query_id
stringlengths
32
32
query
stringlengths
7
4.32k
positive_passages
listlengths
1
1
negative_passages
listlengths
88
101
a0248bad17747eaa21ae23a62b9ab496
work keeps receiving requests, and for each does: reply on the requestorprovided channel the result into the request inform on the balancerprovided channel by sending itself when done
[ { "docid": "9a91a33beb7be5274891f809287a17c4", "score": "0.7065281", "text": "func (w *Worker) work(done chan<- *Worker) {\n\tfor {\n\t\treq := <-w.requests // get requests from load balancer\n\t\treq.c <- req.fn() // do the work and send the answer back to the requestor\n\t\tdone <- w // tell load balancer a task has been completed by worker w.\n\t}\n}", "title": "" } ]
[ { "docid": "358b6eb53bd311d5b6a3cd3b4720b56b", "score": "0.72372615", "text": "func (w *Worker) work(done chan *Worker) {\n\tfor r := range w.requests {\n\t\tresult := r.Fn() // perform job function\n\t\tr.C <- result // response end result to requester\n\t\tdone <- w // report job completion to balancer\n\t}\n}", "title": "" }, { "docid": "d0bc22d2dac177917879a8be8268e5d2", "score": "0.7095953", "text": "func (client *Client) worker() {\n\tvar dialErr = client.Dial()\n\n\tdefer func() {\n\n\t\tclose(client.jobChan)\n\t\tclose(client.jobCancelChan)\n\t\tclient.jobChan = nil\n\t\tclient.jobCancelChan = nil\n\n\t\t// Fail any pending requests with ErrClosed or a dial error\n\t\tvar failReason = ErrClosed\n\t\tif dialErr != nil {\n\t\t\tfailReason = dialErr\n\t\t}\n\n\t\tfor _, resChan := range client.pendingMap {\n\t\t\tresChan <- ServerResponse{\n\t\t\t\tnil,\n\t\t\t\tfailReason,\n\t\t\t}\n\t\t\tclose(resChan)\n\t\t}\n\n\t\tclient.pending.Done()\n\t}()\n\n\tfor {\n\t\tselect {\n\t\tcase <-client.ctx.Done():\n\t\t\treturn\n\t\tcase _, normalShutdown := <-client.closeNotifChan:\n\t\t\tif normalShutdown {\n\t\t\t\treturn\n\t\t\t}\n\n\t\t\t// We lost our connection. Redial endpoint\n\t\t\tdialErr = client.Dial()\n\t\tcase transportMsg, ok := <-client.binding.Messages:\n\t\t\tif !ok {\n\t\t\t\tclient.binding.Messages = nil\n\t\t\t\tcontinue\n\t\t\t}\n\n\t\t\t// Try to match the correlation id to a pending request.\n\t\t\t// If we cannot find a match, ignore the response\n\t\t\tresChan, exists := client.pendingMap[transportMsg.Message.CorrelationId]\n\t\t\tif !exists {\n\t\t\t\tcontinue\n\t\t\t}\n\n\t\t\t// Remove from pending requests send the response and close the channel\n\t\t\tdelete(client.pendingMap, transportMsg.Message.CorrelationId)\n\n\t\t\tvar err error\n\t\t\tif errMsg, exists := transportMsg.Message.Headers[\"error\"]; exists {\n\t\t\t\t// Check for known error types\n\t\t\t\tif errMsg == ErrCancelled.Error() {\n\t\t\t\t\terr = ErrCancelled\n\t\t\t\t} else if errMsg == ErrTimeout.Error() {\n\t\t\t\t\terr = ErrTimeout\n\t\t\t\t} else if errMsg == ErrServiceUnavailable.Error() {\n\t\t\t\t\terr = ErrServiceUnavailable\n\t\t\t\t} else {\n\t\t\t\t\terr = errors.New(errMsg.(string))\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tresChan <- ServerResponse{\n\t\t\t\ttransportMsg.Message,\n\t\t\t\terr,\n\t\t\t}\n\t\t\tclose(resChan)\n\n\t\tcase req := <-client.jobChan:\n\n\t\t\t// Send request; fail immediately if we got a dial error or the send fails\n\t\t\tvar err = dialErr\n\t\t\tif err == nil {\n\t\t\t\treq.msg.ReplyTo = client.binding.Name\n\t\t\t\terr = client.transport.Send(&req.msg)\n\t\t\t}\n\t\t\tif err != nil {\n\t\t\t\treq.resChan <- ServerResponse{\n\t\t\t\t\tnil,\n\t\t\t\t\terr,\n\t\t\t\t}\n\t\t\t\tclose(req.resChan)\n\t\t\t\treturn\n\t\t\t}\n\n\t\t\t// Add the reply channel to the pendingMap using the correlationId\n\t\t\t// as the key so we can match the response later on.\n\t\t\tclient.pendingMap[req.msg.CorrelationId] = req.resChan\n\n\t\tcase correlationId := <-client.jobCancelChan:\n\n\t\t\t// Received a cancellation for a pending request\n\t\t\tresChan, exists := client.pendingMap[correlationId]\n\t\t\tif !exists {\n\t\t\t\tcontinue\n\t\t\t}\n\n\t\t\t// Remove from pending requests send the error and close the channel\n\t\t\tdelete(client.pendingMap, correlationId)\n\n\t\t\tresChan <- ServerResponse{\n\t\t\t\tnil,\n\t\t\t\tErrCancelled,\n\t\t\t}\n\t\t\tclose(resChan)\n\t\t}\n\t}\n}", "title": "" }, { "docid": "be8b55e35e8127e94d331ac1a1f5415a", "score": "0.6855956", "text": "func sendEndWork(channelToSendRequest chan Request, nb int){\n\tfor i := 0 ; i < alpha ; i++{\n\t\tchannelToSendRequest <- Request{nil, true}\n\t}\n}", "title": "" }, { "docid": "2eb0f5f407d1a1ee342e4bf7aa8c6d40", "score": "0.6776557", "text": "func worker(ctx context.Context, i int, msgChan <-chan Message, msgErrChan chan<- Message, url string, wg *sync.WaitGroup) {\n\tdefer wg.Done()\n\n\tvar err error\n\tclient := newHTTPClient()\n\n\tfor m := range msgChan {\n\t\tselect {\n\t\tcase <-ctx.Done():\n\t\t\t// The worker stops sending new messages, adds current message to err channel and exits\n\t\t\tlog.Debug(\"worker:\", i, \"is interrupted\")\n\n\t\t\tselect {\n\t\t\tcase msgErrChan <- m:\n\t\t\t\tlog.Debug(\"worker:\", i, \"added current message to err channel before exit\")\n\t\t\tdefault:\n\t\t\t\tlog.Error(\"worker:\", i, \"err channel is full, could not add current message before exit\")\n\t\t\t}\n\t\t\treturn\n\n\t\tdefault:\n\t\t\t// Sending a message\n\t\t\terr = sendMessageWithClient(client, url, m.Body)\n\t\t\tif err != nil {\n\t\t\t\t// Set the error and move the message into error channel\n\t\t\t\tm.Err = err\n\t\t\t\t// Is Blocked when the error channel is full\n\t\t\t\t// TODO: can be ignored on block\n\t\t\t\tmsgErrChan <- m\n\t\t\t\tcontinue\n\t\t\t}\n\t\t}\n\t}\n\tlog.Info(\"worker:\", i, \"completed\")\n}", "title": "" }, { "docid": "53ba6238765a75eed13bed634f9bc19a", "score": "0.6516422", "text": "func (h *Handler) requestWorker() {\n\tfor job := range h.requests {\n\t\tif h.shutdown {\n\t\t\tbreak\n\t\t}\n\n\t\tvar httpResponse *http.Response\n\t\tvar err error\n\n\t\tif job.Auth {\n\t\t\t<-h.timeLockAuth\n\t\t\tif job.Request.Method != \"GET\" {\n\t\t\t\thttpResponse, err = h.Client.Do(job.Request)\n\t\t\t} else {\n\t\t\t\thttpResponse, err = h.Client.Get(job.Path)\n\t\t\t}\n\t\t\th.timeLockAuth <- 1\n\t\t} else {\n\t\t\t<-h.timeLock\n\t\t\tif job.Request.Method != \"GET\" {\n\t\t\t\thttpResponse, err = h.Client.Do(job.Request)\n\t\t\t} else {\n\t\t\t\thttpResponse, err = h.Client.Get(job.Path)\n\t\t\t}\n\t\t\th.timeLock <- 1\n\t\t}\n\n\t\tfor b := false; !b; {\n\t\t\tselect {\n\t\t\tcase h.responses <- &exchResponse{Response: httpResponse, ResError: err}:\n\t\t\t\tb = true\n\t\t\tdefault:\n\t\t\t\tcontinue\n\t\t\t}\n\t\t}\n\t}\n\th.wg.Done()\n}", "title": "" }, { "docid": "4b70dcdd56a738a77103caf42106d964", "score": "0.6493881", "text": "func (w *dialWorker) loop() {\n\tw.wg.Add(1)\n\tdefer w.wg.Done()\n\tdefer w.s.limiter.clearAllPeerDials(w.peer)\n\n\t// dq is used to pace dials to different addresses of the peer\n\tdq := newDialQueue()\n\t// dialsInFlight is the number of dials in flight.\n\tdialsInFlight := 0\n\n\tstartTime := w.cl.Now()\n\t// dialTimer is the dialTimer used to trigger dials\n\tdialTimer := w.cl.InstantTimer(startTime.Add(math.MaxInt64))\n\ttimerRunning := true\n\t// scheduleNextDial updates timer for triggering the next dial\n\tscheduleNextDial := func() {\n\t\tif timerRunning && !dialTimer.Stop() {\n\t\t\t<-dialTimer.Ch()\n\t\t}\n\t\ttimerRunning = false\n\t\tif dq.len() > 0 {\n\t\t\tif dialsInFlight == 0 && !w.connected {\n\t\t\t\t// if there are no dials in flight, trigger the next dials immediately\n\t\t\t\tdialTimer.Reset(startTime)\n\t\t\t} else {\n\t\t\t\tdialTimer.Reset(startTime.Add(dq.top().Delay))\n\t\t\t}\n\t\t\ttimerRunning = true\n\t\t}\n\t}\n\n\t// totalDials is used to track number of dials made by this worker for metrics\n\ttotalDials := 0\nloop:\n\tfor {\n\t\t// The loop has three parts\n\t\t// 1. Input requests are received on w.reqch. If a suitable connection is not available we create\n\t\t// a pendRequest object to track the dialRequest and add the addresses to dq.\n\t\t// 2. Addresses from the dialQueue are dialed at appropriate time intervals depending on delay logic.\n\t\t// We are notified of the completion of these dials on w.resch.\n\t\t// 3. Responses for dials are received on w.resch. On receiving a response, we updated the pendRequests\n\t\t// interested in dials on this address.\n\n\t\tselect {\n\t\tcase req, ok := <-w.reqch:\n\t\t\tif !ok {\n\t\t\t\tif w.s.metricsTracer != nil {\n\t\t\t\t\tw.s.metricsTracer.DialCompleted(w.connected, totalDials)\n\t\t\t\t}\n\t\t\t\treturn\n\t\t\t}\n\t\t\t// We have received a new request. If we do not have a suitable connection,\n\t\t\t// track this dialRequest with a pendRequest.\n\t\t\t// Enqueue the peer's addresses relevant to this request in dq and\n\t\t\t// track dials to the addresses relevant to this request.\n\n\t\t\tc, err := w.s.bestAcceptableConnToPeer(req.ctx, w.peer)\n\t\t\tif c != nil || err != nil {\n\t\t\t\treq.resch <- dialResponse{conn: c, err: err}\n\t\t\t\tcontinue loop\n\t\t\t}\n\n\t\t\taddrs, addrErrs, err := w.s.addrsForDial(req.ctx, w.peer)\n\t\t\tif err != nil {\n\t\t\t\treq.resch <- dialResponse{\n\t\t\t\t\terr: &DialError{\n\t\t\t\t\t\tPeer: w.peer,\n\t\t\t\t\t\tDialErrors: addrErrs,\n\t\t\t\t\t\tCause: err,\n\t\t\t\t\t}}\n\t\t\t\tcontinue loop\n\t\t\t}\n\n\t\t\t// get the delays to dial these addrs from the swarms dialRanker\n\t\t\tsimConnect, _, _ := network.GetSimultaneousConnect(req.ctx)\n\t\t\taddrRanking := w.rankAddrs(addrs, simConnect)\n\t\t\taddrDelay := make(map[string]time.Duration, len(addrRanking))\n\n\t\t\t// create the pending request object\n\t\t\tpr := &pendRequest{\n\t\t\t\treq: req,\n\t\t\t\taddrs: make(map[string]struct{}, len(addrRanking)),\n\t\t\t\terr: &DialError{Peer: w.peer, DialErrors: addrErrs},\n\t\t\t}\n\t\t\tfor _, adelay := range addrRanking {\n\t\t\t\tpr.addrs[string(adelay.Addr.Bytes())] = struct{}{}\n\t\t\t\taddrDelay[string(adelay.Addr.Bytes())] = adelay.Delay\n\t\t\t}\n\n\t\t\t// Check if dials to any of the addrs have completed already\n\t\t\t// If they have errored, record the error in pr. If they have succeeded,\n\t\t\t// respond with the connection.\n\t\t\t// If they are pending, add them to tojoin.\n\t\t\t// If we haven't seen any of the addresses before, add them to todial.\n\t\t\tvar todial []ma.Multiaddr\n\t\t\tvar tojoin []*addrDial\n\n\t\t\tfor _, adelay := range addrRanking {\n\t\t\t\tad, ok := w.trackedDials[string(adelay.Addr.Bytes())]\n\t\t\t\tif !ok {\n\t\t\t\t\ttodial = append(todial, adelay.Addr)\n\t\t\t\t\tcontinue\n\t\t\t\t}\n\n\t\t\t\tif ad.conn != nil {\n\t\t\t\t\t// dial to this addr was successful, complete the request\n\t\t\t\t\treq.resch <- dialResponse{conn: ad.conn}\n\t\t\t\t\tcontinue loop\n\t\t\t\t}\n\n\t\t\t\tif ad.err != nil {\n\t\t\t\t\t// dial to this addr errored, accumulate the error\n\t\t\t\t\tpr.err.recordErr(ad.addr, ad.err)\n\t\t\t\t\tdelete(pr.addrs, string(ad.addr.Bytes()))\n\t\t\t\t\tcontinue\n\t\t\t\t}\n\n\t\t\t\t// dial is still pending, add to the join list\n\t\t\t\ttojoin = append(tojoin, ad)\n\t\t\t}\n\n\t\t\tif len(todial) == 0 && len(tojoin) == 0 {\n\t\t\t\t// all request applicable addrs have been dialed, we must have errored\n\t\t\t\tpr.err.Cause = ErrAllDialsFailed\n\t\t\t\treq.resch <- dialResponse{err: pr.err}\n\t\t\t\tcontinue loop\n\t\t\t}\n\n\t\t\t// The request has some pending or new dials\n\t\t\tw.pendingRequests[pr] = struct{}{}\n\n\t\t\tfor _, ad := range tojoin {\n\t\t\t\tif !ad.dialed {\n\t\t\t\t\t// we haven't dialed this address. update the ad.ctx to have simultaneous connect values\n\t\t\t\t\t// set correctly\n\t\t\t\t\tif simConnect, isClient, reason := network.GetSimultaneousConnect(req.ctx); simConnect {\n\t\t\t\t\t\tif simConnect, _, _ := network.GetSimultaneousConnect(ad.ctx); !simConnect {\n\t\t\t\t\t\t\tad.ctx = network.WithSimultaneousConnect(ad.ctx, isClient, reason)\n\t\t\t\t\t\t\t// update the element in dq to use the simultaneous connect delay.\n\t\t\t\t\t\t\tdq.Add(network.AddrDelay{\n\t\t\t\t\t\t\t\tAddr: ad.addr,\n\t\t\t\t\t\t\t\tDelay: addrDelay[string(ad.addr.Bytes())],\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\t// add the request to the addrDial\n\t\t\t}\n\n\t\t\tif len(todial) > 0 {\n\t\t\t\tnow := time.Now()\n\t\t\t\t// these are new addresses, track them and add them to dq\n\t\t\t\tfor _, a := range todial {\n\t\t\t\t\tw.trackedDials[string(a.Bytes())] = &addrDial{\n\t\t\t\t\t\taddr: a,\n\t\t\t\t\t\tctx: req.ctx,\n\t\t\t\t\t\tcreatedAt: now,\n\t\t\t\t\t}\n\t\t\t\t\tdq.Add(network.AddrDelay{Addr: a, Delay: addrDelay[string(a.Bytes())]})\n\t\t\t\t}\n\t\t\t}\n\t\t\t// setup dialTimer for updates to dq\n\t\t\tscheduleNextDial()\n\n\t\tcase <-dialTimer.Ch():\n\t\t\t// It's time to dial the next batch of addresses.\n\t\t\t// We don't check the delay of the addresses received from the queue here\n\t\t\t// because if the timer triggered before the delay, it means that all\n\t\t\t// the inflight dials have errored and we should dial the next batch of\n\t\t\t// addresses\n\t\t\tnow := time.Now()\n\t\t\tfor _, adelay := range dq.NextBatch() {\n\t\t\t\t// spawn the dial\n\t\t\t\tad, ok := w.trackedDials[string(adelay.Addr.Bytes())]\n\t\t\t\tif !ok {\n\t\t\t\t\tlog.Errorf(\"SWARM BUG: no entry for address %s in trackedDials\", adelay.Addr)\n\t\t\t\t\tcontinue\n\t\t\t\t}\n\t\t\t\tad.dialed = true\n\t\t\t\tad.dialRankingDelay = now.Sub(ad.createdAt)\n\t\t\t\terr := w.s.dialNextAddr(ad.ctx, w.peer, ad.addr, w.resch)\n\t\t\t\tif err != nil {\n\t\t\t\t\t// Errored without attempting a dial. This happens in case of\n\t\t\t\t\t// backoff or black hole.\n\t\t\t\t\tw.dispatchError(ad, err)\n\t\t\t\t} else {\n\t\t\t\t\t// the dial was successful. update inflight dials\n\t\t\t\t\tdialsInFlight++\n\t\t\t\t\ttotalDials++\n\t\t\t\t}\n\t\t\t}\n\t\t\ttimerRunning = false\n\t\t\t// schedule more dials\n\t\t\tscheduleNextDial()\n\n\t\tcase res := <-w.resch:\n\t\t\t// A dial to an address has completed.\n\t\t\t// Update all requests waiting on this address. On success, complete the request.\n\t\t\t// On error, record the error\n\n\t\t\tdialsInFlight--\n\t\t\tad, ok := w.trackedDials[string(res.Addr.Bytes())]\n\t\t\tif !ok {\n\t\t\t\tlog.Errorf(\"SWARM BUG: no entry for address %s in trackedDials\", res.Addr)\n\t\t\t\tif res.Conn != nil {\n\t\t\t\t\tres.Conn.Close()\n\t\t\t\t}\n\t\t\t\tcontinue\n\t\t\t}\n\n\t\t\tif res.Conn != nil {\n\t\t\t\t// we got a connection, add it to the swarm\n\t\t\t\tconn, err := w.s.addConn(res.Conn, network.DirOutbound)\n\t\t\t\tif err != nil {\n\t\t\t\t\t// oops no, we failed to add it to the swarm\n\t\t\t\t\tres.Conn.Close()\n\t\t\t\t\tw.dispatchError(ad, err)\n\t\t\t\t\tcontinue loop\n\t\t\t\t}\n\n\t\t\t\tfor pr := range w.pendingRequests {\n\t\t\t\t\tif _, ok := pr.addrs[string(ad.addr.Bytes())]; ok {\n\t\t\t\t\t\tpr.req.resch <- dialResponse{conn: conn}\n\t\t\t\t\t\tdelete(w.pendingRequests, pr)\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tad.conn = conn\n\t\t\t\tif !w.connected {\n\t\t\t\t\tw.connected = true\n\t\t\t\t\tif w.s.metricsTracer != nil {\n\t\t\t\t\t\tw.s.metricsTracer.DialRankingDelay(ad.dialRankingDelay)\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tcontinue loop\n\t\t\t}\n\n\t\t\t// it must be an error -- add backoff if applicable and dispatch\n\t\t\t// ErrDialRefusedBlackHole shouldn't end up here, just a safety check\n\t\t\tif res.Err != ErrDialRefusedBlackHole && res.Err != context.Canceled && !w.connected {\n\t\t\t\t// we only add backoff if there has not been a successful connection\n\t\t\t\t// for consistency with the old dialer behavior.\n\t\t\t\tw.s.backf.AddBackoff(w.peer, res.Addr)\n\t\t\t} else if res.Err == ErrDialRefusedBlackHole {\n\t\t\t\tlog.Errorf(\"SWARM BUG: unexpected ErrDialRefusedBlackHole while dialing peer %s to addr %s\",\n\t\t\t\t\tw.peer, res.Addr)\n\t\t\t}\n\n\t\t\tw.dispatchError(ad, res.Err)\n\t\t\t// Only schedule next dial on error.\n\t\t\t// If we scheduleNextDial on success, we will end up making one dial more than\n\t\t\t// required because the final successful dial will spawn one more dial\n\t\t\tscheduleNextDial()\n\t\t}\n\t}\n}", "title": "" }, { "docid": "a9cbd30156abe52e000cb926a81f5579", "score": "0.64816785", "text": "func startWorker(reqChan <-chan string, resChan chan<- response) {\n\tclient := http.Client{Timeout: defaultTimeInSec * time.Second}\n\tfor req := range reqChan {\n\t\tadd, err := getFormattedAddress(req)\n\t\tif err != nil {\n\t\t\tresChan <- response{address: req, err: err}\n\t\t\tcontinue\n\t\t}\n\t\tresp, err := fetch(add, &client)\n\t\tif err != nil {\n\t\t\tresChan <- response{address: add, err: err}\n\t\t\tcontinue\n\t\t}\n\n\t\thash := fmt.Sprintf(\"%x\", md5.Sum(resp))\n\t\tresChan <- response{address: add, hash: hash}\n\t}\n}", "title": "" }, { "docid": "4f008d10c093fe4b1ed247eea83738d4", "score": "0.6480713", "text": "func (c *Client) DoChannel(reqch <-chan *Request, respch chan<- *Response) {\n\t// TODO: enable cancelling of batch jobs\n\tfor req := range reqch {\n\t\tresp := c.Do(req)\n\t\trespch <- resp\n\t\t<-resp.Done\n\t}\n}", "title": "" }, { "docid": "ac2e9318b2a0537cda51b810044ac2aa", "score": "0.64709604", "text": "func (a *Agent) processRequests(conn *ssh.Client) error {\n\tdefer conn.Close()\n\tticker := time.NewTicker(defaults.ReverseTunnelAgentHeartbeatPeriod)\n\tdefer ticker.Stop()\n\n\thb, reqC, err := conn.OpenChannel(chanHeartbeat, nil)\n\tif err != nil {\n\t\treturn trace.Wrap(err)\n\t}\n\tnewTransportC := conn.HandleChannelOpen(chanTransport)\n\tnewDiscoveryC := conn.HandleChannelOpen(chanDiscovery)\n\n\t// send first ping right away, then start a ping timer:\n\thb.SendRequest(\"ping\", false, nil)\n\n\tfor {\n\t\tselect {\n\t\t// need to exit:\n\t\tcase <-a.ctx.Done():\n\t\t\treturn trace.ConnectionProblem(nil, \"heartbeat: agent is stopped\")\n\t\t// time to ping:\n\t\tcase <-ticker.C:\n\t\t\tbytes, _ := a.Clock.Now().UTC().MarshalText()\n\t\t\t_, err := hb.SendRequest(\"ping\", false, bytes)\n\t\t\tif err != nil {\n\t\t\t\tlog.Error(err)\n\t\t\t\treturn trace.Wrap(err)\n\t\t\t}\n\t\t\ta.Debugf(\"ping -> %v\", conn.RemoteAddr())\n\t\t// ssh channel closed:\n\t\tcase req := <-reqC:\n\t\t\tif req == nil {\n\t\t\t\treturn trace.ConnectionProblem(nil, \"heartbeat: connection closed\")\n\t\t\t}\n\t\t// new transport request:\n\t\tcase nch := <-newTransportC:\n\t\t\tif nch == nil {\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\ta.Debugf(\"transport request: %v\", nch.ChannelType())\n\t\t\tch, req, err := nch.Accept()\n\t\t\tif err != nil {\n\t\t\t\ta.Warningf(\"failed to accept request: %v\", err)\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tgo a.proxyTransport(ch, req)\n\t\t// new discovery request\n\t\tcase nch := <-newDiscoveryC:\n\t\t\tif nch == nil {\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\ta.Debugf(\"discovery request: %v\", nch.ChannelType())\n\t\t\tch, req, err := nch.Accept()\n\t\t\tif err != nil {\n\t\t\t\ta.Warningf(\"failed to accept request: %v\", err)\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tgo a.handleDiscovery(ch, req)\n\t\t}\n\t}\n}", "title": "" }, { "docid": "8d57e182f5ae5005bcf1306e5fe5c2f0", "score": "0.63834006", "text": "func (w *worker) process(c Frontend_ProcessClient) error {\n\t// Build a child context so we can cancel querie when the stream is closed.\n\tctx, cancel := context.WithCancel(c.Context())\n\tdefer cancel()\n\n\tfor {\n\t\trequest, err := c.Recv()\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\t// Handle the request on a \"background\" goroutine, so we go back to\n\t\t// blocking on c.Recv(). This allows us to detect the stream closing\n\t\t// and cancel the query. We don't actally handle queries in parallel\n\t\t// here, as we're running in lock step with the server - each Recv is\n\t\t// paired with a Send.\n\t\tgo func() {\n\t\t\tresponse, err := w.server.Handle(ctx, request.HttpRequest)\n\t\t\tif err != nil {\n\t\t\t\tvar ok bool\n\t\t\t\tresponse, ok = httpgrpc.HTTPResponseFromError(err)\n\t\t\t\tif !ok {\n\t\t\t\t\tresponse = &httpgrpc.HTTPResponse{\n\t\t\t\t\t\tCode: http.StatusInternalServerError,\n\t\t\t\t\t\tBody: []byte(err.Error()),\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t// Ensure responses that are too big are not retried.\n\t\t\tif len(response.Body) >= w.cfg.GRPCClientConfig.MaxSendMsgSize {\n\t\t\t\terrMsg := fmt.Sprintf(\"response larger than the max (%d vs %d)\", len(response.Body), w.cfg.GRPCClientConfig.MaxSendMsgSize)\n\t\t\t\tresponse = &httpgrpc.HTTPResponse{\n\t\t\t\t\tCode: http.StatusRequestEntityTooLarge,\n\t\t\t\t\tBody: []byte(errMsg),\n\t\t\t\t}\n\t\t\t\tlevel.Error(w.log).Log(\"msg\", \"error processing query\", \"err\", errMsg)\n\t\t\t}\n\n\t\t\tif err := c.Send(&ProcessResponse{\n\t\t\t\tHttpResponse: response,\n\t\t\t}); err != nil {\n\t\t\t\tlevel.Error(w.log).Log(\"msg\", \"error processing requests\", \"err\", err)\n\t\t\t}\n\t\t}()\n\t}\n}", "title": "" }, { "docid": "26e63fec0e021f676c6d3795874f8916", "score": "0.63574445", "text": "func worker(myChan *WorkerChannel, freeChan chan *WorkerChannel, respChan chan interface{}, id int) {\n\tgo func() {\n\t\tfor {\n\t\t\tselect {\n\t\t\tcase data := <-myChan.Receiver:\n\t\t\t\t// Processing task\n\t\t\t\tresult := myChan.ChanTask.Run(data)\n\t\t\t\trespChan <- result\n\t\t\t\t// Done let me ask for more work.\n\t\t\t\tfreeChan <- myChan\n\t\t\tcase <-myChan.Finisher:\n\t\t\t\tclose(myChan.Receiver)\n\t\t\t\tclose(myChan.Finisher)\n\t\t\t\treturn\n\t\t\t}\n\t\t}\n\t}()\n}", "title": "" }, { "docid": "418b6892d6509c0f8145eaa7b7b34e4f", "score": "0.6343826", "text": "func (n *dummy) process(j job.Job) {\n\n\t////////////////////////////////////////////\n\t// DUMMY NODE WON'T DO WORK SO JUST FORWARD.\n\n\tresponseChan := n.sendNexts(j.Context, j.Payload.(payload.Bytes), j.Data)\n\n\t// Await Responses\n\tResponse := n.waitResponses(responseChan)\n\n\t// Send Response back.\n\tj.ResponseChan <- Response\n}", "title": "" }, { "docid": "3fe1d4c444ceaaefe986414f2ea258e2", "score": "0.6341805", "text": "func (rs *Service) loop() {\n\tvar err error\n\tvar ok bool\n\tvar m *network.MessageToPhoton\n\tvar st transfer.StateChange\n\tvar req *apiReq\n\tvar sentMessage *protocolMessage\n\n\tdefer rpanic.PanicRecover(\"photon service\")\n\tfor {\n\t\tselect {\n\t\t//message from other nodes\n\t\tcase m, ok = <-rs.Protocol.ReceivedMessageChan:\n\t\t\tif ok {\n\t\t\t\terr = rs.MessageHandler.onMessage(m.Msg, m.EchoHash)\n\t\t\t\tif err != nil {\n\t\t\t\t\tlog.Error(fmt.Sprintf(\"MessageHandler.onMessage %v\", err))\n\t\t\t\t}\n\t\t\t\trs.Protocol.ReceivedMessageResultChan <- err\n\t\t\t} else {\n\t\t\t\tlog.Info(\"Protocol.ReceivedMessageChan closed\")\n\t\t\t\treturn\n\t\t\t}\n\t\t\t// contract events from block chain\n\t\tcase st, ok = <-rs.BlockChainEvents.StateChangeChannel:\n\t\t\tif ok {\n\t\t\t\tblockStateChange, ok2 := st.(*transfer.BlockStateChange)\n\t\t\t\tif ok2 {\n\t\t\t\t\trs.handleBlockNumber(blockStateChange)\n\t\t\t\t} else {\n\t\t\t\t\tlog.Trace(fmt.Sprintf(\"statechange received :%s\", utils.StringInterface(st, 2)))\n\t\t\t\t\t_, isHistoryComplete := st.(*mediatedtransfer.ContractHistoryEventCompleteStateChange)\n\t\t\t\t\tif isHistoryComplete {\n\t\t\t\t\t\tif rs.ChanHistoryContractEventsDealComplete != nil {\n\t\t\t\t\t\t\tclose(rs.ChanHistoryContractEventsDealComplete)\n\t\t\t\t\t\t\trs.ChanHistoryContractEventsDealComplete = nil\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tpanic(\"only can receive ContractHistoryEventCompleteStateChange once\")\n\t\t\t\t\t\t}\n\t\t\t\t\t} else {\n\t\t\t\t\t\terr = rs.StateMachineEventHandler.OnBlockchainStateChange(st)\n\t\t\t\t\t\tif err != nil {\n\t\t\t\t\t\t\tlog.Error(fmt.Sprintf(\"stateMachineEventHandler.OnBlockchainStateChange %s\", err))\n\t\t\t\t\t\t}\n\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t} else {\n\t\t\t\tlog.Info(\"Events.StateChangeChannel closed\")\n\t\t\t\treturn\n\t\t\t}\n\t\t//user's request\n\t\tcase req, ok = <-rs.UserReqChan:\n\t\t\tif ok {\n\t\t\t\trs.handleReq(req)\n\t\t\t} else {\n\t\t\t\tlog.Info(\"req closed\")\n\t\t\t\treturn\n\t\t\t}\n\t\t\t//i have sent a message complete\n\t\tcase sentMessage, ok = <-rs.ProtocolMessageSendComplete:\n\t\t\tif ok {\n\t\t\t\trs.handleSentMessage(sentMessage)\n\t\t\t} else {\n\t\t\t\tlog.Info(\"ProtocolMessageSendComplete closed\")\n\t\t\t\treturn\n\t\t\t}\n\t\tcase s := <-rs.Chain.Client.StatusChan:\n\t\t\tselect {\n\t\t\tcase rs.EthConnectionStatus <- s:\n\t\t\tdefault:\n\t\t\t\t//never block\n\t\t\t}\n\t\t\tif s == netshare.Connected {\n\t\t\t\trs.handleEthRPCConnectionOK()\n\t\t\t} else {\n\t\t\t\trs.NotifyHandler.NotifyString(notify.LevelWarn, \"公链连接失败,正在尝试重连\")\n\t\t\t}\n\t\tcase <-rs.quitChan:\n\t\t\tlog.Info(fmt.Sprintf(\"%s quit now\", utils.APex2(rs.NodeAddress)))\n\t\t\treturn\n\t\t}\n\t}\n}", "title": "" }, { "docid": "705e691b52f93303b9ca9ad289fe649e", "score": "0.6325141", "text": "func testWorkRequester(in chan<- PAMessage) {\n\tfmt.Println(\"Start Goroutine for Job Requests\")\n\tfor i := 1; i <= 5; i++ {\n\t\tin <- PAMessage{code: i, subtype: i + 1}\n\t}\n\tclose(in)\n}", "title": "" }, { "docid": "7b2c7bfb9ccc5b72b0a1b5f8fb402f2b", "score": "0.6291241", "text": "func initDispatcher(workerCount int) { // number of workers\n\n// Initializing the common channel where the workers will wait for the work. \t\nworkerQueue := make(chan chan RequestStructure, workerCount)\n\n// Depending on the count, creating the required number of workers.\n\tfor i := 0; i < workerCount; i++ {\n\t\tfmt.Println(\"From Dispatcher : Starting Worker\", i+1)\n\t\tworker := makeWorker(i+1, workerQueue)\n\t\tgo worker.initWorker()\n\t}\n\n// Outer Anonymous Go routine.\n\tgo func() {\n\t\tfor {\n\t\t\tselect {\n// Pull off work request from the queue\n\t\t\tcase work := <-catcherQueue:\n\t\t\t\tfmt.Println(\"From Dispatcher : Received work requeust\")\n// Inner Anonymous Go routine.\n\t\t\t\tgo func() {\n\t\t\t\t\tworker := <-workerQueue\n\t\t\t\t\tfmt.Println(\"From Dispatcher : Dispatching work request\")\n// Send the work request to worker.\n\t\t\t\t\tworker <- work\n\t\t\t\t}()\n\t\t\t}\n\t\t}\n\t}()\n}", "title": "" }, { "docid": "d921b22189cb1008cd963971090d7797", "score": "0.6288387", "text": "func (s *Server) handleChannels(chans <-chan ssh.NewChannel, sshConn ssh.Conn) {\n\t// Service the incoming Channel channel.\n\tfor newChannel := range chans {\n\n\t\tlog.Printf(\"Received channel: %v\", newChannel.ChannelType())\n\t\t// Check the type of channel\n\t\tif t := newChannel.ChannelType(); t != s.ChannelName {\n\t\t\tnewChannel.Reject(ssh.UnknownChannelType, fmt.Sprintf(\"unknown channel type: %s\", t))\n\t\t\tcontinue\n\t\t}\n\t\tchannel, requests, err := newChannel.Accept()\n\t\tif err != nil {\n\t\t\tlog.Printf(\"could not accept channel (%s)\", err)\n\t\t\tcontinue\n\t\t}\n\t\tlog.Printf(\"Accepted channel\")\n\n\t\t// Channels can have out-of-band requests\n\t\tgo func(in <-chan *ssh.Request) {\n\t\t\tfor req := range in {\n\t\t\t\tok := false\n\t\t\t\tswitch req.Type {\n\n\t\t\t\tcase \"subsystem\":\n\t\t\t\t\tok = true\n\t\t\t\t\tlog.Printf(\"subsystem '%s'\", req.Payload[4:])\n\t\t\t\t\tswitch string(req.Payload[4:]) {\n\t\t\t\t\t//RPCSubsystem Request made indicates client desires RPC Server access\n\t\t\t\t\tcase RPCSubsystem:\n\t\t\t\t\t\tgo s.ServeConn(channel)\n\t\t\t\t\t\tlog.Printf(\"Started SSH RPC\")\n\t\t\t\t\t\t// triggers reverse RPC connection as well\n\t\t\t\t\t\tclientChannel, err := openRPCClientChannel(sshConn, s.ChannelName+\"-reverse\")\n\t\t\t\t\t\tif err != nil {\n\t\t\t\t\t\t\tlog.Printf(\"Failed to create client channel: \" + err.Error())\n\t\t\t\t\t\t\tcontinue\n\t\t\t\t\t\t}\n\t\t\t\t\t\trpcClient := rpc.NewClient(clientChannel)\n\t\t\t\t\t\tif s.CallbackFunc != nil {\n\t\t\t\t\t\t\ts.CallbackFunc(rpcClient, sshConn)\n\t\t\t\t\t\t}\n\t\t\t\t\t\tlog.Printf(\"Started SSH RPC client\")\n\t\t\t\t\tdefault:\n\t\t\t\t\t\tlog.Printf(\"Unknown subsystem: %s\", req.Payload)\n\t\t\t\t\t}\n\n\t\t\t\t}\n\t\t\t\tif !ok {\n\t\t\t\t\tlog.Printf(\"declining %s request...\", req.Type)\n\t\t\t\t}\n\t\t\t\treq.Reply(ok, nil)\n\t\t\t}\n\t\t}(requests)\n\t}\n}", "title": "" }, { "docid": "f34a6f4f36c37b320d626732c2101ac2", "score": "0.6279595", "text": "func (w *work) requestHandler() *work {\r\n\tw.submit = make(chan Request, w.workers)\r\n\tfor i := 0; i < w.workers; i++ {\r\n\t\tw.wg.Add(1)\r\n\t\tgo func() {\r\n\t\t\tdefer w.wg.Done()\r\n\t\t\tfor {\r\n\t\t\t\tp, done := <-w.submit\r\n\t\t\t\tif !done {\r\n\t\t\t\t\treturn\r\n\t\t\t\t}\r\n\t\t\t\tw.doRequest(p)\r\n\t\t\t\tif w.params.Progress != nil {\r\n\t\t\t\t\tw.params.Progress <- p.index\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}()\r\n\t}\r\n\tfor _, e := range w.params.Requests {\r\n\t\tw.submit <- e\r\n\t}\r\n\tclose(w.submit)\r\n\tw.wg.Wait()\r\n\tw.sortResponse()\r\n\treturn w\r\n}", "title": "" }, { "docid": "02909b376cf5695a74e0ce3f81c7fbed", "score": "0.62629616", "text": "func (c *Client) dispatch(ctx context.Context, conn *websocket.Conn) {\n\t// drain the channel to avoid blocking\n\tdefer func() {\n\t\tfmt.Println(\"Client.dispatch(): drain channels to avoid blocking\")\n\t\tfor reqSent := range c.requestDone {\n\t\t\tif c.deliveryMap == nil {\n\t\t\t\tcontinue\n\t\t\t}\n\n\t\t\tc.deliveryMap.removeRequestOp(reqSent.id, reqSent.response)\n\t\t}\n\t\tfor range c.requestOps {\n\t\t}\n\t}()\n\n\tfor {\n\t\tselect {\n\t\tcase req := <-c.requestOps:\n\t\t\tif conn == nil {\n\t\t\t\tfmt.Printf(\"Client.dispatch(): failed to receive the call request since there is no active websocket connection\\n\")\n\n\t\t\t\treq.err <- errNilConnection\n\t\t\t\treturn\n\t\t\t}\n\n\t\t\tmsg, err := encodeClientRequest(req.id, req.method, req.args)\n\t\t\tif err != nil {\n\t\t\t\tfmt.Printf(\"Client.dispatch(): failed to encode the client request as a json rpc call. Error: %s\\n\", err.Error())\n\n\t\t\t\treq.err <- err\n\t\t\t\tcontinue\n\t\t\t}\n\n\t\t\terr = conn.WriteMessage(websocket.BinaryMessage, msg)\n\t\t\tif err != nil {\n\t\t\t\tfmt.Printf(\"Client.dispatch(): failed to send the call request through the websocket connection. Error: %s\\n\", err.Error())\n\n\t\t\t\treq.err <- err\n\t\t\t\treturn\n\t\t\t}\n\n\t\t\tfmt.Printf(\"Client.dispatch(): successfully send the call request through the websocket connection. Request:{id: %s, method: %s, params: %v}\\n\", req.id, req.method, req.args)\n\t\tcase reqSent := <-c.requestDone:\n\t\t\tif c.deliveryMap == nil {\n\t\t\t\tfmt.Printf(\"Client.dispatch(): found empty delivery map. Client should be reinialized...\\n\")\n\n\t\t\t\tcontinue\n\t\t\t}\n\n\t\t\tc.deliveryMap.removeRequestOp(reqSent.id, reqSent.response)\n\t\tcase <-ctx.Done():\n\t\t\tfmt.Printf(\"Client.dispatch(): the connection has been closed. Abort the process loop...\\n\")\n\n\t\t\treturn\n\t\t}\n\t}\n}", "title": "" }, { "docid": "648663f34266242e4174f53a4b1b4701", "score": "0.62551224", "text": "func (s *Server) handleRequests(reqs <-chan *ssh.Request) {\n\tfor req := range reqs {\n\t\tlog.Printf(\"recieved out-of-band request: %+v\", req)\n\t}\n}", "title": "" }, { "docid": "a6c79b927ce664f01b821a60f1d00e81", "score": "0.6221504", "text": "func sendRequests(count int, namespace, revName string, respCh chan *httptest.ResponseRecorder, handler activationHandler) {\n\tfor i := 0; i < count; i++ {\n\t\tgo func() {\n\t\t\trespCh <- sendRequest(namespace, revName, handler)\n\t\t}()\n\t}\n}", "title": "" }, { "docid": "31094af0950cd549163cbac707febe6a", "score": "0.62103873", "text": "func sendLoop(dnsConn net.PacketConn, ttConn *turbotunnel.QueuePacketConn, ch <-chan *record, maxEncodedPayload int) error {\n\tvar nextRec *record\n\tfor {\n\t\trec := nextRec\n\t\tnextRec = nil\n\n\t\tif rec == nil {\n\t\t\tvar ok bool\n\t\t\trec, ok = <-ch\n\t\t\tif !ok {\n\t\t\t\tbreak\n\t\t\t}\n\t\t}\n\n\t\tif rec.Resp.Rcode() == dns.RcodeNoError && len(rec.Resp.Question) == 1 {\n\t\t\t// If it's a non-error response, we can fill the Answer\n\t\t\t// section with downstream packets.\n\n\t\t\t// Any changes to how responses are built need to happen\n\t\t\t// also in computeMaxEncodedPayload.\n\t\t\trec.Resp.Answer = []dns.RR{\n\t\t\t\t{\n\t\t\t\t\tName: rec.Resp.Question[0].Name,\n\t\t\t\t\tType: rec.Resp.Question[0].Type,\n\t\t\t\t\tClass: rec.Resp.Question[0].Class,\n\t\t\t\t\tTTL: responseTTL,\n\t\t\t\t\tData: nil, // will be filled in below\n\t\t\t\t},\n\t\t\t}\n\n\t\t\tvar payload bytes.Buffer\n\t\t\tlimit := maxEncodedPayload\n\t\t\t// We loop and bundle as many packets from OutgoingQueue\n\t\t\t// into the response as will fit. Any packet that would\n\t\t\t// overflow the capacity of the DNS response, we stash\n\t\t\t// to be bundled into a future response.\n\t\t\ttimer := time.NewTimer(maxResponseDelay)\n\t\tloop:\n\t\t\tfor {\n\t\t\t\tvar p []byte\n\t\t\t\tselect {\n\t\t\t\t// Check the nextRec, timer, and stash cases\n\t\t\t\t// before considering the OutgoingQueue case.\n\t\t\t\t// Only if all these cases fail do we enter the\n\t\t\t\t// default arm, where they are checked again in\n\t\t\t\t// addition to OutgoingQueue.\n\t\t\t\tcase nextRec = <-ch:\n\t\t\t\t\t// If there's another response waiting\n\t\t\t\t\t// to be sent, wait no longer for a\n\t\t\t\t\t// payload for this one.\n\t\t\t\t\tbreak loop\n\t\t\t\tcase <-timer.C:\n\t\t\t\t\tbreak loop\n\t\t\t\tcase p = <-ttConn.Unstash(rec.ClientID):\n\t\t\t\tdefault:\n\t\t\t\t\tselect {\n\t\t\t\t\tcase nextRec = <-ch:\n\t\t\t\t\t\tbreak loop\n\t\t\t\t\tcase <-timer.C:\n\t\t\t\t\t\tbreak loop\n\t\t\t\t\tcase p = <-ttConn.Unstash(rec.ClientID):\n\t\t\t\t\tcase p = <-ttConn.OutgoingQueue(rec.ClientID):\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\t// We wait for the first packet in a bundle\n\t\t\t\t// only. The second and later packets must be\n\t\t\t\t// immediately available or they will be omitted\n\t\t\t\t// from this bundle.\n\t\t\t\ttimer.Reset(0)\n\n\t\t\t\tlimit -= 2 + len(p)\n\t\t\t\tif payload.Len() == 0 {\n\t\t\t\t\t// No packet length check for the first\n\t\t\t\t\t// packet; if it's too large, we allow\n\t\t\t\t\t// it to be truncated and dropped by the\n\t\t\t\t\t// receiver.\n\t\t\t\t} else if limit < 0 {\n\t\t\t\t\t// Stash this packet to send in the next\n\t\t\t\t\t// response.\n\t\t\t\t\tttConn.Stash(p, rec.ClientID)\n\t\t\t\t\tbreak loop\n\t\t\t\t}\n\t\t\t\tif int(uint16(len(p))) != len(p) {\n\t\t\t\t\tpanic(len(p))\n\t\t\t\t}\n\t\t\t\tbinary.Write(&payload, binary.BigEndian, uint16(len(p)))\n\t\t\t\tpayload.Write(p)\n\t\t\t}\n\t\t\ttimer.Stop()\n\n\t\t\trec.Resp.Answer[0].Data = dns.EncodeRDataTXT(payload.Bytes())\n\t\t}\n\n\t\tbuf, err := rec.Resp.WireFormat()\n\t\tif err != nil {\n\t\t\tlog.Printf(\"resp WireFormat: %v\", err)\n\t\t\tcontinue\n\t\t}\n\t\t// Truncate if necessary.\n\t\t// https://tools.ietf.org/html/rfc1035#section-4.1.1\n\t\tif len(buf) > maxUDPPayload {\n\t\t\tlog.Printf(\"truncating response of %d bytes to max of %d\", len(buf), maxUDPPayload)\n\t\t\tbuf = buf[:maxUDPPayload]\n\t\t\tbuf[2] |= 0x02 // TC = 1\n\t\t}\n\n\t\t// Now we actually send the message as a UDP packet.\n\t\t_, err = dnsConn.WriteTo(buf, rec.Addr)\n\t\tif err != nil {\n\t\t\tif err, ok := err.(net.Error); ok && err.Temporary() {\n\t\t\t\tlog.Printf(\"WriteTo temporary error: %v\", err)\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\treturn err\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "87fbf27da66e64e818f1fb8c96bcbebb", "score": "0.6189996", "text": "func (n *nodeSession) loopForRequest() error {\r\n\tfor {\r\n\t\tselect {\r\n\t\tcase <-n.tom.Dying():\r\n\t\t\treturn n.tom.Err()\r\n\t\tcase req := <-n.reqc:\r\n\t\t\tn.mu.Lock()\r\n\t\t\tn.pendingResp[req.call.SeqId] = req\r\n\t\t\tn.mu.Unlock()\r\n\r\n\t\t\tif err := n.writeRequest(req.call); err != nil {\r\n\t\t\t\tn.logger.Printf(\"failed to send request to %s: %s\", n, err)\r\n\r\n\t\t\t\t// notify the rpc caller.\r\n\t\t\t\treq.call.Err = err\r\n\t\t\t\tn.notifyCallerAndDrop(req)\r\n\r\n\t\t\t\t// don give up if there's still hope\r\n\t\t\t\tif !rpc.IsNetworkTimeoutErr(err) {\r\n\t\t\t\t\treturn nil\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n}", "title": "" }, { "docid": "c6aa55e905e452372187b84d9347ac68", "score": "0.6182534", "text": "func (req *RequestMessage) dispatch(config CatalogConfig, workerGroup *sync.WaitGroup, wh WorkHandler, outputChannel chan ResponsePayload) {\n\tfor _, v := range req.Payload.Jobs {\n\t\tworkerGroup.Add(1)\n\t\tlog.Debugf(\"Job Input Data %v\", v)\n\t\tgo startWorker(config, workerGroup, wh, outputChannel, v)\n\t}\n}", "title": "" }, { "docid": "df02701a0b469553a0bc43b891b54188", "score": "0.6178587", "text": "func (p *Pool) worker(w Worker) {\n\n\t// Each pconn has it's own ResponseCache.\n\tresponseCache := NewResponseCache()\n\n\t// Start a new connection.\n\tpconn, err := NewPConn(p, responseCache, w.host, w.serverName)\n\tif err != nil {\n\t\tp.log.Printf(\"Failed to add a new connection to %s\\n\", w.host)\n\t\treturn\n\t}\n\n\t// Enter the loop for the worker.\n\tfor {\n\t\tselect {\n\t\tcase <-pconn.closech:\n\t\t\tp.log.Println(\"PConn gone\")\n\t\t\tw.done <- struct{}{}\n\t\t\treturn\n\t\tcase req := <-w.requests:\n\t\t\tpconn.writech <- req\n\t\t}\n\t}\n}", "title": "" }, { "docid": "72562f420f25f8ae6e06dcb39eb19959", "score": "0.6161994", "text": "func (f *forwarder) handleRequests() {\n\tfor req := range f.clientNewRequests {\n\t\tdebug(fmt.Sprintf(\"%s recieved out-of-band request: %+v\", f.ConnID, req))\n\t}\n}", "title": "" }, { "docid": "5b1402e840e6c56b3d4bd34019318acc", "score": "0.615488", "text": "func (c *Client) spawnRequestHandlerWorker() {\n\tgo func() {\n\t\tfor {\n\t\t\tselect {\n\t\t\tcase <-c.ctx.Done():\n\t\t\t\tclose(c.requestQueue)\n\t\t\t\treturn\n\t\t\tdefault:\n\t\t\t\tentry := <-c.requestQueue\n\n\t\t\t\tlastRequest := c.getLastExecutionTimeForRequest(entry.req)\n\t\t\t\tdiff := time.Now().UTC().Sub(lastRequest)\n\n\t\t\t\tif diff.Seconds() < 1.0 {\n\t\t\t\t\tif c.Debug {\n\t\t\t\t\t\tlog.Printf(\"bunq: waiting %f seconds before sending the http request.\", 1.0-diff.Seconds())\n\t\t\t\t\t}\n\n\t\t\t\t\ttime.Sleep(time.Duration((1.0 - diff.Seconds()) * float64(time.Second)))\n\t\t\t\t}\n\n\t\t\t\tgo c.registerRequestInRateLimitMap(entry.req)\n\n\t\t\t\tif c.Debug {\n\t\t\t\t\tdump, _ := httputil.DumpRequest(entry.req, true)\n\t\t\t\t\tlog.Printf(\"\\n%s\\n\", dump)\n\t\t\t\t}\n\n\t\t\t\tres, err := c.Do(entry.req)\n\n\t\t\t\tif err != nil && c.Debug {\n\t\t\t\t\tlog.Print(err)\n\t\t\t\t}\n\n\t\t\t\tif c.Debug && err == nil {\n\t\t\t\t\tdump, _ := httputil.DumpResponse(res, true)\n\t\t\t\t\tlog.Printf(\"\\n%s\\n\", dump)\n\t\t\t\t}\n\n\t\t\t\tentry.resChan <- res\n\t\t\t\tentry.errChan <- errors.Wrap(err, \"bunq: http request failed.\")\n\t\t\t}\n\t\t}\n\t}()\n}", "title": "" }, { "docid": "f72a56b2f07a57f5ef5d57b5a96f7ff5", "score": "0.61504406", "text": "func (c *Connection) processor() error {\n\tfor {\n\t\tselect {\n\t\tcase <-c.t.Dying():\n\t\t\treturn nil\n\t\tcase nc := <-c.cmdCh:\n\t\t\tif nc == nil {\n\t\t\t\tc.logger.Warn().Str(\"cmd\", \"nil\").Msg(\"ignoring nil command\")\n\t\t\t\tbreak\n\t\t\t}\n\t\t\tif nc.command != noitCmdConnect {\n\t\t\t\tc.logger.Debug().Str(\"cmd\", nc.command).Msg(\"ignoring command\")\n\t\t\t\tbreak\n\t\t\t}\n\n\t\t\tif len(nc.request) == 0 {\n\t\t\t\tc.logger.Debug().\n\t\t\t\t\tStr(\"cmd\", nc.command).\n\t\t\t\t\tStr(\"req\", string(nc.request)).\n\t\t\t\t\tMsg(\"ignoring zero length request\")\n\t\t\t\tbreak\n\t\t\t}\n\n\t\t\tif c.shutdown() {\n\t\t\t\treturn nil\n\t\t\t}\n\n\t\t\t// Successfully connected, sent, and received data.\n\t\t\t// In certain circumstances, a broker will allow a connection, accept\n\t\t\t// the initial introduction, and then summarily disconnect (e.g. multiple\n\t\t\t// agents attempting reverse connections for the same check.)\n\t\t\tif c.connAttempts > 0 {\n\t\t\t\tc.resetConnectionAttempts()\n\t\t\t}\n\n\t\t\t// NOTE: do not check whether shutting down for the next two\n\t\t\t// let the metrics go ahead and be sent through for\n\t\t\t// the channel in the request from the broker.\n\t\t\t// then exit at the start of the next iteration.\n\t\t\t//\n\t\t\t// send the request from the broker to the local agent\n\t\t\tdata, err := c.fetchMetricData(&nc.request)\n\t\t\tif err != nil {\n\t\t\t\tc.logger.Warn().Err(err).Msg(\"fetching metric data\")\n\t\t\t}\n\t\t\t// send the metrics received from the local agent back to the broker\n\t\t\t// NOTE: send even if metrics will be empty\n\t\t\tif err := c.sendMetricData(c.conn, nc.channelID, data); err != nil {\n\t\t\t\tc.logger.Warn().Err(err).Msg(\"sending metric data\")\n\t\t\t}\n\t\t}\n\t}\n}", "title": "" }, { "docid": "713cf843192c3152280f587bdaaaebf4", "score": "0.61438215", "text": "func worker(linkq chan string, resultsq chan []string) {\n\tfor link := range linkq {\n\t\tplinks, err := getPageLinks(link)\n\t\tif err != nil {\n\t\t\tfmt.Printf(\"ERROR fetching %s: %v\", link, err)\n\t\t\tcontinue // Goes to next iteration of for loop\n\t\t}\n\n\t\tfmt.Printf(\"%s (%d links)\\n\", link, len(plinks.Links))\n\t\ttime.Sleep(time.Millisecond * 500) // Time to wait between individual worker requests\n\t\tif len(plinks.Links) > 0 {\n\t\t\t// Define a temporary go function to stop the workers from blocking when attempting to write to channer\n\t\t\t// Define and immediately invoke function\n\t\t\tgo func(links []string) {\n\t\t\t\tresultsq <- links\n\t\t\t}(plinks.Links)\n\t\t}\n\t}\n}", "title": "" }, { "docid": "6fcee5eefa1a12a59e803010b212943e", "score": "0.61371434", "text": "func main() {\n\t// Prepare our sockets\n\tfrontend, _ := zmq.NewSocket(zmq.ROUTER)\n\tbackend, _ := zmq.NewSocket(zmq.ROUTER)\n\tdefer frontend.Close()\n\tdefer backend.Close()\n\tfrontend.Bind(\"ipc://frontend.ipc\")\n\tbackend.Bind(\"ipc://backend.ipc\")\n\n\tclient_nbr := 0\n\tfor ; client_nbr < NBR_CLIENTS; client_nbr++ {\n\t\tgo client_task()\n\t}\n\tfor worker_nbr := 0; worker_nbr < NBR_WORKERS; worker_nbr++ {\n\t\tgo worker_task()\n\t}\n\n\t// Queue of available workers\n\tworkers := make([]string, 0, 10)\n\n\tpool := func(soc *zmq.Socket, ch chan []string) {\n\t\tfor {\n\t\t\tmsg, err := soc.RecvMessage(0)\n\t\t\tif err != nil {\n\t\t\t\tpanic(err)\n\t\t\t}\n\t\t\tch <- msg\n\t\t}\n\t}\n\tchBack := make(chan []string, 100)\n\tchFrontIf := make(chan []string, 100)\n\tgo pool(backend, chBack)\n\tgo pool(frontend, chFrontIf)\n\n\tchNil := make(chan []string) // a channel that is never used\n\tfor client_nbr > 0 {\n\t\tchFront := chNil\n\t\t// Poll frontend only if we have available workers\n\t\tif len(workers) > 0 {\n\t\t\tchFront = chFrontIf\n\t\t}\n\t\tselect {\n\t\tcase msg := <-chBack:\n\t\t\t// Use worker identity for load-balancing\n\t\t\tworker_id := msg[0]\n\t\t\tmsg = msg[2:]\n\n\t\t\tworkers = append(workers, worker_id)\n\n\t\t\t// If client reply, send rest back to frontend\n\t\t\tif msg[0] != WORKER_READY {\n\t\t\t\tfrontend.SendMessage(msg)\n\t\t\t\tclient_nbr--\n\t\t\t}\n\t\tcase msg := <-chFront:\n\t\t\t// Route client request to first available worker\n\t\t\tbackend.SendMessage(workers[0], \"\", msg)\n\n\t\t\t// Dequeue and drop the next worker identity\n\t\t\tworkers = workers[1:]\n\t\t}\n\t}\n\n\ttime.Sleep(100 * time.Millisecond)\n}", "title": "" }, { "docid": "1e1b4509fe8d3ec6f538a8a393bc3e52", "score": "0.61354256", "text": "func (m *mdns) loop(in chan msg) {\n\tvar timeout <-chan time.Time\n\tfor {\n\t\tselect {\n\t\tcase msg := <-in:\n\t\t\tif len(msg.Question) > 0 {\n\t\t\t\t// This is an incoming request from another host, try to send a reply\n\t\t\t\tmsg.MsgHdr.Response = true\n\t\t\t\tfor _, qst := range msg.Question {\n\t\t\t\t\tfor _, rr := range m.match(qst) {\n\t\t\t\t\t\tmsg.Answer = append(msg.Answer, rr)\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tif len(msg.Answer) > 0 {\n\t\t\t\t\tmsg.Question = nil\n\t\t\t\t\tm.write(msg)\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\t// This might be a reply to user dns request\n\t\t\t\tfor _, rr := range msg.Answer {\n\t\t\t\t\tvar results chan dns.RR\n\t\t\t\t\tfor _, query := range m.pending {\n\t\t\t\t\t\tfor _, q := range query.questions {\n\t\t\t\t\t\t\tif rr.Header().Name == q.Name {\n\t\t\t\t\t\t\t\tresults = query.results\n\t\t\t\t\t\t\t\tbreak\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\tif results == nil {\n\t\t\t\t\t\tcontinue\n\t\t\t\t\t}\n\t\t\t\t\tresults <- rr\n\t\t\t\t}\n\t\t\t}\n\t\tcase query := <-m.queries:\n\t\t\tquery.timeout = time.After(time.Millisecond * 500)\n\t\t\tif len(m.pending) == 0 {\n\t\t\t\ttimeout = query.timeout\n\t\t\t}\n\t\t\tm.pending = append(m.pending, query)\n\t\t\tm.write(msg{\n\t\t\t\t&dns.Msg{\n\t\t\t\t\tQuestion: query.questions,\n\t\t\t\t}, ipv4mcastaddr, m.connv4,\n\t\t\t})\n\t\t\tm.write(msg{\n\t\t\t\t&dns.Msg{\n\t\t\t\t\tQuestion: query.questions,\n\t\t\t\t}, ipv6mcastaddr, m.connv6,\n\t\t\t})\n\t\tcase <-timeout:\n\t\t\tclose(m.pending[0].results)\n\t\t\tm.pending = m.pending[1:]\n\t\t\tif len(m.pending) > 0 {\n\t\t\t\ttimeout = m.pending[0].timeout\n\t\t\t} else {\n\t\t\t\ttimeout = nil\n\t\t\t}\n\t\tcase <-m.exit:\n\t\t\tm.connv4.Close()\n\t\t\tm.connv6.Close()\n\t\t\treturn\n\t\t}\n\t}\n}", "title": "" }, { "docid": "ae802e2354eb173a515b533a19507fb7", "score": "0.6134971", "text": "func (n *Dbnode) handleRequests() {\n\tgo n.setInternalTimer()\n\n\ttimeoutCounter := 0\n\tn.internalTimer <- timeoutCounter\n\n\ttimedOutLockRequests := make(chan *packet.Message, 10)\n\n\tfor {\n\t\tselect {\n\t\tcase msg := <-n.Incoming:\n\t\t\tif n.disabled || msg.DemuxKey == packet.ControlRecover {\n\t\t\t\tif n.disabled && msg.DemuxKey == packet.ControlRecover {\n\t\t\t\t\tn.disabled = false\n\t\t\t\t\ttimeoutCounter = 0\n\t\t\t\t\tn.internalTimer <- timeoutCounter\n\n\t\t\t\t\tn.requestRepeater.Recover()\n\t\t\t\t\tn.elector.ProcessMsg(packet.Message{\n\t\t\t\t\t\tDemuxKey: packet.ControlRecover,\n\t\t\t\t\t})\n\n\t\t\t\t\tfmt.Printf(\"Node %v recovered\\n\", n.id)\n\t\t\t\t}\n\n\t\t\t\tcontinue\n\t\t\t}\n\n\t\t\tif msg.DemuxKey == packet.ControlFail {\n\t\t\t\tif !n.disabled {\n\t\t\t\t\tn.disabled = true\n\n\t\t\t\t\tn.requestRepeater.Fail()\n\t\t\t\t\tn.elector.ProcessMsg(packet.Message{\n\t\t\t\t\t\tDemuxKey: packet.ControlFail,\n\t\t\t\t\t})\n\n\t\t\t\t\tfmt.Printf(\"Node %v failed while in mode %v\\n\", n.id, n.currentMode)\n\n\t\t\t\t\tif n.currentMode != coordinatingWrite && n.currentMode != assemblingQuorum {\n\t\t\t\t\t\tn.currentMode = idle\n\t\t\t\t\t\tn.currentTxid = -1\n\t\t\t\t\t\tn.clientRequest = packet.Message{}\n\t\t\t\t\t\tn.quorumMembers = nil\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tcontinue\n\t\t\t}\n\n\t\t\tif msg.Dest != n.id {\n\t\t\t\tlog.Fatal(\"Midelivered message\", msg)\n\t\t\t}\n\n\t\t\tif msg.DemuxKey == packet.InternalTimerSignal {\n\t\t\t\tif msg.Id == timeoutCounter {\n\t\t\t\t\tswitch n.currentMode {\n\t\t\t\t\tcase coordinatingRead:\n\t\t\t\t\t\tn.abortProcessing()\n\t\t\t\t\tcase coordinatingWrite:\n\t\t\t\t\t\tn.abortProcessing()\n\t\t\t\t\tcase assemblingQuorum:\n\t\t\t\t\t\tn.abortProcessing()\n\t\t\t\t\tcase processingRead:\n\t\t\t\t\t\tn.abortProcessing()\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tn.internalTimer <- timeoutCounter\n\t\t\t} else {\n\t\t\t\ttimeoutCounter++\n\t\t\t}\n\n\t\t\t// Occasionally delete stale unlockTxids\n\t\t\tif msg.DemuxKey == packet.ElectionElect {\n\t\t\t\tn.cleanUnlockTxids()\n\t\t\t}\n\n\t\t\tswitch msg.DemuxKey {\n\t\t\tcase packet.ClientWriteRequest, packet.ClientStrongWriteRequest:\n\t\t\t\tif n.writeQuorumSize == 1 {\n\t\t\t\t\tn.processLocalWrite(msg)\n\t\t\t\t} else if n.elector.Leader() == n.id {\n\t\t\t\t\tn.lockRequests.enqueue(&msg)\n\t\t\t\t\tgo func() {\n\t\t\t\t\t\ttime.Sleep(10 * n.lockTimeout)\n\t\t\t\t\t\ttimedOutLockRequests <- &msg\n\t\t\t\t\t}()\n\t\t\t\t} else {\n\t\t\t\t\tn.elector.ForwardToLeader(msg)\n\t\t\t\t}\n\t\t\tcase packet.ClientReadRequest, packet.NodeLockRequest, packet.NodeLockRequestNoTimeout:\n\t\t\t\tif msg.DemuxKey == packet.ClientReadRequest && n.readQuorumSize == 1 {\n\t\t\t\t\tn.processLocalRead(msg)\n\t\t\t\t} else {\n\t\t\t\t\tn.lockRequests.enqueue(&msg)\n\t\t\t\t\tgo func() {\n\t\t\t\t\t\ttime.Sleep(n.lockTimeout)\n\t\t\t\t\t\ttimedOutLockRequests <- &msg\n\t\t\t\t\t}()\n\t\t\t\t}\n\t\t\tcase packet.NodeLockResponse:\n\t\t\t\tn.handleLockRes(msg)\n\t\t\tcase packet.NodeUnlockRequest:\n\t\t\t\tn.handleUnlockReq(msg)\n\t\t\tcase packet.NodeUnlockAck:\n\t\t\t\tn.handleUnlockAck(msg)\n\t\t\tcase packet.NodeGetRequest:\n\t\t\t\tn.handleGetReq(msg)\n\t\t\tcase packet.NodeGetResponse:\n\t\t\t\tn.handleGetRes(msg)\n\t\t\tcase packet.NodePutRequest:\n\t\t\t\tn.handlePutReq(msg)\n\t\t\tcase packet.NodePutResponse:\n\t\t\t\tn.handlePutRes(msg)\n\t\t\tcase packet.NodeTimestampRequest:\n\t\t\t\tn.handleTimestampReq(msg)\n\t\t\tcase packet.NodeBackgroundWriteRequest:\n\t\t\t\tn.handleBackgroundWriteReq(msg)\n\t\t\tcase packet.NodeBackgroundWriteResponse:\n\t\t\t\tn.handleBackgroundWriteRes(msg)\n\t\t\tcase packet.InternalTimerSignal:\n\t\t\t\t// Do nothing (already dealt with above)\n\t\t\tcase packet.ElectionElect, packet.ElectionCoordinator, packet.ElectionAck:\n\t\t\t\ttimeoutCounter--\n\t\t\t\tn.elector.ProcessMsg(msg)\n\t\t\tdefault:\n\t\t\t\tlog.Fatal(\"Unexpected message type\", msg)\n\t\t\t}\n\n\t\t\tif n.currentMode == idle && !n.lockRequests.empty() {\n\t\t\t\tmsg = *n.lockRequests.dequeue()\n\n\t\t\t\t// Don't lock for a transaction for which we have\n\t\t\t\t// previously received an unlock request.\n\t\t\t\tif n.unlockTxids[msg.Id] {\n\t\t\t\t\tcontinue\n\t\t\t\t}\n\n\t\t\t\tn.currentTxid = msg.Id\n\t\t\t\tn.clientRequest = msg\n\n\t\t\t\tswitch msg.DemuxKey {\n\t\t\t\tcase packet.ClientReadRequest:\n\t\t\t\t\tif fastReads {\n\t\t\t\t\t\tn.currentMode = coordinatingFastRead\n\t\t\t\t\t} else {\n\t\t\t\t\t\tn.currentMode = coordinatingRead\n\t\t\t\t\t}\n\t\t\t\t\tn.continueProcessing()\n\t\t\t\tcase packet.ClientWriteRequest, packet.ClientStrongWriteRequest:\n\t\t\t\t\tn.currentMode = assemblingQuorum\n\t\t\t\t\tn.continueProcessing()\n\t\t\t\tcase packet.NodeLockRequest:\n\t\t\t\t\tn.currentMode = processingRead\n\t\t\t\t\tn.Outgoing <- packet.Message{\n\t\t\t\t\t\tId: msg.Id,\n\t\t\t\t\t\tSrc: n.id,\n\t\t\t\t\t\tDest: msg.Src,\n\t\t\t\t\t\tDemuxKey: packet.NodeLockResponse,\n\t\t\t\t\t\tOk: true,\n\t\t\t\t\t}\n\t\t\t\tcase packet.NodeLockRequestNoTimeout:\n\t\t\t\t\tn.currentMode = processingWrite\n\t\t\t\t\tn.Outgoing <- packet.Message{\n\t\t\t\t\t\tId: msg.Id,\n\t\t\t\t\t\tSrc: n.id,\n\t\t\t\t\t\tDest: msg.Src,\n\t\t\t\t\t\tDemuxKey: packet.NodeLockResponse,\n\t\t\t\t\t\tOk: true,\n\t\t\t\t\t}\n\t\t\t\tdefault:\n\t\t\t\t\tlog.Fatal(\"Unexpected message type\", msg)\n\t\t\t\t}\n\t\t\t}\n\t\tcase msg := <-timedOutLockRequests:\n\t\t\tif n.disabled {\n\t\t\t\tcontinue\n\t\t\t}\n\n\t\t\tif n.lockRequests.remove(msg) {\n\t\t\t\tvar resType packet.Messagetype\n\t\t\t\tswitch msg.DemuxKey {\n\t\t\t\tcase packet.ClientReadRequest:\n\t\t\t\t\tresType = packet.ClientReadResponse\n\t\t\t\tcase packet.ClientWriteRequest, packet.ClientStrongWriteRequest:\n\t\t\t\t\tresType = packet.ClientWriteResponse\n\t\t\t\tdefault:\n\t\t\t\t\tresType = packet.NodeLockResponse\n\t\t\t\t}\n\n\t\t\t\tn.Outgoing <- packet.Message{\n\t\t\t\t\tId: msg.Id,\n\t\t\t\t\tSrc: n.id,\n\t\t\t\t\tDest: msg.Src,\n\t\t\t\t\tDemuxKey: resType,\n\t\t\t\t\tKey: msg.Key,\n\t\t\t\t\tValue: msg.Value,\n\t\t\t\t\tOk: false,\n\t\t\t\t}\n\t\t\t} else if msg.Id == n.currentTxid && (msg.DemuxKey == packet.ClientReadRequest || msg.DemuxKey == packet.ClientWriteRequest || msg.DemuxKey == packet.ClientStrongWriteRequest) {\n\t\t\t\tn.abortProcessing()\n\t\t\t}\n\t\tcase <-n.stateQueryReq:\n\t\t\tn.stateQueryRes <- n.currentTxid\n\t\t}\n\t}\n}", "title": "" }, { "docid": "394b39438a5d514fc40c4a5ade1916d9", "score": "0.6118875", "text": "func Requestor(args ...flagger.Commands) {\n\tch := make(chan string)\n\tgo func() {\n\t\tfor _, command := range args {\n\t\t\tmakeRequest(command, ch)\n\t\t}\n\t}()\n\n\tfor c := range ch {\n\t\tfmt.Println(c)\n\t}\n\n}", "title": "" }, { "docid": "0bcf936a486907bbfe353b5945c611db", "score": "0.61160994", "text": "func setupRequestAndReplyFunc() (func(int), chan bool) {\n\tvar numReqsFinished = 0 // Counts the times makeRequestAndGetResponse returns:\n\t// when it is equal to the number of times its called,\n\t// we know all the goroutines are done.\n\tvar semaphore = make(chan bool, 1) // Make sure one write to the log doesn't get clobbered by another\n\n\tvar doneChannel = make(chan bool, 1) // Signals to other routine that all goroutines are done\n\tmakeRequestAndGetResponse := func(requestNumber int) {\n\t\tvar myClient http.Client\n\n\t\tmyRequest, _ := http.NewRequest(\"GET\", requestURL, nil)\n\t\tmyRequest.Header.Add(\"Harness-Request-Number\", fmt.Sprintf(\"\\\"%04d\\\"\", requestNumber))\n\t\tmyResponse, _ := (&myClient).Do(myRequest)\n\t\tlenContent, _ := strconv.Atoi(myResponse.Header.Get(\"Content-Length\"))\n\t\ttheContent := make([]byte, lenContent)\n\t\tactuallyRead, _ := myResponse.Body.Read(theContent)\n\t\tmyResponse.Body.Close()\n\t\tsemaphore <- true\n\t\tlog.Printf(\"Retrieval #%04d (Compare with server # in Content).\\n\", requestNumber)\n\t\tlog.Printf(\"\\tResponse Status Code: %d\\n\", myResponse.StatusCode)\n\t\tlog.Printf(\"\\tResponse Status '%s'\\n\", myResponse.Status)\n\t\tlog.Printf(\"\\tLength: %d\\n\", actuallyRead)\n\t\tlog.Printf(\"\\tResponse Content:\\n%s\\n\", theContent)\n\t\tnumReqsFinished++\n\t\t<-semaphore\n\t\tif numReqsFinished == maxRequest {\n\t\t\tdoneChannel <- true\n\t\t}\n\t}\n\treturn makeRequestAndGetResponse, doneChannel\n}", "title": "" }, { "docid": "f2d6e4775939b15f9b025a3204f5c888", "score": "0.611127", "text": "func requestHandler() {\n\n\t// loop for checking if there is any new request from Consumer (Kafka) that has been sent to consumerChan\n\tfor {\n\t\tselect {\n\t\t// execute if there is a new request in consumerChan\n\t\tcase newRequest := <-consumerChan:\n\n\t\t\tstart := time.Now()\n\t\t\t// Send new request to `Biller` and get response that ready to produce\n\t\t\tmsg := newRequest\n\t\t\tlog.Printf(\"[Time: %v. Elapsed: %.6fs] Received new Request\\n\", time.Now().Format(\"15:04:05\"), time.Since(start).Seconds())\n\t\t\tisoParsed := getResponse(msg, start)\n\n\t\t\t// Send new response to billerChan\n\t\t\tbillerChan <- isoParsed\n\n\t\t\t// Done with requestHandler\n\t\t\tlog.Printf(\"[Time: %v. Elapsed: %.6fs] Send response to consumer\\n\", time.Now().Format(\"15:04:05\"), time.Since(start).Seconds())\n\t\t\tlog.Println(\"New request handled\")\n\n\t\t// keep looping if there is none new request\n\t\tdefault:\n\t\t\tcontinue\n\t\t}\n\t}\n\n}", "title": "" }, { "docid": "77bb04cc214cc674805c92708d7413fd", "score": "0.6098322", "text": "func doRecieve(client *Client) {\n\tvar err error\n\tvar res *mcd.MCResponse\n\tfor {\n\t\t// We generally call the message as request.\n\t\tif res, err = client.conn.Receive(); err != nil {\n\t\t\t// TODO: temporary fix. because UPR_MUTATION gives non SUCCESS status\n\t\t\tif _, ok := err.(*mcd.MCResponse); !ok {\n\t\t\t\tif client.tryError(err) {\n\t\t\t\t\tbreak\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tswitch res.Opcode {\n\t\tcase UPR_OPEN, UPR_FAILOVER_LOG, UPR_STREAM_REQ:\n\t\t\tclient.response <- res\n\n\t\tcase UPR_STREAM_END:\n\t\t\tstream := client.getStream(res.Opaque)\n\t\t\tif stream.autoRestart {\n\t\t\t\tstream.healthy = false\n\t\t\t\tgo client.restartStream(stream)\n\t\t\t} else {\n\t\t\t\tclient.evictStream(res.Opaque)\n\t\t\t}\n\n\t\tcase UPR_MUTATION, UPR_DELETION:\n\t\t\tstream := client.getStream(res.Opaque)\n\t\t\tif res.Opaque > 0 && stream != nil {\n\t\t\t\tif stream.IsHealthy() {\n\t\t\t\t\tstream.Handlecommand(mkRequest(res))\n\t\t\t\t} else {\n\t\t\t\t\tstream.Queuecommand(mkRequest(res))\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tlog.Println(\"ERROR: un-known opaque received %v\", res)\n\t\t\t}\n\n\t\tcase UPR_CLOSE_STREAM:\n\t\t\tpanic(\"UPR_CLOSE_STREAM not yet implemented\")\n\n\t\tcase UPR_SNAPSHOTM, UPR_EXPIRATION, UPR_FLUSH, UPR_ADD_STREAM:\n\t\t\tlog.Printf(\"Opcode %v not implemented\", res.Opcode)\n\n\t\tdefault:\n\t\t\tlog.Println(\"ERROR: un-known opcode received\", res)\n\t\t}\n\t}\n\n\tif client.autoRestart { // auto restart this connection\n\t\tlog.Printf(\"Client %v attempting autorestart\", client.name)\n\t\tclient.Connect(client.host, client.name, true)\n\t}\n}", "title": "" }, { "docid": "3d15810698e2dd8f0adbf8a028958270", "score": "0.6093877", "text": "func ProcessRequests(aInCtx context.Context, geoSrv GeoServiceImpl, reqChan chan smbroker.Message) {\n\tlogger := smlog.MustFromContext(aInCtx)\n\tfor {\n\t\tselect {\n\t\tcase msg, chOk := <-reqChan:\n\t\t\tif !chOk {\n\t\t\t\tlogger.Sugar().Info(\"Request channel closed\")\n\t\t\t\t//close all the service owned channels\n\t\t\t\tclose(ShutdownChann) //\n\t\t\t\tShutdownChann = nil\n\t\t\t\treturn\n\t\t\t}\n\t\t\t//Get the implementation fn to process the request\n\t\t\tcheckGetOverride := reflect.New(msg.RestStim.MoType.Elem())\n\t\t\tmo := checkGetOverride.Interface()\n\t\t\tv, lOk := mo.(GeoService)\n\t\t\tif lOk {\n\t\t\t\tswitch msg.RestStim.Verb {\n\t\t\t\tcase http.MethodGet:\n\t\t\t\t\t//parse the URL to get the input params\n\t\t\t\t\tparsedURL, err := url.Parse(msg.RestStim.RestUrl)\n\t\t\t\t\tif err != nil {\n\t\t\t\t\t\tlogger.With(zap.Error(err)).Error(\"Error in input data\")\n\t\t\t\t\t\tmsg.RestStim.RespStatus = http.StatusBadRequest\n\t\t\t\t\t} else {\n\t\t\t\t\t\tx := parsedURL.Query().Get(\"Lat\")\n\t\t\t\t\t\ty := parsedURL.Query().Get(\"Long\")\n\t\t\t\t\t\txVal, _ := strconv.ParseFloat(x, 64)\n\t\t\t\t\t\tyVal, _ := strconv.ParseFloat(y, 64)\n\t\t\t\t\t\t//calculate the distance\n\t\t\t\t\t\toutput := v.GetDistance(aInCtx, xVal, yVal)\n\t\t\t\t\t\t//return the response\n\t\t\t\t\t\tmsg.RestStim.RespBody = strconv.FormatFloat(output, 'f', 6, 64)\n\t\t\t\t\t\tmsg.RestStim.RespStatus = http.StatusOK\n\t\t\t\t\t}\n\t\t\t\tcase http.MethodPut:\n\t\t\t\t\tv.UpdateCoordinates(aInCtx)\n\t\t\t\t\tmsg.RestStim.RespStatus = http.StatusOK\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tmsg.RestStim.RespStatus = http.StatusBadRequest\n\t\t\t}\n\t\t\t//update the src and target service name\n\t\t\tmsg.TargetSrvName = msg.SrcSrvName\n\t\t\tmsg.SrcSrvName = geoSrv.Name\n\t\t\tmsg.RestStim.IsResponse = true\n\t\t\t//send the response to the broker to send\n\t\t\terr := geoSrv.Broker.Response(aInCtx, msg.SrcSrvName, msg)\n\t\t\tif err != nil {\n\t\t\t\tlogger.With(zap.Error(err)).Error(\"Error in sending the response.\")\n\t\t\t}\n\n\t\t}\n\n\t}\n\n}", "title": "" }, { "docid": "c941104df2179f304e1bb74456e541d1", "score": "0.6091566", "text": "func (d *GRPCMessageServer) work() {\n\n\t// Get internal messages from rcvQ and send them to all currently active streams.\n\tgo func() {\n\t\tfor {\n\t\t\tselect {\n\t\t\tcase <-d.State.killChan:\n\t\t\t\treturn\n\t\t\tdefault:\n\t\t\t\tmsg, shutdown := d.State.rcvQ.Get()\n\t\t\t\tif shutdown {\n\t\t\t\t\tlogger.Debugf(\"stopping send routine in worker on controller %s\", d.State.Conf.GetID())\n\t\t\t\t\treturn\n\t\t\t\t}\n\n\t\t\t\td.mu.RLock()\n\t\t\t\tlogger.Debugf(\"grpc: (internal) message received (# of receivers %d): %v\", len(d.State.streamQs), msg)\n\t\t\t\tfor _, sq := range d.State.streamQs {\n\t\t\t\t\tsq.Add(msg)\n\t\t\t\t}\n\t\t\t\td.State.rcvQ.Done(msg)\n\t\t\t\td.mu.RUnlock()\n\t\t\t}\n\t\t}\n\t}()\n\n\tlis, err := net.Listen(\"tcp\", fmt.Sprintf(\"%s:%d\", d.State.Conf.HostAddress, d.State.Conf.Port))\n\tif err != nil {\n\t\tlogger.Errorf(\"failed to listen (%s:%d): %v\", d.State.Conf.HostAddress, d.State.Conf.Port, err)\n\t\treturn\n\t}\n\tvar opts []grpc.ServerOption\n\tif d.State.Conf.TLSEnabled {\n\t\tlogger.Infof(\"grpc: starting tls server\")\n\t\tcreds, err := credentials.NewServerTLSFromFile(d.State.Conf.CertFile, d.State.Conf.KeyFile)\n\t\tif err != nil {\n\t\t\tlogger.Errorf(\"Failed to generate credentials %v\", err)\n\t\t\treturn\n\t\t}\n\t\topts = []grpc.ServerOption{grpc.Creds(creds)}\n\t}\n\td.State.grpcServer = grpc.NewServer(opts...)\n\tseguepb.RegisterMessengerServer(d.State.grpcServer, d)\n\td.State.grpcServer.Serve(lis) // Stop will ensure this go routine exists\n}", "title": "" }, { "docid": "76b85387ab56e7f419220582990b966f", "score": "0.6078169", "text": "func (f *Fetch) loop() {\n\tf.log.Info(\"starting fetch main loop\")\n\tfor {\n\t\tselect {\n\t\tcase req := <-f.requestReceiver:\n\t\t\tf.handleNewRequest(&req)\n\t\tcase <-f.batchTimeout.C:\n\t\t\tgo f.requestHashBatchFromPeers() // Process the batch.\n\t\tcase <-f.stop:\n\t\t\tclose(f.doneChan)\n\t\t\treturn\n\t\t}\n\t}\n}", "title": "" }, { "docid": "150bed06786ab029ad8383435e3fafcd", "score": "0.607303", "text": "func (p *Peer) dispatcher() {\n\tpending := make(map[uint64]*Request)\n\n\tfor {\n\t\tselect {\n\t\tcase reqOp := <-p.reqDispatch:\n\t\t\treq := reqOp.req\n\t\t\treq.Sent = time.Now()\n\n\t\t\trequestTracker.Track(p.id, p.version, req.code, req.want, req.id)\n\t\t\terr := p2p.Send(p.rw, req.code, req.data)\n\t\t\treqOp.fail <- err\n\n\t\t\tif err == nil {\n\t\t\t\tpending[req.id] = req\n\t\t\t}\n\n\t\tcase cancelOp := <-p.reqCancel:\n\t\t\t// Retrieve the pendign request to cancel and short circuit if it\n\t\t\t// has already been serviced and is not available anymore\n\t\t\treq := pending[cancelOp.id]\n\t\t\tif req == nil {\n\t\t\t\tcancelOp.fail <- nil\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\t// Stop tracking the request\n\t\t\tdelete(pending, cancelOp.id)\n\t\t\tcancelOp.fail <- nil\n\n\t\tcase resOp := <-p.resDispatch:\n\t\t\tres := resOp.res\n\t\t\tres.Req = pending[res.id]\n\n\t\t\t// Independent if the request exists or not, track this packet\n\t\t\trequestTracker.Fulfil(p.id, p.version, res.code, res.id)\n\n\t\t\tswitch {\n\t\t\tcase res.Req == nil:\n\t\t\t\t// Response arrived with an untracked ID. Since even cancelled\n\t\t\t\t// requests are tracked until fulfilment, a dangling repsponse\n\t\t\t\t// means the remote peer implements the protocol badly.\n\t\t\t\tresOp.fail <- errDanglingResponse\n\n\t\t\tcase res.Req.want != res.code:\n\t\t\t\t// Response arrived, but it's a different packet type than the\n\t\t\t\t// one expected by the requester. Either the local code is bad,\n\t\t\t\t// or the remote peer send junk. In neither cases can we handle\n\t\t\t\t// the packet.\n\t\t\t\tresOp.fail <- fmt.Errorf(\"%w: have %d, want %d\", errMismatchingResponseType, res.code, res.Req.want)\n\n\t\t\tdefault:\n\t\t\t\t// All dispatcher checks passed and the response was initialized\n\t\t\t\t// with the matching request. Signal to the delivery routine that\n\t\t\t\t// it can wait for a handler response and dispatch the data.\n\t\t\t\tres.Time = res.recv.Sub(res.Req.Sent)\n\t\t\t\tresOp.fail <- nil\n\n\t\t\t\t// Stop tracking the request, the response dispatcher will deliver\n\t\t\t\tdelete(pending, res.id)\n\t\t\t}\n\n\t\tcase <-p.term:\n\t\t\treturn\n\t\t}\n\t}\n}", "title": "" }, { "docid": "91e24aa066262610cf739c519ed035d2", "score": "0.6063518", "text": "func queueWorker(queue <-chan task) {\n\tfor task := range queue {\n\t\tprocessRequest(task)\n\t}\n}", "title": "" }, { "docid": "addf40cc2606462a5b2041e32d6bc817", "score": "0.605326", "text": "func (s *server) answer(channel ssh.Channel, requests <-chan *ssh.Request, sshConn string) error {\n\tdefer channel.Close()\n\n\t// Answer all the requests on this connection.\n\tfor req := range requests {\n\t\tok := false\n\n\t\t// I think that ideally what we want to do here is pass this on to\n\t\t// the Cookoo router and let it handle each Type on its own.\n\t\tswitch req.Type {\n\t\tcase \"env\":\n\t\t\to := &EnvVar{}\n\t\t\tssh.Unmarshal(req.Payload, o)\n\t\t\tfmt.Printf(\"Key='%s', Value='%s'\\n\", o.Name, o.Value)\n\t\t\treq.Reply(true, nil)\n\t\tcase \"exec\":\n\t\t\tclean := cleanExec(req.Payload)\n\t\t\tparts := strings.SplitN(clean, \" \", 2)\n\n\t\t\trouter := s.c.Get(\"cookoo.Router\", nil).(*cookoo.Router)\n\n\t\t\t// TODO: Should we unset the context value 'cookoo.Router'?\n\t\t\t// We need a shallow copy of the context to avoid race conditions.\n\t\t\tcxt := s.c.Copy()\n\t\t\tcxt.Put(\"SSH_CONNECTION\", sshConn)\n\n\t\t\t// Only allow commands that we know about.\n\t\t\tswitch parts[0] {\n\t\t\tcase \"ping\":\n\t\t\t\tcxt.Put(\"channel\", channel)\n\t\t\t\tcxt.Put(\"request\", req)\n\t\t\t\tsshPing := cxt.Get(\"route.sshd.sshPing\", \"sshPing\").(string)\n\t\t\t\terr := router.HandleRequest(sshPing, cxt, true)\n\t\t\t\tif err != nil {\n\t\t\t\t\tlog.Warnf(s.c, \"Error pinging: %s\", err)\n\t\t\t\t}\n\t\t\t\treturn err\n\t\t\tcase \"git-receive-pack\", \"git-upload-pack\":\n\t\t\t\tif len(parts) < 2 {\n\t\t\t\t\tlog.Warn(s.c, \"Expected two-part command.\\n\")\n\t\t\t\t\treq.Reply(ok, nil)\n\t\t\t\t\tbreak\n\t\t\t\t}\n\t\t\t\treq.Reply(true, nil) // We processed. Yay.\n\n\t\t\t\tcxt.Put(\"channel\", channel)\n\t\t\t\tcxt.Put(\"request\", req)\n\t\t\t\tcxt.Put(\"operation\", parts[0])\n\t\t\t\tcxt.Put(\"repository\", parts[1])\n\t\t\t\tsshGitReceive := cxt.Get(\"route.sshd.sshGitReceive\", \"sshGitReceive\").(string)\n\t\t\t\terr := router.HandleRequest(sshGitReceive, cxt, true)\n\t\t\t\tvar xs uint32\n\t\t\t\tif err != nil {\n\t\t\t\t\tlog.Errf(s.c, \"Failed git receive: %v\", err)\n\t\t\t\t\txs = 1\n\t\t\t\t}\n\t\t\t\tsendExitStatus(xs, channel)\n\t\t\t\treturn nil\n\t\t\tdefault:\n\t\t\t\tlog.Warnf(s.c, \"Illegal command is '%s'\\n\", clean)\n\t\t\t\treq.Reply(false, nil)\n\t\t\t\treturn nil\n\t\t\t}\n\n\t\t\tif err := sendExitStatus(0, channel); err != nil {\n\t\t\t\tlog.Errf(s.c, \"Failed to write exit status: %s\", err)\n\t\t\t}\n\t\t\treturn nil\n\t\tdefault:\n\t\t\t// We simply ignore all of the other cases and leave the\n\t\t\t// channel open to take additional requests.\n\t\t\tlog.Infof(s.c, \"Received request of type %s\\n\", req.Type)\n\t\t\treq.Reply(false, nil)\n\t\t}\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "875f6ca53ec69a98d244a8579c4d4067", "score": "0.6043433", "text": "func (f *fetcher) run() {\n\tgo func() {\n\t\tfor {\n\t\t\tselect {\n\t\t\tcase q := <-f.quitChan:\n\t\t\t\t// Stick it back in so anything else looking at the quitChan can\n\t\t\t\t// stop\n\t\t\t\tf.quitChan <- q\n\t\t\t\t// Stop taking new requests\n\t\t\t\tclose(f.pendingRequests)\n\t\t\t\t// Close out pending requests\n\t\t\t\tfor req := range f.pendingRequests {\n\t\t\t\t\treq.response <- &fetchResponse{err: errors.New(\"fetcher quit\")}\n\t\t\t\t}\n\t\t\t\treturn\n\t\t\tcase req := <-f.pendingRequests:\n\t\t\t\tlog.WithField(\"req\", req).Debug(\"pending request received\")\n\t\t\t\t// Process the request\n\t\t\t\tf.process(req)\n\t\t\t}\n\t\t}\n\t}()\n}", "title": "" }, { "docid": "1eebcd169b32e91ca681df262dff3716", "score": "0.60261047", "text": "func worker(id int, jobs <-chan request, result chan<- bool) {\n\tfor j := range jobs {\n\t\tlog.Debugln(\"Worker\", id, \"working on\", j.ID)\n\t\tdownloadFile(j.Client, j.Rt, j.ID, j.Filename)\n\t\tlog.Debugln(\"Worker\", id, \"done on\", j.ID)\n\t\tresult <- true\n\t}\n}", "title": "" }, { "docid": "1340022c3ddafdb801ebf5a3e609c014", "score": "0.601956", "text": "func (qr *Queuer) fetchWork(ctx context.Context, qt *task.QueueTask) {\n\n\t// If we are able to determine the required capacity for the queue and\n\t// the node does not have sufficient available dont both going to get any\n\t// work\n\tcapacityMaybe, err := qr.check(ctx, qt.Subscription)\n\n\tworkDone := false\n\tstartedAt := time.Now()\n\n\t// Make sure we are not needlessly doing this by seeing if anything at all is waiting\n\thasWork, err := qr.tasker.HasWork(ctx, qt.Subscription)\n\n\tif hasWork && err == nil {\n\n\t\tif exists, _ := qr.tasker.Exists(ctx, qt.Subscription+responseSuffix); exists {\n\t\t\tshortQueueName, err := qr.tasker.GetShortQName(qt)\n\t\t\tif err != nil {\n\t\t\t\tlogger.Info(\"no short queue\", \"error\", err.Error)\n\t\t\t} else {\n\t\t\t\tresponseQName := shortQueueName + responseSuffix\n\n\t\t\t\t// Check before starting if there is a response queue available for\n\t\t\t\t// reporting. If so start a channel for reporting with a listener\n\t\t\t\t// and a pump to present reports\n\t\t\t\tif rspEncryptStore := GetRspnsEncrypt(); rspEncryptStore != nil {\n\t\t\t\t\t// The response store does not need the response suffice because it only\n\t\t\t\t\t// deals with response queue public keys\n\n\t\t\t\t\tif key, err := rspEncryptStore.Select(responseQName); err == nil {\n\n\t\t\t\t\t\tif responseQ, err := qr.tasker.Responder(ctx, responseQName, key); err != nil {\n\t\t\t\t\t\t\tlogger.Warn(\"responder unavailable\", \"queue_name\", responseQName, \"error\", err.Error())\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tqt.ResponseQ = responseQ\n\t\t\t\t\t\t}\n\t\t\t\t\t} else {\n\t\t\t\t\t\tlogger.Info(\"no response key\", \"queue_name\", responseQName, \"keys\", spew.Sdump(*rspEncryptStore))\n\t\t\t\t\t}\n\t\t\t\t} else {\n\t\t\t\t\tlogger.Info(\"no response key store\", \"queue_name\", responseQName)\n\t\t\t\t}\n\n\t\t\t\tif qt.ResponseQ != nil {\n\t\t\t\t\tselect {\n\t\t\t\t\tcase qt.ResponseQ <- &runnerReports.Report{\n\t\t\t\t\t\tTime: timestamppb.Now(),\n\t\t\t\t\t\tExecutorId: &wrappers.StringValue{\n\t\t\t\t\t\t\tValue: network.GetHostName(),\n\t\t\t\t\t\t},\n\t\t\t\t\t\tPayload: &runnerReports.Report_Logging{\n\t\t\t\t\t\t\tLogging: &runnerReports.LogEntry{\n\t\t\t\t\t\t\t\tTime: timestamppb.Now(),\n\t\t\t\t\t\t\t\tSeverity: runnerReports.LogSeverity_Debug,\n\t\t\t\t\t\t\t\tMessage: &wrappers.StringValue{\n\t\t\t\t\t\t\t\t\tValue: \"scanning queue\",\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\tFields: map[string]string{\n\t\t\t\t\t\t\t\t\t\"queue_name\": shortQueueName,\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t},\n\t\t\t\t\t}:\n\t\t\t\t\tdefault:\n\t\t\t\t\t\t// No point responding to back preassure here as recovery\n\t\t\t\t\t\t// is not that important for this type of message\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\t// Increment the inflight counter for the worker\n\t\tqr.subs.incWorkers(qt.Subscription)\n\t\t// Use the context for workers that is canceled once a queue disappears\n\n\t\tprocessed, rsc, qErr := qr.tasker.Work(ctx, qt)\n\t\t// Decrement the inflight counter for the worker\n\t\tqr.subs.decWorkers(qt.Subscription)\n\n\t\t// Stop the background responder by closing the channel\n\t\tif qt.ResponseQ != nil {\n\t\t\tclose(qt.ResponseQ)\n\t\t\tqt.ResponseQ = nil\n\t\t}\n\n\t\t// Set the default resource requirements for the next message fetch to that of the most recently\n\t\t// seen resource request\n\t\t//\n\t\tif rsc != nil {\n\t\t\t// Update the resources this queue has been requesting per experiment on each new experiment message\n\t\t\tif err := qr.subs.setResources(qt.Subscription, rsc); err != nil {\n\t\t\t\tlogger.Trace(\"resource update failed\", \"subscription\", qt.Subscription, \"error\", err.Error())\n\t\t\t} else {\n\t\t\t\tlogger.Debug(\"resource updated\", \"subscription\", qt.Subscription, \"resource\", rsc)\n\t\t\t}\n\t\t} else {\n\t\t\tlogger.Trace(\"resource update was empty\", \"subscription\", qt.Subscription)\n\t\t}\n\n\t\tworkDone = processed\n\t\terr = qErr\n\t}\n\n\t// As jobs finish we should determine what they delay should be before the\n\t// runner should look for the next job in the specific queue being used\n\t// should be. Thisd acts as a form of penalty for queuing new work based on\n\t// how long the jobs are taking and if errors are occurring in them. We start\n\t// assuming that a 2 minute penalty exists to cover the worst case penalty.\n\tbackoffTime := time.Duration(15 * time.Second)\n\tmsg := \"backing off\"\n\tlvl := logxi.LevelDebug\n\tmsgVars := []interface{}{\"project_id\", qt.Project, \"subscription_id\", qt.Subscription}\n\n\tif err != nil {\n\t\t// No work found return to waiting for some, at the outer bound of the queue service\n\t\t// interval\n\t\tlvl = logxi.LevelWarn\n\t\tmsg = msg + \", receive failed\"\n\t\tmsgVars = append(msgVars, \"error\", err.Error())\n\t} else {\n\n\t\tif !workDone && capacityMaybe {\n\t\t\tlvl = logxi.LevelTrace\n\t\t\tmsg = msg + \", empty\"\n\t\t}\n\t\tif !capacityMaybe {\n\t\t\tmsg = msg + \", no capacity\"\n\t\t\tif err != nil {\n\t\t\t\tmsg = msg + \", \" + err.Error()\n\t\t\t}\n\t\t}\n\n\t\t// Only if work was actually done do we add a measurement to the EMA\n\t\tif workDone {\n\t\t\t// Take the execution duration and use it to calculate a relative penalty for\n\t\t\t// new jobs being queued. This allows smaller requests to sneak through while\n\t\t\t// the larger projects are paying the penalty in the form of a backoff.\n\t\t\texecTime := time.Since(startedAt)\n\t\t\tqr.subs.execTime(qt.Subscription, execTime)\n\t\t}\n\n\t\t// If we dont have a backoff in effect use the average run time to penalize\n\t\t// ourselves for the next attempt at queuing work, only do this if we are\n\t\t// not already is a backoff situation otherwise backoffs will just keep piling\n\t\t// up\n\t\tif avg, err := qr.subs.getExecAvg(qt.Subscription); err != nil {\n\t\t\tlogger.Warn(\"could not calculate execution time\", \"project_id\", qr.project, \"subscription_id\", qt.Subscription, \"error\", err.Error())\n\t\t} else {\n\t\t\tbackoffTime = time.Duration(time.Duration(avg.Hours()/2.0) * queuePollInterval)\n\t\t}\n\t}\n\n\t// Set the penalty for the queue, except where one is already in effect\n\tif delayed, isPresent := backoffs.Get(qr.project + \":\" + qt.Subscription); !isPresent {\n\t\t// Use a default of 15 seconds if no backoff has been specified\n\t\tif backoffTime == time.Duration(0) {\n\t\t\tbackoffTime = time.Duration(15 * time.Second)\n\t\t}\n\t\tbackoffs.Set(qt.Project+\":\"+qt.Subscription, backoffTime)\n\t\tmsg = msg + \", now delayed\"\n\t} else {\n\t\tlvl = logxi.LevelTrace\n\t\tmsg = msg + \", already delayed\"\n\t\tbackoffTime = time.Until(delayed).Truncate(time.Second)\n\t}\n\n\tmsgVars = append([]interface{}{\"duration\", backoffTime.String()}, msgVars...)\n\tlogger.Log(lvl, msg, msgVars)\n}", "title": "" }, { "docid": "2e4acf9e9d0eb86ef4de6d5c1eaabb50", "score": "0.6014031", "text": "func (manager *ManagerImpl) Request(opts Options) chan *http.Response {\n\tresponseChan := make(chan *http.Response, 1)\n\t// starts rutine, will execute on separate thread while channel is inmediatly\n\t// returned to the consumer\n\tmanager.pushToQueue(func() {\n\t\t//mutex := manager.mutex\n\t\t//mutex.Lock()\n\t\t// set info\n\t\tmanager.currentConns++\n\t\t//manager.currentRequests[opts.URL] = struct{}{}\n\t\tmanager.syncCurrentRequests.Store(opts.URL, struct{}{})\n\n\t\t// Get from cache, if not available perform req\n\t\tvar response *http.Response\n\t\tresponse, inCache := manager.getFromCache(opts)\n\t\t// if not in cache\n\t\tif !inCache {\n\t\t\treq, _ := http.NewRequest(\n\t\t\t\topts.Method,\n\t\t\t\topts.URL,\n\t\t\t\tnil)\n\t\t\t// gather headers\n\t\t\tfor key, value := range opts.Headers {\n\t\t\t\treq.Header.Add(key, value)\n\t\t\t}\n\n\t\t\tcacheResponseChannel := make(chan interface{}, 1) // buffered channel is highly important\n\t\t\tmanager.cache.Store(opts.URL, cacheResponseChannel) // nolint: errcheck\n\t\t\t//mutex.Unlock()\n\n\t\t\t// ommiting error management :(\n\t\t\tresponse, _ = manager.client.Do(req)\n\t\t\tcacheResponseChannel <- response\n\t\t\t/*_, err := manager.cache.Store(opts.URL, response)\n\n\t\t\tif err != nil {\n\t\t\t\tresponseChan <- nil\n\t\t\t} //*/\n\t\t}\n\n\t\tfmt.Println(response.Status)\n\t\tfmt.Println(manager.getStatus())\n\t\tresponseChan <- response // write the response to the channel\n\t\tmanager.currentConns-- // not thread safe\n\t\t//delete(manager.currentRequests, opts.URL)\n\t\tmanager.syncCurrentRequests.Delete(opts.URL)\n\t\t//}()\n\t})\n\treturn responseChan // channel is resturned asynchronously\n}", "title": "" }, { "docid": "f3aec16b5f612c56bc0c6bfc8872ed73", "score": "0.5994061", "text": "func (qr *Queuer) doWork(ctx context.Context, request *SubRequest) {\n\n\tif _, isPresent := backoffs.Get(request.project + \":\" + request.subscription); isPresent {\n\t\tlogger.Trace(fmt.Sprintf(\"%v, backed off\", request))\n\t\treturn\n\t}\n\n\tlogger.Debug(\"started doWork\", \"project_id\", request.project, \"subscription_id\", request.subscription)\n\tdefer logger.Debug(\"completed doWork\", \"project_id\", request.project, \"subscription_id\", request.subscription)\n\n\tdefer func() {\n\t\tif r := recover(); r != nil {\n\t\t\tlogger.Warn(fmt.Sprintf(\"panic running studioml script %#v, %s\", r, string(debug.Stack())))\n\t\t}\n\t}()\n\n\t// cCtx is used to cancel any workers when a queue disappears\n\tcCtx, origCancel := context.WithCancel(context.Background())\n\tworkCancel := runner.GetCancelWrapper(origCancel, \"Worker cancel for queue deletion\", logger)\n\n\t// If any one of the contexts is Done then invoke the cancel function\n\tgo DualWait(ctx, cCtx, workCancel)\n\n\t// Spins out a go routine to handle messages, HandleMsg will be invoked\n\t// by the queue specific implementation in the event that valid work is found\n\t// which is typically done via the queues Work(...) method\n\t//\n\tgo qr.startFetch(cCtx, request)\n\n\t// While the above func is looking for work check periodically that\n\t// the queue that was used to send the message still exists, if it\n\t// does not cancel everything as this is an indication that the\n\t// work is intended to be abruptly terminated.\n\t//\n\t// This function blocks until the context is Done or the queue disappears\n\tqr.watchQueueDelete(cCtx, workCancel, request)\n}", "title": "" }, { "docid": "3b32cbfab419e70b3820719776adfe37", "score": "0.5992537", "text": "func handle_request(service_request *brubeckServiceRequest, socket zmq.Socket, passphrase string) {\n // run in a goroutine\n go func(){\n // handle request\n // 1. get method to call in routing table\n my_handler := demo_handler // fake it for now\n\n // 2. call method which should return a value which is the body of the response.\n var status_code, status_message, response_body = my_handler(service_request)\n\n method := \"response\"\n arguments :=map[string]string { }\n headers :=map[string]string { }\n\n // send the request back \n // 1. create a response object\n service_response := createBrubeckServiceResponse(service_request, \n status_code, status_message, \n method, arguments, response_body, headers)\n\n // 2. call method to send response\n println(\"Sending response\")\n send_response(service_response, socket, passphrase)\n \n // We are done, nothing to report\n return\n \n }()\n // We will be done in a while, nothing to report\n return\n}", "title": "" }, { "docid": "2ab2cae1eb956a16755729c8a3ee6060", "score": "0.5991831", "text": "func (cm *CoffeeMachineService) Worker(Orders <-chan string) {\n defer cm.workerWg.Done()\n\n for order := range Orders {\n recipe, err := cm.RecipeSvc.ByName(order)\n if err != nil {\n cm.AlertingSvc.Alert(err)\n } else {\n r, err := cm.DispenseIngredient(*recipe)\n if err != nil {\n cm.AlertingSvc.Alert(err)\n } else {\n beverage := coffee_machine.NewBeverage(r.Name, *r)\n beverage.Serve()\n }\n }\n }\n}", "title": "" }, { "docid": "e752614a03a0b4fda290f70fa0b0f4da", "score": "0.5962318", "text": "func dispatchJob(workInfo *WorkInfo, m *Master) {\n var urls []string\n for i:= 0;i < 10;i++ {\n url := <- m.jobChan // get ulr from channel\n urls = append(urls, url)\n }\n args := &DojobArgs{}\n // args.Url = \"www.baidu.com\"//url\n args.JobType = \"Crawl\"\n args.Urls = urls\n var reply DojobReply\n err := call(workInfo.workAddr, \"Worker.Dojob\", args, &reply)\n if err == true {\n m.workers[workInfo] = false;\n fmt.Println(\"dispatchJob success worker: \" + workInfo.workAddr)\n }\n}", "title": "" }, { "docid": "d4842bfc96f06aa7584534404fa46b50", "score": "0.5960079", "text": "func HandleRequests(conn io.ReadWriteCloser, requestedIds <-chan string, outbund <-chan *messages.ChatMessage) {\n\ttoServer := messages.MakeMessageWriter(conn)\n\tfor {\n\t\tselect {\n\t\tcase queryId := <-requestedIds:\n\t\t\ta := &messages.ProtocolMessage{\n\t\t\t\tType: messages.QueryType,\n\t\t\t\tChatMessage: &messages.ChatMessage{\n\t\t\t\t\tUUID: queryId,\n\t\t\t\t},\n\t\t\t}\n\t\t\ttoServer <- a\n\t\tcase newMesg := <-outbund:\n\t\t\ta := &messages.ProtocolMessage{\n\t\t\t\tType: messages.NewMessageType,\n\t\t\t\tChatMessage: newMesg,\n\t\t\t}\n\t\t\ttoServer <- a\n\t\t}\n\t}\n}", "title": "" }, { "docid": "ade7fc37c14aee9ca32fb225c6442872", "score": "0.59547544", "text": "func TestReqRepMulti(t *testing.T) {\n\t// Configure the test\n\tservers := 75\n\trequests := 75\n\n\tstart := new(sync.WaitGroup)\n\tproc := new(sync.WaitGroup)\n\tproc.Add(1)\n\tdone := new(sync.WaitGroup)\n\tterm := new(sync.WaitGroup)\n\tterm.Add(1)\n\tkill := new(sync.WaitGroup)\n\n\t// Start up the concurrent requesters\n\tfor i := 0; i < servers; i++ {\n\t\tstart.Add(1)\n\t\tdone.Add(1)\n\t\tkill.Add(1)\n\t\tgo func() {\n\t\t\t// Connect to the relay\n\t\t\tapp := \"test-reqrep-multi\"\n\t\t\tconn, err := iris.Connect(relayPort, app, new(requester))\n\t\t\tif err != nil {\n\t\t\t\tt.Fatalf(\"connection failed: %v.\", err)\n\t\t\t}\n\t\t\t// Notify parent and wait for continuation permission\n\t\t\tstart.Done()\n\t\t\tproc.Wait()\n\n\t\t\t// Send the requests to the group and wait for the replies\n\t\t\tfor j := 0; j < requests; j++ {\n\t\t\t\t// Generate a new random message\n\t\t\t\treq := make([]byte, 128)\n\t\t\t\tio.ReadFull(rand.Reader, req)\n\n\t\t\t\t// Send request, verify reply\n\t\t\t\trep, err := conn.Request(app, req, 250*time.Millisecond)\n\t\t\t\tif err != nil {\n\t\t\t\t\tt.Fatalf(\"request failed: %v.\", err)\n\t\t\t\t}\n\t\t\t\tif bytes.Compare(rep, req) != 0 {\n\t\t\t\t\tt.Fatalf(\"reply mismatch: have %v, want %v.\", rep, req)\n\t\t\t\t}\n\t\t\t}\n\t\t\t// Wait till everybody else finishes\n\t\t\tdone.Done()\n\t\t\tterm.Wait()\n\n\t\t\t// Terminate the server and signal tester\n\t\t\tconn.Close()\n\t\t\tkill.Done()\n\t\t}()\n\t}\n\t// Schedule the parallel operations\n\tstart.Wait()\n\tproc.Done()\n\tdone.Wait()\n\tterm.Done()\n\tkill.Wait()\n}", "title": "" }, { "docid": "30169fab092052fa02b53900d226da4c", "score": "0.5952747", "text": "func startReceiver(resChan <-chan response, wg *sync.WaitGroup, log *log.Logger) {\n\tfor res := range resChan {\n\t\tlog.Println(res.string())\n\t\twg.Done()\n\t}\n}", "title": "" }, { "docid": "d40f0b4c7b9220041614c14896e3d75d", "score": "0.59519887", "text": "func (itemService *ItemService) worker() {\n\tvar wg sync.WaitGroup\n\twg.Add(WORKER)\n\t//when user gracefulStop program then wait until all goroutine close\n\tgo func() {\n\t\tsig := <-gracefulStop\n\t\twg.Wait()\n\t\tfmt.Printf(\"caught sig: %+v\", sig)\n\t\tfmt.Println(\"wait for all goroutine close and store last generate id into json file\")\n\t\tfmt.Println(itemService.CallerJSONData.FailureId())\n\t\titemService.CallerJSONData.WriteJSONFile()\n\t\tos.Exit(0)\n\t}()\n\n\treqIDChan := make(chan int)\n\trespItemChan := make(chan model.ResponseChan)\n\t//Create worker\n\tfor i := 0; i < WORKER; i++ {\n\t\tgo itemService.ItemData.Item(reqIDChan, respItemChan, &wg)\n\t}\n\t//Pass task to worker\n\tfor j := 0; j < WORKER; j++ {\n\t\treqIDChan <- itemService.generateReqID()\n\t}\n\t//get worker output from channel\n\tfor k := 0; k < WORKER; k++ {\n\t\trespData := <-respItemChan\n\t\titemService.updateLastRequestID(respData.RequestID)\n\t\tif respData.Error != \"\" {\n\t\t\titemService.failureLog(respData.Error, respData.RequestID)\n\t\t\tcontinue\n\t\t}\n\t\titemService.CallerJSONData.SetFailureCnt(0)\n\t\tfmt.Println(respData.ItemData.Title, respData.ItemData.Id)\n\t}\n\twg.Wait()\n}", "title": "" }, { "docid": "6be92c8ec0cda9e37c1a118cb7a96906", "score": "0.5942313", "text": "func hashWorker(jobs <-chan hashRequest, result chan<- dbRequest, done chan<- bool) {\n for req := range jobs {\n resp := make(chan *HashEntry)\n hash, tdelta := computeHash(req.payload)\n result <- dbRequest{storing: true, id: req.id, hash: hash, tdelta: tdelta, resp: resp}\n <-resp\n }\n done<-true\n log.Print(\"hashWorker is now done\")\n}", "title": "" }, { "docid": "ee4a8c00591ac3623d586076c4800dcb", "score": "0.59401", "text": "func (s *NetworkController) worker() {\n\tfor {\n\t\tfunc() {\n\t\t\tkey, quit := s.workingQueue.Get()\n\t\t\tif quit {\n\t\t\t\treturn\n\t\t\t}\n\t\t\tdefer s.workingQueue.Done(key)\n\t\t\terr := s.syncNetwork(key.(string))\n\t\t\tif err != nil {\n\t\t\t\tglog.Errorf(\"Error syncing network: %v\", err)\n\t\t\t}\n\t\t}()\n\t}\n}", "title": "" }, { "docid": "08f016a6dbac131293936ad1c1d9e533", "score": "0.5939579", "text": "func (self *GenServer) loop() {\n\tdefer self.recover()\n\n for ; ; {\n\t\tself.status = READY\n\t\tselect {\n\t\tcase msg := <- self.ch :\n\t\t\tself.status = BUSY\n\t\t\tswitch cmsg := msg.(type) {\n\t\t\tcase CallMessage:\n\t\t\t\tself.handle_call(&cmsg)\n\t\t\tcase CastMessage:\n\t\t\t\tself.handle_cast(&cmsg)\n\t\t\t}\n\t\tcase cmd := <- self.control_ch :\n\t\t\tself.status = BUSY\n\t\t\tswitch ccmd := cmd.(type) {\n\t\t\tcase initControlMessage:\n\t\t\t\tself.handle_init(&ccmd)\n\t\t\tcase stopControlMessage:\n\t\t\t\tself.handle_stop(&ccmd)\n\t\t\t}\n\t\t}\n\t}\n}", "title": "" }, { "docid": "00f8e638dc36c10f40a0330128fdadbd", "score": "0.5931996", "text": "func (drh *DefaultRequestHandler) processRequest(req *RequestMessage, config CatalogConfig, wh WorkHandler) {\n\tvar workerGroup sync.WaitGroup\n\tvar responderGroup sync.WaitGroup\n\toutputChannel := make(chan ResponsePayload)\n\trs := &Responder{\n\t\tOutput: os.Stdout,\n\t\theader: ResponseHeader{\n\t\t\tAccount: req.Account,\n\t\t\tSender: req.Sender,\n\t\t\tInResponseTo: req.MessageID,\n\t\t},\n\t}\n\tresponderGroup.Add(1)\n\tlog.Debug(\"Starting Responder\")\n\tgo startResponder(&responderGroup, rs, outputChannel)\n\n\tlog.Debug(\"Starting Workers\")\n\treq.dispatch(config, &workerGroup, wh, outputChannel)\n\n\tworkerGroup.Wait()\n\toutputChannel <- ResponsePayload{messageType: \"eof\"}\n\tresponderGroup.Wait()\n}", "title": "" }, { "docid": "987aec16966e84b1a8c5ce8240013eee", "score": "0.59297144", "text": "func worker(id int, jobsChnl <-chan int, resultsChan chan<- int ){ // Don't forget to see small difference between Sender and Receiver Channles. :) Quite hacky it is\n\n for j:=range jobsChnl {\n fmt.Println(id, \"*** This is ID of the JOB\", j, \"*** and this is job\")\n time.Sleep(time.Second*30)\n resultsChan <- j * 2\n }\n}", "title": "" }, { "docid": "bb1e2c6d7abc4d6e1a9a669b7325c2a5", "score": "0.59261876", "text": "func (c *conn) writer(p peerProcessor) {\n\tc.wg.Add(1)\n\twr := p.NewEncoder(c.config.codec, c.conn)\n\tfor {\n\t\tselect {\n\t\tcase pl := <- c.send:\n\t\t\tlog.Printf(\"send payload:%v\", pl.String())\n\t\t\tif pl.kind == REQUEST {\n\t\t\t\t//request need to be wait for response\n\t\t\t\treq := pl.request()\n\t\t\t\tc.rmap[req.msgid] = req\n\t\t\t}\n\t\t\t//TODO: pack context arg and send to remote\n\t\t\tif err := wr.Encode(pl); err != nil {\n\t\t\t\tlog.Printf(\"send fails %v\", err)\n\t\t\t\tgoto EXIT\n\t\t\t}\n\t\t\tc.stats.n_send++\n\t\t\t//pending flush until some number of request sent (currently 10)\n\t\t\tif len(c.send) <= 0 || c.stats.n_send > 10 {\n\t\t\t\tif err := wr.Flush(); err != nil {\n\t\t\t\t\tlog.Printf(\"flush fails %v\", err)\n\t\t\t\t\tgoto EXIT\n\t\t\t\t}\n\t\t\t\tc.stats.n_send = 0\n\t\t\t}\n\t\tcase res := <- c.recv:\n\t\t\tc.processResponse(res)\n\t\tcase t := <- c.tick.C:\n\t\t\tfor msgid, req := range c.rmap {\n\t\t\t\tctx := req.ctx\n\t\t\t\tif ctx.deadline.UnixNano() <= 0 {\n\t\t\t\t\tif tmp, ok := ctx.gctx.Deadline(); ok {\n\t\t\t\t\t\tctx.deadline = tmp\n\t\t\t\t\t} else {\n\t\t\t\t\t\tctx.deadline = time.Now().Add(5 * time.Second) //default timeout: 5 sec\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tif ctx.deadline.UnixNano() < t.UnixNano() {\n\t\t\t\t\t//timed out.\n\t\t\t\t\tdelete(c.rmap, msgid)\n\t\t\t\t\treq.receiver <- &response{ msgid, newerr(ActorTimeout, ctx.deadline), nil }\n\t\t\t\t}\n\t\t\t}\n\t\t\tif c.config.pingInterval > 0 {\n\t\t\t\tc.stats.pingCount--\n\t\t\t\tif c.stats.pingCount <= 0 {\n\t\t\t\t\tgo func() {\n\t\t\t\t\t\tif err := c.systemRequest(p, \"ping\"); err != nil {\n\t\t\t\t\t\t\tlog.Printf(\"keepalive fails %v\", err)\n\t\t\t\t\t\t\tc.Close()\n\t\t\t\t\t\t\treturn\n\t\t\t\t\t\t}\n\t\t\t\t\t}()\n\t\t\t\t\tc.stats.pingCount = c.config.pingInterval\n\t\t\t\t}\n\t\t\t}\n\t\tcase <- c.closer:\n\t\t\tgoto EXIT\n\t\t}\n\t}\nEXIT:\n\tc.wg.Done()\n\tc.wg.Wait()\n\tc.finalize()\n}", "title": "" }, { "docid": "95bfd29345ab741205a4b2214ac86ffa", "score": "0.59226865", "text": "func (mb *MessageBroker) loop() {\n\tfor {\n\t\tselect {\n\t\tcase <-mb.ctx.Done():\n\t\t\tutil.LogInfo(\"Stream: Done -- broker loop has terminated\")\n\t\t\treturn\n\t\tcase c := <-mb.addClient:\n\t\t\tmb.handleAddClient(c)\n\t\tcase c := <-mb.removeClient:\n\t\t\tmb.handleRemoveClient(c)\n\t\tcase b := <-mb.sendMessage:\n\t\t\tmb.handleSendMessage(b)\n\t\tcase b := <-mb.sendAction:\n\t\t\tmb.handleSendAction(b)\n\t\t}\n\t}\n}", "title": "" }, { "docid": "e3849b186c678962fc0ccc3f3b1d97f2", "score": "0.5916181", "text": "func (bas *BaseService) RequestChan() <-chan *Request {\n\treturn bas.queue\n}", "title": "" }, { "docid": "ab24e04d3ead3b513ebc1affb77a0b4b", "score": "0.5908608", "text": "func (appMgr *Manager) agentResponseWorker() {\n\tlog.Debugf(\"[CORE] Agent Response Worker started and blocked on channel %v\", appMgr.agRspChan)\n\tfor msgRsp := range appMgr.agRspChan {\n\t\trspMsg := msgRsp.(resource.MessageResponse).ResourceResponse\n\t\t// If admit status is set and if routes are configured appManager\n\t\t// would process route admit status, by default appManager would\n\t\t// process ARP handling aloing with Admit Status for both k8s or OSCP\n\t\tif rspMsg.IsResponseSuccessful == true {\n\t\t\t// if route is configured in appManager\n\t\t\tif appMgr.routeClientV1 != nil {\n\t\t\t\tlog.Debugf(\"[CORE] Updating Route Admit Status\")\n\t\t\t\tappMgr.updateRouteAdmitStatusAll()\n\t\t\t}\n\t\t}\n\t}\n}", "title": "" }, { "docid": "b786c0a8318f1f931a2c3372a68fa259", "score": "0.59041363", "text": "func (h *httpHandler) dispatch(id, channel string, results <-chan string, done <-chan bool) {\n\tpersister := h.Persister()\n\tr, err := persister.GetResult(id)\n\tif err != nil {\n\t\tlog.Println(err)\n\t\treturn\n\t}\n\n\tfor {\n\t\tselect {\n\t\tcase <-done:\n\t\t\tr.Done = true\n\t\t\tpersister.SaveResult(id, r)\n\t\tcase result := <-results:\n\t\t\tr.Responses = append(r.Responses, newMessage(id, channel, result))\n\t\t\tpersister.SaveResult(id, r)\n\t\t}\n\t}\n}", "title": "" }, { "docid": "390a9c6686ce409669659b21a37f1abe", "score": "0.5902953", "text": "func (f *forwarder) handleChannels() {\n\n\tvar err error\n\n\t// Service the incoming Channel channel.\n\tfor newChannel := range f.clientNewChannel {\n\n\t\t// Channels of type \"session\" handle requests that are involved in running\n\t\t// commands on a server, subsystem requests, and agent forwarding.\n\t\tif t := newChannel.ChannelType(); t != \"session\" {\n\t\t\tdebug(fmt.Sprintf(\"%s Channel type rejected (only session) %s\", f.ConnID, t))\n\t\t\tnewChannel.Reject(ssh.UnknownChannelType, fmt.Sprintf(\"Channel type rejected (only session) %s\", t))\n\t\t\tcontinue\n\t\t}\n\n\t\t// Accept accepts the channel creation request. It returns the Channel\n\t\t// and a Go channel containing SSH requests. The Go channel must be\n\t\t// serviced otherwise the Channel will hang.\n\t\tf.clientRawChannel, f.clientRequests, err = newChannel.Accept()\n\t\tif err != nil {\n\t\t\tdebug(fmt.Sprintf(\"%s Could not accept channel: %s\", f.ConnID, err))\n\t\t\tcontinue\n\t\t}\n\n\t\t// Log\n\t\tstartTime := time.Now()\n\t\tf.clientChannel = NewLogChannel(startTime, f.clientRawChannel, f.RemoteUser, f.remoteDest, f.Gate.Config.Log.LogDir)\n\n\t\t// channel to synchronise Requests for AgentForwarding\n\t\tf.chanAgentForwarding = make(chan bool, 1)\n\n\t\t// handle all requests in a routine\n\t\tgo f.handleSessionRequests()\n\n\t\t// Connect to the destination\n\t\tf.remoteConnection()\n\t}\n}", "title": "" }, { "docid": "a1f4657dbbb2195da6267c104a77d8b0", "score": "0.5899542", "text": "func (c *controller) worker(ctx context.Context) {\n\tfor c.processNextWorkItem() {\n\t}\n}", "title": "" }, { "docid": "43a95b30e359da3d0b23249dc372bb05", "score": "0.5896586", "text": "func (d *Dispatcher) dispatch() {\n\tfor {\n\t\tselect {\n\t\tcase job := <-JobQueue:\n\t\t\t// a job request has been received\n\t\t\tgo func(job Job) {\n\t\t\t\t// try to obtain a worker job channel that is available.\n\t\t\t\t// this will block until a worker is idle\n\t\t\t\tjobChannel := <-d.WorkerPool\n\n\t\t\t\t// dispatch the job to the worker job channel\n\t\t\t\tjobChannel <- job\n\t\t\t}(job)\n\t\t}\n\t}\n}", "title": "" }, { "docid": "6d92e28e84ce48e09d3d0aae6c933546", "score": "0.58939165", "text": "func (w *work) doRequest(r Request) {\r\n\tres, err := r.Client.Do(r.Request)\r\n\tw.mutex.Lock()\r\n\tvalue := &Response{\r\n\t\tResponse: res,\r\n\t\tError: err,\r\n\t\tindex: r.index,\r\n\t}\r\n\tw.result = append(w.result, *value)\r\n\tw.mutex.Unlock()\r\n}", "title": "" }, { "docid": "dd3761a4feb958e438eafd6f470ffeca", "score": "0.589287", "text": "func (m *Master) Request(args *RequestArgs, reply *RequestReply) error {\n\n\tmu.Lock()\n\tdefer mu.Unlock()\n\n\tinprogressFound := false\n\n\t// loop to find idel map task\n\tfor i, maptask := range m.mapTasks {\n\t\t// unassigned maptask found\n\t\tswitch maptask.Status {\n\t\tcase IDEL:\n\t\t\treply.MapTask = maptask\n\t\t\treply.Type = \"Map\"\n\t\t\treply.TaskId = maptask.Id\n\t\t\tm.mapTasks[i].Status = INPROGRESS\n\t\t\tlog.Printf(\"worker #%d takes map task #%d\", args.WorkerId, maptask.Id)\n\t\t\treturn nil\n\t\tcase INPROGRESS:\n\t\t\tinprogressFound = true\n\t\tcase COMPLETE:\n\n\t\tdefault:\n\t\t\tlog.Fatalln(\"Error Status: \", maptask.Status)\n\t\t\tos.Exit(2)\n\t\t}\n\t}\n\n\t// Loop to find idel reduce task\n\tfor i, reducetask := range m.reduceTasks {\n\t\t// unassigned maptask found\n\t\tswitch reducetask.Status {\n\t\tcase IDEL:\n\t\t\treply.ReduceTask = reducetask\n\t\t\treply.Type = \"Reduce\"\n\t\t\tlog.Println(\"assign redude : \", reply, \" to: \", args.WorkerId)\n\t\t\treply.TaskId = reducetask.Id\n\t\t\tm.reduceTasks[i].Status = INPROGRESS\n\t\t\treturn nil\n\t\tcase INPROGRESS:\n\t\t\tinprogressFound = true\n\t\tcase COMPLETE:\n\n\t\tdefault:\n\t\t\tlog.Fatalln(\"Error Status: \", reducetask.Status)\n\t\t\tos.Exit(2)\n\t\t}\n\t}\n\t// All completed\n\tif !inprogressFound {\n\t\treply.Type = \"Finished\"\n\t\treturn nil\n\t} else {\n\t\t// Some inprogress\n\t\treply.Type = \"Busy\"\n\t\treturn nil\n\t}\n}", "title": "" }, { "docid": "f1befdd3c285795e67cb2e81446b872a", "score": "0.589252", "text": "func (c *Controller) worker() {\n\tfor c.processNextWorkItem() {\n\t}\n}", "title": "" }, { "docid": "f1befdd3c285795e67cb2e81446b872a", "score": "0.589252", "text": "func (c *Controller) worker() {\n\tfor c.processNextWorkItem() {\n\t}\n}", "title": "" }, { "docid": "e8d3d00c7b5419230ce223c87f4bd365", "score": "0.5892253", "text": "func (p *Peer) Controller(){\n\touterLoop:\n\tfor {\n\t\t// p.LastSentMutex.Lock();\n\t\ttimeouter := time.After(100 * time.Millisecond)\n\n\t\tif p.LastSent != nil {\n\t\t\tinnerLoop:\n\t\t\tfor {\n\t\t\t\tselect {\n\t\t\t\tcase <- timeouter:\n\t\t\t\t\t//Timeout\n\t\t\t\t\tfmt.Println(\"timeout, resending \", counter)\n\t\t\t\t\tcounter++\n\t\t\t\t\tp.SyncChan <- p.LastSent\n\t\t\t\t\tcontinue outerLoop\n\t\t\t\tcase ackNumber := <- p.AckQueue:\n\t\t\t\t\tcounter = 0\n\t\t\t\t\tif ackNumber == p.LastSent.Number {\n\t\t\t\t\t\tp.LastSent = nil\n\t\t\t\t\t\tbreak innerLoop\t\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tnewPayload := <-p.SendPayloadChannel\n\t\tnewPackage := Package{Type: EnumPackageData, Number: p.PackageNumber, Payload: newPayload};\n\t\tp.PackageNumber++;\n\t\tnewPackage.CalcChecksum();\n\n\t\tp.LastSent = &newPackage;\n\t\tp.SyncChan <- p.LastSent\n\t\t\t\n\t\t// p.LastSentMutex.Unlock();\n\t}\n\n}", "title": "" }, { "docid": "01ae948292adb7af60a7e0bdcbad2573", "score": "0.58919364", "text": "func (self *Node) runCycles(backChannel chan bool) {\n\t//process incoming messages\n\tgo self.handleIncomingTransportMessages() //pop them off the channel\n\tgo self.handleIncomingControlMessages() //pop them off the channel\n\tbackChannel <- true\n}", "title": "" }, { "docid": "e8002c4bd0891601e54f9d1aa4767765", "score": "0.588935", "text": "func (c *StatusController) worker() {\n\tfor c.processNextWorkItem() {\n\t}\n}", "title": "" }, { "docid": "3251513c940cf76990ea9822c9c6efbc", "score": "0.58890766", "text": "func (c *core) bufferResponse(wg *sync.WaitGroup, control chan int) {\n\tdefer wg.Done()\n\n\tlog.Debug(\"Starting up responder queue.\")\n\nLoop:\n\tfor {\n\t\tfor _, pl := range plugins.SkillPlugins {\n\t\t\tselect {\n\t\t\t// check if we have any new control messages\n\t\t\tcase con := <-control:\n\t\t\t\tswitch con {\n\t\t\t\tcase QUIT:\n\t\t\t\t\tbreak Loop\n\t\t\t\t}\n\t\t\t// check for any new events\n\t\t\tcase event := <-pl.FromPlugin():\n\t\t\t\tlog.Debug(\"Received skill response: \" + event.Message)\n\t\t\t\t// add the event to be processed by the skills\n\t\t\t\tc.output.Push(event)\n\t\t\t}\n\t\t}\n\t}\n\tlog.Debug(\"Responder queue shutting down.\")\n}", "title": "" }, { "docid": "d48b307431a52760a2d477d5d7d5e397", "score": "0.5887846", "text": "func (w *worker) Run(results chan<- *jobResult, quit <-chan struct{}) {\n\tpeer := w.peer\n\n\t// Subscribe to messages from the peer.\n\tmsgChan, cancel := peer.SubscribeRecvMsg()\n\tdefer cancel()\n\n\tfor {\n\t\tlog.Tracef(\"Worker %v waiting for more work\", peer.Addr())\n\n\t\tvar job *queryJob\n\t\tselect {\n\t\t// Poll a new job from the nextJob channel.\n\t\tcase job = <-w.nextJob:\n\t\t\tlog.Tracef(\"Worker %v picked up job with index %v\",\n\t\t\t\tpeer.Addr(), job.Index())\n\n\t\t// Ignore any message received while not working on anything.\n\t\tcase msg := <-msgChan:\n\t\t\tlog.Tracef(\"Worker %v ignoring received msg %T \"+\n\t\t\t\t\"since no job active\", peer.Addr(), msg)\n\t\t\tcontinue\n\n\t\t// If the peer disconnected, we can exit immediately, as we\n\t\t// weren't working on a query.\n\t\tcase <-peer.OnDisconnect():\n\t\t\tlog.Debugf(\"Peer %v for worker disconnected\",\n\t\t\t\tpeer.Addr())\n\t\t\treturn\n\n\t\tcase <-quit:\n\t\t\treturn\n\t\t}\n\n\t\tselect {\n\t\t// There is no point in queueing the request if the job already\n\t\t// is canceled, so we check this quickly.\n\t\tcase <-job.cancelChan:\n\t\t\tlog.Tracef(\"Worker %v found job with index %v \"+\n\t\t\t\t\"already canceled\", peer.Addr(), job.Index())\n\n\t\t\t// We break to the below loop, where we'll check the\n\t\t\t// cancel channel again and the ErrJobCanceled\n\t\t\t// result will be sent back.\n\t\t\tbreak\n\n\t\t// We received a non-canceled query job, send it to the peer.\n\t\tdefault:\n\t\t\tlog.Tracef(\"Worker %v queuing job %T with index %v\",\n\t\t\t\tpeer.Addr(), job.Req, job.Index())\n\n\t\t\tpeer.QueueMessageWithEncoding(job.Req, nil, job.encoding)\n\t\t}\n\n\t\t// Wait for the correct response to be received from the peer,\n\t\t// or an error happening.\n\t\tvar (\n\t\t\tjobErr error\n\t\t\ttimeout = time.NewTimer(job.timeout)\n\t\t)\n\n\tLoop:\n\t\tfor {\n\t\t\tselect {\n\t\t\t// A message was received from the peer, use the\n\t\t\t// response handler to check whether it was answering\n\t\t\t// our request.\n\t\t\tcase resp := <-msgChan:\n\t\t\t\tprogress := job.HandleResp(\n\t\t\t\t\tjob.Req, resp, peer.Addr(),\n\t\t\t\t)\n\n\t\t\t\tlog.Tracef(\"Worker %v handled msg %T while \"+\n\t\t\t\t\t\"waiting for response to %T (job=%v). \"+\n\t\t\t\t\t\"Finished=%v, progressed=%v\",\n\t\t\t\t\tpeer.Addr(), resp, job.Req, job.Index(),\n\t\t\t\t\tprogress.Finished, progress.Progressed)\n\n\t\t\t\t// If the response did not answer our query, we\n\t\t\t\t// check whether it did progress it.\n\t\t\t\tif !progress.Finished {\n\t\t\t\t\t// If it did make progress we reset the\n\t\t\t\t\t// timeout. This ensures that the\n\t\t\t\t\t// queries with multiple responses\n\t\t\t\t\t// expected won't timeout before all\n\t\t\t\t\t// responses have been handled.\n\t\t\t\t\t// TODO(halseth): separate progress\n\t\t\t\t\t// timeout value.\n\t\t\t\t\tif progress.Progressed {\n\t\t\t\t\t\ttimeout.Stop()\n\t\t\t\t\t\ttimeout = time.NewTimer(\n\t\t\t\t\t\t\tjob.timeout,\n\t\t\t\t\t\t)\n\t\t\t\t\t}\n\t\t\t\t\tcontinue Loop\n\t\t\t\t}\n\n\t\t\t\t// We did get a valid response, and can break\n\t\t\t\t// the loop.\n\t\t\t\tbreak Loop\n\n\t\t\t// If the timeout is reached before a valid response\n\t\t\t// has been received, we exit with an error.\n\t\t\tcase <-timeout.C:\n\t\t\t\t// The query did experience a timeout and will\n\t\t\t\t// be given to someone else.\n\t\t\t\tjobErr = ErrQueryTimeout\n\t\t\t\tlog.Tracef(\"Worker %v timeout for request %T \"+\n\t\t\t\t\t\"with job index %v\", peer.Addr(),\n\t\t\t\t\tjob.Req, job.Index())\n\n\t\t\t\tbreak Loop\n\n\t\t\t// If the peer disconnects before giving us a valid\n\t\t\t// answer, we'll also exit with an error.\n\t\t\tcase <-peer.OnDisconnect():\n\t\t\t\tlog.Debugf(\"Peer %v for worker disconnected, \"+\n\t\t\t\t\t\"cancelling job %v\", peer.Addr(),\n\t\t\t\t\tjob.Index())\n\n\t\t\t\tjobErr = ErrPeerDisconnected\n\t\t\t\tbreak Loop\n\n\t\t\t// If the job was canceled, we report this back to the\n\t\t\t// work manager.\n\t\t\tcase <-job.cancelChan:\n\t\t\t\tlog.Tracef(\"Worker %v job %v canceled\",\n\t\t\t\t\tpeer.Addr(), job.Index())\n\n\t\t\t\tjobErr = ErrJobCanceled\n\t\t\t\tbreak Loop\n\n\t\t\tcase <-quit:\n\t\t\t\treturn\n\t\t\t}\n\t\t}\n\n\t\t// Stop to allow garbage collection.\n\t\ttimeout.Stop()\n\n\t\t// We have a result ready for the query, hand it off before\n\t\t// getting a new job.\n\t\tselect {\n\t\tcase results <- &jobResult{\n\t\t\tjob: job,\n\t\t\tpeer: peer,\n\t\t\terr: jobErr,\n\t\t}:\n\t\tcase <-quit:\n\t\t\treturn\n\t\t}\n\n\t\t// If the peer disconnected, we can exit immediately.\n\t\tif jobErr == ErrPeerDisconnected {\n\t\t\treturn\n\t\t}\n\t}\n}", "title": "" }, { "docid": "4a641308b4ab4d21c3ad3065beff88bd", "score": "0.58876824", "text": "func (d *controllerService) processModifyVolumeRequests(h *modifyVolumeRequestHandler, responseChans []chan modifyVolumeResponse) {\n\tklog.V(4).InfoS(\"Start processing ModifyVolumeRequest for \", \"volume ID\", h.volumeID)\n\tprocess := func(req *modifyVolumeRequest) {\n\t\tif err := h.validateModifyVolumeRequest(req); err != nil {\n\t\t\treq.responseChan <- modifyVolumeResponse{err: err}\n\t\t} else {\n\t\t\th.mergeModifyVolumeRequest(req)\n\t\t\tresponseChans = append(responseChans, req.responseChan)\n\t\t}\n\t}\n\n\tfor {\n\t\tselect {\n\t\tcase req := <-h.requestChan:\n\t\t\tprocess(req)\n\t\tcase <-time.After(modifyVolumeRequestHandlerTimeout):\n\t\t\td.modifyVolumeManager.requestHandlerMap.Delete(h.volumeID)\n\t\t\t// At this point, no new requests can come in on the request channel because it has been removed from the map\n\t\t\t// However, the request channel may still have requests waiting on it\n\t\t\t// Thus, process any requests still waiting in the channel\n\t\t\tfor loop := true; loop; {\n\t\t\t\tselect {\n\t\t\t\tcase req := <-h.requestChan:\n\t\t\t\t\tprocess(req)\n\t\t\t\tdefault:\n\t\t\t\t\tloop = false\n\t\t\t\t}\n\t\t\t}\n\t\t\tactualSizeGiB, err := d.executeModifyVolumeRequest(h.volumeID, h.mergedRequest)\n\t\t\tfor _, c := range responseChans {\n\t\t\t\tselect {\n\t\t\t\tcase c <- modifyVolumeResponse{volumeSize: actualSizeGiB, err: err}:\n\t\t\t\tdefault:\n\t\t\t\t\tklog.V(6).InfoS(\"Ignoring response channel because it has no receiver\", \"volumeID\", h.volumeID)\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn\n\t\t}\n\t}\n}", "title": "" }, { "docid": "49b539b8b9e339eeda46cecc8f5ed309", "score": "0.5885249", "text": "func (s *grpcServer) dispatch(stream grpc.Stream, methodName string, getState stateGetterFn, worker dispatchFn) error {\n\n\t// tracks attribute state for this stream\n\treqTracker := s.attrMgr.NewTracker()\n\trespTracker := s.attrMgr.NewTracker()\n\tdefer reqTracker.Done()\n\tdefer respTracker.Done()\n\n\t// used to serialize sending on the grpc stream, since the grpc stream is not multithread-safe\n\tsendLock := &sync.Mutex{}\n\n\troot, ctx := s.tracer.StartRootSpan(stream.Context(), methodName)\n\tdefer root.Finish()\n\n\t// ensure pending stuff is done before leaving\n\twg := sync.WaitGroup{}\n\tdefer wg.Wait()\n\n\tfor {\n\t\tdState := getState()\n\n\t\t// get a single message\n\t\terr := stream.RecvMsg(dState.request)\n\t\tif err == io.EOF {\n\t\t\treturn nil\n\t\t} else if err != nil {\n\t\t\tglog.Errorf(\"Reading from gRPC request stream failed: %v\", err)\n\t\t\treturn err\n\t\t}\n\t\t// ensure the indices are matched for processing\n\t\t*dState.responseIndex = *dState.requestIndex\n\n\t\trequestBag, err := reqTracker.ApplyProto(dState.inAttrs)\n\t\tif err != nil {\n\t\t\tmsg := \"Request could not be processed due to invalid 'attribute_update'.\"\n\t\t\tglog.Error(msg, \"\\n\", err)\n\t\t\tdetails := status.NewBadRequest(\"attribute_update\", err)\n\t\t\t*dState.result = status.InvalidWithDetails(msg, details)\n\n\t\t\tsendLock.Lock()\n\t\t\terr = s.sendMsg(stream, dState.response)\n\t\t\tsendLock.Unlock()\n\n\t\t\tif err != nil {\n\t\t\t\tglog.Errorf(\"Unable to send gRPC response message: %v\", err)\n\t\t\t}\n\n\t\t\tcontinue\n\t\t}\n\n\t\t// throw the message into the work queue\n\t\twg.Add(1)\n\t\ts.gp.ScheduleWork(func() {\n\t\t\tspan, ctx2 := s.tracer.StartSpanFromContext(ctx, \"RequestProcessing\")\n\t\t\tspan.LogFields(log.Object(\"gRPC request\", dState.request))\n\n\t\t\tresponseBag := attribute.GetMutableBag(nil)\n\n\t\t\t// do the actual work for the message\n\t\t\targs := dispatchArgs{\n\t\t\t\tdState.request,\n\t\t\t\tdState.response,\n\t\t\t\t*dState.requestIndex,\n\t\t\t\trequestBag,\n\t\t\t\tresponseBag,\n\t\t\t\tdState.result,\n\t\t\t}\n\n\t\t\tworker(ctx2, args)\n\n\t\t\tsendLock.Lock()\n\t\t\tif err = respTracker.ApplyBag(responseBag, 0, dState.outAttrs); err != nil {\n\t\t\t\t*dState.outAttrs = mixerpb.Attributes{}\n\t\t\t\tglog.Errorf(\"Unable to apply response attribute bag, sending blank attributes: %v\", err)\n\t\t\t}\n\t\t\terr = s.sendMsg(stream, dState.response)\n\t\t\tsendLock.Unlock()\n\n\t\t\tif err != nil {\n\t\t\t\tglog.Errorf(\"Unable to send gRPC response message: %v\", err)\n\t\t\t}\n\n\t\t\trequestBag.Done()\n\t\t\tresponseBag.Done()\n\n\t\t\tspan.LogFields(log.Object(\"gRPC response\", dState.response))\n\t\t\tspan.Finish()\n\n\t\t\twg.Done()\n\t\t})\n\t}\n}", "title": "" }, { "docid": "87e0fe62103aa41902b02b64b0508191", "score": "0.58764505", "text": "func (f *Fetch) receiveResponse(data []byte) {\n\tif f.stopped() {\n\t\treturn\n\t}\n\n\tvar response responseBatch\n\terr := types.BytesToInterface(data, &response)\n\tif err != nil {\n\t\tf.log.With().Error(\"response was unclear, maybe leaking\", log.Err(err))\n\t\treturn\n\t}\n\n\tf.activeBatchM.RLock()\n\tbatch, has := f.activeBatches[response.ID]\n\tf.activeBatchM.RUnlock()\n\tif !has {\n\t\tf.log.With().Warning(\"unknown batch response received, or already invalidated\", log.String(\"batchHash\", response.ID.ShortString()))\n\t\treturn\n\t}\n\n\t// convert requests to map so it can be invalidated when reading Responses\n\tbatchMap := batch.ToMap()\n\t// iterate all hash Responses\n\tfor _, resID := range response.Responses {\n\t\t// take lock here to make handling of a single hash atomic\n\t\tf.activeReqM.Lock()\n\t\t// for each hash, send Data on waiting channel\n\t\treqs := f.pendingRequests[resID.Hash]\n\t\tactualHash := emptyHash\n\t\tfor _, req := range reqs {\n\t\t\tvar err error\n\t\t\tif req.validateResponseHash {\n\t\t\t\tif actualHash == emptyHash {\n\t\t\t\t\tactualHash = types.CalcHash32(data)\n\t\t\t\t}\n\t\t\t\tif actualHash != resID.Hash {\n\t\t\t\t\terr = fmt.Errorf(\"hash didnt match expected: %v, actual %v\", resID.Hash.ShortString(), actualHash.ShortString())\n\t\t\t\t}\n\t\t\t}\n\t\t\treq.returnChan <- HashDataPromiseResult{\n\t\t\t\tErr: err,\n\t\t\t\tHash: resID.Hash,\n\t\t\t\tData: resID.Data,\n\t\t\t\tIsLocal: false,\n\t\t\t}\n\t\t\t// todo: mark peer as malicious\n\t\t}\n\t\t// remove from map\n\t\tdelete(batchMap, resID.Hash)\n\n\t\t// remove from pending list\n\t\tdelete(f.pendingRequests, resID.Hash)\n\t\tf.activeReqM.Unlock()\n\t}\n\n\t// iterate all requests that didn't return value from peer and notify\n\t// they will be retried for MaxRetriesForRequest\n\tfor h := range batchMap {\n\t\tif f.stopped() {\n\t\t\treturn\n\t\t}\n\t\tf.log.With().Warning(\"hash not found in response from peer\",\n\t\t\tlog.String(\"hint\", string(batchMap[h].Hint)),\n\t\t\tlog.String(\"hash\", h.ShortString()),\n\t\t\tlog.String(\"peer\", batch.peer.String()))\n\t\tf.activeReqM.Lock()\n\t\treqs := f.pendingRequests[h]\n\t\tinvalidatedRequests := 0\n\t\tfor _, req := range reqs {\n\t\t\treq.retries++\n\t\t\tif req.retries > f.cfg.MaxRetriesForRequest {\n\t\t\t\tf.log.With().Debug(\"gave up on hash after max retries\",\n\t\t\t\t\tlog.String(\"hash\", req.hash.ShortString()))\n\t\t\t\treq.returnChan <- HashDataPromiseResult{\n\t\t\t\t\tErr: ErrExceedMaxRetries,\n\t\t\t\t\tHash: req.hash,\n\t\t\t\t\tData: []byte{},\n\t\t\t\t\tIsLocal: false,\n\t\t\t\t}\n\t\t\t\tinvalidatedRequests++\n\t\t\t} else {\n\t\t\t\t// put the request back to the active list\n\t\t\t\tf.activeRequests[req.hash] = append(f.activeRequests[req.hash], req)\n\t\t\t}\n\t\t}\n\t\t// the remaining requests in pendingRequests is either invalid (exceed MaxRetriesForRequest) or\n\t\t// put back to the active list.\n\t\tdelete(f.pendingRequests, h)\n\t\tf.activeReqM.Unlock()\n\t}\n\n\t// delete the hash of waiting batch\n\tf.activeBatchM.Lock()\n\tdelete(f.activeBatches, response.ID)\n\tf.activeBatchM.Unlock()\n}", "title": "" }, { "docid": "34d57a1527795bb9fa93083aaf51b8c0", "score": "0.58754945", "text": "func (bruter *Postgres) handle(outChan chan model.Result, errChan chan model.Err) {\n\tdefer bruter.wg.Done()\n\taddr := fmt.Sprintf(\"%s:%d\", bruter.Host, bruter.Port)\n\n\tfor c := range bruter.queue {\n\t\tif !bruter.active.Get() { // possibility to get a recheck or counter\n\t\t\tcontinue\n\t\t}\n\n\t\ttime.Sleep(bruter.sleep)\n\t\tok, err := ConnectPostgres(addr, c, bruter.timeout)\n\t\tif err != nil {\n\t\t\terrStr := err.Error()\n\t\t\tshouldContinue := true\n\n\t\t\tif strings.Contains(errStr, \"password authentication failed for user\") {\n\t\t\t\tif bruter.LogFailedAttempts {\n\t\t\t\t\tlog.Println(\"Failed for\", addr, string(c.ToJson()))\n\t\t\t\t}\n\t\t\t\tcontinue\n\t\t\t}\n\n\t\t\tif !shouldContinue {\n\t\t\t\tlog.Println(\"Disable Bruteforce (conn reset) for \", PostgresName, bruter.Host)\n\t\t\t\tbruter.active.Set(false)\n\t\t\t}\n\t\t\terrChan <- model.Err{\n\t\t\t\tError: err.Error(),\n\t\t\t\tHost: bruter.Host,\n\t\t\t\tPort: strconv.Itoa(bruter.Port),\n\t\t\t\tAddr: addr,\n\t\t\t}\n\t\t}\n\n\t\tif ok {\n\t\t\tif bruter.StopIfSuccess {\n\t\t\t\tbruter.active.Set(false)\n\t\t\t}\n\n\t\t\toutChan <- model.Result{\n\t\t\t\tService: PostgresName,\n\t\t\t\tHost: bruter.Host,\n\t\t\t\tCredential: c,\n\t\t\t\tPort: strconv.Itoa(bruter.Port),\n\t\t\t}\n\t\t}\n\t}\n}", "title": "" }, { "docid": "8af30f15c750f93838520a5986dd5bf8", "score": "0.58655655", "text": "func (d *DefaultDiscovery) run() {\n\tvar requested, oldRequest, r int\n\tvar ok bool\n\n\tfor {\n\t\tif requested == 0 {\n\t\t\trequested, ok = <-d.requestCh\n\t\t}\n\t\toldRequest = requested\n\t\tfor ok && requested > 0 {\n\t\t\tselect {\n\t\t\tcase r, ok = <-d.requestCh:\n\t\t\t\tif requested <= r {\n\t\t\t\t\trequested = r\n\t\t\t\t}\n\t\t\tcase addr := <-d.pool:\n\t\t\t\tupdatePoolCountMetric(d.PoolCount())\n\t\t\t\td.lock.Lock()\n\t\t\t\tif !d.connectedAddrs[addr] && !d.attempted[addr] {\n\t\t\t\t\td.attempted[addr] = true\n\t\t\t\t\tgo d.tryAddress(addr)\n\t\t\t\t\trequested--\n\t\t\t\t}\n\t\t\t\td.lock.Unlock()\n\t\t\tdefault: // Empty pool\n\t\t\t\tvar added int\n\t\t\t\td.lock.Lock()\n\t\t\t\tfor _, addr := range d.seeds {\n\t\t\t\t\tif !d.connectedAddrs[addr] {\n\t\t\t\t\t\tdelete(d.badAddrs, addr)\n\t\t\t\t\t\td.unconnectedAddrs[addr] = connRetries\n\t\t\t\t\t\td.pushToPoolOrDrop(addr)\n\t\t\t\t\t\tadded++\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\td.lock.Unlock()\n\t\t\t\t// The pool is empty, but all seed nodes are already connected,\n\t\t\t\t// we can end up in an infinite loop here, so drop the request.\n\t\t\t\tif added == 0 {\n\t\t\t\t\trequested = 0\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tif !ok {\n\t\t\treturn\n\t\t}\n\t\t// Special case, no connections after all attempts.\n\t\td.lock.RLock()\n\t\tconnected := len(d.connectedAddrs)\n\t\td.lock.RUnlock()\n\t\tif connected == 0 {\n\t\t\ttime.Sleep(d.dialTimeout)\n\t\t\trequested = oldRequest\n\t\t}\n\t}\n}", "title": "" }, { "docid": "d23d6c755990d7f194c6f36cb5c4c211", "score": "0.5860612", "text": "func (r *Requester) MakeRequests(companies []string, options map[string]interface{}) {\n c := make(chan *Response)\n for _, symbol := range companies {\n r.activeRequests++\n r.Work <- *NewRequest(c, symbol, options)\n // If we need to wait for a request to finish do not implement an additional delay\n if r.manageActiveProc(c) {\n continue \n } else {\n time.Sleep(r.requestDelay) \n }\n }\n r.waitToFinish(c, companies)\n writeToCsv(r.allResponses)\n}", "title": "" }, { "docid": "e16010e57a71319a3ae035a27a0d9bc7", "score": "0.5856233", "text": "func forward(in <-chan minicli.Responses, out chan<- minicli.Responses) {\n\tfor v := range in {\n\t\tout <- v\n\t}\n}", "title": "" }, { "docid": "98d2a2b4d1f6c25bfc3e2f0f9ba21872", "score": "0.58488715", "text": "func(network *Network) workerFindData(requestsChannel chan Request, targetId KademliaID, responseChannel chan Response, isForNode bool) {\n\n\tfor {\n\t\trequest := <- requestsChannel\n\t\tif(request.endWork){\n\t\t\tbreak\n\t\t}\n\t\tfmt.Print(\"request: \")\n\t\tfmt.Println(request.contact)\n\t\tif !isForNode {\n\t\t\tselect {\n\t\t\t\tcase responseChannel <- network.SendFindDataValue(targetId, request.contact):\n\t\t\t\tcase <-time.After(time.Second * 5): fmt.Println(\"Timeout Send Data\")\n\t\t\t}\n\t\t} else {\n\t\t\tselect {\n\t\t\t\tcase\tresponseChannel <- network.SendFindContactMessage(&targetId, request.contact):\n\t\t\t\tcase <-time.After(time.Second * 3):fmt.Println(\"Timeout Send Contact\")\n\t\t\t}\n\t\t}\n\t}\n}", "title": "" }, { "docid": "4095f013aef37facb886393a7635eecb", "score": "0.58457917", "text": "func (w *Worker) Start() {\n go func() {\n for {\n // Add ourselves into the worker queue.\n w.WorkerQueue <- w.Work\n log.Printf(\"adding worker to queue\\n\")\n\n select {\n case work := <-w.Work:\n // Receive a work request.\n switch work.JobType{\n case RequestPost:\n var post db_handler.Post\n json.Unmarshal(work.Data, &post)\n log.Printf(\"worker%d: Received work request, get Post %s \\n\", w.ID, post.Content)\n go db_handler.CreatePost(post) \n case RequestComment:\n var comment db_handler.Comment\n json.Unmarshal(work.Data, &comment)\n log.Printf(\"worker%d: Received work request, get Post %s \\n\", w.ID, comment.Comment)\n go db_handler.CreateComment(comment)\n case RequestLike:\n var comment db_handler.Comment\n json.Unmarshal(work.Data, &comment)\n log.Printf(\"worker%d: Received work request, get Post %s \\n\", w.ID, comment.Id)\n go db_handler.IncrementLike(strconv.Itoa(comment.Id))\n }\n // fmt.Printf(\"worker%d: Received work request, delaying for %f seconds\\n\", w.ID, work.Delay.Seconds())\n \n // time.Sleep(work.Delay)\n // fmt.Printf(\"worker%d: Hello, %s!\\n\", w.ID, work.Name)\n \n case <-w.QuitChan:\n // We have been asked to stop.\n log.Printf(\"worker%d stopping\\n\", w.ID)\n return\n }\n }\n }()\n}", "title": "" }, { "docid": "780e2f8bdd0b4732e7b115da657e8caa", "score": "0.58407056", "text": "func runner(c chan *msg, req *http.Request, rps int, duration int) {\n\tvar wg sync.WaitGroup\n\n\t// \"request per second\" to \"time used for one request\"\n\t// nanoseconds per request (request interval in nanoseconds)\n\tnpr := time.Duration(1000000000 / rps)\n\ttimeShouldPass := npr\n\n\tstart := time.Now()\n\tfor i := 0; i < rps*duration; i += 1 {\n\t\twg.Add(1)\n\n\t\tgo func() {\n\t\t\tdefer wg.Done()\n\n\t\t\tduration, err := request(req)\n\t\t\tm := &msg{\n\t\t\t\tduration: duration,\n\t\t\t\terror: errors.Wrap(err, \"error while request\"),\n\t\t\t}\n\n\t\t\tc <- m\n\t\t}()\n\n\t\ttimeShouldPass += npr\n\t\ttimePassed := time.Since(start)\n\t\ttimeToSleep := timeShouldPass - timePassed\n\t\t// case when request took longer than needed for required requests per second\n\t\tif timeToSleep <= 0 {\n\t\t\tcontinue\n\t\t}\n\n\t\ttime.Sleep(timeToSleep)\n\t}\n\n\twg.Wait()\n\tclose(c)\n}", "title": "" }, { "docid": "4b11be45ec7268180253cbb0337240cf", "score": "0.58331156", "text": "func dispatchJoinReplies() {\n\tfor range time.Tick(time.Second * time.Duration(joinReplyInterval)) {\n\t\tfor i := 0; i < (joinReplyLen / 2); i++ {\n\t\t\tsendMessage(\n\t\t\t\t<-joinReplyChan,\n\t\t\t\tfmt.Sprintf(\"%d%s%s\", spec.JOINREPLY, delimiter, spec.EncodeMemberMap(&memberMap)),\n\t\t\t\tfalse,\n\t\t\t)\n\t\t}\n\t}\n}", "title": "" }, { "docid": "989d969c393a33dcf7368378fbb9636e", "score": "0.5831946", "text": "func worker(context *zmq.Context, uri string, queue <-chan *validator_pb2.Message, done chan<- bool, handlers []TransactionHandler) {\n\t// Connect to the main send/receive thread\n\tconnection, err := messaging.NewConnection(context, zmq.DEALER, uri, false)\n\tif err != nil {\n\t\tlogger.Errorf(\"Failed to connect to main thread: %v\", err)\n\t\tdone <- false\n\t\treturn\n\t}\n\tdefer connection.Close()\n\tid := connection.Identity()\n\n\t// Receive work off of the queue until the queue is closed\n\tfor msg := range queue {\n\t\trequest := &processor_pb2.TpProcessRequest{}\n\t\terr = proto.Unmarshal(msg.GetContent(), request)\n\t\tif err != nil {\n\t\t\tlogger.Errorf(\n\t\t\t\t\"(%v) Failed to unmarshal TpProcessRequest: %v\", id, err,\n\t\t\t)\n\t\t\tbreak\n\t\t}\n\n\t\theader := request.GetHeader()\n\n\t\t// Try to find a handler\n\t\thandler, err := findHandler(handlers, header)\n\t\tif err != nil {\n\t\t\tlogger.Errorf(\"(%v) Failed to find handler: %v\", id, err)\n\t\t\tbreak\n\t\t}\n\n\t\t// Construct a new Context instance for the handler\n\t\tcontextId := request.GetContextId()\n\t\tcontext := NewContext(connection, contextId)\n\n\t\t// Run the handler\n\t\terr = handler.Apply(request, context)\n\n\t\t// Process the handler response\n\t\tresponse := &processor_pb2.TpProcessResponse{}\n\t\tif err != nil {\n\t\t\tswitch e := err.(type) {\n\t\t\tcase *InvalidTransactionError:\n\t\t\t\tlogger.Warnf(\"(%v) %v\", id, e)\n\t\t\t\tresponse.Status = processor_pb2.TpProcessResponse_INVALID_TRANSACTION\n\t\t\t\tresponse.Message = e.Msg\n\t\t\t\tresponse.ExtendedData = e.ExtendedData\n\t\t\tcase *InternalError:\n\t\t\t\tlogger.Warnf(\"(%v) %v\", id, e)\n\t\t\t\tresponse.Status = processor_pb2.TpProcessResponse_INTERNAL_ERROR\n\t\t\t\tresponse.Message = e.Msg\n\t\t\t\tresponse.ExtendedData = e.ExtendedData\n\t\t\tcase *AuthorizationException:\n\t\t\t\tlogger.Warnf(\"(%v) %v\", id, e)\n\t\t\t\tresponse.Status = processor_pb2.TpProcessResponse_INVALID_TRANSACTION\n\t\t\t\tresponse.Message = e.Msg\n\t\t\t\tresponse.ExtendedData = e.ExtendedData\n\t\t\tdefault:\n\t\t\t\tlogger.Errorf(\"(%v) Unknown error: %v\", id, err)\n\t\t\t\tresponse.Status = processor_pb2.TpProcessResponse_INTERNAL_ERROR\n\t\t\t\tresponse.Message = e.Error()\n\t\t\t}\n\t\t} else {\n\t\t\tresponse.Status = processor_pb2.TpProcessResponse_OK\n\t\t}\n\n\t\tresponseData, err := proto.Marshal(response)\n\t\tif err != nil {\n\t\t\tlogger.Errorf(\"(%v) Failed to marshal TpProcessResponse: %v\", id, err)\n\t\t\tbreak\n\t\t}\n\n\t\t// Send back a response to the validator\n\t\terr = connection.SendMsg(\n\t\t\tvalidator_pb2.Message_TP_PROCESS_RESPONSE,\n\t\t\tresponseData, msg.GetCorrelationId(),\n\t\t)\n\t\tif err != nil {\n\t\t\tlogger.Errorf(\"(%v) Error sending TpProcessResponse: %v\", id, err)\n\t\t\tbreak\n\t\t}\n\t}\n\n\tdone <- true\n}", "title": "" }, { "docid": "a278fab8a59f75c7c19c1ac14cae23a2", "score": "0.5830621", "text": "func (server *HttpServer)serve(c chan *Request) {\n\tfor request :=range c{\n\t\tserver.pool.JobQueue<- func() {\n\t\t\trequest.handle(context.TODO())\n\t\t}\n\t}\n}", "title": "" }, { "docid": "748e6fd32b16e7e007763c4876d426c5", "score": "0.58278847", "text": "func (h *HTTPConn) serveLoop(handler http.Handler,\n reqCh chan *HTTPRcvdReq, rspCh chan *HTTPRcvdRsp, errCh chan error) error {\n\n var tempDelay time.Duration // how long to sleep on accept failure\n h.mu.Lock()\n listener := h.listener\n h.wg.Add(1)\n defer h.wg.Done()\n h.mu.Unlock()\n\n for {\n if listener == nil {\n return fmt.Errorf(\"nil listener in serveLoop\")\n }\n conn, errAcc := listener.Accept()\n if errAcc != nil {\n if ne, ok := errAcc.(net.Error); ok && ne.Temporary() {\n if tempDelay == 0 {\n tempDelay = 5 * time.Millisecond\n } else {\n tempDelay *= 2\n }\n if max := 1 * time.Second; tempDelay > max {\n tempDelay = max\n }\n glog.Infof(\"accept error: %v; retrying in %v\", errAcc, tempDelay)\n time.Sleep(tempDelay)\n continue\n }\n if strings.Contains(errAcc.Error(),\n \"use of closed network connection\") {\n glog.V(1).Infof(\"network connection closed on server :: %v\", errAcc)\n } else {\n // This will happen when server closes while we are in accept.\n glog.V(1).Infof(\"error in accept :: \", errAcc)\n }\n return errAcc\n }\n tempDelay = 0\n glog.V(1).Info(\"accepted new connection\")\n h.ServeConn(conn, handler, reqCh, rspCh, errCh)\n }\n}", "title": "" }, { "docid": "7300bb036ba161b91148e76d23aa9084", "score": "0.5826865", "text": "func (r *Requester) manageActiveProc(c chan *Response) bool {\n if r.activeRequests == r.maxRequests {\n resp := <- c\n r.allResponses = append(r.allResponses, resp)\n r.activeRequests--\n return true\n }\n return false\n}", "title": "" }, { "docid": "3f5e4cf9ea077e5aecbaed819eec359a", "score": "0.5821078", "text": "func (ctrl *Controller) worker() {\n\tfor ctrl.processNextWorkItem() {\n\t}\n}", "title": "" }, { "docid": "55cab8cef70e9b7f3d7ff1e2188e08ea", "score": "0.58199996", "text": "func (c Consumer) handleResponses() {\n\tfor response := range c.responseChan {\n\t\twg := sync.WaitGroup{}\n\t\tfor _, message := range response.Messages {\n\t\t\twg.Add(1)\n\t\t\tgo func(message sqs.Message) {\n\t\t\t\tdefer wg.Done()\n\t\t\t\tc.handleMessage(message)\n\t\t\t}(message)\n\t\t\tif c.waitForCompletion {\n\t\t\t\twg.Wait()\n\t\t\t}\n\t\t}\n\t\twg.Wait()\n\t}\n}", "title": "" }, { "docid": "8eafa00bb35ab6910dc534172e748743", "score": "0.5816587", "text": "func Do(p *Params) []Response {\r\n\tif !p.TurnOffMultithread {\r\n\t\truntime.GOMAXPROCS(runtime.NumCPU())\r\n\t}\r\n\tw := &work{\r\n\t\tworkers: func(wn int) int {\r\n\t\t\tif wn > 0 {\r\n\t\t\t\treturn wn\r\n\t\t\t}\r\n\t\t\treturn workerNumber\r\n\t\t}(p.Workers),\r\n\t\tparams: p,\r\n\t}\r\n\tfor i := range w.params.Requests {\r\n\t\tw.params.Requests[i].index = i\r\n\t}\r\n\tres := w.requestHandler()\r\n\r\n\t// Output : Response from all requests\r\n\treturn res.result\r\n}", "title": "" }, { "docid": "056742c87ff2fc9c6012f45369ece963", "score": "0.5815278", "text": "func clients(ips []string, ch chan string, myIP string) {\n // We handle every client (connected ip) concurrently.\n for _, c := range connections{\n go handleClient(*c, myIP)\n }\n\n for {\n if initial && firstWave {\n for _, c := range connections {\n c.Channel <- \"hello\"\n }\n fmt.Println(\"Init -> Sending first wave message to neighbours\")\n firstWave = false\n }\n\n message, _ := <- ch\n messages := strings.Split(message, \";\")\n if messages[0] == \"parent\" {\n if messages[1] == \"hello\"{\n fmt.Println(\"Sending first wave message to parent\")\n } else {\n fmt.Println(\"Sending second wave message to parent\")\n }\n parent.Channel <- messages[1]\n } else {\n // Send to connections\n if messages[0] == \"hello\"{\n fmt.Println(\"Sending first wave message to neighbours\")\n } else {\n fmt.Println(\"Sending second wave message to neighbours\")\n }\n for _, c := range connections {\n c.Channel <- messages[0]\n }\n }\n }\n}", "title": "" }, { "docid": "82c0003af9de4258c837b1d2492ee47f", "score": "0.58148175", "text": "func doReceive(prefix string, nc netConn, mutch chan<- []*protobuf.VbKeyVersions, reqch chan<- []interface{}) {\n\tconn, worker := nc.conn, nc.worker\n\tflags := TransportFlag(0).SetProtobuf() // TODO: make it configurable\n\tpkt := NewTransportPacket(c.MaxDataportPayload, flags)\n\tmsg := serverMessage{raddr: conn.RemoteAddr().String()}\n\n\tstarted := make(map[string]*activeVb) // TODO: avoid magic numbers\n\tfinished := make(map[string]*activeVb) // TODO: avoid magic numbers\n\n\t// detect StreamBegin and StreamEnd messages.\n\t// TODO: function uses 2 level of loops, figure out a smart way to identify\n\t// presence of StreamBegin/StreamEnd so that we can avoid looping.\n\tupdateActiveVbuckets := func(vbs []*protobuf.VbKeyVersions) {\n\t\tfor _, vb := range vbs {\n\t\t\tbucket, vbno := vb.GetBucketname(), uint16(vb.GetVbucket())\n\t\t\tkvs := vb.GetKvs()\n\n\t\t\tcommands := make([]uint32, 0, len(kvs))\n\t\t\tseqnos := make([]uint64, 0, len(kvs))\n\n\t\t\t// TODO: optimize this.\n\t\t\tfor _, kv := range kvs {\n\t\t\t\tseqnos = append(seqnos, kv.GetSeqno())\n\t\t\t\tcommands = append(commands, kv.GetCommands()...)\n\t\t\t\tcommands = append(commands, 17)\n\n\t\t\t\tavb := &activeVb{bucket, vbno}\n\t\t\t\tif byte(kv.GetCommands()[0]) == c.StreamBegin {\n\t\t\t\t\tstarted[avb.id()] = avb\n\t\t\t\t} else if byte(kv.GetCommands()[0]) == c.StreamEnd {\n\t\t\t\t\tfinished[avb.id()] = avb\n\t\t\t\t}\n\t\t\t}\n\t\t\tc.Tracef(\"%v {%v, %v}\\n\", prefix, bucket, vbno)\n\t\t}\n\t}\n\nloop:\n\tfor {\n\t\ttimeoutMs := c.DataportReadDeadline * time.Millisecond\n\t\tconn.SetReadDeadline(time.Now().Add(timeoutMs))\n\t\tmsg.cmd, msg.err, msg.args = 0, nil, nil\n\t\tif payload, err := pkt.Receive(conn); err != nil {\n\t\t\tmsg.cmd, msg.err = serverCmdError, err\n\t\t\treqch <- []interface{}{msg}\n\t\t\tc.Errorf(\"%v worker %q exited %v\\n\", prefix, msg.raddr, err)\n\t\t\tbreak loop\n\n\t\t} else if vbmap, ok := payload.(*protobuf.VbConnectionMap); ok {\n\t\t\tmsg.cmd, msg.args = serverCmdVbmap, []interface{}{vbmap}\n\t\t\treqch <- []interface{}{msg}\n\t\t\tc.Infof(\n\t\t\t\t\"%v worker %q exiting with `serverCmdVbmap`\\n\",\n\t\t\t\tprefix, msg.raddr)\n\t\t\tbreak loop\n\n\t\t} else if vbs, ok := payload.([]*protobuf.VbKeyVersions); ok {\n\t\t\tupdateActiveVbuckets(vbs)\n\t\t\tselect {\n\t\t\tcase mutch <- vbs:\n\t\t\t\tif len(started) > 0 || len(finished) > 0 {\n\t\t\t\t\tmsg.cmd = serverCmdVbcontrol\n\t\t\t\t\tmsg.args = []interface{}{started, finished}\n\t\t\t\t\treqch <- []interface{}{msg}\n\t\t\t\t\tc.Infof(\n\t\t\t\t\t\t\"%v worker %q exit with %q {%v,%v}\\n\",\n\t\t\t\t\t\tprefix, msg.raddr, `serverCmdVbcontrol`,\n\t\t\t\t\t\tlen(started), len(finished))\n\t\t\t\t\tbreak loop\n\t\t\t\t}\n\n\t\t\tcase <-worker:\n\t\t\t\tmsg.cmd, msg.err = serverCmdError, ErrorWorkerKilled\n\t\t\t\treqch <- []interface{}{msg}\n\t\t\t\tc.Errorf(\"%v worker %q exited %v\\n\", prefix, msg.raddr, msg.err)\n\t\t\t\tbreak loop\n\t\t\t}\n\n\t\t} else {\n\t\t\tmsg.cmd, msg.err = serverCmdError, ErrorPayload\n\t\t\treqch <- []interface{}{msg}\n\t\t\tc.Errorf(\"%v worker %q exited %v\\n\", prefix, msg.raddr, err)\n\t\t\tbreak loop\n\t\t}\n\t}\n\tnc.active = false\n}", "title": "" }, { "docid": "3f7c87ea74e2c3698a7bb5d1664e76b6", "score": "0.5810166", "text": "func (c *Controller) worker(logger klog.Logger) {\n\tfor c.processNextWorkItem(logger) {\n\t}\n}", "title": "" }, { "docid": "a3e70942322c12b1aa45b4e3ac9e5ffc", "score": "0.57912976", "text": "func (c *connection) run() {\n\tfor in := range c.connection.Incoming() {\n\t\tdebugf(\"incoming %v\", in)\n\n\t\tswitch in := in.(type) {\n\n\t\tcase *electron.IncomingSender:\n\t\t\ts := in.Accept().(electron.Sender)\n\t\t\tgo c.sender(s)\n\n\t\tcase *electron.IncomingReceiver:\n\t\t\tin.SetPrefetch(true)\n\t\t\tin.SetCapacity(*credit) // Pre-fetch up to credit window.\n\t\t\tr := in.Accept().(electron.Receiver)\n\t\t\tgo c.receiver(r)\n\n\t\tdefault:\n\t\t\tin.Accept() // Accept sessions unconditionally\n\t\t}\n\t}\n\tdebugf(\"incoming closed: %v\", c.connection)\n}", "title": "" }, { "docid": "287d919906e7b31a59e4ae74727c3a5e", "score": "0.5783245", "text": "func (ctrl *ClusterController) worker(ctx context.Context) {\n\tfor ctrl.processNextWorkItem(ctx) {\n\t}\n}", "title": "" }, { "docid": "1ecbd4f552a1fb7ae808e5e570adbeb4", "score": "0.5782042", "text": "func (c *Client) loop() {\n\tvar errc chan error\n\tvar fail error\n\n\t// Loop until we receive a quit request or hit an error\n\tfor fail == nil && errc == nil {\n\t\t// Decode the next message from the data stream\n\t\ttopic, action, data, err := c.decode()\n\t\tif err != nil {\n\t\t\tif err != io.EOF {\n\t\t\t\tfail = err\n\t\t\t}\n\t\t\tbreak\n\t\t}\n\t\t// Depending on its content, forward to the appropriate channel\n\t\tswitch topic {\n\t\tcase topicConnection:\n\t\t\tswitch {\n\t\t\tcase action == actionPing:\n\t\t\t\tif err := c.encode(topicConnection, actionPong); err != nil {\n\t\t\t\t\tfail = err\n\t\t\t\t\tbreak\n\t\t\t\t}\n\t\t\tdefault:\n\t\t\t\tfail = fmt.Errorf(\"unknown connecrtion action: %s\", action)\n\t\t\t}\n\t\t\tcontinue\n\n\t\tcase topicAuth:\n\t\t\t// If a login response came, send success or failure back\n\t\t\tc.loginLock.Lock()\n\t\t\tresc := c.loginRes\n\t\t\tc.loginLock.Unlock()\n\n\t\t\tswitch {\n\t\t\tcase resc == nil:\n\t\t\t\tfail = errors.New(\"no login pending\")\n\t\t\tcase action == actionAck:\n\t\t\t\tresc <- nil\n\t\t\tcase action == actionError:\n\t\t\t\tresc <- fmt.Errorf(\"%s\", data)\n\t\t\tdefault:\n\t\t\t\tfail = fmt.Errorf(\"unknown auth action: %s\", action)\n\t\t\t}\n\t\t\tcontinue\n\n\t\tcase topicEvent:\n\t\t\t// An event topic may either receive an operation result or a publish\n\t\t\tswitch action {\n\t\t\tcase actionAck, actionError:\n\t\t\t\tfail = c.finishEventOperation(action, data)\n\t\t\tcase actionEvent:\n\t\t\t\tfail = c.processEvent(data)\n\t\t\tdefault:\n\t\t\t\tfail = fmt.Errorf(\"unknown event action: %s\", action)\n\t\t\t}\n\t\t\tcontinue\n\t\t}\n\t\tfmt.Println(topic, action, data)\n\t}\n\t// Client terminating, wait for quit channel and return\n\tif errc == nil {\n\t\terrc = <-c.quit\n\t}\n\terrc <- fail\n}", "title": "" }, { "docid": "31c169e907e314f42015bf4085a79ced", "score": "0.57607883", "text": "func worker(ports chan int, results chan int, url string) {\n\tfor p := range ports {\n\t\taddress := fmt.Sprintf(\"%s:%d\", url, p)\n\t\tconn, err := net.Dial(\"tcp\", address)\n\t\tif err != nil {\n\t\t\tresults <- 0\n\t\t\tcontinue\n\t\t}\n\t\tconn.Close()\n\t\tresults <- p\n\t}\n}", "title": "" } ]
d122e15ebafc3ac95fdacf057431ec3a
ServeHTTP modifies a posts
[ { "docid": "a00f1b82454263b7bb2d179287aead84", "score": "0.7003452", "text": "func (p PostEditHandler) ServeHTTP(w http.ResponseWriter, r *http.Request) {\n\tdata := LayoutData(w, r)\n\n\tdata, errStr := servePostPage(r, data, p.Database)\n\tif errStr != \"\" {\n\t\tdata = data.MergeKV(\"error\", errStr)\n\t\tmustRender(w, r, \"posts\", data)\n\t\treturn\n\t}\n\n\t/*u, ok := getUser(w, r, p.Authboss)\n\tif !ok {\n\t\thttp.Redirect(w, r, strings.TrimRight(r.RequestURI, \"/new_post\"), http.StatusFound)\n\t\treturn\n\t}\n\tuser, ok := u.(*models.User)\n\tif !ok {\n\t\thttp.Redirect(w, r, strings.TrimRight(r.RequestURI, \"/new_post\"), http.StatusFound)\n\t\treturn\n\t}*/\n\n\tattr, err := authboss.AttributesFromRequest(r)\n\tif err != nil {\n\t\tlog.WithError(err).Error(\"internal error when parsing request\")\n\t\tdata = data.MergeKV(\"error\", \"internal error\")\n\t\tmustRender(w, r, \"posts\", data)\n\t\treturn\n\t}\n\n\tpostVar, ok := mux.Vars(r)[\"post\"]\n\tif !ok {\n\t\tdata = data.MergeKV(\"error\", \"Invalid comment ID\")\n\t\tmustRender(w, r, \"posts\", data)\n\t\treturn\n\t}\n\n\tpost := &models.Post{}\n\tid, err := strconv.ParseUint(postVar, 10, 32)\n\tif err != nil {\n\t\tdata = data.MergeKV(\"error\", \"Invalid comment ID\")\n\t\tmustRender(w, r, \"posts\", data)\n\t\treturn\n\t}\n\tpost.ID = uint(id)\n\n\terr = p.Database.First(&post).Error\n\tif err != nil {\n\t\tlog.WithError(err).Error(\"internal error when retriving post from database\")\n\t\tdata = data.MergeKV(\"error\", \"internal error\")\n\t\tmustRender(w, r, \"posts\", data)\n\t\treturn\n\t}\n\tdata = data.MergeKV(\"edit_post\", post)\n\n\tif r.Method == \"GET\" {\n\t\tmustRender(w, r, \"posts\", data)\n\t\treturn\n\t}\n\n\tcomment, ok := attr.String(\"comment\")\n\tif !ok {\n\t\tdata = data.MergeKV(\"error\", \"Invalid comment\")\n\t\tmustRender(w, r, \"posts\", data)\n\t\treturn\n\t}\n\tpost.Comment = comment\n\n\terr = p.Database.Model(&post).Updates(&post).Error\n\tif err != nil {\n\t\tlog.WithError(err).Error(\"internal error when updating post in the database\")\n\t\tdata = data.MergeKV(\"error\", \"internal error\")\n\t\tmustRender(w, r, \"posts\", data)\n\t\treturn\n\t}\n\n\thttp.Redirect(w, r, \"/forums/thread/\"+mux.Vars(r)[\"thread\"], http.StatusFound)\n}", "title": "" } ]
[ { "docid": "d8ede841ad4678934ac07f9d94b25278", "score": "0.6268061", "text": "func (s PostsShowHandler) ServeHTTP(w http.ResponseWriter, r *http.Request) {\n\tdata := LayoutData(w, r)\n\n\tdata, err := servePostPage(r, data, s.Database)\n\tif err != \"\" {\n\t\tdata = data.MergeKV(\"error\", err)\n\t}\n\n\tmustRender(w, r, \"posts\", data)\n}", "title": "" }, { "docid": "0a46bf9a76309652b61b59ca040a733c", "score": "0.62455", "text": "func (p PostCreateHandler) ServeHTTP(w http.ResponseWriter, r *http.Request) {\n\tdata := LayoutData(w, r)\n\n\tdata, errStr := servePostPage(r, data, p.Database)\n\tif errStr != \"\" {\n\t\tdata = data.MergeKV(\"error\", errStr)\n\t\tmustRender(w, r, \"posts\", data)\n\t\treturn\n\t}\n\n\tu, ok := getUser(w, r, p.Authboss)\n\tif !ok {\n\t\thttp.Redirect(w, r, strings.TrimRight(r.RequestURI, \"/new_post\"), http.StatusFound)\n\t\treturn\n\t}\n\tuser, ok := u.(*models.User)\n\tif !ok {\n\t\thttp.Redirect(w, r, strings.TrimRight(r.RequestURI, \"/new_post\"), http.StatusFound)\n\t\treturn\n\t}\n\n\tattr, err := authboss.AttributesFromRequest(r)\n\tif err != nil {\n\t\tlog.WithError(err).Error(\"internal error when parsing request\")\n\t\tdata = data.MergeKV(\"error\", \"internal error\")\n\t\tmustRender(w, r, \"posts\", data)\n\t\treturn\n\t}\n\n\tcomment, ok := attr.String(\"comment\")\n\tif !ok {\n\t\tdata = data.MergeKV(\"errs\", map[string][]string{\"comment\": {\"Invalid comment\"}})\n\t\tmustRender(w, r, \"posts\", data)\n\t\treturn\n\t}\n\tdata = data.MergeKV(\"comment\", comment)\n\n\tvar post models.Post\n\tpost.Comment = comment\n\tpost.User = user\n\tpost.Thread = data[\"thread\"].(*models.Thread)\n\n\terr = p.Database.Create(&post).Error\n\tif err != nil {\n\t\tlog.WithError(err).Error(\"internal error when creating a new post\")\n\t\tdata = data.MergeKV(\"error\", \"internal error\")\n\t\tmustRender(w, r, \"posts\", data)\n\t\treturn\n\t}\n\n\thttp.Redirect(w, r, strings.TrimRight(r.RequestURI, \"/new_post\"), http.StatusFound)\n}", "title": "" }, { "docid": "fc8106d782be7a9ef39f5b62f8695d60", "score": "0.62125176", "text": "func (s *Server) getUserPosts(w http.ResponseWriter, r *http.Request) {\n}", "title": "" }, { "docid": "1ff0949bbd43e025118762e40e567b7d", "score": "0.618543", "text": "func (p *PostPutReportUpdater) PostServeHTTP(w http.ResponseWriter, r *http.Request) {\n\n\treportID := chi.URLParam(r, \"reportId\")\n\tmatch := uuidRegex.MatchString(reportID)\n\tif len(reportID) == 0 || !match {\n\t\terr := ErrorResponse{\"path_not_found\", ErrMissingOrIncorrectReportID.Error()}\n\t\terrorResponse(w, http.StatusBadRequest, err)\n\t\treturn\n\t}\n\n\t// call logic\n\tresponseID, err := p.reportUpdater.Update(reportID, \"BLOCKED\")\n\tif err != nil {\n\t\tif err == logic.ErrUnknownReportID {\n\t\t\terr := ErrorResponse{\"entity_not_found\", err.Error()}\n\t\t\terrorResponse(w, http.StatusNotFound, err)\n\t\t\treturn\n\t\t}\n\t\terr := ErrorResponse{\"entity_not_modified\", err.Error()}\n\t\terrorResponse(w, http.StatusInternalServerError, err)\n\t\treturn\n\t}\n\n\t// build response\n\tresponse := Response{responseID}\n\tw.Header().Set(\"Content-Type\", \"application/json\")\n\tw.WriteHeader(http.StatusOK)\n\n\tjsonEnc := json.NewEncoder(w)\n\terr = jsonEnc.Encode(&response)\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n}", "title": "" }, { "docid": "0a84f309e49d0fe3137e1b7b71aef5a0", "score": "0.60048443", "text": "func (s *Server) createPost(w http.ResponseWriter, r *http.Request) {\n}", "title": "" }, { "docid": "f47abf6753f46eff7617705ff230fceb", "score": "0.59950715", "text": "func (s *WebHandler) Post(c *gin.Context) {\n\tcats, _ := model.Model.GetCats()\n\tid := c.Param(\"id\")\n\tid = strings.TrimSuffix(id, \".html\")\n\tpostId := util.ToInt(id)\n\tpost, err := model.Model.GetPost(postId)\n\tif err != nil {\n\t\tc.HTML(http.StatusOK, \"404\", gin.H{})\n\t} else {\n\t\tvar nextId, prevId int\n\t\tvar nextTitle, prevTitle string\n\t\tif next, err := model.Model.NextPost(postId); err == nil {\n\t\t\tnextTitle = next.Title\n\t\t\tnextId = next.Id\n\t\t}\n\t\tif prev, err := model.Model.PrevPost(postId); err == nil {\n\t\t\tprevTitle = prev.Title\n\t\t\tprevId = prev.Id\n\t\t}\n\t\t// 更新浏览次数\n\t\t_ = model.Model.PostView(postId)\n\t\t_, isLogin := isAdminLogon(c)\n\t\tnewPost := adaptPost(post, cats)\n\t\tmd := goldmark.New(\n\t\t\tgoldmark.WithExtensions(\n\t\t\t\textension.GFM,\n\t\t\t\textension.Typographer,\n\t\t\t\textension.DefinitionList,\n\t\t\t\t&toc.Extender{Title: \"文章目录\"},\n\t\t\t),\n\t\t\tgoldmark.WithParserOptions(\n\t\t\t\tparser.WithAutoHeadingID(),\n\t\t\t),\n\t\t\tgoldmark.WithRendererOptions(\n\t\t\t\thtml.WithUnsafe(),\n\t\t\t\thtml.WithHardWraps(),\n\t\t\t\thtml.WithXHTML(),\n\t\t\t),\n\t\t)\n\t\tvar buf bytes.Buffer\n\t\terr := md.Convert([]byte(post.Content), &buf)\n\t\tif err != nil {\n\n\t\t}\n\t\t// 新窗口跳转\n\t\tnewPost.Content = strings.ReplaceAll(buf.String(), \"<a \", \"<a target='_blank'\")\n\t\tc.HTML(http.StatusOK, \"post\", gin.H{\n\t\t\t\"title\": post.Title,\n\t\t\t\"content\": post.Content,\n\t\t\t\"post\": newPost,\n\t\t\t\"nextTitle\": nextTitle,\n\t\t\t\"nextId\": nextId,\n\t\t\t\"prevTitle\": prevTitle,\n\t\t\t\"prevId\": prevId,\n\t\t\t\"isLogin\": isLogin,\n\t\t\t\"activeNav\": \"home\",\n\t\t\t\"side\": getSideData(),\n\t\t\t\"n\": (time.Now().Unix() - post.Created) / (86400 * 360),\n\t\t\t\"PAGE_ID\": fmt.Sprintf(\"detail-%v\", post.Id),\n\t\t\t\"unescaped\": func(str string) template.HTML { return template.HTML(str) },\n\t\t})\n\t}\n}", "title": "" }, { "docid": "194234cfa18af48e357579b8db5ca7f7", "score": "0.5967177", "text": "func (m thunder) ServeHTTP(w http.ResponseWriter, req *http.Request) {\n\t//Must call ParseForm on request in order to use Form (for url and body values)\n\t//or PostForm (for body values)\n\terr := req.ParseForm()\n\tif err != nil {\n\t\tlog.Fatalln(err)\n\t}\n\n\t//Assignment struct and initializing struct with values caching to data\n\tdata := struct {\n\t\tMethod string\n\t\tURL *url.URL\n\t\t//Remember map[string][]string - key is type string and\n\t\t// takes a slice of values\n\t\tSubmissions map[string][]string\n\t\tHeader http.Header\n\t\tHost string\n\t\tContentLength int64\n\t}{\n\t\treq.Method,\n\t\treq.URL,\n\t\t//using Form - After calling ParseForm on request\n\t\treq.Form,\n\t\treq.Header,\n\t\treq.Host,\n\t\treq.ContentLength,\n\t}\n\n\t//Execute template and pass data in\n\ttpl.ExecuteTemplate(w, \"index.gohtml\", data)\n}", "title": "" }, { "docid": "ab5935b4fcf99666aefff11c91bd6de0", "score": "0.5910996", "text": "func PostsHandler(w http.ResponseWriter, r *http.Request) {\n\n\tresJSON(w, posts)\n}", "title": "" }, { "docid": "c9057a8ca49ba67b2d7abc049a493b4f", "score": "0.58451885", "text": "func (m *Middleware) ServeHTTP(w http.ResponseWriter, r *http.Request) {\n\tfor _, h := range m.pre {\n\t\th.ServeHTTP(w, r)\n\t}\n\tm.mux.ServeHTTP(w, r)\n\tfor _, h := range m.post {\n\t\th.ServeHTTP(w, r)\n\t}\n}", "title": "" }, { "docid": "ee6b56c142b2f58f07d80017200c6b46", "score": "0.5807704", "text": "func handlePost(wr http.ResponseWriter, r *http.Request, data method) {\n\twr.Write([]byte(\"POST\"))\n}", "title": "" }, { "docid": "d76e8c6da50b6897a48a2707b824106b", "score": "0.57824206", "text": "func (s *Server) Post(p string, handler http.Handler) {\n\ts.Handle(\"POST\", p, handler)\n}", "title": "" }, { "docid": "d4b438f7588e2141c780c50c797f4f42", "score": "0.5745421", "text": "func servePostPage(r *http.Request, data authboss.HTMLData, db *gorm.DB) (authboss.HTMLData, string) {\n\tcat, ok := mux.Vars(r)[\"thread\"]\n\tif !ok {\n\t\treturn data, \"Invalid thread name\"\n\t}\n\n\tvar thread models.Thread\n\tthreadS := strings.Split(cat, \"-\")\n\tif len(threadS) <= 0 {\n\t\treturn data, \"Invalid thread name\"\n\t}\n\n\tid, err := strconv.ParseUint(threadS[0], 10, 32)\n\tif err != nil {\n\t\treturn data, \"Invalid thread ID\"\n\t}\n\tthread.ID = uint(id)\n\n\terr = db.First(&thread).Error\n\tif err != nil {\n\t\tlog.WithError(err).Error(\"internal error when retriving thread from database\")\n\t\treturn data, \"Internal error\"\n\t}\n\n\tthreadName := strings.Replace(thread.Name, \" \", \"-\", -1)\n\tpath := fmt.Sprintf(\"%d-%s\", thread.ID, threadName)\n\turlPath, err := urlEncoded(path)\n\tif err != nil {\n\t\tlog.WithField(\"path\", path).Error(\"error parsing url\")\n\t\treturn data, \"Internal error\"\n\t}\n\tthread.DisplayName = urlPath\n\tdata = data.MergeKV(\"thread\", &thread)\n\n\tvar posts []models.Post\n\terr = db.Where(\"thread_id = ?\", thread.ID).Find(&posts).Error\n\tif err != nil {\n\t\tlog.WithError(err).Error(\"internal error when retriving posts from database\")\n\t\treturn data, \"Internal error\"\n\t}\n\n\tconv := NewBBCodeConverter()\n\tfor i := range posts {\n\t\tcomment := conv.Convert(posts[i].Comment)\n\t\tposts[i].DisplayComment = template.HTML(comment)\n\n\t\tif posts[i].User != nil {\n\t\t\tposts[i].User = setCustomUserData(posts[i].User).(*models.User)\n\t\t}\n\t}\n\n\tdata = data.MergeKV(\"posts\", posts)\n\treturn data, \"\"\n}", "title": "" }, { "docid": "e92c609d13f15cfe79dcc788994ba580", "score": "0.57405204", "text": "func (self httpFrontend) handle_poster(wr http.ResponseWriter, r *http.Request) {\n path := r.URL.Path\n var board string\n // extract board\n parts := strings.Count(path, \"/\")\n if parts > 1 {\n board = strings.Split(path, \"/\")[2]\n }\n \n // this is a POST request\n if r.Method == \"POST\" && self.AllowNewsgroup(board) && newsgroupValidFormat(board) {\n self.handle_postform(wr, r, board)\n } else {\n wr.WriteHeader(403)\n io.WriteString(wr, \"Nope\")\n }\n}", "title": "" }, { "docid": "bddef4d8fae0fabf7f2d5dc6bc3beb77", "score": "0.5702911", "text": "func (h CreatePageHandler) ServeHTTP(w http.ResponseWriter, r *http.Request) {\n\n\tcp := &CreatePage{Post: &yoradb.Post{}}\n\n\tuser, ok := UserFromContext(r.Context())\n\tif ok {\n\t\tcp.UserName = user.Name\n\t}\n\n\tif !user.CreatePostPermit {\n\t\tw.WriteHeader(http.StatusForbidden)\n\t\tcp.ErrorMessage = \"Недостаточно прав для создания статьи\"\n\t\tErrorTemplate.Execute(w, cp)\n\t\treturn\n\t}\n\n\tif r.Method == http.MethodGet {\n\n\t\tw.WriteHeader(http.StatusOK)\n\n\t\th.template.Execute(w, cp)\n\n\t} else if r.Method == http.MethodPost {\n\n\t\terr := r.ParseForm()\n\t\tif err != nil {\n\t\t\tlog.Printf(\"Error during create page form parse: %v\\n\", err)\n\t\t\tw.WriteHeader(http.StatusInternalServerError)\n\t\t\treturn\n\t\t}\n\t\tpost := &yoradb.Post{}\n\n\t\tpost.Title = template.HTML(r.FormValue(\"title\"))\n\t\tpost.Description = template.HTML(r.FormValue(\"description\"))\n\t\tpost.ImageURL = r.FormValue(\"imageurl\")\n\t\tpost.Annotation = template.HTML(r.FormValue(\"annotation\"))\n\t\tpost.Text = template.HTML(r.FormValue(\"posttext\"))\n\n\t\tvar postID int64\n\t\tpostID, err = h.db.CreatePost(post, user.ID)\n\t\tif err != nil {\n\t\t\tcp.Post = post\n\t\t\tcp.ErrorMessage = err.Error()\n\n\t\t\tlog.Printf(\"Error during insert post in DB: %v\\nUserID: %v\\n\", err, user.ID)\n\n\t\t\tw.WriteHeader(http.StatusOK)\n\t\t\th.template.Execute(w, cp)\n\n\t\t\treturn\n\t\t}\n\n\t\tredirectURL := fmt.Sprintf(\"/post/%v\", postID)\n\t\thttp.Redirect(w, r, redirectURL, http.StatusSeeOther)\n\t}\n}", "title": "" }, { "docid": "8429de55840636e16ab2f287f8727341", "score": "0.5645646", "text": "func (srv *Server) Post(service string) error {\n\tin, out, err := os.Pipe()\n\tif err != nil {\n\t\treturn err\n\t}\n\tf, err := os.OpenFile(\"/srv/\"+service, os.O_CREATE|os.O_WRONLY, 0666)\n\tif err != nil {\n\t\treturn err\n\t}\n\t_, err = f.Write([]byte(fmt.Sprintf(\"%d\", in.Fd())))\n\tif err != nil {\n\t\tin.Close()\n\t\tout.Close()\n\t\tf.Close()\n\t\treturn err\n\t}\n\tnewConn(srv, out).serve()\n\treturn nil\n}", "title": "" }, { "docid": "7420bbade59281aebcf8d058bcba749d", "score": "0.5622832", "text": "func (f *file) ServeHTTP(w http.ResponseWriter, r *http.Request) {\n\tvar buf *bytes.Reader\n\tif v := readerPool.Get(); v == nil {\n\t\tbuf = bytes.NewReader(f.contents)\n\t} else {\n\t\tbuf = v.(*bytes.Reader)\n\t\tbuf.Reset(f.contents)\n\t}\n\thttp.ServeContent(w, r, path.Base(r.URL.Path), modTime, buf)\n}", "title": "" }, { "docid": "87c357320290f5f117cfb307c7b2a542", "score": "0.56218714", "text": "func Post(w http.ResponseWriter, r *http.Request) {\n\tpost := &models.Post{\n\t\tSlug: r.URL.Path[len(\"/post/\"):],\n\t}\n\n\terr := post.Fetch()\n\tif err != nil {\n\t\ttpl.ExecuteTemplate(w, \"404\", nil)\n\t\treturn\n\t}\n\n\ttpl.ExecuteTemplate(w, \"post\", post)\n}", "title": "" }, { "docid": "b78eb1994c6c9124cfdd178b6c3b6bf6", "score": "0.56128174", "text": "func HTTPServer(w http.ResponseWriter, r *http.Request) {\n\tvar d Post\n\n\terr := json.NewDecoder(r.Body).Decode(&d)\n\tif err != nil {\n\t\tw.WriteHeader(http.StatusBadRequest)\n\t\tw.Write([]byte(\"400 - Invalid Parameters!\"))\n\t\treturn\n\t}\n\n\tmsg, err := PostMessage(d)\n\tif err != nil {\n\t\thttp.Error(w, err.Error(), http.StatusInternalServerError)\n\t}\n\tw.WriteHeader(http.StatusOK)\n\tw.Header().Set(\"Content-Type\", \"application/json; charset=utf-8\")\n\tjson.NewEncoder(w).Encode(msg)\n}", "title": "" }, { "docid": "7404284fff791ca81c740e9b7ddc143f", "score": "0.55446124", "text": "func NewPost(w http.ResponseWriter, r *http.Request) {\n\tpageData := context.Get(r, \"PageData\").(*x.PageData)\n\tc := appengine.NewContext(r)\n\tif r.Method == \"GET\" {\n\t\tif err := newPostTmpl.Execute(w, pageData); err != nil {\n\t\t\thttp.Error(w, err.Error(), http.StatusInternalServerError)\n\t\t}\n\t} else if r.Method == \"POST\" {\n\t\tvar post models.Post\n\t\tif title := r.PostFormValue(\"Title\"); title != \"\" {\n\t\t\tpost.Title = title\n\t\t\tpost.JoinedTitle = strings.Join(strings.Split(strings.ToLower(title), \" \"), \"-\")\n\t\t}\n\t\tif abstractMD := r.PostFormValue(\"AbstractMD\"); abstractMD != \"\" {\n\t\t\tpost.AbstractMD = abstractMD\n\t\t\tpost.AbstractHTML = string(blackfriday.MarkdownBasic([]byte(abstractMD)))\n\t\t}\n\t\tif bodymd := r.PostFormValue(\"BodyMD\"); bodymd != \"\" {\n\t\t\tpost.BodyMD = bodymd\n\t\t\tpost.BodyHTML = string(blackfriday.MarkdownBasic([]byte(bodymd)))\n\t\t}\n\t\tif tagStr := r.PostFormValue(\"Tags\"); tagStr != \"\" {\n\t\t\ttags := strings.Split(tagStr, \",\")\n\t\t\tfor i, tag := range tags {\n\t\t\t\ttags[i] = strings.Trim(tag, \" \\t\")\n\t\t\t}\n\t\t\tpost.Tags = tags\n\t\t}\n\n\t\tpost.Author = pageData.Author.Key\n\t\tpost.DateAdded = time.Now()\n\t\tpost.YearAdded = time.Now().Year()\n\t\tpost.MonthAdded = int(time.Now().Month())\n\t\tpost.DayAdded = time.Now().Day()\n\n\t\tif _, err := datastore.Put(c, datastore.NewIncompleteKey(c, \"Post\", nil), &post); err == nil {\n\t\t\thttp.Redirect(w, r, \"/author/\", http.StatusFound)\n\t\t\treturn\n\t\t} else {\n\t\t\thttp.Error(w, err.Error(), http.StatusInternalServerError)\n\t\t\treturn\n\t\t}\n\t}\n}", "title": "" }, { "docid": "0f0e85f770eed0fd8397a84195b4534e", "score": "0.55382013", "text": "func (mid *Middlewares) Post() {\r\n\tif mid.c == nil {\r\n\t\treturn\r\n\t}\r\n\tfor i := len(mid.items); i > 0; i-- {\r\n\t\tmid.items[i-1].Post()\r\n\t}\r\n}", "title": "" }, { "docid": "26e98f29afd01f45002a2194b61b18e2", "score": "0.5527662", "text": "func (mux *ServeMux) ServeHTTP(w ResponseWriter, r *Request)", "title": "" }, { "docid": "49a061beabe96c48e28e3b4d88a83d41", "score": "0.5525894", "text": "func (handler *HTTPCRUDHandler) Post(res http.ResponseWriter, req *http.Request) {\n\tnewItem, err := handler.parseJSON(req.Body)\n\tif err != nil {\n\t\tsendError(res, err)\n\t\treturn\n\t}\n\titems, rowsAffected, err := handler.store.Add(newItem)\n\tif err != nil {\n\t\tsendError(res, err)\n\t\treturn\n\t}\n\tsendSuccess(res, items, rowsAffected)\n}", "title": "" }, { "docid": "8ee318d6854f6068c69eb3e3f07dbfb5", "score": "0.5522191", "text": "func ApiPostHandler(w http.ResponseWriter, r *http.Request) {\n\tvar Data = map[string]interface{}{\n\t\t\"Data\": &models.PostModel{},\n\t}\n\tvars := mux.Vars(r)\n\tw.Header().Set(\"Access-Control-Allow-Origin\", \"*\")\n\tw.Header().Set(\"Access-Control-Allow-Headers\", \"Content-Type\")\n\tlog.Printf(\"/Post/%v @ Post.ApiPostHandler\", vars[\"id\"])\n\tid, err := strconv.Atoi(vars[\"id\"])\n\tIfErr(err, w, r)\n\tData[\"Data\"], _, err = models.Post.ReadPost(id)\n\t// actual.Time = getWakaTime(vars[\"name\"])\n\tif IfErr(err, w, r) {\n\t\tjson.NewEncoder(w).Encode(Data)\n\t}\n}", "title": "" }, { "docid": "7b1f2fe6eaeaca1217720ec619bf82ea", "score": "0.5510447", "text": "func (s *Server) ServeHTTP(w http.ResponseWriter, r *http.Request) {\n\tvar (\n\t\td = rootData{\n\t\t\tBasePath: s.cfg.BasePath,\n\t\t\tGodocURL: s.cfg.GodocURL,\n\t\t\tAnalyticsHTML: s.cfg.AnalyticsHTML,\n\t\t}\n\t\tt *template.Template\n\t)\n\tswitch p := strings.TrimPrefix(r.URL.Path, s.cfg.BasePath); p {\n\tcase \"/\":\n\t\td.Data = s.docs\n\t\tif len(s.docs) > s.cfg.HomeArticles {\n\t\t\td.Data = s.docs[:s.cfg.HomeArticles]\n\t\t}\n\t\tt = s.template.home\n\tcase \"/index\":\n\t\td.Data = s.docs\n\t\tt = s.template.index\n\tcase \"/feed.atom\", \"/feeds/posts/default\":\n\t\tw.Header().Set(\"Content-type\", \"application/atom+xml; charset=utf-8\")\n\t\tw.Write(s.atomFeed)\n\t\treturn\n\tcase \"/.json\":\n\t\tif p := r.FormValue(\"jsonp\"); validJSONPFunc.MatchString(p) {\n\t\t\tw.Header().Set(\"Content-type\", \"application/javascript; charset=utf-8\")\n\t\t\tfmt.Fprintf(w, \"%v(%s)\", p, s.jsonFeed)\n\t\t\treturn\n\t\t}\n\t\tw.Header().Set(\"Content-type\", \"application/json; charset=utf-8\")\n\t\tw.Write(s.jsonFeed)\n\t\treturn\n\tdefault:\n\t\tif redir, ok := s.redirects[p]; ok {\n\t\t\thttp.Redirect(w, r, redir, http.StatusMovedPermanently)\n\t\t\treturn\n\t\t}\n\t\tdoc, ok := s.docPaths[p]\n\t\tif !ok {\n\t\t\t// Not a doc; try to just serve static content.\n\t\t\ts.content.ServeHTTP(w, r)\n\t\t\treturn\n\t\t}\n\t\td.Doc = doc\n\t\tt = s.template.article\n\t}\n\tvar err error\n\tif s.cfg.ServeLocalLinks {\n\t\tvar buf bytes.Buffer\n\t\terr = t.ExecuteTemplate(&buf, \"root\", d)\n\t\tif err != nil {\n\t\t\tlog.Println(err)\n\t\t\treturn\n\t\t}\n\t\t_, err = golangOrgAbsLinkReplacer.WriteString(w, buf.String())\n\t} else {\n\t\terr = t.ExecuteTemplate(w, \"root\", d)\n\t}\n\tif err != nil {\n\t\tlog.Println(err)\n\t}\n}", "title": "" }, { "docid": "2396aecc3aa65063c2c59963a7f48459", "score": "0.5499341", "text": "func HTTPInvoke(http.ResponseWriter, *http.Request) {\n\tctx := context.Background()\n\ts, err := setupSummoner(ctx, false)\n\tif err != nil {\n\t\tlog.Fatalf(\"Failed to setup summoner: %v\", err)\n\t}\n\tif err := s.checkPosts(ctx); err != nil {\n\t\tlog.Fatalf(\"Failed to process posts: %v\", err)\n\t}\n}", "title": "" }, { "docid": "379dd997d1f6be7650cfa6342b148ec1", "score": "0.5491903", "text": "func (e *Echo) Post(url string) *http.ResourceWriter {\n\treturn http.Post(url)\n}", "title": "" }, { "docid": "60d7e1f06888483ca706be2ce159a320", "score": "0.5481061", "text": "func (d *HTTPDispatcher) serve(w http.ResponseWriter, r *http.Request, accept string,\n\tget func() (interface{}, HTTPResponse, error),\n\tbody interface{},\n\tpost func(crypto.PublicKey) (interface{}, HTTPResponse, error)) {\n\n\tswitch r.Method {\n\tcase \"HEAD\":\n\t\twriteResponse(w, r, nil, &HTTPResponse{}, d.ns)\n\n\tcase \"GET\":\n\t\tif get == nil {\n\t\t\twriteError(w, serverErrorf(http.StatusMethodNotAllowed, Malformed, \"Method %s\", r.Method))\n\t\t\treturn\n\t\t}\n\t\tif got := r.Header.Get(acceptHeader); accept != \"*/*\" && got != accept {\n\t\t\twriteError(w, serverErrorf(http.StatusNotAcceptable, Malformed, \"only %s supported, got %s\", accept, got))\n\t\t\treturn\n\t\t}\n\t\tresp, hresp, err := get()\n\t\tif err != nil {\n\t\t\twriteError(w, err)\n\t\t\treturn\n\t\t}\n\t\twriteResponse(w, r, resp, &hresp, d.ns)\n\n\tcase \"POST\":\n\t\tif post == nil {\n\t\t\twriteError(w, serverErrorf(http.StatusMethodNotAllowed, Malformed, \"Method %s\", r.Method))\n\t\t\treturn\n\t\t}\n\t\tif got := r.Header.Get(acceptHeader); accept != \"*/*\" && got != accept {\n\t\t\twriteError(w, serverErrorf(http.StatusNotAcceptable, Malformed, \"only %s supported, got %s\", accept, got))\n\t\t\treturn\n\t\t}\n\t\tkey, err := readRequest(body, r, d.ns)\n\t\tif err != nil {\n\t\t\twriteError(w, err)\n\t\t\treturn\n\t\t}\n\t\tresp, hresp, err := post(key)\n\t\tif err != nil {\n\t\t\twriteError(w, err)\n\t\t\treturn\n\t\t}\n\t\twriteResponse(w, r, resp, &hresp, d.ns)\n\n\tdefault:\n\t\twriteError(w, serverErrorf(http.StatusMethodNotAllowed, Malformed, \"Method %s\", r.Method))\n\t}\n}", "title": "" }, { "docid": "7f074851a5fed7089e05fa70878b8ce5", "score": "0.54759574", "text": "func UpdatePost(c echo.Context) error {\n postParam := BingedUpdatePostParam{}\n\n if err := c.Bind(&postParam); err != nil {\n log.Debugf(\"[UpdatePost]bind data error: %v\", err)\n RequestResult(c, http.StatusBadRequest, nil, \"error\")\n return err\n }\n\n s := c.FormValue(\"pv\")\n v, _ := c.FormParams()\n log.Debugf(\"update post with postParam: %v, %v, %v\", postParam, v, s)\n\n postId, err := strconv.ParseUint(postParam.Id, 10, 64)\n if err != nil {\n RequestResult(c, http.StatusBadRequest, nil, \"wrong id\")\n return err\n }\n\n log.Debugf(\"%v\", postId)\n\n params := make(map[string]interface{})\n\n params[\"id\"] = postId\n if len(postParam.Title) > 0 {\n params[\"title\"] = postParam.Title\n }\n if len(postParam.Content) > 0 {\n params[\"content\"] = postParam.Content\n }\n if len(postParam.Pv) > 0 {\n if pv, err := strconv.Atoi(postParam.Pv); err != nil {\n RequestResult(c, http.StatusBadRequest, nil, \"wrong pv\")\n } else {\n params[\"pv\"] = pv\n }\n }\n \n var post *model.Post\n if _, err := post.UpdatePost(params); err != nil {\n return err\n }\n\n RequestResult(c, http.StatusOK, nil, \"ok\")\n return nil\n}", "title": "" }, { "docid": "1994d639a1f4c1810743b3fd93bd2cd3", "score": "0.5465574", "text": "func (m hotdog) ServeHTTP(w http.ResponseWriter, req *http.Request) {\n err := req.ParseForm()\n if err != nil {\n log.Fatalln(err)\n }\n\n //field attached to req called form\n // saying give me the form\n tpl.ExecuteTemplate(w, \"parseFromIndex.gohtml\", req.Form)\n}", "title": "" }, { "docid": "dd927a7533eac2b87dada75bab9ab100", "score": "0.5461113", "text": "func (srv *Server) ServeHTTP(w http.ResponseWriter, r *http.Request) {\n\tif r.Method != http.MethodPost {\n\t\tif srv.NotFound != nil {\n\t\t\tsrv.NotFound.ServeHTTP(w, r)\n\t\t\treturn\n\t\t}\n\t\thttp.NotFound(w, r)\n\t\treturn\n\t}\n\th, ok := srv.handlers.Load(r.URL.Path)\n\tif !ok {\n\t\tif srv.NotFound != nil {\n\t\t\tsrv.NotFound.ServeHTTP(w, r)\n\t\t\treturn\n\t\t}\n\t\thttp.NotFound(w, r)\n\t\treturn\n\t}\n\thandler, ok := h.(http.Handler)\n\tif !ok {\n\t\tpanic(\"remotohttp: handler is the wrong type\")\n\t}\n\topener := func(_ context.Context, file remototypes.File) (io.ReadCloser, error) {\n\t\tf, _, err := r.FormFile(file.Fieldname)\n\t\treturn f, err\n\t}\n\tr = r.WithContext(remototypes.WithOpener(r.Context(), opener))\n\thandler.ServeHTTP(w, r)\n}", "title": "" }, { "docid": "de32c5dfb3f6b265cf41d9f956df21d8", "score": "0.54571176", "text": "func GetPostsHandler(w http.ResponseWriter, r *http.Request) {\n\trandomFile, _ := os.Open(\"/dev/random\")\n\trandomReader := bufio.NewReader(randomFile)\n\trandomNumber, _ := rand.Int(randomReader, big.NewInt(10))\n\titerCount := int(100 + randomNumber.Int64())\n\n\tfile, _ := os.OpenFile(\"/dev/null\", 0, 644)\n\n\tfor i := 0; i < iterCount; i++ {\n\t\tfor j := 0; j < iterCount; j++ {\n\t\t\tmul := []byte(strconv.Itoa(i * j))\n\t\t\tfile.Write(mul)\n\t\t}\n\t}\n\n\tfile.Close()\n\n\tjson.NewEncoder(w).Encode(posts)\n}", "title": "" }, { "docid": "584edd487d01fe8cfe2c3b3560dd0233", "score": "0.5440032", "text": "func Post(route string, handler interface{}) {\n\tmainServer.Post(route, handler)\n}", "title": "" }, { "docid": "747fd0f222b879a7cb6c9efd0965a2ba", "score": "0.543189", "text": "func updatePost(c *gin.Context) {\n\tfmt.Println(\"here\")\n\tuserEmail, ok := validateToken(c)\n\tif !ok {\n\t\tc.JSON(401, gin.H{\n\t\t\t\"message\": \"permission denied.\",\n\t\t})\n\t\treturn\n\t} else if !validatePost(c) {\n\t\treturn\n\t}\n\tmyform := c.Request.PostForm\n\ttitle := myform[\"title\"][0]\n\tcontent := myform[\"content\"][0]\n\tpostId := c.Param(\"id\")\n\tpostObjectId, err := primitive.ObjectIDFromHex(postId)\n\tif err != nil {\n\t\tc.JSON(400, gin.H{\n\t\t\t\"message\": \"url id is not valid\",\n\t\t})\n\t\treturn\n\t}\n\tcollection := client.Database(\"Web_HW3\").Collection(\"Post\")\n\tfilter := bson.M{\"_id\": postObjectId}\n\tvar targetPost Post\n\terr = collection.FindOne(context.TODO(), filter).Decode(&targetPost)\n\tif err != nil {\n\t\tc.JSON(400, gin.H{\n\t\t\t\"message\": \"url id is not valid\",\n\t\t})\n\t\treturn\n\t}\n\tif targetPost.Created_by != userEmail {\n\t\tc.JSON(401, gin.H{\n\t\t\t\"message\": \"permission denied.\",\n\t\t})\n\t\treturn\n\t}\n\tcollection.UpdateOne(context.TODO(), filter,\n\t\tbson.D{\n\t\t\t{\"$set\", bson.D{{\"title\", title}, {\"content\", content}}},\n\t\t})\n\tc.String(204, \"\")\n}", "title": "" }, { "docid": "7aaef292e27af04349981c50e20e72fc", "score": "0.54302293", "text": "func (p Post) ApplyTo(req *http.Request) {\n req.Method = \"POST\"\n req.URL = p.URL\n req.Body = ioutil.NopCloser(bytes.NewBuffer(p.Body))\n req.ContentLength = int64(len(p.Body))\n req.Header.Set(\"Content-Type\", p.ContentType)\n}", "title": "" }, { "docid": "3b84f81fce8b1fd1b33a17f6340ed945", "score": "0.5423997", "text": "func (m magic) ServeHTTP(w http.ResponseWriter, r *http.Request) {\n\terr := r.ParseForm()\n\tif err != nil {\n\t\tlog.Fatalln(err)\n\t}\n\n\ttpl.ExecuteTemplate(w, \"tpl.gohtml\", r.Form)\n}", "title": "" }, { "docid": "e7076e329c880540c7941ef6111a5a69", "score": "0.54038626", "text": "func (c *Core) ServeHTTP(w http.ResponseWriter, r *http.Request) {\n\tcontext := c.pool.Get().(*context)\n\tcontext.writermem.reset(w)\n\tcontext.r = r\n\tcontext.reset()\n\t//context.w.Header().Set(HeaderServer, serverName)\n\tc.handleHTTPRequest(context)\n\tc.pool.Put(context)\n}", "title": "" }, { "docid": "0316dc02a915afbf18bbbff6b75e7f44", "score": "0.53948087", "text": "func (s *Server) ServeHTTP(w http.ResponseWriter, r *http.Request) {\n\tpayload, err := github.ValidatePayload(r, []byte(s.HmacSecret))\n\tif err != nil {\n\t\tlog.Printf(\"error validating request body: err=%s\\n\", err)\n\t\treturn\n\t}\n\tdefer r.Body.Close()\n\n\tevent, err := github.ParseWebHook(github.WebHookType(r), payload)\n\tif err != nil {\n\t\tlog.Printf(\"could not parse webhook: err=%s\\n\", err)\n\t\treturn\n\t}\n\tif err := s.GitHubEventHandler.HandleEvent(event, payload); err != nil {\n\t\tlog.Println(\"error parsing event.\")\n\t\treturn\n\t}\n}", "title": "" }, { "docid": "e2a4270911bbc80ae5bdd408644bc0c4", "score": "0.5391057", "text": "func (h handler) ServeHTTP(w http.ResponseWriter, r *http.Request) {\n\ttmpl, err := h.tmpl.Render()\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\n\tsession, err := h.store.Get(r, h.config.SessionName)\n\tif err != nil {\n\t\thttp.Error(w, err.Error(), http.StatusInternalServerError)\n\t\treturn\n\t}\n\n\tif r.Method == http.MethodPost {\n\t\th.handlePostMethod(w, r, session)\n\t\treturn\n\t}\n\n\tdata := h.tmpl.Data()\n\tif flashes := session.Flashes(); len(flashes) > 0 {\n\t\tdata.SetFlashes(flashes)\n\t}\n\n\terr = session.Save(r, w)\n\tif err != nil {\n\t\thttp.Error(w, err.Error(), http.StatusInternalServerError)\n\t\treturn\n\t}\n\n\tif err = tmpl.ExecuteTemplate(w, blog.TemplatesBase, data); err != nil {\n\t\tlog.Fatal(\"Could not execute register templates.\")\n\t}\n}", "title": "" }, { "docid": "f947963f265ce9a91982239e345a32e7", "score": "0.53827435", "text": "func handlerPost(w http.ResponseWriter, r *http.Request) {\n\tfmt.Println(`\"Request received by endpoint \"/post\"`)\n\n\t// Remove CORS restrictions\n\tw.Header().Set(\"Content-Type\", \"application/json\")\n\tw.Header().Set(\"Access-Control-Allow-Origin\", \"*\")\n\tw.Header().Set(\"Access-Control-Allow-Headers\", \"Content-Type,Authorization\")\n\n\tif r.Method == \"OPTIONS\" {\n\t\treturn\n\t}\n\n\tuser := r.Context().Value(\"user\")\n\tclaims := user.(*jwt.Token).Claims\n\tusername := claims.(jwt.MapClaims)[\"username\"]\n\n\tlat, _ := strconv.ParseFloat(r.FormValue(\"lat\"), 64)\n\tlon, _ := strconv.ParseFloat(r.FormValue(\"lon\"), 64)\n\n\tp := &Post{\n\t\tUser: username.(string),\n\t\tMessage: r.FormValue(\"message\"),\n\t\tLocation: Location{\n\t\t\tLat: lat,\n\t\t\tLon: lon,\n\t\t},\n\t}\n\n\tid := uuid.New()\n\tfile, _, err := r.FormFile(\"image\")\n\tif err != nil {\n\t\thttp.Error(w, \"Image is not available\", http.StatusBadRequest)\n\t\tfmt.Printf(\"Image is not available %v.\\n\", err)\n\t\treturn\n\t}\n\n\tattrs, err := saveToGCS(file, BUCKET_NAME, id)\n\tif err != nil {\n\t\thttp.Error(w, \"Failed to save image to GCS\", http.StatusInternalServerError)\n\t\tfmt.Printf(\"Failed to save image to GCS %v.\\n\", err)\n\t\treturn\n\t}\n\n\tp.URL = attrs.MediaLink\n\n\terr = saveToES(p, id)\n\tif err != nil {\n\t\thttp.Error(w, \"Failed to save post to ElasticSearch\", http.StatusInternalServerError)\n\t\tfmt.Printf(\"Failed to save post to ElasticSearch %v.\\n\", err)\n\t\treturn\n\t}\n\tfmt.Printf(\"Saved one post to ElasticSearch: %s\", p.Message)\n\n\t// Save a copy of data to BigTable\n\t// err = saveToBigTable(p, id)\n\t// if err != nil {\n\t// \thttp.Error(w, \"Failed to save post to BigTable\", http.StatusInternalServerError)\n\t// \tfmt.Printf(\"Failed to save post to BigTable %v.\\n\", err)\n\t// \treturn\n\t// }\n\t// fmt.Printf(\"Saved one post to BigTable: %s\", p)\n}", "title": "" }, { "docid": "5370249acdabc7c76b3658fbad7ef3c0", "score": "0.5371565", "text": "func (svr *AdminServer) ServeHTTP(w http.ResponseWriter, r *http.Request) {\n\tn, err := parseN(r)\n\tif err != nil {\n\t\tn = 1\n\t}\n\n\tctx := context.WithValue(context.Background(), \"n\", n)\n\n\tswitch {\n\tcase strings.HasPrefix(r.URL.Path, \"/config\"):\n\t\tsvr.handleConfig(w, r.WithContext(ctx))\n\n\tcase strings.HasPrefix(r.URL.Path, \"/object/\"):\n\t\ts := strings.TrimPrefix(r.URL.Path, \"/object/\")\n\t\tif len(s) == 0 {\n\t\t\tw.WriteHeader(404)\n\t\t\treturn\n\t\t}\n\n\t\tsvr.handleObject(w, r.WithContext(context.WithValue(ctx, \"oid\", []byte(s))))\n\n\tcase strings.HasPrefix(r.URL.Path, \"/kv\"):\n\t\tkey := strings.TrimPrefix(r.URL.Path, \"/kv/\")\n\t\tif len(key) == 0 {\n\t\t\tw.WriteHeader(404)\n\t\t\treturn\n\t\t}\n\n\t\tsvr.handleKV(w, r.WithContext(context.WithValue(ctx, \"key\", []byte(key))))\n\n\tcase strings.HasPrefix(r.URL.Path, \"/lookup\"):\n\t\tkey := strings.TrimPrefix(r.URL.Path, \"/lookup/\")\n\t\tif len(key) == 0 {\n\t\t\tw.WriteHeader(404)\n\t\t\treturn\n\t\t}\n\t\tctx = context.WithValue(ctx, \"key\", []byte(key))\n\t\tsvr.handleLookup(w, r.WithContext(ctx))\n\n\tdefault:\n\t\tw.WriteHeader(404)\n\t\treturn\n\t}\n\n}", "title": "" }, { "docid": "e451f2f73bce2d272a87aeea2d94dc4a", "score": "0.53697735", "text": "func UpdatePost(w http.ResponseWriter, req *http.Request) {\n\tw.Header().Set(\"Content-Type\", \"application/json\")\n\tclient := database.GetDB()\n\tvar requestBody postRequestBody\n\tvar post models.Post\n\tpostID := chi.URLParam(req, \"postId\")\n\tfmt.Println(\"UpdatePost DEBUG:\", postID)\n\n\tjson.NewDecoder(req.Body).Decode(&requestBody)\n\n\tctx, _ := context.WithTimeout(context.Background(), 10*time.Second)\n\tcollection := client.Database(dbName).Collection(\"posts\")\n\n\tpostObjID, _ := primitive.ObjectIDFromHex(postID)\n\n\tfilter := bson.M{\"_id\": postObjID}\n\n\tpostRes := collection.FindOne(ctx, filter)\n\tif postRes.Err() != nil {\n\t\tw.WriteHeader(http.StatusInternalServerError)\n\t\tjson.NewEncoder(w).Encode(map[string]string{\n\t\t\t\"message\": \"Server Error Occurred\",\n\t\t\t\"error\": postRes.Err().Error(),\n\t\t})\n\t\treturn\n\t}\n\n\tpostRes.Decode(&post)\n\n\tpost.Title = requestBody.Title\n\tpost.Content = requestBody.Content\n\n\tupdate := bson.M{\n\t\t\"$set\": post,\n\t}\n\n\tres, err := collection.UpdateOne(ctx, filter, update)\n\tif err != nil {\n\t\tw.WriteHeader(http.StatusInternalServerError)\n\t\tjson.NewEncoder(w).Encode(map[string]string{\n\t\t\t\"message\": \"Server Error Occurred\",\n\t\t\t\"error\": err.Error(),\n\t\t})\n\t\treturn\n\t}\n\n\tjson.NewEncoder(w).Encode(res)\n}", "title": "" }, { "docid": "36b3a82be776bd5bb01ddf98acc0588b", "score": "0.53493476", "text": "func (h Http) Post(url string, bodyType string, body io.Reader) (*http.Response, error) {\r\n\treturn http.Post(url, bodyType, body)\r\n}", "title": "" }, { "docid": "c89763d4c4c489915cff23521f47a34f", "score": "0.5343916", "text": "func (mw *Middleware) ServeHTTP(w http.ResponseWriter, r *http.Request) (int, error) {\n\tcfg := mw.PathConfigs.ConfigForPath(r)\n\tif cfg == nil {\n\t\treturn mw.Next.ServeHTTP(w, r) // exit early\n\t}\n\tif !cfg.IsRequestAllowed(r) {\n\t\tif cfg.Log.IsDebug() {\n\t\t\tcfg.Log.Debug(\"caddyesi.Middleware.ServeHTTP.IsRequestAllowed\",\n\t\t\t\tlog.Bool(\"is_response_allowed\", false), loghttp.Request(\"request\", r), log.Stringer(\"config\", cfg),\n\t\t\t)\n\t\t}\n\t\treturn mw.Next.ServeHTTP(w, r) // go on ...\n\t}\n\tif err := handleHeaderCommands(cfg, w, r); err != nil {\n\t\t// clears the Tag tags\n\t\treturn http.StatusInternalServerError, err\n\t}\n\n\tpageID, entities := cfg.ESITagsByRequest(r)\n\tif entities == nil || len(entities) == 0 {\n\t\t// Slow path because Tag cache tag is empty and we need to analyse the\n\t\t// buffer.\n\t\treturn mw.serveBuffered(cfg, pageID, w, r)\n\t}\n\n\t////////////////////////////////////////////////////////////////////////////////\n\t// Proceed from map, filled with the parsed Tag tags.\n\n\tvar logR *http.Request\n\tif cfg.Log.IsInfo() || cfg.Log.IsDebug() { // avoids race condition when logging\n\t\t// TODO(CyS) logging this request can be avoided because we only need to\n\t\t// trace a request ID and log somewhere which request ID belongs to\n\t\t// which printed request for debugging\n\t\tlogR = loghttp.ShallowCloneRequest(r)\n\t}\n\n\tchanTag := make(chan esitag.DataTag)\n\tgo func() {\n\t\tvar wg *sync.WaitGroup\n\t\tif entities.HasCoalesce() {\n\t\t\twg = new(sync.WaitGroup)\n\t\t\tvar coaEnt esitag.Entities\n\t\t\tcoaEnt, entities = entities.SplitCoalesce()\n\t\t\t// variable entities will be reused after go func() to query the\n\t\t\t// non-coalesce resources.\n\n\t\t\tvar logR2 *http.Request\n\t\t\tif cfg.Log.IsInfo() || cfg.Log.IsDebug() { // avoids race condition when logging\n\t\t\t\tlogR2 = loghttp.ShallowCloneRequest(logR)\n\t\t\t}\n\t\t\twg.Add(1)\n\t\t\tgo func() {\n\t\t\t\tdefer wg.Done()\n\t\t\t\tcoaID := coaEnt.UniqueID()\n\t\t\t\tdoRes, _, _ := mw.coalesce.Do(strconv.FormatUint(coaID, 10), func() (interface{}, error) {\n\t\t\t\t\tcoaChanTag := make(chan esitag.DataTag)\n\t\t\t\t\t// wow this is ugly (3 level of goroutines) but for now the\n\t\t\t\t\t// best I can come up with. but not using coalesce will\n\t\t\t\t\t// consume less memory than with the code in the previous\n\t\t\t\t\t// version of QueryResources.\n\t\t\t\t\tgo func() {\n\t\t\t\t\t\tif err := coaEnt.QueryResources(coaChanTag, r); err != nil {\n\t\t\t\t\t\t\tif cfg.Log.IsInfo() {\n\t\t\t\t\t\t\t\tcfg.Log.Info(\"caddyesi.Middleware.ServeHTTP.coaEnt.QueryResources.Error\",\n\t\t\t\t\t\t\t\t\tlog.Err(err), log.Uint64(\"page_id\", pageID), log.Uint64(\"entities_coalesce_id\", coaID),\n\t\t\t\t\t\t\t\t\tloghttp.Request(\"request\", logR2),\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\tif cfg.Log.IsDebug() {\n\t\t\t\t\t\t\tcfg.Log.Info(\"caddyesi.Middleware.ServeHTTP.coaEnt.QueryResources.Once\",\n\t\t\t\t\t\t\t\tlog.Uint64(\"page_id\", pageID), log.Uint64(\"entities_coalesce_id\", coaID),\n\t\t\t\t\t\t\t\tlog.Stringer(\"coalesce_entities\", coaEnt), log.Stringer(\"non_coalesce_entities\", entities),\n\t\t\t\t\t\t\t\tloghttp.Request(\"request\", logR2),\n\t\t\t\t\t\t\t)\n\t\t\t\t\t\t}\n\t\t\t\t\t\tclose(coaChanTag)\n\t\t\t\t\t}()\n\t\t\t\t\ttags := esitag.NewDataTagsCapped(avgESITagsPerPage)\n\t\t\t\t\tfor tag := range coaChanTag {\n\t\t\t\t\t\ttags.Slice = append(tags.Slice, tag)\n\t\t\t\t\t}\n\t\t\t\t\treturn tags, nil\n\t\t\t\t})\n\t\t\t\tfor _, tag := range doRes.(*esitag.DataTags).Slice {\n\t\t\t\t\tchanTag <- tag\n\t\t\t\t}\n\t\t\t}()\n\t\t}\n\n\t\t// trigger the DoRequests and query all backend resources in\n\t\t// parallel. Errors are mostly of cancelled client requests which\n\t\t// the context propagates.\n\t\terr := entities.QueryResources(chanTag, r)\n\t\tif err != nil {\n\t\t\tif cfg.Log.IsInfo() {\n\t\t\t\tcfg.Log.Info(\"caddyesi.Middleware.ServeHTTP.entities.QueryResources.Error\",\n\t\t\t\t\tlog.Err(err), loghttp.Request(\"request\", logR), log.Stringer(\"config\", cfg),\n\t\t\t\t\tlog.Uint64(\"page_id\", pageID),\n\t\t\t\t)\n\t\t\t}\n\t\t}\n\t\tif wg != nil {\n\t\t\twg.Wait()\n\t\t}\n\t\tclose(chanTag)\n\t}()\n\treturn mw.Next.ServeHTTP(responseWrapInjector(chanTag, w), r)\n}", "title": "" }, { "docid": "0a3fc200e781a58378311b428ddeea79", "score": "0.5340671", "text": "func (a App) Posts(res http.ResponseWriter, req *http.Request) {\n\n\ttmpl := template.Must(template.ParseFiles(\n\t\tprojectView(\"layout\"),\n\t\tprojectView(\"nav\"),\n\t\tprojectView(\"posts\"),\n\t))\n\n\terr := tmpl.ExecuteTemplate(res, \"layout\", posts)\n\tif err != nil {\n\t\thttp.Error(res, err.Error(), http.StatusInternalServerError)\n\t}\n}", "title": "" }, { "docid": "fbf2470512fff4760cab1aa6ee608c91", "score": "0.53367156", "text": "func (s *Service) ProxyPost(w http.ResponseWriter, r *http.Request) {\n\ts.Proxy(w, r)\n}", "title": "" }, { "docid": "bdbd85feb514a3da61d7e488d2b48133", "score": "0.53349245", "text": "func (u *UploadPredictions) ServeHTTP(w http.ResponseWriter, r *http.Request) {\n\tparentContext := context.TODO()\n\tctx, ctxCancel := context.WithTimeout(parentContext, time.Hour*2)\n\tdefer ctxCancel()\n\n\tswitch r.Method {\n\tcase http.MethodPut:\n\t\tvar buffer bytes.Buffer\n\n\t\tfile, header, err := r.FormFile(\"uploadFile\")\n\n\t\tif err != nil {\n\t\t\thttp.Error(w, err.Error(), http.StatusBadRequest)\n\t\t\treturn\n\t\t}\n\n\t\tfn := strings.Split(header.Filename, \".\")\n\t\tif len(fn) <= 0 {\n\t\t\thttp.Error(w, \"Invalid file type\", http.StatusBadRequest)\n\t\t\treturn\n\t\t}\n\n\t\tif fn[len(fn)-1] != \"csv\" {\n\t\t\thttp.Error(w, \"Invalid file type. File must be a csv file\", http.StatusBadRequest)\n\t\t\treturn\n\t\t}\n\n\t\t// ID of the event that we will be updating data for\n\t\teventID := r.FormValue(\"eventID\")\n\n\t\tif err != nil {\n\t\t\thttp.Error(w, err.Error(), http.StatusBadRequest)\n\t\t\treturn\n\t\t}\n\n\t\t// transfer contents of the file to our buffer\n\t\tio.Copy(&buffer, file)\n\n\t\t// Determine whether it is prediction or results\n\t\t// Getting the string version of our buffer\n\t\tcontents := strings.Split(buffer.String(), \"\\n\")\n\n\t\tif len(contents) <= 0 {\n\t\t\thttp.Error(w, \"No contents found in CSV\", http.StatusBadRequest)\n\t\t\treturn\n\t\t}\n\t\tcolumnNames := strings.Split(contents[0], \",\")\n\t\t_, gamesCache := getGames(columnNames)\n\t\tvar gameIDSlice []int\n\t\tvar userIDSlice []int\n\t\tcompetitorCache := make(map[string]int)\n\t\tmatchIDCache := make(map[string]int)\n\t\tinsertGameQuery := \"select * from public.insert_game_sp($1::text);\"\n\t\tinsertUserQuery := \"select * from public.insert_or_update_user_sp($1::text,$2::text);\"\n\t\tinsertMatchQuery := \"select * from public.insert_match_sp($1::int4,$2::int4);\"\n\t\tinsertCompetitorQuery := \"select * from public.insert_competitor_sp($1::text);\"\n\t\tinsertParticipantQuery := \"select * from public.insert_participant_sp($1::int4,$2::int4);\"\n\t\tinsertPredictionQuery := \"select * from public.insert_prediction_sp($1::int4,$2::int4);\"\n\n\t\tfor _, game := range gamesCache {\n\t\t\t// get game Id from hitting postgres\n\t\t\tvar id int\n\t\t\tvar matchID int\n\t\t\terr := u.Data.GetContext(ctx, &id, insertGameQuery, game)\n\t\t\tif err != nil {\n\t\t\t\tfmt.Println(err)\n\t\t\t}\n\t\t\tgameIDSlice = append(gameIDSlice, id)\n\n\t\t\t//upload a match\n\t\t\terr = u.Data.GetContext(ctx, &matchID, insertMatchQuery, eventID, id)\n\t\t\tif err != nil {\n\t\t\t\tfmt.Println(err)\n\t\t\t}\n\t\t\tif matchIDCache[game] == 0 {\n\t\t\t\tmatchIDCache[game] = matchID\n\t\t\t}\n\t\t}\n\n\t\tcolumnNames = strings.Split(contents[0], \",\")\n\t\tfor l, v := range contents {\n\t\t\tcurrentRowSplit := strings.Split(v, \",\")\n\t\t\t//skip first row cuz its whack\n\t\t\tif l != 0 {\n\t\t\t\tvar userID int\n\t\t\t\tvar competitorID int\n\t\t\t\tvar participantID int\n\t\t\t\tvar predictionID int\n\t\t\t\t// user created(replace with postgres)\n\t\t\t\terr := u.Data.GetContext(ctx, &userID, insertUserQuery, strings.ToLower(currentRowSplit[1]), strings.ToLower(currentRowSplit[2]))\n\t\t\t\tif err != nil {\n\t\t\t\t\tfmt.Println(err)\n\t\t\t\t}\n\t\t\t\tuserIDSlice = append(userIDSlice, userID)\n\n\t\t\t\t// Create competitors\n\t\t\t\tfor colIndex, column := range currentRowSplit {\n\t\t\t\t\tif colIndex < len(columnNames) {\n\t\t\t\t\t\tif strings.Contains(columnNames[colIndex], \"Predictions\") {\n\t\t\t\t\t\t\tif competitorCache[column] == 0 {\n\t\t\t\t\t\t\t\tif column == \"\" {\n\t\t\t\t\t\t\t\t\tcolumn = \"Skip this\"\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\terr := u.Data.GetContext(ctx, &competitorID, insertCompetitorQuery, column)\n\t\t\t\t\t\t\t\tif err != nil {\n\t\t\t\t\t\t\t\t\tfmt.Println(err)\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tcompetitorCache[column] = competitorID\n\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t// match exist, map the competitor to the match\n\t\t\t\t\t\t\tif matchIDCache[gamesCache[colIndex-3]] != 0 {\n\t\t\t\t\t\t\t\terr := u.Data.GetContext(ctx, &participantID, insertParticipantQuery, matchIDCache[gamesCache[colIndex-3]], competitorCache[column])\n\t\t\t\t\t\t\t\tif err != nil {\n\t\t\t\t\t\t\t\t\tfmt.Println(err)\n\t\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t\t//create a prediction\n\t\t\t\t\t\t\t\terr = u.Data.GetContext(ctx, &predictionID, insertPredictionQuery, userID, participantID)\n\t\t\t\t\t\t\t\tif err != nil {\n\t\t\t\t\t\t\t\t\tfmt.Println(err)\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\t// Cleaning up buffer memory\n\t\tbuffer.Reset()\n\t\tw.Write([]byte(\"Yes\"))\n\n\tdefault:\n\t\thttp.Error(w, \"Invalid request method\", http.StatusMethodNotAllowed)\n\t}\n}", "title": "" }, { "docid": "a8788989557ef21381a6ceeb4545d298", "score": "0.53332657", "text": "func (s *server) ServeHTTP(rw http.ResponseWriter, req *http.Request) {\n\tc := s.air.contextPool.Get().(*Context)\n\tc.feed(req, rw)\n\n\t// Gases\n\th := func(c *Context) error {\n\t\tif methodAllowed(c.Request.Method) {\n\t\t\ts.air.router.route(c.Request.Method, c.Request.URL.EscapedPath(), c)\n\t\t} else {\n\t\t\tc.Handler = MethodNotAllowedHandler\n\t\t}\n\n\t\th := c.Handler\n\t\tfor i := len(s.air.gases) - 1; i >= 0; i-- {\n\t\t\th = s.air.gases[i](h)\n\t\t}\n\n\t\treturn h(c)\n\t}\n\n\t// Pregases\n\tfor i := len(s.air.pregases) - 1; i >= 0; i-- {\n\t\th = s.air.pregases[i](h)\n\t}\n\n\t// Execute chain\n\tif err := h(c); err != nil {\n\t\ts.air.HTTPErrorHandler(err, c)\n\t}\n\n\tc.reset()\n\ts.air.contextPool.Put(c)\n}", "title": "" }, { "docid": "967be96e54a0231c82144ea7afc519c5", "score": "0.53315896", "text": "func adminHandler(w http.ResponseWriter, r *http.Request) {\n\tif r.URL.Path != \"/admin\" {\n\t\thttp.Error(w, \"404 not found.\", http.StatusNotFound)\n\t\treturn\n\t}\n\t// Process 'Get' and 'Post' calls\n\tswitch r.Method {\n\tcase \"GET\":\n\t\thttp.Error(w, \"404 not found.\", http.StatusNotFound)\n\tcase \"POST\":\n\t\t// Ensure the correct content type has been sent to the server.\n\t\tcontentType := r.Header.Get(\"Content-Type\")\n\t\tif contentType != \"application/json\" {\n\t\t\t// Put an error code here. Do nothing but notify the screen.\n\t\t\tfmt.Println(\"Incorrect Content Type\")\n\t\t}\n\t\tvar bp blog_post // Declare the blog post.\n\t\tvar unmarshalErr *json.UnmarshalTypeError\n\t\tdecoder := json.NewDecoder(r.Body)\n\t\tdecoder.DisallowUnknownFields()\n\t\terr := decoder.Decode(&bp)\n\t\tif err != nil {\n\t\t\tfmt.Println(\"There was a decoding error!\")\n\t\t\tif errors.As(err, &unmarshalErr) {\n\t\t\t\terrorResponse(w, \"Bad Request. Wrong Type provided for field \"+unmarshalErr.Field, http.StatusBadRequest)\n\t\t\t} else {\n\t\t\t\terrorResponse(w, \"Bad Request \"+err.Error(), http.StatusBadRequest)\n\t\t\t}\n\t\t\treturn\n\t\t}\n\n\t\t// Add the post to the blog.\n\t\tbp.post()\n\n\t\t// The blog has posted, send the response back to the User.\n\t\tfmt.Fprintf(w, `OK`)\n\n\t\t//TODO: Better error handling.\n\tdefault:\n\t\tfmt.Fprintf(w, \"Sorry, only POST method is supported.\")\n\t}\n}", "title": "" }, { "docid": "054bb582f9c97a7ae5677fe797bdd6b3", "score": "0.53270924", "text": "func WriterPost(c *gin.Context) {\n\tvar article model.Article\n\tidStr := c.Param(\"id\")\n\n\tarticle.Title = c.DefaultPostForm(\"title\", \"无题\")\n\tarticle.ClassID, _ = strconv.Atoi(c.DefaultPostForm(\"classId\", \"0\"))\n\tarticle.Abstract.String = c.DefaultPostForm(\"abstract\", \"无\")\n\tarticle.Main.String = c.DefaultPostForm(\"main\", \"无\")\n\n\tvar err error\n\tif idStr != \"\" {\n\t\tid, err := strconv.ParseUint(idStr, 10, 64)\n\t\tif err != nil {\n\t\t\tc.String(http.StatusOK, \"id错误\")\n\t\t\treturn\n\t\t}\n\t\terr = service.UpdateOneArticle(id, &article)\n\t} else {\n\t\terr = service.AddOneArticle(&article)\n\t}\n\tif err != nil {\n\t\tc.String(http.StatusOK, \"编辑失败\")\n\t} else {\n\t\tc.String(http.StatusOK, \"编辑成功\")\n\t}\n}", "title": "" }, { "docid": "17996b3bdaf57680394e7695c76f090f", "score": "0.529676", "text": "func (s *Server) ServeHTTP(w http.ResponseWriter, r *http.Request) {\n\ts.e.ServeHTTP(w, r)\n}", "title": "" }, { "docid": "25691582667c97faa467a150ca22f751", "score": "0.5289823", "text": "func (s *HTTPServer) handle(w http.ResponseWriter, r *http.Request) {\n\tbody, err := ioutil.ReadAll(r.Body)\n\tif err != nil {\n\t\thttp.Error(w, err.Error(), http.StatusInternalServerError)\n\t\treturn\n\t}\n\n\t// Fail if there is such header.\n\tif r.Header.Get(FailHeader) != \"\" {\n\t\tw.WriteHeader(http.StatusBadRequest)\n\t\t_, _ = w.Write([]byte(FailBody))\n\t\treturn\n\t}\n\n\t// echo back the Content-Type and Content-Length in the response\n\tfor _, k := range []string{\"Content-Type\", \"Content-Length\"} {\n\t\tif v := r.Header.Get(k); v != \"\" {\n\t\t\tw.Header().Set(k, v)\n\t\t}\n\t}\n\n\tif delay := r.URL.Query().Get(\"delay\"); delay != \"\" {\n\t\tdelaySeconds, err := strconv.ParseInt(delay, 10, 64)\n\t\tif err != nil {\n\t\t\tw.WriteHeader(http.StatusBadRequest)\n\t\t\t_, _ = w.Write([]byte(\"Bad request parameter: delay\"))\n\t\t\treturn\n\t\t}\n\t\ttime.Sleep(time.Duration(delaySeconds) * time.Second)\n\t}\n\n\tw.WriteHeader(http.StatusOK)\n\n\treqHeaders := make(http.Header)\n\treqHeaders[\":method\"] = []string{r.Method}\n\treqHeaders[\":authority\"] = []string{r.Host}\n\treqHeaders[\":path\"] = []string{r.URL.String()}\n\tfor name, headers := range r.Header {\n\t\tfor _, h := range headers {\n\t\t\treqHeaders[name] = append(reqHeaders[name], h)\n\t\t}\n\t}\n\n\ts.mu.Lock()\n\ts.reqHeaders = reqHeaders\n\ts.mu.Unlock()\n\n\tw.Write(body)\n}", "title": "" }, { "docid": "0931bea45b5272fa8728c8ce0075459d", "score": "0.5289634", "text": "func PostHandler(w http.ResponseWriter, r *http.Request){\n\tif r.Method != \"POST\" {\n\t\thttp.Error(w,\"Method Not Allowed\",405)\n\t\treturn\n\t}\n\tjsonData := getAllJSONdata(r ,\"args\",\"data\",\"files\",\"form\",\"headers\",\"json\",\"origin\",\"url\")\n\tw.Write(makeJSONresponse(jsonData))\t\n}", "title": "" }, { "docid": "29a80738cf38edf9b11adb0eb6f45a99", "score": "0.52864337", "text": "func (h AppHandler)ServeHTTP(w http.ResponseWriter, r *http.Request) {\n\th.mux.ServeHTTP(w, r)\n}", "title": "" }, { "docid": "f86a01effae4980708ac222a7a7e69eb", "score": "0.5276719", "text": "func (hs *HandlersStack) ServeHTTP(w http.ResponseWriter, r *http.Request) {\n\t// Get a context for the request from ctxPool.\n\tc := getContext(w, r)\n\n\t// Set some \"good practice\" default headers.\n\tc.ResponseWriter.Header().Set(\"Cache-Control\", \"no-cache\")\n\tc.ResponseWriter.Header().Set(\"Content-Type\", \"application/json\")\n\tc.ResponseWriter.Header().Set(\"Connection\", \"keep-alive\")\n\tc.ResponseWriter.Header().Set(\"Vary\", \"Accept-Encoding\")\n\t//c.ResponseWriter.Header().Set(\"Access-Control-Allow-Origin\", \"*\")\n\tc.ResponseWriter.Header().Set(\"Access-Control-Allow-Headers\", \"X-Requested-With\")\n\tc.ResponseWriter.Header().Set(\"Access-Control-Allow-Methods\", \"PUT,POST,GET,DELETE,OPTIONS\")\n\n\t// Always recover form panics.\n\tdefer c.Recover()\n\n\t// Enter the handlers stack.\n\tc.Next()\n\n\t// Respnose data\n\t// if c.written == false {\n\t// \tc.Fail(errors.New(\"not written\"))\n\t// }\n\t// Put the context to ctxPool\n\tputContext(c)\n}", "title": "" }, { "docid": "a4b6f6ed6e605f7c12482455f623d113", "score": "0.526596", "text": "func (c *Context) Write(data []byte) {\n\treader := bytes.NewReader(data)\n\tname := c.Req.RequestURI\n\thttp.ServeContent(c.Wr, c.Req, name, time.Now(), reader)\n}", "title": "" }, { "docid": "aeb9e640833af485585068895fe9fe47", "score": "0.52591217", "text": "func (r *Route) Post(handlers ...Handler) *Route {\n\treturn r.add(\"POST\", handlers)\n}", "title": "" }, { "docid": "3e6e317906cd8fec9e060d6d6f35df09", "score": "0.5254306", "text": "func (h Handler) ServeHTTP(w http.ResponseWriter, r *http.Request) {\n\tdefer r.Body.Close()\n\n\t//check request method\n\tif r.Method != \"POST\" {\n\t\thttp.Error(w, \"method not allowed\", http.StatusMethodNotAllowed)\n\t\treturn\n\t}\n\n\t//protect against maliciously large payloads (GitHub payloads are capped at 25 MiB)\n\tbodyReader := io.LimitReader(r.Body, 25<<20)\n\tbody, err := ioutil.ReadAll(bodyReader)\n\tif err != nil {\n\t\thttp.Error(w, err.Error(), http.StatusInternalServerError)\n\t\treturn\n\t}\n\n\t//check signature\n\terr = h.checkGitHubSignature(r, body)\n\tif err == errNoSignature {\n\t\terr = h.checkGiteaSignature(r, body)\n\t}\n\tif err != nil {\n\t\thttp.Error(w, err.Error(), http.StatusUnauthorized)\n\t\treturn\n\t}\n\n\t//decode event\n\teventType := r.Header.Get(\"X-GitHub-Event\")\n\teventDecoder := EventDecoder(MinimalEventDecoder)\n\tif h.EventDecoder != nil {\n\t\teventDecoder = h.EventDecoder\n\t}\n\tevent, err := eventDecoder(eventType, []byte(body))\n\tif err != nil {\n\t\thttp.Error(w, err.Error(), http.StatusBadRequest)\n\t\treturn\n\t}\n\tif event == nil {\n\t\thttp.Error(w, \"event type not supported\", http.StatusNotImplemented)\n\t\treturn\n\t}\n\n\th.Callback(r.Header.Get(\"X-GitHub-Delivery\"), event)\n\tw.WriteHeader(http.StatusNoContent)\n}", "title": "" }, { "docid": "c7be60705a2755b9e2a750c071fba2d0", "score": "0.52539945", "text": "func (s *Server) ServeHTTP(w http.ResponseWriter, r *http.Request) {\n\tpayload, err := github.ValidatePayload(r, []byte(c.WebhookSecret))\n\tif err != nil {\n\t\tglog.Errorf(\"Invalid payload: %v\", err)\n\t\treturn\n\t}\n\tevent, err := github.ParseWebHook(github.WebHookType(r), payload)\n\tif err != nil {\n\t\tglog.Errorf(\"Failed to parse webhook\")\n\t\treturn\n\t}\n\tfmt.Fprint(w, \"Received a webhook event\")\n\n\tvar client http.Client\n\tclient.Do(r)\n\tswitch event.(type) {\n\tcase *github.IssueEvent:\n\t\tgo s.handleIssueEvent(payload)\n\tcase *github.IssueCommentEvent:\n\t\t// Comments on PRs belong to IssueCommentEvent\n\t\tIsIssueCommentHandling = true\n\t\tgo s.handleIssueCommentEvent(payload, s.GithubClient, s.Repository)\n\tcase *github.PullRequestEvent:\n\t\tif !IsIssueCommentHandling {\n\t\t\tgo s.handlePullRequestEvent(payload, ClientRepo)\n\t\t}\n\t\t//Fall Back to original state\n\t\tIsIssueCommentHandling = false\n\tcase *github.PullRequestComment:\n\t\tgo s.handlePullRequestCommentEvent(payload)\n\t}\n}", "title": "" }, { "docid": "8ec5498bae20928e1ac09dd7d4809bdb", "score": "0.5251877", "text": "func (c *Client) ServeHTTP(w http.ResponseWriter, r *http.Request) {\n\tif r.Method != \"POST\" {\n\t\tc.logger.Printf(\"Invalid %q request from %q\", r.Method, r.RemoteAddr)\n\t\thttp.Error(w, \"405 Method Not Allowed\", http.StatusMethodNotAllowed)\n\t\treturn\n\t}\n\n\tmsg := InMessage{}\n\tif err := decodeForm(&msg, r); err != nil {\n\t\tc.logger.Printf(\"Invalid form data: %v\", err)\n\t\thttp.Error(w, \"400 Bad Request\", http.StatusBadRequest)\n\t\treturn\n\t}\n\n\tif len(c.tokens) > 0 {\n\t\tif msg.Token == \"\" {\n\t\t\tc.logger.Printf(\"No token request from %q\", r.RemoteAddr)\n\t\t\thttp.Error(w, \"400 Bad Request\", http.StatusBadRequest)\n\t\t\treturn\n\t\t} else if !c.validToken(msg.Token) {\n\t\t\tc.logger.Printf(\"Invalid token %q request from %q\", msg.Token, r.RemoteAddr)\n\t\t\thttp.Error(w, \"400 Bad Request\", http.StatusBadRequest)\n\t\t\treturn\n\t\t}\n\t}\n\n\tim := translateInMessage(&msg)\n\tc.in <- *im\n}", "title": "" }, { "docid": "06b8e21bcd73af30af14f52030339f4b", "score": "0.52485955", "text": "func (engine *Engine) ServeHTTP(w http.ResponseWriter, req *http.Request) {\n\tc := engine.pool.Get().(*Context)\n\tc.writermem.reset(w)\n\tc.Request = req\n\tc.reset()\n\tengine.handleHTTPRequest(c)\n\tengine.pool.Put(c)\n}", "title": "" }, { "docid": "54bffd345dd959cf187a49c19d3b7c0b", "score": "0.524834", "text": "func UpdatePost(w http.ResponseWriter, r *http.Request) {\n\tparameters := mux.Vars(r)\n\tl := len(posts)\n\tfor i := 0; i < l; i++ {\n\t\tif posts[i].ID == parameters[\"id\"] {\n\t\t\tvar updatedpost post\n\t\t\tjson.NewDecoder(r.Body).Decode(&updatedpost)\n\t\t\t\n\t\t\tif updatedpost.ID != parameters[\"id\"] {\n\t\t\t\tw.Write([]byte(\"Error. Trying to update post with wrong id!/n\"))\n\t\t\t\treturn\n\t\t\t}\n\n\t\t\tupdatedleft := append(posts[:i], updatedpost) \n\t\t\tposts = append(updatedleft, posts[i+1:]...)\n\t\t\tw.Write([]byte(\"Post successfully updated.\\n\"))\n\t\t\tl--\n\t\t\treturn\n\t\t}\n\t}\n\tw.Write([]byte(\"Could not find post. Cannot update.\\n\"))\n}", "title": "" }, { "docid": "8b508588ea840c7c7c0f1ca32805685b", "score": "0.52476835", "text": "func (p *BKRepoReverseProxy) ServeHTTP(w http.ResponseWriter, req *http.Request) {\n\trtime := time.Now()\n\tkit := common.HTTPRequestKit(req)\n\n\tlogger.V(2).Infof(\"FileContent[%s][%s]| input[%+v]\", kit.Rid, req.Method, req.URL)\n\n\tdefer func() {\n\t\tcost := p.collector.StatRequest(fmt.Sprintf(\"FileContent-%s\", req.Method), http.StatusOK, rtime, time.Now())\n\t\tlogger.V(2).Infof(\"FileContent[%s][%s]| output[%dms] [%+v]\", kit.Rid, req.Method, cost, req.URL)\n\t}()\n\n\t// mux limit the file content path in target path format, and you can get biz_id\n\t// from mux vars base on the request.\n\tbizID := mux.Vars(req)[\"biz_id\"]\n\n\tif req.Method == \"PUT\" {\n\t\t// NOTE: check target business repo project/repository in upload request.\n\n\t\tsyncBKRepoFlag := syncBKRepoRecordTypeNone\n\t\tif record, err := p.syncBKRepoRecords.Get(bizID); err == nil && record != nil {\n\t\t\tif flag, ok := record.(syncBKRepoRecordType); ok {\n\t\t\t\tsyncBKRepoFlag = flag\n\t\t\t}\n\t\t}\n\n\t\tif syncBKRepoFlag < syncBKRepoRecordTypeProjCreated {\n\t\t\terr := bkrepo.CreateProject(\n\t\t\t\tfmt.Sprintf(\"%s://%s\", defaultProxyScheme, p.viper.GetString(\"bkrepo.host\")),\n\t\t\t\t&bkrepo.Auth{Token: p.viper.GetString(\"bkrepo.token\"), UID: kit.User},\n\t\t\t\t&bkrepo.CreateProjectReq{\n\t\t\t\t\tName: bizID,\n\t\t\t\t\tDisplayName: bizID,\n\t\t\t\t\tDescription: \"bscp-configs\"},\n\t\t\t\tp.viper.GetDuration(\"bkrepo.timeout\"))\n\n\t\t\tif err != nil {\n\t\t\t\tlogger.Warnf(\"FileContent[%s][%s]| [%+v], create bkrepo project failed, %+v\",\n\t\t\t\t\tkit.Rid, req.Method, req.URL, err)\n\t\t\t} else {\n\t\t\t\tp.syncBKRepoRecords.SetWithExpire(bizID, syncBKRepoRecordTypeProjCreated,\n\t\t\t\t\tp.viper.GetDuration(\"bkrepo.recordCacheExpiration\"))\n\n\t\t\t\tlogger.V(2).Infof(\"FileContent[%s][%s]| [%+v], create bkrepo project success\",\n\t\t\t\t\tkit.Rid, req.Method, req.URL)\n\t\t\t}\n\t\t}\n\n\t\tif syncBKRepoFlag < syncBKRepoRecordTypeRepoCreated {\n\t\t\terr := bkrepo.CreateRepo(\n\t\t\t\tfmt.Sprintf(\"%s://%s\", defaultProxyScheme, p.viper.GetString(\"bkrepo.host\")),\n\t\t\t\t&bkrepo.Auth{Token: p.viper.GetString(\"bkrepo.token\"), UID: kit.User},\n\t\t\t\t&bkrepo.CreateRepoReq{\n\t\t\t\t\tProjectID: bizID,\n\t\t\t\t\tName: bkrepo.CONFIGSREPONAME,\n\t\t\t\t\tType: bkrepo.REPOTYPE,\n\t\t\t\t\tCategory: bkrepo.CATEGORY,\n\t\t\t\t\tConfiguration: bkrepo.Configuration{Type: bkrepo.REPOCFGTYPE},\n\t\t\t\t\tDescription: \"bscp-configs\"},\n\t\t\t\tp.viper.GetDuration(\"bkrepo.timeout\"))\n\n\t\t\tif err != nil {\n\t\t\t\tlogger.Warnf(\"FileContent[%s][%s]| [%+v], create bkrepo repository failed, %+v\",\n\t\t\t\t\tkit.Rid, req.Method, req.URL, err)\n\t\t\t} else {\n\t\t\t\tp.syncBKRepoRecords.SetWithExpire(bizID, syncBKRepoRecordTypeRepoCreated,\n\t\t\t\t\tp.viper.GetDuration(\"bkrepo.recordCacheExpiration\"))\n\n\t\t\t\tlogger.V(2).Infof(\"FileContent[%s][%s]| [%+v], create bkrepo repository success\",\n\t\t\t\t\tkit.Rid, req.Method, req.URL)\n\t\t\t}\n\t\t}\n\t}\n\n\tp.proxy.ServeHTTP(w, req)\n}", "title": "" }, { "docid": "7f40323742d07893601a9684f9c99db0", "score": "0.52409005", "text": "func updatePost(postID string, message interface{}) *http.Response {\n\treturn sendMessage(\"PUT\", \"http://\"+address+\"/api/posts/\"+postID, message, true)\n}", "title": "" }, { "docid": "dd8763bf88b786d6bcd47cf7eeb96f75", "score": "0.5239624", "text": "func (h Handler) ServeHTTP(w http.ResponseWriter, r *http.Request) {\n\tif r.Method != http.MethodPost {\n\t\th.eh(w, r, ErrBadMethod)\n\t\treturn\n\t}\n\n\t//Check for some absurd content length\n\t//32mb should be plenty, right?\n\tif r.ContentLength <= 0 || r.ContentLength > (1024*1024*32) {\n\t\th.eh(w, r, ErrBadContentLength)\n\t\treturn\n\t}\n\n\tvar jb []byte\n\tif ct := r.Header.Get(\"Content-Type\"); ct == \"application/json\" {\n\t\tjb = make([]byte, r.ContentLength) //not something you want to do in production\n\n\t\t_, err := io.ReadAtLeast(r.Body, jb, int(r.ContentLength))\n\t\tif err != nil {\n\t\t\th.eh(w, r, err)\n\t\t\treturn\n\t\t}\n\t} else if ct == \"application/octet-stream\" {\n\t\t//Raven uses base64+zlib on \"packets\" larger than 1KB\n\t\tb64r := base64.NewDecoder(base64.StdEncoding, r.Body)\n\n\t\tzlr, err := zlib.NewReader(b64r)\n\t\tif err != nil {\n\t\t\th.eh(w, r, err)\n\t\t\treturn\n\t\t}\n\n\t\tjb, err = ioutil.ReadAll(zlr)\n\t\tzlr.Close()\n\t\tif err != nil {\n\t\t\th.eh(w, r, err)\n\t\t\treturn\n\t\t}\n\t} else {\n\t\th.eh(w, r, ErrBadContentType)\n\t\treturn\n\t}\n\n\tif h.next != nil {\n\t\tctx := context.WithValue(r.Context(), rawMessage, json.RawMessage(jb))\n\t\th.next.ServeHTTP(w, r.WithContext(ctx))\n\t\treturn\n\t}\n\n\tb, err := httputil.DumpRequest(r, false)\n\tif err != nil {\n\t\th.eh(w, r, err)\n\t\treturn\n\t}\n\n\tbuf := new(bytes.Buffer)\n\tif err = json.Indent(buf, jb, \"\", \" \"); err != nil {\n\t\th.eh(w, r, err)\n\t}\n\n\th.logger.Printf(\"\\n%s%s\\n\", b, buf.Bytes())\n}", "title": "" }, { "docid": "cd2c417569f36323a52d337c77cffc97", "score": "0.52386117", "text": "func (engine *Engine) ServeHTTP(w http.ResponseWriter, req *http.Request) {\n\tc := engine.pool.Get().(*Context)\n\tc.writermem.reset(w)\n\tc.Request = req\n\tc.reset()\n\n\tengine.handleHTTPRequest(c)\n\n\tengine.pool.Put(c)\n}", "title": "" }, { "docid": "2b1eb8d2450fee364ff9cc2493d94859", "score": "0.5221358", "text": "func main() {\r\n\tresp, err := http.Get(getURL)\r\n\tif err != nil {\r\n\t\tpanic(err)\r\n\t}\r\n\tdefer resp.Body.Close()\r\n\tbody, err := ioutil.ReadAll(resp.Body)\r\n\tfmt.Println(\"get:\\n\", keepLines(string(body), 3))\r\n\r\n\tresp, err = http.PostForm(postURL,\r\n\t\turl.Values{\"q\": {\"github\"}})\r\n\tif err != nil {\r\n\t\tpanic(err)\r\n\t}\r\n\tdefer resp.Body.Close()\r\n\tbody, err = ioutil.ReadAll(resp.Body)\r\n\tfmt.Println(\"post:\\n\", keepLines(string(body), 3))\r\n}", "title": "" }, { "docid": "f60b45707755237af27fbefc662f9f01", "score": "0.5216925", "text": "func (s *Server) Post(lang, path string, handler Handler) {\n\ts.router.POST(path, s.decorate(lang, handler))\n}", "title": "" }, { "docid": "504b598014ce0171d7c1be9a38f4e01a", "score": "0.5215154", "text": "func PostHandler(w http.ResponseWriter, r *http.Request) {\n\t// TODO: check that the posted file is an image\n\tif err := r.ParseMultipartForm(int64(settings.Config.Server.MaxFileSize)); err != nil {\n\t\terrMessage := fmt.Sprintf(\n\t\t\t\"Have you added the Content-Type: multipart/form-data header?\"+\n\t\t\t\t\"This is the detailed error: %s\", err.Error())\n\t\thttp.Error(w, errMessage, http.StatusBadRequest)\n\t\treturn\n\t}\n\n\t// TODO: support multiple file upload, for now, we return after the first insertion\n\tvar key string\n\tfor key, _ = range r.MultipartForm.File {\n\t\tbreak\n\t}\n\tfile, fileHeader, err := r.FormFile(key)\n\n\tfileBytes, err := ioutil.ReadAll(file)\n\tif err != nil {\n\t\thttp.Error(w, err.Error(), http.StatusBadRequest)\n\t}\n\tdefer file.Close()\n\n\t// TODO: accept PNGs as well (the header is \"application/octet-stream\".\n\t// We should check file headers and not request headers.\n\tif !strings.HasPrefix(fileHeader.Header.Get(\"Content-Type\"), \"image/\") {\n\t\thttp.Error(w, \"I will just accept an \\\"image/*\\\" here!\", http.StatusBadRequest)\n\t\treturn\n\t}\n\n\tchecksum := fmt.Sprintf(\"%x\", md5.Sum(fileBytes))\n\tdoc, err := mongo.GetHippoByMD5(checksum)\n\n\tif doc != nil {\n\t\tw.Header().Set(\"Content-Type\", \"application/json\")\n\t\tw.WriteHeader(409)\n\t\tw.Write(doc.JSON())\n\t\treturn\n\t}\n\n\tif err == mgo.ErrNotFound {\n\t\tdoc, err := mongo.InsertHippo(fileBytes)\n\t\tif err != nil {\n\t\t\thttp.Error(w, \"Holy s*£%t! I couldn't store your hippo!\", http.StatusInternalServerError)\n\t\t\treturn\n\t\t}\n\t\tw.Header().Set(\"Content-Type\", \"application/json\")\n\t\tw.WriteHeader(201)\n\t\tw.Write(doc.JSON())\n\t\treturn\n\t}\n\n\tw.WriteHeader(500)\n}", "title": "" }, { "docid": "a0ae5cc58d2b16273d03778a05fb425d", "score": "0.52143276", "text": "func (self httpFrontend) handle_postform(wr http.ResponseWriter, r *http.Request, board string) {\n\n // always lower case newsgroups\n board = strings.ToLower(board)\n \n // post fail message\n post_fail := \"\"\n\n // post message\n msg := \"\"\n \n // the nntp message\n var nntp nntpArticle\n nntp.headers = make(ArticleHeaders)\n\n\n // tripcode private key\n var tripcode_privkey []byte\n\n\n\n // encrypt IP Addresses\n // when a post is recv'd from a frontend, the remote address is given its own symetric key that the local srnd uses to encrypt the address with, for privacy\n // when a mod event is fired, it includes the encrypted IP address and the symetric key that frontend used to encrypt it, thus allowing others to determine the IP address\n // each stnf will optinally comply with the mod event, banning the address from being able to post from that frontend\n // this will be done eventually but for now that requires too much infrastrucutre, let's go with regular IP Addresses for now.\n \n // get the \"real\" ip address from the request\n\n address , _, err := net.SplitHostPort(r.RemoteAddr)\n // TODO: have in config upstream proxy ip and check for that\n if strings.HasPrefix(address, \"127.\") {\n // if it's loopback check headers for reverse proxy headers\n // TODO: make sure this isn't a tor user being sneaky\n address = getRealIP(r.Header.Get(\"X-Real-IP\"))\n }\n \n // check for banned\n if len(address) > 0 {\n banned, err := self.daemon.database.CheckIPBanned(address)\n if err == nil {\n if banned {\n wr.WriteHeader(403)\n // TODO: ban messages\n io.WriteString(wr, \"nigguh u banned.\")\n return\n }\n } else {\n wr.WriteHeader(500)\n io.WriteString(wr, \"error checking for ban: \")\n io.WriteString(wr, err.Error())\n return\n }\n }\n if len(address) == 0 {\n address = \"Tor\"\n }\n if ! strings.HasPrefix(address, \"127.\") {\n // set the ip address of the poster to be put into article headers\n // if we cannot determine it, i.e. we are on Tor/i2p, this value is not set\n if address == \"Tor\" {\n nntp.headers.Set(\"X-Tor-Poster\", \"1\")\n } else {\n address, err = self.daemon.database.GetEncAddress(address)\n nntp.headers.Set(\"X-Encrypted-IP\", address)\n // TODO: add x-tor-poster header for tor exits\n }\n }\n \n // if we don't have an address for the poster try checking for i2p httpd headers\n address = r.Header.Get(\"X-I2P-DestHash\")\n // TODO: make sure this isn't a Tor user being sneaky\n if len(address) > 0 {\n nntp.headers.Set(\"X-I2P-DestHash\", address)\n }\n \n\n // set newsgroup\n nntp.headers.Set(\"Newsgroups\", board)\n \n // redirect url\n url := \"\"\n // mime part handler\n var part_buff bytes.Buffer\n mp_reader, err := r.MultipartReader()\n if err != nil {\n errmsg := fmt.Sprintf(\"httpfrontend post handler parse multipart POST failed: %s\", err)\n log.Println(errmsg)\n wr.WriteHeader(500)\n io.WriteString(wr, errmsg)\n return\n }\n\n var subject, name string\n \n for {\n part, err := mp_reader.NextPart()\n if err == nil {\n // get the name of the part\n partname := part.FormName()\n\n // read part for attachment\n if partname == \"attachment\" && self.attachments {\n log.Println(\"attaching file...\")\n att := readAttachmentFromMimePart(part)\n nntp = nntp.Attach(att).(nntpArticle)\n continue\n }\n\n io.Copy(&part_buff, part)\n \n // check for values we want\n if partname == \"subject\" {\n subject = part_buff.String()\n } else if partname == \"name\" {\n name = part_buff.String()\n } else if partname == \"message\" {\n msg = part_buff.String()\n } else if partname == \"reference\" {\n ref := part_buff.String()\n if len(ref) == 0 {\n url = fmt.Sprintf(\"%s.html\", board)\n } else if ValidMessageID(ref) {\n if self.daemon.database.HasArticleLocal(ref) {\n nntp.headers.Set(\"References\", ref)\n url = fmt.Sprintf(\"thread-%s.html\", ShortHashMessageID(ref))\n } else {\n // no such article\n url = fmt.Sprintf(\"%s.html\", board)\n post_fail += \"we don't have \"\n post_fail += ref\n post_fail += \"locally, can't reply. \"\n }\n } else {\n post_fail += \"invalid reference: \"\n post_fail += ref\n post_fail += \", not posting. \"\n }\n \n\n } else if partname == \"captcha\" {\n captcha_solution := part_buff.String()\n s, err := self.store.Get(r, self.name)\n captcha_id , ok := s.Values[\"captcha_id\"]\n if err == nil && ok {\n if captcha.VerifyString(captcha_id.(string), captcha_solution) {\n // captcha is valid\n } else {\n // captcha is not valid\n post_fail += \"failed captcha. \"\n }\n } else {\n // captcha has no cookies\n post_fail += \"enable cookies. \"\n }\n }\n // we done\n // reset buffer for reading parts\n part_buff.Reset()\n // close our part\n part.Close()\n } else {\n if err != io.EOF {\n errmsg := fmt.Sprintf(\"httpfrontend post handler error reading multipart: %s\", err)\n log.Println(errmsg)\n wr.WriteHeader(500)\n io.WriteString(wr, errmsg)\n return\n }\n break\n }\n }\n\n\n // make error template param\n resp_map := make(map[string]string)\n resp_map[\"prefix\"] = self.prefix\n // set redirect url\n if len(url) > 0 {\n // if we explicitly know the url use that\n resp_map[\"redirect_url\"] = self.prefix + url\n } else {\n // if our referer is saying we are from /new/ page use that\n // otherwise use prefix\n if strings.HasSuffix(r.Referer(), self.prefix+\"new/\") {\n resp_map[\"redirect_url\"] = self.prefix + \"new/\"\n } else {\n resp_map[\"redirect_url\"] = self.prefix\n }\n }\n\n if len(nntp.attachments) == 0 && len(msg) == 0 {\n post_fail += \"no message. \"\n }\n \n if len(post_fail) > 0 {\n wr.WriteHeader(200)\n resp_map[\"reason\"] = post_fail\n io.WriteString(wr, template.renderTemplate(\"post_fail.mustache\", resp_map))\n return\n }\n \n // set subject\n if len(subject) == 0 {\n subject = \"None\"\n }\n nntp.headers.Set(\"Subject\", subject)\n if isSage(subject) {\n nntp.headers.Set(\"X-Sage\", \"1\")\n }\n\n // set name\n if len(name) == 0 {\n name = \"Anonymous\"\n } else {\n idx := strings.Index(name, \"#\")\n // tripcode\n if idx >= 0 {\n tripcode_privkey = parseTripcodeSecret(name[idx+1:])\n name = strings.Trim(name[:idx], \"\\t \")\n if name == \"\" {\n name = \"Anonymous\"\n }\n }\n }\n nntp.headers.Set(\"From\", nntpSanitize(fmt.Sprintf(\"%s <anon@%s>\", name, self.name)))\n nntp.headers.Set(\"Message-ID\", genMessageID(self.name))\n \n // set message\n nntp.message = createPlaintextAttachment(msg)\n // set date\n nntp.headers.Set(\"Date\", timeNowStr())\n // append path from frontend\n nntp.AppendPath(self.name)\n // send message off to daemon\n log.Printf(\"uploaded %d attachments\", len(nntp.Attachments()))\n nntp.Pack()\n\n // sign if needed\n if len(tripcode_privkey) == nacl.CryptoSignSeedLen() {\n nntp, err = signArticle(nntp, tripcode_privkey)\n if err != nil {\n // wtf? error!?\n log.Println(\"error signing\", err)\n wr.WriteHeader(500)\n io.WriteString(wr, err.Error())\n return \n }\n }\n // XXX: write it temp instead\n // self.postchan <- nntp\n f := self.daemon.store.CreateTempFile(nntp.MessageID())\n if f != nil {\n nntp.WriteTo(f, \"\\n\")\n f.Close()\n }\n self.daemon.infeed_load <- nntp.MessageID()\n\n // send success reply\n wr.WriteHeader(200)\n // determine the root post so we can redirect to the thread for it\n msg_id := nntp.headers.Get(\"References\", nntp.MessageID())\n // render response as success\n url = fmt.Sprintf(\"%sthread-%s.html\", self.prefix, ShortHashMessageID(msg_id))\n io.WriteString(wr, template.renderTemplate(\"post_success.mustache\", map[string]string {\"prefix\" : self.prefix, \"message_id\" : nntp.MessageID(), \"redirect_url\" : url}))\n}", "title": "" }, { "docid": "a45d0f22f0ca70e8179eea368ae96a1c", "score": "0.52094287", "text": "func (h *nextRequestHandler) ServeHTTP(w http.ResponseWriter, r *http.Request) {\n\th.c.Writer = &wrappedResponseWriter{h.c.Writer, w}\n\th.c.Next()\n}", "title": "" }, { "docid": "0089cebb492177ae1e70162342cafaef", "score": "0.52092594", "text": "func GetPost(w http.ResponseWriter, r *http.Request) {\n\tparameters := mux.Vars(r)\n\tfor _, indexpost := range posts {\n\t\tif parameters[\"id\"] == indexpost.ID {\n\t\t\tjson.NewEncoder(w).Encode(indexpost)\n\t\t}\n\t}\n}", "title": "" }, { "docid": "4191229172d43eca3a353f27ee6c4b71", "score": "0.52078706", "text": "func resetHandler(w http.ResponseWriter, r *http.Request) {\n\tif r.Method != \"POST\" {\n\t\tnotImplemented(w)\n\t\treturn\n\t}\n\n\tlog.WithFields(reqFields(r)).Info(\"reset handler invoked\")\n\tposts = nil\n\tfor _, p := range orgPosts {\n\t\tposts = append(posts, p)\n\t}\n\tidSeq = len(posts)\n\twrite(w, map[string]bool{\"reset\": true})\n}", "title": "" }, { "docid": "6e51f7726df78e26b164639507d028a0", "score": "0.52070695", "text": "func (listener *WebListener) POST(path string, handler http.HandlerFunc) {\n\tlistener.router.POST(path, listener.middleware.ThenFunc(handler))\n}", "title": "" }, { "docid": "e0f9095e5d9246946960f8f1623e3a33", "score": "0.5206204", "text": "func PutPost(w http.ResponseWriter, r *http.Request) {\n\tvars := mux.Vars(r)\n\tid, _ := strconv.ParseUint(vars[\"id\"], 10, 64)\n\tbody := util.BodyParser(r)\n\tvar post model.Post\n\terr := json.Unmarshal(body, &post)\n\tif err != nil {\n\t\tutil.ToJSON(w, err.Error(), http.StatusUnprocessableEntity)\n\t\treturn\n\t}\n\tpost.ID = uint32(id)\n\trows, err := model.UpdatePost(post)\n\tif err != nil {\n\t\tutil.ToJSON(w, err.Error(), http.StatusUnprocessableEntity)\n\t\treturn\n\t}\n\tutil.ToJSON(w, rows, http.StatusCreated)\n}", "title": "" }, { "docid": "41d39ec0acbbb5964689f91c79bc249a", "score": "0.5201858", "text": "func (h *PostsHandler) Add(w http.ResponseWriter, r *http.Request) {\n\n\tnewPost := &posts.Post{}\n\terr := json.NewDecoder(r.Body).Decode(newPost)\n\tif err != nil {\n\t\th.Logger.Errorf(`BadRequest. %s`, err.Error())\n\t\tjsonMessage := utils.GetJSONMessageAsString(err.Error())\n\t\thttp.Error(w, jsonMessage, http.StatusBadRequest)\n\t\treturn\n\t}\n\n\tsess, err := session.SessionFromContext(r.Context())\n\tif err != nil {\n\t\th.Logger.Errorf(`InternalServerError. %s`, err.Error())\n\t\thttp.Error(w, `InternalServerError`, http.StatusInternalServerError)\n\t\treturn\n\t}\n\n\tauthor, err := h.UsersRepo.GetByID(sess.UserID)\n\tif err != nil {\n\t\th.Logger.Errorf(`InternalServerError. Could not find user. %s`, err.Error())\n\t\thttp.Error(w, `InternalServerError`, http.StatusInternalServerError)\n\t\treturn\n\t}\n\tauthor.PasswordHash = \"\" // a security measure :)\n\tnewPost.Author = *author\n\n\tcreatedPost, err := h.PostsRepo.Add(newPost)\n\tif err != nil {\n\t\tjsonMessage := utils.GetJSONMessageAsString(err.Error())\n\t\thttp.Error(w, jsonMessage, http.StatusInternalServerError)\n\t\treturn\n\t}\n\tw.Header().Add(\"Content-Type\", \"application/json\")\n\tresult, _ := json.Marshal(createdPost)\n\tw.Write(result)\n}", "title": "" }, { "docid": "2dd9bb8ca05a3562585ef1ed41f2c319", "score": "0.5201453", "text": "func (s *Handler) ServeHTTP(w http.ResponseWriter, r *http.Request) {\n\t// println(\"Request to the remote service has been established\")\n\tkey := getURLParam(r, internal.QueryCacheKey)\n\tif key == \"\" {\n\t\t// println(\"return because key was empty\")\n\t\tw.WriteHeader(internal.FailStatus)\n\t\treturn\n\t}\n\n\t// we always need the Entry, so get it now\n\tentry := s.store.Get(key)\n\n\tif entry == nil && r.Method != methodPost {\n\t\t// if it's nil then means it never setted before\n\t\t// it doesn't exists, and client doesn't wants to\n\t\t// add a cache entry, so just return\n\t\t//\n\t\t// no delete action is valid\n\t\t// no get action is valid\n\t\t// no post action is requested\n\t\tw.WriteHeader(internal.FailStatus)\n\t\treturn\n\t}\n\n\tswitch r.Method {\n\tcase methodGet:\n\t\t{\n\t\t\t// get from the cache and send to client\n\t\t\tres, ok := entry.Response()\n\t\t\tif !ok {\n\t\t\t\t// entry exists but it has been expired\n\t\t\t\t// return\n\t\t\t\tw.WriteHeader(internal.FailStatus)\n\t\t\t\treturn\n\t\t\t}\n\n\t\t\t// entry exists and response is valid\n\t\t\t// send it to the client\n\t\t\tw.Header().Set(internal.ContentTypeHeader, res.ContentType())\n\t\t\tw.WriteHeader(res.StatusCode())\n\t\t\tw.Write(res.Body())\n\t\t}\n\tcase methodPost:\n\t\t{\n\t\t\t// save a new cache entry if entry ==nil or\n\t\t\t// update an existing if entry !=nil\n\n\t\t\tbody, err := ioutil.ReadAll(r.Body)\n\t\t\tif err != nil || len(body) == 0 {\n\t\t\t\t// println(\"body's request was empty, return fail\")\n\t\t\t\tw.WriteHeader(internal.FailStatus)\n\t\t\t\treturn\n\t\t\t}\n\n\t\t\tstatusCode, _ := getURLParamInt(r, internal.QueryCacheStatusCode)\n\t\t\tcontentType := getURLParam(r, internal.QueryCacheContentType)\n\n\t\t\t// now that we have the information\n\t\t\t// we want to see if this is a totally new cache entry\n\t\t\t// or just update an existing one with the new information\n\t\t\t// (an update can change the status code, content type\n\t\t\t// and ofcourse the body and expiration time by header)\n\n\t\t\tif entry == nil {\n\t\t\t\t// get the information by its url\n\t\t\t\t// println(\"we have a post request method, let's save a cached entry \")\n\t\t\t\t// get the cache expiration via url param\n\t\t\t\texpirationSeconds, err := getURLParamInt64(r, internal.QueryCacheDuration)\n\t\t\t\t// get the body from the requested body\n\t\t\t\t// get the expiration from the \"cache-control's maxage\" if no url param is setted\n\t\t\t\tif expirationSeconds <= 0 || err != nil {\n\t\t\t\t\texpirationSeconds = int64(nethttp.GetMaxAge(r)().Seconds())\n\t\t\t\t}\n\t\t\t\t// if not setted then try to get it via\n\t\t\t\tif expirationSeconds <= 0 {\n\t\t\t\t\texpirationSeconds = int64(internal.MinimumCacheDuration.Seconds())\n\t\t\t\t}\n\n\t\t\t\tcacheDuration := time.Duration(expirationSeconds) * time.Second\n\n\t\t\t\t// store by its url+the key in order to be unique key among different servers with the same paths\n\t\t\t\ts.store.Set(key, statusCode, contentType, body, cacheDuration)\n\t\t\t} else {\n\t\t\t\t// update an existing one and change its duration based on the header\n\t\t\t\t// (if > existing duration)\n\t\t\t\tentry.Reset(statusCode, contentType, body, nethttp.GetMaxAge(r))\n\t\t\t}\n\n\t\t\tw.WriteHeader(internal.SuccessStatus)\n\t\t}\n\tcase methodDelete:\n\t\t{\n\t\t\t// remove the entry entirely from the cache\n\t\t\t// manually DELETE cache should remove this entirely\n\t\t\t// no just invalidate it\n\t\t\ts.store.Remove(key)\n\t\t\tw.WriteHeader(internal.SuccessStatus)\n\t\t}\n\tdefault:\n\t\tw.WriteHeader(internal.FailStatus)\n\t}\n\n}", "title": "" }, { "docid": "f4f6a1ce63c0df6196eeb226328dbb8a", "score": "0.51993364", "text": "func (h *Handler) ServeHTTP(w http.ResponseWriter, r *http.Request) {\n\tw.Header().Add(\"X-Cloudive-Version\", h.Version)\n\n\tif strings.HasPrefix(r.URL.Path, \"/debug/pprof\") {\n\t\tswitch r.URL.Path {\n\t\tcase \"/debug/pprof/cmdline\":\n\t\t\tpprof.Cmdline(w, r)\n\t\tcase \"/debug/pprof/profile\":\n\t\t\tpprof.Profile(w, r)\n\t\tcase \"/debug/pprof/symbol\":\n\t\t\tpprof.Symbol(w, r)\n\t\tdefault:\n\t\t\tpprof.Index(w, r)\n\t\t}\n\t} else {\n\t\tw.Header().Add(\"Content-Type\", \"application/json\")\n\t\th.mux.ServeHTTP(w, r)\n\t}\n\n\t// atomic.AddInt64(&h.stats.RequestDuration, time.Since(start).Nanoseconds())\n}", "title": "" }, { "docid": "96237281e96897a119eaf1503dc2dcd9", "score": "0.51918197", "text": "func (m *MiniMux) Post(path string, handler http.Handler) {\n\tm.add(\"POST\", path, handler)\n}", "title": "" }, { "docid": "aa650e8b8103722ff642794e3b93cf3f", "score": "0.51881945", "text": "func (g *GitLab) ServeHTTP(w http.ResponseWriter, r *http.Request) {\n\tdata := map[string]interface{}{}\n\tif err := json.NewDecoder(r.Body).Decode(&data); err != nil {\n\t\treason := \"invalid request format, should be a map<string, Any>\"\n\t\thttp.Error(w, reason, http.StatusBadRequest)\n\t\treturn\n\t}\n\n\t// verify github signature\n\tif secret, ok := os.LookupEnv(\"GITLAB_SECRET\"); ok {\n\t\tif r.Header.Get(\"X-Gitlab-Token\") != secret {\n\t\t\thttp.Error(w, \"signature not matched\", http.StatusForbidden)\n\t\t\treturn\n\t\t}\n\t}\n\n\t// TODO: identify the event type and then publish data to broker queue\n\n\tw.WriteHeader(http.StatusOK)\n\tw.Write([]byte(\"webhook accepted\"))\n}", "title": "" }, { "docid": "19c330b432236634ce3dfc1c103100a2", "score": "0.51843786", "text": "func (indexHandler *IndexHandler) ServeHTTP(rw http.ResponseWriter, req *http.Request) {\n\trw.Header().Add(\"Cache-Control\", \"no-cache, no-store, must-revalidate\")\n\terr := indexHandler.page.Execute(rw, indexHandler.readPageData())\n\tif err != nil {\n\t\tlog.Printf(\"Error occurred while executing template: %v\", err)\n\t}\n}", "title": "" }, { "docid": "ea59a8f927fb21f7b06ff19bacd9fff1", "score": "0.5184128", "text": "func Serve(resp http.ResponseWriter, req *http.Request) {\n\n\twww.ServeHTTP(resp, req)\n}", "title": "" }, { "docid": "a03df044b54ee5827b1a2dc3b1bc3328", "score": "0.51837975", "text": "func (controller PostController) Update(w http.ResponseWriter, r *http.Request) {\n\tuserID, err := authentication.ExtractUserID(r)\n\tif err != nil {\n\t\tresponse.Error(w, http.StatusUnauthorized, err)\n\t\treturn\n\t}\n\n\tparams := mux.Vars(r)\n\n\tpostID, err := strconv.ParseUint(params[\"postID\"], 10, 64)\n\tif err != nil {\n\t\tresponse.Error(w, http.StatusBadRequest, err)\n\t\treturn\n\t}\n\n\tstoredPost, err := controller.postRepository.FindByID(postID)\n\tif err != nil {\n\t\tresponse.Error(w, http.StatusInternalServerError, err)\n\t\treturn\n\t}\n\n\tif userID != storedPost.AuthorID {\n\t\tresponse.Error(w, http.StatusForbidden, errors.New(\"you cannot update a post that is not yours\"))\n\t\treturn\n\t}\n\n\tbody, err := ioutil.ReadAll(r.Body)\n\tif err != nil {\n\t\tresponse.Error(w, http.StatusUnprocessableEntity, err)\n\t\treturn\n\t}\n\n\tvar post model.Post\n\terr = json.Unmarshal(body, &post)\n\tif err != nil {\n\t\tresponse.Error(w, http.StatusBadRequest, err)\n\t\treturn\n\t}\n\n\terr = controller.postRepository.Update(postID, post)\n\tif err != nil {\n\t\tresponse.Error(w, http.StatusInternalServerError, err)\n\t\treturn\n\t}\n\n\tresponse.JSON(w, http.StatusNoContent, nil)\n\n}", "title": "" }, { "docid": "742009643809b63564a1d2760866f3dd", "score": "0.5179959", "text": "func handlePost(w http.ResponseWriter, r *http.Request) {\n\tcmd := r.FormValue(\"cmd\")\n\tif cmd == \"restart\" {\n\t\tif commander.done {\n\t\t\tfmt.Printf(\"Restarting %s commander\\n\", command)\n\t\t\t// create a new one\n\t\t\tc, err := startCommander(command, tempFileName)\n\t\t\tcommander = c\n\t\t\tif err != nil {\n\t\t\t\tfmt.Printf(\"Error restarting %s: %s\\n\", command, err)\n\t\t\t}\n\t\t}\n\t\thttp.Redirect(w, r, context, 302)\n\t\treturn\n\t}\n\tcommander.WriteString(cmd)\n\ttime.Sleep(time.Second)\n\thttp.Redirect(w, r, context, 302)\n}", "title": "" }, { "docid": "db873d85ae2bf9915dd49666f17856b2", "score": "0.5179201", "text": "func Handle(w http.ResponseWriter, r *http.Request) {\n\tr.ParseForm()\n\tif !checkUrl(w, r) {\n\t\tlog.Println(\"Fail\")\n\t\tlog.Println(r.Form[\"token\"], r.Form[\"timestamp\"], r.Form[\"nonce\"])\n\t\treturn\n\t}\n\tif r.Method == \"POST\" {\n\t\tBigContent := PsBig(r)\n\t\tif BigContent != nil {\n\t\t\tfmt.Println(\"MsgType: \", BigContent.MsgType)\n\t\t\tswitch BigContent.MsgType {\n\t\t\tcase \"text\":\n\t\t\t\tlog.Printf(\"msg:| %s |, user:| %s |\", BigContent.Content, BigContent.FromUserName)\n\t\t\t\ttextReply, err := MkText(BigContent.ToUserName, BigContent.FromUserName, reverseStr(BigContent.Content))\n\t\t\t\tif err != nil {\n\t\t\t\t\tlog.Println(err)\n\t\t\t\t\treturn\n\t\t\t\t}\n\t\t\t\tfmt.Fprintf(w, string(textReply))\n\t\t\tcase \"image\":\n\t\t\t\ttextReply, err := MkText(BigContent.ToUserName, BigContent.FromUserName, \"好图,已撸。\")\n\t\t\t\tif err != nil {\n\t\t\t\t\tlog.Println(err)\n\t\t\t\t\treturn\n\t\t\t\t}\n\t\t\t\tfmt.Fprintf(w, string(textReply))\n\t\t\tdefault:\n\t\t\t\tfmt.Fprint(w, \"success\")\n\t\t\t}\n\n\t\t}\n\t}\n\tlog.Println(\"Succeed\")\n}", "title": "" }, { "docid": "2d0098cc9e1b7d9c9e4257d244f6a8e6", "score": "0.51773274", "text": "func GetPostHandle(db interface{}) func(server.Request) (handler.Response, error) {\n\n\treturn func(req server.Request) (handler.Response, error) {\n\t\t// Create service\n\t\tpostService, serviceErr := service.NewPostService(db)\n\t\tif serviceErr != nil {\n\t\t\treturn handler.Response{StatusCode: http.StatusInternalServerError}, serviceErr\n\t\t}\n\t\tpostId := req.GetParamByName(\"postId\")\n\t\tpostUUID, uuidErr := uuid.FromString(postId)\n\t\tif uuidErr != nil {\n\t\t\treturn handler.Response{StatusCode: http.StatusBadRequest,\n\t\t\t\t\tBody: utils.MarshalError(\"parseUUIDError\", \"Can not parse post id!\")},\n\t\t\t\tnil\n\t\t}\n\n\t\tfoundPost, err := postService.FindById(postUUID)\n\t\tif err != nil {\n\t\t\treturn handler.Response{StatusCode: http.StatusInternalServerError}, err\n\t\t}\n\n\t\tpostModel := models.PostModel{\n\t\t\tObjectId: foundPost.ObjectId,\n\t\t\tPostTypeId: foundPost.PostTypeId,\n\t\t\tOwnerUserId: foundPost.OwnerUserId,\n\t\t\tScore: foundPost.Score,\n\t\t\tVotes: foundPost.Votes,\n\t\t\tViewCount: foundPost.ViewCount,\n\t\t\tBody: foundPost.Body,\n\t\t\tOwnerDisplayName: foundPost.OwnerDisplayName,\n\t\t\tOwnerAvatar: foundPost.OwnerAvatar,\n\t\t\tTags: foundPost.Tags,\n\t\t\tCommentCounter: foundPost.CommentCounter,\n\t\t\tImage: foundPost.Image,\n\t\t\tImageFullPath: foundPost.ImageFullPath,\n\t\t\tVideo: foundPost.Video,\n\t\t\tThumbnail: foundPost.Thumbnail,\n\t\t\tDisableComments: foundPost.DisableComments,\n\t\t\tDisableSharing: foundPost.DisableSharing,\n\t\t\tDeleted: foundPost.Deleted,\n\t\t\tDeletedDate: foundPost.DeletedDate,\n\t\t\tCreatedDate: foundPost.CreatedDate,\n\t\t\tLastUpdated: foundPost.LastUpdated,\n\t\t\tAccessUserList: foundPost.AccessUserList,\n\t\t\tPermission: foundPost.Permission,\n\t\t\tVersion: foundPost.Version,\n\t\t}\n\n\t\tif foundPost.PostTypeId == constants.PostConstAlbum.Parse() || foundPost.PostTypeId == constants.PostConstPhotoGallery.Parse() {\n\t\t\tpostModel.Album = models.PostAlbumModel{\n\t\t\t\tCount: foundPost.Album.Count,\n\t\t\t\tCover: foundPost.Album.Cover,\n\t\t\t\tCoverId: foundPost.Album.CoverId,\n\t\t\t\tPhotos: foundPost.Album.Photos,\n\t\t\t\tTitle: foundPost.Album.Title,\n\t\t\t}\n\t\t}\n\n\t\tbody, marshalErr := json.Marshal(postModel)\n\t\tif marshalErr != nil {\n\t\t\terrorMessage := fmt.Sprintf(\"Error while marshaling postModel: %s\",\n\t\t\t\tmarshalErr.Error())\n\t\t\treturn handler.Response{StatusCode: http.StatusBadRequest, Body: utils.MarshalError(\"marshalPostModelError\", errorMessage)},\n\t\t\t\tmarshalErr\n\n\t\t}\n\t\treturn handler.Response{\n\t\t\tBody: []byte(body),\n\t\t\tStatusCode: http.StatusOK,\n\t\t}, nil\n\t}\n}", "title": "" }, { "docid": "2307e0fdbc1613f3720ff137504a845e", "score": "0.5177212", "text": "func (h *httpHandler) ServeHTTP(w http.ResponseWriter, r *http.Request) {\n\tif r.Method != http.MethodPost {\n\t\thttp.Error(w, http.StatusText(http.StatusMethodNotAllowed), http.StatusMethodNotAllowed)\n\t\treturn\n\t}\n\n\tw.Header().Set(\"Content-Type\", \"application/json\")\n\n\th.server.ServeCodec(jsonrpc.NewServerCodec(&serverCodec{r.Body, w}))\n}", "title": "" }, { "docid": "e0ace2e84bcc10591aa559a1ee2155e2", "score": "0.51715887", "text": "func PostID(next http.Handler) http.Handler {\n\tfn := func(w http.ResponseWriter, r *http.Request) {\n\t\tpostID, err := strconv.Atoi(chi.URLParam(r, \"postID\"))\n\t\tif err != nil {\n\t\t\thttp.Error(w, \"Invalid PostID Param\", http.StatusBadRequest)\n\t\t\treturn\n\t\t}\n\t\tctx := context.WithValue(r.Context(), \"post_id\", postID)\n\t\tnext.ServeHTTP(w, r.WithContext(ctx))\n\t}\n\treturn http.HandlerFunc(fn)\n}", "title": "" }, { "docid": "6c2d4eb78536a3787bc7cbff8832d6ae", "score": "0.51682293", "text": "func (a App) ShowPost(res http.ResponseWriter, req *http.Request) {\n\n\ttmpl := template.Must(template.ParseFiles(\n\t\tprojectView(\"layout\"),\n\t\tprojectView(\"nav\"),\n\t\tprojectView(\"show_post\"),\n\t))\n\n\terr := tmpl.ExecuteTemplate(res, \"layout\", posts[1])\n\tif err != nil {\n\t\thttp.Error(res, err.Error(), http.StatusInternalServerError)\n\t}\n}", "title": "" }, { "docid": "e19de233b28a6ccb4b126d4d80030f2e", "score": "0.5162486", "text": "func UpdatePost(w http.ResponseWriter, r *http.Request) {\n\tpostID, err := getPostID(r)\n\tif err != nil {\n\t\tresponses.Error(w, http.StatusBadRequest, err)\n\t\treturn\n\t}\n\n\tuserID, err := authentication.GetUserID(r)\n\tif err != nil {\n\t\tresponses.Error(w, http.StatusUnauthorized, err)\n\t\treturn\n\t}\n\n\tdb, err := database.Connect()\n\tif err != nil {\n\t\tresponses.Error(w, http.StatusInternalServerError, err)\n\t\treturn\n\t}\n\tdefer db.Close()\n\n\trepository := repositories.NewPostsRepository(db)\n\tsavedPost, err := repository.SearchByID(postID)\n\tif err != nil {\n\t\tresponses.Error(w, http.StatusInternalServerError, err)\n\t\treturn\n\t}\n\n\tif savedPost.UserID != userID {\n\t\tresponses.Error(w, http.StatusForbidden, errors.New(\"Unable to update other user´s post\"))\n\t\treturn\n\t}\n\n\trequestBody, err := ioutil.ReadAll(r.Body)\n\tif err != nil {\n\t\tresponses.Error(w, http.StatusUnprocessableEntity, err)\n\t\treturn\n\t}\n\n\tvar updatedPost models.Post\n\tif err = json.Unmarshal(requestBody, &updatedPost); err != nil {\n\t\tresponses.Error(w, http.StatusBadRequest, err)\n\t\treturn\n\t}\n\n\tif err = updatedPost.Prepare(); err != nil {\n\t\tresponses.Error(w, http.StatusBadRequest, err)\n\t\treturn\n\t}\n\n\tif err = repository.Update(postID, updatedPost); err != nil {\n\t\tresponses.Error(w, http.StatusInternalServerError, err)\n\t\treturn\n\t}\n\n\tresponses.JSON(w, http.StatusNoContent, nil)\n}", "title": "" }, { "docid": "62bd1a0553606b6062797bfdd4cdeaee", "score": "0.5155851", "text": "func (c *Repo) Post() {\n files, err := listFiles(RepositoryDir)\n \n json := make(map[string]interface{})\n if err == nil {\n json[\"files\"] = files\n } else {\n json[\"error\"] = err.Error()\n }\n c.Data[\"json\"] = json\n c.ServeJson()\n}", "title": "" }, { "docid": "58e5a3741d2a32e85bb10543a9d00112", "score": "0.5152999", "text": "func (s *Server) getPostByID(w http.ResponseWriter, r *http.Request) {\n}", "title": "" }, { "docid": "f237dfbca06694b89f4d5603941509dd", "score": "0.51462716", "text": "func createPost(res http.ResponseWriter, req *http.Request) {\n\tif req.Method == \"GET\" {\n\t\tres.WriteHeader(http.StatusInternalServerError)\n\t\tres.Write([]byte(`{\"message\":\"GET METHOD is not applicable\"}`))\n\t} else {\n\t\tif req.Header.Get(\"Content-Type\") != \"application/json\" {\n\t\t\tres.WriteHeader(http.StatusInternalServerError)\n\t\t\tres.Write([]byte(`{\"message\":\"Only json data is allowed\"}`))\n\t\t} else {\n\t\t\treq.ParseForm()\n\t\t\tdecoder := json.NewDecoder(req.Body)\n\t\t\tvar newPost Post\n\t\t\tnewPost.PostTimestamp = time.Now()\n\t\t\terr := decoder.Decode(&newPost)\n\t\t\tif err != nil {\n\t\t\t\tpanic(err)\n\t\t\t}\n\t\t\tlog.Println(newPost.Id)\n\t\t\tinsertPost(newPost)\n\t\t}\n\t}\n}", "title": "" }, { "docid": "e87ab490250949c84b9c0c24dfca0afb", "score": "0.5145858", "text": "func GET_Posts_New(w http.ResponseWriter, r *http.Request) {\n\t// print received request\n\tfmt.Println(\"Received request to get new posts of each user's sub reddits\")\n\n\t// get numbers of posts of each sub reddit to retrieve\n\tquery := r.URL.Query()\n\tlimit := query.Get(\"limit\")\n\tif limit == \"\" {\n\t\tlimit = \"3\"\n\t}\n\n\t// convert limit to int. In case of error, log and fail request\n\tlimitInt, err := strconv.Atoi(limit)\n\tif err != nil {\n\t\tfmt.Println(\"Failing request:\", err)\n\t\tw.WriteHeader(http.StatusBadRequest)\n\t\tw.Header().Set(\"Content-Type\", \"application/json\")\n\t\tjson.NewEncoder(w).Encode(\n\t\t\tFailureResponse{Error{\"Invalid limit. It must be an integer\"}},\n\t\t)\n\t\treturn\n\t}\n\n\t// print progression\n\tfmt.Println(\"Requesting \" + limit + \" new posts of each user's sub reddits\")\n\n\t// get sub reddits' new posts\n\tposts := requester.GetPosts(\n\t\tglobals.USERNAME,\n\t\tglobals.SUB_REDDITS,\n\t\tNewPostsControll,\n\t\tlimitInt,\n\t\t\"new\",\n\t\tglobals.TOKEN,\n\t)\n\n\t// respond request. If fails to encode response fail request\n\tw.Header().Set(\"Content-Type\", \"application/json\")\n\terr = json.NewEncoder(w).Encode(PostsResponse{posts})\n\tif err != nil {\n\t\tfmt.Println(\"Failing request:\", err)\n\t\tw.WriteHeader(http.StatusInternalServerError)\n\t\tw.Header().Set(\"Content-Type\", \"application/json\")\n\t\tjson.NewEncoder(w).Encode(\n\t\t\tFailureResponse{Error{\"Failed to parse reddit response.\"}},\n\t\t)\n\t\treturn\n\t}\n\tfmt.Println(\"Answered user's sub reddits' new posts\")\n}", "title": "" }, { "docid": "b37247fac8f24b3b76e8a1c76da57738", "score": "0.5134015", "text": "func (ws wrapperServer) ServeHTTP(w http.ResponseWriter, r *http.Request) {\n\n}", "title": "" }, { "docid": "239484b53a315f6d0adfda738646aff4", "score": "0.51295984", "text": "func (s *Server)GetPost(w http.ResponseWriter, r *http.Request) {\n\tvar (\n\t\tposts []models.Post\n\t\tids []float64\n\t\treqIds models.RequestPostsById\n\t\treqId models.RequestPostById\n\t)\n\terr := json.NewDecoder(r.Body).Decode(&reqIds)\n\tif err != nil {\n\t\t//If not multiple User Ids, check single\n\t\terr := json.NewDecoder(r.Body).Decode(&reqId)\n\t\tif err != nil {\n\t\t\t//Input invalid\n\t\t\tutil.InfoLog(\"Request input invalid\")\n\t\t\tutil.WriteRes(http.StatusBadRequest, http.StatusText(http.StatusBadRequest), w)\n\t\t}\n\t}\n\tdefer func() {\n\t\terr := r.Body.Close()\n\t\tif err != nil {\n\t\t\tutil.ErrorLog(\"Failed to close reader stream of request body\", err)\n\t\t\tutil.WriteRes(http.StatusInternalServerError, http.StatusText(http.StatusInternalServerError), w)\n\t\t\treturn\n\t\t}\n\t}()\n\n\tids = append(reqIds.Posts, reqId.Id)\n\n\tfor _, i := range ids {\n\t\tgo func(){\n\t\t\tpost, err := s.db.GetPost(i)\n\t\t\tif err != nil {\n\t\t\t\tutil.ErrorLog(\"Failed to GetPost\", err)\n\t\t\t\tutil.WriteRes(http.StatusInternalServerError, http.StatusText(http.StatusInternalServerError), w)\n\t\t\t\treturn\n\t\t\t}\n\t\t\tposts = append(posts, post)\n\t\t}()\n\t}\n\traw, err := json.Marshal(posts)\n\tif err != nil {\n\t\tutil.ErrorLog(\"Failed to marshal posts into response\", err)\n\t\tutil.WriteRes(http.StatusInternalServerError, http.StatusText(http.StatusInternalServerError), w)\n\t\treturn\n\t}\n\tres := string(raw)\n\tutil.WriteRes(http.StatusOK, res, w)\n}", "title": "" }, { "docid": "c9811e57394f5d0c104abcc00cd95d0c", "score": "0.5127649", "text": "func (b BoardRenderHandler) ServeHTTP(w http.ResponseWriter, r *http.Request) {\n\tif r.Method != http.MethodGet {\n\t\tw.WriteHeader(http.StatusMethodNotAllowed)\n\t\treturn\n\t}\n\tquery := r.URL.Query()\n\tfen := query.Get(\"fen\")\n\tif fen == \"\" {\n\t\tw.WriteHeader(http.StatusBadRequest)\n\t\treturn\n\t}\n\tif !b.LinkRenderer.ValidateLink(*r.URL) {\n\t\tw.WriteHeader(http.StatusForbidden)\n\t\treturn\n\t}\n\tboard, err := chessimage.NewRendererFromFEN(fen)\n\tif err != nil {\n\t\tw.WriteHeader(http.StatusInternalServerError)\n\t\treturn\n\t}\n\tif from := query.Get(\"from\"); from != \"\" {\n\t\tto := query.Get(\"to\")\n\t\ttFrom, _ := chessimage.TileFromAN(from)\n\t\ttTo, _ := chessimage.TileFromAN(to)\n\t\tboard.SetLastMove(chessimage.LastMove{\n\t\t\tFrom: tFrom,\n\t\t\tTo: tTo,\n\t\t})\n\t}\n\tif check := query.Get(\"check\"); check != \"\" {\n\t\ttCheck, _ := chessimage.TileFromAN(check)\n\t\tboard.SetCheckTile(tCheck)\n\t}\n\n\tinverted := query.Get(\"inverted\") == \"true\"\n\timage, err := board.Render(chessimage.Options{AssetPath: \"./assets/\", Inverted: inverted})\n\tif err != nil {\n\t\tlog.Println(err)\n\t}\n\tw.Header().Add(\"Cache-Control\", \"max-age=7776000\")\n\tpng.Encode(w, image)\n}", "title": "" }, { "docid": "b2c5b1da1fd7600d4aa0d34371932548", "score": "0.51254624", "text": "func (t *templateHandler) ServeHTTP(w http.ResponseWriter, r *http.Request) {\n\tcalls = calls + 1\n\n\tt.once.Do(func() {\n\t\tt.templ = template.Must(template.ParseFiles(filepath.Join(\"templates\", t.filename)))\n\t})\n\n\tdata := Data{\n\t\tCalls: calls,\n\t}\n\n\tt.templ.Execute(w, &data)\n}", "title": "" }, { "docid": "93427aae129cb6367df01db072010ae3", "score": "0.5123122", "text": "func (s *Server) ServeHTTP(w http.ResponseWriter, r *http.Request) {\n\treq, err := decodeRequest(r.Body)\n\tif err != nil {\n\t\tw.WriteHeader(http.StatusBadRequest)\n\t\tw.Write([]byte(\"error: \" + err.Error()))\n\t\treturn\n\t}\n\ts.handleRequest(req)\n}", "title": "" }, { "docid": "844f47d8e4c5403d74154e1cad0576da", "score": "0.51221573", "text": "func (r *Route) Post(h Handler) *Route {\n\treturn r.Handle(h, \"POST\")\n}", "title": "" }, { "docid": "1f4b5430f19655570e0fa13d9ba73ed0", "score": "0.5113444", "text": "func (wb webHandler) ServeHTTP(w http.ResponseWriter, r *http.Request) {\n\n\tp := r.URL.Path\n\n\tswitch p {\n\tcase \"\":\n\t\tfallthrough\n\tcase \"/\":\n\t\tp = wb.home\n\tdefault:\n\t\t// Remove whitespace at the end of URL.\n\t\tp = strings.Trim(p, \" \")\n\n\t\t// Remove preceding \"/\" if any.\n\t\tp = strings.TrimLeft(p, \"/\")\n\t}\n\n\tif page, exists := wb.stories[p]; exists {\n\t\tif err := wb.tpl.Execute(w, page); err != nil {\n\t\t\tfmt.Printf(\"error %v\", err)\n\t\t}\n\t}\n}", "title": "" } ]
e7abf0ae7b0457cde8a9c1e2db9c7aaa
CreateStringMatcher returns a matcher for string. input must be either a plain string or a function.
[ { "docid": "2a3e8b6bbf3ff7785c3bc10a0057be29", "score": "0.7522646", "text": "func CreateStringMatcher(input string) (types.GomegaMatcher, error) {\n\tif patternEmpty.MatchString(input) {\n\t\treturn &matchers.BeEmptyMatcher{}, nil\n\t}\n\tif patternNotEmpty.MatchString(input) {\n\t\treturn &matchers.NotMatcher{\n\t\t\tMatcher: &matchers.BeEmptyMatcher{},\n\t\t}, nil\n\t}\n\tif patternTimestamp.MatchString(input) {\n\t\tm := patternTimestamp.FindStringSubmatch(input)\n\t\tsub := mapSubexpNames(m, patternTimestamp.SubexpNames())\n\t\ttsStr := sub[\"time\"]\n\t\tdeltaStr := sub[\"delta\"]\n\t\tts, err := ParseTime(tsStr)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tdelta, err := strconv.ParseInt(deltaStr, 10, 64)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn NewTimestampMatcher(ts, time.Duration(delta)*time.Millisecond), nil\n\t}\n\treturn &matchers.EqualMatcher{\n\t\tExpected: input,\n\t}, nil\n}", "title": "" } ]
[ { "docid": "b67b9c545cb681b4f657188aadbf20ee", "score": "0.58939743", "text": "func NewMatcher(matcher string) Matcher {\n\tswitch matcher {\n\tcase Text:\n\t\treturn TextMatcher{}\n\tcase Contains:\n\t\treturn ContainsMatcher{}\n\tcase Equal:\n\t\treturn EqualMatcher{}\n\tcase NotContains:\n\t\treturn NotContainsMatcher{}\n\tcase JSON:\n\t\treturn JSONMatcher{}\n\tcase XML:\n\t\treturn XMLMatcher{}\n\tcase File:\n\t\treturn FileMatcher{}\n\tdefault:\n\t\tpanic(fmt.Sprintf(\"Validator '%s' does not exist!\", matcher))\n\t}\n}", "title": "" }, { "docid": "af9136548bd0612fd04aad9ab34fa911", "score": "0.5882335", "text": "func String() Matcher {\n\treturn MatchFunc(func(v interface{}) error {\n\t\tif _, ok := v.(string); ok {\n\t\t\treturn nil\n\t\t}\n\t\treturn ErrNotString\n\t})\n}", "title": "" }, { "docid": "66a4c63021d1b47c8d1369e743e31124", "score": "0.5836471", "text": "func MatchString(pattern, s string) (matched bool, err error) {\n\treturn Match(pattern, []byte(s))\n}", "title": "" }, { "docid": "6d7b5900b5740fa2410a730c81ff2c0e", "score": "0.577907", "text": "func StringMatcherForTesting(exact, prefix, suffix, contains *string, regex *regexp.Regexp, ignoreCase bool) StringMatcher {\n\tsm := StringMatcher{\n\t\texactMatch: exact,\n\t\tprefixMatch: prefix,\n\t\tsuffixMatch: suffix,\n\t\tregexMatch: regex,\n\t\tcontainsMatch: contains,\n\t\tignoreCase: ignoreCase,\n\t}\n\tif ignoreCase {\n\t\tswitch {\n\t\tcase sm.exactMatch != nil:\n\t\t\t*sm.exactMatch = strings.ToLower(*exact)\n\t\tcase sm.prefixMatch != nil:\n\t\t\t*sm.prefixMatch = strings.ToLower(*prefix)\n\t\tcase sm.suffixMatch != nil:\n\t\t\t*sm.suffixMatch = strings.ToLower(*suffix)\n\t\tcase sm.containsMatch != nil:\n\t\t\t*sm.containsMatch = strings.ToLower(*contains)\n\t\t}\n\t}\n\treturn sm\n}", "title": "" }, { "docid": "9e0fe28a0cbeb51d9cae2f8b6afc2014", "score": "0.5737702", "text": "func New(name string, fn func(amq.Message, *amq.Binding) bool) amq.Matcher {\n\treturn &matcherImpl{\n\t\tname: name,\n\t\tfn: &fn,\n\t}\n}", "title": "" }, { "docid": "29aa884b7cbd75f57c8e9820f04d130e", "score": "0.57099617", "text": "func MetadataStringMatcher(filter, key string, m *matcherpb.StringMatcher) *matcherpb.MetadataMatcher {\n\treturn &matcherpb.MetadataMatcher{\n\t\tFilter: filter,\n\t\tPath: []*matcherpb.MetadataMatcher_PathSegment{\n\t\t\t{\n\t\t\t\tSegment: &matcherpb.MetadataMatcher_PathSegment_Key{\n\t\t\t\t\tKey: key,\n\t\t\t\t},\n\t\t\t},\n\t\t},\n\t\tValue: &matcherpb.ValueMatcher{\n\t\t\tMatchPattern: &matcherpb.ValueMatcher_StringMatch{\n\t\t\t\tStringMatch: m,\n\t\t\t},\n\t\t},\n\t}\n}", "title": "" }, { "docid": "e452903aa4fe09e72d12e39e80ed4b4e", "score": "0.5652916", "text": "func NewStringConverter(input string) StringConverter {\n\treturn StringConverter{\n\t\tinputString: input,\n\t\tvalidationRegExp: validationRegExp,\n\t\tgroupRegExp: groupRegExp,\n\t}\n}", "title": "" }, { "docid": "7108166d8e9b6b3f85d6fb979a2a6a80", "score": "0.56260633", "text": "func TestNewNameMatcher(t *testing.T) {\r\n\tt.Run(\"Create matcher without arguments\", func(t *testing.T) {\r\n\t\tmatcher := NewNameMatcher()\r\n\t\trequire.NotNil(t, matcher)\r\n\t\trequire.Equal(t, 0, len(matcher.names))\r\n\t})\r\n\tt.Run(\"Create matcher for one event\", func(t *testing.T) {\r\n\t\tmatcher := NewNameMatcher(\"event1\")\r\n\t\trequire.NotNil(t, matcher)\r\n\t\trequire.Equal(t, 1, len(matcher.names))\r\n\t\trequire.EqualValues(t, []string{\"EVENT1\"}, matcher.names)\r\n\t})\r\n\tt.Run(\"Create matcher for two events\", func(t *testing.T) {\r\n\t\tmatcher := NewNameMatcher(\"Event1\", \"Event2\")\r\n\t\trequire.NotNil(t, matcher)\r\n\t\trequire.Equal(t, 2, len(matcher.names))\r\n\t\trequire.EqualValues(t, []string{\"EVENT1\", \"EVENT2\"}, matcher.names)\r\n\t})\r\n}", "title": "" }, { "docid": "c4c919197cbcdfb8bb45cd9fb6760ea6", "score": "0.5578858", "text": "func NewStringFunc(uniq string, values ...interface{}) (String, error) {\n\tf, err := newFunc(uniq, values...)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn f.(String), nil\n}", "title": "" }, { "docid": "3d4bb0e32089b5cc96f5ff36cd78152f", "score": "0.555343", "text": "func NewString(str string) String {\n\treturn String{ExprTypeString, str}\n}", "title": "" }, { "docid": "809bed4d88b58d7d2cf5f7d8d9d32d53", "score": "0.55222017", "text": "func NewSubstringMatcher(substring string) *SubstringMatcher {\n\treturn &SubstringMatcher{\n\t\tsubstring: substring,\n\t}\n}", "title": "" }, { "docid": "fec0c93bfc221b7d794724058247b1c0", "score": "0.54220045", "text": "func matchFunc(a, b string) bool {\n\tmatched, _ := regexp.MatchString(b, a)\n\treturn matched\n}", "title": "" }, { "docid": "88b559ee1f37f0e8dfbf229675888b75", "score": "0.5420798", "text": "func New(str string, bufferlen int) *MatchingWriter {\n\tmatches := make(chan string, bufferlen)\n\treturn &MatchingWriter{str, matches}\n}", "title": "" }, { "docid": "b9046e1f6bc6079afba0e0f700c4b5f2", "score": "0.5404023", "text": "func StringMatch(c Condition) Condition {\n\treturn buildBasicCondition(\n\t\t\"$regex\",\n\t\tCondition{\n\t\t\tKey: c.Key,\n\t\t\tValue: primitive.Regex{\n\t\t\t\tPattern: \"^\" + c.Value.(string) + \"$\",\n\t\t\t\tOptions: \"i\",\n\t\t\t},\n\t\t})\n}", "title": "" }, { "docid": "7698332b016b8e4271580b0ea510c144", "score": "0.5359024", "text": "func create(str string, approx NumberOfMatches) MatchableString {\n\tswitch approx {\n\tcase LessThan1000:\n\t\treturn createBoyer(str)\n\tcase MoreThan1000:\n\t\treturn createSuffixArray(str)\n\tdefault:\n\t\treturn nil\n\t}\n}", "title": "" }, { "docid": "459561289903d808d28b1755f70b6533", "score": "0.53228885", "text": "func (expr *NameExpr) MatchString(s string) bool {\n\tif expr.literal == s { // if matches as string, as it's.\n\t\treturn true\n\t}\n\n\tif expr.regex != nil {\n\t\treturn expr.regex.MatchString(s)\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "569c3e5304a7819583483bee63c47a36", "score": "0.529203", "text": "func NewStringLikeFunc(key Key, values ...string) (Function, error) {\n\tsset := set.CreateStringSet(values...)\n\tif err := validateStringLikeValues(stringLike, key, sset); err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn &stringLikeFunc{key, sset}, nil\n}", "title": "" }, { "docid": "ea710f10e154899301a1798e485245fd", "score": "0.52541703", "text": "func createBoyer(str string) MatchableString {\n\tvar boyer MatchableStringB\n\tboyer.SetString(str)\n\n\treturn &boyer\n}", "title": "" }, { "docid": "225a2ecb1f04dc01d764ae13ef608d34", "score": "0.52181023", "text": "func NewFromString(str string) *Scanner {\n\treturn &Scanner{\n\t\tr: bufio.NewReader(strings.NewReader(str)),\n\t}\n}", "title": "" }, { "docid": "7cea2037bc395483cb5eb7a5aebca193", "score": "0.51805604", "text": "func NewString(s string) *string {\n\treturn &s\n}", "title": "" }, { "docid": "a834f98d5e2fb030276e8355d376b5aa", "score": "0.51783097", "text": "func FuncString(f expvar.Func,) string", "title": "" }, { "docid": "5ee5685490b8920c40678fe8e9bc1ca0", "score": "0.5159941", "text": "func TestDefaulterString(t *testing.T) {\n\tassert := asserts.NewTesting(t, asserts.FailStop)\n\n\td := stringex.NewDefaulter(\"my-id\", true)\n\ts := d.String()\n\n\tassert.Equal(s, \"Defaulter{my-id}\")\n}", "title": "" }, { "docid": "9ded2e0254bc9797ea286dd337c03452", "score": "0.51599205", "text": "func NewStringRule(validator stringValidator, code int) *StringRule {\n\treturn &StringRule{\n\t\tvalidate: validator,\n\t\tcode: code,\n\t}\n}", "title": "" }, { "docid": "c1fd9a183f4daefc259af3948fd900f0", "score": "0.5145746", "text": "func NewStringFormatter(p *string) *StringFormatter {\n\treturn &StringFormatter{p}\n}", "title": "" }, { "docid": "a14992d83d2b3a6134339351bcda8969", "score": "0.5137719", "text": "func StringMatcherFromProto(matcherProto *v3matcherpb.StringMatcher) (StringMatcher, error) {\n\tif matcherProto == nil {\n\t\treturn StringMatcher{}, errors.New(\"input StringMatcher proto is nil\")\n\t}\n\n\tmatcher := StringMatcher{ignoreCase: matcherProto.GetIgnoreCase()}\n\tswitch mt := matcherProto.GetMatchPattern().(type) {\n\tcase *v3matcherpb.StringMatcher_Exact:\n\t\tmatcher.exactMatch = &mt.Exact\n\t\tif matcher.ignoreCase {\n\t\t\t*matcher.exactMatch = strings.ToLower(*matcher.exactMatch)\n\t\t}\n\tcase *v3matcherpb.StringMatcher_Prefix:\n\t\tif matcherProto.GetPrefix() == \"\" {\n\t\t\treturn StringMatcher{}, errors.New(\"empty prefix is not allowed in StringMatcher\")\n\t\t}\n\t\tmatcher.prefixMatch = &mt.Prefix\n\t\tif matcher.ignoreCase {\n\t\t\t*matcher.prefixMatch = strings.ToLower(*matcher.prefixMatch)\n\t\t}\n\tcase *v3matcherpb.StringMatcher_Suffix:\n\t\tif matcherProto.GetSuffix() == \"\" {\n\t\t\treturn StringMatcher{}, errors.New(\"empty suffix is not allowed in StringMatcher\")\n\t\t}\n\t\tmatcher.suffixMatch = &mt.Suffix\n\t\tif matcher.ignoreCase {\n\t\t\t*matcher.suffixMatch = strings.ToLower(*matcher.suffixMatch)\n\t\t}\n\tcase *v3matcherpb.StringMatcher_SafeRegex:\n\t\tregex := matcherProto.GetSafeRegex().GetRegex()\n\t\tre, err := regexp.Compile(regex)\n\t\tif err != nil {\n\t\t\treturn StringMatcher{}, fmt.Errorf(\"safe_regex matcher %q is invalid\", regex)\n\t\t}\n\t\tmatcher.regexMatch = re\n\tcase *v3matcherpb.StringMatcher_Contains:\n\t\tif matcherProto.GetContains() == \"\" {\n\t\t\treturn StringMatcher{}, errors.New(\"empty contains is not allowed in StringMatcher\")\n\t\t}\n\t\tmatcher.containsMatch = &mt.Contains\n\t\tif matcher.ignoreCase {\n\t\t\t*matcher.containsMatch = strings.ToLower(*matcher.containsMatch)\n\t\t}\n\tdefault:\n\t\treturn StringMatcher{}, fmt.Errorf(\"unrecognized string matcher: %+v\", matcherProto)\n\t}\n\treturn matcher, nil\n}", "title": "" }, { "docid": "ff58f4dc99baada7b253352170cfaf89", "score": "0.51264244", "text": "func NewString(name string) *expvar.String", "title": "" }, { "docid": "dd1829dc99e4f84c63535d48497c823f", "score": "0.51161546", "text": "func NewMatcher(names ...string) ltl.Operator {\n\treturn signalMatcher(newSignal(names...))\n}", "title": "" }, { "docid": "8cb79b5ad301d0efa827679f7277ccef", "score": "0.50889516", "text": "func NewMatcher(patterns []Pattern) Matcher {\n\treturn &matcher{patterns}\n}", "title": "" }, { "docid": "222b047a8ed75d8a7a24fb117543619e", "score": "0.5058417", "text": "func StringTest(){\n\n}", "title": "" }, { "docid": "8c57cc3e581fe7b2b2fdadb1d6eaa376", "score": "0.5053603", "text": "func (m *Matcher) AcceptString(exact string) *Matcher {\n\tp := &prefixMatcher{exact}\n\tm.add(p)\n\treturn m\n}", "title": "" }, { "docid": "be995ac5e150cc2407bd01e40f10e134", "score": "0.5050018", "text": "func NewNameMatcher(types ...AtomType) NamedCheckerFunc {\n\tts := NewTypeSet(types...)\n\treturn ts.MatchNamed\n}", "title": "" }, { "docid": "3527d053febcdc3a7f15b2efe3ead2c7", "score": "0.50204957", "text": "func FromString(input string) *string {\n\treturn &input\n}", "title": "" }, { "docid": "48ee163dada6edae39708e1a7ad41f93", "score": "0.501538", "text": "func WalkString(s string, fn WalkFunc) (err error) {\n\treturn Walk([]byte(s), fn)\n}", "title": "" }, { "docid": "426f7f3fbeed7fbbacd52cfa933779b4", "score": "0.5009587", "text": "func regexpString(a sexp) (*regexp.Regexp, error) {\n\ts, ok := a.i.(qString)\n\tif !ok {\n\t\treturn nil, ErrNeedString\n\t}\n\tre, err := regexp.Compile(string(s))\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"compiling regexp: %w: %v\", ErrBadRegexp, err)\n\t}\n\treturn re, nil\n}", "title": "" }, { "docid": "fd1aa80e4d6badaaed68b8c1763ee832", "score": "0.49964604", "text": "func (p tyString) NewInstance(args ...interface{}) interface{} {\n\n\tret := new(string)\n\tif len(args) > 0 {\n\t\t*ret = String(args[0])\n\t}\n\treturn ret\n}", "title": "" }, { "docid": "b27efca5814f159b99ef07ce0254acc8", "score": "0.4986109", "text": "func FuncString(obj *types.Func,) string", "title": "" }, { "docid": "91e9b9fd2baa608f4469dca9c5c23128", "score": "0.49808463", "text": "func NewMatcher() *Matcher {\n\treturn &Matcher{}\n}", "title": "" }, { "docid": "97a27b97b5dc7d1f89024f130bbd7272", "score": "0.4972427", "text": "func (sm StringMatcher) Match(input string) bool {\n\tif sm.ignoreCase {\n\t\tinput = strings.ToLower(input)\n\t}\n\tswitch {\n\tcase sm.exactMatch != nil:\n\t\treturn input == *sm.exactMatch\n\tcase sm.prefixMatch != nil:\n\t\treturn strings.HasPrefix(input, *sm.prefixMatch)\n\tcase sm.suffixMatch != nil:\n\t\treturn strings.HasSuffix(input, *sm.suffixMatch)\n\tcase sm.regexMatch != nil:\n\t\treturn grpcutil.FullMatchWithRegex(sm.regexMatch, input)\n\tcase sm.containsMatch != nil:\n\t\treturn strings.Contains(input, *sm.containsMatch)\n\t}\n\treturn false\n}", "title": "" }, { "docid": "4be065d6dc062286d7fba4035afe5510", "score": "0.49714476", "text": "func NewStringTest(init ...*StringTest) *StringTest {\n\tvar o *StringTest\n\tif len(init) == 1 {\n\t\to = init[0]\n\t} else {\n\t\to = new(StringTest)\n\t}\n\treturn o\n}", "title": "" }, { "docid": "24650f01f91e784ffe0264bb13ee1e41", "score": "0.49461365", "text": "func NewMatcher(url *url.URL) *Matcher {\n\treturn &Matcher{\n\t\turl: url,\n\t}\n}", "title": "" }, { "docid": "8470a9414d11bbb234349cfaaabf332a", "score": "0.4944454", "text": "func NewTextMatcher(text string, run Runner) Matcher {\n\treturn textMatcher{\n\t\tloweredText: strings.ToLower(text),\n\t\trun: run,\n\t}\n}", "title": "" }, { "docid": "a09505d7f7d9d0255ebbe090e77fdeca", "score": "0.49408233", "text": "func New(str string) Type {\n\ttyp, _, err := Eval(str, nil, nil)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn typ\n}", "title": "" }, { "docid": "1ac5b178286efacb6ce562c344e2494d", "score": "0.4939084", "text": "func runStringTests(t *testing.T, f func(string) []byte, funcName string, testCases []StringTest) {\n\tfor _, tc := range testCases {\n\t\tactual := string(f(tc.in))\n\t\tif actual != tc.out {\n\t\t\tt.Errorf(\"%s(%q) = %q; want %q\", funcName, tc.in, actual, tc.out)\n\t\t}\n\t}\n}", "title": "" }, { "docid": "3cecf9b6dd596d21749f1a467ad4f9b5", "score": "0.49299982", "text": "func NewMatcher() *Matcher {\n\treturn &Matcher{\n\t\t&unionMatcher{\n\t\t\t[]textMatcher{},\n\t\t},\n\t}\n}", "title": "" }, { "docid": "ecc74834383dcef383051baa3db6b480", "score": "0.49268517", "text": "func NewMyString(s string) MyString {\n\treturn MyString{str: s}\n}", "title": "" }, { "docid": "44da8e487b7e73a19768c9061db76e4f", "score": "0.49233305", "text": "func PatternMatchString(pspec *C.GPatternSpec, string_ string) (return__ bool) {\n\t__cgo__string_ := (*C.gchar)(unsafe.Pointer(C.CString(string_)))\n\tvar __cgo__return__ C.gboolean\n\t__cgo__return__ = C.g_pattern_match_string(pspec, __cgo__string_)\n\tC.free(unsafe.Pointer(__cgo__string_))\n\treturn__ = __cgo__return__ == C.gboolean(1)\n\treturn\n}", "title": "" }, { "docid": "c8918908cd4df7d7fa36fc474d2ce2bd", "score": "0.49220547", "text": "func WrapString(val string) Any {\n\treturn &stringAny{baseAny{}, val}\n}", "title": "" }, { "docid": "c1c47af46e8a9e0da73fed8d46c390b0", "score": "0.49144563", "text": "func NewString(v string) *string {\n\treturn &v\n}", "title": "" }, { "docid": "6469445cdc2dfb90e05adcfb227763af", "score": "0.4900694", "text": "func NewString(str string) *String {\n\ts := &String{}\n\tif str != \"\" {\n\t\ts.Store(str)\n\t}\n\treturn s\n}", "title": "" }, { "docid": "c5013398777124ee6042bba8094b9932", "score": "0.48964995", "text": "func NewString(s string) String {\n\treturn String{\n\t\tstr: s,\n\t}\n}", "title": "" }, { "docid": "cd116516646b9c580b4b576fd6733ee7", "score": "0.48905364", "text": "func NewMatcher() *Matcher {\n\treturn &Matcher{\n\t\tPermissions: []string{},\n\t\tContext: map[string]string{},\n\t}\n}", "title": "" }, { "docid": "340e153934d960d1e99f69b912ede414", "score": "0.4886076", "text": "func IsStringMatches(s string, params ...string) bool {\n\tif len(params) == 1 {\n\t\tpattern := params[0]\n\t\treturn IsMatches(s, pattern)\n\t}\n\treturn false\n}", "title": "" }, { "docid": "53969215e6a4818079bdd73d8fb20d01", "score": "0.4876518", "text": "func TestRegexMatch() {\n\n}", "title": "" }, { "docid": "48e81360e0c26f9f150b66fd79424320", "score": "0.486559", "text": "func FromString(name string, tplstr *string, locator templateLocator) (*Template, error) {\n\ttpl, err := newTemplate(name, tplstr, locator)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\terr = tpl.parse()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn tpl, nil\n}", "title": "" }, { "docid": "00a16215a678fae3001836135f9d19ce", "score": "0.48572454", "text": "func FromString(s string) Source {\n\treturn stringSource(s)\n}", "title": "" }, { "docid": "3528a4d8d61ea8d42361bab5c154b295", "score": "0.48427448", "text": "func NewStringlike(val string, st bool) rnt.Object {\n\tif !st {\n\t\treturn rnt.NewBytes([]byte(val)...)\n\t}\n\treturn rnt.NewStr(val)\n}", "title": "" }, { "docid": "5b7657d1c5f873aa6029632cbcff37b7", "score": "0.48277777", "text": "func NewMatcher(t testing.TB) *Matcher {\n\tmock := &Matcher{}\n\n\tt.Cleanup(func() { mock.AssertExpectations(t) })\n\n\treturn mock\n}", "title": "" }, { "docid": "7b4eae79f11dcbe842547386bf0e5336", "score": "0.482603", "text": "func ChaincodeInvokeByString(chaincodeID, argsStr string) string {\n\tlog.Infof(\"chaincode invoke: %s; %s; %s\", chaincodeID, argsStr)\n\targ, err := ParseArgs(argsStr)\n\tif strings.EqualFold(arg.Func, \"create\") {\n\t\tRegisterWalletByString(arg.Args[0], arg.Args[1], arg.Args[2])\n\t}\n\tif err == nil {\n\t\tvar argsArray []Args\n\t\targsArray = append(argsArray, *arg)\n\t\tvar ret string\n\t\tret, err = ChaincodeInvoke(chaincodeID, argsArray)\n\t\tif err == nil {\n\t\t\tlog.Info(\"chaincode invoke result: \", ret)\n\t\t\treturn ret\n\t\t}\n\t}\n\tlog.Errorf(\"%s %v\", defaultResultJSON, err)\n\treturn defaultResultJSON\n}", "title": "" }, { "docid": "89c2dda761c1d9439880b76a067416e0", "score": "0.48206583", "text": "func NewString(name string) *String {\n\tlock.Lock()\n\tdefer lock.Unlock()\n\n\tnode := findNodeLocked(name, true)\n\ts := String{value: \"\"}\n\tnode.object = &s\n\treturn &s\n}", "title": "" }, { "docid": "1a53c54d7febb5251b339b64743a9f09", "score": "0.48060876", "text": "func TestExprString(t *testing.T) {\n\tdefer leaktest.AfterTest(t)()\n\tdefer log.Scope(t).Close(t)\n\tdefer ast.MockNameTypes(map[string]*types.T{\n\t\t\"a\": types.Bool,\n\t\t\"b\": types.Bool,\n\t\t\"c\": types.Bool,\n\t\t\"d\": types.Bool,\n\t\t\"e\": types.Bool,\n\t\t\"f\": types.Int,\n\t\t\"g\": types.Int,\n\t\t\"h\": types.Int,\n\t\t\"i\": types.Int,\n\t\t\"j\": types.Int,\n\t\t\"k\": types.Int,\n\t})()\n\ttestExprs := []string{\n\t\t`a AND b`,\n\t\t`a AND b OR c`,\n\t\t`(a AND b) OR c`,\n\t\t`a AND (b OR c)`,\n\t\t`a AND NOT ((b OR c) AND (d AND e))`,\n\t\t`~-f`,\n\t\t`-2*(f+3)*g`,\n\t\t`f&g<<(g+h)&i > 0 AND (g&i)+h>>(i&f) > 0`,\n\t\t`f&(g<<g+h)&i > 0 AND g&(i+h>>i)&f > 0`,\n\t\t`f = g|h`,\n\t\t`f != g|h`,\n\t\t`NOT a AND b`,\n\t\t`NOT (a AND b)`,\n\t\t`(NOT a) AND b`,\n\t\t`NOT (a = NOT b = c)`,\n\t\t`NOT NOT a = b`,\n\t\t`NOT NOT (a = b)`,\n\t\t`NOT (NOT a) < b`,\n\t\t`NOT (NOT a = b)`,\n\t\t`(NOT NOT a) >= b`,\n\t\t`(a OR (g BETWEEN (h+i) AND (j+k))) AND b`,\n\t\t`(1 >= 2) IS OF (BOOL)`,\n\t\t`(1 >= 2) = (2 IS OF (BOOL))`,\n\t\t`count(1) FILTER (WHERE true)`,\n\t}\n\tctx := context.Background()\n\tfor _, exprStr := range testExprs {\n\t\texpr, err := parser.ParseExpr(exprStr)\n\t\tif err != nil {\n\t\t\tt.Fatalf(\"%s: %v\", exprStr, err)\n\t\t}\n\t\ttypedExpr, err := ast.TypeCheck(ctx, expr, nil, types.Any)\n\t\tif err != nil {\n\t\t\tt.Fatalf(\"%s: %v\", expr, err)\n\t\t}\n\t\t// str may differ than exprStr (we may be adding some parens).\n\t\tstr := typedExpr.String()\n\t\texpr2, err := parser.ParseExpr(str)\n\t\tif err != nil {\n\t\t\tt.Fatalf(\"%s: %v\", exprStr, err)\n\t\t}\n\t\ttypedExpr2, err := ast.TypeCheck(ctx, expr2, nil, types.Any)\n\t\tif err != nil {\n\t\t\tt.Fatalf(\"%s: %v\", expr2, err)\n\t\t}\n\t\t// Verify that when we stringify the expression again, the string is the\n\t\t// same. This is important because we don't want cycles of parsing and\n\t\t// printing an expression to keep adding parens.\n\t\tif str2 := typedExpr2.String(); str != str2 {\n\t\t\tt.Errorf(\"Print/parse/print cycle changes the string: `%s` vs `%s`\", str, str2)\n\t\t}\n\t\t// Compare the normalized expressions.\n\t\tctx := ast.NewTestingEvalContext(cluster.MakeTestingClusterSettings())\n\t\tdefer ctx.Mon.Stop(context.Background())\n\t\tnormalized, err := ctx.NormalizeExpr(typedExpr)\n\t\tif err != nil {\n\t\t\tt.Fatalf(\"%s: %v\", exprStr, err)\n\t\t}\n\t\tnormalized2, err := ctx.NormalizeExpr(typedExpr2)\n\t\tif err != nil {\n\t\t\tt.Fatalf(\"%s: %v\", exprStr, err)\n\t\t}\n\t\tif !reflect.DeepEqual(ast.StripMemoizedFuncs(normalized), ast.StripMemoizedFuncs(normalized2)) {\n\t\t\tt.Errorf(\"normalized expressions differ\\n\"+\n\t\t\t\t\"original: %s\\n\"+\n\t\t\t\t\"intermediate: %s\\n\"+\n\t\t\t\t\"before: %#v\\n\"+\n\t\t\t\t\"after: %#v\", exprStr, str, normalized, normalized2)\n\t\t}\n\t}\n}", "title": "" }, { "docid": "c495588ee90cefd23a3c12a2a0b5a17e", "score": "0.48035514", "text": "func NewMatcher(types ...AtomType) AtomCheckerFunc {\n\tts := NewTypeSet(types...)\n\treturn ts.Match\n}", "title": "" }, { "docid": "dd82861dd778ff45ab6a5cfea7cfea09", "score": "0.47910267", "text": "func NewStringLit(value string) *goast.BasicLit {\n\treturn &goast.BasicLit{\n\t\tKind: token.STRING,\n\t\tValue: value,\n\t}\n}", "title": "" }, { "docid": "bf3ef11dcd93cc62e83cab8abd6f082a", "score": "0.47902715", "text": "func NewMyString(val string) (stringer Stringer, err error) {\n\tif val == \"\" {\n\t\terr = errors.New(\"Empty string value.\")\n\t\treturn\n\t}\n\treturn MyString(val), nil\n}", "title": "" }, { "docid": "9544dfc50309dab26ce63d659118057e", "score": "0.47874585", "text": "func NewString() *String {\n\treturn &String{}\n}", "title": "" }, { "docid": "62466bbb50cafd9d8c3a0a487528246a", "score": "0.47775465", "text": "func FuncStringContains(substr string, s string) bool {\n\treturn strings.Contains(s, substr)\n}", "title": "" }, { "docid": "79080e0db89f9801c4767664f4c29099", "score": "0.47563732", "text": "func (a AnyString) Match(v driver.Value) bool {\n\t_, ok := v.(string)\n\treturn ok\n}", "title": "" }, { "docid": "5f94601de6faa9a8b1d80394092785e9", "score": "0.47458166", "text": "func NewNamedString(in *yaml.Node, context *compiler.Context) (*NamedString, error) {\n\terrors := make([]error, 0)\n\tx := &NamedString{}\n\tm, ok := compiler.UnpackMap(in)\n\tif !ok {\n\t\tmessage := fmt.Sprintf(\"has unexpected value: %+v (%T)\", in, in)\n\t\terrors = append(errors, compiler.NewError(context, message))\n\t} else {\n\t\tallowedKeys := []string{\"name\", \"value\"}\n\t\tvar allowedPatterns []*regexp.Regexp\n\t\tinvalidKeys := compiler.InvalidKeysInMap(m, allowedKeys, allowedPatterns)\n\t\tif len(invalidKeys) > 0 {\n\t\t\tmessage := fmt.Sprintf(\"has invalid %s: %+v\", compiler.PluralProperties(len(invalidKeys)), strings.Join(invalidKeys, \", \"))\n\t\t\terrors = append(errors, compiler.NewError(context, message))\n\t\t}\n\t\t// string name = 1;\n\t\tv1 := compiler.MapValueForKey(m, \"name\")\n\t\tif v1 != nil {\n\t\t\tx.Name, ok = compiler.StringForScalarNode(v1)\n\t\t\tif !ok {\n\t\t\t\tmessage := fmt.Sprintf(\"has unexpected value for name: %s\", compiler.Display(v1))\n\t\t\t\terrors = append(errors, compiler.NewError(context, message))\n\t\t\t}\n\t\t}\n\t\t// string value = 2;\n\t\tv2 := compiler.MapValueForKey(m, \"value\")\n\t\tif v2 != nil {\n\t\t\tx.Value, ok = compiler.StringForScalarNode(v2)\n\t\t\tif !ok {\n\t\t\t\tmessage := fmt.Sprintf(\"has unexpected value for value: %s\", compiler.Display(v2))\n\t\t\t\terrors = append(errors, compiler.NewError(context, message))\n\t\t\t}\n\t\t}\n\t}\n\treturn x, compiler.NewErrorGroupOrNil(errors)\n}", "title": "" }, { "docid": "0a3c0b52d5a31a63f7ed40a8738cf935", "score": "0.47450864", "text": "func New() string {\n\treturn NewString()\n}", "title": "" }, { "docid": "de2035cb9ee17d442ad8234bc2bc1d46", "score": "0.47421765", "text": "func (r *CreateMatchRequest) FromJsonString(s string) error {\n\tf := make(map[string]interface{})\n\tif err := json.Unmarshal([]byte(s), &f); err != nil {\n\t\treturn err\n\t}\n\tdelete(f, \"MatchName\")\n\tdelete(f, \"RuleCode\")\n\tdelete(f, \"Timeout\")\n\tdelete(f, \"ServerType\")\n\tdelete(f, \"MatchDesc\")\n\tdelete(f, \"NotifyUrl\")\n\tdelete(f, \"ServerRegion\")\n\tdelete(f, \"ServerQueue\")\n\tdelete(f, \"CustomPushData\")\n\tdelete(f, \"ServerSessionData\")\n\tdelete(f, \"GameProperties\")\n\tdelete(f, \"LogSwitch\")\n\tdelete(f, \"Tags\")\n\tif len(f) > 0 {\n\t\treturn tcerr.NewTencentCloudSDKError(\"ClientError.BuildRequestError\", \"CreateMatchRequest has unknown keys!\", \"\")\n\t}\n\treturn json.Unmarshal([]byte(s), &r)\n}", "title": "" }, { "docid": "3710cdd4f0ecd29f85591840b1708b7e", "score": "0.47368923", "text": "func NewString(s string) (*Uncurl, error) {\n\treturn New([]byte(s))\n}", "title": "" }, { "docid": "e3a90422af76bdb72855f71a6a114ac2", "score": "0.47281206", "text": "func (re *Regexp) MatchString(s string) (bool, error) {\n\tm, err := re.run(true, -1, getRunes(s))\n\tif err != nil {\n\t\treturn false, err\n\t}\n\treturn m != nil, nil\n}", "title": "" }, { "docid": "48e68978fff878b72f96830448895d19", "score": "0.471679", "text": "func Example_createString() {\n\tsource := CreateString(func(N NextString, E Error, C Complete, X Canceled) {\n\t\tif X() {\n\t\t\treturn\n\t\t}\n\t\tN(\"Hello\")\n\t\tN(\"World!\")\n\t\tC()\n\t})\n\n\terr := source.Println()\n\n\tif err == nil {\n\t\tfmt.Println(\"success\")\n\t}\n\n\t// Output:\n\t// Hello\n\t// World!\n\t// success\n}", "title": "" }, { "docid": "a43bd28bffcbe376e916905178449da5", "score": "0.47121423", "text": "func MakeString(value string) MaybeString {\n\treturn MaybeString{\n\t\tvalue: value,\n\t\tMaybe: Maybe{MaybeState: MaybeValue},\n\t}\n}", "title": "" }, { "docid": "872d1b73b15a508ec4f227c2760a67a5", "score": "0.47084686", "text": "func (m HandlerFuncMatcher) String() string {\n\treturn fmt.Sprintf(\"handler name equal to %s\", m.handlerName)\n}", "title": "" }, { "docid": "ab9a8d0109e1232b181aaf8c30b2bd2c", "score": "0.4708215", "text": "func FuzzMyStringAPI(f *fuzz.F) {\n\tstr := f.String(\"myString\").Get()\n\tMyStringAPI(str)\n}", "title": "" }, { "docid": "daa1e7e33efc1add5d5a2a06308144c3", "score": "0.47060114", "text": "func MakeString(str string) HWString {\n\treturn HWString{Val: str, Meta: \"string - 0\", Type: STR_TYPE}\n}", "title": "" }, { "docid": "174ac48164210ddcbe48ace11b810860", "score": "0.47033328", "text": "func NewRegexRule(str string) (RegexRule, error) {\n\n\t_, err := regexp.Compile(str)\n\tif err != nil {\n\t\treturn RegexRule{}, err\n\t}\n\n\treturn RegexRule{\n\t\tregexStr: str,\n\t}, nil\n}", "title": "" }, { "docid": "21017182d9a0d4441d718aa1d2fa1f80", "score": "0.4695365", "text": "func BeAString() DataTypeMatcher {\n\treturn DataTypeMatcher{\n\t\ttyp: unstructured.DataString,\n\t}\n}", "title": "" }, { "docid": "604af770d1d6a8de206ee085ad03be43", "score": "0.4689725", "text": "func NewShoutingString(s string) Shouting {\n\tload := Shouting{}\n\tload.str = strings.ToUpper(s)\n\treturn load\n}", "title": "" }, { "docid": "c273ee96b0d0fa516efb08cc580a32f8", "score": "0.46885067", "text": "func NewString() String {\n\treturn String{}\n}", "title": "" }, { "docid": "b105740af03e9939d8e9f5171e7f7777", "score": "0.46696663", "text": "func NewScanner(str string) *Scanner {\n\ts, _ := scannerPool.Get().(*Scanner)\n\tif s == nil {\n\t\ts = &Scanner{rd: strings.NewReader(str)}\n\t} else {\n\t\ts.rd.Reset(str)\n\t}\n\ts.ch = -2\n\ts.err = nil\n\treturn s\n}", "title": "" }, { "docid": "f4579732c2c2528d7eaf9c6ab860498f", "score": "0.4662001", "text": "func (*RequestMatcher) String() string {\n\treturn \"request matcher\"\n}", "title": "" }, { "docid": "84403cc4e2a3a5a05793d8abbdfca5f0", "score": "0.46556377", "text": "func NewStringNotLikeFunc(key Key, values ...string) (Function, error) {\n\tsset := set.CreateStringSet(values...)\n\tif err := validateStringLikeValues(stringNotLike, key, sset); err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn &stringNotLikeFunc{stringLikeFunc{key, sset}}, nil\n}", "title": "" }, { "docid": "28e5b5d893615371255e3b4f6e12dfb9", "score": "0.46523795", "text": "func NewMatcher(platform specs.Platform) Matcher {\n\treturn &matcher{\n\t\tPlatform: Normalize(platform),\n\t}\n}", "title": "" }, { "docid": "3dbe983f9af2388b1ab0d7fb4ad03244", "score": "0.46507928", "text": "func NewString(value *string, name string, options ...Option) *Flag {\n\tf := newFlag(name, options...)\n\n\tf.define = func(fs clip.FlagSet) {\n\t\tfs.DefineString(value, name, f.short, *value, f.summary)\n\t}\n\n\treturn &f\n}", "title": "" }, { "docid": "34eea1eada585fbe52a25ec5a58d1afc", "score": "0.46477383", "text": "func newStringLikeFunc(key Key, values ValueSet) (Function, error) {\n\tvalueStrings, err := valuesToStringSlice(stringLike, values)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn NewStringLikeFunc(key, valueStrings...)\n}", "title": "" }, { "docid": "7710d9323d3af65973cc1cd5715afc60", "score": "0.46375254", "text": "func New(specStr string) (Stitch, error) {\n\tvar sc scanner.Scanner\n\tsc.Init(strings.NewReader(specStr))\n\tparsed, err := parse(sc)\n\tif err != nil {\n\t\treturn Stitch{}, err\n\t}\n\n\treturn toStitch(parsed)\n}", "title": "" }, { "docid": "d4f316285e9377db622e70e79a4b2ae2", "score": "0.46355477", "text": "func MustCompile(str string) regexpinterface.Regexp {\n\treturn &Regexp{str: str}\n}", "title": "" }, { "docid": "82086fd21d63a89b0330b3978b63f411", "score": "0.4634477", "text": "func NewStringTypeParser(setter SetStringFunc) *StringTypeParser {\n\tparser := new(StringTypeParser)\n\tparser.setter = setter\n\treturn parser\n}", "title": "" }, { "docid": "12356d461ec99be93aab8139704e7d18", "score": "0.4628263", "text": "func newRegexpMatcher(logger logrus.FieldLogger) *regexpMatcher {\n\treturn &regexpMatcher{\n\t\tmtx: sync.RWMutex{},\n\t\tlogger: logger,\n\t}\n}", "title": "" }, { "docid": "4a247c81f2a2144007550a0243b53ffd", "score": "0.46239054", "text": "func FromString(s string) Literal {\n\treturn FromBytes([]byte(s))\n}", "title": "" }, { "docid": "b9c2bea8ba4f2bd9a340fa5b97197e74", "score": "0.46174285", "text": "func NewFuzzyMatcher(pattern string) *FuzzyMatcher {\n\treturn &FuzzyMatcher{pattern: pattern}\n}", "title": "" }, { "docid": "37509831a99607ababb1fc81edbc7123", "score": "0.46168342", "text": "func ThriftString(s string) *string {\n p := new(string)\n *p = s\n return p\n}", "title": "" }, { "docid": "ed74f089ed54b13568d856db2825c4c7", "score": "0.46022436", "text": "func (f CacheActorFactory) CreateStringCacheActor(clusterName string, nodeName string, usePersistence bool) *actor.PID {\n\ta := StringCacheActor{ClusterName: clusterName, NodeName: nodeName}\n\tstringCache := &cache.StringCache{Map: make(map[string]cache.StringCacheEntry)}\n\ta.Cache = stringCache\n\ta.CachePersister = stringCache\n\tif usePersistence {\n\t\ta.DB = repo.StringCacheRepository{Host: \"localhost\", DBName: a.ClusterName, ColName: a.NodeName}\n\t} else {\n\t\ta.DB = repo.EmptyStringCacheRepository{}\n\t}\n\ta.restoreSnapshot()\n\tprops := actor.FromInstance(&a)\n\tpid, _ := actor.SpawnNamed(props, nodeName)\n\treturn pid\n}", "title": "" }, { "docid": "dce32067e237b0cc1a91a2e07dd6b260", "score": "0.4600034", "text": "func (p *Patrun) FindString(pat string) interface{} {\n mapData := createMap(pat)\n\n return p.Find(mapData)\n}", "title": "" }, { "docid": "9bdec30fa1572e6550a79ab3228a3fa0", "score": "0.45892572", "text": "func FromString(str string) (*Formula, error) {\n\tsrc := strings.NewReader(str)\n\tast, err := parse(\"formula\", src)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn &Formula{\n\t\tast: ast,\n\t}, nil\n}", "title": "" }, { "docid": "4d59faa4025656c06120094619f5560c", "score": "0.45888123", "text": "func FromString(ctx context.Context, typ attr.Type, val string, path path.Path) (attr.Value, diag.Diagnostics) {\n\tvar diags diag.Diagnostics\n\terr := tftypes.ValidateValue(tftypes.String, val)\n\tif err != nil {\n\t\treturn nil, append(diags, validateValueErrorDiag(err, path))\n\t}\n\ttfStr := tftypes.NewValue(tftypes.String, val)\n\n\tif typeWithValidate, ok := typ.(xattr.TypeWithValidate); ok {\n\t\tdiags.Append(typeWithValidate.Validate(ctx, tfStr, path)...)\n\n\t\tif diags.HasError() {\n\t\t\treturn nil, diags\n\t\t}\n\t}\n\n\tstr, err := typ.ValueFromTerraform(ctx, tfStr)\n\tif err != nil {\n\t\treturn nil, append(diags, valueFromTerraformErrorDiag(err, path))\n\t}\n\n\treturn str, diags\n}", "title": "" }, { "docid": "674c05e62c6c12cfba74f6502b91def7", "score": "0.45870706", "text": "func TestAsString(t *testing.T) {\n\tassert := asserts.NewTesting(t, asserts.FailStop)\n\n\td := stringex.NewDefaulter(\"AsString\", true)\n\ttests := []struct {\n\t\tv valuer\n\t\tdv string\n\t\texpected string\n\t}{\n\t\t{valuer{\"foo\", false}, \"bar\", \"foo\"},\n\t\t{valuer{\"foo\", true}, \"bar\", \"bar\"},\n\t}\n\tfor i, test := range tests {\n\t\tassert.Logf(\"test %v %d: %v and default %v\", d, i, test.v, test.dv)\n\t\tsv := d.AsString(test.v, test.dv)\n\t\tassert.Equal(sv, test.expected)\n\t}\n}", "title": "" }, { "docid": "9e95d702f75db4cc7e76a4bc24cc595d", "score": "0.45849305", "text": "func MatchString(pattern string, str string) bool {\n\tif pattern == str {\n\t\treturn true\n\t}\n\tEOF := len(str)\n\tfinal := len(pattern)\n\tskip := -1\n\tfor i := 0; i < final; i++ {\n\t\tif pattern[i] == '*' {\n\t\t\tskip = i\n\t\t}\n\t}\n\tif skip == -1 && pattern != str {\n\t\treturn false\n\t}\n\tnstr := EOF - (final - skip) + 1\n\tif nstr < 0 {\n\t\t// input shorter than pattern\n\t\treturn false\n\t}\n\tif skip != -1 && pattern[skip+1:final] != str[nstr:EOF] {\n\t\treturn false\n\t}\n\n\tloopback := -1\n\tcurrent := 0\n\tfor cursor := 0; cursor < EOF && current != final; cursor++ {\n\t\tif str[cursor] == pattern[current] {\n\t\t\tcurrent++\n\t\t} else if pattern[current] == '*' {\n\t\t\tloopback = current\n\t\t\tif current+1 < final && pattern[current+1] == str[cursor] ||\n\t\t\t\tcurrent+1 < final && pattern[current+1] == '*' {\n\t\t\t\tcurrent++\n\t\t\t\tcursor--\n\t\t\t}\n\t\t} else if loopback == -1 {\n\t\t\tbreak\n\t\t} else {\n\t\t\tcurrent = loopback\n\t\t\tcursor--\n\t\t}\n\t}\n\n\tif current == skip && skip+1 == final {\n\t\treturn pattern[current] == '*'\n\t}\n\treturn current == final\n}", "title": "" }, { "docid": "c565e8e048a87bf6fa2b7e24df7f91fe", "score": "0.45844296", "text": "func (as AnyString) Match(v driver.Value) bool {\n\t_, ok := v.(string)\n\treturn ok\n}", "title": "" } ]
03190d2c7513300b18600f3692da08c8
/ UpdateAllPapers is used to requery all papers in the database. The primary use case is if an additional data field is added to paper data, requiring all papers to pull data for this new field. Function bypasses the standard behavior of GetPaperData which will load paper data from the database rather then making a query if a paper is already stored locally. Receives a DataSelector post request and updates all papers in the sitestage specified by the DataSelector.
[ { "docid": "2bedc0d44c5e4b95cce3672b5adbc9ed", "score": "0.8284301", "text": "func UpdateAllPapers(w http.ResponseWriter, r *http.Request) {\n\tjsn, err := ioutil.ReadAll(r.Body)\n\tif err != nil {\n\t\tPubmedLogger.Printf(\"Error reading body: \", err)\n\t}\n\n\tds := DataSelector{}\n\terr = json.Unmarshal(jsn, &ds)\n\tif err != nil {\n\t\tPubmedLogger.Printf(\"Decoding error: \", err)\n\t}\n\n\tpmids := dbaccess.GetAllPubmedID(ds.Site, ds.Stage)\n\tgetPapers(ds.Site, ds.Stage, pmids)\n\n\tdata := dbaccess.SelectData(ds)\n\tdata_jsn, _ := json.Marshal(data)\n\tw.Write(data_jsn)\n}", "title": "" } ]
[ { "docid": "497848311d3f8cee318ba824b5d83f44", "score": "0.6283937", "text": "func (o PowDatumSlice) UpdateAllP(exec boil.Executor, cols M) {\n\tif err := o.UpdateAll(exec, cols); err != nil {\n\t\tpanic(boil.WrapErr(err))\n\t}\n}", "title": "" }, { "docid": "f39e8e181b8b5acd6e970cd6d7ee61b5", "score": "0.627783", "text": "func (q powDatumQuery) UpdateAllP(cols M) {\n\tif err := q.UpdateAll(cols); err != nil {\n\t\tpanic(boil.WrapErr(err))\n\t}\n}", "title": "" }, { "docid": "0c50821defa1dfc8be12619e96faa709", "score": "0.62668514", "text": "func (q powDatumQuery) UpdateAll(cols M) error {\n\tqueries.SetUpdate(q.Query, cols)\n\n\t_, err := q.Query.Exec()\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"models: unable to update all for pow_data\")\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "1aaeb48dadf7c89376d758e5ec3907d2", "score": "0.626498", "text": "func (q jbrowseQuery) UpdateAllP(cols M) {\n\tif err := q.UpdateAll(cols); err != nil {\n\t\tpanic(boil.WrapErr(err))\n\t}\n}", "title": "" }, { "docid": "8dcf5d6553de7c1114ae7f57fdc4cbd3", "score": "0.62057775", "text": "func (o BlogPostSlice) UpdateAllP(exec boil.Executor, cols M) {\n\tif err := o.UpdateAll(exec, cols); err != nil {\n\t\tpanic(boil.WrapErr(err))\n\t}\n}", "title": "" }, { "docid": "a5035df37f8ff7e495a4f5f4fcc72c1c", "score": "0.6160789", "text": "func (q blogPostQuery) UpdateAllP(cols M) {\n\tif err := q.UpdateAll(cols); err != nil {\n\t\tpanic(boil.WrapErr(err))\n\t}\n}", "title": "" }, { "docid": "0736ef0d8bd27e93bf736495988b1409", "score": "0.61521864", "text": "func (q ladonPolicyQuery) UpdateAllP(cols M) {\n\tif err := q.UpdateAll(cols); err != nil {\n\t\tpanic(boil.WrapErr(err))\n\t}\n}", "title": "" }, { "docid": "845b3f427c0a11176d5456ad66f222bd", "score": "0.61348855", "text": "func (o JbrowseSlice) UpdateAllP(exec boil.Executor, cols M) {\n\tif err := o.UpdateAll(exec, cols); err != nil {\n\t\tpanic(boil.WrapErr(err))\n\t}\n}", "title": "" }, { "docid": "f7ea87edabd3915651def2dab91a3998", "score": "0.6122961", "text": "func (o ContentUnitDerivationSlice) UpdateAllP(exec boil.Executor, cols M) {\n\tif err := o.UpdateAll(exec, cols); err != nil {\n\t\tpanic(boil.WrapErr(err))\n\t}\n}", "title": "" }, { "docid": "fb291b5e329f1393dde9bafcc46ec814", "score": "0.61044794", "text": "func (q measureDateQuery) UpdateAllP(cols M) {\n\tif err := q.UpdateAll(cols); err != nil {\n\t\tpanic(boil.WrapErr(err))\n\t}\n}", "title": "" }, { "docid": "8a2f38155a9c92955b8476908d63eb90", "score": "0.6097346", "text": "func (q contentUnitDerivationQuery) UpdateAllP(cols M) {\n\tif err := q.UpdateAll(cols); err != nil {\n\t\tpanic(boil.WrapErr(err))\n\t}\n}", "title": "" }, { "docid": "db491aa84cb92cb6c9ffd82e98ea6642", "score": "0.60839593", "text": "func (q bookmarkSearchDatumQuery) UpdateAll(ctx context.Context, exec boil.ContextExecutor, cols M) (int64, error) {\n\tqueries.SetUpdate(q.Query, cols)\n\n\tresult, err := q.Query.ExecContext(ctx, exec)\n\tif err != nil {\n\t\treturn 0, errors.Wrap(err, \"models: unable to update all for bookmark_search_data\")\n\t}\n\n\trowsAff, err := result.RowsAffected()\n\tif err != nil {\n\t\treturn 0, errors.Wrap(err, \"models: unable to retrieve rows affected for bookmark_search_data\")\n\t}\n\n\treturn rowsAff, nil\n}", "title": "" }, { "docid": "873493f1a634b4dee9e6a4791b1d1fc1", "score": "0.60839313", "text": "func (q vulnInfoQuery) UpdateAllP(cols M) {\n\tif err := q.UpdateAll(cols); err != nil {\n\t\tpanic(boil.WrapErr(err))\n\t}\n}", "title": "" }, { "docid": "2225a6d326c362fb577749542ac76198", "score": "0.60623854", "text": "func (q jbrowseOrganismQuery) UpdateAllP(cols M) {\n\tif err := q.UpdateAll(cols); err != nil {\n\t\tpanic(boil.WrapErr(err))\n\t}\n}", "title": "" }, { "docid": "1f4727e999effcf3e4f6bf0b65b45be1", "score": "0.6047508", "text": "func (q funderQuery) UpdateAllP(cols M) {\n\tif err := q.UpdateAll(cols); err != nil {\n\t\tpanic(boil.WrapErr(err))\n\t}\n}", "title": "" }, { "docid": "0e84dd3c2b0f6256a1331d05a6e297cd", "score": "0.6042965", "text": "func (o UpepGeneIdentifierSlice) UpdateAllP(exec boil.Executor, cols M) {\n\tif err := o.UpdateAll(exec, cols); err != nil {\n\t\tpanic(boil.WrapErr(err))\n\t}\n}", "title": "" }, { "docid": "249945a8afc685dc93c0783891a8ff93", "score": "0.602517", "text": "func (q pilotQuery) UpdateAll(cols M) error {\n\tqueries.SetUpdate(q.Query, cols)\n\n\t_, err := q.Query.Exec()\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"models: unable to update all for pilots\")\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "1221971d35746292817ee15fa79a0011", "score": "0.60151637", "text": "func (q pilotQuery) UpdateAllP(cols M) {\n\tif err := q.UpdateAll(cols); err != nil {\n\t\tpanic(boil.WrapErr(err))\n\t}\n}", "title": "" }, { "docid": "d8ac7ac305ee488eb829e7902baa9b2b", "score": "0.60138154", "text": "func (q upepGeneIdentifierQuery) UpdateAllP(cols M) {\n\tif err := q.UpdateAll(cols); err != nil {\n\t\tpanic(boil.WrapErr(err))\n\t}\n}", "title": "" }, { "docid": "5371ad828b2e362bc185e6bd925aaa54", "score": "0.6010242", "text": "func (q studentQuery) UpdateAllP(cols M) {\n\tif err := q.UpdateAll(cols); err != nil {\n\t\tpanic(boil.WrapErr(err))\n\t}\n}", "title": "" }, { "docid": "c88b78240d7cfb47e1e2f13080e9b607", "score": "0.5997204", "text": "func (q guestListQuery) UpdateAllP(cols M) {\n\tif err := q.UpdateAll(cols); err != nil {\n\t\tpanic(boil.WrapErr(err))\n\t}\n}", "title": "" }, { "docid": "48bb6563ffd260198af8e9df24ea4553", "score": "0.59660196", "text": "func (q jobQuery) UpdateAllP(cols M) {\n\tif err := q.UpdateAll(cols); err != nil {\n\t\tpanic(boil.WrapErr(err))\n\t}\n}", "title": "" }, { "docid": "5a0c7c29ee497c20619a34dd6fbf914c", "score": "0.5963761", "text": "func (o FunderSlice) UpdateAllP(exec boil.Executor, cols M) {\n\tif err := o.UpdateAll(exec, cols); err != nil {\n\t\tpanic(boil.WrapErr(err))\n\t}\n}", "title": "" }, { "docid": "f77a9de729cb6f7db97e6cd0d75aaa29", "score": "0.5962831", "text": "func (o MeasureDateSlice) UpdateAllP(exec boil.Executor, cols M) {\n\tif err := o.UpdateAll(exec, cols); err != nil {\n\t\tpanic(boil.WrapErr(err))\n\t}\n}", "title": "" }, { "docid": "cef930cf6b5bc3b75ac9467b4913c8ac", "score": "0.5952989", "text": "func (o JbrowseOrganismSlice) UpdateAllP(exec boil.Executor, cols M) {\n\tif err := o.UpdateAll(exec, cols); err != nil {\n\t\tpanic(boil.WrapErr(err))\n\t}\n}", "title": "" }, { "docid": "41da03196ba5c9a9e7e69faad68934be", "score": "0.5952552", "text": "func (q distroAdvisoryQuery) UpdateAllP(cols M) {\n\tif err := q.UpdateAll(cols); err != nil {\n\t\tpanic(boil.WrapErr(err))\n\t}\n}", "title": "" }, { "docid": "4165dfdde23d8d567901d4d897fe22b9", "score": "0.5933215", "text": "func (o BloggerfriendSlice) UpdateAllP(exec boil.Executor, cols M) {\n\tif err := o.UpdateAll(exec, cols); err != nil {\n\t\tpanic(boil.WrapErr(err))\n\t}\n}", "title": "" }, { "docid": "e884627d2281726e4fd8f279c8f439ae", "score": "0.59296167", "text": "func (o LadonPolicySlice) UpdateAllP(exec boil.Executor, cols M) {\n\tif err := o.UpdateAll(exec, cols); err != nil {\n\t\tpanic(boil.WrapErr(err))\n\t}\n}", "title": "" }, { "docid": "62794668fc2b0cf2e698dd59581db702", "score": "0.5929094", "text": "func (q whiteCardQuery) UpdateAllP(cols M) {\n\tif err := q.UpdateAll(cols); err != nil {\n\t\tpanic(boil.WrapErr(err))\n\t}\n}", "title": "" }, { "docid": "6b83c81cbfd8c296b81a5a3211142362", "score": "0.5928475", "text": "func (q bloggerfriendQuery) UpdateAllP(cols M) {\n\tif err := q.UpdateAll(cols); err != nil {\n\t\tpanic(boil.WrapErr(err))\n\t}\n}", "title": "" }, { "docid": "28922e9044670f62f1a1aed8aa8ecf24", "score": "0.5926314", "text": "func (o PilotSlice) UpdateAllP(exec boil.Executor, cols M) {\n\tif err := o.UpdateAll(exec, cols); err != nil {\n\t\tpanic(boil.WrapErr(err))\n\t}\n}", "title": "" }, { "docid": "31abbd4cd8a4b6d7062f2327214e8f3b", "score": "0.5926182", "text": "func (q pilotQuery) UpdateAll(ctx context.Context, exec boil.ContextExecutor, cols M) (int64, error) {\n\tqueries.SetUpdate(q.Query, cols)\n\n\tresult, err := q.Query.ExecContext(ctx, exec)\n\tif err != nil {\n\t\treturn 0, errors.Wrap(err, \"models: unable to update all for pilots\")\n\t}\n\n\trowsAff, err := result.RowsAffected()\n\tif err != nil {\n\t\treturn 0, errors.Wrap(err, \"models: unable to retrieve rows affected for pilots\")\n\t}\n\n\treturn rowsAff, nil\n}", "title": "" }, { "docid": "99d9e685805087aa909dfdab76df54e3", "score": "0.5917568", "text": "func (o StudentSlice) UpdateAllP(exec boil.Executor, cols M) {\n\tif err := o.UpdateAll(exec, cols); err != nil {\n\t\tpanic(boil.WrapErr(err))\n\t}\n}", "title": "" }, { "docid": "7c5c6766d1c10788ed4fb6a0c265d185", "score": "0.58894503", "text": "func (q upepRefSeqDBQuery) UpdateAllP(cols M) {\n\tif err := q.UpdateAll(cols); err != nil {\n\t\tpanic(boil.WrapErr(err))\n\t}\n}", "title": "" }, { "docid": "a2122f11e2c60fe2fe9a1a0d82b6f3f2", "score": "0.5888635", "text": "func (q ladonPolicyQuery) UpdateAll(cols M) error {\n\tqueries.SetUpdate(q.Query, cols)\n\n\t_, err := q.Query.Exec()\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"models: unable to update all for ladon_policy\")\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "21b447123f8f8a553437c99b4b14e716", "score": "0.58840203", "text": "func (o WhiteCardSlice) UpdateAllP(exec boil.Executor, cols M) {\n\tif err := o.UpdateAll(exec, cols); err != nil {\n\t\tpanic(boil.WrapErr(err))\n\t}\n}", "title": "" }, { "docid": "dcacd13fc52b45698e05b4279987d96f", "score": "0.58753", "text": "func (o BookmarkSearchDatumSlice) UpdateAll(ctx context.Context, exec boil.ContextExecutor, cols M) (int64, error) {\n\tln := int64(len(o))\n\tif ln == 0 {\n\t\treturn 0, nil\n\t}\n\n\tif len(cols) == 0 {\n\t\treturn 0, errors.New(\"models: update all requires at least one column argument\")\n\t}\n\n\tcolNames := make([]string, len(cols))\n\targs := make([]interface{}, len(cols))\n\n\ti := 0\n\tfor name, value := range cols {\n\t\tcolNames[i] = name\n\t\targs[i] = value\n\t\ti++\n\t}\n\n\t// Append all of the primary key values for each column\n\tfor _, obj := range o {\n\t\tpkeyArgs := queries.ValuesFromMapping(reflect.Indirect(reflect.ValueOf(obj)), bookmarkSearchDatumPrimaryKeyMapping)\n\t\targs = append(args, pkeyArgs...)\n\t}\n\n\tsql := fmt.Sprintf(\"UPDATE \\\"bookmark_search_data\\\" SET %s WHERE %s\",\n\t\tstrmangle.SetParamNames(\"\\\"\", \"\\\"\", 0, colNames),\n\t\tstrmangle.WhereClauseRepeated(string(dialect.LQ), string(dialect.RQ), 0, bookmarkSearchDatumPrimaryKeyColumns, len(o)))\n\n\tif boil.IsDebug(ctx) {\n\t\twriter := boil.DebugWriterFrom(ctx)\n\t\tfmt.Fprintln(writer, sql)\n\t\tfmt.Fprintln(writer, args...)\n\t}\n\tresult, err := exec.ExecContext(ctx, sql, args...)\n\tif err != nil {\n\t\treturn 0, errors.Wrap(err, \"models: unable to update all in bookmarkSearchDatum slice\")\n\t}\n\n\trowsAff, err := result.RowsAffected()\n\tif err != nil {\n\t\treturn 0, errors.Wrap(err, \"models: unable to retrieve rows affected all in update all bookmarkSearchDatum\")\n\t}\n\treturn rowsAff, nil\n}", "title": "" }, { "docid": "930e837387da770367a0e7f3affcde86", "score": "0.58543366", "text": "func (q funderQuery) UpdateAll(cols M) error {\n\tqueries.SetUpdate(q.Query, cols)\n\n\t_, err := q.Query.Exec()\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"public: unable to update all for funder\")\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "5e0dfd635714b020781aecf25c4ada2e", "score": "0.5849054", "text": "func (q snatcherQuery) UpdateAll(ctx context.Context, exec boil.ContextExecutor, cols M) (int64, error) {\n\tqueries.SetUpdate(q.Query, cols)\n\n\tresult, err := q.Query.ExecContext(ctx, exec)\n\tif err != nil {\n\t\treturn 0, errors.Wrap(err, \"model: unable to update all for snatchers\")\n\t}\n\n\trowsAff, err := result.RowsAffected()\n\tif err != nil {\n\t\treturn 0, errors.Wrap(err, \"model: unable to retrieve rows affected for snatchers\")\n\t}\n\n\treturn rowsAff, nil\n}", "title": "" }, { "docid": "65c9417e869b14d306e87a1e78389802", "score": "0.5839988", "text": "func (o VulnInfoSlice) UpdateAllP(exec boil.Executor, cols M) {\n\tif err := o.UpdateAll(exec, cols); err != nil {\n\t\tpanic(boil.WrapErr(err))\n\t}\n}", "title": "" }, { "docid": "b172946562262e210b0b1cca8b661719", "score": "0.5839635", "text": "func (o JobSlice) UpdateAllP(exec boil.Executor, cols M) {\n\tif err := o.UpdateAll(exec, cols); err != nil {\n\t\tpanic(boil.WrapErr(err))\n\t}\n}", "title": "" }, { "docid": "4b684491404d780f1f40b584b9168ead", "score": "0.58316505", "text": "func (o PowDatumSlice) UpdateAll(exec boil.Executor, cols M) error {\n\tln := int64(len(o))\n\tif ln == 0 {\n\t\treturn nil\n\t}\n\n\tif len(cols) == 0 {\n\t\treturn errors.New(\"models: update all requires at least one column argument\")\n\t}\n\n\tcolNames := make([]string, len(cols))\n\targs := make([]interface{}, len(cols))\n\n\ti := 0\n\tfor name, value := range cols {\n\t\tcolNames[i] = name\n\t\targs[i] = value\n\t\ti++\n\t}\n\n\t// Append all of the primary key values for each column\n\tfor _, obj := range o {\n\t\tpkeyArgs := queries.ValuesFromMapping(reflect.Indirect(reflect.ValueOf(obj)), powDatumPrimaryKeyMapping)\n\t\targs = append(args, pkeyArgs...)\n\t}\n\n\tsql := fmt.Sprintf(\"UPDATE \\\"pow_data\\\" SET %s WHERE %s\",\n\t\tstrmangle.SetParamNames(\"\\\"\", \"\\\"\", 1, colNames),\n\t\tstrmangle.WhereClauseRepeated(string(dialect.LQ), string(dialect.RQ), len(colNames)+1, powDatumPrimaryKeyColumns, len(o)))\n\n\tif boil.DebugMode {\n\t\tfmt.Fprintln(boil.DebugWriter, sql)\n\t\tfmt.Fprintln(boil.DebugWriter, args...)\n\t}\n\n\t_, err := exec.Exec(sql, args...)\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"models: unable to update all in powDatum slice\")\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "3ea958e4c9f7858c34021e6afea142f1", "score": "0.5830498", "text": "func (q offerQuery) UpdateAll(ctx context.Context, exec boil.ContextExecutor, cols M) (int64, error) {\n\tqueries.SetUpdate(q.Query, cols)\n\n\tresult, err := q.Query.ExecContext(ctx, exec)\n\tif err != nil {\n\t\treturn 0, errors.Wrap(err, \"models: unable to update all for offers\")\n\t}\n\n\trowsAff, err := result.RowsAffected()\n\tif err != nil {\n\t\treturn 0, errors.Wrap(err, \"models: unable to retrieve rows affected for offers\")\n\t}\n\n\treturn rowsAff, nil\n}", "title": "" }, { "docid": "03a856da3c014107fcf96b30adc75a99", "score": "0.5826188", "text": "func (q onetimePadQuery) UpdateAll(ctx context.Context, exec boil.ContextExecutor, cols M) (int64, error) {\n\tqueries.SetUpdate(q.Query, cols)\n\n\tresult, err := q.Query.ExecContext(ctx, exec)\n\tif err != nil {\n\t\treturn 0, errors.Wrap(err, \"postgresmodel: unable to update all for OnetimePads\")\n\t}\n\n\trowsAff, err := result.RowsAffected()\n\tif err != nil {\n\t\treturn 0, errors.Wrap(err, \"postgresmodel: unable to retrieve rows affected for OnetimePads\")\n\t}\n\n\treturn rowsAff, nil\n}", "title": "" }, { "docid": "2a3389d76b605f7ed0f5001a17965c5c", "score": "0.58238626", "text": "func (o ExchangeSlice) UpdateAllP(exec boil.Executor, cols M) {\n\tif err := o.UpdateAll(exec, cols); err != nil {\n\t\tpanic(boil.WrapErr(err))\n\t}\n}", "title": "" }, { "docid": "0d7e3c20a8bb48e62a311b58e0afce90", "score": "0.58183247", "text": "func (q upepRefSeqEntryQuery) UpdateAllP(cols M) {\n\tif err := q.UpdateAll(cols); err != nil {\n\t\tpanic(boil.WrapErr(err))\n\t}\n}", "title": "" }, { "docid": "1b6fd26bdcf4b2122e1327b8dfc3d5bb", "score": "0.5817783", "text": "func (o UpepRefSeqEntrySlice) UpdateAllP(exec boil.Executor, cols M) {\n\tif err := o.UpdateAll(exec, cols); err != nil {\n\t\tpanic(boil.WrapErr(err))\n\t}\n}", "title": "" }, { "docid": "e05a64cd288738448b1a8d6f9c5fea4c", "score": "0.5809588", "text": "func (q stockRelationshipCvtermQuery) UpdateAllP(cols M) {\n\tif err := q.UpdateAll(cols); err != nil {\n\t\tpanic(boil.WrapErr(err))\n\t}\n}", "title": "" }, { "docid": "b25490bf9f1e564e1ca458d0ce4ebad5", "score": "0.5808174", "text": "func (o UpepRefSeqDBSlice) UpdateAllP(exec boil.Executor, cols M) {\n\tif err := o.UpdateAll(exec, cols); err != nil {\n\t\tpanic(boil.WrapErr(err))\n\t}\n}", "title": "" }, { "docid": "a4791a3c08c135e35015a9286f308b1c", "score": "0.58052444", "text": "func (q tagQuery) UpdateAllP(cols M) {\n\tif err := q.UpdateAll(cols); err != nil {\n\t\tpanic(boil.WrapErr(err))\n\t}\n}", "title": "" }, { "docid": "a4791a3c08c135e35015a9286f308b1c", "score": "0.58052444", "text": "func (q tagQuery) UpdateAllP(cols M) {\n\tif err := q.UpdateAll(cols); err != nil {\n\t\tpanic(boil.WrapErr(err))\n\t}\n}", "title": "" }, { "docid": "007da966a85eb3c5a88e770e434dc7ed", "score": "0.57999915", "text": "func (q exchangeQuery) UpdateAllP(cols M) {\n\tif err := q.UpdateAll(cols); err != nil {\n\t\tpanic(boil.WrapErr(err))\n\t}\n}", "title": "" }, { "docid": "6aa6365b99d1316b0ed9e2b9f0f49b07", "score": "0.5798957", "text": "func (o DistroAdvisorySlice) UpdateAllP(exec boil.Executor, cols M) {\n\tif err := o.UpdateAll(exec, cols); err != nil {\n\t\tpanic(boil.WrapErr(err))\n\t}\n}", "title": "" }, { "docid": "9bbd64400905da5cb153b67683faa614", "score": "0.5782461", "text": "func (o BlogPostSlice) UpdateAllGP(cols M) {\n\tif err := o.UpdateAll(boil.GetDB(), cols); err != nil {\n\t\tpanic(boil.WrapErr(err))\n\t}\n}", "title": "" }, { "docid": "5d5d5f5f88bf4dee9d2b9a738e92b55f", "score": "0.5774845", "text": "func (q battlereportQuery) UpdateAll(ctx context.Context, exec boil.ContextExecutor, cols M) (int64, error) {\n\tqueries.SetUpdate(q.Query, cols)\n\n\tresult, err := q.Query.ExecContext(ctx, exec)\n\tif err != nil {\n\t\treturn 0, errors.Wrap(err, \"models: unable to update all for battlereports\")\n\t}\n\n\trowsAff, err := result.RowsAffected()\n\tif err != nil {\n\t\treturn 0, errors.Wrap(err, \"models: unable to retrieve rows affected for battlereports\")\n\t}\n\n\treturn rowsAff, nil\n}", "title": "" }, { "docid": "58553ae9af559333738038697dbedd8b", "score": "0.5773168", "text": "func (q phenotypeCvtermQuery) UpdateAllP(cols M) {\n\tif err := q.UpdateAll(cols); err != nil {\n\t\tpanic(boil.WrapErr(err))\n\t}\n}", "title": "" }, { "docid": "10f9cfc75a26ea19dff96c68dc7bb194", "score": "0.57700765", "text": "func (q patientNoteQuery) UpdateAll(ctx context.Context, exec boil.ContextExecutor, cols M) (int64, error) {\n\tqueries.SetUpdate(q.Query, cols)\n\n\tresult, err := q.Query.ExecContext(ctx, exec)\n\tif err != nil {\n\t\treturn 0, errors.Wrap(err, \"models: unable to update all for patient_note\")\n\t}\n\n\trowsAff, err := result.RowsAffected()\n\tif err != nil {\n\t\treturn 0, errors.Wrap(err, \"models: unable to retrieve rows affected for patient_note\")\n\t}\n\n\treturn rowsAff, nil\n}", "title": "" }, { "docid": "031bd8760d0febc035829c28492b0a3f", "score": "0.5764439", "text": "func (o GuestListSlice) UpdateAllP(exec boil.Executor, cols M) {\n\tif err := o.UpdateAll(exec, cols); err != nil {\n\t\tpanic(boil.WrapErr(err))\n\t}\n}", "title": "" }, { "docid": "7b52be08d9f50fee53ed993769be6726", "score": "0.5760099", "text": "func (q meetupQuery) UpdateAll(ctx context.Context, exec boil.ContextExecutor, cols M) (int64, error) {\n\tqueries.SetUpdate(q.Query, cols)\n\n\tresult, err := q.Query.ExecContext(ctx, exec)\n\tif err != nil {\n\t\treturn 0, errors.Wrap(err, \"models: unable to update all for meetup\")\n\t}\n\n\trowsAff, err := result.RowsAffected()\n\tif err != nil {\n\t\treturn 0, errors.Wrap(err, \"models: unable to retrieve rows affected for meetup\")\n\t}\n\n\treturn rowsAff, nil\n}", "title": "" }, { "docid": "5306e854f08ec6c6529c1931bd325abd", "score": "0.57488596", "text": "func (q blogPostQuery) UpdateAll(cols M) error {\n\tqueries.SetUpdate(q.Query, cols)\n\n\t_, err := q.Query.Exec()\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"mdbmdbmodels: unable to update all for blog_posts\")\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "96f1531af1cc3ca8769ec22f9225a92c", "score": "0.5747707", "text": "func (q operationQuery) UpdateAllP(cols M) {\n\tif err := q.UpdateAll(cols); err != nil {\n\t\tpanic(boil.WrapErr(err))\n\t}\n}", "title": "" }, { "docid": "9e3c773fdbf549da5cafea9af03b657a", "score": "0.5747663", "text": "func (q commentQuery) UpdateAllP(cols M) {\n\tif err := q.UpdateAll(cols); err != nil {\n\t\tpanic(boil.WrapErr(err))\n\t}\n}", "title": "" }, { "docid": "a8d8f69700c134b225048841591c7e18", "score": "0.57299405", "text": "func (o PhenotypeSlice) UpdateAllP(exec boil.Executor, cols M) {\n\tif err := o.UpdateAll(exec, cols); err != nil {\n\t\tpanic(boil.WrapErr(err))\n\t}\n}", "title": "" }, { "docid": "9319cf75969bce0b330e3d39c1acdbb1", "score": "0.5719658", "text": "func (o PowDatumSlice) UpdateAllGP(cols M) {\n\tif err := o.UpdateAll(boil.GetDB(), cols); err != nil {\n\t\tpanic(boil.WrapErr(err))\n\t}\n}", "title": "" }, { "docid": "4e6b6bbe886490d2b8b604a8cb41b1bf", "score": "0.57146305", "text": "func (q phenotypeQuery) UpdateAllP(cols M) {\n\tif err := q.UpdateAll(cols); err != nil {\n\t\tpanic(boil.WrapErr(err))\n\t}\n}", "title": "" }, { "docid": "e132d15f0f563322d252f268421508b6", "score": "0.5698432", "text": "func (o GroupMemberSlice) UpdateAllP(ctx context.Context, exec boil.ContextExecutor, cols M) int64 {\n\trowsAff, err := o.UpdateAll(ctx, exec, cols)\n\tif err != nil {\n\t\tpanic(boil.WrapErr(err))\n\t}\n\n\treturn rowsAff\n}", "title": "" }, { "docid": "0ca748629f32ab413e375101aaf4a115", "score": "0.56958324", "text": "func (q groupMemberQuery) UpdateAllP(ctx context.Context, exec boil.ContextExecutor, cols M) int64 {\n\trowsAff, err := q.UpdateAll(ctx, exec, cols)\n\tif err != nil {\n\t\tpanic(boil.WrapErr(err))\n\t}\n\n\treturn rowsAff\n}", "title": "" }, { "docid": "22face619bc0f6586c8df6d890a93d28", "score": "0.56946707", "text": "func (q geoZoneMatrixQuery) UpdateAllP(cols M) {\n\tif err := q.UpdateAll(cols); err != nil {\n\t\tpanic(boil.WrapErr(err))\n\t}\n}", "title": "" }, { "docid": "b54db8078e6c07caed67168740b72d4d", "score": "0.5685674", "text": "func (o CommentSlice) UpdateAllP(exec boil.Executor, cols M) {\n\tif err := o.UpdateAll(exec, cols); err != nil {\n\t\tpanic(boil.WrapErr(err))\n\t}\n}", "title": "" }, { "docid": "4d30a101b1f0847506dab92bd5510c32", "score": "0.56849164", "text": "func (q measureDateQuery) UpdateAll(cols M) error {\n\tqueries.SetUpdate(q.Query, cols)\n\n\t_, err := q.Query.Exec()\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"public: unable to update all for measure_date\")\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "9d2dbfab85b72a0f211c36e3353752f1", "score": "0.56827044", "text": "func (q jbrowseQuery) UpdateAll(cols M) error {\n\tqueries.SetUpdate(q.Query, cols)\n\n\t_, err := q.Query.Exec()\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"chado: unable to update all for jbrowse\")\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "063849b68f68f050a3bced3a5889cdc2", "score": "0.5661867", "text": "func (q playerQuery) UpdateAllP(cols M) {\n\tif err := q.UpdateAll(cols); err != nil {\n\t\tpanic(boil.WrapErr(err))\n\t}\n}", "title": "" }, { "docid": "7d240d31c5924ea07581977494435557", "score": "0.56572235", "text": "func (o PilotSlice) UpdateAll(exec boil.Executor, cols M) error {\n\tln := int64(len(o))\n\tif ln == 0 {\n\t\treturn nil\n\t}\n\n\tif len(cols) == 0 {\n\t\treturn errors.New(\"models: update all requires at least one column argument\")\n\t}\n\n\tcolNames := make([]string, len(cols))\n\targs := make([]interface{}, len(cols))\n\n\ti := 0\n\tfor name, value := range cols {\n\t\tcolNames[i] = name\n\t\targs[i] = value\n\t\ti++\n\t}\n\n\t// Append all of the primary key values for each column\n\tfor _, obj := range o {\n\t\tpkeyArgs := queries.ValuesFromMapping(reflect.Indirect(reflect.ValueOf(obj)), pilotPrimaryKeyMapping)\n\t\targs = append(args, pkeyArgs...)\n\t}\n\n\tsql := fmt.Sprintf(\"UPDATE `pilots` SET %s WHERE %s\",\n\t\tstrmangle.SetParamNames(\"`\", \"`\", 0, colNames),\n\t\tstrmangle.WhereClauseRepeated(string(dialect.LQ), string(dialect.RQ), 0, pilotPrimaryKeyColumns, len(o)))\n\n\tif boil.DebugMode {\n\t\tfmt.Fprintln(boil.DebugWriter, sql)\n\t\tfmt.Fprintln(boil.DebugWriter, args...)\n\t}\n\n\t_, err := exec.Exec(sql, args...)\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"models: unable to update all in pilot slice\")\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "3131ba0c8fb45d7b667c55248dcea23c", "score": "0.5657029", "text": "func (q jobSeekerQuery) UpdateAll(ctx context.Context, exec boil.ContextExecutor, cols M) (int64, error) {\n\tqueries.SetUpdate(q.Query, cols)\n\n\tresult, err := q.Query.ExecContext(ctx, exec)\n\tif err != nil {\n\t\treturn 0, errors.Wrap(err, \"models: unable to update all for job_seeker\")\n\t}\n\n\trowsAff, err := result.RowsAffected()\n\tif err != nil {\n\t\treturn 0, errors.Wrap(err, \"models: unable to retrieve rows affected for job_seeker\")\n\t}\n\n\treturn rowsAff, nil\n}", "title": "" }, { "docid": "af1719772e4872c522978157040545eb", "score": "0.5652434", "text": "func (o TagSlice) UpdateAllP(exec boil.Executor, cols M) {\n\tif err := o.UpdateAll(exec, cols); err != nil {\n\t\tpanic(boil.WrapErr(err))\n\t}\n}", "title": "" }, { "docid": "af1719772e4872c522978157040545eb", "score": "0.5652434", "text": "func (o TagSlice) UpdateAllP(exec boil.Executor, cols M) {\n\tif err := o.UpdateAll(exec, cols); err != nil {\n\t\tpanic(boil.WrapErr(err))\n\t}\n}", "title": "" }, { "docid": "684629557d590335d9901150ea4d1539", "score": "0.5639825", "text": "func (q protocolsSetQuery) UpdateAll(ctx context.Context, exec boil.ContextExecutor, cols M) (int64, error) {\n\tqueries.SetUpdate(q.Query, cols)\n\n\tresult, err := q.Query.ExecContext(ctx, exec)\n\tif err != nil {\n\t\treturn 0, errors.Wrap(err, \"models: unable to update all for protocols_sets\")\n\t}\n\n\trowsAff, err := result.RowsAffected()\n\tif err != nil {\n\t\treturn 0, errors.Wrap(err, \"models: unable to retrieve rows affected for protocols_sets\")\n\t}\n\n\treturn rowsAff, nil\n}", "title": "" }, { "docid": "85af51f0f62c1c2fda7d2e6826a13f44", "score": "0.5638074", "text": "func (o PilotSlice) UpdateAll(ctx context.Context, exec boil.ContextExecutor, cols M) (int64, error) {\n\tln := int64(len(o))\n\tif ln == 0 {\n\t\treturn 0, nil\n\t}\n\n\tif len(cols) == 0 {\n\t\treturn 0, errors.New(\"models: update all requires at least one column argument\")\n\t}\n\n\tcolNames := make([]string, len(cols))\n\targs := make([]interface{}, len(cols))\n\n\ti := 0\n\tfor name, value := range cols {\n\t\tcolNames[i] = name\n\t\targs[i] = value\n\t\ti++\n\t}\n\n\t// Append all of the primary key values for each column\n\tfor _, obj := range o {\n\t\tpkeyArgs := queries.ValuesFromMapping(reflect.Indirect(reflect.ValueOf(obj)), pilotPrimaryKeyMapping)\n\t\targs = append(args, pkeyArgs...)\n\t}\n\n\tsql := fmt.Sprintf(\"UPDATE \\\"pilots\\\" SET %s WHERE %s\",\n\t\tstrmangle.SetParamNames(\"\\\"\", \"\\\"\", 1, colNames),\n\t\tstrmangle.WhereClauseRepeated(string(dialect.LQ), string(dialect.RQ), len(colNames)+1, pilotPrimaryKeyColumns, len(o)))\n\n\tif boil.DebugMode {\n\t\tfmt.Fprintln(boil.DebugWriter, sql)\n\t\tfmt.Fprintln(boil.DebugWriter, args...)\n\t}\n\n\tresult, err := exec.ExecContext(ctx, sql, args...)\n\tif err != nil {\n\t\treturn 0, errors.Wrap(err, \"models: unable to update all in pilot slice\")\n\t}\n\n\trowsAff, err := result.RowsAffected()\n\tif err != nil {\n\t\treturn 0, errors.Wrap(err, \"models: unable to retrieve rows affected all in update all pilot\")\n\t}\n\treturn rowsAff, nil\n}", "title": "" }, { "docid": "cbf267f1221aecf7bd078101a5139558", "score": "0.5633667", "text": "func (o BlockedEntrySlice) UpdateAllP(exec boil.Executor, cols M) {\n\terr := o.UpdateAll(exec, cols)\n\tif err != nil {\n\t\tpanic(boil.WrapErr(err))\n\t}\n}", "title": "" }, { "docid": "f028c3f11cebcfcbd1b7591f98908aae", "score": "0.5629074", "text": "func (q noteRatingQuery) UpdateAll(ctx context.Context, exec boil.ContextExecutor, cols M) (int64, error) {\n\tqueries.SetUpdate(q.Query, cols)\n\n\tresult, err := q.Query.ExecContext(ctx, exec)\n\tif err != nil {\n\t\treturn 0, errors.Wrap(err, \"models: unable to update all for NoteRatings\")\n\t}\n\n\trowsAff, err := result.RowsAffected()\n\tif err != nil {\n\t\treturn 0, errors.Wrap(err, \"models: unable to retrieve rows affected for NoteRatings\")\n\t}\n\n\treturn rowsAff, nil\n}", "title": "" }, { "docid": "c380abf446f553f1a8f2a24fc1e7a83d", "score": "0.56279594", "text": "func (q distroAdvisoryQuery) UpdateAll(cols M) error {\n\tqueries.SetUpdate(q.Query, cols)\n\n\t_, err := q.Query.Exec()\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"models: unable to update all for distro_advisories\")\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "0ff264b09f8b5dd30f637785de43a96a", "score": "0.5620088", "text": "func (o PhenotypeCvtermSlice) UpdateAllP(exec boil.Executor, cols M) {\n\tif err := o.UpdateAll(exec, cols); err != nil {\n\t\tpanic(boil.WrapErr(err))\n\t}\n}", "title": "" }, { "docid": "04d112db0354b2ddae129ddf13e85708", "score": "0.5615718", "text": "func (q creditCardQuery) UpdateAllP(ctx context.Context, exec boil.ContextExecutor, cols M) int64 {\n\trowsAff, err := q.UpdateAll(ctx, exec, cols)\n\tif err != nil {\n\t\tpanic(boil.WrapErr(err))\n\t}\n\n\treturn rowsAff\n}", "title": "" }, { "docid": "d6a2bff99e21d136691475aa76a90c2f", "score": "0.56103265", "text": "func (o OfferSlice) UpdateAll(ctx context.Context, exec boil.ContextExecutor, cols M) (int64, error) {\n\tln := int64(len(o))\n\tif ln == 0 {\n\t\treturn 0, nil\n\t}\n\n\tif len(cols) == 0 {\n\t\treturn 0, errors.New(\"models: update all requires at least one column argument\")\n\t}\n\n\tcolNames := make([]string, len(cols))\n\targs := make([]interface{}, len(cols))\n\n\ti := 0\n\tfor name, value := range cols {\n\t\tcolNames[i] = name\n\t\targs[i] = value\n\t\ti++\n\t}\n\n\t// Append all of the primary key values for each column\n\tfor _, obj := range o {\n\t\tpkeyArgs := queries.ValuesFromMapping(reflect.Indirect(reflect.ValueOf(obj)), offerPrimaryKeyMapping)\n\t\targs = append(args, pkeyArgs...)\n\t}\n\n\tsql := fmt.Sprintf(\"UPDATE `offers` SET %s WHERE %s\",\n\t\tstrmangle.SetParamNames(\"`\", \"`\", 0, colNames),\n\t\tstrmangle.WhereClauseRepeated(string(dialect.LQ), string(dialect.RQ), 0, offerPrimaryKeyColumns, len(o)))\n\n\tif boil.DebugMode {\n\t\tfmt.Fprintln(boil.DebugWriter, sql)\n\t\tfmt.Fprintln(boil.DebugWriter, args...)\n\t}\n\n\tresult, err := exec.ExecContext(ctx, sql, args...)\n\tif err != nil {\n\t\treturn 0, errors.Wrap(err, \"models: unable to update all in offer slice\")\n\t}\n\n\trowsAff, err := result.RowsAffected()\n\tif err != nil {\n\t\treturn 0, errors.Wrap(err, \"models: unable to retrieve rows affected all in update all offer\")\n\t}\n\treturn rowsAff, nil\n}", "title": "" }, { "docid": "93b8ae7f1b82ca9bfc9f3773f9f95731", "score": "0.5606534", "text": "func (o BattlereportSlice) UpdateAll(ctx context.Context, exec boil.ContextExecutor, cols M) (int64, error) {\n\tln := int64(len(o))\n\tif ln == 0 {\n\t\treturn 0, nil\n\t}\n\n\tif len(cols) == 0 {\n\t\treturn 0, errors.New(\"models: update all requires at least one column argument\")\n\t}\n\n\tcolNames := make([]string, len(cols))\n\targs := make([]interface{}, len(cols))\n\n\ti := 0\n\tfor name, value := range cols {\n\t\tcolNames[i] = name\n\t\targs[i] = value\n\t\ti++\n\t}\n\n\t// Append all of the primary key values for each column\n\tfor _, obj := range o {\n\t\tpkeyArgs := queries.ValuesFromMapping(reflect.Indirect(reflect.ValueOf(obj)), battlereportPrimaryKeyMapping)\n\t\targs = append(args, pkeyArgs...)\n\t}\n\n\tsql := fmt.Sprintf(\"UPDATE \\\"battlereports\\\" SET %s WHERE %s\",\n\t\tstrmangle.SetParamNames(\"\\\"\", \"\\\"\", 1, colNames),\n\t\tstrmangle.WhereClauseRepeated(string(dialect.LQ), string(dialect.RQ), len(colNames)+1, battlereportPrimaryKeyColumns, len(o)))\n\n\tif boil.DebugMode {\n\t\tfmt.Fprintln(boil.DebugWriter, sql)\n\t\tfmt.Fprintln(boil.DebugWriter, args...)\n\t}\n\n\tresult, err := exec.ExecContext(ctx, sql, args...)\n\tif err != nil {\n\t\treturn 0, errors.Wrap(err, \"models: unable to update all in battlereport slice\")\n\t}\n\n\trowsAff, err := result.RowsAffected()\n\tif err != nil {\n\t\treturn 0, errors.Wrap(err, \"models: unable to retrieve rows affected all in update all battlereport\")\n\t}\n\treturn rowsAff, nil\n}", "title": "" }, { "docid": "1889cbaf48d41ac125d7775169a979a6", "score": "0.5596621", "text": "func (q tBookQuery) UpdateAll(ctx context.Context, exec boil.ContextExecutor, cols M) (int64, error) {\n\tqueries.SetUpdate(q.Query, cols)\n\n\tresult, err := q.Query.ExecContext(ctx, exec)\n\tif err != nil {\n\t\treturn 0, errors.Wrap(err, \"models: unable to update all for t_book\")\n\t}\n\n\trowsAff, err := result.RowsAffected()\n\tif err != nil {\n\t\treturn 0, errors.Wrap(err, \"models: unable to retrieve rows affected for t_book\")\n\t}\n\n\treturn rowsAff, nil\n}", "title": "" }, { "docid": "48148ce9b081caf51a34bb59998c322f", "score": "0.559562", "text": "func (q corporationDeltaQuery) UpdateAll(ctx context.Context, exec boil.ContextExecutor, cols M) error {\n\tqueries.SetUpdate(q.Query, cols)\n\n\t_, err := q.Query.ExecContext(ctx, exec)\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"boiler: unable to update all for corporation_deltas\")\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "8c806e1063e9055974b667c4550f3b2a", "score": "0.55935234", "text": "func (q analyticsPageviewQuery) UpdateAll(ctx context.Context, exec boil.ContextExecutor, cols M) (int64, error) {\n\tqueries.SetUpdate(q.Query, cols)\n\n\tresult, err := q.Query.ExecContext(ctx, exec)\n\tif err != nil {\n\t\treturn 0, errors.Wrap(err, \"models: unable to update all for analytics_pageviews\")\n\t}\n\n\trowsAff, err := result.RowsAffected()\n\tif err != nil {\n\t\treturn 0, errors.Wrap(err, \"models: unable to retrieve rows affected for analytics_pageviews\")\n\t}\n\n\treturn rowsAff, nil\n}", "title": "" }, { "docid": "fae0cff68b7ba0001b53781e126fc6cc", "score": "0.559222", "text": "func (o TenantSlice) UpdateAllP(exec boil.Executor, cols M) int64 {\n\trowsAff, err := o.UpdateAll(exec, cols)\n\tif err != nil {\n\t\tpanic(boil.WrapErr(err))\n\t}\n\n\treturn rowsAff\n}", "title": "" }, { "docid": "f5e9eb5d48bac2afeffffd325ba637ad", "score": "0.55863893", "text": "func (o StockRelationshipCvtermSlice) UpdateAllP(exec boil.Executor, cols M) {\n\tif err := o.UpdateAll(exec, cols); err != nil {\n\t\tpanic(boil.WrapErr(err))\n\t}\n}", "title": "" }, { "docid": "5e8780e53cf05295f8c07c1e2b72d2e7", "score": "0.55860955", "text": "func (o *PowDatumSlice) ReloadAllP(exec boil.Executor) {\n\tif err := o.ReloadAll(exec); err != nil {\n\t\tpanic(boil.WrapErr(err))\n\t}\n}", "title": "" }, { "docid": "746022d04f85ee0f918ce1939a4d90ab", "score": "0.55786943", "text": "func (o GeoZoneMatrixSlice) UpdateAllP(exec boil.Executor, cols M) {\n\tif err := o.UpdateAll(exec, cols); err != nil {\n\t\tpanic(boil.WrapErr(err))\n\t}\n}", "title": "" }, { "docid": "40e84c9ffdb7da9f0c28296dc3abfa7b", "score": "0.557739", "text": "func (q personQuery) UpdateAll(ctx context.Context, exec boil.ContextExecutor, cols M) (int64, error) {\n\tqueries.SetUpdate(q.Query, cols)\n\n\tresult, err := q.Query.ExecContext(ctx, exec)\n\tif err != nil {\n\t\treturn 0, errors.Wrap(err, \"models: unable to update all for person\")\n\t}\n\n\trowsAff, err := result.RowsAffected()\n\tif err != nil {\n\t\treturn 0, errors.Wrap(err, \"models: unable to retrieve rows affected for person\")\n\t}\n\n\treturn rowsAff, nil\n}", "title": "" }, { "docid": "d5ea431cda7a378338686efd30d85aa0", "score": "0.55756265", "text": "func (q tenantQuery) UpdateAllP(exec boil.Executor, cols M) int64 {\n\trowsAff, err := q.UpdateAll(exec, cols)\n\tif err != nil {\n\t\tpanic(boil.WrapErr(err))\n\t}\n\n\treturn rowsAff\n}", "title": "" }, { "docid": "c3c1bc15fc6c963f8692279483429ca6", "score": "0.5561615", "text": "func (q vulnInfoQuery) UpdateAll(cols M) error {\n\tqueries.SetUpdate(q.Query, cols)\n\n\t_, err := q.Query.Exec()\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"models: unable to update all for vuln_infos\")\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "3a38ba462c585ce31a98efd988541242", "score": "0.55582213", "text": "func UpdateAll(ui UI, data *UIData) {\n\tvar wg sync.WaitGroup\n\tfor _, service := range data.Services {\n\t\twg.Add(1)\n\t\tgo service.Update(&wg)\n\t}\n\twg.Wait()\n\n\tdata.LastTimestamp = time.Now()\n\n\tui.Update(*data)\n}", "title": "" }, { "docid": "45e9a7b1a8de52217664d151f924536a", "score": "0.55580723", "text": "func (q blockedEntryQuery) UpdateAllP(exec boil.Executor, cols M) {\n\terr := q.UpdateAll(exec, cols)\n\tif err != nil {\n\t\tpanic(boil.WrapErr(err))\n\t}\n}", "title": "" }, { "docid": "195f1186954146f18223e5f0bb855b05", "score": "0.5525423", "text": "func (o CreditCardSlice) UpdateAllP(ctx context.Context, exec boil.ContextExecutor, cols M) int64 {\n\trowsAff, err := o.UpdateAll(ctx, exec, cols)\n\tif err != nil {\n\t\tpanic(boil.WrapErr(err))\n\t}\n\n\treturn rowsAff\n}", "title": "" }, { "docid": "ef6cc9f14349b23127f897dcf384f384", "score": "0.5519616", "text": "func (q jobQuery) UpdateAll(cols M) error {\n\tqueries.SetUpdate(q.Query, cols)\n\n\t_, err := q.Query.Exec()\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"models: unable to update all for job\")\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "b5cbc8e71faac979d4935126887b7f7e", "score": "0.55191916", "text": "func (q paymentQuery) UpdateAll(ctx context.Context, exec boil.ContextExecutor, cols M) (int64, error) {\n\tqueries.SetUpdate(q.Query, cols)\n\n\tresult, err := q.Query.ExecContext(ctx, exec)\n\tif err != nil {\n\t\treturn 0, errors.Wrap(err, \"models: unable to update all for payments\")\n\t}\n\n\trowsAff, err := result.RowsAffected()\n\tif err != nil {\n\t\treturn 0, errors.Wrap(err, \"models: unable to retrieve rows affected for payments\")\n\t}\n\n\treturn rowsAff, nil\n}", "title": "" } ]
6772fcca5c55480c61fbe08828f6ba35
processWikiFile takes the filename of an article (amongs other things), converts the markdown markup into HTML, "linkifies" said HTML and then sanitizes it using Bluemonday to prevent malicious Javascript and the like.
[ { "docid": "e4899164a89ec66d82b7ad0aeb9054aa", "score": "0.8011209", "text": "func processWikiFile(inputDir string, outputDir string, fileName string, mode os.FileMode, recognizer goahocorasick.Machine, linkTable map[string]string) {\n\tcontents, err := ioutil.ReadFile(filepath.Join(inputDir, fileName))\n\tif err != nil {\n\t\tlog.Fatalf(\"Error while reading '%s': %s\", fileName, err)\n\t}\n\n\toutput := blackfriday.MarkdownCommon(contents)\n\tlinked := linkArticles(output, recognizer, linkTable)\n\tsafe := bluemonday.UGCPolicy().SanitizeBytes(linked)\n\n\toutPath := filepath.Join(outputDir, fileName+\".html\")\n\n\tf, err := os.Create(outPath)\n\tif err != nil {\n\t\tlog.Fatalf(\"Error creating file '%s': %s\", outPath, err)\n\t}\n\tdefer f.Close()\n\n\terr = tmpl.Execute(f, string(safe))\n\tif err != nil {\n\t\tlog.Fatalf(\"Error while writing to '%s': %s\", outPath, err)\n\t}\n}", "title": "" } ]
[ { "docid": "0860791e746c38910ed3f72dcebbbc2d", "score": "0.55882394", "text": "func (p *HtmlStriper2) ParseFile(filename string) {\n\t//fmt.Printf(\"Parsing %s...\\n\", filename)\n\t// create from a file\n\ts, err := ReadTextFile(filename)\n\tif err != nil {\n\t\tfmt.Printf(\"%v\\n\", err)\n\t\treturn\n\t}\n\n\tpolicy := bluemonday.StrictPolicy()\n\tstripped := policy.Sanitize(s)\n\tp.allLines = append(p.allLines, stripped)\n\tWriteTextFile(filename+\".txt\", stripped)\n}", "title": "" }, { "docid": "38ed5517cfd0e022f29930dead77bfaf", "score": "0.5529961", "text": "func processMarkdown() (map[string][]byte, error) {\n\t// map md file names to raw html bytes\n\thtml := make(map[string][]byte)\n\n\tfiles, err := ioutil.ReadDir(\"./posts\")\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tfor _, file := range files {\n\t\tname := strings.TrimSuffix(file.Name(), filepath.Ext(file.Name()))\n\t\tmd, err := ioutil.ReadFile(\"./posts/\" + file.Name())\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\thtml[name] = blackfriday.MarkdownCommon([]byte(md))\n\t}\n\treturn html, nil\n}", "title": "" }, { "docid": "0a5ed5bad62d5052c37bac779efd1b75", "score": "0.53686607", "text": "func (b *Builder) parseFile(path string, kind pageTypeKind, folderContext *FolderContext) error {\n\tg := NewGrammar()\n\tvar markdown []byte\n\tvar res []*Resource\n\tvar parser *Parser\n\tvar doc *DocumentNode\n\tvar err error\n\tvar pt *pageType\n\tvar frontmatter map[string]interface{}\n\ttags := make(map[string][]string)\n\n\tcontentResolver := func(res *Resource) error {\n\t\treturn resolveContentResource(b, res)\n\t}\n\n\tprintln(\"Processing file\", path, \"...\")\n\t// Read and process the markdown file (if one exists)\n\tmarkdown, err = afero.ReadFile(b.contentFs, path)\n\tif err != nil {\n\t\t// The \"index.md\" does not exist? This is ok for the homepage and folders.\n\t\tif (kind == homepagePageType || kind == folderPageType || kind == categoryPageType || kind == categoryValuePageType) && os.IsNotExist(err) {\n\t\t\t// OK\n\t\t\tprintln(\" markdown file is missing\")\n\t\t\tmarkdown = []byte{}\n\t\t} else {\n\t\t\treturn err\n\t\t}\n\t}\n\t// Create a parser for the page\n\tparser = NewParser(g, markdown, contentResolver)\n\n\t// Parse and process frontmatter\n\tfrontmatter, err = parser.ParseFrontmatter()\n\tif err != nil {\n\t\treturn fmt.Errorf(\"In %v: YAML parsing error: %v\", path, err)\n\t}\n\tif frontmatter == nil {\n\t\tfrontmatter = make(map[string]interface{})\n\t}\n\n\tfor k, v := range frontmatter {\n\t\tswitch k {\n\t\tcase \"Scripts\":\n\t\tcase \"Styles\":\n\t\t\tif list, ok := v.([]interface{}); ok {\n\t\t\t\tfor _, resurl := range list {\n\t\t\t\t\tif strurl, ok := resurl.(string); ok {\n\t\t\t\t\t\tu, err := url.Parse(strurl)\n\t\t\t\t\t\tif err != nil {\n\t\t\t\t\t\t\treturn fmt.Errorf(\"In %v %v: URL is malformed: %v\", path, k, err)\n\t\t\t\t\t\t}\n\t\t\t\t\t\tvar r *Resource\n\t\t\t\t\t\tif k == \"Scripts\" {\n\t\t\t\t\t\t\tr = &Resource{Type: ResourceTypeScript, URL: u}\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tr = &Resource{Type: ResourceTypeStyle, URL: u}\n\t\t\t\t\t\t}\n\t\t\t\t\t\terr = contentResolver(r)\n\t\t\t\t\t\tif err != nil {\n\t\t\t\t\t\t\treturn fmt.Errorf(\"In %v %v: resource resolution error: %v\", path, k, err)\n\t\t\t\t\t\t}\n\t\t\t\t\t\tres = append(res, r)\n\t\t\t\t\t} else {\n\t\t\t\t\t\treturn fmt.Errorf(\"In %v %v: YAML field 'Scripts' must be a string or list of string\", path, k)\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t} else if strurl, ok := v.(string); ok {\n\t\t\t\tu, err := url.Parse(strurl)\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn fmt.Errorf(\"In %v %v: URL is malformed: %v\", path, k, err)\n\t\t\t\t}\n\t\t\t\tvar r *Resource\n\t\t\t\tif k == \"Scripts\" {\n\t\t\t\t\tr = &Resource{Type: ResourceTypeScript, URL: u}\n\t\t\t\t} else {\n\t\t\t\t\tr = &Resource{Type: ResourceTypeStyle, URL: u}\n\t\t\t\t}\n\t\t\t\terr = contentResolver(r)\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn fmt.Errorf(\"In %v %v: resource resolution error: %v\", path, k, err)\n\t\t\t\t}\n\t\t\t\tres = append(res, r)\n\t\t\t} else {\n\t\t\t\treturn fmt.Errorf(\"In %v %v: YAML field 'Scripts' must be a string or list of string\", path, k)\n\t\t\t}\n\t\tcase \"Title\":\n\t\t\tif _, ok := v.(string); !ok {\n\t\t\t\treturn fmt.Errorf(\"In %v %v: YAML field 'Title' must be a string\", path, k)\n\t\t\t}\n\t\tcase \"Type\":\n\t\t\tpageTypeName, err := yamlString(\"Type\", v, path)\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t\tpt, err = b.lookupPageType(pageTypeName)\n\t\t\tif err != nil {\n\t\t\t\treturn fmt.Errorf(\"In %v: page type %v: %v\", path, pageTypeName, err.Error())\n\t\t\t}\n\t\tdefault:\n\t\t\t// Handle later, after the page type is known\n\t\t}\n\t}\n\n\t// Select a page type if none has been specified\n\tif pt == nil {\n\t\tpt = b.selectPageType(kind, folderContext)\n\t}\n\tprintln(\" page Type: \", pt.name)\n\n\tfor k, v := range frontmatter {\n\t\tswitch k {\n\t\tcase \"Scripts\", \"Styles\", \"Type\", \"Title\":\n\t\t\t// Handled above\n\t\t\tbreak\n\t\tdefault:\n\t\t\t// Is `k` a TagType?\n\t\t\tif _, ok := b.site.tags.Types[k]; ok {\n\t\t\t\tif list, ok := v.([]interface{}); ok {\n\t\t\t\t\tfor _, tagValue := range list {\n\t\t\t\t\t\tif tagValueName, ok := tagValue.(string); ok {\n\t\t\t\t\t\t\ttags[k] = append(tags[k], tagValueName)\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\treturn fmt.Errorf(\"In %v: Value of tag type %v must be a string or a list of strings\", path, k)\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t} else {\n\t\t\t\t\tvstr, err := yamlString(k, v, path)\n\t\t\t\t\tif err != nil {\n\t\t\t\t\t\treturn fmt.Errorf(\"In %v: Value of tag type %v must be a string or a list of strings\", path, k)\n\t\t\t\t\t}\n\t\t\t\t\ttags[k] = []string{vstr}\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\t// `k` must be a VarDef\n\t\t\t\tvdef, err := pt.findVariable(k)\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn fmt.Errorf(\"In %v: %v is neither a tag type nor a known variable\", path, k)\n\t\t\t\t}\n\t\t\t\terr = vdef.checkYAMLValue(v)\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn fmt.Errorf(\"In %v: variable %v: %v\", path, k, err)\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\t// Lookup syntax extension (if available)\n\tmarkdownSyntaxData, _, err := b.lookupMarkdownSyntax(pt)\n\tif err != nil && !os.IsNotExist(err) {\n\t\treturn err\n\t}\n\t// Process syntax extension\n\tfor i := 0; i < len(markdownSyntaxData); i++ {\n\t\tmarkdownSyntax := markdownSyntaxData[i]\n\t\t// markdownSyntaxFile := markdownSyntaxFiles[i]\n\t\tsyntaxResolver := func(res *Resource) error {\n\t\t\treturn pt.resolveStaticResource(res, pt)\n\t\t}\n\t\tsyntaxParser := NewParser(g, markdownSyntax, syntaxResolver)\n\t\t// Parse the frontmatter of the syntax extension. But currently it is ignored\n\t\t_, err = syntaxParser.ParseFrontmatter()\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\t// Parse markdown of the syntax extension\n\t\t_, err = syntaxParser.ParseMarkdown()\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\t// Parse markdown\n\tif parser != nil {\n\t\tdoc, err = parser.ParseMarkdown()\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t} else {\n\t\tdoc = NewDocument(g)\n\t}\n\n\tvar base string\n\tvar baseFile string\n\tvar layouts []string\n\tif !pt.isNone() {\n\t\t// Lookup base and layout(s) HTML files.\n\t\t// Find all resources referenced in these HTML files.\n\t\tbase, baseFile, err = b.lookupBaseHTML(pt, kind, folderContext)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tif baseFile != \"\" {\n\t\t\tbaseResolver := func(res *Resource) error {\n\t\t\t\treturn pt.resolveStaticResource(res, pt)\n\t\t\t}\n\t\t\tvar baseRes []*Resource\n\t\t\tbase, baseRes, err = ParseHTMLResources(base, baseResolver)\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t\tres = append(res, baseRes...)\n\t\t}\n\t\tlayoutData, _, err := b.lookupLayoutHTML(pt, kind, folderContext)\n\t\tif err != nil && !os.IsNotExist(err) {\n\t\t\treturn err\n\t\t}\n\t\tfor i := 0; i < len(layoutData); i++ {\n\t\t\tlayoutStr := layoutData[i]\n\t\t\tlayoutResolver := func(res *Resource) error {\n\t\t\t\treturn pt.resolveStaticResource(res, pt)\n\t\t\t}\n\t\t\tvar layoutRes []*Resource\n\t\t\tlayoutStr, layoutRes, err = ParseHTMLResources(layoutStr, layoutResolver)\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t\tlayouts = append(layouts, layoutStr)\n\t\t\tres = append(res, layoutRes...)\n\t\t}\n\t}\n\n\t// Compute a sensible title\n\tif _, ok := frontmatter[\"Title\"]; !ok {\n\t\ttitle := stripSuffix(filepath.Base(path))\n\t\tif title == \"index\" {\n\t\t\tif path == \".\" {\n\t\t\t\ttitle = b.site.ctx.Title\n\t\t\t} else {\n\t\t\t\ttitle = filepath.Base(filepath.Dir(path))\n\t\t\t}\n\t\t}\n\t\tfrontmatter[\"Title\"] = title\n\t}\n\n\t// Create the page\n\tpage := &Page{Grammar: g, Document: doc, Fname: path, Resources: res, Params: frontmatter, PageTypeName: pt.name}\n\tif pt.isNone() {\n\t\t// Do not generate a file for this page\n\t\tpage.Fname = \"\"\n\t} else {\n\t\t// Set the RelURL property\n\t\toutpath := strings.TrimSuffix(path, \".md\") + \".html\"\n\t\tpage.RelURL = \"/\" + filepath.ToSlash(outpath)\n\t}\n\n\t// Create the generator for the page\n\tgen := NewHTMLGenerator(page, base, layouts, contentResolver, folderContext, b.site.ctx, &b.options.Options)\n\tb.generators[path] = gen\n\n\t// Parse all templates and determine resources\n\terr = gen.Prepare()\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// Add page specific resources\n\tptTemp := pt\n\tfor ptTemp != nil {\n\t\tpage.Resources = append(page.Resources, ptTemp.resources...)\n\t\tptTemp = ptTemp.inheritPageType\n\t}\n\n\t// Determine all tags to which the generated page belongs\n\tfor tagType, values := range tags {\n\t\tt, ok := b.site.tags.Types[tagType]\n\t\tif ok {\n\t\t\tfor _, value := range values {\n\t\t\t\tt.addPage(value, gen.PageContext())\n\t\t\t}\n\t\t}\n\t}\n\n\tif kind == homepagePageType {\n\t\tb.site.ctx.Folder = folderContext\n\t\tfolderContext.Page = gen.PageContext()\n\t} else if kind == folderPageType || kind == categoryPageType {\n\t\tfolderContext.Page = gen.PageContext()\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "3a3fc6df071da12825da3fe7939956fa", "score": "0.53619546", "text": "func (ac *Config) MarkdownPage(w http.ResponseWriter, req *http.Request, data []byte, filename string) {\n\t// Prepare for receiving title and codeStyle information\n\tsearchKeywords := []string{\"title\", \"codestyle\", \"theme\", \"replace_with_theme\", \"css\", \"favicon\"}\n\n\t// Also prepare for receiving meta tag information\n\tsearchKeywords = append(searchKeywords, themes.MetaKeywords...)\n\n\t// Extract keywords from the given data, and remove the lines with keywords,\n\t// but only the first time that keyword occurs.\n\tvar kwmap map[string][]byte\n\n\tdata, kwmap = utils.ExtractKeywords(data, searchKeywords)\n\n\t// Create a Markdown parser with the desired extensions\n\textensions := parser.CommonExtensions | parser.AutoHeadingIDs\n\tmdParser := parser.NewWithExtensions(extensions)\n\t// Convert from Markdown to HTML\n\thtmlbody := markdown.ToHTML(data, mdParser, nil)\n\n\t// TODO: Check if handling \"# title <tags\" on the first line is valid\n\t// Markdown or not. Submit a patch to gomarkdown/markdown if it is.\n\n\tvar h1title []byte\n\tif bytes.HasPrefix(htmlbody, []byte(\"<p>#\")) {\n\t\tfields := bytes.Split(htmlbody, []byte(\"<\"))\n\t\tif len(fields) > 2 {\n\t\t\th1title = bytes.TrimPrefix(fields[1][2:], []byte(\"#\"))\n\t\t\thtmlbody = htmlbody[3+len(h1title):] // 3 is the length of <p>\n\t\t}\n\t}\n\n\t// Checkboxes\n\thtmlbody = bytes.ReplaceAll(htmlbody, []byte(\"<li>[ ] \"), []byte(\"<li><input type=\\\"checkbox\\\" disabled> \"))\n\thtmlbody = bytes.ReplaceAll(htmlbody, []byte(\"<li><p>[ ] \"), []byte(\"<li><p><input type=\\\"checkbox\\\" disabled> \"))\n\thtmlbody = bytes.ReplaceAll(htmlbody, []byte(\"<li>[x] \"), []byte(\"<li><input type=\\\"checkbox\\\" disabled checked> \"))\n\thtmlbody = bytes.ReplaceAll(htmlbody, []byte(\"<li>[X] \"), []byte(\"<li><input type=\\\"checkbox\\\" disabled checked> \"))\n\thtmlbody = bytes.ReplaceAll(htmlbody, []byte(\"<li><p>[x] \"), []byte(\"<li><p><input type=\\\"checkbox\\\" disabled checked> \"))\n\n\t// These should work by default, but does not.\n\t// TODO: Look into how gomarkdown/markdown handles this.\n\thtmlbody = bytes.ReplaceAll(htmlbody, []byte(\"&amp;gt;\"), []byte(\"&gt;\"))\n\thtmlbody = bytes.ReplaceAll(htmlbody, []byte(\"&amp;lt;\"), []byte(\"&lt;\"))\n\n\t// If there is no given title, use the h1title\n\ttitle := kwmap[\"title\"]\n\tif len(title) == 0 {\n\t\tif len(h1title) != 0 {\n\t\t\ttitle = h1title\n\t\t} else {\n\t\t\t// If no title has been provided, use the filename\n\t\t\ttitle = []byte(filepath.Base(filename))\n\t\t}\n\t}\n\n\t// Find the theme that should be used\n\ttheme := kwmap[\"theme\"]\n\tif len(theme) == 0 {\n\t\ttheme = []byte(ac.defaultTheme)\n\t}\n\n\t// Theme aliases. Use a map if there are more than 2 aliases in the future.\n\tif string(theme) == \"default\" {\n\t\t// Use the \"material\" theme by default for Markdown\n\t\ttheme = []byte(\"material\")\n\t}\n\n\t// Check if a specific string should be replaced with the current theme\n\treplaceWithTheme := kwmap[\"replace_with_theme\"]\n\tif len(replaceWithTheme) != 0 {\n\t\t// Replace all instances of the value given with \"replace_with_theme: ...\" with the current theme name\n\t\thtmlbody = bytes.ReplaceAll(htmlbody, replaceWithTheme, []byte(theme))\n\t}\n\n\t// If the theme is a filename, create a custom theme where the file is imported from the CSS\n\tif bytes.Contains(theme, []byte(\".\")) {\n\t\tst := string(theme)\n\t\tthemes.NewTheme(st, []byte(\"@import url(\"+st+\");\"), themes.DefaultCustomCodeStyle)\n\t}\n\n\tvar head strings.Builder\n\n\t// If a favicon is specified, use that\n\tfavicon := kwmap[\"favicon\"]\n\tif len(favicon) > 0 {\n\t\thead.WriteString(`<link rel=\"shortcut icon\" type=\"image/`)\n\t\t// Only support the most common mime formats for favicons\n\t\tswitch {\n\t\tcase bytes.HasSuffix(favicon, []byte(\".ico\")):\n\t\t\thead.WriteString(\"x-icon\")\n\t\tcase bytes.HasSuffix(favicon, []byte(\".bmp\")):\n\t\t\thead.WriteString(\"bmp\")\n\t\tcase bytes.HasSuffix(favicon, []byte(\".gif\")):\n\t\t\thead.WriteString(\"gif\")\n\t\tcase bytes.HasSuffix(favicon, []byte(\".jpg\")):\n\t\t\thead.WriteString(\"jpeg\")\n\t\tdefault:\n\t\t\thead.WriteString(\"png\")\n\t\t}\n\t\thead.WriteString(`\" href=\"`)\n\t\thead.Write(favicon)\n\t\thead.WriteString(`\"/>`)\n\t}\n\n\t// If style.gcss is present, use that style in <head>\n\tCSSFilename := filepath.Join(filepath.Dir(filename), themes.DefaultCSSFilename)\n\tGCSSFilename := filepath.Join(filepath.Dir(filename), themes.DefaultGCSSFilename)\n\tswitch {\n\tcase ac.fs.Exists(CSSFilename):\n\t\t// Link to stylesheet (without checking if the CSS file is valid first)\n\t\thead.WriteString(`<link href=\"`)\n\t\thead.WriteString(themes.DefaultCSSFilename)\n\t\thead.WriteString(`\" rel=\"stylesheet\" type=\"text/css\">`)\n\tcase ac.fs.Exists(GCSSFilename):\n\t\tif ac.debugMode {\n\t\t\tgcssblock, err := ac.cache.Read(GCSSFilename, ac.shouldCache(\".gcss\"))\n\t\t\tif err != nil {\n\t\t\t\tfmt.Fprintf(w, \"Unable to read %s: %s\", filename, err)\n\t\t\t\treturn\n\t\t\t}\n\t\t\tgcssdata := gcssblock.MustData()\n\n\t\t\t// Try compiling the GCSS file first\n\t\t\terrChan := make(chan error)\n\t\t\tgo ValidGCSS(gcssdata, errChan)\n\t\t\terr = <-errChan\n\t\t\tif err != nil {\n\t\t\t\t// Invalid GCSS, return an error page\n\t\t\t\tac.PrettyError(w, req, GCSSFilename, gcssdata, err.Error(), \"gcss\")\n\t\t\t\treturn\n\t\t\t}\n\t\t}\n\t\t// Link to stylesheet (without checking if the GCSS file is valid first)\n\t\thead.WriteString(`<link href=\"`)\n\t\thead.WriteString(themes.DefaultGCSSFilename)\n\t\thead.WriteString(`\" rel=\"stylesheet\" type=\"text/css\">`)\n\tdefault:\n\t\t// If not, use the theme by inserting the CSS style directly\n\t\thead.Write(themes.StyleHead(string(theme)))\n\t}\n\n\t// Additional CSS file\n\tadditionalCSSfile := string(kwmap[\"css\"])\n\tif additionalCSSfile != \"\" {\n\t\t// If serving a single Markdown file, include the CSS file inline in a style tag\n\t\tif ac.markdownMode && ac.fs.Exists(additionalCSSfile) {\n\t\t\t// Cache the CSS only if Markdown should be cached\n\t\t\tcssblock, err := ac.cache.Read(additionalCSSfile, ac.shouldCache(\".md\"))\n\t\t\tif err != nil {\n\t\t\t\tfmt.Fprintf(w, \"Unable to read %s: %s\", filename, err)\n\t\t\t\treturn\n\t\t\t}\n\t\t\tcssdata := cssblock.MustData()\n\t\t\thead.WriteString(\"<style>\" + string(cssdata) + \"</style>\")\n\t\t} else {\n\t\t\thead.WriteString(`<link href=\"`)\n\t\t\thead.WriteString(additionalCSSfile)\n\t\t\thead.WriteString(`\" rel=\"stylesheet\" type=\"text/css\">`)\n\t\t}\n\t}\n\n\tcodeStyle := string(kwmap[\"codestyle\"])\n\n\t// Add meta tags, if metadata information has been declared\n\tfor _, keyword := range themes.MetaKeywords {\n\t\tif len(kwmap[keyword]) != 0 {\n\t\t\t// Add the meta tag\n\t\t\thead.WriteString(`<meta name=\"`)\n\t\t\thead.WriteString(keyword)\n\t\t\thead.WriteString(`\" content=\"`)\n\t\t\thead.Write(kwmap[keyword])\n\t\t\thead.WriteString(`\" />`)\n\t\t}\n\t}\n\n\t// Embed the style and rendered markdown into a simple HTML 5 page\n\thtmldata := themes.SimpleHTMLPage(title, h1title, []byte(head.String()), htmlbody)\n\n\t// Add syntax highlighting to the header, but only if \"<pre\" is present\n\tif bytes.Contains(htmlbody, []byte(\"<pre\")) {\n\t\t// If codeStyle is not \"none\", highlight the current htmldata\n\t\tif codeStyle == \"\" {\n\t\t\t// Use the highlight style from the current theme\n\t\t\thighlighted, err := splash.UnescapeSplash(htmldata, themes.ThemeToCodeStyle(string(theme)))\n\t\t\tif err != nil {\n\t\t\t\tlog.Error(err)\n\t\t\t} else {\n\t\t\t\t// Only use the new and highlighted HTML if there were no errors\n\t\t\t\thtmldata = highlighted\n\t\t\t}\n\t\t} else if codeStyle != \"none\" {\n\t\t\t// Use the highlight style from codeStyle\n\t\t\thighlighted, err := splash.UnescapeSplash(htmldata, codeStyle)\n\t\t\tif err != nil {\n\t\t\t\tlog.Error(err)\n\t\t\t} else {\n\t\t\t\t// Only use the new HTML if there were no errors\n\t\t\t\thtmldata = highlighted\n\t\t\t}\n\t\t}\n\t}\n\n\t// If the auto-refresh feature has been enabled\n\tif ac.autoRefresh {\n\t\t// Insert JavaScript for refreshing the page into the generated HTML\n\t\thtmldata = ac.InsertAutoRefresh(req, htmldata)\n\t}\n\n\t// Write the rendered Markdown page to the client\n\tac.DataToClient(w, req, filename, htmldata)\n}", "title": "" }, { "docid": "ddc0b18742a896e52725b05506df375e", "score": "0.53327477", "text": "func RenderWiki(filename string, rawBytes []byte, urlPrefix string, metas map[string]string) string {\n\treturn string(renderFile(filename, rawBytes, urlPrefix, metas, true))\n}", "title": "" }, { "docid": "08a98a6784cb2b80c5ebd7b559fd6aca", "score": "0.520417", "text": "func parseMarkdown(markdown []byte) []byte {\n\tmarkdownString := string(markdown)\n\treWikiLink := regexp.MustCompile(\"\\\\[\\\\[(.*)]]\")\n\tmarkdownString = reWikiLink.ReplaceAllStringFunc(markdownString, convertWikiLink)\n\treturn blackfriday.Run([]byte(markdownString))\n}", "title": "" }, { "docid": "eeb4b0879c45deb7164c80177e8f8bf2", "score": "0.5148113", "text": "func processMarkdown(s string) string {\n\tparser := blackfriday.New(blackfriday.WithExtensions(blackfriday.CommonExtensions))\n\troot := parser.Parse([]byte(s))\n\tbuf := walkMarkdown(root, nil, 0)\n\treturn string(buf)\n}", "title": "" }, { "docid": "40b45a8f6bdb5a835c332c77b30029f8", "score": "0.5146911", "text": "func RenderWiki(rawBytes []byte, urlPrefix string, metas map[string]string) string {\n\treturn markup.RenderWiki(\"a.md\", rawBytes, urlPrefix, metas)\n}", "title": "" }, { "docid": "bbc0937effa118fa46dd85157070849c", "score": "0.5146334", "text": "func (p *HtmlStriper) ParseFile(filename string) {\n\t//fmt.Printf(\"Parsing %s...\\n\", filename)\n\t// create from a file\n\ts, err := ReadTextFile(filename)\n\tif err != nil {\n\t\tfmt.Printf(\"%v\\n\", err)\n\t\treturn\n\t}\n\n\tstripped := strip.StripTags(s)\n\tp.allLines = append(p.allLines, stripped)\n\t//WriteTextFile(filename+\".txt\", stripped)\n}", "title": "" }, { "docid": "c662ccde9329a4c539ae0a73ab2d4207", "score": "0.5126087", "text": "func visit(path string, f os.FileInfo, err error) error {\n\tif !f.IsDir() {\n\t\tif extRule.MatchString(path) {\n\t\t\tcontent, err := ioutil.ReadFile(path)\n\t\t\tif err != nil {\n\t\t\t\tlog.Fatal(\"I Can't read this file : \", path)\n\t\t\t}\n\t\t\t// Remove all HTML tags, simplify the content and calculate the hash\n\t\t\ta := article{Key:name2key(path), Path:path,\tSimHash:stopwords.Simhash(content, *langCode, true)}\n\t\t\tcache[a.Key] = a\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "e0851e40635814161455337135f7eee5", "score": "0.5027497", "text": "func sanitizeDesc(text string) string {\n\tif text == \"\" {\n\t\treturn text\n\t}\n\n\ts := strings.Replace(text, \"<br>\", \"\\n\", -1)\n\ts = strings.Replace(s, \"</br>\", \"\\n\", -1)\n\ts = strings.Replace(s, \"<p></p>\", \"\", -1)\n\ts = strings.Replace(s, \"<p>\", \"\", -1)\n\ts = strings.Replace(s, \"</p>\", \"\\n\", -1)\n\ts = strings.Replace(s, \"<ul>\", \"\\n\", -1)\n\ts = strings.Replace(s, \"</ul>\", \"\\n\", -1)\n\ts = strings.Replace(s, \"<li>\", \"• \", -1)\n\ts = strings.Replace(s, \"</li>\", \"\\n\", -1)\n\ts = strings.Replace(s, `<a id=\"field_detail\" name=\"field_detail\"></a>`, \"\", -1)\n\n\t// Remove a few common harmless entities, to arrive at something more like plain text\n\t// This relies on having removed *all* tags above\n\ts = strings.Replace(s, \"&nbsp;\", \" \", -1)\n\ts = strings.Replace(s, \"&quot;\", \"\\\"\", -1)\n\ts = strings.Replace(s, \"&apos;\", \"'\", -1)\n\ts = strings.Replace(s, \"&#34;\", \"\\\"\", -1)\n\ts = strings.Replace(s, \"&#39;\", \"'\", -1)\n\t// NB spaces here are significant - we only allow & not part of entity\n\ts = strings.Replace(s, \"&amp; \", \"& \", -1)\n\ts = strings.Replace(s, \"&amp;amp; \", \"& \", -1)\n\n\tb := bytes.NewBufferString(\"\")\n\n\t//Remove remaining tags\n\tinTag := false\n\tfor _, r := range s {\n\t\tswitch r {\n\t\tcase '<':\n\t\t\tinTag = true\n\t\tcase '>':\n\t\t\tinTag = false\n\t\tdefault:\n\t\t\tif !inTag {\n\t\t\t\tb.WriteRune(r)\n\t\t\t}\n\t\t}\n\t}\n\ts = b.String()\n\n\treturn s\n}", "title": "" }, { "docid": "5119574309aa2d1464c5057ba3fd1cde", "score": "0.4952393", "text": "func ProcessHTMLDocument(inputFilepath string, outputFilepath string, codeRoot string) {\n\tfile, err := os.Open(inputFilepath)\n\tif err != nil {\n\t\tlog.Fatal(\"Could not open HTML document: \", err)\n\t}\n\tdefer file.Close()\n\toutputFile, err := os.Create(outputFilepath)\n\n\tif err != nil {\n\t\tlog.Fatal(\"Could not create output file: \", err)\n\t}\n\tdefer outputFile.Close()\n\n\tscanner := bufio.NewScanner(file)\n\tsep := \"\"\n\tfor scanner.Scan() {\n\t\toutputFile.WriteString(sep + handleHTMLLine(scanner.Text(), codeRoot))\n\t\tsep = \"\\n\"\n\t}\n\tif err := scanner.Err(); err != nil {\n\t\tlog.Fatal(\"Could not scan HTML docuemnt: \", err)\n\t}\n}", "title": "" }, { "docid": "592f640886dae8ca79ea1013a8a49b9d", "score": "0.49268967", "text": "func convertHtml(content string, fileName string) {\n\tmd := (renderFile(content))\n\thtml := markdown.ToHTML(md, nil, nil)\n\twriteFile(html, fileName+\".html\")\n}", "title": "" }, { "docid": "4546685098b06e9a7cea38a8dc3d1be7", "score": "0.49241433", "text": "func processMarkdownNode(node *md.Node, entering bool, sourceDocument *document, taskChan chan<- task, workerNum int) md.WalkStatus {\n\n\t// Since this gets called twice, only execute on the entry event\n\tif entering == true {\n\t\tbbrepo := sourceDocument.getBBFile().GetBBRepo()\n\t\t// We only care about links and images\n\t\tif node.Type == md.Link || node.Type == md.Image {\n\n\t\t\t// Parse the reference so we can get the parts we need\n\t\t\t// If it can't be parsed, just continue\n\t\t\tlinkURL, err := url.Parse(string(node.LinkData.Destination))\n\t\t\tif err != nil {\n\t\t\t\tlog.Warnf(\"[worker:%03d] Unable to parse markdown reference %s\", workerNum, string(node.LinkData.Destination))\n\t\t\t\treturn md.GoToNext\n\t\t\t}\n\n\t\t\t// Determine what type of file we're dealing with and exit here if it's\n\t\t\t// not markdown or image\n\t\t\tvar docType docType\n\t\t\tif filepath.Ext(linkURL.Path) == \".md\" {\n\t\t\t\tdocType = markdownType\n\t\t\t} else if node.Type == md.Image {\n\t\t\t\tdocType = imageType\n\t\t\t} else {\n\t\t\t\treturn md.GoToNext\n\t\t\t}\n\n\t\t\t// Get our Bitbucket URL ready\n\t\t\tu, err := url.Parse(sourceDocument.getBBFile().GetBBRepo().GetBBProject().GetBBClient().BaseUrl.String())\n\t\t\tif err != nil {\n\t\t\t\tlog.Fatal(err)\n\t\t\t}\n\n\t\t\tlog.Infof(\"[worker:%03d] Found link:%s in [%s]%s\", workerNum, linkURL.String(), sourceDocument.getBBFile().GetBBRepo().GetName(), sourceDocument.getBBFile().GetFullPath())\n\t\t\tvar newBBFile bitbucket.BBFile\n\t\t\t// Continue only if reference is a relative link or from the same Bitbucket host\n\t\t\tif (linkURL.Host == u.Host || (linkURL.Scheme == \"\" && linkURL.Host == \"\")) && linkURL.Path != \"\" {\n\t\t\t\t// If our path starts with a /, we don't need to add the project/repo info\n\t\t\t\tif strings.HasPrefix(linkURL.Path, \"/\") {\n\t\t\t\t\t// Get rid of the leading slash\n\t\t\t\t\tbbf, err := bbrepo.GetFile(linkURL.Path)\n\t\t\t\t\tif err != nil {\n\t\t\t\t\t\tlog.Warnf(\"[worker:%03d] Found link:%s, But Got Error:%s\", workerNum, linkURL.String(), err)\n\t\t\t\t\t\treturn md.GoToNext\n\t\t\t\t\t}\n\t\t\t\t\tnewBBFile = bbf\n\t\t\t\t} else {\n\t\t\t\t\t// Path is relative, use the masterFilePath directory to generate\n\t\t\t\t\t// the master file path for the reference file\n\t\t\t\t\tsourcePath := filepath.Dir(sourceDocument.getBBFile().GetBasePath())\n\t\t\t\t\tfp := filepath.Join(sourcePath, linkURL.Path)\n\t\t\t\t\tbbf, err := bbrepo.GetFile(fp)\n\t\t\t\t\tif err != nil {\n\t\t\t\t\t\tlog.Warnf(\"[worker:%03d] Found2 link:%s, But Got Error:%s\", workerNum, linkURL.String(), err)\n\t\t\t\t\t\treturn md.GoToNext\n\t\t\t\t\t}\n\t\t\t\t\tnewBBFile = bbf\n\n\t\t\t\t}\n\t\t\t\tif newBBFile == nil {\n\t\t\t\t\treturn md.GoToNext\n\t\t\t\t}\n\t\t\t\t// Generate the document object for this file\n\t\t\t\tdocument := NewDocument(bbrepo.GetBBProject().GetKey(), bbrepo.GetSlug(), newBBFile.GetFullPath(), newBBFile)\n\t\t\t\tdocument.docType = docType\n\n\t\t\t\t// Check if the file is on the master list, if not, add it\n\t\t\t\tif _, ok := masterFileList.LoadOrStore(document.uid, document); !ok {\n\t\t\t\t\t// Create a task to process this file\n\t\t\t\t\ttask := fileTask{document: document, referencedBy: sourceDocument, file: newBBFile}\n\t\t\t\t\ttaskChan <- task\n\t\t\t\t} else {\n\t\t\t\t\tlog.Infof(\"[worker:%03d] Skipped, already processed link:%s\", workerNum, linkURL.String())\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\treturn md.GoToNext\n}", "title": "" }, { "docid": "9c89102bddb5d42516ab0fa97dc8d4fe", "score": "0.48825392", "text": "func ParseMDFile(r io.Reader, tPtr interface{}) error {\n\tpf, err := pageparser.ParseFrontMatterAndContent(r)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"error parsing front matter: %v\", err)\n\t}\n\tfm, err := yaml.Marshal(pf.FrontMatter)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"error marshaling yaml: %v\", err)\n\t}\n\terr = yaml.Unmarshal(fm, tPtr)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"erorr unmarshaling yaml: %v\", err)\n\t}\n\n\t// Set field value for markdown text depending on CVE or Researcher\n\tswitch t := tPtr.(type) {\n\tcase *CVE:\n\t\tt.Advisory = string(pf.Content)\n\tcase *Researcher:\n\t\tt.Bio = string(pf.Content)\n\tdefault:\n\t\treturn fmt.Errorf(\"unknown type: %+v\", tPtr)\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "0c6d630221f547c81df00c66bbf81c14", "score": "0.48750675", "text": "func markdownProcessor(input []byte, defaultProcessor func([]byte) ([]byte, error)) ([]byte, error) {\n\tinput = normalizeEOL(input)\n\tconfigType, frontMatterSrc, mdSrc := SplitFrontMatter(input)\n\t//NOTE: should inspect front matter for Markdown parsing configuration\n\tconfig, err := ProcessorConfig(configType, frontMatterSrc)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tif thing, ok := config[\"markup\"]; ok == true {\n\t\tmarkup := thing.(string)\n\t\tswitch markup {\n\t\tcase \"mmark\":\n\t\t\text, htmlFlags, err := ConfigMmark(config)\n\t\t\tif err != nil {\n\t\t\t\treturn nil, err\n\t\t\t}\n\t\t\tp := parser.NewWithExtensions(mparser.Extensions | ext)\n\t\t\tparserFlags := parser.FlagsNone\n\t\t\t// We're working as if we're getting data from stdin here ...\n\t\t\tinit := mparser.NewInitial(\"\")\n\t\t\tdocumentTitle := \"\" // hack to get document title from TOML title block and then set it here.\n\t\t\tp.Opts = parser.Options{\n\t\t\t\tParserHook: func(data []byte) (ast.Node, []byte, int) {\n\t\t\t\t\tnode, data, consumed := mparser.Hook(data)\n\t\t\t\t\tif t, ok := node.(*mast.Title); ok {\n\t\t\t\t\t\tif !t.IsTriggerDash() {\n\t\t\t\t\t\t\tdocumentTitle = t.TitleData.Title\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\treturn node, data, consumed\n\t\t\t\t},\n\t\t\t\tReadIncludeFn: init.ReadInclude,\n\t\t\t\tFlags: parserFlags,\n\t\t\t}\n\t\t\tdoc := markdown.Parse(mdSrc, p)\n\t\t\tmparser.AddBibliography(doc)\n\t\t\tmparser.AddIndex(doc)\n\n\t\t\tdocumentLanguage := \"\"\n\t\t\tmhtmlOpts := mhtml.RendererOptions{\n\t\t\t\tLanguage: lang.New(documentLanguage),\n\t\t\t}\n\n\t\t\topts := html.RendererOptions{\n\t\t\t\tComments: [][]byte{[]byte(\"//\"), []byte(\"#\")}, // used for callouts.\n\t\t\t\tRenderNodeHook: mhtmlOpts.RenderHook,\n\t\t\t\tFlags: htmlFlags,\n\t\t\t\tGenerator: ` <meta name=\"GENERATOR\" content=\"github.com/mmarkdown/mmark Mmark Markdown Processor - mmark.nl`,\n\t\t\t}\n\t\t\topts.Title = documentTitle // hack to add-in discovered title\n\t\t\trenderer := html.NewRenderer(opts)\n\t\t\treturn markdown.Render(doc, renderer), nil\n\t\tcase \"gomarkdown\":\n\t\t\text, htmlFlags, err := ConfigMarkdown(config)\n\t\t\tif err != nil {\n\t\t\t\treturn nil, err\n\t\t\t}\n\n\t\t\tp := parser.NewWithExtensions(ext)\n\t\t\topts := html.RendererOptions{Flags: htmlFlags}\n\t\t\tr := html.NewRenderer(opts)\n\t\t\treturn markdown.ToHTML(mdSrc, p, r), nil\n\t\tcase \"fountain\":\n\t\t\tif err := ConfigFountain(config); err != nil {\n\t\t\t\treturn nil, err\n\t\t\t}\n\t\t\tsrc, err := fountain.Run(mdSrc)\n\t\t\tif err != nil {\n\t\t\t\treturn nil, err\n\t\t\t}\n\t\t\treturn src, nil\n\t\tdefault:\n\t\t\treturn nil, fmt.Errorf(\"unknown markup engine\")\n\t\t}\n\t}\n\treturn defaultProcessor(mdSrc)\n}", "title": "" }, { "docid": "b91f6a631709a3eb4fd17bcc0077f250", "score": "0.48447508", "text": "func buildMD(input inputFile, templates map[string]*template.Template, dest string) error {\n\t// Read the Markdown file\n\tcontents, err := ioutil.ReadFile(input.source)\n\n\tif err != nil {\n\t\treturn fmt.Errorf(\"Could not read file %q: %v\", input.source, err)\n\t}\n\n\t// Render as HTML\n\thtml := blackfriday.Run(contents)\n\n\ttitle := getTitle(html)\n\n\t// Open the destination file for writing\n\toutFile, err := os.OpenFile(dest, os.O_WRONLY|os.O_CREATE, 0644)\n\n\tif err != nil {\n\t\treturn fmt.Errorf(\"Could not open for writing file %q: %v\", dest, err)\n\t}\n\n\tw := bufio.NewWriter(outFile)\n\n\t// Render the template and write it to the destination\n\ttemplates[input.template].Execute(w, templateInput{Content: string(html), Title: title})\n\n\terr = w.Flush()\n\n\tif err != nil {\n\t\treturn fmt.Errorf(\"Could not write to file %q: %v\", dest, err)\n\t}\n\n\terr = outFile.Close()\n\n\tif err != nil {\n\t\treturn fmt.Errorf(\"Could not close file %q: %v\", dest, err)\n\t}\n\n\tfmt.Printf(\"[BUILT] %q (%v)\\n\", dest, title)\n\n\treturn nil\n}", "title": "" }, { "docid": "b8260170b4dff43756bfe37daacd5f92", "score": "0.48327106", "text": "func ProcessFile(w io.Writer, path string, maxLength, tabWidth int,\n\texclude *regexp.Regexp) error {\n\tf, err := os.Open(path)\n\tif err != nil {\n\t\treturn err\n\t}\n\tdefer func() {\n\t\terr := f.Close()\n\t\tif err != nil {\n\t\t\tfmt.Printf(\"Error closing file: %s\\n\", err)\n\t\t}\n\t}()\n\n\treturn Process(f, w, path, maxLength, tabWidth, exclude)\n}", "title": "" }, { "docid": "5e77233fcdc54d92a0e0d24327bf758a", "score": "0.48020232", "text": "func convertMD(filename string, opts ...parser.ParseOption) bytes.Buffer {\n\td, err := ioutil.ReadFile(filename)\n\tif err != nil {\n\t\tlog.Fatalf(\"Read: cannot read README.md, err: %v\", err)\n\t}\n\n\tvar b bytes.Buffer\n\terr = md.Convert(d, &b, opts...)\n\tif err != nil {\n\t\tlog.Fatalf(\"Convert: cannot convert README from markdown to html, err: %v\", err)\n\t}\n\treturn b\n}", "title": "" }, { "docid": "8c2bf911f551c38256369940d4bea13c", "score": "0.47629836", "text": "func (d *Document) Process() {\n\tfor i := range d.sections {\n\t\td.sections[i].renderedCode = bytes.TrimSpace(highlight(d.src, d.sections[i].code))\n\t\td.sections[i].renderedComments = bytes.TrimSpace(formatComments(d.sections[i].comments))\n\t}\n}", "title": "" }, { "docid": "1f92a7d5a5d16767513ac2263f7fbc7b", "score": "0.47099292", "text": "func parseLesson(tmpl *template.Template, path string) ([]byte, error) {\n\tf, err := os.Open(path)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tdefer f.Close()\n\tdoc, err := present.Parse(prepContent(f), path, 0)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tlesson := Lesson{\n\t\tdoc.Title,\n\t\tdoc.Subtitle,\n\t\tmake([]Page, len(doc.Sections)),\n\t}\n\n\tfor i, sec := range doc.Sections {\n\t\tp := &lesson.Pages[i]\n\t\tw := new(bytes.Buffer)\n\t\tif err := sec.Render(w, tmpl); err != nil {\n\t\t\treturn nil, fmt.Errorf(\"render section: %v\", err)\n\t\t}\n\t\tp.Title = sec.Title\n\t\tp.Content = w.String()\n\t\tcodes := findPlayCode(sec)\n\t\tp.Files = make([]File, len(codes))\n\t\tfor i, c := range codes {\n\t\t\tf := &p.Files[i]\n\t\t\tf.Name = c.FileName\n\t\t\tf.Content = string(c.Raw)\n\t\t\thash := sha1.Sum(c.Raw)\n\t\t\tf.Hash = base64.StdEncoding.EncodeToString(hash[:])\n\t\t}\n\t}\n\n\tw := new(bytes.Buffer)\n\tif err := json.NewEncoder(w).Encode(lesson); err != nil {\n\t\treturn nil, fmt.Errorf(\"encode lesson: %v\", err)\n\t}\n\treturn w.Bytes(), nil\n}", "title": "" }, { "docid": "b9c5e8963297b25ffde0c95224251cfb", "score": "0.47052172", "text": "func ParseMD(filename string, hashDir string, htmlDir string) error {\n\tsrc, err := ioutil.ReadFile(filename)\n\tes := errutil.NewErrorStack(err)\n\n\tconfigString, mdString, err := split(string(src))\n\tes.Push(err)\n\n\tconfig, err := cfg.Load(configString)\n\tes.Push(err)\n\n\tif !config.Find(\"show\").Bool() {\n\t\treturn errors.New(\"no show\")\n\t}\n\n\tif !config.IsExist(\"tags\") {\n\t\tes.Push(errors.New(\"no tags\"))\n\t}\n\n\tif es.First() != nil {\n\t\treturn es.First()\n\t}\n\n\taid, err := getID(filename)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\terr = parseTag(config.Find(\"tags\").StringArray())\n\tes.Push(err)\n\n\tpost, err := parsePost(config)\n\tif err != nil {\n\t\treturn err\n\t}\n\tpost.ID = aid\n\tts := make([]Tag, 0)\n\tfor _, t := range config.Find(\"tags\").StringArray() {\n\t\ttag, err := findTag(t)\n\t\tif err != nil {\n\t\t\tcontinue\n\t\t}\n\t\tts = append(ts, tag)\n\t}\n\tpost.Tags = ts\n\tallPosts = append(allPosts, post)\n\n\tif isHashed(aid, mdString, hashDir) {\n\t\treturn nil\n\t}\n\n\terr = writeHash(aid, mdString, hashDir)\n\tes.Push(err)\n\n\terr = writeHTML(aid, mdString, htmlDir)\n\tes.Push(err)\n\n\treturn es.First()\n}", "title": "" }, { "docid": "3e0b4fbb9e3d3d3a413f28e534bd1ace", "score": "0.46644086", "text": "func readParseFile(filename string) (page Page) {\n\tPrintvln(\"Parsing File:\", filename)\n\tepoch, _ := time.Parse(\"20060102\", \"19700101\")\n\n\t// setup default page struct\n\tpage = Page{\n\t\tTitle: \"\", Category: \"\", SimpleCategory: \"\", Content: \"\", Layout: \"\", Date: epoch, OutFile: filename, Extension: \".html\",\n\t\tUrl: \"\", PrevUrl: \"\", PrevTitle: \"\", NextUrl: \"\", NextTitle: \"\",\n\t\tPrevCatUrl: \"\", PrevCatTitle: \"\", NextCatUrl: \"\", NextCatTitle: \"\",\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\tPrintErr(\"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\tPrintvln( \"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\tPrintvln( \"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\tPrintvln( \"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 := markdownRender([]byte(content))\n\t\tpage.Content = string(output)\n\t} else {\n\t\tpage.Content = content\n\t}\n\n\treturn page\n}", "title": "" }, { "docid": "fc322d1926937eef9c70187180011ec3", "score": "0.4658913", "text": "func isWikiFile(fileName string) bool {\n\treturn !strings.Contains(fileName, \".\")\n}", "title": "" }, { "docid": "0901074069f68c1c21f67a2f010c8b0d", "score": "0.46208525", "text": "func ParseFile(filename string) {\n\tcontent := ReadFile(filename)\n\tnews_lines := ExtractNewsLine(content)\n\tConnect(database_name, true)\n\tfor _, line := range news_lines {\n\t\tid := PostNews(line)\n\t\tfor _, trigram := range ngram.BuildNGram(line, 3) {\n\t\t\tPutTrigram(trigram, id)\n\t\t}\n\t}\n}", "title": "" }, { "docid": "a1452b7be0b592e6e83e7fee824c4218", "score": "0.45673442", "text": "func IsWikiArticle(path string, info os.FileInfo) bool {\n\trelp, err := filepath.Rel(Basepath, path)\n\tif err != nil {\n\t\treturn true // Always skip bad paths\n\t}\n\n\tswitch {\n\tcase info.IsDir():\n\t\treturn true\n\tcase filepath.Ext(info.Name()) != \".md\":\n\t\treturn true\n\tcase strings.HasPrefix(relp, \"templates\"):\n\t\treturn true\n\tcase strings.HasPrefix(relp, \"generated\"):\n\t\treturn true\n\tcase info.Name() == \"README.md\":\n\t\treturn true\n\t}\n\treturn false\n}", "title": "" }, { "docid": "129239c546db597d00d57403b07bd52b", "score": "0.4562233", "text": "func mdFileToHTML(filename string) (string, error) {\n\tbytes, err := ioutil.ReadFile(filename)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n if HTML, err := mdToHTML(bytes); err != nil {\n return \"\", err\n } else {\n return string(HTML), nil\n }\n}", "title": "" }, { "docid": "0a3a7e2063b17e44b113e5cd5f0b2311", "score": "0.45602843", "text": "func processFile(f *gocodewalker.File) ([]byte, error) {\n\tcontent := readFileContent(f)\n\n\tif len(content) == 0 {\n\t\tif Verbose {\n\t\t\tfmt.Printf(\"empty file so moving on %s\\n\", f.Location)\n\t\t}\n\t\treturn nil, errors.New(\"empty file so moving on\")\n\t}\n\n\t// Check if this file is binary by checking for nul byte and if so bail out\n\t// this is how GNU Grep, git and ripgrep binaryCheck for binary files\n\tif !IncludeBinaryFiles {\n\t\tisBinary := false\n\n\t\tbinaryCheck := content\n\t\tif len(binaryCheck) > 10_000 {\n\t\t\tbinaryCheck = content[:10_000]\n\t\t}\n\t\tif bytes.IndexByte(binaryCheck, 0) != -1 {\n\t\t\tisBinary = true\n\t\t}\n\n\t\tif isBinary {\n\t\t\tif Verbose {\n\t\t\t\tfmt.Printf(\"file determined to be binary so moving on %s\\n\", f.Location)\n\t\t\t}\n\t\t\treturn nil, errors.New(\"binary file\")\n\t\t}\n\t}\n\n\tif !IncludeMinified {\n\t\t// Check if this file is minified\n\t\t// Check if the file is minified and if so ignore it\n\t\tsplit := bytes.Split(content, []byte(\"\\n\"))\n\t\tsumLineLength := 0\n\t\tfor _, s := range split {\n\t\t\tsumLineLength += len(s)\n\t\t}\n\t\taverageLineLength := sumLineLength / len(split)\n\n\t\tif averageLineLength > MinifiedLineByteLength {\n\t\t\tif Verbose {\n\t\t\t\tfmt.Printf(\"file determined to be minified so moving on %s\", f.Location)\n\t\t\t}\n\t\t\treturn nil, errors.New(\"file determined to be minified\")\n\t\t}\n\t}\n\n\treturn content, nil\n}", "title": "" }, { "docid": "12be274404db7d4057d8075e57f3136d", "score": "0.4558372", "text": "func RenderFile(c *modulir.Context, source, target string) error {\n\tinData, err := os.ReadFile(source)\n\tif err != nil {\n\t\treturn xerrors.Errorf(\"error reading file: %w\", err)\n\t}\n\n\toutData := Render(c, inData)\n\n\terr = os.WriteFile(target, outData, 0o600)\n\tif err != nil {\n\t\treturn xerrors.Errorf(\"error writing file: %w\", err)\n\t}\n\n\tc.Log.Debugf(\"mmarkdown: Rendered '%s' to '%s'\", source, target)\n\treturn nil\n}", "title": "" }, { "docid": "b42c42374ebab11cd2641018c9579cc8", "score": "0.45321116", "text": "func processFile(filename string, info fs.FileInfo, in io.Reader, r *reporter) error {\n\tsrc, err := readFile(filename, info, in)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tfileSet := token.NewFileSet()\n\tfragmentOk := false\n\tif info == nil {\n\t\t// If we are formatting stdin, we accept a program fragment in lieu of a\n\t\t// complete source file.\n\t\tfragmentOk = true\n\t}\n\tfile, sourceAdj, indentAdj, err := parse(fileSet, filename, src, fragmentOk)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tif rewrite != nil {\n\t\tif sourceAdj == nil {\n\t\t\tfile = rewrite(fileSet, file)\n\t\t} else {\n\t\t\tr.Warnf(\"warning: rewrite ignored for incomplete programs\\n\")\n\t\t}\n\t}\n\n\tast.SortImports(fileSet, file)\n\n\tif *simplifyAST {\n\t\tsimplify(file)\n\t}\n\n\tres, err := format(fileSet, file, sourceAdj, indentAdj, src, printer.Config{Mode: printerMode, Tabwidth: tabWidth})\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tif !bytes.Equal(src, res) {\n\t\t// formatting has changed\n\t\tif *list {\n\t\t\tfmt.Fprintln(r, filename)\n\t\t}\n\t\tif *write {\n\t\t\tif info == nil {\n\t\t\t\tpanic(\"-w should not have been allowed with stdin\")\n\t\t\t}\n\t\t\t// make a temporary backup before overwriting original\n\t\t\tperm := info.Mode().Perm()\n\t\t\tbakname, err := backupFile(filename+\".\", src, perm)\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t\tfdSem <- true\n\t\t\terr = os.WriteFile(filename, res, perm)\n\t\t\t<-fdSem\n\t\t\tif err != nil {\n\t\t\t\tos.Rename(bakname, filename)\n\t\t\t\treturn err\n\t\t\t}\n\t\t\terr = os.Remove(bakname)\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t\tif *doDiff {\n\t\t\tdata, err := diffWithReplaceTempFile(src, res, filename)\n\t\t\tif err != nil {\n\t\t\t\treturn fmt.Errorf(\"computing diff: %s\", err)\n\t\t\t}\n\t\t\tfmt.Fprintf(r, \"diff -u %s %s\\n\", filepath.ToSlash(filename+\".orig\"), filepath.ToSlash(filename))\n\t\t\tr.Write(data)\n\t\t}\n\t}\n\n\tif !*list && !*write && !*doDiff {\n\t\t_, err = r.Write(res)\n\t}\n\n\treturn err\n}", "title": "" }, { "docid": "275a04b44032d13d73098946ec78c337", "score": "0.45304322", "text": "func ParseFile(name string, fn func(word string)) error {\n\tfile, err := os.Open(name)\n\tif err != nil {\n\t\treturn err\n\t}\n\tdefer file.Close()\n\n\ts := bufio.NewScanner(file)\n\tvar word string\n\tfor s.Scan() {\n\t\t// Normalize words to lowercase and only apply function to non empty words\n\t\tword = strings.ToLower(s.Text())\n\t\tif word != \"\" {\n\t\t\tfn(word)\n\t\t}\n\t}\n\treturn s.Err()\n}", "title": "" }, { "docid": "4f0d6431fe1746b279a90804525b6468", "score": "0.45301157", "text": "func SanitizeText(txt string) (newTxt string) {\n\tnewTxt = HTMLToText(txt)\n\tnewTxt = strings.Replace(newTxt, \"½\", \"1/2\", -1)\n\tnewTxt = strings.Replace(newTxt, \"\\\\\\\\\", \"\\\\\", -1)\n\tnewTxt = strings.Replace(newTxt, \"\\\\'\", \"'\", -1)\n\tnewTxt = strings.Replace(newTxt, `\\\"`, `\"`, -1)\n\treturn\n}", "title": "" }, { "docid": "9483db8a499e15f674894abd8f8f9109", "score": "0.44988447", "text": "func LoadWiki(source io.Reader, visitor func(*Article) bool) error {\n\t// Open an XML decoder over the file.\n\tdecoder := xml.NewDecoder(source)\n\n\tfor {\n\t\t// Get the next token.\n\t\ttok, tokErr := decoder.Token()\n\t\tif tok == nil {\n\t\t\treturn nil\n\t\t}\n\n\t\tif tokErr != nil {\n\t\t\treturn tokErr\n\t\t}\n\n\t\tswitch se := tok.(type) {\n\t\tcase xml.StartElement:\n\t\t\t// Element is a starting element\n\t\t\tif se.Name.Local == \"page\" {\n\t\t\t\tvar a Article\n\t\t\t\tdecoder.DecodeElement(&a, &se)\n\n\t\t\t\tshouldCont := visitor(&a)\n\n\t\t\t\tif !shouldCont {\n\t\t\t\t\treturn ErrStopped\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n}", "title": "" }, { "docid": "a1b4cda3ea30c3133c15301377f901e6", "score": "0.44940075", "text": "func generateHTML(infile string, outfile string, options int, title string, css string) (err error) {\n\tvar input []byte\n\t// Read the markdown file into a byte slice.\n\tif input, err = ioutil.ReadFile(infile); err != nil {\n\t\treturn err\n\t}\n\t// Create an object to do the rendering.\n\t// Pass it the contents of a title tag, and CSS\n\t// (which in this case isn't used)\n\trenderer := blackfriday.HtmlRenderer(options,\n\t\ttitle, css)\n\n\t// Read the markdown file from the byte slice named\n\t// input, render to HTML, and write\n\t// to a byte slice named output.\n\tvar output []byte\n\toutput = blackfriday.Markdown(input, renderer, 0)\n\n\t// Take the rendered HTML and open up a file object.\n\tvar out *os.File\n\tif out, err = os.Create(outfile); err != nil {\n\t\treturn err\n\t}\n\tdefer out.Close()\n\n\t// Take the generated byte slice in output and\n\t// create an HTML file.\n\tif _, err = out.Write(output); err != nil {\n\t\treturn err\n\t}\n\n\t// Success.\n\treturn nil\n}", "title": "" }, { "docid": "7c200c4d8ff6f9f0ee34d6c79561dfae", "score": "0.4491629", "text": "func Compile(dir, name string, draft bool, email bool) (*Passage, error) {\n\tinPath := path.Join(dir, name)\n\n\traw, err := ioutil.ReadFile(inPath)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tfrontmatter, content, err := sorg.SplitFrontmatter(string(raw))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tvar passage Passage\n\terr = yaml.Unmarshal([]byte(frontmatter), &passage)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tpassage.ContentRaw = content\n\tpassage.Draft = draft\n\tpassage.Slug = strings.Replace(name, \".md\", \"\", -1)\n\n\tslugParts := strings.Split(passage.Slug, \"-\")\n\tif len(slugParts) < 2 {\n\t\treturn nil, fmt.Errorf(\"Expected passage slug to contain issue number: %v\",\n\t\t\tpassage.Slug)\n\t}\n\tpassage.Issue = slugParts[0]\n\n\tif passage.Title == \"\" {\n\t\treturn nil, fmt.Errorf(\"No title for passage: %v\", inPath)\n\t}\n\n\tif passage.PublishedAt == nil {\n\t\treturn nil, fmt.Errorf(\"No publish date for passage: %v\", inPath)\n\t}\n\n\tpassage.Content = markdown.Render(content, &markdown.RenderOptions{\n\t\tAbsoluteURLs: email,\n\t\tNoFootnoteLinks: email,\n\t\tNoHeaderLinks: email,\n\t\tNoRetina: true,\n\t})\n\n\treturn &passage, nil\n}", "title": "" }, { "docid": "951867d32f00ce3768ccfa30c5dcfe89", "score": "0.44840133", "text": "func compileMarkdownToHTML(input []byte) []byte {\n\treturn bf2.Run(input, bf2.WithExtensions(bf2.CommonExtensions|\n\t\tbf2.AutoHeadingIDs))\n}", "title": "" }, { "docid": "ae518790462b17d56a24ec7a6f5375ba", "score": "0.4460858", "text": "func processFile(path string, options *config.BoilerplateOptions, variables map[string]interface{}) error {\n\tisText, err := util.IsTextFile(path)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tif isText {\n\t\treturn processTemplate(path, options, variables)\n\t} else {\n\t\treturn copyFile(path, options, variables)\n\t}\n}", "title": "" }, { "docid": "53e71c06e843ef811d17557cd7172270", "score": "0.44483045", "text": "func parse(inputHTML, outputPath string) error {\n\n\tdoc := strings.NewReader(inputHTML)\n\ttokenizer := html.NewTokenizer(doc)\n\tpdf := gofpdf.New(\"P\", \"mm\", \"Letter\", \"\")\n\tghfm.Setup(pdf)\n\n\tfor {\n\t\ttt := tokenizer.Next()\n\n\t\tif tt == html.ErrorToken {\n\t\t\tbreak // End of document\n\t\t}\n\n\t\tif tt == html.SelfClosingTagToken {\n\t\t\tT1 := tokenizer.Token()\n\n\t\t\tif T1.Data == \"hr\" {\n\t\t\t\tghfm.HR(pdf)\n\t\t\t}\n\t\t\tif T1.Data == \"br\" {\n\t\t\t\t// decide how to deal with these?\n\t\t\t}\n\t\t\tif T1.Data == \"img\" {\n\t\t\t\tparseImg(pdf, T1)\n\t\t\t}\n\t\t}\n\n\t\tif tt == html.StartTagToken {\n\t\t\tT1 := tokenizer.Token()\n\n\t\t\tif T1.Data == \"h1\" {\n\t\t\t\tparseH1(pdf, tokenizer)\n\t\t\t}\n\t\t\tif T1.Data == \"h2\" {\n\t\t\t\tparseH2(pdf, tokenizer)\n\t\t\t}\n\t\t\tif T1.Data == \"h3\" {\n\t\t\t\tparseH3(pdf, tokenizer)\n\t\t\t}\n\t\t\tif T1.Data == \"h4\" {\n\t\t\t\tparseH4(pdf, tokenizer)\n\t\t\t}\n\t\t\tif T1.Data == \"h5\" {\n\t\t\t\tparseH5(pdf, tokenizer)\n\t\t\t}\n\t\t\tif T1.Data == \"h6\" {\n\t\t\t\tparseH6(pdf, tokenizer)\n\t\t\t}\n\t\t\tif T1.Data == \"pre\" {\n\t\t\t\tparsePre(pdf, tokenizer)\n\t\t\t}\n\t\t\tif T1.Data == \"p\" {\n\t\t\t\tparseP(pdf, tokenizer)\n\t\t\t}\n\t\t\tif T1.Data == \"blockquote\" {\n\t\t\t\t// parseBlockquote(pdf, tokenizer)\n\t\t\t}\n\t\t\tif T1.Data == \"ol\" || T1.Data == \"ul\" {\n\t\t\t\t// parseList(pdf, tokenizer)\n\t\t\t}\n\t\t\tif T1.Data == \"dl\" {\n\t\t\t\t// Deal with definition lists?\n\t\t\t}\n\t\t\tif T1.Data == \"table\" {\n\t\t\t\t// parseTable(pdf, tokenizer)\n\t\t\t}\n\t\t}\n\t}\n\n\treturn pdf.OutputFileAndClose(outputPath)\n}", "title": "" }, { "docid": "be99c74781bfdb54c98731e8683438bd", "score": "0.44231772", "text": "func processFile(fileName string) error {\n\tfset := token.NewFileSet()\n\tvar err error\n\tnode, err := parser.ParseFile(fset, fileName, nil, parser.ParseComments)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tvar buf bytes.Buffer\n\tt, err := prepareTemplate()\n\tif err != nil {\n\t\treturn err\n\t}\n\n\terr = t.ExecuteTemplate(&buf, basicTemplateName, node.Name.Name)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"%s:%w\", ErrExecuteTemplate, err)\n\t}\n\n\t// first we need to collect info about non struct user defined types\n\texternalUserNonStructTypes := collectNonStructTypeInfo(node)\n\n\t// generate validation\n\tfor _, f := range node.Decls {\n\t\tg, ok := f.(*ast.GenDecl)\n\t\tif !ok {\n\t\t\tcontinue\n\t\t}\n\t\tfor _, spec := range g.Specs {\n\t\t\tcurrType, ok := spec.(*ast.TypeSpec)\n\t\t\tif !ok {\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tcurrStruct, ok := currType.Type.(*ast.StructType)\n\t\t\tif !ok {\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\terr := processStruct(&buf, t, currStruct, currType, externalUserNonStructTypes)\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\n\tresFileName := fmt.Sprintf(\"%s_%s\", strings.TrimSuffix(fileName, sourceFileExtension), basicFileNameSuffix)\n\n\terr = formatSourceAndWrite(resFileName, &buf)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"%s:%w\", ErrFormat, err)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "5852228e53f6a2365716397a6c264031", "score": "0.43977264", "text": "func renderToFilesystem(wg *sync.WaitGroup, errOutputCh chan error, data *renderData, doc *model.Document, live bool) {\n\t// only files that have been touched\n\tif !isNewer(doc.FullPath, doc.ModifiedAt) {\n\t\treturn\n\t}\n\trecordModified(doc.FullPath, doc.ModifiedAt)\n\n\twg.Add(1)\n\tgo func(p *model.Document) {\n\t\tdefer wg.Done()\n\n\t\toutputFilename := p.OutputFilename\n\t\t// save preprocessed markdown\n\t\terr := preprocessDoc(data, p, filepath.Join(\".\", \"output\", outputFilename+\".md\"))\n\t\tif err != nil {\n\t\t\terrOutputCh <- errors.Wrap(err, \"unable to preprocess\")\n\t\t\treturn\n\t\t}\n\n\t\tpandoc(outputFilename, errOutputCh)\n\n\t\t// remove preprocessed markdown\n\t\terr = os.Remove(filepath.Join(\".\", \"output\", outputFilename+\".md\"))\n\t\tif err != nil {\n\t\t\terrOutputCh <- err\n\t\t\treturn\n\t\t}\n\n\t\trel, err := filepath.Rel(config.ProjectRoot(), p.FullPath)\n\t\tif err != nil {\n\t\t\trel = p.FullPath\n\t\t}\n\t\tfmt.Printf(\"%s -> %s\\n\", rel, filepath.Join(\"output\", p.OutputFilename))\n\t}(doc)\n}", "title": "" }, { "docid": "a03c041399d1493cf2e0cb41534c93d0", "score": "0.4395286", "text": "func main() {\n\turl := flag.String(\"url\", DefaultURL, \"URL of the page you'd like to read\")\n\tfilepath := flag.String(\"file\", \"\", \"Optional filepath to output the page text\")\n\tflag.Parse()\n\n\ttext := makePlain(*url)\n\n\tif *filepath != \"\" {\n\t\tif err := ioutil.WriteFile(*filepath, []byte(text), 0666); err != nil {\n\t\t\tfmt.Printf(\"Failed to write text to '%s'\\n\", *filepath)\n\t\t\tlog.Error(err)\n\t\t} else {\n\t\t\tfmt.Printf(\"Text successfully written to '%s'\\n\", *filepath)\n\t\t}\n\t} else {\n\t\tfmt.Println(text)\n\t}\n}", "title": "" }, { "docid": "460f79a8ec213381b00bea70821693bc", "score": "0.4384115", "text": "func handleDoc(docPath string, absImgFolder string, steps []ImageMaintainStep) HandleResult {\n\thandleResult := HandleResult{DocPath: docPath}\n\t// get doc file content\n\tcontentBytes, err := os.ReadFile(docPath)\n\tif err != nil {\n\t\thandleResult.Err = fmt.Errorf(\"reading failed\\n%w\", err)\n\t\treturn handleResult\n\t}\n\n\thandleResult.AllRefImgs = base.NewSet(10) // To store reference image paths.\n\n\t// directly convert for saving memory\n\tcontent := *(*string)(unsafe.Pointer(&contentBytes))\n\n\t// line workflow\n\tfixedContent := imgTagRegexp.ReplaceAllStringFunc(content, func(wholeImgTag string) string {\n\t\tmatchParts := imgTagRegexp.FindStringSubmatch(wholeImgTag) // matchLine is whole image tag\n\t\timgTitle := matchParts[1] // tag title\n\t\timgPath := matchParts[2] // img path\n\t\timgProtocol := strings.ToLower(matchParts[3]) // protocol\n\n\t\timgTagInfo := &ImageTag{\n\t\t\tIsWebUrl: imgProtocol != \"\",\n\t\t\tProtocal: imgProtocol,\n\t\t\tWholeTag: wholeImgTag,\n\t\t\tImgTitle: imgTitle,\n\t\t\tDocPath: docPath,\n\t\t\tImgPath: imgPath,\n\t\t\tAbsImgFolder: absImgFolder,\n\t\t}\n\n\t\tfor _, handleStep := range steps {\n\t\t\thandleStep(imgTagInfo, &handleResult)\n\t\t}\n\n\t\treturn imgTagInfo.WholeTag\n\t})\n\n\thandleResult.HasChangeDuringWorkflow = fixedContent != content\n\n\tif !handleResult.HasChangeDuringWorkflow {\n\t\treturn handleResult\n\t}\n\n\t// Write fixed content to original path.\n\tif err = overrideExistFile(docPath, fixedContent); err != nil {\n\t\thandleResult.Err = fmt.Errorf(\"writing failed\\n%w\", err)\n\t\treturn handleResult\n\t}\n\n\treturn handleResult\n}", "title": "" }, { "docid": "bc457e66ab74217961e523ef2db3e7c0", "score": "0.43819785", "text": "func FormatTweetFactory(conf *Config) func(text string) template.HTML {\n\tisLocal := func(url string) bool {\n\t\tif NormalizeURL(url) == \"\" {\n\t\t\treturn false\n\t\t}\n\t\treturn strings.HasPrefix(NormalizeURL(url), NormalizeURL(conf.BaseURL))\n\t}\n\n\treturn func(text string) template.HTML {\n\t\trenderHookProcessURLs := func(w io.Writer, node ast.Node, entering bool) (ast.WalkStatus, bool) {\n\t\t\tspan, ok := node.(*ast.HTMLSpan)\n\t\t\tif !ok {\n\t\t\t\treturn ast.GoToNext, false\n\t\t\t}\n\n\t\t\tleaf := span.Leaf\n\t\t\tdoc, err := goquery.NewDocumentFromReader(bytes.NewReader(leaf.Literal))\n\t\t\tif err != nil {\n\t\t\t\tlog.WithError(err).Warn(\"error parsing HTMLSpan\")\n\t\t\t\treturn ast.GoToNext, false\n\t\t\t}\n\n\t\t\ta := doc.Find(\"a\")\n\t\t\thref, ok := a.Attr(\"href\")\n\t\t\tif !ok {\n\t\t\t\treturn ast.GoToNext, false\n\t\t\t}\n\n\t\t\tif isLocal(href) {\n\t\t\t\thref = UserURL(href)\n\t\t\t} else {\n\t\t\t\treturn ast.GoToNext, false\n\t\t\t}\n\n\t\t\thtml := fmt.Sprintf(`<a href=\"%s\">`, href)\n\n\t\t\tio.WriteString(w, html)\n\n\t\t\treturn ast.GoToNext, true\n\t\t}\n\n\t\thtmlFlags := html.CommonFlags | html.HrefTargetBlank\n\t\topts := html.RendererOptions{\n\t\t\tFlags: htmlFlags,\n\t\t\tRenderNodeHook: renderHookProcessURLs,\n\t\t}\n\t\trenderer := html.NewRenderer(opts)\n\n\t\tmd := []byte(FormatMentions(text))\n\t\tmaybeUnsafeHTML := markdown.ToHTML(md, nil, renderer)\n\t\tp := bluemonday.UGCPolicy()\n\t\tp.AllowAttrs(\"target\").OnElements(\"a\")\n\t\thtml := p.SanitizeBytes(maybeUnsafeHTML)\n\n\t\treturn template.HTML(html)\n\t}\n}", "title": "" }, { "docid": "59a43cc2f8f60c35f5016f87d8ddeb68", "score": "0.43745312", "text": "func (fs *UrlFileSystem) PublishFile(dir string, f *File, filter FileFilter) error {\n\tvar err error\n var rel string\n\n if rel, _, err = fs.FilterAndAssign(f, filter); err != nil {\n return err\n }\n\n if (rel == \"\") {\n return nil\n }\n\n\tout := filepath.Join(dir, rel)\n\n\tif f.page != nil {\n\t\tif _, err = f.page.Parse(f.source); err != nil {\n\t\t\treturn err\n\t\t}\n\t\tif err = f.page.Update(); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\n\tparent := out\n\tisDir := f.info.Mode().IsDir()\n\tif !isDir {\n\t\tparent = filepath.Dir(out)\n\t}\n\n\tif err = os.MkdirAll(parent, os.ModeDir | 0755); err != nil {\n\t\treturn err\n\t}\n\n\t// Write out the file data\n\tif !isDir {\n\t\tvar mode os.FileMode = 0644\n\t\tif f.info != nil {\n\t\t\tmode = f.info.Mode()\n\t\t}\n\t\tif err = ioutil.WriteFile(out, f.data, mode); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "4dcf257770bf6084055eaf23e0c1651b", "score": "0.43744773", "text": "func ProcessTemplate(project *Project, in string, out string) error {\n\t// Prepare the context object used for template evaluation:\n\tctx := new(Context)\n\tctx.project = project\n\n\t// Create the template and register the functions:\n\ttmpl := template.New(filepath.Base(in))\n\ttmpl.Funcs(template.FuncMap{\n\t\t\"tag\": func(name string) (string, error) {\n\t\t\treturn tagFunc(ctx, name)\n\t\t},\n\t})\n\n\t// Parse the template:\n\tlog.Debug(\"Loading template from file '%s'\", in)\n\t_, err := tmpl.ParseFiles(in)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// Create the file where the output of the template evaluation\n\t// will be written, and remember to close it:\n\tinfo, err := os.Stat(in)\n\tif err != nil {\n\t\treturn err\n\t}\n\tlog.Debug(\"Creating template result file '%s'\", out)\n\tfile, err := os.OpenFile(out, os.O_CREATE|os.O_WRONLY, info.Mode())\n\tif err != nil {\n\t\treturn err\n\t}\n\tdefer file.Close()\n\n\t// Evaluate the template:\n\treturn tmpl.Execute(file, ctx)\n}", "title": "" }, { "docid": "b85aa1411f270979943bb57ee31e5785", "score": "0.43702722", "text": "func main() {\n http.HandleFunc(\"/markdown\", GenerateMarkdown)\n http.Handle(\"/\", http.FileServer(http.Dir(\"public\"))) // Handle on / is catch all hence needs to be last handler\n http.ListenAndServe(\":8080\", nil)\n}", "title": "" }, { "docid": "44bd0e9e4e59c79f8971494d7e19c999", "score": "0.43674183", "text": "func WriteGitHubFlavoredMarkdownViaLocal(w io.Writer, markdown []byte, root string) (cleanup func()) {\n\tabsRoot, err := filepath.Abs(root)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\tpaths := createAssets(absRoot)\n\tio.WriteString(w, `<html><head><meta charset=\"utf-8\">`)\n\tfor _, link := range localCss {\n\t\tio.WriteString(w, styleLink(path.Clean(\"/\"+link)))\n\t}\n\tio.WriteString(w, `</head><body><article class=\"markdown-body entry-content\" style=\"padding: 30px;\">`)\n\tw.Write(github_flavored_markdown.Markdown(markdown))\n\tio.WriteString(w, `</article></body></html>`)\n\treturn func() {\n\t\tvar errors []error\n\t\tfor _, link := range paths {\n\t\t\terr := os.Remove(link)\n\t\t\tif err != nil {\n\t\t\t\terrors = append(errors, err)\n\t\t\t}\n\t\t}\n\t\tif len(errors) != 0 {\n\t\t\tpanic(errors)\n\t\t}\n\t}\n}", "title": "" }, { "docid": "b29f0a4f1f6503dba900503141e274ce", "score": "0.4359192", "text": "func (lex *Lex) processHTML(html string) {\n\tfragments := re.Split(html, -1)\n\tsubmatches := re.FindAllStringSubmatch(html, -1)\n\tfor i, frag := range fragments {\n\t\tlex.push(HTML, frag, frag, strings.Count(frag, \"\\n\"))\n\t\tif i < len(submatches) {\n\t\t\tsubmatch := submatches[i]\n\t\t\tif submatch[1] == \"file\" {\n\t\t\t\tlex.push(FILE_INCLUDE, submatch[2], submatch[2], strings.Count(submatch[0], \"\\n\"))\n\t\t\t} else {\n\t\t\t\tlex.push(VIRTUAL_INCLUDE, submatch[2], submatch[2], strings.Count(submatch[0], \"\\n\"))\n\t\t\t}\n\t\t}\n\t}\n}", "title": "" }, { "docid": "397cc6e4534becc2bb140b88d3f9dd0e", "score": "0.43498516", "text": "func updateWikiPage(doer *models.User, repo *models.Repository, oldWikiName, newWikiName, content, message string, isNew bool) (err error) {\n\tif err = nameAllowed(newWikiName); err != nil {\n\t\treturn err\n\t}\n\twikiWorkingPool.CheckIn(com.ToStr(repo.ID))\n\tdefer wikiWorkingPool.CheckOut(com.ToStr(repo.ID))\n\n\tif err = InitWiki(repo); err != nil {\n\t\treturn fmt.Errorf(\"InitWiki: %v\", err)\n\t}\n\n\thasMasterBranch := git.IsBranchExist(repo.WikiPath(), \"master\")\n\n\tbasePath, err := models.CreateTemporaryPath(\"update-wiki\")\n\tif err != nil {\n\t\treturn err\n\t}\n\tdefer func() {\n\t\tif err := models.RemoveTemporaryPath(basePath); err != nil {\n\t\t\tlog.Error(\"Merge: RemoveTemporaryPath: %s\", err)\n\t\t}\n\t}()\n\n\tcloneOpts := git.CloneRepoOptions{\n\t\tBare: true,\n\t\tShared: true,\n\t}\n\n\tif hasMasterBranch {\n\t\tcloneOpts.Branch = \"master\"\n\t}\n\n\tif err := git.Clone(repo.WikiPath(), basePath, cloneOpts); err != nil {\n\t\tlog.Error(\"Failed to clone repository: %s (%v)\", repo.FullName(), err)\n\t\treturn fmt.Errorf(\"Failed to clone repository: %s (%v)\", repo.FullName(), err)\n\t}\n\n\tgitRepo, err := git.OpenRepository(basePath)\n\tif err != nil {\n\t\tlog.Error(\"Unable to open temporary repository: %s (%v)\", basePath, err)\n\t\treturn fmt.Errorf(\"Failed to open new temporary repository in: %s %v\", basePath, err)\n\t}\n\tdefer gitRepo.Close()\n\n\tif hasMasterBranch {\n\t\tif err := gitRepo.ReadTreeToIndex(\"HEAD\"); err != nil {\n\t\t\tlog.Error(\"Unable to read HEAD tree to index in: %s %v\", basePath, err)\n\t\t\treturn fmt.Errorf(\"Unable to read HEAD tree to index in: %s %v\", basePath, err)\n\t\t}\n\t}\n\n\tnewWikiPath := NameToFilename(newWikiName)\n\tif isNew {\n\t\tfilesInIndex, err := gitRepo.LsFiles(newWikiPath)\n\t\tif err != nil {\n\t\t\tlog.Error(\"%v\", err)\n\t\t\treturn err\n\t\t}\n\t\tif util.IsStringInSlice(newWikiPath, filesInIndex) {\n\t\t\treturn models.ErrWikiAlreadyExist{\n\t\t\t\tTitle: newWikiPath,\n\t\t\t}\n\t\t}\n\t} else {\n\t\toldWikiPath := NameToFilename(oldWikiName)\n\t\tfilesInIndex, err := gitRepo.LsFiles(oldWikiPath)\n\t\tif err != nil {\n\t\t\tlog.Error(\"%v\", err)\n\t\t\treturn err\n\t\t}\n\n\t\tif util.IsStringInSlice(oldWikiPath, filesInIndex) {\n\t\t\terr := gitRepo.RemoveFilesFromIndex(oldWikiPath)\n\t\t\tif err != nil {\n\t\t\t\tlog.Error(\"%v\", err)\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\n\t// FIXME: The wiki doesn't have lfs support at present - if this changes need to check attributes here\n\n\tobjectHash, err := gitRepo.HashObject(strings.NewReader(content))\n\tif err != nil {\n\t\tlog.Error(\"%v\", err)\n\t\treturn err\n\t}\n\n\tif err := gitRepo.AddObjectToIndex(\"100644\", objectHash, newWikiPath); err != nil {\n\t\tlog.Error(\"%v\", err)\n\t\treturn err\n\t}\n\n\ttree, err := gitRepo.WriteTree()\n\tif err != nil {\n\t\tlog.Error(\"%v\", err)\n\t\treturn err\n\t}\n\n\tcommitTreeOpts := git.CommitTreeOpts{\n\t\tMessage: message,\n\t}\n\n\tcommitter := doer.NewGitSig()\n\n\tsign, signingKey, signer, _ := repo.SignWikiCommit(doer)\n\tif sign {\n\t\tcommitTreeOpts.KeyID = signingKey\n\t\tif repo.GetTrustModel() == models.CommitterTrustModel || repo.GetTrustModel() == models.CollaboratorCommitterTrustModel {\n\t\t\tcommitter = signer\n\t\t}\n\t} else {\n\t\tcommitTreeOpts.NoGPGSign = true\n\t}\n\tif hasMasterBranch {\n\t\tcommitTreeOpts.Parents = []string{\"HEAD\"}\n\t}\n\n\tcommitHash, err := gitRepo.CommitTree(doer.NewGitSig(), committer, tree, commitTreeOpts)\n\tif err != nil {\n\t\tlog.Error(\"%v\", err)\n\t\treturn err\n\t}\n\n\tif err := git.Push(basePath, git.PushOptions{\n\t\tRemote: \"origin\",\n\t\tBranch: fmt.Sprintf(\"%s:%s%s\", commitHash.String(), git.BranchPrefix, \"master\"),\n\t\tEnv: models.FullPushingEnvironment(\n\t\t\tdoer,\n\t\t\tdoer,\n\t\t\trepo,\n\t\t\trepo.Name+\".wiki\",\n\t\t\t0,\n\t\t),\n\t}); err != nil {\n\t\tlog.Error(\"%v\", err)\n\t\tif git.IsErrPushOutOfDate(err) || git.IsErrPushRejected(err) {\n\t\t\treturn err\n\t\t}\n\t\treturn fmt.Errorf(\"Push: %v\", err)\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "c6465c15ef379061db538ab5bb7ec214", "score": "0.4347219", "text": "func (t *Translator) ProcessFile(filename string) (err error) {\n\tbaseName := filename[:len(filename)-len(\".vgo\")]\n\tgoFile := baseName + \"_\" + t.goarch + \".go\"\n\tasmFile := baseName + \"_\" + t.goarch + \".s\"\n\n\t// Parse and preprocess.\n\tgoInput, err := parser.ParseFile(t.fset, filename, nil, parser.ParseComments)\n\tif err != nil {\n\t\treturn\n\t}\n\tast.Walk(t, goInput)\n\n\t// Write modified Go file\n\tgoF, err := os.Create(goFile)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"error creating %s: %s\", goFile, err)\n\t}\n\tprintconfig.Fprint(goF, t.fset, goInput)\n\terr = goF.Close()\n\tif err != nil {\n\t\treturn fmt.Errorf(\"error creating %s: %s\", goFile, err)\n\t}\n\n\t// Write assembly.\n\tasmBuf := new(bytes.Buffer)\n\tw := codeWriter{\n\t\tw: asmBuf,\n\t\tgoarch: t.goarch,\n\t\tgosubarch: t.gosubarch,\n\t\tarch: t.arch,\n\t}\n\tfor _, f := range t.funcs {\n\t\terr = w.CodeGen(f)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\terr = ioutil.WriteFile(asmFile, asmBuf.Bytes(), 0644)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"error creating %s: %s\", asmFile, err)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "d12556dcc406132602cac7e028047fde", "score": "0.43471006", "text": "func processDirContent(path string, info os.FileInfo, err error) error {\n\tif err != nil {\n\t\treturn err\n\t}\n\tif strings.ToLower(filepath.Ext(path)) == \".txt\" {\n\t\tif err := processDataContent(path); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "25247d5eabc13e27b15fbf973a4d91c0", "score": "0.43189964", "text": "func analyzeFile(path string, info os.FileInfo) {\n\tdefer wg.Done()\n\tif !info.IsDir() {\n\t\tfile, _ := os.Open(path)\n\t\thead := make([]byte, 261)\n\t\tfile.Read(head)\n\n\t\tif filetype.IsVideo(head) {\n\t\t\tsearchSubtitles(path, languages)\n\t\t}\n\t}\n}", "title": "" }, { "docid": "ee0e0d3520f732cefb41172a1668affb", "score": "0.43153167", "text": "func DeleteWikiPage(doer *models.User, repo *models.Repository, wikiName string) (err error) {\n\twikiWorkingPool.CheckIn(com.ToStr(repo.ID))\n\tdefer wikiWorkingPool.CheckOut(com.ToStr(repo.ID))\n\n\tif err = InitWiki(repo); err != nil {\n\t\treturn fmt.Errorf(\"InitWiki: %v\", err)\n\t}\n\n\tbasePath, err := models.CreateTemporaryPath(\"update-wiki\")\n\tif err != nil {\n\t\treturn err\n\t}\n\tdefer func() {\n\t\tif err := models.RemoveTemporaryPath(basePath); err != nil {\n\t\t\tlog.Error(\"Merge: RemoveTemporaryPath: %s\", err)\n\t\t}\n\t}()\n\n\tif err := git.Clone(repo.WikiPath(), basePath, git.CloneRepoOptions{\n\t\tBare: true,\n\t\tShared: true,\n\t\tBranch: \"master\",\n\t}); err != nil {\n\t\tlog.Error(\"Failed to clone repository: %s (%v)\", repo.FullName(), err)\n\t\treturn fmt.Errorf(\"Failed to clone repository: %s (%v)\", repo.FullName(), err)\n\t}\n\n\tgitRepo, err := git.OpenRepository(basePath)\n\tif err != nil {\n\t\tlog.Error(\"Unable to open temporary repository: %s (%v)\", basePath, err)\n\t\treturn fmt.Errorf(\"Failed to open new temporary repository in: %s %v\", basePath, err)\n\t}\n\tdefer gitRepo.Close()\n\n\tif err := gitRepo.ReadTreeToIndex(\"HEAD\"); err != nil {\n\t\tlog.Error(\"Unable to read HEAD tree to index in: %s %v\", basePath, err)\n\t\treturn fmt.Errorf(\"Unable to read HEAD tree to index in: %s %v\", basePath, err)\n\t}\n\n\twikiPath := NameToFilename(wikiName)\n\tfilesInIndex, err := gitRepo.LsFiles(wikiPath)\n\tfound := false\n\tfor _, file := range filesInIndex {\n\t\tif file == wikiPath {\n\t\t\tfound = true\n\t\t\tbreak\n\t\t}\n\t}\n\tif found {\n\t\terr := gitRepo.RemoveFilesFromIndex(wikiPath)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t} else {\n\t\treturn os.ErrNotExist\n\t}\n\n\t// FIXME: The wiki doesn't have lfs support at present - if this changes need to check attributes here\n\n\ttree, err := gitRepo.WriteTree()\n\tif err != nil {\n\t\treturn err\n\t}\n\tmessage := \"Delete page '\" + wikiName + \"'\"\n\tcommitTreeOpts := git.CommitTreeOpts{\n\t\tMessage: message,\n\t\tParents: []string{\"HEAD\"},\n\t}\n\n\tcommitter := doer.NewGitSig()\n\n\tsign, signingKey, signer, _ := repo.SignWikiCommit(doer)\n\tif sign {\n\t\tcommitTreeOpts.KeyID = signingKey\n\t\tif repo.GetTrustModel() == models.CommitterTrustModel || repo.GetTrustModel() == models.CollaboratorCommitterTrustModel {\n\t\t\tcommitter = signer\n\t\t}\n\t} else {\n\t\tcommitTreeOpts.NoGPGSign = true\n\t}\n\n\tcommitHash, err := gitRepo.CommitTree(doer.NewGitSig(), committer, tree, commitTreeOpts)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tif err := git.Push(basePath, git.PushOptions{\n\t\tRemote: \"origin\",\n\t\tBranch: fmt.Sprintf(\"%s:%s%s\", commitHash.String(), git.BranchPrefix, \"master\"),\n\t\tEnv: models.PushingEnvironment(doer, repo),\n\t}); err != nil {\n\t\tif git.IsErrPushOutOfDate(err) || git.IsErrPushRejected(err) {\n\t\t\treturn err\n\t\t}\n\t\treturn fmt.Errorf(\"Push: %v\", err)\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "f3eb747204ac1978a76c0f4c448de66e", "score": "0.43122423", "text": "func (s *Scraper) HandleFile(fileName string) {\n\tcfg, err := s.configParser.ReadConfigurationFile(fileName)\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\n\ts.session = session.NewSession(cfg)\n\n\twriter := epub.NewWriter(cfg)\n\tfor _, source := range cfg.Chapters {\n\t\tif source.Toc != nil {\n\t\t\tchapters := s.handleToc(source.Toc, cfg)\n\t\t\tfor _, chapter := range chapters {\n\t\t\t\twriter.AddChapter(chapter.title, chapter.content, chapter.addPrefix)\n\t\t\t}\n\t\t} else if source.Chapter != nil {\n\t\t\tchapter := s.extractChapterData(\n\t\t\t\tsource.Chapter.URL,\n\t\t\t\tcfg,\n\t\t\t\tsource.Chapter.SourceContent,\n\t\t\t)\n\t\t\tif chapter != nil {\n\t\t\t\twriter.AddChapter(chapter.title, chapter.content, chapter.addPrefix)\n\t\t\t}\n\t\t}\n\t}\n\t// finally save the generated epub to the file system\n\twriter.WriteEpub()\n\twriter.PolishEpub()\n}", "title": "" }, { "docid": "7b7fcb8f5694ef770da2110168dc2269", "score": "0.4296647", "text": "func (s *Slide) Process() {\n\ts.getMetadata()\n\ts.Source = faReplace(string(s.Source))\n\tlines := strings.Split(s.Source, \"\\n\")\n\ts.Source = \"\"\n\tfor _, line := range lines {\n\t\tline = fragment(line)\n\t\ts.Source = s.Source + line + \"\\n\"\n\t}\n}", "title": "" }, { "docid": "6996fad644a98ec97002da2f4a81aff7", "score": "0.42953873", "text": "func parseArticle(request articleParseRequest) (articleParseResponse, error) {\n\tmethodName := \"pkg.ParserArticle\"\n\n\ttag := \"\"\n\tenter := false\n\n\tarticle := \"\"\n\n\ttokenizer := html.NewTokenizer(strings.NewReader(request.ArticleHtmlDom))\n\tfor {\n\t\ttokenType := tokenizer.Next()\n\t\ttoken := tokenizer.Token()\n\n\t\terr := tokenizer.Err()\n\t\tif err == io.EOF {\n\t\t\tbreak\n\t\t}\n\n\t\tswitch tokenType {\n\t\tcase html.ErrorToken:\n\t\t\tpkg.LogError(methodName, \"Token error\", err)\n\n\t\tcase html.StartTagToken, html.SelfClosingTagToken:\n\t\t\tenter = false\n\t\t\ttagAttribute := token.Attr\n\t\t\ttag = token.Data\n\t\t\tfor _, textTag := range request.TextTagsToParse {\n\t\t\t\tif tag == textTag && !checkElementAttribute(request.WhitelistAttributeValues, tagAttribute) {\n\t\t\t\t\tenter = true\n\t\t\t\t\tbreak\n\t\t\t\t}\n\t\t\t}\n\n\t\tcase html.TextToken:\n\t\t\tif enter {\n\t\t\t\tdata := strings.TrimSpace(token.Data)\n\t\t\t\tif len(data) > 0 {\n\t\t\t\t\tarticle += fmt.Sprintf(\"%s\\n\", data)\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\treturn articleParseResponse{\n\t\tArticleText: article,\n\t}, nil\n}", "title": "" }, { "docid": "4582383fc6f21c0b9f6489bb0e52150c", "score": "0.42854887", "text": "func Sanitize(markdown string) string {\n\tresult := markdown\n\n\t// Preserve double spaces at the end of the line\n\tresult = regexp.MustCompile(` {2}(\\r?\\n)`).ReplaceAllString(result, \"‡‡$1\")\n\n\t// Remove trailing spaces from the end of lines\n\tresult = regexp.MustCompile(` +(\\r?\\n)`).ReplaceAllString(result, \"$1\")\n\tresult = regexp.MustCompile(` +$`).ReplaceAllLiteralString(result, \"\")\n\n\t// Preserve double spaces at the end of the line\n\tresult = regexp.MustCompile(`‡‡(\\r?\\n)`).ReplaceAllString(result, \" $1\")\n\n\t// Remove blank line with only double spaces in it\n\tresult = regexp.MustCompile(`(\\r?\\n) (\\r?\\n)`).ReplaceAllString(result, \"$1\")\n\n\t// Remove multiple consecutive blank lines\n\tresult = regexp.MustCompile(`(\\r?\\n){3,}`).ReplaceAllString(result, \"$1$1\")\n\tresult = regexp.MustCompile(`(\\r?\\n){2,}$`).ReplaceAllString(result, \"$1\")\n\n\treturn result\n}", "title": "" }, { "docid": "f49a141ec1db561285ec6114729d9ad5", "score": "0.4284202", "text": "func (p *MarkdownTileProcessing) Process(tile *dynatrace.Tile, defaultScore keptncommon.SLOScore, defaultComparison keptncommon.SLOComparison) (*keptncommon.SLOScore, *keptncommon.SLOComparison) {\n\t// we allow the user to use a markdown to specify SLI/SLO properties, e.g: KQG.Total.Pass\n\t// if we find KQG. we process the markdown\n\treturn parseMarkdownConfiguration(tile.Markdown, defaultScore, defaultComparison)\n}", "title": "" }, { "docid": "ab48d01ebcc9b9a51dfab165bd11dd7e", "score": "0.42832085", "text": "func parseFile(filename string) *template.Template {\n\treturn template.Must(template.ParseFiles(filename))\n}", "title": "" }, { "docid": "06b645c7d8b4b37bbab77674917392ff", "score": "0.42819852", "text": "func loadMarkDownPage(title string) (*Page, error) {\n body, err := readFile(paths.Static + title + \".md\")\n if err != nil {\n return nil, err\n }\n bodyHtml := template.HTML(blackfriday.MarkdownCommon(body))\n return &Page{Title: strings.Title(title), Body:bodyHtml}, nil\n}", "title": "" }, { "docid": "0619d506eb955cca235572cfc5454d65", "score": "0.42801297", "text": "func readWiki(wikiDecoder *xml.Decoder, movieEntries chan<- *wikiEntry) error {\n\tdefer close(movieEntries)\n\n\tvar entry *wikiEntry\n\tfor {\n\t\ttoken, err := wikiDecoder.Token()\n\t\tif err == io.EOF {\n\t\t\tbreak\n\t\t}\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"could not get next token: %v\", err)\n\t\t}\n\n\t\tswitch t := token.(type) {\n\t\tcase xml.StartElement:\n\t\t\tswitch t.Name.Local {\n\t\t\tcase tagDoc:\n\t\t\t\t// Start of a new Wikipedia entry\n\t\t\t\tif entry.isMovie() {\n\t\t\t\t\tmovieEntries <- entry\n\t\t\t\t}\n\t\t\t\tentry = &wikiEntry{}\n\t\t\tcase tagTitle:\n\t\t\t\tvar title string\n\t\t\t\tif err := wikiDecoder.DecodeElement(&title, &t); err != nil {\n\t\t\t\t\treturn fmt.Errorf(\"could not decode element: %v\", err)\n\t\t\t\t}\n\t\t\t\ttitle = strings.TrimPrefix(title, \"Wikipedia: \")\n\t\t\t\tentry.title = title\n\t\t\tcase tagURL:\n\t\t\t\tif err := wikiDecoder.DecodeElement(&entry.url, &t); err != nil {\n\t\t\t\t\treturn fmt.Errorf(\"could not decode element: %v\", err)\n\t\t\t\t}\n\t\t\tcase tagAbstract:\n\t\t\t\tif err := wikiDecoder.DecodeElement(&entry.abstract, &t); err != nil {\n\t\t\t\t\treturn fmt.Errorf(\"could not decode element: %v\", err)\n\t\t\t\t}\n\t\t\tcase tagAnchor:\n\t\t\t\tvar anchor string\n\t\t\t\tif err := wikiDecoder.DecodeElement(&anchor, &t); err != nil {\n\t\t\t\t\treturn fmt.Errorf(\"could not decode element: %v\", err)\n\t\t\t\t}\n\t\t\t\tentry.anchors = append(entry.anchors, normaliseString(anchor))\n\t\t\t}\n\t\t}\n\t}\n\n\tif entry != nil && entry.isMovie() {\n\t\tmovieEntries <- entry\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "e4ccc5ef09d55548f76e036509499232", "score": "0.4280071", "text": "func Process(t Template, wr io.Writer, fileNames ...string) error {\n\treturn Process2(t, wr, fileNames[0], fileNames...)\n}", "title": "" }, { "docid": "ecf9aab57d5e951a72ca35971e82467f", "score": "0.42639", "text": "func newDocument(contentfile string, site *site) (document, error) {\n\tparseError := func(err error) error {\n\t\treturn fmt.Errorf(\"\\\"%s\\\": %s\", contentfile, err.Error())\n\t}\n\tif !fsx.PathIsInDir(contentfile, site.contentDir) {\n\t\tpanic(\"document is outside content directory: \" + contentfile)\n\t}\n\tif !fsx.FileExists(contentfile) {\n\t\tpanic(\"missing document: \" + contentfile)\n\t}\n\tdoc := document{}\n\tdoc.contentPath = contentfile\n\tdoc.site = site\n\tinfo, err := os.Stat(contentfile)\n\tif err != nil {\n\t\treturn doc, parseError(err)\n\t}\n\tdoc.modtime = info.ModTime()\n\tdoc.conf = site.configFor(doc.contentPath)\n\t// Extract title and date from file name.\n\tvar d string\n\td, doc.title = extractDateTitle(contentfile)\n\tif d != \"\" {\n\t\tif doc.date, err = parseDate(d, doc.conf.timezone); err != nil {\n\t\t\treturn doc, parseError(err)\n\t\t}\n\t}\n\t// Parse embedded front matter.\n\tdoc.author = doc.conf.author // Default author.\n\tdoc.templates = doc.conf.templates // Default templates.\n\tdoc.permalink = doc.conf.permalink // Default permalink.\n\tdoc.content, err = fsx.ReadFile(doc.contentPath)\n\tif err != nil {\n\t\treturn doc, parseError(err)\n\t}\n\tif err := doc.extractFrontMatter(); err != nil {\n\t\treturn doc, parseError(fmt.Errorf(\"front matter: %s\", err.Error()))\n\t}\n\t// Synthesize template path, build path and URL from content path, permalink and slug values.\n\trel, _ := filepath.Rel(site.contentDir, doc.contentPath)\n\tdoc.templatePath = filepath.Join(site.templateDir, rel)\n\tf := filepath.Base(rel)\n\tswitch filepath.Ext(f) {\n\tcase \".md\", \".rmu\":\n\t\tf = fsx.ReplaceExt(f, \".html\")\n\t}\n\tif doc.slug != \"\" {\n\t\tf = doc.slug + filepath.Ext(f)\n\t}\n\tif doc.permalink != \"\" {\n\t\tlink := doc.permalink\n\t\tlink = strings.Replace(link, \"%y\", doc.date.Format(\"2006\"), -1)\n\t\tlink = strings.Replace(link, \"%m\", doc.date.Format(\"01\"), -1)\n\t\tlink = strings.Replace(link, \"%d\", doc.date.Format(\"02\"), -1)\n\t\tlink = strings.Replace(link, \"%f\", f, -1)\n\t\tlink = strings.Replace(link, \"%p\", fsx.FileName(f), -1)\n\t\tlink = strings.TrimPrefix(link, \"/\")\n\t\tif strings.HasSuffix(link, \"/\") {\n\t\t\t// \"Pretty\" URLs.\n\t\t\tdoc.buildPath = filepath.Join(site.buildDir, filepath.FromSlash(link), \"index.html\")\n\t\t\tdoc.url = rootRelURL(link) + \"/\"\n\t\t} else {\n\t\t\tdoc.buildPath = filepath.Join(site.buildDir, filepath.FromSlash(link))\n\t\t\tdoc.url = rootRelURL(link)\n\t\t}\n\t} else {\n\t\tdoc.buildPath = filepath.Join(site.buildDir, filepath.Dir(rel), f)\n\t\tdoc.url = rootRelURL(path.Dir(filepath.ToSlash(rel)), f)\n\t}\n\tif doc.layout == \"\" {\n\t\t// Find nearest document layout template file.\n\t\tlayout := \"\"\n\t\tfor _, l := range site.htmlTemplates.layouts {\n\t\t\tif len(l) > len(layout) && fsx.PathIsInDir(doc.templatePath, filepath.Dir(l)) {\n\t\t\t\tlayout = l\n\t\t\t}\n\t\t}\n\t\tif layout == \"\" {\n\t\t\treturn doc, parseError(fmt.Errorf(\"missing layout.html template\"))\n\t\t}\n\t\tdoc.layout = site.htmlTemplates.name(layout)\n\t}\n\tswitch doc.conf.id {\n\tcase \"optional\":\n\tcase \"mandatory\":\n\t\tif doc.id == nil || *doc.id == \"\" {\n\t\t\treturn doc, parseError(fmt.Errorf(\"missing mandatory document id\"))\n\t\t}\n\tcase \"urlpath\":\n\t\tif doc.id == nil {\n\t\t\ts := strings.TrimPrefix(doc.url, doc.site.urlprefix())\n\t\t\tdoc.id = &s\n\t\t}\n\tdefault:\n\t\tpanic(\"illegal doc.conf.id for :\" + doc.contentPath + \": \" + doc.conf.id)\n\t}\n\tif !cleanURLPath(doc.url) {\n\t\tdoc.site.logWarning(\"\\\"%s\\\": unhygienic document URL path: \\\"%s\\\"\", contentfile, doc.url) // Non-fatal error.\n\t\tdoc.url = encodeURL(doc.url)\n\t}\n\treturn doc, nil\n}", "title": "" }, { "docid": "caa484f188d02f5f56a1fdfcbfa9ab94", "score": "0.42623332", "text": "func (p *Post) ReadMarkdown(filename string) error {\n\tmarkdownBytes, err := ioutil.ReadFile(filename)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tfrontMatter, err := parseFrontmatter(&markdownBytes)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tif title, ok := frontMatter[\"title\"]; ok {\n\t\tp.Title = title.(string)\n\t} else {\n\t\treturn fmt.Errorf(\"could not read the title from post\")\n\t}\n\n\tif date, ok := frontMatter[\"date\"]; ok {\n\t\tif p.Date, err = time.Parse(\"2006-01-02\", date.(string)); err != nil {\n\t\t\treturn err\n\t\t}\n\t} else {\n\t\treturn fmt.Errorf(\"could not read the date from post\")\n\t}\n\n\tp.Body = template.HTML(blackfriday.MarkdownCommon([]byte(markdownBytes)))\n\tp.RelativeLink = \"/posts/\" + strings.TrimSuffix(filepath.Base(filename), \".md\") + \".html\"\n\n\tif canonicalLink, ok := frontMatter[\"canonical\"]; ok {\n\t\tp.CanonicalLink = canonicalLink.(string)\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "40da05ffa7f287bce78a23a3de1cf3b9", "score": "0.42537415", "text": "func (site *site) renderStaticFile(f string) error {\n\t// Parse document.\n\tdoc, err := newDocument(f, site)\n\tif err != nil {\n\t\treturn err\n\t}\n\t// Render document markup as a text template.\n\tsite.verbose2(\"render static: \" + doc.contentPath)\n\tsite.verbose2(doc.String())\n\tmarkup := doc.content\n\tif isTemplate(doc.contentPath, doc.templates) {\n\t\tdata := doc.frontMatter()\n\t\tmarkup, err = site.textTemplates.renderText(\"staticFile\", markup, data)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\tsite.verbose(\"write static: \" + doc.buildPath)\n\terr = mkMissingDir(filepath.Dir(doc.buildPath))\n\tif err != nil {\n\t\treturn err\n\t}\n\treturn writeFile(doc.buildPath, markup)\n}", "title": "" }, { "docid": "a56a86e2072ecaf4af9bef3b340ede4d", "score": "0.42448005", "text": "func mainHandler(w http.ResponseWriter, r *http.Request,store *cayley.Handle){\n\n\tt, error := template.ParseFiles(\"website/templates/index.html\")\n\n\tif error != nil {\n\t\tfmt.Println(\"error:\", error)\n\t\tfmt.Println(\"HTML TEMPLATE WAS NOT FOUND. Check if the html file is present.\")\n\n\t}\n\t\n\tpath := cayley.StartPath(store, \"Article\").\n\t\tIn().\n\t\tTag(\"link\").\n\t\tSave(\"has_image\", \"image\").\n\t\tSave(\"has_title\",\"title\").\n\t\tSave(\"has_description\",\"description\")\n\n\tit := path.BuildIterator()\n\tit, _ = it.Optimize()\n\t\n\tarticleList:= make([]Article, 0)\n\n\tfor graph.Next(it) {\n\t\ttags := make(map[string]graph.Value)\n\t\tit.TagResults(tags)\n\n\t\tarticleList=append(articleList,Article{\n\t\t\tstore.NameOf(tags[\"title\"]),\n\t\t\tstore.NameOf(tags[\"description\"]),\n\t\t\tstore.NameOf(tags[\"link\"]),\n\t\t\tstore.NameOf(tags[\"image\"]),\n\t\t})\n\n\t}\n\n\ttype PageContent struct {\n\t\tArticles []Article\t\n\t}\n\n\tt.Execute(w, PageContent{articleList})\n}", "title": "" }, { "docid": "0dddc6d9fb7c02c67a20a11464b4995e", "score": "0.4242457", "text": "func PublishFile(dst, src, problemName string) error {\n\tin, err := os.Open(src)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tresult, err := io.ReadAll(in)\n\tresult_str := strings.ReplaceAll(string(result), \"YYYY\", problemName)\n\n\tdefer in.Close()\n\n\t// 사전에 디렉토리를 생성해야함\n\tout, err := os.Create(dst)\n\tif err != nil {\n\t\treturn err\n\t}\n\tdefer out.Close()\n\n\t// clear then\n\tout.Truncate(0)\n\t// write\n\tout.WriteString(\n\t\tresult_str,\n\t)\n\n\treturn nil\n}", "title": "" }, { "docid": "90091b9bed185a3a6a7b2a782f01b4b4", "score": "0.42409933", "text": "func writeHTML(aid string, md string, htmlDir string) error {\n\tfile := path.Join(htmlDir, aid)\n\terr := ioutil.WriteFile(file, markdown.ToHTML([]byte(md), nil, nil), 0o755)\n\treturn err\n}", "title": "" }, { "docid": "22daf29d2f211bd9b4572c7ca39decf2", "score": "0.4237011", "text": "func buildWikipediaLink(attrs map[string]string) template.HTML {\n\twikipediaRoot := \"https://en.wikipedia.org\"\n\tlinkTemplate := \"<a href='%s' title='%s' target='_blank'>\"\n\treturn template.HTML(\n\t\tfmt.Sprintf(linkTemplate, wikipediaRoot + attrs[\"href\"], attrs[\"title\"]))\n}", "title": "" }, { "docid": "4243386c35433eef50a78d155324ded3", "score": "0.42310292", "text": "func ParseResearcherMDFile(reader io.Reader) (researcher Researcher, err error) {\n\tpf, err := pageparser.ParseFrontMatterAndContent(reader)\n\tif err != nil {\n\t\treturn researcher, err\n\t}\n\tfm, err := yaml.Marshal(pf.FrontMatter)\n\tif err != nil {\n\t\treturn researcher, err\n\t}\n\terr = yaml.Unmarshal(fm, &researcher)\n\tif err != nil {\n\t\treturn researcher, err\n\t}\n\tresearcher.Bio = string(pf.Content)\n\treturn\n}", "title": "" }, { "docid": "37312feadeb3bed7a26291fa71261c74", "score": "0.42291927", "text": "func makePlain(url string) string {\n\tresponse, err := loadPage(url)\n\tif err != nil {\n\t\tlog.Error(err)\n\t}\n\n\ttext, err := extractText(response)\n\tif err != nil {\n\t\tlog.Error(err)\n\t}\n\n\treturn text\n}", "title": "" }, { "docid": "6ddf13f45b182be1cf213964a45655c1", "score": "0.42224854", "text": "func (d *Document) Compile(dir string) (err error) {\n\td.Content, err = ioutil.ReadFile(d.FullPath)\n\n\tvar buf bytes.Buffer\n\terr = goldmark.Convert(d.Content, &buf)\n\n\td.Content = buf.Bytes()\n\td.Content = CompileTemplate(d.FileInfo.Name(), d.Content)\n\n\tpath, err := filepath.Rel(dir, d.FullPath)\n\tfolder := strings.Split(path, string(filepath.Separator))[0]\n\tsubDir := folder\n\n\tif folder == \"pages\" {\n\t\tsubDir = \"\"\n\t}\n\n\treturn d.WriteFile(dir, subDir)\n}", "title": "" }, { "docid": "ac5c94f3b53aadf2b96d0c8d9b674d54", "score": "0.4213775", "text": "func ProcessFile(fileInput string, regexPattern string) error {\r\n\tfile, err := os.Open(fileInput)\r\n\tif err != nil {\r\n\t\treturn errors.Wrap(err, \"Failed to open file\")\r\n\t}\r\n\tdefer file.Close()\r\n\r\n\tscanner := bufio.NewScanner(file)\r\n\treg := regexp.MustCompile(regexPattern)\r\n\tif err := scanner.Err(); err != nil {\r\n\t\treturn errors.Wrap(err, \"Failed to compile regex\")\r\n\t}\r\n\t// Read the file line for line\r\n\tfor scanner.Scan() {\r\n\t\tvar match = reg.FindStringSubmatch(scanner.Text())\r\n\t\tif len(match) != 3 {\r\n\t\t\treturn errors.Wrap(errors.New(\"Regular Expression - error\"), \"Regular Expression should contain two groups the first identifying the IP Address, and the second identifying the URL\")\r\n\t\t}\r\n\t\taddMap(IPmap, match[1])\r\n\t\taddMap(URLmap, match[2])\r\n\t\tSuccessful++\r\n\t}\r\n\tif err := scanner.Err(); err != nil {\r\n\t\treturn errors.Wrap(err, \"Failed to process file\")\r\n\t}\r\n\treturn err\r\n}", "title": "" }, { "docid": "8857e2b9663636f1f12e19c229b360a6", "score": "0.42096794", "text": "func ProcessDomain(name string) (*Publisher, error) {\n\tvar domain = name\n\tif !strings.Contains(name, \"/ads.txt\") {\n\t\tdomain = fmt.Sprintf(\"%s/ads.txt\", name)\n\t}\n\tvar resp = &http.Response{}\n\tresp, err := http.Get(fmt.Sprintf(\"http://%s\", domain))\n\tif err != nil || resp.StatusCode == http.StatusNotFound {\n\t\tresp, err = http.Get(fmt.Sprintf(\"https://%s\", domain))\n\t\tif err != nil || resp.StatusCode == http.StatusNotFound {\n\t\t\treturn nil, fmt.Errorf(\"ads.txt not found\")\n\t\t}\n\t}\n\tdefer resp.Body.Close()\n\treturn parseAdsTxt(name, resp.Body)\n}", "title": "" }, { "docid": "d1b6266a6334b42be2699a8b68a8b67c", "score": "0.42030764", "text": "func mmarkProcessor(fName string, input []byte) ([]byte, error) {\n\tconfigType, frontMatterSrc, mmarkSrc := SplitFrontMatter(input)\n\t//NOTE: should inspect front matter for Markdown parsing configuration\n\tconfig, err := ProcessorConfig(configType, frontMatterSrc)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\text, htmlFlags, err := ConfigMmark(config)\n\t// Used when processing XML versus man or HTML output.\n\tparserFlags := parser.FlagsNone\n\tp := parser.NewWithExtensions(mparser.Extensions | ext)\n\tinit := mparser.NewInitial(fName)\n\tdocumentTitle := \"\" // hack to get document title from TOML title block and then set it here.\n\tp.Opts = parser.Options{\n\t\tParserHook: func(data []byte) (ast.Node, []byte, int) {\n\t\t\tnode, data, consumed := mparser.Hook(data)\n\t\t\tif t, ok := node.(*mast.Title); ok {\n\t\t\t\tif !t.IsTriggerDash() {\n\t\t\t\t\tdocumentTitle = t.TitleData.Title\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn node, data, consumed\n\t\t},\n\t\tReadIncludeFn: init.ReadInclude,\n\t\tFlags: parserFlags,\n\t}\n\n\tdoc := markdown.Parse(mmarkSrc, p)\n\tmparser.AddBibliography(doc)\n\tmparser.AddIndex(doc)\n\n\tdocumentLanguage := \"\"\n\tmhtmlOpts := mhtml.RendererOptions{\n\t\tLanguage: lang.New(documentLanguage),\n\t}\n\n\topts := html.RendererOptions{\n\t\tComments: [][]byte{[]byte(\"//\"), []byte(\"#\")}, // used for callouts.\n\t\tRenderNodeHook: mhtmlOpts.RenderHook,\n\t\tFlags: htmlFlags, //html.CommonFlags | html.FootnoteNoHRTag | html.FootnoteReturnLinks | html.CompletePage,\n\t\tGenerator: ` <meta name=\"GENERATOR\" content=\"github.com/caltechylibrary/mkpage using Mmark/gomarkdown processor`,\n\t}\n\topts.Title = documentTitle // hack to add-in discovered title\n\n\trenderer := html.NewRenderer(opts)\n\tout := markdown.Render(doc, renderer)\n\treturn out, nil\n}", "title": "" }, { "docid": "b8b3507342c83c26cf8a2dc24b52d0e5", "score": "0.4202742", "text": "func handleFile(w http.ResponseWriter, r *http.Request) {\n\t// Strip the leading \"/public/\" from the requested path\n\trequestedFile := r.URL.Path[len(\"/public/\"):]\n\t// Serve the file if it's valid, otherwise send an error message\n\tif isValidFile(requestedFile) {\n\t\thttp.ServeFile(w, r, cfg.FilePath+\"/\"+requestedFile)\n\t} else {\n\t\thttp.NotFound(w, r)\n\t}\n}", "title": "" }, { "docid": "c0bef4b4044714f0622ce4cc17d8bdb9", "score": "0.42020205", "text": "func (l *linkProcessor) ProcessLink(link string) {\n\t// Convert link to URL object\n\turl, err := url.ParseRequestURI(link)\n\n\t// Validate URL\n\tif err != nil {\n\t\tutils.ReplyError(l.bot, l.msg, fmt.Sprintf(\"I couldn't parse the [%v] link.\", link))\n\t\treturn\n\t}\n\n\t// Validate HOST in the URL (only instagram.com is allowed)\n\tif url.Host != \"instagram.com\" && url.Host != \"www.instagram.com\" {\n\t\tutils.ReplyError(l.bot, l.msg, fmt.Sprintf(\"I can only process links from [instagram.com] not [%v].\", url.Host))\n\t\treturn\n\t}\n\n\t// Extract shortcode\n\tshortcode, err := instagram.ExtractShortcodeFromLink(url.Path)\n\tif err != nil {\n\t\tutils.ReplyError(l.bot, l.msg, err.Error())\n\t\treturn\n\t}\n\n\tlog.WithFields(log.Fields{\n\t\t\"chat_id\": l.msg.Sender.ID,\n\t\t\"shortcode\": shortcode,\n\t}).Infof(\"Processing link\")\n\n\t// Process fetching the shortcode from Instagram\n\tresponse, err := instagram.GetPostWithCode(shortcode)\n\tif err != nil {\n\t\tutils.ReplyError(l.bot, l.msg, err.Error())\n\t\treturn\n\t}\n\n\tmediaSender := MediaSender{\n\t\tbot: l.bot,\n\t\tmsg: l.msg,\n\t\tmedia: response,\n\t}\n\tmediaSender.Send()\n}", "title": "" }, { "docid": "e150b6255583ebd5a7f70d1b899b9877", "score": "0.41852835", "text": "func MarkdownWriter(listing string, filename string) (err error) {\n\toutFile := GetOutFile(filename + \".md\")\n\terr = ioutil.WriteFile(outFile, []byte(listing), 0644)\n\treturn\n}", "title": "" }, { "docid": "ff6900457f10f626570f1937dacff3fb", "score": "0.41841954", "text": "func (dc *markdownConverter) processTextRunInTableCell(out *bytes.Buffer, t *docs.TextRun) error {\n\t// unfortunately markdown only supports at most one of italic, bold,\n\t// or strikethrough for any one bit of text\n\tif t.TextStyle.Italic {\n\t\tlog.Println(\"warning: ignoring italics in table cell\")\n\t}\n\tif t.TextStyle.Bold {\n\t\tlog.Println(\"warning: ignoring bold text in table cell\")\n\t}\n\tif t.TextStyle.Strikethrough {\n\t\tlog.Println(\"warning: ignoring strikethrough in table cell\")\n\t}\n\tif googledoc.IsMonospace(t.TextStyle.WeightedFontFamily) {\n\t\tlog.Println(\"warning: ignoring monospace in table cell\")\n\t}\n\n\t// the following features are not supported at all in markdown\n\tif t.TextStyle.SmallCaps {\n\t\tlog.Printf(\"warning: ignoring smallcaps on %q\", t.Content)\n\t}\n\tif t.TextStyle.BackgroundColor != nil {\n\t\tlog.Printf(\"warning: ignoring background color on %q\", t.Content)\n\t}\n\tif t.TextStyle.ForegroundColor != nil && t.TextStyle.Link == nil {\n\t\tlog.Printf(\"warning: ignoring foreground color on %q\", t.Content)\n\t}\n\tif t.TextStyle.Underline && t.TextStyle.Link == nil {\n\t\tlog.Printf(\"warning: ignoring underlining on %q\", t.Content)\n\t}\n\n\tswitch t.TextStyle.BaselineOffset {\n\tcase \"SUBSCRIPT\":\n\t\tlog.Println(\"warning: ignoring subscript\")\n\tcase \"SUPERSCRIPT\":\n\t\tlog.Println(\"warning: ignoring superscript\")\n\t}\n\n\t// replace unicode quote characters with ordinary quote characters\n\tcontent := t.Content\n\tcontent = strings.ReplaceAll(content, `“`, `\"`)\n\tcontent = strings.ReplaceAll(content, `”`, `\"`)\n\n\t// in markdown we can only have single lines of text in each table cell\n\tif strings.Contains(content, \"\\n\") {\n\t\tlog.Println(\"warning: stripping newlines from content in table cell\")\n\t\tcontent = strings.ReplaceAll(content, \"\\n\", \" \")\n\t}\n\n\t// write the beginning of a link in form [...TEXT...](...URL...)\n\tif t.TextStyle.Link == nil {\n\t\tfmt.Fprint(out, content)\n\t} else {\n\t\tfmt.Fprintf(out, \"[%s](%s)\", content, t.TextStyle.Link.Url)\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "09d0b82958254d268f70d530bbe36bf1", "score": "0.41834337", "text": "func processFile(filePath string) {\r\n\t/**********************\r\n\tGet pwd, write unabbreviated here\r\n\t**********************/\r\n\tpwd, err := os.Getwd()\r\n if err != nil {\r\n fmt.Println(err)\r\n os.Exit(1)\r\n }\r\n\t\r\n /**********************\r\n\tRead file with scanner\r\n\t**********************/\r\n\treadLine(pwd+\"/\"+filePath)\r\n\t\r\n}", "title": "" }, { "docid": "a750cb8ad71d5437ebe1225f1bf93a9d", "score": "0.41757688", "text": "func parseJekyllList() {\n\tstart := time.Now()\n\tlog.Println(\"Analyzing a list of Jekyll posts...\")\n\n\t// open input file\n\tfi, err := os.Open(*jekyll)\n\tif err != nil {\n\t\t\tpanic(err)\n\t}\n\tdefer func() {\n\t\t\tif err := fi.Close(); err != nil {\n\t\t\t\t\tpanic(err)\n\t\t\t}\n\t}()\n\tr := csv.NewReader(fi)\n\n\tfor {\n\t\trecord, err := r.Read()\n\t\tif err == io.EOF {\n\t\t\tbreak\n\t\t}\n\t\tif err != nil {\n\t\t\tlog.Fatal(err)\n\t\t}\n\t\tcontent, err := ioutil.ReadFile(record[1])\n\t\tif err != nil {\n\t\t\tlog.Fatal(\"I Can't read this file : \", record[1])\n\t\t}\n\t\ta := article{Key:name2key(record[1]),\n\t\t\t Path:record[1],\tSimHash:stopwords.Simhash(content, *langCode, true),\n\t\t\t URL:record[0],\n\t\t\t Title: record[2],\n\t\t\t Description: record[3],\n\t\t Thumbnail: record[4]}\n\t\tcache[a.Key] = a\n\t}\n\t//Sort the list of articles\n\tcompareFiles()\n\n\t//Create a collection of posts easily usable with Jekyll Liquid tags\n\tvar jekyllPosts []post\n\tfor _, articlePost := range cache {\n\t\t\taPost := post {URL:articlePost.URL,Title:articlePost.Title,\n\t\t\t\tDescription:articlePost.Description,\n\t\t\t\tThumbnail:articlePost.Thumbnail}\n\t\t\tfor _, articleRelated := range articlePost.Related {\n\t\t\t\t\taRelatedPost := post {URL:articleRelated.URL,Title:articleRelated.Title,\n\t\t\t\t\t\tDescription:articleRelated.Description,\n\t\t\t\t\t\tThumbnail:articleRelated.Thumbnail}\n\t\t\t\t\taPost.Related = append(aPost.Related, aRelatedPost)\n\t\t\t}\n\t\t\tjekyllPosts = append(jekyllPosts, aPost)\n\t}\n\n\tb, err := json.Marshal(jekyllPosts)\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\tvar out bytes.Buffer\n\tjson.Indent(&out, b, \"\", \"\\t\")\n\n\t// open output file\n\tfo, err := os.Create(filepath.Join(exePath, \"posts.json\"))\n\tif err != nil {\n\t\t\tpanic(err)\n\t}\n\tdefer func() {\n\t\t\tif err := fo.Close(); err != nil {\n\t\t\t\t\tpanic(err)\n\t\t\t}\n\t}()\n\tout.WriteTo(fo)\n\tlog.Println(\"Total time : \", time.Since(start))\n}", "title": "" }, { "docid": "6d47aa5a25c6a97eaf97de793e6ffa5e", "score": "0.41746503", "text": "func (p *Post) Read(filename string, body []byte) error {\n\tvar title string\n\tvar draft bool\n\tvar short bool\n\tvar date time.Time\n\tvar err error\n\n\tfrontmatter, err := parseFrontmatter(&body)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tif v, ok := frontmatter[\"title\"]; ok {\n\t\ttitle = v.(string)\n\t} else {\n\t\treturn fmt.Errorf(\"could not read the title from post\")\n\t}\n\n\tif v, ok := frontmatter[\"draft\"]; ok {\n\t\tdraft = v.(bool)\n\t}\n\n\tif v, ok := frontmatter[\"short\"]; ok {\n\t\tshort = v.(bool)\n\t}\n\n\tif v, ok := frontmatter[\"date\"]; ok {\n\t\tif date, err = time.Parse(shortTimeFormat, v.(string)); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\tvar descBuf, titleBuf bytes.Buffer\n\tvar desc = body\n\tif len(desc) > 200 {\n\t\tdesc = desc[:200]\n\t}\n\txml.EscapeText(&descBuf, bytes.Trim(desc, \" \\n\\r\"))\n\txml.EscapeText(&titleBuf, []byte(title))\n\n\tp.Slug = strings.TrimSuffix(filepath.Base(filename), \".md\")\n\tp.OutputFilename = path.Join(\"post\", p.Slug+\".html\")\n\tp.Body = string(blackfriday.MarkdownOptions(body, renderer, blackfriday.Options{Extensions: commonExtensions}))\n\tp.Title = title\n\tp.Date = date\n\tp.Link = strings.TrimSuffix(p.Index.URL, \"/\") + \"/\" + path.Join(\"post\", p.Slug)\n\tp.RelativeLink = path.Join(\"post\", p.Slug)\n\tp.XMLDesc = descBuf.String()\n\tp.XMLTitle = titleBuf.String()\n\tp.Draft = draft\n\tp.Short = short\n\n\treturn nil\n}", "title": "" }, { "docid": "959aba5f5de489e9379a04a28d96215f", "score": "0.41685525", "text": "func convertWikiLink(link string) string {\n\ttitle := link[2 : len(link)-2]\n\treturn fmt.Sprintf(\"[%s](../%s/)\", title, generateURLPathFromTitle(title))\n}", "title": "" }, { "docid": "b0ac21ff970fc9a138ebef596ba5e095", "score": "0.41673774", "text": "func Process(siteRoot, templatePath string, writer *bufio.Writer) error {\n // Parse the template to obtain code sections and static sections.\n err := parse(siteRoot, templatePath)\n if err != nil {\n message := fmt.Sprintf(\"Template parsing error in %s: %s\\n\",\n templatePath, err)\n fmt.Fprint(os.Stderr, message)\n writer.WriteString(message)\n return err\n }\n\n // Discard whitespace sections before the first code section.\n for len(sections) != 0 {\n section := sections[0]\n if section.Kind == Code {\n break\n }\n text := strings.TrimSpace(section.Text)\n if len(text) != 0 {\n break\n }\n sections = sections[1:]\n }\n\n // Discard whitespace sections after the last code section.\n for len(sections) != 0 {\n section := sections[len(sections)-1]\n if section.Kind == Code {\n break\n }\n text := strings.TrimSpace(section.Text)\n if len(text) != 0 {\n break\n }\n sections = sections[:len(sections)-1]\n }\n\n // Take care of initial and final whitespace within the code sections.\n // Find the first and last code sections.\n codeLeft, codeRight := -1, -1\n for i, section := range sections {\n if section.Kind == Code {\n codeLeft = i\n break\n }\n }\n for i := len(sections)-1; i >= 0; i-- {\n if sections[i].Kind == Code {\n codeRight = i\n break\n }\n }\n // Between these code sections, left-trim the initial static sections and\n // right-trim the final static sections.\n for i := codeLeft+1; i < codeRight; i++ {\n if sections[i].Kind == Static {\n sections[i].Text = strings.TrimLeftFunc(sections[i].Text,\n unicode.IsSpace)\n if len(sections[i].Text) != 0 { // Continue trimming until the\n break // resulting section is non-empty. \n }\n }\n }\n for i := codeRight-1; i > codeLeft; i-- {\n if sections[i].Kind == Static {\n sections[i].Text = strings.TrimRightFunc(sections[i].Text,\n unicode.IsSpace)\n if len(sections[i].Text) != 0 { // Continue trimming until non-empty.\n // Add a newline to the final static section.\n sections[i].Text += \"\\n\"\n break\n }\n }\n }\n\n // Concatenate consecutive static sections if desired.\n if MergeStaticText {\n newSections := []*Section{}\n n := len(sections)\n for pos := 0; pos < n; pos++ {\n section := sections[pos]\n if section.Kind == Code || pos+1 == n || sections[pos+1].Kind == Code {\n newSections = append(newSections, section)\n continue\n }\n substrings := []string{}\n var seek int\n for seek = pos; seek < n && sections[seek].Kind == Static; seek++ {\n substrings = append(substrings, sections[seek].Text)\n }\n section.Text = strings.Join(substrings, \"\")\n newSections = append(newSections, section)\n pos = seek-1\n }\n sections = newSections\n }\n\n // Discard code and static sections that consist entirely of whitespace.\n newSections := []*Section{}\n for _, section := range sections {\n trimmed := strings.TrimFunc(section.Text, unicode.IsSpace)\n if len(trimmed) != 0 {\n newSections = append(newSections, section)\n }\n }\n sections = newSections\n\n // Concatenate only the code sections. We're not adding print statements yet\n // because we don't know what the print command is going to look like. We\n // do want to parse the user's code in order to scan the imports.\n output := bytes.Buffer{}\n for _, section := range sections {\n if section.Kind == Code {\n fmt.Fprint(&output, section.Text)\n fmt.Fprint(&output, \"\\n\") // Ensure that statements are separated.\n }\n }\n fileSet := token.NewFileSet()\n file, err := parser.ParseFile(fileSet, \"output\", output.Bytes(),\n parser.ParseComments)\n if err != nil {\n message := fmt.Sprintf(\"Error parsing code sections: %s\\n\", err)\n fmt.Fprint(os.Stderr, message)\n writer.WriteString(fmt.Sprintf(\"%s\\n---\\n%s\", output.Bytes(), message))\n return err\n }\n\n // seekPath is the import path of the package containing the print command.\n seekPath := \"github.com/michaellaszlo/boomerang/runtime\" \n seekName := path.Base(seekPath)\n printCall := \"WriteString\"\n\n // Has the desired package been imported? Is the name available?\n isImported := false\n var importedAs string // Use this if the path has been imported.\n seenName := map[string]bool{} // Consult this if we have to import.\n\n for _, importSpec := range file.Imports {\n importPath, _ := strconv.Unquote(importSpec.Path.Value)\n var importName string\n if importSpec.Name == nil {\n importName = path.Base(importPath)\n } else {\n importName = importSpec.Name.Name\n }\n seenName[importName] = true // NB: underscore imports only run a package.\n if !isImported && importPath == seekPath && importName != \"_\" {\n isImported = true // If the package is imported several times,\n importedAs = importName // we use the name in the first occurrence.\n }\n }\n\n var importAs, printPrefix string // NB: these are \"\" by default\n if isImported {\n if importedAs != \".\" { // No prefix is needed with a dot import.\n printPrefix = importedAs+\".\"\n }\n } else {\n if !seenName[seekName] {\n importAs = seekName\n } else { // Look for a name that hasn't been used yet.\n for i := 0; ; i++ {\n importAs = fmt.Sprintf(\"%s_%d\", seekName, i)\n _, found := seenName[importAs]\n if !found {\n break\n }\n }\n }\n printPrefix = importAs+\".\"\n }\n\n // Concatenate the code with static sections wrapped in print statements.\n output.Reset()\n for _, section := range sections {\n if section.Kind == Code {\n fmt.Fprint(&output, section.Text)\n fmt.Fprint(&output, \"\\n\") // Ensure that statements are separated.\n } else {\n pieces := makeRawStrings(section.Text)\n for _, piece := range pieces {\n s := fmt.Sprintf(\";%s%s(%s);\", printPrefix, printCall, piece)\n fmt.Fprintf(&output, s)\n }\n }\n }\n // Have Go parse the whole output in preparation for import injection\n // and formatted code output.\n fileSet = token.NewFileSet()\n file, err = parser.ParseFile(fileSet, \"output\", output.Bytes(),\n parser.ParseComments)\n if err != nil {\n message := fmt.Sprintf(\"Error parsing template output: %s\\n\", err)\n fmt.Fprint(os.Stderr, message)\n writer.WriteString(fmt.Sprintf(\"%s\\n---\\n%s\", output.Bytes(), message))\n return err\n }\n // Inject an import statement if necessary.\n if !isImported {\n if importAs == seekName { // Make 'import \"fmt\"', not 'import fmt \"fmt\"'.\n astutil.AddImport(fileSet, file, seekPath)\n } else { // AddNamedImport would make 'import fmt \"fmt\"'.\n astutil.AddNamedImport(fileSet, file, importAs, seekPath)\n }\n }\n\n // Look for the main function among the top-level declarations.\n for _, decl := range file.Decls {\n funcDecl, hasType := decl.(*ast.FuncDecl)\n if hasType {\n funcName := funcDecl.Name.Name\n if funcName == \"main\" {\n // Build a new statement: defer runtime.PrintCGI()\n statement := &ast.DeferStmt{\n Call: &ast.CallExpr {\n Fun: &ast.SelectorExpr {\n X: ast.NewIdent(\"runtime\"),\n Sel: ast.NewIdent(\"PrintCGI\"),\n },\n },\n }\n // Insert the new statement at the head of func main()\n oldStatements := funcDecl.Body.List\n newStatements := []ast.Stmt{ statement }\n funcDecl.Body.List = append(newStatements, oldStatements...)\n }\n }\n }\n\n // Print with a custom configuration: soft tabs of two spaces each.\n config := printer.Config{ Mode: printer.UseSpaces, Tabwidth: 2 }\n (&config).Fprint(writer, fileSet, file)\n return nil\n}", "title": "" }, { "docid": "ca191c978f7267e01edfea106e445b24", "score": "0.4163081", "text": "func parsePage(url string) (title, link string) {\n\tdoc, err := http.Get(url)\n\n\tif err != nil {\n\t\tlog.Println(err)\n\t\treturn \"SERVER ERROR\", \"/wiki/SERVER_ERROR\"\n\t}\n\n\tpage, err := html.Parse(doc.Body)\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\n\ttitle = findTitle(page)\n\n\tcontentNode := findContentNode(page)\n\tif contentNode == nil {\n\t\tfmt.Println(\"not found\")\n\t\treturn title, \"\"\n\t}\n\n\tlink = findFirstLink(contentNode)\n\tif *showOutput {\n\t\turl := doc.Request.URL\n\t\tfmt.Println(url)\n\t\tfmt.Printf(\" title: %s \\n link: %s\\n\", title, link)\n\t}\n\n\treturn title, link\n}", "title": "" }, { "docid": "ae69aef6196f48a04fd61acc4ba00ee4", "score": "0.41542494", "text": "func ReadHtmlFile(name string) []byte {\n\tdata, err := ioutil.ReadFile(name)\n\tif err != nil {\n\t\tpanic(0)\n\t}\n\treturn data\n}", "title": "" }, { "docid": "ae69aef6196f48a04fd61acc4ba00ee4", "score": "0.41542494", "text": "func ReadHtmlFile(name string) []byte {\n\tdata, err := ioutil.ReadFile(name)\n\tif err != nil {\n\t\tpanic(0)\n\t}\n\treturn data\n}", "title": "" }, { "docid": "e3e6320b28b875eb504980a7dbe546bc", "score": "0.41486132", "text": "func GenerateMarkdown(rw http.ResponseWriter, r *http.Request) {\n markdown := blackfriday.MarkdownCommon([]byte(r.FormValue(\"body\")))\n rw.Write(markdown)\n}", "title": "" }, { "docid": "495592ae6292d8000cfc77f243c808dc", "score": "0.4142013", "text": "func HTMLFile() fs.File {\n\treturn Default.HTMLFile()\n}", "title": "" }, { "docid": "8897fa84bc48ca1aeec54ea81198e5ef", "score": "0.4141116", "text": "func GenerateArticlePage(w http.ResponseWriter, r *http.Request) {\n\tvar page ArticleNew\n\ttype ArticleID struct {\n\t\tID string `json:\"id\"`\n\t}\n\tvar id ArticleID\n\tw.Header().Set(\"Content-Type\", \"application/json\")\n\tjson.NewDecoder(r.Body).Decode(&id)\n\tdb := db.Driver()\n\tres := db.Table(\"articles\").Select(\"articles.article_id, articles.creation_date, articles.category, articles.title, articles.post, articles.comment, categories.id, categories.category_name\").Joins(\"left join categories on categories.id = articles.category\").Where(\"articles.article_id=?\", id.ID).Scan(&page)\n\ttotalRows := res.RowsAffected\n\ttmp := page.Post\n\tmd := []byte(tmp)\n\thtml := blackfriday.MarkdownCommon(md)\n\tpage.Content = template.HTML(html)\n\thandleDB(db)\n\tjson.NewEncoder(w).Encode(MessageResult{Message: \"OK\", Data: page, Total: totalRows})\n}", "title": "" }, { "docid": "9c5eb96ba0397d61b04e70e4323872b9", "score": "0.4141001", "text": "func (project *project) preprocess_file(data []byte) []byte {\n\tsdata := string(data)\n\n\t// Replace imports\n\tsdata = strings.Replace(sdata, \"malware/\", project.Srcid+\"/\", -1)\n\n\tsdata = strings.Replace(sdata, \"_C2_IP_\", project.Ip, -1)\n\tsdata = strings.Replace(sdata, \"_C2_PORT_\", strconv.Itoa(project.Port), -1)\n\tsdata = strings.Replace(sdata, \"_NETWORK_TYPE_\", project.NetworkModule, -1)\n\n\tmodules_create := \"\"\n\tmodules_import := \"\"\n\tfor _, module := range project.Modules {\n\t\tmodules_create += module + \".Create(),\\n\"\n\t\tmodules_import += \"\\\"\" + project.Srcid + \"/implant/modules/\" + module + \"\\\"\\n\"\n\t}\n\tsdata = strings.Replace(sdata, \"_INCLUDED_MODULES_IMPORT_\", modules_import, -1)\n\tsdata = strings.Replace(sdata, \"_INCLUDED_MODULES_\", modules_create, -1)\n\n\treturn []byte(sdata)\n}", "title": "" }, { "docid": "281f9e1909696544bf2ba6073bd34646", "score": "0.41349387", "text": "func processDataContent(path string) error {\n\tfmt.Printf(\"processing %v\\n\", path)\n\n\tdataFile, err := ioutil.ReadFile(path)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tdataFile = replaceAllVerbatimTags(&dataFile)\n\tdataFile = replaceAllBase64Images(&dataFile, path)\n\n\terr = ioutil.WriteFile(path, dataFile, 0644)\n\tif err != nil {\n\t\treturn err\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "71fdbd95294a34a9be664909acfd91c0", "score": "0.4134066", "text": "func linkArticles(inputHTML []byte, recognizer goahocorasick.Machine, linkTable map[string]string) []byte {\n\tz := html.NewTokenizer(bytes.NewReader(inputHTML))\n\tresult := []byte{}\n\n\tinsideLinkTag := false\n\n\tfor {\n\t\ttt := z.Next()\n\t\tswitch tt {\n\t\tcase html.ErrorToken:\n\t\t\tif z.Err() == io.EOF {\n\t\t\t\treturn result\n\t\t\t}\n\t\t\tlog.Fatalf(\"Error while parsing generated HTML: %s\", z.Err())\n\n\t\tcase html.TextToken:\n\t\t\tif !insideLinkTag {\n\t\t\t\tresult = append(result, linkifyText(z.Text(), recognizer, linkTable)...)\n\t\t\t} else {\n\t\t\t\tresult = append(result, z.Raw()...)\n\t\t\t}\n\n\t\tcase html.StartTagToken:\n\t\t\ttn, _ := z.TagName()\n\t\t\tif string(tn) == \"a\" || string(tn) == \"A\" {\n\t\t\t\tinsideLinkTag = true\n\t\t\t}\n\t\t\tresult = append(result, z.Raw()...)\n\n\t\tcase html.EndTagToken:\n\t\t\ttn, _ := z.TagName()\n\t\t\tif string(tn) == \"a\" || string(tn) == \"A\" {\n\t\t\t\tinsideLinkTag = false\n\t\t\t}\n\t\t\tresult = append(result, z.Raw()...)\n\n\t\tdefault:\n\t\t\tresult = append(result, z.Raw()...)\n\t\t}\n\t}\n}", "title": "" }, { "docid": "2683d448ed2d2c9ab3745d9c04ca6bae", "score": "0.41324198", "text": "func buildFile(input inputFile, templates map[string]*template.Template, destDir string) error {\n\t// Get the output filename\n\tvar destFileName string\n\n\tif input.extension == \"md\" {\n\t\tdestFileName = makeDestFilename(input.dest, destDir, \"html\")\n\t} else {\n\t\tdestFileName = makeDestFilename(input.dest, destDir, input.extension)\n\t}\n\n\t// Create the path to the filename if needed\n\terr := os.MkdirAll(filepath.Dir(destFileName), 0755)\n\n\tif err != nil {\n\t\treturn fmt.Errorf(\"Could not create directory %q: %v\", filepath.Dir(destFileName), err)\n\t}\n\n\tif input.extension == \"md\" {\n\t\treturn buildMD(input, templates, destFileName)\n\t} else {\n\t\treturn copyFile(input, destFileName)\n\t}\n}", "title": "" }, { "docid": "cdcb099a359aa46b557d9a2b626de625", "score": "0.4130648", "text": "func (p *Generator) CreateMarkdown(t *template.Template, outputFileName string, i interface{}) error {\n\tvar buf bytes.Buffer\n\tif err := t.Execute(&buf, i); err != nil {\n\t\treturn err\n\t}\n\tif err := p.Fs.MkdirAll(path.Dir(outputFileName), os.ModePerm); err != nil {\n\t\treturn err\n\t}\n\tf2, err := p.Fs.Create(outputFileName)\n\tif err != nil {\n\t\treturn err\n\t}\n\tout := buf.Bytes()\n\tif p.Format == \"html\" && !p.DisableCss {\n\t\traw := string(blackfriday.MarkdownCommon(out))\n\t\traw = strings.ReplaceAll(raw, \"README.md\", p.OutputFileName)\n\t\tout = []byte(header + raw + style + endTags)\n\t}\n\tif _, err = f2.Write(out); err != nil {\n\t\treturn err\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "c3b76e02972d7f339498579a2871b048", "score": "0.4127596", "text": "func loadPage(title string) (*File, error) {\n\tfilename := rootDir + title + ext[0]\n\tbody, err := ioutil.ReadFile(filename)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn &File{Name: title, Body: body}, nil\n}", "title": "" }, { "docid": "c2d25b3b6fc74d1e50b45d7bec38f296", "score": "0.41167444", "text": "func (t *RegexpConverter) Convert(document string, lineLength int) (string, error) {\n\t// Brutish way to get a fully formed html document\n\tdoc, err := html.Parse(strings.NewReader(document))\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\n\t// Find the <body> tag within the document\n\tvar bodyElement *html.Node\n\tif doc.Type == html.ElementNode && doc.Data == \"body\" {\n\t\tbodyElement = doc\n\t} else {\n\t\tvar scanForBody func(n *html.Node, depth int)\n\t\tscanForBody = func(n *html.Node, depth int) {\n\t\t\tif n == nil {\n\t\t\t\treturn\n\t\t\t}\n\t\t\tfor c := n.FirstChild; c != nil; c = c.NextSibling {\n\t\t\t\tif n.Type == html.ElementNode && n.Data == \"body\" {\n\t\t\t\t\tbodyElement = n\n\t\t\t\t\treturn\n\t\t\t\t}\n\t\t\t\tif depth < 5 {\n\t\t\t\t\tscanForBody(c, depth+1)\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tscanForBody(doc, 0)\n\t}\n\tif bodyElement == nil {\n\t\treturn \"\", ErrBodyNotFound\n\t}\n\n\tvar dropNonContentTags func(*html.Node)\n\tdropNonContentTags = func(n *html.Node) {\n\t\tif n == nil {\n\t\t\treturn\n\t\t}\n\t\tvar toRemove []*html.Node\n\t\tfor c := n.FirstChild; c != nil; c = c.NextSibling {\n\t\t\tif c.DataAtom == atom.Script || c.DataAtom == atom.Style {\n\t\t\t\ttoRemove = append(toRemove, c)\n\t\t\t} else {\n\t\t\t\tdropNonContentTags(c)\n\t\t\t}\n\t\t}\n\t\tfor _, r := range toRemove {\n\t\t\tn.RemoveChild(r)\n\t\t}\n\t}\n\tdropNonContentTags(bodyElement)\n\n\t// Reconstitute the cleaned HTML document for application\n\t// of plaintext-conversion logic\n\tvar clean bytes.Buffer\n\terr = html.Render(&clean, bodyElement)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\n\t// strip text ignored html. Useful for removing\n\t// headers and footers that aren't needed in the\n\t// text version\n\ttxt := t.ignoredHTML.ReplaceAllString(clean.String(), \"\")\n\n\t// strip out html comments\n\ttxt = t.comments.ReplaceAllString(txt, \"\")\n\n\t// replace images with their alt attributes for img tags with \"\" for attribute quotes\n\t// eg. the following formats:\n\t// <img alt=\"\" />\n\t// <img alt=\"\">\n\ttxt = t.imgAltDoubleQuotes.Replace(txt)\n\n\t// replace images with their alt attributes for img tags with '' for attribute quotes\n\t// eg. the following formats:\n\t// <img alt='' />\n\t// <img alt=''>\n\ttxt = t.imgAltSingleQuotes.Replace(txt)\n\n\t// links\n\ttxt = t.links.Replace(txt)\n\n\t// handle headings (H1-H6)\n\ttxt = t.headerClose.Replace(txt)\n\ttxt = t.headerBlock.Replace(txt)\n\n\t// wrap spans\n\ttxt = t.wrapSpans.Replace(txt)\n\n\t// lists -- TODO: should handle ordered lists\n\ttxt = t.lists.ReplaceAllString(txt, \"* \")\n\n\t// list not followed by a newline\n\ttxt = t.listsNoNewline.ReplaceAllString(txt, \"\\n\")\n\n\t// paragraphs and line breaks\n\ttxt = t.paragraphs.ReplaceAllString(txt, \"\\n\\n\")\n\ttxt = t.lineBreaks.ReplaceAllString(txt, \"\\n\")\n\n\t// strip remaining tags\n\ttxt = t.remainingTags.ReplaceAllString(txt, \"\")\n\n\t// decode HTML entities\n\ttxt = html.UnescapeString(txt)\n\n\t// no more than two consecutive spaces\n\ttxt = t.shortenSpaces.ReplaceAllString(txt, \" \")\n\n\t// apply word wrapping\n\ttxt = WordWrap(txt, lineLength)\n\n\t// remove linefeeds (\\r\\n and \\r -> \\n)\n\ttxt = t.lineFeeds.ReplaceAllString(txt, \"\\n\")\n\n\t// strip extra spaces\n\ttxt = t.nonBreakingSpaces.ReplaceAllString(txt, \" \")\n\ttxt = t.extraSpaceStartOfLine.ReplaceAllString(txt, \"\\n\")\n\ttxt = t.extraSpaceEndOfLine.ReplaceAllString(txt, \"\\n\")\n\n\t// no more than two consecutive newlines\n\ttxt = t.consecutiveNewlines.ReplaceAllString(txt, \"\\n\\n\")\n\n\t// wordWrap messes up the parens\n\ttxt = t.fixWordWrappedParens.Replace(txt)\n\n\treturn strings.TrimSpace(txt), nil\n}", "title": "" }, { "docid": "c63dc3ef522a2e4b43d793cd327e4934", "score": "0.41158313", "text": "func ProcessLinks(content string, links []LinkInfo) string {\n\tmdContent := \"\"\n\tcurrentPos := 0\n\n\t// Ensure links are in order of starting byte\n\tsort.Slice(links, func(i, j int) bool {\n\t\treturn links[i].StartByte < links[j].StartByte\n\t})\n\n\tfor _, linkInfo := range links {\n\t\tif linkInfo.StartByte >= len(content) {\n\t\t\tbreak\n\t\t}\n\n\t\tmdContent += content[currentPos:linkInfo.StartByte]\n\t\tcurrentPos = linkInfo.StartByte\n\t\tlinkContent := content[currentPos : linkInfo.StartByte+linkInfo.Length]\n\t\tmdContent += Link(linkContent, linkInfo.Destination)\n\t\tcurrentPos += linkInfo.Length\n\t}\n\n\tif currentPos < len(content) {\n\t\tmdContent += content[currentPos:len(content)]\n\t}\n\n\treturn mdContent\n}", "title": "" }, { "docid": "98d467d3780c342664c44e083593c18e", "score": "0.41154706", "text": "func NormalizeWikiName(name string) string {\n\treturn strings.ReplaceAll(name, \"-\", \" \")\n}", "title": "" }, { "docid": "03020a223ee3e9ee21e6908ee155e08a", "score": "0.41103676", "text": "func (p *Profanity) Process() error {\n\tp.Verbosef(\"using rules file: %q\", p.Config.RulesFileOrDefault())\n\tif ruleFilter := p.Config.Rules.String(); ruleFilter != \"\" {\n\t\tp.Verbosef(\"using rule filter: %s\", ruleFilter)\n\t}\n\tif fileFilter := p.Config.Files.String(); fileFilter != \"\" {\n\t\tp.Verbosef(\"using file filter: %s\", fileFilter)\n\t}\n\tif dirFilter := p.Config.Dirs.String(); dirFilter != \"\" {\n\t\tp.Verbosef(\"using dir filter: %s\", dirFilter)\n\t}\n\terr := p.Walk(p.Config.RootOrDefault())\n\tif err != nil {\n\t\tp.Verbosef(\"profanity %s!\", ansi.Red(\"failed\"))\n\t\treturn err\n\t}\n\tp.Verbosef(\"profanity %s!\", ansi.Green(\"ok\"))\n\treturn nil\n}", "title": "" } ]
56e3194ecd9a0402f4fef7d1a5e2ff75
reset resets the existing node data.
[ { "docid": "afd97134c51659ef4fbba168a8d76b5b", "score": "0.7626395", "text": "func (node *treeNode) reset(prefix string) {\n\tnode.prefix = prefix\n\tnode.data = nil\n\tnode.parameter = nil\n\tnode.wildcard = nil\n\tnode.kind = 0\n\tnode.startIndex = 0\n\tnode.endIndex = 0\n\tnode.indices = nil\n\tnode.children = nil\n}", "title": "" } ]
[ { "docid": "f450cfbfa55196016c20aac69f8c94b2", "score": "0.6926044", "text": "func (n *Nodes) Reset() {\n\tn.curr = nil\n\tn.pos = 0\n\tn.iter = n.nodes.MapRange()\n}", "title": "" }, { "docid": "32a94e0b543929f6ef95e8b73ce8cf4d", "score": "0.6760113", "text": "func (t *Tree) Reset() {\n\tt.head = nil\n\tt.currentIndex = 0\n\tt.proofIndex = 0\n\tt.proofSet = nil\n}", "title": "" }, { "docid": "5a9452e2b42edb5950afdda09805045b", "score": "0.66833687", "text": "func (set *NodeSet) Reset() {\n\tset.list = set.list[:0]\n\tset.m = nil\n}", "title": "" }, { "docid": "6873cfc8d1dc3c075d889727029b6110", "score": "0.6592871", "text": "func (na *EventHashList) Reset() {\n\tna.nodes = map[string][]string{}\n}", "title": "" }, { "docid": "4818b03d9b7f3eefc57e511991e8b9bc", "score": "0.65071356", "text": "func (s *NodeStatus) Reset() {\n\ts.Free = false\n\ts.Reason = \"\"\n\ts.Load1 = 0\n\ts.Load5 = 0\n\ts.Load15 = 0\n\ts.Net = \"\"\n\ts.NetUtilization = 0\n}", "title": "" }, { "docid": "28cc690f402de3693a69c00ea4b4d8a2", "score": "0.6499794", "text": "func (a *TreeToListAdapter) reset() {\n\ta.descendants = a.adapter.Count()\n\ta.children = make([]*TreeToListNode, a.descendants)\n\tfor i := range a.children {\n\t\tnode := a.adapter.NodeAt(i)\n\t\titem := node.Item()\n\t\ta.children[i] = &TreeToListNode{container: node, item: item, parent: a}\n\t}\n}", "title": "" }, { "docid": "0dcbc3485019ff5d1a13109a7400630d", "score": "0.6443247", "text": "func (rb *RingBuffer[V]) Reset() {\n\tatomic.StoreUint64(&rb.queue, 0)\n\tatomic.StoreUint64(&rb.dequeue, 0)\n\n\tvar zero V\n\tfor idx, n := range rb.nodes {\n\t\tn.data = zero\n\t\tn.position = uint64(idx)\n\t}\n}", "title": "" }, { "docid": "5047c8ce962fb6b05434324cba33e623", "score": "0.6437254", "text": "func (t *ChildrenTraverser) reset() {\n\n\tt.discovered = make(map[iotago.BlockID]struct{})\n\tt.stack = list.New()\n}", "title": "" }, { "docid": "452727dd174975320142d9f15c771c7b", "score": "0.64197326", "text": "func (fs *MemFS) Reset() {\n\tfs.tree.children = make(map[string]*memFSNode)\n}", "title": "" }, { "docid": "5b836d51962cb73e8fe20cdccbc90eb6", "score": "0.62597877", "text": "func (n *Node) clear() {\n\tn.data = nil\n\tn.borders[1] = 0\n\tfor key := range n.children {\n\t\tn.children[key].parent = nil\n\t}\n\tn.children = nil\n}", "title": "" }, { "docid": "829bb24beefd815419c4870cb4c3c390", "score": "0.6228607", "text": "func (jsn *Json) Reset(data []byte) *Json {\n\tif data == nil {\n\t\tjsn.n = 0\n\t\treturn jsn\n\t}\n\tjsn.data, jsn.n = data, len(data)\n\treturn jsn\n}", "title": "" }, { "docid": "599b7375347def9ad41be4f402cbae02", "score": "0.6217155", "text": "func (cd *ChaincodeData) Reset() { *cd = ChaincodeData{} }", "title": "" }, { "docid": "f8cb16be267cdd772f8a1c7e2d4489de", "score": "0.6158364", "text": "func (p *Parser) Reset() {\n\tp.tree = nil\n\tp.head = nil\n\tp.done = false\n}", "title": "" }, { "docid": "3de153bd711bb34f394e8e1560ad9240", "score": "0.6135298", "text": "func (d *DepthFirst) Reset() {\n\td.s.Clear()\n\td.visits = d.visits[:0]\n}", "title": "" }, { "docid": "6830b1d1ce703793505af0f137e6a235", "score": "0.61117786", "text": "func (self *QuadTree) Reset(x int, y int, width int, height int) {\n self.Object.Call(\"reset\", x, y, width, height)\n}", "title": "" }, { "docid": "0e547bd3c1d80c20202a6ec484365e5d", "score": "0.60913044", "text": "func (ns *NS) Reset() {\n\tns.Delete()\n}", "title": "" }, { "docid": "429ff6851617e5080583f1540c860940", "score": "0.6044396", "text": "func (n *NodeIDContainer) Reset(val roachpb.NodeID) {\n\tatomic.StoreInt32(&n.nodeID, int32(val))\n}", "title": "" }, { "docid": "bb1d81260935f125687909fb1f01584b", "score": "0.60248446", "text": "func (element *Element) Reset() {\n\telement.Target = InitialState\n\n\t// reset all clusters\n\tclusterNames, _ := element.ListClusters()\n\tfor _, clusterName := range clusterNames {\n\t\tcluster, _ := element.GetCluster(clusterName)\n\n\t\tcluster.Reset()\n\t}\n}", "title": "" }, { "docid": "382d901bad276cf5bbf88b2b13fcc7d3", "score": "0.6017792", "text": "func (in *NodeStatus) ResetDirty() {\n\tin.dirty = false\n}", "title": "" }, { "docid": "8f013779943cf9136bf4f8a98b406af1", "score": "0.6010124", "text": "func (ast *AST) Reset() *AST {\n\tvar freetree func(*NonTerminal)\n\n\tfreetree = func(node *NonTerminal) {\n\t\tfor _, q := range node.Children {\n\t\t\tif nt, ok := q.(*NonTerminal); ok {\n\t\t\t\tfreetree(nt)\n\t\t\t}\n\t\t}\n\t\tast.putnt(node)\n\t}\n\tif node, ok := ast.root.(*NonTerminal); ok {\n\t\tfreetree(node)\n\t}\n\tast.y, ast.root = nil, nil\n\treturn ast\n}", "title": "" }, { "docid": "c51702c31271d1423a33a20a359ff436", "score": "0.6007581", "text": "func (s *Nodes) clear() {\n\tif len(*s) != 0 {\n\t\t*s = make(Nodes)\n\t}\n}", "title": "" }, { "docid": "9cf50e3378b572ef11686683348d0f2f", "score": "0.60029036", "text": "func Reset() {\n\tpointerIndex = 0\n}", "title": "" }, { "docid": "7c305e01206689bf31f1f34d9d90c1cf", "score": "0.59995157", "text": "func (c *Chain) Reset() {\n\tc.d = make(map[string][]Cell)\n\tc.totalRecords = 0\n}", "title": "" }, { "docid": "ecc7e6c36a3dd47627dbd5b51e9d8ad9", "score": "0.5968674", "text": "func clear(n *node) *node {\n\tif n != nil {\n\t\tn.l = clear(n.l)\n\t\tn.r = clear(n.r)\n\t}\n\tn = nil\n\n\treturn n\n}", "title": "" }, { "docid": "9263f309cf28cf6c5a6e147d22c792e6", "score": "0.59572023", "text": "func (j *JSONQ) reset() *JSONQ {\n\tj.jsonContent = j.rootJSONContent\n\tj.queries = make([][]query, 0)\n\tj.queryIndex = 0\n\treturn j\n}", "title": "" }, { "docid": "7161cee7d91f004964419142f9dc759b", "score": "0.59558463", "text": "func (r *mqttReader) reset(buf []byte) {\n\tif l := len(r.pbuf); l > 0 {\n\t\ttmp := make([]byte, l+len(buf))\n\t\tcopy(tmp, r.pbuf)\n\t\tcopy(tmp[l:], buf)\n\t\tbuf = tmp\n\t\tr.pbuf = nil\n\t}\n\tr.buf = buf\n\tr.pos = 0\n\tr.pstart = 0\n}", "title": "" }, { "docid": "244767607ef0712a60add4a2f7c1f5c0", "score": "0.5944971", "text": "func (q *Quorum) Reset() {\n\tq.size = 0\n\tq.acks = make(map[ID]bool)\n\tq.zones = make(map[int]int)\n\tq.nacks = make(map[ID]bool)\n\tq.idColMap = make(map[ID]int)\n}", "title": "" }, { "docid": "13fcf1328d57707dbee3af222dc94de6", "score": "0.59438235", "text": "func (s *Stats) Reset() {\n\ts.Duration = 0\n\ts.Nodes = 0\n}", "title": "" }, { "docid": "1b12b7372fc70f129a8b5393cf5b4c40", "score": "0.5932044", "text": "func (lc *linkCache) reset() {\n\tlc.directM = nil\n\tlc.allM = nil\n}", "title": "" }, { "docid": "c9eec58855390dbd77b627c7993bfdd0", "score": "0.59296274", "text": "func reset() {\n\tinitialized = false\n\tallMetrics = makeMetricSet()\n\temitter.Reset()\n}", "title": "" }, { "docid": "244305a382d24d6c16448045de7cb6ff", "score": "0.59294075", "text": "func (a *arena) reset() {\n\ta.h.Len = 0\n}", "title": "" }, { "docid": "b13e4dce33f9d4c08daf24515acbe1c1", "score": "0.58967894", "text": "func (m *matrix) Reset() {\n\tfor i := 0; i < m.nRow*m.nCol; i++ {\n\t\tm.data[i] = 0\n\t}\n}", "title": "" }, { "docid": "13617b65ea067d398aad438aada20019", "score": "0.5871587", "text": "func (ws *WarpSync) reset() {\n\tws.StartTime = time.Time{}\n\tws.InitMilestone = 0\n\tws.TargetMilestone = 0\n\tws.PreviousCheckpoint = 0\n\tws.CurrentCheckpoint = 0\n\tws.referencedBlocksTotal = 0\n}", "title": "" }, { "docid": "0829dd2419a8f24d31767d47b48de624", "score": "0.58667433", "text": "func (t *parser) reset() {\n\tt.tabs, t.innerTabs = 0, 0\n\tt.parent, t.output, t.accumulator = \"\", \"\", \"\"\n\tt.seen = make(map[string][]string)\n\tt.stack = append(t.stack, \"\")\n}", "title": "" }, { "docid": "7ddb566523dae3233ed6c1d6db453835", "score": "0.5864723", "text": "func (mail *MailTx) Reset() {\n\tmail.ID = \"\"\n\tmail.From = \"\"\n\tmail.Recipients = nil\n\tmail.Data = nil\n}", "title": "" }, { "docid": "60811a3997145039e4414e99b9cd0890", "score": "0.58550566", "text": "func (db dbData) ResetState(identity string, isonline bool, isreqConn bool, lock int) error {\n\ttmpNodeState, err := db.GetNodeData(identity)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tif isonline {\n\t\ttmpNodeState.IsOnline = true\n\t} else {\n\t\ttmpNodeState.IsOnline = false\n\t}\n\tif isreqConn {\n\t\ttmpNodeState.IsWinRequireconn = true\n\t} else {\n\t\ttmpNodeState.IsWinRequireconn = false\n\t}\n\tif lock == 1 {\n\t\ttmpNodeState.Locking = 1\n\t} else {\n\t\ttmpNodeState.Locking = 0\n\t}\n\ttmpNodeState.ApplicationData = InteractiveSocket.Node{}\n\t//put resetted struct\n\tif err := db.database.Update(func(tx *bolt.Tx) error {\n\t\tbucket := tx.Bucket([]byte(BUCKET_NODE))\n\t\tif val, err := json.Marshal(&tmpNodeState); err != nil {\n\t\t\treturn errors.New(\"BOLT : Marshal failed\")\n\t\t} else {\n\t\t\tif err := bucket.Put([]byte(identity), val); err != nil {\n\t\t\t\treturn errors.New(\"BOLT : Put failed\")\n\t\t\t}\n\t\t}\n\t\treturn nil\n\t}); err != nil {\n\t\treturn err\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "32097fa88d41b98bad2c37b6ef70c3b5", "score": "0.58426493", "text": "func (ll *LinkedList) Reset() {\n\tll.iter = 0\n}", "title": "" }, { "docid": "5b05e3e14b2e5bffea208e5d424879ab", "score": "0.58241636", "text": "func (p *DB) Reset() {\n\tp.mu.Lock()\n\tp.rnd = rand.New(rand.NewSource(0xdeadbeef))\n\tp.maxHeight = 1\n\tp.n = 0\n\tp.kvSize = 0\n\tp.kvData = p.kvData[:0]\n\tp.nodeData = p.nodeData[:nNext+tMaxHeight]\n\tp.nodeData[nKV] = 0\n\tp.nodeData[nKey] = 0\n\tp.nodeData[nVal] = 0\n\tp.nodeData[nHeight] = tMaxHeight\n\tfor n := 0; n < tMaxHeight; n++ {\n\t\tp.nodeData[nNext+n] = 0\n\t\tp.prevNode[n] = 0\n\t}\n\tp.mu.Unlock()\n}", "title": "" }, { "docid": "de91f60524ddc6276d13bcb9b6e20c28", "score": "0.581535", "text": "func (l *DoubleLinkedList) Reset() {\n\tl.length = 0\n\tl.head = nil\n\tl.tail = nil\n}", "title": "" }, { "docid": "e088f799426dbc6086f1ad0f1aa427a1", "score": "0.5812812", "text": "func (o *Ops) Reset() {\n\to.stackDepth = 0\n\t// Leave references to the GC.\n\tfor i := range o.refs {\n\t\to.refs[i] = nil\n\t}\n\to.data = o.data[:0]\n\to.refs = o.refs[:0]\n\to.version++\n}", "title": "" }, { "docid": "50faf99b7e3314922782e5f53c5b9fa8", "score": "0.58021605", "text": "func (bm *batchMetrics) reset() {\n\tbm.metricData = pdata.NewMetrics()\n\tbm.metricCount = 0\n}", "title": "" }, { "docid": "f681270048f31818689278a83566aa19", "score": "0.5794275", "text": "func (s *sstack) Reset() {\n\t*s = *newSstack(s.setIndex)\n}", "title": "" }, { "docid": "b76eed475b45d8f5fc01a8b2481b410e", "score": "0.5770175", "text": "func (labeller *Labeller) Reset() {\n\tlabeller.index = 0\n}", "title": "" }, { "docid": "cd49fbf907931453b45423a8fd35bc2b", "score": "0.57495135", "text": "func (a *Timestamp) Reset(data *Data) {\n\ta.setData(data)\n}", "title": "" }, { "docid": "b89803ca8457f97a172aada264047fde", "score": "0.57456064", "text": "func (c *Cell) Reset() {\n\tc.buf = c.buf[:0]\n\tc.off = 0\n}", "title": "" }, { "docid": "52ab90c84f6a96555f6c0d9180505545", "score": "0.57355076", "text": "func (bf *BitField) Reset() {\n\tbf.data = nil\n\tbf.size = 0\n}", "title": "" }, { "docid": "4cad78b65f7184f9af773d260457181f", "score": "0.5731843", "text": "func (in *Inflights) reset() {\n\tin.start = 0\n\tin.count = 0\n\tin.bytes = 0\n}", "title": "" }, { "docid": "cfd1661d977d10817eea55e94b071a49", "score": "0.57304835", "text": "func (hll *HyperLogLog) Reset() {\n\tfor i := range hll.data {\n\t\thll.data[i] = 0\n\t}\n}", "title": "" }, { "docid": "c7e0c0b1131251507e69297967f2978d", "score": "0.572672", "text": "func (r *reaData) resetDat(backupDat []string) {\r\n\ttermbox.Clear(termbox.ColorDefault, termbox.ColorDefault)\r\n\tbaseDat := make([]string, len(backupDat))\r\n\tr.Data = baseDat\r\n\t_ = copy(r.Data, backupDat)\r\n\tif r.Height > len(r.Data) {\r\n\t\tr.inBufD(r.Data)\r\n\t} else {\r\n\t\tr.inBufD(r.Data[r.Row : r.Row+r.Height])\r\n\t}\r\n\tr.inBufC(r.X, r.Y)\r\n\tif r.Onflag {\r\n\t\tr.Onflag = false\r\n\t\tr.SelectedValue = \"\"\r\n\t\tr.Pos = 0\r\n\t}\r\n\tvar temp reaData\r\n\tr.DataWithInf = temp.DataWithInf\r\n\tr.inDat(baseDat)\r\n\ttermbox.Flush()\r\n}", "title": "" }, { "docid": "f601a2f77f0c9070c9102d1da0ed8718", "score": "0.5724724", "text": "func (iter *twoThreeTreeIterator) Reset() {\n\titer.stack.Clear()\n\tif iter.root != nil {\n\t\tnode := iter.root\n\t\tfor node != nil {\n\t\t\titer.stack.Push(node)\n\t\t\tnode = node.left\n\t\t}\n\t}\n}", "title": "" }, { "docid": "9f47fed32ef5f76f0c75a37540496b8b", "score": "0.5701728", "text": "func (tx *Tx) Reset() {\n\ttx.options = nil\n\ttx.builder = nil\n\ttx.payload = \"\"\n\ttx.submitted = false\n\ttx.response = nil\n\ttx.isMultiOp = false\n\ttx.err = nil\n}", "title": "" }, { "docid": "2b870454a7aa60cefee019c570f0ff85", "score": "0.569865", "text": "func (q *Queue) reset() error {\n\t//Delete all old data\n\tq.remove()\n\t//Reset the data structure\n\tqh := &QueueHeader{\n\t\tExpires: time.Now().Add(time.Duration(q.mgr.cfg.QueueExpiry * 1e9)).UnixNano(),\n\t\tIndex: 0,\n\t\tID: q.hdr.ID,\n\t\tCreated: time.Now(),\n\t\tMaxLength: q.hdr.MaxLength,\n\t\tMaxSize: q.hdr.MaxSize,\n\t}\n\tctx, cancel := context.WithCancel(context.Background())\n\t*q = Queue{\n\t\thdr: qh,\n\t\tmgr: q.mgr,\n\t\tCtx: ctx,\n\t\tctxcancel: cancel,\n\t}\n\tq.writeHeader()\n\treturn nil\n}", "title": "" }, { "docid": "4f157ff6cea0d3fbfc1c1ef05221eec0", "score": "0.5664294", "text": "func (f *FileBackend) reset() error {\n\tf.offset = 0\n\tf.ln = 0\n\tf.col = 0\n\t_, err := f.file.Seek(0, 0)\n\treturn err\n}", "title": "" }, { "docid": "2ca2ea5522e6d0cd9559e13c05bca360", "score": "0.565843", "text": "func (d *Document) Reset() {\n\tfor idx := range d.elems {\n\t\td.elems[idx] = nil\n\t}\n\td.cacheValid = false\n\td.elems = d.elems[:0]\n}", "title": "" }, { "docid": "df1ca8d1520430c5782ca49611028e22", "score": "0.56446594", "text": "func (w *World) Reset() {\n\tw.checkLocked()\n\n\tw.entities = w.entities[:1]\n\tw.targetEntities.Reset()\n\tw.entityPool.Reset()\n\tw.locks.Reset()\n\tw.resources.reset()\n\n\tlen := w.nodes.Len()\n\tvar i int32\n\tfor i = 0; i < len; i++ {\n\t\tw.nodes.Get(i).Reset(w.Cache())\n\t}\n}", "title": "" }, { "docid": "8b4c1e64504084db731fac951fa0135c", "score": "0.56432855", "text": "func Reset() { dc.ClearAll() }", "title": "" }, { "docid": "f07f8ac6a4ea309d8db740fb6a124175", "score": "0.5635952", "text": "func (nodeStrategy) ResetBeforeCreate(obj runtime.Object) {\n\t_ = obj.(*api.Node)\n\t// Nodes allow *all* fields, including status, to be set.\n}", "title": "" }, { "docid": "5c74b35280ae0979f3e3c0042c78f67a", "score": "0.5634563", "text": "func Reset() {\n\tfor _, r := range roots {\n\t\tr.Reset()\n\t}\n\tErrors = nil\n}", "title": "" }, { "docid": "1a260695aa975e7392aea94813193be5", "score": "0.56287575", "text": "func (s *Stats) reset() {\n\ts.calls = 0\n\ts.failures = 0\n\ts.successes = 0\n\ts.continuousFailures = 0\n\ts.continuousSuccesses = 0\n}", "title": "" }, { "docid": "9e512800f147a56e604b02f769aebe47", "score": "0.5627576", "text": "func (r *RingBuffer) Reset() {\n\tr.written = 0\n\tr.ringMode = false\n\tr.pos = 0\n}", "title": "" }, { "docid": "e062fb4f9b32a732723dd09f23edb1a1", "score": "0.5626932", "text": "func (c *CountMinSketch) Reset() {\n\tmatrix := make([][]uint64, c.depth)\n\tfor i := uint(0); i < c.depth; i++ {\n\t\tmatrix[i] = make([]uint64, c.width)\n\t}\n\n\tc.matrix = matrix\n\tc.count = 0\n}", "title": "" }, { "docid": "0ec2eca875318056a930c048624f6d79", "score": "0.5620432", "text": "func (s *RawDynamicElement) Reset() error {\n\ts.active = false\n\treturn nil\n}", "title": "" }, { "docid": "72f32b3fbba9a33791b508a847b05564", "score": "0.56158334", "text": "func (b *Buffer) Reset() {\n\tb.head = b.tail\n}", "title": "" }, { "docid": "46c79a1890e2154d0db91b4d71ac3e07", "score": "0.56157595", "text": "func (t *Text) reset() {\n\tt.content = nil\n\tt.wrapped = nil\n\tt.scroll = newScrollTracker(t.opts)\n\tt.lastWidth = 0\n\tt.contentChanged = true\n}", "title": "" }, { "docid": "ec9f9f62eb0831c838e8172da203a38a", "score": "0.5607333", "text": "func Reset(pwd string) error {\n\tData.RootPath = pwd\n\treturn get()\n}", "title": "" }, { "docid": "6cd1e98c7bef6c4f36c691c093e6b6c8", "score": "0.5604073", "text": "func (u *UntrustedInputChecker) reset() {\n\tu.start = nil\n\tu.filteringObject = false\n\tu.cur = u.cur[:0]\n}", "title": "" }, { "docid": "9d70940d261b9af3a1cf97a056c59a22", "score": "0.5601857", "text": "func (p *Buffer) Reset() {\n\tp.index = 0 // for reading\n}", "title": "" }, { "docid": "020c5cd2602ed867c909a0ba336ecaff", "score": "0.55979294", "text": "func (cache *Cache) Reset(backend Reader) {\n\tcache.Lock()\n\tdefer cache.Unlock()\n\tcache.backend = backend\n\tcache.registry = make(map[crypto.Address]*nodeInfo)\n}", "title": "" }, { "docid": "84f8505ac4ca3688a6174c9c578ae35b", "score": "0.5589158", "text": "func (w *Writer) reset() {\n\tw.buf.Reset()\n\tw.cell = cell{}\n\tw.lines = w.lines[0:0]\n\tw.addNewLine()\n}", "title": "" }, { "docid": "c7f5aa4345bed701d5afb857d055d8e7", "score": "0.5574453", "text": "func (d *DiagDense) Reset() {\n\t// No change of Inc or n to 0 may be\n\t// made unless both are set to 0.\n\td.mat.Inc = 0\n\td.mat.N = 0\n\td.mat.Data = d.mat.Data[:0]\n}", "title": "" }, { "docid": "c620574b24fd699225b91365656325ed", "score": "0.5573222", "text": "func (a *ConnectionAddress) reset() {\n\ta.Host = a.Host[:0]\n\tfor i := range a.IP {\n\t\ta.IP[i] = 0\n\t}\n\ta.Type = AddressIPv4\n}", "title": "" }, { "docid": "19f317e9e55546894e39ab20ef4ce80c", "score": "0.5572742", "text": "func (p *payload) reset() {\n\t// ⚠️ Warning!\n\t//\n\t// Resetting the payload for re-use requires the transport to wait for the\n\t// HTTP package to Close the request body before attempting to re-use it\n\t// again! This requires additional logic to be in place. See:\n\t//\n\t// • https://github.com/golang/go/blob/go1.16/src/net/http/client.go#L136-L138\n\t// • https://github.com/DataDog/dd-trace-go/pull/475\n\t// • https://github.com/DataDog/dd-trace-go/pull/549\n\t// • https://github.com/DataDog/dd-trace-go/pull/976\n\t//\n\tpanic(\"not implemented\")\n}", "title": "" }, { "docid": "48a9d959881b4c32e75b20df8fa8a68a", "score": "0.55696225", "text": "func (bt *batchTraces) reset() {\n\tbt.traceData = pdata.NewTraces()\n\tbt.spanCount = 0\n}", "title": "" }, { "docid": "b413db4d89bef121ebd669bc05819a92", "score": "0.55672866", "text": "func (s *SymBandDense) Reset() {\n\ts.mat.N = 0\n\ts.mat.K = 0\n\ts.mat.Stride = 0\n\ts.mat.Uplo = 0\n\ts.mat.Data = s.mat.Data[:0]\n}", "title": "" }, { "docid": "a43840a7a9350b9efd37ff75a20771d5", "score": "0.55672204", "text": "func (r *BatchBitReader) Reset(data []byte) {\n\tr.data = data\n\tr.buf.v, r.buf.n, r.err = 0, 0, nil\n\tr.readBuf()\n}", "title": "" }, { "docid": "f005d734c8ed5b32635b8b739a0e2199", "score": "0.55655277", "text": "func (b *BlobBuilder) Reset() {\n\tb.wr = nil\n\tb.topLevel = 0\n}", "title": "" }, { "docid": "f85c12a221ff58d8768f0f66b61bf3c0", "score": "0.55597895", "text": "func (bm *batchLogs) reset() {\n\tbm.logData = pdata.NewLogs()\n\tbm.logCount = 0\n}", "title": "" }, { "docid": "806f28e8ed9829e0e6b6144ad2007c76", "score": "0.55592704", "text": "func (repository *Repository) Reset() {\n\trepository.idData = make(map[string]*users.User)\n\trepository.usernameData = make(map[string]*users.User)\n\trepository.lastAdded = nil\n}", "title": "" }, { "docid": "33047c0f2b50ce96086f8c5868fcd256", "score": "0.55554354", "text": "func (sfClient *SFClient) ResetNode(ctx context.Context, req *ResetNodeRequest) (*ResetNodeResult, *SdkError) {\n\tvar res ResetNodeResult\n\t_, err := sfClient.MakeSFCall(ctx, \"ResetNode\", 1, req, &res)\n\treturn &res, err\n}", "title": "" }, { "docid": "921288dd0ba64004928fb99335d66cfa", "score": "0.5553173", "text": "func (txn *Txn) Reset() {\n\ttxn.puts = internal.NewIDHeap()\n\ttxn.takes = internal.NewIDHeap()\n\ttxn.putValues = make([]kv, 0)\n\ttxn.takeValues = make([]kv, 0)\n}", "title": "" }, { "docid": "636ee0ec7c4752433f00d90bf9654ce1", "score": "0.5532044", "text": "func (p *CheckpointSet) Reset() {\n\tp.records = make(map[mapkey]export.Record)\n\tp.updates = nil\n}", "title": "" }, { "docid": "14e2501a6fdd9042df6fb0906932c6a1", "score": "0.5531837", "text": "func (b *BreadthFirst) Reset() {\n\tb.q.Clear()\n\tb.visits = b.visits[:0]\n}", "title": "" }, { "docid": "e96440bb3a22ca34928f19bbf720f134", "score": "0.5527802", "text": "func (packet *Packet) Reset() {\n\tpacket.payload.Reset()\n\tpacket.Count = 0\n}", "title": "" }, { "docid": "4291938dfb55cd228eafa7baca4b43a0", "score": "0.5521986", "text": "func (in *inflights) reset() {\n\tin.count = 0\n\tin.start = 0\n}", "title": "" }, { "docid": "7ca3cddebe0035da90468f532f3375fd", "score": "0.55132735", "text": "func (db *MemDB) Reset() {\n\tdb.root = nullAddr\n\tdb.stages = db.stages[:0]\n\tdb.dirty = false\n\tdb.vlogInvalid = false\n\tdb.size = 0\n\tdb.count = 0\n\tdb.vlog.reset()\n\tdb.allocator.reset()\n}", "title": "" }, { "docid": "24b272f4fef5a0ef9481d709c0ad9d65", "score": "0.5503159", "text": "func reset() {\n\tvar redis = godis.New(\"\", 0, \"\")\n\tredis.Flushdb()\n}", "title": "" }, { "docid": "d63ba849348765605fb0af9a04999bfb", "score": "0.5498252", "text": "func (b *Builder) Reset() {\n\tb.addr = nil\n\tb.buf = nil\n}", "title": "" }, { "docid": "f81577e6d3450ae1cb1ff404e59ed300", "score": "0.54976666", "text": "func (c *cmac) Reset() {\n\tfor i := range c.x {\n\t\tc.x[i] = 0\n\t}\n\tc.n = 0\n}", "title": "" }, { "docid": "c943055cecd4b12f05b926b3d1b5f567", "score": "0.54846245", "text": "func (c *Context) reset() {\n\tdebugf(\"(*Context).reset\")\n\tif c.bin != nil {\n\t\tc.bin.Reset(nil)\n\t}\n\tif c.bout != nil {\n\t\tc.bout.Reset(nil)\n\t}\n\tc.kv = nil\n\tc.Conn = nil\n}", "title": "" }, { "docid": "daf33ceebaa8160e82029097cbd8b548", "score": "0.5480319", "text": "func (s *IntStack) Reset() {\n\ts.next = 0\n}", "title": "" }, { "docid": "861750e456639f46caba3b2ef138a315", "score": "0.5479877", "text": "func (g *GraphGenerator) Reset() error {\n\tfor _, filename := range [3]string{sFileName, cFileName, soFileName} {\n\t\terr := os.Remove(\"/Users/crushonly/neo4j/import/\" + filename)\n\t\tif err != nil {\n\t\t\tlog.Println(err)\n\t\t}\n\t}\n\n\tsession, err := g.driver.Session(neo4j.AccessModeWrite)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tres, err := session.Run(`MATCH (n) DETACH DELETE n`, nil)\n\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\n\tsummary, err := res.Summary()\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\tfmt.Printf(\"%+v\\n\", summary.Counters())\n\tfmt.Println(\"the database is now empty\")\n\n\treturn nil\n}", "title": "" }, { "docid": "aef6ba653986ca946f82f59317607905", "score": "0.54764", "text": "func (i *CRUDInfo) Reset() {\n\ti.Type = Unknown\n\ti.BindPlanUsed = nil\n\ti.RowCount = 0\n\ti.ChildUpdateRowCount = 0\n\ti.ChildInsertRowCount = 0\n}", "title": "" }, { "docid": "d5d80fb69da94fe78baccf54b2dbcef5", "score": "0.54759467", "text": "func Reset(s *Sparql) {\n s.Reset()\n s.skipBegin = 0\n s.Keyword = \"\"\n s.Prefix = \"\"\n s.pathLength = 0\n s.Pof = \"?POF\"\n s.Tps = s.Tps[:0]\n}", "title": "" }, { "docid": "e2465761bf7939ae0d75df562ad09348", "score": "0.5474089", "text": "func (iter *treeMapValueIterator) Reset() { iter.treeIter.Reset() }", "title": "" }, { "docid": "a78ee55593573051877eedbf8999b37a", "score": "0.5469952", "text": "func (b *LabelsBuilder) Reset() {\n\tb.del = b.del[:0]\n\tb.add = b.add[:0]\n\tb.err = \"\"\n}", "title": "" }, { "docid": "b124d6d76ca3e0ed1d9d5a4a4fc788dc", "score": "0.5456399", "text": "func (t *Stree) Clear() {\n\tt.count = 0\n\tt.root = nil\n\tt.base = nil\n\tt.min = 0\n\tt.max = 0\n}", "title": "" }, { "docid": "1b270835644d14d5c3e0991cdd2d9d42", "score": "0.54557556", "text": "func (s *store) reset(st *store) error {\n\ts.mu.Lock()\n\tdefer s.mu.Unlock()\n\n\tif err := s.raftState.close(); err != nil {\n\t\treturn err\n\t}\n\n\t// we have to remove all file in raft path\n\t// directory, since we want to a reset operation.\n\t//\n\terr := os.RemoveAll(filepath.Join(s.raftState.path, \"/*\"))\n\tif err != nil {\n\t\tos.Remove(filepath.Join(s.path, \"raft.db\"))\n\t}\n\n\tst.path = s.path\n\tst.raftState = s.raftState\n\t// reopen the strore after remove all files\n\tif err := st.open(st.raftLn); err != nil {\n\t\treturn err\n\t}\n\tif s.raftState == nil {\n\t\t// return nil\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "2aa731fc5eadcfb8bb0c83722af053f0", "score": "0.5452524", "text": "func (c *Cache) Reset() { c.enqueue(query{op: resetOp}) }", "title": "" }, { "docid": "08570220666edb13db192617aa13f138", "score": "0.5450834", "text": "func (tfd *TermFieldDoc) Reset() *TermFieldDoc {\n\t// remember the []byte used for the ID\n\tid := tfd.ID\n\tvectors := tfd.Vectors\n\t// idiom to copy over from empty TermFieldDoc (0 allocations)\n\t*tfd = TermFieldDoc{}\n\t// reuse the []byte already allocated (and reset len to 0)\n\ttfd.ID = id[:0]\n\ttfd.Vectors = vectors[:0]\n\treturn tfd\n}", "title": "" }, { "docid": "01ce0a21879309f0ad52fbff0eb177a1", "score": "0.54470676", "text": "func (v *Voronoi) Reset() {\n\tv.EventQueue = NewEventQueue(v.Sites)\n\tv.ParabolaTree = nil\n\tv.SweepLine = 0\n\tv.DCEL = dcel.NewDCEL()\n}", "title": "" } ]
1a739b9995b346e807c5566497b749a8
Configure a node to listen for tcp connections.
[ { "docid": "1101e55cd435ae5a7704765225671bb5", "score": "0.0", "text": "func (node Node) UnicastReceive() {\n\t// Listen to an unused TCP port on localhost.\n\tport := \":\" + node.Port\n\tlistener, err := net.Listen(\"tcp\", port)\n\terrorchecker.CheckError(err)\n\tdefer listener.Close()\n\tfmt.Println(\"Listening to tcp port \" + port + \" was successful!\")\n\tfmt.Println(\"To send a message, type: send <destination_id_number> <message>\")\n\n\t// Listen for TCP connections until the process is closed.\n\tfor {\n\t\t// Wait for a connection from a client to our TCP port and then set up a TCP channel with them.\n\t\tconn, err := listener.Accept()\n\t\terrorchecker.CheckError(err)\n\t\tfmt.Println(\"Connection to client was successful!\")\n\n\t\t// Handle client as a goroutine to be able to handle multiple clients at once.\n\t\tgo handleClient(conn)\n\t}\n\treturn\n}", "title": "" } ]
[ { "docid": "8e3ff185722648612338f168e0265ebe", "score": "0.6655258", "text": "func setupTCPListener(tcpPort string) (tcpListener *net.TCPListener) {\n\ttcpAddr := localHost + \":\" + tcpPort\n\tresolvedTCPAddr, err := net.ResolveTCPAddr(tcpType, tcpAddr)\n\ttcpListener, err = net.ListenTCP(tcpType, resolvedTCPAddr)\n\n\tif err != nil {\n\t\tfmt.Println(\"Error listening:\", err.Error())\n\t\tos.Exit(1)\n\t}\n\t// Close the conn when the application closes.\n\n\taddrs, _ := net.InterfaceAddrs()\n\tvar serverIp string\n\n\tfor _, a := range addrs {\n\t\tif ipnet, ok := a.(*net.IPNet); ok && !ipnet.IP.IsLoopback() {\n\t\t\tif ipnet.IP.To4() != nil {\n\t\t\t\tserverIp = ipnet.IP.String()\n\t\t\t\toutLog.Printf(\"Node started. Receiving on %v\\n\", serverIp+\":\"+tcpPort)\n\t\t\t\tbreak\n\t\t\t}\n\t\t}\n\t}\n\n\tgo listenToConnection(tcpListener)\n\n\treturn tcpListener\n}", "title": "" }, { "docid": "e2f41147aaa1a7579956b67007ff19f8", "score": "0.66067564", "text": "func (c *Cluster) Listen() error {\n\tportstr := strconv.Itoa(c.self.Port)\n\tc.debug(\"Listening on port %d\", c.self.Port)\n\tln, err := net.Listen(\"tcp\", \":\"+portstr)\n\tif err != nil {\n\t\treturn err\n\t}\n\tdefer ln.Close()\n\t// save bound port back to Node in case where port is autoconfigured by OS\n\tif c.self.Port == 0 {\n\t\tc.debug(\"Port set to 0\")\n\t\tcolonPos := strings.LastIndex(ln.Addr().String(), \":\")\n\t\tif colonPos == -1 {\n\t\t\tc.debug(\"OS returned an address without a port.\")\n\t\t\treturn errors.New(\"OS returned an address without a port.\")\n\t\t}\n\t\tport, err := strconv.ParseInt(ln.Addr().String()[colonPos+1:], 10, 32)\n\t\tif err != nil {\n\t\t\tc.debug(\"Couldn't record autoconfigured port: %s\", err.Error())\n\t\t\treturn errors.New(\"Couldn't record autoconfigured port: \" + err.Error())\n\t\t}\n\t\tc.debug(\"Setting port to %d\", port)\n\t\tc.self.Port = int(port)\n\t}\n\tconnections := make(chan net.Conn)\n\tgo func(ln net.Listener, ch chan net.Conn) {\n\t\tfor {\n\t\t\tconn, err := ln.Accept()\n\t\t\tif err != nil {\n\t\t\t\tc.fanOutError(err)\n\t\t\t\treturn\n\t\t\t}\n\t\t\tc.debug(\"Connection received.\")\n\t\t\tch <- conn\n\t\t}\n\t}(ln, connections)\n\tfor {\n\t\tselect {\n\t\tcase <-c.kill:\n\t\t\treturn nil\n\t\tcase <-time.After(time.Duration(c.heartbeatFrequency) * time.Second):\n\t\t\tc.debug(\"Sending heartbeats.\")\n\t\t\tgo c.sendHeartbeats()\n\t\t\tbreak\n\t\tcase conn := <-connections:\n\t\t\tc.debug(\"Handling connection.\")\n\t\t\tgo c.handleClient(conn)\n\t\t\tbreak\n\t\tcase <-c.proximityCache.ticker:\n\t\t\tc.debug(\"Emptying proximity cache...\")\n\t\t\tgo c.clearProximityCache()\n\t\t\tbreak\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "05370301938045f6a6009d5fa8bb1fa5", "score": "0.6399463", "text": "func (n *Node) Listen() error {\r\n\tif n.listening.Load() {\r\n\t\treturn errors.New(\"node is already listenintg\")\r\n\t}\r\n\r\n\tvar err error\r\n\tdefer func() {\r\n\t\tif err != nil {\r\n\t\t\tn.listening.Store(false)\r\n\t\t}\r\n\t}()\r\n\r\n\tn.listener, err = net.Listen(\"tcp\", net.JoinHostPort(normalizeIP(n.host), strconv.FormatUint(uint64(n.port), 10)))\r\n\tif err != nil {\r\n\t\treturn err\r\n\t}\r\n\r\n\taddr, ok := n.listener.Addr().(*net.TCPAddr)\r\n\tif !ok {\r\n\t\tn.listener.Close()\r\n\t\treturn errors.New(\"Did not bind to TCP address\")\r\n\t}\r\n\r\n\tn.host = addr.IP\r\n\tn.port = uint16(addr.Port)\r\n\r\n\tif n.addr == \"\" {\r\n\t\tn.addr = net.JoinHostPort(normalizeIP(n.host), strconv.FormatUint(uint64(n.port), 10))\r\n\t\tn.id = NewID(n.publicKey, n.host, n.port)\r\n\t} else {\r\n\t\tresolved, err := ResolveAddress(n.addr)\r\n\t\tif err != nil {\r\n\t\t\tn.listener.Close()\r\n\t\t\treturn err\r\n\t\t}\r\n\r\n\t\thostStr, portStr, err := net.SplitHostPort(resolved)\r\n\t\tif err != nil {\r\n\t\t\tn.listener.Close()\r\n\t\t\treturn err\r\n\t\t}\r\n\r\n\t\thost := net.ParseIP(hostStr)\r\n\t\tif host == nil {\r\n\t\t\tn.listener.Close()\r\n\t\t\treturn errors.New(\"Host in provided public address is invalid(must be IPv4/IPv6)\")\r\n\t\t}\r\n\r\n\t\tport, err := strconv.ParseUint(portStr, 10, 16)\r\n\t\tif err != nil {\r\n\t\t\tn.listener.Close()\r\n\t\t\treturn err\r\n\t\t}\r\n\r\n\t\tn.id = NewID(n.publicKey, host, uint16(port))\r\n\t}\r\n\r\n\tfor _, protocol := range n.protocols {\r\n\t\tif protocol.Bind == nil {\r\n\t\t\tcontinue\r\n\t\t}\r\n\r\n\t\tif err = protocol.Bind(n); err != nil {\r\n\t\t\tn.listener.Close()\r\n\t\t\treturn err\r\n\t\t}\r\n\t}\r\n\r\n\tn.work = make(chan HandlerContext, int(n.numWorkers))\r\n\tn.workers.Add(int(n.numWorkers))\r\n\r\n\tfor i := uint(0); i < n.numWorkers; i++ {\r\n\t\tgo func() {\r\n\t\t\tdefer n.workers.Done()\r\n\t\t\tfor ctx := range n.work {\r\n\t\t\t\tfor _, handler := range n.handlers {\r\n\t\t\t\t\tif err := handler(ctx); err != nil {\r\n\t\t\t\t\t\tctx.client.Logger().Warn(\"Got an error executing a message handeler.\", zap.Error(err))\r\n\t\t\t\t\t\tctx.client.reportError(err)\r\n\t\t\t\t\t\tctx.client.close()\r\n\r\n\t\t\t\t\t\treturn\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}()\r\n\t}\r\n\r\n\tgo func() {\r\n\t\tn.listening.Store(true)\r\n\r\n\t\tdefer func() {\r\n\t\t\tn.inbound.release()\r\n\r\n\t\t\tclose(n.work)\r\n\t\t\tn.workers.Wait()\r\n\r\n\t\t\tn.listening.Store(false)\r\n\t\t\tclose(n.listenerDone)\r\n\t\t}()\r\n\r\n\t\tn.logger.Info(\"Listening for incoming peers.\",\r\n\t\t\tzap.String(\"bind_addr\", addr.String()),\r\n\t\t\tzap.String(\"ip_addr\", n.id.Address),\r\n\t\t\tzap.String(\"public_key\", n.publicKey.String()),\r\n\t\t\tzap.String(\"private_key\", n.privateKey.String()),\r\n\t\t)\r\n\r\n\t\tfor {\r\n\t\t\tconn, err := n.listener.Accept()\r\n\t\t\tif err != nil {\r\n\t\t\t\tn.listenerDone <- err\r\n\t\t\t\tbreak\r\n\t\t\t}\r\n\r\n\t\t\taddr := conn.RemoteAddr().String()\r\n\r\n\t\t\tclient, exists := n.inbound.get(n, addr)\r\n\t\t\tif !exists {\r\n\t\t\t\tgo client.inbound(conn, addr)\r\n\t\t\t}\r\n\t\t}\r\n\t}()\r\n\r\n\treturn nil\r\n}", "title": "" }, { "docid": "6e5bd865838a78f37e68770f8b1e9f82", "score": "0.6398286", "text": "func (t TCPMech) Listen(ctx context.Context, config Config, u *URI, opts []ListenerOption) (Listener, error) {\n\t// Construct the listener config\n\topts = append(opts, control{Control: tcpReuseAddr})\n\tlc, err := mkListenConfigPatch(opts, nil)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\t// Create the listener\n\tl, err := lc.Listen(ctx, \"tcp\", u.Host)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\t// Return a listener\n\treturn &TCPListener{\n\t\tL: l,\n\t\tURI: TCPAddr2URI(l.Addr()),\n\t}, nil\n}", "title": "" }, { "docid": "4074b48542777f95c548578227a6aee7", "score": "0.63156736", "text": "func setupServer(port string) net.Listener {\n server, err := net.Listen(\"tcp\", \":\" + port)\n errHandler(err, \"#Can not start server!\", true)\n return server\n}", "title": "" }, { "docid": "2022d6c1d6fe3f5a5a7f2a4610da701f", "score": "0.62311417", "text": "func (this *Protocol) ListenTcp(addr string) error {\n this.objMutex.Lock()\n defer this.objMutex.Unlock()\n\n tcpSrv := newtcpSrv(this)\n this.netObjects = append(this.netObjects, tcpSrv)\n\n _, err := tcpSrv.Start(addr)\n return err\n}", "title": "" }, { "docid": "b2692c64ade00606f686423fe325952b", "score": "0.6189014", "text": "func InitializeNodeServers(config *utils.Config) {\n\tfor i, node := range config.Nodes {\n\t\tln, err := net.Listen(\"tcp\", \":\"+node.Port)\n\t\tutils.CheckError(err)\n\t\t// Save listener to config\n\t\tconfig.Nodes[i].Server = ln\n\t}\n}", "title": "" }, { "docid": "a0f23286c48c5f7b43f9558624686284", "score": "0.6188961", "text": "func (ts *TcpServer) Listen(netWork, address string, max_handler_count int64) error {\n\t// if listener not close, try close it.\n\tif ts.listener != nil && !ts.isClosed {\n\t\terr := ts.Close()\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\tl, err := net.Listen(netWork, address)\n\tif err != nil {\n\t\treturn err\n\t}\n\tts.handlerSemaphore = semaphore.NewWeighted(max_handler_count)\n\tts.listener = l\n\tts.isClosed = false\n\treturn nil\n}", "title": "" }, { "docid": "7f88a2b5f34a63e733b10ba54026bef9", "score": "0.6170828", "text": "func (s tcpAddr) Listen() net.Listener {\n\tl, err := net.Listen(s.net, s.host+\":\"+s.port)\n\tif err != nil {\n\t\tlog.Fatalln(\"Listen():\", err)\n\t}\n\treturn l\n}", "title": "" }, { "docid": "ae3524568e6c780356b11e5f030f5331", "score": "0.61243486", "text": "func Listen(addr string, upgrader *websocket.Upgrader) (net.Listener, error) {\n\ttcpAddr, err := net.ResolveTCPAddr(\"tcp\", addr)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tif upgrader == nil {\n\t\tupgrader = &websocket.Upgrader{\n\t\t\tCheckOrigin: func(r *http.Request) bool {\n\t\t\t\treturn true\n\t\t\t},\n\t\t}\n\t}\n\tln := &Listener{\n\t\taddr: tcpAddr,\n\t\tupgrader: upgrader,\n\t\tacceptQueue: make(chan net.Conn, 4096),\n\t}\n\treturn ln, nil\n}", "title": "" }, { "docid": "691c636374ac115f825f38ad41f6664b", "score": "0.60751104", "text": "func Listen(laddr string) (net.Listener, error) { return ListenWithOptions(laddr, nil, 0, 0) }", "title": "" }, { "docid": "96dac176abbfda3604a6270a191ea0ec", "score": "0.60575575", "text": "func (config ServerConfig) Listen(address string) (net.Listener, error) {\n\taddr, resolveErr := pt.ResolveAddr(address)\n\tif resolveErr != nil {\n\t\treturn nil, resolveErr\n\t}\n\n\tln, err := net.ListenTCP(\"tcp\", addr)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn newReplicantTransportListener(ln, config), nil\n}", "title": "" }, { "docid": "cc6a45bebaa7bb2ade313f1caf7f5eb9", "score": "0.60538703", "text": "func (r *Raft) ListenTCP() {\n\treturn\n\t// rpcs := rpc.NewServer()\n\t// rpc.Register(r)\n\t// for {\n\t// \tconn, err := r.tcpListener.Accept()\n\t// \tif err != nil {\n\t// \t\tlog.Printf(\"Failed to accept. Err: %s\", err)\n\t// \t\tcontinue\n\t// \t}\n\t//\n\t// \tfmt.Printf(\"Accepted the connection from %s\\n\", conn.RemoteAddr())\n\t//\n\t// \tgo rpcs.ServeConn(conn)\n\t//\n\t// }\n}", "title": "" }, { "docid": "7a0a34b4d7450681df35d5ff24214a3a", "score": "0.6039768", "text": "func Listen(network, laddr string, config *Config) (net.Listener, error) {}", "title": "" }, { "docid": "d4c1845b605729a27931304736d52152", "score": "0.6037404", "text": "func listenOnAddr(addr string)(l net.Listener,err error){\r\n l,err=net.Listen(\"tcp\",addr)\r\n if err==nil{\r\n return\r\n }\r\n l,err=net.Listen(\"tcp\",\":0\")\r\n return \r\n}", "title": "" }, { "docid": "d850da6d85f2e6dc9e10c16fc752e08c", "score": "0.5987534", "text": "func listen() error {\n\tcer, err := tls.LoadX509KeyPair(\"server.crt\", \"server.key\")\n\tif err != nil {\n\t return err\n\t}\n\n\ttlsconfig := &tls.Config{Certificates: []tls.Certificate{cer}}\n\n\tl, err := tls.Listen(\"tcp\", \":\"+cfg.CnCPort, tlsconfig)\n\n\t//l, err := net.Listen(\"tcp\", \":\"+cfg.CnCPort)\n\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tlog.Println(\"Started CnC server at port \" + cfg.CnCPort)\n\n\tdefer l.Close()\n\tfor {\n\t\tconn, err := l.Accept()\n\t\tif err != nil {\n\t\t\tlog.Printf(\"TCP accept failed: %s\\n\", err)\n\t\t\tcontinue\n\t\t}\n\t\tgo handle(conn)\n\t}\n}", "title": "" }, { "docid": "fc76136a205a999916ac360931cdc5cb", "score": "0.59858435", "text": "func (ts *TCPTunServer) Listen() {\n\tgo ts.listenNode()\n\tgo ts.listenTun()\n}", "title": "" }, { "docid": "6dd6ce7f74384f023ad7282e46a8cbf1", "score": "0.59759915", "text": "func ListenTCP(network string, laddr *net.TCPAddr) (net.Listener, error) {\n\treturn nil, nil\n}", "title": "" }, { "docid": "63008ab73e4cb385262a736bd6b8c24f", "score": "0.59722656", "text": "func (s *Server) listen(fullHostOrPort ...string) error {\n\tfulladdr := ParseAddr(fullHostOrPort)\n\t//mux := http.NewServeMux() //we use the http's ServeMux for now as the top- middleware of the server, for now.\n\n\t//mux.Handle(\"/\", s.handler)\n\n\t//return http.ListenAndServe(s.config.Host+strconv.Itoa(s.config.Port), mux)\n\tlistener, err := net.Listen(\"tcp\", fulladdr)\n\n\tif err != nil {\n\t\t//panic(\"Cannot run the server [problem with tcp listener on host:port]: \" + fulladdr + \" err:\" + err.Error())\n\t\treturn err\n\t}\n\ts.listener = &tcpKeepAliveListener{listener.(*net.TCPListener)}\n\t//err = http.Serve(s.listener, s.handler)\n\t//TODO: MAKE IT RETURN A CHANNEL WITH AN ERROR IF NOT NIL THEN THE USER MUST KNOW .\n\t//I changed that because we need PostListen on the plugins, the blocking is made at the station level now.\n\tgo http.Serve(s.listener, s.handler)\n\tif err == nil {\n\t\ts.ListeningAddr = fulladdr\n\t\ts.IsRunning = true\n\t\ts.IsSecure = false\n\t\ts.CertFile = \"\"\n\t\ts.KeyFile = \"\"\n\t}\n\n\t//listener.Close()\n\n\treturn err\n}", "title": "" }, { "docid": "101c13a0c6606ebe6271fac98c2d541f", "score": "0.5966131", "text": "func (s *APIServer) Listen() error {\n\tlistener, err := net.Listen(\"tcp\", s.Config.Address)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"can't start listener for the API Server %s : %v\", s.Name, err)\n\t}\n\ts.Listener = listener\n\treturn nil\n}", "title": "" }, { "docid": "3f1b937d93c96e7ea9067bf30454e3d6", "score": "0.59189874", "text": "func StartTCPServer() {\n\n\thostAndPort := \":12000\"\n\tlistener := initServer(hostAndPort)\n\tfor {\n\t\tconn, err := listener.Accept()\n\t\tcheckError(err, \"Accept: \")\n\t\tgo connectionHandler(conn)\n\t}\n\n}", "title": "" }, { "docid": "96d2cca436634aed71476cbb0cdc3479", "score": "0.591735", "text": "func listenAndServeTCP(c *cli.Context) error {\n\n\tport := c.Int(`port`)\n\tif port <= 0 {\n\t\treturn fmt.Errorf(\"invalid port number, please specify a positive integer\")\n\t}\n\n\t// Create a tcp listener for the specified port\n\tl, err := net.Listen(`tcp`, `:`+strconv.Itoa(port))\n\tif err != nil {\n\t\treturn fmt.Errorf(\"Unable to listen for TCP connections on port %d: %v\", port, err)\n\t}\n\tdefer l.Close()\n\tlog.Printf(\"Listening for connections on port %d...\\n\", port)\n\n\t// Continuously handle requests on the connection.\n\t// The server blocks on the call to Accept new connections. Once a new client Connects\n\t// to the TCP port, the Accept function will return and the server will continue\n\t// to serve that request in a separate goroutine.\n\n\t// Unlike rpccalc.FifoConn, TCP connections can handle multiple clients connected\n\t// simultaneously, so we are able to serve each request in a separate goroutine.\n\tfor {\n\t\tconn, err := l.Accept()\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"Failed to accept incoming connection: %v\", err)\n\t\t}\n\t\tcodec := rpc.NewJSONCodec(conn)\n\t\tgo server.ServeCodec(codec, 0)\n\t}\n}", "title": "" }, { "docid": "816f62c58b0a8e47c9f0308d49aa6bd7", "score": "0.59124863", "text": "func (t *TCPConnector) Start(port string) {\n\tt.Port = port\n\tt.Listener()\n}", "title": "" }, { "docid": "c30362914cf440255677dc506c5996da", "score": "0.5911751", "text": "func ListenPort(port int) ConfigOption {\n\treturn func(c *Config) {\n\t\tc.port = port\n\t}\n}", "title": "" }, { "docid": "38a24966f3ab330dc178ba8dda887e34", "score": "0.5906767", "text": "func (sck *csocket) Listen(addr string) error {\n\t_, err := sck.sock.Bind(addr)\n\treturn err\n}", "title": "" }, { "docid": "c85dc7e13ed806488a9f1c011785b58d", "score": "0.589886", "text": "func Listen(ctx context.Context, clientset kubernetes.Interface, restConfig *rest.Config, addr Addr) (net.Listener, error) {\n\t// We connect through port forwarding. Strictly\n\t// speaking this is overkill because we don't need a local\n\t// port. But this way we can reuse client-go/tools/portforward\n\t// instead of having to replicate handleConnection\n\t// in our own code.\n\trestClient := clientset.CoreV1().RESTClient()\n\tif restConfig.GroupVersion == nil {\n\t\trestConfig.GroupVersion = &schema.GroupVersion{}\n\t}\n\tif restConfig.NegotiatedSerializer == nil {\n\t\trestConfig.NegotiatedSerializer = scheme.Codecs\n\t}\n\n\t// The setup code around the actual portforward is from\n\t// https://github.com/kubernetes/kubernetes/blob/c652ffbe4a29143623a1aaec39f745575f7e43ad/staging/src/k8s.io/kubectl/pkg/cmd/portforward/portforward.go\n\treq := restClient.Post().\n\t\tResource(\"pods\").\n\t\tNamespace(addr.Namespace).\n\t\tName(addr.PodName).\n\t\tSubResource(\"portforward\")\n\ttransport, upgrader, err := spdy.RoundTripperFor(restConfig)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"create round tripper: %w\", err)\n\t}\n\tdialer := spdy.NewDialer(upgrader, &http.Client{Transport: transport}, \"POST\", req.URL())\n\n\tprefix := fmt.Sprintf(\"port forwarding for %s\", addr)\n\tctx, cancel := context.WithCancel(ctx)\n\tl := &listener{\n\t\tctx: ctx,\n\t\tcancel: cancel,\n\t\taddr: addr,\n\t}\n\n\tvar connectionsCreated int\n\n\trunForwarding := func() {\n\t\tklog.V(2).Infof(\"%s: starting connection polling\", prefix)\n\t\tdefer klog.V(2).Infof(\"%s: connection polling ended\", prefix)\n\n\t\ttryConnect := time.NewTicker(connectionPollInterval)\n\t\tdefer tryConnect.Stop()\n\t\tfor {\n\t\t\tselect {\n\t\t\tcase <-ctx.Done():\n\t\t\t\treturn\n\t\t\tcase <-tryConnect.C:\n\t\t\t\tfunc() {\n\t\t\t\t\tl.mutex.Lock()\n\t\t\t\t\tdefer l.mutex.Unlock()\n\n\t\t\t\t\tfor i, c := range l.connections {\n\t\t\t\t\t\tif c == nil {\n\t\t\t\t\t\t\tklog.V(5).Infof(\"%s: trying to create a new connection #%d\", prefix, connectionsCreated)\n\t\t\t\t\t\t\tstream, err := dial(ctx, fmt.Sprintf(\"%s #%d\", prefix, connectionsCreated), dialer, addr.Port)\n\t\t\t\t\t\t\tif err != nil {\n\t\t\t\t\t\t\t\tklog.Errorf(\"%s: no connection: %v\", prefix, err)\n\t\t\t\t\t\t\t\treturn\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t// Make the connection available to Accept below.\n\t\t\t\t\t\t\tklog.V(5).Infof(\"%s: created a new connection #%d\", prefix, connectionsCreated)\n\t\t\t\t\t\t\tc := &connection{\n\t\t\t\t\t\t\t\tl: l,\n\t\t\t\t\t\t\t\tstream: stream,\n\t\t\t\t\t\t\t\taddr: addr,\n\t\t\t\t\t\t\t\tcounter: connectionsCreated,\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tl.connections[i] = c\n\t\t\t\t\t\t\tconnectionsCreated++\n\t\t\t\t\t\t\treturn\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}()\n\t\t\t}\n\t\t}\n\t}\n\n\t// Portforwarding and polling for connections run in the background.\n\tgo func() {\n\t\tfor {\n\t\t\trunning := false\n\t\t\tpod, err := clientset.CoreV1().Pods(addr.Namespace).Get(ctx, addr.PodName, metav1.GetOptions{})\n\t\t\tif err != nil {\n\t\t\t\tklog.V(5).Infof(\"checking for container %q in pod %s/%s: %v\", addr.ContainerName, addr.Namespace, addr.PodName, err)\n\t\t\t}\n\t\t\tfor i, status := range pod.Status.ContainerStatuses {\n\t\t\t\tif pod.Spec.Containers[i].Name == addr.ContainerName &&\n\t\t\t\t\tstatus.State.Running != nil {\n\t\t\t\t\trunning = true\n\t\t\t\t\tbreak\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif running {\n\t\t\t\tklog.V(2).Infof(\"container %q in pod %s/%s is running\", addr.ContainerName, addr.Namespace, addr.PodName)\n\t\t\t\trunForwarding()\n\t\t\t}\n\n\t\t\tselect {\n\t\t\tcase <-ctx.Done():\n\t\t\t\treturn\n\t\t\t// Sleep a bit before restarting. This is\n\t\t\t// where we potentially wait for the pod to\n\t\t\t// start.\n\t\t\tcase <-time.After(1 * time.Second):\n\t\t\t}\n\t\t}\n\t}()\n\n\treturn l, nil\n}", "title": "" }, { "docid": "408b58e4350ab03012de0d263037c01c", "score": "0.5883537", "text": "func (i *TCP) Listen() (net.Listener, error) {\n\taddr := i.Addr()\n\tif i.ip == \"localhost\" {\n\t\taddr = fmt.Sprintf(\":%d\", i.port)\n\t}\n\treturn net.Listen(\"tcp\", addr)\n}", "title": "" }, { "docid": "3ea99ca298cd48deab0250686da808bb", "score": "0.58796895", "text": "func (ln *LocalNode) listen() {\n\tlistener, err := ln.address.Transport.Listen(ln.port)\n\tif err != nil {\n\t\tln.Stop(fmt.Errorf(\"failed to listen to port %d\", ln.port))\n\t\treturn\n\t}\n\tln.listener = listener\n\n\tif ln.port == 0 {\n\t\t_, portStr, err := transport.SplitHostPort(listener.Addr().String())\n\t\tif err != nil {\n\t\t\tln.Stop(err)\n\t\t\treturn\n\t\t}\n\n\t\tif len(portStr) > 0 {\n\t\t\tport, err := strconv.Atoi(portStr)\n\t\t\tif err != nil {\n\t\t\t\tln.Stop(err)\n\t\t\t\treturn\n\t\t\t}\n\n\t\t\tln.SetInternalPort(uint16(port))\n\t\t}\n\t}\n\n\tif ln.address.Port == 0 {\n\t\tln.address.Port = ln.port\n\t\tln.Addr = ln.address.String()\n\t}\n\n\tfor {\n\t\t// listener.Accept() is placed before checking stops to prevent the error\n\t\t// log when local node is stopped and thus conn is closed\n\t\tconn, err := listener.Accept()\n\n\t\tif ln.IsStopped() {\n\t\t\tif err == nil {\n\t\t\t\tconn.Close()\n\t\t\t}\n\t\t\treturn\n\t\t}\n\n\t\tif err != nil {\n\t\t\tlog.Errorf(\"Error accepting connection: %v\", err)\n\t\t\ttime.Sleep(1 * time.Second)\n\t\t\tcontinue\n\t\t}\n\n\t\tshouldAccept := true\n\t\tvar shouldCallNextMiddleware bool\n\t\tfor _, mw := range ln.middlewareStore.connectionAccepted {\n\t\t\tshouldAccept, shouldCallNextMiddleware = mw.Func(conn)\n\t\t\tif !shouldAccept {\n\t\t\t\tbreak\n\t\t\t}\n\t\t\tif !shouldCallNextMiddleware {\n\t\t\t\tbreak\n\t\t\t}\n\t\t}\n\t\tif !shouldAccept {\n\t\t\tconn.Close()\n\t\t\tcontinue\n\t\t}\n\n\t\t_, loaded := ln.neighbors.LoadOrStore(conn.RemoteAddr().String(), nil)\n\t\tif loaded {\n\t\t\tlog.Errorf(\"Remote addr %s is already connected, reject connection\", conn.RemoteAddr().String())\n\t\t\tconn.Close()\n\t\t\tcontinue\n\t\t}\n\n\t\tlog.Infof(\"Remote node connect from %s to local address %s\", conn.RemoteAddr().String(), conn.LocalAddr())\n\n\t\trn, err := ln.StartRemoteNode(conn, false, nil)\n\t\tif err != nil {\n\t\t\tlog.Errorf(\"Error creating remote node: %v\", err)\n\t\t\tln.neighbors.Delete(conn.RemoteAddr().String())\n\t\t\tconn.Close()\n\t\t\tcontinue\n\t\t}\n\n\t\tln.neighbors.Store(conn.RemoteAddr().String(), rn)\n\t}\n}", "title": "" }, { "docid": "761462205d5ccd1b9f1dbc4532aad1a5", "score": "0.587685", "text": "func (b *Broker) ListenTCP() error {\n\tl, err := net.Listen(\"tcp\", fmt.Sprintf(\"%s:%d\", b.cfg.Hostname, b.cfg.Port))\n\tif err != nil {\n\t\treturn err\n\t}\n\tlog.WithFields(log.Fields{\n\t\t\"hostname\": b.cfg.Hostname,\n\t\t\"port\": b.cfg.Port,\n\t}).Info(\"Listening for incoming LightMQ connections\")\n\tdefer l.Close()\n\tfor {\n\t\tconn, err := l.Accept()\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"fail accepting connection %s\", err.Error())\n\t\t}\n\t\tgo b.handleTCPConnection(conn)\n\t}\n}", "title": "" }, { "docid": "306a9b3c322b563ddd529915c5c13348", "score": "0.5858719", "text": "func (server *WebServer) Listen() {\n\tln, err := net.Listen(\"tcp\", server.Addr())\n\tif err != nil {\n\t\tlog.Fatal(\"Failed to initalize server at \" + server.Addr())\n\t}\n\tserver.listener = ln\n\n\tfor {\n\t\tconn, _ := ln.Accept()\n\t\tgo server.handleConnection(conn)\n\t}\n}", "title": "" }, { "docid": "a8bcebbf3642c2a40117d952850b66a8", "score": "0.58460784", "text": "func Listen(addr string) (*SecureListener, error) {\n\tkp, err := NewKeyPair()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tl, err := net.Listen(\"tcp\", addr)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn NewSecureListener(l, kp), nil\n}", "title": "" }, { "docid": "e7a6de79cc0615a4a53c0ac4215855d9", "score": "0.58430296", "text": "func Listen() {\n\ttcpAddr, err := net.ResolveTCPAddr(\"tcp4\", DefaultPort)\n\tif err != nil {\n\t\tlog.Println(err)\n\t\tos.Exit(500) // TODO errors handling\n\t}\n\tlistener, err := net.ListenTCP(\"tcp\", tcpAddr)\n\tif err != nil {\n\t\tlog.Println(err)\n\t\tos.Exit(500) // TODO errors handling\n\t}\n\tlog.Printf(\"Listenning on port %s\\n\", DefaultPort)\n\tfor {\n\t\tconn, err := listener.Accept()\n\t\tif err != nil {\n\t\t\tcontinue // TODO errors handling\n\t\t}\n\t\t// Time out after 500ms (TODO handles timeout behavior)\n\t\tconn.SetDeadline(time.Now().Add(time.Millisecond * 500))\n\t\tn := Node{\n\t\t\tSocket: conn,\n\t\t}\n\t\tgo n.ProcessMessages()\n\t}\n}", "title": "" }, { "docid": "d1352aced7ecbc829b334a875404baec", "score": "0.5841618", "text": "func (self *TextprotoServerInterface) Listen(addr string, handler HandlerFn, waitGroup *sync.WaitGroup) {\n self.handler = handler\n defer waitGroup.Done()\n\n tcpAddr, resolveErr := net.ResolveTCPAddr(\"tcp\", addr)\n if resolveErr != nil {\n errLog.Printf(\"net.ResolveTCPAddr err=%v\\n\", resolveErr)\n return\n }\n\n tcpListener, listenErr := net.ListenTCP(\"tcp\", tcpAddr)\n if listenErr != nil {\n errLog.Printf(\"net.ListenTCP err=%v\\n\", listenErr)\n return\n }\n\n for {\n if tcpConn, acceptErr := tcpListener.AcceptTCP(); acceptErr != nil {\n errLog.Printf(\"tcpListener.AcceptTCP err=%v\\n\", acceptErr)\n return\n } else {\n go self.handleConn(tcpConn)\n }\n }\n}", "title": "" }, { "docid": "579879e15aa81ceffe83cc522b182744", "score": "0.58186626", "text": "func listenToArtnode(ipPort string) {\n\tmRPC := new(MinerRPC)\n\tserver := rpc.NewServer()\n\tregisterServer(server, mRPC)\n\tl, e := net.Listen(\"tcp\", fmt.Sprintf(\"127.0.0.1:%s\", artAppListenPort))\n\tif e != nil {\n\t\tlog.Fatal(\"listen error:\", e)\n\t}\n\n\tgo server.Accept(l)\n\truntime.Gosched()\n}", "title": "" }, { "docid": "aa6430d710d6ba36ee6f78dbbb3786e4", "score": "0.5797586", "text": "func listenForTCP() {\n\tConnTCP, err := net.Listen(\"tcp\", \":3000\")\n\tcheckError(err)\n\n\tfor {\n\n\t\tConn, _ := ConnTCP.Accept()\n\t\thandleClientTCP(Conn)\n\t\tlistenForUDP()\n\t}\n}", "title": "" }, { "docid": "4bd1fd9f3a6f4a6506d54e808685e174", "score": "0.579104", "text": "func main() {\r\n\tvar port int\r\n\tflag.IntVar(&port, \"p\", 8080, \"port\")\r\n\tflag.Parse()\r\n\tfmt.Println(port)\r\n\r\n\tlistener, err := net.Listen(\"tcp\", \"localhost:\"+strconv.Itoa(port))\r\n\tif err != nil {\r\n\t\tlog.Fatal(err)\r\n\t}\r\n\r\n\tfor {\r\n\t\tconn, err := listener.Accept()\r\n\t\tif err != nil {\r\n\t\t\tlog.Print(err)\r\n\t\t\tcontinue\r\n\t\t}\r\n\t\tgo handleConn(conn)\r\n\t}\r\n}", "title": "" }, { "docid": "e7d5bca07ba6051c03fce9959d2d3a3a", "score": "0.57793635", "text": "func (cfg Config) Listen() (hostport string, e error) {\n\turi, e := url.Parse(cfg.HTTPUri)\n\tif e != nil {\n\t\treturn \"\", e\n\t}\n\n\tif uri.Scheme != \"http\" || strings.TrimPrefix(uri.Path, \"/\") != \"\" {\n\t\treturn \"\", errors.New(\"GraphQL server URI should have 'http' scheme and '/' path\")\n\t}\n\n\thost, port := uri.Hostname(), uri.Port()\n\tif port == \"\" {\n\t\tport = \"80\"\n\t}\n\treturn net.JoinHostPort(host, port), nil\n}", "title": "" }, { "docid": "f62722febc246881a611e46a0462a074", "score": "0.57760894", "text": "func (c *Client) listen() error {\n\tc.setDefaultPort(&c.ClientHostPort, \":\"+common.DefaultClientPortHTTP)\n\tc.setDefaultPort(&c.ServerPort, common.DefaultServerPort)\n\n\tc.mux = http.NewServeMux() // Using default mux creates problem in unit tests\n\tc.mux.Handle(\"/\", crossdock.Handler(c.Behaviors, true))\n\n\tlistener, err := net.Listen(\"tcp\", c.ClientHostPort)\n\tif err != nil {\n\t\treturn err\n\t}\n\tc.listener = listener\n\tc.ClientHostPort = listener.Addr().String() // override in case it was \":0\"\n\treturn nil\n}", "title": "" }, { "docid": "ce513d11fb96393dcf29d5d76338b6aa", "score": "0.57471913", "text": "func listen(port string) {\n\tln, err := net.Listen(\"tcp\", \":\"+port)\n\tif err != nil {\n\t\tlog.Fatal(\"Error creating listener on port \", port, \": \", err.Error())\n\t}\n\n\tfor {\n\t\tconn, err := ln.Accept()\n\t\tif err != nil {\n\t\t\tlog.Fatal(\"Error accepting connection on port\", port, \": \", err.Error())\n\t\t}\n\t\tconn.SetDeadline(time.Now().Add(15 * time.Minute))\n\t\tgo handle(conn, port)\n\t}\n}", "title": "" }, { "docid": "504a7b8dd468e23b7773dfc83dff6528", "score": "0.5746538", "text": "func Listen(port, certLocation string, location string) error {\n\tcer, err := tls.LoadX509KeyPair(certLocation+\"/server.crt\", certLocation+\"/server.key\")\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tconfig := &tls.Config{Certificates: []tls.Certificate{cer}}\n\tln, err := tls.Listen(\"tcp\", \":\"+port, config)\n\tif err != nil {\n\t\treturn err\n\t}\n\tdefer ln.Close()\n\n\tlog.Info(\"server started, ready to accept commands\", log.SysLog, map[string]interface{}{})\n\n\tfor {\n\t\tconn, err := ln.Accept()\n\t\tif err != nil {\n\t\t\tlog.Error(err.Error(), log.SysLog, map[string]interface{}{})\n\t\t\tcontinue\n\t\t}\n\t\tgo handleConnection(conn, location)\n\t}\n}", "title": "" }, { "docid": "5c508793c7b4d4b5ae454713bcd15ac6", "score": "0.574419", "text": "func (d *W5500) SocketLISTEN(socket uint8) error {\n\treturn d.WriteSocketRegisters(socket, 0x0001, []byte{0x02}) // LISTEN\n}", "title": "" }, { "docid": "38bcd4a12c55315ea470cf8e8fd89f8c", "score": "0.57147825", "text": "func (xpub *xpubSocket) Listen(ep string) error {\n\treturn xpub.sck.Listen(ep)\n}", "title": "" }, { "docid": "7969a65268f197fb929a4607698062b2", "score": "0.5696573", "text": "func turnServerUp(port string) (net.Listener){\n fmt.Println(\"--- Launching server in port: \" + port + \"...\")\n // listen on all interfaces,\n ln, _ := net.Listen(\"tcp\", \":\" + port)\n return ln\n}", "title": "" }, { "docid": "8aebe14c66e1435d6fac071a8ba393cc", "score": "0.56841785", "text": "func (app *App) Listen() error {\n\tlis, err := net.Listen(\"tcp\", fmt.Sprintf(\"%s:%d\", app.config.App.Host, app.config.App.Port))\n\tif err != nil {\n\t\treturn err\n\t}\n\treturn app.grpcServer.Serve(lis)\n}", "title": "" }, { "docid": "e7d1c7e7b5024ad83ce29faa49cccfba", "score": "0.5674892", "text": "func (t *TCP) Listen() {\n\taddr, err := net.ResolveTCPAddr(\"tcp\", \":\"+t.port)\n\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\n\tl, err := net.ListenTCP(\"tcp4\", addr)\n\tif err != nil {\n\t\tt.log.Fatal(\"Cannot listen on socket\", err)\n\t}\n\n\t// figure out the port bind for Port()\n\tt.port = strings.Split(l.Addr().String(), \":\")[1]\n\n\tfor {\n\t\tconn, err := l.AcceptTCP()\n\t\tif err != nil {\n\t\t\tt.log.Fatal(err)\n\t\t}\n\n\t\tgo t.readMessage(conn)\n\t}\n}", "title": "" }, { "docid": "072ac982370199c223a55044c7b44def", "score": "0.56709063", "text": "func Listen(network, addr string, config *ServerConfig) (*Listener, error) {\n\tl, err := net.Listen(network, addr)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn &Listener{\n\t\tl,\n\t\tconfig,\n\t}, nil\n}", "title": "" }, { "docid": "5db7057da22e0d8068209074ff3b12c9", "score": "0.5669304", "text": "func listenTCP() (net.Listener, string) {\n\tl, e := net.Listen(\"tcp\", \"127.0.0.1:0\") // any available address\n\tif e != nil {\n\t\tlog.Fatalf(\"net.Listen tcp :0: %v\", e)\n\t}\n\treturn l, l.Addr().String()\n}", "title": "" }, { "docid": "77701edfa42c1c889a9eb11ffec44b31", "score": "0.5666237", "text": "func StartTCP(port string) {\n\t\n\t\n\tln, err := net.Listen(\"tcp\", \":\"+port)\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t\tpanic(\"Server Failed:\")\n\t}\n\n\tfor {\n\n\t\t\n\t\tconn, err := ln.Accept()\n\t\tif err != nil {\n\t\t\tlog.Fatal(\"Accept() Error:\")\n\t\t}\n\t\tTrace (log.Printf, \"Connected to %v\\n\", conn)\n\t\tgo QWorker(conn)\n\t}\n\n}", "title": "" }, { "docid": "ed0d52e8b3c87a26da0ae12a63f972ea", "score": "0.5664216", "text": "func (s *ServerHTTPS) Listen() (net.Listener, error) {\n\tl, err := reuseport.Listen(\"tcp\", s.Addr[len(transport.HTTPS+\"://\"):])\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn l, nil\n}", "title": "" }, { "docid": "69ddf89d13c9b8494546c355e172959e", "score": "0.56540173", "text": "func WithTCPListener(address string) Option {\n\treturn func(o *Options) error {\n\t\tsocket, err := net.Listen(\"tcp\", address)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tif o.Listener != nil {\n\t\t\tsocket.Close()\n\t\t\treturn fmt.Errorf(\"listener already configured: %s\", address)\n\t\t}\n\t\to.Listener = socket\n\t\treturn nil\n\t}\n}", "title": "" }, { "docid": "6f6d15b1c0ffbb47f4eb8d24a12b2b4c", "score": "0.5651007", "text": "func (s *Server) Listen(protocol Protocol, ip net.IP, port int) error {\n\t//check input arguments for errors\n\tif !isValidProtocol(protocol) {\n\t\treturn Error{ErrorTypeFatal, \"NewServer\", \"Invalid protocol specified\"}\n\t}\n\n\tif port < 0 {\n\t\treturn Error{ErrorTypeFatal, \"NewServer\", \"Invalid listening port specified\"}\n\t}\n\n\t//convert IP and port to string\n\tvar buffer bytes.Buffer\n\n\tif ip != nil {\n\t\tbuffer.WriteString(ip.String())\n\t}\n\n\tbuffer.WriteString(\":\")\n\tbuffer.WriteString(strconv.Itoa(port))\n\n\t//listen on a new port\n\tif isTCPProtocol(protocol) {\n\t\t//resolve address into tcp address\n\t\ttcpAddress, err := net.ResolveTCPAddr(protocolMap[protocol], buffer.String())\n\n\t\tif err != nil {\n\t\t\treturn ErrorEmbedded{ErrorTypeFatal, \"Server\", \"Failed to resolve TCP address\", err}\n\t\t}\n\n\t\t//create new TCP port\n\t\tnewListener, err := net.ListenTCP(protocolMap[protocol], tcpAddress)\n\n\t\t//check if the connection was handled correctly\n\t\tif err != nil {\n\t\t\treturn ErrorEmbedded{ErrorTypeFatal, \"Server\", \"Failed to listen on a new TCP port\", err}\n\t\t}\n\n\t\t//new TCP port\n\t\ts.listeners = append(s.listeners, serverListener{protocol,\n\t\t\tbuffer.String(), wrapTCPListener{newListener}, make(chan int)})\n\t\tnewEntry := &s.listeners[len(s.listeners)-1]\n\n\t\ts.waitGroupListeners.Add(1)\n\t\tgo serverRoutine(s.newConnections, s.listenerErrors, newEntry.quit, newEntry.listener,\n\t\t\ts.deadlineListen, &s.waitGroupListeners)\n\t} else {\n\t\t//resolve address into unix address\n\t\tunixAddress, err := net.ResolveUnixAddr(protocolMap[protocol], buffer.String())\n\n\t\tif err != nil {\n\t\t\treturn ErrorEmbedded{ErrorTypeFatal, \"Server\", \"Failed to resolve unix address\", err}\n\t\t}\n\n\t\t//create new Unix port\n\t\tnewListener, err := net.ListenUnix(protocolMap[protocol], unixAddress)\n\n\t\t//check if the connection was created correctly\n\t\tif err != nil {\n\t\t\treturn ErrorEmbedded{ErrorTypeFatal, \"Server\", \"Failed to listen on a new Unix port\", err}\n\t\t}\n\n\t\t//new Unix port\n\t\ts.listeners = append(s.listeners, serverListener{protocol,\n\t\t\tbuffer.String(), wrapUnixListener{newListener}, make(chan int)})\n\t\tnewEntry := &s.listeners[len(s.listeners)-1]\n\n\t\ts.waitGroupListeners.Add(1)\n\t\tgo serverRoutine(s.newConnections, s.listenerErrors, newEntry.quit, newEntry.listener,\n\t\t\ts.deadlineListen, &s.waitGroupListeners)\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "b66421b2dc7dc4f8481fa51fa89e30a5", "score": "0.56437314", "text": "func (s *Server) Listen(ip string, port int) {\n\tln, err := net.Listen(\"tcp\", fmt.Sprintf(\"%s:%d\", ip, port))\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\n\tfor {\n\t\tconn, err := ln.Accept()\n\t\tif err != nil {\n\t\t\tfmt.Println(\"[ERROR]\", err)\n\t\t}\n\t\ts.Sessions <- &conn\n\t}\n}", "title": "" }, { "docid": "a48b410b913413337b51e528e6ce7c96", "score": "0.5636363", "text": "func (cm *CodaConnectionManager) Listen(net network.Network, addr ma.Multiaddr) {\n\tcm.p2pManager.Notifee().Listen(net, addr)\n}", "title": "" }, { "docid": "cefd5bd7432b09c25ed499fac378b6af", "score": "0.56204027", "text": "func (s *Session) ListenTCP(opts *proto.TCPOptions, extra interface{}) (*Tunnel, error) {\n\treturn s.Listen(\"tcp\", opts, extra)\n}", "title": "" }, { "docid": "29a521afb428b19b54ae541ace59912d", "score": "0.56152385", "text": "func (b *Bootstrapper) Listen(addr string, cfgs ...iris.Configurator) {\n\tb.Run(iris.Addr(addr), cfgs...)\n}", "title": "" }, { "docid": "9a10eff2740f10a039b1d68f7f62426d", "score": "0.560784", "text": "func (router *routerSocket) Listen(ep string) error {\n\treturn router.sck.Listen(ep)\n}", "title": "" }, { "docid": "2a0f2f4ab3155c09a092189a7253b7f2", "score": "0.56026137", "text": "func (p *Proxy) Listen(ctx context.Context) error {\n\tlistener, err := net.ListenTCP(Network, &net.TCPAddr{\n\t\tPort: DefaultPort,\n\t})\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tfor {\n\t\tconn, err := listener.AcceptTCP()\n\t\tif err != nil {\n\t\t\tlog.Printf(\"err tcp during connection: %v\", err)\n\t\t\tcontinue\n\t\t}\n\t\tlog.Printf(\"proxy: received new connect\")\n\n\t\tp.Lock()\n\t\tp.channel = channel.NewChannel(conn)\n\t\tp.Unlock()\n\n\t\tlog.Printf(\"proxy: channel connected\")\n\t\t// kick off recv side of channel\n\t\tgo p.channel.Recv(ctx)\n\t\t// blocks until ctx is canceled or an underlying\n\t\t// tcp error is detected.\n\t\tp.channel.Ping(ctx)\n\t\tlog.Printf(\"proxy: channel disconnected\")\n\t}\n}", "title": "" }, { "docid": "933ed9ebd084981be0ed44b87782ccee", "score": "0.5595202", "text": "func Listen(s int, n int) (err error) {\n\t_, _, e1 := Syscall(SYS_LISTEN, uintptr(s), uintptr(n), 0)\n\tif e1 != 0 {\n\t\terr = errnoErr(e1)\n\t}\n\treturn\n}", "title": "" }, { "docid": "329969aae0bd954296793360e6ad838e", "score": "0.55892473", "text": "func StartTCP() {\n\tfor _, bind := range Conf.TCPBind {\n\t\tglog.Infof(\"start tcp listen addr:\\\"%s\\\"\", bind)\n\t\tgo tcpListen(bind)\n\t}\n}", "title": "" }, { "docid": "18f7d64e2e64d6ec0b2fb397ede4ef65", "score": "0.55817103", "text": "func main() {\n\tlistener, err := net.Listen(\"tcp\", \":8080\")\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\tdefer listener.Close()\n\n\tfor {\n\t\tcnn, err := listener.Accept()\n\t\tif err != nil {\n\t\t\tlog.Println(err)\n\t\t}\n\n\t\tfmt.Fprint(cnn, \"I see you connected.\")\n\t\tcnn.Close()\n\t}\n}", "title": "" }, { "docid": "5f2033a484dcf02270e6a4fe6105b302", "score": "0.5573216", "text": "func Start(host string, port int) (err error) {\n\tif host == \"\" {\n\t\thost = props.GetString(\"host\", \"\")\n\t}\n\tif port == 0 {\n\t\tport = props.GetInt(\"port\", 8899)\n\t}\n\n\tvar net gracenet.Net\n\tln, err = net.Listen(\"tcp\", host+\":\"+strconv.Itoa(port))\n\n\tif err != nil {\n\t\tlog.Infof(\"can't start this server because of %v\", err)\n\t\treturn\n\t}\n\n\tlog.Infof(\"Server started at %s\", ln.Addr().String())\n\n\tfor {\n\t\tconn, err := ln.Accept()\n\t\tif err == nil {\n\t\t\tgo HandleConn(conn)\n\t\t}\n\t}\n}", "title": "" }, { "docid": "1cae10d0632ee6e9cba174287a31ffcf", "score": "0.55621004", "text": "func (t *TCPServer) Run() {\n\tvar err error\n\tt.server, err = net.Listen(\"tcp\", t.addr)\n\tdefer t.Close()\n\n\tif err != nil {\n\t\tt.logger.Printf(\"Failed to create listener on port %s with error %v\", t.addr, err)\n\t\tos.Exit(1)\n\t}\n\n\tt.logger.Printf(\"telnet-server listening on %s\\n\", t.server.Addr())\n\n\tfor {\n\t\tconn, err := t.server.Accept()\n\t\tif err != nil {\n\t\t\terr = errors.New(\"could not accept connection\")\n\t\t\tt.metrics.IncrementConnectionErrors()\n\t\t\tcontinue\n\t\t}\n\t\tif conn == nil {\n\t\t\terr = errors.New(\"could not create connection\")\n\t\t\tt.metrics.IncrementConnectionErrors()\n\t\t\tcontinue\n\t\t}\n\t\tconn.Write([]byte(banner() + \"\\n\"))\n\t\tgo t.handleConnections(conn)\n\t}\n}", "title": "" }, { "docid": "7fbb024ff022ef7c3af95928b9ab67b4", "score": "0.5561073", "text": "func Listen(host string) (Listener, error) {\n\tr := &tfoListener{}\n\n\taddr, err := net.ResolveTCPAddr(\"tcp6\", host)\n\tif err == nil {\n\t\t//addr.IP存放的是ipv6地址,直接复制\n\t\tcopy(r.ServerAddr[:], addr.IP)\n\t} else {\n\t\t//不是ipv6地址,尝试解析ipv4地址\n\t\taddr, err = net.ResolveTCPAddr(\"tcp4\", host)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tif bytes.HasSuffix(addr.IP, []byte{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}) {\n\t\t\t//addr.IP前4字节存放ipv4地址,转为ipv4映射ipv6\n\t\t\tcopy(r.ServerAddr[:12], []byte{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff})\n\t\t\tcopy(r.ServerAddr[12:], addr.IP[:4])\n\t\t} else {\n\t\t\t//addr.IP存放的是ipv4映射ipv6地址 直接复制\n\t\t\tcopy(r.ServerAddr[:], addr.IP)\n\t\t}\n\t}\n\tr.ServerPort = addr.Port\n\n\tr.fd, err = syscall.Socket(syscall.AF_INET6, syscall.SOCK_STREAM, 0)\n\tif err != nil {\n\t\tif err == syscall.ENOPROTOOPT {\n\t\t\treturn nil, ErrTFONotSupport\n\t\t}\n\t\treturn nil, err\n\t}\n\tsyscall.SetsockoptInt(r.fd, syscall.SOL_SOCKET, syscall.SO_REUSEADDR, 1)\n\terr = syscall.Bind(r.fd, &syscall.SockaddrInet6{Addr: r.ServerAddr, Port: r.ServerPort})\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\terr = syscall.SetsockoptInt(r.fd, syscall.IPPROTO_TCP, TCPFastOpen, 3)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\terr = syscall.Listen(r.fd, ListenBacklog)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn r, nil\n}", "title": "" }, { "docid": "aa1a8c484e5dde303d009087a7751001", "score": "0.5560068", "text": "func InitTcpListener(address string) (net.Listener, error) {\n\ttcpAddr, err := net.ResolveTCPAddr(\"tcp\", address)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tlistener, err := net.ListenTCP(\"tcp\", tcpAddr)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tlogger.Infof(\"Init TCP Address[ %s ]\", address)\n\n\treturn listener, nil\n}", "title": "" }, { "docid": "461681df6cae3c971f35f1b7b6e5b6c2", "score": "0.55556005", "text": "func (s *Server) Serve() error {\n\tln, err := net.Listen(\"tcp\", s.addr)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\treturn s.configListener(ln)\n}", "title": "" }, { "docid": "27338e23c99e0a2eb21db9bbe38225be", "score": "0.55548805", "text": "func (d *DiscordClient) ListenConfigure(shardCount int, shardID int) (<-chan Message, error) {\n\terr := d.shardListenConfigure(1, shardCount, shardID)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn d.messageChan, err\n}", "title": "" }, { "docid": "224752175bca14b9266a7b1654dc00f5", "score": "0.555164", "text": "func (s *TCPServer) Listen() {\n\ts.ConnectionManager.stop = make(chan interface{})\n\tsrv, err := net.ListenTCP(\"tcp4\", s.NetAddr)\n\tif err != nil {\n\t\tglog.Errorf(\"error creating server: %s\\n\", err.Error())\n\t}\n\n\ts.startTime = time.Now()\n\n\tglog.Infof(\"server listening on: %s\\n\", s.NetAddr.String())\n\n\tfor {\n\t\tconn, err := srv.AcceptTCP()\n\t\tif err != nil {\n\t\t\tglog.Errorf(\"error accepting connection: %s\\n\", err.Error())\n\t\t}\n\t\tglog.V(10).Infof(\"got connection from: %s\", conn.RemoteAddr().String())\n\t\tif shouldReject(conn) {\n\t\t\tglog.V(10).Infof(\"kicked: %s\", conn.RemoteAddr().String())\n\t\t\tconn.Close()\n\t\t\tcontinue\n\t\t}\n\t\tconn.SetKeepAlive(true)\n\t\t_, err = conn.Write(packet.StrangePacket.MarshalBinary())\n\t\tif err != nil {\n\t\t\tglog.Errorf(\"error writing SP: %s\", err.Error())\n\t\t\treturn\n\t\t}\n\n\t\tctx := context.WithValue(context.Background(), \"UserConn\", conn)\n\n\t\tsource := s.ConnectionManager.ReadFrom(conn)\n\t\tsource = s.AuthManager.RegisterDataSource(ctx, source)\n\t\tsource = s.GameManager.RegisterDataSource(ctx, source)\n\t\ts.ConnectionManager.Write(conn, source)\n\t}\n}", "title": "" }, { "docid": "109bea87b19b838fad1ac7ff978eb468", "score": "0.5550629", "text": "func (s *Server) Listen(listen func()) {\n\tfor _, port := range allKeys(s.mux.defaultHandles, s.mux.handles) {\n\t\tgo func(port uint) {\n\t\t\thandle := httpHandle(s, port)\n\t\t\tif s.TLSConfig != nil {\n\t\t\t\tsev := &http.Server{\n\t\t\t\t\tAddr: utoa(port),\n\t\t\t\t\tTLSConfig: s.TLSConfig,\n\t\t\t\t\tHandler: handle,\n\t\t\t\t\tReadTimeout: 5 * time.Second,\n\t\t\t\t\tWriteTimeout: 10 * time.Second,\n\t\t\t\t\tIdleTimeout: 120 * time.Second,\n\t\t\t\t}\n\t\t\t\tsev.ListenAndServeTLS(\"\", \"\")\n\t\t\t} else if s.TLS != nil {\n\t\t\t\thttp.ListenAndServeTLS(\":\"+utoa(port), s.TLS.pubKey, s.TLS.priKey, handle)\n\t\t\t} else {\n\t\t\t\thttp.ListenAndServe(\":\"+utoa(port), handle)\n\t\t\t}\n\t\t}(port)\n\t}\n\tlisten()\n}", "title": "" }, { "docid": "89a54d95ffb00dc03a0962026cd9f3e2", "score": "0.5548338", "text": "func createListener(port string) (listener net.Listener) {\n\n\tlistener, err := net.Listen(\"tcp\", strings.Join([]string{\":\", port}, \"\"))\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\n\treturn listener\n}", "title": "" }, { "docid": "a25755d7d842082f3e2000231a31933b", "score": "0.554567", "text": "func (server *Server) Listen() {\n\n\tipport := server.Session.GetServerIPPort()\n\n\tvar err error\n\tvar l net.Listener\n\n\tif server.Session.Config.TLSParams.UseTLS {\n\t\tl, err = tls.Listen(\"tcp\", ipport, server.Session.Config.TLSParams.TLSConfig)\n\t} else {\n\t\tl, err = net.Listen(\"tcp\", ipport)\n\t}\n\n\tif err != nil {\n\t\tlog.Fatalf(\"Error listening : %s\", err.Error())\n\t}\n\t// Close the listener when the application closes.\n\tdefer l.Close()\n\n\tlog.Infof(\"Listenning on : %s\", ipport)\n\n\tfor {\n\t\t// Listen for an incoming connection.\n\t\tconn, err := l.Accept()\n\t\tif err != nil {\n\t\t\tlog.Fatalf(\"Error accepting : %s\", err.Error())\n\t\t}\n\n\t\t// Handle connections in a new goroutine. (multi-client)\n\t\tgo server.handleRequest(conn)\n\t}\n}", "title": "" }, { "docid": "adcc3532f586c6dbee0aaa4daa3deb4e", "score": "0.5534078", "text": "func listen(ctx context.Context, args []string) error {\n\tvar err error\n\tvar localIP net.IP\n\tvar localPort uint16\n\n\t// Validation\n\t// In listen mode, hostname and port control the address the server will bind to.\n\tlocalIP = net.ParseIP(args[0])\n\tif localIP == nil {\n\t\treturn fmt.Errorf(\"Invalid hostname %s\", args[0])\n\t}\n\n\tintfName, err := getInterfaceFromIP(localIP)\n\tif err != nil {\n\t\treturn errors.Wrapf(err, \"Invalid local IP: %s\", args[0])\n\t}\n\n\t// override the interface if specified\n\tif flagInterface != \"\" {\n\t\tintfName = flagInterface\n\t}\n\n\ti, err := strconv.Atoi(args[1])\n\tlocalPort = uint16(i)\n\tif err != nil || localPort == 0 {\n\t\treturn fmt.Errorf(\"Invalid local Port: %s\", args[1])\n\t}\n\tif flagSrcPort != 0 {\n\t\treturn fmt.Errorf(\"Source port flag only available in connect mode: %d\", flagSrcPort)\n\t}\n\n\t// Defaulting\n\n\t// Use TCP by default\n\ttransportProtocol := tcp.NewProtocol\n\ttransportProtocolNumber := tcp.ProtocolNumber\n\tif flagUDP {\n\t\ttransportProtocol = udp.NewProtocol\n\t\ttransportProtocolNumber = udp.ProtocolNumber\n\t}\n\n\t// Use IPv4 or IPv6 depending on the destination address\n\tisIPv6 := isIPv6Address(localIP)\n\tprotocolNumber := ipv4.ProtocolNumber\n\tnetworkProtocol := ipv4.NewProtocol\n\tfamily := netlink.FAMILY_V4\n\tif isIPv6 {\n\t\tprotocolNumber = ipv6.ProtocolNumber\n\t\tnetworkProtocol = ipv6.NewProtocol\n\t\tfamily = netlink.FAMILY_V6\n\t}\n\n\tmtu, err := rawfile.GetMTU(intfName)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"Failed to get interface %s MTU: %v\", intfName, err)\n\t}\n\n\tifaceLink, err := netlink.LinkByName(intfName)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"unable to bind to %q: %v\", intfName, err)\n\t}\n\n\tlog.Printf(\"Creating raw socket\")\n\t// https://github.com/google/gvisor/blob/108410638aa8480e82933870ba8279133f543d2b/test/benchmarks/tcp/tcp_proxy.go\n\tfd, err := unix.Socket(unix.AF_PACKET, unix.SOCK_RAW, int(htons(unix.ETH_P_ALL)))\n\tif err != nil {\n\t\treturn fmt.Errorf(\"Could not create socket: %s\", err.Error())\n\t}\n\tdefer unix.Close(fd)\n\n\tif fd < 0 {\n\t\treturn fmt.Errorf(\"Socket error: return < 0\")\n\t}\n\n\tif err = unix.SetNonblock(fd, true); err != nil {\n\t\treturn fmt.Errorf(\"Error setting fd to nonblock: %s\", err)\n\t}\n\n\tll := unix.SockaddrLinklayer{\n\t\tProtocol: htons(unix.ETH_P_ALL),\n\t\tIfindex: ifaceLink.Attrs().Index,\n\t\tPkttype: unix.PACKET_HOST,\n\t}\n\n\tif err := unix.Bind(fd, &ll); err != nil {\n\t\treturn fmt.Errorf(\"unable to bind to %q: %v\", \"iface.Name\", err)\n\t}\n\n\t// Add a filter to the socket so we receive only the packets we are interested\n\t// TODO we can make this more restrictive with source IP and source Port\n\t// xref: https://blog.cloudflare.com/bpf-the-forgotten-bytecode/\n\n\t// offset 23 protocol 6 TCP 17 UDP\n\tbpfProto := uint32(6)\n\tif flagUDP {\n\t\tbpfProto = uint32(17)\n\t}\n\tbpfFilter := []bpf.Instruction{\n\t\t// check the ethertype\n\t\tbpf.LoadAbsolute{Off: 12, Size: 2},\n\t\t// allow arp\n\t\tbpf.JumpIf{Val: 0x0806, SkipTrue: 10},\n\t\t// check is ipv4\n\t\tbpf.JumpIf{Val: 0x0800, SkipFalse: 10},\n\t\t// check the protocol\n\t\tbpf.LoadAbsolute{Off: 23, Size: 1},\n\t\tbpf.JumpIf{Val: bpfProto, SkipFalse: 8},\n\t\t// check the destination address\n\t\tbpf.LoadAbsolute{Off: 30, Size: 4},\n\t\tbpf.JumpIf{Val: binary.BigEndian.Uint32(localIP.To4()), SkipFalse: 6},\n\t\t// skip if offset non zero\n\t\tbpf.LoadAbsolute{Off: 20, Size: 2},\n\t\tbpf.JumpIf{Cond: bpf.JumpBitsSet, Val: 0x1fff, SkipTrue: 4},\n\t\t// check the destination port\n\t\tbpf.LoadMemShift{Off: 14},\n\t\tbpf.LoadIndirect{Off: 16, Size: 2},\n\t\tbpf.JumpIf{Val: uint32(localPort), SkipFalse: 1},\n\t\tbpf.RetConstant{Val: 0xffff},\n\t\tbpf.RetConstant{Val: 0x0},\n\t}\n\n\tif isIPv6 {\n\t\tbpfFilter = []bpf.Instruction{\n\t\t\t// check the ethertype\n\t\t\tbpf.LoadAbsolute{Off: 12, Size: 2},\n\t\t\tbpf.JumpIf{Val: 0x86dd, SkipFalse: 14},\n\t\t\t// check the protocol\n\t\t\tbpf.LoadAbsolute{Off: 20, Size: 1},\n\t\t\t// allow icmpv6\n\t\t\tbpf.JumpIf{Val: 58, SkipTrue: 11},\n\t\t\tbpf.JumpIf{Val: bpfProto, SkipFalse: 11},\n\t\t\t// check the destination address\n\t\t\tbpf.LoadAbsolute{Off: 38, Size: 4},\n\t\t\tbpf.JumpIf{Val: binary.BigEndian.Uint32(localIP.To16()[0:4]), SkipFalse: 9},\n\t\t\tbpf.LoadAbsolute{Off: 42, Size: 4},\n\t\t\tbpf.JumpIf{Val: binary.BigEndian.Uint32(localIP.To16()[4:8]), SkipFalse: 7},\n\t\t\tbpf.LoadAbsolute{Off: 46, Size: 4},\n\t\t\tbpf.JumpIf{Val: binary.BigEndian.Uint32(localIP.To16()[8:12]), SkipFalse: 5},\n\t\t\tbpf.LoadAbsolute{Off: 50, Size: 4},\n\t\t\tbpf.JumpIf{Val: binary.BigEndian.Uint32(localIP.To16()[12:16]), SkipFalse: 3},\n\t\t\t// check the destination port\n\t\t\tbpf.LoadAbsolute{Off: 56, Size: 2},\n\t\t\tbpf.JumpIf{Val: uint32(localPort), SkipFalse: 1},\n\t\t\tbpf.RetConstant{Val: 0xffff}, // accept\n\t\t\tbpf.RetConstant{Val: 0x0}, // drop\n\t\t}\n\t}\n\tfilter, err := bpf.Assemble(bpfFilter)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"Failed to generate BPF assembler: %v\", err)\n\t}\n\n\tf := make([]unix.SockFilter, len(filter))\n\tfor i := range filter {\n\t\tf[i].Code = filter[i].Op\n\t\tf[i].Jf = filter[i].Jf\n\t\tf[i].Jt = filter[i].Jt\n\t\tf[i].K = filter[i].K\n\t}\n\tfprog := &unix.SockFprog{\n\t\tLen: uint16(len(filter)),\n\t\tFilter: &f[0],\n\t}\n\terr = unix.SetsockoptSockFprog(fd, unix.SOL_SOCKET, unix.SO_ATTACH_FILTER, fprog)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"unable to set BPF filter on socket: %v\", err)\n\t}\n\n\tlog.Printf(\"Adding ebpf ingress filter on interface %s\", ifaceLink.Attrs().Name)\n\t// filter on the host so our userspace connections are not resetted\n\t// using tc since they are at the beginning of the pipeline\n\t// # add an ingress qdisc\n\t// tc qdisc add dev eth3 ingress\n\t// xref: https://codilime.com/pdf/codilime_packet_flow_in_netfilter_A3-1-1.pdf\n\tqdisc := &netlink.GenericQdisc{\n\t\tQdiscAttrs: netlink.QdiscAttrs{\n\t\t\tLinkIndex: ifaceLink.Attrs().Index,\n\t\t\tHandle: netlink.MakeHandle(0xffff, 0),\n\t\t\tParent: netlink.HANDLE_CLSACT,\n\t\t},\n\t\tQdiscType: \"clsact\",\n\t}\n\tif err = netlink.QdiscAdd(qdisc); err != nil {\n\t\treturn fmt.Errorf(\"Failed to add qdisc: %v\", err)\n\t}\n\tdefer netlink.QdiscDel(qdisc)\n\n\tspec, err := loadFilter()\n\tif err != nil {\n\t\treturn fmt.Errorf(\"Error creating eBPF program: %v\", err)\n\t}\n\n\t// TODO: IPv6\n\terr = spec.RewriteConstants(map[string]interface{}{\n\t\t\"PROTO\": uint8(transportProtocolNumber),\n\t\t\"IP_FAMILY\": uint8(family),\n\t\t// \"SRC_IP\": 0,\n\t\t\"DST_IP\": ip2int(localIP),\n\t\t// \"SRC_PORT\": 0,\n\t\t\"DST_PORT\": uint16(localPort),\n\t})\n\tif err != nil {\n\t\treturn fmt.Errorf(\"Error rewriting eBPF program: %v\", err)\n\t}\n\n\tobjs := filterObjects{}\n\tif err := spec.LoadAndAssign(&objs, nil); err != nil {\n\t\treturn fmt.Errorf(\"failed to load objects: %v\", err)\n\t}\n\tdefer objs.Close()\n\n\tbpfFd := objs.Ingress.FD()\n\t// https://man7.org/linux/man-pages/man8/tc-bpf.8.html\n\tingressFilter := &netlink.BpfFilter{\n\t\tFilterAttrs: netlink.FilterAttrs{\n\t\t\tLinkIndex: ifaceLink.Attrs().Index,\n\t\t\tParent: netlink.HANDLE_MIN_INGRESS,\n\t\t\tHandle: netlink.MakeHandle(0, 1),\n\t\t\tProtocol: unix.ETH_P_ALL,\n\t\t},\n\t\tFd: bpfFd,\n\t\tName: \"nkFilter\",\n\t\tDirectAction: true,\n\t}\n\n\tlog.Printf(\"filter %v\", ingressFilter.String())\n\tif err := netlink.FilterAdd(ingressFilter); err != nil {\n\t\treturn fmt.Errorf(\"Failed to add filter: %v\", err)\n\t}\n\tdefer netlink.FilterDel(ingressFilter)\n\n\tlog.Printf(\"Creating user TCP/IP stack\")\n\t// add the socket to the userspace stack\n\tla := tcpip.LinkAddress(ifaceLink.Attrs().HardwareAddr)\n\n\tlinkID, err := fdbased.New(&fdbased.Options{\n\t\tFDs: []int{fd},\n\t\tMTU: mtu,\n\t\tEthernetHeader: true,\n\t\tAddress: tcpip.LinkAddress(la),\n\t\t// Enable checksum generation as we need to generate valid\n\t\t// checksums for the veth device to deliver our packets to the\n\t\t// peer. But we do want to disable checksum verification as veth\n\t\t// devices do perform GRO and the linux host kernel may not\n\t\t// regenerate valid checksums after GRO.\n\t\tTXChecksumOffload: false,\n\t\tRXChecksumOffload: true,\n\t\tPacketDispatchMode: fdbased.RecvMMsg,\n\t})\n\tif err != nil {\n\t\treturn fmt.Errorf(\"Can't create user-space link: %v\\n\", err)\n\t}\n\n\tif flagDebug {\n\t\tlinkID = sniffer.New(linkID)\n\t}\n\n\tipstack := stack.New(stack.Options{\n\t\tNetworkProtocols: []stack.NetworkProtocolFactory{networkProtocol, arp.NewProtocol},\n\t\tTransportProtocols: []stack.TransportProtocolFactory{transportProtocol},\n\t})\n\tdefer func() {\n\t\tipstack.Close()\n\t}()\n\n\tif err := ipstack.CreateNIC(1, linkID); err != nil {\n\t\treturn fmt.Errorf(\"Failed to create userspace NIC: %v\", err)\n\t}\n\n\tipstack.AddAddress(nicID, protocolNumber, ipToStackAddress(localIP))\n\t// use the address as source\n\tladdr := tcpip.FullAddress{\n\t\tNIC: nicID,\n\t\tAddr: ipToStackAddress(localIP),\n\t\tPort: uint16(localPort),\n\t}\n\n\t// Add IPv4 and IPv6 default routes, so all traffic goes through the fake NIC\n\tsubnet, _ := tcpip.NewSubnet(tcpip.Address(strings.Repeat(\"\\x00\", 4)), tcpip.AddressMask(strings.Repeat(\"\\x00\", 4)))\n\tif isIPv6 {\n\t\tsubnet, _ = tcpip.NewSubnet(tcpip.Address(strings.Repeat(\"\\x00\", 16)), tcpip.AddressMask(strings.Repeat(\"\\x00\", 16)))\n\t}\n\n\tipstack.SetRouteTable([]tcpip.Route{\n\t\t{\n\t\t\tDestination: subnet,\n\t\t\tNIC: nicID,\n\t\t},\n\t})\n\n\t// Implement the netcat logic\n\t// It basically copies from a TCP/UDP socket to stdout in server mode\n\n\t// server mode: socket(localhost,port) ---> stdin\n\tif flagUDP {\n\t\t// TODO: UDP listeners\n\t} else {\n\t\tl, err := gonet.ListenTCP(ipstack, laddr, protocolNumber)\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"Error open TCP listener: %v\", err)\n\t\t}\n\t\tdefer l.Close()\n\t\tlog.Printf(\"Listening on %s:%d\", localIP, localPort)\n\t\t// accept connections\n\t\terrCh := make(chan error, 2)\n\t\tgo func() {\n\t\t\tinConn, err := l.Accept()\n\t\t\tif err != nil {\n\t\t\t\terrCh <- err\n\t\t\t\treturn\n\t\t\t}\n\t\t\tlog.Printf(\"incoming connection established.\")\n\t\t\tdefer inConn.Close()\n\n\t\t\t// process connection\n\t\t\tgo func() {\n\t\t\t\t_, err = io.Copy(inConn, os.Stdin)\n\t\t\t\terrCh <- err\n\t\t\t}()\n\t\t\t_, err = io.Copy(os.Stdout, inConn)\n\t\t\terrCh <- err\n\n\t\t}()\n\t\t// the signal handler can unblock this too\n\t\tselect {\n\t\tcase err = <-errCh:\n\t\t\tlog.Printf(\"Connection error: %v\", err)\n\t\tcase <-ctx.Done():\n\t\t\tlog.Printf(\"Done\")\n\t\t}\n\n\t\t// give a chance to terminate gracefully\n\t\ttime.Sleep(500 * time.Millisecond)\n\t}\n\treturn err\n}", "title": "" }, { "docid": "a6edaad7c34395357eee7492b3a5ffdd", "score": "0.55276406", "text": "func newListener(t *testing.T) *net.TCPListener {\n\taddr := &net.TCPAddr{\n\t\tPort: 0,\n\t}\n\n\tl, err := net.ListenTCP(\"tcp\", addr)\n\tif err != nil {\n\t\tt.Fatalf(\"Could not create TCP listener: %v\", err)\n\t}\n\n\treturn l\n}", "title": "" }, { "docid": "beae7a50d1f6f427db324cb808aac711", "score": "0.55103356", "text": "func (t *TCPServer) Run() (err error) {\n\tt.server, err = net.Listen(\"tcp\", t.addr)\n\tif err != nil {\n\t\treturn\n\t}\n\tfor {\n\t\tconn, err := t.server.Accept()\n\t\tif err != nil {\n\t\t\terr = errors.New(\"could not accept connection\")\n\t\t\tbreak\n\t\t}\n\t\tif conn == nil {\n\t\t\terr = errors.New(\"could not create connection\")\n\t\t\tbreak\n\t\t}\n\t\tconn.Close()\n\t}\n\treturn\n}", "title": "" }, { "docid": "9b8d01adc0a27fe1ee51ee4a5e5403f5", "score": "0.549605", "text": "func (s *Server) Listen() error {\n\tln, err := net.Listen(\"tcp\", \"0.0.0.0:\"+strconv.Itoa(s.Port))\n\tif err != nil {\n\t\treturn err\n\t}\n\tgo s.listenHTTP()\n\ts.Printf(\"Listening: 0.0.0.0:%d, ip: %s\", s.Port, s.IP)\n\tfor {\n\t\tconn, err := ln.Accept()\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\ts.Printf(\"New connection from %s\", conn.RemoteAddr())\n\t\tgo s.handleConnection(s.NewConn(conn))\n\t}\n}", "title": "" }, { "docid": "595a46432216eddc7ece9016f92c5c46", "score": "0.54904497", "text": "func (t *TCPProvider) Start(p event.Passer) {\n\n\tlogrus.Infof(\"TCP Provider listening on %s\", t.laddr.String())\n\t// start listening on that addr\n\terr := t.listen()\n\tif err != nil {\n\t\tlogrus.Error(err)\n\t\treturn\n\t}\n\n\tgo func() {\n\t\t// listen for ever\n\t\tfor {\n\t\t\tc, err := t.listener.AcceptTCP()\n\t\t\tif err != nil {\n\t\t\t\tlogrus.Errorf(\"Cannot accept new tcp connection %s\", err.Error())\n\t\t\t} else {\n\t\t\t\t// consume the connection\n\t\t\t\tlogrus.Infof(\"Accpeted new tcp connection from %s\", c.RemoteAddr().String())\n\t\t\t\tgo t.consume(c, p)\n\t\t\t}\n\t\t}\n\t}()\n}", "title": "" }, { "docid": "e91659968d67a16b507b0cc8c06f9be0", "score": "0.5489951", "text": "func (s *server) Listen() {\n\tvar (\n\t\terr error\n\t\tlistener net.Listener\n\t)\n\n\t// Listen with TLS or not\n\tif s.config == nil {\n\t\tlistener, err = net.Listen(\"tcp\", s.address)\n\t} else {\n\t\tlistener, err = tls.Listen(\"tcp\", s.address, s.config)\n\t}\n\tif err != nil {\n\t\ts.logger.Fatal(\"Error starting TCP server.\")\n\t}\n\ttcpListener, ok := listener.(*net.TCPListener)\n\tif !ok {\n\t\ts.logger.Fatal(\"Could not wrap as TCP Listener\")\n\t}\n\n\ts.newKafkaConn()\n\tgo s.logRoutine()\n\n\tdefer func() {\n\t\ttcpListener.Close()\n\t\ts.KafkaConn.Close()\n\t\ts.logger.Info(\"Server has shutdown. OK, I love you, Buh Bye!\")\n\t}()\n\n\tfor {\n\t\ttcpListener.SetDeadline(time.Now().Add(time.Second * 2))\n\t\tselect {\n\t\tcase <-s.context.Done():\n\t\t\treturn\n\t\tdefault:\n\t\t\tconn, err := tcpListener.Accept()\n\t\t\tif opErr, ok := err.(*net.OpError); ok && opErr.Timeout() {\n\t\t\t\t// Checks for timeout error, we arent worried about accept errors here\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tclient := newClient(conn, s) // change to getClient if reusing buffers\n\t\t\tgo client.listen() // goroutine\n\t\t}\n\t}\n}", "title": "" }, { "docid": "e6f1a8bf521d8d5920ae2380301a240d", "score": "0.5487694", "text": "func ListenWithOptions(laddr string, block BlockCrypt, dataShards, parityShards int) (*Listener, error) {\n\tudpaddr, err := net.ResolveUDPAddr(\"udp\", laddr)\n\tif err != nil {\n\t\treturn nil, errors.WithStack(err)\n\t}\n\tconn, err := net.ListenUDP(\"udp\", udpaddr)\n\tif err != nil {\n\t\treturn nil, errors.WithStack(err)\n\t}\n\n\treturn serveConn(block, dataShards, parityShards, conn, true)\n}", "title": "" }, { "docid": "cf4e16c83f3a288829f7ef39ca58a4fe", "score": "0.5487332", "text": "func (node *Node) Start() {\n\tlisten, err := net.Listen(\"tcp\", node.Address)\n\tdefer listen.Close()\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\tif node.Address != nodes[0] {\n\t\tfmt.Printf(\"sending version to root node: %s\\n\", nodes[0])\n\t\tnode.SendVersionCommand(nodes[0], node.Chain, node.Env)\n\t}\n\tfor {\n\t\tfmt.Printf(\"server listening on port: %s\\n\", node.Port)\n\t\tconn, err := listen.Accept()\n\t\tif err != nil {\n\t\t\tpanic(err)\n\t\t}\n\t\tfmt.Printf(\"connection established on port: %s\\n\", node.Port)\n\t\tgo handleConnection(conn, node, node.Env)\n\t}\n}", "title": "" }, { "docid": "5e69e56c9a780e776e1792eb3f5f76e8", "score": "0.5483695", "text": "func (s *StratumServer) Listen() {\n\tquit := make(chan bool)\n\tfor _, port := range s.config.Stratum.Ports {\n\t\tgo func(cfg pool.Port) {\n\t\t\te := NewEndpoint(&cfg)\n\t\t\te.Listen(s)\n\t\t}(port)\n\t}\n\t<-quit\n}", "title": "" }, { "docid": "a1aa3ef3d9114dc55d6bc67f341f34bf", "score": "0.54800755", "text": "func (self *Server) Listen(url string) error {\n\n\tself.url = url\n\n\tvar err error\n\tif self.sock, err = pub.NewSocket(); err != nil {\n\t\treturn err\n\t}\n\n\tself.sock.AddTransport(ipc.NewTransport())\n\tself.sock.AddTransport(tcp.NewTransport())\n\tif err = self.sock.Listen(url); err != nil {\n\t\treturn err\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "b8ee7ce5008df1a5a68ff4173a6e030c", "score": "0.54745126", "text": "func Listen(port int) net.Conn {\n\tvar err error\n\n\tlog.Printf(\"Starting server on Port %v...\\n\", port)\n\n\t// create listener on given port\n\tln, err := net.Listen(\"tcp\", fmt.Sprintf(\":%v\", port))\n\tif err != nil {\n\t\tlog.Println(err)\n\t\tpanic(err)\n\t}\n\n\t// accept connection on given port\n\tconn, err := ln.Accept()\n\tif err != nil {\n\t\tlog.Println(err)\n\t\tpanic(err)\n\t}\n\n\treturn conn\n}", "title": "" }, { "docid": "1c0fe0c86a6853d92fc734e0c7c5303f", "score": "0.5471326", "text": "func InheritOrListenTCP(addr string) (net.Listener, error) {\n\ttcpAddr, err := net.ResolveTCPAddr(\"tcp\", addr)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"graceful: failed to resolve tcp addr %s: %v\", addr, err)\n\t}\n\taddr = tcpAddr.String()\n\n\tfor i, iaddr := range InheritedAddrs() {\n\t\tif iaddr != addr {\n\t\t\tcontinue\n\t\t}\n\t\treturn func() (net.Listener, error) {\n\t\t\tfd := uintptr(3 + i)\n\t\t\tf := os.NewFile(fd, addr)\n\t\t\tif f == nil {\n\t\t\t\treturn nil, fmt.Errorf(\"graceful: failed to NewFile. fd %v, addr %v\", fd, addr)\n\t\t\t}\n\t\t\tdefer f.Close()\n\t\t\tln, err := net.FileListener(f)\n\t\t\tif err != nil {\n\t\t\t\treturn nil, fmt.Errorf(\"graceful: failed to create file listener: %v\", err)\n\t\t\t}\n\t\t\treturn ln, nil\n\t\t}()\n\t}\n\tln, err := net.Listen(\"tcp\", addr)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"graceful: failed to listen: %v\", err)\n\t}\n\treturn ln, nil\n}", "title": "" }, { "docid": "b9a21a94196bb5d0f62d4423bbd28637", "score": "0.54668176", "text": "func listenServer(ch chan net.Conn){\n ln, err := net.Listen(\"tcp\", \":\"+*listen_port)\n if err != nil{\n log.Fatal(err)\n } else {\n log.Println(\"listening on \", *listen_port)\n }\n for {\n conn, err := ln.Accept()\n fmt.Println(conn)\n if err!= nil{\n continue\n }\n ch <- conn\n }\n}", "title": "" }, { "docid": "b42741e297789ea0a3db67a5004875f4", "score": "0.54650044", "text": "func (e *Endpoint) Listen(s *StratumServer) {\n\tbindAddr := fmt.Sprintf(\"%s:%d\", e.config.Host, e.config.Port)\n\taddr, err := net.ResolveTCPAddr(\"tcp\", bindAddr)\n\tif err != nil {\n\t\tStratumErrorLogger.Printf(\"[Stratum] Error: %v\", err)\n\t\tlog.Fatalf(\"[Stratum] Error: %v\", err)\n\t}\n\tserver, err := net.ListenTCP(\"tcp\", addr)\n\tif err != nil {\n\t\tStratumErrorLogger.Printf(\"[Stratum] Error: %v\", err)\n\t\tlog.Fatalf(\"[Stratum] Error: %v\", err)\n\t}\n\tdefer server.Close()\n\n\tlog.Printf(\"[Stratum] Stratum listening on %s\", bindAddr)\n\tStratumInfoLogger.Printf(\"[Stratum] Stratum listening on %s\", bindAddr)\n\taccept := make(chan int, e.config.MaxConn)\n\tn := 0\n\n\tfor {\n\t\tconn, err := server.AcceptTCP()\n\t\tif err != nil {\n\t\t\tcontinue\n\t\t}\n\t\tconn.SetKeepAlive(true)\n\t\tip, _, _ := net.SplitHostPort(conn.RemoteAddr().String())\n\n\t\tVarDiff := &VarDiff{}\n\n\t\tcs := &Session{conn: conn, ip: ip, enc: json.NewEncoder(conn), endpoint: e, VarDiff: VarDiff}\n\t\tn++\n\n\t\taccept <- n\n\t\tgo func() {\n\t\t\ts.handleClient(cs, e)\n\t\t\t<-accept\n\t\t}()\n\t}\n}", "title": "" }, { "docid": "f1c8edf89c141dd62c14d13a251b5191", "score": "0.5462596", "text": "func (dealer *dealerSocket) Listen(ep string) error {\n\treturn dealer.sck.Listen(ep)\n}", "title": "" }, { "docid": "405bfc65ec16c7f40e6e02663407e40d", "score": "0.5456989", "text": "func (s *Server) Listen(network, addr string) (net.Listener, error) {\n\thost, port, err := net.SplitHostPort(addr)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"tsnet: %w\", err)\n\t}\n\n\tif err := s.Start(); err != nil {\n\t\treturn nil, err\n\t}\n\n\tkey := listenKey{network, host, port}\n\tln := &listener{\n\t\ts: s,\n\t\tkey: key,\n\t\taddr: addr,\n\n\t\tconn: make(chan net.Conn),\n\t}\n\ts.mu.Lock()\n\tif s.listeners == nil {\n\t\ts.listeners = map[listenKey]*listener{}\n\t}\n\tif _, ok := s.listeners[key]; ok {\n\t\ts.mu.Unlock()\n\t\treturn nil, fmt.Errorf(\"tsnet: listener already open for %s, %s\", network, addr)\n\t}\n\ts.listeners[key] = ln\n\ts.mu.Unlock()\n\treturn ln, nil\n}", "title": "" }, { "docid": "7d9eb20452db047c8e2680da608ccc4a", "score": "0.5455928", "text": "func mustTCPListener(bind string) net.Listener {\n\tl, err := net.Listen(\"tcp\", bind)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn l\n}", "title": "" }, { "docid": "5d06b9b130d26dd4acfdd95d4bee1149", "score": "0.54533917", "text": "func listen() (string, net.Listener, error) {\n\tlis, err := net.Listen(\"tcp\", \":0\")\n\tif err != nil {\n\t\treturn \"\", nil, err\n\t}\n\t_, port, err := net.SplitHostPort(lis.Addr().String())\n\tif err != nil {\n\t\treturn \"\", nil, err\n\t}\n\taddr := \"localhost:\" + port\n\treturn addr, lis, nil\n}", "title": "" }, { "docid": "0fd5ec847999b79dc66ee29aaded6e04", "score": "0.5449611", "text": "func (s *Semaphore) startTCPServer() {\n\tlistener, err := net.Listen(\"tcp\", s.me)\n\n\tif err != nil {\n\t\tlog.Printf(\"listen tcp error: %v\", err)\n\t}\n\n\tfor {\n\t\tconn, err := listener.Accept()\n\t\tif err != nil {\n\t\t\tlog.Printf(\"accept tcp error: %v\", err)\n\t\t}\n\t\ts.processConn(conn)\n\t}\n\n}", "title": "" }, { "docid": "42d5f0352b6c34bdd6f77ce06bf411bb", "score": "0.54494995", "text": "func (t *TCPProvider) Start(p event.EventPasser) {\n\n\tlogrus.Infof(\"TCP Provider listening on %s\", t.laddr.String())\n\t// start listening on that addr\n\terr := t.listen()\n\tif err != nil {\n\t\tlogrus.Error(err)\n\t\treturn\n\t}\n\n\tgo func() {\n\t\t// listen for ever\n\t\tfor {\n\t\t\tc, err := t.listener.AcceptTCP()\n\t\t\tif err != nil {\n\t\t\t\tlogrus.Errorf(\"Cannot accept new tcp connection %s\", err.Error())\n\t\t\t} else {\n\t\t\t\t// consume the connection\n\t\t\t\tlogrus.Infof(\"Accpeted new tcp connection from %s\", c.RemoteAddr().String())\n\t\t\t\tgo t.consume(c, p)\n\t\t\t}\n\t\t}\n\t}()\n}", "title": "" }, { "docid": "a6593b690517d5143c1a0b9388f8e41c", "score": "0.5447869", "text": "func startTCPListener(address string) (net.Listener, error) {\n\tlog.WithField(\"listen_address\", address).Debug(\"Starting TCP listener\")\n\tlis, err := net.Listen(\"tcp\", address)\n\tif err != nil {\n\t\treturn nil, errors.Wrapf(err, \"cannot listen on address %s\", address)\n\t}\n\tlog.WithField(\"listen_address\", lis.Addr()).Info(\"Started TCP listener\")\n\treturn lis, nil\n}", "title": "" }, { "docid": "c1f4a8e0854e126897d8e060b402599d", "score": "0.54417884", "text": "func main() {\n\tlistener, err := net.Listen(\"tcp\", \"localhost:8000\")\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\tfor {\n\t\tconn, err := listener.Accept()\n\t\tif err != nil {\n\t\t\tlog.Print(err)\n\t\t\tcontinue\n\t\t}\n\t\tgo handleConn(conn) // handle connection concurrently\n\t}\n}", "title": "" }, { "docid": "1bc08e5af4e3c54df86d58b9b6ad2487", "score": "0.54371154", "text": "func Listen(addr string, handler http.Handler) {\n\tlog.Info(\"init\", \"addr\", addr)\n\tsvr = &http.Server{\n\t\tAddr: addr,\n\t\tHandler: handler,\n\t\tReadTimeout: time.Second * 30,\n\t\tReadHeaderTimeout: time.Second * 20,\n\t}\n\tif err := svr.ListenAndServe(); err != nil {\n\t\tif err == http.ErrServerClosed {\n\t\t\treturn\n\t\t}\n\t\tlog.Fatal(\"listen-error\", \"error\", err)\n\t}\n}", "title": "" }, { "docid": "745ea001b9fad8f80754979039bbacf9", "score": "0.5433235", "text": "func (node *Node) Run() {\n\tlistener, err := net.ListenTCP(\"tcp\", node.Address)\n\tif err != nil {\n\t\tlog.Panic(err)\n\t}\n\tdefer listener.Close()\n\tfmt.Println(\"node start at \", node.Address)\n\n\t// connection message channel\n\tconnChan := make(chan *ConnMessage)\n\t// data channel\n\tdataChan := make(chan []byte)\n\n\tgo ListenConnections(listener, connChan, dataChan)\n\n\tfor {\n\t\tselect {\n\t\tcase connMessage := <-connChan:\n\t\t\tif connMessage.Connected {\n\t\t\t\t// new connection, insert into node.Connected\n\t\t\t\tnode.Connected[connMessage.Conn.RemoteAddr().String()] = connMessage.Conn\n\t\t\t\tfmt.Printf(\"connect from %v\\n\", connMessage.Conn.RemoteAddr())\n\t\t\t\tfmt.Printf(\"current connected: %v\\n\", node.Connected)\n\t\t\t} else {\n\t\t\t\t// lost connect, remove from node.Connected\n\t\t\t\tdelete(node.Connected, connMessage.Conn.RemoteAddr().String())\n\t\t\t\tfmt.Printf(\"disconnect from %v\\n\", connMessage.Conn.RemoteAddr())\n\t\t\t\tfmt.Printf(\"current connected: %v\\n\", node.Connected)\n\t\t\t}\n\t\tcase data := <-dataChan:\n\t\t\tfmt.Printf(\"receive data: %s\\n\", data)\n\t\t}\n\t}\n}", "title": "" }, { "docid": "09a2d475e52feb425636a2be0f6ed3ba", "score": "0.54331785", "text": "func startServer() {\n\tfmt.Println(\"(\", localPort, \")\")\n\tln, _ := net.Listen(\"tcp\", \"localhost:\"+localPort)\n\tdefer ln.Close()\n\n\tfor {\n\t\tconn, _ := ln.Accept()\n\t\tgo handleRequeset(conn)\n\t}\n}", "title": "" }, { "docid": "9e7f93ee9c0ba4c8bed088ab8bd46c6a", "score": "0.5428226", "text": "func (t *Server) Run() error {\n\taddr := t.httpSrv.Addr\n\tif addr == \"\" {\n\t\taddr = \":http\"\n\t}\n\tlistener, err := net.Listen(\"tcp\", addr)\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"TCP listener setup\")\n\t}\n\n\tt.addr = listener.Addr()\n\t// Address determined, readers must be unblocked\n\tt.addrReadWait.Done()\n\n\ttcpListener := tcpKeepAliveListener{\n\t\tTCPListener: listener.(*net.TCPListener),\n\t\tKeepAliveDuration: t.conf.KeepAliveDuration,\n\t}\n\n\tif t.conf.TLS != nil {\n\t\tt.debugLog.Print(\"listening https://\" + t.addr.String())\n\n\t\tif err := t.httpSrv.ServeTLS(\n\t\t\ttcpListener,\n\t\t\tt.conf.TLS.CertificateFilePath,\n\t\t\tt.conf.TLS.PrivateKeyFilePath,\n\t\t); err != http.ErrServerClosed {\n\t\t\treturn err\n\t\t}\n\t} else {\n\t\tt.debugLog.Print(\"listening http://\" + t.addr.String())\n\n\t\tif err := t.httpSrv.Serve(tcpListener); err != http.ErrServerClosed {\n\t\t\treturn err\n\t\t}\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "2a502819212a3f92537ae99753b61226", "score": "0.5421585", "text": "func newTCP(channel chan []byte, log *l.Entry) Listener {\n\tt := new(TCP)\n\n\tt.log = log\n\tt.channel = channel\n\n\tt.name = \"TCP\"\n\tt.port = DefaultTCPListenerPort\n\treturn t\n}", "title": "" }, { "docid": "91afba61f8cde519d4be809724f97f0e", "score": "0.5415515", "text": "func (s *Server) Run(addr string) error {\n\tlis, err := net.Listen(\"tcp\", addr)\n\tif err != nil {\n\t\terr = errors.WithStack(err)\n\t\tlog.Error(\"failed to listen: %v\", err)\n\t\treturn err\n\t}\n\treflection.Register(s.server)\n\treturn s.Serve(lis)\n}", "title": "" }, { "docid": "8687f89fcd266675e9e830758c031538", "score": "0.54107505", "text": "func NewTCPListener(\n\tvolumeDriverName string,\n\taddress string,\n\tstart <-chan struct{},\n) (net.Listener, string, error) {\n\treturn newTCPListener(\n\t\tvolumeDriverName,\n\t\taddress,\n\t\tstart,\n\t)\n}", "title": "" }, { "docid": "0587279e0063cb498cf2749cbaefc2ee", "score": "0.53972125", "text": "func (a *Application) Listen(address string, configurators ...iris.Configurator) {\n\t_ = a.Run(iris.Addr(address), configurators...)\n}", "title": "" }, { "docid": "49939562cc5795b8ab3bfc614f2b9694", "score": "0.5392653", "text": "func ListenAddr(addr string) ConfigOption {\n\treturn func(c *Config) {\n\t\tc.addr = addr\n\t}\n}", "title": "" } ]
b1ef19d3aab7f19b07af66654f274100
Reload refetches the object from the database using the primary keys with an executor.
[ { "docid": "717a37f87c866ff8f8c6104d5f02744b", "score": "0.6058914", "text": "func (o *Twitter) Reload(ctx context.Context, exec boil.ContextExecutor) error {\n\tret, err := FindTwitter(ctx, exec, o.Date)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t*o = *ret\n\treturn nil\n}", "title": "" } ]
[ { "docid": "5d63a4d6037e4b73363b0f0841e6681d", "score": "0.6821177", "text": "func (o *ExternalEntity) Reload(ctx context.Context, exec boil.ContextExecutor) error {\n\tret, err := FindExternalEntity(ctx, exec, o.ID)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t*o = *ret\n\treturn nil\n}", "title": "" }, { "docid": "af578ef389cd22a0693deffd4443a07b", "score": "0.6763359", "text": "func (o *Partner) Reload(exec boil.Executor) error {\n\tret, err := FindPartner(exec, o.ID)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t*o = *ret\n\treturn nil\n}", "title": "" }, { "docid": "404a0261e3611683728a47f174fced41", "score": "0.66859317", "text": "func (o *Operation) Reload(exec boil.Executor) error {\n\tret, err := FindOperation(exec, o.ID)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t*o = *ret\n\treturn nil\n}", "title": "" }, { "docid": "9f2d330f6efea6ab0ef4c38c3b3d09f2", "score": "0.6667511", "text": "func (o *Creator) Reload(ctx context.Context, exec boil.ContextExecutor) error {\n\tret, err := FindCreator(ctx, exec, o.ID)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t*o = *ret\n\treturn nil\n}", "title": "" }, { "docid": "c75869743dc1bf1a57d43b31fcfc26cc", "score": "0.66454077", "text": "func (o *UpepRefSeqDB) Reload(exec boil.Executor) error {\n\tret, err := FindUpepRefSeqDB(exec, o.ID)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t*o = *ret\n\treturn nil\n}", "title": "" }, { "docid": "253ce2eae01ee88a63fdb3582682cd96", "score": "0.6594483", "text": "func (o *Person) Reload(ctx context.Context, exec boil.ContextExecutor) error {\n\tret, err := FindPerson(ctx, exec, o.ID)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t*o = *ret\n\treturn nil\n}", "title": "" }, { "docid": "aab14b8ee46863335aee8b2e138aaff5", "score": "0.6554595", "text": "func (o *DistroAdvisory) Reload(exec boil.Executor) error {\n\tret, err := FindDistroAdvisory(exec, o.ID)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t*o = *ret\n\treturn nil\n}", "title": "" }, { "docid": "7341881cc7b32f064d91215bd3c04ed8", "score": "0.6543809", "text": "func (o *AdminPromo) Reload(exec boil.Executor) error {\n\tret, err := FindAdminPromo(exec, o.ID)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t*o = *ret\n\treturn nil\n}", "title": "" }, { "docid": "aeecf10f4dc120cf8b0f9a1aa12f81b7", "score": "0.6484703", "text": "func (o *OrderModel) Reload(ctx context.Context, exec boil.ContextExecutor) error {\n\tret, err := FindOrderModel(ctx, exec, o.ID)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t*o = *ret\n\treturn nil\n}", "title": "" }, { "docid": "c9192780abb369062d85f8c22b007bb2", "score": "0.645946", "text": "func (o *CMFUserBalanceRecord) Reload(ctx context.Context, exec boil.ContextExecutor) error {\n\tret, err := FindCMFUserBalanceRecord(ctx, exec, o.ID)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t*o = *ret\n\treturn nil\n}", "title": "" }, { "docid": "4a4a427b120011a443ec70ddc423124c", "score": "0.6456944", "text": "func (o *RankVehicle) Reload(ctx context.Context, exec boil.ContextExecutor) error {\n\tret, err := FindRankVehicle(ctx, exec, o.ID)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t*o = *ret\n\treturn nil\n}", "title": "" }, { "docid": "42da7b55bcfa062d245174a52ffc5527", "score": "0.6381877", "text": "func (o *ScheduledCommand) Reload(ctx context.Context, exec boil.ContextExecutor) error {\n\tret, err := FindScheduledCommand(ctx, exec, o.ID)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t*o = *ret\n\treturn nil\n}", "title": "" }, { "docid": "769f838aa6060c60b97c11c5d7d9dbf0", "score": "0.63806975", "text": "func (o *Order) Reload(exec boil.Executor) error {\n\tret, err := FindOrder(exec, o.ID)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t*o = *ret\n\treturn nil\n}", "title": "" }, { "docid": "c50d00057bb7224041086cc9dcd756ca", "score": "0.63777584", "text": "func (o *Rower) Reload(exec boil.Executor) error {\n\tret, err := FindRower(exec, o.ID)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t*o = *ret\n\treturn nil\n}", "title": "" }, { "docid": "8f5a35b018185acfbeafa65581439e32", "score": "0.637226", "text": "func (o *Offer) Reload(ctx context.Context, exec boil.ContextExecutor) error {\n\tret, err := FindOffer(ctx, exec, o.ID)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t*o = *ret\n\treturn nil\n}", "title": "" }, { "docid": "9a291b3d8c370363ce22b9c18f042c45", "score": "0.63634646", "text": "func (o *Payment) Reload(ctx context.Context, exec boil.ContextExecutor) error {\n\tret, err := FindPayment(ctx, exec, o.ID)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t*o = *ret\n\treturn nil\n}", "title": "" }, { "docid": "9a291b3d8c370363ce22b9c18f042c45", "score": "0.63634646", "text": "func (o *Payment) Reload(ctx context.Context, exec boil.ContextExecutor) error {\n\tret, err := FindPayment(ctx, exec, o.ID)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t*o = *ret\n\treturn nil\n}", "title": "" }, { "docid": "f85b18d28774e2f3837a88fc3cf06172", "score": "0.6361557", "text": "func (o *PowDatum) Reload(exec boil.Executor) error {\n\tret, err := FindPowDatum(exec, o.ID)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t*o = *ret\n\treturn nil\n}", "title": "" }, { "docid": "a043c12e9f2ec247f708ee3cf92d716f", "score": "0.63288903", "text": "func (o *Question) Reload(ctx context.Context, exec boil.ContextExecutor) error {\n\tret, err := FindQuestion(ctx, exec, o.ID)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t*o = *ret\n\treturn nil\n}", "title": "" }, { "docid": "a043c12e9f2ec247f708ee3cf92d716f", "score": "0.63288903", "text": "func (o *Question) Reload(ctx context.Context, exec boil.ContextExecutor) error {\n\tret, err := FindQuestion(ctx, exec, o.ID)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t*o = *ret\n\treturn nil\n}", "title": "" }, { "docid": "57042058b3de3fe69ec581998c197e3d", "score": "0.6305959", "text": "func (o *Exchange) Reload(exec boil.Executor) error {\n\tret, err := FindExchange(exec, o.ID)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t*o = *ret\n\treturn nil\n}", "title": "" }, { "docid": "58eb192ce45d73deaaf55db2a797168d", "score": "0.62980354", "text": "func (o *StockRelationshipCvterm) Reload(exec boil.Executor) error {\n\tret, err := FindStockRelationshipCvterm(exec, o.StockRelationshipCvtermID)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t*o = *ret\n\treturn nil\n}", "title": "" }, { "docid": "67c6e823f5d87532c74e398dde5c5aef", "score": "0.6295424", "text": "func (o *Pilot) Reload(ctx context.Context, exec boil.ContextExecutor) error {\n\tret, err := FindPilot(ctx, exec, o.ID)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t*o = *ret\n\treturn nil\n}", "title": "" }, { "docid": "ee7d4aeb6ac60710375499321db7bcc0", "score": "0.62898403", "text": "func (o *Transaction) Reload(exec boil.Executor) error {\n\tret, err := FindTransaction(exec, o.ID)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t*o = *ret\n\treturn nil\n}", "title": "" }, { "docid": "b9df3c507866c0ecbfdf216364545717", "score": "0.62662125", "text": "func (o *WhiteCard) Reload(exec boil.Executor) error {\n\tret, err := FindWhiteCard(exec, o.ID)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t*o = *ret\n\treturn nil\n}", "title": "" }, { "docid": "21b7d822b41a5b8769234d615ea18362", "score": "0.62647104", "text": "func (o *CreditCard) Reload(ctx context.Context, exec boil.ContextExecutor) error {\n\tret, err := FindCreditCard(ctx, exec, o.ID)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t*o = *ret\n\treturn nil\n}", "title": "" }, { "docid": "7102d878c3f4f0426eeb6045a00c03b4", "score": "0.6262644", "text": "func (o *Student) Reload(exec boil.Executor) error {\n\tret, err := FindStudent(exec, o.UserID)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t*o = *ret\n\treturn nil\n}", "title": "" }, { "docid": "1cb1c107b48eb01ec5f17913f8cbcce2", "score": "0.6261409", "text": "func (o *XRPAccountKey) Reload(ctx context.Context, exec boil.ContextExecutor) error {\n\tret, err := FindXRPAccountKey(ctx, exec, o.ID)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t*o = *ret\n\treturn nil\n}", "title": "" }, { "docid": "01275f95548446a3f88de0317c89b3fa", "score": "0.62255037", "text": "func (o *Boat) Reload(exec boil.Executor) error {\n\tret, err := FindBoat(exec, o.ID)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t*o = *ret\n\treturn nil\n}", "title": "" }, { "docid": "0b1a5bde5686add9ba8819506576cb74", "score": "0.6223358", "text": "func (o *BookmarkSearchDatum) Reload(ctx context.Context, exec boil.ContextExecutor) error {\n\tret, err := FindBookmarkSearchDatum(ctx, exec, o.ID)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t*o = *ret\n\treturn nil\n}", "title": "" }, { "docid": "fa3d76df2d46fcdfedf7ddcc85a50ebb", "score": "0.62096715", "text": "func (o *User) Reload(ctx context.Context, exec boil.ContextExecutor) error {\n\tret, err := FindUser(ctx, exec, o.ID)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t*o = *ret\n\treturn nil\n}", "title": "" }, { "docid": "230a32fadc6fcc52126f7ba2f2b21497", "score": "0.6198592", "text": "func (o *CommandList) Reload(ctx context.Context, exec boil.ContextExecutor) error {\n\tret, err := FindCommandList(ctx, exec, o.ID)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t*o = *ret\n\treturn nil\n}", "title": "" }, { "docid": "ab049026b2b7336bf25377749fd9a13f", "score": "0.6197402", "text": "func (o *Pilot) Reload(exec boil.Executor) error {\n\tret, err := FindPilot(exec, o.ID)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t*o = *ret\n\treturn nil\n}", "title": "" }, { "docid": "4f0a79e8792ba86665cee693b24cda7e", "score": "0.6195092", "text": "func (o *Meetup) Reload(ctx context.Context, exec boil.ContextExecutor) error {\n\tret, err := FindMeetup(ctx, exec, o.ID)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t*o = *ret\n\treturn nil\n}", "title": "" }, { "docid": "9a326562d934838bce4b51b489e821af", "score": "0.6179006", "text": "func (o *TBook) Reload(ctx context.Context, exec boil.ContextExecutor) error {\n\tret, err := FindTBook(ctx, exec, o.ID)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t*o = *ret\n\treturn nil\n}", "title": "" }, { "docid": "d5a61d78d1c9d60d1b2c9d38d7abb3ac", "score": "0.6172031", "text": "func (o *Player) Reload(ctx context.Context, exec boil.ContextExecutor) error {\n\tret, err := FindPlayer(ctx, exec, o.ID)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t*o = *ret\n\treturn nil\n}", "title": "" }, { "docid": "72fed2b7c2920d7bab88eb6774debff3", "score": "0.61705047", "text": "func (o *UpepGeneIdentifier) Reload(exec boil.Executor) error {\n\tret, err := FindUpepGeneIdentifier(exec, o.ID)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t*o = *ret\n\treturn nil\n}", "title": "" }, { "docid": "deaab1f7525152d9ab33870830856de8", "score": "0.6152084", "text": "func (o *Following) Reload(ctx context.Context, exec boil.ContextExecutor) error {\n\tret, err := FindFollowing(ctx, exec, o.ID)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t*o = *ret\n\treturn nil\n}", "title": "" }, { "docid": "f98d85a55bedef4175f00a60fbec7f4e", "score": "0.61302155", "text": "func (o *EarthquakeUpdate) Reload(ctx context.Context, exec boil.ContextExecutor) error {\n\tret, err := FindEarthquakeUpdate(ctx, exec, o.ID)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t*o = *ret\n\treturn nil\n}", "title": "" }, { "docid": "34f4e8aad4750dee83d3549b6b09bad2", "score": "0.611216", "text": "func (o *QueryLog) Reload(exec boil.Executor) error {\n\tret, err := FindQueryLog(exec, o.ID)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t*o = *ret\n\treturn nil\n}", "title": "" }, { "docid": "81461f345ac0451e41cea89c6938ec8c", "score": "0.6083072", "text": "func (o *Link) Reload(ctx context.Context, exec boil.ContextExecutor) error {\n\tret, err := FindLink(ctx, exec, o.ID)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t*o = *ret\n\treturn nil\n}", "title": "" }, { "docid": "751ac1ddde804be09bdd8e754b9b19e9", "score": "0.60816765", "text": "func (o *Job) Reload(exec boil.Executor) error {\n\tret, err := FindJob(exec, o.JobID)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t*o = *ret\n\treturn nil\n}", "title": "" }, { "docid": "b6344b019fdda43323c9d17039a67813", "score": "0.6078866", "text": "func (o *Tenant) Reload(exec boil.Executor) error {\n\tret, err := FindTenant(exec, o.ID)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t*o = *ret\n\treturn nil\n}", "title": "" }, { "docid": "f3f67b4b0fe89a9124bd18a5b455031b", "score": "0.6065784", "text": "func (o *PurchaseItem) Reload(ctx context.Context, exec boil.ContextExecutor) error {\n\tret, err := FindPurchaseItem(ctx, exec, o.ID)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t*o = *ret\n\treturn nil\n}", "title": "" }, { "docid": "07043b8309fdcd3ee07a399844badba2", "score": "0.6059903", "text": "func (o *Player) Reload(exec boil.Executor) error {\n\tret, err := FindPlayer(exec, o.ID)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t*o = *ret\n\treturn nil\n}", "title": "" }, { "docid": "d18b38414acc65ed78112ee0f400ab36", "score": "0.60543513", "text": "func (o *Collection) Reload(exec boil.Executor) error {\n\tret, err := FindCollection(exec, o.ID)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t*o = *ret\n\treturn nil\n}", "title": "" }, { "docid": "abc5464c354f9af0a612c1367f0f039e", "score": "0.6048739", "text": "func (o *Battlereport) Reload(ctx context.Context, exec boil.ContextExecutor) error {\n\tret, err := FindBattlereport(ctx, exec, o.ID)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t*o = *ret\n\treturn nil\n}", "title": "" }, { "docid": "6ae9702137a72a4341b6d299ef863e2e", "score": "0.6018151", "text": "func (o *NoteRating) Reload(ctx context.Context, exec boil.ContextExecutor) error {\n\tret, err := FindNoteRating(ctx, exec, o.ID)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t*o = *ret\n\treturn nil\n}", "title": "" }, { "docid": "d09f64c53b128e67398acd61a2049f28", "score": "0.60090345", "text": "func (o *Snatcher) Reload(ctx context.Context, exec boil.ContextExecutor) error {\n\tret, err := FindSnatcher(ctx, exec, o.ID)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t*o = *ret\n\treturn nil\n}", "title": "" }, { "docid": "d2afd6a8561cd5fb4a5e061e875e1b3f", "score": "0.59933966", "text": "func (o *FollowingTeacher) Reload(ctx context.Context, exec boil.ContextExecutor) error {\n\tret, err := FindFollowingTeacher(ctx, exec, o.UserID, o.TeacherID)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t*o = *ret\n\treturn nil\n}", "title": "" }, { "docid": "626b92fe6994e3b45a702c082db5d908", "score": "0.5984406", "text": "func (o *Auditlog) Reload(ctx context.Context, exec boil.ContextExecutor) error {\n\tret, err := FindAuditlog(ctx, exec, o.ID)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t*o = *ret\n\treturn nil\n}", "title": "" }, { "docid": "31197fc74302eed8c48dd4c3f56b448a", "score": "0.5984305", "text": "func (o *Branch) Reload(ctx context.Context, exec boil.ContextExecutor) error {\n\tret, err := FindBranch(ctx, exec, o.ID)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t*o = *ret\n\treturn nil\n}", "title": "" }, { "docid": "97c2193a392430909be4b2ebde708581", "score": "0.5959077", "text": "func (o *Operation) ReloadP(exec boil.Executor) {\n\tif err := o.Reload(exec); err != nil {\n\t\tpanic(boil.WrapErr(err))\n\t}\n}", "title": "" }, { "docid": "2aa83248522ea96ddf333451dbf3cbb9", "score": "0.5936921", "text": "func (o *Funder) Reload(exec boil.Executor) error {\n\tret, err := FindFunder(exec, o.FundrefID)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t*o = *ret\n\treturn nil\n}", "title": "" }, { "docid": "142dcf3f55dc8435dfacfe1614e750b9", "score": "0.5928105", "text": "func (o *GuestList) Reload(exec boil.Executor) error {\n\tret, err := FindGuestList(exec, o.ID)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t*o = *ret\n\treturn nil\n}", "title": "" }, { "docid": "06a258a01ff61df090601f2640e8c787", "score": "0.5920654", "text": "func (o *BlogPost) Reload(exec boil.Executor) error {\n\tret, err := FindBlogPost(exec, o.ID)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t*o = *ret\n\treturn nil\n}", "title": "" }, { "docid": "03ab5e0fe9bbee18802753239e48b572", "score": "0.5917486", "text": "func (o *Earthquake) Reload(ctx context.Context, exec boil.ContextExecutor) error {\n\tret, err := FindEarthquake(ctx, exec, o.EventID)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t*o = *ret\n\treturn nil\n}", "title": "" }, { "docid": "cfe6d0fb4615f2a130af92fb19c3b565", "score": "0.59090114", "text": "func (o *GeoZoneMatrix) Reload(exec boil.Executor) error {\n\tret, err := FindGeoZoneMatrix(exec, o.ID)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t*o = *ret\n\treturn nil\n}", "title": "" }, { "docid": "624f87efee6c7f3f9cc1d9806b256958", "score": "0.5901372", "text": "func (o *RowerSlice) ReloadAll(exec boil.Executor) error {\n\tif o == nil || len(*o) == 0 {\n\t\treturn nil\n\t}\n\n\tslice := RowerSlice{}\n\tvar args []interface{}\n\tfor _, obj := range *o {\n\t\tpkeyArgs := queries.ValuesFromMapping(reflect.Indirect(reflect.ValueOf(obj)), rowerPrimaryKeyMapping)\n\t\targs = append(args, pkeyArgs...)\n\t}\n\n\tsql := \"SELECT \\\"rower\\\".* FROM \\\"rower\\\" WHERE \" +\n\t\tstrmangle.WhereClauseRepeated(string(dialect.LQ), string(dialect.RQ), 1, rowerPrimaryKeyColumns, len(*o))\n\n\tq := queries.Raw(sql, args...)\n\n\terr := q.Bind(nil, exec, &slice)\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"models: unable to reload all in RowerSlice\")\n\t}\n\n\t*o = slice\n\n\treturn nil\n}", "title": "" }, { "docid": "ec33f9bb5d0808062957967b7f2a2120", "score": "0.58970594", "text": "func (o *CorporationDelta) Reload(ctx context.Context, exec boil.ContextExecutor) error {\n\tret, err := FindCorporationDelta(ctx, exec, o.ID)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t*o = *ret\n\treturn nil\n}", "title": "" }, { "docid": "a9f1c1abfbe775e1fdf8e4da31f72f3a", "score": "0.5896515", "text": "func (o *PatientNote) Reload(ctx context.Context, exec boil.ContextExecutor) error {\n\tret, err := FindPatientNote(ctx, exec, o.Noteid)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t*o = *ret\n\treturn nil\n}", "title": "" }, { "docid": "7bb8fefa60166efc352edfc93af735f8", "score": "0.5896054", "text": "func (o *BlockedEntry) Reload(exec boil.Executor) error {\n\tret, err := FindBlockedEntry(exec, o.ID)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t*o = *ret\n\treturn nil\n}", "title": "" }, { "docid": "88864f7e03bb971e2a87ec837d148471", "score": "0.589444", "text": "func (o *Game) Reload(ctx context.Context, exec boil.ContextExecutor) error {\n\tret, err := FindGame(ctx, exec, o.ID)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t*o = *ret\n\treturn nil\n}", "title": "" }, { "docid": "01f2c2462e7058b055055fec214943b2", "score": "0.58770406", "text": "func (o *ImageMap) Reload(ctx context.Context, exec boil.ContextExecutor) error {\n\tret, err := FindImageMap(ctx, exec, o.ID)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t*o = *ret\n\treturn nil\n}", "title": "" }, { "docid": "35bb0adc0b6de380faf4467bdd139819", "score": "0.58642834", "text": "func (o *Phenotype) Reload(exec boil.Executor) error {\n\tret, err := FindPhenotype(exec, o.PhenotypeID)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t*o = *ret\n\treturn nil\n}", "title": "" }, { "docid": "136a37bb0b3453b11bbd015734b46f39", "score": "0.5857255", "text": "func (o *PhenotypeCvterm) Reload(exec boil.Executor) error {\n\tret, err := FindPhenotypeCvterm(exec, o.PhenotypeCvtermID)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t*o = *ret\n\treturn nil\n}", "title": "" }, { "docid": "b2eb40ec2010909a5ce5f32eaef39fb2", "score": "0.5853842", "text": "func (o *VSPTick) Reload(ctx context.Context, exec boil.ContextExecutor) error {\n\tret, err := FindVSPTick(ctx, exec, o.ID)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t*o = *ret\n\treturn nil\n}", "title": "" }, { "docid": "3ce30cd0c7473758ec355bf254f34fce", "score": "0.58432806", "text": "func (o *JobSeeker) Reload(ctx context.Context, exec boil.ContextExecutor) error {\n\tret, err := FindJobSeeker(ctx, exec, o.ID)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t*o = *ret\n\treturn nil\n}", "title": "" }, { "docid": "be21544b51d78452cd204febaed1fedc", "score": "0.583694", "text": "func (o *UpepRefSeqEntry) Reload(exec boil.Executor) error {\n\tret, err := FindUpepRefSeqEntry(exec, o.ID)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t*o = *ret\n\treturn nil\n}", "title": "" }, { "docid": "b4f6c31cb40885e852bd0e086c3d0682", "score": "0.5834629", "text": "func (o *ProtocolsSet) Reload(ctx context.Context, exec boil.ContextExecutor) error {\n\tret, err := FindProtocolsSet(ctx, exec, o.ID)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t*o = *ret\n\treturn nil\n}", "title": "" }, { "docid": "f6e37625f77ece61797d3d14a4fa14c5", "score": "0.5832426", "text": "func (o *Jbrowse) Reload(exec boil.Executor) error {\n\tret, err := FindJbrowse(exec, o.JbrowseID)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t*o = *ret\n\treturn nil\n}", "title": "" }, { "docid": "bc42fb64cc3dcd745e1ecdcfa125a5f9", "score": "0.5827807", "text": "func (o *AuthItem) Reload(ctx context.Context, exec boil.ContextExecutor) error {\n\tret, err := FindAuthItem(ctx, exec, o.ID)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t*o = *ret\n\treturn nil\n}", "title": "" }, { "docid": "da8346af1135b423fcc70ab75ae6c3b7", "score": "0.58139515", "text": "func (o *Subject) Reload(ctx context.Context, exec boil.ContextExecutor) error {\n\tret, err := FindSubject(ctx, exec, o.ID)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t*o = *ret\n\treturn nil\n}", "title": "" }, { "docid": "d4847b57036750c333dc6495cfcaddc6", "score": "0.5813894", "text": "func (o *QuestionAnswer) Reload(exec boil.Executor) error {\n\tret, err := FindQuestionAnswer(exec, o.ID)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t*o = *ret\n\treturn nil\n}", "title": "" }, { "docid": "5f20c28b982396439142a2f5d48a7fcb", "score": "0.5813208", "text": "func (o *UpepRefSeqDB) ReloadP(exec boil.Executor) {\n\tif err := o.Reload(exec); err != nil {\n\t\tpanic(boil.WrapErr(err))\n\t}\n}", "title": "" }, { "docid": "7b9c257c77037b21a839adc728ee67a2", "score": "0.5804419", "text": "func (o *TsunamiInfo) Reload(ctx context.Context, exec boil.ContextExecutor) error {\n\tret, err := FindTsunamiInfo(ctx, exec, o.ID)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t*o = *ret\n\treturn nil\n}", "title": "" }, { "docid": "ea0aef818584f81f8cef7cbe9ac55557", "score": "0.5771203", "text": "func (o *UserActivity) Reload(exec boil.Executor) error {\n\tret, err := FindUserActivity(exec, o.ID)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t*o = *ret\n\treturn nil\n}", "title": "" }, { "docid": "a77b14edd8ef1f9aa87f70baefc8ca5b", "score": "0.57561296", "text": "func (o *Tag) Reload(exec boil.Executor) error {\n\tret, err := FindTag(exec, o.ID)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t*o = *ret\n\treturn nil\n}", "title": "" }, { "docid": "a77b14edd8ef1f9aa87f70baefc8ca5b", "score": "0.57561296", "text": "func (o *Tag) Reload(exec boil.Executor) error {\n\tret, err := FindTag(exec, o.ID)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t*o = *ret\n\treturn nil\n}", "title": "" }, { "docid": "db038713f64a9485b8066ff2207c3c77", "score": "0.5751715", "text": "func (o *AuthRole) Reload(exec boil.Executor) error {\n\tret, err := FindAuthRole(exec, o.AuthRoleID)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t*o = *ret\n\treturn nil\n}", "title": "" }, { "docid": "94f4f4b466e1b206d05af252084db708", "score": "0.5723206", "text": "func (o *HomeCommentPicture) Reload(ctx context.Context, exec boil.ContextExecutor) error {\n\tret, err := FindHomeCommentPicture(ctx, exec, o.ID)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t*o = *ret\n\treturn nil\n}", "title": "" }, { "docid": "23bc8ce6ec7eb12ff542b40ee36dba2a", "score": "0.5717446", "text": "func (o *CreatorSlice) ReloadAll(ctx context.Context, exec boil.ContextExecutor) error {\n\tif o == nil || len(*o) == 0 {\n\t\treturn nil\n\t}\n\n\tslice := CreatorSlice{}\n\tvar args []interface{}\n\tfor _, obj := range *o {\n\t\tpkeyArgs := queries.ValuesFromMapping(reflect.Indirect(reflect.ValueOf(obj)), creatorPrimaryKeyMapping)\n\t\targs = append(args, pkeyArgs...)\n\t}\n\n\tsql := \"SELECT \\\"creator\\\".* FROM \\\"creator\\\" WHERE \" +\n\t\tstrmangle.WhereClauseRepeated(string(dialect.LQ), string(dialect.RQ), 0, creatorPrimaryKeyColumns, len(*o))\n\n\tq := queries.Raw(sql, args...)\n\n\terr := q.Bind(ctx, exec, &slice)\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"models: unable to reload all in CreatorSlice\")\n\t}\n\n\t*o = slice\n\n\treturn nil\n}", "title": "" }, { "docid": "cef30e8e001c797e33d6686d09e58ce7", "score": "0.5716328", "text": "func (o *ContentUnitDerivation) Reload(exec boil.Executor) error {\n\tret, err := FindContentUnitDerivation(exec, o.SourceID, o.DerivedID)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t*o = *ret\n\treturn nil\n}", "title": "" }, { "docid": "e89e254edc5093e01848a3da51c0daf6", "score": "0.57138056", "text": "func (o *Student) ReloadP(exec boil.Executor) {\n\tif err := o.Reload(exec); err != nil {\n\t\tpanic(boil.WrapErr(err))\n\t}\n}", "title": "" }, { "docid": "46649ffa5c98477543ec6c86d3250115", "score": "0.57110155", "text": "func (o *Achievement) Reload(ctx context.Context, exec boil.ContextExecutor) error {\n\tret, err := FindAchievement(ctx, exec, o.ID)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t*o = *ret\n\treturn nil\n}", "title": "" }, { "docid": "91c454bcf599891f93571dbea4484560", "score": "0.5701878", "text": "func (o *Comment) Reload(exec boil.Executor) error {\n\tret, err := FindComment(exec, o.ID)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t*o = *ret\n\treturn nil\n}", "title": "" }, { "docid": "f1ddf767977c732b2fa44ce3c7f483c5", "score": "0.57011163", "text": "func (o *AdminPromoSlice) ReloadAll(exec boil.Executor) error {\n\tif o == nil || len(*o) == 0 {\n\t\treturn nil\n\t}\n\n\tslice := AdminPromoSlice{}\n\tvar args []interface{}\n\tfor _, obj := range *o {\n\t\tpkeyArgs := queries.ValuesFromMapping(reflect.Indirect(reflect.ValueOf(obj)), adminPromoPrimaryKeyMapping)\n\t\targs = append(args, pkeyArgs...)\n\t}\n\n\tsql := \"SELECT \\\"admin_promo\\\".* FROM \\\"admin_promo\\\" WHERE \" +\n\t\tstrmangle.WhereClauseRepeated(string(dialect.LQ), string(dialect.RQ), 1, adminPromoPrimaryKeyColumns, len(*o))\n\n\tq := queries.Raw(sql, args...)\n\n\terr := q.Bind(nil, exec, &slice)\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"models: unable to reload all in AdminPromoSlice\")\n\t}\n\n\t*o = slice\n\n\treturn nil\n}", "title": "" }, { "docid": "f386716b5ada2cd8f6d32722d1b8b4a3", "score": "0.56792784", "text": "func (o *StockRelationshipCvterm) ReloadP(exec boil.Executor) {\n\tif err := o.Reload(exec); err != nil {\n\t\tpanic(boil.WrapErr(err))\n\t}\n}", "title": "" }, { "docid": "647998a7c2633931c6a26f287c5a5f59", "score": "0.5678727", "text": "func (o *IntensityStationCode) Reload(ctx context.Context, exec boil.ContextExecutor) error {\n\tret, err := FindIntensityStationCode(ctx, exec, o.ID)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t*o = *ret\n\treturn nil\n}", "title": "" }, { "docid": "bea5e533630886a68f4d2845f319bef0", "score": "0.5676022", "text": "func (o *AnalyticsPageview) Reload(ctx context.Context, exec boil.ContextExecutor) error {\n\tret, err := FindAnalyticsPageview(ctx, exec, o.ID)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t*o = *ret\n\treturn nil\n}", "title": "" }, { "docid": "5623a7a6ba6b9fca92f6b13ce3f03d63", "score": "0.567212", "text": "func (o *JbrowseSlice) ReloadAll(exec boil.Executor) error {\n\tif o == nil || len(*o) == 0 {\n\t\treturn nil\n\t}\n\n\tjbrowses := JbrowseSlice{}\n\tvar args []interface{}\n\tfor _, obj := range *o {\n\t\tpkeyArgs := queries.ValuesFromMapping(reflect.Indirect(reflect.ValueOf(obj)), jbrowsePrimaryKeyMapping)\n\t\targs = append(args, pkeyArgs...)\n\t}\n\n\tsql := fmt.Sprintf(\n\t\t\"SELECT \\\"jbrowse\\\".* FROM \\\"jbrowse\\\" WHERE (%s) IN (%s)\",\n\t\tstrings.Join(strmangle.IdentQuoteSlice(dialect.LQ, dialect.RQ, jbrowsePrimaryKeyColumns), \",\"),\n\t\tstrmangle.Placeholders(dialect.IndexPlaceholders, len(*o)*len(jbrowsePrimaryKeyColumns), 1, len(jbrowsePrimaryKeyColumns)),\n\t)\n\n\tq := queries.Raw(exec, sql, args...)\n\n\terr := q.Bind(&jbrowses)\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"chado: unable to reload all in JbrowseSlice\")\n\t}\n\n\t*o = jbrowses\n\n\treturn nil\n}", "title": "" }, { "docid": "02bc39f1fa33a6df1b154db276e2f07f", "score": "0.56707126", "text": "func (o *OperationSlice) ReloadAll(exec boil.Executor) error {\n\tif o == nil || len(*o) == 0 {\n\t\treturn nil\n\t}\n\n\toperations := OperationSlice{}\n\tvar args []interface{}\n\tfor _, obj := range *o {\n\t\tpkeyArgs := queries.ValuesFromMapping(reflect.Indirect(reflect.ValueOf(obj)), operationPrimaryKeyMapping)\n\t\targs = append(args, pkeyArgs...)\n\t}\n\n\tsql := \"SELECT \\\"operations\\\".* FROM \\\"operations\\\" WHERE \" +\n\t\tstrmangle.WhereClauseRepeated(string(dialect.LQ), string(dialect.RQ), 1, operationPrimaryKeyColumns, len(*o))\n\n\tq := queries.Raw(exec, sql, args...)\n\n\terr := q.Bind(&operations)\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"mdbmdbmodels: unable to reload all in OperationSlice\")\n\t}\n\n\t*o = operations\n\n\treturn nil\n}", "title": "" }, { "docid": "644a352ba97d8aef9271a56b423d4ade", "score": "0.5666302", "text": "func (o *Permission) Reload(ctx context.Context, exec boil.ContextExecutor) error {\n\tret, err := FindPermission(ctx, exec, o.ID)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t*o = *ret\n\treturn nil\n}", "title": "" }, { "docid": "7ff7d7b8671fb970eab928ac7af0bf98", "score": "0.5657201", "text": "func (o *DistroAdvisory) ReloadP(exec boil.Executor) {\n\tif err := o.Reload(exec); err != nil {\n\t\tpanic(boil.WrapErr(err))\n\t}\n}", "title": "" }, { "docid": "4e047f52c47c02183eaa7a59df4e53a7", "score": "0.56531864", "text": "func (o *UpepRefSeqDBSlice) ReloadAll(exec boil.Executor) error {\n\tif o == nil || len(*o) == 0 {\n\t\treturn nil\n\t}\n\n\tupepRefSeqDBS := UpepRefSeqDBSlice{}\n\tvar args []interface{}\n\tfor _, obj := range *o {\n\t\tpkeyArgs := queries.ValuesFromMapping(reflect.Indirect(reflect.ValueOf(obj)), upepRefSeqDBPrimaryKeyMapping)\n\t\targs = append(args, pkeyArgs...)\n\t}\n\n\tsql := \"SELECT \\\"upep\\\".\\\"upep_ref_seq_db\\\".* FROM \\\"upep\\\".\\\"upep_ref_seq_db\\\" WHERE \" +\n\t\tstrmangle.WhereClauseRepeated(string(dialect.LQ), string(dialect.RQ), 1, upepRefSeqDBPrimaryKeyColumns, len(*o))\n\n\tq := queries.Raw(exec, sql, args...)\n\n\terr := q.Bind(&upepRefSeqDBS)\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"models: unable to reload all in UpepRefSeqDBSlice\")\n\t}\n\n\t*o = upepRefSeqDBS\n\n\treturn nil\n}", "title": "" }, { "docid": "bfbb381814332b6a06c67e5dcbcf50fd", "score": "0.5652929", "text": "func (o *Group) Reload(ctx context.Context, exec boil.ContextExecutor) error {\n\tret, err := FindGroup(ctx, exec, o.ID)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t*o = *ret\n\treturn nil\n}", "title": "" }, { "docid": "464ddb2a167da7bfc78cb6a050a4756d", "score": "0.56516093", "text": "func (o *PartnerSlice) ReloadAll(exec boil.Executor) error {\n\tif o == nil || len(*o) == 0 {\n\t\treturn nil\n\t}\n\n\tslice := PartnerSlice{}\n\tvar args []interface{}\n\tfor _, obj := range *o {\n\t\tpkeyArgs := queries.ValuesFromMapping(reflect.Indirect(reflect.ValueOf(obj)), partnerPrimaryKeyMapping)\n\t\targs = append(args, pkeyArgs...)\n\t}\n\n\tsql := \"SELECT `partners`.* FROM `partners` WHERE \" +\n\t\tstrmangle.WhereClauseRepeated(string(dialect.LQ), string(dialect.RQ), 0, partnerPrimaryKeyColumns, len(*o))\n\n\tq := queries.Raw(sql, args...)\n\n\terr := q.Bind(nil, exec, &slice)\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"models: unable to reload all in PartnerSlice\")\n\t}\n\n\t*o = slice\n\n\treturn nil\n}", "title": "" }, { "docid": "833f4b2f4eb06203fa82291a3ea676b6", "score": "0.5646366", "text": "func (o *LadonPolicy) Reload(exec boil.Executor) error {\n\tret, err := FindLadonPolicy(exec, o.ID)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t*o = *ret\n\treturn nil\n}", "title": "" }, { "docid": "c16a09298a7ae418aa44521a275e7f7b", "score": "0.56374276", "text": "func (o *Job) ReloadP(exec boil.Executor) {\n\tif err := o.Reload(exec); err != nil {\n\t\tpanic(boil.WrapErr(err))\n\t}\n}", "title": "" }, { "docid": "1c75594288998a9b4c053b6f7df945cb", "score": "0.56283367", "text": "func (o *EarthquakeCount) Reload(ctx context.Context, exec boil.ContextExecutor) error {\n\tret, err := FindEarthquakeCount(ctx, exec, o.ID)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t*o = *ret\n\treturn nil\n}", "title": "" } ]
a3e3810368d1fe5cd975db90d2ccb92a
WithPayload adds the payload to the logout user unauthorized response
[ { "docid": "39a95d923e8d0d0d7487c2a4bdc7dd43", "score": "0.7017865", "text": "func (o *LogoutUserUnauthorized) WithPayload(payload *models.Error) *LogoutUserUnauthorized {\n\to.Payload = payload\n\treturn o\n}", "title": "" } ]
[ { "docid": "b01e075aa77077be5752e842afdcc0a7", "score": "0.67199874", "text": "func (o *PostUserIDF2aUnauthorized) WithPayload(payload *models.Response) *PostUserIDF2aUnauthorized {\n\to.Payload = payload\n\treturn o\n}", "title": "" }, { "docid": "5ab0cfb8e71d50ec4842d88955e1b80d", "score": "0.64547694", "text": "func (o *LogoutUserUnauthorized) SetPayload(payload *models.Error) {\n\to.Payload = payload\n}", "title": "" }, { "docid": "1b5d42f52d4ba8c6c02f5cd723e1ccaf", "score": "0.63343513", "text": "func (o *EndSessionV1Unauthorized) WithPayload(payload *model.StandardError) *EndSessionV1Unauthorized {\n\to.Payload = payload\n\treturn o\n}", "title": "" }, { "docid": "bcce22b365ea421eb1b01ca12fdfd7bf", "score": "0.6308535", "text": "func (o *DeleteUserUnauthorized) WithPayload(payload *models.ErrorResponse) *DeleteUserUnauthorized {\n\to.Payload = payload\n\treturn o\n}", "title": "" }, { "docid": "ebb165bcc94be57cbae2ceece0f76f13", "score": "0.61618537", "text": "func (o *DeleteUserUnauthorized) SetPayload(payload *models.ErrorResponse) {\n\to.Payload = payload\n}", "title": "" }, { "docid": "b8b7bf225da9ce44df62e974dc26ec81", "score": "0.6150534", "text": "func (o *DeleteUserForbidden) SetPayload(payload *models.ErrorResponse) {\n\to.Payload = payload\n}", "title": "" }, { "docid": "750d44a595c30e68e1b5dab7b6898e79", "score": "0.61315525", "text": "func (o *CreateUserUnauthorized) SetPayload(payload *models.ErrorResponse) {\n\to.Payload = payload\n}", "title": "" }, { "docid": "a7b07ac062808c1594ca999cb4b36c12", "score": "0.60988665", "text": "func (o *DeleteUserForbidden) WithPayload(payload *models.ErrorResponse) *DeleteUserForbidden {\n\to.Payload = payload\n\treturn o\n}", "title": "" }, { "docid": "976d6b9444725d40ef40521ff44853b2", "score": "0.60876834", "text": "func (o *GetCurrentUserUnauthorized) WithPayload(payload *models.Error) *GetCurrentUserUnauthorized {\n\to.Payload = payload\n\treturn o\n}", "title": "" }, { "docid": "cf46b22872476d4b0dacc2b4f1c91640", "score": "0.60412496", "text": "func (o *DeletePostbyIDUnauthorized) WithPayload(payload *models.Response) *DeletePostbyIDUnauthorized {\n\to.Payload = payload\n\treturn o\n}", "title": "" }, { "docid": "7be514c232c94492696500eefe175010", "score": "0.5963323", "text": "func (o *LogoutDefault) WithPayload(payload *models.Error) *LogoutDefault {\n\to.Payload = payload\n\treturn o\n}", "title": "" }, { "docid": "327d1b5f3e5854f9771c09bd234eaaa5", "score": "0.5946237", "text": "func (o *PostUserIDF2aUnauthorized) SetPayload(payload *models.Response) {\n\to.Payload = payload\n}", "title": "" }, { "docid": "08b88716768954a3c86cdf13d4adad58", "score": "0.59428453", "text": "func (o *LogoutDefault) SetPayload(payload *models.Error) {\n\to.Payload = payload\n}", "title": "" }, { "docid": "affa4ca898e453b28a0e09a9a702fc54", "score": "0.5918715", "text": "func (o *DeleteUserInternalServerError) SetPayload(payload *models.ErrorResponse) {\n\to.Payload = payload\n}", "title": "" }, { "docid": "d0630e7aa2fca8f820432965b8d42bc7", "score": "0.5917643", "text": "func (o *GetRefreshTokenUnauthorized) WithPayload(payload *models.GeneralResponse) *GetRefreshTokenUnauthorized {\n\to.Payload = payload\n\treturn o\n}", "title": "" }, { "docid": "3bdfe13a88f431468d14a5046c23a415", "score": "0.5911393", "text": "func (o *DeleteProjectUserUnauthorized) WithPayload(payload *models.ErrorResponse) *DeleteProjectUserUnauthorized {\n\to.Payload = payload\n\treturn o\n}", "title": "" }, { "docid": "8f59c543b0f2c23fd9a8cf8db515dc02", "score": "0.5909453", "text": "func (o *CreateUserForbidden) SetPayload(payload *models.ErrorResponse) {\n\to.Payload = payload\n}", "title": "" }, { "docid": "dc861dd0b954301ef86d82ae9d5c5d67", "score": "0.589896", "text": "func (o *UpdateMovieUnauthorized) WithPayload(payload *models.Result) *UpdateMovieUnauthorized {\n\to.Payload = payload\n\treturn o\n}", "title": "" }, { "docid": "6a5b64134468e5b47bb1067e672e631a", "score": "0.5893659", "text": "func (o *DeleteUserInternalServerError) WithPayload(payload *models.ErrorResponse) *DeleteUserInternalServerError {\n\to.Payload = payload\n\treturn o\n}", "title": "" }, { "docid": "49fddd786c1f61c8ba38d53ed36acaae", "score": "0.5887564", "text": "func (o *ReplicateUnauthorized) WithPayload(payload *models.ErrorResponse) *ReplicateUnauthorized {\n\to.Payload = payload\n\treturn o\n}", "title": "" }, { "docid": "576593033fe9b448c44994d2e25bab91", "score": "0.5859504", "text": "func (o *GetRefreshTokenUnauthorized) SetPayload(payload *models.GeneralResponse) {\n\to.Payload = payload\n}", "title": "" }, { "docid": "9035d6b86ccb0a7f311469ad97954073", "score": "0.5844081", "text": "func (o *UpdateActionUnauthorized) WithPayload(payload *models.ErrorMessage) *UpdateActionUnauthorized {\n\to.Payload = payload\n\treturn o\n}", "title": "" }, { "docid": "6d76194ca15463ca10c115b40ce7ac4a", "score": "0.58192563", "text": "func (o *GetCurrentUserUnauthorized) SetPayload(payload *models.Error) {\n\to.Payload = payload\n}", "title": "" }, { "docid": "e16157549291fc5616b6b7240247750a", "score": "0.5765371", "text": "func (o *DeleteProjectUserUnauthorized) SetPayload(payload *models.ErrorResponse) {\n\to.Payload = payload\n}", "title": "" }, { "docid": "1f77c8784c42ce2d0a43a3cc4dd2a945", "score": "0.57650304", "text": "func (o *DeleteUserNotFound) SetPayload(payload *models.MissingResponse) {\n\to.Payload = payload\n}", "title": "" }, { "docid": "d55297390b4b24fcb3e1cf22e6812666", "score": "0.5764752", "text": "func (o *GetResetPasswordRequestEmailUnauthorized) SetPayload(payload *models.GeneralResponse) {\n\to.Payload = payload\n}", "title": "" }, { "docid": "9706b2c3fdef1fce102c0a7c4a0879d2", "score": "0.5753218", "text": "func (o *AddReleasesUnauthorized) WithPayload(payload *models.APIResponse) *AddReleasesUnauthorized {\n\to.Payload = payload\n\treturn o\n}", "title": "" }, { "docid": "4ff73b671cb2ea63896bc3d4e5b2ca30", "score": "0.5744187", "text": "func (o *V2PostStepReplyUnauthorized) WithPayload(payload *models.InfraError) *V2PostStepReplyUnauthorized {\n\to.Payload = payload\n\treturn o\n}", "title": "" }, { "docid": "f3edfde7c81eb396064070cc55879850", "score": "0.5737975", "text": "func (o *GetResetPasswordRequestEmailUnauthorized) WithPayload(payload *models.GeneralResponse) *GetResetPasswordRequestEmailUnauthorized {\n\to.Payload = payload\n\treturn o\n}", "title": "" }, { "docid": "eb810d16f4d36ddb3ff7f6e2587b884e", "score": "0.57332265", "text": "func (o *CreateUserUnauthorized) WithPayload(payload *models.ErrorResponse) *CreateUserUnauthorized {\n\to.Payload = payload\n\treturn o\n}", "title": "" }, { "docid": "b6f2408d830295bfdc12787655fa719c", "score": "0.5732542", "text": "func (o *ServiceInstanceLastOperationGetUnauthorized) WithPayload(payload *models.Error) *ServiceInstanceLastOperationGetUnauthorized {\n\to.Payload = payload\n\treturn o\n}", "title": "" }, { "docid": "5c5546fb4c57746a691b1ade3aff2f42", "score": "0.5732026", "text": "func (o *ServiceInstanceLastOperationGetUnauthorized) SetPayload(payload *models.Error) {\n\to.Payload = payload\n}", "title": "" }, { "docid": "e2909a844cb56edc8102946dcec44bea", "score": "0.5704674", "text": "func (o *UpdateClusterUnauthorized) SetPayload(payload *models.APIResponse) {\n\to.Payload = payload\n}", "title": "" }, { "docid": "0cfbe83c91cb2b4468865447104d1b46", "score": "0.56943023", "text": "func (o *PartialUpdateAppUnauthorized) WithPayload(payload *models.Unauthorized) *PartialUpdateAppUnauthorized {\n\to.Payload = payload\n\treturn o\n}", "title": "" }, { "docid": "c30abf44132258fe54907f51f61e0901", "score": "0.5693852", "text": "func (o *AddReleasesUnauthorized) SetPayload(payload *models.APIResponse) {\n\to.Payload = payload\n}", "title": "" }, { "docid": "fcc378a10a86db93216954e2f377c0d6", "score": "0.5693763", "text": "func (o *GetIBAServerUnauthorized) WithPayload(payload *models.ErrorResponse) *GetIBAServerUnauthorized {\n\to.Payload = payload\n\treturn o\n}", "title": "" }, { "docid": "719d6f8c77170910fff3f8ebb7ad933d", "score": "0.5681163", "text": "func (o *EndSessionV1Unauthorized) SetPayload(payload *model.StandardError) {\n\to.Payload = payload\n}", "title": "" }, { "docid": "1240d407a884fc7af8b874e83962a80f", "score": "0.5665676", "text": "func (o *GetRefreshTokenForbidden) SetPayload(payload *models.GeneralResponse) {\n\to.Payload = payload\n}", "title": "" }, { "docid": "5fbb65ced3f95230a7a65cd64181a972", "score": "0.5649062", "text": "func (o *CreateHPCResourceUnauthorized) SetPayload(payload *models.ErrorResponse) {\n\to.Payload = payload\n}", "title": "" }, { "docid": "9fd1db9e63b2ecd22fc6027625adf332", "score": "0.56464756", "text": "func (o *ReplicateUnauthorized) SetPayload(payload *models.ErrorResponse) {\n\to.Payload = payload\n}", "title": "" }, { "docid": "19e788bba522a5ccb80226aed6537672", "score": "0.5646068", "text": "func (o *AddConsumptionUnauthorized) WithPayload(payload *models.ErrorResponse) *AddConsumptionUnauthorized {\n\to.Payload = payload\n\treturn o\n}", "title": "" }, { "docid": "db045870940121562375d075ef44803f", "score": "0.5644476", "text": "func (o *GetResetPasswordRequestEmailForbidden) SetPayload(payload *models.GeneralResponse) {\n\to.Payload = payload\n}", "title": "" }, { "docid": "81baf4157ce2bc0b61b78c1deebc23af", "score": "0.5643612", "text": "func (o *DeleteUserInternalServerError) WithPayload(payload string) *DeleteUserInternalServerError {\n\to.Payload = payload\n\treturn o\n}", "title": "" }, { "docid": "81a9edea2592a8802528e9779b95b1e0", "score": "0.5643493", "text": "func (o *GetAllActionsUnauthorized) WithPayload(payload *models.ErrorMessage) *GetAllActionsUnauthorized {\n\to.Payload = payload\n\treturn o\n}", "title": "" }, { "docid": "766e9a863d234036f24c4e9c4fea10c0", "score": "0.56345356", "text": "func (o *PartialUpdateAppUnauthorized) SetPayload(payload *models.Unauthorized) {\n\to.Payload = payload\n}", "title": "" }, { "docid": "01b81327aa63ab33d41a97f782bcdbb4", "score": "0.5619125", "text": "func (o *GetIBAServerUnauthorized) SetPayload(payload *models.ErrorResponse) {\n\to.Payload = payload\n}", "title": "" }, { "docid": "f3fc38897c6b40c7d4b54ac91cd0eb4c", "score": "0.5618658", "text": "func (o *UpdateClusterUnauthorized) WithPayload(payload *models.APIResponse) *UpdateClusterUnauthorized {\n\to.Payload = payload\n\treturn o\n}", "title": "" }, { "docid": "6e7450fea943ff40dba952d0776069d1", "score": "0.56166416", "text": "func (o *FinishDocumentReviewUnauthorized) WithPayload(payload *ghcmessages.Error) *FinishDocumentReviewUnauthorized {\n\to.Payload = payload\n\treturn o\n}", "title": "" }, { "docid": "83bce1ae238dd83107185abc40a4b184", "score": "0.561519", "text": "func (o *DeleteUserOK) SetPayload(payload *models.DeletedResponse) {\n\to.Payload = payload\n}", "title": "" }, { "docid": "2957d86fad6d7393a8de820e186f25b9", "score": "0.56150955", "text": "func (o *DeleteOrganizationUnauthorized) SetPayload(payload *models.ErrorResponse) {\n\to.Payload = payload\n}", "title": "" }, { "docid": "fdce449559d5354f7fcace09fe17dafd", "score": "0.560888", "text": "func (o *DeleteProjectUserInternalServerError) SetPayload(payload *models.ErrorResponse) {\n\to.Payload = payload\n}", "title": "" }, { "docid": "15b7124e1f834f33411b7c726e1c012c", "score": "0.56080216", "text": "func (r Response) Unauthorized(code string, payload Payload, header ...ResponseHeader) {\n\tr.Response(code, http.Unauthorized, payload, header...)\n}", "title": "" }, { "docid": "934cbdef9e33012657f5a246a0930fb3", "score": "0.5605823", "text": "func (o *InviteUserToGroupUnauthorized) SetPayload(payload *modelapi.Error) {\n\to.Payload = payload\n}", "title": "" }, { "docid": "375a107c107fce85bee05db50db442df", "score": "0.5605242", "text": "func (o *DeleteUserInternalServerError) SetPayload(payload string) {\n\to.Payload = payload\n}", "title": "" }, { "docid": "04c4f1f5725366226cbcd51caf46ad84", "score": "0.5600687", "text": "func (o *CreateUserServiceUnavailable) SetPayload(payload *models.ErrorResponse) {\n\to.Payload = payload\n}", "title": "" }, { "docid": "69311bbd2b964fdf939260c52838208b", "score": "0.55990684", "text": "func (o *DeleteUserUnauthorized) SetPayload(payload *DeleteUserUnauthorizedBody) {\n\to.Payload = payload\n}", "title": "" }, { "docid": "7c5365c9967ce812af84f3211af4d241", "score": "0.5598835", "text": "func (o *CreateUserInternalServerError) SetPayload(payload *models.ErrorResponse) {\n\to.Payload = payload\n}", "title": "" }, { "docid": "4fb039707e21470f7a687b83a0a3449c", "score": "0.5581178", "text": "func (o *PostRegisterDetailsUnauthorized) WithPayload(payload *models.GeneralResponse) *PostRegisterDetailsUnauthorized {\n\to.Payload = payload\n\treturn o\n}", "title": "" }, { "docid": "0eac7c0120c0e2ac955e5bd846ab0f7d", "score": "0.5580858", "text": "func (o *DeregisterInfraEnvUnauthorized) WithPayload(payload *models.InfraError) *DeregisterInfraEnvUnauthorized {\n\to.Payload = payload\n\treturn o\n}", "title": "" }, { "docid": "7275833ecc22ebbe092de0d50a431c8f", "score": "0.5570932", "text": "func (o *DeleteUserForbidden) SetPayload(payload *DeleteUserForbiddenBody) {\n\to.Payload = payload\n}", "title": "" }, { "docid": "cab09064d524279bf7344f3953f95069", "score": "0.5570489", "text": "func (o *DeleteOrganizationForbidden) SetPayload(payload *models.ErrorResponse) {\n\to.Payload = payload\n}", "title": "" }, { "docid": "0fe1e7818b2378f7f18d6ef2785233c2", "score": "0.5549063", "text": "func (o *PatchV1AdminUsersUserUnauthorized) SetPayload(payload string) {\n\to.Payload = payload\n}", "title": "" }, { "docid": "cd735372e00d4db9eb6ef7fc51bfc67a", "score": "0.5548571", "text": "func (o *DeclineCurrentUserInviteUnauthorized) SetPayload(payload *modelapi.Error) {\n\to.Payload = payload\n}", "title": "" }, { "docid": "1f9f503a751b25fd3c9b849e1922f0d9", "score": "0.5547918", "text": "func (o *PartialUpdateAppForbidden) SetPayload(payload *models.Unauthorized) {\n\to.Payload = payload\n}", "title": "" }, { "docid": "ac2a881801104fbbbf67499f130778d3", "score": "0.55477536", "text": "func (o *PostRegisterDetailsUnauthorized) SetPayload(payload *models.GeneralResponse) {\n\to.Payload = payload\n}", "title": "" }, { "docid": "66d82b9d04cf2bf482795bcc30d6014e", "score": "0.55472136", "text": "func (o *DeletePostbyIDUnauthorized) SetPayload(payload *models.Response) {\n\to.Payload = payload\n}", "title": "" }, { "docid": "831369d58effaa80e9b7b6247d9a80db", "score": "0.5530633", "text": "func (o *CheckUserGetNamespaceUnauthorized) SetPayload(payload *models.Error) {\n\to.Payload = payload\n}", "title": "" }, { "docid": "6ea2ad98dacd36541077f3b71a77a86c", "score": "0.5524189", "text": "func (o *DeleteUserByNameUnauthorized) SetPayload(payload *models.Error) {\n\to.Payload = payload\n}", "title": "" }, { "docid": "ef8c9c11fdbe47c3ebacf476d2984427", "score": "0.5522993", "text": "func (o *DeleteOrganizationUnauthorized) WithPayload(payload *models.ErrorResponse) *DeleteOrganizationUnauthorized {\n\to.Payload = payload\n\treturn o\n}", "title": "" }, { "docid": "075033554e5cd9ee5e221a283d819123", "score": "0.5517703", "text": "func (o *DeclineCurrentUserInviteInternalServerError) SetPayload(payload *modelapi.Error) {\n\to.Payload = payload\n}", "title": "" }, { "docid": "26df62766f899f20407221c41c063a0b", "score": "0.55104446", "text": "func (o *PostFriendsUpdatesListUnauthorized) SetPayload(payload *models.ErrorResponse) {\n\to.Payload = payload\n}", "title": "" }, { "docid": "1168ac94b2b2a825cd5fb530db3019a1", "score": "0.5506374", "text": "func (o *UpdateActionUnauthorized) SetPayload(payload *models.ErrorMessage) {\n\to.Payload = payload\n}", "title": "" }, { "docid": "2f139f1f0b4152d69bc864b7c3f45f29", "score": "0.5501634", "text": "func (o *CreateCurrentAPISessionCertificateUnauthorized) SetPayload(payload *rest_model.APIErrorEnvelope) {\n\to.Payload = payload\n}", "title": "" }, { "docid": "b6625232fbce37a3cf976c3669e21d62", "score": "0.5491819", "text": "func (o *GetWhoamiUnauthorized) SetPayload(payload *GetWhoamiUnauthorizedBody) {\n\to.Payload = payload\n}", "title": "" }, { "docid": "c190fa3bac7a319a3147602ce5c3ff0b", "score": "0.54901654", "text": "func (o *GetModelUnauthorized) SetPayload(payload *restmodels.Error) {\n\to.Payload = payload\n}", "title": "" }, { "docid": "970886e09e5279d90f5ef2f7f8689310", "score": "0.5489156", "text": "func (o *PatchV1AdminUsersUserForbidden) SetPayload(payload string) {\n\to.Payload = payload\n}", "title": "" }, { "docid": "cd5cb45bf27312c0a7b0092fa7a6138d", "score": "0.54837984", "text": "func (o *CreateUserGardenDefault) SetPayload(payload *models.ErrorResponse) {\n\to.Payload = payload\n}", "title": "" }, { "docid": "f57e498b0c622f59c348e79f3d055119", "score": "0.54758364", "text": "func (o *GetUserInternalServerError) SetPayload(payload *models.APIError) {\n\to.Payload = payload\n}", "title": "" }, { "docid": "1d209be4bfcceeae234853b63a7e4306", "score": "0.5473819", "text": "func (o *GetGateSourceByGateNameAndMntUnauthorized) SetPayload(payload *models.ErrorResponse) {\n\to.Payload = payload\n}", "title": "" }, { "docid": "f2dd2c3f81d74bd57f99188c91651a09", "score": "0.5469332", "text": "func (o *GetAllActionsUnauthorized) SetPayload(payload *models.ErrorMessage) {\n\to.Payload = payload\n}", "title": "" }, { "docid": "ef016cdd18ac498f6a127f37b1d2057d", "score": "0.5462892", "text": "func (r *Responder) Unauthorized() { r.write(http.StatusUnauthorized) }", "title": "" }, { "docid": "8e9b96d7da0e6172c9783853f49ba0b6", "score": "0.54591316", "text": "func (o *ShowPackageReleasesUnauthorized) WithPayload(payload *models.Error) *ShowPackageReleasesUnauthorized {\n\to.Payload = payload\n\treturn o\n}", "title": "" }, { "docid": "e71cd6cd5ab9fc387c12226197f24865", "score": "0.5457111", "text": "func (o *GetActivationsUnauthorized) SetPayload(payload *models.ErrorMessage) {\n\to.Payload = payload\n}", "title": "" }, { "docid": "ccfd870fe831beed55e648bcfa89e5ab", "score": "0.5456835", "text": "func (o *DeleteUserUnauthorized) WithPayload(payload *DeleteUserUnauthorizedBody) *DeleteUserUnauthorized {\n\to.Payload = payload\n\treturn o\n}", "title": "" }, { "docid": "6420843267d4b18f7e584c6b3e7a9f4d", "score": "0.54530627", "text": "func (o *DeleteUserForbidden) WithPayload(payload *DeleteUserForbiddenBody) *DeleteUserForbidden {\n\to.Payload = payload\n\treturn o\n}", "title": "" }, { "docid": "d0fdaf0f597c146bbca37c4edaf66eae", "score": "0.5446741", "text": "func (o *GetSolvableTestsFromUserForbidden) SetPayload(payload *models.Error) {\n\to.Payload = payload\n}", "title": "" }, { "docid": "446ff7c3d5c2b0ee30542a740d87b261", "score": "0.54398274", "text": "func (o *GetApisUnauthorized) SetPayload(payload *models.Error) {\n\to.Payload = payload\n}", "title": "" }, { "docid": "a51f0c936909b62af4ed27aae9df586a", "score": "0.54266554", "text": "func (o *UserInfoOK) SetPayload(payload *models.User) {\n\to.Payload = payload\n}", "title": "" }, { "docid": "544fa6572da2513beb3e46230986f4e4", "score": "0.53995085", "text": "func (o *InviteUserToGroupUnauthorized) WithPayload(payload *modelapi.Error) *InviteUserToGroupUnauthorized {\n\to.Payload = payload\n\treturn o\n}", "title": "" }, { "docid": "b395b85b48ace5a8824584c0a348bc91", "score": "0.5391586", "text": "func (o *DeclineCurrentUserInviteUnauthorized) WithPayload(payload *modelapi.Error) *DeclineCurrentUserInviteUnauthorized {\n\to.Payload = payload\n\treturn o\n}", "title": "" }, { "docid": "a6c5856957f60c5fe90d1ab5c304c349", "score": "0.538884", "text": "func (o *GetPaymentRequestEDIUnauthorized) SetPayload(payload *supportmessages.ClientError) {\n\to.Payload = payload\n}", "title": "" }, { "docid": "1e58011a3a44ca055f3cfeb076787540", "score": "0.53783315", "text": "func (o *DeleteProjectUserBadRequest) SetPayload(payload *models.ErrorResponse) {\n\to.Payload = payload\n}", "title": "" }, { "docid": "d325f7cf2de1711846a53904ca03248c", "score": "0.537652", "text": "func (o *AddOrgMembersV1Unauthorized) SetPayload(payload *model.StandardError) {\n\to.Payload = payload\n}", "title": "" }, { "docid": "9970299b2c857f337eb91994a7e834b4", "score": "0.5373997", "text": "func (o *GetRefreshTokenInternalServerError) SetPayload(payload *models.GeneralResponse) {\n\to.Payload = payload\n}", "title": "" }, { "docid": "2a6902c11462862967767100809c17c9", "score": "0.53651863", "text": "func (o *DeleteProjectUserInternalServerError) WithPayload(payload *models.ErrorResponse) *DeleteProjectUserInternalServerError {\n\to.Payload = payload\n\treturn o\n}", "title": "" }, { "docid": "7cb490b9ee743e0373a2b484675d25a9", "score": "0.5359741", "text": "func (o *AddConsumptionUnauthorized) SetPayload(payload *models.ErrorResponse) {\n\to.Payload = payload\n}", "title": "" }, { "docid": "3df49638049cae6eefa3e33fe914ca4d", "score": "0.5349045", "text": "func (o *VerifyAccountUnauthorized) SetPayload(payload *models.Error) {\n\to.Payload = payload\n}", "title": "" }, { "docid": "a03989efbd9ec24f2339a11fc2acd904", "score": "0.53477037", "text": "func (o *V2ListOperatorPropertiesUnauthorized) SetPayload(payload *models.InfraError) {\n\to.Payload = payload\n}", "title": "" }, { "docid": "57fa96ff320859df1ff1a4a87d734a0f", "score": "0.5346419", "text": "func (o *V2PostStepReplyUnauthorized) SetPayload(payload *models.InfraError) {\n\to.Payload = payload\n}", "title": "" }, { "docid": "6ab62f94dac8e0916fa3f39e90a9d076", "score": "0.53442127", "text": "func (o *PostUserIDF2aOK) SetPayload(payload *models.Response) {\n\to.Payload = payload\n}", "title": "" } ]
8c476db802f3554b3e4868d06c235b36
UpdateKarteiLernen Um die Karte nach dem Lernen zu aktualisieren
[ { "docid": "b3291a71c0c40df24e141baea23741d5", "score": "0.75210595", "text": "func UpdateKarteiLernen(id string, choise string, kartennr string) {\n\n\tkarteiMap, _ := btDBS.Get(id, nil)\n\tvar kartei, _ = map2kartei(karteiMap)\n\tvar index, _ = strconv.ParseInt(kartennr, 0, 0)\n\tindex--\n\tvar fachnr, _ = strconv.ParseInt(kartei.Karteikarten[index].Fach, 0, 0)\n\n\tif choise == \"true\" {\n\t\tif fachnr < 4 {\n\t\t\tfachnr++\n\t\t}\n\t} else {\n\t\tfachnr = 0\n\t}\n\n\tkartei.Karteikarten[index].Fach = strconv.Itoa(int(fachnr))\n\n\tkarteiMap, _ = kartei2Map(kartei)\n\n\tbtDBS.Set(id, karteiMap)\n}", "title": "" } ]
[ { "docid": "4a35e5d8226837171e2e4dec9cc9e050", "score": "0.6339193", "text": "func UpdateKarteikastenKarten(id string, KartenName string, Frage string, Antwort string, KartenNr string) error {\n\n\tkastenMap, _ := btDBS.Get(id, nil)\n\n\tvar karteikastenStruct, _ = map2kartei(kastenMap)\n\n\tkartennr, _ := strconv.ParseInt(KartenNr, 0, 0)\n\n\tif kartennr == 0 {\n\n\t\tkartenNRneu, _ := strconv.ParseInt(karteikastenStruct.AnzKarten, 0, 0)\n\t\tkartenNRneuInt := int(kartenNRneu + 1)\n\t\tkarteikastenStruct.AnzKarten = strconv.Itoa(kartenNRneuInt)\n\n\t\tvar Karten = make([]Karteikarte, kartenNRneuInt)\n\n\t\tfor i := 0; i < int(kartenNRneu); i++ {\n\t\t\tKarten[i] = karteikastenStruct.Karteikarten[i]\n\t\t}\n\n\t\tif Antwort == \"\" {\n\t\t\tKarten[kartenNRneu].Antwort = \"\"\n\t\t} else {\n\t\t\tKarten[kartenNRneu].Antwort = Antwort\n\t\t}\n\t\tif Frage == \"\" {\n\t\t\tKarten[kartenNRneu].Frage = \"\"\n\t\t} else {\n\t\t\tKarten[kartenNRneu].Frage = Frage\n\t\t}\n\t\tif KartenName == \"\" {\n\t\t\tKarten[kartenNRneu].KartenName = \"\"\n\t\t} else {\n\t\t\tKarten[kartenNRneu].KartenName = KartenName\n\t\t}\n\n\t\tKarten[kartenNRneu].KartenNr = strconv.Itoa(kartenNRneuInt)\n\t\tKarten[kartenNRneu].Fach = \"0\"\n\n\t\tkarteikastenStruct.Karteikarten = Karten\n\n\t\tKasteMap, _ := kartei2Map(karteikastenStruct)\n\n\t\tfmt.Println(KasteMap)\n\n\t\tret := btDBS.Set(id, KasteMap)\n\n\t\treturn ret\n\n\t} else {\n\n\t\tkarteikastenStruct.Karteikarten[kartennr-1].KartenName = KartenName\n\t\tkarteikastenStruct.Karteikarten[kartennr-1].Frage = Frage\n\t\tkarteikastenStruct.Karteikarten[kartennr-1].Antwort = Antwort\n\n\t\tKasteMap, _ := kartei2Map(karteikastenStruct)\n\n\t\tret := btDBS.Set(id, KasteMap)\n\t\treturn ret\n\t}\n\n}", "title": "" }, { "docid": "04100cda3ea0f0b3d767bd15a00d3d2d", "score": "0.5805192", "text": "func UpdateRezept(w http.ResponseWriter, r *http.Request) {\n\tid := r.FormValue(\"id\")\n\tif id == \"\" {\n\t\thttp.Redirect(w, r, \"/alleRezepte\", http.StatusFound)\n\t\treturn\n\t} else {\n\t\tdaten := model.GetRezeptById(id)\n\t\tid1, _ := strconv.Atoi(daten.ID)\n\t\tif id1 <= 0 {\n\t\t\thttp.Redirect(w, r, \"/alleRezepte\", http.StatusFound)\n\t\t\treturn\n\t\t} else {\n\n\t\t\tvar index []int\n\t\t\tfor i := 0; i < len(daten.Schritte); i++ {\n\t\t\t\tindex = append(index, (i + 1))\n\t\t\t}\n\n\t\t\tvar index2 []int\n\t\t\tfor i := 0; i < len(daten.Zutaten); i++ {\n\t\t\t\tindex2 = append(index2, (i + 1))\n\t\t\t}\n\n\t\t\tdatensatz := Datenrezeptupdate{\n\t\t\t\tRezept: daten,\n\t\t\t\tIndexSchritte: index,\n\t\t\t\tIndexZutaten: index2,\n\t\t\t}\n\n\t\t\ttmpl, err := template.ParseFiles(\"static/template/updateRezept.tmpl\",\n\t\t\t\t\"static/template/headAdmin.tmpl\", \"static/template/headerAdmin.tmpl\")\n\t\t\tif err != nil {\n\t\t\t\tw.Header().Set(\"Location\", (\"/rezeptBearbeiten?id=\" + id))\n\t\t\t\tt, err := template.New(\"todos\").Parse(\"Es ist ein Fehler beim anzeigen der Seite aufgetretten.\")\n\t\t\t\tif err != nil {\n\t\t\t\t\tpanic(err)\n\t\t\t\t}\n\t\t\t\terr = t.Execute(w, \"todos\")\n\t\t\t\tif err != nil {\n\t\t\t\t\tpanic(err)\n\t\t\t\t}\n\t\t\t\treturn\n\t\t\t}\n\n\t\t\tvar t1 = template.Must(tmpl, err)\n\t\t\tt1.ExecuteTemplate(w, \"updateRezept\", datensatz)\n\t\t}\n\t}\n}", "title": "" }, { "docid": "0f36a75c8dd7d0f5c6bd79b6d62d419e", "score": "0.5493476", "text": "func UpdateRezeptDB(w http.ResponseWriter, r *http.Request) {\n\tname := r.FormValue(\"name\")\n\tart := r.FormValue(\"art\")\n\tanlass := r.FormValue(\"anlass\")\n\tpraeferenz := r.FormValue(\"praeferenz\")\n\tzeit, _ := strconv.Atoi(r.FormValue(\"zeit\"))\n\tbeschreibung := r.FormValue(\"beschreibung\")\n\tanzahlZutaten := r.FormValue(\"member\")\n\tanzahlSchritte := r.FormValue(\"memberText\")\n\tid := r.FormValue(\"id\")\n\tbild := r.FormValue(\"bild\")\n\n\tif name == \"\" || art == \"\" || anlass == \"\" || praeferenz == \"\" || beschreibung == \"\" || anzahlZutaten == \"\" || anzahlSchritte == \"\" || id == \"\" {\n\t\thttp.Redirect(w, r, \"/alleRezepte\", http.StatusFound)\n\t} else {\n\n\t\tanzahlZutatenInt, _ := strconv.Atoi(anzahlZutaten)\n\t\tzutaten := make([]model.Zutat, anzahlZutatenInt)\n\n\t\tanzahlSchritteInt, _ := strconv.Atoi(anzahlSchritte)\n\t\tschritte := make([]string, anzahlSchritteInt)\n\n\t\tfor i := 0; i < anzahlSchritteInt; i++ {\n\t\t\tsname := r.FormValue(\"schritt\" + strconv.Itoa(i+1))\n\t\t\tif sname == \"\" {\n\t\t\t\thttp.Redirect(w, r, (\"/rezeptBearbeiten?id=\" + id), http.StatusFound)\n\t\t\t\treturn\n\t\t\t} else {\n\t\t\t\tschritte[i] = sname\n\t\t\t}\n\n\t\t}\n\n\t\tfor i := 0; i < anzahlZutatenInt; i++ {\n\t\t\tzname := r.FormValue(\"zutatName\" + strconv.Itoa(i+1))\n\t\t\tzmenge, _ := strconv.Atoi(r.FormValue(\"zutatMenge\" + strconv.Itoa(i+1)))\n\t\t\tzeinheit := r.FormValue(\"zutatEinheit\" + strconv.Itoa(i+1))\n\t\t\tidz := r.FormValue(\"zutatID\" + strconv.Itoa(i+1))\n\t\t\tif zname == \"\" || zmenge == 0 || zeinheit == \"\" {\n\t\t\t\thttp.Redirect(w, r, (\"/rezeptBearbeiten?id=\" + id), http.StatusFound)\n\t\t\t\treturn\n\t\t\t} else {\n\t\t\t\tzutat := model.Zutat{idz, zname, zmenge, zeinheit}\n\t\t\t\tzutaten[i] = zutat\n\t\t\t}\n\t\t}\n\n\t\tbildUp := UploadPicture(r)\n\n\t\tif bildUp == \"\" {\n\t\t\tbildUp = bild\n\t\t}\n\n\t\trezept := model.Rezept{\n\t\t\tID: id,\n\t\t\tName: name,\n\t\t\tArt: art,\n\t\t\tAnlass: anlass,\n\t\t\tPraeferenz: praeferenz,\n\t\t\tKochzeit: zeit,\n\t\t\tBeschreibung: beschreibung,\n\t\t\tAnzahlZutaten: anzahlSchritteInt,\n\t\t\tZutaten: zutaten,\n\t\t\tSchritte: schritte,\n\t\t\tBild: bildUp,\n\t\t}\n\n\t\ttemp := model.UpdateRezeptInDB(rezept)\n\t\tif temp {\n\t\t\thttp.Redirect(w, r, \"/alleRezepte\", http.StatusFound)\n\t\t} else {\n\t\t\t//redirect\n\t\t}\n\t}\n}", "title": "" }, { "docid": "8e6fd22324720c626120c806359accaa", "score": "0.53546125", "text": "func (server *Server) UpdateItensFatura(w http.ResponseWriter, r *http.Request) {\n\n\t//\tAutorizacao de Modulo\n\tif err := config.AuthMod(w, r, 17023); err != nil {\n\t\tresponses.ERROR(w, http.StatusUnauthorized, fmt.Errorf(\"[FATAL] Unauthorized\"))\n\t\treturn\n\t}\n\n\tbody, err := ioutil.ReadAll(r.Body)\n\tif err != nil {\n\t\tresponses.ERROR(w, http.StatusUnprocessableEntity, fmt.Errorf(\"[FATAL] it couldn't read the 'body', %v\\n\", err))\n\t\treturn\n\t}\n\n\t//\tExtrai o cod_usuario do body\n\ttokenID, err := auth.ExtractTokenID(r)\n\tif err != nil {\n\t\tresponses.ERROR(w, http.StatusUnauthorized, errors.New(\"Unauthorized\"))\n\t\treturn\n\t}\n\n\titensFatura := models.ItensFatura{}\n\tlogItensFatura := models.Log{}\n\n\tif err = json.Unmarshal(body, &itensFatura); err != nil {\n\t\tresponses.ERROR(w, http.StatusUnprocessableEntity, fmt.Errorf(\"[FATAL] ERROR: 422, %v\\n\", err))\n\t\treturn\n\t}\n\n\t// Vars retorna as variaveis de rota\n\tvars := mux.Vars(r)\n\n\t//\tnumNF armazena a chave primaria da tabela itensFatura\n\tnumNF, err := strconv.ParseUint(vars[\"num_nf\"], 10, 64)\n\tif err != nil {\n\t\tresponses.ERROR(w, http.StatusBadRequest, fmt.Errorf(\"[FATAL] It couldn't parse the variable, %v\\n\", err))\n\t\treturn\n\t}\n\n\t//\tcodIbge armazena a chave primaria da tabela itensFatura\n\tcodIbge, err := strconv.ParseUint(vars[\"cod_ibge\"], 10, 64)\n\tif err != nil {\n\t\tresponses.ERROR(w, http.StatusBadRequest, fmt.Errorf(\"[FATAL] It couldn't parse the variable, %v\\n\", err))\n\t\treturn\n\t}\n\n\t//\tidEmpenho armazena a chave primaria da tabela itensFatura\n\tidEmpenho, err := strconv.ParseUint(vars[\"id_empenho\"], 10, 64)\n\tif err != nil {\n\t\tresponses.ERROR(w, http.StatusBadRequest, fmt.Errorf(\"[FATAL] It couldn't parse the variable, %v\\n\", err))\n\t\treturn\n\t}\n\n\t//\tcodItem armazena a chave primaria da tabela itensFatura\n\tcodItem, err := strconv.ParseUint(vars[\"cod_item\"], 10, 64)\n\tif err != nil {\n\t\tresponses.ERROR(w, http.StatusBadRequest, fmt.Errorf(\"[FATAL] It couldn't parse the variable, %v\\n\", err))\n\t\treturn\n\t}\n\n\t//\tcodTipoItem armazena a chave primaria da tabela itensFatura\n\tcodTipoItem, err := strconv.ParseUint(vars[\"cod_tipo_item\"], 10, 64)\n\tif err != nil {\n\t\tresponses.ERROR(w, http.StatusBadRequest, fmt.Errorf(\"[FATAL] It couldn't parse the variable, %v\\n\", err))\n\t\treturn\n\t}\n\n\tif err = validation.Validator.Struct(itensFatura); err != nil {\n\t\tlog.Printf(\"[WARN] invalid information, because, %v\\n\", fmt.Errorf(\"[FATAL] validation error!, %v\\n\", err))\n\t\tw.WriteHeader(http.StatusPreconditionFailed)\n\t\treturn\n\t}\n\n\t//\tParametros de entrada(nome_server, chave_primaria, chave_primaria, chave_primaria, chave_primaria, chave_primaria, nome_tabela, operacao, id_usuario)\n\terr = logItensFatura.LogItensFatura(server.DB, uint32(numNF), uint32(codIbge), uint32(idEmpenho), uint32(codItem), uint32(codTipoItem), \"itens_fatura\", \"u\", tokenID)\n\tif err != nil {\n\t\tformattedError := config.FormatError(err.Error())\n\t\tresponses.ERROR(w, http.StatusInternalServerError, fmt.Errorf(\"[FATAL] it couldn't save log in database, %v\\n\", formattedError))\n\t\treturn\n\t}\n\n\t//\tupdateItensFatura recebe a nova itensFatura, a que foi alterada\n\tupdateItensFatura, err := itensFatura.UpdateItensFatura(server.DB, uint32(numNF), uint32(codIbge), uint32(idEmpenho), uint32(codItem), uint32(codTipoItem))\n\tif err != nil {\n\t\tformattedError := config.FormatError(err.Error())\n\t\tresponses.ERROR(w, http.StatusInternalServerError, fmt.Errorf(\"[FATAL] it couldn't update in database , %v\\n\", formattedError))\n\t\treturn\n\t}\n\n\t//\tRetorna o Status 200 e o JSON da struct alterada\n\tresponses.JSON(w, http.StatusOK, updateItensFatura)\n}", "title": "" }, { "docid": "82bfb869d757dafec0f382fa37a95772", "score": "0.5143639", "text": "func UpdateBeitrag(w http.ResponseWriter, r *http.Request) {\n\ttitel := r.FormValue(\"titel\")\n\tkategorie := r.FormValue(\"kategorie\")\n\tinhalt := r.FormValue(\"inhalt\")\n\tid, _ := strconv.Atoi(r.FormValue(\"id\"))\n\tif titel == \"\" || kategorie == \"\" || inhalt == \"\" || id <= 0 {\n\t\thttp.Redirect(w, r, \"/alleBeitraege\", http.StatusFound)\n\t} else {\n\t\tbeitrag := model.Beitrag{\n\t\t\tTitel: titel,\n\t\t\tKategorie: kategorie,\n\t\t\tInhalt: inhalt,\n\t\t\tBeitID: id,\n\t\t}\n\t\tprintln(beitrag.Titel)\n\t\ttemp := model.UpdateBeitragToDB(beitrag)\n\t\tif temp {\n\t\t\thttp.Redirect(w, r, \"/alleBeitraege\", http.StatusFound)\n\t\t} else {\n\t\t\thttp.Redirect(w, r, \"/beitragBearbeiten?id=\"+strconv.Itoa(id), http.StatusFound)\n\t\t}\n\t}\n}", "title": "" }, { "docid": "5a79598cf606b20f613b111b98bc733b", "score": "0.51192", "text": "func (u *HTTPKarteikastenHandler) Update(w http.ResponseWriter, r *http.Request) {\n\tvalid := session.GetCookieAuthenticated(w, r)\n\tif valid {\n\t\t// Get userid from cookie for foreign key from kasten\n\t\tuserid := session.GetCookieUserID(w, r)\n\t\tvar kasten model.Karteikasten\n\t\tkasten.UserID = userid\n\t\terr := json.NewDecoder(r.Body).Decode(&kasten)\n\t\tif err != nil {\n\t\t\tfmt.Println(err)\n\t\t}\n\t\t// If struct isn't valid don't store it\n\t\tif ok, err := isRequestValid(&kasten); !ok {\n\t\t\tfmt.Println(err)\n\t\t} else {\n\t\t\terr = u.KarteikastenUsecase.Update(&kasten)\n\t\t\tif err != nil {\n\t\t\t\tfmt.Println(err)\n\t\t\t} else {\n\t\t\t\tjson.NewEncoder(w).Encode(kasten)\n\t\t\t}\n\t\t}\n\t} else {\n\t\tfmt.Println(\"Nicht eingeloggt\")\n\t}\n}", "title": "" }, { "docid": "3659818ece16678d4b597c8d2fc1dedf", "score": "0.49539068", "text": "func EditLisGET(w http.ResponseWriter, r *http.Request) {\n\tsess := model.Instance(r)\n var params httprouter.Params\n params = context.Get(r, \"params\").(httprouter.Params)\n SId := params.ByName(\"id\")\n Id,_ := atoi32(SId)\n posact = int(Id)\n offset = int(Id) - 1\n TotalCount := model.EditCount()\n if TotalCount == 0 {\n\t sess.AddFlash(view.Flash{\"No hay lenguajes.\", view.FlashError})\n sess.Save(r, w)\n return\n }else{\n offset = offset * limit\n lisEdits, err := model.EditLim(limit, offset)\n if err != nil {\n log.Println(err)\n\t sess.AddFlash(view.Flash{\"Error Listando Editores.\", view.FlashError})\n sess.Save(r, w)\n }\n\tv := view.New(r)\n\tv.Name = \"editor/editlis\"\n\tv.Vars[\"token\"] = csrfbanana.Token(w, r, sess)\n numberOfBtns := getNumberOfButtonsForPagination(TotalCount, limit)\n sliceBtns := createSliceForBtns(numberOfBtns, posact) \n v.Vars[\"slice\"] = sliceBtns\n v.Vars[\"current\"] = posact\n v.Vars[\"Level\"] = sess.Values[\"level\"]\n v.Vars[\"LisEdit\"] = lisEdits\n\tv.Render(w)\n }\n }", "title": "" }, { "docid": "85b5f14f9edb189b44135c45fca6468a", "score": "0.48253584", "text": "func (s Boardpia) UpdatePrevNewArrivals(arrivals []NewArrival) {\n\treturn\n}", "title": "" }, { "docid": "6952e66e9081181ec4bc343b29f2c88d", "score": "0.46507078", "text": "func UpdateItinerarioExposicion(writter http.ResponseWriter, request *http.Request) {\n\tvar lastItinerarioExposicion models.ItinerarioExposicion\n\tvar newItinerarioExposicion models.ItinerarioExposicion\n\tvar recipient map[string]interface{}\n\terr := json.NewDecoder(request.Body).Decode(&recipient)\n\tjsonResponse := simplejson.New()\n\tif err == nil {\n\n\t\tmapstructure.Decode(recipient[\"filter\"], &lastItinerarioExposicion)\n\t\tmapstructure.Decode(recipient[\"update\"], &newItinerarioExposicion)\n\n\t\tItinerarioExposicionFilters, ItinerarioExposicionFiltersValues := utilities.ObjectFields(lastItinerarioExposicion)\n\t\tItinerarioExposicionStrings, ItinerarioExposicionValues := utilities.ObjectFields(newItinerarioExposicion)\n\n\t\tItinerarioExposicionRows, err := utilities.UpdateObject(\"ItinerarioExposicion\", ItinerarioExposicionFilters, ItinerarioExposicionFiltersValues, ItinerarioExposicionStrings, ItinerarioExposicionValues)\n\t\tif err == nil {\n\n\t\t\tif ItinerarioExposicionRows {\n\n\t\t\t\tjsonResponse.Set(\"Exito\", true)\n\t\t\t\tjsonResponse.Set(\"Message\", \"ItinerarioExposicion actualizado\")\n\n\t\t\t} else {\n\n\t\t\t\tjsonResponse.Set(\"Exito\", false)\n\t\t\t\tjsonResponse.Set(\"Message\", err.Error())\n\n\t\t\t}\n\n\t\t} else {\n\t\t\tjsonResponse.Set(\"Exito\", false)\n\t\t\tjsonResponse.Set(\"Message\", err.Error())\n\t\t}\n\n\t} else {\n\t\tjsonResponse.Set(\"Exito\", false)\n\t\tjsonResponse.Set(\"Message\", err.Error())\n\t}\n\n\tpayload, err := jsonResponse.MarshalJSON()\n\twritter.Header().Set(\"Content-Type\", \"application/json\")\n\twritter.Write(payload)\n\treturn\n}", "title": "" }, { "docid": "d1d120a6e359e097bc4478707ea08387", "score": "0.46395823", "text": "func UpdateDataKaryaById(Id_karya string, Kategory string, Judul string, Deskripsi string) {\n\tdb := Conn()\n\tdefer db.Close()\n\tstmt, _ := db.Prepare(\"UPDATE tb_karya SET Kategory=?, Judul=?, Deskripsi=? WHERE Id_karya=?\")\n\tstmt.Exec(Kategory, Judul, Deskripsi, Id_karya)\n\tdefer stmt.Close()\n}", "title": "" }, { "docid": "a27041810d8e33a2c93c1f1bc0c45488", "score": "0.46391478", "text": "func (itensFatura *ItensFatura) UpdateItensFatura(db *gorm.DB, numNF, codIbge, idEmpenho, codItem, codTipoItem uint32) (*ItensFatura, error) {\n\n\t//\tPermite a atualizacao dos campos indicados\n\tdb = db.Debug().Exec(\"UPDATE itens_fatura SET valor = ?, quantidade = ? WHERE num_nf = ? AND cod_ibge = ? AND id_empenho = ? AND cod_item = ? AND cod_tipo_item = ?\", itensFatura.Valor, itensFatura.Quantidade, numNF, codIbge, idEmpenho, codItem, codTipoItem)\n\tif db.Error != nil {\n\t\treturn &ItensFatura{}, db.Error\n\t}\n\n\t//\tBusca um elemento no banco de dados a partir de sua chave primaria\n\terr := db.Debug().Model(&ItensFatura{}).Take(&itensFatura).Error\n\tif err != nil {\n\t\treturn &ItensFatura{}, err\n\t}\n\n\treturn itensFatura, err\n}", "title": "" }, { "docid": "d0ca597cd87870aac6d59d1c38c1bd3d", "score": "0.46378624", "text": "func UpdateLamp(lamp Lamp) {\n\tsession := connectDB()\n\tdefer session.Close()\n\tlampcoll := session.DB(\"HA17DB_jesse_arff_590245\").C(\"lamps\")\n\terr := lampcoll.Update(bson.M{\"lampid\": lamp.LampID}, bson.M{\"$set\": bson.M{\"name\": lamp.Name, \"status\": lamp.Status, \"roomid\": lamp.RoomID}})\n\t//err := lampcoll.Remove(bson.M{\"lampid\": lamp.LampID})\n\t//err = lampcoll.Insert(lamp)\n\tif err != nil {\n\n\t}\n\tuser := User{\n\t\tUserID: -1,\n\t}\n\tscenes := Getsences(user)\n\tscenecoll := session.DB(\"HA17DB_jesse_arff_590245\").C(\"scenes\")\n\tfor _, scene := range scenes {\n\t\tfor _, sceneLamp := range scene.Lamps {\n\t\t\tif sceneLamp.LampID == lamp.LampID {\n\t\t\t\tscenecoll.Update(bson.M{\"sceneid\": scene.SceneID, \"lamps.lampid\": sceneLamp.LampID}, bson.M{\"$set\": bson.M{\"lamps.$.name\": lamp.Name, \"lamps.$.roomid\": lamp.RoomID}})\n\t\t\t}\n\t\t}\n\t}\n\tUpdateTime()\n}", "title": "" }, { "docid": "66d28a7e0fc38159ce76c088f143ffca", "score": "0.45741564", "text": "func (r *Routine) Update() {\n\tfor i, iface := range r.ilist {\n\t\tr.ilist[i].oldDown = iface.newDown\n\t\tr.ilist[i].oldUp = iface.newUp\n\n\t\tdown, err := readFile(iface.downPath)\n\t\tif err != nil {\n\t\t\t// r.err = err\n\t\t\tcontinue\n\t\t}\n\t\tr.ilist[i].newDown = down\n\n\t\tup, err := readFile(iface.upPath)\n\t\tif err != nil {\n\t\t\t// r.err = err\n\t\t\tcontinue\n\t\t}\n\t\tr.ilist[i].newUp = up\n\t}\n}", "title": "" }, { "docid": "56c57c8c76ccc4ac7e7cbb409d644a04", "score": "0.4555473", "text": "func (c *API) UpdateKeyless() {\n}", "title": "" }, { "docid": "3dccac518f2084b20e71f9258905f7f6", "score": "0.45435604", "text": "func (c *lins) Update(lin *v1.Lin) (result *v1.Lin, err error) {\n\tresult = &v1.Lin{}\n\terr = c.client.Put().\n\t\tNamespace(c.ns).\n\t\tResource(\"lins\").\n\t\tName(lin.Name).\n\t\tBody(lin).\n\t\tDo().\n\t\tInto(result)\n\treturn\n}", "title": "" }, { "docid": "ffc7f2d12dcc30352f40a6c3c77822a6", "score": "0.45108977", "text": "func Update_orders_and_lights(system_update_ch <- chan map[string]Elev_info, rem_local_order_ch chan <-[N_FLOORS][N_BUTTONS]int, elev_id string){\n\n\tvar new_local_order_matrix [N_FLOORS][N_BUTTONS]int\n\n\tfor{\n\n\t\tselect{\n\n\t\tcase online_elevators := <- system_update_ch:\n\n\t\t\tnew_local_order_matrix = online_elevators[elev_id].Local_order_matrix\n\n\t\t\tfor i:= 0; i < N_FLOORS; i++{\n\n\t\t\t\tfor j:= 0; j < N_BUTTONS-1; j++{\n\n\t\t\t\t\tfor order_elevator := range online_elevators {\n\n\t\t\t\t\t\tif online_elevators[order_elevator].Local_order_matrix[i][j] == 1{\n\n\t\t\t\t\t\t\tElev_set_button_lamp(j,i,1)\n\n\t\t\t\t\t\t\tfor elevator := range online_elevators {\n\n\t\t\t\t\t\t\t\tif online_elevators[elevator].Floor == i{\n\n\t\t\t\t\t\t\t\t\tif online_elevators[elevator].Dir == DIR_UP && j == EXT_UP_BUTTONS {\n\n\t\t\t\t\t\t\t\t\t\tnew_local_order_matrix[i][j] = 0\n\t\t\t\t\t\t\t\t\t\tElev_set_button_lamp(j,i,0)\n\n\t\t\t\t\t\t\t\t\t}else if online_elevators[elevator].Dir == DIR_DOWN && j == EXT_DOWN_BUTTONS{\n\n\t\t\t\t\t\t\t\t\t\tnew_local_order_matrix[i][j] = 0\n\t\t\t\t\t\t\t\t\t\tElev_set_button_lamp(j,i,0)\n\n\t\t\t\t\t\t\t\t\t}else if online_elevators[elevator].Dir == DIR_IDLE && (j == EXT_UP_BUTTONS || j == EXT_DOWN_BUTTONS){\n\n\t\t\t\t\t\t\t\t\t\tnew_local_order_matrix[i][j] = 0\n\t\t\t\t\t\t\t\t\t\tElev_set_button_lamp(j,i,0)\n\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}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif online_elevators[elev_id].Local_order_matrix[online_elevators[elev_id].Floor][INTERNAL_BUTTONS] == 1{\n\n\t\t\t\tnew_local_order_matrix[online_elevators[elev_id].Floor][INTERNAL_BUTTONS] = 0\n\t\t\t\tElev_set_button_lamp(INTERNAL_BUTTONS, online_elevators[elev_id].Floor, 0)\n\t\t\t\t\n\t\t\t}\n\n\t\t\tfor i := 0; i < N_FLOORS; i++{\n\n\t\t\t\tif new_local_order_matrix[i][INTERNAL_BUTTONS] == 1{\n\n\t\t\t\t\tElev_set_button_lamp(INTERNAL_BUTTONS, i, 1)\n\n\t\t\t\t}\n\t\t\t}\n\t\t\tif Elev_get_floor_sensor_signal() != LIMBO{\n\t\t\t\tElev_set_floor_indicator(Elev_get_floor_sensor_signal())\n\t\t\t}\t\n\t\t\trem_local_order_ch <- new_local_order_matrix\n\t\t}\n\t}\n}", "title": "" }, { "docid": "b9a42b9a62016776b70063df4d06a116", "score": "0.45038724", "text": "func (s *SessionTicketService) stayUpdated() {\n\tdefer func() {\n\t\tif err := recover(); err != nil {\n\t\t\tlog.Printf(\"[PANIC] session ticket service: %v\\n%s\", err, debug.Stack())\n\t\t}\n\t}()\n\n\ts.ticker = time.NewTicker(s.RotationInterval)\n\tdefer func() {\n\t\t_ = s.ticker.Stop\n\t}()\n\n\tfor {\n\t\tselect {\n\t\tcase <-s.ticker.C:\n\t\t\ts.mu.Lock()\n\n\t\t\tif s.DisableRotation {\n\t\t\t\ts.mu.Unlock()\n\t\t\t\tcontinue\n\t\t\t}\n\n\t\t\tnewKeys, err := s.RotateSTEKs(s.currentKeys)\n\t\t\tif err == nil {\n\t\t\t\ts.currentKeys = newKeys\n\t\t\t}\n\t\t\tfmt.Println(newKeys)\n\n\t\t\tconfigs := s.configs\n\n\t\t\ts.mu.Unlock()\n\n\t\t\tfor cfg := range configs {\n\t\t\t\tcfg.SetSessionTicketKeys(newKeys)\n\t\t\t}\n\t\tcase <-s.stopChan:\n\t\t\treturn\n\t\t}\n\t}\n}", "title": "" }, { "docid": "7b15342eafdecdb3cbdb5d7146b2f527", "score": "0.4490847", "text": "func AutorizadosUpdate(w http.ResponseWriter, r *http.Request) {\n\tdb := database.DbConn()\n\tauto := model.Tautorizado{}\n\tif r.Method == \"POST\" {\n\t\ti, _ := strconv.Atoi(r.FormValue(\"ID\"))\n\t\tauto.ID = int64(i)\n\t\tauto.IDUsuario, _ = strconv.Atoi(r.FormValue(\"IDUsuario\"))\n\t\tauto.NombreAutorizado = r.FormValue(\"NombreAutorizado\")\n\t\tauto.Nif = r.FormValue(\"Nif\")\n\t\tinsForm, err := db.Prepare(\"UPDATE autorizados SET idUsuario=?, nombreAutorizado=?, autorizados.nif=? WHERE autorizados.id=?\")\n\t\tif err != nil {\n\t\t\tvar verror model.Resulterror\n\t\t\tverror.Result = \"ERROR\"\n\t\t\tverror.Error = \"Error Actualizando Base de Datos\"\n\t\t\ta, _ := json.Marshal(verror)\n\t\t\tw.Write(a)\n\t\t\tpanic(err.Error())\n\t\t}\n\n\t\tinsForm.Exec(auto.IDUsuario, auto.NombreAutorizado, auto.Nif, auto.ID)\n\t\tlog.Println(\"UPDATE: nombreAutorizado: \" + auto.NombreAutorizado + \" | nif: \" + auto.Nif)\n\t}\n\tdefer db.Close()\n\tvar vrecord model.AutorizadoRecord\n\tvrecord.Result = \"OK\"\n\tvrecord.Record = auto\n\ta, _ := json.Marshal(vrecord)\n\tw.Write(a)\n\n\t//\thttp.Redirect(w, r, \"/\", 301)\n}", "title": "" }, { "docid": "3f4b390125462f3c4e4ce38806dab8ab", "score": "0.44561845", "text": "func update() {\r\n\tfor _, clm := range clms {\r\n\t\tclm.update()\r\n\t}\r\n}", "title": "" }, { "docid": "c30d5648cca87e1fb4315a56379a28a0", "score": "0.44512898", "text": "func PageKaryaEdit(w http.ResponseWriter, r *http.Request) {\n\tdata := make(map[string]interface{})\n\n\t// ambil Id_karya dari URL\n\tr.ParseForm()\n\tId_karya := r.FormValue(\"Id_karya\")\n\n\t// jika POST maka jalankan condition if\n\tif r.Method == \"POST\" {\n\t\tKategory := r.PostFormValue(\"Kategory\")\n\t\tJudul := r.PostFormValue(\"Judul\")\n\t\tDeskripsi := r.PostFormValue(\"Deskripsi\")\n\n\t\t// menampilkan di cmd\n\t\tfmt.Println(Kategory, Judul, Deskripsi)\n\n\t\t// model UpdateDataSiswaById()\n\t\tUpdateDataKaryaById(Id_karya, Kategory, Judul, Deskripsi)\n\n\t\t// info yang dicetak di html\n\t\tdata[\"info\"] = \"Data berhasil diupdate\"\n\t}\n\n\tdata[\"karya\"] = ReadDataKaryaById(Id_karya)\n\tRenderTemplate(w, Dir_Name+\"karya_edit.html\", data)\n}", "title": "" }, { "docid": "25291c6d8841a4a4822a6a1c600372b2", "score": "0.44460228", "text": "func Light_updater() {\n\tfor {\n\t\tselect {\n\t\tcase lightArray := <-ExStateMChans.LightChan:\n\t\t\tfor i := 0; i < N_FLOORS; i++ {\n\t\t\t\tfor j := 0; j < N_BUTTONS-1; j++ {\n\t\t\t\t\t\n\t\t\t\t\tdriver.Elev_set_button_lamp(i, j, lightArray[i][j])\n\t\t\t\t\tInStateMChans.buttonUpdatedChan <- Order{i, j, lightArray[i][j]}\n\n\t\t\t\t}\n\t\t\t}\n\t\tcase commandLights := <-InStateMChans.commandLightsChan:\n\t\t\tfor i := 0; i < N_FLOORS; i++ {\n\t\t\t\tfmt.Println(\"commandLights \")\n\t\t\t\tdriver.Elev_set_button_lamp(i, driver.COMMAND, commandLights[i])\n\t\t\t\tInStateMChans.buttonUpdatedChan <- Order{i, driver.COMMAND, commandLights[i]}\n\t\t\t}\n\t\t}\n\t}\n}", "title": "" }, { "docid": "8a5704ca246a7392c56fdf231bc2244e", "score": "0.44391233", "text": "func AlleRezepte(w http.ResponseWriter, r *http.Request) {\n\tmodel.LengthRezepte()\n\tdaten := model.GetAlleRezepte()\n\ttempl, err := template.ParseFiles(\"static/template/alleRezepte.tmpl\",\n\t\t\"static/template/headAdmin.tmpl\", \"static/template/headerAdmin.tmpl\",\n\t\t\"static/template/alleRezepteKachel.tmpl\")\n\tif err != nil {\n\t\tw.Header().Set(\"Location\", \"/alleRezepte\")\n\t\tt, err := template.New(\"todos\").Parse(\"Es ist ein Fehler beim anzeigen der Seite aufgetretten.\")\n\t\tif err != nil {\n\t\t\tpanic(err)\n\t\t}\n\t\terr = t.Execute(w, \"todos\")\n\t\tif err != nil {\n\t\t\tpanic(err)\n\t\t}\n\t\treturn\n\t}\n\tvar t1 = template.Must(templ, err)\n\tt1.ExecuteTemplate(w, \"alleRezepte\", daten)\n\n}", "title": "" }, { "docid": "e921ed30e4ef3cb4cd5aa03b228c0467", "score": "0.44317353", "text": "func (vm VoteManager) updateLinoStakeStat(ctx sdk.Context, linoStake linotypes.Coin, isAdd bool) sdk.Error {\n\tpastDay := vm.gm.GetPastDay(ctx, ctx.BlockHeader().Time.Unix())\n\tlinoStakeStat, err := vm.storage.GetLinoStakeStat(ctx, pastDay)\n\tif err != nil {\n\t\treturn err\n\t}\n\tif isAdd {\n\t\tlinoStakeStat.TotalLinoStake = linoStakeStat.TotalLinoStake.Plus(linoStake)\n\t\tlinoStakeStat.UnclaimedLinoStake = linoStakeStat.UnclaimedLinoStake.Plus(linoStake)\n\t} else {\n\t\tlinoStakeStat.TotalLinoStake = linoStakeStat.TotalLinoStake.Minus(linoStake)\n\t\tlinoStakeStat.UnclaimedLinoStake = linoStakeStat.UnclaimedLinoStake.Minus(linoStake)\n\t}\n\tvm.storage.SetLinoStakeStat(ctx, pastDay, linoStakeStat)\n\treturn nil\n}", "title": "" }, { "docid": "2955cf8147dfd6df01a6f0cc2e152700", "score": "0.44129267", "text": "func (t *Tile) Update() error { return nil }", "title": "" }, { "docid": "174109c12b7fb3ed136c0e44c1bbdeae", "score": "0.44094986", "text": "func update () {}", "title": "" }, { "docid": "1e70f52ba4668fa6f48d6c17359f6d58", "score": "0.43872488", "text": "func (server *Server) UpdateEntidade(w http.ResponseWriter, r *http.Request) {\n\n\t//\tAutorizacao de Modulo\n\terr := config.AuthMod(w, r, 12003)\n\tif err != nil {\n\t\tresponses.ERROR(w, http.StatusUnauthorized, fmt.Errorf(\"[FATAL] Unauthorized\"))\n\t\treturn\n\t}\n\n\t//\tVars retorna as variaveis de rota\n\tvars := mux.Vars(r)\n\n\t//\tcnpj armazena a chave primaria da tabela entidade\n\tcnpj := vars[\"cnpj\"]\n\n\tbody, err := ioutil.ReadAll(r.Body)\n\tif err != nil {\n\t\tresponses.ERROR(w, http.StatusUnprocessableEntity, fmt.Errorf(\"[FATAL] it couldn't read the 'body', %v\\n\", err))\n\t\treturn\n\t}\n\n\t//\tExtrai o cod_usuario do body\n\ttokenID, err := auth.ExtractTokenID(r)\n\tif err != nil {\n\t\tresponses.ERROR(w, http.StatusUnauthorized, errors.New(\"Unauthorized\"))\n\t\treturn\n\t}\n\n\tentidade := models.Entidade{}\n\tlogEntidade := models.Log{}\n\n\terr = json.Unmarshal(body, &entidade)\n\tif err != nil {\n\t\tresponses.ERROR(w, http.StatusUnprocessableEntity, fmt.Errorf(\"[FATAL] ERROR: 422, %v\\n\", err))\n\t\treturn\n\t}\n\n\terr = validation.Validator.Struct(entidade)\n\tif err != nil {\n\t\tlog.Printf(\"[WARN] invalid information, because, %v\\n\", fmt.Errorf(\"[FATAL] validation error!, %v\\n\", err))\n\t\tw.WriteHeader(http.StatusPreconditionFailed)\n\t\treturn\n\t}\n\n\t//\tParametros de entrada(nome_server, chave_primaria, nome_tabela, operacao, id_usuario)\n\terr = logEntidade.LogEntidade(server.DB, cnpj, \"entidade\", \"u\", tokenID)\n\tif err != nil {\n\t\tformattedError := config.FormatError(err.Error())\n\t\tresponses.ERROR(w, http.StatusInternalServerError, fmt.Errorf(\"[FATAL] it couldn't save log in database, %v\\n\", formattedError))\n\t\treturn\n\t}\n\n\t//\tupdateEntidade recebe a nova entidade, a que foi alterada\n\tupdateEntidade, err := entidade.UpdateEntidade(server.DB, cnpj)\n\tif err != nil {\n\t\tformattedError := config.FormatError(err.Error())\n\t\tresponses.ERROR(w, http.StatusInternalServerError, fmt.Errorf(\"[FATAL] it couldn't update in database , %v\\n\", formattedError))\n\t\treturn\n\t}\n\n\t//\tRetorna o Status 200 e o JSON da struct alterada\n\tresponses.JSON(w, http.StatusOK, updateEntidade)\n}", "title": "" }, { "docid": "45cb466221b3a357a49e594798ff8718", "score": "0.43776676", "text": "func (g *Gossiper) UpdateFromRollout(cluster clusters.Cluster) {\n\tlog.Lvl2(\"Update information form a new cluster :O \")\n\n\tg.Cluster = &cluster\n\tclusters.InitCounter(g.Cluster)\n\tg.Cluster.HeartBeats = make(map[string]bool)\n\n\tg.slice_results = make([][]string, 0)\n\tg.acks_cases = make(map[string][]string)\n\tg.correct_results_rcv = make(map[string][]string)\n\tg.reset_requests = make(map[string][]string)\n\tg.members_ready_resend_requests = make(map[string][]string)\n\tg.pending_nodes_requests = make([]string, 0)\n\tg.pending_messages_requests = make([]RequestMessage, 0)\n\tg.displayed_requests = make([]string, 0)\n}", "title": "" }, { "docid": "500401ba1558b1a87986ac9c9ca8f6d3", "score": "0.43510485", "text": "func (karteikasten KarteikastenData) ZufallsKarte() (ret int64) {\n\tvar f string\n\tr := rand.Intn(14)\n\tif r == 0 {\n\t\tf = \"4\"\n\t} else if r == 1 || r == 2 {\n\t\tf = \"3\"\n\t} else if r == 3 || r == 4 || r == 5 {\n\t\tf = \"2\"\n\t} else if r == 6 || r == 7 || r == 8 || r == 9 {\n\t\tf = \"1\"\n\t} else if r == 10 || r == 11 || r == 12 || r == 13 || r == 14 {\n\t\tf = \"0\"\n\t}\n\tfmt.Println(f)\n\tvar len = len(karteikasten.Karteikarten)\n\n\tvar kartenNr = make([]string, len)\n\tvar i = 0\n\n\tfor j := 0; j < len; j++ {\n\t\tif karteikasten.Karteikarten[j].Fach == f {\n\t\t\tkartenNr[i] = karteikasten.Karteikarten[j].KartenNr\n\t\t\ti++\n\t\t}\n\t}\n\n\tfmt.Println(kartenNr)\n\tfmt.Println(i)\n\n\tvar index int\n\tif i > 1 {\n\t\ti--\n\t\tindex = rand.Intn(i)\n\t} else if i == 1 {\n\t\tindex = 0\n\t} else {\n\t\tvar tmp = (len - 1)\n\t\tindex = rand.Intn(tmp)\n\t}\n\n\tfmt.Println(index)\n\n\tret, _ = strconv.ParseInt(kartenNr[index], 0, 0)\n\tret--\n\treturn ret\n}", "title": "" }, { "docid": "34f7d7d20cc643185f2356f19487df9e", "score": "0.4348075", "text": "func updater() {\n\tupdateCurrentWorlds()\n\tupdateAllUsers() // has to run here to set delayBetweenFullUpdates\n\tqueueUserChannel := setDelay()\n\tfor {\n\t\t// reset timer until next wvw reset update\n\t\tworldsChannel := resetWorldUpdateTimer()\n\t\tselect {\n\t\tcase <-worldsChannel:\n\t\t\tupdateCurrentWorlds()\n\t\t\tqueueUserChannel = setDelay()\n\t\t\tupdateAllUsers()\n\t\tcase <-queueUserChannel:\n\t\t\tqueueUserChannel = setDelay()\n\t\t\tupdateAllUsers()\n\t\t}\n\t}\n}", "title": "" }, { "docid": "c638b3598326b658795617a234eddc89", "score": "0.43397093", "text": "func EditUpPOST(w http.ResponseWriter, r *http.Request) {\n var err error\n var edit model.Editor\n\tsess := model.Instance(r)\n\tif validate, missingField := view.Validate(r, []string{\"name\"}); !validate {\n\t\tsess.AddFlash(view.Flash{\"Falta Campo: \" + missingField, view.FlashError})\n\t\tsess.Save(r, w)\n\t\tEditUpGET(w, r)\n\t\treturn\n\t}\n\tedit.Name = r.FormValue(\"name\")\n var params httprouter.Params\n\tparams = context.Get(r, \"params\").(httprouter.Params)\n\tedit.Id, _ = atoi32(params.ByName(\"id\"))\n SPag := params.ByName(\"pagi\")\n err = edit.Update()\n if err == nil{\n sess.AddFlash(view.Flash{\"Lenguaje actualizado exitosamente para: \" +edit.Name, view.FlashSuccess})\n } else {\n\t\tlog.Println(err)\n\t\tsess.AddFlash(view.Flash{\"Un error ocurrio actualizando.\", view.FlashError})\n\t}\n\tsess.Save(r, w)\n path := fmt.Sprintf(\"/editor/list/%s\", SPag)\n\thttp.Redirect(w, r, path, http.StatusFound)\n//\tEditUpGET(w, r)\n }", "title": "" }, { "docid": "0951f36d245f40d412eeb6ce355f993f", "score": "0.43246916", "text": "func (a *API) UpdateENIs(enis map[string]ENIMap) {\n\ta.mutex.Lock()\n\ta.enis = map[string]ENIMap{}\n\tfor instanceID, m := range enis {\n\t\ta.enis[instanceID] = ENIMap{}\n\t\tfor eniID, eni := range m {\n\t\t\ta.enis[instanceID][eniID] = eni.DeepCopy()\n\t\t}\n\t}\n\ta.mutex.Unlock()\n}", "title": "" }, { "docid": "1cc2558a89c06c49e5d9db4fcbed4c3b", "score": "0.43238795", "text": "func (server *Server) UpdatePrevisaoEmpenho(w http.ResponseWriter, r *http.Request) {\n\n\t//\tAutorizacao de Modulo\n\tif err := config.AuthMod(w, r, 18003); err != nil {\n\t\tresponses.ERROR(w, http.StatusUnauthorized, fmt.Errorf(\"[FATAL] Unauthorized\"))\n\t\treturn\n\t}\n\n\t//\tVars retorna as variaveis de rota\n\tvars := mux.Vars(r)\n\n\t//\tcodPrevisaoEmpenho armazena a chave primaria da tabela previsao empenho\n\tcodPrevisaoEmpenho, err := strconv.ParseUint(vars[\"cod_previsao_empenho\"], 10, 64)\n\tif err != nil {\n\t\tresponses.ERROR(w, http.StatusBadRequest, fmt.Errorf(\"[FATAL] It couldn't parse the variable, %v\\n\", err))\n\t\treturn\n\t}\n\n\tbody, err := ioutil.ReadAll(r.Body)\n\tif err != nil {\n\t\tresponses.ERROR(w, http.StatusUnprocessableEntity, fmt.Errorf(\"[FATAL] it couldn't read the 'body', %v\\n\", err))\n\t\treturn\n\t}\n\n\t//\tExtrai o cod_usuario do body\n\ttokenID, err := auth.ExtractTokenID(r)\n\tif err != nil {\n\t\tresponses.ERROR(w, http.StatusUnauthorized, errors.New(\"Unauthorized\"))\n\t\treturn\n\t}\n\n\tprevisaoEmpenho := models.PrevisaoEmpenho{}\n\tlogPrevisaoEmpenho := models.Log{}\n\n\tif err = json.Unmarshal(body, &previsaoEmpenho); err != nil {\n\t\tresponses.ERROR(w, http.StatusUnprocessableEntity, fmt.Errorf(\"[FATAL] ERROR: 422, %v\\n\", err))\n\t\treturn\n\t}\n\n\tif err = validation.Validator.Struct(previsaoEmpenho); err != nil {\n\t\tlog.Printf(\"[WARN] invalid information, because, %v\\n\", fmt.Errorf(\"[FATAL] validation error!, %v\\n\", err))\n\t\tw.WriteHeader(http.StatusPreconditionFailed)\n\t\treturn\n\t}\n\n\t//\tParametros de entrada(nome_server, chave_primaria, nome_tabela, operacao, id_usuario)\n\terr = logPrevisaoEmpenho.LogPrevisaoEmpenho(server.DB, uint32(codPrevisaoEmpenho), \"previsao_empenho\", \"u\", tokenID)\n\tif err != nil {\n\t\tformattedError := config.FormatError(err.Error())\n\t\tresponses.ERROR(w, http.StatusInternalServerError, fmt.Errorf(\"[FATAL] it couldn't save log in database, %v\", formattedError))\n\t\treturn\n\t}\n\n\t// updatePrevisaEmpenho recebe a nova previsao_empenho, a que foi alterada\n\tupdatePrevisaoEmpenho, err := previsaoEmpenho.UpdatePrevisaoEmpenho(server.DB, uint32(codPrevisaoEmpenho))\n\tif err != nil {\n\t\tformattedError := config.FormatError(err.Error())\n\t\tresponses.ERROR(w, http.StatusInternalServerError, fmt.Errorf(\"[FATAL] it couldn't update in database , %v\\n\", formattedError))\n\t\treturn\n\t}\n\n\t//\tRetorna o Status 200 e o JSON da struct alterada\n\tresponses.JSON(w, http.StatusOK, updatePrevisaoEmpenho)\n}", "title": "" }, { "docid": "2ab76f416df18b95f8e8a5d167844da6", "score": "0.4317888", "text": "func UpdateDataSiswaById(id string, judul string, isi string) {\n\tdb := Conn()\n\tdefer db.Close()\n\tstmt, _ := db.Prepare(\"UPDATE karya SET judul=?, isi=? WHERE id=?\")\n\tstmt.Exec(judul, isi, id)\n\tdefer stmt.Close()\n}", "title": "" }, { "docid": "d212a8a3a354ea834bb8e02f0807a0ae", "score": "0.43129492", "text": "func (c *Challenge) Update() (int, error) {\n\tsets := []string{}\n\tvalues := make(map[int]interface{})\n\tindex := 0\n\n\tif c.Description != nil {\n\t\tvalues[index] = *c.Description\n\t\tindex = index + 1\n\t\tsets = append(sets, \"description=$\"+strconv.Itoa(index))\n\t}\n\n\tif c.Status != \"\" {\n\t\tvalues[index] = c.Status\n\t\tindex = index + 1\n\t\tsets = append(sets, \"status=$\"+strconv.Itoa(index))\n\t}\n\n\tif c.UpdatedAt != nil {\n\t\tvalues[index] = c.UpdatedAt\n\t\tindex = index + 1\n\t\tsets = append(sets, \"updated_at=$\"+strconv.Itoa(index))\n\t}\n\n\tif c.Location != nil {\n\t\tgeomStr, err := json.Marshal(c.Location)\n\t\tif err != nil {\n\t\t\tlog.Printf(\"Bad location value err: %v\\n\", err)\n\t\t\treturn 0, err\n\t\t}\n\n\t\tgeometryValue := \"ST_GeomFromGeoJSON('\" + string(geomStr) + \"')\"\n\t\tsets = append(sets, \"updated_at=\"+geometryValue)\n\t}\n\n\tstmt, err := db.Prepare(\"UPDATE challenges SET \" + strings.Join(sets, \", \") + \" WHERE deleted_at IS NULL AND id=\" + fmt.Sprintf(\"%v\", c.ID) + \" AND user_id=\" + fmt.Sprintf(\"%v\", c.UserID) + \";\")\n\tif err != nil {\n\t\tlog.Printf(\"UPDATE challegne prepare statement error: %v\", err)\n\t\treturn 500, errors.New(\"Server error\")\n\t}\n\n\targsValues := make([]interface{}, len(values))\n\tfor k, v := range values {\n\t\targsValues[k] = v\n\t}\n\n\tres, err := stmt.Exec(argsValues...)\n\tif err != nil {\n\t\tlog.Printf(\"exec statement error: %v\", err)\n\t\treturn 500, errors.New(\"Server error\")\n\t}\n\n\taffected, err := res.RowsAffected()\n\tif err != nil {\n\t\tlog.Printf(\"rows effected error: %v\", err)\n\t\treturn 500, errors.New(\"Server error\")\n\t}\n\tif affected == 0 {\n\t\tlog.Printf(\"rows effected -> %v\", affected)\n\t\treturn 404, errors.New(\"Challenge not found\")\n\t}\n\n\treturn 0, nil\n}", "title": "" }, { "docid": "dcb4a8faa4aa35c60fd9f46aaab44e07", "score": "0.43115935", "text": "func (pos *ChessBoard) UpdateListsMaterial() {\n\tfor index := 0; index < BoardSquareNum; index++ {\n\t\tpiece := pos.Pieces[index]\n\t\tif piece != OffBoard && piece != Empty {\n\t\t\tcolour := PieceColour[piece]\n\n\t\t\tpos.pieceNum[piece]++ // increment piece number\n\n\t\t\tif piece == WhiteKing || piece == BlackKing {\n\t\t\t\tpos.kingSquare[colour] = index\n\t\t\t}\n\t\t}\n\t}\n}", "title": "" }, { "docid": "1bd9812e132da915e06d75f8a80c1a51", "score": "0.43046325", "text": "func (n *wrsNode) setWeiUnitght(idx int, WeiUnitght int64) int64 {\n\tif n.level == 0 {\n\t\toldWeiUnitght := n.WeiUnitghts[idx]\n\t\tn.WeiUnitghts[idx] = WeiUnitght\n\t\tdiff := WeiUnitght - oldWeiUnitght\n\t\tn.sumWeiUnitght += diff\n\t\tif WeiUnitght == 0 {\n\t\t\tn.items[idx] = nil\n\t\t\tn.itemCnt--\n\t\t}\n\t\treturn diff\n\t}\n\tbranchItems := n.maxItems / wrsBranches\n\tbranch := idx / branchItems\n\tdiff := n.items[branch].(*wrsNode).setWeiUnitght(idx-branch*branchItems, WeiUnitght)\n\tn.WeiUnitghts[branch] += diff\n\tn.sumWeiUnitght += diff\n\tif WeiUnitght == 0 {\n\t\tn.itemCnt--\n\t}\n\treturn diff\n}", "title": "" }, { "docid": "92cb6f07279c650fb32b9fd1c294df85", "score": "0.42980915", "text": "func (kademlia *Kademlia) Refresh() {\n\ttempArr := [IDLength]string{}\n\tfor i := 0; i <= IDLength-1; i++ {\n\t\tbitstring := strconv.FormatInt(int64(kademlia.id[i]), 2)\n\t\tfor j := len(bitstring); j < 8; j++ {\n\t\t\tbitstring = \"0\" + bitstring\n\n\t\t}\n\t\ttempArr[i] = bitstring\n\t}\n\t//Here temp array is the binary list of the KademliaID\n\temptyBucketFlag := true\n\tfor i := IDLength - 1; i >= 0; i-- {\n\t\tfor j := 7; j >= 0; j-- {\n\t\t\ttemp := tempArr\n\t\t\t//This if statement simply flips the [i][j] bit\n\t\t\tif string(temp[i][j]) == \"1\" {\n\t\t\t\ttemp[i] = temp[i][:j] + string(\"0\") + temp[i][j+1:]\n\t\t\t} else {\n\t\t\t\ttemp[i] = temp[i][:j] + string(\"1\") + temp[i][j+1:]\n\t\t\t}\n\t\t\thexArr := [IDLength]byte{}\n\t\t\t//This for-loop makes the binary array into the same format as the KademliaID\n\t\t\tfor y := 0; y < IDLength; y++ {\n\t\t\t\tt, _ := strconv.ParseUint(temp[y], 2, 64)\n\t\t\t\tb := byte(t)\n\t\t\t\thexArr[y] = b\n\n\t\t\t}\n\n\t\t\tbucketKademliaID := hex.EncodeToString(hexArr[0:IDLength])\n\t\t\t//This is to get the bucketindex for the new kademliaID:\n\t\t\tbucketIndex := kademlia.routingTable.getBucketIndex(NewKademliaID(bucketKademliaID))\n\t\t\tif kademlia.routingTable.buckets[bucketIndex].Len() != 0 || !emptyBucketFlag == true {\n\t\t\t\temptyBucketFlag = false\n\t\t\t\tLog(\"Refresh: Now sending a PING to a KademliaID belonging to bucket \" + strconv.Itoa(bucketIndex))\n\t\t\t\tgo kademlia.LookupContact(NewKademliaID(bucketKademliaID))\n\t\t\t}\n\t\t}\n\t}\n}", "title": "" }, { "docid": "fd8ec7c6bafd5d969a51b9688e409c9f", "score": "0.42976627", "text": "func (o *RecipeBatchLipid) Update(ctx context.Context, exec boil.ContextExecutor, columns boil.Columns) (int64, error) {\n\tif !boil.TimestampsAreSkipped(ctx) {\n\t\tcurrTime := time.Now().In(boil.GetLocation())\n\n\t\to.UpdatedAt = currTime\n\t}\n\n\tvar err error\n\tif err = o.doBeforeUpdateHooks(ctx, exec); err != nil {\n\t\treturn 0, err\n\t}\n\tkey := makeCacheKey(columns, nil)\n\trecipeBatchLipidUpdateCacheMut.RLock()\n\tcache, cached := recipeBatchLipidUpdateCache[key]\n\trecipeBatchLipidUpdateCacheMut.RUnlock()\n\n\tif !cached {\n\t\twl := columns.UpdateColumnSet(\n\t\t\trecipeBatchLipidAllColumns,\n\t\t\trecipeBatchLipidPrimaryKeyColumns,\n\t\t)\n\n\t\tif !columns.IsWhitelist() {\n\t\t\twl = strmangle.SetComplement(wl, []string{\"created_at\"})\n\t\t}\n\t\tif len(wl) == 0 {\n\t\t\treturn 0, errors.New(\"models: unable to update recipe_batch_lipid, could not build whitelist\")\n\t\t}\n\n\t\tcache.query = fmt.Sprintf(\"UPDATE \\\"recipe_batch_lipid\\\" SET %s WHERE %s\",\n\t\t\tstrmangle.SetParamNames(\"\\\"\", \"\\\"\", 1, wl),\n\t\t\tstrmangle.WhereClause(\"\\\"\", \"\\\"\", len(wl)+1, recipeBatchLipidPrimaryKeyColumns),\n\t\t)\n\t\tcache.valueMapping, err = queries.BindMapping(recipeBatchLipidType, recipeBatchLipidMapping, append(wl, recipeBatchLipidPrimaryKeyColumns...))\n\t\tif err != nil {\n\t\t\treturn 0, err\n\t\t}\n\t}\n\n\tvalues := queries.ValuesFromMapping(reflect.Indirect(reflect.ValueOf(o)), cache.valueMapping)\n\n\tif boil.IsDebug(ctx) {\n\t\twriter := boil.DebugWriterFrom(ctx)\n\t\tfmt.Fprintln(writer, cache.query)\n\t\tfmt.Fprintln(writer, values)\n\t}\n\tvar result sql.Result\n\tresult, err = exec.ExecContext(ctx, cache.query, values...)\n\tif err != nil {\n\t\treturn 0, errors.Wrap(err, \"models: unable to update recipe_batch_lipid row\")\n\t}\n\n\trowsAff, err := result.RowsAffected()\n\tif err != nil {\n\t\treturn 0, errors.Wrap(err, \"models: failed to get rows affected by update for recipe_batch_lipid\")\n\t}\n\n\tif !cached {\n\t\trecipeBatchLipidUpdateCacheMut.Lock()\n\t\trecipeBatchLipidUpdateCache[key] = cache\n\t\trecipeBatchLipidUpdateCacheMut.Unlock()\n\t}\n\n\treturn rowsAff, o.doAfterUpdateHooks(ctx, exec)\n}", "title": "" }, { "docid": "478baf0e3d619d9311e4754eb63d2e38", "score": "0.42667314", "text": "func (te *pkTableEditor) UpdateRow(ctx context.Context, dOldRow row.Row, dNewRow row.Row, errFunc PKDuplicateErrFunc) (retErr error) {\n\tte.writeMutex.Lock()\n\tdefer te.writeMutex.Unlock()\n\n\tdOldKeyVal, err := dOldRow.NomsMapKeyTuple(te.tSch, te.tf)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tdNewKeyVal, err := dNewRow.NomsMapKeyTuple(te.tSch, te.tf)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tdNewRowVal, err := dNewRow.NomsMapValueTuple(te.tSch, te.tf)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tnewHash, err := dNewKeyVal.Hash(dNewRow.Format())\n\tif err != nil {\n\t\treturn err\n\t}\n\n\toldHash, err := dOldKeyVal.Hash(dOldRow.Format())\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// Index operations should come before all table operations. For the reasoning, refer to the comment in InsertKeyVal\n\tindexOpsToUndo := make([]int, len(te.indexEds))\n\tdefer func() {\n\t\tif retErr != nil {\n\t\t\tfor i, opsToUndo := range indexOpsToUndo {\n\t\t\t\tfor undone := 0; undone < opsToUndo; undone++ {\n\t\t\t\t\tte.indexEds[i].Undo(ctx)\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}()\n\n\tfor i, indexEd := range te.indexEds {\n\t\toldFullKey, oldPartialKey, oldVal, err := dOldRow.ReduceToIndexKeys(indexEd.Index(), te.tf)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\terr = indexEd.DeleteRow(ctx, oldFullKey, oldPartialKey, oldVal)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tindexOpsToUndo[i]++\n\t\tnewFullKey, newPartialKey, newVal, err := dNewRow.ReduceToIndexKeys(indexEd.Index(), te.tf)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\terr = indexEd.InsertRow(ctx, newFullKey, newPartialKey, newVal)\n\t\tif uke, ok := err.(*uniqueKeyErr); ok {\n\t\t\ttableTupleHash, err := uke.TableTuple.Hash(uke.TableTuple.Format())\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t\tkvp, pkExists, err := te.tea.Get(ctx, tableTupleHash, uke.TableTuple)\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t\tif !pkExists {\n\t\t\t\tkeyStr, _ := formatKey(ctx, uke.TableTuple)\n\t\t\t\treturn fmt.Errorf(\"UNIQUE constraint violation on index '%s', but could not find row with primary key: %s\",\n\t\t\t\t\tindexEd.Index().Name(), keyStr)\n\t\t\t}\n\t\t\treturn te.keyErrForKVP(ctx, indexEd.Index().Name(), kvp, false, errFunc)\n\t\t} else if err != nil {\n\t\t\treturn err\n\t\t}\n\t\tindexOpsToUndo[i]++\n\t}\n\n\terr = te.tea.Delete(oldHash, dOldKeyVal)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tte.setDirty(true)\n\n\tif kvp, pkExists, err := te.tea.Get(ctx, newHash, dNewKeyVal); err != nil {\n\t\treturn err\n\t} else if pkExists {\n\t\treturn te.keyErrForKVP(ctx, \"PRIMARY KEY\", kvp, true, errFunc)\n\t}\n\n\treturn te.tea.Insert(newHash, dNewKeyVal, dNewRowVal)\n}", "title": "" }, { "docid": "3391d509bd14b255e9da605ae39c8e1e", "score": "0.42658824", "text": "func (sync *synchronizer) updateBlokchain() {\n\t// TODO: write test for me\n\tif sync.peerSet.HasAnyOpenSession() {\n\t\tsync.logger.Debug(\"We have open seasson\")\n\t\treturn\n\t}\n\n\tourHeight := sync.state.LastBlockHeight()\n\tclaimedHeight := sync.peerSet.MaxClaimedHeight()\n\tif claimedHeight > ourHeight {\n\t\tif claimedHeight > ourHeight+LatestBlockInterval {\n\t\t\tsync.logger.Info(\"Need more blocks. Joining download topic\")\n\t\t\t// TODO:\n\t\t\t// If peer doesn't respond, we should leave the topic\n\t\t\t// A byzantine peer can send an invalid height, then all the nodes will join download topic.\n\t\t\t// We should find a way to avoid it.\n\t\t\tif err := sync.network.JoinDownloadTopic(); err != nil {\n\t\t\t\tsync.logger.Info(\"We can't join download topic\", \"err\", err)\n\t\t\t} else {\n\t\t\t\tsync.downloadBlocks()\n\t\t\t}\n\t\t} else {\n\t\t\tsync.logger.Info(\"Need more blocks. Ask for the latest blocks\")\n\t\t\tsync.queryLatestBlocks()\n\t\t}\n\t}\n}", "title": "" }, { "docid": "22a51be32cf9190209d4175a63ae5538", "score": "0.42560658", "text": "func UpdateAll30Min() {\n\tSetNodesBrands(models.TopNodes())\n\tSetBrandsNodes()\n}", "title": "" }, { "docid": "64265ec7d5b103bc70f1905156727098", "score": "0.4255432", "text": "func (t *Table) Update() {\n\tfor i, check := range t.Checks {\n\n\t\tgo func(i int, check *site.Site) {\n\t\t\tres := check.Check()\n\t\t\tt.View.Rows[i+1] = res.String()\n\t\t\tt.Render()\n\t\t}(i, check)\n\n\t}\n}", "title": "" }, { "docid": "caae29b83cea87b13e47dde310ac5588", "score": "0.42456266", "text": "func (a *WordsApiService) UpdateListLevel(ctx context.Context, data *models.UpdateListLevelRequest) (models.ListResponse, *http.Response, error) {\n var (\n successPayload models.ListResponse\n )\n\n requestData, err := data.CreateRequestData();\n if err != nil {\n return successPayload, nil, err\n }\n\n requestData.Path = a.client.cfg.BaseUrl + requestData.Path;\n\n r, err := a.client.prepareRequest(ctx, requestData)\n if err != nil {\n return successPayload, nil, err\n }\n\n response, err := a.client.callAPI(r)\n defer response.Body.Close()\n\n if err != nil || response == nil {\n return successPayload, response, err\n }\n if response.StatusCode == 401 {\n return successPayload, nil, errors.New(\"Access is denied\")\n }\n if response.StatusCode >= 300 {\n var apiError models.WordsApiErrorResponse;\n\n if err = json.NewDecoder(response.Body).Decode(&apiError); err != nil {\n return successPayload, response, err\n }\n\n return successPayload, response, &apiError\n }\n if err = json.NewDecoder(response.Body).Decode(&successPayload); err != nil {\n return successPayload, response, err\n }\n\n return successPayload, response, err\n}", "title": "" }, { "docid": "7e255d4cbde9f1dfc62165aa1d969f16", "score": "0.42439485", "text": "func UpdateAll10Min() {\n\tSetHomeNodes()\n\tSetHomeTopProducts()\n}", "title": "" }, { "docid": "97fd6502277ad591490a9d89142469ff", "score": "0.42434043", "text": "func (wlts Wallets) Update(wltID string, updateFunc func(Wallet) Wallet) error {\n\tw, ok := wlts[wltID]\n\tif !ok {\n\t\treturn ErrWalletNotExist\n\t}\n\n\tnewWlt := updateFunc(*w)\n\twlts[wltID] = &newWlt\n\treturn nil\n}", "title": "" }, { "docid": "a8c9e57596f4b4649b20ca5389000176", "score": "0.42343044", "text": "func updateTellerNextQueue(w http.ResponseWriter, r *http.Request) {\n\tdriver, err := db.New(\"db\")\n\t//GET THE CHAIR'S DATA\n\terr = driver.Open(Chair{}).Where(\"Teller_ID\", \"=\", \"1\").First().AsEntity(&AllChair)\n\terr = driver.Open(Teller{}).Where(\"Teller_ID\", \"=\", \"1\").First().AsEntity(&AllTeller)\n\tif AllChair.Occupied == 0 {\n\t\tAllTeller.Status = false\n\t\tw.Write([]byte(\"NO MORE CUSTOMER, TELLER IS PUT TO SLEEP\"))\n\t} else {\n\t\tAllChair.Occupied = AllChair.Occupied - 1\n\t\tAllChair.Available = AllChair.Available + 1\n\t\tAllTeller.Queue = AllTeller.Queue + 1\n\t\tw.Write([]byte(\"NEXT CUSTOMER PLEASE COME TO THE DESIGNATED COUNTER\"))\n\t}\n\terr = driver.Update(AllTeller)\n\tif err != nil {\n\t\thttp.Error(w, err.Error(), http.StatusInternalServerError)\n\t\treturn\n\t}\n\terr = driver.Update(AllChair)\n\tif err != nil {\n\t\thttp.Error(w, err.Error(), http.StatusInternalServerError)\n\t\treturn\n\t}\n\n}", "title": "" }, { "docid": "8d9c3f7dbfebcd833303db64b08f4202", "score": "0.42123094", "text": "func (g *Gossiper) KeyRollout(leader string) {\n\t//Send a new key pair to the \"leader\"\n\n\tvar err error\n\tg.Keypair, err = ies.GenerateKeyPair()\n\tg.Cluster.PublicKeys = make(map[string]ies.PublicKey)\n\n\tif err != nil {\n\t\tlog.Error(\"Could not generate new keypair : \", err)\n\t}\n\n\t//go func() {\n\tlog.Lvl2(g.Name, \"sending a rollout update to \", leader)\n\tg.Cluster.PublicKeys[g.Name] = g.Keypair.PublicKey\n\n\tif leader != g.Name {\n\t\t//Request to join\n\t\tdone := false\n\t\tfor !done {\n\t\t\tselect {\n\t\t\tcase <-time.After(time.Second * 5):\n\t\t\t\tgo g.RequestJoining(leader)\n\n\t\t\t\tbreak\n\t\t\tcase <-ClusterUpdated:\n\t\t\t\tdone = true\n\t\t\t\tbreak\n\t\t\t}\n\t\t}\n\n\t}\n\n\t//}()\n\n\t//leader does the rest.\n\tif leader == g.Name {\n\t\tg.Cluster.HeartBeats[g.Name] = true\n\t\t//Check who is still in the cluster.\n\t\tvar nextMembers []string\n\t\tfor _, m := range g.Cluster.Members {\n\t\t\tflag, ok := g.Cluster.HeartBeats[m]\n\t\t\tif !ok || !flag {\n\t\t\t\t//he wants to be removed\n\t\t\t\tlog.Lvl1(\"Removing : \", m, \" from cluster\")\n\t\t\t\tdelete(g.Cluster.PublicKeys, m)\n\t\t\t} else {\n\t\t\t\tlog.Lvl1(\"Staying in cluster \", m)\n\t\t\t\tnextMembers = append(nextMembers, m)\n\t\t\t}\n\n\t\t}\n\t\tg.Cluster.Members = nextMembers\n\n\t\tlog.Lvl1(\"New members for this key rollout : \", nextMembers)\n\n\t\t//Check if received all the keys from them\n\t\tfor {\n\t\t\t<-time.After(5 * time.Second)\n\t\t\tif len(g.Cluster.PublicKeys) == len(nextMembers) {\n\t\t\t\t//we got all the maps we can generate the master key and return\n\t\t\t\tlog.Lvl2(\"Got all the members needed\")\n\t\t\t\terr := g.AnnounceNewMasterKey()\n\t\t\t\tif err != nil {\n\t\t\t\t\tlog.Error(\"Could not announce master key : \", err)\n\t\t\t\t}\n\t\t\t\treturn\n\t\t\t}\n\t\t\tlog.Lvl3(\"Missing some members ( have \", len(g.Cluster.PublicKeys), \"need \", len(nextMembers), \")\")\n\t\t\tlog.Lvl2(g.Cluster.PublicKeys)\n\t\t}\n\n\t}\n\n}", "title": "" }, { "docid": "84f8b954e44ec1e3ecf2ad3eccf301ef", "score": "0.42094365", "text": "func (c *cartridge) Update() {\n\tc.rot -= 4\n}", "title": "" }, { "docid": "d9b4f1e496f422dd37c60beef0cd7257", "score": "0.42038417", "text": "func Update() {\n\tfor _, view := range Views.lookup {\n\t\tview.Update()\n\t}\n}", "title": "" }, { "docid": "6224be936159224ee3cc34d3683bf388", "score": "0.42010608", "text": "func changeLinodeSettings(client *linodego.Client, linode linodego.Linode, d *schema.ResourceData) error {\n\tupdates := make(map[string]interface{})\n\tif d.Get(\"group\").(string) != linode.LpmDisplayGroup {\n\t\tupdates[\"lpm_displayGroup\"] = d.Get(\"group\")\n\t}\n\n\tif d.Get(\"name\").(string) != linode.Label.String() {\n\t\tupdates[\"Label\"] = d.Get(\"name\")\n\t}\n\n\tif len(updates) > 0 {\n\t\t_, err := client.Linode.Update(linode.LinodeId, updates)\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"Failed to update the linode's group because %s\", err)\n\t\t}\n\t}\n\td.SetPartial(\"group\")\n\td.SetPartial(\"name\")\n\treturn nil\n}", "title": "" }, { "docid": "19c77bfaa3d928160bbad17c4de892bc", "score": "0.41896033", "text": "func UpdateBarang(rw http.ResponseWriter, rq *http.Request, Kode_Barang string) {\n\tvar brg barang\n\tkb := Kode_Barang\n\tbrgDecoder := json.NewDecoder(rq.Body)\n\terr := brgDecoder.Decode(&brg)\n\n\tif err != nil{\n\t\tlog.Fatal(err)\n\t}\n\tdefer rq.Body.Close()\n\n\tdb , err := sql.Open(\"mysql\",\n\t\t\"root:14july98@tcp(127.0.0.1:3306)/inventaris\")\n\tif err != nil{\n\t\tlog.Fatal(err)\n\t}\n\n\tst, err := db.Prepare(\"UPDATE barang SET Kondisi = ? where Kode_Barang like ?\")\n\tif err != nil{\n\t\tlog.Fatal(err)\n\t}\n\n\t_, err = st.Exec(brg.Kondisi, kb)\n}", "title": "" }, { "docid": "b67f45b544544461bc472015536f42f7", "score": "0.41748354", "text": "func updateItem(w http.ResponseWriter, r *http.Request, p httprouter.Params) {\r\n\tid, _ := strconv.Atoi(p.ByName(\"id\"))\r\n\tfmt.Println(id)\r\n\r\n\tr.ParseMultipartForm(2000)\r\n\tfmt.Println(r.FormValue(\"Title\"))\r\n\tit := items[id]\r\n\tit.Lock()\r\n\tit.Title = r.FormValue(\"Title\")\r\n\tit.Description = r.FormValue(\"Description\")\r\n\r\n\tit.ShipL, _ = strconv.ParseFloat(r.FormValue(\"ShipL\"), 64)\r\n\tit.ShipW, _ = strconv.ParseFloat(r.FormValue(\"ShipW\"), 64)\r\n\tit.ShipH, _ = strconv.ParseFloat(r.FormValue(\"ShipH\"), 64)\r\n\tit.ShipWeight, _ = strconv.ParseFloat(r.FormValue(\"ShipWeight\"), 64)\r\n\tit.Price, _ = strconv.ParseFloat(r.FormValue(\"Price\"), 64)\r\n\r\n\tit.Sold, _ = strconv.ParseBool(r.FormValue(\"Sold\"))\r\n\tit.Listed, _ = strconv.ParseBool(r.FormValue(\"Listed\"))\r\n\r\n\tit.SizeDescription= r.FormValue(\"SizeDescription\")\r\n\r\n\tsaveItemsToBackup()\r\n\tit.Unlock()\r\n}", "title": "" }, { "docid": "729111048dd30648820d10e11702d936", "score": "0.4170791", "text": "func (te *pkTableEditor) UpdateRow(ctx context.Context, dOldRow row.Row, dNewRow row.Row, errFunc PKDuplicateCb) (retErr error) {\n\tte.writeMutex.Lock()\n\tdefer te.writeMutex.Unlock()\n\n\tdOldKeyVal, err := dOldRow.NomsMapKeyTuple(te.tSch, te.tf)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tdNewKeyVal, err := dNewRow.NomsMapKeyTuple(te.tSch, te.tf)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tdNewRowVal, err := dNewRow.NomsMapValueTuple(te.tSch, te.tf)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tnewHash, err := dNewKeyVal.Hash(dNewRow.Format())\n\tif err != nil {\n\t\treturn err\n\t}\n\n\toldHash, err := dOldKeyVal.Hash(dOldRow.Format())\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// Index operations should come before all table operations. For the reasoning, refer to the comment in InsertKeyVal\n\tindexOpsToUndo := make([]int, len(te.indexEds))\n\tdefer func() {\n\t\tif retErr != nil {\n\t\t\tfor i, opsToUndo := range indexOpsToUndo {\n\t\t\t\tfor undone := 0; undone < opsToUndo; undone++ {\n\t\t\t\t\tte.indexEds[i].Undo(ctx)\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}()\n\n\tfor i, indexEd := range te.indexEds {\n\t\toldFullKey, oldPartialKey, oldVal, err := dOldRow.ReduceToIndexKeys(indexEd.Index(), te.tf)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\terr = indexEd.DeleteRow(ctx, oldFullKey, oldPartialKey, oldVal)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tindexOpsToUndo[i]++\n\t\tnewFullKey, newPartialKey, newVal, err := dNewRow.ReduceToIndexKeys(indexEd.Index(), te.tf)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\terr = indexEd.InsertRowWithDupCb(ctx, newFullKey, newPartialKey, newVal, func(ctx context.Context, uke *uniqueKeyErr) error {\n\t\t\ttableTupleHash, err := uke.TableTuple.Hash(uke.TableTuple.Format())\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t\tkvp, pkExists, err := te.tea.Get(ctx, tableTupleHash, uke.TableTuple)\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t\tif !pkExists {\n\t\t\t\tkeyStr, _ := formatKey(ctx, uke.TableTuple)\n\t\t\t\treturn fmt.Errorf(\"UNIQUE constraint violation on index '%s', but could not find row with primary key: %s\",\n\t\t\t\t\tindexEd.Index().Name(), keyStr)\n\t\t\t}\n\t\t\tnewKeyString, err := formatKey(ctx, uke.IndexTuple)\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t\treturn te.maybeReturnErrForKVP(ctx, newKeyString, indexEd.Index().Name(), kvp, false, errFunc)\n\t\t})\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tindexOpsToUndo[i]++\n\t}\n\n\terr = te.tea.Delete(oldHash, dOldKeyVal)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tte.MarkDirty()\n\n\tif kvp, pkExists, err := te.tea.Get(ctx, newHash, dNewKeyVal); err != nil {\n\t\treturn err\n\t} else if pkExists {\n\t\tstr, err := formatKey(ctx, dNewKeyVal)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\treturn te.maybeReturnErrForKVP(ctx, str, \"PRIMARY KEY\", kvp, true, errFunc)\n\t}\n\n\treturn te.tea.Insert(newHash, dNewKeyVal, dNewRowVal)\n}", "title": "" }, { "docid": "5fb134d6ad9e665f321e55e8434e86a9", "score": "0.41707495", "text": "func UpdateSellerPosition(db *sqlx.DB,\n ax *sqlx.Tx,\n sellerId int,\n ticker string,\n amountTraded int,\n cashTraded int) {\n UpdatePosition(ax, sellerId, ticker, -amountTraded, -cashTraded)\n UpdateUserCash(ax, sellerId, cashTraded)\n}", "title": "" }, { "docid": "7e3ed91bfa1d9bdb9510266e19f1c5e8", "score": "0.41683373", "text": "func BeitragBearbeiten(w http.ResponseWriter, r *http.Request) {\n\tid := r.FormValue(\"id\")\n\tif id == \"\" {\n\t\thttp.Redirect(w, r, \"/alleBeitraege\", http.StatusFound)\n\t} else {\n\t\tdaten := model.GetBeitragById(id)\n\t\tif daten.BeitID == 0 {\n\t\t\thttp.Redirect(w, r, \"/alleBeitraege\", http.StatusFound)\n\t\t} else {\n\t\t\ttemp, err := template.ParseFiles(\"static/template/updateBeitrag.tmpl\",\n\t\t\t\t\"static/template/headAdmin.tmpl\", \"static/template/headerAdmin.tmpl\")\n\t\t\tif err != nil {\n\t\t\t\tw.Header().Set(\"Location\", \"/beitragBearbeiten?id=\"+id)\n\t\t\t\tt, err := template.New(\"todos\").Parse(\"Es ist ein Fehler beim anzeigen der Seite aufgetretten.\")\n\t\t\t\tif err != nil {\n\t\t\t\t\tpanic(err)\n\t\t\t\t}\n\t\t\t\terr = t.Execute(w, \"todos\")\n\t\t\t\tif err != nil {\n\t\t\t\t\tpanic(err)\n\t\t\t\t}\n\t\t\t\treturn\n\t\t\t}\n\t\t\tvar t1 = template.Must(temp, err)\n\t\t\tt1.ExecuteTemplate(w, \"updateBeitrag\", daten)\n\t\t}\n\t}\n}", "title": "" }, { "docid": "3756a6d3abc9053f635b89068108a8dd", "score": "0.4167398", "text": "func UpdateLedger(stub *shim.ChaincodeStub, tableName string, keys []string, args []byte) error {\n\n\tnKeys := GetNumberOfKeys(tableName)\n\tif nKeys < 1 {\n\t\tfmt.Printf(\"Atleast 1 Key must be provided \\n\")\n\t}\n\n\tvar columns []*shim.Column\n\n\tfor i := 0; i < nKeys; i++ {\n\t\tcol := shim.Column{Value: &shim.Column_String_{String_: keys[i]}}\n\t\tcolumns = append(columns, &col)\n\t}\n\n\tlastCol := shim.Column{Value: &shim.Column_Bytes{Bytes: []byte(args)}}\n\tcolumns = append(columns, &lastCol)\n\n\trow := shim.Row{columns}\n\tok, err := stub.InsertRow(tableName, row)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"UpdateLedger: InsertRow into \"+tableName+\" Table operation failed. %s\", err)\n\t}\n\tif !ok {\n\t\treturn errors.New(\"UpdateLedger: InsertRow into \" + tableName + \" Table failed. Row with given key \" + keys[0] + \" already exists\")\n\t}\n\n\tfmt.Printf(\"UpdateLedger: InsertRow into \" + tableName + \" Table operation Successful. \")\n\treturn nil\n}", "title": "" }, { "docid": "e737b46a494b5a9428f2bf542757325e", "score": "0.41627225", "text": "func (h *Handler) update(c echo.Context) (e error) {\n\tvar id int64\n\tvar session *auth.SessionData\n\tvar r updateRequest\n\tvar u *model.Partnership\n\tctx := c.(*cuxs.Context)\n\tif id, e = common.Decrypt(ctx.Param(\"id\")); e == nil {\n\t\tif u, e = GetPartnershipByField(\"id\", id); e == nil {\n\t\t\tif session, e = auth.UserSession(ctx); e == nil {\n\t\t\t\tr.Session = session\n\t\t\t\tr.PartnerOld = u\n\t\t\t\tif e = ctx.Bind(&r); e == nil {\n\t\t\t\t\tm := r.Transform()\n\t\t\t\t\tif m.Save(\"order_rule\", \"max_plafon\", \"full_name\", \"email\", \"phone\", \"address\", \"city\", \"province\", \"bank_name\", \"bank_holder\", \"bank_number\", \"sales_person\", \"visit_day\", \"note\", \"updated_by\", \"updated_at\"); e == nil {\n\t\t\t\t\t\tctx.Data(m)\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t} else {\n\t\t\te = echo.ErrNotFound\n\t\t}\n\t}\n\treturn ctx.Serve(e)\n}", "title": "" }, { "docid": "746b3206a7550ef7c239b0efa552612d", "score": "0.4158263", "text": "func (t *TxStructure) LSet(key []byte, index int64, value []byte) error {\n\ttrace_util_0.Count(_list_00000, 47)\n\tif t.readWriter == nil {\n\t\ttrace_util_0.Count(_list_00000, 51)\n\t\treturn errWriteOnSnapshot\n\t}\n\ttrace_util_0.Count(_list_00000, 48)\n\tmetaKey := t.encodeListMetaKey(key)\n\tmeta, err := t.loadListMeta(metaKey)\n\tif err != nil || meta.IsEmpty() {\n\t\ttrace_util_0.Count(_list_00000, 52)\n\t\treturn errors.Trace(err)\n\t}\n\n\ttrace_util_0.Count(_list_00000, 49)\n\tindex = adjustIndex(index, meta.LIndex, meta.RIndex)\n\n\tif index >= meta.LIndex && index < meta.RIndex {\n\t\ttrace_util_0.Count(_list_00000, 53)\n\t\treturn t.readWriter.Set(t.encodeListDataKey(key, index), value)\n\t}\n\ttrace_util_0.Count(_list_00000, 50)\n\treturn errInvalidListIndex.GenWithStack(\"invalid list index %d\", index)\n}", "title": "" }, { "docid": "f26435eab208a894bee060e971b683fb", "score": "0.41553223", "text": "func (o *RoleMenu) Update(exec boil.Executor, whitelist ...string) error {\n\tvar err error\n\tkey := makeCacheKey(whitelist, nil)\n\troleMenuUpdateCacheMut.RLock()\n\tcache, cached := roleMenuUpdateCache[key]\n\troleMenuUpdateCacheMut.RUnlock()\n\n\tif !cached {\n\t\twl := strmangle.UpdateColumnSet(\n\t\t\troleMenuColumns,\n\t\t\troleMenuPrimaryKeyColumns,\n\t\t\twhitelist,\n\t\t)\n\n\t\tif len(whitelist) == 0 {\n\t\t\twl = strmangle.SetComplement(wl, []string{\"created_at\"})\n\t\t}\n\t\tif len(wl) == 0 {\n\t\t\treturn errors.New(\"models: unable to update role_menus, could not build whitelist\")\n\t\t}\n\n\t\tcache.query = fmt.Sprintf(\"UPDATE \\\"role_menus\\\" SET %s WHERE %s\",\n\t\t\tstrmangle.SetParamNames(\"\\\"\", \"\\\"\", 1, wl),\n\t\t\tstrmangle.WhereClause(\"\\\"\", \"\\\"\", len(wl)+1, roleMenuPrimaryKeyColumns),\n\t\t)\n\t\tcache.valueMapping, err = queries.BindMapping(roleMenuType, roleMenuMapping, append(wl, roleMenuPrimaryKeyColumns...))\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\tvalues := queries.ValuesFromMapping(reflect.Indirect(reflect.ValueOf(o)), cache.valueMapping)\n\n\tif boil.DebugMode {\n\t\tfmt.Fprintln(boil.DebugWriter, cache.query)\n\t\tfmt.Fprintln(boil.DebugWriter, values)\n\t}\n\n\t_, err = exec.Exec(cache.query, values...)\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"models: unable to update role_menus row\")\n\t}\n\n\tif !cached {\n\t\troleMenuUpdateCacheMut.Lock()\n\t\troleMenuUpdateCache[key] = cache\n\t\troleMenuUpdateCacheMut.Unlock()\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "d5d66ef7350ab96997b093fdb7314978", "score": "0.4155188", "text": "func EditUpGET(w http.ResponseWriter, r *http.Request) {\n\tsess := model.Instance(r)\n var edit model.Editor\n\tvar params httprouter.Params\n\tparams = context.Get(r, \"params\").(httprouter.Params)\n\tid,_ := atoi32(params.ByName(\"id\"))\n edit.Id = id\n\terr := (&edit).EditById()\n\tif err != nil { // Si no existe el usuario\n log.Println(err)\n sess.AddFlash(view.Flash{\"Es raro. No tenemos editor.\", view.FlashError})\n sess.Save(r, w)\n http.Redirect(w, r, \"/editor/list/1\", http.StatusFound)\n return\n\t}\n\tv := view.New(r)\n\tv.Name = \"editor/editupdate\"\n\tv.Vars[\"token\"] = csrfbanana.Token(w, r, sess)\n v.Vars[\"name\"] = edit.Name\n//\tview.Repopulate([]string{\"name\"}, r.Form, v.Vars)\n v.Render(w)\n }", "title": "" }, { "docid": "b3844049423360c3d1458b363893af97", "score": "0.4150562", "text": "func (p *Party) setUpdated() {\n\tp.changeID++\n\tp.lastChangeT = time.Now()\n}", "title": "" }, { "docid": "e12cd76a566add89f8b2bd90f2869263", "score": "0.41445652", "text": "func (lb *DistributedLB) UpdateServers() {\n\tid := 0\n\t//re initialze server ID, Assumption: acutally this will by synchronized across the server by IPC\n\tfor serverIP, server := range lb.ServerMap {\n\t\tif server.IPAddress != \"\" && server.OperStatus == true {\n\t\t\tserver.ServerID = id\n\t\t\tid++\n\t\t\tlb.ServerMap[serverIP] = server\n\t\t}\n\t}\n\tfor _, server := range lb.ServerMap {\n\t\t//assign unique objects per server\n\t\tlb.RedistributeObjects(&server)\n\t\tlb.ServerMap[server.IPAddress] = server\n\t}\n}", "title": "" }, { "docid": "713546f9d39f7e7ffd02772d6db12a3c", "score": "0.41405857", "text": "func (u *Updater) update() {\n\t// Make request to iTrak data feed\n\tclient := http.Client{Timeout: time.Second * 5}\n\tresp, err := client.Get(u.cfg.DataFeed)\n\tif err != nil {\n\t\tlog.WithError(err).Error(\"Could not get data feed.\")\n\t\treturn\n\t}\n\n\tif resp.StatusCode != http.StatusOK {\n\t\tlog.Errorf(\"data feed status code %d\", resp.StatusCode)\n\t\treturn\n\t}\n\n\t// Read response body content\n\tbody, err := ioutil.ReadAll(resp.Body)\n\tif err != nil {\n\t\tlog.WithError(err).Error(\"Could not read data feed.\")\n\t\treturn\n\t}\n\tresp.Body.Close()\n\n\tdfresp := &DataFeedResponse{\n\t\tBody: body,\n\t\tStatusCode: resp.StatusCode,\n\t\tHeaders: resp.Header,\n\t}\n\tu.setLastResponse(dfresp)\n\n\tdelim := \"eof\"\n\t// split the body of response by delimiter\n\tvehiclesData := strings.Split(string(body), delim)\n\tvehiclesData = vehiclesData[:len(vehiclesData)-1] // last element is EOF\n\n\t// TODO: Figure out if this handles == 1 vehicle correctly or always assumes > 1.\n\tif len(vehiclesData) <= 1 {\n\t\tlog.Warnf(\"Found no vehicles delineated by '%s'.\", delim)\n\t}\n\n\twg := sync.WaitGroup{}\n\t// for parsed data, update each vehicle\n\tfor _, vehicleData := range vehiclesData {\n\t\twg.Add(1)\n\t\tgo func(vehicleData string) {\n\t\t\tu.handleVehicleData(vehicleData)\n\t\t\twg.Done()\n\t\t}(vehicleData)\n\t}\n\twg.Wait()\n\tlog.Debugf(\"Updated vehicles.\")\n\n\t// Prune updates older than one month\n\tdeleted, err := u.ms.DeleteLocationsBefore(time.Now().AddDate(0, -1, 0))\n\tif err != nil {\n\t\tlog.WithError(err).Error(\"unable to remove old locations\")\n\t\treturn\n\t}\n\tif deleted > 0 {\n\t\tlog.Debugf(\"Removed %d old updates.\", deleted)\n\t}\n}", "title": "" }, { "docid": "fc6ed39c71561ca9c94bf91160204826", "score": "0.41390285", "text": "func (b *KalmanBlobie) Update(newb Blobie) error {\n\tvar newbCast *KalmanBlobie\n\tswitch newb.(type) {\n\tcase *KalmanBlobie:\n\t\tnewbCast = newb.(*KalmanBlobie)\n\t\tbreak\n\tdefault:\n\t\treturn fmt.Errorf(\"KalmanBlobie.Update() method must accept interface of type *KalmanBlobie\")\n\t}\n\tnewCenterX, newCenterY := float64(newbCast.Center.X), float64(newbCast.Center.Y)\n\n\t// Reset y\n\tb.yMatrix.Set(0, 0, newCenterX)\n\tb.yMatrix.Set(1, 0, newCenterY)\n\n\t// Reset u\n\tb.uMatrix.Set(0, 0, 0.0)\n\tb.uMatrix.Set(1, 0, 0.0)\n\tb.uMatrix.Set(2, 0, 0.0)\n\tb.uMatrix.Set(3, 0, 0.0)\n\n\t// Evaluate state\n\tstate, err := b.pointTracker.Process(b.uMatrix, b.yMatrix)\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"Can't process linear Kalman filter\")\n\t}\n\tkalmanX, kalmanY := int(state.At(0, 0)), int(state.At(1, 0))\n\tb.CurrentRect = newbCast.CurrentRect\n\tb.Center = image.Point{kalmanX, kalmanY}\n\tdiffX, diffY := kalmanX-newbCast.Center.X, kalmanY-newbCast.Center.Y\n\tb.CurrentRect = image.Rect(newbCast.CurrentRect.Min.X-diffX, newbCast.CurrentRect.Min.Y-diffY, newbCast.CurrentRect.Max.X-diffX, newbCast.CurrentRect.Max.Y-diffY)\n\tb.Area = newbCast.Area\n\tb.Diagonal = newbCast.Diagonal\n\tb.AspectRatio = newbCast.AspectRatio\n\tb.isStillBeingTracked = true\n\tb.isExists = true\n\t// Append new point to track\n\tb.Track = append(b.Track, b.Center)\n\tb.TrackTime = append(b.TrackTime, newbCast.TrackTime[len(newbCast.TrackTime)-1])\n\t// Restrict number of points in track (shift to the left)\n\tif len(b.Track) > b.maxPointsInTrack {\n\t\tb.Track = b.Track[1:]\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "8fef4256c82662fcb1de0a9103d413ec", "score": "0.41211778", "text": "func (w *webserver) update() {\n\n\tdsvrdRotators, err := discovery.LookupRotators()\n\tif err != nil {\n\t\tlog.Println(err)\n\t\treturn\n\t}\n\n\t// check if rotator(s) are not registered yet\n\tfor _, dr := range dsvrdRotators {\n\n\t\t// only add when the rotator is not registed yet\n\t\t_, exists := w.Rotator(dr.Name)\n\t\tif exists {\n\t\t\tcontinue\n\t\t}\n\n\t\tdoneCh := make(chan struct{})\n\t\tdone := proxy.DoneCh(doneCh)\n\t\thost := proxy.Host(dr.AddrV4.String())\n\t\tport := proxy.Port(dr.Port)\n\t\teh := proxy.EventHandler(ev)\n\t\tr, err := proxy.New(done, host, port, eh)\n\t\tif err != nil {\n\t\t\tlog.Println(\"unable to create proxy object:\", err)\n\t\t\tr.Close()\n\t\t\tr = nil\n\t\t\tcontinue\n\t\t}\n\t\tif err := w.AddRotator(r); err != nil {\n\t\t\tlog.Println(err)\n\t\t\tcontinue\n\t\t}\n\t\tgo func() {\n\t\t\t<-doneCh\n\t\t\tw.RemoveRotator(r)\n\t\t}()\n\t}\n}", "title": "" }, { "docid": "599516ebf0ee9dac26590dd959748301", "score": "0.4117498", "text": "func Update(i Item) {\n\tfor i != nil {\n\t\tcached := i.CachedHash()\n\t\t*cached = HashZero // invalidate\n\t\t*cached = Hash(i)\n\t\ti = i.Parent()\n\t}\n}", "title": "" }, { "docid": "73f59df425a35bafd15a887cc5a0f6d0", "score": "0.4116208", "text": "func update_sent_messages(i int) {\n\tmensagens_enviadas_lock.Lock()\n\tmensagens_enviadas[i] += 1\n\tmensagens_enviadas_lock.Unlock()\n}", "title": "" }, { "docid": "36488025f567b9cfd9d28549ad07a518", "score": "0.41129497", "text": "func (it *Items) UpdateVote(rw http.ResponseWriter, r *http.Request) {\n\tit.l.Println(\"[DEBUG] get all records\")\n\n\titems := models.GetList()\n\n\terr := models.ToJSON(items, rw)\n\tif err != nil {\n\t\tit.l.Println(\"[ERROR] serializing product\", err)\n\t}\n}", "title": "" }, { "docid": "68785a331b3d06488e736de5fb2c5e3b", "score": "0.41111308", "text": "func (f *FailingKubeClient) Update(r, modified kube.ResourceList, ignoreMe bool) (*kube.Result, error) {\n\tif f.UpdateError != nil {\n\t\treturn &kube.Result{}, f.UpdateError\n\t}\n\treturn f.PrintingKubeClient.Update(r, modified, ignoreMe)\n}", "title": "" }, { "docid": "8d6dde63dd667673c9c0386aaab232a2", "score": "0.41110778", "text": "func (torrent *Torrent) Update() {\n\n}", "title": "" }, { "docid": "ef6c1f62fa3c7eb3e707b7e10bce6d7b", "score": "0.41057757", "text": "func (tx *Tx) LSet(bucket string, key []byte, index int, value []byte) error {\n\tvar (\n\t\terr error\n\t\tbuffer bytes.Buffer\n\t)\n\n\tif err = tx.checkTxIsClosed(); err != nil {\n\t\treturn err\n\t}\n\n\tif _, ok := tx.db.ListIdx[bucket]; !ok {\n\t\treturn ErrBucket\n\t}\n\n\tif _, ok := tx.db.ListIdx[bucket].Items[string(key)]; !ok {\n\t\treturn ErrKeyNotFound\n\t}\n\n\tsize, _ := tx.LSize(bucket, key)\n\tif index < 0 || index >= size {\n\t\treturn list.ErrIndexOutOfRange\n\t}\n\n\tbuffer.Write(key)\n\tbuffer.Write([]byte(SeparatorForListKey))\n\tindexBytes := []byte(strconv2.IntToStr(index))\n\tbuffer.Write(indexBytes)\n\tnewKey := buffer.Bytes()\n\n\treturn tx.push(bucket, newKey, DataLSetFlag, value)\n}", "title": "" }, { "docid": "474d79c9bfe1fbe31a2b7a6014891f42", "score": "0.41004345", "text": "func (o *RegistryJournal) Update(ctx context.Context, exec boil.ContextExecutor, columns boil.Columns) (int64, error) {\n\tvar err error\n\tif err = o.doBeforeUpdateHooks(ctx, exec); err != nil {\n\t\treturn 0, err\n\t}\n\tkey := makeCacheKey(columns, nil)\n\tregistryJournalUpdateCacheMut.RLock()\n\tcache, cached := registryJournalUpdateCache[key]\n\tregistryJournalUpdateCacheMut.RUnlock()\n\n\tif !cached {\n\t\twl := columns.UpdateColumnSet(\n\t\t\tregistryJournalColumns,\n\t\t\tregistryJournalPrimaryKeyColumns,\n\t\t)\n\n\t\tif !columns.IsWhitelist() {\n\t\t\twl = strmangle.SetComplement(wl, []string{\"created_at\"})\n\t\t}\n\t\tif len(wl) == 0 {\n\t\t\treturn 0, errors.New(\"models: unable to update registry_journals, could not build whitelist\")\n\t\t}\n\n\t\tcache.query = fmt.Sprintf(\"UPDATE `registry_journals` SET %s WHERE %s\",\n\t\t\tstrmangle.SetParamNames(\"`\", \"`\", 0, wl),\n\t\t\tstrmangle.WhereClause(\"`\", \"`\", 0, registryJournalPrimaryKeyColumns),\n\t\t)\n\t\tcache.valueMapping, err = queries.BindMapping(registryJournalType, registryJournalMapping, append(wl, registryJournalPrimaryKeyColumns...))\n\t\tif err != nil {\n\t\t\treturn 0, err\n\t\t}\n\t}\n\n\tvalues := queries.ValuesFromMapping(reflect.Indirect(reflect.ValueOf(o)), cache.valueMapping)\n\n\tif boil.DebugMode {\n\t\tfmt.Fprintln(boil.DebugWriter, cache.query)\n\t\tfmt.Fprintln(boil.DebugWriter, values)\n\t}\n\n\tvar result sql.Result\n\tresult, err = exec.ExecContext(ctx, cache.query, values...)\n\tif err != nil {\n\t\treturn 0, errors.Wrap(err, \"models: unable to update registry_journals row\")\n\t}\n\n\trowsAff, err := result.RowsAffected()\n\tif err != nil {\n\t\treturn 0, errors.Wrap(err, \"models: failed to get rows affected by update for registry_journals\")\n\t}\n\n\tif !cached {\n\t\tregistryJournalUpdateCacheMut.Lock()\n\t\tregistryJournalUpdateCache[key] = cache\n\t\tregistryJournalUpdateCacheMut.Unlock()\n\t}\n\n\treturn rowsAff, o.doAfterUpdateHooks(ctx, exec)\n}", "title": "" }, { "docid": "b3c206a9f3707160ca8f6a43224b20b6", "score": "0.40995374", "text": "func updateTicket(w http.ResponseWriter, r *http.Request) {\n\tvars := mux.Vars(r)\n\tTicketID, err := strconv.Atoi(vars[\"id\"])\n\tvar updatedTicket Ticket\n\tif err != nil {\n\t\tfmt.Fprintf(w, \"Invalid ID\")\n\t}\n\treqBody, err := ioutil.ReadAll(r.Body)\n\tif err != nil {\n\t\tfmt.Fprintf(w, \"Please Enter Valid Data\")\n\t}\n\tjson.Unmarshal(reqBody, &updatedTicket)\n\tfor i, t := range Tickets {\n\t\tif t.ID == TicketID {\n\t\t\tupdatedTicket.ID = t.ID\n\t\t\tupdatedTicket.CreationDate = t.CreationDate\n\t\t\tupdatedTicket.UpdateDate = time.Now()\n\t\t\tTickets = append(Tickets, updatedTicket)\n\t\t\tfmt.Fprintf(w, \"The Ticket with ID %v has been updated successfully\", TicketID)\n\t\t\tTickets = append(Tickets[:i], Tickets[i+1:]...)\n\t\t}\n\t}\n\n}", "title": "" }, { "docid": "2417a69af5583706f1969753c7cc2553", "score": "0.40943527", "text": "func update_received_messages(i int) {\n\tmensagens_recebidas_lock.Lock()\n\tmensagens_recebidas[i] += 1\n\tmensagens_recebidas_lock.Unlock()\n}", "title": "" }, { "docid": "3671ccb75b1ac6b2974eee06883738ee", "score": "0.4091005", "text": "func (api *LanguageApi) update(c *routing.Context) error {\n\tid := c.Param(\"id\")\n\n\tmodel, fetchErr := api.dao.GetByID(id)\n\tif fetchErr != nil {\n\t\treturn utils.NewNotFoundError(fmt.Sprintf(\"Language item with id \\\"%v\\\" doesn't exist!\", id))\n\t}\n\n\tform := &models.LanguageForm{Model: model}\n\n\tif readErr := c.Read(form); readErr != nil {\n\t\treturn utils.NewBadRequestError(\"Oops, an error occurred while updating Language item.\", readErr)\n\t}\n\n\tupdatedModel, updateErr := api.dao.Update(form)\n\tif updateErr != nil {\n\t\treturn utils.NewBadRequestError(\"Oops, an error occurred while updating Language item.\", updateErr)\n\t}\n\n\treturn c.Write(updatedModel)\n}", "title": "" }, { "docid": "6b9a3d70cde0d6d8a1a8f48f8a940868", "score": "0.4083357", "text": "func (o *Lipid) Update(ctx context.Context, exec boil.ContextExecutor, columns boil.Columns) (int64, error) {\n\tif !boil.TimestampsAreSkipped(ctx) {\n\t\tcurrTime := time.Now().In(boil.GetLocation())\n\n\t\to.UpdatedAt = currTime\n\t}\n\n\tvar err error\n\tif err = o.doBeforeUpdateHooks(ctx, exec); err != nil {\n\t\treturn 0, err\n\t}\n\tkey := makeCacheKey(columns, nil)\n\tlipidUpdateCacheMut.RLock()\n\tcache, cached := lipidUpdateCache[key]\n\tlipidUpdateCacheMut.RUnlock()\n\n\tif !cached {\n\t\twl := columns.UpdateColumnSet(\n\t\t\tlipidAllColumns,\n\t\t\tlipidPrimaryKeyColumns,\n\t\t)\n\n\t\tif !columns.IsWhitelist() {\n\t\t\twl = strmangle.SetComplement(wl, []string{\"created_at\"})\n\t\t}\n\t\tif len(wl) == 0 {\n\t\t\treturn 0, errors.New(\"models: unable to update lipid, could not build whitelist\")\n\t\t}\n\n\t\tcache.query = fmt.Sprintf(\"UPDATE \\\"lipid\\\" SET %s WHERE %s\",\n\t\t\tstrmangle.SetParamNames(\"\\\"\", \"\\\"\", 1, wl),\n\t\t\tstrmangle.WhereClause(\"\\\"\", \"\\\"\", len(wl)+1, lipidPrimaryKeyColumns),\n\t\t)\n\t\tcache.valueMapping, err = queries.BindMapping(lipidType, lipidMapping, append(wl, lipidPrimaryKeyColumns...))\n\t\tif err != nil {\n\t\t\treturn 0, err\n\t\t}\n\t}\n\n\tvalues := queries.ValuesFromMapping(reflect.Indirect(reflect.ValueOf(o)), cache.valueMapping)\n\n\tif boil.IsDebug(ctx) {\n\t\twriter := boil.DebugWriterFrom(ctx)\n\t\tfmt.Fprintln(writer, cache.query)\n\t\tfmt.Fprintln(writer, values)\n\t}\n\tvar result sql.Result\n\tresult, err = exec.ExecContext(ctx, cache.query, values...)\n\tif err != nil {\n\t\treturn 0, errors.Wrap(err, \"models: unable to update lipid row\")\n\t}\n\n\trowsAff, err := result.RowsAffected()\n\tif err != nil {\n\t\treturn 0, errors.Wrap(err, \"models: failed to get rows affected by update for lipid\")\n\t}\n\n\tif !cached {\n\t\tlipidUpdateCacheMut.Lock()\n\t\tlipidUpdateCache[key] = cache\n\t\tlipidUpdateCacheMut.Unlock()\n\t}\n\n\treturn rowsAff, o.doAfterUpdateHooks(ctx, exec)\n}", "title": "" }, { "docid": "17a5cd5877603848d826ad5b9ec20d86", "score": "0.40815273", "text": "func (tv *TableView) UpdateItem(index int) error {\n\tif s, ok := tv.model.(Sorter); ok {\n\t\tif err := s.Sort(s.SortedColumn(), s.SortOrder()); err != nil {\n\t\t\treturn err\n\t\t}\n\t} else {\n\t\tif win.FALSE == win.SendMessage(tv.hwndFrozenLV, win.LVM_UPDATE, uintptr(index), 0) {\n\t\t\treturn newError(\"LVM_UPDATE\")\n\t\t}\n\t\tif win.FALSE == win.SendMessage(tv.hwndNormalLV, win.LVM_UPDATE, uintptr(index), 0) {\n\t\t\treturn newError(\"LVM_UPDATE\")\n\t\t}\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "12b9c7c79bacb9bf328a51176d8f21df", "score": "0.4078559", "text": "func UpdateAutor(writter http.ResponseWriter, request *http.Request) {\n\tvar autor models.Autor\n\terr := json.NewDecoder(request.Body).Decode(&autor)\n\tjsonResponse := simplejson.New()\n\tif err == nil {\n\n\t\tvar autorFilters []string\n\t\tvar autorFiltersValues []interface{}\n\n\t\tautorFilters = append(autorFilters, \"ID\")\n\t\tautorFiltersValues = append(autorFiltersValues, autor.ID)\n\n\t\tautor.ID = 0\n\n\t\tautorStrings, autorValues := utilities.ObjectFields(autor)\n\n\t\tautorRows, err := utilities.UpdateObject(\"Autor\", autorFilters, autorFiltersValues, autorStrings, autorValues)\n\t\tif err == nil {\n\n\t\t\tif autorRows {\n\n\t\t\t\tjsonResponse.Set(\"Exito\", true)\n\t\t\t\tjsonResponse.Set(\"Message\", \"Autor actualizado\")\n\n\t\t\t} else {\n\n\t\t\t\tjsonResponse.Set(\"Exito\", false)\n\t\t\t\tjsonResponse.Set(\"Message\", err.Error())\n\n\t\t\t}\n\n\t\t} else {\n\t\t\tjsonResponse.Set(\"Exito\", false)\n\t\t\tjsonResponse.Set(\"Message\", err.Error())\n\t\t}\n\n\t} else {\n\t\tjsonResponse.Set(\"Exito\", false)\n\t\tjsonResponse.Set(\"Message\", err.Error())\n\t}\n\n\tpayload, err := jsonResponse.MarshalJSON()\n\twritter.Header().Set(\"Content-Type\", \"application/json\")\n\twritter.Write(payload)\n\treturn\n}", "title": "" }, { "docid": "67ace32370ce69a63b74afc43115adfe", "score": "0.40672627", "text": "func (c *WorkLocationcontroller) EditWorkLocation() {\n\n\tlog.Println(\"inside edittttttt\");\n\tr := c.Ctx.Request\n\tw := c.Ctx.ResponseWriter\n\tcompanyTeamName := c.Ctx.Input.Param(\":companyTeamName\")\n\tworkLocationId := c.Ctx.Input.Param(\":worklocationid\")\n\tstoredSession := ReadSession(w, r, companyTeamName)\n\tcompanyUsers :=models.Company{}\n\tvar keySliceForGroupAndUser []string\n\t//workLocationViewmodel := viewmodels.AddLocationViewModel{}\n\tuserMap := make(map[string]models.WorkLocationUser)\n\tgroupNameAndDetails := models.WorkLocationGroup{}\n\tgroupMemberNameForTask :=models.GroupMemberNameInWorkLocation{}\n\tgroupMemberMap := make(map[string]models.GroupMemberNameInWorkLocation)\n\tgroupMap := make(map[string]models.WorkLocationGroup)\n\tvar keySliceForGroup [] string\n\tvar MemberNameArray [] string\n\t//var notificationCount = 0\n\tgroup := models.Group{}\n\tviewModelForEdit :=viewmodels.EditWorkLocation{}\n\tusersDetail :=models.Users{}\n\tuserName :=models.WorkLocationUser{}\n\tWorkLocation := models.WorkLocation{}\n\tif r.Method == \"POST\" {\n\t\texposureTask := c.GetString(\"exposureBreakTime\")\n\t\texposureWorkTime := c.GetString(\"exposureWorkTime\")\n\t\tlog.Println(\"exposureTask\",exposureTask)\n\t\tlog.Println(\"exposureWorkTime\",exposureWorkTime)\n\t\tfitToWorkName :=c.GetString(\"fitToWorkName\")\n\t\tgroupKeySliceForWorkLocationString := c.GetString(\"groupArrayElement\")\n\t\tUserOrGroupNameArray :=c.GetStrings(\"userAndGroupName\")\n\t\ttaskLocation := c.GetString(\"taskLocation\")\n\t\tdailyEndTime := c.GetString(\"dailyEndTimeString\")\n\t\tdailyStartTime := c.GetString(\"dailyStartTimeString\")\n\t\tgroupKeySliceForWorkLocation :=strings.Split(groupKeySliceForWorkLocationString, \",\")\n\t\tuserIdArray := c.GetStrings(\"selectedUserNames\")\n\t\tlatitude := c.GetString(\"latitudeId\")\n\t\tlongitude := c.GetString(\"longitudeId\")\n\t\tstartDate := c.GetString(\"startDateTimeStamp\")\n\t\tendDate := c.GetString(\"endDateTimeStamp\")\n\t\tstartDateInt , err := strconv.ParseInt(startDate, 10, 64)\n\t\tendDateInt, err := strconv.ParseInt(endDate, 10, 64)\n\t\tloginType := c.GetString(\"loginType\")\n\t\tlog.Println(\"loginType\",loginType)\n\t\tlogInMinutes :=c.GetString(\"logInMinutes\")\n\t\tlogInMinutesInString, err := strconv.ParseInt(logInMinutes, 10, 64)\n\t\tWorkLocationBreakTimeSlice :=strings.Split(exposureTask, \",\")\n\t\tWorkLocationTimeSlice :=strings.Split(exposureWorkTime, \",\")\n\t\tWorkLocation.Info.NFCTagID =c.GetString(\"nfcTagForTask\")\n\t\tlog.Println(\"WorkLocation.Info.NFCTagID\",WorkLocation.Info.NFCTagID)\n\n\n\t\tlayout := \"01/02/2006 15:04\"\n\t\tstartDateInUnix, err := time.Parse(layout, dailyStartTime)\n\t\tif err != nil {\n\t\t\tlog.Println(err)\n\t\t}\n\t\t//task.Info.StartDate = startDate.UTC().Unix()\n\t\tendDateInUnix, err := time.Parse(layout, dailyEndTime)\n\t\tif err != nil {\n\t\t\tlog.Println(err)\n\t\t}\n\t\t//task.Info.EndDate = endDate.Unix()\n\n\t\ttempFitToWorkCheck :=c.GetString(\"fitToWorkCheck\")\n\t\tlog.Println(\"tempFitToWorkCheck\",tempFitToWorkCheck)\n\t\tif tempFitToWorkCheck ==\"on\" {\n\t\t\tWorkLocation.Settings.FitToWorkDisplayStatus =\"EachTime\"\n\t\t} else {\n\t\t\tWorkLocation.Settings.FitToWorkDisplayStatus = \"OnceADay\"\n\t\t}\n\t\tlog.Println(\"userIdArray\",userIdArray)\n\n\t\tvar tempArray []string\n\t\tfor i:=0;i<len(userIdArray);i++{\n\n\t\t\texists := false\n\t\t\tfor v := 0; v < i; v++ {\n\t\t\t\tif userIdArray[v] == userIdArray[i] {\n\t\t\t\t\texists = true\n\t\t\t\t\tbreak\n\t\t\t\t}\n\t\t\t}\n\t\t\t// If no previous element exists, append this one.\n\t\t\tif !exists {\n\t\t\t\ttempArray = append(tempArray, userIdArray[i])\n\t\t\t}\n\t\t}\n\n\t\tvar groupKeySlice\t[]string\n\t\tfor j:=0;j<len(tempArray);j++ {\n\t\t\tlog.Println(\"iam in inner loop\")\n\t\t\ttempName := UserOrGroupNameArray[j]\n\t\t\tuserOrGroupRegExp := regexp.MustCompile(`\\((.*?)\\)`)\n\t\t\tuserOrGroupSelection := userOrGroupRegExp.FindStringSubmatch(tempName)\n\t\t\tif (userOrGroupSelection[1]) == \"User\" {\n\t\t\t\ttempName = tempName[:len(tempName) - 7]\n\t\t\t\tuserName.FullName = tempName\n\t\t\t\tuserName.Status = helpers.StatusActive\n\t\t\t\tlog.Println(\"tempId\", userIdArray[j])\n\t\t\t\tuserMap[userIdArray[j]] = userName\n\t\t\t\tlog.Println(\"userMap\", userMap)\n\t\t\t\tWorkLocation.Info.WorkLocation = taskLocation\n\t\t\t\tWorkLocation.Info.CompanyTeamName = companyTeamName\n\t\t\t\tWorkLocation.Info.UsersAndGroupsInWorkLocation.User = userMap\n\t\t\t\tWorkLocation.Info.Latitude =latitude\n\t\t\t\tWorkLocation.Info.Longitude =longitude\n\t\t\t\tWorkLocation.Info.StartDate =startDateInt\n\t\t\t\tWorkLocation.Info.EndDate =endDateInt\n\t\t\t\tWorkLocation.Info.DailyStartDate = startDateInUnix.Unix()\n\t\t\t\tWorkLocation.Info.DailyEndDate =endDateInUnix.Unix()\n\t\t\t\tWorkLocation.Settings.DateOfCreation = time.Now().Unix()\n\t\t\t\tWorkLocation.Settings.Status = helpers.StatusActive\n\t\t\t\tWorkLocation.Info.LoginType = loginType\n\t\t\t\tWorkLocation.Info.LogTimeInMinutes = logInMinutesInString\n\t\t\t\tlog.Println(\"loginType\",loginType)\n\t\t\t\tlog.Println(\"userMap[tempId]\", userMap)\n\n\t\t\t}\n\t\t\tif groupKeySliceForWorkLocation[0] != \"\" {\n\t\t\t\tlog.Println(\"w5\")\n\t\t\t\tfor i := 0; i < len(groupKeySliceForWorkLocation); i++ {\n\t\t\t\t\tgroupDetails, dbStatus := group.GetGroupDetailsById(c.AppEngineCtx, groupKeySliceForWorkLocation[i])\n\t\t\t\t\tswitch dbStatus {\n\t\t\t\t\tcase true:\n\t\t\t\t\t\tgroupNameAndDetails.GroupName = groupDetails.Info.GroupName\n\t\t\t\t\t\tmemberData := reflect.ValueOf(groupDetails.Members)\n\t\t\t\t\t\tfor _, key := range memberData.MapKeys() {\n\n\t\t\t\t\t\t\tlog.Println(\"status\",groupDetails.Members[key.String()].Status)\n\t\t\t\t\t\t\tif groupDetails.Members[key.String()].Status != helpers.UserStatusDeleted{\n\t\t\t\t\t\t\t\tkeySliceForGroup = append(keySliceForGroup, key.String())\n\t\t\t\t\t\t\t\tMemberNameArray = append(MemberNameArray, groupDetails.Members[key.String()].MemberName)\n\t\t\t\t\t\t\t\tbreak\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\tcase false:\n\t\t\t\t\t\tlog.Println(helpers.ServerConnectionError)\n\t\t\t\t\t}\n\t\t\t\t\tfor i := 0; i < len(keySliceForGroup); i++ {\n\t\t\t\t\t\tgroupMemberNameForTask.MemberName = MemberNameArray[i]\n\t\t\t\t\t\tgroupMemberMap[keySliceForGroup[i]] = groupMemberNameForTask\n\t\t\t\t\t}\n\t\t\t\t\tgroupNameAndDetails.Members = groupMemberMap\n\t\t\t\t\tgroupMap[string(groupKeySliceForWorkLocation[i])] = groupNameAndDetails\n\t\t\t\t\tgroupKeySlice = append(groupKeySlice, string(groupKeySliceForWorkLocation[i]))\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tlog.Println(\"uu1\")\n\t\tWorkLocation.Info.UsersAndGroupsInWorkLocation.User = userMap\n\t\tlog.Println(\"uu2\",WorkLocation.Info.UsersAndGroupsInWorkLocation.User)\n\t\tif groupKeySliceForWorkLocation[0] !=\"\" {\n\t\t\tlog.Println(\"uu2\")\n\t\t\tWorkLocation.Info.UsersAndGroupsInWorkLocation.Group = groupMap\n\t\t\tlog.Println(\"uu3\",WorkLocation.Info.UsersAndGroupsInWorkLocation.Group )\n\t\t}\n\t\tlog.Println(\"op1\")\n\t\tcompanyName :=storedSession.CompanyName\n\t\tdbStatus :=WorkLocation.EditWorkLocationToDb(c.AppEngineCtx,workLocationId,companyTeamName,fitToWorkName,WorkLocationBreakTimeSlice,WorkLocationTimeSlice,companyName)\n\t\tswitch dbStatus {\n\t\tcase true:\n\t\t\tw.Write([]byte(\"true\"))\n\t\tcase false:\n\t\t\tw.Write([]byte(\"false\"))\n\t\t}\n\t} else{\n\n\t\tdbStatus ,testUser:= companyUsers.GetUsersForDropdownFromCompany(c.AppEngineCtx,companyTeamName)\n\n\t\tswitch dbStatus {\n\t\tcase true:\n\t\t\tdataValue := reflect.ValueOf(testUser)\n\t\t\tfor _, key := range dataValue.MapKeys() {\n\n\t\t\t\tdataValue := reflect.ValueOf(testUser[key.String()].Users)\n\t\t\t\tfor _, userKeys := range dataValue.MapKeys() {\n\t\t\t\t\t//viewModel.GroupNameArray = append(viewModel.GroupNameArray ,testUser[key.String()].Users[userKey.String()].FullName+\" (User)\")\n\t\t\t\t\tdbStatus := usersDetail.GetActiveUsersEmailForDropDown(c.AppEngineCtx, userKeys.String(), testUser[key.String()].Users[userKeys.String()].Email, companyTeamName)\n\t\t\t\t\tswitch dbStatus {\n\t\t\t\t\tcase true:\n\t\t\t\t\t\tviewModelForEdit.GroupNameArray = append(viewModelForEdit.GroupNameArray, testUser[key.String()].Users[userKeys.String()].FullName + \" (User)\")\n\t\t\t\t\t\tkeySliceForGroupAndUser = append(keySliceForGroupAndUser, userKeys.String())\n\t\t\t\t\tcase false:\n\t\t\t\t\t\tlog.Println(helpers.ServerConnectionError)\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\tallGroups, dbStatus := models.GetAllGroupDetails(c.AppEngineCtx,companyTeamName)\n\t\t\tswitch dbStatus {\n\t\t\tcase true:\n\t\t\t\tdataValue := reflect.ValueOf(allGroups)\n\t\t\t\tfor _, key := range dataValue.MapKeys() {\n\t\t\t\t\tif allGroups[key.String()].Settings.Status ==\"Active\"{\n\t\t\t\t\t\tvar memberSlice []string\n\n\t\t\t\t\t\tkeySliceForGroupAndUser = append(keySliceForGroupAndUser, key.String())\n\t\t\t\t\t\tviewModelForEdit.GroupNameArray = append(viewModelForEdit.GroupNameArray, allGroups[key.String()].Info.GroupName+\" (Group)\")\n\n\t\t\t\t\t\t// For selecting members while selecting a group in dropdown\n\t\t\t\t\t\tmemberSlice = append(memberSlice, key.String())\n\t\t\t\t\t\tgroupDataValue := reflect.ValueOf(allGroups[key.String()].Members)\n\t\t\t\t\t\tfor _, memberKey := range groupDataValue.MapKeys() {\n\t\t\t\t\t\t\tmemberSlice = append(memberSlice, memberKey.String())\n\t\t\t\t\t\t}\n\t\t\t\t\t\tviewModelForEdit.GroupMembers = append(viewModelForEdit.GroupMembers, memberSlice)\n\t\t\t\t\t\tlog.Println(\"iam in trouble\",viewModelForEdit.GroupMembers)\n\n\t\t\t\t\t}\n\n\t\t\t\t\t//viewModelForEdit.WorkLocation = allGroups[key.String()]\n\t\t\t\t}\n\n\t\t\t\tviewModelForEdit.WorkLogId = workLocationId\n\t\t\t\tviewModelForEdit.UserAndGroupKey=keySliceForGroupAndUser\n\t\t\tcase false:\n\t\t\t\tlog.Println(helpers.ServerConnectionError)\n\t\t\t}\n\t\tcase false:\n\t\t\tlog.Println(helpers.ServerConnectionError)\n\t\t}\n\t\tworkLocation,dbStatus:= models.GetAllWorkLocationDetailsByWorkId(c.AppEngineCtx,workLocationId)\n\t\tswitch dbStatus {\n\t\tcase true:\n\t\t\tviewModelForEdit.PageType = helpers.SelectPageForEdit\n\t\t\tuserDataValues := reflect.ValueOf(workLocation.Info.UsersAndGroupsInWorkLocation.User)\n\n\t\t\tfor _,userKey :=range userDataValues.MapKeys(){\n\t\t\t\tviewModelForEdit.UserNameToEdit = append(viewModelForEdit.UserNameToEdit,workLocation.Info.UsersAndGroupsInWorkLocation.User[userKey.String()].FullName)\n\t\t\t\tviewModelForEdit.UsersKey = append(viewModelForEdit.UsersKey,userKey.String())\n\t\t\t\t//userWOrkLocationData := models.GetWorkLocationDataFromUsers(c.AppEngineCtx,workLocationId,userKey.String())\n\t\t\t\t//log.Println(\"user work location Dta for get ststus of each users\",userWOrkLocationData)\n\n\n\t\t\t}\n\t\t\tstartTime := time.Unix(workLocation.Info.DailyStartDate, 0)\n\t\t\tstartTimeOfWorkLocation := startTime.String()[11:16]\n\t\t\tendTime := time.Unix(workLocation.Info.DailyEndDate,0)\n\t\t\tendTimeOfWorkLocation := endTime.String()[11:16]\n\t\t\tlog.Println(\"endTimeOfWorkLocation\",endTimeOfWorkLocation)\n\t\t\tlog.Println(\"startTimeOfWorkLocation\",startTimeOfWorkLocation)\n\t\t\tviewModelForEdit.FitToWorkCheck = workLocation.Settings.FitToWorkDisplayStatus\n\t\t\tviewModelForEdit.LatitudeForEditing = workLocation.Info.Latitude\n\t\t\tviewModelForEdit.LongitudeForEditing = workLocation.Info.Longitude\n\t\t\tviewModelForEdit.WorkLocation = workLocation.Info.WorkLocation\n\t\t\tviewModelForEdit.DailyStartTime = startTimeOfWorkLocation\n\t\t\tviewModelForEdit.DailyEndTime = endTimeOfWorkLocation\n\t\t\tviewModelForEdit.StartDate = workLocation.Info.StartDate\n\t\t\tviewModelForEdit.EndDate = workLocation.Info.EndDate\n\t\t\tviewModelForEdit.LoginType = workLocation.Info.LoginType\n\t\t\tviewModelForEdit.LogInMin = workLocation.Info.LogTimeInMinutes\n\t\t\tviewModelForEdit.FitToWorkName = workLocation.FitToWork.Info.FitToWorkName\n\t\t\tviewModelForEdit.NFCTagId = workLocation.Info.NFCTagID\n\n\t\tcase false:\n\t\t\tlog.Println(helpers.ServerConnectionError)\n\t\t}\n\n\t}\n\n\n\tworkLocationValues := models.IsWorkAssignedToUser(c.AppEngineCtx,companyTeamName)\n\tlog.Println(\"allWorkLocationData\",workLocationValues)\n\tdataValue := reflect.ValueOf(workLocationValues)\n\n\tfor _, key := range dataValue.MapKeys() {\n\t\tlog.Println(\"alredy key\",key.String())\n\t\tif workLocationValues[key.String()].Settings.Status != helpers.StatusInActive{\n\t\t\tuserDataValues := reflect.ValueOf(workLocationValues[key.String()].Info.UsersAndGroupsInWorkLocation.User)\n\t\t\tfor _,userKey :=range userDataValues.MapKeys(){\n\t\t\t\tvar tempUserArray []string\n\t\t\t\tlog.Println(\"alredy strat\",workLocationValues[key.String()].Info.StartDate)\n\t\t\t\tlog.Println(\"alredy end\",workLocationValues[key.String()].Info.EndDate )\n\t\t\t\tstartDateFromDbInInt:= strconv.FormatInt(int64(workLocationValues[key.String()].Info.StartDate), 10)\n\t\t\t\tendDateFromDbInInt:=strconv.FormatInt(workLocationValues[key.String()].Info.EndDate, 10)\n\t\t\t\ttempUserArray = append(tempUserArray,userKey.String())\n\t\t\t\ttempUserArray = append(tempUserArray, startDateFromDbInInt)\n\t\t\t\ttempUserArray = append(tempUserArray, endDateFromDbInInt)\n\t\t\t\ttempUserArray = append(tempUserArray, key.String())\n\t\t\t\tviewModelForEdit.DateValues = append(viewModelForEdit.DateValues,tempUserArray)\n\t\t\t}\n\t\t}\n\n\t}\n\n\n\n\n\tvar keySliceForFitToWork []string\n\tvar tempKeySliceFitToWork []string\n\tvar tempInstructionKeySlice []string\n\tvar instructionDescription []string\n\tvar fitToWorkStructSlice []viewmodels.TaskFitToWork\n\tvar tempfitToWorkStructSlice [][]viewmodels.TaskFitToWork\n\tvar fitToWorkStruct viewmodels.TaskFitToWork\n\tdbStatus,fitToWorkById := models.GetSelectedCompanyName(c.AppEngineCtx, companyTeamName)\n\tswitch dbStatus {\n\tcase true:\n\t\tfitToWorkDataValues := reflect.ValueOf(fitToWorkById)\n\t\tfor _, fitToWorkKey := range fitToWorkDataValues.MapKeys() {\n\t\t\ttempKeySliceFitToWork = append(tempKeySliceFitToWork, fitToWorkKey.String())\n\t\t}\n\t\tfor _, eachKey := range tempKeySliceFitToWork {\n\t\t\tif fitToWorkById[eachKey].Settings.Status == helpers.StatusActive {\n\t\t\t\tkeySliceForFitToWork = append(keySliceForFitToWork, eachKey)\n\t\t\t\tviewModelForEdit.FitToWorkArray = append(viewModelForEdit.FitToWorkArray, fitToWorkById[eachKey].FitToWorkName)\n\t\t\t\tgetInstructions := models.GetAllInstructionsOfFitToWorkById(c.AppEngineCtx, companyTeamName, eachKey)\n\t\t\t\tfitToWorkInstructionValues := reflect.ValueOf(getInstructions)\n\t\t\t\tfor _, fitToWorkInstructionKey := range fitToWorkInstructionValues.MapKeys() {\n\t\t\t\t\ttempInstructionKeySlice = append(tempInstructionKeySlice, fitToWorkInstructionKey.String())\n\t\t\t\t}\n\n\t\t\t\tfor _, eachInstructionKey := range tempInstructionKeySlice {\n\t\t\t\t\tinstructionDescription = append(instructionDescription, getInstructions[eachInstructionKey].Description)\n\n\t\t\t\t}\n\t\t\t\tfitToWorkStruct.FitToWorkName = fitToWorkById[eachKey].FitToWorkName\n\t\t\t\tfitToWorkStruct.Instruction = instructionDescription\n\t\t\t\tfitToWorkStruct.InstructionKey = tempInstructionKeySlice\n\t\t\t\tfitToWorkStructSlice = append(fitToWorkStructSlice, fitToWorkStruct)\n\t\t\t}\n\t\t}\n\t\tviewModelForEdit.FitToWorkKey = keySliceForFitToWork\n\t\ttempfitToWorkStructSlice = append(tempfitToWorkStructSlice, fitToWorkStructSlice)\n\t\tviewModelForEdit.FitToWorkForTask = tempfitToWorkStructSlice\n\tcase false:\n\t\tlog.Println(helpers.ServerConnectionError)\n\t}\n\n\t//var fitToWorkSlice\t\t\t[]string\n\tvar WorkTime []string\n\tvar BreakTime\t\t\t\t[]string\n\tdbStatus, WorkBreak := models.GetWorkLocationBreakDetailById(c.AppEngineCtx, workLocationId)\n\tswitch dbStatus {\n\tcase true:\n\t\tworkValue := reflect.ValueOf(WorkBreak)\n\t\tfor _, key := range workValue.MapKeys() {\n\t\t\tbreakHourInInt, err := strconv.Atoi(WorkBreak[key.String()].BreakDurationInMinutes)\n\t\t\t//workHourInInt, err := strconv.Atoi(taskWorkBreak[key.String()].WorkTime)\n\t\t\tif err != nil {\n\t\t\t\t// handle error\n\t\t\t\tlog.Println(err)\n\n\t\t\t}\n\t\t\tvar breakHours = breakHourInInt/60\n\t\t\tvar breakMinutes =breakHourInInt %60\n\t\t\tvar breakHourInString =string(breakHours)\n\t\t\tvar breakMinutesInString =string(breakMinutes)\n\t\t\tvar prependBreakHours =\"\"\n\t\t\tvar prependBreakMinutes =\"\"\n\t\t\tif len(breakHourInString) ==1 {\n\n\t\t\t\tprependBreakHours = fmt.Sprintf(\"%02d\", breakHours)\n\t\t\t} else {\n\t\t\t\tprependBreakHours = string(breakHours)\n\t\t\t}\n\t\t\tif len(breakMinutesInString) ==1 {\n\n\t\t\t\tprependBreakMinutes = fmt.Sprintf(\"%02d\", breakMinutes)\n\t\t\t} else {\n\t\t\t\tprependBreakMinutes = string(breakMinutes)\n\t\t\t}\n\t\t\tbreakTimeForTask :=prependBreakHours+\":\"+prependBreakMinutes\n\t\t\tBreakTime = append(BreakTime,breakTimeForTask)\n\n\t\t\tworkHourInInt, err := strconv.Atoi(WorkBreak[key.String()].BreakStartTimeInMinutes)\n\t\t\t//workHourInInt, err := strconv.Atoi(taskWorkBreak[key.String()].WorkTime)\n\t\t\tif err != nil {\n\t\t\t\t// handle error\n\t\t\t\tlog.Println(err)\n\n\t\t\t}\n\t\t\tvar workHours = workHourInInt/60\n\t\t\tvar workMinutes =workHourInInt %60\n\t\t\tvar workHourInString =string(workHours)\n\t\t\tvar workMinutesInString =string(workMinutes)\n\t\t\tvar prependWorkHours =\"\"\n\t\t\tvar prependWorkMinutes =\"\"\n\t\t\tif len(workHourInString) ==1 {\n\n\t\t\t\tprependWorkHours = fmt.Sprintf(\"%02d\", workHours)\n\t\t\t} else {\n\t\t\t\tprependWorkHours = string(workHours)\n\t\t\t}\n\t\t\tif len(workMinutesInString) ==1 {\n\n\t\t\t\tprependWorkMinutes = fmt.Sprintf(\"%02d\", workMinutes)\n\t\t\t} else {\n\t\t\t\tprependWorkMinutes = string(workMinutes)\n\t\t\t}\n\t\t\tworkTimeForTask :=prependWorkHours+\":\"+prependWorkMinutes\n\n\t\t\tWorkTime = append(WorkTime,workTimeForTask)\n\n\t\t}\n\tcase false:\n\t\tlog.Println(helpers.ServerConnectionError)\n\t}\n\n\tviewModelForEdit.BreakTime =BreakTime\n\tviewModelForEdit.WorkTime = WorkTime\n\t//viewModelForEdit.NotificationNumber=notificationCoun\n\tviewModelForEdit.CompanyTeamName = storedSession.CompanyTeamName\n\tviewModelForEdit.CompanyPlan = storedSession.CompanyPlan\n\tviewModelForEdit.AdminFirstName =storedSession.AdminFirstName\n\tviewModelForEdit.AdminLastName =storedSession.AdminLastName\n\tviewModelForEdit.ProfilePicture =storedSession.ProfilePicture\n\tlog.Println(\"viewModelForEdit break time\",viewModelForEdit.BreakTime)\n\tlog.Println(\"WorkTime\",WorkTime)\n\n\tc.Data[\"vm\"] = viewModelForEdit\n\tif viewModelForEdit.CompanyPlan ==\"family\" || viewModelForEdit.CompanyPlan ==\"campus\"{\n\t\tc.TplName = \"template/add-workLocation-on-plan.html\"\n\t}else{\n\t\tc.TplName = \"template/add-workLocation.html\"\n\t}\n\n}", "title": "" }, { "docid": "08f87ee001318801a01d3e8b68aaaba8", "score": "0.40658662", "text": "func (qs PlanQuerySet) UpdatedAtLte(updatedAt time.Time) PlanQuerySet {\n\treturn qs.w(qs.db.Where(\"updated_at <= ?\", updatedAt))\n}", "title": "" }, { "docid": "3d40bffcfe95cec2da508dc67e67f299", "score": "0.40544724", "text": "func (service *SPVServiceImpl) updateLocalHeight() {\n\tservice.PeerManager().Local().SetHeight(uint64(service.chain.Height()))\n}", "title": "" }, { "docid": "601221991e072ed64a0da814d7c9de16", "score": "0.40540075", "text": "func (api *rolloutAPI) Update(obj *rollout.Rollout) 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.RolloutV1().Rollout().Update(context.Background(), obj)\n\t\treturn err\n\t}\n\n\tapi.ct.handleRolloutEvent(&kvstore.WatchEvent{Object: obj, Type: kvstore.Updated})\n\treturn nil\n}", "title": "" }, { "docid": "9f2c00e36545987b33a165369514a02b", "score": "0.404462", "text": "func updateClients(cl []Client){\n\tfor i := range cl {\n\t\tcl[i].Update()\n\t}\n}", "title": "" }, { "docid": "2fa39b88ff195551c6f08fd5cb0aefb2", "score": "0.40313435", "text": "func (qs ArticleQuerySet) UpdatedAtLte(updatedAt time.Time) ArticleQuerySet {\n\treturn qs.w(qs.db.Where(\"updated_at <= ?\", updatedAt))\n}", "title": "" }, { "docid": "724c0d8830fa1201cdf02bd94011313a", "score": "0.4031093", "text": "func (tp *TipoPrenda) Modificar() bool {\n\tconn := conectar()\n\tdefer conn.desconectar()\n\terr := conn.db.C(coleccionTipoPrenda).UpdateId(tp.ID, tp)\n\tif err != nil {\n\t\tlog.RegistrarError(err)\n\t\treturn false\n\t}\n\treturn true\n}", "title": "" }, { "docid": "0fba3873cf8229c5e8c6ca7cc919dace", "score": "0.40310758", "text": "func (candidate *Candidate) UpdateNominees() error {\n\n\tif candidate.Nominee1.String == candidate.User.Email ||\n\t\tcandidate.Nominee2.String == candidate.User.Email {\n\t\treturn errors.New(\"Cannot nominate yourself :-|\")\n\t}\n\n\tif candidate.Nominee1.String == candidate.Nominee2.String &&\n\t\tcandidate.Nominee1.Valid && candidate.Nominee2.Valid {\n\t\treturn errors.New(\"Double nomination not permitted :-|\")\n\t}\n\n\tif err := c.RegexpStr(candidate.Ballot.RegexpVoter, candidate.Nominee1.String); err != nil && candidate.Nominee1.Valid {\n\t\treturn err\n\t}\n\n\tif err := c.RegexpStr(candidate.Ballot.RegexpVoter, candidate.Nominee2.String); err != nil && candidate.Nominee2.Valid {\n\t\treturn err\n\t}\n\n\tbuilder := sq.Update(\"Candidate\")\n\n\tif candidate.Nominee1.Valid {\n\t\tbuilder = builder.Set(\"nominee1_email\", candidate.Nominee1.String)\n\t}\n\tif candidate.Nominee2.Valid {\n\t\tbuilder = builder.Set(\"nominee2_email\", candidate.Nominee2.String)\n\t}\n\n\tquery, args, err := builder.Where(sq.And{\n\t\tsq.Eq{\"ballot_code\": candidate.Ballot.Code},\n\t\tsq.Eq{\"user_email\": candidate.User.Email}}).ToSql()\n\tif err != nil {\n\t\treturn err\n\t}\n\tfmt.Println(query)\n\t_, err = mysql.Exec(query, args)\n\treturn err\n}", "title": "" }, { "docid": "67c7e7f82e5a6bc5037f9c8e32059909", "score": "0.40309066", "text": "func (e *entry) refresh(newTopics map[string]*models.Topic) {\n\te.Lock()\n\tdefer e.Unlock()\n\n\te.topics = newTopics\n\te.ts = utils.Now()\n}", "title": "" }, { "docid": "ae6bac9b814f5abea4a19ff0a0818bba", "score": "0.40306702", "text": "func (mi *Minion) setLife() {\r\n\tmi.life = -1\r\n\t//mi.life = util.Poisson(life)\r\n}", "title": "" }, { "docid": "665beb5e6e6fe50977385290b94243c4", "score": "0.4026874", "text": "func EditMachineInfo(id int, name string) {\n\tsess := SetupDB()\n\t_, err := sess.Update(\"machines\").\n\t\tSet(\"name\", name).\n\t\tSet(\"modified_at\", \"NOW()\").\n\t\tWhere(\"id = ?\", id).\n\t\tExec()\n\tCheckErr(err)\n}", "title": "" }, { "docid": "04a155f27dde0384169c4dd894cf4ff0", "score": "0.4024972", "text": "func (u *User) UpdateUser(oldUser *UserRow, tx *sqlx.Tx) (*UserRow, error) {\n\n\tdata := make(map[string]interface{})\n\n\told := oldUser //what is\n\tnew := &u.UserRow //what will be\n\n\ts := reflect.ValueOf(old).Elem()\n\ts2 := reflect.ValueOf(new).Elem()\n\n\ttypeOfT := s.Type()\n\tfmt.Println(\"t=\", old)\n\tfmt.Println(\"t2=\", new)\n\n\tfor i := 0; i < s.NumField(); i++ {\n\t\told := s.Field(i)\n\t\tnew := s2.Field(i)\n\n\t\tfmt.Printf(\"OLD %d: %s %s = %v\\n\", i, typeOfT.Field(i).Name, old.Type(), old.Interface())\n\t\tfmt.Printf(\"NEW %d: %s %s = %v\\n\", i, typeOfT.Field(i).Name, new.Type(), new.Interface())\n\n\t\tif typeOfT.Field(i).Name == \"UserID\" { //users cant change the id so continue\n\t\t\tcontinue\n\t\t}\n\n\t\tif new.Interface() == \"\" {\n\t\t\tcontinue\n\t\t}\n\n\t\tif old.Interface() != new.Interface() {\n\t\t\tfmt.Printf(\"change old to new\\n\")\n\t\t\told.Set(reflect.Value(new))\n\t\t}\n\n\t\tfmt.Printf(\"F2 %d: %s %s = %v\\n\", i, typeOfT.Field(i).Name, new.Type(), new.Interface())\n\n\t}\n\tfmt.Println(\"OLD \", old)\n\tfmt.Println(\"NEW \", new)\n\n\tdata[UserEmail] = old.Email\n\tdata[FirstName] = old.FirstName\n\tdata[LastName] = old.LastName\n\tdata[GithubName] = old.GithubName\n\tdata[SlackName] = old.SlackName\n\n\tsqlResult, err := u.UpdateByID(tx, data, oldUser.UserID)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tu.UserRow = *old\n\treturn u.userRowFromSqlResult(tx, sqlResult)\n}", "title": "" }, { "docid": "642feec868d39a7c5e5f1274a0982613", "score": "0.40068138", "text": "func changeLinodeSize(client *linodego.Client, linode linodego.Linode, d *schema.ResourceData) error {\n\tvar newPlanID int\n\tvar waitMinutes int\n\n\t// Get the Linode Plan Size\n\tsizeId, err := getSizeId(client, d.Get(\"size\").(int))\n\tif err != nil {\n\t\treturn fmt.Errorf(\"Failed to find a Plan with %d RAM because %s\", d.Get(\"size\"), err)\n\t}\n\tnewPlanID = sizeId\n\n\t// Check if we can safely resize, with Disk Size considered\n\tcurrentDiskSize, err := getTotalDiskSize(client, linode.LinodeId)\n\tnewDiskSize, err := getPlanDiskSize(client, newPlanID)\n\tif currentDiskSize > newDiskSize {\n\t\treturn fmt.Errorf(\"Cannot resize linode %d because currentDisk(%d GB) is bigger than newDisk(%d GB)\", linode.LinodeId, currentDiskSize, newDiskSize)\n\t}\n\n\t// Resize the Linode\n\tclient.Linode.Resize(linode.LinodeId, newPlanID)\n\t// Linode says 1-3 minutes per gigabyte for Resize time... Let's be safe with 3\n\twaitMinutes = ((linode.TotalHD / 1024) * 3)\n\t// Wait for the Resize Operation to Complete\n\terr = waitForJobsToCompleteWaitMinutes(client, linode.LinodeId, waitMinutes)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"Failed to wait for linode %d resize because %s\", linode.LinodeId, err)\n\t}\n\n\tif d.Get(\"disk_expansion\").(bool) {\n\t\t// Determine the biggestDisk ID and Size\n\t\tbiggestDiskID, biggestDiskSize, err := getBiggestDisk(client, linode.LinodeId)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\t// Calculate new size, with other disks taken into consideration\n\t\texpandedDiskSize := (newDiskSize - (currentDiskSize - biggestDiskSize))\n\n\t\t// Resize the Disk\n\t\tclient.Disk.Resize(linode.LinodeId, biggestDiskID, expandedDiskSize)\n\t\t// Wait for the Disk Resize Operation to Complete\n\t\terr = waitForJobsToCompleteWaitMinutes(client, linode.LinodeId, waitMinutes)\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"Failed to wait for resize of Disk %d for Linode %d because %s\", biggestDiskID, linode.LinodeId, err)\n\t\t}\n\t}\n\n\t// Boot up the resized Linode\n\tclient.Linode.Boot(linode.LinodeId, 0)\n\n\t// Return the new Linode size\n\td.SetPartial(\"size\")\n\treturn nil\n}", "title": "" }, { "docid": "675d962eadbc9ace12d172c40627cb36", "score": "0.40040016", "text": "func (jc *JobController) UpdateTrainingJob(node string) {\n\n}", "title": "" }, { "docid": "cf70327c7af1f9a1bac574dea33c1b71", "score": "0.40003017", "text": "func (l *list) setMode(md mode) {\n\t// mode is immutable once set\n\tif l.md > 0 {\n\t\treturn\n\t}\n\n\tl.md = md\n\n\tif md == UNIQ || md == PASS {\n\t\tl.ul = []item{{\"default\", 0}}\n\t\tl.ui = []int{0}\n\t\ttmp := make([]int, len(l.pl))\n\t\tfor i := range tmp {\n\t\t\ttmp[i] = i\n\t\t}\n\t\tl.pi = [][]int{tmp}\n\t}\n}", "title": "" }, { "docid": "218b96eb7c98feb712945ead9883d0dc", "score": "0.39958337", "text": "func (te *pkTableEditor) Table(ctx *sql.Context) (*doltdb.Table, error) {\n\tif !te.HasEdits() {\n\t\treturn te.t, nil\n\t}\n\n\tvar tbl *doltdb.Table\n\terr := func() error {\n\t\tte.writeMutex.Lock()\n\t\tdefer te.writeMutex.Unlock()\n\n\t\tupdatedMap, err := te.tea.MaterializeEdits(ctx, te.nbf)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\tnewTable, err := te.t.UpdateNomsRows(ctx, updatedMap)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\tte.t = newTable\n\t\ttbl = te.t\n\t\treturn nil\n\t}()\n\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tidxMutex := &sync.Mutex{}\n\tidxWg := &sync.WaitGroup{}\n\tidxWg.Add(len(te.indexEds))\n\tfor i := 0; i < len(te.indexEds); i++ {\n\t\tgo func(i int) {\n\t\t\tdefer idxWg.Done()\n\t\t\tindexMap, idxErr := te.indexEds[i].Map(ctx)\n\t\t\tidxMutex.Lock()\n\t\t\tdefer idxMutex.Unlock()\n\t\t\tif err != nil {\n\t\t\t\treturn\n\t\t\t}\n\t\t\tif idxErr != nil {\n\t\t\t\terr = idxErr\n\t\t\t\treturn\n\t\t\t}\n\t\t\ttbl, idxErr = tbl.SetNomsIndexRows(ctx, te.indexEds[i].Index().Name(), indexMap)\n\t\t\tif idxErr != nil {\n\t\t\t\terr = idxErr\n\t\t\t\treturn\n\t\t\t}\n\t\t}(i)\n\t}\n\tidxWg.Wait()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tif te.cvEditor != nil {\n\t\tcvMap, err := te.cvEditor.Map(ctx)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tte.cvEditor = nil\n\t\ttbl, err = tbl.SetConstraintViolations(ctx, cvMap)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\tte.t = tbl\n\n\treturn te.t, nil\n}", "title": "" }, { "docid": "21fd84db6b9253b0be6e86262a4af1db", "score": "0.3987301", "text": "func UpdateDatabaseEntries(JWTtoken string, cfg *config.Config, db *gorm.DB) {\n\t// Create ticker\n\tticker := time.NewTicker(time.Duration(cfg.ButlingButler.Interval) * time.Second)\n\n\tfor range ticker.C {\n\t\t// Get all the user responses\n\t\tuserResponses, err := getUserRespones(JWTtoken, cfg)\n\t\tif err != nil {\n\t\t\tlog.Fatalln(err)\n\t\t}\n\n\t\t// Continue if the user responses array has\n\t\t// a length of 0\n\t\tif len(userResponses) == 0 {\n\t\t\tcontinue\n\t\t}\n\n\t\tfmt.Printf(\"[+] - %s - Got user responses\", time.Now().Format(time.RubyDate))\n\n\t\tfor _, userResponse := range userResponses {\n\t\t\tfmt.Println(userResponse.VPNhash)\n\n\t\t\t// create VPN struct obj\n\t\t\tvar userVPNLog database.UserVPNLog\n\n\t\t\t// Query entry\n\t\t\t//db.Where(\"vpn_hash = ? AND event_id = ?\", userResponse.VPNhash, userResponse.EventID).First(&userVPNLog)\n\t\t\tdb.Where(\"vpn_hash = ?\", userResponse.VPNhash).First(&userVPNLog)\n\n\t\t\tfmt.Println(userResponse.VPNhash)\n\t\t\tfmt.Println(userResponse.EventID)\n\n\t\t\t// Update entry\n\t\t\t// True: Legit login\n\t\t\t// False: UNauthorized login\n\t\t\tif userResponse.UserSelection == \"legitimate_login\" {\n\t\t\t\tuserVPNLog.UserConfirmation = true\n\t\t\t} else {\n\t\t\t\tuserVPNLog.UserConfirmation = false\n\n\t\t\t\t// Create ticket and set caseID\n\t\t\t\tuserVPNLog.CaseID, err = ticket.CreateTheHiveCase(cfg, userVPNLog)\n\t\t\t\tif err != nil {\n\t\t\t\t\tlog.Fatalln(err)\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t// Commit entry\n\t\t\tdb.Save(&userVPNLog)\n\t\t}\n\n\t}\n}", "title": "" }, { "docid": "9aa84d7450ae99d15875bac949b45ab9", "score": "0.39872828", "text": "func Edit(w http.ResponseWriter, r *http.Request) {\n\n\t// TODO edit confidential bugs?\n\n\tuser := utils.GetAuthenticatedUser(r)\n\n\tif !user.Permissions.Glsa.Edit {\n\t\tauthentication.AccessDenied(w, r)\n\t\treturn\n\t}\n\n\tglsaID := r.URL.Path[len(\"/glsa/edit/\"):]\n\n\tparsedGlsaId, _ := strconv.ParseInt(glsaID, 10, 64)\n\tcurrentGlsa := &models.Glsa{Id: parsedGlsaId}\n\terr := user.CanAccess(connection.DB.Model(currentGlsa).\n\t\tRelation(\"Bugs\").\n\t\tRelation(\"Creator\").\n\t\tRelation(\"Comments\").\n\t\tRelation(\"Comments.User\").\n\t\tWherePK()).\n\t\tSelect()\n\n\tif r.Method == \"POST\" {\n\n\t\tr.ParseForm()\n\n\t\tid, err := strconv.ParseInt(glsaID, 10, 64)\n\n\t\tif err != nil {\n\t\t\thttp.NotFound(w, r)\n\t\t\treturn\n\t\t}\n\n\t\t// if\n\t\tvar packages []gpackage.Package\n\t\tfor k, _ := range getArrayParam(\"package_atom\", r) {\n\t\t\tnewPackage := gpackage.Package{\n\t\t\t\tAffected: r.Form[\"package_vulnerable\"][k] == \"true\",\n\t\t\t\tAtom: r.Form[\"package_atom\"][k],\n\t\t\t\tIdentifier: r.Form[\"package_identifier\"][k],\n\t\t\t\tVersion: r.Form[\"package_version\"][k],\n\t\t\t\tSlot: r.Form[\"package_slot\"][k],\n\t\t\t\tArch: r.Form[\"package_arch\"][k],\n\t\t\t\tAuto: r.Form[\"package_auto\"][k] == \"true\",\n\t\t\t}\n\t\t\tpackages = append(packages, newPackage)\n\t\t}\n\n\t\tvar references []models.Reference\n\t\tfor k, _ := range getArrayParam(\"reference_title\", r) {\n\t\t\tnewReference := models.Reference{\n\t\t\t\tTitle: r.Form[\"reference_title\"][k],\n\t\t\t\tURL: r.Form[\"reference_url\"][k],\n\t\t\t}\n\t\t\treferences = append(references, newReference)\n\t\t}\n\n\t\t// Update Bugs: delete old mapping first\n\t\t_, err = connection.DB.Model(&[]models.GlsaToBug{}).Where(\"glsa_id = ?\", glsaID).Delete()\n\t\tif err != nil {\n\t\t\tlogger.Error.Println(\"ERR during delete\")\n\t\t\tlogger.Error.Println(err)\n\t\t}\n\n\t\tnewBugs := bugzilla.GetBugsByIds(getArrayParam(\"bugs\", r))\n\n\t\tfor _, newBug := range newBugs {\n\t\t\t_, err = connection.DB.Model(&newBug).OnConflict(\"(id) DO UPDATE\").Insert()\n\n\t\t\tif err != nil {\n\t\t\t\tlogger.Error.Println(\"Error creating bug\")\n\t\t\t\tlogger.Error.Println(err)\n\t\t\t}\n\n\t\t\tparsedGlsaID, _ := strconv.ParseInt(glsaID, 10, 64)\n\n\t\t\tglsaToBug := &models.GlsaToBug{\n\t\t\t\tGlsaId: parsedGlsaID,\n\t\t\t\tBugId: newBug.Id,\n\t\t\t}\n\n\t\t\tconnection.DB.Model(glsaToBug).Insert()\n\n\t\t}\n\n\t\tglsa := &models.Glsa{\n\t\t\tId: id,\n\t\t\t//\t\t\tAlias: getStringParam(\"alias\", r),\n\t\t\t//\t\t\tType: getStringParam(\"status\", r),\n\t\t\tTitle: getStringParam(\"title\", r),\n\t\t\tSynopsis: getStringParam(\"synopsis\", r),\n\t\t\tPackages: packages,\n\t\t\tDescription: getStringParam(\"description\", r),\n\t\t\tImpact: getStringParam(\"impact\", r),\n\t\t\tWorkaround: getStringParam(\"workaround\", r),\n\t\t\tResolution: getStringParam(\"resolution\", r),\n\t\t\tReferences: references,\n\t\t\tPermission: getStringParam(\"permission\", r),\n\t\t\tAccess: getStringParam(\"access\", r),\n\t\t\tSeverity: getStringParam(\"severity\", r),\n\t\t\tKeyword: getStringParam(\"keyword\", r),\n\t\t\tBackground: getStringParam(\"background\", r),\n\t\t\t//TODO\n\t\t\t//Bugs: ,\n\t\t\t//Comments: nil,\n\t\t\tRevision: \"r9999\",\n\t\t\t//\t\t\tCreated: time.Time{},\n\t\t\tUpdated: time.Time{},\n\t\t}\n\n\t\tif currentGlsa.Type == \"request\" && glsa.Description != \"\" {\n\t\t\tglsa.Type = \"draft\"\n\t\t} else {\n\t\t\tglsa.Type = currentGlsa.Type\n\t\t}\n\n\t\t_, err = connection.DB.Model(glsa).Column(\n\t\t\t\"type\",\n\t\t\t\"title\",\n\t\t\t\"synopsis\",\n\t\t\t\"packages\",\n\t\t\t\"description\",\n\t\t\t\"impact\",\n\t\t\t\"workaround\",\n\t\t\t\"resolution\",\n\t\t\t\"references\",\n\t\t\t\"permission\",\n\t\t\t\"access\",\n\t\t\t\"severity\",\n\t\t\t\"keyword\",\n\t\t\t\"background\",\n\t\t\t\"updated\",\n\t\t\t\"revision\").WherePK().Update()\n\n\t\tif err != nil {\n\t\t\thttp.NotFound(w, r)\n\t\t\tlogger.Error.Println(\"ERR NOT FOUND\")\n\t\t\tlogger.Error.Println(err)\n\t\t\treturn\n\t\t}\n\n\t\thttp.Redirect(w, r, \"/glsa/\"+glsaID, 301)\n\t\treturn\n\t}\n\n\tif err != nil {\n\t\thttp.NotFound(w, r)\n\t\treturn\n\t}\n\n\tcurrentGlsa.ComputeStatus(user)\n\tcurrentGlsa.ComputeCommentBadges()\n\n\t// sort the comments by creation date\n\tsort.Slice(currentGlsa.Comments, func(p, q int) bool {\n\t\treturn currentGlsa.Comments[p].Date.Before(currentGlsa.Comments[q].Date) })\n\n\tglsaCount, err := connection.DB.Model((*models.Glsa)(nil)).Count()\n\n\trenderEditTemplate(w, user, currentGlsa, int64(glsaCount))\n}", "title": "" }, { "docid": "988197946bcbe6f98077b154e17bfd26", "score": "0.3985732", "text": "func UpdateDL(r *http.Request) (*DayLevel, error) {\n\t// get form values\n\tvar err error\n\n\tdl := DayLevel{}\n\n\tdl.ID, err = strconv.ParseInt(r.FormValue(\"Id\"), 10, 64)\n\n\tdl.Focus, err = strconv.ParseInt(r.FormValue(\"focus\"), 10, 64)\n\tif err != nil {\n\t\t// handle the error in some way\n\t\tfmt.Println(\"focus entry not accepted\")\n\t\tfmt.Println(err)\n\t}\n\n\tdl.FischioOrecchie, err = strconv.ParseInt(r.FormValue(\"fischio_orecchie\"), 10, 64)\n\tif err != nil {\n\t\t// handle the error in some way\n\t\tfmt.Println(\"Fischio orecchie entry not accepted\")\n\t\tfmt.Println(err)\n\t}\n\n\tdl.PowerEnergy, err = strconv.ParseInt(r.FormValue(\"power_energy\"), 10, 64)\n\tif err != nil {\n\t\t// handle the error in some way\n\t\tfmt.Println(\"Power energy entry not accepted\")\n\t\tfmt.Println(err)\n\t}\n\n\tdl.Dormito, err = strconv.ParseInt(r.FormValue(\"dormito\"), 10, 64)\n\tif err != nil {\n\t\t// handle the error in some way\n\t\tfmt.Println(\"Dormito entry not accepted\")\n\t\tfmt.Println(err)\n\t}\n\n\tdl.PR, err = strconv.ParseInt(r.FormValue(\"pr\"), 10, 64)\n\tif err != nil {\n\t\t// handle the error in some way\n\t\tfmt.Println(\"Public relations entry not accepted\")\n\t\tfmt.Println(err)\n\t}\n\n\tdl.Ansia, err = strconv.ParseInt(r.FormValue(\"ansia\"), 10, 64)\n\tif err != nil {\n\t\t// handle the error in some way\n\t\tfmt.Println(\"Ansia entry not accepted\")\n\t\tfmt.Println(err)\n\t}\n\n\tdl.Arrabiato, err = strconv.ParseInt(r.FormValue(\"arrabiato\"), 10, 64)\n\tif err != nil {\n\t\t// handle the error in some way\n\t\tfmt.Println(\"Arrabiato entry not accepted\")\n\t\tfmt.Println(err)\n\t}\n\n\tdl.Irritato, err = strconv.ParseInt(r.FormValue(\"irritato\"), 10, 64)\n\tif err != nil {\n\t\t// handle the error in some way\n\t\tfmt.Println(\"irritato entry not accepted\")\n\t\tfmt.Println(err)\n\t}\n\n\tdl.Depresso, err = strconv.ParseInt(r.FormValue(\"depresso\"), 10, 64)\n\tif err != nil {\n\t\t// handle the error in some way\n\t\tfmt.Println(\"Depresso entry not accepted\")\n\t\tfmt.Println(err)\n\t}\n\n\tdl.CinqueTib, err = strconv.ParseBool(r.FormValue(\"cinque_tibetani\"))\n\tif err != nil {\n\t\t// handle the error in some way\n\t\tfmt.Println(\"Cinque tibetani entry not accepted\")\n\t\tfmt.Println(err)\n\t}\n\n\tdl.Meditazione, err = strconv.ParseBool(r.FormValue(\"meditazione\"))\n\tif err != nil {\n\t\t// handle the error in some way\n\t\tfmt.Println(\"Meditazione entry not accepted\")\n\t\tfmt.Println(err)\n\t}\n\n\tt := time.Now()\n\tfmt.Println(t.Format(\"2006-01-02 15:04:05\"))\n\tdl.CreatedOn = t\n\tupdateQuery := `UPDATE daylevels \n\t\t\t SET focus= $1,\n\t\t\t fischio_orecchie=$2,\n\t\t\t power_energy=$3,\n\t\t\t dormito=$4,\n\t\t\t pr=$5,\n\t\t\t ansia=$6,\n\t\t\t arrabiato=$7,\n\t\t\t irritato=$8,\n\t\t\t depresso=$9,\n\t\t\t cinque_tibetani=$10,\n\t\t\t meditazione=$11\n\t\t\t WHERE id=$12`\n\n\t// insert values\n\t_, err = config.DB.Exec(updateQuery,\n\t\t&dl.Focus,\n\t\t&dl.FischioOrecchie,\n\t\t&dl.PowerEnergy,\n\t\t&dl.Dormito,\n\t\t&dl.PR,\n\t\t&dl.Ansia,\n\t\t&dl.Arrabiato,\n\t\t&dl.Irritato,\n\t\t&dl.Depresso,\n\t\t&dl.CinqueTib,\n\t\t&dl.Meditazione,\n\t\t&dl.ID)\n\n\tif err != nil {\n\t\treturn &dl, err\n\t}\n\treturn &dl, nil\n}", "title": "" }, { "docid": "e946cf8389e6d115f708772a25ae0e42", "score": "0.3974876", "text": "func (o *Room) Update(exec boil.Executor, whitelist ...string) error {\n\tcurrTime := time.Now().In(boil.GetLocation())\n\n\to.UpdatedAt = currTime\n\n\tvar err error\n\tif err = o.doBeforeUpdateHooks(exec); err != nil {\n\t\treturn err\n\t}\n\tkey := makeCacheKey(whitelist, nil)\n\troomUpdateCacheMut.RLock()\n\tcache, cached := roomUpdateCache[key]\n\troomUpdateCacheMut.RUnlock()\n\n\tif !cached {\n\t\twl := strmangle.UpdateColumnSet(\n\t\t\troomColumns,\n\t\t\troomPrimaryKeyColumns,\n\t\t\twhitelist,\n\t\t)\n\n\t\tif len(whitelist) == 0 {\n\t\t\twl = strmangle.SetComplement(wl, []string{\"created_at\"})\n\t\t}\n\t\tif len(wl) == 0 {\n\t\t\treturn errors.New(\"models: unable to update rooms, could not build whitelist\")\n\t\t}\n\n\t\tcache.query = fmt.Sprintf(\"UPDATE \\\"rooms\\\" SET %s WHERE %s\",\n\t\t\tstrmangle.SetParamNames(\"\\\"\", \"\\\"\", 1, wl),\n\t\t\tstrmangle.WhereClause(\"\\\"\", \"\\\"\", len(wl)+1, roomPrimaryKeyColumns),\n\t\t)\n\t\tcache.valueMapping, err = queries.BindMapping(roomType, roomMapping, append(wl, roomPrimaryKeyColumns...))\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\tvalues := queries.ValuesFromMapping(reflect.Indirect(reflect.ValueOf(o)), cache.valueMapping)\n\n\tif boil.DebugMode {\n\t\tfmt.Fprintln(boil.DebugWriter, cache.query)\n\t\tfmt.Fprintln(boil.DebugWriter, values)\n\t}\n\n\t_, err = exec.Exec(cache.query, values...)\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"models: unable to update rooms row\")\n\t}\n\n\tif !cached {\n\t\troomUpdateCacheMut.Lock()\n\t\troomUpdateCache[key] = cache\n\t\troomUpdateCacheMut.Unlock()\n\t}\n\n\treturn o.doAfterUpdateHooks(exec)\n}", "title": "" }, { "docid": "9942417c4ac6d85b23d8cf0e801691e4", "score": "0.39747956", "text": "func (qs TaskQuerySet) UpdatedAtLte(updatedAt time.Time) TaskQuerySet {\n\treturn qs.w(qs.db.Where(\"updated_at <= ?\", updatedAt))\n}", "title": "" }, { "docid": "47c7565083b8695f21d613980e598c4a", "score": "0.39745504", "text": "func UpdateWikipediaLists(wikipediaSession wikipedia.Session, sleepTime time.Duration) {\n\tfor {\n\t\twikipediaSession.UpdateLists()\n\n\t\ttime.Sleep(sleepTime)\n\t}\n}", "title": "" } ]
d9d9ee061c7690362b533e5d8a2f71e0
Call is a single request handler called via client.Call or the generated client code
[ { "docid": "6e07a65c15fb028334a58c7665da32be", "score": "0.0", "text": "func (e *Example) GetImageCd(ctx context.Context, req *example.Request, rsp *example.Response) error {\n\tfmt.Println(\"获取图片验证码服务,GetImageCd...\")\n\t// 1.初始化返回值\n\trsp.Errno = utils.RECODE_OK\n\trsp.Errmsg = utils.RecodeText(rsp.Errno)\n\n\t// 2.生成随机数与图片\n\t//创建一个句柄\n\tcap := captcha.New()\n\t//设置字体\n\tif err := cap.SetFont(\"comic.ttf\"); err != nil {\n\t\t//抛出异常\n\t\tpanic(err.Error())\n\t}\n\t//设置突破大小\n\tcap.SetSize(90, 41)\n\t//设置干扰强度\n\tcap.SetDisturbance(captcha.MEDIUM)\n\t//设置前景色\n\tcap.SetFrontColor(color.RGBA{255, 255, 255, 255}, color.RGBA{0, 0, 0, 200})\n\t//设置背景色\n\tcap.SetBkgColor(color.RGBA{255, 0, 0, 255}, color.RGBA{0, 0, 255, 255}, color.RGBA{0, 153, 0, 255})\n\n\t//随即生成图片与验证码\n\timg, str := cap.Create(4, captcha.NUM)\n\t//打印字符串\n\tprintln(\"随机验证码为:\", str)\n\n\t// 3.连接redis\n\tbm, err := utils.RedisOpen(utils.G_server_name, utils.G_redis_addr,\n\t\tutils.G_redis_port, utils.G_redis_dbnum)\n\tif err != nil {\n\t\trsp.Errno = utils.RECODE_DBERR\n\t\trsp.Errmsg = utils.RecodeText(rsp.Errno)\n\t\treturn nil\n\t}\n\n\t// 4.存入数据\n\tbm.Put(req.Uuid, str, time.Second*300)\n\n\t// 5.将图片拆分,返回数据给web端\n\trgba := *((*img).RGBA)\n\t// 赋值数据给proto\n\t// pix\n\tfor _, value := range rgba.Pix {\n\t\trsp.Pix = append(rsp.Pix, uint32(value))\n\t}\n\t// stride\n\trsp.Stride = int64(rgba.Stride)\n\t// point\n\trsp.Min = &example.ResponsePoint{\n\t\tX: int64(rgba.Rect.Min.X),\n\t\tY: int64(rgba.Rect.Min.Y),\n\t}\n\trsp.Max = &example.ResponsePoint{\n\t\tX: int64(rgba.Rect.Max.X),\n\t\tY: int64(rgba.Rect.Max.Y),\n\t}\n\treturn nil\n}", "title": "" } ]
[ { "docid": "8af0af39b3d9dd55ab9a3b49fba7cbde", "score": "0.7532259", "text": "func Call(method string, req, resp interface{}) error { return DefaultClient.Call(method, req, resp) }", "title": "" }, { "docid": "e54ac37d0b5183c1206251f89f009493", "score": "0.72006893", "text": "func (client *Client) Call(serviceMethod string, args any, reply any) error {\n\tcall := <-client.Go(serviceMethod, args, reply, make(chan *Call, 1)).Done\n\treturn call.Error\n}", "title": "" }, { "docid": "76b31caaf861e2a35f4200e8153bd900", "score": "0.71785784", "text": "func (rc *rpcClient) Call(method string, args, reply interface{}) error {\n\treturn rc.client.Call(rc.prefix+\".\"+method, args, reply)\n}", "title": "" }, { "docid": "18611313b1bd6960d2eb85449a6397c0", "score": "0.7168369", "text": "func (c *Client) Call(method string, args interface{}, reply interface{}) error {\n\tcall := <-c.Go(method, args, reply, make(chan *Call, 1)).Done\n\treturn call.Error\n}", "title": "" }, { "docid": "b5a81991fdb01db99ff7b7bcbc0b0969", "score": "0.71586156", "text": "func (client *client) Call(serviceMethod string, args interface{}, reply interface{}) (err error) {\n\tcall := <-client.Go(serviceMethod, args, reply, make(chan *Call, 1)).Done\n\treturn call.Error\n}", "title": "" }, { "docid": "7d3ff3548151f08851690c3b8509cd52", "score": "0.71265644", "text": "func (client *Client) Call(ctx context.Context, serviceMethod string, args, reply interface{}) error {\r\n\tcall := client.Go(serviceMethod, args, reply, make(chan *Call, 1))\r\n\tselect {\r\n\tcase <-ctx.Done():\r\n\t\tclient.removeCall(call.Seq)\r\n\t\treturn errors.New(\"rpc client: call failed: \" + ctx.Err().Error())\r\n\tcase call := <-call.Done:\r\n\t\treturn call.Error\r\n\t}\r\n}", "title": "" }, { "docid": "e6058f421c16f514ca4086e9ee9f6792", "score": "0.70790565", "text": "func (e *MainService) Call(ctx context.Context, req *mainService.Request, rsp *mainService.Response) error {\n\tlog.Info(\"Received MainService.Call request\")\n\trsp.Msg = \"Hello \" + req.Name\n\treturn nil\n}", "title": "" }, { "docid": "22636e413c75bfbbff053a70c269eb1f", "score": "0.7033639", "text": "func (e *Idiomatic) Call(ctx context.Context, req *idiomatic.Request, rsp *idiomatic.Response) error {\n\tlog.Info(\"Received Idiomatic.Call request\")\n\trsp.Msg = \"Hello \" + req.Name\n\treturn nil\n}", "title": "" }, { "docid": "defbdbce94cce469c2853add48f2a4fd", "score": "0.70089155", "text": "func (client *Client) Call(serviceMethod string, args interface{}, reply interface{}, cfInfo ChainingFunctionInfo) {\n\t// call := <-client.Go(serviceMethod, args, reply, make(chan *Call, 1)).Done\n\t// fmt.Println(cfInfo)\n\tclient.Go(serviceMethod, args, reply, make(chan *Call, 1), cfInfo)\n\t// go func() {\n\t// \tfmt.Println(client.Go(serviceMethod, args, reply, make(chan *Call, 1)).Done)\n\t// }()\n\t// return call.Error\n}", "title": "" }, { "docid": "9e71c29f206c01de432377fd7522deaf", "score": "0.6995266", "text": "func (e *TestSrv) Call(ctx context.Context, req *testSrv.Request, rsp *testSrv.Response) error {\n\tlog.Log(\"Received TestSrv.Call request\")\n\trsp.Msg = \"Hello \" + req.Name\n\treturn nil\n}", "title": "" }, { "docid": "eeef484d0f56f5528a054af26764e0e0", "score": "0.69677293", "text": "func (c *Client) Call(dest peer.ID, svcName string, svcMethod string, args interface{}, reply interface{}) error {\n\tdone := make(chan *Call, 1)\n\tc.Go(dest, svcName, svcMethod, args, reply, done)\n\tcall := <-done\n\treturn call.Error\n}", "title": "" }, { "docid": "6ec970cae03c5fca43af5683b93a14d6", "score": "0.69171536", "text": "func (c *client) call(ctx context.Context, req, resp interface{}) error {\n\treturn soapCall(ctx, c.httpClient, c.url, c.securityHeader, req, nil, resp, c.httpLogWriter)\n}", "title": "" }, { "docid": "343c78846e0d36b158d3e8a6d8eb883e", "score": "0.6854015", "text": "func (p *ApiServiceClient) Call(ctx context.Context, service_name string, method string, params string, request_info string) (r string, err error) {\n var _args2 ApiServiceCallArgs\n _args2.ServiceName = service_name\n _args2.Method = method\n _args2.Params = params\n _args2.RequestInfo = request_info\n var _result3 ApiServiceCallResult\n if err = p.c.Call(ctx, \"call\", &_args2, &_result3); err != nil {\n return\n }\n return _result3.GetSuccess(), nil\n}", "title": "" }, { "docid": "3e0718bddc399631541cc5105a0ca445", "score": "0.6848253", "text": "func Call(id, method string, args ...interface{}) error {\n\treturn RawCall(context.Background(), id, method, 1, args...)\n}", "title": "" }, { "docid": "a82c548c2846873a90e2d77129602194", "score": "0.6833387", "text": "func Call(method string, req, res interface{}, caller Caller) error {\n\tctx, client, id := caller.CallContext()\n\n\tpayload, err := Normalize(req)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tbin, err := client.Call(ctx, id, method, payload)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tif res != nil {\n\t\terr = json.Unmarshal(bin, res)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "3350cf5a9c158cd67a2effa024ee3a9b", "score": "0.6832197", "text": "func ExampleClient_Call() {\n\tc := &Client{\"http://localhost/\"}\n\tvar i int64\n\terr := c.Call(&i, \"add\", 1, 2)\n\tif err != nil {\n\t\tswitch err.(type) {\n\t\tcase Fault:\n\t\t\t// function failed at server\n\t\tcase ProtocolError:\n\t\t\t// protocol botch between client & server\n\t\tdefault:\n\t\t\t// some other error\n\t\t}\n\t}\n\tfmt.Println(i)\n}", "title": "" }, { "docid": "3e84bcc923bb6ce53e7e159841781172", "score": "0.68282884", "text": "func (c *clientWrapper) Call(ctx context.Context, req client.Request, rsp interface{}, opts ...client.CallOption) error {\n\tif _, ok := c.cbs[req.Service()]; ok {\n\t\t_, err := c.cbs[req.Service()].Execute(func() (interface{}, error) {\n\t\t\tcerr := c.Client.Call(ctx, req, rsp, opts...)\n\t\t\treturn nil, cerr\n\t\t})\n\n\t\treturn err\n\t}\n\n\terr := c.Client.Call(ctx, req, rsp, opts...)\n\treturn err\n}", "title": "" }, { "docid": "d477728bdfc90ca95e32c2edf93fdedb", "score": "0.678265", "text": "func (r *GoinRPC) Call(res uint64 /*out param*/, funcName string, args ...interface{}) (err error) {\n\tfmt.Printf(\"Call -- %s %v\\n\", funcName, args)\n\treturn nil\n}", "title": "" }, { "docid": "92ef333e6683daa8d4094f5e5920df53", "score": "0.6765644", "text": "func (a *Client) call(c *Call, ctx context.Context) (*Response, error) {\n\tev := &Response{}\n\tresp, err := a.c.Do(c, ctx)\n\tif err != nil {\n\t\treturn ev, err\n\t}\n\terr = resp.Read(ev)\n\tresp.Close()\n\treturn ev, err\n}", "title": "" }, { "docid": "99f7bcc5f414e26a99a288f9b56887fc", "score": "0.67419505", "text": "func (c *Client) Call(method string, req, resp interface{}) error {\n\tt, err := c.transport()\n\tif err != nil {\n\t\treturn err\n\t}\n\n\treturn t.Call(method, req, resp)\n}", "title": "" }, { "docid": "036711e31266442196072dad38832554", "score": "0.6715075", "text": "func (cl *RPCClient) Call(rpcid uint64, args []byte, reply *[]byte) bool {\n\t*reply = make([]byte, 0)\n\te := cl.cl.Call(\"RPCHandler.Handle\", &grove_common.RawRPCRequest{RpcId: rpcid, Data: args}, reply)\n\tif e != nil {\n\t\tpanic(e)\n\t}\n\treturn false\n}", "title": "" }, { "docid": "813382ba9f8f011c2072b4b396a78549", "score": "0.6706", "text": "func (c *Client) Call(serviceMethod interface{}, args interface{}) (reply interface{}, err error) {\n\tr := request{Method: serviceMethod, Params: args}\n\n\tif c.Veo {\n\t\tr.ID = 2\n\t} else {\n\t\tc.seqmutex.Lock()\n\t\tc.seq++\n\t\tr.ID = c.seq\n\t\tc.seqmutex.Unlock()\n\t}\n\n\trawmsg, err := json.Marshal(r)\n\tif err != nil {\n\t\treturn\n\t}\n\tcall := c.registerRequest(r.ID)\n\tdefer c.cancelRequest(r.ID)\n\n\trawmsg = append(rawmsg, []byte(\"\\n\")...)\n\t_, err = c.socket.Write(rawmsg)\n\tlog.Print(\"[Stratum --->]\", string(rawmsg), \"err:\", err)\n\tif err != nil {\n\t\tc.poolstates = types.Sick\n\t\tlog.Print(\"Socket Write Error:\", err)\n\t\treturn\n\t}\n\t//Make sure the request is cancelled if no response is given\n\tgo func() {\n\t\ttime.Sleep(10 * time.Second)\n\t\tc.cancelRequest(r.ID)\n\t}()\n\treply = <-call\n\n\tif reply == nil {\n\t\terr = errors.New(\"Timeout\")\n\t\treturn\n\t}\n\terr, _ = reply.(error)\n\treturn\n}", "title": "" }, { "docid": "bed50c5c112d563d068c76aa2541f805", "score": "0.6667125", "text": "func (c *Hello) Call(ctx context.Context, req *hellopb.CallRequest) (*hellopb.CallResponse, error) {\n\tlog.Printf(\"Received Hello.Call request: %+v\", req)\n\treturn &hellopb.CallResponse{\n\t\tMsg: \"Hello \" + req.Name,\n\t\tTimestamp: ptypes.TimestampNow(),\n\t}, nil\n}", "title": "" }, { "docid": "5b8581b693b6b7c4cdae1b0c8020708e", "score": "0.6664534", "text": "func (e *UserService) Call(ctx context.Context, req *userService.Request, rsp *userService.Response) error {\n\tlog.Info(\"Received UserService.Call request\")\n\trsp.Msg = \"Hello \" + req.Name\n\treturn nil\n}", "title": "" }, { "docid": "8ac4541255ca15dccd50dfde569035bc", "score": "0.6662335", "text": "func (_Client *ClientCallerRaw) Call(opts *bind.CallOpts, result interface{}, method string, params ...interface{}) error {\n\treturn _Client.Contract.contract.Call(opts, result, method, params...)\n}", "title": "" }, { "docid": "746ae93aa9429c68b1b1ca003c58dbcf", "score": "0.66612124", "text": "func (t *HelloworldService) Call(request *CallRequest) (*CallResponse, error) {\n\trsp := &CallResponse{}\n\treturn rsp, t.client.Call(\"helloworld\", \"Call\", request, rsp)\n}", "title": "" }, { "docid": "14e1200450217ce27669f9b3c012ad1f", "score": "0.6660491", "text": "func (c *Client) Call(p Params, m ...string) (err error) {\n\tmethod, m := m[len(m)-1], m[:len(m)-1]\n\tpath := strings.Join(m, \"/\")\n\tif len(path) > 0 {\n\t\tpath += \"/\"\n\t}\n\n\tc.Method = method\n\tc.MethodPath = path\n\tc.Params = p\n\n\tc.payload, err = xml.MarshalIndent(c, \"\", \"\")\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tb, err := c.doRequest()\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tvar soap SoapEnvelope\n\terr = xml.Unmarshal(b, &soap)\n\n\tc.Body = soap.Body.Contents\n\n\treturn err\n}", "title": "" }, { "docid": "4c2f8e223ef855f0975d075f7afc8845", "score": "0.66502815", "text": "func (c *Client) Call(serviceMethod string, args ...interface{}) (interface{}, error) {\n\tcall := <-c.Go(serviceMethod, make(chan *Call, 1), args...).Done\n\treturn call.Reply, call.Error\n}", "title": "" }, { "docid": "c82fd865c0fadafd0df633ac71f0af56", "score": "0.65975255", "text": "func (c *Client) Call(ctx context.Context, method string, req, resp proto.Message) error {\n\tif method == \"\" {\n\t\treturn fmt.Errorf(\"must pass non-empty method arge\")\n\t}\n\tif req == nil {\n\t\treturn fmt.Errorf(\"must pass non-nil req arg\")\n\t}\n\tif resp == nil {\n\t\treturn fmt.Errorf(\"must pass non-nil resp arg\")\n\t}\n\n\tdata, err := c.marshalProto(req)\n\tif err != nil {\n\t\treturn err\n\t}\n\tdefer c.pool.Put(data)\n\n\tif c.maxSize > 0 {\n\t\tif len(*data) > int(c.maxSize) {\n\t\t\treturn fmt.Errorf(\"data has a size greater than your max size limit\")\n\t\t}\n\t}\n\n\tbuff := c.pool.Get()\n\tdefer c.pool.Put(buff)\n\n\tif err := c.rpc.Call(ctx, method, *data, buff); err != nil {\n\t\treturn err\n\t}\n\n\tif err := proto.Unmarshal(*buff, resp); err != nil {\n\t\treturn rpc.Errorf(rpc.ETBadData, \"could not unmarshal into response(%T):\\n%s\", resp, string(*buff))\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "a1089704ebbe88b27a1da26d19939738", "score": "0.65921634", "text": "func (_Ibchandler *IbchandlerCallerRaw) Call(opts *bind.CallOpts, result *[]interface{}, method string, params ...interface{}) error {\n\treturn _Ibchandler.Contract.contract.Call(opts, result, method, params...)\n}", "title": "" }, { "docid": "83668363b18104bb7d91a2e6f911cc6d", "score": "0.6591685", "text": "func (c *Client) Call(phone string, conversation string) (code int, body string, err error) {\n return c.post(\"call\", map[string]string{\"phone\": phone, \"conversation\": conversation})\n}", "title": "" }, { "docid": "d7ddf637516242b4f90d4aab50f6d3ed", "score": "0.65893257", "text": "func (_Client *ClientRaw) Call(opts *bind.CallOpts, result interface{}, method string, params ...interface{}) error {\n\treturn _Client.Contract.ClientCaller.contract.Call(opts, result, method, params...)\n}", "title": "" }, { "docid": "98fbbe2b24c67996344250415ab35dde", "score": "0.65778303", "text": "func (r Client) Call(l Logger, ret interface{}, url1 string) (err error) {\n\tresp, err := r.PostWith(l, url1, \"application/x-www-form-urlencoded\", nil, 0)\n\tif err != nil {\n\t\treturn err\n\t}\n\treturn callRet(l, ret, resp)\n}", "title": "" }, { "docid": "129a358cba9eb5d7999774a64a4f8391", "score": "0.6568707", "text": "func (b *OptionBuilder) Call() *Contract {\n\tb.option.ContractType = CALL\n\treturn b.option\n}", "title": "" }, { "docid": "ab47beef01921ad9775571f74649adfe", "score": "0.654165", "text": "func (_IServiceCoreEx *IServiceCoreExCallerRaw) Call(opts *bind.CallOpts, result interface{}, method string, params ...interface{}) error {\n\treturn _IServiceCoreEx.Contract.contract.Call(opts, result, method, params...)\n}", "title": "" }, { "docid": "c2ef563230334fdac0c98ce7b82fb342", "score": "0.65256095", "text": "func (c *PersistentCaller) Call(method string, args interface{}, reply interface{}) (err error) {\n\tstartTime := time.Now()\n\tdefer func() {\n\t\trecordRPCCost(startTime, method, err)\n\t}()\n\n\terr = c.initClient(method == route.DHTPing.String())\n\tif err != nil {\n\t\terr = errors.Wrap(err, \"init PersistentCaller client failed\")\n\t\treturn\n\t}\n\terr = c.client.Call(method, args, reply)\n\tif err != nil {\n\t\tif err == io.EOF ||\n\t\t\terr == io.ErrUnexpectedEOF ||\n\t\t\terr == io.ErrClosedPipe ||\n\t\t\terr == rpc.ErrShutdown ||\n\t\t\tstrings.Contains(strings.ToLower(err.Error()), \"shut down\") ||\n\t\t\tstrings.Contains(strings.ToLower(err.Error()), \"broken pipe\") {\n\t\t\t// if got EOF, retry once\n\t\t\treconnectErr := c.ResetClient(method)\n\t\t\tif reconnectErr != nil {\n\t\t\t\terr = errors.Wrap(reconnectErr, \"reconnect failed\")\n\t\t\t}\n\t\t}\n\t\terr = errors.Wrapf(err, \"call %s failed\", method)\n\t\treturn\n\t}\n\treturn\n}", "title": "" }, { "docid": "d53049306692ea83bded43b0a0799308", "score": "0.65186054", "text": "func (l *HomeTestProcess) Call(method string, body interface{}) (response interface{}, err error) {\n\tendpoint, exists := Endpoints[method]\n\tif !exists {\n\t\treturn response, errors.New(fmt.Sprintf(\"No matching endpoint found for method: %v\\n Valid Endpoints are: %v\\n\", method, Endpoints))\n\t}\n\tresponse, err = l.client(endpoint, body)\n\treturn response, err\n}", "title": "" }, { "docid": "ea620e0c8bbc735c0df8aeae66e1a59c", "score": "0.65011185", "text": "func (client *InternalClient) Call(req interface{}, res interface{}, timeout time.Duration) error {\n\tcall := client.Go(req, res, make(chan *Call, 1), MSG_TYPE_REQUEST)\n\tselect {\n\tcase <-call.Done:\n\t\treturn call.Error\n\tcase <-time.After(timeout):\n\t\tclient.RemovePendingOnCall(call)\n\t\treturn ErrTimeout\n\t}\n}", "title": "" }, { "docid": "b6709325e3bd5b6e0ff29a56da4b32ad", "score": "0.6499321", "text": "func (b *Browser) Call(ctx context.Context, sessionID, methodName string, params json.RawMessage) (res []byte, err error) {\n\tres, err = b.client.Call(ctx, sessionID, methodName, params)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tb.set(proto.TargetSessionID(sessionID), methodName, params)\n\n\treturn\n}", "title": "" }, { "docid": "7f36d8fdb9e21616bf93306382b93df9", "score": "0.6498753", "text": "func (_Random *RandomCallerRaw) Call(opts *bind.CallOpts, result *[]interface{}, method string, params ...interface{}) error {\n\treturn _Random.Contract.contract.Call(opts, result, method, params...)\n}", "title": "" }, { "docid": "6a5028240409fcf4f3d6f6ddf161b8fd", "score": "0.6480955", "text": "func (rc *rpcClient) Call(method string, args, reply interface{}) error {\n\tctx := context.Background()\n\ttimeout := rc.timeout\n\n\tswitch method {\n\tcase \"AddTransport\":\n\t\ttimeout = visorconfig.TransportRPCTimeout\n\tcase \"Update\":\n\t\ttimeout = visorconfig.UpdateRPCTimeout\n\t}\n\n\tif timeout != 0 {\n\t\tvar cancel context.CancelFunc\n\t\tctx, cancel = context.WithDeadline(ctx, time.Now().Add(timeout))\n\t\tdefer cancel()\n\t}\n\n\tselect {\n\tcase call := <-rc.client.Go(rc.prefix+\".\"+method, args, reply, nil).Done:\n\t\treturn call.Error\n\tcase <-ctx.Done():\n\t\tif err := rc.conn.Close(); err != nil {\n\t\t\trc.log.WithError(err).Warn(\"Failed to close rpc client after timeout error.\")\n\t\t}\n\t\treturn ctx.Err()\n\t}\n}", "title": "" }, { "docid": "d93b8d865142530b7ba263c77b9835b0", "score": "0.64758176", "text": "func (c *Client) Call(urlSuffix string, httpMethod string, payload []byte) ([]byte, error) {\n\tvar req *http.Request\n\tvar err error\n\n\tif len(payload) > 0 {\n\t\treq, err = http.NewRequest(httpMethod, fmt.Sprintf(\"%s%s\", BitlyBaseURL, urlSuffix), strings.NewReader(string(payload)))\n\t} else {\n\t\treq, err = http.NewRequest(httpMethod, fmt.Sprintf(\"%s%s\", BitlyBaseURL, urlSuffix), nil)\n\t}\n\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treq.Header.Add(\"authorization\", fmt.Sprintf(\"Bearer %s\", c.AccessToken))\n\n\tres, err := http.DefaultClient.Do(req)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tdefer res.Body.Close()\n\treturn ioutil.ReadAll(res.Body)\n}", "title": "" }, { "docid": "67696d5aae2eec348eb974c5ac93b93c", "score": "0.6471089", "text": "func (c *oneClient) Call(method string, args ...interface{}) (*response, error) {\n\tvar (\n\t\tok bool\n\n\t\tstatus bool\n\t\tbody string\n\t\tbodyInt int64\n\t)\n\n\tif c.xmlrpcClientError != nil {\n\t\treturn nil, fmt.Errorf(\"Unitialized client. Token: '%s', xmlrpcClient: '%s'\", c.token, c.xmlrpcClientError)\n\t}\n\n\tresult := []interface{}{}\n\n\txmlArgs := make([]interface{}, len(args)+1)\n\n\txmlArgs[0] = c.token\n\tcopy(xmlArgs[1:], args[:])\n\n\terr := c.xmlrpcClient.Call(method, xmlArgs, &result)\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\n\tstatus, ok = result[0].(bool)\n\tif ok == false {\n\t\tlog.Fatal(\"Unexpected XML-RPC response. Expected: Index 0 Boolean\")\n\t}\n\n\tbody, ok = result[1].(string)\n\tif ok == false {\n\t\tbodyInt, ok = result[1].(int64)\n\t\tif ok == false {\n\t\t\tlog.Fatal(\"Unexpected XML-RPC response. Expected: Index 0 Int or String\")\n\t\t}\n\t}\n\n\t// TODO: errCode? result[2]\n\n\tr := &response{status, body, int(bodyInt)}\n\n\tif status == false {\n\t\terr = errors.New(body)\n\t}\n\n\treturn r, err\n}", "title": "" }, { "docid": "f1d3bbacbb14d373a29245df473ad139", "score": "0.64696354", "text": "func (c *bufferedClient) Call(url string, endpoint string, method string, args []interface{}, reply []interface{}) (err error) {\n\t// Marshall args\n\tb := new(bytes.Buffer)\n\n\t// If no arguments are set, remove\n\tif len(args) > 0 {\n\t\tif err := codec.NewEncoder(b, c.handle.handle).Encode(args); err != nil {\n\t\t\treturn errors.Wrap(err, \"could not encode argument\")\n\t\t}\n\t}\n\n\t// Create request\n\t// Create post url\n\tpostURL := fmt.Sprintf(\"%s%s/%s\", url, endpoint, method)\n\n\trequest, errRequest := newRequest(postURL, c.handle.contentType, b, c.headers.Clone())\n\tif errRequest != nil {\n\t\treturn errRequest\n\t}\n\n\tresp, errDo := c.client.Do(request)\n\tif errDo != nil {\n\t\treturn errors.Wrap(errDo, \"could not execute request\")\n\t}\n\tdefer resp.Body.Close()\n\n\t// Check status\n\tif resp.StatusCode != http.StatusOK {\n\t\tbody, err := ioutil.ReadAll(resp.Body)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\treturn fmt.Errorf(\"%s: %s\", resp.Status, string(body))\n\t}\n\n\tresponseHandle := getHandlerForContentType(resp.Header.Get(\"Content-Type\")).handle\n\tif err := codec.NewDecoder(resp.Body, responseHandle).Decode(reply); err != nil {\n\t\treturn errors.Wrap(err, \"could not decode response from client\")\n\t}\n\n\treturn err\n}", "title": "" }, { "docid": "e7a6695c4dab426099f6f89a1a2a16e7", "score": "0.6466666", "text": "func (_Proxy *ProxyCallerRaw) Call(opts *bind.CallOpts, result *[]interface{}, method string, params ...interface{}) error {\n\treturn _Proxy.Contract.contract.Call(opts, result, method, params...)\n}", "title": "" }, { "docid": "8781c7ed34de8c6046614c7a4350faa0", "score": "0.6466331", "text": "func (r Client) Call(ret interface{}, url1 string) (err error) {\n\tresp, err := r.PostWith(url1, \"application/x-www-form-urlencoded\", nil, 0)\n\tif err != nil {\n\t\treturn err\n\t}\n\treturn callRet(ret, resp)\n}", "title": "" }, { "docid": "b2882c29bf3b5e2828421f0373bc2eb2", "score": "0.6442884", "text": "func (s *GoldRpcServer) Call(ctx context.Context, req *SyncRequest) (rsp *SyncResponse, err error) {\n\t// wrap the raw request\n\treqData := make(map[string]interface{})\n\terr = json.Unmarshal(req.Data.Data, &reqData)\n\tif err != nil {\n\t\treturn\n\t}\n\tgoldReq := &common.GoldRequest{\n\t\tInvoker: req.Data.Sender,\n\t\tTimeStamp: req.Data.Timestamp,\n\t\tData: reqData,\n\t}\n\tgoldRsp := &common.GoldResponse{}\n\terr = s.Function.OnHandle(goldReq, goldRsp)\n\tif err != nil {\n\t\t// the result suggests that shall we continue to run the code.\n\t\tctn := s.Function.OnError(err)\n\t\tif !ctn {\n\t\t\treturn\n\t\t} else {\n\t\t\terr = nil\n\t\t}\n\t}\n\tgoldRsp.TimeStamp = time.Now().Unix()\n\tgoldRsp.Handler = common.GetGoldEnv().PodName\n\t// transfer the response\n\tb, err := json.Marshal(&goldRsp.Data)\n\tif err != nil {\n\t\treturn\n\t}\n\td := &SyncData{\n\t\tData: b,\n\t\tSender: goldRsp.Handler,\n\t\tTimestamp: goldRsp.TimeStamp,\n\t}\n\trsp = &SyncResponse{Data: d}\n\treturn\n}", "title": "" }, { "docid": "64c5980046bd005d04bbbd7288bf00fc", "score": "0.64280576", "text": "func (_Ibchandler *IbchandlerRaw) Call(opts *bind.CallOpts, result *[]interface{}, method string, params ...interface{}) error {\n\treturn _Ibchandler.Contract.IbchandlerCaller.contract.Call(opts, result, method, params...)\n}", "title": "" }, { "docid": "fc86efd5036b8c3051baa6b9e3b0f75c", "score": "0.64276546", "text": "func (c *Client) Call(method string, params ...interface{}) (interface{}, error) {\n\treq := protocol.Request{\n\t\tMethod: method,\n\t\tParams: utils.ParamsFormat(params...),\n\t}\n\tresp, err := c.Send(&req)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tif resp.Error != nil {\n\t\treturn nil, resp.Error\n\t}\n\treturn resp.Body, nil\n}", "title": "" }, { "docid": "5fb673247ed5f532c9ac31a06bbc36ec", "score": "0.64237493", "text": "func (_RegistryClient *RegistryClientCallerRaw) Call(opts *bind.CallOpts, result interface{}, method string, params ...interface{}) error {\n\treturn _RegistryClient.Contract.contract.Call(opts, result, method, params...)\n}", "title": "" }, { "docid": "2f31131aa3b6ecef9e45c6d60e886cb5", "score": "0.6413234", "text": "func (_IServiceCoreEx *IServiceCoreExRaw) Call(opts *bind.CallOpts, result interface{}, method string, params ...interface{}) error {\n\treturn _IServiceCoreEx.Contract.IServiceCoreExCaller.contract.Call(opts, result, method, params...)\n}", "title": "" }, { "docid": "d82c44567a43687d9b4cbb674903978c", "score": "0.6412588", "text": "func (_Proxy *ProxyCallerRaw) Call(opts *bind.CallOpts, result interface{}, method string, params ...interface{}) error {\n\treturn _Proxy.Contract.contract.Call(opts, result, method, params...)\n}", "title": "" }, { "docid": "41e550d99a73205088d3dd40b19327ad", "score": "0.6388579", "text": "func (_Subscribe *SubscribeCallerRaw) Call(opts *bind.CallOpts, result interface{}, method string, params ...interface{}) error {\n\treturn _Subscribe.Contract.contract.Call(opts, result, method, params...)\n}", "title": "" }, { "docid": "19360848efe4bb7e8a05bb7eb0f887cc", "score": "0.6383325", "text": "func (_Sampel *SampelCallerRaw) Call(opts *bind.CallOpts, result interface{}, method string, params ...interface{}) error {\n\treturn _Sampel.Contract.contract.Call(opts, result, method, params...)\n}", "title": "" }, { "docid": "8abf021b1514c72f9a0ae0eef35c3ecb", "score": "0.637706", "text": "func (client *HTTPjsonRPCClient) Call(ctx *context.Context, serviceMethod string, args interface{}, reply interface{}) (err error) {\n\tclient.id++\n\tid := client.id\n\tvar data []byte\n\tif data, err = json.Marshal(map[string]interface{}{\n\t\t\"method\": serviceMethod,\n\t\t\"id\": client.id,\n\t\t\"params\": [1]interface{}{args},\n\t}); err != nil {\n\t\treturn\n\t}\n\n\tvar req *http.Request\n\treq, err = http.NewRequestWithContext(ctx, http.MethodPost, client.url, io.NopCloser(bytes.NewBuffer(data)))\n\tif err != nil {\n\t\treturn\n\t}\n\treq.Header.Set(\"Content-Type\", \"application/json\")\n\tvar resp *http.Response\n\tif resp, err = client.httpClient.Do(req); err != nil {\n\t\treturn\n\t}\n\tdefer resp.Body.Close()\n\tvar jsonRsp JSONrpcResponse\n\tif err = json.NewDecoder(resp.Body).Decode(&jsonRsp); err != nil {\n\t\treturn\n\t}\n\tif jsonRsp.ID != id {\n\t\treturn ErrReqUnsynchronized\n\t}\n\tif jsonRsp.Error != nil || jsonRsp.Result == nil {\n\t\tx, ok := jsonRsp.Error.(string)\n\t\tif !ok {\n\t\t\treturn fmt.Errorf(\"invalid error %v\", jsonRsp.Error)\n\t\t}\n\t\tif x == \"\" {\n\t\t\tx = \"unspecified error\"\n\t\t}\n\t\treturn errors.New(x)\n\t}\n\treturn json.Unmarshal(*jsonRsp.Result, reply)\n}", "title": "" }, { "docid": "974f8f69242091772f54a4c83c27862d", "score": "0.6371268", "text": "func (_Protocol *ProtocolCallerRaw) Call(opts *bind.CallOpts, result interface{}, method string, params ...interface{}) error {\n\treturn _Protocol.Contract.contract.Call(opts, result, method, params...)\n}", "title": "" }, { "docid": "974f8f69242091772f54a4c83c27862d", "score": "0.6371268", "text": "func (_Protocol *ProtocolCallerRaw) Call(opts *bind.CallOpts, result interface{}, method string, params ...interface{}) error {\n\treturn _Protocol.Contract.contract.Call(opts, result, method, params...)\n}", "title": "" }, { "docid": "52f2f746a4080e75d3481a2a5a55fc67", "score": "0.6369296", "text": "func (_Htlc *HtlcCallerRaw) Call(opts *bind.CallOpts, result interface{}, method string, params ...interface{}) error {\n\treturn _Htlc.Contract.contract.Call(opts, result, method, params...)\n}", "title": "" }, { "docid": "6dbb2783633d4ed5df16e0d677f29f45", "score": "0.6354442", "text": "func (_Router *RouterCallerRaw) Call(opts *bind.CallOpts, result *[]interface{}, method string, params ...interface{}) error {\n\treturn _Router.Contract.contract.Call(opts, result, method, params...)\n}", "title": "" }, { "docid": "76f016d253e38291e3fbf0cecfc87a89", "score": "0.63524693", "text": "func (c *Client) Call(ctx context.Context, proc Procedure) error {\n\t// check context\n\tif ctx == nil {\n\t\tctx = context.Background()\n\t}\n\n\t// get meta\n\tmeta := GetMeta(proc)\n\n\t// trace request\n\tctx, span := xo.Trace(ctx, \"CALL \"+meta.Name)\n\tdefer span.End()\n\n\t// pre validate\n\terr := proc.Validate()\n\tif err != nil {\n\t\treturn xo.W(err)\n\t}\n\n\t// prepare url\n\turl := fmt.Sprintf(\"%s/%s\", strings.TrimRight(c.baseURL, \"/\"), meta.Name)\n\n\t// encode procedure\n\tbuf, err := meta.Coding.Marshal(proc)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// TODO: Set trace headers.\n\n\t// create request\n\treq, err := http.NewRequestWithContext(ctx, \"POST\", url, bytes.NewReader(buf))\n\tif err != nil {\n\t\treturn xo.W(err)\n\t}\n\n\t// set content type\n\treq.Header.Set(\"Content-Type\", meta.Coding.MimeType())\n\n\t// perform request\n\tres, err := c.httpClient.Do(req)\n\tif err != nil {\n\t\treturn xo.W(err)\n\t}\n\n\t// ensure body is closed\n\tdefer res.Body.Close()\n\n\t// read body\n\tbody, err := io.ReadAll(res.Body)\n\tif err != nil {\n\t\treturn xo.W(err)\n\t}\n\n\t// check code\n\tif res.StatusCode != 200 {\n\t\t// unmarshal error\n\t\tvar rpcError Error\n\t\terr = meta.Coding.Unmarshal(body, &rpcError)\n\t\tif err != nil {\n\t\t\treturn xo.W(ErrorFromStatus(res.StatusCode, \"\"))\n\t\t}\n\n\t\treturn xo.W(&rpcError)\n\t}\n\n\t// decode response\n\terr = meta.Coding.Unmarshal(body, proc)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// set response flag\n\tproc.GetBase().Response = true\n\n\t// post validate\n\terr = proc.Validate()\n\tif err != nil {\n\t\treturn xo.W(err)\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "f366dda56a8d2686028278999bd1e497", "score": "0.6351282", "text": "func Call(ctx Context, service, method string, in Reader, out Writer) error {\n\tcaller, ok := ctx.Value(contextKeyCaller).(Caller)\n\tif !ok {\n\t\treturn errors.New(\"call: no caller on context\")\n\t}\n\treturn caller(ctx, service, method, in, out)\n}", "title": "" }, { "docid": "6ec68ea79019f9a74ba65081970d9aff", "score": "0.6349435", "text": "func (_Eventer *EventerCallerRaw) Call(opts *bind.CallOpts, result *[]interface{}, method string, params ...interface{}) error {\n\treturn _Eventer.Contract.contract.Call(opts, result, method, params...)\n}", "title": "" }, { "docid": "d84eab628c75aee525b0fd5a821b062e", "score": "0.6335348", "text": "func (m ServiceWorkerDispatchSyncEvent) Call(c Client) error {\n\treturn call(m.ProtoReq(), m, nil, c)\n}", "title": "" }, { "docid": "e7e2f9866b3f0eb69ac42f198c6e1750", "score": "0.6329293", "text": "func (e *Template) Call(ctx context.Context, req *template.Request, rsp *template.Response) error {\n\trsp.Msg = \"Hello \" + req.Name\n\tlogutil.BgLogger().Info(\"Received Template.Call request\", zap.String(\"rsp.Msg\", rsp.Msg))\n\treturn nil\n}", "title": "" }, { "docid": "b43ee1a72ca59c853595a189a7860ebe", "score": "0.63291913", "text": "func (_e *A_Expecter) Call() *A_Call_Call {\n\treturn &A_Call_Call{Call: _e.mock.On(\"Call\")}\n}", "title": "" }, { "docid": "4f23f59589ee4705c0553c258922014b", "score": "0.6328958", "text": "func (_Proxy *ProxyRaw) Call(opts *bind.CallOpts, result *[]interface{}, method string, params ...interface{}) error {\n\treturn _Proxy.Contract.ProxyCaller.contract.Call(opts, result, method, params...)\n}", "title": "" }, { "docid": "33decb4a1ba741324afec37db0f16509", "score": "0.6325231", "text": "func (c *Client) makeCall(call *Call) {\n\tlogger.Debugf(\"makeCall: %s.%s\",\n\t\tcall.SvcID.Name,\n\t\tcall.SvcID.Method)\n\n\t// Handle local RPC calls\n\tif call.Dest == \"\" || call.Dest == c.host.ID() {\n\t\tlogger.Debugf(\"local call: %s.%s\",\n\t\t\tcall.SvcID.Name, call.SvcID.Method)\n\t\tif c.server == nil {\n\t\t\terr := errors.New(\n\t\t\t\t\"Cannot make local calls: server not set\")\n\t\t\tlogger.Error(err)\n\t\t\tcall.Error = err\n\t\t\tcall.done()\n\t\t\treturn\n\t\t}\n\t\terr := c.server.Call(call)\n\t\tcall.Error = err\n\t\tif err != nil {\n\t\t\tlogger.Error(err)\n\t\t}\n\t\tcall.done()\n\t\treturn\n\t}\n\n\t// Handle remote RPC calls\n\tif c.host == nil {\n\t\tpanic(\"no host set: cannot perform remote call\")\n\t}\n\tif c.protocol == \"\" {\n\t\tpanic(\"no protocol set: cannot perform remote call\")\n\t}\n\tc.send(call)\n}", "title": "" }, { "docid": "8c85e412d75ae23930e16c3fdd47f161", "score": "0.63224065", "text": "func (_ISignatureValidator *ISignatureValidatorCallerRaw) Call(opts *bind.CallOpts, result *[]interface{}, method string, params ...interface{}) error {\n\treturn _ISignatureValidator.Contract.contract.Call(opts, result, method, params...)\n}", "title": "" }, { "docid": "b4e743d46b98ed65bef8ba4665279404", "score": "0.6320235", "text": "func (i *pluginInstance) Call(endpoint plugin.Endpoint, message, result interface{}) ([]byte, error) {\n\treturn i.client.Call(endpoint, message, result)\n}", "title": "" }, { "docid": "650ec8728a3c8d99a1d958db25704943", "score": "0.63103616", "text": "func (e *GetArea) Call(ctx context.Context, req *getArea.Request, rsp *getArea.Response) error {\n\tlog.Log(\"Received GetArea.Call request\")\n\trsp.Errmsg = \"Hello \" + req.Name\n\treturn nil\n}", "title": "" }, { "docid": "8ae3aeb9f882b118b01efb5cda5fcb34", "score": "0.6308514", "text": "func (_RandomNumber *RandomNumberCallerRaw) Call(opts *bind.CallOpts, result *[]interface{}, method string, params ...interface{}) error {\n\treturn _RandomNumber.Contract.contract.Call(opts, result, method, params...)\n}", "title": "" }, { "docid": "67679497171c7922f2d3db62d4f71717", "score": "0.63045603", "text": "func (peer *Peer) Call(method string, args interface{}, reply interface{}) error {\n\tcall, err := peer.OpenCall(peer.NextPeer(), method, args, reply)\n\tif err != nil {\n\t\treturn err\n\t}\n\treturn (<-call.Done).Error\n}", "title": "" }, { "docid": "afe65d1636aa2d190805d938934fb0c9", "score": "0.6295134", "text": "func simpleCall(cmd string) {\n\tclient := connect()\n\tvar in rfkrpc.In\n\tvar out rfkrpc.Out\n\terr := client.Call(cmd, in, &out)\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n}", "title": "" }, { "docid": "ac40112e68abf5feb59ed1bafec9b0f3", "score": "0.6292127", "text": "func (_Singleton *SingletonCallerRaw) Call(opts *bind.CallOpts, result *[]interface{}, method string, params ...interface{}) error {\n\treturn _Singleton.Contract.contract.Call(opts, result, method, params...)\n}", "title": "" }, { "docid": "1971fb0eec8f3f1946dd2d717897740f", "score": "0.6291579", "text": "func (_ISignatureValidator *ISignatureValidatorRaw) Call(opts *bind.CallOpts, result *[]interface{}, method string, params ...interface{}) error {\n\treturn _ISignatureValidator.Contract.ISignatureValidatorCaller.contract.Call(opts, result, method, params...)\n}", "title": "" }, { "docid": "ba202b8eee430cc1132014c2aa4cb7b0", "score": "0.6288806", "text": "func (_Abimarket *AbimarketCallerRaw) Call(opts *bind.CallOpts, result *[]interface{}, method string, params ...interface{}) error {\n\treturn _Abimarket.Contract.contract.Call(opts, result, method, params...)\n}", "title": "" }, { "docid": "cb0623f41a68a378f1ca615ab2ed60b9", "score": "0.62854713", "text": "func (_Onepay *OnepayCallerRaw) Call(opts *bind.CallOpts, result interface{}, method string, params ...interface{}) error {\n\treturn _Onepay.Contract.contract.Call(opts, result, method, params...)\n}", "title": "" }, { "docid": "08948f2b4412d8ae705a9f68dc48e025", "score": "0.6282376", "text": "func (s *PluginRPCServer) Call(args *ArgsCall, resp *RespCall) error {\n\tres, err := s.Impl.Call(args.Tag, args.Command, args.Options)\n\tif err != nil {\n\t\tresp.Err = s.newError(err)\n\t\treturn nil\n\t}\n\tresp.Response = res\n\treturn nil\n}", "title": "" }, { "docid": "a3c80f869fb386bb9c87df4c78db464b", "score": "0.62800735", "text": "func (c *RPCClient) Call(req *RPCMessage, res RPCResponse) error {\n\tif res == nil {\n\t\tres = &RPCMessage{}\n\t}\n\tapi := req.API\n\tmethod := req.Method\n\tif req.AuthToken == \"\" {\n\t\treq.AuthToken = c.AuthToken\n\t}\n\n\taddress := c.Router.GetAddress(api)\n\n\t// u := address + strings.TrimSuffix(api, \"_api\") + \"/\" + method\n\tu := strings.TrimSuffix(api, \"_api\") + \".\" + method + \"()\"\n\tlogrus.Infof(\"✈️ RPC: %s Request: %+v\", u, req.Params)\n\n\tconn := c.RPC.GetConnection(address)\n\terr := conn.Call(req, res)\n\tif err != nil {\n\t\tlogrus.Errorf(\"⚠️ RPC: %s Call failed: %s\", u, err)\n\t\treturn err\n\t}\n\n\tr := res.Response()\n\tif r.Error != nil {\n\t\tlogrus.Errorf(\"⚠️ RPC: %s Response Error: Code=%s Message=%s\", u, r.Error.RPCCode, r.Error.Message)\n\t\treturn r.Error\n\t}\n\n\tlogrus.Infof(\"✅ RPC: %s Response OK: took %.1fms\", u, r.Took)\n\treturn nil\n}", "title": "" }, { "docid": "b5c92f27792e2f810a7a2bf6eb552d7f", "score": "0.6279677", "text": "func (_Pancake *PancakeCallerRaw) Call(opts *bind.CallOpts, result *[]interface{}, method string, params ...interface{}) error {\n\treturn _Pancake.Contract.contract.Call(opts, result, method, params...)\n}", "title": "" }, { "docid": "eccbe4317fcc9903d3c22157519774e6", "score": "0.62700754", "text": "func (_Proxy *ProxyRaw) Call(opts *bind.CallOpts, result interface{}, method string, params ...interface{}) error {\n\treturn _Proxy.Contract.ProxyCaller.contract.Call(opts, result, method, params...)\n}", "title": "" }, { "docid": "54907452deb192468e6881a2dd0dc77b", "score": "0.6267025", "text": "func (ovsdb *OVSDB) Call(method string, args interface{}, idref *uint64) (json.RawMessage, error) {\n\tif ovsdb.synchronize != nil && ovsdb.synchronize.WaitConnected() {\n\t\treturn nil, errors.New(\"no connection\")\n\t}\n\n\tid := ovsdb.GetCounter()\n\tif idref != nil {\n\t\t*idref = id\n\t}\n\n\t// create RPC request\n\treq := map[string]interface{}{\n\t\t\"method\": method,\n\t\t\"params\": args,\n\t\t\"id\": id,\n\t}\n\n\tch := make(chan int, 1)\n\n\t// store channel in list to pass it to receiver loop\n\tovsdb.pendingMutex.Lock()\n\tovsdb.pending[id] = &Pending{\n\t\tchannel: ch,\n\t}\n\tovsdb.pendingMutex.Unlock()\n\n\t// send message\n\terr := ovsdb.encodeWrapper(req)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\t// block function\n\t<-ch\n\n\tovsdb.pendingMutex.Lock()\n\tif ovsdb.pending[id].connectionClosed {\n\t\tovsdb.pendingMutex.Unlock()\n\t\treturn nil, errors.New(\"connection closed\")\n\t}\n\n\t// transaction error always is null, OVSDB errors for transactions are handled later\n\tif ovsdb.pending[id].error != nil {\n\t\tvar err2 Error\n\n\t\tjson.Unmarshal(*ovsdb.pending[id].error, &err2)\n\n\t\tdelete(ovsdb.pending, id)\n\n\t\tovsdb.pendingMutex.Unlock()\n\t\treturn nil, errors.New(err2.Error + \": \" + err2.Details + \" (\" + err2.Syntax + \")\" )\n\t}\n\n\tresponse := ovsdb.pending[id].response\n\tdelete(ovsdb.pending, id)\n\n\tovsdb.pendingMutex.Unlock()\n\treturn *response, nil\n}", "title": "" }, { "docid": "ca3bf496fb5c5bea855c375072a5e899", "score": "0.62652487", "text": "func (_Tellor *TellorCallerRaw) Call(opts *bind.CallOpts, result interface{}, method string, params ...interface{}) error {\n\treturn _Tellor.Contract.contract.Call(opts, result, method, params...)\n}", "title": "" }, { "docid": "41b6d30deb4b27a0a5164b47a60aa2ad", "score": "0.6262317", "text": "func (_TopLevel *TopLevelCallerRaw) Call(opts *bind.CallOpts, result *[]interface{}, method string, params ...interface{}) error {\n\treturn _TopLevel.Contract.contract.Call(opts, result, method, params...)\n}", "title": "" }, { "docid": "c16f4121bf59b2d41fda1a7bf20defe0", "score": "0.62326086", "text": "func (r Client) GetCall(l Logger, ret interface{}, url1 string) (err error) {\n\tresp, err := r.Get(l, url1)\n\tif err != nil {\n\t\treturn err\n\t}\n\treturn callRet(l, ret, resp)\n}", "title": "" }, { "docid": "9dd4ae5e6c83d134e87ac43db345fce3", "score": "0.62312514", "text": "func (_OneStepProof *OneStepProofCallerRaw) Call(opts *bind.CallOpts, result interface{}, method string, params ...interface{}) error {\n\treturn _OneStepProof.Contract.contract.Call(opts, result, method, params...)\n}", "title": "" }, { "docid": "d5df292da5f4cab718000c77349796ec", "score": "0.6229558", "text": "func (_Dosproxy *DosproxyCallerRaw) Call(opts *bind.CallOpts, result *[]interface{}, method string, params ...interface{}) error {\n\treturn _Dosproxy.Contract.contract.Call(opts, result, method, params...)\n}", "title": "" }, { "docid": "8dc2aac3abab8f33ecfe0009aa7df11b", "score": "0.6228438", "text": "func (_Utils *UtilsCallerRaw) Call(opts *bind.CallOpts, result interface{}, method string, params ...interface{}) error {\n\treturn _Utils.Contract.contract.Call(opts, result, method, params...)\n}", "title": "" }, { "docid": "23d93a57313719e20cf92d031ca1fa29", "score": "0.6225526", "text": "func (_PMintyMultiSale *PMintyMultiSaleCallerRaw) Call(opts *bind.CallOpts, result *[]interface{}, method string, params ...interface{}) error {\n\treturn _PMintyMultiSale.Contract.contract.Call(opts, result, method, params...)\n}", "title": "" }, { "docid": "ec82b2777dc68535db4a985991064413", "score": "0.622386", "text": "func (_Protocol *ProtocolRaw) Call(opts *bind.CallOpts, result interface{}, method string, params ...interface{}) error {\n\treturn _Protocol.Contract.ProtocolCaller.contract.Call(opts, result, method, params...)\n}", "title": "" }, { "docid": "ec82b2777dc68535db4a985991064413", "score": "0.622386", "text": "func (_Protocol *ProtocolRaw) Call(opts *bind.CallOpts, result interface{}, method string, params ...interface{}) error {\n\treturn _Protocol.Contract.ProtocolCaller.contract.Call(opts, result, method, params...)\n}", "title": "" }, { "docid": "7fdf908af1ad17dac9bd0d5b71834ca1", "score": "0.62228376", "text": "func (_TellorDispute *TellorDisputeCallerRaw) Call(opts *bind.CallOpts, result interface{}, method string, params ...interface{}) error {\n\treturn _TellorDispute.Contract.contract.Call(opts, result, method, params...)\n}", "title": "" }, { "docid": "d632be5b9abe02c4eaa3cca4285c6a93", "score": "0.62107384", "text": "func (api *API) Call(service, function string, params utils.M, timeout int) (*model.Response, error) {\n\treturn api.config.Transport.Call(context.TODO(), api.config.Token, service, function, params, timeout)\n}", "title": "" }, { "docid": "3b9d7f7cdc5a329e2778f7e02a23c0c4", "score": "0.62072915", "text": "func (_Context *ContextCallerRaw) Call(opts *bind.CallOpts, result *[]interface{}, method string, params ...interface{}) error {\n\treturn _Context.Contract.contract.Call(opts, result, method, params...)\n}", "title": "" }, { "docid": "2afde7d00a7ca057913e5f272ec92082", "score": "0.6207118", "text": "func (_TomoValidator *TomoValidatorCallerRaw) Call(opts *bind.CallOpts, result interface{}, method string, params ...interface{}) error {\n\treturn _TomoValidator.Contract.contract.Call(opts, result, method, params...)\n}", "title": "" }, { "docid": "e2967de17f55b5171b361d6716e201eb", "score": "0.6206172", "text": "func (gs *goGenServ) HandleCall(from *etf.Tuple, message *etf.Term, state interface{}) (code int, reply *etf.Term, stateout interface{}) {\n\tfmt.Printf(\"HandleCall: %#v, From: %#v (unhandled)\\n\", *message, *from)\n\tstateout = state\n\tcode = 0\n\treturn\n}", "title": "" }, { "docid": "e1cecd4d0116faf66231a430cdda6566", "score": "0.6204941", "text": "func (_Common *CommonCallerRaw) Call(opts *bind.CallOpts, result *[]interface{}, method string, params ...interface{}) error {\n\treturn _Common.Contract.contract.Call(opts, result, method, params...)\n}", "title": "" }, { "docid": "230269271d47f90bd3f29c7622e81a71", "score": "0.6204909", "text": "func (_RegistryClient *RegistryClientRaw) Call(opts *bind.CallOpts, result interface{}, method string, params ...interface{}) error {\n\treturn _RegistryClient.Contract.RegistryClientCaller.contract.Call(opts, result, method, params...)\n}", "title": "" }, { "docid": "1234f0d44c7c8aa2c24756db5bfae977", "score": "0.6201423", "text": "func (_Bindings *BindingsCallerRaw) Call(opts *bind.CallOpts, result interface{}, method string, params ...interface{}) error {\n\treturn _Bindings.Contract.contract.Call(opts, result, method, params...)\n}", "title": "" }, { "docid": "97e35b5ec90f2aab7e3ac3221218d683", "score": "0.6196868", "text": "func (fc facadeCaller) FacadeCall(request string, params, response interface{}) error {\n\treturn fc.caller.APICall(\n\t\tfc.facadeName, fc.bestVersion, \"\",\n\t\trequest, params, response)\n}", "title": "" }, { "docid": "1ab72548145b8f01670a5c01145f2f40", "score": "0.619446", "text": "func (_Crowdsale *CrowdsaleCallerRaw) Call(opts *bind.CallOpts, result interface{}, method string, params ...interface{}) error {\n\treturn _Crowdsale.Contract.contract.Call(opts, result, method, params...)\n}", "title": "" } ]
6f6bec27dba0f8f753496dc19b6d0723
DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new StackList.
[ { "docid": "89a0ef53e351b83c8211fe1bab22ebf8", "score": "0.85889155", "text": "func (in *StackList) DeepCopy() *StackList {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(StackList)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" } ]
[ { "docid": "0e6ed308f110c29b7480565a5f8f5181", "score": "0.7729224", "text": "func (in *LokiStackList) DeepCopy() *LokiStackList {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(LokiStackList)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "a1dab41bca2b6b627fe81792a6ab429c", "score": "0.65859646", "text": "func (in *StatefulSetList) DeepCopy() *StatefulSetList {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(StatefulSetList)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "b06e0c7794e694da7b50365ef5f4b7bc", "score": "0.6567817", "text": "func (in *Stack) DeepCopy() *Stack {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(Stack)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "1d99264099b0e339c621a7163b42c92f", "score": "0.6476843", "text": "func (in *SliceList) DeepCopy() *SliceList {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(SliceList)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "761d6c4a28a6fa5af659ad02190d0d49", "score": "0.6327741", "text": "func (in *FridgeList) DeepCopy() *FridgeList {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(FridgeList)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "6b587cb40a70680f9a5ded728c55703d", "score": "0.63201606", "text": "func (in *StoragePoolList) DeepCopy() *StoragePoolList {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(StoragePoolList)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "61cfdc65cbf33b05b83a8a53588954cf", "score": "0.6310324", "text": "func (in *SubnetworkList) DeepCopy() *SubnetworkList {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(SubnetworkList)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "4794a3a07a9805d06e2f0cee99a72afd", "score": "0.62018496", "text": "func (in *QueueList) DeepCopy() *QueueList {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(QueueList)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "576d6218d26276249e55a7547cd32fd6", "score": "0.61751705", "text": "func (in *PoolList) DeepCopy() *PoolList {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(PoolList)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "123249e57354765b42a5eb64048571ff", "score": "0.6174574", "text": "func (in *ImageTagMirrorSetList) DeepCopy() *ImageTagMirrorSetList {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(ImageTagMirrorSetList)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "c2d7b3aa64428db62e4920819b7cd48a", "score": "0.6159641", "text": "func (in *SplunkForwarderList) DeepCopy() *SplunkForwarderList {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(SplunkForwarderList)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "793c196076e7e3a86beb18458da44901", "score": "0.6156024", "text": "func (in *CloudformationList) DeepCopy() *CloudformationList {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(CloudformationList)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "951445500f902823f0b9d495a8a32cf0", "score": "0.6092199", "text": "func (in *GameStatefulSetList) DeepCopy() *GameStatefulSetList {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(GameStatefulSetList)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "5670a402cdf0a900869d9a44a7d465a2", "score": "0.6081376", "text": "func (in *MembershipList) DeepCopy() *MembershipList {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(MembershipList)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "11a94803919c965cf065c989980eef1d", "score": "0.6061564", "text": "func (in *SecurityList) DeepCopy() *SecurityList {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(SecurityList)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "27ea97af541df1abdc52a1190da36770", "score": "0.6057193", "text": "func (in *StateMachineList) DeepCopy() *StateMachineList {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(StateMachineList)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "d9510f761fc05630dadfa92f3fd3d858", "score": "0.6046589", "text": "func (in *ObjectSliceList) DeepCopy() *ObjectSliceList {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(ObjectSliceList)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "9ce76d6698d7dcf8dcbc30dd51c709a4", "score": "0.5997204", "text": "func (in *VarnishList) DeepCopy() *VarnishList {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(VarnishList)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "899e57346b4289a3a8bdd9d05c20ec89", "score": "0.5984557", "text": "func (in *SubnetGroupList) DeepCopy() *SubnetGroupList {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(SubnetGroupList)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "d81e95373598432a985e54d72e5834f6", "score": "0.5978214", "text": "func (in *ConsoleList) DeepCopy() *ConsoleList {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(ConsoleList)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "8be93d7601a6e5e520abb91ffb76d022", "score": "0.5974095", "text": "func (in *SiteList) DeepCopy() *SiteList {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(SiteList)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "f1d8c8592fab56e35ab0c95fc1d35a16", "score": "0.596575", "text": "func (in *NetworkList) DeepCopy() *NetworkList {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(NetworkList)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "f1d8c8592fab56e35ab0c95fc1d35a16", "score": "0.596575", "text": "func (in *NetworkList) DeepCopy() *NetworkList {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(NetworkList)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "f1d8c8592fab56e35ab0c95fc1d35a16", "score": "0.596575", "text": "func (in *NetworkList) DeepCopy() *NetworkList {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(NetworkList)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "3d611bea2c02421c2381edd1491d9760", "score": "0.5949868", "text": "func (in *StackElements) DeepCopy() *StackElements {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(StackElements)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "e8a5b149048798c3e048dbc1ae156c3c", "score": "0.59496397", "text": "func (in *SpaceList) DeepCopy() *SpaceList {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(SpaceList)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "ccbd62c5b30968ab53e4f1f0b5e5153b", "score": "0.593902", "text": "func (in *CStorPoolList) DeepCopy() *CStorPoolList {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(CStorPoolList)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "749d168cd64d062d806fd56894c032c6", "score": "0.59360164", "text": "func (in *DNSList) DeepCopy() *DNSList {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(DNSList)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "18a05c752e630a1d876fff2c3536fc7b", "score": "0.59270567", "text": "func (in *ModelPackagingList) DeepCopy() *ModelPackagingList {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(ModelPackagingList)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "9a3b4593924636f02e9314bc9c48fd87", "score": "0.59214246", "text": "func (in *SubnetList) DeepCopy() *SubnetList {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(SubnetList)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "004c44307d3eb3335ecc1f0e52850a52", "score": "0.5916565", "text": "func (in *TemplateList) DeepCopy() *TemplateList {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(TemplateList)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "004c44307d3eb3335ecc1f0e52850a52", "score": "0.5916565", "text": "func (in *TemplateList) DeepCopy() *TemplateList {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(TemplateList)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "c9cf578956dd098581f4fcde596c2216", "score": "0.59059733", "text": "func (in *CloneSetList) DeepCopy() *CloneSetList {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(CloneSetList)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "ce2af28a2425544a6799c558deef946c", "score": "0.5898821", "text": "func (in *BundleList) DeepCopy() *BundleList {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(BundleList)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "ce2af28a2425544a6799c558deef946c", "score": "0.5898821", "text": "func (in *BundleList) DeepCopy() *BundleList {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(BundleList)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "ce2af28a2425544a6799c558deef946c", "score": "0.5898821", "text": "func (in *BundleList) DeepCopy() *BundleList {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(BundleList)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "775e68abe212ad98d7560e3325ac28ef", "score": "0.5892077", "text": "func (in *ClusterObjectSliceList) DeepCopy() *ClusterObjectSliceList {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(ClusterObjectSliceList)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "05aa1bfd3d289b5b0a27d5457ee20b0f", "score": "0.5891277", "text": "func (in *SiteResourceGroupList) DeepCopy() *SiteResourceGroupList {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(SiteResourceGroupList)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "c563cd29aa96967d8d072050546fa354", "score": "0.5885563", "text": "func (in *MirrorList) DeepCopy() *MirrorList {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(MirrorList)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "643aefcf7a7a6ee5eb578eaa54c7e824", "score": "0.58777016", "text": "func (in *IPPoolList) DeepCopy() *IPPoolList {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(IPPoolList)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "44b2f5f5488867a88ae8566337de3279", "score": "0.58698714", "text": "func (in *ImageSetList) DeepCopy() *ImageSetList {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(ImageSetList)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "51f1e7cb6616171be7c0513ec410da5c", "score": "0.5864891", "text": "func (in *SequenceList) DeepCopy() *SequenceList {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(SequenceList)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "e0bb31501a93d6729c528804fbc1aa12", "score": "0.585703", "text": "func (in *XClusterList) DeepCopy() *XClusterList {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(XClusterList)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "760002f8ed8e0a4315c757588dc183c2", "score": "0.58568496", "text": "func (in *ContainerNodePoolList) DeepCopy() *ContainerNodePoolList {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(ContainerNodePoolList)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "6a5fc84f52e10de53583e95444530740", "score": "0.5848198", "text": "func (in *LokiStack) DeepCopy() *LokiStack {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(LokiStack)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "bd807cb5ef453cbd4fde598d67211bc2", "score": "0.5843154", "text": "func (in *NodePoolList) DeepCopy() *NodePoolList {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(NodePoolList)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "d96ec54de6dc169f562e6e16c377ac61", "score": "0.58312273", "text": "func (in *PrestoList) DeepCopy() *PrestoList {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(PrestoList)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "bde33cf558385537c0495353df099466", "score": "0.581404", "text": "func (in *NodeGroupList) DeepCopy() *NodeGroupList {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(NodeGroupList)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "524a472e30b440d053ad8c814f57f5fc", "score": "0.5807602", "text": "func (in *DNSProviderList) DeepCopy() *DNSProviderList {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(DNSProviderList)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "2e4d6e757b415d01e267509ca844eed0", "score": "0.5773988", "text": "func (in *CStorBackupList) DeepCopy() *CStorBackupList {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(CStorBackupList)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "a1e767ba4251f63ccf3099b8de0a8018", "score": "0.57709414", "text": "func (in *ObjectSetList) DeepCopy() *ObjectSetList {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(ObjectSetList)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "6025d2f43b423576a67e9d3ef11baeea", "score": "0.5763866", "text": "func (in *ObjectTemplateList) DeepCopy() *ObjectTemplateList {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(ObjectTemplateList)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "bb89cc009414db01e1c76b600c694694", "score": "0.576143", "text": "func (in *RecordSetList) DeepCopy() *RecordSetList {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(RecordSetList)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "8f86516ac9ef96e5d71e66ea8a320875", "score": "0.57300806", "text": "func (in *ImageDigestMirrorSetList) DeepCopy() *ImageDigestMirrorSetList {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(ImageDigestMirrorSetList)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "e62a76f4d3bb81b16756d0b433aba553", "score": "0.5724392", "text": "func (in *HostList) DeepCopy() *HostList {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(HostList)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "25b3e0f1bcc053be338c91f1902abb5f", "score": "0.57199675", "text": "func (in *CloudSubnetList) DeepCopy() *CloudSubnetList {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(CloudSubnetList)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "d51530fa0afac8d342f6f0c18f8cb997", "score": "0.57179457", "text": "func (in *VirtualMachineList) DeepCopy() *VirtualMachineList {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(VirtualMachineList)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "d51530fa0afac8d342f6f0c18f8cb997", "score": "0.57179457", "text": "func (in *VirtualMachineList) DeepCopy() *VirtualMachineList {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(VirtualMachineList)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "4462c0d5e468810a6900a7fc47975fa0", "score": "0.5708775", "text": "func (in *VirtualNetworkList) DeepCopy() *VirtualNetworkList {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(VirtualNetworkList)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "6fb438545d4a3a465d26090e2d93a449", "score": "0.5705738", "text": "func (in *ProjectList) DeepCopy() *ProjectList {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(ProjectList)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "6fb438545d4a3a465d26090e2d93a449", "score": "0.5705738", "text": "func (in *ProjectList) DeepCopy() *ProjectList {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(ProjectList)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "e523c39c0b66c86daf7802c51166ee1a", "score": "0.57051134", "text": "func (in *ImageListList) DeepCopy() *ImageListList {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(ImageListList)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "efd18e784f2463aae484073ff7ae46ce", "score": "0.56892353", "text": "func (in *LocalStorageList) DeepCopy() *LocalStorageList {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(LocalStorageList)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "1ba3741a6f79e241cc25d86d1c7b1f94", "score": "0.5684303", "text": "func (in *GitRepoList) DeepCopy() *GitRepoList {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(GitRepoList)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "7b0f907153938a976e4edce2701c1d9f", "score": "0.5682754", "text": "func (in *ConsulList) DeepCopy() *ConsulList {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(ConsulList)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "73d5aee433c18c7102ff2d81033e7727", "score": "0.5682744", "text": "func (in *HookTemplateList) DeepCopy() *HookTemplateList {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(HookTemplateList)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "55814b60ed1cf23bd55bcb48c88e583d", "score": "0.5682534", "text": "func (in *ConnectionList) DeepCopy() *ConnectionList {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(ConnectionList)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "14c5e7a26dad79fc9ab688ae889ecc9b", "score": "0.56790197", "text": "func (in *PackageList) DeepCopy() *PackageList {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(PackageList)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "dc286640a82ba43a04d8a5feda3d352b", "score": "0.56669307", "text": "func (c *Config) GetStackList() (stacks []string) {\n\tfor stack := range c.Stacks {\n\t\tstacks = append(stacks, stack)\n\t}\n\tsort.Strings(stacks)\n\treturn\n}", "title": "" }, { "docid": "9571fcceaa10b3af726a762e00b5104e", "score": "0.56610364", "text": "func (in *VirtualMachineCloneList) DeepCopy() *VirtualMachineCloneList {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(VirtualMachineCloneList)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "8e412010727f83213278ced41d2a615c", "score": "0.5654539", "text": "func (in *FeatureList) DeepCopy() *FeatureList {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(FeatureList)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "ab079d9fca75f073e9c0001da8f845a3", "score": "0.56438005", "text": "func (in *XFirewallList) DeepCopy() *XFirewallList {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(XFirewallList)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "07180505b5a10089bde6353540e4cd08", "score": "0.56364346", "text": "func (in *EgressList) DeepCopy() *EgressList {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(EgressList)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "07180505b5a10089bde6353540e4cd08", "score": "0.56364346", "text": "func (in *EgressList) DeepCopy() *EgressList {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(EgressList)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "b2b6f246a82c436251221be2cd13be86", "score": "0.5635605", "text": "func (in *VirtualMachineTemplateList) DeepCopy() *VirtualMachineTemplateList {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(VirtualMachineTemplateList)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "844bdf943b910ae029103aebcf685e19", "score": "0.56333184", "text": "func (in *ResourceSetList) DeepCopy() *ResourceSetList {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(ResourceSetList)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "9361db2dd879f11f550679c93e9893ab", "score": "0.56309897", "text": "func (in *SporosList) DeepCopy() *SporosList {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(SporosList)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "ccc6aa3e93fd570ef67b637dd4443f77", "score": "0.5630522", "text": "func (in *CloudIPList) DeepCopy() *CloudIPList {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(CloudIPList)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "fce6077475be927a1d82a445932df51e", "score": "0.56260234", "text": "func (in *ShareInfoList) DeepCopy() *ShareInfoList {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(ShareInfoList)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "f10483c807a5747612ae6a28472401a1", "score": "0.5620154", "text": "func (in *PipelineList) DeepCopy() *PipelineList {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(PipelineList)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "6ee3729fff39f308133835d12466f279", "score": "0.5619613", "text": "func (in *AddressPoolList) DeepCopy() *AddressPoolList {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(AddressPoolList)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "6ee3729fff39f308133835d12466f279", "score": "0.5619613", "text": "func (in *AddressPoolList) DeepCopy() *AddressPoolList {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(AddressPoolList)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "0ff5579df89314d8933c7695f2795641", "score": "0.5614565", "text": "func (in *MachineTemplateList) DeepCopy() *MachineTemplateList {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(MachineTemplateList)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "6a81d768ba1033909a1c89b9dfe2de06", "score": "0.56141835", "text": "func (in *ContentList) DeepCopy() *ContentList {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(ContentList)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "48ab8106282dd9d8d52b749c24ddbd77", "score": "0.5601877", "text": "func (in *DNSLockList) DeepCopy() *DNSLockList {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(DNSLockList)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "ad09021b86413a7a276dfa0f1404453a", "score": "0.55954707", "text": "func (in *CustomNetworkList) DeepCopy() *CustomNetworkList {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(CustomNetworkList)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "5a9057b9bb7df68f143e4440682c9e92", "score": "0.55883515", "text": "func (in *InstanceGroupList) DeepCopy() *InstanceGroupList {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(InstanceGroupList)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "dcd2e092b71b23043995ef2a5534d491", "score": "0.55846494", "text": "func (in *TeamList) DeepCopy() *TeamList {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(TeamList)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "dcd2e092b71b23043995ef2a5534d491", "score": "0.55846494", "text": "func (in *TeamList) DeepCopy() *TeamList {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(TeamList)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "f01dd599c7cc3f155793f246f854d740", "score": "0.55725485", "text": "func (in *StorageClusterList) DeepCopy() *StorageClusterList {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(StorageClusterList)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "f693e67255a09c434e4bb25f2362b931", "score": "0.5572166", "text": "func (in *ClusterGroupList) DeepCopy() *ClusterGroupList {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(ClusterGroupList)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "16167ca60dbb5ddb6fa4285cdb3bcf28", "score": "0.5572156", "text": "func (in *ScopeList) DeepCopy() *ScopeList {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(ScopeList)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "c1be3f3e452a699f9aaa0ac1321d9af3", "score": "0.5571988", "text": "func (in *FeedList) DeepCopy() *FeedList {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(FeedList)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "7d076470635fd3a5caded950431a8c1e", "score": "0.55718434", "text": "func (in *MachineList) DeepCopy() *MachineList {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(MachineList)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "7e852772b3e74c91bfe364edfb340889", "score": "0.55663514", "text": "func (in *FederatedReplicaSetList) DeepCopy() *FederatedReplicaSetList {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(FederatedReplicaSetList)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "f73e9e77ea799262f66a092f875f356b", "score": "0.55610734", "text": "func (in *EKSList) DeepCopy() *EKSList {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(EKSList)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "94e53218d9edd68d637fcfe2bf6a9a8a", "score": "0.555838", "text": "func (in *SensuRestoreList) DeepCopy() *SensuRestoreList {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(SensuRestoreList)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "7a3c7442a291b0e5dacd6acabc91df05", "score": "0.5557337", "text": "func (in *ProviderList) DeepCopy() *ProviderList {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(ProviderList)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "d8d0ce2407bed8e8b862dae6ca699f29", "score": "0.5556001", "text": "func (in *WorkspaceList) DeepCopy() *WorkspaceList {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(WorkspaceList)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "ac4941b7871915f729fedd259093ad39", "score": "0.5554368", "text": "func (in *EventSourceList) DeepCopy() *EventSourceList {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(EventSourceList)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" } ]
693f34c54b28a9f1c277091ac24c84a1
IntersectsBBox detects if the object intersects a bbox.
[ { "docid": "925b03afe990dcea400472b332175876", "score": "0.7774643", "text": "func (g FeatureCollection) IntersectsBBox(bbox BBox) bool {\n\tif g.BBox != nil {\n\t\treturn rectBBox(g.CalculatedBBox()).IntersectsRect(rectBBox(bbox))\n\t}\n\tfor _, g := range g.Features {\n\t\tif g.IntersectsBBox(bbox) {\n\t\t\treturn false\n\t\t}\n\t}\n\treturn true\n}", "title": "" } ]
[ { "docid": "1833df629518cbc54919660ea46c37dc", "score": "0.8263879", "text": "func (g Feature) IntersectsBBox(bbox BBox) bool {\n\tif g.BBox != nil {\n\t\treturn rectBBox(g.CalculatedBBox()).IntersectsRect(rectBBox(bbox))\n\t}\n\treturn g.Geometry.IntersectsBBox(bbox)\n}", "title": "" }, { "docid": "e22e34d84250b8988916dc9eceba5550", "score": "0.6785863", "text": "func (g Feature) WithinBBox(bbox BBox) bool {\n\tif g.BBox != nil {\n\t\treturn rectBBox(g.CalculatedBBox()).InsideRect(rectBBox(bbox))\n\t}\n\treturn g.Geometry.WithinBBox(bbox)\n}", "title": "" }, { "docid": "8c8b79b441d840220b828dfe52c1cde1", "score": "0.6751413", "text": "func Intersect(a, b BBox) (BBox, error) {\n\treturn NewBBox(math.Max(a.Xmin(), b.Xmin()),\n\t\tmath.Max(a.Ymin(), b.Ymin()),\n\t\tmath.Min(a.Xmax(), b.Xmax()),\n\t\tmath.Min(a.Ymax(), b.Ymax()))\n}", "title": "" }, { "docid": "e228ca3c1eb0610ff93eed917bfbfc9f", "score": "0.6707563", "text": "func (self *BoundingBox) Intersects(b *BoundingBox) bool {\r\n\tif !self.IsValid() {\r\n\t\treturn false\r\n\t}\r\n\t// test using SAT (separating axis theorem)\r\n\r\n\tlx := float32(math.Abs(float64(self.Cnt.X - b.Cnt.X)))\r\n\tsumx := (self.Dim.X / 2.0) + (b.Dim.X / 2.0)\r\n\r\n\tly := float32(math.Abs(float64(self.Cnt.Y - b.Cnt.Y)))\r\n\tsumy := (self.Dim.Y / 2.0) + (b.Dim.Y / 2.0)\r\n\r\n\tlz := float32(math.Abs(float64(self.Cnt.Z - b.Cnt.Z)))\r\n\tsumz := (self.Dim.Z / 2.0) + (b.Dim.Z / 2.0)\r\n\r\n\treturn (lx <= sumx && ly <= sumy && lz <= sumz)\r\n}", "title": "" }, { "docid": "1574e5db433477231a3b1ae0641d9eb1", "score": "0.6666484", "text": "func (b bbox) Contains(x, y float64) bool {\n\treturn IsInRangeFloat64(x, b.xmin, b.xmax) && IsInRangeFloat64(y, b.ymin, b.ymax)\n}", "title": "" }, { "docid": "3b79c339b7804a68c8ae227663d04274", "score": "0.6657317", "text": "func EqualBBox(a, b BBox) bool {\n\treturn EqualFloat(a.Xmin(), b.Xmin()) &&\n\t\tEqualFloat(a.Xmax(), b.Xmax()) &&\n\t\tEqualFloat(a.Ymin(), b.Ymin()) &&\n\t\tEqualFloat(a.Ymax(), b.Ymax())\n}", "title": "" }, { "docid": "4a7bcdd67c60a1d6115cb5991caf97e4", "score": "0.6593558", "text": "func (g FeatureCollection) WithinBBox(bbox BBox) bool {\n\tif g.BBox != nil {\n\t\treturn rectBBox(g.CalculatedBBox()).InsideRect(rectBBox(bbox))\n\t}\n\tif len(g.Features) == 0 {\n\t\treturn false\n\t}\n\tfor _, g := range g.Features {\n\t\tif !g.WithinBBox(bbox) {\n\t\t\treturn false\n\t\t}\n\t}\n\treturn true\n}", "title": "" }, { "docid": "17f512547ca045e9aa7e3f4ccba5ce4d", "score": "0.645564", "text": "func bboxContains(bbox *BBox, point *GeoCoord) bool {\n\treturn point.Lat >= bbox.south && point.Lat <= bbox.north && func() bool {\n\t\tif bboxIsTransmeridian(bbox) {\n\t\t\treturn point.Lon >= bbox.west || point.Lon <= bbox.east\n\t\t}\n\t\treturn point.Lon >= bbox.west && point.Lon <= bbox.east\n\t}()\n}", "title": "" }, { "docid": "f907f1c73bfb21a8debb10256182d884", "score": "0.6418005", "text": "func (nb *NodeBase) WinBBoxInBBox(bbox image.Rectangle) bool {\n\tnb.BBoxMu.RLock()\n\tdefer nb.BBoxMu.RUnlock()\n\treturn mat32.RectInNotEmpty(nb.WinBBox, bbox)\n}", "title": "" }, { "docid": "ce0808aa123d4264a5284e680844d1ee", "score": "0.6414125", "text": "func (gdt *Aabb) Intersects(with Aabb) Bool {\n\targ0 := gdt.getBase()\n\targ1 := with.getBase()\n\n\tret := C.go_godot_aabb_intersects(GDNative.api, arg0, arg1)\n\n\treturn Bool(ret)\n}", "title": "" }, { "docid": "25210b1dc7be170a090e8bc32b7f9cf8", "score": "0.63955796", "text": "func bboxEquals(b1 *BBox, b2 *BBox) bool {\n\treturn b1.north == b2.north && b1.south == b2.south &&\n\t\tb1.east == b2.east && b1.west == b2.west\n}", "title": "" }, { "docid": "62945f338a4d7cabafbf7a65dac184aa", "score": "0.6248556", "text": "func (b *Box) InRect(x, y int) bool {\n\trectX, rectY, width, height := b.GetRect()\n\treturn x >= rectX && x < rectX+width && y >= rectY && y < rectY+height\n}", "title": "" }, { "docid": "66dad1662881d38f5f9ad3bcc299ceed", "score": "0.6214823", "text": "func (b *BBox) Overlaps(other *BBox) bool {\n\tpanic(\"BBox.Overlaps is not implemented yet\")\n}", "title": "" }, { "docid": "e7d3bb8428543539ee42da12faf6244b", "score": "0.61916095", "text": "func (b Bound) IsIntersect(bounds Bound) bool {\n\treturn !(bounds.Max.X < b.Min.X || bounds.Min.X > b.Max.X || bounds.Max.Y < b.Min.Y || bounds.Min.Y > b.Max.Y)\n}", "title": "" }, { "docid": "a67edff180b56447f9fdd609d9506e39", "score": "0.6169882", "text": "func (b *Box) Intersects(o *Box) bool {\n\treturn !(b.max[0] < o.min[0] ||\n\t\to.max[0] < b.min[0] ||\n\t\tb.max[1] < o.min[1] ||\n\t\to.max[1] < b.min[1] ||\n\t\tb.max[2] < o.min[2] ||\n\t\to.max[2] < b.min[2])\n}", "title": "" }, { "docid": "7b7974c10a98bf70116405828178b670", "score": "0.61436343", "text": "func (b Box) Intersect(r raytracing.Ray, maxRange float64) (bool, float64) {\n\tvar tMin, tMax float64\n\n\tx1 := (b.MinCorner.X - r.Position.X) / r.Direction.X\n\tx2 := (b.MaxCorner.X - r.Position.X) / r.Direction.X\n\n\ttMin = math.Min(x1, x2)\n\ttMax = math.Max(x1, x2)\n\n\ty1 := (b.MinCorner.Y - r.Position.Y) / r.Direction.Y\n\ty2 := (b.MaxCorner.Y - r.Position.Y) / r.Direction.Y\n\n\ttMin = math.Max(tMin, math.Min(y1, y2))\n\ttMax = math.Min(tMax, math.Max(y1, y2))\n\n\tz1 := (b.MinCorner.Z - r.Position.Z) / r.Direction.Z\n\tz2 := (b.MaxCorner.Z - r.Position.Z) / r.Direction.Z\n\n\ttMin = math.Max(tMin, math.Min(z1, z2))\n\ttMax = math.Min(tMax, math.Max(z1, z2))\n\n\tif tMin < tMax && tMin > 1e-4 && tMin < maxRange {\n\t\treturn true, tMin\n\t}\n\treturn false, maxRange\n}", "title": "" }, { "docid": "4e1915aa6140e06ca3e80cb72ef9a001", "score": "0.60502946", "text": "func (b BBox) Overlaps(b2 BBox) bool {\n\treturn b.SW.InBBox(b2) || b.NE.InBBox(b2) || b2.SW.InBBox(b) || b2.NE.InBBox(b)\n}", "title": "" }, { "docid": "6496269f16c3e7abea9775d73d37067f", "score": "0.59803134", "text": "func insideBox(x, y, b_x1, b_y1, b_x2, b_y2 float64) (bool) {\n if ( x > b_x1 && y > b_y1 && x < b_x1+b_x2 && y < b_y1+b_y2 ) {\n return true\n }\n return false\n}", "title": "" }, { "docid": "7fe914c67a52025dac7f04d1487fb2c0", "score": "0.57783717", "text": "func (self *BoundingBox) Contains(b *BoundingBox) bool {\r\n\treturn !self.IsValid() || (self.Min.X <= b.Min.X && self.Min.Y <= b.Min.Y &&\r\n\t\tself.Min.Z <= b.Min.Z && self.Max.X >= b.Max.X && self.Max.Y >= b.Max.Y && self.Max.Z >= b.Max.Z)\r\n}", "title": "" }, { "docid": "4fe017e542385c25f4e7e9941b433177", "score": "0.5763809", "text": "func intersects(a, b *mbr.MBR) bool {\n\treturn !(b.MinX > a.MaxX || b.MaxX < a.MinX || b.MinY > a.MaxY || b.MaxY < a.MinY)\n}", "title": "" }, { "docid": "4c1ea9e6c54c521d8091c6428d823c3e", "score": "0.5736942", "text": "func (b *BBox) IntersectEdge(ray geometry.Ray) (bool, float64) {\n\tintersected, t0, t1 := b.IntersectP(ray)\n\n\tif !intersected {\n\t\treturn false, 0\n\t}\n\n\tif t0 > ray.Maxt || t0 < ray.Mint {\n\t\treturn false, 0\n\t}\n\n\t// Edge size\n\tbs := .04\n\tpNear := ray.Origin.Plus(ray.Direction.MultiplyScalar(t0))\n\n\tif (utils.EqualFloat64(pNear.Y, b.Min.Y, bs) && utils.EqualFloat64(pNear.Z, b.Min.Z, bs)) ||\n\t\t(utils.EqualFloat64(pNear.Y, b.Min.Y, bs) && utils.EqualFloat64(pNear.X, b.Min.X, bs)) ||\n\t\t(utils.EqualFloat64(pNear.X, b.Min.X, bs) && utils.EqualFloat64(pNear.Z, b.Min.Z, bs)) ||\n\t\t(utils.EqualFloat64(pNear.Y, b.Min.Y, bs) && utils.EqualFloat64(pNear.X, b.Max.X, bs)) ||\n\t\t(utils.EqualFloat64(pNear.X, b.Min.X, bs) && utils.EqualFloat64(pNear.Z, b.Max.Z, bs)) ||\n\t\t(utils.EqualFloat64(pNear.X, b.Max.X, bs) && utils.EqualFloat64(pNear.Z, b.Min.Z, bs)) ||\n\t\t(utils.EqualFloat64(pNear.Z, b.Min.Z, bs) && utils.EqualFloat64(pNear.Y, b.Max.Y, bs)) ||\n\t\t(utils.EqualFloat64(pNear.Z, b.Max.Z, bs) && utils.EqualFloat64(pNear.Y, b.Min.Y, bs)) ||\n\t\t(utils.EqualFloat64(pNear.Y, b.Max.Y, bs) && utils.EqualFloat64(pNear.Z, b.Max.Z, bs)) ||\n\t\t(utils.EqualFloat64(pNear.Y, b.Max.Y, bs) && utils.EqualFloat64(pNear.X, b.Max.X, bs)) ||\n\t\t(utils.EqualFloat64(pNear.X, b.Min.X, bs) && utils.EqualFloat64(pNear.Y, b.Max.Y, bs)) ||\n\t\t(utils.EqualFloat64(pNear.X, b.Max.X, bs) && utils.EqualFloat64(pNear.Z, b.Max.Z, bs)) {\n\t\treturn true, t0\n\t}\n\n\tif t1 > ray.Maxt || t1 < ray.Mint {\n\t\treturn false, 0\n\t}\n\n\tpFar := ray.Origin.Plus(ray.Direction.MultiplyScalar(t1))\n\n\tif (utils.EqualFloat64(pFar.Y, b.Min.Y, bs) && utils.EqualFloat64(pFar.Z, b.Min.Z, bs)) ||\n\t\t(utils.EqualFloat64(pFar.Y, b.Min.Y, bs) && utils.EqualFloat64(pFar.X, b.Min.X, bs)) ||\n\t\t(utils.EqualFloat64(pFar.X, b.Min.X, bs) && utils.EqualFloat64(pFar.Z, b.Min.Z, bs)) ||\n\t\t(utils.EqualFloat64(pFar.Y, b.Min.Y, bs) && utils.EqualFloat64(pFar.X, b.Max.X, bs)) ||\n\t\t(utils.EqualFloat64(pFar.X, b.Min.X, bs) && utils.EqualFloat64(pFar.Z, b.Max.Z, bs)) ||\n\t\t(utils.EqualFloat64(pFar.X, b.Max.X, bs) && utils.EqualFloat64(pFar.Z, b.Min.Z, bs)) ||\n\t\t(utils.EqualFloat64(pFar.Z, b.Min.Z, bs) && utils.EqualFloat64(pFar.Y, b.Max.Y, bs)) ||\n\t\t(utils.EqualFloat64(pFar.Z, b.Max.Z, bs) && utils.EqualFloat64(pFar.Y, b.Min.Y, bs)) ||\n\t\t(utils.EqualFloat64(pFar.Y, b.Max.Y, bs) && utils.EqualFloat64(pFar.Z, b.Max.Z, bs)) ||\n\t\t(utils.EqualFloat64(pFar.Y, b.Max.Y, bs) && utils.EqualFloat64(pFar.X, b.Max.X, bs)) ||\n\t\t(utils.EqualFloat64(pFar.X, b.Min.X, bs) && utils.EqualFloat64(pFar.Y, b.Max.Y, bs)) ||\n\t\t(utils.EqualFloat64(pFar.X, b.Max.X, bs) && utils.EqualFloat64(pFar.Z, b.Max.Z, bs)) {\n\t\treturn true, t1\n\t}\n\n\treturn false, 0\n}", "title": "" }, { "docid": "8313192b0f1377a9a7ac528556e75fcc", "score": "0.56920767", "text": "func (p *Polygon) boundaryApproxIntersects(it *ShapeIndexIterator, cell Cell) bool {\n\taClipped := it.IndexCell().findByShapeID(0)\n\n\t// If there are no edges, there is no intersection.\n\tif len(aClipped.edges) == 0 {\n\t\treturn false\n\t}\n\n\t// We can save some work if cell is the index cell itself.\n\tif it.CellID() == cell.ID() {\n\t\treturn true\n\t}\n\n\t// Otherwise check whether any of the edges intersect cell.\n\tmaxError := (faceClipErrorUVCoord + intersectsRectErrorUVDist)\n\tbound := cell.BoundUV().ExpandedByMargin(maxError)\n\tfor _, e := range aClipped.edges {\n\t\tedge := p.index.Shape(0).Edge(e)\n\t\tv0, v1, ok := ClipToPaddedFace(edge.V0, edge.V1, cell.Face(), maxError)\n\t\tif ok && edgeIntersectsRect(v0, v1, bound) {\n\t\t\treturn true\n\t\t}\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "14be0942b628d2206863e966a1819ef1", "score": "0.5665139", "text": "func (g FeatureCollection) IsBBoxDefined() bool {\n\treturn g.BBox != nil\n}", "title": "" }, { "docid": "2e2eb2116356c6b98817e1d5ac2d05a5", "score": "0.56548077", "text": "func (jbobject *GraphicsRegion) Intersects(a int, b int, c int, d int) bool {\n\tjret, err := jbobject.CallMethod(javabind.GetEnv(), \"intersects\", javabind.Boolean, a, b, c, d)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn jret.(bool)\n}", "title": "" }, { "docid": "ef75607b699b3a21fb59d567dacd768e", "score": "0.5640061", "text": "func (g Feature) IsBBoxDefined() bool {\n\treturn g.BBox != nil\n}", "title": "" }, { "docid": "a04ac4270e4169d2a7c085b65bbb2493", "score": "0.56233686", "text": "func (b *Box) Contains(o *Box) bool {\n\treturn (b.min[0] <= o.min[0] &&\n\t\tb.max[0] >= o.max[0] &&\n\t\tb.min[1] <= o.min[1] &&\n\t\tb.max[1] >= o.max[1] &&\n\t\tb.min[2] <= o.min[2] &&\n\t\tb.max[2] >= o.max[2])\n}", "title": "" }, { "docid": "3c1dbeffbb37ada2b940a28fc6f13917", "score": "0.5618126", "text": "func (nb *NodeBase) AllWithinBBox(bbox image.Rectangle, leavesOnly bool) ki.Slice {\n\tvar rval ki.Slice\n\tnb.FuncDownMeFirst(0, nb.This(), func(k ki.Ki, level int, d any) bool {\n\t\tif k == nb.This() {\n\t\t\treturn ki.Continue\n\t\t}\n\t\tif leavesOnly && k.HasChildren() {\n\t\t\treturn ki.Continue\n\t\t}\n\t\t_, ni := KiToNode2D(k)\n\t\tif ni == nil || ni.IsDeleted() || ni.IsDestroyed() {\n\t\t\t// 3D?\n\t\t\treturn ki.Break\n\t\t}\n\t\tif ni.WinBBoxInBBox(bbox) {\n\t\t\trval = append(rval, ni.This())\n\t\t}\n\t\treturn ki.Continue\n\t})\n\treturn rval\n}", "title": "" }, { "docid": "47258d1d42a561d93628f11131f3c0a0", "score": "0.5592243", "text": "func (r Rectangle) Intersects(o Rectangle) bool {\n\treturn r.x < (o.x+o.w) && (r.x+r.w) > o.x &&\n\t\tr.y < (o.y+o.h) && (r.y+r.h) > o.y\n}", "title": "" }, { "docid": "4de88a51f7df7dcc31224665a1465659", "score": "0.5573262", "text": "func (b *BBox) Inside(p geometry.Vector) bool {\n\tif p.X < b.Min.X || p.X > b.Max.X {\n\t\treturn false\n\t}\n\n\tif p.Y < b.Min.Y || p.Y > b.Max.Y {\n\t\treturn false\n\t}\n\n\tif p.Z < b.Min.Z || p.Z > b.Max.Z {\n\t\treturn false\n\t}\n\n\treturn true\n}", "title": "" }, { "docid": "fb65f15bff6c5e48f8a8a006877ba4f5", "score": "0.555892", "text": "func (b BoundingBox) Contains(position Vector3) bool {\n\tif position.X > b.Minimum.X && position.X < b.Maximum.X {\n\t\tif position.Y > b.Minimum.Y && position.Y < b.Maximum.Y {\n\t\t\tif position.Z > b.Minimum.Z && position.Z < b.Maximum.Z {\n\t\t\t\treturn true\n\t\t\t}\n\t\t}\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "1d800ffe5e5282ac09c00761355dda6a", "score": "0.5535601", "text": "func (gdt *Aabb) IntersectsSegment(from Vector3, to Vector3) Bool {\n\targ0 := gdt.getBase()\n\targ1 := from.getBase()\n\targ2 := to.getBase()\n\n\tret := C.go_godot_aabb_intersects_segment(GDNative.api, arg0, arg1, arg2)\n\n\treturn Bool(ret)\n}", "title": "" }, { "docid": "27912a4a5a117193fcd4c19a856b0e05", "score": "0.5465872", "text": "func (bb BoundingBox) Overlaps(test BoundingBox) bool {\n\tbblen := len(bb)\n\ttestlen := len(test)\n\n\tif (bblen == 0) || (testlen == 0) || (bblen != testlen) {\n\t\treturn false\n\t}\n\tresult := true\n\tbbDimensions := bblen / 2\n\tif bb.Antimeridian() && test.Antimeridian() {\n\t\t// no op\n\t} else if bb.Antimeridian() {\n\t\tresult = result && ((test[bbDimensions] >= bb[0]) && (test[bbDimensions] <= 180) ||\n\t\t\t(test[0] <= bb[bbDimensions]) && (test[0] >= -180))\n\t} else if test.Antimeridian() {\n\t\tresult = result && ((bb[bbDimensions] >= test[0]) && (bb[bbDimensions] <= 180) ||\n\t\t\t(bb[0] <= test[bbDimensions]) && (bb[0] >= -180))\n\t} else {\n\t\tresult = result && (bb[0] < test[bbDimensions]) && (bb[bbDimensions] > test[0])\n\t}\n\tresult = result && (bb[1] < test[1+bbDimensions]) && (bb[1+bbDimensions] > test[1])\n\tif bbDimensions > 2 {\n\t\tresult = result && (bb[2] < test[2+bbDimensions]) && (bb[2+bbDimensions] > test[2])\n\t}\n\treturn result\n}", "title": "" }, { "docid": "543699427eca95fc4fcdfcd4a6f74b5e", "score": "0.5400143", "text": "func BoundingBox(points []Vec2) Box {\n\tif len(points) < 2 {\n\t\treturn MakeBox(V2(0, 0), V2(0, 0))\n\t}\n\n\ttopleft := points[0]\n\tbottomright := points[1]\n\tpoints = points[1 : len(points)-1]\n\n\tfor _, p := range points {\n\t\tif p.X < topleft.X {\n\t\t\ttopleft.X = p.X\n\t\t}\n\t\tif p.Y < topleft.Y {\n\t\t\ttopleft.Y = p.Y\n\t\t}\n\t\tif p.X > bottomright.X {\n\t\t\tbottomright.X = p.X\n\t\t}\n\t\tif p.Y > bottomright.Y {\n\t\t\tbottomright.Y = p.Y\n\t\t}\n\t}\n\n\treturn MakeBox(topleft, bottomright)\n}", "title": "" }, { "docid": "facf109eccc69f4de6fd90c04ec4fd83", "score": "0.53774506", "text": "func bboxIsTransmeridian(bbox *BBox) bool {\n\treturn bbox.east < bbox.west\n}", "title": "" }, { "docid": "054e5d8e5b7c3e010a5692f8ee126abe", "score": "0.53627306", "text": "func (b *BBox) IntersectP(ray geometry.Ray) (bool, float64, float64) {\n\tvar t0 = ray.Mint\n\tvar t1 = ray.Maxt\n\tvar invRayDir, tNear, tFar float64\n\n\tinvRayDir = 1.0 / ray.Direction.X\n\ttNear = (b.Min.X - ray.Origin.X) * invRayDir\n\ttFar = (b.Max.X - ray.Origin.X) * invRayDir\n\tif tNear > tFar {\n\t\ttNear, tFar = tFar, tNear\n\t}\n\tif tNear > t0 {\n\t\tt0 = tNear\n\t}\n\tif tFar < t1 {\n\t\tt1 = tFar\n\t}\n\tif t0 > t1 {\n\t\treturn false, t0, t1\n\t}\n\n\tinvRayDir = 1.0 / ray.Direction.Y\n\ttNear = (b.Min.Y - ray.Origin.Y) * invRayDir\n\ttFar = (b.Max.Y - ray.Origin.Y) * invRayDir\n\tif tNear > tFar {\n\t\ttNear, tFar = tFar, tNear\n\t}\n\tif tNear > t0 {\n\t\tt0 = tNear\n\t}\n\tif tFar < t1 {\n\t\tt1 = tFar\n\t}\n\tif t0 > t1 {\n\t\treturn false, t0, t1\n\t}\n\n\tinvRayDir = 1.0 / ray.Direction.Z\n\ttNear = (b.Min.Z - ray.Origin.Z) * invRayDir\n\ttFar = (b.Max.Z - ray.Origin.Z) * invRayDir\n\tif tNear > tFar {\n\t\ttNear, tFar = tFar, tNear\n\t}\n\tif tNear > t0 {\n\t\tt0 = tNear\n\t}\n\tif tFar < t1 {\n\t\tt1 = tFar\n\t}\n\tif t0 > t1 {\n\t\treturn false, t0, t1\n\t}\n\n\treturn true, t0, t1\n}", "title": "" }, { "docid": "65122949a1a168df561c7e63ee13a313", "score": "0.53495157", "text": "func (gdt *Aabb) Intersection(with Aabb) Aabb {\n\targ0 := gdt.getBase()\n\targ1 := with.getBase()\n\n\tret := C.go_godot_aabb_intersection(GDNative.api, arg0, arg1)\n\n\treturn Aabb{base: &ret}\n\n}", "title": "" }, { "docid": "1312ebd0e57d1c15173361aded0d7cc6", "score": "0.534556", "text": "func (self *IntRect) Intersects(rect2 sfIntRect*, overlappingRect sfIntRect*) sfBool {\n return SfBool2GoBool( C.sfIntRect_Intersects(self.Cref, rect2, overlappingRect) )\n}", "title": "" }, { "docid": "a94154efbb3504e9f4e7f0425fa5efcb", "score": "0.5335257", "text": "func (q *QuadTree) Intersects(rect geom.Rect) bool {\n\tif q.root != nil {\n\t\tif q.root.intersects(rect) {\n\t\t\treturn true\n\t\t}\n\t}\n\tfor _, one := range q.outside {\n\t\tif one.Bounds().Intersects(rect) {\n\t\t\treturn true\n\t\t}\n\t}\n\treturn false\n}", "title": "" }, { "docid": "d260c554934756ff1f1997d5927cd236", "score": "0.53339267", "text": "func (r Rectangle) Intersects(other Rectangle) bool {\n\treturn r.StartX <= other.EndX && r.EndX >= other.StartX && r.StartY <= other.EndY && r.EndY >= other.StartY\n}", "title": "" }, { "docid": "b6d6852fca9df7ba8636f49c515931bc", "score": "0.53152347", "text": "func (p *Primitives) ContainsRect(tl, br Point) bool {\n\n\tl := tl.X\n\tr := br.X\n\tt := tl.Y\n\tb := br.Y\n\n\trequired := []Line{}\n\n\trequired = append(required, Line{Point{l, t}, Point{r, t}, false})\n\trequired = append(required, Line{Point{r, t}, Point{r, b}, false})\n\trequired = append(required, Line{Point{r, b}, Point{l, b}, false})\n\trequired = append(required, Line{Point{l, b}, Point{l, t}, false})\n\n\tfor _, line := range required {\n\t\tif !p.ContainsLine(line) {\n\t\t\treturn false\n\t\t}\n\t}\n\treturn true\n}", "title": "" }, { "docid": "ce1946fcc6f30f2c22e688d824c651a0", "score": "0.53008306", "text": "func RectWithinRect(inner Rect, outer Rect) bool {\n\tif (inner[0] >= outer[0]) && (inner[1] >= outer[1]) &&\n\t\t(inner[2] <= outer[2]) && (inner[3] <= outer[3]) {\n\t\treturn true\n\t}\n\treturn false\n}", "title": "" }, { "docid": "35dd29419327796e45d5fa7a0f09a684", "score": "0.5298258", "text": "func (l *Line) bbox() BoundingBox {\n\tmaxX := math.Max(l[0].X, l[1].X)\n\tmaxY := math.Max(l[0].Y, l[1].Y)\n\tminX := math.Min(l[0].X, l[1].X)\n\tminY := math.Min(l[0].Y, l[1].Y)\n\treturn BoundingBox{Min: Point{X: minX, Y: minY}, Max: Point{X: maxX, Y: maxY}}\n}", "title": "" }, { "docid": "9891daff926023e37f1401d9bada84eb", "score": "0.52972883", "text": "func contains(a, b *mbr.MBR) bool {\n\treturn b.MinX >= a.MinX && b.MaxX <= a.MaxX && b.MinY >= a.MinY && b.MaxY <= a.MaxY\n}", "title": "" }, { "docid": "9b4efcdd1beff006a84b0e581a24845f", "score": "0.5289278", "text": "func (t *Translation) BoundingBox(t0, t1 float64) (*aabb.AABB, bool) {\n\tbox, ok := t.Primitive.BoundingBox(t0, t1)\n\tif ok {\n\t\tbox = &aabb.AABB{\n\t\t\tA: box.A.AddVector(t.Displacement),\n\t\t\tB: box.B.AddVector(t.Displacement),\n\t\t}\n\t}\n\treturn box, ok\n}", "title": "" }, { "docid": "14b520ac53ddfdcfc97d892d6ae781ff", "score": "0.52768034", "text": "func BoundingBox(pairs []PairType) (lf, rt, tp, bt float64) {\n\tvar xr, yr RangeType\n\n\tfor j, pr := range pairs {\n\t\txr.Set(pr.X, j == 0)\n\t\tyr.Set(pr.Y, j == 0)\n\t}\n\treturn xr.Min, xr.Max, yr.Max, yr.Min\n}", "title": "" }, { "docid": "312d480083c6d94ac178be1b0ebd3a6e", "score": "0.52707237", "text": "func overlaps(b0, b1 Bounds) bool {\n\treturn (intersects(b0.X, b0.X+b0.W, b1.X, b1.X+b1.W) &&\n\t\tintersects(b0.Y, b0.Y+b0.H, b1.Y, b1.Y+b1.H))\n}", "title": "" }, { "docid": "9f988f7ea22bd4609562bf95a45edaba", "score": "0.52648675", "text": "func (r *Rect) Intersects(otherRect Rect) bool {\n\treturn (int(math.Abs(float64(r.X-otherRect.X)))*2 < (r.W + otherRect.W)) &&\n\t\t(int(math.Abs(float64(r.Y-otherRect.Y)))*2 < (r.H + otherRect.H))\n}", "title": "" }, { "docid": "f414b2151831e250136fa8f715d30436", "score": "0.5245154", "text": "func (b Box) Intersect(l Line) (Vec2, bool) {\n\t// This is transliterated in part from:\n\t//\n\t// https://github.com/JulNadeauCA/libagar/blob/master/gui/primitive.c\n\n\tfaces := []Line{\n\t\tb.Top(),\n\t\tb.Left(),\n\t\tb.Right(),\n\t\tb.Bottom(),\n\t}\n\n\tdists := []float64{-1, -1, -1, -1}\n\tintersects := []bool{false, false, false, false}\n\tintersectPoints := make([]Vec2, 4)\n\n\tshortest_dist := float64(-1.0)\n\tbest := -1\n\n\tfor i := range faces {\n\t\tin, ok := IntersectLines(faces[i], l)\n\t\tif !ok {\n\t\t\tcontinue\n\t\t}\n\t\tdists[i] = in.Length()\n\t\tintersects[i] = ok\n\t\tintersectPoints[i] = in\n\n\t\tif (dists[i] < shortest_dist) || (shortest_dist == float64(-1)) {\n\t\t\tshortest_dist = dists[i]\n\t\t\tbest = i\n\t\t}\n\t}\n\n\tif shortest_dist < 0 {\n\t\treturn V2(0, 0), false\n\t}\n\n\treturn intersectPoints[best], true\n}", "title": "" }, { "docid": "8e8d5e321acbb006ba00d756a550532f", "score": "0.5227587", "text": "func (b Box) Contains(v Vec2) bool {\n\tif (v.X < b.GetCorner1().X) && (v.X > b.GetCorner2().X) {\n\t\treturn false\n\t}\n\n\tif (v.Y < b.GetCorner1().Y) && (v.Y > b.GetCorner3().Y) {\n\t\treturn false\n\t}\n\n\treturn true\n}", "title": "" }, { "docid": "35fac67d5a249c73d0338345dcd93c64", "score": "0.5199955", "text": "func (gdt *Aabb) IntersectsPlane(plane Plane) Bool {\n\targ0 := gdt.getBase()\n\targ1 := plane.getBase()\n\n\tret := C.go_godot_aabb_intersects_plane(GDNative.api, arg0, arg1)\n\n\treturn Bool(ret)\n}", "title": "" }, { "docid": "0eac0fcc763910fdeb6254208f8951b5", "score": "0.5181958", "text": "func (b *Box) IsContainedIn(o *Box) bool {\n\treturn o.Contains(b)\n}", "title": "" }, { "docid": "d61e5e7b412caed8f4b37b9ae6362bda", "score": "0.5171488", "text": "func (q *QuadTree) MatchedIntersects(matcher Matcher, rect geom.Rect) bool {\n\tif q.root != nil {\n\t\tif q.root.matchedIntersects(matcher, rect) {\n\t\t\treturn true\n\t\t}\n\t}\n\tfor _, one := range q.outside {\n\t\tif one.Bounds().Intersects(rect) && matcher.Matches(one) {\n\t\t\treturn true\n\t\t}\n\t}\n\treturn false\n}", "title": "" }, { "docid": "6d78680a314a207184c79a941f079dc3", "score": "0.5160776", "text": "func (g Feature) Intersects(o Object) bool {\n\treturn intersectsObjectShared(g, o,\n\t\tfunc(v Polygon) bool {\n\t\t\treturn g.Geometry.Intersects(o)\n\t\t},\n\t\tfunc(v MultiPolygon) bool {\n\t\t\treturn g.Geometry.Intersects(o)\n\t\t},\n\t)\n}", "title": "" }, { "docid": "35c2b06145525084857ed5297cc0d3d0", "score": "0.51482654", "text": "func (r Rect) Intersects(other Rect) bool {\n\treturn r.X.Intersects(other.X) && r.Y.Intersects(other.Y)\n}", "title": "" }, { "docid": "b2f458293f6bb6d0d788d9ea26d4006e", "score": "0.51448774", "text": "func (nb *NodeBase) PosInWinBBox(pos image.Point) bool {\n\tnb.BBoxMu.RLock()\n\tdefer nb.BBoxMu.RUnlock()\n\treturn pos.In(nb.WinBBox)\n}", "title": "" }, { "docid": "78228930801e1ccffdd899e460ab6933", "score": "0.51431704", "text": "func (r *Rectangle) PerfectFit(b *box) bool {\n\tdx, dy := r.Dx(), r.Dy()\n\tif b.w == dx && b.l == dy {\n\t\treturn true\n\t}\n\treturn false\n}", "title": "" }, { "docid": "87a26523af5e9f4d0b90d1279a401088", "score": "0.5141561", "text": "func (self *IntRect) Contains(x int, y int) sfBool {\n return SfBool2GoBool( C.sfIntRect_Contains(self.Cref, x, y) )\n}", "title": "" }, { "docid": "d35f72d2db239cd05e9b9fb7b113ac0d", "score": "0.5137504", "text": "func isInRect(pos TowerPos, start TowerPos, end TowerPos) bool {\n\treturn (pos.X >= start.X && pos.X <= end.X && pos.Y >= start.Y && pos.Y <= end.Y)\n}", "title": "" }, { "docid": "c6fc4b7e4298ae2a91b68e5ac3fcc62d", "score": "0.5120894", "text": "func (p *Primitives) BoundingBoxOfLines() (left, top, right, bottom float64) {\n\tconst huge = 1e12\n\tleft = huge\n\ttop = huge\n\tright = -huge\n\tbottom = -huge\n\tfor _, line := range p.Lines {\n\t\tfor _, pt := range []Point{line.P1, line.P2} {\n\t\t\tif pt.X < left {\n\t\t\t\tleft = pt.X\n\t\t\t}\n\t\t\tif pt.Y < top {\n\t\t\t\ttop = pt.Y\n\t\t\t}\n\t\t\tif pt.X > right {\n\t\t\t\tright = pt.X\n\t\t\t}\n\t\t\tif pt.Y > bottom {\n\t\t\t\tbottom = pt.Y\n\t\t\t}\n\t\t}\n\t}\n\treturn\n}", "title": "" }, { "docid": "0bba2b7766849ddf1249bf4c9cf1bfec", "score": "0.5115442", "text": "func (r *rRect) contains(b *rRect) bool {\n\tfor i := 0; i < rDims; i++ {\n\t\tif b.min[i] < r.min[i] || b.max[i] > r.max[i] {\n\t\t\treturn false\n\t\t}\n\t}\n\treturn true\n}", "title": "" }, { "docid": "312877f0f8f13c66925f8905e48921d6", "score": "0.50848967", "text": "func (r *Rectangle) Intersect(s *Rectangle) *Rectangle {\n\tif r.topCorner.Column < s.topCorner.Column {\n\t\tr.topCorner.Column = s.topCorner.Column\n\t}\n\tif r.topCorner.Row < s.topCorner.Row {\n\t\tr.topCorner.Row = s.topCorner.Row\n\t}\n\tif r.bottomCorner.Column > s.bottomCorner.Column {\n\t\tr.bottomCorner.Column = s.bottomCorner.Column\n\t}\n\tif r.bottomCorner.Row > s.bottomCorner.Row {\n\t\tr.bottomCorner.Row = s.bottomCorner.Row\n\t}\n\t// Letting r0 and s0 be the values of r and s at the time that the method is called, this next line is equivalent to:\n\t// if max(r0.topCorner.Column, s0.topCorner.Column) >= min(r0.bottomCorner.Column, s0.bottomCorner.Column) || likewiseForRow { etc }\n\tif r.Empty() {\n\t\treturn &Rectangle{}\n\t}\n\treturn r\n}", "title": "" }, { "docid": "d7586e0195740aba0b841e90ff920af9", "score": "0.5082874", "text": "func (b *Bounds) Overlaps(b2 *Bounds) bool {\n\treturn b.Min.X <= b2.Max.X && b.Min.Y <= b2.Max.Y && b.Max.X >= b2.Min.X && b.Max.Y >= b2.Min.Y\n}", "title": "" }, { "docid": "ab45d4954796702f938f29c69067ec90", "score": "0.508124", "text": "func (b *board) WithinBounds(x, y int) bool {\n\tif x >= 0 && y >= 0 {\n\t\tif x < b.width && y < b.height {\n\t\t\treturn true\n\t\t}\n\t}\n\treturn false\n}", "title": "" }, { "docid": "63ffd5b329a99a0375bd2450e40f0f7a", "score": "0.505833", "text": "func (r Rectangle) Intersect(s Rectangle) Rectangle {}", "title": "" }, { "docid": "162a4dfc9b87a0f230044fc2dcdd6ffe", "score": "0.50580394", "text": "func (r Rectangle) Overlaps(s Rectangle) bool {}", "title": "" }, { "docid": "1298f6eb12bfa7cea83da4479980bfdd", "score": "0.5054869", "text": "func (r *Rectangle) Overlaps(s *Rectangle) bool {\n\treturn !r.Empty() && !s.Empty() && r.topCorner.Column < s.bottomCorner.Column && s.topCorner.Column < r.bottomCorner.Column && r.topCorner.Row < s.bottomCorner.Row && s.topCorner.Row < r.bottomCorner.Row\n}", "title": "" }, { "docid": "789a1570a5943af57f87af23c2e4d83b", "score": "0.50504667", "text": "func (b *BBox) IntersectPOptimized(ray *geometry.Ray, invDir *geometry.Vector, dirIsNeg [3]bool) bool {\n\tvar p0x, p0y, p1x, p1y float64\n\n\tif dirIsNeg[0] {\n\t\tp0x = b.Max.X\n\t\tp0y = b.Min.X\n\t} else {\n\t\tp0x = b.Min.X\n\t\tp0y = b.Max.X\n\t}\n\n\tif dirIsNeg[1] {\n\t\tp1x = b.Max.Y\n\t\tp1y = b.Min.Y\n\t} else {\n\t\tp1x = b.Min.Y\n\t\tp1y = b.Max.Y\n\t}\n\n\ttmin := (p0x - ray.Origin.X) * invDir.X\n\ttmax := (p0y - ray.Origin.X) * invDir.X\n\ttymin := (p1x - ray.Origin.Y) * invDir.Y\n\ttymax := (p1y - ray.Origin.Y) * invDir.Y\n\tif tmin > tymax || tymin > tmax {\n\t\treturn false\n\t}\n\tif tymin > tmin {\n\t\ttmin = tymin\n\t}\n\tif tymax < tmax {\n\t\ttmax = tymax\n\t}\n\n\tvar p2x, p2y float64\n\n\tif dirIsNeg[2] {\n\t\tp2x = b.Max.Z\n\t\tp2y = b.Min.Z\n\t} else {\n\t\tp2x = b.Min.Z\n\t\tp2y = b.Max.Z\n\t}\n\n\ttzmin := (p2x - ray.Origin.Z) * invDir.Z\n\ttzmax := (p2y - ray.Origin.Z) * invDir.Z\n\n\tif (tmin > tzmax) || (tzmin > tmax) {\n\t\treturn false\n\t}\n\tif tzmin > tmin {\n\t\ttmin = tzmin\n\t}\n\tif tzmax < tmax {\n\t\ttmax = tzmax\n\t}\n\treturn (tmin < ray.Maxt) && (tmax > ray.Mint)\n}", "title": "" }, { "docid": "a754711777af1316762fb95b385653c5", "score": "0.50386345", "text": "func (r Rect) InBounds(x, y int) bool {\n\tif x < r.X || x >= r.X {\n\t\treturn false\n\t}\n\tif y < r.Y || y >= r.Y {\n\t\treturn false\n\t}\n\treturn true\n}", "title": "" }, { "docid": "5788aee57ce99e865eadfb2513f9326c", "score": "0.50105476", "text": "func (t *textTable) bbox() model.PdfRectangle {\n\treturn t.PdfRectangle\n}", "title": "" }, { "docid": "a5461cb86296ee35cea46b8226ff6dcf", "score": "0.4992307", "text": "func (q *QuadTree) MatchedContainsRect(matcher Matcher, rect geom.Rect) bool {\n\tif q.root != nil {\n\t\tif q.root.matchedContainsRect(matcher, rect) {\n\t\t\treturn true\n\t\t}\n\t}\n\tfor _, one := range q.outside {\n\t\tif one.Bounds().ContainsRect(rect) && matcher.Matches(one) {\n\t\t\treturn true\n\t\t}\n\t}\n\treturn false\n}", "title": "" }, { "docid": "04ca70d48c33def57a09ea2fe8a10e88", "score": "0.4984339", "text": "func NewBBox(xmin, ymin, xmax, ymax float64) (BBox, error) {\n\n\tif xmin >= xmax {\n\t\treturn nil, errRightLowerThanLeft\n\t}\n\tif ymin >= ymax {\n\t\treturn nil, errTopLowerThanBottom\n\t}\n\treturn &bbox{xmin, xmax, ymin, ymax}, nil\n}", "title": "" }, { "docid": "230842ed446523b41071290a40bced2c", "score": "0.49787652", "text": "func (c *Circle) ContainsRectangle(r *rectangle.Rectangle) bool {\n\treturn ContainsRectangle(c, r)\n}", "title": "" }, { "docid": "9a9782d6c5a57be622e47a8391b76017", "score": "0.49684402", "text": "func (self *Polygon) Intersects(other Geometry) bool {\n\t//checks for non-geometry types\n\tif IsNullGeometry(other) {\n\t\treturn false\n\t}\n\n\tvar bln = false\n\tvar within_bounds bool\n\tvar rings []*LineString\n\tvar ln *LineString\n\n\t//reverse intersect line inter poly\n\tif other.Type().IsSegment() ||\n\t\tother.Type().IsLineString() || other.Type().IsPoint() {\n\n\t\tln = other.AsLinear()[0]\n\t\twithin_bounds = self.Shell.bbox.Intersects(&ln.bbox.MBR)\n\t\trings = self.AsLinear()\n\t\tbln = within_bounds && ln.intersects_polygon(rings)\n\n\t} else if other.Type().IsPolygon() {\n\t\tvar ply = CastAsPolygon(other)\n\t\tif self.Shell.bbox.Intersects(&ply.Shell.bbox.MBR) {\n\t\t\tvar small, big *Polygon\n\n\t\t\tif self.Shell.bbox.Area() < ply.Shell.bbox.Area() {\n\t\t\t\tsmall, big = self, ply\n\t\t\t} else {\n\t\t\t\tsmall, big = ply, self\n\t\t\t}\n\t\t\tbln = small.Shell.LineString.intersects_polygon(big.AsLinear())\n\t\t}\n\t}\n\n\treturn bln\n}", "title": "" }, { "docid": "2e3c4c48c63bdc7b33b04ae19fa3b9cb", "score": "0.49641064", "text": "func (s *MultiCircleSDF2) BoundingBox() Box2 {\n\treturn s.bb\n}", "title": "" }, { "docid": "266bcbe7ec79f1fe9cf9d14a80dc8327", "score": "0.49634746", "text": "func (c coordinates) isInBounds(rows, cols int) bool {\n\treturn c.x >= 0 && c.x < cols && c.y >= 0 && c.y < rows\n}", "title": "" }, { "docid": "c12d2276c7081e3a04159197e208512c", "score": "0.49602333", "text": "func (q *QuadTree) ContainsRect(rect geom.Rect) bool {\n\tif q.root != nil {\n\t\tif q.root.containsRect(rect) {\n\t\t\treturn true\n\t\t}\n\t}\n\tfor _, one := range q.outside {\n\t\tif one.Bounds().ContainsRect(rect) {\n\t\t\treturn true\n\t\t}\n\t}\n\treturn false\n}", "title": "" }, { "docid": "38cab308e7e0919f0f9705bd72ef9da4", "score": "0.4954852", "text": "func isInSegmentEnvelopes(data *lineIntersectorData, intersectionPoint geom.Coord) bool {\n\tintersection1 := internal.IsPointWithinLineBounds(intersectionPoint, data.inputLines[0][0], data.inputLines[0][1])\n\tintersection2 := internal.IsPointWithinLineBounds(intersectionPoint, data.inputLines[1][0], data.inputLines[1][1])\n\n\treturn intersection1 && intersection2\n}", "title": "" }, { "docid": "94e4c05af93963af327f4b717652be51", "score": "0.49030507", "text": "func (r *Rectangle) In(s *Rectangle) bool {\n\tif r.Empty() {\n\t\treturn true\n\t}\n\t// Note that r.bottomCorner is an exclusive bound for r, so that r.In(s)/ does not require that r.bottomCorner.In(s).\n\treturn s.topCorner.Column <= r.topCorner.Column && r.bottomCorner.Column <= s.bottomCorner.Column && s.topCorner.Row <= r.topCorner.Row && r.bottomCorner.Row <= s.bottomCorner.Row\n}", "title": "" }, { "docid": "7c54c6d48011811f3ab1b40208f94681", "score": "0.4902436", "text": "func rayIntersectsSegment(p, a, b XY) bool {\n\treturn (a.Y > p.Y) != (b.Y > p.Y) &&\n\t\tp.X < (b.X-a.X)*(p.Y-a.Y)/(b.Y-a.Y)+a.X\n}", "title": "" }, { "docid": "06d3e41329cf7766a94b931259178c2d", "score": "0.48956352", "text": "func (p *Point) IsInBounds(b Bounds) bool {\n\treturn p.X >= b.Min.X && p.X < b.Max.X &&\n\t\tp.Y >= b.Min.Y && p.Y < b.Max.Y &&\n\t\tp.Z >= b.Min.Z && p.Z < b.Max.Z\n}", "title": "" }, { "docid": "6ace9082c4e41dcc7713de5f412a077b", "score": "0.48910746", "text": "func (s Line) BBox() vec2.Rect {\n\treturn s.bbox\n}", "title": "" }, { "docid": "d9f5b641aeb3cead5a7e112623512c43", "score": "0.48847252", "text": "func (b *Border) Contains(coord Coordinates) bool {\n\t_, exists := b.coords[coord]\n\treturn exists\n}", "title": "" }, { "docid": "cac531ad843e0c928bab88e2192939b2", "score": "0.48787838", "text": "func (rb *Bitmap) Intersect(x2 *Bitmap) bool {\n\tanswer := bool(C.roaring_bitmap_intersect(rb.cpointer, x2.cpointer))\n\truntime.KeepAlive(rb)\n\truntime.KeepAlive(x2)\n\treturn answer\n}", "title": "" }, { "docid": "c9da2f1b49edb7a48366f4c897385ff7", "score": "0.48748195", "text": "func (r1 Rectangle) Intersect(r2 Rectangle) (Rectangle, bool) {\n\tvar x1, y1, w1, h1 float64\n\tvar x2, y2, w2, h2 float64\n\n\tif r1.X < r2.X {\n\t\tx1 = r1.X\n\t\tw1 = r1.Width\n\t\tx2 = r2.X\n\t\tw2 = r2.Width\n\t} else {\n\t\tx2 = r1.X\n\t\tw2 = r1.Width\n\t\tx1 = r2.X\n\t\tw1 = r2.Width\n\t}\n\n\tif r1.Y < r2.Y {\n\t\ty1 = r1.Y\n\t\th1 = r1.Height\n\t\ty2 = r2.Y\n\t\th2 = r2.Height\n\t} else {\n\t\ty2 = r1.Y\n\t\th2 = r1.Height\n\t\ty1 = r2.Y\n\t\th1 = r2.Height\n\t}\n\tr := intersectNormalizedRectangles(NewRect(x1, y1, w1, h1), NewRect(x2, y2, w2, h2))\n\treturn r, r.Width > 0 && r.Height > 0\n}", "title": "" }, { "docid": "fb8a8b4e91b8add31cdafd570354ac9a", "score": "0.48635328", "text": "func (v *Vec2) IsInside(a Vec2) bool {\n\treturn v.X >= 0 && v.X < a.X && v.Y >= 0 && v.Y < a.Y\n}", "title": "" }, { "docid": "e59952a44aaf4c460902ec89bfa0dc6c", "score": "0.48608765", "text": "func checkLineBox(B1, B2, L1, L2 mgl32.Vec3) (bool, mgl32.Vec3) {\n\tvar Hit mgl32.Vec3\n\n\tif L2.X() < B1.X() && L1.X() < B1.X() {\n\t\treturn false, mgl32.Vec3{}\n\t}\n\tif L2.X() > B2.X() && L1.X() > B2.X() {\n\t\treturn false, mgl32.Vec3{}\n\t}\n\tif L2.Y() < B1.Y() && L1.Y() < B1.Y() {\n\t\treturn false, mgl32.Vec3{}\n\t}\n\tif L2.Y() > B2.Y() && L1.Y() > B2.Y() {\n\t\treturn false, mgl32.Vec3{}\n\t}\n\tif L2.Z() < B1.Z() && L1.Z() < B1.Z() {\n\t\treturn false, mgl32.Vec3{}\n\t}\n\tif L2.Z() > B2.Z() && L1.Z() > B2.Z() {\n\t\treturn false, mgl32.Vec3{}\n\t}\n\tif L1.X() > B1.X() && L1.X() < B2.X() &&\n\t\tL1.Y() > B1.Y() && L1.Y() < B2.Y() &&\n\t\tL1.Z() > B1.Z() && L1.Z() < B2.Z() {\n\t\tHit = L1\n\t\treturn true, Hit\n\t}\n\tif (getIntersection(L1.X()-B1.X(), L2.X()-B1.X(), L1, L2, &Hit) && inBox(Hit, B1, B2, 1)) ||\n\t\t(getIntersection(L1.Y()-B1.Y(), L2.Y()-B1.Y(), L1, L2, &Hit) && inBox(Hit, B1, B2, 2)) ||\n\t\t(getIntersection(L1.Z()-B1.Z(), L2.Z()-B1.Z(), L1, L2, &Hit) && inBox(Hit, B1, B2, 3)) ||\n\t\t(getIntersection(L1.X()-B2.X(), L2.X()-B2.X(), L1, L2, &Hit) && inBox(Hit, B1, B2, 1)) ||\n\t\t(getIntersection(L1.Y()-B2.Y(), L2.Y()-B2.Y(), L1, L2, &Hit) && inBox(Hit, B1, B2, 2)) ||\n\t\t(getIntersection(L1.Z()-B2.Z(), L2.Z()-B2.Z(), L1, L2, &Hit) && inBox(Hit, B1, B2, 3)) {\n\t\treturn true, Hit\n\t}\n\n\treturn false, mgl32.Vec3{}\n}", "title": "" }, { "docid": "ffacb1d7d7451770b43a3a1eb855f74c", "score": "0.48442125", "text": "func (self *Segment) Intersects(other Geometry) bool {\n\treturn self.AsLineString().Intersects(other)\n}", "title": "" }, { "docid": "2a59ecddab4f025410747821d1989efe", "score": "0.4841314", "text": "func (q *QuadTree) ContainedByRect(rect geom.Rect) bool {\n\tif q.root != nil {\n\t\tif q.root.containedByRect(rect) {\n\t\t\treturn true\n\t\t}\n\t}\n\tfor _, one := range q.outside {\n\t\tif rect.ContainsRect(one.Bounds()) {\n\t\t\treturn true\n\t\t}\n\t}\n\treturn false\n}", "title": "" }, { "docid": "d917aa70be27b92893c7828bfbb225c3", "score": "0.4828666", "text": "func (g FeatureCollection) Intersects(o Object) bool {\n\treturn intersectsObjectShared(g, o,\n\t\tfunc(v Polygon) bool {\n\t\t\tif len(g.Features) == 0 {\n\t\t\t\treturn false\n\t\t\t}\n\t\t\tfor _, f := range g.Features {\n\t\t\t\tif f.Intersects(o) {\n\t\t\t\t\treturn true\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn false\n\t\t},\n\t\tfunc(v MultiPolygon) bool {\n\t\t\tif len(g.Features) == 0 {\n\t\t\t\treturn false\n\t\t\t}\n\t\t\tfor _, f := range g.Features {\n\t\t\t\tif f.Intersects(o) {\n\t\t\t\t\treturn true\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn false\n\t\t},\n\t)\n}", "title": "" }, { "docid": "222ab62f6b3847f199f6b4c722687638", "score": "0.48280802", "text": "func (r Rectangle) Contains(v Vector2) bool {\n\treturn r.Min.X <= v.X && r.Max.X >= v.X && r.Min.Y <= v.Y && r.Max.Y >= v.Y\n}", "title": "" }, { "docid": "58bf18b07af57f3f425387281f70b6d7", "score": "0.48254737", "text": "func (nb *Node2DBase) ComputeBBox2DBase(parBBox image.Rectangle, delta image.Point) {\n\tnb.ObjBBox = nb.BBox.Add(delta)\n\tnb.VpBBox = parBBox.Intersect(nb.ObjBBox)\n\tnb.SetWinBBox()\n}", "title": "" }, { "docid": "2c181c1e1fa19167f5d80ca6b9c8d100", "score": "0.48251438", "text": "func GetIntersectingRectangle(rectangleA Rectangle, rectangleB Rectangle) (Rectangle, bool) {\n\tvar rectangleC Rectangle\n\tx1, y1 := rectangleA.X, rectangleA.Y-rectangleA.H\n\tx2, y2 := rectangleA.X+rectangleA.W, rectangleA.Y\n\tx3, y3 := rectangleB.X, rectangleB.Y-rectangleB.H\n\tx4, y4 := rectangleB.X+rectangleB.W, rectangleB.Y\n\tx5 := math.Max(x1, x3)\n\ty5 := math.Max(y1, y3)\n\tx6 := math.Min(x2, x4)\n\ty6 := math.Min(y2, y4)\n\tif x5 >= x6 || y5 >= y6 {\n\t\treturn rectangleC, false\n\t}\n\t// fmt.Println(\"(\", x1, \", \", y1, \")\")\n\t// fmt.Println(\"(\", x2, \", \", y2, \")\")\n\t// fmt.Println(\"(\", x3, \", \", y3, \")\")\n\t// fmt.Println(\"(\", x4, \", \", y4, \")\")\n\t// fmt.Println(\"(\", x5, \", \", y5, \")\")\n\t// fmt.Println(\"(\", x6, \", \", y6, \")\")\n\trectangleC.X = x5\n\trectangleC.Y = y6\n\trectangleC.H = y6 - y5\n\trectangleC.W = x6 - x5\n\treturn rectangleC, true\n}", "title": "" }, { "docid": "0e30fadcfa91bac59c29c12a076ccd27", "score": "0.48180762", "text": "func intersect(ax, ay, bx, by, cx, cy, dx, dy int) bool {\n\treturn (ccw(ax, ay, cx, cy, dx, dy) != ccw(bx, by, cx, cy, dx, dy) && ccw(ax, ay, bx, by, cx, cy) != ccw(ax, ay, bx, by, dx, dy))\n}", "title": "" }, { "docid": "957977079ea8cf8011565b7129336236", "score": "0.48146528", "text": "func (r Rect) Contains(other Rect) bool {\n\treturn r.X.ContainsInterval(other.X) && r.Y.ContainsInterval(other.Y)\n}", "title": "" }, { "docid": "8099a5e8a2c1aa9d94f56abf79d64ac0", "score": "0.4808521", "text": "func (s *DifferenceSDF2) BoundingBox() Box2 {\n\treturn s.bb\n}", "title": "" }, { "docid": "72e4649dd970e9ca1ba64b07d64cfd58", "score": "0.48064864", "text": "func (p Point) IntersectsCell(c Cell) bool {\n\treturn c.ContainsPoint(p)\n}", "title": "" }, { "docid": "94848cfd4c08c3d8ce255a47b568fdf9", "score": "0.48030216", "text": "func (c Cell) IntersectsCell(oc Cell) bool {\n\treturn c.id.Intersects(oc.id)\n}", "title": "" }, { "docid": "7605f9664e6141f250e28361550b6bfc", "score": "0.48028484", "text": "func intersects(left0, right0, left1, right1 int) bool {\n\t// Invariant: left0 <= right0 && left1 <= right1\n\tif left0 <= left1 {\n\t\treturn right0 >= left1\n\t} else {\n\t\treturn left0 <= right1\n\t}\n}", "title": "" }, { "docid": "189bb6481f2f3b79343c2d525ad980f0", "score": "0.48020178", "text": "func (s *LineSDF2) BoundingBox() Box2 {\n\treturn s.bb\n}", "title": "" }, { "docid": "6573a13836b781cddde0272634fafbd3", "score": "0.48006243", "text": "func (b *Bounds) Intersect(o Bounds) Bounds {\n\tif b.IsEmpty() || o.IsEmpty() || !b.Overlaps(o) {\n\t\treturn Bounds{\n\t\t\tStart: b.Start,\n\t\t\tStop: b.Start,\n\t\t}\n\t}\n\ti := Bounds{}\n\n\ti.Start = b.Start\n\tif o.Start > b.Start {\n\t\ti.Start = o.Start\n\t}\n\n\ti.Stop = b.Stop\n\tif o.Stop < b.Stop {\n\t\ti.Stop = o.Stop\n\t}\n\n\treturn i\n}", "title": "" } ]
d012967a684700c255522e38d2615b14
Header gets notification header
[ { "docid": "38027d9d60226a780f008859356c1f6c", "score": "0.75154746", "text": "func (n *Notification) Header() *NotificationHeader {\n\treturn (*NotificationHeader)(unsafe.Pointer(&n.Data[0]))\n}", "title": "" } ]
[ { "docid": "57af41a9a74fc27af63d504be66b495c", "score": "0.64773", "text": "func (f *fixedLibrarianSubscribeClient) Header() (metadata.MD, error) {\n\treturn nil, nil\n}", "title": "" }, { "docid": "a29caca0c0d5b2768b457e2f2e37736c", "score": "0.64263725", "text": "func Header(st streams.Stream) string {\n\ttitle := st.Metadata.Title\n\tscope := st.Metadata.Scope\n\ts := \"\"\n\n\tswitch {\n\tcase title != \"\" && scope == \"\":\n\t\ts = title\n\tcase title == \"\" && scope != \"\":\n\t\ts = scope\n\tcase title != \"\" && scope != \"\":\n\t\ts = title + \": \" + scope\n\t}\n\n\treturn s\n}", "title": "" }, { "docid": "496db505d60185c304ead71874c6effe", "score": "0.6398776", "text": "func (*BacklogFormatter) GetHeader() string {\n\treturn \"|Host|Value|h\\n\"\n}", "title": "" }, { "docid": "80d7580f66db1237db197418baaca000", "score": "0.6372693", "text": "func (c *ProjectsNotificationConfigsGetCall) Header() http.Header {\n\tif c.header_ == nil {\n\t\tc.header_ = make(http.Header)\n\t}\n\treturn c.header_\n}", "title": "" }, { "docid": "358a9a9fa8bbcd2dd40c4855cb337eda", "score": "0.6265403", "text": "func (i *Input)Header(key string)string {\n\treturn i.request.Header.Get(key)\n}", "title": "" }, { "docid": "a07f2153aef14a5b1abb53b26f978131", "score": "0.62614703", "text": "func (c *Ctx) Header(s string) string {\n\treturn c.Req.Header.Get(s)\n}", "title": "" }, { "docid": "e50b30df686d795c023503d07805aede", "score": "0.6251353", "text": "func (c *OrganizationsNotificationConfigsGetCall) Header() http.Header {\n\tif c.header_ == nil {\n\t\tc.header_ = make(http.Header)\n\t}\n\treturn c.header_\n}", "title": "" }, { "docid": "1751452113cab134ba1556e2b3653c55", "score": "0.62443787", "text": "func (pkt *PublishPacket) Header() *FixedHeader {\n\t// Topic + Data\n\tlength := 2 + len(pkt.Topic) + len(pkt.Data)\n\tif pkt.header.QoS > 0 {\n\t\tlength += 2 // Message ID field\n\t}\n\tpkt.header.Length = length\n\treturn pkt.header\n}", "title": "" }, { "docid": "21366b802e952f52f9c56903f65e4227", "score": "0.6241312", "text": "func (pkt *SubscribePacket) Header() *FixedHeader {\n\t// MessageID + Topics*(Topic Length + QoS)\n\tlength := 2 + len(pkt.Topics)*(2+1)\n\tfor _, topic := range pkt.Topics {\n\t\tlength += len(topic.Name)\n\t}\n\tpkt.header.Length = length\n\treturn pkt.header\n}", "title": "" }, { "docid": "5d7b61528c0e5314f54305e843a40615", "score": "0.622008", "text": "func (w *Whisper) Header() *Header { return &w.header }", "title": "" }, { "docid": "97adb4016777dc5d2054b762a070c871", "score": "0.62096834", "text": "func (pkt *SubAckPacket) Header() *FixedHeader {\n\t// MessageID + Topics*(granted QoS)\n\tlength := 2 + len(pkt.Granted)\n\tpkt.header.Length = length\n\treturn pkt.header\n}", "title": "" }, { "docid": "8794d8a52d06425e2e8833aafcf0a35d", "score": "0.61813855", "text": "func (req Request)header(key string) string {\n\treturn req.r.Header.Get(key)\n}", "title": "" }, { "docid": "ca7fcd12a13274717e7cfa1752588320", "score": "0.6180908", "text": "func (t Target) Header() []string {\n\treturn []string{\"SERVER\", \"JOB\", \"SCRAPE_URL\", \"LAST_SCRAPE\", \"LABELS\", \"LAST_ERROR\", \"HEALTH\"}\n}", "title": "" }, { "docid": "0a12e2b062cc38ac69678dbc07e1f073", "score": "0.61798185", "text": "func (c *FoldersNotificationConfigsGetCall) Header() http.Header {\n\tif c.header_ == nil {\n\t\tc.header_ = make(http.Header)\n\t}\n\treturn c.header_\n}", "title": "" }, { "docid": "4e10247c640030aab3d9b846891911d7", "score": "0.6176153", "text": "func (*BacklogCodeFormatter) GetHeader() string {\n\treturn \"\"\n}", "title": "" }, { "docid": "1df70740d4a82976e3eef965a9d924b2", "score": "0.61659575", "text": "func (c *ProjectsNotificationConfigsListCall) Header() http.Header {\n\tif c.header_ == nil {\n\t\tc.header_ = make(http.Header)\n\t}\n\treturn c.header_\n}", "title": "" }, { "docid": "4bf3b0b16efc08259c574bb5dfef93e6", "score": "0.616139", "text": "func getXMLHeader() string {\n\treturn header\n}", "title": "" }, { "docid": "b52316674db1f8bed6c236c93dbbf827", "score": "0.6141948", "text": "func (pkt *UnsubscribePacket) Header() *FixedHeader {\n\t// MessageID + Topics*(Topic Length)\n\tlength := 2 + len(pkt.Topics)*(2)\n\tfor _, topic := range pkt.Topics {\n\t\tlength += len(topic)\n\t}\n\tpkt.header.Length = length\n\treturn pkt.header\n}", "title": "" }, { "docid": "3fca1613fc99ccdba9a48d2b8696fcb6", "score": "0.61214465", "text": "func Header(ctx context.Context, key string) (string, bool) {\n\tif l, ok := HeaderN(ctx, key, 1); ok {\n\t\treturn l[0], ok\n\t}\n\treturn \"\", false\n}", "title": "" }, { "docid": "6c7f86fc52b918d444b50034904dc9a6", "score": "0.6121078", "text": "func HeaderGetTimestamp(service *NeoVmService, engine *vm.ExecutionEngine) error {\n\td, err := vm.PopInteropInterface(engine)\n\tif err != nil {\n\t\treturn err\n\t}\n\tvar data *types.Header\n\tif b, ok := d.(*types.Block); ok {\n\t\tdata = b.Header\n\t} else if h, ok := d.(*types.Header); ok {\n\t\tdata = h\n\t} else {\n\t\treturn errors.NewErr(\"[HeaderGetTimestamp] Wrong type!\")\n\t}\n\tvm.PushData(engine, data.Timestamp)\n\treturn nil\n}", "title": "" }, { "docid": "6c7f86fc52b918d444b50034904dc9a6", "score": "0.6121078", "text": "func HeaderGetTimestamp(service *NeoVmService, engine *vm.ExecutionEngine) error {\n\td, err := vm.PopInteropInterface(engine)\n\tif err != nil {\n\t\treturn err\n\t}\n\tvar data *types.Header\n\tif b, ok := d.(*types.Block); ok {\n\t\tdata = b.Header\n\t} else if h, ok := d.(*types.Header); ok {\n\t\tdata = h\n\t} else {\n\t\treturn errors.NewErr(\"[HeaderGetTimestamp] Wrong type!\")\n\t}\n\tvm.PushData(engine, data.Timestamp)\n\treturn nil\n}", "title": "" }, { "docid": "a8c3106c6081fdc182b7a83ecf4e6dad", "score": "0.61137074", "text": "func (res *response) Header() Header {\n return res.header\n}", "title": "" }, { "docid": "8d9a55b11a7b450e746724501c36746a", "score": "0.6092037", "text": "func Header(headerName, keyName string) sallust.LoggerFunc {\n\theaderName = textproto.CanonicalMIMEHeaderKey(headerName)\n\n\treturn func(kv []zap.Field, request *http.Request) []zap.Field {\n\t\tvalues := request.Header[headerName]\n\t\tswitch len(values) {\n\t\tcase 0:\n\t\t\treturn append(kv, zap.String(keyName, \"\"))\n\t\tcase 1:\n\t\t\treturn append(kv, zap.String(keyName, values[0]))\n\t\tdefault:\n\t\t\treturn append(kv, zap.Strings(keyName, values))\n\t\t}\n\t}\n}", "title": "" }, { "docid": "703f8d77d2a62aaf868bacf8d2bd2f1d", "score": "0.60875267", "text": "func headerGet(h http.Header, key string) string {\n\tif v := h[key]; len(v) > 0 {\n\t\treturn v[0]\n\t}\n\treturn \"\"\n}", "title": "" }, { "docid": "41d15863083eff82340d03b5ec45d768", "score": "0.6075352", "text": "func (r *request) Header(key string) string {\n\tif r.rsp == nil {\n\t\treturn \"\"\n\t}\n\treturn r.rsp.Header.Get(key)\n}", "title": "" }, { "docid": "dc71171b8b637049dee114c778d2b24c", "score": "0.6062736", "text": "func (c *OrganizationsNotificationConfigsListCall) Header() http.Header {\n\tif c.header_ == nil {\n\t\tc.header_ = make(http.Header)\n\t}\n\treturn c.header_\n}", "title": "" }, { "docid": "2bca00a5c928990fa9028b9784cd00f0", "score": "0.60315686", "text": "func (c *FoldersNotificationConfigsListCall) Header() http.Header {\n\tif c.header_ == nil {\n\t\tc.header_ = make(http.Header)\n\t}\n\treturn c.header_\n}", "title": "" }, { "docid": "d44ff7d9c840401d95236db893121b60", "score": "0.6021565", "text": "func (*MarkdownFormatter) GetHeader() string {\n\treturn `|Host|Value|\n|---|---|\n`\n}", "title": "" }, { "docid": "cd1d2a42b175deb464016bb69d5b41fd", "score": "0.601901", "text": "func (e *Encoder) getHeader(mn, w, h int64, mv byte) string {\r\n\tif mv > 1 {\r\n\t\treturn fmt.Sprintf(\"P%d\\n%d %d\\n%d\\n\", mn, w, h, mv)\r\n\t}\r\n\treturn fmt.Sprintf(\"P%d\\n%d %d\\n\", mn, w, h)\r\n}", "title": "" }, { "docid": "7cd357c33900b1af9badd094a021bb88", "score": "0.59890896", "text": "func (c *ProjectsNotificationConfigsCreateCall) Header() http.Header {\n\tif c.header_ == nil {\n\t\tc.header_ = make(http.Header)\n\t}\n\treturn c.header_\n}", "title": "" }, { "docid": "7f8357b1e9901412026ac5c0003c081f", "score": "0.5984633", "text": "func (c *Mcontext) GetHeader(key string) string {\n\treturn c.requestHeader(key)\n}", "title": "" }, { "docid": "4d1addc460f360e193f945d31b644de2", "score": "0.5977863", "text": "func (n Noop) Header() http.Header { return make(map[string][]string) }", "title": "" }, { "docid": "c90a4a9a751d078f873fe2dd732ec245", "score": "0.5973205", "text": "func (m *decMessage) getHeader() []byte {\n\treturn m.payload[:headerBytes]\n}", "title": "" }, { "docid": "79c9bf414788fcb17acfad44b910d422", "score": "0.5972556", "text": "func (w monitorWriter) Header() http.Header {\n\treturn w.writer.Header()\n}", "title": "" }, { "docid": "6dd551d8b14fca551b6a4a1c2a7a8844", "score": "0.5966945", "text": "func (c *ProjectsNotificationConfigsPatchCall) Header() http.Header {\n\tif c.header_ == nil {\n\t\tc.header_ = make(http.Header)\n\t}\n\treturn c.header_\n}", "title": "" }, { "docid": "4cb076ae451320cad226f5e21a161516", "score": "0.5959144", "text": "func (c *LiveBroadcastsTransitionCall) Header() http.Header {\n\tif c.header_ == nil {\n\t\tc.header_ = make(http.Header)\n\t}\n\treturn c.header_\n}", "title": "" }, { "docid": "8ae43938ad4f38b9a93738f20ccaf059", "score": "0.59466016", "text": "func (c *Client) notify(headers http.Header) {\n\tfor header, callback := range c.eventHeaderCallbacks {\n\t\tif h := headers.Get(header); h != \"\" {\n\t\t\tcallback(h)\n\t\t}\n\t}\n}", "title": "" }, { "docid": "2b96d9a35bb8f5576a2684b47cdadb23", "score": "0.5936846", "text": "func (me *mockEvent) GetHeaderString(key string) string {\n\targs := me.Called(key)\n\treturn args.String(0)\n}", "title": "" }, { "docid": "9d4c31cc4b8f8c6672a5df9e2e425018", "score": "0.59305835", "text": "func (c *FoldersNotificationConfigsPatchCall) Header() http.Header {\n\tif c.header_ == nil {\n\t\tc.header_ = make(http.Header)\n\t}\n\treturn c.header_\n}", "title": "" }, { "docid": "57947c832dacbb9f3aff214479b82789", "score": "0.5926278", "text": "func (c *IssuesGetCall) Header() http.Header {\n\tif c.header_ == nil {\n\t\tc.header_ = make(http.Header)\n\t}\n\treturn c.header_\n}", "title": "" }, { "docid": "2eaf9f94d566e3f829680ac7254bd842", "score": "0.59205794", "text": "func (c *LiveBroadcastsUpdateCall) Header() http.Header {\n\tif c.header_ == nil {\n\t\tc.header_ = make(http.Header)\n\t}\n\treturn c.header_\n}", "title": "" }, { "docid": "cdf99598d57330977594e48f55354f13", "score": "0.5920361", "text": "func (p *Peer) Header(key string) (string, bool) {\n\tv, ok := p.Headers[key]\n\treturn v, ok\n}", "title": "" }, { "docid": "c1118bd662bf341f9b446ef6336ea576", "score": "0.5912891", "text": "func Header(n string, v string) {\n\tHeaders[n] = v\n}", "title": "" }, { "docid": "965eb5585ffe546216be4fc1b035d037", "score": "0.5907277", "text": "func (c *OrganizationsNotificationConfigsPatchCall) Header() http.Header {\n\tif c.header_ == nil {\n\t\tc.header_ = make(http.Header)\n\t}\n\treturn c.header_\n}", "title": "" }, { "docid": "97b00bc971c3db0666c001ea70dfb260", "score": "0.59062225", "text": "func (b *RegistrationMessage) Header() message.Header {\n\treturn message.Header{\n\t\tFrom: identity.CreateAddressFromString(b.Address),\n\t\tTo: nil,\n\t\tTimestamp: time.Now().Unix(),\n\t}\n}", "title": "" }, { "docid": "4e7a112c82661e57e293825af2e0c123", "score": "0.5905432", "text": "func (r *responseHeader) Header() []byte {\n\tout := make([]byte, len(r.meta)+5)\n\tcopy(out, strconv.Itoa(int(r.Status)))\n\tout[2] = ' '\n\tcopy(out[3:], r.meta)\n\tcopy(out[len(r.meta)+3:], []byte(\"\\r\\n\"))\n\treturn out\n}", "title": "" }, { "docid": "f4d3114698d17e19f81ed784e2f62650", "score": "0.5899731", "text": "func (c *Caller) Header(key string) (value string, ok bool) {\n\tc.dataMu.RLock()\n\tdefer c.dataMu.RUnlock()\n\n\tvalue, ok = c.headers[key]\n\treturn\n}", "title": "" }, { "docid": "a45b1785d9e8665e2485c851fee2fd25", "score": "0.5893459", "text": "func (pkt *ConnectPacket) Header() *FixedHeader {\n\t// Protocol + Version + Flags + KeepAlive + ClientID\n\tlength := 2 + len(pkt.Protocol) + 1 + 1 + 2 + 2 + len(pkt.ClientID)\n\tif pkt.Will != nil {\n\t\tlength += 2 + len(pkt.Will.Topic) + 2 + len(pkt.Will.Data)\n\t}\n\tif pkt.Auth != nil {\n\t\tlength += 2 + len(pkt.Auth.Username) + 2 + len(pkt.Auth.Password)\n\t}\n\tpkt.header.Length = length\n\treturn pkt.header\n}", "title": "" }, { "docid": "765234bbe597e9972b933e55ec7000d6", "score": "0.58905774", "text": "func (c *FoldersNotificationConfigsCreateCall) Header() http.Header {\n\tif c.header_ == nil {\n\t\tc.header_ = make(http.Header)\n\t}\n\treturn c.header_\n}", "title": "" }, { "docid": "0e96441520f9bbb53c64e6f80610cd7d", "score": "0.58860177", "text": "func (c *PretargetingConfigGetCall) Header() http.Header {\n\tif c.header_ == nil {\n\t\tc.header_ = make(http.Header)\n\t}\n\treturn c.header_\n}", "title": "" }, { "docid": "33397394f18207691e5628f5261e55e5", "score": "0.58810574", "text": "func (c *OrganizationsNotificationConfigsCreateCall) Header() http.Header {\n\tif c.header_ == nil {\n\t\tc.header_ = make(http.Header)\n\t}\n\treturn c.header_\n}", "title": "" }, { "docid": "9b514e7b2f584a9aa0bc23067a3a65a8", "score": "0.58680475", "text": "func (p *FullIntraRequest) Header() Header {\n\treturn Header{\n\t\tCount: FormatFIR,\n\t\tType: TypePayloadSpecificFeedback,\n\t\tLength: uint16((p.len() / 4) - 1),\n\t}\n}", "title": "" }, { "docid": "85d897948d44afd5534e8cf28e536527", "score": "0.58641577", "text": "func (c *ProjectsLocationsAgentsWebhooksGetCall) Header() http.Header {\n\tif c.header_ == nil {\n\t\tc.header_ = make(http.Header)\n\t}\n\treturn c.header_\n}", "title": "" }, { "docid": "a8bbb28b5697b3d8f0eedb7c2f7afbae", "score": "0.586088", "text": "func (c *ProjectsNotificationConfigsDeleteCall) Header() http.Header {\n\tif c.header_ == nil {\n\t\tc.header_ = make(http.Header)\n\t}\n\treturn c.header_\n}", "title": "" }, { "docid": "eaf2fcf98c2ec52a22dd45df3df84e4b", "score": "0.5853578", "text": "func (c *LiveBroadcastsListCall) Header() http.Header {\n\tif c.header_ == nil {\n\t\tc.header_ = make(http.Header)\n\t}\n\treturn c.header_\n}", "title": "" }, { "docid": "572fb8b8ca34b896bb5641669ad6530b", "score": "0.5851934", "text": "func GetHeaderInfo(req *http.Request) (h HeaderInfo) {\n\t// update the title if the user is already logged in\n\tstatus := PathInfo{\"Login\", \"/authentication\", \"authentication\"}\n\tif checkLoginStatus(req) {\n\t\tstatus.Title = \"Logout\"\n\t}\n\n\t// nav-bar information\n\th = HeaderInfo{\n\t\tTitle: \"eckon.dev\",\n\t\tNavigation: []PathInfo{\n\t\t\t{\n\t\t\t\t\"Phase\",\n\t\t\t\t\"/phase\",\n\t\t\t\t\"\",\n\t\t\t},\n\t\t\tstatus,\n\t\t},\n\t\tOnHomePage: false,\n\t\tUser: getCurrentUsername(req),\n\t}\n\n\tfor e := range h.Navigation {\n\t\t// if the path is in the headerInfo -> mark it to highlight it in the front end (append class list)\n\t\tif h.Navigation[e].Path == req.URL.String() {\n\t\t\th.Navigation[e].Class += \" highlighted-content\"\n\t\t\treturn\n\t\t}\n\t}\n\t// if no highlight -> it's on the home page\n\th.OnHomePage = true\n\n\treturn\n}", "title": "" }, { "docid": "c3ede8caa85ac40b1df01d72264eb36f", "score": "0.5835885", "text": "func (c *ServicesCheckCall) Header() http.Header {\n\tif c.header_ == nil {\n\t\tc.header_ = make(http.Header)\n\t}\n\treturn c.header_\n}", "title": "" }, { "docid": "b977395615d1734dd8a1d55d53b6628f", "score": "0.5827388", "text": "func (o SubscriptionKeyParameterNamesContractOutput) Header() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v SubscriptionKeyParameterNamesContract) *string { return v.Header }).(pulumi.StringPtrOutput)\n}", "title": "" }, { "docid": "2d1870b63d60c96044b5ae282ac32986", "score": "0.5826086", "text": "func (w *StatusLoggingResponseWriter) Header() http.Header {\n\treturn w.ResponseWriter.Header()\n}", "title": "" }, { "docid": "c63dccdededa947c708b4904319a9714", "score": "0.5812162", "text": "func (c *ServerDetailsCall) Header() http.Header {\n\tif c.header_ == nil {\n\t\tc.header_ = make(http.Header)\n\t}\n\treturn c.header_\n}", "title": "" }, { "docid": "fd1fec5f9230a760fbcf6f9938ffc49c", "score": "0.58095753", "text": "func (p *RapidResynchronizationRequest) Header() Header {\n\treturn Header{\n\t\tCount: FormatRRR,\n\t\tType: TypeTransportSpecificFeedback,\n\t\tLength: rrrLength,\n\t}\n}", "title": "" }, { "docid": "865af25c3a44ed5f0633526fe9d18526", "score": "0.58050364", "text": "func HeaderGetVersion(service *NeoVmService, engine *vm.ExecutionEngine) error {\n\td, err := vm.PopInteropInterface(engine)\n\tif err != nil {\n\t\treturn err\n\t}\n\tvar data *types.Header\n\tif b, ok := d.(*types.Block); ok {\n\t\tdata = b.Header\n\t} else if h, ok := d.(*types.Header); ok {\n\t\tdata = h\n\t} else {\n\t\treturn errors.NewErr(\"[HeaderGetVersion] Wrong type!\")\n\t}\n\tvm.PushData(engine, data.Version)\n\treturn nil\n}", "title": "" }, { "docid": "865af25c3a44ed5f0633526fe9d18526", "score": "0.58050364", "text": "func HeaderGetVersion(service *NeoVmService, engine *vm.ExecutionEngine) error {\n\td, err := vm.PopInteropInterface(engine)\n\tif err != nil {\n\t\treturn err\n\t}\n\tvar data *types.Header\n\tif b, ok := d.(*types.Block); ok {\n\t\tdata = b.Header\n\t} else if h, ok := d.(*types.Header); ok {\n\t\tdata = h\n\t} else {\n\t\treturn errors.NewErr(\"[HeaderGetVersion] Wrong type!\")\n\t}\n\tvm.PushData(engine, data.Version)\n\treturn nil\n}", "title": "" }, { "docid": "090a8ffa743b9fe89f1e425cf32f43cb", "score": "0.57912", "text": "func (c *SuperChatEventsListCall) Header() http.Header {\n\tif c.header_ == nil {\n\t\tc.header_ = make(http.Header)\n\t}\n\treturn c.header_\n}", "title": "" }, { "docid": "b6e867ab4254950a7ebf0d40da3abcd1", "score": "0.57873917", "text": "func NotifyWithHeader(header string) Option {\n\treturn func(n *Notification) {\n\t\tn.Header = header\n\t}\n}", "title": "" }, { "docid": "f0a27f700a96d3fc97fdb63d277b99bd", "score": "0.5786506", "text": "func (c *OperationsGetCall) Header() http.Header {\n\tif c.header_ == nil {\n\t\tc.header_ = make(http.Header)\n\t}\n\treturn c.header_\n}", "title": "" }, { "docid": "c1b09a9fd86e386c1b45a7c58ed251a6", "score": "0.57854456", "text": "func (*JSONFormatter) GetHeader() string {\n\treturn \"{\"\n}", "title": "" }, { "docid": "cb97450620e99b00eede2cdabce067e7", "score": "0.57792586", "text": "func (r *request) VersionHeader() string {\n\tif r.rsp == nil {\n\t\treturn \"\"\n\t}\n\treturn r.rsp.Header.Get(versionHeaderKey)\n}", "title": "" }, { "docid": "a899d8996494535459cfa43022ce1e2a", "score": "0.576942", "text": "func (m *Message) GetHeader(key string) string {\n\tif m.headers == nil {\n\t\tm.headers = make(map[string]string)\n\t}\n\treturn m.headers[key]\n}", "title": "" }, { "docid": "1400937339a3b592f80218319a64d820", "score": "0.57692516", "text": "func (c *IssuesModifyCall) Header() http.Header {\n\tif c.header_ == nil {\n\t\tc.header_ = make(http.Header)\n\t}\n\treturn c.header_\n}", "title": "" }, { "docid": "d4fd17b85f608eb5462beb08bb313c76", "score": "0.5768607", "text": "func (c *BillingInfoGetCall) Header() http.Header {\n\tif c.header_ == nil {\n\t\tc.header_ = make(http.Header)\n\t}\n\treturn c.header_\n}", "title": "" }, { "docid": "65cdddb586175a50b39917c686e1911d", "score": "0.5768544", "text": "func (h Header) Get(key string) string {\n\treturn textproto.MIMEHeader(h).Get(key)\n}", "title": "" }, { "docid": "65cdddb586175a50b39917c686e1911d", "score": "0.5768544", "text": "func (h Header) Get(key string) string {\n\treturn textproto.MIMEHeader(h).Get(key)\n}", "title": "" }, { "docid": "65cdddb586175a50b39917c686e1911d", "score": "0.5768544", "text": "func (h Header) Get(key string) string {\n\treturn textproto.MIMEHeader(h).Get(key)\n}", "title": "" }, { "docid": "65cdddb586175a50b39917c686e1911d", "score": "0.5768544", "text": "func (h Header) Get(key string) string {\n\treturn textproto.MIMEHeader(h).Get(key)\n}", "title": "" }, { "docid": "65cdddb586175a50b39917c686e1911d", "score": "0.5768544", "text": "func (h Header) Get(key string) string {\n\treturn textproto.MIMEHeader(h).Get(key)\n}", "title": "" }, { "docid": "65cdddb586175a50b39917c686e1911d", "score": "0.5768544", "text": "func (h Header) Get(key string) string {\n\treturn textproto.MIMEHeader(h).Get(key)\n}", "title": "" }, { "docid": "7ca4858f30f2fd929701f4572e16c5e4", "score": "0.5768238", "text": "func (c *FoldersNotificationConfigsDeleteCall) Header() http.Header {\n\tif c.header_ == nil {\n\t\tc.header_ = make(http.Header)\n\t}\n\treturn c.header_\n}", "title": "" }, { "docid": "39c368c6713fb7a0b95810b4bf54226e", "score": "0.5761982", "text": "func (c *OrganizationsNotificationConfigsDeleteCall) Header() http.Header {\n\tif c.header_ == nil {\n\t\tc.header_ = make(http.Header)\n\t}\n\treturn c.header_\n}", "title": "" }, { "docid": "2229facdb38521e6aad3741ee976262b", "score": "0.57566327", "text": "func (s PostgresStorage) getHeader(reqId string) (*http.Header, error) {\n\theader := http.Header{}\n\treturn &header, nil\n}", "title": "" }, { "docid": "eb06ea6c2cffcd2785b6e4772cf9c4c6", "score": "0.57361686", "text": "func (c *LiveBroadcastsInsertCall) Header() http.Header {\n\tif c.header_ == nil {\n\t\tc.header_ = make(http.Header)\n\t}\n\treturn c.header_\n}", "title": "" }, { "docid": "28eed9ba4cd110e994165b271ffbc0aa", "score": "0.5724792", "text": "func (*MarkdownCodeFormatter) GetHeader() string {\n\treturn \"\"\n}", "title": "" }, { "docid": "bcc43218d5c37880575352f91b3b4cd9", "score": "0.57176226", "text": "func (d Dir) Header(key string) (header mail.Header, err error) {\n\tfilename, err := d.Filename(key)\n\tif err != nil {\n\t\treturn\n\t}\n\tfile, err := os.Open(filename)\n\tif err != nil {\n\t\treturn\n\t}\n\tdefer file.Close()\n\ttp := textproto.NewReader(bufio.NewReader(file))\n\thdr, err := tp.ReadMIMEHeader()\n\tif err != nil {\n\t\treturn\n\t}\n\theader = mail.Header(hdr)\n\treturn\n}", "title": "" }, { "docid": "b8ec8020d24c4d785ee64cbb17f64a9e", "score": "0.57140416", "text": "func (c *SubscriptionsInsertCall) Header() http.Header {\n\tif c.header_ == nil {\n\t\tc.header_ = make(http.Header)\n\t}\n\treturn c.header_\n}", "title": "" }, { "docid": "99c040a6be41a7e1811935433e1c654b", "score": "0.5712319", "text": "func (c *SurveysGetCall) Header() http.Header {\n\tif c.header_ == nil {\n\t\tc.header_ = make(http.Header)\n\t}\n\treturn c.header_\n}", "title": "" }, { "docid": "0dc927257a0e295c965b8b72462225cd", "score": "0.5711469", "text": "func (c *PlatformsPropertiesTopicStatesPatchCall) Header() http.Header {\n\tif c.header_ == nil {\n\t\tc.header_ = make(http.Header)\n\t}\n\treturn c.header_\n}", "title": "" }, { "docid": "89d46c3ef120e46bb7a7caaae6254c65", "score": "0.57100034", "text": "func (req *Request) GetHeader(key string) string {\n\treturn string(req.Req.Header.Peek(key))\n}", "title": "" }, { "docid": "401a323a7612fdc6497c7d484b35f141", "score": "0.57099974", "text": "func (pkt *PingReqPacket) Header() *FixedHeader {\n\treturn pkt.header\n}", "title": "" }, { "docid": "4342792d6407a37ca7b6bceb4de3324a", "score": "0.5708837", "text": "func (b mergeableIATBatch) GetHeaderSignature() string { return b.iatBatch.Header.String()[:87] }", "title": "" }, { "docid": "6390690d77fd82d8e645bffeeeba8b17", "score": "0.5707561", "text": "func ReceiverHeader(h *http.Header) (token, topicFN, pulsarURL string, err bool) {\n\ttoken = strings.TrimSpace(strings.Replace(h.Get(\"Authorization\"), \"Bearer\", \"\", 1))\n\ttopicFN = h.Get(\"TopicFn\")\n\tpulsarURL = h.Get(\"PulsarUrl\")\n\treturn token, topicFN, pulsarURL, token == \"\" || topicFN == \"\" || pulsarURL == \"\"\n\n}", "title": "" }, { "docid": "d97eb129355a9adddd7bd5f0e4758f4b", "score": "0.5705077", "text": "func (c *SubscriptionsListCall) Header() http.Header {\n\tif c.header_ == nil {\n\t\tc.header_ = make(http.Header)\n\t}\n\treturn c.header_\n}", "title": "" }, { "docid": "c626e4920221c7674e099704ce0d4a26", "score": "0.56977683", "text": "func (r *PrivateLinkPrincipalPollResponse) Header() http.Header {\n\tif r == nil {\n\t\treturn nil\n\t}\n\treturn r.response.Header()\n}", "title": "" }, { "docid": "f64e48eb3bdf5dba50e3ec0c86d5cf7f", "score": "0.56968004", "text": "func (lens Lens) Header(artifacts []api.Artifact, resourceDir string, config json.RawMessage, spyglassConfig config.Spyglass) string {\n\toutput, err := renderTemplate(resourceDir, \"header\", nil)\n\tif err != nil {\n\t\tlogrus.Warnf(\"Failed to render header: %v\", err)\n\t\treturn \"Error: \" + err.Error()\n\t}\n\treturn output\n}", "title": "" }, { "docid": "ccfb21fb9f3e2902e4dcc0a0065a55fe", "score": "0.5694545", "text": "func (p Provider) Header(h *jwt.Header) {\n\th.Alg = algToString(p.alg)\n\tif p.settings.kid != \"\" {\n\t\th.Kid = p.settings.kid\n\t}\n\tif p.settings.jku != \"\" {\n\t\th.Jku = p.settings.jku\n\t}\n}", "title": "" }, { "docid": "bad0533b8cb39ac4ecd8e0fb7bf4b329", "score": "0.5688388", "text": "func (t *TestLogger) makeHeader() string {\n\tnow := time.Now()\n\ttimeStr := now.Format(time.RFC3339)\n\n\tnameString := \"\"\n\tif t.name != \"\" {\n\t\tnameString = fmt.Sprintf(\" %s\", t.name)\n\t}\n\n\tseverity := \"I\" // TODO: Technically there are multiple severities?\n\n\treturn fmt.Sprintf(\"%s%s]%s\", severity, timeStr, nameString)\n}", "title": "" }, { "docid": "68b6bdbb7d35d6764928805f17440f14", "score": "0.568777", "text": "func (c *CasesGetCall) Header() http.Header {\n\tif c.header_ == nil {\n\t\tc.header_ = make(http.Header)\n\t}\n\treturn c.header_\n}", "title": "" }, { "docid": "57fdb7c958c8090f81fb28ff09f0c762", "score": "0.5686188", "text": "func printHeader(m *dns.Msg) {\n\tfmt.Printf(\";; ->>HEADER<<- ;; opcode: %s, status: %s, id: %d\\n\",\n\t\topcodeString(m.MsgHdr.Opcode),\n\t\trcodeString(m.MsgHdr.Rcode),\n\t\tm.MsgHdr.Id)\n\tfmt.Printf(\";; flags:\")\n\tif m.MsgHdr.Response {\n\t\tfmt.Printf(\" qr\")\n\t}\n\tif m.MsgHdr.Authoritative {\n\t\tfmt.Printf(\" aa\")\n\t}\n\tif m.MsgHdr.Truncated {\n\t\tfmt.Printf(\" tc\")\n\t}\n\tif m.MsgHdr.RecursionDesired {\n\t\tfmt.Printf(\" rd\")\n\t}\n\tif m.MsgHdr.RecursionAvailable {\n\t\tfmt.Printf(\" ra\")\n\t}\n\tif m.MsgHdr.AuthenticatedData {\n\t\tfmt.Printf(\" ad\")\n\t}\n\tif m.MsgHdr.CheckingDisabled {\n\t\tfmt.Printf(\" cd\")\n\t}\n\tfmt.Printf(\"; QUERY: %d, ANSWER: %d, AUTHORITY: %d, ADDITIONAL: %d\\n\",\n\t\tlen(m.Question), len(m.Answer), len(m.Ns), len(m.Extra))\n\treturn\n}", "title": "" }, { "docid": "b80548ac5caf31f8d2c9332ffb97a15a", "score": "0.5686083", "text": "func checkForHeader(header map[string][]string) {\n\tfmt.Fprintf(color.Output, \"\\n%v\", black(\"== HEADER AUDIT ==\"))\n\n\tfor k := range secHeaders {\n\t\tavailable := false\n\t\tfor h := range header {\n\t\t\tif strings.ToLower(h) == strings.ToLower(k) {\n\t\t\t\tif len(header[k]) <= 0 {\n\t\t\t\t\theader[k] = header[h]\n\t\t\t\t\tdelete(header, h)\n\t\t\t\t}\n\n\t\t\t\tavailable = true\n\t\t\t\tbreak\n\t\t\t}\n\t\t}\n\n\t\tif available {\n\t\t\tfmt.Fprintf(color.Output, \"\\n%v\", green(\"[✔] \", k, \" \", header[k]))\n\t\t} else {\n\t\t\tfmt.Fprintf(color.Output, \"\\n%v\", red(\"[✖] \", k, \" (Not present)\"))\n\t\t}\n\n\t\tif *detailFlag {\n\t\t\tfmt.Fprintf(color.Output, \" ➡ %v\", yellow(secHeaders[k]))\n\t\t}\n\t}\n\n\tfmt.Fprintf(color.Output, \"\\n\\n%v\\n\", black(\"== RAW HEADERS ==\"))\n\n\tfor k, v := range header {\n\t\tfmt.Fprintf(color.Output, \"%v \", cyan(k, \":\"))\n\t\tfor i := range v {\n\t\t\tfmt.Printf(\"%s\\n\", v[i])\n\t\t}\n\t}\n}", "title": "" }, { "docid": "06b435f5d6776b91616415621bf3c9e1", "score": "0.56848073", "text": "func (c *TransferOperationsGetCall) Header() http.Header {\n\tif c.header_ == nil {\n\t\tc.header_ = make(http.Header)\n\t}\n\treturn c.header_\n}", "title": "" }, { "docid": "098c69c5b1ba8006291fb743d50386e7", "score": "0.56829613", "text": "func (c *cliUI) writeHeader() {\n\tfmt.Fprintf(c.App.Writer, \"%s\", cli.CursorTo(1, 1))\n\tfmt.Fprintf(c.App.Writer, \"%s%s%s\", cli.ClearLine, cli.YellowColor.Format(c.App.Name+\"\\n\"), cli.ClearLine)\n\tfmt.Fprintf(c.App.Writer, \"%s%d actions are waiting for your approval\\n%s\\n\", cli.ClearLine.String(), len(c.queue), cli.ClearLine)\n\tfmt.Fprintf(c.App.Writer, \"%s%s%s\", cli.ClearLine, cli.YellowColor.Format(\"QUEUED actions:\\n\"), cli.ClearLine)\n}", "title": "" } ]
24437b3c70af329f4eda4ddb659cb1f9
updateCreateRequest creates the Update request.
[ { "docid": "6325d21bddf2c8d80d1927fe131eb3da", "score": "0.6671661", "text": "func (client *SapMonitorsClient) updateCreateRequest(ctx context.Context, resourceGroupName string, sapMonitorName string, tagsParameter Tags, options *SapMonitorsClientUpdateOptions) (*policy.Request, error) {\n\turlPath := \"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HanaOnAzure/sapMonitors/{sapMonitorName}\"\n\tif client.subscriptionID == \"\" {\n\t\treturn nil, errors.New(\"parameter client.subscriptionID cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{subscriptionId}\", url.PathEscape(client.subscriptionID))\n\tif resourceGroupName == \"\" {\n\t\treturn nil, errors.New(\"parameter resourceGroupName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{resourceGroupName}\", url.PathEscape(resourceGroupName))\n\tif sapMonitorName == \"\" {\n\t\treturn nil, errors.New(\"parameter sapMonitorName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{sapMonitorName}\", url.PathEscape(sapMonitorName))\n\treq, err := runtime.NewRequest(ctx, http.MethodPatch, runtime.JoinPaths(client.internal.Endpoint(), urlPath))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treqQP := req.Raw().URL.Query()\n\treqQP.Set(\"api-version\", \"2020-02-07-preview\")\n\treq.Raw().URL.RawQuery = reqQP.Encode()\n\treq.Raw().Header[\"Accept\"] = []string{\"application/json\"}\n\treturn req, runtime.MarshalAsJSON(req, tagsParameter)\n}", "title": "" } ]
[ { "docid": "f42d5390a417ab882adf8364981081a4", "score": "0.7146215", "text": "func (client *ServersClient) updateCreateRequest(ctx context.Context, resourceGroupName string, serverName string, parameters ServerUpdate, options *ServersClientBeginUpdateOptions) (*policy.Request, error) {\n\turlPath := \"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}\"\n\tif resourceGroupName == \"\" {\n\t\treturn nil, errors.New(\"parameter resourceGroupName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{resourceGroupName}\", url.PathEscape(resourceGroupName))\n\tif serverName == \"\" {\n\t\treturn nil, errors.New(\"parameter serverName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{serverName}\", url.PathEscape(serverName))\n\tif client.subscriptionID == \"\" {\n\t\treturn nil, errors.New(\"parameter client.subscriptionID cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{subscriptionId}\", url.PathEscape(client.subscriptionID))\n\treq, err := runtime.NewRequest(ctx, http.MethodPatch, runtime.JoinPaths(client.internal.Endpoint(), urlPath))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treqQP := req.Raw().URL.Query()\n\treqQP.Set(\"api-version\", \"2022-08-01-preview\")\n\treq.Raw().URL.RawQuery = reqQP.Encode()\n\treq.Raw().Header[\"Accept\"] = []string{\"application/json\"}\n\tif err := runtime.MarshalAsJSON(req, parameters); err != nil {\n\t\treturn nil, err\n\t}\n\treturn req, nil\n}", "title": "" }, { "docid": "c85dad1ccba086b0e42d129704b2d219", "score": "0.7139317", "text": "func (client *AlertsClient) updateCreateRequest(ctx context.Context, scope string, alertID string, parameters Alert, options *AlertsClientUpdateOptions) (*policy.Request, error) {\n\turlPath := \"/{scope}/providers/Microsoft.Authorization/roleManagementAlerts/{alertId}\"\n\turlPath = strings.ReplaceAll(urlPath, \"{scope}\", scope)\n\turlPath = strings.ReplaceAll(urlPath, \"{alertId}\", alertID)\n\treq, err := runtime.NewRequest(ctx, http.MethodPatch, runtime.JoinPaths(client.internal.Endpoint(), urlPath))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treqQP := req.Raw().URL.Query()\n\treqQP.Set(\"api-version\", \"2022-08-01-preview\")\n\treq.Raw().URL.RawQuery = reqQP.Encode()\n\treq.Raw().Header[\"Accept\"] = []string{\"application/json\"}\n\treturn req, runtime.MarshalAsJSON(req, parameters)\n}", "title": "" }, { "docid": "4e5f7bffde619a74799ccb8361dd8059", "score": "0.7115746", "text": "func (client *FactoriesClient) updateCreateRequest(ctx context.Context, resourceGroupName string, factoryName string, factoryUpdateParameters FactoryUpdateParameters, options *FactoriesClientUpdateOptions) (*policy.Request, error) {\n\turlPath := \"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataFactory/factories/{factoryName}\"\n\tif client.subscriptionID == \"\" {\n\t\treturn nil, errors.New(\"parameter client.subscriptionID cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{subscriptionId}\", url.PathEscape(client.subscriptionID))\n\tif resourceGroupName == \"\" {\n\t\treturn nil, errors.New(\"parameter resourceGroupName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{resourceGroupName}\", url.PathEscape(resourceGroupName))\n\tif factoryName == \"\" {\n\t\treturn nil, errors.New(\"parameter factoryName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{factoryName}\", url.PathEscape(factoryName))\n\treq, err := runtime.NewRequest(ctx, http.MethodPatch, runtime.JoinPaths(client.internal.Endpoint(), urlPath))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treqQP := req.Raw().URL.Query()\n\treqQP.Set(\"api-version\", \"2018-06-01\")\n\treq.Raw().URL.RawQuery = reqQP.Encode()\n\treq.Raw().Header[\"Accept\"] = []string{\"application/json\"}\n\treturn req, runtime.MarshalAsJSON(req, factoryUpdateParameters)\n}", "title": "" }, { "docid": "e8e23b16344df0414de9ec764229fd14", "score": "0.7081614", "text": "func (client *CloudServicesClient) updateCreateRequest(ctx context.Context, resourceGroupName string, cloudServiceName string, parameters CloudServiceUpdate, options *CloudServicesClientBeginUpdateOptions) (*policy.Request, error) {\n\turlPath := \"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}\"\n\tif resourceGroupName == \"\" {\n\t\treturn nil, errors.New(\"parameter resourceGroupName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{resourceGroupName}\", url.PathEscape(resourceGroupName))\n\tif cloudServiceName == \"\" {\n\t\treturn nil, errors.New(\"parameter cloudServiceName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{cloudServiceName}\", url.PathEscape(cloudServiceName))\n\tif client.subscriptionID == \"\" {\n\t\treturn nil, errors.New(\"parameter client.subscriptionID cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{subscriptionId}\", url.PathEscape(client.subscriptionID))\n\treq, err := runtime.NewRequest(ctx, http.MethodPatch, runtime.JoinPaths(client.host, urlPath))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treqQP := req.Raw().URL.Query()\n\treqQP.Set(\"api-version\", \"2022-09-04\")\n\treq.Raw().URL.RawQuery = reqQP.Encode()\n\treq.Raw().Header[\"Accept\"] = []string{\"application/json\"}\n\treturn req, runtime.MarshalAsJSON(req, parameters)\n}", "title": "" }, { "docid": "c85189569a71ccbf1f3544c3188823be", "score": "0.69800895", "text": "func (client *AccountsClient) updateCreateRequest(ctx context.Context, resourceGroupName string, accountName string, account Account, options *AccountsClientBeginUpdateOptions) (*policy.Request, error) {\n\turlPath := \"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CognitiveServices/accounts/{accountName}\"\n\tif resourceGroupName == \"\" {\n\t\treturn nil, errors.New(\"parameter resourceGroupName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{resourceGroupName}\", url.PathEscape(resourceGroupName))\n\tif accountName == \"\" {\n\t\treturn nil, errors.New(\"parameter accountName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{accountName}\", url.PathEscape(accountName))\n\tif client.subscriptionID == \"\" {\n\t\treturn nil, errors.New(\"parameter client.subscriptionID cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{subscriptionId}\", url.PathEscape(client.subscriptionID))\n\treq, err := runtime.NewRequest(ctx, http.MethodPatch, runtime.JoinPaths(client.internal.Endpoint(), urlPath))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treqQP := req.Raw().URL.Query()\n\treqQP.Set(\"api-version\", \"2023-05-01\")\n\treq.Raw().URL.RawQuery = reqQP.Encode()\n\treq.Raw().Header[\"Accept\"] = []string{\"application/json\"}\n\treturn req, runtime.MarshalAsJSON(req, account)\n}", "title": "" }, { "docid": "92bf4117e565f1dc8b15e81d20245250", "score": "0.6945986", "text": "func (client *WorkspacesClient) updateCreateRequest(ctx context.Context, resourceGroupName string, workspaceName string, parameters WorkspaceUpdate, options *WorkspacesBeginUpdateOptions) (*policy.Request, error) {\n\turlPath := \"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Databricks/workspaces/{workspaceName}\"\n\tif resourceGroupName == \"\" {\n\t\treturn nil, errors.New(\"parameter resourceGroupName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{resourceGroupName}\", url.PathEscape(resourceGroupName))\n\tif workspaceName == \"\" {\n\t\treturn nil, errors.New(\"parameter workspaceName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{workspaceName}\", url.PathEscape(workspaceName))\n\tif client.subscriptionID == \"\" {\n\t\treturn nil, errors.New(\"parameter client.subscriptionID cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{subscriptionId}\", url.PathEscape(client.subscriptionID))\n\treq, err := runtime.NewRequest(ctx, http.MethodPatch, runtime.JoinPaths(client.ep, urlPath))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treqQP := req.Raw().URL.Query()\n\treqQP.Set(\"api-version\", \"2021-04-01-preview\")\n\treq.Raw().URL.RawQuery = reqQP.Encode()\n\treq.Raw().Header.Set(\"Accept\", \"application/json\")\n\treturn req, runtime.MarshalAsJSON(req, parameters)\n}", "title": "" }, { "docid": "6c24aa678a9b3fee8bd25185a7b2f421", "score": "0.69308555", "text": "func (client *CertificateOrdersClient) updateCreateRequest(ctx context.Context, resourceGroupName string, certificateOrderName string, certificateDistinguishedName CertificateOrderPatchResource, options *CertificateOrdersClientUpdateOptions) (*policy.Request, error) {\n\turlPath := \"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CertificateRegistration/certificateOrders/{certificateOrderName}\"\n\tif resourceGroupName == \"\" {\n\t\treturn nil, errors.New(\"parameter resourceGroupName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{resourceGroupName}\", url.PathEscape(resourceGroupName))\n\tif certificateOrderName == \"\" {\n\t\treturn nil, errors.New(\"parameter certificateOrderName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{certificateOrderName}\", url.PathEscape(certificateOrderName))\n\tif client.subscriptionID == \"\" {\n\t\treturn nil, errors.New(\"parameter client.subscriptionID cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{subscriptionId}\", url.PathEscape(client.subscriptionID))\n\treq, err := runtime.NewRequest(ctx, http.MethodPatch, runtime.JoinPaths(client.internal.Endpoint(), urlPath))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treqQP := req.Raw().URL.Query()\n\treqQP.Set(\"api-version\", \"2022-09-01\")\n\treq.Raw().URL.RawQuery = reqQP.Encode()\n\treq.Raw().Header[\"Accept\"] = []string{\"application/json\"}\n\treturn req, runtime.MarshalAsJSON(req, certificateDistinguishedName)\n}", "title": "" }, { "docid": "bbce1580a3d57ace4eec19f2ddb569a6", "score": "0.6922438", "text": "func (client *MonitorsClient) updateCreateRequest(ctx context.Context, resourceGroupName string, monitorName string, options *MonitorsClientBeginUpdateOptions) (*policy.Request, error) {\n\turlPath := \"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Datadog/monitors/{monitorName}\"\n\tif client.subscriptionID == \"\" {\n\t\treturn nil, errors.New(\"parameter client.subscriptionID cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{subscriptionId}\", url.PathEscape(client.subscriptionID))\n\tif resourceGroupName == \"\" {\n\t\treturn nil, errors.New(\"parameter resourceGroupName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{resourceGroupName}\", url.PathEscape(resourceGroupName))\n\tif monitorName == \"\" {\n\t\treturn nil, errors.New(\"parameter monitorName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{monitorName}\", url.PathEscape(monitorName))\n\treq, err := runtime.NewRequest(ctx, http.MethodPatch, runtime.JoinPaths(client.host, urlPath))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treqQP := req.Raw().URL.Query()\n\treqQP.Set(\"api-version\", \"2021-03-01\")\n\treq.Raw().URL.RawQuery = reqQP.Encode()\n\treq.Raw().Header.Set(\"Accept\", \"application/json\")\n\tif options != nil && options.Body != nil {\n\t\treturn req, runtime.MarshalAsJSON(req, *options.Body)\n\t}\n\treturn req, nil\n}", "title": "" }, { "docid": "a7d43897222b41e969601efdde3ae255", "score": "0.69157416", "text": "func (client *SQLVirtualMachinesClient) updateCreateRequest(ctx context.Context, resourceGroupName string, sqlVirtualMachineName string, parameters Update, options *SQLVirtualMachinesClientBeginUpdateOptions) (*policy.Request, error) {\n\turlPath := \"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.SqlVirtualMachine/sqlVirtualMachines/{sqlVirtualMachineName}\"\n\tif resourceGroupName == \"\" {\n\t\treturn nil, errors.New(\"parameter resourceGroupName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{resourceGroupName}\", url.PathEscape(resourceGroupName))\n\tif sqlVirtualMachineName == \"\" {\n\t\treturn nil, errors.New(\"parameter sqlVirtualMachineName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{sqlVirtualMachineName}\", url.PathEscape(sqlVirtualMachineName))\n\tif client.subscriptionID == \"\" {\n\t\treturn nil, errors.New(\"parameter client.subscriptionID cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{subscriptionId}\", url.PathEscape(client.subscriptionID))\n\treq, err := runtime.NewRequest(ctx, http.MethodPatch, runtime.JoinPaths(client.host, urlPath))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treqQP := req.Raw().URL.Query()\n\treqQP.Set(\"api-version\", \"2017-03-01-preview\")\n\treq.Raw().URL.RawQuery = reqQP.Encode()\n\treq.Raw().Header.Set(\"Accept\", \"application/json\")\n\treturn req, runtime.MarshalAsJSON(req, parameters)\n}", "title": "" }, { "docid": "be76666d1befb8e1e859f7f47ff7aed3", "score": "0.68910146", "text": "func (client *ServersClient) updateCreateRequest(ctx context.Context, resourceGroup string, fluidRelayServerName string, resource ServerUpdate, options *ServersClientUpdateOptions) (*policy.Request, error) {\n\turlPath := \"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.FluidRelay/fluidRelayServers/{fluidRelayServerName}\"\n\tif client.subscriptionID == \"\" {\n\t\treturn nil, errors.New(\"parameter client.subscriptionID cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{subscriptionId}\", url.PathEscape(client.subscriptionID))\n\tif resourceGroup == \"\" {\n\t\treturn nil, errors.New(\"parameter resourceGroup cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{resourceGroup}\", url.PathEscape(resourceGroup))\n\tif fluidRelayServerName == \"\" {\n\t\treturn nil, errors.New(\"parameter fluidRelayServerName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{fluidRelayServerName}\", url.PathEscape(fluidRelayServerName))\n\treq, err := runtime.NewRequest(ctx, http.MethodPatch, runtime.JoinPaths(client.internal.Endpoint(), urlPath))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treqQP := req.Raw().URL.Query()\n\treqQP.Set(\"api-version\", \"2022-06-01\")\n\treq.Raw().URL.RawQuery = reqQP.Encode()\n\treq.Raw().Header[\"Accept\"] = []string{\"application/json\"}\n\treturn req, runtime.MarshalAsJSON(req, resource)\n}", "title": "" }, { "docid": "21476faba7122d4bfbfb17aaa2119128", "score": "0.6885705", "text": "func (client *ClustersClient) updateCreateRequest(ctx context.Context, resourceGroupName string, clusterName string, parameters ClusterForUpdate, options *ClustersClientBeginUpdateOptions) (*policy.Request, error) {\n\turlPath := \"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/serverGroupsv2/{clusterName}\"\n\turlPath = strings.ReplaceAll(urlPath, \"{subscriptionId}\", url.PathEscape(client.subscriptionID))\n\tif resourceGroupName == \"\" {\n\t\treturn nil, errors.New(\"parameter resourceGroupName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{resourceGroupName}\", url.PathEscape(resourceGroupName))\n\tif clusterName == \"\" {\n\t\treturn nil, errors.New(\"parameter clusterName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{clusterName}\", url.PathEscape(clusterName))\n\treq, err := runtime.NewRequest(ctx, http.MethodPatch, runtime.JoinPaths(client.internal.Endpoint(), urlPath))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treqQP := req.Raw().URL.Query()\n\treqQP.Set(\"api-version\", \"2022-11-08\")\n\treq.Raw().URL.RawQuery = reqQP.Encode()\n\treq.Raw().Header[\"Accept\"] = []string{\"application/json\"}\n\treturn req, runtime.MarshalAsJSON(req, parameters)\n}", "title": "" }, { "docid": "a31f5fa6865e5de14dd172f3a4c9b0be", "score": "0.6881729", "text": "func (client *AlertProcessingRulesClient) updateCreateRequest(ctx context.Context, resourceGroupName string, alertProcessingRuleName string, alertProcessingRulePatch PatchObject, options *AlertProcessingRulesClientUpdateOptions) (*policy.Request, error) {\n\turlPath := \"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AlertsManagement/actionRules/{alertProcessingRuleName}\"\n\tif client.subscriptionID == \"\" {\n\t\treturn nil, errors.New(\"parameter client.subscriptionID cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{subscriptionId}\", url.PathEscape(client.subscriptionID))\n\tif resourceGroupName == \"\" {\n\t\treturn nil, errors.New(\"parameter resourceGroupName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{resourceGroupName}\", url.PathEscape(resourceGroupName))\n\tif alertProcessingRuleName == \"\" {\n\t\treturn nil, errors.New(\"parameter alertProcessingRuleName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{alertProcessingRuleName}\", url.PathEscape(alertProcessingRuleName))\n\treq, err := runtime.NewRequest(ctx, http.MethodPatch, runtime.JoinPaths(client.host, urlPath))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treqQP := req.Raw().URL.Query()\n\treqQP.Set(\"api-version\", \"2021-08-08\")\n\treq.Raw().URL.RawQuery = reqQP.Encode()\n\treq.Raw().Header.Set(\"Accept\", \"application/json\")\n\treturn req, runtime.MarshalAsJSON(req, alertProcessingRulePatch)\n}", "title": "" }, { "docid": "95be887dc18b2b04a6616464d49f5868", "score": "0.6874514", "text": "func (client *GroupClient) updateCreateRequest(ctx context.Context, resourceGroupName string, serviceName string, groupID string, ifMatch string, parameters GroupUpdateParameters, options *GroupUpdateOptions) (*policy.Request, error) {\n\turlPath := \"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/groups/{groupId}\"\n\tif resourceGroupName == \"\" {\n\t\treturn nil, errors.New(\"parameter resourceGroupName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{resourceGroupName}\", url.PathEscape(resourceGroupName))\n\tif serviceName == \"\" {\n\t\treturn nil, errors.New(\"parameter serviceName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{serviceName}\", url.PathEscape(serviceName))\n\tif groupID == \"\" {\n\t\treturn nil, errors.New(\"parameter groupID cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{groupId}\", url.PathEscape(groupID))\n\tif client.subscriptionID == \"\" {\n\t\treturn nil, errors.New(\"parameter client.subscriptionID cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{subscriptionId}\", url.PathEscape(client.subscriptionID))\n\treq, err := runtime.NewRequest(ctx, http.MethodPatch, runtime.JoinPaths(client.ep, urlPath))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treqQP := req.Raw().URL.Query()\n\treqQP.Set(\"api-version\", \"2021-08-01\")\n\treq.Raw().URL.RawQuery = reqQP.Encode()\n\treq.Raw().Header.Set(\"If-Match\", ifMatch)\n\treq.Raw().Header.Set(\"Accept\", \"application/json\")\n\treturn req, runtime.MarshalAsJSON(req, parameters)\n}", "title": "" }, { "docid": "3b04a9a3e59603a0beb36b447937b47a", "score": "0.6861362", "text": "func (client *WebAppsClient) updateCreateRequest(ctx context.Context, resourceGroupName string, name string, siteEnvelope SitePatchResource, options *WebAppsUpdateOptions) (*policy.Request, error) {\n\turlPath := \"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}\"\n\tif resourceGroupName == \"\" {\n\t\treturn nil, errors.New(\"parameter resourceGroupName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{resourceGroupName}\", url.PathEscape(resourceGroupName))\n\tif name == \"\" {\n\t\treturn nil, errors.New(\"parameter name cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{name}\", url.PathEscape(name))\n\tif client.subscriptionID == \"\" {\n\t\treturn nil, errors.New(\"parameter client.subscriptionID cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{subscriptionId}\", url.PathEscape(client.subscriptionID))\n\treq, err := runtime.NewRequest(ctx, http.MethodPatch, runtime.JoinPaths(client.ep, urlPath))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treqQP := req.Raw().URL.Query()\n\treqQP.Set(\"api-version\", \"2021-02-01\")\n\treq.Raw().URL.RawQuery = reqQP.Encode()\n\treq.Raw().Header.Set(\"Accept\", \"application/json\")\n\treturn req, runtime.MarshalAsJSON(req, siteEnvelope)\n}", "title": "" }, { "docid": "8f843836a95929823bd3d9b6edcad8db", "score": "0.6833225", "text": "func (client *APIClient) updateCreateRequest(ctx context.Context, resourceGroupName string, serviceName string, apiID string, ifMatch string, parameters APIUpdateContract, options *APIClientUpdateOptions) (*policy.Request, error) {\n\turlPath := \"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}\"\n\tif resourceGroupName == \"\" {\n\t\treturn nil, errors.New(\"parameter resourceGroupName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{resourceGroupName}\", url.PathEscape(resourceGroupName))\n\tif serviceName == \"\" {\n\t\treturn nil, errors.New(\"parameter serviceName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{serviceName}\", url.PathEscape(serviceName))\n\tif apiID == \"\" {\n\t\treturn nil, errors.New(\"parameter apiID cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{apiId}\", url.PathEscape(apiID))\n\tif client.subscriptionID == \"\" {\n\t\treturn nil, errors.New(\"parameter client.subscriptionID cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{subscriptionId}\", url.PathEscape(client.subscriptionID))\n\treq, err := runtime.NewRequest(ctx, http.MethodPatch, runtime.JoinPaths(client.internal.Endpoint(), urlPath))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treqQP := req.Raw().URL.Query()\n\treqQP.Set(\"api-version\", \"2022-08-01\")\n\treq.Raw().URL.RawQuery = reqQP.Encode()\n\treq.Raw().Header[\"If-Match\"] = []string{ifMatch}\n\treq.Raw().Header[\"Accept\"] = []string{\"application/json\"}\n\tif err := runtime.MarshalAsJSON(req, parameters); err != nil {\n\t\treturn nil, err\n\t}\n\treturn req, nil\n}", "title": "" }, { "docid": "5d7bd940fbe0434934531a92be9b95e1", "score": "0.6830831", "text": "func (client *IotSecuritySolutionClient) updateCreateRequest(ctx context.Context, resourceGroupName string, solutionName string, updateIotSecuritySolutionData UpdateIotSecuritySolutionData, options *IotSecuritySolutionClientUpdateOptions) (*policy.Request, error) {\n\turlPath := \"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/iotSecuritySolutions/{solutionName}\"\n\tif client.subscriptionID == \"\" {\n\t\treturn nil, errors.New(\"parameter client.subscriptionID cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{subscriptionId}\", url.PathEscape(client.subscriptionID))\n\tif resourceGroupName == \"\" {\n\t\treturn nil, errors.New(\"parameter resourceGroupName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{resourceGroupName}\", url.PathEscape(resourceGroupName))\n\tif solutionName == \"\" {\n\t\treturn nil, errors.New(\"parameter solutionName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{solutionName}\", url.PathEscape(solutionName))\n\treq, err := runtime.NewRequest(ctx, http.MethodPatch, runtime.JoinPaths(client.internal.Endpoint(), urlPath))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treqQP := req.Raw().URL.Query()\n\treqQP.Set(\"api-version\", \"2019-08-01\")\n\treq.Raw().URL.RawQuery = reqQP.Encode()\n\treq.Raw().Header[\"Accept\"] = []string{\"application/json\"}\n\treturn req, runtime.MarshalAsJSON(req, updateIotSecuritySolutionData)\n}", "title": "" }, { "docid": "1a5fc539d763eaa2d06fe1f1144d14d4", "score": "0.6821201", "text": "func (client *CapacityReservationsClient) updateCreateRequest(ctx context.Context, resourceGroupName string, capacityReservationGroupName string, capacityReservationName string, parameters CapacityReservationUpdate, options *CapacityReservationsBeginUpdateOptions) (*policy.Request, error) {\n\turlPath := \"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/capacityReservationGroups/{capacityReservationGroupName}/capacityReservations/{capacityReservationName}\"\n\tif resourceGroupName == \"\" {\n\t\treturn nil, errors.New(\"parameter resourceGroupName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{resourceGroupName}\", url.PathEscape(resourceGroupName))\n\tif capacityReservationGroupName == \"\" {\n\t\treturn nil, errors.New(\"parameter capacityReservationGroupName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{capacityReservationGroupName}\", url.PathEscape(capacityReservationGroupName))\n\tif capacityReservationName == \"\" {\n\t\treturn nil, errors.New(\"parameter capacityReservationName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{capacityReservationName}\", url.PathEscape(capacityReservationName))\n\tif client.subscriptionID == \"\" {\n\t\treturn nil, errors.New(\"parameter client.subscriptionID cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{subscriptionId}\", url.PathEscape(client.subscriptionID))\n\treq, err := runtime.NewRequest(ctx, http.MethodPatch, runtime.JoinPaths(client.ep, urlPath))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treqQP := req.Raw().URL.Query()\n\treqQP.Set(\"api-version\", \"2021-07-01\")\n\treq.Raw().URL.RawQuery = reqQP.Encode()\n\treq.Raw().Header.Set(\"Accept\", \"application/json\")\n\treturn req, runtime.MarshalAsJSON(req, parameters)\n}", "title": "" }, { "docid": "1d5e7060d229a4bef25fe578841418cd", "score": "0.67668515", "text": "func (client *VirtualMachinesClient) updateCreateRequest(ctx context.Context, resourceGroupName string, virtualMachineName string, body VirtualMachineUpdate, options *VirtualMachinesClientBeginUpdateOptions) (*policy.Request, error) {\n\turlPath := \"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ConnectedVMwarevSphere/virtualMachines/{virtualMachineName}\"\n\tif client.subscriptionID == \"\" {\n\t\treturn nil, errors.New(\"parameter client.subscriptionID cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{subscriptionId}\", url.PathEscape(client.subscriptionID))\n\tif resourceGroupName == \"\" {\n\t\treturn nil, errors.New(\"parameter resourceGroupName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{resourceGroupName}\", url.PathEscape(resourceGroupName))\n\tif virtualMachineName == \"\" {\n\t\treturn nil, errors.New(\"parameter virtualMachineName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{virtualMachineName}\", url.PathEscape(virtualMachineName))\n\treq, err := runtime.NewRequest(ctx, http.MethodPatch, runtime.JoinPaths(client.internal.Endpoint(), urlPath))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treqQP := req.Raw().URL.Query()\n\treqQP.Set(\"api-version\", \"2022-01-10-preview\")\n\treq.Raw().URL.RawQuery = reqQP.Encode()\n\treq.Raw().Header[\"Accept\"] = []string{\"application/json\"}\n\treturn req, runtime.MarshalAsJSON(req, body)\n}", "title": "" }, { "docid": "dfd27263d2af96d0e27fa672bf6dd4d9", "score": "0.6764611", "text": "func (client *VirtualMachineImageTemplatesClient) updateCreateRequest(ctx context.Context, resourceGroupName string, imageTemplateName string, parameters ImageTemplateUpdateParameters, options *VirtualMachineImageTemplatesClientBeginUpdateOptions) (*policy.Request, error) {\n\turlPath := \"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.VirtualMachineImages/imageTemplates/{imageTemplateName}\"\n\tif client.subscriptionID == \"\" {\n\t\treturn nil, errors.New(\"parameter client.subscriptionID cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{subscriptionId}\", url.PathEscape(client.subscriptionID))\n\tif resourceGroupName == \"\" {\n\t\treturn nil, errors.New(\"parameter resourceGroupName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{resourceGroupName}\", url.PathEscape(resourceGroupName))\n\tif imageTemplateName == \"\" {\n\t\treturn nil, errors.New(\"parameter imageTemplateName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{imageTemplateName}\", url.PathEscape(imageTemplateName))\n\treq, err := runtime.NewRequest(ctx, http.MethodPatch, runtime.JoinPaths(client.host, urlPath))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treqQP := req.Raw().URL.Query()\n\treqQP.Set(\"api-version\", \"2021-10-01\")\n\treq.Raw().URL.RawQuery = reqQP.Encode()\n\treq.Raw().Header.Set(\"Accept\", \"application/json\")\n\treturn req, runtime.MarshalAsJSON(req, parameters)\n}", "title": "" }, { "docid": "650e1f55bea552586f0cf7b1df2af9a4", "score": "0.6764516", "text": "func (client *WebhooksClient) updateCreateRequest(ctx context.Context, resourceGroupName string, registryName string, webhookName string, webhookUpdateParameters WebhookUpdateParameters, options *WebhooksClientBeginUpdateOptions) (*policy.Request, error) {\n\turlPath := \"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/webhooks/{webhookName}\"\n\tif client.subscriptionID == \"\" {\n\t\treturn nil, errors.New(\"parameter client.subscriptionID cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{subscriptionId}\", url.PathEscape(client.subscriptionID))\n\tif resourceGroupName == \"\" {\n\t\treturn nil, errors.New(\"parameter resourceGroupName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{resourceGroupName}\", url.PathEscape(resourceGroupName))\n\tif registryName == \"\" {\n\t\treturn nil, errors.New(\"parameter registryName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{registryName}\", url.PathEscape(registryName))\n\tif webhookName == \"\" {\n\t\treturn nil, errors.New(\"parameter webhookName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{webhookName}\", url.PathEscape(webhookName))\n\treq, err := runtime.NewRequest(ctx, http.MethodPatch, runtime.JoinPaths(client.internal.Endpoint(), urlPath))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treqQP := req.Raw().URL.Query()\n\treqQP.Set(\"api-version\", \"2019-05-01\")\n\treq.Raw().URL.RawQuery = reqQP.Encode()\n\treq.Raw().Header[\"Accept\"] = []string{\"application/json\"}\n\treturn req, runtime.MarshalAsJSON(req, webhookUpdateParameters)\n}", "title": "" }, { "docid": "55764691f9e3bbf0915125a8b3b6f32c", "score": "0.6759427", "text": "func (client *LocalRulestacksClient) updateCreateRequest(ctx context.Context, resourceGroupName string, localRulestackName string, properties LocalRulestackResourceUpdate, options *LocalRulestacksClientUpdateOptions) (*policy.Request, error) {\n\turlPath := \"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/PaloAltoNetworks.Cloudngfw/localRulestacks/{localRulestackName}\"\n\tif client.subscriptionID == \"\" {\n\t\treturn nil, errors.New(\"parameter client.subscriptionID cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{subscriptionId}\", url.PathEscape(client.subscriptionID))\n\tif resourceGroupName == \"\" {\n\t\treturn nil, errors.New(\"parameter resourceGroupName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{resourceGroupName}\", url.PathEscape(resourceGroupName))\n\tif localRulestackName == \"\" {\n\t\treturn nil, errors.New(\"parameter localRulestackName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{localRulestackName}\", url.PathEscape(localRulestackName))\n\treq, err := runtime.NewRequest(ctx, http.MethodPatch, runtime.JoinPaths(client.internal.Endpoint(), urlPath))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treqQP := req.Raw().URL.Query()\n\treqQP.Set(\"api-version\", \"2022-08-29\")\n\treq.Raw().URL.RawQuery = reqQP.Encode()\n\treq.Raw().Header[\"Accept\"] = []string{\"application/json\"}\n\treturn req, runtime.MarshalAsJSON(req, properties)\n}", "title": "" }, { "docid": "dea5de26bf459f059d592501af1cf830", "score": "0.6733962", "text": "func (client *CassandraClustersClient) updateCreateRequest(ctx context.Context, resourceGroupName string, clusterName string, body ClusterResource, options *CassandraClustersClientBeginUpdateOptions) (*policy.Request, error) {\n\turlPath := \"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/cassandraClusters/{clusterName}\"\n\tif client.subscriptionID == \"\" {\n\t\treturn nil, errors.New(\"parameter client.subscriptionID cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{subscriptionId}\", url.PathEscape(client.subscriptionID))\n\tif resourceGroupName == \"\" {\n\t\treturn nil, errors.New(\"parameter resourceGroupName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{resourceGroupName}\", url.PathEscape(resourceGroupName))\n\tif clusterName == \"\" {\n\t\treturn nil, errors.New(\"parameter clusterName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{clusterName}\", url.PathEscape(clusterName))\n\treq, err := runtime.NewRequest(ctx, http.MethodPatch, runtime.JoinPaths(client.internal.Endpoint(), urlPath))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treqQP := req.Raw().URL.Query()\n\treqQP.Set(\"api-version\", \"2023-03-15-preview\")\n\treq.Raw().URL.RawQuery = reqQP.Encode()\n\treq.Raw().Header[\"Accept\"] = []string{\"application/json\"}\n\treturn req, runtime.MarshalAsJSON(req, body)\n}", "title": "" }, { "docid": "6e3558433829a57302e60824c3f5ce9f", "score": "0.67124474", "text": "func (client *ApplyUpdatesClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, providerName string, resourceType string, resourceName string, options *ApplyUpdatesClientCreateOrUpdateOptions) (*policy.Request, error) {\n\turlPath := \"/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/{providerName}/{resourceType}/{resourceName}/providers/Microsoft.Maintenance/applyUpdates/default\"\n\tif client.subscriptionID == \"\" {\n\t\treturn nil, errors.New(\"parameter client.subscriptionID cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{subscriptionId}\", url.PathEscape(client.subscriptionID))\n\tif resourceGroupName == \"\" {\n\t\treturn nil, errors.New(\"parameter resourceGroupName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{resourceGroupName}\", url.PathEscape(resourceGroupName))\n\tif providerName == \"\" {\n\t\treturn nil, errors.New(\"parameter providerName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{providerName}\", url.PathEscape(providerName))\n\tif resourceType == \"\" {\n\t\treturn nil, errors.New(\"parameter resourceType cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{resourceType}\", url.PathEscape(resourceType))\n\tif resourceName == \"\" {\n\t\treturn nil, errors.New(\"parameter resourceName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{resourceName}\", url.PathEscape(resourceName))\n\treq, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.internal.Endpoint(), urlPath))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treqQP := req.Raw().URL.Query()\n\treqQP.Set(\"api-version\", \"2023-04-01\")\n\treq.Raw().URL.RawQuery = reqQP.Encode()\n\treq.Raw().Header[\"Accept\"] = []string{\"application/json\"}\n\treturn req, nil\n}", "title": "" }, { "docid": "90610bba47ab281f42551c5c4091ceb0", "score": "0.6702656", "text": "func (client *ManagedInstancesClient) updateCreateRequest(ctx context.Context, resourceGroupName string, managedInstanceName string, parameters ManagedInstanceUpdate, options *ManagedInstancesClientBeginUpdateOptions) (*policy.Request, error) {\n\turlPath := \"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}\"\n\tif resourceGroupName == \"\" {\n\t\treturn nil, errors.New(\"parameter resourceGroupName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{resourceGroupName}\", url.PathEscape(resourceGroupName))\n\tif managedInstanceName == \"\" {\n\t\treturn nil, errors.New(\"parameter managedInstanceName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{managedInstanceName}\", url.PathEscape(managedInstanceName))\n\tif client.subscriptionID == \"\" {\n\t\treturn nil, errors.New(\"parameter client.subscriptionID cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{subscriptionId}\", url.PathEscape(client.subscriptionID))\n\treq, err := runtime.NewRequest(ctx, http.MethodPatch, runtime.JoinPaths(client.internal.Endpoint(), urlPath))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treqQP := req.Raw().URL.Query()\n\treqQP.Set(\"api-version\", \"2022-08-01-preview\")\n\treq.Raw().URL.RawQuery = reqQP.Encode()\n\treq.Raw().Header[\"Accept\"] = []string{\"application/json\"}\n\tif err := runtime.MarshalAsJSON(req, parameters); err != nil {\n\t\treturn nil, err\n\t}\n\treturn req, nil\n}", "title": "" }, { "docid": "98b6f1d74c73e4a9230cc00d3211029b", "score": "0.6680146", "text": "func (client *ConnectedEnvironmentsClient) updateCreateRequest(ctx context.Context, resourceGroupName string, connectedEnvironmentName string, options *ConnectedEnvironmentsClientUpdateOptions) (*policy.Request, error) {\n\turlPath := \"/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.App/connectedEnvironments/{connectedEnvironmentName}\"\n\tif client.subscriptionID == \"\" {\n\t\treturn nil, errors.New(\"parameter client.subscriptionID cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{subscriptionId}\", url.PathEscape(client.subscriptionID))\n\tif resourceGroupName == \"\" {\n\t\treturn nil, errors.New(\"parameter resourceGroupName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{resourceGroupName}\", url.PathEscape(resourceGroupName))\n\tif connectedEnvironmentName == \"\" {\n\t\treturn nil, errors.New(\"parameter connectedEnvironmentName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{connectedEnvironmentName}\", url.PathEscape(connectedEnvironmentName))\n\treq, err := runtime.NewRequest(ctx, http.MethodPatch, runtime.JoinPaths(client.host, urlPath))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treqQP := req.Raw().URL.Query()\n\treqQP.Set(\"api-version\", \"2022-06-01-preview\")\n\treq.Raw().URL.RawQuery = reqQP.Encode()\n\treq.Raw().Header[\"Accept\"] = []string{\"application/json\"}\n\treturn req, nil\n}", "title": "" }, { "docid": "8df8ac9c767d4c012f63a0ecc44374d2", "score": "0.6672178", "text": "func (client *ClustersClient) updateCreateRequest(ctx context.Context, resourceGroupName string, clusterName string, parameters ClusterPatch, options *ClustersUpdateOptions) (*policy.Request, error) {\n\turlPath := \"/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/clusters/{clusterName}\"\n\tif resourceGroupName == \"\" {\n\t\treturn nil, errors.New(\"parameter resourceGroupName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{resourceGroupName}\", url.PathEscape(resourceGroupName))\n\tif clusterName == \"\" {\n\t\treturn nil, errors.New(\"parameter clusterName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{clusterName}\", url.PathEscape(clusterName))\n\tif client.subscriptionID == \"\" {\n\t\treturn nil, errors.New(\"parameter client.subscriptionID cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{subscriptionId}\", url.PathEscape(client.subscriptionID))\n\treq, err := runtime.NewRequest(ctx, http.MethodPatch, runtime.JoinPaths(client.ep, urlPath))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treqQP := req.Raw().URL.Query()\n\treqQP.Set(\"api-version\", \"2021-06-01\")\n\treq.Raw().URL.RawQuery = reqQP.Encode()\n\treq.Raw().Header.Set(\"Accept\", \"application/json\")\n\treturn req, runtime.MarshalAsJSON(req, parameters)\n}", "title": "" }, { "docid": "80c3bab2129d957a513aa580a3081390", "score": "0.66691947", "text": "func (client *KeyVaultClient) updateKeyCreateRequest(ctx context.Context, vaultBaseURL string, keyName string, keyVersion string, parameters KeyUpdateParameters, options *KeyVaultClientUpdateKeyOptions) (*policy.Request, error) {\n\thost := \"{vaultBaseUrl}\"\n\thost = strings.ReplaceAll(host, \"{vaultBaseUrl}\", vaultBaseURL)\n\turlPath := \"/keys/{key-name}/{key-version}\"\n\tif keyName == \"\" {\n\t\treturn nil, errors.New(\"parameter keyName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{key-name}\", url.PathEscape(keyName))\n\tif keyVersion == \"\" {\n\t\treturn nil, errors.New(\"parameter keyVersion cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{key-version}\", url.PathEscape(keyVersion))\n\treq, err := runtime.NewRequest(ctx, http.MethodPatch, runtime.JoinPaths(host, urlPath))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treqQP := req.Raw().URL.Query()\n\treqQP.Set(\"api-version\", \"7.2\")\n\treq.Raw().URL.RawQuery = reqQP.Encode()\n\treq.Raw().Header.Set(\"Accept\", \"application/json\")\n\treturn req, runtime.MarshalAsJSON(req, parameters)\n}", "title": "" }, { "docid": "3a74c034b55d49cc0b033a6e4bcda895", "score": "0.66582876", "text": "func (client *SubscriptionClient) updateCreateRequest(ctx context.Context, resourceGroupName string, serviceName string, sid string, ifMatch string, parameters SubscriptionUpdateParameters, options *SubscriptionClientUpdateOptions) (*policy.Request, error) {\n\turlPath := \"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/subscriptions/{sid}\"\n\tif resourceGroupName == \"\" {\n\t\treturn nil, errors.New(\"parameter resourceGroupName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{resourceGroupName}\", url.PathEscape(resourceGroupName))\n\tif serviceName == \"\" {\n\t\treturn nil, errors.New(\"parameter serviceName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{serviceName}\", url.PathEscape(serviceName))\n\tif sid == \"\" {\n\t\treturn nil, errors.New(\"parameter sid cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{sid}\", url.PathEscape(sid))\n\tif client.subscriptionID == \"\" {\n\t\treturn nil, errors.New(\"parameter client.subscriptionID cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{subscriptionId}\", url.PathEscape(client.subscriptionID))\n\treq, err := runtime.NewRequest(ctx, http.MethodPatch, runtime.JoinPaths(client.internal.Endpoint(), urlPath))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treqQP := req.Raw().URL.Query()\n\tif options != nil && options.Notify != nil {\n\t\treqQP.Set(\"notify\", strconv.FormatBool(*options.Notify))\n\t}\n\treqQP.Set(\"api-version\", \"2022-08-01\")\n\tif options != nil && options.AppType != nil {\n\t\treqQP.Set(\"appType\", string(*options.AppType))\n\t}\n\treq.Raw().URL.RawQuery = reqQP.Encode()\n\treq.Raw().Header[\"If-Match\"] = []string{ifMatch}\n\treq.Raw().Header[\"Accept\"] = []string{\"application/json\"}\n\tif err := runtime.MarshalAsJSON(req, parameters); err != nil {\n\t\treturn nil, err\n\t}\n\treturn req, nil\n}", "title": "" }, { "docid": "8d56d24f26c1667c8d2e6149079cb600", "score": "0.6656449", "text": "func (client *AgentsClient) updateCreateRequest(ctx context.Context, resourceGroupName string, storageMoverName string, agentName string, agent AgentUpdateParameters, options *AgentsClientUpdateOptions) (*policy.Request, error) {\n\turlPath := \"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageMover/storageMovers/{storageMoverName}/agents/{agentName}\"\n\tif client.subscriptionID == \"\" {\n\t\treturn nil, errors.New(\"parameter client.subscriptionID cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{subscriptionId}\", url.PathEscape(client.subscriptionID))\n\tif resourceGroupName == \"\" {\n\t\treturn nil, errors.New(\"parameter resourceGroupName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{resourceGroupName}\", url.PathEscape(resourceGroupName))\n\tif storageMoverName == \"\" {\n\t\treturn nil, errors.New(\"parameter storageMoverName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{storageMoverName}\", url.PathEscape(storageMoverName))\n\tif agentName == \"\" {\n\t\treturn nil, errors.New(\"parameter agentName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{agentName}\", url.PathEscape(agentName))\n\treq, err := runtime.NewRequest(ctx, http.MethodPatch, runtime.JoinPaths(client.internal.Endpoint(), urlPath))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treqQP := req.Raw().URL.Query()\n\treqQP.Set(\"api-version\", \"2023-07-01-preview\")\n\treq.Raw().URL.RawQuery = reqQP.Encode()\n\treq.Raw().Header[\"Accept\"] = []string{\"application/json\"}\n\treturn req, runtime.MarshalAsJSON(req, agent)\n}", "title": "" }, { "docid": "ba529773ab326e2046ea68fd7d47750e", "score": "0.6647058", "text": "func (client *PortalConfigClient) updateCreateRequest(ctx context.Context, resourceGroupName string, serviceName string, portalConfigID string, ifMatch string, parameters PortalConfigContract, options *PortalConfigClientUpdateOptions) (*policy.Request, error) {\n\turlPath := \"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/portalconfigs/{portalConfigId}\"\n\tif client.subscriptionID == \"\" {\n\t\treturn nil, errors.New(\"parameter client.subscriptionID cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{subscriptionId}\", url.PathEscape(client.subscriptionID))\n\tif resourceGroupName == \"\" {\n\t\treturn nil, errors.New(\"parameter resourceGroupName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{resourceGroupName}\", url.PathEscape(resourceGroupName))\n\tif serviceName == \"\" {\n\t\treturn nil, errors.New(\"parameter serviceName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{serviceName}\", url.PathEscape(serviceName))\n\tif portalConfigID == \"\" {\n\t\treturn nil, errors.New(\"parameter portalConfigID cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{portalConfigId}\", url.PathEscape(portalConfigID))\n\treq, err := runtime.NewRequest(ctx, http.MethodPatch, runtime.JoinPaths(client.internal.Endpoint(), urlPath))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treqQP := req.Raw().URL.Query()\n\treqQP.Set(\"api-version\", \"2022-08-01\")\n\treq.Raw().URL.RawQuery = reqQP.Encode()\n\treq.Raw().Header[\"If-Match\"] = []string{ifMatch}\n\treq.Raw().Header[\"Accept\"] = []string{\"application/json\"}\n\tif err := runtime.MarshalAsJSON(req, parameters); err != nil {\n\t\treturn nil, err\n\t}\n\treturn req, nil\n}", "title": "" }, { "docid": "9a8f7fe08e89977b99d1ea8c482e2a61", "score": "0.6643546", "text": "func (client *TablesClient) updateCreateRequest(ctx context.Context, resourceGroupName string, workspaceName string, tableName string, parameters Table, options *TablesClientUpdateOptions) (*policy.Request, error) {\n\turlPath := \"/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/tables/{tableName}\"\n\tif client.subscriptionID == \"\" {\n\t\treturn nil, errors.New(\"parameter client.subscriptionID cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{subscriptionId}\", url.PathEscape(client.subscriptionID))\n\tif resourceGroupName == \"\" {\n\t\treturn nil, errors.New(\"parameter resourceGroupName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{resourceGroupName}\", url.PathEscape(resourceGroupName))\n\tif workspaceName == \"\" {\n\t\treturn nil, errors.New(\"parameter workspaceName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{workspaceName}\", url.PathEscape(workspaceName))\n\tif tableName == \"\" {\n\t\treturn nil, errors.New(\"parameter tableName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{tableName}\", url.PathEscape(tableName))\n\treq, err := runtime.NewRequest(ctx, http.MethodPatch, runtime.JoinPaths(client.internal.Endpoint(), urlPath))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treqQP := req.Raw().URL.Query()\n\treqQP.Set(\"api-version\", \"2020-08-01\")\n\treq.Raw().URL.RawQuery = reqQP.Encode()\n\treq.Raw().Header[\"Accept\"] = []string{\"application/json\"}\n\treturn req, runtime.MarshalAsJSON(req, parameters)\n}", "title": "" }, { "docid": "e0df2105ddf0ed234268283f85a59e61", "score": "0.6640284", "text": "func (client *ReplicationvCentersClient) updateCreateRequest(ctx context.Context, fabricName string, vcenterName string, updateVCenterRequest UpdateVCenterRequest, options *ReplicationvCentersClientBeginUpdateOptions) (*policy.Request, error) {\n\turlPath := \"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationvCenters/{vcenterName}\"\n\tif client.resourceName == \"\" {\n\t\treturn nil, errors.New(\"parameter client.resourceName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{resourceName}\", url.PathEscape(client.resourceName))\n\tif client.resourceGroupName == \"\" {\n\t\treturn nil, errors.New(\"parameter client.resourceGroupName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{resourceGroupName}\", url.PathEscape(client.resourceGroupName))\n\tif client.subscriptionID == \"\" {\n\t\treturn nil, errors.New(\"parameter client.subscriptionID cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{subscriptionId}\", url.PathEscape(client.subscriptionID))\n\tif fabricName == \"\" {\n\t\treturn nil, errors.New(\"parameter fabricName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{fabricName}\", url.PathEscape(fabricName))\n\tif vcenterName == \"\" {\n\t\treturn nil, errors.New(\"parameter vcenterName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{vcenterName}\", url.PathEscape(vcenterName))\n\treq, err := runtime.NewRequest(ctx, http.MethodPatch, runtime.JoinPaths(client.host, urlPath))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treqQP := req.Raw().URL.Query()\n\treqQP.Set(\"api-version\", \"2021-11-01\")\n\treq.Raw().URL.RawQuery = reqQP.Encode()\n\treq.Raw().Header.Set(\"Accept\", \"application/json\")\n\treturn req, runtime.MarshalAsJSON(req, updateVCenterRequest)\n}", "title": "" }, { "docid": "466a07d80d8c9e9dd1e334358c153142", "score": "0.6629236", "text": "func (client *NetworkToNetworkInterconnectsClient) updateCreateRequest(ctx context.Context, resourceGroupName string, networkFabricName string, networkToNetworkInterconnectName string, body NetworkToNetworkInterconnectPatch, options *NetworkToNetworkInterconnectsClientBeginUpdateOptions) (*policy.Request, error) {\n\turlPath := \"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedNetworkFabric/networkFabrics/{networkFabricName}/networkToNetworkInterconnects/{networkToNetworkInterconnectName}\"\n\turlPath = strings.ReplaceAll(urlPath, \"{subscriptionId}\", url.PathEscape(client.subscriptionID))\n\tif resourceGroupName == \"\" {\n\t\treturn nil, errors.New(\"parameter resourceGroupName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{resourceGroupName}\", url.PathEscape(resourceGroupName))\n\tif networkFabricName == \"\" {\n\t\treturn nil, errors.New(\"parameter networkFabricName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{networkFabricName}\", url.PathEscape(networkFabricName))\n\tif networkToNetworkInterconnectName == \"\" {\n\t\treturn nil, errors.New(\"parameter networkToNetworkInterconnectName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{networkToNetworkInterconnectName}\", url.PathEscape(networkToNetworkInterconnectName))\n\treq, err := runtime.NewRequest(ctx, http.MethodPatch, runtime.JoinPaths(client.internal.Endpoint(), urlPath))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treqQP := req.Raw().URL.Query()\n\treqQP.Set(\"api-version\", \"2023-06-15\")\n\treq.Raw().URL.RawQuery = reqQP.Encode()\n\treq.Raw().Header[\"Accept\"] = []string{\"application/json\"}\n\treturn req, runtime.MarshalAsJSON(req, body)\n}", "title": "" }, { "docid": "b1e6a4d37c604ac9d576d7e1a802e29a", "score": "0.6622024", "text": "func (client *KeyVaultClient) updateKeyCreateRequest(ctx context.Context, vaultBaseURL string, keyName string, keyVersion string, parameters KeyUpdateParameters, options *KeyVaultClientUpdateKeyOptions) (*policy.Request, error) {\n\thost := \"{vaultBaseUrl}\"\n\thost = strings.ReplaceAll(host, \"{vaultBaseUrl}\", vaultBaseURL)\n\turlPath := \"/keys/{key-name}/{key-version}\"\n\tif keyName == \"\" {\n\t\treturn nil, errors.New(\"parameter keyName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{key-name}\", url.PathEscape(keyName))\n\t// if keyVersion == \"\" {\n\t// \treturn nil, errors.New(\"parameter keyVersion cannot be empty\")\n\t// }\n\turlPath = strings.ReplaceAll(urlPath, \"{key-version}\", url.PathEscape(keyVersion))\n\treq, err := runtime.NewRequest(ctx, http.MethodPatch, runtime.JoinPaths(host, urlPath))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treqQP := req.Raw().URL.Query()\n\treqQP.Set(\"api-version\", \"7.3\")\n\treq.Raw().URL.RawQuery = reqQP.Encode()\n\treq.Raw().Header.Set(\"Accept\", \"application/json\")\n\treturn req, runtime.MarshalAsJSON(req, parameters)\n}", "title": "" }, { "docid": "5b5e7487a47bdacb27eb1bfe7930e0f7", "score": "0.661631", "text": "func (client *ContainerGroupsClient) updateCreateRequest(ctx context.Context, resourceGroupName string, containerGroupName string, resource Resource, options *ContainerGroupsClientUpdateOptions) (*policy.Request, error) {\n\turlPath := \"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerInstance/containerGroups/{containerGroupName}\"\n\tif client.subscriptionID == \"\" {\n\t\treturn nil, errors.New(\"parameter client.subscriptionID cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{subscriptionId}\", url.PathEscape(client.subscriptionID))\n\tif resourceGroupName == \"\" {\n\t\treturn nil, errors.New(\"parameter resourceGroupName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{resourceGroupName}\", url.PathEscape(resourceGroupName))\n\tif containerGroupName == \"\" {\n\t\treturn nil, errors.New(\"parameter containerGroupName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{containerGroupName}\", url.PathEscape(containerGroupName))\n\treq, err := runtime.NewRequest(ctx, http.MethodPatch, runtime.JoinPaths(client.internal.Endpoint(), urlPath))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treqQP := req.Raw().URL.Query()\n\treqQP.Set(\"api-version\", \"2023-05-01\")\n\treq.Raw().URL.RawQuery = reqQP.Encode()\n\treq.Raw().Header[\"Accept\"] = []string{\"application/json\"}\n\treturn req, runtime.MarshalAsJSON(req, resource)\n}", "title": "" }, { "docid": "0ec33d99b82c3568726d193c6a813e0e", "score": "0.66003823", "text": "func (client *SyncGroupsClient) updateCreateRequest(ctx context.Context, resourceGroupName string, serverName string, databaseName string, syncGroupName string, parameters SyncGroup, options *SyncGroupsClientBeginUpdateOptions) (*policy.Request, error) {\n\turlPath := \"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/syncGroups/{syncGroupName}\"\n\tif resourceGroupName == \"\" {\n\t\treturn nil, errors.New(\"parameter resourceGroupName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{resourceGroupName}\", url.PathEscape(resourceGroupName))\n\tif serverName == \"\" {\n\t\treturn nil, errors.New(\"parameter serverName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{serverName}\", url.PathEscape(serverName))\n\tif databaseName == \"\" {\n\t\treturn nil, errors.New(\"parameter databaseName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{databaseName}\", url.PathEscape(databaseName))\n\tif syncGroupName == \"\" {\n\t\treturn nil, errors.New(\"parameter syncGroupName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{syncGroupName}\", url.PathEscape(syncGroupName))\n\tif client.subscriptionID == \"\" {\n\t\treturn nil, errors.New(\"parameter client.subscriptionID cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{subscriptionId}\", url.PathEscape(client.subscriptionID))\n\treq, err := runtime.NewRequest(ctx, http.MethodPatch, runtime.JoinPaths(client.host, urlPath))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treqQP := req.Raw().URL.Query()\n\treqQP.Set(\"api-version\", \"2020-11-01-preview\")\n\treq.Raw().URL.RawQuery = reqQP.Encode()\n\treq.Raw().Header.Set(\"Accept\", \"application/json\")\n\treturn req, runtime.MarshalAsJSON(req, parameters)\n}", "title": "" }, { "docid": "ab341025902a82695b91832785c7f088", "score": "0.65966094", "text": "func (client *CassandraClustersClient) createUpdateCreateRequest(ctx context.Context, resourceGroupName string, clusterName string, body ClusterResource, options *CassandraClustersClientBeginCreateUpdateOptions) (*policy.Request, error) {\n\turlPath := \"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/cassandraClusters/{clusterName}\"\n\tif client.subscriptionID == \"\" {\n\t\treturn nil, errors.New(\"parameter client.subscriptionID cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{subscriptionId}\", url.PathEscape(client.subscriptionID))\n\tif resourceGroupName == \"\" {\n\t\treturn nil, errors.New(\"parameter resourceGroupName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{resourceGroupName}\", url.PathEscape(resourceGroupName))\n\tif clusterName == \"\" {\n\t\treturn nil, errors.New(\"parameter clusterName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{clusterName}\", url.PathEscape(clusterName))\n\treq, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.internal.Endpoint(), urlPath))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treqQP := req.Raw().URL.Query()\n\treqQP.Set(\"api-version\", \"2023-03-15-preview\")\n\treq.Raw().URL.RawQuery = reqQP.Encode()\n\treq.Raw().Header[\"Accept\"] = []string{\"application/json\"}\n\treturn req, runtime.MarshalAsJSON(req, body)\n}", "title": "" }, { "docid": "2ac6728b20975d4269f6f335fcd167e9", "score": "0.6593269", "text": "func (client *MetricAlertsClient) updateCreateRequest(ctx context.Context, resourceGroupName string, ruleName string, parameters MetricAlertResourcePatch, options *MetricAlertsClientUpdateOptions) (*policy.Request, error) {\n\turlPath := \"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/metricAlerts/{ruleName}\"\n\tif client.subscriptionID == \"\" {\n\t\treturn nil, errors.New(\"parameter client.subscriptionID cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{subscriptionId}\", url.PathEscape(client.subscriptionID))\n\tif resourceGroupName == \"\" {\n\t\treturn nil, errors.New(\"parameter resourceGroupName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{resourceGroupName}\", url.PathEscape(resourceGroupName))\n\tif ruleName == \"\" {\n\t\treturn nil, errors.New(\"parameter ruleName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{ruleName}\", url.PathEscape(ruleName))\n\treq, err := runtime.NewRequest(ctx, http.MethodPatch, runtime.JoinPaths(client.internal.Endpoint(), urlPath))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treqQP := req.Raw().URL.Query()\n\treqQP.Set(\"api-version\", \"2018-03-01\")\n\treq.Raw().URL.RawQuery = reqQP.Encode()\n\treq.Raw().Header[\"Accept\"] = []string{\"application/json\"}\n\tif err := runtime.MarshalAsJSON(req, parameters); err != nil {\n\t\treturn nil, err\n\t}\n\treturn req, nil\n}", "title": "" }, { "docid": "e73aa85ced21b9585e57688a5cf833c2", "score": "0.6578656", "text": "func (client *AvailabilitySetsClient) updateCreateRequest(ctx context.Context, resourceGroupName string, availabilitySetName string, parameters AvailabilitySetUpdate, options *AvailabilitySetsUpdateOptions) (*policy.Request, error) {\n\turlPath := \"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}\"\n\tif resourceGroupName == \"\" {\n\t\treturn nil, errors.New(\"parameter resourceGroupName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{resourceGroupName}\", url.PathEscape(resourceGroupName))\n\tif availabilitySetName == \"\" {\n\t\treturn nil, errors.New(\"parameter availabilitySetName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{availabilitySetName}\", url.PathEscape(availabilitySetName))\n\tif client.subscriptionID == \"\" {\n\t\treturn nil, errors.New(\"parameter client.subscriptionID cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{subscriptionId}\", url.PathEscape(client.subscriptionID))\n\treq, err := runtime.NewRequest(ctx, http.MethodPatch, runtime.JoinPaths(client.ep, urlPath))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treqQP := req.Raw().URL.Query()\n\treqQP.Set(\"api-version\", \"2021-07-01\")\n\treq.Raw().URL.RawQuery = reqQP.Encode()\n\treq.Raw().Header.Set(\"Accept\", \"application/json\")\n\treturn req, runtime.MarshalAsJSON(req, parameters)\n}", "title": "" }, { "docid": "1b8177a0804dcd1a149cfc1effadfed3", "score": "0.6570454", "text": "func (client *DiskEncryptionSetsClient) updateCreateRequest(ctx context.Context, resourceGroupName string, diskEncryptionSetName string, diskEncryptionSet DiskEncryptionSetUpdate, options *DiskEncryptionSetsBeginUpdateOptions) (*policy.Request, error) {\n\turlPath := \"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskEncryptionSets/{diskEncryptionSetName}\"\n\tif client.subscriptionID == \"\" {\n\t\treturn nil, errors.New(\"parameter client.subscriptionID cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{subscriptionId}\", url.PathEscape(client.subscriptionID))\n\tif resourceGroupName == \"\" {\n\t\treturn nil, errors.New(\"parameter resourceGroupName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{resourceGroupName}\", url.PathEscape(resourceGroupName))\n\tif diskEncryptionSetName == \"\" {\n\t\treturn nil, errors.New(\"parameter diskEncryptionSetName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{diskEncryptionSetName}\", url.PathEscape(diskEncryptionSetName))\n\treq, err := runtime.NewRequest(ctx, http.MethodPatch, runtime.JoinPaths(client.ep, urlPath))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treqQP := req.Raw().URL.Query()\n\treqQP.Set(\"api-version\", \"2021-04-01\")\n\treq.Raw().URL.RawQuery = reqQP.Encode()\n\treq.Raw().Header.Set(\"Accept\", \"application/json\")\n\treturn req, runtime.MarshalAsJSON(req, diskEncryptionSet)\n}", "title": "" }, { "docid": "e70f869fdd6eaed215b0002610849777", "score": "0.654902", "text": "func (client *SpatialAnchorsAccountsClient) updateCreateRequest(ctx context.Context, resourceGroupName string, accountName string, spatialAnchorsAccount SpatialAnchorsAccount, options *SpatialAnchorsAccountsClientUpdateOptions) (*policy.Request, error) {\n\turlPath := \"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MixedReality/spatialAnchorsAccounts/{accountName}\"\n\tif client.subscriptionID == \"\" {\n\t\treturn nil, errors.New(\"parameter client.subscriptionID cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{subscriptionId}\", url.PathEscape(client.subscriptionID))\n\tif resourceGroupName == \"\" {\n\t\treturn nil, errors.New(\"parameter resourceGroupName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{resourceGroupName}\", url.PathEscape(resourceGroupName))\n\tif accountName == \"\" {\n\t\treturn nil, errors.New(\"parameter accountName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{accountName}\", url.PathEscape(accountName))\n\treq, err := runtime.NewRequest(ctx, http.MethodPatch, runtime.JoinPaths(client.internal.Endpoint(), urlPath))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treqQP := req.Raw().URL.Query()\n\treqQP.Set(\"api-version\", \"2021-03-01-preview\")\n\treq.Raw().URL.RawQuery = reqQP.Encode()\n\treq.Raw().Header[\"Accept\"] = []string{\"application/json\"}\n\treturn req, runtime.MarshalAsJSON(req, spatialAnchorsAccount)\n}", "title": "" }, { "docid": "6118ba24be24d2eeee6f755ab5c8bb85", "score": "0.650955", "text": "func (client *IscsiTargetsClient) updateCreateRequest(ctx context.Context, resourceGroupName string, diskPoolName string, iscsiTargetName string, iscsiTargetUpdatePayload IscsiTargetUpdate, options *IscsiTargetsClientBeginUpdateOptions) (*policy.Request, error) {\n\turlPath := \"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StoragePool/diskPools/{diskPoolName}/iscsiTargets/{iscsiTargetName}\"\n\tif client.subscriptionID == \"\" {\n\t\treturn nil, errors.New(\"parameter client.subscriptionID cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{subscriptionId}\", url.PathEscape(client.subscriptionID))\n\tif resourceGroupName == \"\" {\n\t\treturn nil, errors.New(\"parameter resourceGroupName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{resourceGroupName}\", url.PathEscape(resourceGroupName))\n\tif diskPoolName == \"\" {\n\t\treturn nil, errors.New(\"parameter diskPoolName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{diskPoolName}\", url.PathEscape(diskPoolName))\n\tif iscsiTargetName == \"\" {\n\t\treturn nil, errors.New(\"parameter iscsiTargetName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{iscsiTargetName}\", url.PathEscape(iscsiTargetName))\n\treq, err := runtime.NewRequest(ctx, http.MethodPatch, runtime.JoinPaths(client.internal.Endpoint(), urlPath))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treqQP := req.Raw().URL.Query()\n\treqQP.Set(\"api-version\", \"2021-08-01\")\n\treq.Raw().URL.RawQuery = reqQP.Encode()\n\treq.Raw().Header[\"Accept\"] = []string{\"application/json\"}\n\treturn req, runtime.MarshalAsJSON(req, iscsiTargetUpdatePayload)\n}", "title": "" }, { "docid": "a80056789b86e21f6e8e74d32a7e0380", "score": "0.6507501", "text": "func (client *AFDOriginsClient) updateCreateRequest(ctx context.Context, resourceGroupName string, profileName string, originGroupName string, originName string, originUpdateProperties AFDOriginUpdateParameters, options *AFDOriginsClientBeginUpdateOptions) (*policy.Request, error) {\n\turlPath := \"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/originGroups/{originGroupName}/origins/{originName}\"\n\tif resourceGroupName == \"\" {\n\t\treturn nil, errors.New(\"parameter resourceGroupName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{resourceGroupName}\", url.PathEscape(resourceGroupName))\n\tif profileName == \"\" {\n\t\treturn nil, errors.New(\"parameter profileName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{profileName}\", url.PathEscape(profileName))\n\tif originGroupName == \"\" {\n\t\treturn nil, errors.New(\"parameter originGroupName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{originGroupName}\", url.PathEscape(originGroupName))\n\tif originName == \"\" {\n\t\treturn nil, errors.New(\"parameter originName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{originName}\", url.PathEscape(originName))\n\tif client.subscriptionID == \"\" {\n\t\treturn nil, errors.New(\"parameter client.subscriptionID cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{subscriptionId}\", url.PathEscape(client.subscriptionID))\n\treq, err := runtime.NewRequest(ctx, http.MethodPatch, runtime.JoinPaths(client.internal.Endpoint(), urlPath))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treqQP := req.Raw().URL.Query()\n\treqQP.Set(\"api-version\", \"2021-06-01\")\n\treq.Raw().URL.RawQuery = reqQP.Encode()\n\treq.Raw().Header[\"Accept\"] = []string{\"application/json\"}\n\treturn req, runtime.MarshalAsJSON(req, originUpdateProperties)\n}", "title": "" }, { "docid": "8ab7d386d092b89614a74ee2b98ae026", "score": "0.65041137", "text": "func (client *RedisClient) updateCreateRequest(ctx context.Context, resourceGroupName string, name string, parameters RedisUpdateParameters, options *RedisUpdateOptions) (*policy.Request, error) {\n\turlPath := \"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/redis/{name}\"\n\tif resourceGroupName == \"\" {\n\t\treturn nil, errors.New(\"parameter resourceGroupName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{resourceGroupName}\", url.PathEscape(resourceGroupName))\n\tif name == \"\" {\n\t\treturn nil, errors.New(\"parameter name cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{name}\", url.PathEscape(name))\n\tif client.subscriptionID == \"\" {\n\t\treturn nil, errors.New(\"parameter client.subscriptionID cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{subscriptionId}\", url.PathEscape(client.subscriptionID))\n\treq, err := runtime.NewRequest(ctx, http.MethodPatch, runtime.JoinPaths(client.ep, urlPath))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treqQP := req.Raw().URL.Query()\n\treqQP.Set(\"api-version\", \"2020-12-01\")\n\treq.Raw().URL.RawQuery = reqQP.Encode()\n\treq.Raw().Header.Set(\"Accept\", \"application/json\")\n\treturn req, runtime.MarshalAsJSON(req, parameters)\n}", "title": "" }, { "docid": "e3ad9cab3471b7090efca2ac94b22f69", "score": "0.64932257", "text": "func (client *DataCollectionEndpointsClient) updateCreateRequest(ctx context.Context, resourceGroupName string, dataCollectionEndpointName string, options *DataCollectionEndpointsClientUpdateOptions) (*policy.Request, error) {\n\turlPath := \"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/dataCollectionEndpoints/{dataCollectionEndpointName}\"\n\tif client.subscriptionID == \"\" {\n\t\treturn nil, errors.New(\"parameter client.subscriptionID cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{subscriptionId}\", url.PathEscape(client.subscriptionID))\n\tif resourceGroupName == \"\" {\n\t\treturn nil, errors.New(\"parameter resourceGroupName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{resourceGroupName}\", url.PathEscape(resourceGroupName))\n\tif dataCollectionEndpointName == \"\" {\n\t\treturn nil, errors.New(\"parameter dataCollectionEndpointName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{dataCollectionEndpointName}\", url.PathEscape(dataCollectionEndpointName))\n\treq, err := runtime.NewRequest(ctx, http.MethodPatch, runtime.JoinPaths(client.host, urlPath))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treqQP := req.Raw().URL.Query()\n\treqQP.Set(\"api-version\", \"2021-04-01\")\n\treq.Raw().URL.RawQuery = reqQP.Encode()\n\treq.Raw().Header.Set(\"Accept\", \"application/json\")\n\tif options != nil && options.Body != nil {\n\t\treturn req, runtime.MarshalAsJSON(req, *options.Body)\n\t}\n\treturn req, nil\n}", "title": "" }, { "docid": "b4c411ba63b97c372e77dadb190c3644", "score": "0.64928067", "text": "func (client *DicomServicesClient) updateCreateRequest(ctx context.Context, resourceGroupName string, dicomServiceName string, workspaceName string, dicomservicePatchResource DicomServicePatchResource, options *DicomServicesClientBeginUpdateOptions) (*policy.Request, error) {\n\turlPath := \"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HealthcareApis/workspaces/{workspaceName}/dicomservices/{dicomServiceName}\"\n\tif resourceGroupName == \"\" {\n\t\treturn nil, errors.New(\"parameter resourceGroupName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{resourceGroupName}\", url.PathEscape(resourceGroupName))\n\tif client.subscriptionID == \"\" {\n\t\treturn nil, errors.New(\"parameter client.subscriptionID cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{subscriptionId}\", url.PathEscape(client.subscriptionID))\n\tif dicomServiceName == \"\" {\n\t\treturn nil, errors.New(\"parameter dicomServiceName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{dicomServiceName}\", url.PathEscape(dicomServiceName))\n\tif workspaceName == \"\" {\n\t\treturn nil, errors.New(\"parameter workspaceName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{workspaceName}\", url.PathEscape(workspaceName))\n\treq, err := runtime.NewRequest(ctx, http.MethodPatch, runtime.JoinPaths(client.host, urlPath))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treqQP := req.Raw().URL.Query()\n\treqQP.Set(\"api-version\", \"2021-06-01-preview\")\n\treq.Raw().URL.RawQuery = reqQP.Encode()\n\treq.Raw().Header.Set(\"Accept\", \"application/json\")\n\treturn req, runtime.MarshalAsJSON(req, dicomservicePatchResource)\n}", "title": "" }, { "docid": "c42b7cd8625a50463f851e67237047d7", "score": "0.6490876", "text": "func (client *DataCollectionEndpointsClient) updateCreateRequest(ctx context.Context, resourceGroupName string, dataCollectionEndpointName string, options *DataCollectionEndpointsUpdateOptions) (*policy.Request, error) {\n\turlPath := \"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/dataCollectionEndpoints/{dataCollectionEndpointName}\"\n\tif client.subscriptionID == \"\" {\n\t\treturn nil, errors.New(\"parameter client.subscriptionID cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{subscriptionId}\", url.PathEscape(client.subscriptionID))\n\tif resourceGroupName == \"\" {\n\t\treturn nil, errors.New(\"parameter resourceGroupName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{resourceGroupName}\", url.PathEscape(resourceGroupName))\n\tif dataCollectionEndpointName == \"\" {\n\t\treturn nil, errors.New(\"parameter dataCollectionEndpointName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{dataCollectionEndpointName}\", url.PathEscape(dataCollectionEndpointName))\n\treq, err := runtime.NewRequest(ctx, http.MethodPatch, runtime.JoinPaths(client.ep, urlPath))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treqQP := req.Raw().URL.Query()\n\treqQP.Set(\"api-version\", \"2021-04-01\")\n\treq.Raw().URL.RawQuery = reqQP.Encode()\n\treq.Raw().Header.Set(\"Accept\", \"application/json\")\n\tif options != nil && options.Body != nil {\n\t\treturn req, runtime.MarshalAsJSON(req, *options.Body)\n\t}\n\treturn req, nil\n}", "title": "" }, { "docid": "25bf764c01464cc683458a7579cf5bc4", "score": "0.64583445", "text": "func (client *IntegrationRuntimeNodesClient) updateCreateRequest(ctx context.Context, resourceGroupName string, factoryName string, integrationRuntimeName string, nodeName string, updateIntegrationRuntimeNodeRequest UpdateIntegrationRuntimeNodeRequest, options *IntegrationRuntimeNodesClientUpdateOptions) (*policy.Request, error) {\n\turlPath := \"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataFactory/factories/{factoryName}/integrationRuntimes/{integrationRuntimeName}/nodes/{nodeName}\"\n\tif client.subscriptionID == \"\" {\n\t\treturn nil, errors.New(\"parameter client.subscriptionID cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{subscriptionId}\", url.PathEscape(client.subscriptionID))\n\tif resourceGroupName == \"\" {\n\t\treturn nil, errors.New(\"parameter resourceGroupName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{resourceGroupName}\", url.PathEscape(resourceGroupName))\n\tif factoryName == \"\" {\n\t\treturn nil, errors.New(\"parameter factoryName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{factoryName}\", url.PathEscape(factoryName))\n\tif integrationRuntimeName == \"\" {\n\t\treturn nil, errors.New(\"parameter integrationRuntimeName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{integrationRuntimeName}\", url.PathEscape(integrationRuntimeName))\n\tif nodeName == \"\" {\n\t\treturn nil, errors.New(\"parameter nodeName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{nodeName}\", url.PathEscape(nodeName))\n\treq, err := runtime.NewRequest(ctx, http.MethodPatch, runtime.JoinPaths(client.internal.Endpoint(), urlPath))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treqQP := req.Raw().URL.Query()\n\treqQP.Set(\"api-version\", \"2018-06-01\")\n\treq.Raw().URL.RawQuery = reqQP.Encode()\n\treq.Raw().Header[\"Accept\"] = []string{\"application/json\"}\n\treturn req, runtime.MarshalAsJSON(req, updateIntegrationRuntimeNodeRequest)\n}", "title": "" }, { "docid": "3c054e069857d6e879df9f3b2cc992eb", "score": "0.64572334", "text": "func (client *AgentPoolsClient) updateCreateRequest(ctx context.Context, resourceGroupName string, kubernetesClusterName string, agentPoolName string, agentPoolUpdateParameters AgentPoolPatchParameters, options *AgentPoolsClientBeginUpdateOptions) (*policy.Request, error) {\n\turlPath := \"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetworkCloud/kubernetesClusters/{kubernetesClusterName}/agentPools/{agentPoolName}\"\n\turlPath = strings.ReplaceAll(urlPath, \"{subscriptionId}\", url.PathEscape(client.subscriptionID))\n\tif resourceGroupName == \"\" {\n\t\treturn nil, errors.New(\"parameter resourceGroupName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{resourceGroupName}\", url.PathEscape(resourceGroupName))\n\tif kubernetesClusterName == \"\" {\n\t\treturn nil, errors.New(\"parameter kubernetesClusterName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{kubernetesClusterName}\", url.PathEscape(kubernetesClusterName))\n\tif agentPoolName == \"\" {\n\t\treturn nil, errors.New(\"parameter agentPoolName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{agentPoolName}\", url.PathEscape(agentPoolName))\n\treq, err := runtime.NewRequest(ctx, http.MethodPatch, runtime.JoinPaths(client.internal.Endpoint(), urlPath))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treqQP := req.Raw().URL.Query()\n\treqQP.Set(\"api-version\", \"2023-07-01\")\n\treq.Raw().URL.RawQuery = reqQP.Encode()\n\treq.Raw().Header[\"Accept\"] = []string{\"application/json\"}\n\tif err := runtime.MarshalAsJSON(req, agentPoolUpdateParameters); err != nil {\n\t\treturn nil, err\n\t}\n\treturn req, nil\n}", "title": "" }, { "docid": "521d4008ad351c97b3f776d9aeb3f855", "score": "0.6447143", "text": "func (client *ReplicationsClient) updateCreateRequest(ctx context.Context, resourceGroupName string, registryName string, replicationName string, replicationUpdateParameters ReplicationUpdateParameters, options *ReplicationsClientBeginUpdateOptions) (*policy.Request, error) {\n\turlPath := \"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/replications/{replicationName}\"\n\turlPath = strings.ReplaceAll(urlPath, \"{subscriptionId}\", url.PathEscape(client.subscriptionID))\n\tif resourceGroupName == \"\" {\n\t\treturn nil, errors.New(\"parameter resourceGroupName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{resourceGroupName}\", url.PathEscape(resourceGroupName))\n\tif registryName == \"\" {\n\t\treturn nil, errors.New(\"parameter registryName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{registryName}\", url.PathEscape(registryName))\n\tif replicationName == \"\" {\n\t\treturn nil, errors.New(\"parameter replicationName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{replicationName}\", url.PathEscape(replicationName))\n\treq, err := runtime.NewRequest(ctx, http.MethodPatch, runtime.JoinPaths(client.internal.Endpoint(), urlPath))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treqQP := req.Raw().URL.Query()\n\treqQP.Set(\"api-version\", \"2023-01-01-preview\")\n\treq.Raw().URL.RawQuery = reqQP.Encode()\n\treq.Raw().Header[\"Accept\"] = []string{\"application/json\"}\n\tif err := runtime.MarshalAsJSON(req, replicationUpdateParameters); err != nil {\n\t\treturn nil, err\n\t}\n\treturn req, nil\n}", "title": "" }, { "docid": "8927f045e16d0e2e19a68bc3b4dd4458", "score": "0.6441655", "text": "func (client *UserMetricsKeysClient) createOrUpdateCreateRequest(ctx context.Context, options *UserMetricsKeysClientCreateOrUpdateOptions) (*policy.Request, error) {\n\turlPath := \"/subscriptions/{subscriptionId}/providers/Microsoft.Network/trafficManagerUserMetricsKeys/default\"\n\tif client.subscriptionID == \"\" {\n\t\treturn nil, errors.New(\"parameter client.subscriptionID cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{subscriptionId}\", url.PathEscape(client.subscriptionID))\n\treq, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.internal.Endpoint(), urlPath))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treqQP := req.Raw().URL.Query()\n\treqQP.Set(\"api-version\", \"2022-04-01\")\n\treq.Raw().URL.RawQuery = reqQP.Encode()\n\treq.Raw().Header[\"Accept\"] = []string{\"application/json\"}\n\treturn req, nil\n}", "title": "" }, { "docid": "eabe992a85c72472e1b64f6f8637a1dd", "score": "0.6435592", "text": "func (client *OutputsClient) updateCreateRequest(ctx context.Context, resourceGroupName string, jobName string, outputName string, output Output, options *OutputsClientUpdateOptions) (*policy.Request, error) {\n\turlPath := \"/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.StreamAnalytics/streamingjobs/{jobName}/outputs/{outputName}\"\n\tif client.subscriptionID == \"\" {\n\t\treturn nil, errors.New(\"parameter client.subscriptionID cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{subscriptionId}\", url.PathEscape(client.subscriptionID))\n\tif resourceGroupName == \"\" {\n\t\treturn nil, errors.New(\"parameter resourceGroupName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{resourceGroupName}\", url.PathEscape(resourceGroupName))\n\tif jobName == \"\" {\n\t\treturn nil, errors.New(\"parameter jobName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{jobName}\", url.PathEscape(jobName))\n\tif outputName == \"\" {\n\t\treturn nil, errors.New(\"parameter outputName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{outputName}\", url.PathEscape(outputName))\n\treq, err := runtime.NewRequest(ctx, http.MethodPatch, runtime.JoinPaths(client.internal.Endpoint(), urlPath))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treqQP := req.Raw().URL.Query()\n\treqQP.Set(\"api-version\", \"2020-03-01\")\n\treq.Raw().URL.RawQuery = reqQP.Encode()\n\tif options != nil && options.IfMatch != nil {\n\t\treq.Raw().Header[\"If-Match\"] = []string{*options.IfMatch}\n\t}\n\treq.Raw().Header[\"Accept\"] = []string{\"application/json\"}\n\treturn req, runtime.MarshalAsJSON(req, output)\n}", "title": "" }, { "docid": "a41473ee2fc274ba7c049909a8690f82", "score": "0.6426928", "text": "func (client *OutputsClient) updateCreateRequest(ctx context.Context, resourceGroupName string, jobName string, outputName string, output Output, options *OutputsUpdateOptions) (*policy.Request, error) {\n\turlPath := \"/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.StreamAnalytics/streamingjobs/{jobName}/outputs/{outputName}\"\n\tif client.subscriptionID == \"\" {\n\t\treturn nil, errors.New(\"parameter client.subscriptionID cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{subscriptionId}\", url.PathEscape(client.subscriptionID))\n\tif resourceGroupName == \"\" {\n\t\treturn nil, errors.New(\"parameter resourceGroupName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{resourceGroupName}\", url.PathEscape(resourceGroupName))\n\tif jobName == \"\" {\n\t\treturn nil, errors.New(\"parameter jobName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{jobName}\", url.PathEscape(jobName))\n\tif outputName == \"\" {\n\t\treturn nil, errors.New(\"parameter outputName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{outputName}\", url.PathEscape(outputName))\n\treq, err := runtime.NewRequest(ctx, http.MethodPatch, runtime.JoinPaths(client.ep, urlPath))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treqQP := req.Raw().URL.Query()\n\treqQP.Set(\"api-version\", \"2017-04-01-preview\")\n\treq.Raw().URL.RawQuery = reqQP.Encode()\n\tif options != nil && options.IfMatch != nil {\n\t\treq.Raw().Header.Set(\"If-Match\", *options.IfMatch)\n\t}\n\treq.Raw().Header.Set(\"Accept\", \"application/json\")\n\treturn req, runtime.MarshalAsJSON(req, output)\n}", "title": "" }, { "docid": "0b01a9bb0971466a296322253b3e5261", "score": "0.6402994", "text": "func (client *CapacitiesClient) updateCreateRequest(ctx context.Context, resourceGroupName string, dedicatedCapacityName string, capacityUpdateParameters DedicatedCapacityUpdateParameters, options *CapacitiesClientBeginUpdateOptions) (*policy.Request, error) {\n\turlPath := \"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.PowerBIDedicated/capacities/{dedicatedCapacityName}\"\n\tif resourceGroupName == \"\" {\n\t\treturn nil, errors.New(\"parameter resourceGroupName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{resourceGroupName}\", url.PathEscape(resourceGroupName))\n\tif dedicatedCapacityName == \"\" {\n\t\treturn nil, errors.New(\"parameter dedicatedCapacityName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{dedicatedCapacityName}\", url.PathEscape(dedicatedCapacityName))\n\tif client.subscriptionID == \"\" {\n\t\treturn nil, errors.New(\"parameter client.subscriptionID cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{subscriptionId}\", url.PathEscape(client.subscriptionID))\n\treq, err := runtime.NewRequest(ctx, http.MethodPatch, runtime.JoinPaths(client.internal.Endpoint(), urlPath))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treqQP := req.Raw().URL.Query()\n\treqQP.Set(\"api-version\", \"2021-01-01\")\n\treq.Raw().URL.RawQuery = reqQP.Encode()\n\treq.Raw().Header[\"Accept\"] = []string{\"application/json\"}\n\treturn req, runtime.MarshalAsJSON(req, capacityUpdateParameters)\n}", "title": "" }, { "docid": "a540d3c7ee015f8d64514cf68c792871", "score": "0.64000666", "text": "func CreateUpdateK8sApplicationConfigRequest() (request *UpdateK8sApplicationConfigRequest) {\n\trequest = &UpdateK8sApplicationConfigRequest{\n\t\tRoaRequest: &requests.RoaRequest{},\n\t}\n\trequest.InitWithApiInfo(\"Edas\", \"2017-08-01\", \"UpdateK8sApplicationConfig\", \"/pop/v5/k8s/acs/k8s_app_configuration\", \"Edas\", \"openAPI\")\n\trequest.Method = requests.PUT\n\treturn\n}", "title": "" }, { "docid": "e6483055381a161d35fe47345a4c64ff", "score": "0.63982034", "text": "func (client *DedicatedHostsClient) updateCreateRequest(ctx context.Context, resourceGroupName string, hostGroupName string, hostName string, parameters DedicatedHostUpdate, options *DedicatedHostsBeginUpdateOptions) (*policy.Request, error) {\n\turlPath := \"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/hostGroups/{hostGroupName}/hosts/{hostName}\"\n\tif resourceGroupName == \"\" {\n\t\treturn nil, errors.New(\"parameter resourceGroupName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{resourceGroupName}\", url.PathEscape(resourceGroupName))\n\tif hostGroupName == \"\" {\n\t\treturn nil, errors.New(\"parameter hostGroupName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{hostGroupName}\", url.PathEscape(hostGroupName))\n\tif hostName == \"\" {\n\t\treturn nil, errors.New(\"parameter hostName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{hostName}\", url.PathEscape(hostName))\n\tif client.subscriptionID == \"\" {\n\t\treturn nil, errors.New(\"parameter client.subscriptionID cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{subscriptionId}\", url.PathEscape(client.subscriptionID))\n\treq, err := runtime.NewRequest(ctx, http.MethodPatch, runtime.JoinPaths(client.ep, urlPath))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treqQP := req.Raw().URL.Query()\n\treqQP.Set(\"api-version\", \"2021-07-01\")\n\treq.Raw().URL.RawQuery = reqQP.Encode()\n\treq.Raw().Header.Set(\"Accept\", \"application/json\")\n\treturn req, runtime.MarshalAsJSON(req, parameters)\n}", "title": "" }, { "docid": "65bdc8ecefc1afc96cd30e283ccd0d89", "score": "0.6395804", "text": "func (client *DedicatedHostsClient) updateCreateRequest(ctx context.Context, resourceGroupName string, hostGroupName string, hostName string, parameters DedicatedHostUpdate, options *DedicatedHostsBeginUpdateOptions) (*azcore.Request, error) {\n\turlPath := \"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/hostGroups/{hostGroupName}/hosts/{hostName}\"\n\turlPath = strings.ReplaceAll(urlPath, \"{resourceGroupName}\", url.PathEscape(resourceGroupName))\n\turlPath = strings.ReplaceAll(urlPath, \"{hostGroupName}\", url.PathEscape(hostGroupName))\n\turlPath = strings.ReplaceAll(urlPath, \"{hostName}\", url.PathEscape(hostName))\n\turlPath = strings.ReplaceAll(urlPath, \"{subscriptionId}\", url.PathEscape(client.subscriptionID))\n\treq, err := azcore.NewRequest(ctx, http.MethodPatch, azcore.JoinPaths(client.con.Endpoint(), urlPath))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treq.Telemetry(telemetryInfo)\n\tquery := req.URL.Query()\n\tquery.Set(\"api-version\", \"2020-06-01\")\n\treq.URL.RawQuery = query.Encode()\n\treq.Header.Set(\"Accept\", \"application/json\")\n\treturn req, req.MarshalAsJSON(parameters)\n}", "title": "" }, { "docid": "497a50ce1ceb775a3325853199068fb9", "score": "0.63897896", "text": "func (client *VirtualMachineScaleSetsClient) updateCreateRequest(ctx context.Context, resourceGroupName string, vmScaleSetName string, parameters VirtualMachineScaleSetUpdate, options *VirtualMachineScaleSetsBeginUpdateOptions) (*policy.Request, error) {\n\turlPath := \"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}\"\n\tif resourceGroupName == \"\" {\n\t\treturn nil, errors.New(\"parameter resourceGroupName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{resourceGroupName}\", url.PathEscape(resourceGroupName))\n\tif vmScaleSetName == \"\" {\n\t\treturn nil, errors.New(\"parameter vmScaleSetName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{vmScaleSetName}\", url.PathEscape(vmScaleSetName))\n\tif client.subscriptionID == \"\" {\n\t\treturn nil, errors.New(\"parameter client.subscriptionID cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{subscriptionId}\", url.PathEscape(client.subscriptionID))\n\treq, err := runtime.NewRequest(ctx, http.MethodPatch, runtime.JoinPaths(client.ep, urlPath))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treqQP := req.Raw().URL.Query()\n\treqQP.Set(\"api-version\", \"2021-07-01\")\n\treq.Raw().URL.RawQuery = reqQP.Encode()\n\treq.Raw().Header.Set(\"Accept\", \"application/json\")\n\treturn req, runtime.MarshalAsJSON(req, parameters)\n}", "title": "" }, { "docid": "36d88616e42cf12a00cd71bb695df50e", "score": "0.6376635", "text": "func (client *MonitoringSettingsClient) updatePutCreateRequest(ctx context.Context, resourceGroupName string, serviceName string, monitoringSettingResource MonitoringSettingResource, options *MonitoringSettingsClientBeginUpdatePutOptions) (*policy.Request, error) {\n\turlPath := \"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/monitoringSettings/default\"\n\tif client.subscriptionID == \"\" {\n\t\treturn nil, errors.New(\"parameter client.subscriptionID cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{subscriptionId}\", url.PathEscape(client.subscriptionID))\n\tif resourceGroupName == \"\" {\n\t\treturn nil, errors.New(\"parameter resourceGroupName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{resourceGroupName}\", url.PathEscape(resourceGroupName))\n\tif serviceName == \"\" {\n\t\treturn nil, errors.New(\"parameter serviceName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{serviceName}\", url.PathEscape(serviceName))\n\treq, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.internal.Endpoint(), urlPath))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treqQP := req.Raw().URL.Query()\n\treqQP.Set(\"api-version\", \"2023-01-01-preview\")\n\treq.Raw().URL.RawQuery = reqQP.Encode()\n\treq.Raw().Header[\"Accept\"] = []string{\"application/json\"}\n\treturn req, runtime.MarshalAsJSON(req, monitoringSettingResource)\n}", "title": "" }, { "docid": "b0e89245e1b24db3e62e7177a8788d0e", "score": "0.63694835", "text": "func CreateUpdateIntegrationRequest() (request *UpdateIntegrationRequest) {\n\trequest = &UpdateIntegrationRequest{\n\t\tRpcRequest: &requests.RpcRequest{},\n\t}\n\trequest.InitWithApiInfo(\"ARMS\", \"2019-08-08\", \"UpdateIntegration\", \"arms\", \"openAPI\")\n\trequest.Method = requests.POST\n\treturn\n}", "title": "" }, { "docid": "be51de9d59f300e613141aa6595332f2", "score": "0.6365494", "text": "func (client *VideosClient) updateCreateRequest(ctx context.Context, resourceGroupName string, accountName string, videoName string, parameters VideoEntity, options *VideosClientUpdateOptions) (*policy.Request, error) {\n\turlPath := \"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/videoAnalyzers/{accountName}/videos/{videoName}\"\n\tif client.subscriptionID == \"\" {\n\t\treturn nil, errors.New(\"parameter client.subscriptionID cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{subscriptionId}\", url.PathEscape(client.subscriptionID))\n\tif resourceGroupName == \"\" {\n\t\treturn nil, errors.New(\"parameter resourceGroupName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{resourceGroupName}\", url.PathEscape(resourceGroupName))\n\tif accountName == \"\" {\n\t\treturn nil, errors.New(\"parameter accountName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{accountName}\", url.PathEscape(accountName))\n\tif videoName == \"\" {\n\t\treturn nil, errors.New(\"parameter videoName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{videoName}\", url.PathEscape(videoName))\n\treq, err := runtime.NewRequest(ctx, http.MethodPatch, runtime.JoinPaths(client.host, urlPath))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treqQP := req.Raw().URL.Query()\n\treqQP.Set(\"api-version\", \"2021-11-01-preview\")\n\treq.Raw().URL.RawQuery = reqQP.Encode()\n\treq.Raw().Header[\"Accept\"] = []string{\"application/json\"}\n\treturn req, runtime.MarshalAsJSON(req, parameters)\n}", "title": "" }, { "docid": "97944e8b73cbcc8f87edf47ce100d63b", "score": "0.63607556", "text": "func (client *GalleryImagesClient) updateCreateRequest(ctx context.Context, resourceGroupName string, galleryName string, galleryImageName string, galleryImage GalleryImageUpdate, options *GalleryImagesClientBeginUpdateOptions) (*policy.Request, error) {\n\turlPath := \"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/images/{galleryImageName}\"\n\tif client.subscriptionID == \"\" {\n\t\treturn nil, errors.New(\"parameter client.subscriptionID cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{subscriptionId}\", url.PathEscape(client.subscriptionID))\n\tif resourceGroupName == \"\" {\n\t\treturn nil, errors.New(\"parameter resourceGroupName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{resourceGroupName}\", url.PathEscape(resourceGroupName))\n\tif galleryName == \"\" {\n\t\treturn nil, errors.New(\"parameter galleryName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{galleryName}\", url.PathEscape(galleryName))\n\tif galleryImageName == \"\" {\n\t\treturn nil, errors.New(\"parameter galleryImageName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{galleryImageName}\", url.PathEscape(galleryImageName))\n\treq, err := runtime.NewRequest(ctx, http.MethodPatch, runtime.JoinPaths(client.host, urlPath))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treqQP := req.Raw().URL.Query()\n\treqQP.Set(\"api-version\", \"2021-07-01\")\n\treq.Raw().URL.RawQuery = reqQP.Encode()\n\treq.Raw().Header.Set(\"Accept\", \"application/json\")\n\treturn req, runtime.MarshalAsJSON(req, galleryImage)\n}", "title": "" }, { "docid": "f3fc543ae125e444ea05ecca6f93b49c", "score": "0.63568354", "text": "func (client *ManagedDatabasesClient) updateCreateRequest(ctx context.Context, resourceGroupName string, managedInstanceName string, databaseName string, parameters ManagedDatabaseUpdate, options *ManagedDatabasesClientBeginUpdateOptions) (*policy.Request, error) {\n\turlPath := \"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}/databases/{databaseName}\"\n\tif resourceGroupName == \"\" {\n\t\treturn nil, errors.New(\"parameter resourceGroupName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{resourceGroupName}\", url.PathEscape(resourceGroupName))\n\tif managedInstanceName == \"\" {\n\t\treturn nil, errors.New(\"parameter managedInstanceName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{managedInstanceName}\", url.PathEscape(managedInstanceName))\n\tif databaseName == \"\" {\n\t\treturn nil, errors.New(\"parameter databaseName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{databaseName}\", url.PathEscape(databaseName))\n\tif client.subscriptionID == \"\" {\n\t\treturn nil, errors.New(\"parameter client.subscriptionID cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{subscriptionId}\", url.PathEscape(client.subscriptionID))\n\treq, err := runtime.NewRequest(ctx, http.MethodPatch, runtime.JoinPaths(client.internal.Endpoint(), urlPath))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treqQP := req.Raw().URL.Query()\n\treqQP.Set(\"api-version\", \"2022-08-01-preview\")\n\treq.Raw().URL.RawQuery = reqQP.Encode()\n\treq.Raw().Header[\"Accept\"] = []string{\"application/json\"}\n\tif err := runtime.MarshalAsJSON(req, parameters); err != nil {\n\t\treturn nil, err\n\t}\n\treturn req, nil\n}", "title": "" }, { "docid": "c6aa3c7d7a160f5c5d274e06b96d9e08", "score": "0.6355494", "text": "func (client *TaskRunsClient) updateCreateRequest(ctx context.Context, resourceGroupName string, registryName string, taskRunName string, updateParameters TaskRunUpdateParameters, options *TaskRunsClientBeginUpdateOptions) (*policy.Request, error) {\n\turlPath := \"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/taskRuns/{taskRunName}\"\n\tif client.subscriptionID == \"\" {\n\t\treturn nil, errors.New(\"parameter client.subscriptionID cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{subscriptionId}\", url.PathEscape(client.subscriptionID))\n\tif resourceGroupName == \"\" {\n\t\treturn nil, errors.New(\"parameter resourceGroupName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{resourceGroupName}\", url.PathEscape(resourceGroupName))\n\tif registryName == \"\" {\n\t\treturn nil, errors.New(\"parameter registryName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{registryName}\", url.PathEscape(registryName))\n\tif taskRunName == \"\" {\n\t\treturn nil, errors.New(\"parameter taskRunName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{taskRunName}\", url.PathEscape(taskRunName))\n\treq, err := runtime.NewRequest(ctx, http.MethodPatch, runtime.JoinPaths(client.host, urlPath))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treqQP := req.Raw().URL.Query()\n\treqQP.Set(\"api-version\", \"2019-06-01-preview\")\n\treq.Raw().URL.RawQuery = reqQP.Encode()\n\treq.Raw().Header.Set(\"Accept\", \"application/json\")\n\treturn req, runtime.MarshalAsJSON(req, updateParameters)\n}", "title": "" }, { "docid": "cf0592308dfb1d66f62ea5f0bb1bb157", "score": "0.63270545", "text": "func (client *ReplicationsClient) updateCreateRequest(ctx context.Context, resourceGroupName string, registryName string, replicationName string, replicationUpdateParameters ReplicationUpdateParameters, options *ReplicationsBeginUpdateOptions) (*azcore.Request, error) {\n\turlPath := \"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/replications/{replicationName}\"\n\tif client.subscriptionID == \"\" {\n\t\treturn nil, errors.New(\"parameter client.subscriptionID cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{subscriptionId}\", url.PathEscape(client.subscriptionID))\n\tif resourceGroupName == \"\" {\n\t\treturn nil, errors.New(\"parameter resourceGroupName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{resourceGroupName}\", url.PathEscape(resourceGroupName))\n\tif registryName == \"\" {\n\t\treturn nil, errors.New(\"parameter registryName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{registryName}\", url.PathEscape(registryName))\n\tif replicationName == \"\" {\n\t\treturn nil, errors.New(\"parameter replicationName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{replicationName}\", url.PathEscape(replicationName))\n\treq, err := azcore.NewRequest(ctx, http.MethodPatch, azcore.JoinPaths(client.con.Endpoint(), urlPath))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treq.Telemetry(telemetryInfo)\n\treqQP := req.URL.Query()\n\treqQP.Set(\"api-version\", \"2021-06-01-preview\")\n\treq.URL.RawQuery = reqQP.Encode()\n\treq.Header.Set(\"Accept\", \"application/json\")\n\treturn req, req.MarshalAsJSON(replicationUpdateParameters)\n}", "title": "" }, { "docid": "a1e64a7e72c2a6a19dbf5e6e5f552eca", "score": "0.6322547", "text": "func (client *VirtualNetworkLinksClient) updateCreateRequest(ctx context.Context, resourceGroupName string, privateZoneName string, virtualNetworkLinkName string, parameters VirtualNetworkLink, options *VirtualNetworkLinksBeginUpdateOptions) (*policy.Request, error) {\n\turlPath := \"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/privateDnsZones/{privateZoneName}/virtualNetworkLinks/{virtualNetworkLinkName}\"\n\tif resourceGroupName == \"\" {\n\t\treturn nil, errors.New(\"parameter resourceGroupName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{resourceGroupName}\", url.PathEscape(resourceGroupName))\n\tif privateZoneName == \"\" {\n\t\treturn nil, errors.New(\"parameter privateZoneName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{privateZoneName}\", url.PathEscape(privateZoneName))\n\tif virtualNetworkLinkName == \"\" {\n\t\treturn nil, errors.New(\"parameter virtualNetworkLinkName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{virtualNetworkLinkName}\", url.PathEscape(virtualNetworkLinkName))\n\tif client.subscriptionID == \"\" {\n\t\treturn nil, errors.New(\"parameter client.subscriptionID cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{subscriptionId}\", url.PathEscape(client.subscriptionID))\n\treq, err := runtime.NewRequest(ctx, http.MethodPatch, runtime.JoinPaths(client.ep, urlPath))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treqQP := req.Raw().URL.Query()\n\treqQP.Set(\"api-version\", \"2020-06-01\")\n\treq.Raw().URL.RawQuery = reqQP.Encode()\n\tif options != nil && options.IfMatch != nil {\n\t\treq.Raw().Header.Set(\"If-Match\", *options.IfMatch)\n\t}\n\treq.Raw().Header.Set(\"Accept\", \"application/json\")\n\treturn req, runtime.MarshalAsJSON(req, parameters)\n}", "title": "" }, { "docid": "62a0b33da2172b34251eecd01cb16fe6", "score": "0.63138914", "text": "func CreateUpdateMessageAppRequest() (request *UpdateMessageAppRequest) {\n\trequest = &UpdateMessageAppRequest{\n\t\tRpcRequest: &requests.RpcRequest{},\n\t}\n\trequest.InitWithApiInfo(\"live\", \"2016-11-01\", \"UpdateMessageApp\", \"live\", \"openAPI\")\n\trequest.Method = requests.POST\n\treturn\n}", "title": "" }, { "docid": "b06bed0601ce09d053f2b01c6b3235d2", "score": "0.63097805", "text": "func CreateUpdateRulesAttributeRequest() (request *UpdateRulesAttributeRequest) {\n\trequest = &UpdateRulesAttributeRequest{\n\t\tRpcRequest: &requests.RpcRequest{},\n\t}\n\trequest.InitWithApiInfo(\"Alb\", \"2020-06-16\", \"UpdateRulesAttribute\", \"alb\", \"openAPI\")\n\trequest.Method = requests.POST\n\treturn\n}", "title": "" }, { "docid": "e0063b887f8d6acbe47fc1319c5675d6", "score": "0.6308491", "text": "func CreateUpdateEcsImageRequest() (request *UpdateEcsImageRequest) {\n\trequest = &UpdateEcsImageRequest{\n\t\tRpcRequest: &requests.RpcRequest{},\n\t}\n\trequest.InitWithApiInfo(\"faas\", \"2020-02-17\", \"UpdateEcsImage\", \"faas\", \"openAPI\")\n\trequest.Method = requests.POST\n\treturn\n}", "title": "" }, { "docid": "f6c72918cfc98ee3ff6702b66fe2ff59", "score": "0.6291369", "text": "func CreateUpdateTicketRequest() (request *UpdateTicketRequest) {\n\trequest = &UpdateTicketRequest{\n\t\tRpcRequest: &requests.RpcRequest{},\n\t}\n\trequest.InitWithApiInfo(\"scsp\", \"2020-07-02\", \"UpdateTicket\", \"\", \"\")\n\trequest.Method = requests.POST\n\treturn\n}", "title": "" }, { "docid": "8c3bd8251cef1cc916a7754a14ad52e5", "score": "0.6283618", "text": "func (client *DefenderSettingsClient) createOrUpdateCreateRequest(ctx context.Context, defenderSettingsModel DefenderSettingsModel, options *DefenderSettingsClientCreateOrUpdateOptions) (*policy.Request, error) {\n\turlPath := \"/subscriptions/{subscriptionId}/providers/Microsoft.IoTSecurity/defenderSettings/default\"\n\tif client.subscriptionID == \"\" {\n\t\treturn nil, errors.New(\"parameter client.subscriptionID cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{subscriptionId}\", url.PathEscape(client.subscriptionID))\n\treq, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.internal.Endpoint(), urlPath))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treqQP := req.Raw().URL.Query()\n\treqQP.Set(\"api-version\", \"2021-02-01-preview\")\n\treq.Raw().URL.RawQuery = reqQP.Encode()\n\treq.Raw().Header[\"Accept\"] = []string{\"application/json\"}\n\treturn req, runtime.MarshalAsJSON(req, defenderSettingsModel)\n}", "title": "" }, { "docid": "a9a33b1d94986bf713e407df05cf692c", "score": "0.62733513", "text": "func (client *ApplyUpdatesClient) listCreateRequest(ctx context.Context, options *ApplyUpdatesClientListOptions) (*policy.Request, error) {\n\turlPath := \"/subscriptions/{subscriptionId}/providers/Microsoft.Maintenance/applyUpdates\"\n\tif client.subscriptionID == \"\" {\n\t\treturn nil, errors.New(\"parameter client.subscriptionID cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{subscriptionId}\", url.PathEscape(client.subscriptionID))\n\treq, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treqQP := req.Raw().URL.Query()\n\treqQP.Set(\"api-version\", \"2023-04-01\")\n\treq.Raw().URL.RawQuery = reqQP.Encode()\n\treq.Raw().Header[\"Accept\"] = []string{\"application/json\"}\n\treturn req, nil\n}", "title": "" }, { "docid": "1ef4c08f385d393200076022a4c24c30", "score": "0.6250374", "text": "func (client *GalleryImageVersionsClient) updateCreateRequest(ctx context.Context, resourceGroupName string, galleryName string, galleryImageName string, galleryImageVersionName string, galleryImageVersion GalleryImageVersionUpdate, options *GalleryImageVersionsBeginUpdateOptions) (*azcore.Request, error) {\n\turlPath := \"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/images/{galleryImageName}/versions/{galleryImageVersionName}\"\n\turlPath = strings.ReplaceAll(urlPath, \"{subscriptionId}\", url.PathEscape(client.subscriptionID))\n\turlPath = strings.ReplaceAll(urlPath, \"{resourceGroupName}\", url.PathEscape(resourceGroupName))\n\turlPath = strings.ReplaceAll(urlPath, \"{galleryName}\", url.PathEscape(galleryName))\n\turlPath = strings.ReplaceAll(urlPath, \"{galleryImageName}\", url.PathEscape(galleryImageName))\n\turlPath = strings.ReplaceAll(urlPath, \"{galleryImageVersionName}\", url.PathEscape(galleryImageVersionName))\n\treq, err := azcore.NewRequest(ctx, http.MethodPatch, azcore.JoinPaths(client.con.Endpoint(), urlPath))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treq.Telemetry(telemetryInfo)\n\tquery := req.URL.Query()\n\tquery.Set(\"api-version\", \"2020-09-30\")\n\treq.URL.RawQuery = query.Encode()\n\treq.Header.Set(\"Accept\", \"application/json\")\n\treturn req, req.MarshalAsJSON(galleryImageVersion)\n}", "title": "" }, { "docid": "472d609920d1318a3a862bff552d38bc", "score": "0.62481505", "text": "func (client *subscriptionClient) putCreateRequest(ctx context.Context, topicName string, subscriptionName string, requestBody map[string]interface{}, options *SubscriptionPutOptions) (*policy.Request, error) {\n\turlPath := \"/{topicName}/subscriptions/{subscriptionName}\"\n\tif topicName == \"\" {\n\t\treturn nil, errors.New(\"parameter topicName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{topicName}\", url.PathEscape(topicName))\n\tif subscriptionName == \"\" {\n\t\treturn nil, errors.New(\"parameter subscriptionName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{subscriptionName}\", url.PathEscape(subscriptionName))\n\treq, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.con.Endpoint(), urlPath))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treqQP := req.Raw().URL.Query()\n\tif client.apiVersion != nil {\n\t\treqQP.Set(\"api-version\", \"2017_04\")\n\t}\n\treq.Raw().URL.RawQuery = reqQP.Encode()\n\tif options != nil && options.IfMatch != nil {\n\t\treq.Raw().Header.Set(\"If-Match\", *options.IfMatch)\n\t}\n\treq.Raw().Header.Set(\"Accept\", \"application/xml, application/atom+xml\")\n\treturn req, runtime.MarshalAsXML(req, requestBody)\n}", "title": "" }, { "docid": "649089931532b0d1e659f063db1b6a71", "score": "0.6236843", "text": "func NewUpdateRequest(payload *roles.Role) *rolespb.UpdateRequest {\n\tmessage := &rolespb.UpdateRequest{\n\t\tName: payload.Name,\n\t}\n\tif payload.Description != nil {\n\t\tmessage.Description = *payload.Description\n\t}\n\treturn message\n}", "title": "" }, { "docid": "a7def017176099fe01d50cb24a3e7b39", "score": "0.6224695", "text": "func newUpdateAttestorUpdateAttestorRequest(ctx context.Context, f *Attestor, c *Client) (map[string]interface{}, error) {\n\treq := map[string]interface{}{}\n\n\treturn req, nil\n}", "title": "" }, { "docid": "89831a9da00d6c4792be9f9890f4efcb", "score": "0.6216815", "text": "func (client *KeyVaultClient) updateCertificateCreateRequest(ctx context.Context, vaultBaseURL string, certificateName string, certificateVersion string, parameters CertificateUpdateParameters, options *KeyVaultClientUpdateCertificateOptions) (*policy.Request, error) {\n\thost := \"{vaultBaseUrl}\"\n\thost = strings.ReplaceAll(host, \"{vaultBaseUrl}\", vaultBaseURL)\n\turlPath := \"/certificates/{certificate-name}/{certificate-version}\"\n\tif certificateName == \"\" {\n\t\treturn nil, errors.New(\"parameter certificateName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{certificate-name}\", url.PathEscape(certificateName))\n\tif certificateVersion == \"\" {\n\t\treturn nil, errors.New(\"parameter certificateVersion cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{certificate-version}\", url.PathEscape(certificateVersion))\n\treq, err := runtime.NewRequest(ctx, http.MethodPatch, runtime.JoinPaths(host, urlPath))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treqQP := req.Raw().URL.Query()\n\treqQP.Set(\"api-version\", \"7.2\")\n\treq.Raw().URL.RawQuery = reqQP.Encode()\n\treq.Raw().Header.Set(\"Accept\", \"application/json\")\n\treturn req, runtime.MarshalAsJSON(req, parameters)\n}", "title": "" }, { "docid": "b229089dcc0f6b024c1d92c44e29ae46", "score": "0.621367", "text": "func (client *KeyVaultClient) updateCertificateOperationCreateRequest(ctx context.Context, vaultBaseURL string, certificateName string, certificateOperation CertificateOperationUpdateParameter, options *KeyVaultClientUpdateCertificateOperationOptions) (*policy.Request, error) {\n\thost := \"{vaultBaseUrl}\"\n\thost = strings.ReplaceAll(host, \"{vaultBaseUrl}\", vaultBaseURL)\n\turlPath := \"/certificates/{certificate-name}/pending\"\n\tif certificateName == \"\" {\n\t\treturn nil, errors.New(\"parameter certificateName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{certificate-name}\", url.PathEscape(certificateName))\n\treq, err := runtime.NewRequest(ctx, http.MethodPatch, runtime.JoinPaths(host, urlPath))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treqQP := req.Raw().URL.Query()\n\treqQP.Set(\"api-version\", \"7.2\")\n\treq.Raw().URL.RawQuery = reqQP.Encode()\n\treq.Raw().Header.Set(\"Accept\", \"application/json\")\n\treturn req, runtime.MarshalAsJSON(req, certificateOperation)\n}", "title": "" }, { "docid": "d17a73bff7771dc42a27647c4bea7e95", "score": "0.62094116", "text": "func (client *MachineExtensionsClient) updateCreateRequest(ctx context.Context, resourceGroupName string, name string, extensionName string, extensionParameters MachineExtensionUpdate, options *MachineExtensionsClientBeginUpdateOptions) (*policy.Request, error) {\n\turlPath := \"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ConnectedVMwarevSphere/virtualMachines/{name}/extensions/{extensionName}\"\n\tif client.subscriptionID == \"\" {\n\t\treturn nil, errors.New(\"parameter client.subscriptionID cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{subscriptionId}\", url.PathEscape(client.subscriptionID))\n\tif resourceGroupName == \"\" {\n\t\treturn nil, errors.New(\"parameter resourceGroupName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{resourceGroupName}\", url.PathEscape(resourceGroupName))\n\tif name == \"\" {\n\t\treturn nil, errors.New(\"parameter name cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{name}\", url.PathEscape(name))\n\tif extensionName == \"\" {\n\t\treturn nil, errors.New(\"parameter extensionName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{extensionName}\", url.PathEscape(extensionName))\n\treq, err := runtime.NewRequest(ctx, http.MethodPatch, runtime.JoinPaths(client.internal.Endpoint(), urlPath))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treqQP := req.Raw().URL.Query()\n\treqQP.Set(\"api-version\", \"2022-01-10-preview\")\n\treq.Raw().URL.RawQuery = reqQP.Encode()\n\treq.Raw().Header[\"Accept\"] = []string{\"application/json\"}\n\treturn req, runtime.MarshalAsJSON(req, extensionParameters)\n}", "title": "" }, { "docid": "25a2ce2d5b522cc8a2f464d973597577", "score": "0.61934847", "text": "func (client *RecordSetsClient) updateCreateRequest(ctx context.Context, resourceGroupName string, privateZoneName string, recordType RecordType, relativeRecordSetName string, parameters RecordSet, options *RecordSetsUpdateOptions) (*azcore.Request, error) {\n\turlPath := \"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/privateDnsZones/{privateZoneName}/{recordType}/{relativeRecordSetName}\"\n\tif resourceGroupName == \"\" {\n\t\treturn nil, errors.New(\"parameter resourceGroupName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{resourceGroupName}\", url.PathEscape(resourceGroupName))\n\tif privateZoneName == \"\" {\n\t\treturn nil, errors.New(\"parameter privateZoneName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{privateZoneName}\", url.PathEscape(privateZoneName))\n\tif recordType == \"\" {\n\t\treturn nil, errors.New(\"parameter recordType cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{recordType}\", url.PathEscape(string(recordType)))\n\tif relativeRecordSetName == \"\" {\n\t\treturn nil, errors.New(\"parameter relativeRecordSetName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{relativeRecordSetName}\", relativeRecordSetName)\n\tif client.subscriptionID == \"\" {\n\t\treturn nil, errors.New(\"parameter client.subscriptionID cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{subscriptionId}\", url.PathEscape(client.subscriptionID))\n\treq, err := azcore.NewRequest(ctx, http.MethodPatch, azcore.JoinPaths(client.con.Endpoint(), urlPath))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treq.Telemetry(telemetryInfo)\n\treqQP := req.URL.Query()\n\treqQP.Set(\"api-version\", \"2020-06-01\")\n\treq.URL.RawQuery = reqQP.Encode()\n\tif options != nil && options.IfMatch != nil {\n\t\treq.Header.Set(\"If-Match\", *options.IfMatch)\n\t}\n\treq.Header.Set(\"Accept\", \"application/json\")\n\treturn req, req.MarshalAsJSON(parameters)\n}", "title": "" }, { "docid": "44bbb93e5b6707884dc1f1eaf16fd7c2", "score": "0.619058", "text": "func (client *APIClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, serviceName string, apiID string, parameters APICreateOrUpdateParameter, options *APIClientBeginCreateOrUpdateOptions) (*policy.Request, error) {\n\turlPath := \"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}\"\n\tif resourceGroupName == \"\" {\n\t\treturn nil, errors.New(\"parameter resourceGroupName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{resourceGroupName}\", url.PathEscape(resourceGroupName))\n\tif serviceName == \"\" {\n\t\treturn nil, errors.New(\"parameter serviceName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{serviceName}\", url.PathEscape(serviceName))\n\tif apiID == \"\" {\n\t\treturn nil, errors.New(\"parameter apiID cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{apiId}\", url.PathEscape(apiID))\n\tif client.subscriptionID == \"\" {\n\t\treturn nil, errors.New(\"parameter client.subscriptionID cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{subscriptionId}\", url.PathEscape(client.subscriptionID))\n\treq, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.internal.Endpoint(), urlPath))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treqQP := req.Raw().URL.Query()\n\treqQP.Set(\"api-version\", \"2022-08-01\")\n\treq.Raw().URL.RawQuery = reqQP.Encode()\n\tif options != nil && options.IfMatch != nil {\n\t\treq.Raw().Header[\"If-Match\"] = []string{*options.IfMatch}\n\t}\n\treq.Raw().Header[\"Accept\"] = []string{\"application/json\"}\n\tif err := runtime.MarshalAsJSON(req, parameters); err != nil {\n\t\treturn nil, err\n\t}\n\treturn req, nil\n}", "title": "" }, { "docid": "5db9442849014f283178085f9453d94c", "score": "0.6186821", "text": "func (client *WebAppsClient) updateConfigurationCreateRequest(ctx context.Context, resourceGroupName string, name string, siteConfig SiteConfigResource, options *WebAppsUpdateConfigurationOptions) (*policy.Request, error) {\n\turlPath := \"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/config/web\"\n\tif resourceGroupName == \"\" {\n\t\treturn nil, errors.New(\"parameter resourceGroupName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{resourceGroupName}\", url.PathEscape(resourceGroupName))\n\tif name == \"\" {\n\t\treturn nil, errors.New(\"parameter name cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{name}\", url.PathEscape(name))\n\tif client.subscriptionID == \"\" {\n\t\treturn nil, errors.New(\"parameter client.subscriptionID cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{subscriptionId}\", url.PathEscape(client.subscriptionID))\n\treq, err := runtime.NewRequest(ctx, http.MethodPatch, runtime.JoinPaths(client.ep, urlPath))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treqQP := req.Raw().URL.Query()\n\treqQP.Set(\"api-version\", \"2021-02-01\")\n\treq.Raw().URL.RawQuery = reqQP.Encode()\n\treq.Raw().Header.Set(\"Accept\", \"application/json\")\n\treturn req, runtime.MarshalAsJSON(req, siteConfig)\n}", "title": "" }, { "docid": "7f7ab397e4d592a9359e14a043335682", "score": "0.6173736", "text": "func (client *ServersClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, serverName string, parameters Server, options *ServersClientBeginCreateOrUpdateOptions) (*policy.Request, error) {\n\turlPath := \"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}\"\n\tif resourceGroupName == \"\" {\n\t\treturn nil, errors.New(\"parameter resourceGroupName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{resourceGroupName}\", url.PathEscape(resourceGroupName))\n\tif serverName == \"\" {\n\t\treturn nil, errors.New(\"parameter serverName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{serverName}\", url.PathEscape(serverName))\n\tif client.subscriptionID == \"\" {\n\t\treturn nil, errors.New(\"parameter client.subscriptionID cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{subscriptionId}\", url.PathEscape(client.subscriptionID))\n\treq, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.internal.Endpoint(), urlPath))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treqQP := req.Raw().URL.Query()\n\treqQP.Set(\"api-version\", \"2022-08-01-preview\")\n\treq.Raw().URL.RawQuery = reqQP.Encode()\n\treq.Raw().Header[\"Accept\"] = []string{\"application/json\"}\n\tif err := runtime.MarshalAsJSON(req, parameters); err != nil {\n\t\treturn nil, err\n\t}\n\treturn req, nil\n}", "title": "" }, { "docid": "9edcef29771e27d7ab33bfa338cf1f59", "score": "0.6171971", "text": "func (_BaseLibrary *BaseLibraryTransactor) UpdateRequest(opts *bind.TransactOpts) (*types.Transaction, error) {\n\treturn _BaseLibrary.contract.Transact(opts, \"updateRequest\")\n}", "title": "" }, { "docid": "8a7291030565483a48ef63bf433e2239", "score": "0.6147021", "text": "func (client *ApplyUpdatesClient) getCreateRequest(ctx context.Context, resourceGroupName string, providerName string, resourceType string, resourceName string, applyUpdateName string, options *ApplyUpdatesClientGetOptions) (*policy.Request, error) {\n\turlPath := \"/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/{providerName}/{resourceType}/{resourceName}/providers/Microsoft.Maintenance/applyUpdates/{applyUpdateName}\"\n\tif client.subscriptionID == \"\" {\n\t\treturn nil, errors.New(\"parameter client.subscriptionID cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{subscriptionId}\", url.PathEscape(client.subscriptionID))\n\tif resourceGroupName == \"\" {\n\t\treturn nil, errors.New(\"parameter resourceGroupName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{resourceGroupName}\", url.PathEscape(resourceGroupName))\n\tif providerName == \"\" {\n\t\treturn nil, errors.New(\"parameter providerName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{providerName}\", url.PathEscape(providerName))\n\tif resourceType == \"\" {\n\t\treturn nil, errors.New(\"parameter resourceType cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{resourceType}\", url.PathEscape(resourceType))\n\tif resourceName == \"\" {\n\t\treturn nil, errors.New(\"parameter resourceName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{resourceName}\", url.PathEscape(resourceName))\n\tif applyUpdateName == \"\" {\n\t\treturn nil, errors.New(\"parameter applyUpdateName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{applyUpdateName}\", url.PathEscape(applyUpdateName))\n\treq, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treqQP := req.Raw().URL.Query()\n\treqQP.Set(\"api-version\", \"2023-04-01\")\n\treq.Raw().URL.RawQuery = reqQP.Encode()\n\treq.Raw().Header[\"Accept\"] = []string{\"application/json\"}\n\treturn req, nil\n}", "title": "" }, { "docid": "52a0757ec78cc33f58b879162f7c980c", "score": "0.6146561", "text": "func (client *CustomDomainsClient) updateCreateRequest(ctx context.Context, resourceGroupName string, serviceName string, appName string, domainName string, domainResource CustomDomainResource, options *CustomDomainsBeginUpdateOptions) (*policy.Request, error) {\n\turlPath := \"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains/{domainName}\"\n\tif client.subscriptionID == \"\" {\n\t\treturn nil, errors.New(\"parameter client.subscriptionID cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{subscriptionId}\", url.PathEscape(client.subscriptionID))\n\tif resourceGroupName == \"\" {\n\t\treturn nil, errors.New(\"parameter resourceGroupName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{resourceGroupName}\", url.PathEscape(resourceGroupName))\n\tif serviceName == \"\" {\n\t\treturn nil, errors.New(\"parameter serviceName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{serviceName}\", url.PathEscape(serviceName))\n\tif appName == \"\" {\n\t\treturn nil, errors.New(\"parameter appName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{appName}\", url.PathEscape(appName))\n\tif domainName == \"\" {\n\t\treturn nil, errors.New(\"parameter domainName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{domainName}\", url.PathEscape(domainName))\n\treq, err := runtime.NewRequest(ctx, http.MethodPatch, runtime.JoinPaths(client.ep, urlPath))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treqQP := req.Raw().URL.Query()\n\treqQP.Set(\"api-version\", \"2021-09-01-preview\")\n\treq.Raw().URL.RawQuery = reqQP.Encode()\n\treq.Raw().Header.Set(\"Accept\", \"application/json\")\n\treturn req, runtime.MarshalAsJSON(req, domainResource)\n}", "title": "" }, { "docid": "369c3e12ba1fecbe4e3290449f287d12", "score": "0.6143318", "text": "func (client *VirtualMachineScaleSetVMRunCommandsClient) updateCreateRequest(ctx context.Context, resourceGroupName string, vmScaleSetName string, instanceID string, runCommandName string, runCommand VirtualMachineRunCommandUpdate, options *VirtualMachineScaleSetVMRunCommandsBeginUpdateOptions) (*policy.Request, error) {\n\turlPath := \"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualMachines/{instanceId}/runCommands/{runCommandName}\"\n\tif resourceGroupName == \"\" {\n\t\treturn nil, errors.New(\"parameter resourceGroupName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{resourceGroupName}\", url.PathEscape(resourceGroupName))\n\tif vmScaleSetName == \"\" {\n\t\treturn nil, errors.New(\"parameter vmScaleSetName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{vmScaleSetName}\", url.PathEscape(vmScaleSetName))\n\tif instanceID == \"\" {\n\t\treturn nil, errors.New(\"parameter instanceID cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{instanceId}\", url.PathEscape(instanceID))\n\tif runCommandName == \"\" {\n\t\treturn nil, errors.New(\"parameter runCommandName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{runCommandName}\", url.PathEscape(runCommandName))\n\tif client.subscriptionID == \"\" {\n\t\treturn nil, errors.New(\"parameter client.subscriptionID cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{subscriptionId}\", url.PathEscape(client.subscriptionID))\n\treq, err := runtime.NewRequest(ctx, http.MethodPatch, runtime.JoinPaths(client.ep, urlPath))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treqQP := req.Raw().URL.Query()\n\treqQP.Set(\"api-version\", \"2021-07-01\")\n\treq.Raw().URL.RawQuery = reqQP.Encode()\n\treq.Raw().Header.Set(\"Accept\", \"application/json, text/json\")\n\treturn req, runtime.MarshalAsJSON(req, runCommand)\n}", "title": "" }, { "docid": "569c8efbd69a4923b8842b7adc83ac59", "score": "0.61421466", "text": "func CreateUpdateEndpointGroupRequest() (request *UpdateEndpointGroupRequest) {\n\trequest = &UpdateEndpointGroupRequest{\n\t\tRpcRequest: &requests.RpcRequest{},\n\t}\n\trequest.InitWithApiInfo(\"Ga\", \"2019-11-20\", \"UpdateEndpointGroup\", \"gaplus\", \"openAPI\")\n\trequest.Method = requests.POST\n\treturn\n}", "title": "" }, { "docid": "6a6a51edd6824ccaae5ac5c1a06486af", "score": "0.6141336", "text": "func (client *GroupClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, serviceName string, groupID string, parameters GroupCreateParameters, options *GroupCreateOrUpdateOptions) (*policy.Request, error) {\n\turlPath := \"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/groups/{groupId}\"\n\tif resourceGroupName == \"\" {\n\t\treturn nil, errors.New(\"parameter resourceGroupName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{resourceGroupName}\", url.PathEscape(resourceGroupName))\n\tif serviceName == \"\" {\n\t\treturn nil, errors.New(\"parameter serviceName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{serviceName}\", url.PathEscape(serviceName))\n\tif groupID == \"\" {\n\t\treturn nil, errors.New(\"parameter groupID cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{groupId}\", url.PathEscape(groupID))\n\tif client.subscriptionID == \"\" {\n\t\treturn nil, errors.New(\"parameter client.subscriptionID cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{subscriptionId}\", url.PathEscape(client.subscriptionID))\n\treq, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.ep, urlPath))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treqQP := req.Raw().URL.Query()\n\treqQP.Set(\"api-version\", \"2021-08-01\")\n\treq.Raw().URL.RawQuery = reqQP.Encode()\n\tif options != nil && options.IfMatch != nil {\n\t\treq.Raw().Header.Set(\"If-Match\", *options.IfMatch)\n\t}\n\treq.Raw().Header.Set(\"Accept\", \"application/json\")\n\treturn req, runtime.MarshalAsJSON(req, parameters)\n}", "title": "" }, { "docid": "6d2f0d77cddb98ef7701a71ce5ce6e08", "score": "0.61341715", "text": "func (client *CloudServicesClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, cloudServiceName string, parameters CloudService, options *CloudServicesClientBeginCreateOrUpdateOptions) (*policy.Request, error) {\n\turlPath := \"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}\"\n\tif resourceGroupName == \"\" {\n\t\treturn nil, errors.New(\"parameter resourceGroupName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{resourceGroupName}\", url.PathEscape(resourceGroupName))\n\tif cloudServiceName == \"\" {\n\t\treturn nil, errors.New(\"parameter cloudServiceName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{cloudServiceName}\", url.PathEscape(cloudServiceName))\n\tif client.subscriptionID == \"\" {\n\t\treturn nil, errors.New(\"parameter client.subscriptionID cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{subscriptionId}\", url.PathEscape(client.subscriptionID))\n\treq, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.host, urlPath))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treqQP := req.Raw().URL.Query()\n\treqQP.Set(\"api-version\", \"2022-09-04\")\n\treq.Raw().URL.RawQuery = reqQP.Encode()\n\treq.Raw().Header[\"Accept\"] = []string{\"application/json\"}\n\treturn req, runtime.MarshalAsJSON(req, parameters)\n}", "title": "" }, { "docid": "4c2c56e5783b97feaf71261b7e1f6a9b", "score": "0.61207235", "text": "func (client *FactoriesClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, factoryName string, factory Factory, options *FactoriesClientCreateOrUpdateOptions) (*policy.Request, error) {\n\turlPath := \"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataFactory/factories/{factoryName}\"\n\tif client.subscriptionID == \"\" {\n\t\treturn nil, errors.New(\"parameter client.subscriptionID cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{subscriptionId}\", url.PathEscape(client.subscriptionID))\n\tif resourceGroupName == \"\" {\n\t\treturn nil, errors.New(\"parameter resourceGroupName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{resourceGroupName}\", url.PathEscape(resourceGroupName))\n\tif factoryName == \"\" {\n\t\treturn nil, errors.New(\"parameter factoryName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{factoryName}\", url.PathEscape(factoryName))\n\treq, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.internal.Endpoint(), urlPath))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treqQP := req.Raw().URL.Query()\n\treqQP.Set(\"api-version\", \"2018-06-01\")\n\treq.Raw().URL.RawQuery = reqQP.Encode()\n\tif options != nil && options.IfMatch != nil {\n\t\treq.Raw().Header[\"If-Match\"] = []string{*options.IfMatch}\n\t}\n\treq.Raw().Header[\"Accept\"] = []string{\"application/json\"}\n\treturn req, runtime.MarshalAsJSON(req, factory)\n}", "title": "" }, { "docid": "1c5be02bae57242a40d946332edfe2fa", "score": "0.61187", "text": "func (client *IPAllocationsClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, ipAllocationName string, parameters IPAllocation, options *IPAllocationsClientBeginCreateOrUpdateOptions) (*policy.Request, error) {\n\turlPath := \"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/IpAllocations/{ipAllocationName}\"\n\tif resourceGroupName == \"\" {\n\t\treturn nil, errors.New(\"parameter resourceGroupName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{resourceGroupName}\", url.PathEscape(resourceGroupName))\n\tif ipAllocationName == \"\" {\n\t\treturn nil, errors.New(\"parameter ipAllocationName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{ipAllocationName}\", url.PathEscape(ipAllocationName))\n\tif client.subscriptionID == \"\" {\n\t\treturn nil, errors.New(\"parameter client.subscriptionID cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{subscriptionId}\", url.PathEscape(client.subscriptionID))\n\treq, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.internal.Endpoint(), urlPath))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treqQP := req.Raw().URL.Query()\n\treqQP.Set(\"api-version\", \"2023-04-01\")\n\treq.Raw().URL.RawQuery = reqQP.Encode()\n\treq.Raw().Header[\"Accept\"] = []string{\"application/json\"}\n\tif err := runtime.MarshalAsJSON(req, parameters); err != nil {\n\t\treturn nil, err\n\t}\n\treturn req, nil\n}", "title": "" }, { "docid": "f7ec0b81f7d642a9bc9484de8b954530", "score": "0.61027807", "text": "func (client *CertificateOrdersClient) updateCertificateCreateRequest(ctx context.Context, resourceGroupName string, certificateOrderName string, name string, keyVaultCertificate CertificatePatchResource, options *CertificateOrdersClientUpdateCertificateOptions) (*policy.Request, error) {\n\turlPath := \"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CertificateRegistration/certificateOrders/{certificateOrderName}/certificates/{name}\"\n\tif resourceGroupName == \"\" {\n\t\treturn nil, errors.New(\"parameter resourceGroupName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{resourceGroupName}\", url.PathEscape(resourceGroupName))\n\tif certificateOrderName == \"\" {\n\t\treturn nil, errors.New(\"parameter certificateOrderName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{certificateOrderName}\", url.PathEscape(certificateOrderName))\n\tif name == \"\" {\n\t\treturn nil, errors.New(\"parameter name cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{name}\", url.PathEscape(name))\n\tif client.subscriptionID == \"\" {\n\t\treturn nil, errors.New(\"parameter client.subscriptionID cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{subscriptionId}\", url.PathEscape(client.subscriptionID))\n\treq, err := runtime.NewRequest(ctx, http.MethodPatch, runtime.JoinPaths(client.internal.Endpoint(), urlPath))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treqQP := req.Raw().URL.Query()\n\treqQP.Set(\"api-version\", \"2022-09-01\")\n\treq.Raw().URL.RawQuery = reqQP.Encode()\n\treq.Raw().Header[\"Accept\"] = []string{\"application/json\"}\n\treturn req, runtime.MarshalAsJSON(req, keyVaultCertificate)\n}", "title": "" }, { "docid": "4762b58d58171ffafd3e612b2b4a78f2", "score": "0.6076945", "text": "func (client *SubscriptionClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, serviceName string, sid string, parameters SubscriptionCreateParameters, options *SubscriptionClientCreateOrUpdateOptions) (*policy.Request, error) {\n\turlPath := \"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/subscriptions/{sid}\"\n\tif resourceGroupName == \"\" {\n\t\treturn nil, errors.New(\"parameter resourceGroupName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{resourceGroupName}\", url.PathEscape(resourceGroupName))\n\tif serviceName == \"\" {\n\t\treturn nil, errors.New(\"parameter serviceName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{serviceName}\", url.PathEscape(serviceName))\n\tif sid == \"\" {\n\t\treturn nil, errors.New(\"parameter sid cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{sid}\", url.PathEscape(sid))\n\tif client.subscriptionID == \"\" {\n\t\treturn nil, errors.New(\"parameter client.subscriptionID cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{subscriptionId}\", url.PathEscape(client.subscriptionID))\n\treq, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.internal.Endpoint(), urlPath))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treqQP := req.Raw().URL.Query()\n\tif options != nil && options.Notify != nil {\n\t\treqQP.Set(\"notify\", strconv.FormatBool(*options.Notify))\n\t}\n\treqQP.Set(\"api-version\", \"2022-08-01\")\n\tif options != nil && options.AppType != nil {\n\t\treqQP.Set(\"appType\", string(*options.AppType))\n\t}\n\treq.Raw().URL.RawQuery = reqQP.Encode()\n\tif options != nil && options.IfMatch != nil {\n\t\treq.Raw().Header[\"If-Match\"] = []string{*options.IfMatch}\n\t}\n\treq.Raw().Header[\"Accept\"] = []string{\"application/json\"}\n\tif err := runtime.MarshalAsJSON(req, parameters); err != nil {\n\t\treturn nil, err\n\t}\n\treturn req, nil\n}", "title": "" }, { "docid": "897b7f8d6e6b22c45d7f7e3b4eece499", "score": "0.607276", "text": "func (client *MonitoringSettingsClient) updatePatchCreateRequest(ctx context.Context, resourceGroupName string, serviceName string, monitoringSettingResource MonitoringSettingResource, options *MonitoringSettingsClientBeginUpdatePatchOptions) (*policy.Request, error) {\n\turlPath := \"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/monitoringSettings/default\"\n\tif client.subscriptionID == \"\" {\n\t\treturn nil, errors.New(\"parameter client.subscriptionID cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{subscriptionId}\", url.PathEscape(client.subscriptionID))\n\tif resourceGroupName == \"\" {\n\t\treturn nil, errors.New(\"parameter resourceGroupName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{resourceGroupName}\", url.PathEscape(resourceGroupName))\n\tif serviceName == \"\" {\n\t\treturn nil, errors.New(\"parameter serviceName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{serviceName}\", url.PathEscape(serviceName))\n\treq, err := runtime.NewRequest(ctx, http.MethodPatch, runtime.JoinPaths(client.internal.Endpoint(), urlPath))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treqQP := req.Raw().URL.Query()\n\treqQP.Set(\"api-version\", \"2023-01-01-preview\")\n\treq.Raw().URL.RawQuery = reqQP.Encode()\n\treq.Raw().Header[\"Accept\"] = []string{\"application/json\"}\n\treturn req, runtime.MarshalAsJSON(req, monitoringSettingResource)\n}", "title": "" }, { "docid": "be45044bf383bf11fde8606496d711e2", "score": "0.6046501", "text": "func (client *WebAppsClient) updateMetadataCreateRequest(ctx context.Context, resourceGroupName string, name string, metadata StringDictionary, options *WebAppsUpdateMetadataOptions) (*policy.Request, error) {\n\turlPath := \"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/config/metadata\"\n\tif resourceGroupName == \"\" {\n\t\treturn nil, errors.New(\"parameter resourceGroupName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{resourceGroupName}\", url.PathEscape(resourceGroupName))\n\tif name == \"\" {\n\t\treturn nil, errors.New(\"parameter name cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{name}\", url.PathEscape(name))\n\tif client.subscriptionID == \"\" {\n\t\treturn nil, errors.New(\"parameter client.subscriptionID cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{subscriptionId}\", url.PathEscape(client.subscriptionID))\n\treq, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.ep, urlPath))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treqQP := req.Raw().URL.Query()\n\treqQP.Set(\"api-version\", \"2021-02-01\")\n\treq.Raw().URL.RawQuery = reqQP.Encode()\n\treq.Raw().Header.Set(\"Accept\", \"application/json\")\n\treturn req, runtime.MarshalAsJSON(req, metadata)\n}", "title": "" }, { "docid": "78162aaf6c5af1ae5260616efc5de982", "score": "0.6033221", "text": "func (_BaseAccessControlGroup *BaseAccessControlGroupTransactor) UpdateRequest(opts *bind.TransactOpts) (*types.Transaction, error) {\n\treturn _BaseAccessControlGroup.contract.Transact(opts, \"updateRequest\")\n}", "title": "" }, { "docid": "eab1e3887099d9340aeb9a382c0916ec", "score": "0.60303956", "text": "func (client *PolicyDefinitionsClient) createOrUpdateCreateRequest(ctx context.Context, policyDefinitionName string, parameters PolicyDefinition, options *PolicyDefinitionsCreateOrUpdateOptions) (*policy.Request, error) {\n\turlPath := \"/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/policyDefinitions/{policyDefinitionName}\"\n\tif policyDefinitionName == \"\" {\n\t\treturn nil, errors.New(\"parameter policyDefinitionName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{policyDefinitionName}\", url.PathEscape(policyDefinitionName))\n\tif client.subscriptionID == \"\" {\n\t\treturn nil, errors.New(\"parameter client.subscriptionID cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{subscriptionId}\", url.PathEscape(client.subscriptionID))\n\treq, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.ep, urlPath))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treqQP := req.Raw().URL.Query()\n\treqQP.Set(\"api-version\", \"2021-06-01\")\n\treq.Raw().URL.RawQuery = reqQP.Encode()\n\treq.Raw().Header.Set(\"Accept\", \"application/json\")\n\treturn req, runtime.MarshalAsJSON(req, parameters)\n}", "title": "" }, { "docid": "06b47cf9681a01439f8421b14a2e69e3", "score": "0.6027707", "text": "func (client *IPAllocationsClient) updateTagsCreateRequest(ctx context.Context, resourceGroupName string, ipAllocationName string, parameters TagsObject, options *IPAllocationsClientUpdateTagsOptions) (*policy.Request, error) {\n\turlPath := \"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/IpAllocations/{ipAllocationName}\"\n\tif resourceGroupName == \"\" {\n\t\treturn nil, errors.New(\"parameter resourceGroupName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{resourceGroupName}\", url.PathEscape(resourceGroupName))\n\tif ipAllocationName == \"\" {\n\t\treturn nil, errors.New(\"parameter ipAllocationName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{ipAllocationName}\", url.PathEscape(ipAllocationName))\n\tif client.subscriptionID == \"\" {\n\t\treturn nil, errors.New(\"parameter client.subscriptionID cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{subscriptionId}\", url.PathEscape(client.subscriptionID))\n\treq, err := runtime.NewRequest(ctx, http.MethodPatch, runtime.JoinPaths(client.internal.Endpoint(), urlPath))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treqQP := req.Raw().URL.Query()\n\treqQP.Set(\"api-version\", \"2023-04-01\")\n\treq.Raw().URL.RawQuery = reqQP.Encode()\n\treq.Raw().Header[\"Accept\"] = []string{\"application/json\"}\n\tif err := runtime.MarshalAsJSON(req, parameters); err != nil {\n\t\treturn nil, err\n\t}\n\treturn req, nil\n}", "title": "" }, { "docid": "6a4b215b6e54fb688647428af140e9e4", "score": "0.6023914", "text": "func (client *ApplyUpdatesClient) createOrUpdateParentCreateRequest(ctx context.Context, resourceGroupName string, providerName string, resourceParentType string, resourceParentName string, resourceType string, resourceName string, options *ApplyUpdatesClientCreateOrUpdateParentOptions) (*policy.Request, error) {\n\turlPath := \"/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/{providerName}/{resourceParentType}/{resourceParentName}/{resourceType}/{resourceName}/providers/Microsoft.Maintenance/applyUpdates/default\"\n\tif client.subscriptionID == \"\" {\n\t\treturn nil, errors.New(\"parameter client.subscriptionID cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{subscriptionId}\", url.PathEscape(client.subscriptionID))\n\tif resourceGroupName == \"\" {\n\t\treturn nil, errors.New(\"parameter resourceGroupName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{resourceGroupName}\", url.PathEscape(resourceGroupName))\n\tif providerName == \"\" {\n\t\treturn nil, errors.New(\"parameter providerName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{providerName}\", url.PathEscape(providerName))\n\tif resourceParentType == \"\" {\n\t\treturn nil, errors.New(\"parameter resourceParentType cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{resourceParentType}\", url.PathEscape(resourceParentType))\n\tif resourceParentName == \"\" {\n\t\treturn nil, errors.New(\"parameter resourceParentName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{resourceParentName}\", url.PathEscape(resourceParentName))\n\tif resourceType == \"\" {\n\t\treturn nil, errors.New(\"parameter resourceType cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{resourceType}\", url.PathEscape(resourceType))\n\tif resourceName == \"\" {\n\t\treturn nil, errors.New(\"parameter resourceName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{resourceName}\", url.PathEscape(resourceName))\n\treq, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.internal.Endpoint(), urlPath))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treqQP := req.Raw().URL.Query()\n\treqQP.Set(\"api-version\", \"2023-04-01\")\n\treq.Raw().URL.RawQuery = reqQP.Encode()\n\treq.Raw().Header[\"Accept\"] = []string{\"application/json\"}\n\treturn req, nil\n}", "title": "" } ]
7d3e30d8775b974c30fdf9214471fa93
serve is the core function of this command.
[ { "docid": "e69ad1cedb2a4697b1067aadbe4b0e23", "score": "0.6778896", "text": "func serve() {\n\tinitLogger()\n\n\tlog.Infof(\"%s version %s - %s\", svc.Name, svc.Version, svcName)\n\tlog.WithFields(log.Fields{\n\t\t\"address\": serverAddress,\n\t\t\"shutdownTimeout\": shutdownTimeout,\n\t\t\"corsAllowedOrigins\": corsAllowedOrigins,\n\t\t\"databaseConnect\": databaseConnect,\n\t}).Debug(\"Flags\")\n\n\tinitStore()\n\n\t// Got service router and launch a graceful shutdown server\n\tsrv := getServer()\n\tgo launchServer(srv)\n\twaitForShutdown(srv)\n}", "title": "" } ]
[ { "docid": "15992c715f189023245f09876f0893e7", "score": "0.69599473", "text": "func main() {\n\tserveCommand := cli.Command{\n\t\tName: \"serve\",\n\t\tShortName: \"s\",\n\t\tUsage: \"Serve the API\",\n\t\tFlags: []cli.Flag{common.FlAddr, common.Fllistaddr},\n\t\tAction: action(serveAction),\n\t}\n\n\tfmt.Println(common.FlAddr.Value)\n\tlog.SetPrefix(\"==>\")\n\tlog.Printf(\"listen: %v\", common.FlAddr.Value)\n\tcommon.Run(\"dcos-autoscale\", serveCommand)\n}", "title": "" }, { "docid": "fddd2b93601ee09a269a5a5e88872958", "score": "0.6950378", "text": "func main() {\n\trootCmd.AddCommand(\n\t\t(&serveCmd{}).new(),\n\t)\n\n\tif err := rootCmd.Execute(); err != nil {\n\t\tlog.Fatalf(\"%v\", err)\n\t}\n}", "title": "" }, { "docid": "d83ad396d3221885c0fedee9c1a19859", "score": "0.67924464", "text": "func Serve() {\n\n}", "title": "" }, { "docid": "a8e056816ccf53bf07d1618c891ae3ec", "score": "0.6791079", "text": "func main() {\n\tserver.Serve()\n}", "title": "" }, { "docid": "185ddb7ddc780be70d8b4db4e32eb468", "score": "0.6766913", "text": "func (m middleware) serve(w http.ResponseWriter, r *http.Request) {\n\tm.fn(w, r, m.next.serve)\n}", "title": "" }, { "docid": "77b41fcd8141c0d0de4d681b6fece3b6", "score": "0.6725481", "text": "func serve(appConfig *config.AppConfig, configs ...service.Config) {\n\to := appConfig.ServerConfig\n\n\tfor _, opt := range configs {\n\t\topt(&o)\n\t}\n\n\trunner := service.NewService(configs...)\n\t//echoHandler := &echo.EndpointEchoHandler{Server: runner}\n\t//echoHandler.RegisterEchoHandlers(handlers.New())\n\n\t// Start the service\n\tif err := runner.Run(context.Background()); err != nil {\n\t\tlog.Printf(\"Unable to start service %s due to %#v\", \"Echo\", err)\n\t}\n}", "title": "" }, { "docid": "29c2f940340da02df4ba31105972e627", "score": "0.6652357", "text": "func serve() {\n\t//serve up image on localhost:8080/image\n\tfmt.Println(\"Please visit localhost:8080/image\")\n\thttp.HandleFunc(\"/image\", respHandler)\n\tif err := http.ListenAndServe(\":8080\", nil); err != nil {\n\t\tlog.Fatalf(\"ListenAndServe: %v\", err)\n\t}\n}", "title": "" }, { "docid": "3e8f041c9a5a3847f9c87d5ac86c005c", "score": "0.6589404", "text": "func (x *handlerExecer) serve(w http.ResponseWriter, r *http.Request, c context.Context) error {\n\th := x.init.Init(r)\n\tif err := h.AuthCheck(r, c); err != nil {\n\t\treturn err\n\t}\n\tif err := h.ReadRequest(r, c); err != nil {\n\t\treturn err\n\t}\n\tif err := h.InitResponse(w); err != nil {\n\t\treturn err\n\t}\n\n\tif err := ExecuteAction(h); err != nil {\n\t\treturn err\n\t}\n\n\treturn h.WriteResponse(w, r)\n}", "title": "" }, { "docid": "860762a6d1705303a338a8207a97b15b", "score": "0.6518677", "text": "func (p *Program) Serve(executor io.Writer, hostAndPort string) {\n\thttp.HandleFunc(\"/\", p.showControlPage)\n\thttp.HandleFunc(\"/favicon.ico\", p.favicon)\n\thttp.HandleFunc(\"/image\", p.image)\n\thttp.HandleFunc(\"/runblock\", p.makeBlockRunner(executor))\n\thttp.HandleFunc(\"/q\", p.quit)\n\tfmt.Println(\"Serving at http://\" + hostAndPort)\n\tfmt.Println()\n\tglog.Info(\"Serving at \" + hostAndPort)\n\tglog.Fatal(http.ListenAndServe(hostAndPort, nil))\n}", "title": "" }, { "docid": "02fd92c32363cc21bd8f2a3cf4a154fd", "score": "0.649675", "text": "func main() {\n\tserver.Run()\n}", "title": "" }, { "docid": "02fd92c32363cc21bd8f2a3cf4a154fd", "score": "0.649675", "text": "func main() {\n\tserver.Run()\n}", "title": "" }, { "docid": "5c1db95457fd6c9a3ff35f0ab98b1ca3", "score": "0.64737123", "text": "func serve(c *cli.Context) (err error) {\n\tif c.Bool(\"profile\") {\n\t\tgo func() {\n\t\t\tfmt.Println(\"==== PROFILING ENABLED ==========\")\n\t\t\truntime.SetBlockProfileRate(5000)\n\t\t\terr := http.ListenAndServe(\"0.0.0.0:6060\", nil)\n\t\t\tpanic(err)\n\t\t}()\n\t}\n\n\tif name := c.String(\"name\"); name != \"\" {\n\t\tconfig.Name = name\n\t}\n\n\tif seed := c.Int64(\"seed\"); seed > 0 {\n\t\tconfig.Seed = seed\n\t}\n\n\tif replica, err = raft.New(config); err != nil {\n\t\treturn cli.Exit(err.Error(), 1)\n\t}\n\n\t// TODO: uptime is only for benchmarking, remove when stable\n\tif uptime := c.Duration(\"uptime\"); uptime > 0 {\n\t\ttime.AfterFunc(uptime, func() {\n\t\t\tif path := c.String(\"outpath\"); path != \"\" {\n\t\t\t\textra := make(map[string]interface{})\n\t\t\t\textra[\"replica\"] = replica.Name\n\t\t\t\textra[\"version\"] = raft.Version()\n\n\t\t\t\tquorum := make([]string, 0, len(config.Peers))\n\t\t\t\tfor _, peer := range config.Peers {\n\t\t\t\t\tquorum = append(quorum, peer.Name)\n\t\t\t\t}\n\t\t\t\textra[\"quorum\"] = quorum\n\n\t\t\t\tif err = replica.Metrics.Dump(path, extra); err != nil {\n\t\t\t\t\tfmt.Println(err.Error())\n\t\t\t\t\tos.Exit(1)\n\t\t\t\t}\n\t\t\t}\n\t\t\tos.Exit(0)\n\t\t})\n\t}\n\n\tif err = replica.Listen(); err != nil {\n\t\treturn cli.Exit(err.Error(), 1)\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "e0e75f0efea0745e79330102fe4d1d3e", "score": "0.6458927", "text": "func main() {\n\tfs := http.FileServer(http.Dir(\"public\"))\n\n\thttp.Handle(\"/\", fs)\n\n\tfmt.Println(\"server starting up...\")\n\terr := http.ListenAndServe(\":8000\", nil)\n\tif err != nil {\n\t\tlog.Fatal(\"error happened while starting server\")\n\t}\n\tfmt.Println(\"server started on localhost:8000\")\n}", "title": "" }, { "docid": "0339f4c16e6d937945f169f3a580b150", "score": "0.6455469", "text": "func (s *server) serve() error {\n\tfs.Logf(s.f, \"Serving FTP on %s\", s.srv.Hostname+\":\"+strconv.Itoa(s.srv.Port))\n\treturn s.srv.ListenAndServe()\n}", "title": "" }, { "docid": "7734aad1edbea93c539c90712c253194", "score": "0.6449303", "text": "func (d *SDHT) serve() error {\n\treturn network.Listen(iface.Address{\n\t\tIP: \"0.0.0.0\",\n\t\tPort: d.addr.Port,\n\t}, d.Respond, d.shutdown)\n}", "title": "" }, { "docid": "e347f474279573685699b903a3ab5163", "score": "0.64437294", "text": "func init() {\n rootCmd.AddCommand(serveCmd)\n}", "title": "" }, { "docid": "c6351e6bd2d89269a355a069065373e6", "score": "0.6438068", "text": "func (s *Server) ServeCMD() {\n ctx := Context{server: s}\n\n // only apply the last plugin for command\n ctx.process(s.plugins[len(s.plugins)-1:])\n}", "title": "" }, { "docid": "1f1cf5452701bbff78a602749b9f9840", "score": "0.6431779", "text": "func runServe(cmd *cobra.Command, cmdArgs []string) error {\n\tlogrus.WithFields(logrus.Fields{\n\t\t\"selectors\": runSettings.SelectorsNames(),\n\t}).Debug(\"configured metrics\")\n\n\tlogrus.WithFields(logrus.Fields{\n\t\t\"address\": runSettings.ServiceAddress,\n\t\t\"port\": runSettings.ServicePort,\n\t}).Info(\"starting service\")\n\n\tif runSettings == nil {\n\t\treturn errors.New(\"nil runSettings\")\n\t}\n\n\texporter := server.LocalExporter{*runSettings}\n\n\thttp.Handle(server.BridgeEndpoint, exporter.BridgeHandler())\n\thttp.Handle(server.MetricsEndpoint, exporter.MetricsHandler())\n\n\tlistenAddr := fmt.Sprintf(\"%s:%d\", runSettings.ServiceAddress, runSettings.ServicePort)\n\tif err := http.ListenAndServe(listenAddr, nil); err != nil {\n\t\treturn err\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "7cea7d337800c30fb051078d9454206f", "score": "0.6423117", "text": "func serve(w http.ResponseWriter, r *http.Request) {\n\tresp := mkResponse(w, r)\n\tServe(resp)\n\tif resp.Err != nil {\n\t\tError(resp)\n\t\tif Development {\n\t\t\tlogit.Logf(logit.DEBUG, \"[Error(%d)] %s\", resp.Status, resp.Err.Error())\n\t\t}\n\t}\n\treturn\n}", "title": "" }, { "docid": "e8689c1fea5fec52a926a6cd839a1bd8", "score": "0.6404132", "text": "func (s *Server) Serve() {\n // flush log when app end\n defer App.GetLog().Flush()\n // exec stopBefore when app end\n defer App.GetStopBefore().Exec()\n\n // initialize plugins\n s.initPlugins()\n\n // process command request\n if App.GetMode() == ModeCmd {\n s.ServeCMD()\n return\n }\n\n // process http request\n if s.httpAddr == \"\" && s.httpsAddr == \"\" {\n s.httpAddr = DefaultHttpAddr\n }\n\n wg := sync.WaitGroup{}\n s.handleHttp(&wg)\n s.handleHttps(&wg)\n s.handleDebug(&wg)\n s.handleSignal(&wg)\n s.handleStats(&wg)\n wg.Wait()\n}", "title": "" }, { "docid": "40317662ac33c72a802b5932ff569f7c", "score": "0.6394556", "text": "func serve(handler fasthttp.RequestHandler, req *fasthttp.Request, res *fasthttp.Response) error {\n\tln := fasthttputil.NewInmemoryListener()\n\tdefer ln.Close()\n\n\tgo func() {\n\t\terr := fasthttp.Serve(ln, handler)\n\t\tif err != nil {\n\t\t\tpanic(fmt.Errorf(\"failed to serve: %v\", err))\n\t\t}\n\t}()\n\n\tclient := fasthttp.Client{\n\t\tDial: func(addr string) (net.Conn, error) {\n\t\t\treturn ln.Dial()\n\t\t},\n\t}\n\n\treturn client.Do(req, res)\n}", "title": "" }, { "docid": "a31d505b1ae807f415bb1cd013abacf9", "score": "0.6392897", "text": "func serve(router *gin.Engine, port int) {\n\tlog.Println(\"Serving on Port\", port)\n\tif err := http.ListenAndServe(\":\"+strconv.Itoa(port), router); err != nil {\n\t\tif errors.Is(http.ErrServerClosed, err) {\n\t\t\treturn\n\t\t}\n\t\tlog.Panicln(fmt.Errorf(\"unable to listen: %s\", err))\n\t}\n}", "title": "" }, { "docid": "dd1dea20112ece7e45124bafd7b4c1a3", "score": "0.6309437", "text": "func (api *Context) serve() {\n\tdefer api.complete()\n\tvar status int\n\tapi.result, status = api.f(api)\n\tif status > 0 {\n\t\tapi.status = status\n\t}\n}", "title": "" }, { "docid": "931b2a5925771087dce0e2a93a0806ed", "score": "0.62845236", "text": "func (s *Server)serve(addr string){\n\tlis, err := net.Listen(\"tcp\", addr)\n\tif err != nil {\n\t\tlog.Fatalf(\"failed to listen: %v\", err)\n\t}\n go func(){\n\t var opts []grpc.ServerOption\n grpcServer := grpc.NewServer(opts...)\n\t pb.RegisterCommpbServer(grpcServer, s)\n if err := grpcServer.Serve(lis); err != nil{\n log.Fatalf(\"fail to start grpc server:%v\",err)\n }\n }()\n}", "title": "" }, { "docid": "3107be9073323259d507ed8ae4a2a9c1", "score": "0.6274065", "text": "func serve(host string, srv *server) {\n\thttp.HandleFunc(\"/stats\", func(w http.ResponseWriter, r *http.Request) {\n\t\taccess := auth(w, r)\n\t\tif access == AccessNone {\n\t\t\treturn\n\t\t}\n\t\tw.Header().Set(\"Content-Type\", \"application/json\")\n\t\tenc := json.NewEncoder(w)\n\t\tsrv.datalock.RLock()\n\t\tenc.Encode(srv.eventData)\n\t\tsrv.datalock.RUnlock()\n\t})\n\t// Little weather proxy/cache for the frontends\n\thttp.HandleFunc(\"/weather\", weather())\n\thttp.HandleFunc(\"/stream\", srv.clientStreamHandler)\n\thttp.HandleFunc(\"/\", func(w http.ResponseWriter, r *http.Request) {\n\t\tif auth(w, r) == AccessNone {\n\t\t\treturn // Don't let them access\n\t\t}\n\t\tpath := strings.Split(strings.TrimPrefix(r.URL.Path, \"/\"), \"/\")\n\t\tswitch path[0] {\n\t\tcase \"static\", \"assets\":\n\t\t\tif path[1] == \"house.html\" {\n\t\t\t\tbreak\n\t\t\t}\n\t\t\tStatic(w, r, path)\n\t\t\treturn\n\t\t}\n\t\t// Default to base site.\n\t\ttmpl, err := template.ParseFiles(\"./assets/house.html\")\n\t\tif err != nil {\n\t\t\tlog.Fatalf(\"unable to parse html: %s\", err)\n\t\t}\n\t\ttmpl.Execute(w, nil)\n\n\t})\n\n\tlog.Printf(\"starting webhost on: %s\", host)\n\tgo func() {\n\t\terr := http.ListenAndServe(host, nil)\n\t\tif err != nil {\n\t\t\tlog.Fatal(err)\n\t\t}\n\t}()\n\n\tc := make(chan os.Signal, 1)\n\tsignal.Notify(c, os.Interrupt)\n\t<-c\n\n\tsrv.stop() // wait for server to stop\n\tlog.Printf(\"Done!\")\n}", "title": "" }, { "docid": "c8ad25b48bc7a3664faa041046422b5e", "score": "0.62626916", "text": "func (s *Server) Serve(ctx context.Context) error {\n\tdefer s.Close()\n\n\tselect {\n\tcase err := <-s.serveAsync():\n\t\treturn err\n\n\tcase err := <-s.exit:\n\t\tlog.Errorf(\"Error triggered exit: %s\", err)\n\t\treturn err\n\n\tcase <-ctx.Done():\n\t\treturn ctx.Err()\n\t}\n}", "title": "" }, { "docid": "2b2ec85e5f29d6d5faa4679f4197dab9", "score": "0.6231388", "text": "func serve(\n\tlogger *zerolog.Logger,\n\tserverConfig config.ServerConf,\n\trequestCache request.Storage,\n\tserverService proxyserver.AccessorService,\n\truleService rule.Service,\n) error {\n\te := server.New()\n\n\te.GET(\"/\", echo.WrapHandler(defaultHandler{logger: logger}))\n\n\tproxyHandler, err := createProxyHandler(logger, requestCache, serverService, ruleService)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tcontextPath := serverConfig.ContextPath\n\tif contextPath == \"\" {\n\t\tcontextPath = XroadDefaulURL\n\t}\n\te.POST(contextPath, echo.WrapHandler(proxyHandler))\n\n\tlogger.Info().Msg(\"start serving proxy server\")\n\terr = server.Start(e, &server.Config{\n\t\tAddress: serverConfig.Address,\n\t\tReadTimeoutSeconds: serverConfig.ReadTimeoutSeconds,\n\t\tWriteTimeoutSeconds: serverConfig.WriteTimeoutSeconds,\n\t\tDebug: serverConfig.Debug,\n\t\tTLS: server.TLSConf{\n\t\t\tCAFile: serverConfig.TLS.CAFile,\n\t\t\tCertFile: serverConfig.TLS.CertFile,\n\t\t\tKeyFile: serverConfig.TLS.KeyFile,\n\t\t\tKeyPassword: serverConfig.TLS.KeyPassword,\n\t\t\tForceClientCertAuth: serverConfig.TLS.ForceClientCertAuth,\n\t\t},\n\t})\n\n\treturn err\n}", "title": "" }, { "docid": "366bb7c0fcca0250b0b07fd97df4b210", "score": "0.6212231", "text": "func (s statics) serve(pattern string, filename string) {\n\thttp.Handle(pattern, s.Final(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {\n\t\thttp.ServeFile(w, r, filename)\n\t})))\n}", "title": "" }, { "docid": "5852157f3100c5ddb4bc9879143ff9d8", "score": "0.61908126", "text": "func main() {\r\n\r\n\tserver.StartServer()\r\n\r\n}", "title": "" }, { "docid": "a06a513b1e3fdc3fa8766ad97a50cf06", "score": "0.617053", "text": "func (s *Server) Serve(addr string) {\n\n\t// set up routes.\n\t// use an anonymous function for closure in order to pass value to handler\n\t// https://groups.google.com/forum/#!topic/golang-nuts/SGn1gd290zI\n\thttp.HandleFunc(\"/subscribe/\", func(w http.ResponseWriter, r *http.Request) {\n\t\tsseHandler(w, r, s.hub)\n\t})\n\n\thttp.HandleFunc(\"/admin\", func(w http.ResponseWriter, r *http.Request) {\n\t\t// kinda ridiculous workaround for serving a single static file, sigh.\n\t\t// works for now without changing paths tho...\n\t\tbox, err := rice.FindBox(\"views\")\n\t\tif err != nil {\n\t\t\tlog.Fatalf(\"error opening rice.Box: %s\\n\", err)\n\t\t}\n\n\t\tfile, err := box.Open(\"admin.html\")\n\t\tif err != nil {\n\t\t\tlog.Fatalf(\"could not open file: %s\\n\", err)\n\t\t}\n\n\t\tfstat, err := file.Stat()\n\t\tif err != nil {\n\t\t\tlog.Fatalf(\"could not stat file: %s\\n\", err)\n\t\t}\n\n\t\thttp.ServeContent(w, r, fstat.Name(), fstat.ModTime(), file)\n\t})\n\n\thttp.HandleFunc(\"/admin/status.json\", func(w http.ResponseWriter, r *http.Request) {\n\t\tadminStatusDataHandler(w, r, s.hub)\n\t})\n\n\t// actually start the HTTP server\n\tDebug(\"Starting server on addr \" + addr)\n\tif err := http.ListenAndServe(addr, nil); err != nil {\n\t\tlog.Fatal(\"ListenAndServe:\", err)\n\t}\n}", "title": "" }, { "docid": "6748b1055d35655ba2c3a292c11cf803", "score": "0.61413765", "text": "func main() {\n\tdir := http.Dir(\"dist\")\n\tfileServer := http.FileServer(dir)\n\thttp.Handle(\"/\", fileServer)\n\n\tfmt.Printf(\"Listening on port %d\\n\", port)\n\n\taddress := fmt.Sprintf(\"localhost:%d\", port)\n\thttp.ListenAndServe(address, nil)\n}", "title": "" }, { "docid": "8294fe1dcf65a981251812682802b4dd", "score": "0.613805", "text": "func serve(cmd *cobra.Command, args []string) {\n\tfmt.Println(welcome)\n\t// open the database\n\tlog.Info(\"serving data from \", dataFilePath)\n\tdata, err := loadData(dataFilePath)\n\tif err != nil {\n\t\tfmt.Println(\"Error starting PLZ\", err)\n\t\tlog.Error(err)\n\t\treturn\n\t}\n\t// echo start\n\te := echo.New()\n\te.HideBanner = true\n\te.Use(middleware.CORS())\n\te.Use(middleware.Logger())\n\te.Use(middleware.Recover())\n\te.Use(middleware.Gzip())\n\t// health check :)\n\te.GET(\"/status\", func(c echo.Context) (err error) {\n\t\treturn c.JSON(http.StatusOK, map[string]interface{}{\n\t\t\t\"status\": \"ok\",\n\t\t\t\"version\": rootCmd.Version,\n\t\t\t\"zip_codes\": len(data[keyCounters]),\n\t\t})\n\t})\n\te.GET(\"/zip/buildings\", func(c echo.Context) (err error) {\n\t\treturn c.JSON(http.StatusOK, data[keyCounters])\n\t})\n\te.GET(\"/zip/buildings/:code\", func(c echo.Context) (err error) {\n\t\tzip := c.Param(\"code\")\n\t\tif r, found := data[keyCounters][zip]; found {\n\t\t\treturn c.JSON(http.StatusOK, r)\n\t\t}\n\t\treturn c.JSON(http.StatusNotFound, map[string]string{})\n\t})\n\te.GET(\"/zip/buildings/history\", func(c echo.Context) (err error) {\n\t\treturn c.JSON(http.StatusOK, data[keyDistrib])\n\t})\n\te.GET(\"/zip/buildings/:code/history\", func(c echo.Context) (err error) {\n\t\tzip := c.Param(\"code\")\n\t\tif r, found := data[keyDistrib][zip]; found {\n\t\t\treturn c.JSON(http.StatusOK, r)\n\t\t}\n\t\treturn c.JSON(http.StatusNotFound, map[string]string{})\n\t})\n\terr = e.Start(listenAddress)\n\tif err != nil {\n\t\tfmt.Println(\"Error starting PLZ\", err)\n\t\tlog.Error(err)\n\t}\n}", "title": "" }, { "docid": "f14099b2ff83fe682de9ce8ebc17831d", "score": "0.6133125", "text": "func (a *App) serve() {\n\twg := sync.WaitGroup{}\n\tctx, cancel := context.WithCancel(context.Background())\n\tfor {\n\t\tclient, err := a.listener.Accept()\n\t\tif err != nil {\n\t\t\tcancel()\n\t\t\twg.Wait()\n\t\t\tclose(a.serveCh)\n\t\t\treturn\n\t\t}\n\t\taddress := client.RemoteAddr()\n\t\ta.debug(\"new connection from %s\", address)\n\t\tserver, err := net.Dial(\"unix\", a.nodeBindAddress)\n\t\tif err != nil {\n\t\t\ta.error(\"dial local node: %v\", err)\n\t\t\tclient.Close()\n\t\t\tcontinue\n\t\t}\n\t\twg.Add(1)\n\t\tgo func() {\n\t\t\tdefer wg.Done()\n\t\t\tif err := proxy(ctx, client, server, a.tls.Listen); err != nil {\n\t\t\t\ta.error(\"proxy: %v\", err)\n\t\t\t}\n\t\t}()\n\t}\n}", "title": "" }, { "docid": "67c5e1d7ee1443eb7199b8150475c3fb", "score": "0.6129937", "text": "func serve(handler fasthttp.RequestHandler, req *http.Request) (*http.Response, error) {\n\tln := fasthttputil.NewInmemoryListener()\n\tdefer ln.Close()\n\n\tgo func() {\n\t\terr := fasthttp.Serve(ln, handler)\n\t\tif err != nil {\n\t\t\tpanic(fmt.Errorf(\"failed to serve: %v\", err))\n\t\t}\n\t}()\n\n\tclient := http.Client{\n\t\tTransport: &http.Transport{\n\t\t\tDialContext: func(ctx context.Context, network, addr string) (net.Conn, error) {\n\t\t\t\treturn ln.Dial()\n\t\t\t},\n\t\t},\n\t}\n\n\treturn client.Do(req)\n}", "title": "" }, { "docid": "99556e3a5e59f0e2b690992bbcdc0484", "score": "0.61285156", "text": "func main() {\n\ts := api.Server{}\n\ts.Start()\n}", "title": "" }, { "docid": "ed2c86f357cf614b2155cd1ae9b0e692", "score": "0.61203486", "text": "func (s *Server) Serve() {\n\ts.bot.Start()\n}", "title": "" }, { "docid": "ec7720c086dde4616fa5d46329ad90fb", "score": "0.6119587", "text": "func (s *service) serve(served chan struct{}) {\n\tgo func() {\n\t\tselect {\n\t\tcase <-s.close:\n\t\t\tbreak\n\t\tcase <-s.context.Done():\n\t\t\tbreak\n\t\t}\n\n\t\tlog.Println(\"Stop grpc service...\")\n\t\tif err := s.Stop(); err != nil {\n\t\t\tlog.Println(err)\n\t\t} else {\n\t\t\tlog.Println(\"grpc service stop complete\")\n\t\t}\n\t}()\n\n\tserved <- struct{}{}\n\tif err := s.server.Serve(s.listener); err != nil {\n\t\tif !errors.Is(err, io.EOF) {\n\t\t\tlog.Fatalf(\"grpc service: %v\", err)\n\t\t}\n\t}\n}", "title": "" }, { "docid": "045283101455a569a9a512693af4c9cd", "score": "0.61109555", "text": "func (ag *agent) serve() {\n\tfor {\n\t\tconn, err := ag.ln.AcceptTCP()\n\t\tif err != nil {\n\t\t\tlog.Errorf(\"Agent.serve(): Failed to accept\\n\")\n\t\t\tcontinue\n\t\t}\n\t\t// TODO(Yifan): Set read time ount.\n\t\tgo ag.serveConn(conn)\n\t}\n}", "title": "" }, { "docid": "f3a56ff91a9e031df9204b80da94d55a", "score": "0.6098857", "text": "func mainServer(w http.ResponseWriter, req *http.Request) {\n\tpath := req.URL.Path[1:]\n\tfmt.Printf(\"path: %s\\n\",path)\n\thttp.ServeFile(w, req, path)\n}", "title": "" }, { "docid": "d59ff7f2c9073cdc2fcc70e6a901d98a", "score": "0.60814613", "text": "func NewServe() *cobra.Command {\n\tc := &cobra.Command{\n\t\tUse: \"serve\",\n\t\tShort: \"Launches a reloading server\",\n\t\tArgs: cobra.ExactArgs(0),\n\t\tRunE: serveHandler,\n\t}\n\tc.Flags().AddFlagSet(flagSetHomes())\n\tc.Flags().StringVarP(&appPath, \"path\", \"p\", \"\", \"Path of the app\")\n\tc.Flags().BoolP(\"verbose\", \"v\", false, \"Verbose output\")\n\tc.Flags().BoolP(flagForceReset, \"f\", false, \"Force reset of the app state on start and every source change\")\n\tc.Flags().BoolP(flagResetOnce, \"r\", false, \"Reset of the app state on first start\")\n\tc.Flags().StringP(flagConfig, \"c\", \"\", \"Starport config file (default: ./config.yml)\")\n\n\treturn c\n}", "title": "" }, { "docid": "1f88666ed0cf26f4d8a9fddbdf9d59fd", "score": "0.6060972", "text": "func main() {\n\te := echo.New()\n\te.Use(middleware.Recover())\n\te.Use(middleware.Logger())\n\te.Use(middleware.Gzip())\n\te.GET(\"/*\", func(c echo.Context) error {\n\t\treturn c.JSON(200 , ResponseJson{\"OK\"})\n\t})\n\te.Logger.Fatal(e.Start(\":8080\"))\n}", "title": "" }, { "docid": "7b47765c567f7e0e32a203dbbd0cfa58", "score": "0.605317", "text": "func MyServer() {\n\tLaunch()\n\t// frontend()\n}", "title": "" }, { "docid": "2c3d024df42184fbd0ecedeb479073f7", "score": "0.6047958", "text": "func (r *Reducer) serve() error {\n\tvar err error\n\tr.listener, err = net.Listen(\"tcp\", r.listen)\n\tif err != nil {\n\t\treturn err\n\t}\n\tr.rpcServer = rpc.NewServer()\n\tr.rpcServer.Register(r.service)\n\tgo func() {\n\t\tfor {\n\t\t\tconn, err := r.listener.Accept()\n\t\t\tif err != nil {\n\t\t\t\tlogger.Printf(\"Failed to accept RPC connection: %v\", err)\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tgo func() {\n\t\t\t\tr.rpcServer.ServeConn(conn)\n\t\t\t}()\n\t\t}\n\t}()\n\tlogger.Printf(\"Serving on %q\", r.listener.Addr())\n\treturn nil\n}", "title": "" }, { "docid": "fb415aaa999aae6169285ed6eb31045e", "score": "0.6041018", "text": "func (w *Webserver) Serve(ctx context.Context) error {\n\te := echo.New()\n\te.Use(middleware.Logger())\n\te.Use(middleware.Recover())\n\t// templateGroup := mewn.Group(\"./templates\")\n\t// t := &Template{\n\t// \ttemplates: templateGroup,\n\t// }\n\t// e.Renderer = t\n\te.Use(func(next echo.HandlerFunc) echo.HandlerFunc {\n\t\treturn func(c echo.Context) error {\n\t\t\tc.Set(\"appContext\", ctx)\n\t\t\treturn next(c)\n\t\t}\n\t})\n\n\tw.Routes(e)\n\n\ttemplateGroup := mewn.Group(\"./templates\")\n\te.GET(\"/\", func(e echo.Context) error {\n\t\tfileStr := templateGroup.String(\"index.html\")\n\t\treturn e.Blob(http.StatusOK, \"text/html\", []byte(fileStr))\n\t})\n\n\te.GET(\"/favicon.ico\", func(e echo.Context) error {\n\t\tfileStr := templateGroup.String(\"favicon.ico\")\n\t\treturn e.Blob(http.StatusOK, \"image/ico\", []byte(fileStr))\n\t})\n\n\te.GET(\"/public/:fileName\", func(e echo.Context) error {\n\t\tvar fileContentType string\n\n\t\tfileStr := templateGroup.String(e.Param(\"fileName\"))\n\n\t\tswitch filepath.Ext(e.Param(\"fileName\")) {\n\t\tcase \".css\":\n\t\t\tfileContentType = \"text/css\"\n\t\tdefault:\n\t\t\treader := bytes.NewReader([]byte(fileStr))\n\t\t\tfileHeader := make([]byte, 512)\n\t\t\treader.Read(fileHeader)\n\t\t\tfileContentType = http.DetectContentType(fileHeader)\n\t\t}\n\t\treturn e.Blob(http.StatusOK, fileContentType, []byte(fileStr))\n\t})\n\n\tc := make(chan error)\n\tgo func() {\n\t\terr := e.Start(\":\" + strconv.FormatInt(config.DefaultConfig.Webserver.Port, 10))\n\t\tif err != nil {\n\t\t\tc <- err\n\t\t}\n\t\tclose(c)\n\t}()\n\tfor {\n\t\tselect {\n\t\tcase err := <-c:\n\t\t\tlog.Fatal(err)\n\t\tcase <-ctx.Done():\n\t\t\treturn nil\n\t\t}\n\t}\n}", "title": "" }, { "docid": "02de0cdabc7fb312f2304b20e4d5e668", "score": "0.6028575", "text": "func Serve(cmd *cobra.Command) {\n\tLoadTerminalID()\n\n\twsContainer := restful.NewContainer()\n\twsContainer.Router(restful.CurlyRouter{})\n\tRegister(wsContainer)\n\t//cors\n\ttools.Cors(wsContainer)\n\t//process port for command\n\tport, _ := cmd.Flags().GetUint16(\"port\")\n\tsPort := \":\" + strconv.FormatUint(uint64(port), 10)\n\tlogger.Info(\"start listening on localhost\", sPort)\n\tserver := &http.Server{Addr: sPort, Handler: wsContainer}\n\tlog.Fatal(server.ListenAndServe())\n}", "title": "" }, { "docid": "4dcea74c6dd214218c8fda58f395e785", "score": "0.6026287", "text": "func (s *ServerQUIC) Serve(l net.Listener) error { return nil }", "title": "" }, { "docid": "054dd30651e22c32c162a33f768aa91a", "score": "0.6014769", "text": "func (s *server) Accept() {\n\ts.serve()\n}", "title": "" }, { "docid": "6d7a0427a47ea71208605eded8314c34", "score": "0.6009548", "text": "func main() {\n\tport := flag.Int(\"port\", 8080, \"port launcher will be running on\")\n\tflag.Parse()\n\tvar err error\n\tconfig, err = ParseConfig(\"launcher.toml\")\n\tif err != nil {\n\t\tfmt.Printf(\"Error while parsing launcher.toml config: %v\\n\", err.Error())\n\t\tos.Exit(1)\n\t}\n\tmux := pat.New()\n\tfs := http.FileServer(&assetfs.AssetFS{Asset: Asset, AssetDir: AssetDir, Prefix: \"static\"})\n\thttp.Handle(\"/static/\", http.StripPrefix(\"/static/\", fs))\n\tgo h.run()\n\thttp.Handle(\"/ws\", websocket.Handler(wsHandler))\n\n\thttp.Handle(\"/\", mux)\n\tmux.Get(\"/\", http.HandlerFunc(Home))\n\tmux.Get(\"/scripts/:name\", http.HandlerFunc(ScriptHandler))\n\tlog.Println(\"Listening on port \" + strconv.Itoa(*port))\n\thttp.ListenAndServe(\":\"+strconv.Itoa(*port), nil)\n}", "title": "" }, { "docid": "e800484dd24a0fccfe6cc4769798bf03", "score": "0.60023856", "text": "func serveFiles() {\r\n\tvar lastMethodPath string\r\n\r\n\thttp.HandleFunc(\"/\", func(w http.ResponseWriter, r *http.Request) {\r\n\t\tfilename := filepath.Join(serveDir, r.URL.Path)\r\n\t\tnewMethodPath := fmt.Sprintf(\"\\n%s '%s':\", r.Method, r.URL.Path)\r\n\t\tif newMethodPath != lastMethodPath {\r\n\t\t\tlastMethodPath = newMethodPath\r\n\t\t\tinfo(newMethodPath)\r\n\t\t}\r\n\t\tif strings.HasSuffix(filename, \".html\") {\r\n\t\t\tfilename = filename[0:len(filename)-5] + \".md\"\r\n\t\t}\r\n\t\tif strings.HasSuffix(filename, \"md\") {\r\n\t\t\tif r.Method == \"HEAD\" {\r\n\t\t\t\tinfo(\".\")\r\n\t\t\t\tif fstat, err := os.Stat(filename); err == nil {\r\n\t\t\t\t\tw.Header().Set(\"Last-Modified\", fstat.ModTime().UTC().Format(http.TimeFormat))\r\n\t\t\t\t\tw.Header().Set(\"Content-Type\", \"text/html\")\r\n\t\t\t\t\tw.Write([]byte{})\r\n\t\t\t\t}\r\n\t\t\t\treturn\r\n\t\t\t}\r\n\t\t\tif content, err := ioutil.ReadFile(filename); err == nil {\r\n\t\t\t\tif html, err := compile(content); err == nil {\r\n\t\t\t\t\tinfo(\" serve converted .md file.\")\r\n\t\t\t\t\tw.Write(html)\r\n\t\t\t\t\treturn\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\t\tif r.URL.Path == \"/favicon.ico\" {\r\n\t\t\tinfo(\" serve internal png.\")\r\n\t\t\tw.Header().Set(\"Cache-Control\", \"max-age=86400\") // 86400 s = 1 day\r\n\t\t\tw.Header().Set(\"Expires\", time.Now().Add(24*time.Hour).UTC().Format(http.TimeFormat))\r\n\t\t\tw.Write(favIcon)\r\n\t\t\treturn\r\n\t\t}\r\n\t\tinfo(\" serve raw file.\")\r\n\t\tw.Header().Set(\"Cache-Control\", \"no-store\")\r\n\t\thttp.FileServer(http.Dir(serveDir)).ServeHTTP(w, r)\r\n\t})\r\n\r\n\tport := availablePort()\r\n\tinfo(\"start serving '%s' folder to localhost:%s.\\n\", serveDir, port)\r\n\turl := \"http://localhost:\" + port + \"/\" + serveFile\r\n\terr := browser.Open(url)\r\n\ttry(err, \"Can't open the web browser, but you can visit now:\", url)\r\n\tcheck(http.ListenAndServe(\"localhost:\"+port, nil))\r\n}", "title": "" }, { "docid": "ba92c431e2d0af12d089aecd9389d4c0", "score": "0.59941435", "text": "func serve(host string, port string) error {\n\taddress := net.JoinHostPort(host, port)\n\tlistener, err := net.Listen(\"tcp\", address)\n\tif err != nil {\n\t\treturn err\n\t}\n\tfmt.Printf(\"Serving on http://%s/\\n\", listener.Addr().String())\n\treturn http.Serve(listener, sudoku.Handler)\n}", "title": "" }, { "docid": "f753bb3f33b04b9af90b94894c71368c", "score": "0.59858793", "text": "func (p *Plugin) Serve() {\n\tp.serverFactory(p.pluginHandler)\n}", "title": "" }, { "docid": "bb4cece5f052de94a0f8e9008c83e33f", "score": "0.59813607", "text": "func run() error {\n\tvar (\n\t\thttpAddr = flag.String(\"http.addr\", \":80\", \"HTTP addr to listen on\")\n\t\tassetsDir = flag.String(\"assets.dir\", \"./public\", \"Directory to serve assets from\")\n\t\tsoundCmd = flag.String(\"sound.cmd\", \"omxplayer ./public/alarm.mp3\", \"Command for playing alarm sound\")\n\t\tlogLevel = flag.Int(\"log.level\", 1, \"0 = off, 1 = normal, 2 = debug\")\n\t)\n\tflag.Parse()\n\tLogStart(os.Args, *logLevel)\n\tsound := NewCmdSound(*soundCmd)\n\tsound = LoggedSound(sound, *logLevel)\n\tclock := NewClock(sound)\n\tclock = LoggedClock(clock, *logLevel)\n\thandler := http.FileServer(http.Dir(*assetsDir))\n\thandler = NewAlarmHandler(clock, handler)\n\thandler = LoggedHandler(handler, *logLevel)\n\treturn http.ListenAndServe(*httpAddr, handler)\n}", "title": "" }, { "docid": "68d5ab862b4e26348bb2f5ab5ee22b8f", "score": "0.59787965", "text": "func main() {\n\terr := http.ListenAndServe(*port, iserve.New())\n\tif err != nil {\n\t\tfmt.Println(err)\n\t}\n}", "title": "" }, { "docid": "bcad3186d90cba2c29ed491d79f04259", "score": "0.59711516", "text": "func (s *gracefulServer) doServe(ctx context.Context) error {\n\taction := \"started\"\n\tif s.fd != 0 {\n\t\taction = \"reloaded\"\n\t}\n\ts.server.Logger().Infof(\n\t\tctx,\n\t\t`pid[%d]: %s server %s listening on [%s]`,\n\t\tgproc.Pid(), s.getProto(), action, s.address,\n\t)\n\ts.status = ServerStatusRunning\n\terr := s.httpServer.Serve(s.listener)\n\ts.status = ServerStatusStopped\n\treturn err\n}", "title": "" }, { "docid": "92c6fa4d69b987d7532bbfef77654978", "score": "0.5947377", "text": "func main() {\n\n\tdir, err := os.Getwd()\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\tfmt.Println(\"Current dir: \", dir)\n\n\tr := mux.NewRouter()\n\tfs := http.FileServer(http.Dir(dir))\n\n\tr.Handle(\"/\", fs)\n\tr.Handle(\"/public\", http.FileServer(http.Dir(\"./public\")))\n\n\tserver := &http.Server{\n\t\tAddr: \":9090\",\n\t\tHandler: r,\n\t}\n\n\tlog.Println(\"Listening...\")\n\tserver.ListenAndServe()\n\t//http.ListenAndServe(\":9090\", fs)\n\n}", "title": "" }, { "docid": "8e4edb00190243db160dae42bade1b1b", "score": "0.59364384", "text": "func serve() {\n\n\tfmt.Println(\"Starting gRPC server ...\")\n\n\t// 1. Server instance\n\tsvr := server.NewServer()\n\n\ttls := true\n\n\topts := []grpc.ServerOption{}\n\n\tif tls {\n\n\t\t// cert and pem - pass full path\n\t\tcert := \"ssl/server.crt\"\n\t\tpem := \"ssl/server.pem\"\n\n\t\tcred, err := credentials.NewServerTLSFromFile(cert, pem)\n\n\t\tif err != nil {\n\t\t\tsvr.Logger.Errorf(\"cannot creat tls cert from file : %v\", err)\n\t\t}\n\n\t\t// gRPC server with opts\n\t\topts = append(opts, grpc.Creds(cred))\n\t}\n\n\t// 2. instantiate grpc server\n\tgs := grpc.NewServer(opts...)\n\n\t// reflection allows inspection of gRPC API endpoints\n\treflection.Register(gs)\n\n\t// 3. Register services\n\t// - you could alternatively create a seperate server for the blog\n\tgreet.RegisterGreetServiceServer(gs, svr)\n\n\tblogpb.RegisterBlogServiceServer(gs, svr)\n\n\t// 4. create a tcp listener\n\tlis, err := net.Listen(\"tcp\", \":50051\")\n\n\tif err != nil {\n\t\tsvr.Logger.Fatalf(\"could not get listener : %v\", err)\n\t}\n\n\tgo func() {\n\n\t\tif err := gs.Serve(lis); err != nil {\n\t\t\tsvr.Logger.Fatalf(\"gRPC server couldn't listen to port: %v\", err)\n\t\t}\n\t}()\n\n\t// Gracefully shut down the grpc server\n\tfmt.Println(\"[ EXIT ] Press CTRL + C ...\")\n\n\tkill := make(chan os.Signal)\n\tsignal.Notify(kill, os.Interrupt)\n\n\t<-kill\n\n\tsvr.Logger.Println(\"Server gracefully shutting down....\")\n\n\tsvr.Logger.Println(\"Closing mongodb connection....\")\n\n\tsvr.DB.Client().Disconnect(context.TODO())\n\n\tlis.Close()\n\n\tos.Exit(0)\n}", "title": "" }, { "docid": "d1ac55f38ec1f8e402de20eea820ed5e", "score": "0.59314233", "text": "func Serve(dir, address, htmlTemplate string) {\n\tif len(dir) == 0 {\n\t\tdir = defDir\n\t}\n\tif len(address) == 0 {\n\t\taddress = defAddress\n\t}\n\tsrv := newServer(dir, address, htmlTemplate)\n\tsrv.start()\n}", "title": "" }, { "docid": "de85176c7faaf3f15bb6c289d6f5868c", "score": "0.5930394", "text": "func (m *Module) serve(net, addr string, adminMode bool) {\n\tm.kcpServer = kcp.NewKCP(m.ServerConv,\n\t\tfunc(buf []byte, size int) {\n\t\t\tif size > 0 {\n\t\t\t\tb := make([]byte, size)\n\t\t\t\tcopy(b, buf[:size])\n\t\t\t\tm.downstreamKCPData <- b\n\n\t\t\t}\n\t\t})\n\tm.kcpServer.SetMtu(mtu) // ((5/8) * 253) -8\n\t// NoDelay options\n\t// fastest: ikcp_nodelay(kcp, 1, 20, 2, 1)\n\t// nodelay: 0:disable(default), 1:enable\n\t// interval: internal update timer interval in millisec, default is 100ms\n\t// resend: 0:disable fast resend(default), 1:enable fast resend\n\t// nc: 0:normal congestion control(default), 1:disable congestion control\n\t// m.kcpServer.NoDelay(1, 20, 2, 1)\n\tm.kcpServer.NoDelay(0, 20, 0, 1)\n\n\tm.wgServer.Add(1)\n\tm.setIsRunningServer(true)\n\n\tgo func() {\n\t\tdefer m.wgServer.Done()\n\n\t\tfor m.IsRunningServer() {\n\t\t\ttime.Sleep(time.Millisecond * 15)\n\t\t\tm.serverMutex.Lock()\n\t\t\tm.kcpServer.Update()\n\t\t\tm.serverMutex.Unlock()\n\t\t}\n\t}()\n\n\tserveMux := mdns.NewServeMux()\n\tserveMux.HandleFunc(\".\", func(w mdns.ResponseWriter, req *mdns.Msg) {\n\t\tm.handleDNS(w, req)\n\t})\n\n\tm.serverMutex.Lock()\n\tm.server = &mdns.Server{Addr: addr, Net: net, TsigSecret: nil, Handler: serveMux}\n\tm.serverMutex.Unlock()\n\terr := m.server.ListenAndServe()\n\tif err != nil {\n\t\tlog.Fatalf(\"Failed to setup the %s server: %v\\n\", net, err)\n\t}\n}", "title": "" }, { "docid": "dfa6fda4962836dffe848cc35e927473", "score": "0.59236175", "text": "func main() {\n\n\tLogger.Infof(\"host %s\", *host)\n\tLogger.Infof(\"port %d\", *port)\n\tLogger.Infof(\"cacheDriver %s\", *cacheDriver)\n\tLogger.Infof(\"REDIS_URL %s\", *redisUrl)\n\tLogger.Infof(\"Static dir %s\", *staticPath)\n\n\t// handle routers\n\tfor k, v := range routes {\n\t\thttp.HandleFunc(k, v)\n\t}\n\n\tgo serveHTTP(*host, *port)\n\tselect {}\n}", "title": "" }, { "docid": "de8f96f1412f45130a6f4e019471668c", "score": "0.5922859", "text": "func main() {\n\tsrv, err := fake.NewServer(server.ServerSettings, nil)\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\n\tlog.Fatal(http.ListenAndServe(server.ServerSettings.GetPort(), srv.Router()))\n}", "title": "" }, { "docid": "7e4ff0cec4edfd7411c7b3fbaacb401c", "score": "0.59107214", "text": "func (a App) Serve(msg string, options ...ExecOption) (ok bool) {\n\tserveCommand := []string{\n\t\t\"chain\",\n\t\t\"serve\",\n\t\t\"-v\",\n\t}\n\n\tif a.homePath != \"\" {\n\t\tserveCommand = append(serveCommand, \"--home\", a.homePath)\n\t}\n\tif a.configPath != \"\" {\n\t\tserveCommand = append(serveCommand, \"--config\", a.configPath)\n\t}\n\n\treturn a.env.Exec(msg,\n\t\tstep.NewSteps(step.New(\n\t\t\tstep.Exec(IgniteApp, serveCommand...),\n\t\t\tstep.Workdir(a.path),\n\t\t)),\n\t\toptions...,\n\t)\n}", "title": "" }, { "docid": "3ac2dde5669df67858909d9b2e51a8a2", "score": "0.58969885", "text": "func main() {\n\tapp := newServerCli()\n\tif err := app.Run(os.Args); err != nil {\n\t\tlog.Fatal(err)\n\t}\n}", "title": "" }, { "docid": "e5f05d22a58e0de016b3bfae5baedb5f", "score": "0.5894062", "text": "func (h *Handler) servePromote(w http.ResponseWriter, r *http.Request, params httprouter.Params) {\n\tif err := h.Main.Promote(); err != nil {\n\t\thh.Error(w, err)\n\t\treturn\n\t}\n}", "title": "" }, { "docid": "ca4cfeb2a1b1f34109f12b444d43429c", "score": "0.589003", "text": "func serveStatic() {\n\thttp.Handle(\"/\", http.FileServer(http.Dir(utils.RenderDir())))\n\tfmt.Println(\"All your thoughs is here: http://localhost:3000\")\n\thttp.ListenAndServe(\":3000\", nil)\n}", "title": "" }, { "docid": "a228fdbf114d4e7b351eaf84753d08c2", "score": "0.5888998", "text": "func (s Server) Run() {\n\tif err := s.httpSrv.Serve(s.httpLn); err != http.ErrServerClosed {\n\t\tlogrus.WithError(err).Warning(\"serve error\")\n\t}\n}", "title": "" }, { "docid": "a228fdbf114d4e7b351eaf84753d08c2", "score": "0.5888998", "text": "func (s Server) Run() {\n\tif err := s.httpSrv.Serve(s.httpLn); err != http.ErrServerClosed {\n\t\tlogrus.WithError(err).Warning(\"serve error\")\n\t}\n}", "title": "" }, { "docid": "7384c78f8e322b75e36328eeaab287ed", "score": "0.58841157", "text": "func (s *Server) RunScgi(addr string) {\n s.initServer()\n s.Logger.Printf(\"web.go serving scgi %s\\n\", addr)\n s.listenAndServeScgi(addr)\n}", "title": "" }, { "docid": "b92f83b55f37a8540d7a257d6ad62c73", "score": "0.5871254", "text": "func (s *Server) Serve(l net.Listener) error {\n\tif err := s.buildStd(); err != nil {\n\t\treturn err\n\t}\n\ts.started = true\n\treturn s.srv.Serve(l)\n}", "title": "" }, { "docid": "9ba65b47ebfc8310e90e9119f9103a9f", "score": "0.58600074", "text": "func (s *server) run() (err error) {\n\t// Run\n\tastilog.Infof(\"astibob: running %s server on %s\", s.name, s.s.Addr)\n\tif err = s.s.ListenAndServe(); err != nil {\n\t\terr = errors.Wrapf(err, \"astibob: running %s server failed\")\n\t\treturn\n\t}\n\treturn\n}", "title": "" }, { "docid": "5dd9ee3dfe6ff3d3309547ddd3081c16", "score": "0.5859822", "text": "func run() error {\n\tsrv := newServer()\n\terr := http.ListenAndServe(\":8080\", srv)\n\tif err != nil {\n\t\treturn err\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "f12bc2bc6308c6ecd37995446e9c0460", "score": "0.5852174", "text": "func (srv *Server) serve(tftpConn *conn) error {\n\tbaseCtx := context.Background() // base is always background, per Issue 16220\n\tctx := context.WithValue(baseCtx, ServerContextKey, srv) // TODO: Design - Do I really need this context value or Context keys?\n\t///////////\n\n\ttftpConn.rwc = &onceClosePacketConn{PacketConn: tftpConn.rwc}\n\tdefer tftpConn.rwc.Close() /* TODO: Later - How do handle the error of a deferred function? */\n\tfor {\n\t\trequest, clientAddr, err := tftpConn.readWithRetry(ctx)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\t// :0 assigns a new ephemeral port from the OS, this becomes the server-side Transfer ID (TID) of the connection\n\t\tclientConn, err := srv.newConn(\"127.0.0.1:0\")\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tgo clientConn.serve(ctx, clientAddr, request)\n\t}\n}", "title": "" }, { "docid": "9e5572e4aee5f2b06fd8d45ccd31beec", "score": "0.584859", "text": "func main() {\n\tvar port = flag.String(\"port\", \"3998\", \"The port to accept web requests.\")\n\tflag.Parse()\n\n\tr := mux.NewRouter()\n\tr.HandleFunc(\"/static/{asset:.*}\", proxy)\n\tr.HandleFunc(\"/play.js\", proxy)\n\tr.HandleFunc(\"/{repo:github.com/[^/]+/[^/]+}{resource:/?.*}\", func(w http.ResponseWriter, r *http.Request) {\n\t\trepo := mux.Vars(r)[\"repo\"]\n\t\tif err := maybeCloneGitRepo(repo); err != nil {\n\t\t\thandleErr(w, \"Failed to clone git repo: \"+repo+\": \"+err.Error(), \"Failed clone repo.\", http.StatusInternalServerError)\n\t\t\treturn\n\t\t}\n\t\tproxy(w, r)\n\t})\n\tlog.Println(\"Listening on :\" + *port)\n\thttp.ListenAndServe(\":\"+*port, r)\n}", "title": "" }, { "docid": "a343a6a82b98607418ffe8ff7ccab14c", "score": "0.5847056", "text": "func CommandServe() *cobra.Command {\n\toptions := &serveOptions{}\n\n\tcmd := &cobra.Command{\n\t\tUse: \"serve [flags] [config]\",\n\t\tShort: \"Launch Dex account API\",\n\t\tExample: \"dex-account serve\",\n\t\tArgs: cobra.RangeArgs(0, 1),\n\t\tRunE: func(cmd *cobra.Command, args []string) error {\n\t\t\tif len(args) > 0 {\n\t\t\t\toptions.configFile = args[0]\n\t\t\t}\n\t\t\trunningServer = options\n\t\t\treturn runServe(options)\n\t\t},\n\t}\n\n\tflags := cmd.PersistentFlags()\n\tflags.StringVar(&options.WebHTTPAddr, \"web-http-addr\", options.WebHTTPAddr, \"Web HTTP address\")\n\tflags.StringVar(&options.WebHTTPSAddr, \"web-https-addr\", options.WebHTTPSAddr, \"Web HTTPS address\")\n\tflags.StringVar(&options.GrpcAddr, \"grpc-addr\", options.GrpcAddr, \"gRPC API address\")\n\n\tviper.BindPFlag(\"web-http-addr\", flags.Lookup(\"web-http-addr\"))\n\tviper.BindPFlag(\"web-https-addr\", flags.Lookup(\"web-https-addr\"))\n\tviper.BindPFlag(\"grpc-addr\", flags.Lookup(\"grpc-addr\"))\n\n\treturn cmd\n}", "title": "" }, { "docid": "4290312ea3be837c5fc1dfe94f2ca73f", "score": "0.58329964", "text": "func (s *server) serve() error {\n\tfor {\n\t\t// listen for tcp connection\n\t\tconn, err := s.lst.Accept()\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\ts.handleConnection(conn)\n\t}\n}", "title": "" }, { "docid": "fd9f049f21b719e461a00bfb82c951ba", "score": "0.58200234", "text": "func (s *Server) Serve() {\n\n\tlog.Println(\"starting server on :\", s.Port)\n\n\tfor _, endpoint := range s.Endpoints {\n\t\thttp.HandleFunc(endpoint.URI, endpoint.HandleFunction)\n\t}\n\n\tlog.Fatal(http.ListenAndServe(\":\"+strconv.Itoa(s.Port), nil))\n}", "title": "" }, { "docid": "fb6bbc564aba9cff3f7ce0dab8faf04e", "score": "0.5818007", "text": "func main(){\n\trouter := gin.Default()\n\trouter.Use(Logger())\n\n\tv1 := router.Group(\"/api/v1\")\n\tfor idx,_ :=range DroneServers {\n\t\tid := strconv.Itoa(idx)\n\t\tv1.POST(\"/drone/\"+ id + \"/buildyaml\", gin.WrapH(NewYamlPlugin(idx)))\n\t\tv1.POST(\"/drone/\" + id + \"/webhook\", gin.WrapH(NewWebhookPlugin(idx)))\n\t}\n\n\tprojects := router.Group(\"/projects\")\n\tprojects.GET(\"/\", getProjectList)\n\tprojects.POST(\"/:project\", createProject)\n\tprojects.GET(\"/:project\", getProjectInfo)\n\tprojects.DELETE(\"/:project\", deleteProject)\n\tprojects.POST(\"/:project/scripts\", createScripts)\n\n\t//静态文件\n\trouter.GET(\"/\", func(c *gin.Context) {\n\t\tc.Redirect(http.StatusMovedPermanently, \"/web\")\n\t})\n\n\twebFS := assetfs.AssetFS{\n\t\tAsset: Asset,\n\t\tAssetDir: AssetDir,\n\t}\n\trouter.StaticFS(\"/web\", &webFS)\n\trouter.Run(\":9900\")\n}", "title": "" }, { "docid": "cac5f03d4bfdf2f080f7a9e42e970956", "score": "0.5808608", "text": "func Serve(e *echo.Echo, port string) {\n\ts := e.Server(port)\n\ts.TLSConfig = nil\n\n\te.Static(\"/static\", \"public\")\n\n\tgracehttp.Serve(s)\n}", "title": "" }, { "docid": "8dc54097a1a5556d86c4bfce0fb554a4", "score": "0.5806993", "text": "func main() {\n\t// Sets up static directory serve\n\tfs := http.FileServer(http.Dir(\"static/\"))\n\tps := http.FileServer(http.Dir(\"samples/\"))\n\t// Sets up routes\n\thttp.Handle(\"/static/\", http.StripPrefix(\"/static/\", fs))\n\thttp.Handle(\"/samples/\", http.StripPrefix(\"/samples/\", ps))\n\thttp.HandleFunc(\"/favicon.ico\", iconHandler)\n\thttp.HandleFunc(\"/\", makeHandler(interpretHandler, \"/\"))\n\thttp.HandleFunc(\"/about\", makeHandler(aboutHandler, \"/about\"))\n\thttp.HandleFunc(\"/info\", makeHandler(infoHandler, \"/info\"))\n\thttp.HandleFunc(\"/interpret\", makeHandler(interpretHandler, \"/interpret\"))\n\thttp.HandleFunc(\"/library\", makeHandler(libraryHandler, \"/library\"))\n\t// Starts the server\n\tport := os.Getenv(\"PORT\")\n\tif port == \"\" {\n\t\tport = \"8080\"\n\t}\n\tlog.Printf(\"Starting server on port %s\\n\", port)\n\tlog.Fatal(http.ListenAndServe(\":\"+port, nil))\n}", "title": "" }, { "docid": "949504dee2be40654dbca737c97dce22", "score": "0.58050936", "text": "func (s *Server) serve(cb ServeFunc) error {\n\ts.l.Lock()\n\tif s.listener == nil {\n\t\ts.l.Unlock()\n\t\treturn errors.New(\"already closed\")\n\t}\n\tlistener := s.listener // accessed outside the lock\n\tctx := s.ctx\n\ts.l.Unlock()\n\n\terr := cb(ctx, listener, &s.wg) // blocks until killServe() is called\n\ts.wg.Wait() // waits for all pending requests\n\n\t// If it was a planned shutdown with killServe(), ignore the error. It says\n\t// that the listening socket was closed.\n\ts.l.Lock()\n\tif s.listener == nil {\n\t\terr = nil\n\t}\n\ts.l.Unlock()\n\n\tif err != nil {\n\t\treturn errors.Annotate(err, \"error in the serving loop\").Err()\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "ce0b72a661133496c5136a3d9d536b9b", "score": "0.5803866", "text": "func serveStandalone(_ *cobra.Command, _ []string) error {\n\tctx := newCtxWithSignals()\n\n\tstandaloneCfg := config.Standalone{}\n\tif fileutil.Exist(cfg) || fileutil.Exist(defaultStandaloneCfgFile) {\n\t\tif err := config.LoadAndSetStandAloneConfig(cfg, defaultStandaloneCfgFile, &standaloneCfg); err != nil {\n\t\t\treturn err\n\t\t}\n\t} else {\n\t\tstandaloneCfg = config.NewDefaultStandalone()\n\t}\n\n\tif err := logger.InitLogger(standaloneCfg.Logging, standaloneLogFileName); err != nil {\n\t\treturn fmt.Errorf(\"init logger error: %s\", err)\n\t}\n\n\t// run cluster as standalone mode\n\truntime := standalone.NewStandaloneRuntime(config.Version, &standaloneCfg, embedEtcd)\n\treturn run(ctx, runtime, func() error {\n\t\tif !fileutil.Exist(cfg) && !fileutil.Exist(defaultStorageCfgFile) {\n\t\t\treturn nil\n\t\t}\n\t\tnewStandaloneCfg := config.Standalone{}\n\t\treturn config.LoadAndSetStandAloneConfig(cfg, defaultStandaloneCfgFile, &newStandaloneCfg)\n\t})\n}", "title": "" }, { "docid": "45b14c46ec3a57a23a3025902b686caf", "score": "0.57898325", "text": "func main() {\n\tconfig.InitConfig()\n\tdb := datastore.NewDB()\n\n\tdefer db.Close()\n\n\tr := registry.NewRegistry(db)\n\n\t//for echo server\n\te := echo.New()\n\trouter.NewERouter(e, r.NewAppController())\n\tgo e.Start(config.C.Server.Address)\n\n\t//webview.Open(\"stock demo\", \"http://0.0.0.0:8080/assets/chat.html\", 1024, 768, true)\n\n\t//only server\n\tlog.Fatal(e.Start(config.C.Server.Address))\n\n}", "title": "" }, { "docid": "c64c080c6e5cf3da70178046910dc31b", "score": "0.57875067", "text": "func (s *Threescale) Run(shutdown chan error) {\n\tshutdown <- s.server.Serve(s.listener)\n}", "title": "" }, { "docid": "c64c080c6e5cf3da70178046910dc31b", "score": "0.57875067", "text": "func (s *Threescale) Run(shutdown chan error) {\n\tshutdown <- s.server.Serve(s.listener)\n}", "title": "" }, { "docid": "7fb95a03177f34e24b7301aaaf3bdd19", "score": "0.5779399", "text": "func main() {\n\thttp.HandleFunc(\"/\", indexHandler)\n\thttp.HandleFunc(\"/styles.css\", stylesHandler)\n\thttp.HandleFunc(\"/sw.js\", serviceWorkerHandler)\n\thttp.HandleFunc(\"/js/\", scriptsHandler)\n\thttp.HandleFunc(\"/manifest.json\", manifestHandler)\n\thttp.HandleFunc(\"/icons/\", iconsHandler)\n\thttp.HandleFunc(\"/favicon.ico\", faviconHandler)\n\t\n\tport := \":5000\"\n\tfmt.Println(\"...Serving on port\", port)\n\thttp.ListenAndServe(port, nil)\n}", "title": "" }, { "docid": "c6ed84abaef21364472b958b19b17dd5", "score": "0.5773302", "text": "func Serve(efs *embed.FS) {\n\tembedFS = efs\n\n\tvar (\n\t\tport int\n\t\thttpsPort int\n\t\tcacheUrl string\n\t\tdbUrl string\n\t\tfsUrl string\n\t\tetcDir string\n\t\tlogLevel string\n\t\tlogDir string\n\t\tnoCompress bool\n\t\tisDev bool\n\t)\n\n\tflag.IntVar(&port, \"port\", 80, \"http server port\")\n\tflag.IntVar(&httpsPort, \"https-port\", 0, \"https(autotls) server port, default is disabled\")\n\tflag.StringVar(&cacheUrl, \"cache\", \"\", \"cache connection Url\")\n\tflag.StringVar(&dbUrl, \"db\", \"\", \"database connection Url\")\n\tflag.StringVar(&fsUrl, \"fs\", \"\", \"file system connection Url\")\n\tflag.StringVar(&cdnDomain, \"cdn-domain\", \"\", \"cdn domain\")\n\tflag.StringVar(&etcDir, \"etc-dir\", \"/usr/local/etc/esmd\", \"the etc dir to store data\")\n\tflag.StringVar(&logLevel, \"log-level\", \"info\", \"log level\")\n\tflag.StringVar(&logDir, \"log-dir\", \"/var/log/esmd\", \"the log dir to store server logs\")\n\tflag.BoolVar(&noCompress, \"no-compress\", false, \"disable compression for text content\")\n\tflag.BoolVar(&isDev, \"dev\", false, \"run server in development mode\")\n\tflag.Parse()\n\n\tif isDev {\n\t\tetcDir, _ = filepath.Abs(\".dev\")\n\t\tlogDir = path.Join(etcDir, \"log\")\n\t\tlogLevel = \"debug\"\n\t\tcdnDomain = \"localhost\"\n\t\tif port != 80 {\n\t\t\tcdnDomain = fmt.Sprintf(\"localhost:%d\", port)\n\t\t}\n\t}\n\tif cacheUrl == \"\" {\n\t\tcacheUrl = \"memory:main\"\n\t}\n\tif dbUrl == \"\" {\n\t\tdbUrl = fmt.Sprintf(\"postdb:%s\", path.Join(etcDir, \"esm.db\"))\n\t}\n\tif fsUrl == \"\" {\n\t\tfsUrl = fmt.Sprintf(\"local:%s\", path.Join(etcDir, \"storage\"))\n\t}\n\n\tvar err error\n\tvar log *logx.Logger\n\tif logDir == \"\" {\n\t\tlog = &logx.Logger{}\n\t} else {\n\t\tlog, err = logx.New(fmt.Sprintf(\"file:%s?buffer=32k\", path.Join(logDir, \"main.log\")))\n\t\tif err != nil {\n\t\t\tfmt.Printf(\"initiate logger: %v\\n\", err)\n\t\t\tos.Exit(1)\n\t\t}\n\t}\n\tlog.SetLevelByName(logLevel)\n\n\tnodeInstallDir := os.Getenv(\"NODE_INSTALL_DIR\")\n\tif nodeInstallDir == \"\" {\n\t\tnodeInstallDir = path.Join(etcDir, \"nodejs\")\n\t}\n\tnode, err = checkNode(nodeInstallDir)\n\tif err != nil {\n\t\tlog.Fatalf(\"check nodejs env: %v\", err)\n\t}\n\tlog.Debugf(\"nodejs v%s installed, registry: %s\", node.version, node.npmRegistry)\n\n\tstorage.SetLogger(log)\n\tstorage.SetIsDev(isDev)\n\n\tcache, err = storage.OpenCache(cacheUrl)\n\tif err != nil {\n\t\tlog.Fatalf(\"init storage(cache,%s): %v\", cacheUrl, err)\n\t}\n\n\tdb, err = storage.OpenDB(dbUrl)\n\tif err != nil {\n\t\tlog.Fatalf(\"init storage(db,%s): %v\", dbUrl, err)\n\t}\n\n\tfs, err = storage.OpenFS(fsUrl)\n\tif err != nil {\n\t\tlog.Fatalf(\"init storage(fs,%s): %v\", fsUrl, err)\n\t}\n\n\tvar accessLogger *logx.Logger\n\tif logDir == \"\" {\n\t\taccessLogger = &logx.Logger{}\n\t} else {\n\t\taccessLogger, err = logx.New(fmt.Sprintf(\"file:%s?buffer=32k&fileDateFormat=20060102\", path.Join(logDir, \"access.log\")))\n\t\tif err != nil {\n\t\t\tlog.Fatalf(\"initiate access logger: %v\", err)\n\t\t}\n\t}\n\taccessLogger.SetQuite(true)\n\n\t// start cjs lexer server\n\tgo func() {\n\t\tfor {\n\t\t\terr := startCJSLexerServer(path.Join(etcDir, \"cjx-lexer.pid\"), isDev)\n\t\t\tif err != nil {\n\t\t\t\tif err.Error() == \"EADDRINUSE\" {\n\t\t\t\t\tcjsLexerServerPort++\n\t\t\t\t} else {\n\t\t\t\t\tlog.Errorf(\"cjs lexer server: %v\", err)\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}()\n\n\tif !noCompress {\n\t\trex.Use(rex.AutoCompress())\n\t}\n\trex.Use(\n\t\trex.ErrorLogger(log),\n\t\trex.AccessLogger(accessLogger),\n\t\trex.Header(\"Server\", \"esm.sh\"),\n\t\trex.Cors(rex.CORS{\n\t\t\tAllowAllOrigins: true,\n\t\t\tAllowMethods: []string{\"GET\"},\n\t\t\tAllowHeaders: []string{\"Origin\", \"Content-Type\", \"Content-Length\", \"Accept-Encoding\"},\n\t\t\tMaxAge: 3600,\n\t\t}),\n\t\tquery(),\n\t)\n\n\tC := rex.Serve(rex.ServerConfig{\n\t\tPort: uint16(port),\n\t\tTLS: rex.TLSConfig{\n\t\t\tPort: uint16(httpsPort),\n\t\t\tAutoTLS: rex.AutoTLSConfig{\n\t\t\t\tAcceptTOS: httpsPort > 0 && !isDev,\n\t\t\t\tCacheDir: path.Join(etcDir, \"autotls\"),\n\t\t\t},\n\t\t},\n\t})\n\n\tc := make(chan os.Signal, 1)\n\tsignal.Notify(c, syscall.SIGTERM, syscall.SIGINT, syscall.SIGQUIT, syscall.SIGKILL, syscall.SIGHUP)\n\n\tif isDev {\n\t\tlog.Debugf(\"Server ready on http://localhost:%d\", port)\n\t\tlog.Debugf(\"Testing page at http://localhost:%d?test\", port)\n\t}\n\n\tselect {\n\tcase <-c:\n\tcase err = <-C:\n\t\tlog.Error(err)\n\t}\n\n\t// release resource\n\tdb.Close()\n\taccessLogger.FlushBuffer()\n\tlog.FlushBuffer()\n}", "title": "" }, { "docid": "326b71aaa97a152681cb11c69d22a04e", "score": "0.57714957", "text": "func (s *server) serve() {\n\tdefer s.wg.Done()\n\tfor {\n\t\tconn, err := s.Listener.Accept()\n\t\tif err != nil {\n\t\t\tif s.running() {\n\t\t\t\tassert.NoError(s.t, err)\n\t\t\t}\n\t\t\treturn\n\t\t}\n\t\ts.wg.Add(1)\n\t\tgo s.handle(conn)\n\t}\n}", "title": "" }, { "docid": "8131ded6781178bd44ef3974e43a7a02", "score": "0.5767053", "text": "func serveHTTP() {\n\tfmt.Printf(\"Web server listening at %s ...\\n\", *port)\n\n\tsrc := &http.Server{\n\t\tAddr: *port,\n\t\tReadTimeout: 1 * time.Hour,\n\t}\n\n\tif *useGzip {\n\t\tfmt.Println(\"HTTP server will return gzip values if permitted by browser.\")\n\t\thttp.HandleFunc(\"/\", makeGzipHandler(fileHandler))\n\t} else {\n\t\thttp.HandleFunc(\"/\", fileHandler)\n\t}\n\tsrc.ListenAndServe()\n}", "title": "" }, { "docid": "a8bc86c843ea6d71daf9a735114d41f1", "score": "0.5762152", "text": "func (sc *serveConn) Serve() error {\n\tvar err error\n\tsc.uid, sc.gid, err = uidAndGid()\n\tif err != nil {\n\t\treturn err\n\t}\n\tfor {\n\t\treq, err := sc.conn.ReadRequest()\n\t\tif err != nil {\n\t\t\tif err == io.EOF {\n\t\t\t\tbreak\n\t\t\t}\n\t\t\treturn err\n\t\t}\n\n\t\tfuse.Debug(fmt.Sprintf(\"%+v\", req))\n\t\tgo sc.serve(req)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "ace1a016cedbac669d6bce17c94273ef", "score": "0.57615846", "text": "func Run() {\n\tserver.Run()\n}", "title": "" }, { "docid": "99241a317b8ede6ff2b546a6f634986d", "score": "0.5739519", "text": "func Serve(ctx context.Context, serveAddr string, db idb.IndexerDb, fetcherError error, log *log.Logger, options ExtraOptions) {\n\te := echo.New()\n\te.HideBanner = true\n\n\tif options.MetricsEndpoint {\n\t\tp := echo_contrib.NewPrometheus(\"indexer\", nil, nil)\n\t\tif options.MetricsEndpointVerbose {\n\t\t\tp.RequestCounterURLLabelMappingFunc = middlewares.PrometheusPathMapperVerbose\n\t\t} else {\n\t\t\tp.RequestCounterURLLabelMappingFunc = middlewares.PrometheusPathMapper404Sink\n\t\t}\n\t\t// This call installs the prometheus metrics collection middleware and\n\t\t// the \"/metrics\" handler.\n\t\tp.Use(e)\n\t}\n\n\te.Use(middlewares.MakeLogger(log))\n\te.Use(middleware.CORS())\n\n\tmiddleware := make([]echo.MiddlewareFunc, 0)\n\n\tmiddleware = append(middleware, middlewares.MakeMigrationMiddleware(db))\n\n\tif len(options.Tokens) > 0 {\n\t\tmiddleware = append(middleware, middlewares.MakeAuth(\"X-Indexer-API-Token\", options.Tokens))\n\t}\n\n\tapi := ServerImplementation{\n\t\tEnableAddressSearchRoundRewind: options.DeveloperMode,\n\t\tdb: db,\n\t\tfetcher: fetcherError,\n\t\ttimeout: options.handlerTimeout(),\n\t\tlog: log,\n\t}\n\n\tgenerated.RegisterHandlers(e, &api, middleware...)\n\tcommon.RegisterHandlers(e, &api)\n\n\tif ctx == nil {\n\t\tctx = context.Background()\n\t}\n\tgetctx := func(l net.Listener) context.Context {\n\t\treturn ctx\n\t}\n\ts := &http.Server{\n\t\tAddr: serveAddr,\n\t\tReadTimeout: options.ReadTimeout,\n\t\tWriteTimeout: options.WriteTimeout,\n\t\tMaxHeaderBytes: 1 << 20,\n\t\tBaseContext: getctx,\n\t}\n\n\tgo func() {\n\t\tlog.Fatal(e.StartServer(s))\n\t}()\n\n\t<-ctx.Done()\n\t// Allow one second for graceful shutdown.\n\tctx, cancel := context.WithTimeout(context.Background(), time.Second)\n\tdefer cancel()\n\tif err := e.Shutdown(ctx); err != nil {\n\t\tlog.Fatal(err)\n\t}\n}", "title": "" }, { "docid": "b3085ed88779a3525114688e769956a0", "score": "0.57391334", "text": "func main() {\n\t// allow OPTIONS\n\tc := cors.New(cors.Options{\n\t\tAllowedOrigins: []string{\"http://127.0.0.1:8080\", \"http://localhost:8080\"},\n\t\tAllowedMethods: []string{\"GET\", \"POST\", \"OPTIONS\"},\n\t\tAllowedHeaders: []string{\"X-Auth-Key\", \"X-Auth-Secret\", \"Content-Type\"},\n\t\tDebug: false,\n\t})\n\n\t//common.StartUp() - Replaced with init method\n\t// Get the mux router object\n\trouter := routers.InitRoutes()\n\t// Create a negroni instance\n\tn := negroni.Classic()\n\tn.Use(c)\n\tn.UseHandler(router)\n\n\tserver := &http.Server{\n\t\tAddr: common.AppConfig.Server,\n\t\tHandler: n,\n\t}\n\tlog.Println(\"Listening...\")\n\tserver.ListenAndServe()\n}", "title": "" }, { "docid": "13138db881e89b6146855de8aec61caf", "score": "0.5737398", "text": "func (this *WSAcceptor) Serve(handler AcceptorHandler) error {\n\tif handler == nil {\n\t\treturn errors.New(\"dnet:Serve handler is nil. \")\n\t}\n\tthis.handler.handler = handler\n\n\tif !atomic.CompareAndSwapInt32(&this.started, 0, 1) {\n\t\treturn errors.New(\"dnet:Serve acceptor is already started. \")\n\t}\n\n\tlistener, err := net.Listen(\"tcp\", this.address)\n\tif err != nil {\n\t\treturn errors.New(\"dnet:Serve net.Listen failed, \" + err.Error())\n\t}\n\tthis.listener = listener\n\tdefer this.Stop()\n\n\tif err = http.Serve(this.listener, this.handler); err != nil {\n\t\tlog.Printf(\"dnet:Serve failed, %s\\n\", err.Error())\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "f23372435e5dd31597928b77f5c72a4a", "score": "0.57342565", "text": "func main() {\n\tcloser := setTracing()\n\tdefer closer.Close()\n\n\tport := os.Getenv(\"PORT\")\n\tif port == \"\" {\n\t\tport = \"8000\"\n\t}\n\n\tsetDB()\n\trouter := setRouter()\n\n\tvar handler http.Handler = router\n\t//some example cors for a website on localhost:3000\n\tif os.Getenv(\"cors_dev\") == \"true\" {\n\t\tc := cors.New(cors.Options{\n\t\t\tAllowedOrigins: []string{\n\t\t\t\t\"http://localhost:3000\",\n\t\t\t},\n\t\t\tAllowedMethods: []string{\"GET\", \"POST\", \"DELETE\", \"PUT\", \"OPTIONS\", \"OPTION\"},\n\t\t\tAllowedHeaders: []string{`Referer`, `user`, `Origin`, `DNT`, `User-Agent`, `X-Requested-With`, `If-Modified-Since`, `Cache-Control`, `Content-Type`, `Range`, `Authorization`, `X-Content-Length`, `X-Content-Name`, `X-Content-Extension`, `X-Chunk-Id`, `maxSize`, `maxWidth`, `maxHeight`, `fileType`},\n\t\t\tAllowCredentials: true,\n\t\t})\n\n\t\thandler = c.Handler(router)\n\t}\n\t//the server\n\tsrv := http.Server{\n\t\tReadTimeout: 0,\n\t\tWriteTimeout: 600 * time.Second,\n\t\tIdleTimeout: 0,\n\t\tReadHeaderTimeout: 0,\n\t\tAddr: \":\" + port,\n\t\tHandler: handler,\n\t}\n\tsrv.ListenAndServe()\n}", "title": "" }, { "docid": "f3e0f8dc503f8a7f5867fb3aab1e00fd", "score": "0.57315964", "text": "func Serve(cmd *cobra.Command) {\n\twsContainer := restful.NewContainer()\n\twsContainer.Router(restful.CurlyRouter{})\n\tauth := new(restful.WebService)\n\t//registry fist auth\n\tFistRegister(auth)\n\twsContainer.Add(auth)\n\t//cors\n\ttools.Cors(wsContainer)\n\n\t//process port for command\n\tport, _ := cmd.Flags().GetUint16(\"port\")\n\tsPort := \":\" + strconv.FormatUint(uint64(port), 10)\n\tlogger.Info(\"start listening on localhost\", sPort)\n\tserver := &http.Server{Addr: sPort, Handler: wsContainer}\n\tlog.Fatal(server.ListenAndServe())\n}", "title": "" }, { "docid": "2b5ce5303c6776012be265a025c855b5", "score": "0.5730311", "text": "func Serve(directory, playerAddress, port string) {\n\tfileDir = directory\n\tif fileDir[len(fileDir)-1] == '/' {\n\t\tfileDir = fileDir[:len(fileDir)-2]\n\t}\n\tplayerIP = playerAddress\n\taddress, _ = os.Hostname()\n\tplayerPort = port\n\n\thttp.HandleFunc(\"/\", rootHandler)\n\thttp.Handle(\"/files/\", http.StripPrefix(\"/files/\", http.FileServer(http.Dir(fileDir)+\"/\")))\n\thttp.HandleFunc(\"/command/\", commandHandler)\n\thttp.HandleFunc(\"/dir/\", dirHandler)\n\tlog.Fatal(http.ListenAndServe(\":\"+port, nil))\n\n}", "title": "" }, { "docid": "58dac26015b7949eb7cef8e9f0c1e164", "score": "0.57290125", "text": "func (g *Gateway) Serve() error {\n\treturn g.httpserver.Serve()\n}", "title": "" }, { "docid": "5c256dd12f261a16a6faa7ca4f844139", "score": "0.57277787", "text": "func main() {\n\thttp.ListenAndServe(\":3000\", http.HandlerFunc(Handler))\n}", "title": "" }, { "docid": "0474f883ea81ccca04816385659f0fd0", "score": "0.5724558", "text": "func (h *Handler) serveDemote(w http.ResponseWriter, r *http.Request, params httprouter.Params) {\n\tif err := h.Main.Demote(); err != nil {\n\t\thh.Error(w, err)\n\t\treturn\n\t}\n}", "title": "" }, { "docid": "e8a5aee1e8d82c3d6613fcbae201748a", "score": "0.57242304", "text": "func main() {\n\tvar exePath string\n\texePath, err := os.Executable()\n\tif err != nil {\n\t\treturn\n\t}\n\texecDir := filepath.Dir(exePath)\n\n\te := echo.New()\n\te.Renderer = &Template{\n\t\ttemplates: template.Must(template.ParseGlob(filepath.Join(execDir, \"view\", \"*.html\"))),\n\t}\n\n\te.Static(\"/\", filepath.Join(execDir, \"view/index.html\"))\n\n\te.GET(\"/result\", func(c echo.Context) error {\n\t\treturn c.Render(http.StatusOK, \"result\", parse(c, \"GET\"))\n\t})\n\te.POST(\"/result\", func(c echo.Context) error {\n\t\treturn c.Render(http.StatusOK, \"result\", parse(c, \"POST\"))\n\t})\n\n\tgo e.Logger.Fatal(e.Start(\":2345\"))\n}", "title": "" }, { "docid": "8c848b5454fe62229383d17d8ae621de", "score": "0.57165146", "text": "func (wserver *webServer) run() (err error) {\n\t// WebSocket\n\thttp.Handle(\"/message\", websocket.Handler(wserver.socket))\n\n\t// Web Contents\n\t// The frontend side should be built by webdev build --output build\n\t// Otherwise, the location will be ../front/build\n\thttp.Handle(\"/\", http.FileServer(http.Dir(\"../front/build/web\")))\n\n\t// Server up and running\n\tlog.Println(wserver.instance.ListenAndServe())\n\n\twserver.wait.Done()\n\treturn nil\n}", "title": "" } ]
44e904c66922ddd15ff3efbed41647f3
SetDomicile gets a reference to the given string and assigns it to the Domicile field.
[ { "docid": "9c154641b5941ae9591f1c4c7e7b6ad2", "score": "0.76880246", "text": "func (o *ETFProfileData) SetDomicile(v string) {\n\to.Domicile = &v\n}", "title": "" } ]
[ { "docid": "628241ba669a657b955511973cc2b985", "score": "0.6009216", "text": "func (o *ETFProfileData) GetDomicile() string {\n\tif o == nil || o.Domicile == nil {\n\t\tvar ret string\n\t\treturn ret\n\t}\n\treturn *o.Domicile\n}", "title": "" }, { "docid": "3dcf1d6e5e63766e8e49ac3ea4cc1772", "score": "0.48465922", "text": "func (d *Drug) SetDosageRegimen(dosageRegimen string) {\n\td.DosageRegimen = dosageRegimen\n}", "title": "" }, { "docid": "01797726dbaada3daf07471f2a1a9f5e", "score": "0.4781201", "text": "func (me *TxsdBibliocoverageSpatial) Set(s string) { (*xsdt.Token)(me).Set(s) }", "title": "" }, { "docid": "e5cca1462fb761e2ab634c4bb73c30cd", "score": "0.47747844", "text": "func (d *Domnode) SetValue(value string) int32 {\n\tvalue_ := C.cef_string_userfree_alloc()\n\tsetCEFStr(value, value_)\n\tdefer func() {\n\t\tC.cef_string_userfree_free(value_)\n\t}()\n\treturn int32(C.gocef_domnode_set_value(d.toNative(), (*C.cef_string_t)(value_), d.set_value))\n}", "title": "" }, { "docid": "8ea0011058778f755bd0d2e9e1d440b9", "score": "0.47454607", "text": "func (d *Dimension) Set(s string) error {\n\tvar v Dimension\n\n\t// Split number and unit.\n\ti := strings.IndexFunc(s, unitToken)\n\tif i < 0 {\n\t\tif err := v.Value.Set(s); err != nil {\n\t\t\treturn fmt.Errorf(\"invalid dimension: %v\", err)\n\t\t}\n\t\tif v.Value == 0 {\n\t\t\t// 0 is a valid dimension.\n\t\t\treturn nil\n\t\t}\n\n\t\treturn fmt.Errorf(\"invalid dimension: expected unit: %q\", s)\n\t}\n\n\tif err := v.Value.Set(s[:i]); err != nil {\n\t\treturn fmt.Errorf(\"invalid dimension: %q: %v\", s, err)\n\t}\n\tif err := v.Unit.Set(s[i:]); err != nil {\n\t\treturn fmt.Errorf(\"invalid dimension: %q: %v\", s, err)\n\t}\n\n\t*d = v\n\n\treturn nil\n}", "title": "" }, { "docid": "bb8eb8d8847fa233105a31fed2d8eca0", "score": "0.46292987", "text": "func (t *Tokenizer) SetDic(dic *Dic) {\n\tif dic != nil {\n\t\tt.dic = dic\n\t}\n}", "title": "" }, { "docid": "bcd14db823745da5ec136a1c1c2c3fc8", "score": "0.46043178", "text": "func (me *TxsdImagedataValign) Set(s string) { (*xsdt.Token)(me).Set(s) }", "title": "" }, { "docid": "d5c30d395bccbde6f9857f68ffa2dbd8", "score": "0.45842746", "text": "func (mc *MedicalfileCreate) SetDentistID(id int) *MedicalfileCreate {\n\tmc.mutation.SetDentistID(id)\n\treturn mc\n}", "title": "" }, { "docid": "3e37e75194440e2168b90a79beea4137", "score": "0.45764142", "text": "func (r *mongoDBStore) SetMediatorDID(d *datastore.DID) error {\n\tctx := context.Background()\n\t_, err := r.db.Collection(MediatorDIDC).DeleteMany(ctx, bson.M{})\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"unable to unset public DID\")\n\t}\n\n\td.ID = d.DID.String()\n\td.Public = true\n\t_, err = r.db.Collection(MediatorDIDC).InsertOne(ctx, d)\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"unable to unset public DID\")\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "6fddca14b08425da4e3951ee1e1290f5", "score": "0.45556128", "text": "func (s *Dimension) SetValue(v string) *Dimension {\n\ts.Value = &v\n\treturn s\n}", "title": "" }, { "docid": "59f16ed2c0f448d67d68c9930768ee93", "score": "0.45452082", "text": "func (h *Host) SetMotd(motd string) {\n\th.mu.Lock()\n\th.motd = motd\n\th.mu.Unlock()\n}", "title": "" }, { "docid": "e7fb85caa047e545e1b9e44848ec8011", "score": "0.4534593", "text": "func (ite *IconTypeEnum) SetValue(s string) {\n\tif ite != nil {\n\t\t*ite = IconTypeEnum(s)\n\t}\n}", "title": "" }, { "docid": "4c8c07c73048a4b01a1cb806a4e51494", "score": "0.45308596", "text": "func (me *TxsdBibliocoverageTemporal) Set(s string) { (*xsdt.Token)(me).Set(s) }", "title": "" }, { "docid": "74bf08d01fd8937a37710baa34a35a29", "score": "0.45243084", "text": "func (d *Pile) Pile(item string) {\n\td.pile <- item\n}", "title": "" }, { "docid": "1116d38d2798bc6ef2dca5b795567a0c", "score": "0.45065776", "text": "func SetString(i interface{}, name string, s string) {\n\tt := FieldValue(i, name)\n\tt.SetString(s)\n}", "title": "" }, { "docid": "a6a32465061bf7cf0cbd40a613a35f70", "score": "0.4468071", "text": "func MakeSetOfDomainsDesignator(id string) AttributeDesignator {\n\treturn MakeAttributeDesignator(MakeAttribute(id, TypeSetOfDomains))\n}", "title": "" }, { "docid": "6e33395d24087a5161ef41fff8869deb", "score": "0.44493607", "text": "func SetAttribute(rawHCL string, dotPath string, value interface{}, renameResource string) string {\n\n\tm := machine{\n\t\ttabStr: \"\\t\",\n\t\tdotPath: dotPath,\n\t\tvalue: value,\n\t\trenameResource: renameResource,\n\t}\n\n\tfor _, line := range strings.Split(rawHCL, \"\\n\") {\n\t\tm.processLine(line)\n\t}\n\n\treturn strings.Join(m.output, \"\\n\")\n}", "title": "" }, { "docid": "88184ee49a7e976685a8a14e26bc89f9", "score": "0.43972117", "text": "func (o *ETFProfileData) HasDomicile() bool {\n\tif o != nil && o.Domicile != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "d6e2147a7dfd9a9119a03b8f9666d5cb", "score": "0.43614623", "text": "func (op MountOperation) SetDomain(domain string) {\n\tdomain0 := C.CString(domain)\n\tC.g_mount_operation_set_domain(op.native(), domain0)\n\tC.free(unsafe.Pointer(domain0)) /*ch:<stdlib.h>*/\n}", "title": "" }, { "docid": "fdc56c0d924913855822217375acde0f", "score": "0.43511614", "text": "func (mc *MedicalfileCreate) SetDentist(d *Dentist) *MedicalfileCreate {\n\treturn mc.SetDentistID(d.ID)\n}", "title": "" }, { "docid": "3fc7e1c68fb43f68da974031f68d3f03", "score": "0.43448082", "text": "func (p *InMemoryParser) SetDelimeter(string) {}", "title": "" }, { "docid": "362c0e28d6b83c19c9d8156b9bb1b596", "score": "0.43415397", "text": "func (ths *OrderBaseInfo) SetDeci(pd, ad int) IOrderBase {\n\tths.PriceFormat = fmt.Sprintf(\"%%.%df\", pd)\n\tths.AmountFormat = fmt.Sprintf(\"%%.%df\", ad)\n\treturn ths\n}", "title": "" }, { "docid": "48fe30cfeb26114a415369636bfb840f", "score": "0.4334362", "text": "func (inplace *InplaceDataStore) SetTile(projectID string, archiveID string, levelID int, x, y int, properties model.TileProperties,\n\tonSuccess func(properties model.TileProperties), onFailure model.FailureFunc) {\n\tinplace.in(func() {\n\t\tproject, err := inplace.workspace.Project(projectID)\n\n\t\tif err == nil {\n\t\t\tlevel := project.Archive().Level(levelID)\n\n\t\t\tlevel.SetTileProperties(x, y, properties)\n\t\t\tresult := level.TileProperties(x, y)\n\t\t\tinplace.out(func() { onSuccess(result) })\n\t\t}\n\t\tif err != nil {\n\t\t\tinplace.out(onFailure)\n\t\t}\n\t})\n}", "title": "" }, { "docid": "c00ae4ffb84a66bad44f77e6c85d9868", "score": "0.43260932", "text": "func (m *EmployeeOrgData) SetDivision(value *string)() {\n m.division = value\n}", "title": "" }, { "docid": "5e6edb231a48de70f9abb9d144daadcd", "score": "0.43215927", "text": "func (u *Unit) Set(s string) error {\n\tif s == \"\" {\n\t\treturn nil\n\t}\n\tif strings.TrimSpace(s) == \"\" {\n\t\treturn fmt.Errorf(\"expected unit: %q\", s)\n\t}\n\tif ok := units[s]; !ok {\n\t\treturn fmt.Errorf(\"invalid unit: %q\", s)\n\t}\n\n\t*u = Unit(s)\n\n\treturn nil\n}", "title": "" }, { "docid": "e1e74d4cc0aae3bb3718420004f64ee7", "score": "0.42786178", "text": "func (o *Dimension) SetValue(v *string) *Dimension {\n\tif o.Value = v; o.Value == nil {\n\t\to.nullFields = append(o.nullFields, \"Value\")\n\t}\n\treturn o\n}", "title": "" }, { "docid": "59d5ad858870f83e1a18fcced88ff30c", "score": "0.42692456", "text": "func (m *Metric) Set(name string) error {\n\t// TODO: Sanity check for invalid characters\n\tm.string = name\n\treturn nil\n}", "title": "" }, { "docid": "e10f6d25ef5eae833986a63e69eeb345", "score": "0.4242927", "text": "func (me *TxsdColValign) Set(s string) { (*xsdt.Token)(me).Set(s) }", "title": "" }, { "docid": "3a3a321be46f03e8e95af089389826e4", "score": "0.42427132", "text": "func (t *Tokenizer) SetUserDic(udic *UserDic) {\n\tt.udic = udic\n}", "title": "" }, { "docid": "b1c0e4f3494e0308ce7c869ee7f4e648", "score": "0.4238686", "text": "func (_this *DOMMatrix) SetD(value float64) {\n\tinput := value\n\t_this.Value_JS.Set(\"d\", input)\n}", "title": "" }, { "docid": "7c1f6a8248c96046d2bba3ffc96a697f", "score": "0.42359847", "text": "func (o *BrowseOp) SetDomain(s string) error {\n\to.m.Lock()\n\tdefer o.m.Unlock()\n\tif o.started {\n\t\treturn ErrStarted\n\t}\n\to.domain = s\n\treturn nil\n}", "title": "" }, { "docid": "83e84598849e93e9d901677bc0c26b27", "score": "0.42340526", "text": "func (m *PhysicianMutation) SetField(name string, value ent.Value) error {\n\tswitch name {\n\tcase physician.FieldNAME:\n\t\tv, ok := value.(string)\n\t\tif !ok {\n\t\t\treturn fmt.Errorf(\"unexpected type %T for field %s\", value, name)\n\t\t}\n\t\tm.SetNAME(v)\n\t\treturn nil\n\tcase physician.FieldEMAIL:\n\t\tv, ok := value.(string)\n\t\tif !ok {\n\t\t\treturn fmt.Errorf(\"unexpected type %T for field %s\", value, name)\n\t\t}\n\t\tm.SetEMAIL(v)\n\t\treturn nil\n\t}\n\treturn fmt.Errorf(\"unknown Physician field %s\", name)\n}", "title": "" }, { "docid": "0a188eee27a67bef5b6debaa9f8b82ac", "score": "0.42127672", "text": "func (i *Uint64Value) Set(s string) error {\n\tv, err := strconv.ParseInt(s, 0, 64)\n\t*i.pv = uint64(v)\n\ti.f = true\n\treturn err\n}", "title": "" }, { "docid": "061e63f2fe896a92c557e971d6feccbf", "score": "0.42013627", "text": "func (m *Contact) SetProfession(value *string)() {\n m.profession = value\n}", "title": "" }, { "docid": "494b9039c5a5c1bbd6bf3f68503426fc", "score": "0.41941708", "text": "func (description *Description) SetValue(value string) {\n\tdescription.value = value\n}", "title": "" }, { "docid": "64e513513411e7e50d5761d83b4c3cf8", "score": "0.41876298", "text": "func (me *TxsdRefmiscinfoClass) Set(s string) { (*xsdt.Token)(me).Set(s) }", "title": "" }, { "docid": "3e7674d383b192bb514a897f5ccf5d5b", "score": "0.4183991", "text": "func (s *Sprite) Set(pic Picture, frame Rect) {\n\ts.d.Picture = pic\n\tif frame != s.frame {\n\t\ts.frame = frame\n\t\ts.calcData()\n\t}\n}", "title": "" }, { "docid": "f0836aa391895127c85076b14fcce67e", "score": "0.41722032", "text": "func (m *DistrictMutation) SetField(name string, value ent.Value) error {\n\tswitch name {\n\tcase district.FieldDistrict:\n\t\tv, ok := value.(string)\n\t\tif !ok {\n\t\t\treturn fmt.Errorf(\"unexpected type %T for field %s\", value, name)\n\t\t}\n\t\tm.SetDistrict(v)\n\t\treturn nil\n\t}\n\treturn fmt.Errorf(\"unknown District field %s\", name)\n}", "title": "" }, { "docid": "346c2488c45dd1bb8f43dd3d4357e07f", "score": "0.41715127", "text": "func (m *Relation) SetSet(value Setable)() {\n m.set = value\n}", "title": "" }, { "docid": "4c5205b4b797d94b20dc0ff2a04fc589", "score": "0.41654095", "text": "func TravelerSetValue(traveler gdbi.Traveler, path string, val interface{}) error {\n\tnamespace := GetNamespace(path)\n\tfield := GetJSONPath(path)\n\tif field == \"\" {\n\t\treturn nil\n\t}\n\tdoc := GetDoc(traveler, namespace)\n\treturn jsonpath.JsonPathSet(doc, field, val)\n}", "title": "" }, { "docid": "d65cb5328946a61f7933d5b0c4854e3d", "score": "0.4164686", "text": "func MountSetattr(dirfd int, pathname string, flags uint, attr *MountAttr) error {\n\treturn mountSetattr(dirfd, pathname, flags, attr, unsafe.Sizeof(*attr))\n}", "title": "" }, { "docid": "69420c4f8bc37b3e780c96fc472c6210", "score": "0.41339388", "text": "func (f *kytheURI) Set(s string) error {\n\turi, err := kytheuri.Parse(s)\n\tswitch {\n\tcase err != nil:\n\t\treturn err\n\tcase uri.Corpus == \"\":\n\t\treturn errors.New(\"missing required URI field: corpus\")\n\tcase uri.Language == \"\":\n\t\treturn errors.New(\"missing required URI field: language\")\n\n\t}\n\t*f = *(*kytheURI)(uri)\n\treturn err\n}", "title": "" }, { "docid": "265d8a406254245b31119e11556fca28", "score": "0.41335627", "text": "func (this *LocalView) Set(move interface{}) { this.otherMove = move.(string) }", "title": "" }, { "docid": "3a228bd1f211b2209176f57fdeaaf322", "score": "0.41291788", "text": "func (r *mongoDBStore) SetPublicDID(d *datastore.DID) error {\n\tctx := context.Background()\n\t_, err := r.db.Collection(PublicDIDC).DeleteMany(ctx, bson.M{})\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"unable to unset public DID\")\n\t}\n\n\td.ID = d.DID.String()\n\td.Public = true\n\t_, err = r.db.Collection(PublicDIDC).InsertOne(ctx, d)\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"unable to unset public DID\")\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "95ba9e7bf951fe37bb735a142b9c9cbf", "score": "0.41283023", "text": "func (s *Sprite) SetCached(cached bool) {\n\ts.d.Cached = cached\n}", "title": "" }, { "docid": "07743ad36484545633f37c2100384bab", "score": "0.412816", "text": "func (l *LocalAccess) SetData(bytes []byte) error {\n\tvar newLocalAccess LocalAccess\n\tif err := yaml.Unmarshal(bytes, &newLocalAccess); err != nil {\n\t\treturn err\n\t}\n\tl.Path = newLocalAccess.Path\n\treturn nil\n}", "title": "" }, { "docid": "31a97f096443f0374b9fbb942bb75eec", "score": "0.41261652", "text": "func (val *uint64Value) Set(str string) error {\n\tv, err := strconv.ParseUint(str, 0, 64)\n\t*val = uint64Value(v)\n\treturn errs.Wrap(err)\n}", "title": "" }, { "docid": "fe93c5877968af986c0bc505b04f0935", "score": "0.41147733", "text": "func (me *TxsdReplaceableClass) Set(s string) { (*xsdt.Token)(me).Set(s) }", "title": "" }, { "docid": "534b9285408b946d68fd91953b99fbd3", "score": "0.41111964", "text": "func (n *NonEmptyString) Set(s string) {\n\t*n = NonEmptyString(s)\n}", "title": "" }, { "docid": "f9e9a5c424a248180622c6be4c995343", "score": "0.41105914", "text": "func SetCD(sku, title string) {\n\tcacheSet(CacheKeyCD+sku, title)\n}", "title": "" }, { "docid": "ebf34d81b6d5fc35fc824a8a24c1652a", "score": "0.40954027", "text": "func (z *Scalar) SetString(s string) error {\n\tin64, err := setString(s, scOrder[:])\n\tif err == nil {\n\t\ts := &scRaw{}\n\t\tcopy(s[:], in64[:ScalarSize/8])\n\t\tz.toMont(s)\n\t}\n\treturn err\n}", "title": "" }, { "docid": "99691f9ecb90c01462501c5c461eb81b", "score": "0.40945938", "text": "func (i *loxInstance) set(name *lang.Token, value interface{}) {\n\n\ti.fields[name.Lexeme] = value\n}", "title": "" }, { "docid": "1e543974d9c019242d2e7363ab8c28d0", "score": "0.40924928", "text": "func (x *fastReflection_AllowDenomProposal) Set(fd protoreflect.FieldDescriptor, value protoreflect.Value) {\n\tswitch fd.FullName() {\n\tcase \"regen.ecocredit.marketplace.v1.AllowDenomProposal.title\":\n\t\tx.Title = value.Interface().(string)\n\tcase \"regen.ecocredit.marketplace.v1.AllowDenomProposal.description\":\n\t\tx.Description = value.Interface().(string)\n\tcase \"regen.ecocredit.marketplace.v1.AllowDenomProposal.denom\":\n\t\tx.Denom = value.Message().Interface().(*AllowedDenom)\n\tdefault:\n\t\tif fd.IsExtension() {\n\t\t\tpanic(fmt.Errorf(\"proto3 declared messages do not support extensions: regen.ecocredit.marketplace.v1.AllowDenomProposal\"))\n\t\t}\n\t\tpanic(fmt.Errorf(\"message regen.ecocredit.marketplace.v1.AllowDenomProposal does not contain field %s\", fd.FullName()))\n\t}\n}", "title": "" }, { "docid": "d1272cdad56fd0ef5b9c27afdf72c556", "score": "0.4080326", "text": "func (z *Complex) SetString(real, imag string) *Complex {\n\tz.R.Parse(real, 0)\n\tz.I.Parse(imag, 0)\n\treturn z\n}", "title": "" }, { "docid": "e90e616073ae522a903583e3fa97a258", "score": "0.4078569", "text": "func SetString(d Datum, v string, ts time.Time) {\n\tswitch d := d.(type) {\n\tcase *String:\n\t\td.Set(v, ts)\n\tdefault:\n\t\tpanic(fmt.Sprintf(\"datum %v is not a String\", d))\n\t}\n}", "title": "" }, { "docid": "eb105687a2560aa36f7bb701fe73f135", "score": "0.40754002", "text": "func (path *Path) SetMed(med int64, doReplace bool) error {\n\n\tparseMed := func(orgMed uint32, med int64, doReplace bool) (*bgp.PathAttributeMultiExitDisc, error) {\n\t\tnewMed := &bgp.PathAttributeMultiExitDisc{}\n\t\tif doReplace {\n\t\t\tnewMed = bgp.NewPathAttributeMultiExitDisc(uint32(med))\n\t\t} else {\n\t\t\tif int64(orgMed)+med < 0 {\n\t\t\t\treturn nil, fmt.Errorf(\"med value invalid. it's underflow threshold.\")\n\t\t\t} else if int64(orgMed)+med > int64(math.MaxUint32) {\n\t\t\t\treturn nil, fmt.Errorf(\"med value invalid. it's overflow threshold.\")\n\t\t\t}\n\t\t\tnewMed = bgp.NewPathAttributeMultiExitDisc(uint32(int64(orgMed) + med))\n\t\t}\n\t\treturn newMed, nil\n\t}\n\n\tidx, attr := path.getPathAttr(bgp.BGP_ATTR_TYPE_MULTI_EXIT_DISC)\n\tif attr != nil {\n\t\tm := attr.(*bgp.PathAttributeMultiExitDisc)\n\t\tnewMed, err := parseMed(m.Value, med, doReplace)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tpath.pathAttrs[idx] = newMed\n\t} else {\n\t\tm := 0\n\t\tnewMed, err := parseMed(uint32(m), med, doReplace)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tpath.pathAttrs = append(path.pathAttrs, newMed)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "24484e08b4ac15f6214a36e74cc8fb8e", "score": "0.40750328", "text": "func (m *SubdistrictMutation) SetField(name string, value ent.Value) error {\n\tswitch name {\n\tcase subdistrict.FieldSubdistrict:\n\t\tv, ok := value.(string)\n\t\tif !ok {\n\t\t\treturn fmt.Errorf(\"unexpected type %T for field %s\", value, name)\n\t\t}\n\t\tm.SetSubdistrict(v)\n\t\treturn nil\n\t}\n\treturn fmt.Errorf(\"unknown Subdistrict field %s\", name)\n}", "title": "" }, { "docid": "541c7b1a1622e14c42d596c53bfe8e6c", "score": "0.40702346", "text": "func (g *Path) SetData(data string) error {\n\tg.DataStr = data\n\tvar err error\n\tg.Data, err = PathDataParse(data)\n\tif err != nil {\n\t\treturn err\n\t}\n\terr = PathDataValidate(&g.Pnt, &g.Data, g.Path())\n\treturn err\n}", "title": "" }, { "docid": "87a6d2f82f6312b1219b94db03207fb1", "score": "0.40626532", "text": "func (f *Field) SetString(structAddr unsafe.Pointer, val string) {\n\tresult := (*string)(unsafe.Pointer(uintptr(structAddr) + f.field.Offset))\n\t*result = val\n}", "title": "" }, { "docid": "5d20e41dfd528c9a694906ff4799db7b", "score": "0.40613216", "text": "func MakeSetOfStringsDesignator(id string) AttributeDesignator {\n\treturn MakeAttributeDesignator(MakeAttribute(id, TypeSetOfStrings))\n}", "title": "" }, { "docid": "b2296bc8f6701b2b9b0654e78df9015e", "score": "0.40564555", "text": "func (o *RegisterOp) SetDomain(s string) error {\n\to.m.Lock()\n\tdefer o.m.Unlock()\n\tif o.started {\n\t\treturn ErrStarted\n\t}\n\to.domain = s\n\treturn nil\n}", "title": "" }, { "docid": "7d9f8109dc574e68e468fb47b1e2ebe1", "score": "0.40427196", "text": "func setDaosAttribute(hdl C.daos_handle_t, at attrType, attr *attribute) error {\n\tif attr == nil {\n\t\treturn errors.Errorf(\"nil %T\", attr)\n\t}\n\n\treturn setDaosAttributes(hdl, at, attrList{attr})\n}", "title": "" }, { "docid": "07f5b4d4c6b79f3610d5e919cf1a40d5", "score": "0.4037671", "text": "func (v *syslogTarget) Set(s string) error {\n\tif v == nil {\n\t\treturn os.ErrInvalid\n\t}\n\tv.isSet = true\n\tv.addr, v.network = \"\", \"\"\n\tif len(s) > 0 && s != \"true\" { // \"true\" is a stub value for the flag without any value\n\t\tparts := strings.Split(s, \"::\")\n\t\tswitch len(parts) {\n\t\tcase 1:\n\t\t\tv.addr = strings.TrimSpace(parts[0])\n\t\t\tif len(v.addr) > 0 {\n\t\t\t\tv.network = \"unixgram\"\n\t\t\t}\n\t\tcase 2:\n\t\t\tv.network = strings.TrimSpace(parts[0])\n\t\t\tv.addr = strings.TrimSpace(parts[1])\n\t\tdefault:\n\t\t\tv.isSet = false\n\t\t\treturn os.ErrInvalid\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "8c6dbb38da1833536422d3f29a448e85", "score": "0.4035875", "text": "func (m *DrugMutation) SetField(name string, value ent.Value) error {\n\tswitch name {\n\tcase drug.FieldDrugName:\n\t\tv, ok := value.(string)\n\t\tif !ok {\n\t\t\treturn fmt.Errorf(\"unexpected type %T for field %s\", value, name)\n\t\t}\n\t\tm.SetDrugName(v)\n\t\treturn nil\n\t}\n\treturn fmt.Errorf(\"unknown Drug field %s\", name)\n}", "title": "" }, { "docid": "42a9bea924b7a5ce11d570d3b8555d6b", "score": "0.40174022", "text": "func (me *TxsdItemizedlistSpacing) Set(s string) { (*xsdt.Token)(me).Set(s) }", "title": "" }, { "docid": "2684785cd0c3ce086e8798e859a5b903", "score": "0.40141618", "text": "func (a *NetworkSlicingIndication) SetDCNI(dCNI uint8) {}", "title": "" }, { "docid": "4319abdeb232c77d9118c25d574281fe", "score": "0.4009152", "text": "func (m *DoctorMutation) SetField(name string, value ent.Value) error {\n\tswitch name {\n\tcase doctor.FieldDoctorEmail:\n\t\tv, ok := value.(string)\n\t\tif !ok {\n\t\t\treturn fmt.Errorf(\"unexpected type %T for field %s\", value, name)\n\t\t}\n\t\tm.SetDoctorEmail(v)\n\t\treturn nil\n\tcase doctor.FieldDoctorName:\n\t\tv, ok := value.(string)\n\t\tif !ok {\n\t\t\treturn fmt.Errorf(\"unexpected type %T for field %s\", value, name)\n\t\t}\n\t\tm.SetDoctorName(v)\n\t\treturn nil\n\tcase doctor.FieldDoctorTel:\n\t\tv, ok := value.(string)\n\t\tif !ok {\n\t\t\treturn fmt.Errorf(\"unexpected type %T for field %s\", value, name)\n\t\t}\n\t\tm.SetDoctorTel(v)\n\t\treturn nil\n\t}\n\treturn fmt.Errorf(\"unknown Doctor field %s\", name)\n}", "title": "" }, { "docid": "210fdf35f349c76cc093c2e5ac4f0a15", "score": "0.4006896", "text": "func (d *DockTile) SetIcon(name string) error {\n\tif _, err := os.Stat(name); err != nil && len(name) != 0 {\n\t\treturn err\n\t}\n\n\ticon := struct {\n\t\tPath string `json:\"path\"`\n\t}{\n\t\tPath: name,\n\t}\n\n\t_, err := driver.macos.RequestWithAsyncResponse(\n\t\t\"/driver/dock/icon\",\n\t\tbridge.NewPayload(icon),\n\t)\n\treturn err\n}", "title": "" }, { "docid": "21e89bfa9b99ed5f541841593b4d2991", "score": "0.40043503", "text": "func (x *fastReflection_MsgRetire_RetireCredits) Set(fd protoreflect.FieldDescriptor, value protoreflect.Value) {\n\tswitch fd.FullName() {\n\tcase \"regen.ecocredit.v1alpha1.MsgRetire.RetireCredits.batch_denom\":\n\t\tx.BatchDenom = value.Interface().(string)\n\tcase \"regen.ecocredit.v1alpha1.MsgRetire.RetireCredits.amount\":\n\t\tx.Amount = value.Interface().(string)\n\tdefault:\n\t\tif fd.IsExtension() {\n\t\t\tpanic(fmt.Errorf(\"proto3 declared messages do not support extensions: regen.ecocredit.v1alpha1.MsgRetire.RetireCredits\"))\n\t\t}\n\t\tpanic(fmt.Errorf(\"message regen.ecocredit.v1alpha1.MsgRetire.RetireCredits does not contain field %s\", fd.FullName()))\n\t}\n}", "title": "" }, { "docid": "6120b34f423391cfa0d08b42c73a09f6", "score": "0.40035883", "text": "func (s *SafeString) Set(str string) {\n\ts.mux.Lock()\n\ts.data = str\n\ts.mux.Unlock()\n}", "title": "" }, { "docid": "17b776853fbd5d3c6de0061ff82b4e03", "score": "0.4002112", "text": "func (uv *URLsValue) Set(s string) error {\n\tus := strings.Split(s, \",\")\n\tnus, err := types.NewURLs(us)\n\tif err != nil {\n\t\treturn errors.Trace(err)\n\t}\n\n\t*uv = URLsValue(nus)\n\treturn nil\n}", "title": "" }, { "docid": "74a85fbbc5accde5bf5aa353428a7714", "score": "0.39983428", "text": "func (s *DimensionKeyDetail) SetValue(v string) *DimensionKeyDetail {\n\ts.Value = &v\n\treturn s\n}", "title": "" }, { "docid": "5da175742037167cc2fc8cf3b68a96e0", "score": "0.39903265", "text": "func (me *TxsdTableOrient) Set(s string) { (*xsdt.Token)(me).Set(s) }", "title": "" }, { "docid": "3a2b04b69409be36ffda2a7f4355630d", "score": "0.3989673", "text": "func (s *ReferenceLineStaticDataConfiguration) SetValue(v float64) *ReferenceLineStaticDataConfiguration {\n\ts.Value = &v\n\treturn s\n}", "title": "" }, { "docid": "0f86bbf4f11554c91d4b49e70405ef24", "score": "0.39871344", "text": "func (tag IPv4TagName) SetString(span opentracing.Span, value string) {\n\tspan.SetTag(string(tag), value)\n}", "title": "" }, { "docid": "671e78e295149c4f5104188b5ccad1dd", "score": "0.39840803", "text": "func (me *TxsdInformaltablePgwide) Set(s string) { (*xsdt.Token)(me).Set(s) }", "title": "" }, { "docid": "ef3069eca0528b5cac4a4528134caa36", "score": "0.39746594", "text": "func (c *config) SetDomain(dom string) *config {\n\tc.Lock()\n\tc.domain = dom\n\tc.loadDomains = append(c.loadDomains, dom)\n\tc.loadDomains = UniqStrings(c.loadDomains)\n\tc.Unlock()\n\n\tc.loadStorage(true)\n\treturn c\n}", "title": "" }, { "docid": "786eacd10034a5e63dc0f6df7779a203", "score": "0.3972301", "text": "func SetFloat64(i interface{}, name string, v float64) {\n\tt := FieldValue(i, name)\n\tt.SetFloat(v)\n}", "title": "" }, { "docid": "2d5eed77d306b40078e435aea4a6c914", "score": "0.39690742", "text": "func (me *TxsdTagClass) Set(s string) { (*xsdt.Token)(me).Set(s) }", "title": "" }, { "docid": "0bba5de6328fde769095ab53a2b303da", "score": "0.39690167", "text": "func (m *NurseMutation) SetField(name string, value ent.Value) error {\n\tswitch name {\n\tcase nurse.FieldNurseEmail:\n\t\tv, ok := value.(string)\n\t\tif !ok {\n\t\t\treturn fmt.Errorf(\"unexpected type %T for field %s\", value, name)\n\t\t}\n\t\tm.SetNurseEmail(v)\n\t\treturn nil\n\tcase nurse.FieldNurseName:\n\t\tv, ok := value.(string)\n\t\tif !ok {\n\t\t\treturn fmt.Errorf(\"unexpected type %T for field %s\", value, name)\n\t\t}\n\t\tm.SetNurseName(v)\n\t\treturn nil\n\tcase nurse.FieldNurseTel:\n\t\tv, ok := value.(string)\n\t\tif !ok {\n\t\t\treturn fmt.Errorf(\"unexpected type %T for field %s\", value, name)\n\t\t}\n\t\tm.SetNurseTel(v)\n\t\treturn nil\n\tcase nurse.FieldNursePassword:\n\t\tv, ok := value.(string)\n\t\tif !ok {\n\t\t\treturn fmt.Errorf(\"unexpected type %T for field %s\", value, name)\n\t\t}\n\t\tm.SetNursePassword(v)\n\t\treturn nil\n\t}\n\treturn fmt.Errorf(\"unknown Nurse field %s\", name)\n}", "title": "" }, { "docid": "8179f5672a7d348110d93ccd2668803a", "score": "0.39689615", "text": "func (t *IDType) Set(s string) error {\n\tswitch s {\n\tcase field.TypeInt.String():\n\t\t*t = IDType(field.TypeInt)\n\tcase field.TypeInt64.String():\n\t\t*t = IDType(field.TypeInt64)\n\tcase field.TypeUint.String():\n\t\t*t = IDType(field.TypeUint)\n\tcase field.TypeUint64.String():\n\t\t*t = IDType(field.TypeUint64)\n\tcase field.TypeString.String():\n\t\t*t = IDType(field.TypeString)\n\tdefault:\n\t\treturn fmt.Errorf(\"invalid type %q\", s)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "39e3b11ea8685886b9a6de32945c07ef", "score": "0.39686576", "text": "func (o *LocalDTO) SetRefGestorTecnico(v int64) {\n\to.RefGestorTecnico.Set(&v)\n}", "title": "" }, { "docid": "cadc268edec43231e45d3284407dd0f0", "score": "0.39684692", "text": "func (r *gitRefs) Set(value string) error {\n\tgitRef, err := clone.ParseRefs(value)\n\tif err != nil {\n\t\treturn err\n\t}\n\tr.gitRefs = append(r.gitRefs, gitRef)\n\treturn nil\n}", "title": "" }, { "docid": "b02c962d54bf3e875b491dbf8daf2de5", "score": "0.3958319", "text": "func SetField(path string, fields graphql.Fields, field *graphql.Field) error {\n\tif fields == nil || field == nil {\n\t\treturn nil\n\t}\n\n\tif IsNestedPath(path) {\n\t\tparts := ParsePath(path)\n\t\tkey := parts[0]\n\n\t\ttarget, has := fields[key]\n\t\tif !has {\n\t\t\ttarget = &graphql.Field{\n\t\t\t\tName: key,\n\t\t\t\tType: graphql.NewObject(graphql.ObjectConfig{\n\t\t\t\t\tName: key,\n\t\t\t\t\tFields: make(graphql.Fields),\n\t\t\t\t}),\n\t\t\t\tResolve: func(p graphql.ResolveParams) (interface{}, error) {\n\t\t\t\t\treturn p.Source, nil\n\t\t\t\t},\n\t\t\t}\n\n\t\t\tfields[key] = target\n\t\t}\n\n\t\tnested, is := target.Type.(*graphql.Object)\n\t\tif !is {\n\t\t\treturn ErrTypeMismatch{\n\t\t\t\tType: key,\n\t\t\t\tExpected: path,\n\t\t\t}\n\t\t}\n\n\t\terr := SetFieldPath(nested, NewPath(parts[1:]), field)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\treturn nil\n\t}\n\n\tfields[path] = field\n\treturn nil\n}", "title": "" }, { "docid": "ed07bdf8b66cfde4c4cc04b7098305b5", "score": "0.39578086", "text": "func (me *TxsdOrgnameClass) Set(s string) { (*xsdt.Token)(me).Set(s) }", "title": "" }, { "docid": "67ff754b34c40bc7c4a34b8ed3f67141", "score": "0.395692", "text": "func (m *MembershipOutlierInsight) SetMember(value DirectoryObjectable)() {\n err := m.GetBackingStore().Set(\"member\", value)\n if err != nil {\n panic(err)\n }\n}", "title": "" }, { "docid": "d0be8d66e5d5389ef1023c18ea1f215b", "score": "0.3956534", "text": "func Set(uid string, Predicate string, value string, dgc *dgo.Dgraph) error {\n\tvar res response.Response\n\n\tSUid, err := hfuncs.UIDStrX(uid)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tmyg := db.NewDgraphTrasn(dgc)\n\n\tstr := fmt.Sprintf(`<%s> <%s> \"%s\" . `, SUid, Predicate, value)\n\tq := []byte(str)\n\n\tres.Data, err = myg.MutateRDF(q, \"set\")\n\tif res.HandleErr(err) {\n\t\treturn err\n\t}\n\tres.Status = response.NULL\n\tres.Code = response.OK\n\n\treturn err\n}", "title": "" }, { "docid": "20e28dde0db23678fae8473ffce5c61d", "score": "0.39564952", "text": "func (dbg *Debug) setDbus(addr, bits uint) error {\n\treturn dbg.rmwDbus(addr, bits, bits)\n}", "title": "" }, { "docid": "da4d375a36c9622194d9ffee7241ff3c", "score": "0.3954767", "text": "func (repo *ObjectRedisCache) SetString(key string, value string) {\n\n\t//Now save it\n\trepo.codec.Set(&cache.Item{\n\t\tKey: key,\n\t\tObject: value,\n\t\tExpiration: time.Hour,\n\t})\n\n}", "title": "" }, { "docid": "32d6f214c4b65c954dfd81a69e677c0f", "score": "0.3953743", "text": "func (d *Distances) Set(c *Cell, dist int) {\n\td.cells.Update(c, dist)\n}", "title": "" }, { "docid": "3998391cf549b06736f09363d5200935", "score": "0.39509246", "text": "func (a *DomainStorage) SetDelete(ctx context.Context, ID string, isDeleted bool) error {\n\t_, ok := a.domains[ID]\n\tif !ok {\n\t\treturn status.Errorf(codes.NotFound, \"Domain %v not found\", ID)\n\t}\n\ta.domains[ID].Deleted = isDeleted\n\treturn nil\n}", "title": "" }, { "docid": "747829390ec82e6c30ddf993e8b4d21b", "score": "0.39502317", "text": "func (bio *Bio) SetID(id string) error {\n\tif !strings.Contains(id, \"-\") {\n\t\treturn fmt.Errorf(\"ID should look like 13-8994: %v\", id)\n\t}\n\n\tbio.id = id\n\n\treturn nil\n}", "title": "" }, { "docid": "94c58bef2173d4b3784de3c26f4f6ad9", "score": "0.3947306", "text": "func (me *TxsdColAlign) Set(s string) { (*xsdt.Token)(me).Set(s) }", "title": "" }, { "docid": "839185da1fd9e3f9f8409b7a81b75d7a", "score": "0.39467794", "text": "func (md *GenericDINode) String() string {\n\treturn md.Ident()\n}", "title": "" }, { "docid": "b0ecced8900137d6cb8a6262d51c88cb", "score": "0.39464626", "text": "func (p *EdgeBean) SetString(key string, value string) {\n\t// Call super method\n\tIValueBean(p).SetString(key, value)\n}", "title": "" }, { "docid": "b34a7e2065b52efb41fbf8ae76ecab51", "score": "0.3945554", "text": "func (m *PrescriptionMutation) SetDoctorID(id int) {\n\tm.doctor = &id\n}", "title": "" }, { "docid": "4739a9872643f2c56240e0165eb85615", "score": "0.3944861", "text": "func (me *TxsdCitetitlePubwork) Set(s string) { (*xsdt.Token)(me).Set(s) }", "title": "" }, { "docid": "237eecfe02369b3ab49aa2e33ac1dafa", "score": "0.39425635", "text": "func (x *IdNode) Setattr(ctx context.Context, req *f.SetattrRequest, resp *f.SetattrResponse) error {\n trace(\"Setattr\", \"path\", x.Path, \"req\", *req)\n // Not Yet Implemented:\n // req.Valid.{ Handle, LockOwner, Crtime, Chgtime, Bkuptime, Flags }\n\n return FindError(\n setattrChtimes(x.Path, req),\n setattrChown(x.Path, req),\n setattrChmod(x.Path, req),\n setattrTruncate(x.Path, req),\n )\n}", "title": "" }, { "docid": "1bec6b180ce7ad3ae0d8e8fcf00d12bb", "score": "0.39323327", "text": "func (me *TxsdArticleClass) Set(s string) { (*xsdt.Token)(me).Set(s) }", "title": "" }, { "docid": "ae3a0a54172c3d2273bd57564745cb47", "score": "0.3927762", "text": "func (i *NullString) Set(v string) {\n\ti.String = v\n\ti.Valid = true\n}", "title": "" } ]
a8dc39c376b71b811c3eee28f7ce3ae5
CheckSameness checks the address are not empty or the same nolint:interfacer
[ { "docid": "462d889b99cc98fbfa1d89180c138aa4", "score": "0.7106013", "text": "func CheckSameness(s1 sdk.AccAddress, s2 sdk.AccAddress) (err sdk.Error) {\n\tif s1.Empty() || s2.Empty() {\n\t\terr = ErrAccountAddressEmpty(\"cannot have empty addresses\")\n\t\treturn\n\t}\n\n\tif s1.Equals(s2) {\n\t\terr = ErrAccountsSame(\"addresses cannot be the same\")\n\t\treturn\n\t}\n\n\treturn\n}", "title": "" } ]
[ { "docid": "ad7e43cabb05eb20a7daadc01614c5cd", "score": "0.6287347", "text": "func ValidateAddress(addr []byte) bool {\n\tif len(addr) != 25 {\n\t\treturn false\n\t}\n\tripe := addr[:21]\n\tsum := sha512.Sum384(ripe)\n\tsum = sha512.Sum384(sum[:])\n\n\tfor i := 0; i < 4; i++ {\n\t\tif sum[i] != addr[i+21] {\n\t\t\treturn false\n\t\t}\n\t}\n\n\treturn true\n}", "title": "" }, { "docid": "e9025e9e30981e14138db2d4cae54d34", "score": "0.62516695", "text": "func TestServiceEntryAddressMatch(t *testing.T) {\n\tnoValidationsShown(t, \"ratings\", \"bookinfo\")\n}", "title": "" }, { "docid": "999d4f16c5b990c35b6aab6498021b5f", "score": "0.6197366", "text": "func isAddressEqual(suite *HandlerSuite, reqAddress *primemessages.Address, respAddress *primemessages.Address) {\n\tif reqAddress.StreetAddress1 != nil && respAddress.StreetAddress1 != nil {\n\t\tsuite.Equal(*reqAddress.StreetAddress1, *respAddress.StreetAddress1)\n\t}\n\tif reqAddress.StreetAddress2 != nil && respAddress.StreetAddress2 != nil {\n\t\tsuite.Equal(*reqAddress.StreetAddress2, *respAddress.StreetAddress2)\n\t}\n\tif reqAddress.StreetAddress3 != nil && respAddress.StreetAddress3 != nil {\n\t\tsuite.Equal(*reqAddress.StreetAddress3, *respAddress.StreetAddress3)\n\t}\n\tsuite.Equal(*reqAddress.PostalCode, *respAddress.PostalCode)\n\tsuite.Equal(*reqAddress.State, *respAddress.State)\n\tsuite.Equal(*reqAddress.City, *respAddress.City)\n\n}", "title": "" }, { "docid": "c62bccbd7f161e8373d2540d169a5af0", "score": "0.6123607", "text": "func TestValidateAddress(t *testing.T) {\n\tbc := testutil.GetBTC()\n\n\ttype args struct {\n\t\taddr string\n\t}\n\ttype want struct {\n\t\tisErr bool\n\t}\n\ttests := []struct {\n\t\tname string\n\t\targs args\n\t\twant want\n\t}{\n\t\t{\n\t\t\tname: \"happy path\",\n\t\t\targs: args{\"2NFXSXxw8Fa6P6CSovkdjXE6UF4hupcTHtr\"},\n\t\t\twant: want{false},\n\t\t},\n\t\t{\n\t\t\tname: \"happy path\",\n\t\t\targs: args{\"2NDGkbQTwg2v1zP6yHZw3UJhmsBh9igsSos\"},\n\t\t\twant: want{false},\n\t\t},\n\t\t{\n\t\t\tname: \"wrong address\",\n\t\t\targs: args{\"4VHGkbQTGg2vN5P6yHZw3UJhmsBh9igsSos\"},\n\t\t\twant: want{true},\n\t\t},\n\t}\n\n\tfor _, tt := range tests {\n\t\tt.Run(tt.name, func(t *testing.T) {\n\t\t\tif got, err := bc.ValidateAddress(tt.args.addr); (err != nil) != tt.want.isErr {\n\t\t\t\tt.Errorf(\"ValidateAddress() = %v, isErr %v\", err, tt.want.isErr)\n\t\t\t} else {\n\t\t\t\tt.Log(got)\n\t\t\t}\n\t\t})\n\t}\n\n\t// bc.Close()\n}", "title": "" }, { "docid": "717e31edc707a9cbbe129782b15486dd", "score": "0.6121191", "text": "func (addr Address) IsCorrectlyFormatted() bool {\n\tif len(addr) == 0 || string(addr) == addr.GetPrefix() || len(addr.RemovePrefix()) != 60 {\n\t\treturn false\n\t}\n\n\tprefix := addr.GetPrefix()\n\tfor _, allowed := range ALLOWED_PREFIX {\n\t\tif prefix == allowed {\n\t\t\treturn true\n\t\t}\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "1f6ac56af6527991447ff506160890e7", "score": "0.6110339", "text": "func TestIsSameAddressFamily(t *testing.T) {\n\thostAddress := \"192.168.1.8/32\"\n\tnetwork := \"192.168.1.0/24\"\n\t_, cidr, err := net.ParseCIDR(network)\n\tif err != nil {\n\t\tt.Errorf(\"could not parse network\")\n\t}\n\tpref, _, err := net.ParseCIDR(hostAddress)\n\tif err != nil {\n\t\tt.Errorf(\"could not parse host address\")\n\t}\n\tif cidr.Contains(pref) != true {\n\t\tt.Errorf(\"the host address is not apart of the network address\")\n\t}\n}", "title": "" }, { "docid": "3f61b60d18108d26db33b34d36655d89", "score": "0.610245", "text": "func checkMultiAddress(pro []priorityOutput) bool {\n\tchk := make(map[int]int)\n\tfor _, p := range pro {\n\t\tchk[p.matchRes.BKRule]++\n\t}\n\tif chk[addressRule] > 1 {\n\t\treturn true\n\t}\n\treturn false\n}", "title": "" }, { "docid": "672e0ab5650362b563d416186296236e", "score": "0.6100839", "text": "func ValidateAddress(address string) bool {\n\t// Decodes address\n\tpubKeyHash := utils.Base58Decode([]byte(address))\n\tactualChecksum := pubKeyHash[len(pubKeyHash)-checksumLength:]\n\tversion := pubKeyHash[0]\n\tpubKeyHash = pubKeyHash[1 : len(pubKeyHash)-checksumLength]\n\n\t// Runs sha256 on the versioned hash twice To create a checksum\n\ttargetChecksum := Checksum(append([]byte{version}, pubKeyHash...))\n\n\treturn bytes.Compare(actualChecksum, targetChecksum) == 0\n}", "title": "" }, { "docid": "1de76ab98476bef0146432389bb85f13", "score": "0.60856646", "text": "func addraddr(pro []priorityOutput, mr *matchResult, nes map[string]struct{}, fips string) bool {\n\tif isNEState(fips, nes) && unequalZipCodes(mr.BKZip, mr.CLZip) {\n\t\treturn false\n\t}\n\tif mr.BKRule != addressRule || mr.CLRule != addressRule {\n\t\treturn false\n\t}\n\tif checkMultiAddress(pro) {\n\t\tif emptyFields(mr.BKUnitNum, mr.CLUnitNum) {\n\t\t\treturn false\n\t\t}\n\t\tif mr.BKUnitNum != mr.CLUnitNum {\n\t\t\treturn false\n\t\t}\n\t}\n\treturn true\n}", "title": "" }, { "docid": "8ea9be328091ff8f50f851d57bb0906f", "score": "0.6034696", "text": "func TestServiceEntryUnmatchingAddress(t *testing.T) {\n\tnoValidationsShown(t, \"ratings-wrong-labels\", \"bookinfo\")\n}", "title": "" }, { "docid": "f6b26aabab6d7a20f23db7083ed74658", "score": "0.603407", "text": "func ValidateAddress(address string) bool {\n\tpubKeyHash := Base58Decode([]byte(address))\n\tactualChecksum := pubKeyHash[len(pubKeyHash)-addressChecksumLen:]\n\tversion := pubKeyHash[0]\n\tpubKeyHash = pubKeyHash[1 : len(pubKeyHash)-addressChecksumLen]\n\ttargetChecksum := checksum(append([]byte{version}, pubKeyHash...))\n\n\treturn bytes.Compare(actualChecksum, targetChecksum) == 0\n}", "title": "" }, { "docid": "f3ec2f33aeb379dcb17dd7d9c655722f", "score": "0.600675", "text": "func CheckAddress(address string) error {\n\tpts := strings.Split(address, \":\")\n\tport, err := strconv.ParseUint(pts[len(pts)-1], 10, 16)\n\tif err != nil {\n\t\treturn boo.Newf(boo.InvalidInput,\n\t\t\t\"address '%s' is invalid\", string(address))\n\t}\n\tif port < 0 || port > 65535 {\n\t\treturn boo.Newf(boo.InvalidInput,\n\t\t\t\"address:%s port is invalid \", string(address))\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "26449cb994708e029d706e5bd112da8e", "score": "0.5992739", "text": "func checkAddressesFormat(addresses []string) errstack.E {\n\tvar rejects []string\n\tfor _, a := range addresses {\n\t\tif !common.IsHexAddress(a) {\n\t\t\trejects = append(rejects, a)\n\t\t}\n\t}\n\tif len(rejects) > 0 {\n\t\treturn errstack.NewReqF(\"Invalid address(es) format\", rejects)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "f262e01ff79ba592a128d9e6ca90d4a1", "score": "0.59616494", "text": "func (v *validator) CheckStreetAddresses(text string) ([]string, *errorAVA.Error) {\n\treturn match(text, regexpValidatorAVA.StreetAddressRegex)\n}", "title": "" }, { "docid": "316425af39f9cb17bedeed71379c0735", "score": "0.58222204", "text": "func checkForNewAddress(addr string) bool {\n\n\tr, _ := regexp.Compile(\"[0-9]*\\\\.[0-9]*\\\\.[0-9]*\\\\.[0-9]*\")\n\tnewAddr := r.FindString(addr)\n\tfor _, cp := range chatPeers {\n\t\toldAddr := cp.Address\n\t\tif oldAddr == newAddr {\n\t\t\treturn false\n\t\t}\n\t}\n\n\taddPeerToList(defaultName, newAddr)\n\n\treturn true\n}", "title": "" }, { "docid": "da766cbad0d406b33e6f8cda4f2087d3", "score": "0.57962626", "text": "func IsValidAddress(address string) bool {\n\treturn IsValidConsortiumAddress(address, SWTCAlphabet, constant.SWTCAccountPrefix)\n}", "title": "" }, { "docid": "959e4c258cc1e7284f40f2e0b259da32", "score": "0.57602745", "text": "func (cf Config) checkNetworkAddress(a string) bool {\n\tsl := strings.Split(a, `:`)\n\tl := len(sl)\n\tif l == 1 {\n\t\treturn false\n\t}\n\tif !(l == 2 && sl[0] == ``) {\n\t\tif ip := net.ParseIP(strings.Join(sl[:l-1], `:`)); ip == nil {\n\t\t\treturn false\n\t\t}\n\t}\n\tport, err := strconv.Atoi(sl[l-1])\n\tif err != nil || port == 10000 || port < 0 || port > 65535 {\n\t\treturn false\n\t}\n\treturn true\n}", "title": "" }, { "docid": "93703842eea0a64f1b0895522a7c9e27", "score": "0.5755419", "text": "func validateBindAddress(address string) error {\n\tl := strings.Split(address, \":\")\n\tif len(l) == 1 {\n\t\treturn validatePortNumber(l[0])\n\t} else if len(l) == 2 {\n\t\treturn validatePortNumber(l[1])\n\t} else {\n\t\treturn errors.New(\"too much sections for parameter\")\n\t}\n}", "title": "" }, { "docid": "a698e1754704d0c7c02e7da42a2dfc1d", "score": "0.57206386", "text": "func isDenyingAAAA(this *dns.AAAA, that *dns.AAAA) bool {\n\tif strings.EqualFold(this.Hdr.Name, that.Hdr.Name) {\n\t\tlog.Debug.Println(\"Same hosts\")\n\t\tif !isValidRR(this) {\n\t\t\tlog.Debug.Println(\"Invalid record produces conflict\")\n\t\t\treturn true\n\t\t}\n\n\t\tswitch compareIP(this.AAAA.To16(), that.AAAA.To16()) {\n\t\tcase -1:\n\t\t\tlog.Debug.Println(\"Lexicographical earlier\")\n\t\t\tbreak\n\t\tcase 1:\n\t\t\tlog.Debug.Println(\"Lexicographical later\")\n\t\t\treturn true\n\t\tdefault:\n\t\t\tlog.Debug.Println(\"No conflict\")\n\t\t\tbreak\n\t\t}\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "01d4232ead4080f1420097fe7a0d4215", "score": "0.571644", "text": "func (conf HadoopConf) CheckTypeOfNameAddressString(maybe_addr string) TypeOfNamenodeAddressString {\n\t// if address is \"Host:Port\" style\n\tif strings.Contains(maybe_addr, \":\") {\n\t\treturn TNAS_SimpleAddress\n\t}\n\t// check is there any mounttable\n\tprefix := \"fs.viewfs.mounttable.\" + maybe_addr + \".link.\"\n\tfor key, _ := range conf {\n\t\tif strings.HasPrefix(key, prefix) {\n\t\t\treturn TNAS_ViewfsNameServiceID\n\t\t}\n\t}\n\t// check is it a NameServiceID\n\tnsids_str, _ := conf[\"dfs.nameservices\"]\n\tnsids := strings.Split(nsids_str, \",\")\n\tfor _, v := range nsids {\n\t\tif maybe_addr == v {\n\t\t\treturn TNAS_SimpleNameServiceID\n\t\t}\n\t}\n\t// check is there any HA nodes\n\tif _, ok := conf[\"dfs.ha.namenodes.\"+maybe_addr]; ok {\n\t\treturn TNAS_SimpleNameServiceID\n\t}\n\t// fallback to simple address\n\treturn TNAS_SimpleAddress\n}", "title": "" }, { "docid": "b73582e758fb0bff58500fa72901b57d", "score": "0.567955", "text": "func (s *HelperSuite) TestAddresses() {\n\t// Setup\n\ts.po.getSlot(\"a\")\n\ts.po.getSlot(\"b\")\n\n\t// Verification\n\taddrs := s.po.Addresses()\n\ts.Require().NotEmpty(addrs)\n\ts.Assert().Len(addrs, 2)\n}", "title": "" }, { "docid": "55b5aa35c449809037b9d8161455af64", "score": "0.56677693", "text": "func (m *Multisig) ValidateAddress(addr Trytes, digests []Trytes) (bool, error) {\n\tk := kerl.NewKerl()\n\n\tfor i := range digests {\n\t\tdigestTrits, err := TrytesToTrits(digests[i])\n\t\tif err != nil {\n\t\t\treturn false, err\n\t\t}\n\t\tif err := k.Absorb(digestTrits); err != nil {\n\t\t\treturn false, err\n\t\t}\n\t}\n\n\taddressTrits, err := k.Squeeze(HashTrinarySize)\n\tif err != nil {\n\t\treturn false, err\n\t}\n\treturn MustTritsToTrytes(addressTrits) == addr, nil\n}", "title": "" }, { "docid": "b6ac6b8815ad2d371e2ead02952e82c1", "score": "0.5659822", "text": "func (a Address) Valid() (ok bool) {\n\tif len(string(a)) < 3 || len(string(a)) > 64 {\n\t\treturn false\n\t}\n\tif bad, err := regexp.MatchString(`(?:--|@@|@.*@|-@|@-|^-|-$)`, string(a)); bad || err != nil {\n\t\treturn false\n\t}\n\tif match, err := regexp.MatchString(`^[a-zA-Z0-9-]+[@][a-zA-Z0-9-]+$`, string(a)); err != nil || !match {\n\t\treturn false\n\t}\n\treturn true\n}", "title": "" }, { "docid": "77b12869a03660a0d165e5d35b54e0d1", "score": "0.56494707", "text": "func TestServiceEntryMissesWorkloadAddress(t *testing.T) {\n\tvalidationsShown(t, \"ratings-missing\", \"bookinfo\")\n}", "title": "" }, { "docid": "730df9775f325d0cd3612bd9e5250166", "score": "0.56338274", "text": "func (e *Validator) ValidateAddress(address string, isTestnet bool) (isValid bool, msg string) {\n\tif isValidNonChecksumAddress(address) {\n\t\tnoPrefixAddr := address[2:]\n\t\tif (strings.ToUpper(noPrefixAddr) == noPrefixAddr) || (strings.ToLower(noPrefixAddr) == noPrefixAddr) {\n\t\t\treturn true, \"\"\n\t\t}\n\t\tchecksumAddress, err := e.ToChecksumAddress(address)\n\t\tif err != nil || checksumAddress != address {\n\t\t\treturn false, \"Invalid checksum\"\n\t\t}\n\t\treturn true, \"\"\n\t}\n\treturn false, \"Invalid format\"\n}", "title": "" }, { "docid": "fd7e52035afe35afd440f485abf56568", "score": "0.561325", "text": "func TestAddressInUse(t *testing.T) {\n\tctrl := &mockControl{}\n\toutPort, inPort := findFreeLocalTCPPorts(t)\n\tport := vpnkit.Port{\n\t\tOutIP: localhost,\n\t\tOutPort: outPort,\n\t\tInIP: localhost,\n\t\tInPort: inPort,\n\t\tProto: vpnkit.TCP,\n\t}\n\tf1, err := ctrl.Forwarder.Make(ctrl, port)\n\tassert.Nil(t, err)\n\tf2, err := ctrl.Forwarder.Make(ctrl, port)\n\tif !strings.HasSuffix(err.Error(), \"bind: address already in use\") {\n\t\tt.Errorf(\"expected an address-already-in-use type of error: %v\", err)\n\t}\n\tassert.Nil(t, f2)\n\tf1.Stop()\n}", "title": "" }, { "docid": "42ef242bf6df7c8948074b5076739f4c", "score": "0.5600553", "text": "func consideredSafe(addr string) bool {\n\tsafePrefixes := []string{\n\t\t\"unix:\",\n\t\t\"systemd:\",\n\t\t\"launchd:\",\n\t\t\"127.0.0.1:\",\n\t\t\"[::1]:\",\n\t\t\"localhost:\",\n\t}\n\tfor _, prefix := range safePrefixes {\n\t\tif strings.HasPrefix(addr, prefix) {\n\t\t\treturn true\n\t\t}\n\t}\n\treturn false\n}", "title": "" }, { "docid": "67d0d146fab7d8bb9bb0e7fa3a0adf8c", "score": "0.5596332", "text": "func checkAddrs(addrs []string) error {\n\t_, err := teleutils.Strings(addrs).Addrs(0)\n\treturn trace.Wrap(err)\n}", "title": "" }, { "docid": "85822b169f7cbc510abdceedfba27509", "score": "0.5584249", "text": "func (c *appContext) addressExists(w http.ResponseWriter, r *http.Request) {\n\taddresses, err := m.GetAddressRawCtx(r, c.Params)\n\tif err != nil {\n\t\tapiLog.Errorf(\"addressExists rejecting request: %v\", err)\n\t\thttp.Error(w, \"address parsing error\", http.StatusBadRequest)\n\t\treturn\n\t}\n\t// GetAddressCtx throws an error if there would be no addresses.\n\tstrMask, err := c.nodeClient.ExistsAddresses(context.TODO(), addresses)\n\tif err != nil {\n\t\tlog.Warnf(\"existsaddress error: %v\", err)\n\t\thttp.Error(w, http.StatusText(422), 422)\n\t}\n\tb, err := hex.DecodeString(strMask)\n\tif err != nil {\n\t\tlog.Warnf(\"existsaddress error: %v\", err)\n\t\thttp.Error(w, http.StatusText(422), 422)\n\t}\n\tmask := binary.LittleEndian.Uint64(append(b, make([]byte, 8-len(b))...))\n\texists := make([]bool, 0, len(addresses))\n\tfor n := range addresses {\n\t\texists = append(exists, (mask&(1<<uint8(n))) != 0)\n\t}\n\twriteJSON(w, exists, m.GetIndentCtx(r))\n}", "title": "" }, { "docid": "a6d42bed73fd09046e4134664193f2cb", "score": "0.55821186", "text": "func EnsureAddr(link netlink.Link, expect *netlink.Addr) (bool, error) {\n\tvar changed bool\n\n\taddrList, err := netlink.AddrList(link, NetlinkFamily(expect.IP))\n\tif err != nil {\n\t\treturn false, fmt.Errorf(\"error list address from if %s, %w\", link.Attrs().Name, err)\n\t}\n\n\tfound := false\n\tfor _, addr := range addrList {\n\t\tif !addr.IP.IsGlobalUnicast() {\n\t\t\tcontinue\n\t\t}\n\n\t\tif (addr.IPNet.String() == expect.IPNet.String()) && (addr.Scope == expect.Scope) {\n\t\t\tfound = true\n\t\t\tcontinue\n\t\t}\n\n\t\terr := AddrDel(link, &addr)\n\t\tif err != nil {\n\t\t\treturn false, err\n\t\t}\n\t\tchanged = true\n\t}\n\tif found {\n\t\treturn changed, nil\n\t}\n\treturn true, AddrReplace(link, expect)\n}", "title": "" }, { "docid": "618166648e98bb69089d6da6d6b0c5e0", "score": "0.55462956", "text": "func (v *Stellar) ValidateAddress(addr string, network NetworkType) *Result {\n\tif isValid := v.IsAddressFormatValid(addr, network); !isValid {\n\t\treturn &Result{Success, false, Unknown, \"\"}\n\t}\n\n\taddrType, err := v.Client.GetAccount(addr)\n\tif err != nil {\n\t\treturn &Result{Failure, false, Unknown, err.Error()}\n\t}\n\n\tif addrType == Unknown {\n\t\treturn &Result{Success, false, Unknown, \"\"}\n\t}\n\n\treturn &Result{Success, true, addrType, \"\"}\n}", "title": "" }, { "docid": "cafb275b4b250653aa3b09f8bd66acf4", "score": "0.55431473", "text": "func TestCoverAddressMarshaling(t *testing.T) {\n\tcs, r := noClustering(NullLogger)\n\tdefer cs.Terminate()\n\tdefer r.Terminate()\n\n\ta := &Address{}\n\ta.connectionServer = cs\n\n\tb, err := a.MarshalBinary()\n\tif b != nil || err != ErrIllegalAddressFormat {\n\t\tt.Fatalf(\"Wrong error from marshaling binary of empty address #%v, #%v\", b, err)\n\t}\n\n\ta = &Address{}\n\terr = a.UnmarshalBinary([]byte(\"<\"))\n\tif err != ErrIllegalAddressFormat {\n\t\tt.Fatal(\"Wrong error from unmarshaling illegal binary mailbox\")\n\t}\n\n\ta, m1 := connections.NewMailbox()\n\tdefer m1.Terminate()\n\n\ta2, m2 := connections.NewMailbox()\n\tdefer m2.Terminate()\n\n\ta2.UnmarshalFromID(a.mailboxID)\n\ta2.connectionServer = connections\n\ta2.Send(\"test\")\n\n\tmsg, ok := m1.ReceiveNextAsync()\n\tif !ok {\n\t\tt.Fatal(\"Mailbox received nothing\")\n\t}\n\tif !reflect.DeepEqual(msg, \"test\") {\n\t\tt.Fatal(\"Can't unmarshal a local address from an ID correctly.\")\n\t}\n\n\terr = a.UnmarshalText([]byte(\"<23456789012345678901234\"))\n\tif err != ErrIllegalAddressFormat {\n\t\tt.Fatal(\"fails the length check on normal mailboxes\")\n\t}\n\terr = a.UnmarshalText([]byte(\"\\\"moo\"))\n\tif err != ErrIllegalAddressFormat {\n\t\tt.Fatal(\"fails to properly check registry mailboxes in text for quotes\")\n\t}\n\n\ta = &Address{}\n\t_, err = a.MarshalText()\n\tif err == nil {\n\t\tt.Fatal(\"can marshal nonexistant address to Text\")\n\t}\n}", "title": "" }, { "docid": "2960943bc1c1f0fc177eac259dd9559e", "score": "0.554181", "text": "func (service *ProviderControlService) checkMpeAddress(mpeAddress string) error {\n\tpassedAddress := common.HexToAddress(mpeAddress)\n\tif !(service.mpeAddress == passedAddress) {\n\t\treturn fmt.Errorf(\"the mpeAddress: %s passed does not match to what has been registered\", mpeAddress)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "65283f92e1bf8b86845297b246eb38c9", "score": "0.55209386", "text": "func (s *PublicRpcAPI) ValidateAddress(address string) (bool, error) {\n\t_, err := asiutil.DecodeAddress(address)\n\tif err != nil {\n\t\t// Return false if error occurs.\n\t\treturn false, nil\n\t}\n\n\treturn true, nil\n}", "title": "" }, { "docid": "8c0e29378ce943942437b146213905ca", "score": "0.5497868", "text": "func checkCoinAddress(c currency.Currency, address string, testnet bool) (string, error) {\n\tif \"\" == address {\n\t\treturn \"\", ErrRequiredCurrencyAddress\n\t}\n\terr := c.ValidateAddress(address, testnet)\n\treturn address, err\n}", "title": "" }, { "docid": "a86cd5afa9000f4a748e04a9ef97e749", "score": "0.54858863", "text": "func (s *PeerServer) checkPeerAddressNonconflict() bool {\n\t// there exists the (name, peer address) pair\n\tif peerURL, ok := s.registry.PeerURL(s.Config.Name); ok {\n\t\tif peerURL == s.Config.URL {\n\t\t\treturn true\n\t\t}\n\t}\n\n\t// check all existing peer addresses\n\tpeerURLs := s.registry.PeerURLs(s.raftServer.Leader(), s.Config.Name)\n\tfor _, peerURL := range peerURLs {\n\t\tif peerURL == s.Config.URL {\n\t\t\treturn false\n\t\t}\n\t}\n\treturn true\n}", "title": "" }, { "docid": "41107207e0249f5ef34983af45a84ff3", "score": "0.54785043", "text": "func (account *AccountJSON) ValidAddress(toAddress *common.Address) error {\n\tif util.Contains(account.Exclusions, toAddress.Hex()) {\n\t\treturn fmt.Errorf(\"%s is excludeded by this account\", toAddress.Hex())\n\t}\n\n\tif len(account.Inclusions) > 0 && !util.Contains(account.Inclusions, toAddress.Hex()) {\n\t\treturn fmt.Errorf(\"%s is not in the set of inclusions of this account\", toAddress.Hex())\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "442868c769f441f990f79bf0506047a3", "score": "0.5476502", "text": "func SeemsValidAddr(addr string) bool {\n\tvar seenAt, seenDom, seenDot, seenTld bool\n\n\tfor _, char := range addr {\n\t\tswitch char {\n\t\tcase '@':\n\t\t\tif seenAt { // more than one '@'\n\t\t\t\treturn false\n\t\t\t}\n\t\t\tseenAt = true\n\t\tcase '.':\n\t\t\tseenDot = seenAt && seenDom // only care about '.' after '@' and domain name\n\t\tdefault:\n\t\t\tif '!' > char || char > '~' {\n\t\t\t\treturn false\n\t\t\t}\n\t\t\tif seenAt {\n\t\t\t\t// https://tools.ietf.org/html/rfc5322#section-3.4.1\n\t\t\t\tif char == '[' || char == ']' || char == '\\\\' {\n\t\t\t\t\treturn false\n\t\t\t\t}\n\t\t\t\tseenDom = !seenDot\n\t\t\t\tseenTld = seenDot\n\t\t\t}\n\t\t}\n\t}\n\treturn seenTld\n}", "title": "" }, { "docid": "f3a44f0e5f5375de77801d7569bf3514", "score": "0.54651475", "text": "func addressMatcher(bk *bkData, indxr *indexerGCV, fips string, logger *log.Logger, cfg *Config) ([]*matchResult, bool) {\n\tif emptyFields(bk.PropHOUSENBR, bk.PropSTREETNAME, bk.PropCITY, bk.PropSTATE) {\n\t\treturn nil, false\n\t}\n\n\tHseNum := bk.PropHOUSENBR\n\tStrtName := bk.PropSTREETNAME\n\tCity := bk.PropCITY\n\tState := bk.PropSTATE\n\tUnitNum := bk.PropUNITNBR\n\n\tmr := make([]*matchResult, 0)\n\n\tif addrVal, ok := indxr.Get(gcvKey{\n\t\tHseNum: HseNum,\n\t\tStrtName: StrtName,\n\t\tCity: City,\n\t\tState: State,\n\t\tUnitNum: UnitNum,\n\t}); ok {\n\t\tfor _, addr := range addrVal {\n\t\t\tmr = append(mr, &matchResult{\n\t\t\t\tFIPS: fips,\n\t\t\t\tMatchVal: fmt.Sprintf(\"%s %s %s %s %s\",\n\t\t\t\t\tHseNum,\n\t\t\t\t\tStrtName,\n\t\t\t\t\tCity,\n\t\t\t\t\tState,\n\t\t\t\t\tUnitNum,\n\t\t\t\t),\n\t\t\t\tDPID: bk.DPID,\n\t\t\t\tSAPID: addr.SAPID,\n\t\t\t\tBKCol: nullInt,\n\t\t\t\tCLCol: nullInt,\n\t\t\t\tBKRule: addressRule,\n\t\t\t\tCLRule: addressRule,\n\t\t\t\tBKHseNum: HseNum,\n\t\t\t\tCLHseNum: addr.HseNum,\n\t\t\t\tBKZip: bk.PropZIP,\n\t\t\t\tCLZip: addr.Zip,\n\t\t\t})\n\t\t}\n\t\treturn mr, true\n\t}\n\treturn nil, false\n}", "title": "" }, { "docid": "3698603808b3ea791c1cf95ed1651dff", "score": "0.54480135", "text": "func checkSubnet(APIstub shim.ChaincodeStubInterface, prefix string, ipType int) (bool, bool) {\n\tresultsIterator, _ := APIstub.GetStateByPartialCompositeKey(\"MASK\", []string{})\n\t//100.10.10.10/24 = 100.10.10.0/24\n\t//100.10.10.30/25 = 100.10.10.0/25\n\t//Loop to go through every IP prefix stored\n\tfor resultsIterator.HasNext() {\n\t\tqueryResponse, _ := resultsIterator.Next()\n\n\t\t_, compositeKeyParts, _ := APIstub.SplitCompositeKey(queryResponse.GetKey())\n\n\t\t//Reconstruct according to the IP type that is stored\n\t\tvar reconstructedPrefix string\n\t\tif len(compositeKeyParts) == 5 {\n\t\t\treconstructedPrefix = reconstructPrefix(compositeKeyParts, 0)\n\t\t} else if len(compositeKeyParts) == 9 {\n\t\t\treconstructedPrefix = reconstructPrefix(compositeKeyParts, 1)\n\t\t}\n\n\t\t//reconstructedPrefix := reconstructPrefix(compositeKeyParts, ipType)\n\t\tfoundIP, foundPrefix, _ := net.ParseCIDR(reconstructedPrefix)\n\t\tfoundMask, _ := strconv.Atoi(strings.Split(foundPrefix.String(), \"/\")[1])\n\t\tgivenIP, givenPrefix, _ := net.ParseCIDR(prefix)\n\t\tgivenMask, _ := strconv.Atoi(strings.Split(givenPrefix.String(), \"/\")[1])\n\n\t\tfmt.Println(\"found prefix: \" + foundPrefix.String())\n\t\tfmt.Println(\"given prefix: \" + givenPrefix.String())\n\n\t\t//Given prefix and found prefix are the same - WON'T BE INSERTED BUT AS PATH CAN BE UPDATED\n\t\tif givenPrefix.String() == foundPrefix.String() {\n\t\t\treturn true, true\n\t\t}\n\n\t\t//Given prefix is a supernet of one already in the blockchain - CAN'T BE INSERTED\n\t\tif givenPrefix.Contains(foundIP) && givenMask < foundMask {\n\t\t\treturn true, false\n\t\t}\n\n\t\t//Given prefix is a subtnet of one already in the blockchain - CAN BE INSERTED IN THE BLOCKCHAIN (IP LIST ONLY)\n\t\tif foundPrefix.Contains(givenIP) {\n\t\t\treturn false, true\n\t\t}\n\t}\n\t//Given prefix isn't a subnet or a supernet of a stored one - CAN BE INSERTED IN THE BLOCKCHAIN (BOTH IP AND MASK LISTS)\n\treturn false, false\n}", "title": "" }, { "docid": "57e60e405904ea2c66b4ec05f52576a5", "score": "0.54474723", "text": "func IsValidAddress(address string) bool {\n\treturn regexp.MustCompile(\"^0x[0-9a-fA-F]{40}$\").MatchString(address)\n}", "title": "" }, { "docid": "7ec8b984a5dff3ecf8e7cf8e769c181a", "score": "0.54470533", "text": "func (o *PrincipalMatch) GetAddressOk() (*string, bool) {\n\tif o == nil || o.Address == nil {\n\t\treturn nil, false\n\t}\n\treturn o.Address, true\n}", "title": "" }, { "docid": "6304046994cca23138926f51a59d3cf9", "score": "0.5438473", "text": "func TestIsValid(t *testing.T) {\n\tt.Parallel()\n\n\tfor _, addr := range validAddrs {\n\t\tna := NetAddress(addr)\n\t\tif err := na.IsValid(); err != nil {\n\t\t\tt.Errorf(\"IsValid returned non-nil for valid NetAddress %q: %v\", addr, err)\n\t\t}\n\t}\n\tfor _, addr := range invalidAddrs {\n\t\tna := NetAddress(addr)\n\t\tif err := na.IsValid(); err == nil {\n\t\t\tt.Errorf(\"IsValid returned nil for an invalid NetAddress %q: %v\", addr, err)\n\t\t}\n\t}\n}", "title": "" }, { "docid": "9c267403fd6bd5ba0e540ad34f585a7e", "score": "0.54311645", "text": "func validateInitialStakedFunds(config *Config) error {\n\tif len(config.InitialStakedFunds) == 0 {\n\t\treturn errors.New(\"initial staked funds cannot be empty\")\n\t}\n\n\tallocationSet := ids.ShortSet{}\n\tinitialStakedFundsSet := ids.ShortSet{}\n\tfor _, allocation := range config.Allocations {\n\t\t// It is ok to have duplicates as different\n\t\t// ethAddrs could claim to the same avaxAddr.\n\t\tallocationSet.Add(allocation.AVAXAddr)\n\t}\n\n\tfor _, staker := range config.InitialStakedFunds {\n\t\tif initialStakedFundsSet.Contains(staker) {\n\t\t\tavaxAddr, err := formatting.FormatAddress(\n\t\t\t\tconfigChainIDAlias,\n\t\t\t\tconstants.GetHRP(config.NetworkID),\n\t\t\t\tstaker.Bytes(),\n\t\t\t)\n\t\t\tif err != nil {\n\t\t\t\treturn fmt.Errorf(\n\t\t\t\t\t\"unable to format address from %s\",\n\t\t\t\t\tstaker.String(),\n\t\t\t\t)\n\t\t\t}\n\n\t\t\treturn fmt.Errorf(\n\t\t\t\t\"address %s is duplicated in initial staked funds\",\n\t\t\t\tavaxAddr,\n\t\t\t)\n\t\t}\n\t\tinitialStakedFundsSet.Add(staker)\n\t\tfmt.Println(\"Initial Staker Fund Set addition: \", staker)\n\n\t\tif !allocationSet.Contains(staker) {\n\t\t\tavaxAddr, err := formatting.FormatAddress(\n\t\t\t\tconfigChainIDAlias,\n\t\t\t\tconstants.GetHRP(config.NetworkID),\n\t\t\t\tstaker.Bytes(),\n\t\t\t)\n\t\t\tif err != nil {\n\t\t\t\treturn fmt.Errorf(\n\t\t\t\t\t\"unable to format address from %s\",\n\t\t\t\t\tstaker.String(),\n\t\t\t\t)\n\t\t\t}\n\n\t\t\treturn fmt.Errorf(\n\t\t\t\t\"address %s does not have an allocation to stake\",\n\t\t\t\tavaxAddr,\n\t\t\t)\n\t\t}\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "6a06ab0f8c923548a8694abd668b5d75", "score": "0.5414021", "text": "func IsVacationAddress(address string) bool {\n\tif address == \"\" {\n\t\treturn false\n\t}\n\tuser_domain := strings.Split(address, \"@\")\n\tfmt.Println(\"-------------------\", address, user_domain)\n\tif len(user_domain) == 0 {\n\t\treturn false\n\t}\n\tif user_domain[1] == Conf.VacationDomain {\n\t\treturn true\n\t}\n\treturn false\n}", "title": "" }, { "docid": "c59c45c02331ecd3b78b7a2a71305b87", "score": "0.5403292", "text": "func TestServiceEntryMoreAddresses(t *testing.T) {\n\tnoValidationsShown(t, \"ratings-surplus\", \"bookinfo\")\n}", "title": "" }, { "docid": "4d2232b434f9a9b2a8244308119eaa96", "score": "0.5384507", "text": "func IsValidConsortiumAddress(address string, alphabet *base58.Alphabet, accountPrefix uint8) bool {\n\tif address == \"\" {\n\t\treturn false\n\t}\n\n\t_, err := utils.DecodeAddress(address, alphabet, accountPrefix)\n\tif err != nil {\n\t\treturn false\n\t}\n\treturn true\n}", "title": "" }, { "docid": "cbb89b2f493a429d2076318d4da08619", "score": "0.5373902", "text": "func (o *IpAddressRange) GetAddressOk() (*string, bool) {\n\tif o == nil {\n\t\treturn nil, false\n\t}\n\treturn &o.Address, true\n}", "title": "" }, { "docid": "4274b7b888894bbb3ed33e10969030ab", "score": "0.53733426", "text": "func scanAddress(addrStr string) (addr types.UnlockHash, err error) {\n\terr = addr.LoadString(addrStr)\n\treturn\n}", "title": "" }, { "docid": "2d6361f845b913e235b097db27ec55ab", "score": "0.53721654", "text": "func (m *EdgeManager) verifyConflict(cidr1, cidr2 string) bool {\n\tsp := strings.Split(cidr1, \"/\")\n\tif len(sp) != 2 {\n\t\tlog.Error(\"invalid cidr format: %s\", cidr1)\n\t\treturn false\n\t}\n\n\tip1, sprefix1 := sp[0], sp[1]\n\tprefix1, err := strconv.Atoi(sprefix1)\n\tif err != nil {\n\t\tlog.Error(\"invalid cidr format: %s\", cidr1)\n\t\treturn false\n\t}\n\n\tipv41, err := ip.ParseIP4(ip1)\n\tif err != nil {\n\t\tlog.Error(\"invalid cidr format: %s\", cidr1)\n\t\treturn false\n\t}\n\n\tsp = strings.Split(cidr2, \"/\")\n\tif len(sp) != 2 {\n\t\tlog.Error(\"invalid cidr format: %s\", cidr2)\n\t\treturn false\n\t}\n\n\tip2, sprefix2 := sp[0], sp[1]\n\tprefix2, err := strconv.Atoi(sprefix2)\n\tif err != nil {\n\t\tlog.Error(\"invalid cidr format: %s\", cidr2)\n\t\treturn false\n\t}\n\n\tipv42, err := ip.ParseIP4(ip2)\n\tif err != nil {\n\t\tlog.Error(\"invalid cidr format: %s\", cidr2)\n\t\treturn false\n\t}\n\n\tipn1 := ip.IP4Net{\n\t\tIP: ipv41,\n\t\tPrefixLen: uint(prefix1),\n\t}\n\tipn2 := ip.IP4Net{\n\t\tIP: ipv42,\n\t\tPrefixLen: uint(prefix2),\n\t}\n\n\treturn !ipn1.Overlaps(ipn2)\n}", "title": "" }, { "docid": "6e7de063c69c5696a3c3bb38e997d740", "score": "0.53513116", "text": "func Valid(addr string) bool {\n\tif len(addr) > 320 { // RFC 3696 says it's 320, not 255.\n\t\treturn false\n\t}\n\n\tmbox, domain, err := Split(addr)\n\tif err != nil {\n\t\treturn false\n\t}\n\n\t// The only case where this can be true is \"postmaster\".\n\t// So allow it.\n\tif domain == \"\" {\n\t\treturn true\n\t}\n\n\treturn ValidMailboxName(mbox) && ValidDomain(domain)\n}", "title": "" }, { "docid": "09e4db229730acbf5f522f10c1825a44", "score": "0.5341124", "text": "func TestGetAddressInfo(t *testing.T) {\n\t// t.SkipNow()\n\tbc := testutil.GetBTC()\n\n\ttype args struct {\n\t\taddr string\n\t}\n\ttype want struct {\n\t\terr error\n\t}\n\ttests := []struct {\n\t\tname string\n\t\targs args\n\t\twant want\n\t}{\n\t\t{\n\t\t\tname: \"happy path\",\n\t\t\targs: args{\"mvTRCKpKVUUv3QgMEn838xXDDZS5SSEhnj\"},\n\t\t\twant: want{nil},\n\t\t},\n\t\t{\n\t\t\tname: \"happy path\",\n\t\t\targs: args{\"n3f97rFX5p1vbwKqkdhjT6QjaiqBw6TfxQ\"},\n\t\t\twant: want{nil},\n\t\t},\n\t\t{\n\t\t\tname: \"happy path\",\n\t\t\targs: args{\"n3f97rFX5p1vbwKqkdhjT6QjaiqBw6TfxQ\"},\n\t\t\twant: want{nil},\n\t\t},\n\t}\n\n\tfor _, tt := range tests {\n\t\tt.Run(tt.name, func(t *testing.T) {\n\t\t\tres, err := bc.GetAddressInfo(tt.args.addr)\n\t\t\tif err != tt.want.err {\n\t\t\t\tt.Errorf(\"GetAddressInfo() = %v, want %v\", err, tt.want.err)\n\t\t\t}\n\t\t\tt.Log(res)\n\t\t})\n\t}\n\t// bc.Close()()()\n}", "title": "" }, { "docid": "f9597927a207c23eec0aa0451512142e", "score": "0.5340965", "text": "func HasValidOwnership(issuerPub string, addresses ...string) ([]string, bool) {\n\tinvalid := make([]string, 0)\n\tprefix := issuerPub[0:30]\n\tfor _, address := range addresses {\n\t\tif address[6:30] != prefix {\n\t\t\tinvalid = append(invalid, address)\n\t\t}\n\t}\n\n\treturn invalid, len(invalid) == 0\n}", "title": "" }, { "docid": "3cb23051c771a1e2c93f88666073e54f", "score": "0.53186065", "text": "func WalletAddressCheck(addr string) string {\n\toutput := sdksource.WalletAddressCheck(addr)\n\treturn output\n}", "title": "" }, { "docid": "8301eb51e283f7583e277880eb059ddb", "score": "0.531505", "text": "func TestTypeAddress(t *testing.T) {\n\tt.Parallel() //RUN TEST PARALLEL\n\n\tadressesTest := []AddressTest{\n\t\t{\"Rua ABC\", \"Rua\"},\n\t\t{\"Avenida Paulista\", \"Avenida\"},\n\t\t{\"Rodovia dos Imigrantes\", \"Rodovia\"},\n\t\t{\"Praça das Rosas\", \"Invalid type\"},\n\t\t{\"RUA DOS BOBOS\", \"Rua\"},\n\t\t{\"AVENIDA REBOUÇAS\", \"Avenida\"},\n\t\t{\"\", \"Invalid type\"},\n\t}\n\n\tfor _, address := range adressesTest {\n\t\treturnReceived := TypeAddress(address.Address)\n\t\tif returnReceived != address.ExpectedReturn {\n\t\t\tt.Errorf(\"The type received %s is different from the expected %s\",\n\t\t\t\treturnReceived,\n\t\t\t\taddress.ExpectedReturn,\n\t\t\t)\n\t\t}\n\t}\n}", "title": "" }, { "docid": "f02f57c7019a96cf1a154221f6934b65", "score": "0.53138363", "text": "func isPrivateAddress(address string) (bool, error) {\n\tipAddress := net.ParseIP(address)\n\tif ipAddress == nil {\n\t\treturn false, errors.New(\"address is not valid\")\n\t}\n\n\tfor i := range cidrs {\n\t\tif cidrs[i].Contains(ipAddress) {\n\t\t\treturn true, nil\n\t\t}\n\t}\n\n\treturn false, nil\n}", "title": "" }, { "docid": "3d056341cfcbd2961f9eae46431fcb7d", "score": "0.5313603", "text": "func (me TpostaladdressTypeType) IsStreet() bool { return me.String() == \"street\" }", "title": "" }, { "docid": "8bafacc35af914c0799459db7bd08490", "score": "0.5311726", "text": "func (v *Classzz) ValidateAddress(addr string, network NetworkType) *Result {\n\tif addrType := v.CashAddrType(addr, network); addrType != Unknown {\n\t\treturn &Result{Success, true, addrType, \"\"}\n\t}\n\n\treturn &Result{Success, false, Unknown, \"\"}\n}", "title": "" }, { "docid": "957fbc20195fe68923b068968a9b2f41", "score": "0.52902144", "text": "func existsAddress(ns walletdb.ReadBucket, addressID []byte) bool {\n\tbucket := ns.NestedReadBucket(addrBucketName)\n\n\taddrHash := sha256.Sum256(addressID)\n\treturn bucket.Get(addrHash[:]) != nil\n}", "title": "" }, { "docid": "2dc9d30e650e8ebbfd9a6588fe13e7fd", "score": "0.52530026", "text": "func TestIsValid(t *testing.T) {\n\ttestSet := []struct {\n\t\tquery NetAddress\n\t\tdesiredResponse bool\n\t}{\n\t\t// Networks such as 10.0.0.x have been omitted from testing - behavior\n\t\t// for these networks is currently undefined.\n\n\t\t// Localhost tests.\n\t\t{\"localhost\", false},\n\t\t{\"localhost:1234\", true},\n\t\t{\"127.0.0.1\", false},\n\t\t{\"127.0.0.1:6723\", true},\n\t\t{\"::1\", false},\n\t\t{\"[::1]:7124\", true},\n\n\t\t// Public name tests.\n\t\t{\"hn.com\", false},\n\t\t{\"hn.com:8811\", true},\n\t\t{\"12.34.45.64\", false},\n\t\t{\"12.34.45.64:7777\", true},\n\t\t{\"::1:4646\", false},\n\t\t{\"plain\", false},\n\t\t{\"plain:6432\", true},\n\n\t\t// Garbage name tests.\n\t\t{\"\", false},\n\t\t{\"garbage:6146:616\", false},\n\t\t{\"[::1]\", false},\n\t\t// {\"google.com:notAPort\", false}, TODO: Failed test case.\n\t}\n\tfor _, test := range testSet {\n\t\tif test.query.IsValid() != test.desiredResponse {\n\t\t\tt.Error(\"test failed:\", test, test.query.IsValid())\n\t\t}\n\t}\n}", "title": "" }, { "docid": "91be38a83af780ad766bd01665faf27c", "score": "0.5252139", "text": "func assertAddr(t *testing.T, got, expected *wire.NetAddress) {\n\tif got.Services != expected.Services {\n\t\tt.Fatalf(\"expected address services %v, got %v\",\n\t\t\texpected.Services, got.Services)\n\t}\n\tif !got.IP.Equal(expected.IP) {\n\t\tt.Fatalf(\"expected address IP %v, got %v\", expected.IP, got.IP)\n\t}\n\tif got.Port != expected.Port {\n\t\tt.Fatalf(\"expected address port %d, got %d\", expected.Port,\n\t\t\tgot.Port)\n\t}\n}", "title": "" }, { "docid": "d9611eada75fe6d71f82df06dd106084", "score": "0.52500075", "text": "func isWildcardAddress(ip net.IP) bool {\n\tswitch ip.String() {\n\tcase \"0.0.0.0\":\n\t\treturn true\n\n\tcase \"::\":\n\t\treturn true\n\n\tdefault:\n\t\treturn false\n\t}\n}", "title": "" }, { "docid": "81af22346360006e68e007e353699384", "score": "0.5248468", "text": "func IsOwnerAddressByStub(accountAddress word256.Word256, stub shim.ChaincodeStubInterface) error {\n\tclientIdent, err := cid.New(stub)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\treturn IsOwnerAddressByClientId(accountAddress, clientIdent)\n}", "title": "" }, { "docid": "3cc77a7130963ab8e6ef03c7fd7ca9fa", "score": "0.52450067", "text": "func validateAddress(email string) bool {\n\t_, err := mail.ParseAddress(email)\n\treturn err == nil\n}", "title": "" }, { "docid": "3c697632479b7ceb4a3a11c40f29178a", "score": "0.52410686", "text": "func assertAddr(t *testing.T, got, expected *wire.NetAddressV2) {\n\tif got.Services != expected.Services {\n\t\tt.Fatalf(\"expected address services %v, got %v\",\n\t\t\texpected.Services, got.Services)\n\t}\n\tgotAddr := got.Addr.String()\n\texpectedAddr := expected.Addr.String()\n\tif gotAddr != expectedAddr {\n\t\tt.Fatalf(\"expected address IP %v, got %v\", expectedAddr,\n\t\t\tgotAddr)\n\t}\n\tif got.Port != expected.Port {\n\t\tt.Fatalf(\"expected address port %d, got %d\", expected.Port,\n\t\t\tgot.Port)\n\t}\n}", "title": "" }, { "docid": "70685f1672b88d1592eed4c5f363726d", "score": "0.5232792", "text": "func IsValidContractAddress(address string) bool {\n\treturn common.IsHexAddress(address)\n}", "title": "" }, { "docid": "695f3bd86e78f4e28a67f0e7bcc8980c", "score": "0.5231895", "text": "func (ka *KnownAddress) isBad() bool {\n\t// just tried in one minute? This isn't suitable for very few peers.\n\t//if ka.lastattempt.After(lastActive.Now().Add(-1 * lastActive.Minute)) {\n\t//\treturn true\n\t//}\n\n\t// Over a month old?\n\tif ka.srcAddr.Timestamp.Before(time.Now().Add(-1 * numMissingDays * time.Hour * 24)) {\n\t\treturn true\n\t}\n\n\t// Just disconnected in one minute? This isn't suitable for very few peers.\n\t//if ka.lastDisconnect.After(lastActive.Now().Add(-1 * lastActive.Minute)) {\n\t//\treturn true\n\t//}\n\n\t// tried too many times?\n\tif ka.attempts >= numRetries {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "7eb1f9f99bfe0fe6103637ca309ba8ba", "score": "0.5230268", "text": "func checkAdvertiseAddress(packages pack.PackageService) error {\n\t// Use the runtime package label to determine the current advertise address.\n\tlocator, err := pack.FindInstalledConfigPackage(packages, loc.Planet)\n\tif err != nil {\n\t\treturn trace.Wrap(err)\n\t}\n\tenvelope, err := packages.ReadPackageEnvelope(*locator)\n\tif err != nil {\n\t\treturn trace.Wrap(err)\n\t}\n\tadvertiseIP := envelope.RuntimeLabels[pack.AdvertiseIPLabel]\n\tif advertiseIP == \"\" {\n\t\tlog.Warnf(\"No %v label on %v.\", pack.AdvertiseIPLabel, envelope)\n\t\treturn nil\n\t}\n\tifaces, err := systeminfo.NetworkInterfaces()\n\tif err != nil {\n\t\treturn trace.Wrap(err)\n\t}\n\tvar ips []string\n\tfor _, iface := range ifaces {\n\t\tips = append(ips, iface.IPv4)\n\t}\n\tfor _, ip := range ips {\n\t\tif ip == advertiseIP {\n\t\t\treturn nil\n\t\t}\n\t}\n\treturn trace.NotFound(`The cluster node is configured with advertise address %v but it's not present on the machine.\nAvailable addresses are: %v.\nIf you wish to reconfigure the node to use a different advertise address, use \"gravity start --advertise-addr=<new-ip>\" command.`, advertiseIP, ips)\n}", "title": "" }, { "docid": "f7b12ddee608ecd02ac2b7426b13793e", "score": "0.520987", "text": "func (dcr *ExchangeWallet) ValidateAddress(address string) bool {\n\t_, err := stdaddr.DecodeAddress(address, dcr.chainParams)\n\treturn err == nil\n}", "title": "" }, { "docid": "7f779ca7541c7d55caeb6716211b753c", "score": "0.5207333", "text": "func IsAddressable(gvr schema.GroupVersionResource, name string, timing ...time.Duration) feature.StepFn {\n\treturn func(ctx context.Context, t feature.T) {\n\t\tinterval, timeout := PollTimings(ctx, timing)\n\t\tvar lastError error\n\t\terr := wait.PollImmediate(interval, timeout, func() (bool, error) {\n\t\t\taddr, err := Address(ctx, gvr, name)\n\t\t\tif err != nil {\n\t\t\t\tlastError = err\n\t\t\t\tif apierrors.IsNotFound(err) {\n\t\t\t\t\t// keep polling\n\t\t\t\t\treturn false, nil\n\t\t\t\t}\n\t\t\t\treturn false, err\n\t\t\t}\n\t\t\tif addr == nil {\n\t\t\t\tlastError = fmt.Errorf(\"%s %s has no status.address.url %w\", gvr, name, err)\n\t\t\t\treturn false, nil\n\t\t\t}\n\n\t\t\t// Success!\n\t\t\treturn true, nil\n\t\t})\n\t\tif err != nil {\n\t\t\tt.Fatalf(\"%s %s did not become addressable %v: %w\", gvr, name, err, lastError)\n\t\t}\n\t}\n}", "title": "" }, { "docid": "f25868ac32da6a05fabdd98ff1557e9d", "score": "0.5205364", "text": "func checkAddrInPrefix(addr string, prefix string, maskBits int) (bool, error) {\n\ta, err := convertDotStringToUint32(addr)\n\tif err != nil {\n\t\treturn false, err\n\t}\n\n\tp, err := convertDotStringToUint32(prefix)\n\tif err != nil {\n\t\treturn false, err\n\t}\n\n\tm := convertMaskbitToUint32(maskBits)\n\n\tresult := p&m == a&m\n\n\treturn result, nil\n}", "title": "" }, { "docid": "f81070a5d43f3a8be1dcdeb7c5cc1511", "score": "0.5198416", "text": "func (v *updateMTOServiceItemData) checkSITDestinationOriginalAddress(_ appcontext.AppContext) error {\n\tif v.updatedServiceItem.SITDestinationOriginalAddress == nil {\n\t\treturn nil // SITDestinationOriginalAddress isn't being updated, so we're fine here\n\t}\n\n\tif v.oldServiceItem.SITDestinationOriginalAddressID == nil {\n\t\tv.verrs.Add(\"SITDestinationOriginalAddress\", \"cannot be manually set\")\n\t\treturn nil // returning here to avoid nil pointer dereference error\n\t}\n\n\tif *v.oldServiceItem.SITDestinationOriginalAddressID != uuid.Nil &&\n\t\tv.updatedServiceItem.SITDestinationOriginalAddress != nil &&\n\t\tv.updatedServiceItem.SITDestinationOriginalAddress.ID != *v.oldServiceItem.SITDestinationOriginalAddressID {\n\t\tv.verrs.Add(\"SITDestinationOriginalAddress\", \"cannot be updated\")\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "ce50669c49a8d225175c6ec4007f9271", "score": "0.51958674", "text": "func (d *AntreaIPAM) Check(args *invoke.Args, k8sArgs *argtypes.K8sArgs, networkConfig []byte) (bool, error) {\n\tmine, allocator, err := d.owns(k8sArgs)\n\tif err != nil {\n\t\treturn mine, err\n\t}\n\tif !mine {\n\t\t// pass this request to next driver\n\t\treturn false, nil\n\t}\n\n\towner := getAllocationOwner(args, k8sArgs)\n\tfound, err := allocator.HasContainer(owner.Pod.ContainerID)\n\tif err != nil {\n\t\treturn true, err\n\t}\n\n\tif !found {\n\t\treturn true, fmt.Errorf(\"no IP Address association found for container %s\", string(k8sArgs.K8S_POD_NAME))\n\t}\n\n\treturn true, nil\n}", "title": "" }, { "docid": "e72d9e3092a935fa67e62011a4165457", "score": "0.51942664", "text": "func maybePCI(addr string) bool {\n\tcomps := strings.Split(addr, \":\")\n\tif len(comps) != 3 {\n\t\treturn false\n\t}\n\treturn (len(comps[0]) == 6 || len(comps[0]) == 4) && len(comps[1]) == 2 && len(comps[2]) >= 2\n}", "title": "" }, { "docid": "b4f0292da900d067e352575089a6c8d2", "score": "0.5175462", "text": "func ValidateAndParseMainnetAddress(address string) common.Address {\n\tcAddr := cfxaddress.MustNew(address, uint32(constants.Mainnet))\n\treturn cAddr.MustGetCommonAddress()\n}", "title": "" }, { "docid": "766cabe050b11f1a43ae2b814f7392fd", "score": "0.51694393", "text": "func (s *Client) addressKnown(na *wire.NetAddress) bool {\n\ts.mu.Lock()\n\t_, exists := s.knownAddresses[addrmgr.NetAddressKey(na)]\n\ts.mu.Unlock()\n\treturn exists\n}", "title": "" }, { "docid": "7bdef06b1e97c0bc9be61bdaecb9a7dc", "score": "0.5164759", "text": "func isIPv4(address string) bool {\n\treturn strings.Count(address, \":\") < 2\n}", "title": "" }, { "docid": "c09b00d737e0f5d5bcffbf0930a15bdd", "score": "0.51637805", "text": "func (spd *Stakepoold) ValidateAddress(ctx context.Context, address string) (*wallettypes.ValidateAddressWalletResult, error) {\n\taddr, err := dcrutil.DecodeAddress(address, spd.Params)\n\tif err != nil {\n\t\tlog.Errorf(\"ValidateAddress: ValidateAddress rpc failed: %v\", err)\n\t\treturn nil, err\n\t}\n\n\tresponse, err := spd.WalletConnection.RPCClient().ValidateAddress(ctx, addr)\n\tif err != nil {\n\t\tlog.Errorf(\"ValidateAddress: ValidateAddress rpc failed: %v\", err)\n\t\treturn nil, err\n\t}\n\n\treturn response, nil\n}", "title": "" }, { "docid": "3cc42914a15265b002fba1ae495e9d73", "score": "0.5162349", "text": "func validateBootstrap(upstream Upstream) (err error) {\n\tswitch upstream := upstream.(type) {\n\tcase *dnsCrypt:\n\t\treturn nil\n\tcase *dnsOverTLS:\n\t\t_, err = netip.ParseAddr(upstream.addr.Hostname())\n\tcase *dnsOverHTTPS:\n\t\t_, err = netip.ParseAddr(upstream.addr.Hostname())\n\tcase *dnsOverQUIC:\n\t\t_, err = netip.ParseAddr(upstream.addr.Hostname())\n\tcase *plainDNS:\n\t\t_, err = netip.ParseAddr(upstream.addr.Hostname())\n\tdefault:\n\t\terr = fmt.Errorf(\"unknown upstream type: %T\", upstream)\n\t}\n\n\treturn errors.Annotate(err, \"bootstrap %s: %w\", upstream.Address())\n}", "title": "" }, { "docid": "9c9c809585b96554e2fb2777304be2b4", "score": "0.5152786", "text": "func IsHexAddress(s string) bool {\n\tif hasHexPrefix(s) {\n\t\ts = s[2:]\n\t}\n\treturn len(s) == 2*AddressLength && isHex(s)\n}", "title": "" }, { "docid": "9c9c809585b96554e2fb2777304be2b4", "score": "0.5152786", "text": "func IsHexAddress(s string) bool {\n\tif hasHexPrefix(s) {\n\t\ts = s[2:]\n\t}\n\treturn len(s) == 2*AddressLength && isHex(s)\n}", "title": "" }, { "docid": "4cf89bc6e2b3a595add9f92ccaf3660f", "score": "0.5147498", "text": "func CheckBech32Address(address string) (*BitcoinAddressType, error) {\n\tnetworkPrefix, decoded, err := bech32.Decode(address)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\t// https://en.bitcoin.it/wiki/BIP_0173\n\t// https://github.com/bitcoin/bips/blob/master/bip-0141.mediawiki#p2wpkh\n\twitnessVersion := decoded[0]\n\tif int(witnessVersion) < 0 || int(witnessVersion) > 16 {\n\t\treturn nil, errors.New(\"Invalid witness version\")\n\t}\n\n\tbody := decoded[1:]\n\tbody, err = bech32.ConvertBits(body, 5, 8, false)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tsegwitType, err := bip0141Type(body)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tif network, exists := bech32PrefixNetwork[networkPrefix]; exists {\n\t\treturn &BitcoinAddressType{\n\t\t\tAddress: address,\n\t\t\tIsBech32: true,\n\t\t\tType: segwitType,\n\t\t\tNetwork: network,\n\t\t}, nil\n\t}\n\n\treturn nil, errors.New(\"Invalid network prefix\")\n}", "title": "" }, { "docid": "d16b7e52078b202e5a4d2491bef19ef0", "score": "0.5145758", "text": "func (v *validator) CheckAddressEth(address string) ([]string, *errorAVA.Error) {\n\treturn match(address, regexpValidatorAVA.AddressEthereumRegex)\n}", "title": "" }, { "docid": "035a27179a0d88dfa94d3f06c2085a06", "score": "0.513881", "text": "func TestReceiverStreetAddressAlphaNumeric(t *testing.T) {\n\ttestReceiverStreetAddressAlphaNumeric(t)\n}", "title": "" }, { "docid": "56d159832752e29ae54018b87df55cc4", "score": "0.5136764", "text": "func IsAddressActive(proto, addr string) bool {\n\tdialer := &net.Dialer{Timeout: time.Second * 1}\n\tif _, err := dialer.Dial(proto, addr); err != nil {\n\t\treturn false\n\t}\n\treturn true\n}", "title": "" }, { "docid": "629356de0769bc2749e3418363a3b113", "score": "0.5134045", "text": "func CheckStateInvariants(st *State, store adt.Store) (*StateSummary, *builtin.MessageAccumulator) {\n\tacc := &builtin.MessageAccumulator{}\n\n\tacc.Require(len(st.NetworkName) > 0, \"network name is empty\")\n\tacc.Require(st.NextID >= builtin.FirstNonSingletonActorId, \"next id %d is too low\", st.NextID)\n\n\tinitSummary := &StateSummary{\n\t\tAddrIDs: nil,\n\t\tNextID: st.NextID,\n\t}\n\n\tlut, err := adt.AsMap(store, st.AddressMap, builtin.DefaultHamtBitwidth)\n\tif err != nil {\n\t\tacc.Addf(\"error loading address map: %v\", err)\n\t\t// Stop here, it's hard to make other useful checks.\n\t\treturn initSummary, acc\n\t}\n\n\tinitSummary.AddrIDs = map[addr.Address]abi.ActorID{}\n\treverse := map[abi.ActorID]addr.Address{}\n\tvar value cbg.CborInt\n\terr = lut.ForEach(&value, func(key string) error {\n\t\tactorId := abi.ActorID(value)\n\t\tkeyAddr, err := addr.NewFromBytes([]byte(key))\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\tacc.Require(keyAddr.Protocol() != addr.ID, \"key %v is an ID address\", keyAddr)\n\t\tacc.Require(keyAddr.Protocol() <= addr.BLS, \"unknown address protocol for key %v\", keyAddr)\n\t\tacc.Require(actorId >= builtin.FirstNonSingletonActorId, \"unexpected singleton ID value %v\", actorId)\n\n\t\tfoundAddr, found := reverse[actorId]\n\t\tacc.Require(!found, \"duplicate mapping to ID %v: %v, %v\", actorId, keyAddr, foundAddr)\n\t\treverse[actorId] = keyAddr\n\n\t\tinitSummary.AddrIDs[keyAddr] = actorId\n\t\treturn nil\n\t})\n\tacc.RequireNoError(err, \"error iterating address map\")\n\treturn initSummary, acc\n}", "title": "" }, { "docid": "e26750b5ad536290c64376883049de43", "score": "0.51315033", "text": "func canonicalizeInlineAddress(line string) (bool, string, string, string) {\n\t// Massage old-style addresses into newstyle\n\tline = strings.Replace(line, \"(\", \"<\", -1)\n\tline = strings.Replace(line, \")\", \">\", -1)\n\t// And another kind of quirks\n\tline = strings.Replace(line, \"&lt;\", \"<\", -1)\n\tline = strings.Replace(line, \"&gt;\", \">\", -1)\n\t// Deal with some address masking that can interfere with next stages\n\tline = strings.Replace(line, \"<at>\", \"@\", -1)\n\tline = strings.Replace(line, \"<dot>\", \".\", -1)\n\t// Line must contain an email address. Find it.\n\taddrStart := strings.LastIndex(line, \"<\")\n\taddrEnd := strings.Index(line[addrStart+1:], \">\") + addrStart + 1\n\tif addrStart < 0 || addrEnd <= addrStart {\n\t\treturn false, \"\", \"\", \"\"\n\t}\n\t// Remove all other < and > delimiters to avoid malformed attributions\n\t// After the address, they can be dropped, but before them might come\n\t// legit parentheses that were converted above.\n\tpre := strings.Replace(\n\t\tstrings.Replace(line[:addrStart], \"<\", \"(\", -1),\n\t\t\">\", \")\", -1)\n\tpost := strings.Replace(line[addrEnd+1:], \">\", \"\", -1)\n\temail := line[addrStart+1 : addrEnd]\n\t// Detect more types of address masking\n\temail = strings.Replace(email, \" at \", \"@\", -1)\n\temail = strings.Replace(email, \" dot \", \".\", -1)\n\temail = strings.Replace(email, \" @ \", \"@\", -1)\n\temail = strings.Replace(email, \" . \", \".\", -1)\n\t// We require exactly one @ in the address, and none outside\n\tif strings.Count(email, \"@\") != 1 ||\n\t\tstrings.Count(pre, \"@\")+strings.Count(post, \"@\") > 0 {\n\t\treturn false, \"\", \"\", \"\"\n\t}\n\treturn true, pre, fmt.Sprintf(\"<%s>\", strings.TrimSpace(email)), post\n}", "title": "" }, { "docid": "07f11f938c584de9e20f395d272d7d55", "score": "0.51294595", "text": "func HandleAddressListSuccessfully(t *testing.T) {\n\tth.Mux.HandleFunc(\"/servers/asdfasdfasdf/ips\", func(w http.ResponseWriter, r *http.Request) {\n\t\tth.TestMethod(t, r, \"GET\")\n\t\tth.TestHeader(t, r, \"X-Auth-Token\", client.TokenID)\n\n\t\tw.Header().Add(\"Content-Type\", \"application/json\")\n\t\tfmt.Fprintf(w, `{\n\t\t\t\"addresses\": {\n\t\t\t\t\"public\": [\n\t\t\t\t{\n\t\t\t\t\t\"version\": 4,\n\t\t\t\t\t\"addr\": \"50.56.176.35\"\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\t\"version\": 6,\n\t\t\t\t\t\"addr\": \"2001:4800:790e:510:be76:4eff:fe04:84a8\"\n\t\t\t\t}\n\t\t\t\t],\n\t\t\t\t\"private\": [\n\t\t\t\t{\n\t\t\t\t\t\"version\": 4,\n\t\t\t\t\t\"addr\": \"10.180.3.155\"\n\t\t\t\t}\n\t\t\t\t]\n\t\t\t}\n\t\t}`)\n\t})\n}", "title": "" }, { "docid": "22cb55240e52080ff6e6658819b7503e", "score": "0.51267284", "text": "func CheckTargetAddress(address model.LabelValue) error {\n\t// For now check for a URL, we may want to expand this later.\n\tif strings.Contains(string(address), \"/\") {\n\t\treturn fmt.Errorf(\"%q is not a valid hostname\", address)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "a81433c79b9e4cc773ab5b4de8e7e303", "score": "0.5105428", "text": "func hasABBA(str string) bool {\n\tif len(str) < 4 {\n\t\treturn false\n\t}\n\tfor i := 1; i < len(str)-2; i++ {\n\t\tif str[i] == str[i-1] {\n\t\t\tcontinue\n\t\t}\n\t\tif str[i] == str[i+1] && str[i-1] == str[i+2] {\n\t\t\treturn true\n\t\t}\n\t}\n\treturn false\n}", "title": "" }, { "docid": "bb1ea2b940b8a38d39214c6fd98bed31", "score": "0.51023924", "text": "func (a *Address) IsEmpty() bool {\n\tif a == nil {\n\t\treturn true\n\t}\n\n\tfor _, additionalLine := range a.AdditionalAddressLines {\n\t\tif additionalLine != \"\" {\n\t\t\treturn false\n\t\t}\n\t}\n\n\tif a.Vat != \"\" ||\n\t\ta.Firstname != \"\" ||\n\t\ta.Lastname != \"\" ||\n\t\ta.MiddleName != \"\" ||\n\t\ta.Title != \"\" ||\n\t\ta.Salutation != \"\" ||\n\t\ta.Street != \"\" ||\n\t\ta.StreetNr != \"\" ||\n\t\ta.Company != \"\" ||\n\t\ta.City != \"\" ||\n\t\ta.PostCode != \"\" ||\n\t\ta.State != \"\" ||\n\t\ta.RegionCode != \"\" ||\n\t\ta.Country != \"\" ||\n\t\ta.CountryCode != \"\" ||\n\t\ta.Telephone != \"\" ||\n\t\ta.Email != \"\" {\n\n\t\treturn false\n\t}\n\n\treturn true\n}", "title": "" }, { "docid": "04d482285381dad816d5d5a7e8d6c114", "score": "0.50991994", "text": "func existsAddress(ns walletdb.ReadBucket, scope *KeyScope, addressID []byte) bool {\n\tscopedBucket, err := fetchReadScopeBucket(ns, scope)\n\tif err != nil {\n\t\treturn false\n\t}\n\n\tbucket := scopedBucket.NestedReadBucket(addrBucketName)\n\n\taddrHash := sha256.Sum256(addressID)\n\treturn bucket.Get(addrHash[:]) != nil\n}", "title": "" }, { "docid": "a96fffa15cfe5b6453b6578992b8250d", "score": "0.5086607", "text": "func compareSEEntry(a *zeroconf.ServiceEntry, b *zeroconf.ServiceEntry) bool {\n\tif a.HostName != b.HostName {\n\t\treturn false\n\t}\n\n\tif a.Port != b.Port {\n\t\treturn false\n\t}\n\n\tif a.TTL != b.TTL {\n\t\treturn false\n\t}\n\n\tif len(a.Text) != len(b.Text) {\n\t\treturn false\n\t} else {\n\t\tfor _, aEntry := range a.Text {\n\t\t\tfor _, bEntry := range b.Text {\n\t\t\t\tif aEntry != bEntry {\n\t\t\t\t\treturn false\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\tif len(a.AddrIPv4) != len(b.AddrIPv4) {\n\t\treturn false\n\t} else {\n\t\tfor _, aAddr := range a.AddrIPv4 {\n\t\t\tfor _, bAddr := range b.AddrIPv4 {\n\t\t\t\tif !aAddr.Equal(bAddr) {\n\t\t\t\t\treturn false\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\tif len(a.AddrIPv6) != len(b.AddrIPv6) {\n\t\treturn false\n\t} else {\n\t\tfor _, aAddr := range a.AddrIPv6 {\n\t\t\tfor _, bAddr := range b.AddrIPv6 {\n\t\t\t\tif !aAddr.Equal(bAddr) {\n\t\t\t\t\treturn false\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\treturn true\n}", "title": "" }, { "docid": "fd13749034ff833768750c2debd18a78", "score": "0.5079473", "text": "func (*Bgp_Neighbor_AfiSafi_Prefixes) IsYANGGoStruct() {}", "title": "" }, { "docid": "f65512b08502951e5ef1f9a332890620", "score": "0.50702596", "text": "func (m *Address) Validate(formats strfmt.Registry) error {\n\treturn nil\n}", "title": "" }, { "docid": "bfdbca1847237a74c16f21144e17bf45", "score": "0.50683326", "text": "func Validate(address string) error {\r\n\tprefix, _, err := bchutil.DecodeCashAddress(address)\r\n\tif err != nil {\r\n\t\treturn err\r\n\t}\r\n\tif prefix != \"bitcoincash\" {\r\n\t\treturn errors.New(\"Invalid prefix\")\r\n\t}\r\n\treturn nil\r\n}", "title": "" }, { "docid": "4d117915a8ebdc62f9a688d3c6f7da70", "score": "0.5064823", "text": "func IsValidReserve(address sdk.Address) bool {\n\tfor _, resStr := range constants.RESERVE_ACCOUNTS {\n\t\tdecoded, err := hex.DecodeString(resStr)\n\t\tif err != nil {\n\t\t\tpanic(err)\n\t\t}\n\t\tif bytes.Equal(address[:], decoded) {\n\t\t\treturn true\n\t\t}\n\t}\n\treturn false\n}", "title": "" }, { "docid": "6201793029b7acc3791d64b82f63e68f", "score": "0.5060945", "text": "func validateSTIEnvironment(address string) error {\n\tresp, err := http.Get(\"http://\" + address)\n\tif err != nil {\n\t\treturn err\n\t}\n\tdefer resp.Body.Close()\n\tbody, err := ioutil.ReadAll(resp.Body)\n\tif strings.TrimSpace(string(body)) != \"success\" {\n\t\treturn fmt.Errorf(\"Expected 'success' got '%v'\", body)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "5156fb8c53baccfe8de307f1e9b2943f", "score": "0.5057746", "text": "func TestExtendedLockedOutput_Address(t *testing.T) {\n\tt.Run(\"CASE: Address is signature backed\", func(t *testing.T) {\n\t\taddy := randEd25119Address()\n\t\to := &ExtendedLockedOutput{address: addy}\n\t\tassert.True(t, o.Address().Equals(addy))\n\t})\n\n\tt.Run(\"CASE: Address is alias address\", func(t *testing.T) {\n\t\taddy := randAliasAddress()\n\t\to := &ExtendedLockedOutput{address: addy}\n\t\tassert.True(t, o.Address().Equals(addy))\n\t})\n}", "title": "" }, { "docid": "b73bee1dc567837263e6f56e8749ddfd", "score": "0.50490427", "text": "func (o *IdentityMatchUser) GetAddressOk() (*AddressDataNullableNoRequiredFields, bool) {\n\tif o == nil {\n\t\treturn nil, false\n\t}\n\treturn o.Address.Get(), o.Address.IsSet()\n}", "title": "" } ]
f705114f18564431e5fb5efcfb09e0b5
GetBitLockerDisableWarningForOtherDiskEncryptionOk returns a tuple with the BitLockerDisableWarningForOtherDiskEncryption field if it's nonnil, zero value otherwise and a boolean to check if the value has been set.
[ { "docid": "7648ecba23e1c2e5f4fd637822c42d57", "score": "0.86788523", "text": "func (o *Windows10EndpointProtectionConfiguration) GetBitLockerDisableWarningForOtherDiskEncryptionOk() (bool, bool) {\n\tif o == nil || o.BitLockerDisableWarningForOtherDiskEncryption == nil {\n\t\tvar ret bool\n\t\treturn ret, false\n\t}\n\treturn *o.BitLockerDisableWarningForOtherDiskEncryption, true\n}", "title": "" } ]
[ { "docid": "a9dc4b65cf59953ccedc9d81ccc88590", "score": "0.86327386", "text": "func (o *MicrosoftGraphWindows10EndpointProtectionConfiguration) GetBitLockerDisableWarningForOtherDiskEncryptionOk() (bool, bool) {\n\tif o == nil || o.BitLockerDisableWarningForOtherDiskEncryption == nil {\n\t\tvar ret bool\n\t\treturn ret, false\n\t}\n\treturn *o.BitLockerDisableWarningForOtherDiskEncryption, true\n}", "title": "" }, { "docid": "ca3e6fefe8a63015c608f5d5fed55d97", "score": "0.8448231", "text": "func (o *Windows10EndpointProtectionConfiguration) GetBitLockerDisableWarningForOtherDiskEncryption() bool {\n\tif o == nil || o.BitLockerDisableWarningForOtherDiskEncryption == nil {\n\t\tvar ret bool\n\t\treturn ret\n\t}\n\treturn *o.BitLockerDisableWarningForOtherDiskEncryption\n}", "title": "" }, { "docid": "c1764ba2052fa121f546e5bcd53ae018", "score": "0.8306377", "text": "func (o *MicrosoftGraphWindows10EndpointProtectionConfiguration) GetBitLockerDisableWarningForOtherDiskEncryption() bool {\n\tif o == nil || o.BitLockerDisableWarningForOtherDiskEncryption == nil {\n\t\tvar ret bool\n\t\treturn ret\n\t}\n\treturn *o.BitLockerDisableWarningForOtherDiskEncryption\n}", "title": "" }, { "docid": "d2f3bdaef7d5c6c381077064819882b4", "score": "0.80211294", "text": "func (o *Windows10EndpointProtectionConfiguration) SetBitLockerDisableWarningForOtherDiskEncryption(v bool) {\n\to.BitLockerDisableWarningForOtherDiskEncryption = &v\n}", "title": "" }, { "docid": "df620c9ad2a9df0c6adf62cc2cdb0454", "score": "0.7949889", "text": "func (o *MicrosoftGraphWindows10EndpointProtectionConfiguration) SetBitLockerDisableWarningForOtherDiskEncryption(v bool) {\n\to.BitLockerDisableWarningForOtherDiskEncryption = &v\n}", "title": "" }, { "docid": "b983c33b5c8ad488a66e01d24d9899b3", "score": "0.7940264", "text": "func (m *Windows10EndpointProtectionConfiguration) GetBitLockerDisableWarningForOtherDiskEncryption()(*bool) {\n val, err := m.GetBackingStore().Get(\"bitLockerDisableWarningForOtherDiskEncryption\")\n if err != nil {\n panic(err)\n }\n if val != nil {\n return val.(*bool)\n }\n return nil\n}", "title": "" }, { "docid": "ab2e4a89c2f811d76c56492471d9289f", "score": "0.7580289", "text": "func (o *Windows10EndpointProtectionConfiguration) HasBitLockerDisableWarningForOtherDiskEncryption() bool {\n\tif o != nil && o.BitLockerDisableWarningForOtherDiskEncryption != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "cd3aed029641908ea7e347e48de6b4f0", "score": "0.74595803", "text": "func (o *MicrosoftGraphWindows10EndpointProtectionConfiguration) HasBitLockerDisableWarningForOtherDiskEncryption() bool {\n\tif o != nil && o.BitLockerDisableWarningForOtherDiskEncryption != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "3b0d4a45ea03e02ec4cd698af5420022", "score": "0.74409395", "text": "func (m *Windows10EndpointProtectionConfiguration) SetBitLockerDisableWarningForOtherDiskEncryption(value *bool)() {\n err := m.GetBackingStore().Set(\"bitLockerDisableWarningForOtherDiskEncryption\", value)\n if err != nil {\n panic(err)\n }\n}", "title": "" }, { "docid": "f99d68c215fca1466935a509e88b83ca", "score": "0.54248327", "text": "func (d *Downtime) GetDisabledOk() (bool, bool) {\n\tif d == nil || d.Disabled == nil {\n\t\treturn false, false\n\t}\n\treturn *d.Disabled, true\n}", "title": "" }, { "docid": "9c49fd40c9f6a6c642e2d06469bf4c33", "score": "0.5306653", "text": "func (o *CreditW2) GetOtherOk() (*string, bool) {\n\tif o == nil {\n\t\treturn nil, false\n\t}\n\treturn o.Other.Get(), o.Other.IsSet()\n}", "title": "" }, { "docid": "473d30a9744e5932c96da51165d4f6fc", "score": "0.50338346", "text": "func (o *CreditW2) GetWagesTipsOtherCompOk() (*string, bool) {\n\tif o == nil {\n\t\treturn nil, false\n\t}\n\treturn o.WagesTipsOtherComp.Get(), o.WagesTipsOtherComp.IsSet()\n}", "title": "" }, { "docid": "20b2bdbac6991e0a249f3eb0e84b110d", "score": "0.50080055", "text": "func (o *ViewBoardColumnSettings) GetPrivateOk() (*bool, bool) {\n\tif o == nil || o.Private == nil {\n\t\treturn nil, false\n\t}\n\treturn o.Private, true\n}", "title": "" }, { "docid": "975a5b95dcc74da537cda9a0a4265405", "score": "0.49587074", "text": "func (o *MetricDescriptor) GetWarningsOk() (*[]string, bool) {\n\tif o == nil || o.Warnings == nil {\n\t\treturn nil, false\n\t}\n\treturn o.Warnings, true\n}", "title": "" }, { "docid": "216d59116573dc9112b960953ffcdc14", "score": "0.4958569", "text": "func (o *DhcpSharednetworkEditInput) GetWarningsOk() (*string, bool) {\n\tif o == nil || o.Warnings == nil {\n\t\treturn nil, false\n\t}\n\treturn o.Warnings, true\n}", "title": "" }, { "docid": "53d2d003825c1f79e02013c7b3711d32", "score": "0.4918388", "text": "func (o *EndpointUpdate) GetDisabledOk() (*bool, bool) {\n\tif o == nil || o.Disabled == nil {\n\t\treturn nil, false\n\t}\n\treturn o.Disabled, true\n}", "title": "" }, { "docid": "8303396aee5f5c5679a4497c46757ddc", "score": "0.48910278", "text": "func (m *DepEnrollmentProfile) GetMacOSFileVaultDisabled()(*bool) {\n val, err := m.GetBackingStore().Get(\"macOSFileVaultDisabled\")\n if err != nil {\n panic(err)\n }\n if val != nil {\n return val.(*bool)\n }\n return nil\n}", "title": "" }, { "docid": "254f1049bc6d42ca73c0f29b33a5c66a", "score": "0.48781753", "text": "func (r *reqUpdateUser) GetDisabledOk() (bool, bool) {\n\tif r == nil || r.Disabled == nil {\n\t\treturn false, false\n\t}\n\treturn *r.Disabled, true\n}", "title": "" }, { "docid": "a24cdc468acca52f01a91ec1b4ca6942", "score": "0.48563164", "text": "func checkOthersAreBlocked(ctx context.Context, utility *hwsec.UtilityCryptohomeBinary) error {\n\t// Mount should fail.\n\tif err := utility.MountVault(ctx, util.SecondUsername, util.SecondPassword, util.PasswordLabel, false, hwsec.NewVaultConfig()); err == nil {\n\t\treturn errors.Wrap(err, \"second user is mountable with password after locking to single user\")\n\t}\n\tif err := utility.MountVault(ctx, util.SecondUsername, util.SecondPin, util.PinLabel, false, hwsec.NewVaultConfig()); err == nil {\n\t\treturn errors.Wrap(err, \"second user is mountable with pin after locking to single user\")\n\t}\n\n\t// CheckKeyEx should fail too.\n\tif result, _ := utility.CheckVault(ctx, util.SecondUsername, util.SecondPassword, util.PasswordLabel); result {\n\t\treturn errors.New(\"check key succeeded after locking to single user\")\n\t}\n\tif result, _ := utility.CheckVault(ctx, util.SecondUsername, util.SecondPin, util.PinLabel); result {\n\t\treturn errors.New(\"check key succeeded with pin after locking to single user\")\n\t}\n\n\t// Shouldn't be able to create new users.\n\tif err := utility.MountVault(ctx, util.ThirdUsername, util.ThirdPassword, util.PasswordLabel, true, hwsec.NewVaultConfig()); err == nil {\n\t\treturn errors.Wrap(err, \"create user succeeded after locking to single user\")\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "9680c04d539b7f273fe5b982b6d0e68d", "score": "0.4814746", "text": "func (o *Windows10TeamGeneralConfiguration) GetMaintenanceWindowBlockedOk() (bool, bool) {\n\tif o == nil || o.MaintenanceWindowBlocked == nil {\n\t\tvar ret bool\n\t\treturn ret, false\n\t}\n\treturn *o.MaintenanceWindowBlocked, true\n}", "title": "" }, { "docid": "0392ad6c7fda1bd0c4133ab93a79fb86", "score": "0.4811943", "text": "func (o *StorageRemoteKeySetting) GetSecondaryServerOk() (*StorageKmipServer, bool) {\n\tif o == nil {\n\t\treturn nil, false\n\t}\n\treturn o.SecondaryServer.Get(), o.SecondaryServer.IsSet()\n}", "title": "" }, { "docid": "e740413a6db37b3bbebf43f0c89e220b", "score": "0.47674304", "text": "func (u *User) GetDisabledOk() (bool, bool) {\n\tif u == nil || u.Disabled == nil {\n\t\treturn false, false\n\t}\n\treturn *u.Disabled, true\n}", "title": "" }, { "docid": "06c0bc7076235bff59fd5c9926ee4ca7", "score": "0.4757067", "text": "func (m *AndroidManagedAppProtection) GetDisableAppEncryptionIfDeviceEncryptionIsEnabled()(*bool) {\n return m.disableAppEncryptionIfDeviceEncryptionIsEnabled\n}", "title": "" }, { "docid": "d3df312729fc68d23cfb0216f2e9798f", "score": "0.47144416", "text": "func (o *BankConnection) GetFurtherLoginNotRecommendedOk() (*bool, bool) {\n\tif o == nil {\n\t\treturn nil, false\n\t}\n\treturn &o.FurtherLoginNotRecommended, true\n}", "title": "" }, { "docid": "9956bbe9134b790f198c204d39702eab", "score": "0.47090596", "text": "func (c *CreatedBy) GetDisabledOk() (bool, bool) {\n\tif c == nil || c.Disabled == nil {\n\t\treturn false, false\n\t}\n\treturn *c.Disabled, true\n}", "title": "" }, { "docid": "300262cab0fa99120992b407b6697488", "score": "0.4642526", "text": "func (client *XenClient) SecretGetOtherConfig(self string) (result map[string]string, err error) {\n\tobj, err := client.APICall(\"secret.get_other_config\", self)\n\tif err != nil {\n\t\treturn\n\t}\n\n\tinterim := reflect.ValueOf(obj)\n\tresult = map[string]string{}\n\tfor _, key := range interim.MapKeys() {\n\t\tobj := interim.MapIndex(key)\n\t\tresult[key.String()] = obj.String()\n\t}\n\n\treturn\n}", "title": "" }, { "docid": "cfaaa4023bad2042ea7612ebc38b4d35", "score": "0.46398568", "text": "func (s *ServiceLevelObjectiveThreshold) GetWarningOk() (float64, bool) {\n\tif s == nil || s.Warning == nil {\n\t\treturn 0, false\n\t}\n\treturn *s.Warning, true\n}", "title": "" }, { "docid": "88b269b72e959d45c0c7f9d47409dd03", "score": "0.4639042", "text": "func (o *MetricData) GetWarningsOk() (*[]string, bool) {\n\tif o == nil || o.Warnings == nil {\n\t\treturn nil, false\n\t}\n\treturn o.Warnings, true\n}", "title": "" }, { "docid": "27f73378871eb421d326130d965f8c95", "score": "0.45715234", "text": "func (o ApmServerSpecHttpTlsSelfSignedCertificateOutput) Disabled() pulumi.BoolPtrOutput {\n\treturn o.ApplyT(func(v ApmServerSpecHttpTlsSelfSignedCertificate) *bool { return v.Disabled }).(pulumi.BoolPtrOutput)\n}", "title": "" }, { "docid": "f89e8a6ff8382193c5ec3ffa16c40403", "score": "0.45709035", "text": "func (_class SecretClass) GetOtherConfig(sessionID SessionRef, self SecretRef) (_retval map[string]string, _err error) {\n\tif IsMock {\n\t\treturn _class.GetOtherConfigMock(sessionID, self)\n\t}\t\n\t_method := \"secret.get_other_config\"\n\t_sessionIDArg, _err := convertSessionRefToXen(fmt.Sprintf(\"%s(%s)\", _method, \"session_id\"), sessionID)\n\tif _err != nil {\n\t\treturn\n\t}\n\t_selfArg, _err := convertSecretRefToXen(fmt.Sprintf(\"%s(%s)\", _method, \"self\"), self)\n\tif _err != nil {\n\t\treturn\n\t}\n\t_result, _err := _class.client.APICall(_method, _sessionIDArg, _selfArg)\n\tif _err != nil {\n\t\treturn\n\t}\n\t_retval, _err = convertStringToStringMapToGo(_method + \" -> \", _result.Value)\n\treturn\n}", "title": "" }, { "docid": "3de398b9f615a8343577e3064e203dcb", "score": "0.4548402", "text": "func (o *StorageExternalPath) GetBlockedPathMonitoringOk() (*int64, bool) {\n\tif o == nil || o.BlockedPathMonitoring == nil {\n\t\treturn nil, false\n\t}\n\treturn o.BlockedPathMonitoring, true\n}", "title": "" }, { "docid": "82a1d66db78d9b92d6fa6c13a43fa734", "score": "0.45389795", "text": "func (o *DefaultManagedAppProtection) GetDisableAppEncryptionIfDeviceEncryptionIsEnabledOk() (bool, bool) {\n\tif o == nil || o.DisableAppEncryptionIfDeviceEncryptionIsEnabled == nil {\n\t\tvar ret bool\n\t\treturn ret, false\n\t}\n\treturn *o.DisableAppEncryptionIfDeviceEncryptionIsEnabled, true\n}", "title": "" }, { "docid": "5b641e36880070cfd867b8313405f78c", "score": "0.45373163", "text": "func (o *FirmwareComponentMetaAllOf) GetDisruptionOk() (*string, bool) {\n\tif o == nil || o.Disruption == nil {\n\t\treturn nil, false\n\t}\n\treturn o.Disruption, true\n}", "title": "" }, { "docid": "6013334ada627a512d13a1c078de2812", "score": "0.4531653", "text": "func (m *PrivateKeyProvider) GetHiddenEnvoyDeprecatedConfig() *_struct.Struct {\n\tif x, ok := m.GetConfigType().(*PrivateKeyProvider_HiddenEnvoyDeprecatedConfig); ok {\n\t\treturn x.HiddenEnvoyDeprecatedConfig\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "6013334ada627a512d13a1c078de2812", "score": "0.4531653", "text": "func (m *PrivateKeyProvider) GetHiddenEnvoyDeprecatedConfig() *_struct.Struct {\n\tif x, ok := m.GetConfigType().(*PrivateKeyProvider_HiddenEnvoyDeprecatedConfig); ok {\n\t\treturn x.HiddenEnvoyDeprecatedConfig\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "6013334ada627a512d13a1c078de2812", "score": "0.4531653", "text": "func (m *PrivateKeyProvider) GetHiddenEnvoyDeprecatedConfig() *_struct.Struct {\n\tif x, ok := m.GetConfigType().(*PrivateKeyProvider_HiddenEnvoyDeprecatedConfig); ok {\n\t\treturn x.HiddenEnvoyDeprecatedConfig\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "a3a3353b0a4abd9dd524cb522867147e", "score": "0.4526275", "text": "func (o *CreditW2) GetWagesTipsOtherComp() string {\n\tif o == nil || o.WagesTipsOtherComp.Get() == nil {\n\t\tvar ret string\n\t\treturn ret\n\t}\n\n\treturn *o.WagesTipsOtherComp.Get()\n}", "title": "" }, { "docid": "b3e836d002cbc99b1ee015f15215cfb0", "score": "0.45231754", "text": "func (m *IosGeneralDeviceConfiguration) GetAirPlayForcePairingPasswordForOutgoingRequests()(*bool) {\n return m.airPlayForcePairingPasswordForOutgoingRequests\n}", "title": "" }, { "docid": "e6770c567860e51b46719ecb79ad5255", "score": "0.45086965", "text": "func (o *BulkMoDeepCloner) GetExcludePropertiesOk() ([]string, bool) {\n\tif o == nil || o.ExcludeProperties == nil {\n\t\treturn nil, false\n\t}\n\treturn o.ExcludeProperties, true\n}", "title": "" }, { "docid": "06e468554c831c6a24ff10ce57325b48", "score": "0.44880468", "text": "func (m *IosGeneralDeviceConfiguration) GetHostPairingBlocked()(*bool) {\n return m.hostPairingBlocked\n}", "title": "" }, { "docid": "aeddd5f800b202734d23cea00a7d25f0", "score": "0.4476683", "text": "func (o *AioCheckOutGeneralOption) GetTradeDescOk() (*string, bool) {\n\tif o == nil {\n\t\treturn nil, false\n\t}\n\treturn &o.TradeDesc, true\n}", "title": "" }, { "docid": "04e7478e73c59a4b596594d73a79b701", "score": "0.4474878", "text": "func (o *ConvergedinfraComplianceSummary) GetNotListedOk() (*int64, bool) {\n\tif o == nil || o.NotListed == nil {\n\t\treturn nil, false\n\t}\n\treturn o.NotListed, true\n}", "title": "" }, { "docid": "68334a73f2afecb24356edb5d78c4ed8", "score": "0.44721088", "text": "func (o *BulkMoCloner) GetExcludePropertiesOk() ([]string, bool) {\n\tif o == nil || o.ExcludeProperties == nil {\n\t\treturn nil, false\n\t}\n\treturn o.ExcludeProperties, true\n}", "title": "" }, { "docid": "2c01121f5cc014acc243d7463b214ed2", "score": "0.44619492", "text": "func (o EnterpriseSearchSpecHttpTlsSelfSignedCertificateOutput) Disabled() pulumi.BoolPtrOutput {\n\treturn o.ApplyT(func(v EnterpriseSearchSpecHttpTlsSelfSignedCertificate) *bool { return v.Disabled }).(pulumi.BoolPtrOutput)\n}", "title": "" }, { "docid": "ad5a702218ca5b0c6da83a5ebf174d65", "score": "0.44605523", "text": "func (m *IosGeneralDeviceConfiguration) GetMessagesBlocked()(*bool) {\n return m.messagesBlocked\n}", "title": "" }, { "docid": "2a043d7bb6ecaa5117d72d34e0e01078", "score": "0.44594902", "text": "func (sbc ServiceBindingCredentials) GetOtherDetails() (map[string]string, error) {\n\tvar creds map[string]string\n\terr := json.Unmarshal([]byte(sbc.OtherDetails), &creds)\n\treturn creds, err\n}", "title": "" }, { "docid": "846b2cd844057c3bc7667967e0a8e2fe", "score": "0.44503576", "text": "func (o *ScanOptions) GetExcludesOk() (string, bool) {\n\tif o == nil || o.Excludes == nil {\n\t\tvar ret string\n\t\treturn ret, false\n\t}\n\treturn *o.Excludes, true\n}", "title": "" }, { "docid": "4ded0ec485b6e8b5d7dcaa6ecfabd4b5", "score": "0.44455472", "text": "func (o *WindowsUpdateForBusinessConfiguration) GetDriversExcludedOk() (bool, bool) {\n\tif o == nil || o.DriversExcluded == nil {\n\t\tvar ret bool\n\t\treturn ret, false\n\t}\n\treturn *o.DriversExcluded, true\n}", "title": "" }, { "docid": "07ba94de2203688098ec1d1e188c9f2c", "score": "0.44336426", "text": "func (o *EventsResponseMetadata) GetWarningsOk() (*[]EventsWarning, bool) {\n\tif o == nil || o.Warnings == nil {\n\t\treturn nil, false\n\t}\n\treturn &o.Warnings, true\n}", "title": "" }, { "docid": "0bb7daef7e1f07e3b381bdd5c6a40ffb", "score": "0.44248635", "text": "func (o *DeploymentVariableAllOf) GetSecuredOk() (*bool, bool) {\n\tif o == nil || o.Secured == nil {\n\t\treturn nil, false\n\t}\n\treturn o.Secured, true\n}", "title": "" }, { "docid": "b8043b609e826ccb452a7f3bf8e3c31f", "score": "0.44184506", "text": "func (o *StorageHitachiArray) GetCtl2IpOk() (*string, bool) {\n\tif o == nil || o.Ctl2Ip == nil {\n\t\treturn nil, false\n\t}\n\treturn o.Ctl2Ip, true\n}", "title": "" }, { "docid": "97c5731cf0dae8dc572a554fe26e0f8c", "score": "0.44166854", "text": "func (o *PayStubEarningsBreakdown) GetYtdAmountOk() (*float64, bool) {\n\tif o == nil {\n\t\treturn nil, false\n\t}\n\treturn o.YtdAmount.Get(), o.YtdAmount.IsSet()\n}", "title": "" }, { "docid": "2fc13da3f9a9b661d5023df66551b2f3", "score": "0.44095692", "text": "func (o *DhcpRange6EditInput) GetWarningsOk() (*string, bool) {\n\tif o == nil || o.Warnings == nil {\n\t\treturn nil, false\n\t}\n\treturn o.Warnings, true\n}", "title": "" }, { "docid": "1ec194f2238ecc3a13bf9c86ad1f05c6", "score": "0.44084513", "text": "func (o *HyperflexReplicationPlatDatastorePair) GetBackupOnlyOk() (*bool, bool) {\n\tif o == nil || o.BackupOnly == nil {\n\t\treturn nil, false\n\t}\n\treturn o.BackupOnly, true\n}", "title": "" }, { "docid": "876bf5b3877f3faac3bb9ae7fc658749", "score": "0.44077423", "text": "func (o *IamApiKeyAllOf) GetPrivateKeyOk() (*string, bool) {\n\tif o == nil || o.PrivateKey == nil {\n\t\treturn nil, false\n\t}\n\treturn o.PrivateKey, true\n}", "title": "" }, { "docid": "5fbb89f4852693bb74801693084c49f6", "score": "0.44057885", "text": "func (o *AioCheckOutGeneralOption) GetCustomField2Ok() (*string, bool) {\n\tif o == nil || o.CustomField2 == nil {\n\t\treturn nil, false\n\t}\n\treturn o.CustomField2, true\n}", "title": "" }, { "docid": "b835558032b3ec5af0171239f68dce8b", "score": "0.4403852", "text": "func (*CDeviceAuth_GetExcludedGamesInLibrary_Response_ExcludedGame) Descriptor() ([]byte, []int) {\n\treturn file_steammessages_deviceauth_steamclient_proto_rawDescGZIP(), []int{19, 0}\n}", "title": "" }, { "docid": "2635f580c1a69b6693d63af63108f9e4", "score": "0.4400371", "text": "func (o SpringCloudCertificateOutput) ExcludePrivateKey() pulumi.BoolPtrOutput {\n\treturn o.ApplyT(func(v *SpringCloudCertificate) pulumi.BoolPtrOutput { return v.ExcludePrivateKey }).(pulumi.BoolPtrOutput)\n}", "title": "" }, { "docid": "e60c4c02220b33367f0b1a236d81bcaf", "score": "0.44001552", "text": "func (o LookupVirtualWanResultOutput) DisableVpnEncryption() pulumi.BoolOutput {\n\treturn o.ApplyT(func(v LookupVirtualWanResult) bool { return v.DisableVpnEncryption }).(pulumi.BoolOutput)\n}", "title": "" }, { "docid": "c8ee3b632d7c196232cfc7db934a38da", "score": "0.43988344", "text": "func (o *User) GetBlockedOk() (*bool, bool) {\n\tif o == nil || o.Blocked == nil {\n\t\treturn nil, false\n\t}\n\treturn o.Blocked, true\n}", "title": "" }, { "docid": "6a4bce204a3dd0969e18902cb7357a8f", "score": "0.43972299", "text": "func (m *Windows10TeamGeneralConfiguration) GetMaintenanceWindowBlocked()(*bool) {\n val, err := m.GetBackingStore().Get(\"maintenanceWindowBlocked\")\n if err != nil {\n panic(err)\n }\n if val != nil {\n return val.(*bool)\n }\n return nil\n}", "title": "" }, { "docid": "d6b68ce5f3658929dd70cbfe06894b60", "score": "0.43890446", "text": "func (_Oneinch *OneinchCallerSession) FLAGDISABLEWETH() (*big.Int, error) {\n\treturn _Oneinch.Contract.FLAGDISABLEWETH(&_Oneinch.CallOpts)\n}", "title": "" }, { "docid": "0411e1d25b1587536a4903ab99265d79", "score": "0.4386406", "text": "func (t *ThresholdCount) GetWarningRecoveryOk() (json.Number, bool) {\n\tif t == nil || t.WarningRecovery == nil {\n\t\treturn \"\", false\n\t}\n\treturn *t.WarningRecovery, true\n}", "title": "" }, { "docid": "4c3f3e89e1957d68a51a72e1d796651e", "score": "0.43809047", "text": "func (m *DepEnrollmentProfile) GetDiagnosticsDisabled()(*bool) {\n val, err := m.GetBackingStore().Get(\"diagnosticsDisabled\")\n if err != nil {\n panic(err)\n }\n if val != nil {\n return val.(*bool)\n }\n return nil\n}", "title": "" }, { "docid": "cb89f3b99bf46656bb9ebf2b9a5efb99", "score": "0.43758965", "text": "func (o ElasticsearchSpecHttpTlsSelfSignedCertificateOutput) Disabled() pulumi.BoolPtrOutput {\n\treturn o.ApplyT(func(v ElasticsearchSpecHttpTlsSelfSignedCertificate) *bool { return v.Disabled }).(pulumi.BoolPtrOutput)\n}", "title": "" }, { "docid": "b5d2dd932ced0c048fd773407e219b2c", "score": "0.43726957", "text": "func (o *FirmwareComponentMeta) GetDisruptionOk() (*string, bool) {\n\tif o == nil || o.Disruption == nil {\n\t\treturn nil, false\n\t}\n\treturn o.Disruption, true\n}", "title": "" }, { "docid": "18610dff46350af3668d76f04d3681ad", "score": "0.43687654", "text": "func (m *GrpcService_GoogleGrpc_CallCredentials_MetadataCredentialsFromPlugin) GetHiddenEnvoyDeprecatedConfig() *_struct.Struct {\n\tif x, ok := m.GetConfigType().(*GrpcService_GoogleGrpc_CallCredentials_MetadataCredentialsFromPlugin_HiddenEnvoyDeprecatedConfig); ok {\n\t\treturn x.HiddenEnvoyDeprecatedConfig\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "18610dff46350af3668d76f04d3681ad", "score": "0.43687654", "text": "func (m *GrpcService_GoogleGrpc_CallCredentials_MetadataCredentialsFromPlugin) GetHiddenEnvoyDeprecatedConfig() *_struct.Struct {\n\tif x, ok := m.GetConfigType().(*GrpcService_GoogleGrpc_CallCredentials_MetadataCredentialsFromPlugin_HiddenEnvoyDeprecatedConfig); ok {\n\t\treturn x.HiddenEnvoyDeprecatedConfig\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "59219bcc11e3dc4d1ca7375b5c4d7ee2", "score": "0.43686512", "text": "func (m *IosGeneralDeviceConfiguration) GetAppStoreBlocked()(*bool) {\n return m.appStoreBlocked\n}", "title": "" }, { "docid": "794310cf5f9a994cf44b6df9d1a5bfdc", "score": "0.43635163", "text": "func (o *ColumnDefinition) GetHiddenOk() (bool, bool) {\n\tif o == nil || o.Hidden == nil {\n\t\tvar ret bool\n\t\treturn ret, false\n\t}\n\treturn *o.Hidden, true\n}", "title": "" }, { "docid": "5b4b9ae0ab666f4de04131f11c234845", "score": "0.4361588", "text": "func (ftu *FieldTypeUpdate) SetPasswordOther(s schema.Password) *FieldTypeUpdate {\n\tftu.mutation.SetPasswordOther(s)\n\treturn ftu\n}", "title": "" }, { "docid": "80b1ea0b45de618d7e8a980cf1392f6b", "score": "0.43609968", "text": "func NewAdminGetThirdPartyConfigForbidden() *AdminGetThirdPartyConfigForbidden {\n\treturn &AdminGetThirdPartyConfigForbidden{}\n}", "title": "" }, { "docid": "bdcc09482fed20f5f317b3dc17ffb3c2", "score": "0.4357817", "text": "func (ftuo *FieldTypeUpdateOne) SetNillablePasswordOther(s *schema.Password) *FieldTypeUpdateOne {\n\tif s != nil {\n\t\tftuo.SetPasswordOther(*s)\n\t}\n\treturn ftuo\n}", "title": "" }, { "docid": "042716db4339ffd5225db8fee4beb7b2", "score": "0.435694", "text": "func (o ApmServerSpecHttpTlsSelfSignedCertificatePtrOutput) Disabled() pulumi.BoolPtrOutput {\n\treturn o.ApplyT(func(v *ApmServerSpecHttpTlsSelfSignedCertificate) *bool {\n\t\tif v == nil {\n\t\t\treturn nil\n\t\t}\n\t\treturn v.Disabled\n\t}).(pulumi.BoolPtrOutput)\n}", "title": "" }, { "docid": "e9c235ef87fd9e6e066959ece8aa43b0", "score": "0.43519855", "text": "func (ftuo *FieldTypeUpdateOne) SetPasswordOther(s schema.Password) *FieldTypeUpdateOne {\n\tftuo.mutation.SetPasswordOther(s)\n\treturn ftuo\n}", "title": "" }, { "docid": "5b9a1332af2c1f517b561bd75f111bac", "score": "0.43506038", "text": "func (o *SignalInsights) GetWarningsOk() (*[]SignalWarning, bool) {\n\tif o == nil || o.Warnings == nil {\n\t\treturn nil, false\n\t}\n\treturn o.Warnings, true\n}", "title": "" }, { "docid": "837d76872618e9b66459252b675e5fb6", "score": "0.43494725", "text": "func (o *Webhook) GetDeactivatedOk() (*string, bool) {\n\tif o == nil {\n\t\treturn nil, false\n\t}\n\treturn &o.Deactivated, true\n}", "title": "" }, { "docid": "9bb51f96c7f78d55e3f92ded1090a503", "score": "0.4348843", "text": "func (ftu *FieldTypeUpdate) SetNillablePasswordOther(s *schema.Password) *FieldTypeUpdate {\n\tif s != nil {\n\t\tftu.SetPasswordOther(*s)\n\t}\n\treturn ftu\n}", "title": "" }, { "docid": "791155244b4a41979463f79585a2a61a", "score": "0.4346066", "text": "func (o IndexerClusterSpecVolumesSecretOutput) Optional() pulumi.BoolPtrOutput {\n\treturn o.ApplyT(func(v IndexerClusterSpecVolumesSecret) *bool { return v.Optional }).(pulumi.BoolPtrOutput)\n}", "title": "" }, { "docid": "44b27572c4f833534b934d16059b0970", "score": "0.43385366", "text": "func (o *DnsAclEditInput) GetWarningsOk() (*string, bool) {\n\tif o == nil || o.Warnings == nil {\n\t\treturn nil, false\n\t}\n\treturn o.Warnings, true\n}", "title": "" }, { "docid": "52e371d79e2cf3145ecf17b81d809b51", "score": "0.43345103", "text": "func (o *PlatformsImages) GetExtraAllowanceOk() (*int32, bool) {\n\tif o == nil {\n\t\treturn nil, false\n\t}\n\treturn &o.ExtraAllowance, true\n}", "title": "" }, { "docid": "9f02e2ebc0d7aa45fd3878286b841acc", "score": "0.4333261", "text": "func (m *BitLockerSystemDrivePolicy) GetRecoveryOptions()(BitLockerRecoveryOptionsable) {\n val, err := m.GetBackingStore().Get(\"recoveryOptions\")\n if err != nil {\n panic(err)\n }\n if val != nil {\n return val.(BitLockerRecoveryOptionsable)\n }\n return nil\n}", "title": "" }, { "docid": "5e35fcb8ac041194579df43d2d6d12e7", "score": "0.43320727", "text": "func (i *Compra) GetFlgPrivate() bool {\n if i.Flg_private == \"0\" {\n\t\treturn true\n\t}\n\treturn false\n}", "title": "" }, { "docid": "01a73244c4228370d2f1e4cdf2b63238", "score": "0.43310338", "text": "func (m *WindowsPhone81GeneralConfiguration) GetWindowsStoreBlocked()(*bool) {\n val, err := m.GetBackingStore().Get(\"windowsStoreBlocked\")\n if err != nil {\n panic(err)\n }\n if val != nil {\n return val.(*bool)\n }\n return nil\n}", "title": "" }, { "docid": "e9df8d1bc4c20ed65d7fe1e0471f4d98", "score": "0.43310258", "text": "func (o *DefaultManagedAppProtection) GetScreenCaptureBlockedOk() (bool, bool) {\n\tif o == nil || o.ScreenCaptureBlocked == nil {\n\t\tvar ret bool\n\t\treturn ret, false\n\t}\n\treturn *o.ScreenCaptureBlocked, true\n}", "title": "" }, { "docid": "127b5137105597f3ac094a792072d8bc", "score": "0.4329908", "text": "func (t *ThresholdCount) GetWarningOk() (json.Number, bool) {\n\tif t == nil || t.Warning == nil {\n\t\treturn \"\", false\n\t}\n\treturn *t.Warning, true\n}", "title": "" }, { "docid": "9cc687abb6ae2d1a3744717039312deb", "score": "0.4329531", "text": "func (o *PrivateIpLight) GetPrivateIpOk() (*string, bool) {\n\tif o == nil || o.PrivateIp == nil {\n\t\treturn nil, false\n\t}\n\treturn o.PrivateIp, true\n}", "title": "" }, { "docid": "cb516c4f88530c73b627ff0aa06f0576", "score": "0.4328011", "text": "func (o *VersionGate) GetWarningMessage() (value string, ok bool) {\n\tok = o != nil && o.bitmap_&1024 != 0\n\tif ok {\n\t\tvalue = o.warningMessage\n\t}\n\treturn\n}", "title": "" }, { "docid": "79e42d17d42ce23adfc89de238bd50de", "score": "0.43216962", "text": "func (m *ManagedAppProtection) GetDataBackupBlocked()(*bool) {\n val, err := m.GetBackingStore().Get(\"dataBackupBlocked\")\n if err != nil {\n panic(err)\n }\n if val != nil {\n return val.(*bool)\n }\n return nil\n}", "title": "" }, { "docid": "c7a3dba706c30b340b4dfdd71dda3e32", "score": "0.43210948", "text": "func (_class VBDClass) GetOtherConfig(sessionID SessionRef, self VBDRef) (_retval map[string]string, _err error) {\n\tif IsMock {\n\t\treturn _class.GetOtherConfigMock(sessionID, self)\n\t}\t\n\t_method := \"VBD.get_other_config\"\n\t_sessionIDArg, _err := convertSessionRefToXen(fmt.Sprintf(\"%s(%s)\", _method, \"session_id\"), sessionID)\n\tif _err != nil {\n\t\treturn\n\t}\n\t_selfArg, _err := convertVBDRefToXen(fmt.Sprintf(\"%s(%s)\", _method, \"self\"), self)\n\tif _err != nil {\n\t\treturn\n\t}\n\t_result, _err := _class.client.APICall(_method, _sessionIDArg, _selfArg)\n\tif _err != nil {\n\t\treturn\n\t}\n\t_retval, _err = convertStringToStringMapToGo(_method + \" -> \", _result.Value)\n\treturn\n}", "title": "" }, { "docid": "a2c70b1d67fd63134664ea559315d837", "score": "0.43162602", "text": "func (o *WindowsInformationProtectionPolicy) GetRevokeOnMdmHandoffDisabledOk() (bool, bool) {\n\tif o == nil || o.RevokeOnMdmHandoffDisabled == nil {\n\t\tvar ret bool\n\t\treturn ret, false\n\t}\n\treturn *o.RevokeOnMdmHandoffDisabled, true\n}", "title": "" }, { "docid": "044d5c06c868847b679be546092f5ce3", "score": "0.43098256", "text": "func (o *WindowsInformationProtectionPolicy) GetWindowsHelloForBusinessBlockedOk() (bool, bool) {\n\tif o == nil || o.WindowsHelloForBusinessBlocked == nil {\n\t\tvar ret bool\n\t\treturn ret, false\n\t}\n\treturn *o.WindowsHelloForBusinessBlocked, true\n}", "title": "" }, { "docid": "539a3981e5206ad5955caaec9e9ecef2", "score": "0.4305015", "text": "func (o *ComparisonBasic) GetNegateOk() (*bool, bool) {\n\tif o == nil {\n\t\treturn nil, false\n\t}\n\treturn &o.Negate, true\n}", "title": "" }, { "docid": "e58e1302a3c3a58a3d7cf39148ad348f", "score": "0.429414", "text": "func (o *CreditW2) SetWagesTipsOtherComp(v string) {\n\to.WagesTipsOtherComp.Set(&v)\n}", "title": "" }, { "docid": "19c986d700f28429a527125e2e0da528", "score": "0.42874452", "text": "func (o *FirmwarePolicyAllOf) GetExcludeComponentListOk() ([]string, bool) {\n\tif o == nil || o.ExcludeComponentList == nil {\n\t\treturn nil, false\n\t}\n\treturn o.ExcludeComponentList, true\n}", "title": "" }, { "docid": "5a73909b618d8dd1da08979930b312d5", "score": "0.42848372", "text": "func (m *WindowsPhone81GeneralConfiguration) GetBluetoothBlocked()(*bool) {\n val, err := m.GetBackingStore().Get(\"bluetoothBlocked\")\n if err != nil {\n panic(err)\n }\n if val != nil {\n return val.(*bool)\n }\n return nil\n}", "title": "" }, { "docid": "9047a04f813db51f90ae67d4d852edeb", "score": "0.42848086", "text": "func (_Oneinch *OneinchSession) FLAGDISABLEWETH() (*big.Int, error) {\n\treturn _Oneinch.Contract.FLAGDISABLEWETH(&_Oneinch.CallOpts)\n}", "title": "" }, { "docid": "8ade73c376d6f4c241ee824c882d1011", "score": "0.42848077", "text": "func (o *DhcpSharednetworkEditInput) GetWarnings() string {\n\tif o == nil || o.Warnings == nil {\n\t\tvar ret string\n\t\treturn ret\n\t}\n\treturn *o.Warnings\n}", "title": "" }, { "docid": "63515f7b33eb2577af105ad1c2df8f59", "score": "0.42805845", "text": "func (o AppProjectSpecOrphanedResourcesOutput) Warn() pulumi.BoolPtrOutput {\n\treturn o.ApplyT(func(v AppProjectSpecOrphanedResources) *bool { return v.Warn }).(pulumi.BoolPtrOutput)\n}", "title": "" }, { "docid": "fe96effcd9aac2b78685e864d635fbc1", "score": "0.42787296", "text": "func (o *OsConfigurationFile) GetInternalOk() (*bool, bool) {\n\tif o == nil || o.Internal == nil {\n\t\treturn nil, false\n\t}\n\treturn o.Internal, true\n}", "title": "" } ]
c47b1cf12ae584d6ad7e21e92e71d680
ContainersPrune cleaning up nonrunning containers
[ { "docid": "83a6e7218e72da992f83fa31b1ab59fb", "score": "0.60809195", "text": "func (cl *Client) ContainersPrune(pruneFilter filters.Args) (*types.ContainersPruneReport, error) {\n\tctx, cancel := context.WithTimeout(context.Background(), time.Minute*5)\n\tdefer cancel()\n\tprune, err := cl.client.ContainersPrune(ctx, pruneFilter)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn &prune, nil\n}", "title": "" } ]
[ { "docid": "529c6d2bbf810bb42c1714be4c016f1b", "score": "0.75473756", "text": "func PruneContainers() error {\n\tcli, err := client.NewEnvClient()\n\tif err != nil {\n\t\tlog.Fatalf(\"Unable to create docker client\\n\")\n\t}\n\treport, err := cli.ContainersPrune(context.Background(), filters.Args{})\n\tif err != nil {\n\t\tlog.Println(\"Prune container failed\")\n\t\treturn err\n\t}\n\tlog.Printf(\"Containers pruned: %v\\n\", report.ContainersDeleted)\n\treturn nil\n}", "title": "" }, { "docid": "5967b64970db65e70bd652f77a6e99dd", "score": "0.7007246", "text": "func DockerPrune() error {\n\treturn sh.RunV(dockerCmd, \"system\", \"prune\", \"-f\")\n}", "title": "" }, { "docid": "fd4d7b2fde594b61bf7afed3caa32345", "score": "0.654269", "text": "func (d *Docker) Prune() error {\n\tif _, err := d.client.PruneContainers(api.PruneContainersOptions{}); err != nil {\n\t\treturn err\n\t}\n\n\tif _, err := d.client.PruneImages(api.PruneImagesOptions{}); err != nil {\n\t\treturn err\n\t}\n\n\tif _, err := d.client.PruneVolumes(api.PruneVolumesOptions{}); err != nil {\n\t\treturn err\n\t}\n\n\tif _, err := d.client.PruneNetworks(api.PruneNetworksOptions{}); err != nil {\n\t\treturn err\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "eebab8da96398cf34aec4549f014ae3c", "score": "0.65337527", "text": "func cleanupContainers() {\n\tcmdRunner := powershell.NewCommandRunner()\n\tcmdRunner.Run(\"Stop-Process -Force -Name containerd-shim-runhcs-v1\")\n\treturn\n}", "title": "" }, { "docid": "9e639454c840725e8b4159f22bf4db36", "score": "0.6530247", "text": "func pruneCanaries(cmd *cobra.Command, args []string) error {\n\tdryRun := viper.GetBool(\"dry_run\")\n\n\tinstances, err := getAWSInstances(hostPrefix)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tidsToTerminate, err := getInstancesToPrune(instances)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\treturn terminateInstances(idsToTerminate, instances, dryRun)\n}", "title": "" }, { "docid": "924ed7e57eee73bd7c2bbdb4936a364d", "score": "0.6480839", "text": "func (j *janitor) clean() {\n\tlog.Infof(\"Starting the container janitor loop\")\n\n\tfor {\n\n\t\ttime.Sleep(j.sleepInterval)\n\t\tlog.Debugf(\"Checking for stale containers\")\n\n\t\tnow := time.Now().UTC()\n\t\tcontainers, err := container.ListContainers(true)\n\t\tif err != nil {\n\t\t\tlog.Errorf(\"Unable to list containers %v\", err)\n\t\t\tcontinue\n\t\t}\n\n\t\tfor _, c := range containers {\n\t\t\ts, err := container.InspectContainer(c.ID)\n\t\t\tif err != nil {\n\t\t\t\tlog.Warnf(\"Can't lookup container %s:%v\", c.ID, err)\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tif !s.State.Running {\n\t\t\t\tdelta := now.Sub(s.State.FinishedAt.UTC())\n\t\t\t\tif delta.Seconds() > j.maxStoppedTime.Seconds() {\n\t\t\t\t\terr := container.RemoveContainer(s.ID)\n\t\t\t\t\tif err != nil {\n\t\t\t\t\t\tlog.Errorf(\"Unable to remove container %s: %v\", s.Name, err)\n\t\t\t\t\t\tcontinue\n\t\t\t\t\t}\n\t\t\t\t\tlog.Infof(\"Removed container %s\", s.Name)\n\n\t\t\t\t\terr = container.RemoveImage(s.Image)\n\t\t\t\t\tif err != nil {\n\t\t\t\t\t\tlog.Errorf(\"Unable to remove image %s: %v\", s.Image, err)\n\t\t\t\t\t\tcontinue\n\t\t\t\t\t}\n\t\t\t\t\tlog.Infof(\"Removed image %s\", s.Image)\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t}\n\n}", "title": "" }, { "docid": "bcedf789ecd7a376db08fffb80af5ee9", "score": "0.6308236", "text": "func DockerWipe(c *typgo.Context) error {\n\tids, err := dockerIDs(c)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"Docker-ID: %w\", err)\n\t}\n\tfor _, id := range ids {\n\t\tif err := kill(c, id); err != nil {\n\t\t\treturn fmt.Errorf(\"Fail to kill #%s: %s\", id, err.Error())\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "65fb9c41736de552f29850fe83616c40", "score": "0.6176783", "text": "func killContainers(pod *corev1.Pod, message string) {\n\tfor _, container := range pod.Spec.Containers {\n\t\tcontainerID, containerStatus, err := util.FindContainerIdAndStatusByName(&pod.Status, container.Name)\n\t\tif err != nil {\n\t\t\tklog.Errorf(\"failed to find container id and status, error: %v\", err)\n\t\t\treturn\n\t\t}\n\n\t\tif containerStatus == nil || containerStatus.State.Running == nil {\n\t\t\treturn\n\t\t}\n\n\t\tif containerID != \"\" {\n\t\t\truntimeType, _, _ := util.ParseContainerId(containerStatus.ContainerID)\n\t\t\truntimeHandler, err := runtime.GetRuntimeHandler(runtimeType)\n\t\t\tif err != nil || runtimeHandler == nil {\n\t\t\t\tklog.Errorf(\"%s, kill container(%s) error! GetRuntimeHandler fail! error: %v\", message, containerStatus.ContainerID, err)\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tif err := runtimeHandler.StopContainer(containerID, 0); err != nil {\n\t\t\t\tklog.Errorf(\"%s, stop container error! error: %v\", message, err)\n\t\t\t}\n\t\t} else {\n\t\t\tklog.Warningf(\"%s, get container ID failed, pod %s/%s containerName %s status: %v\", message, pod.Namespace, pod.Name, container.Name, pod.Status.ContainerStatuses)\n\t\t}\n\t}\n}", "title": "" }, { "docid": "3a05430ad2e3c95c6553fa4a293a8e54", "score": "0.60849744", "text": "func KillContainers(opts CommandOptions) error {\n\tcmd := []string{\"docker-compose\", \"--file\", opts.DockerComposeFileName, \"down\"}\n\tcmd = append(cmd, opts.ImageNames...)\n\treturn util.RunAndPipe(opts.DockerComposeDir, opts.Env, opts.Writer, cmd...)\n}", "title": "" }, { "docid": "f983e5bb075a24c54ddf0d83c62b5c68", "score": "0.60412616", "text": "func (p *kubeBuildletPool) cleanUpOldPods(ctx context.Context) {\n\tif containerService == nil {\n\t\treturn\n\t}\n\tfor {\n\t\tpods, err := kubeClient.GetPods(ctx)\n\t\tif err != nil {\n\t\t\tlog.Printf(\"Error cleaning pods: %v\", err)\n\t\t\treturn\n\t\t}\n\t\tvar stats struct {\n\t\t\tPods int\n\t\t\tWithAttr int\n\t\t\tWithDelete int\n\t\t\tDeletedOld int // even if failed to delete\n\t\t\tStillUsed int\n\t\t\tDeletedOldGen int // even if failed to delete\n\t\t}\n\t\tfor _, pod := range pods {\n\t\t\tif pod.ObjectMeta.Annotations == nil {\n\t\t\t\t// Defensive. Not seen in practice.\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tstats.Pods++\n\t\t\tsawDeleteAt := false\n\t\t\tstats.WithAttr++\n\t\t\tfor k, v := range pod.ObjectMeta.Annotations {\n\t\t\t\tif k == \"delete-at\" {\n\t\t\t\t\tstats.WithDelete++\n\t\t\t\t\tsawDeleteAt = true\n\t\t\t\t\tif v == \"\" {\n\t\t\t\t\t\tlog.Printf(\"missing delete-at value; ignoring\")\n\t\t\t\t\t\tcontinue\n\t\t\t\t\t}\n\t\t\t\t\tunixDeadline, err := strconv.ParseInt(v, 10, 64)\n\t\t\t\t\tif err != nil {\n\t\t\t\t\t\tlog.Printf(\"invalid delete-at value %q seen; ignoring\", v)\n\t\t\t\t\t}\n\t\t\t\t\tif err == nil && time.Now().Unix() > unixDeadline {\n\t\t\t\t\t\tstats.DeletedOld++\n\t\t\t\t\t\tlog.Printf(\"Deleting expired pod %q in zone %q ...\", pod.Name)\n\t\t\t\t\t\terr = kubeClient.DeletePod(ctx, pod.Name)\n\t\t\t\t\t\tif err != nil {\n\t\t\t\t\t\t\tlog.Printf(\"problem deleting old pod %q: %v\", pod.Name, err)\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\t// Delete buildlets (things we made) from previous\n\t\t\t// generations. Only deleting things starting with \"buildlet-\"\n\t\t\t// is a historical restriction, but still fine for paranoia.\n\t\t\tif sawDeleteAt && strings.HasPrefix(pod.Name, \"buildlet-\") {\n\t\t\t\tif p.podUsed(pod.Name) {\n\t\t\t\t\tstats.StillUsed++\n\t\t\t\t} else {\n\t\t\t\t\tstats.DeletedOldGen++\n\t\t\t\t\tlog.Printf(\"Deleting pod %q from an earlier coordinator generation ...\", pod.Name)\n\t\t\t\t\terr = kubeClient.DeletePod(ctx, pod.Name)\n\t\t\t\t\tif err != nil {\n\t\t\t\t\t\tlog.Printf(\"problem deleting pod: %v\", err)\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tlog.Printf(\"Kubernetes pod cleanup loop stats: %+v\", stats)\n\t\ttime.Sleep(time.Minute)\n\t}\n}", "title": "" }, { "docid": "d841aeab349b89edfe9e231a08af5a3b", "score": "0.60295534", "text": "func Prune(baseDir string, opts PruneOpts) error {\n\t// parse jsonnet, init k8s client\n\tp, err := Load(baseDir, opts.Opts)\n\tif err != nil {\n\t\treturn err\n\t}\n\tkube, err := p.Connect()\n\tif err != nil {\n\t\treturn err\n\t}\n\tdefer kube.Close()\n\n\t// find orphaned resources\n\torphaned, err := kube.Orphaned(p.Resources)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tif len(orphaned) == 0 {\n\t\tfmt.Fprintln(os.Stderr, \"Nothing found to prune.\")\n\t\treturn nil\n\t}\n\n\t// print diff\n\tdiff, err := kubernetes.StaticDiffer(false)(orphaned)\n\tif err != nil {\n\t\t// static diff can't fail normally, so unlike in apply, this is fatal\n\t\t// here\n\t\treturn err\n\t}\n\tfmt.Print(term.Colordiff(*diff).String())\n\n\t// print namespace removal warning\n\tnamespaces := []string{}\n\tfor _, obj := range orphaned {\n\t\tif obj.Kind() == \"Namespace\" {\n\t\t\tnamespaces = append(namespaces, obj.Metadata().Name())\n\t\t}\n\t}\n\tif len(namespaces) > 0 {\n\t\twarning := color.New(color.FgHiYellow, color.Bold).FprintfFunc()\n\t\twarning(color.Error, \"WARNING: This will delete following namespaces and all resources in them:\\n\")\n\t\tfor _, ns := range namespaces {\n\t\t\tfmt.Fprintf(os.Stderr, \" - %s\\n\", ns)\n\t\t}\n\t\tfmt.Fprintln(os.Stderr, \"\")\n\t}\n\n\t// prompt for confirm\n\tif opts.AutoApprove != AutoApproveAlways {\n\t\tif err := confirmPrompt(\"Pruning from\", p.Env.Spec.Namespace, kube.Info()); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\t// delete resources\n\treturn kube.Delete(orphaned, kubernetes.DeleteOpts{\n\t\tForce: opts.Force,\n\t\tDryRun: opts.DryRun,\n\t})\n}", "title": "" }, { "docid": "1e52e08f83b69dcf8625f5c7a7be2c35", "score": "0.60151017", "text": "func RunContainerPrune(dockerCli command.Cli, filter opts.FilterOpt) (uint64, string, error) {\n\treturn container.RunPrune(dockerCli, filter)\n}", "title": "" }, { "docid": "1bffcdc043c715df8506070ee2645939", "score": "0.6003499", "text": "func releaseContainersFilterHost(scaleMessage common.InformScaleDownAppMessage,\n\tdockerClient *dockerclient.DockerClient) int {\n\t// must consider min number\n\treleaseContainerIds := []string{}\n\t// count container remaining\n\tcontainerRemainingCount := 0\n\t// need release num temp\n\ttemp := -scaleMessage.Number\n\t// release number\n\treleaseNum := -1\n\n\tcontainers, err := dockerClient.ListContainers(true, false, \"\")\n\tif err != nil {\n\t}\n\n\tfor _, c := range containers {\n\t\tif c.Image != scaleMessage.App {\n\t\t\tcontinue\n\t\t}\n\n\t\tip := getContainerHostIp(c.Id)\n\t\tif isInStringArray(ip, scaleMessage.Hosts) && scaleMessage.Number != 0 {\n\t\t\treleaseContainerIds = append(releaseContainerIds, c.Id)\n\t\t\tscaleMessage.Number++\n\t\t\tcontinue\n\t\t}\n\n\t\tcontainerRemainingCount++\n\t\tif scaleMessage.Number == 0 && containerRemainingCount >= scaleMessage.MinNum {\n\t\t\treleaseNum = temp\n\t\t\tbreak\n\t\t}\n\t}\n\n\tif containerRemainingCount < scaleMessage.MinNum {\n\t\treleaseNum = len(releaseContainerIds) - (scaleMessage.MinNum - containerRemainingCount)\n\t}\n\n\tlog.Println(\"release containers: \", releaseContainerIds, \" number: \", releaseNum)\n\n\tfor _, cId := range releaseContainerIds[:releaseNum] {\n\t\t// stop container with 5 seconds timeout\n\t\tdockerClient.StopContainer(cId, 5)\n\t\t// force remove, delete volume\n\t\tdockerClient.RemoveContainer(cId, true, true)\n\t}\n\n\treturn releaseNum\n}", "title": "" }, { "docid": "4285dffc2b44cf4b098a4ecae64228f2", "score": "0.59936994", "text": "func (client *DockerClient) Clean(config *config.Config) error {\n\t// do not pull same image twice\n\timages := map[imagename.ImageName]*imagename.Tags{}\n\tkeep := client.KeepImages\n\n\t// keep 5 latest images by default\n\tif keep == 0 {\n\t\tkeep = 5\n\t}\n\n\tfor _, container := range GetContainersFromConfig(config) {\n\t\tif container.Image == nil {\n\t\t\tcontinue\n\t\t}\n\t\timages[*container.Image] = &imagename.Tags{}\n\t}\n\n\tif len(images) == 0 {\n\t\treturn nil\n\t}\n\n\t// Go through every image and list existing tags\n\tall, err := client.Docker.ListImages(docker.ListImagesOptions{})\n\tif err != nil {\n\t\treturn fmt.Errorf(\"Failed to list all images, error: %s\", err)\n\t}\n\n\t// collect tags for every image\n\tfor _, image := range all {\n\t\tfor _, repoTag := range image.RepoTags {\n\t\t\timageName := imagename.NewFromString(repoTag)\n\t\t\tfor img := range images {\n\t\t\t\tif img.IsSameKind(*imageName) {\n\t\t\t\t\timages[img].Items = append(images[img].Items, &imagename.Tag{\n\t\t\t\t\t\tID: image.ID,\n\t\t\t\t\t\tName: *imageName,\n\t\t\t\t\t\tCreated: image.Created,\n\t\t\t\t\t})\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\t// for every image, delete obsolete tags\n\tfor name, tags := range images {\n\t\ttoDelete := tags.GetOld(keep)\n\t\tif len(toDelete) == 0 {\n\t\t\tcontinue\n\t\t}\n\n\t\tlog.Infof(\"Cleanup: removing %d tags of image %s\", len(toDelete), name.NameWithRegistry())\n\t\tfor _, n := range toDelete {\n\t\t\tif name.GetTag() == n.GetTag() {\n\t\t\t\tlog.Infof(\"Cleanup: skipping %s because it is in the spec\", n)\n\t\t\t\tcontinue\n\t\t\t}\n\n\t\t\twasRemoved := true\n\n\t\t\tlog.Infof(\"Cleanup: remove %s\", n)\n\t\t\tif err := client.Docker.RemoveImageExtended(n.String(), docker.RemoveImageOptions{Force: false}); err != nil {\n\t\t\t\t// 409 is conflict, which means there is a container exists running under this image\n\t\t\t\tif e, ok := err.(*docker.Error); ok && e.Status == 409 {\n\t\t\t\t\tlog.Infof(\"Cleanup: skip %s because there is an existing container using it\", n)\n\t\t\t\t\twasRemoved = false\n\t\t\t\t} else {\n\t\t\t\t\treturn err\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t// cannot refer to &n because of for loop\n\t\t\tif wasRemoved {\n\t\t\t\tremoved := n\n\t\t\t\tclient.removedImages = append(client.removedImages, &removed)\n\t\t\t}\n\t\t}\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "c21f3f9fefed85dd2df57c8754c16fa0", "score": "0.59415555", "text": "func (kl *kubeletExecutor) GarbageCollectContainers() error {\n\tif err := kl.Kubelet.GarbageCollectContainers(); err != nil {\n\t\treturn err\n\t} else if containers, err := dockertools.GetKubeletDockerContainers(kl.dockerClient, true); err != nil {\n\t\treturn err\n\t} else {\n\t\tids := []string{}\n\t\tfor _, container := range containers {\n\t\t\tids = append(ids, container.ID)\n\t\t}\n\t\treturn kl.PurgeOldest(ids, int(kl.totalMaxDeadContainers))\n\t}\n}", "title": "" }, { "docid": "a969b7c9fa841f9c5f145b1f311b0a32", "score": "0.58809054", "text": "func (b *BuildRunner) Clean() {\n\tdocker.ContainerRemove(context.Background(), b.container, types.ContainerRemoveOptions{\n\t\tForce: true,\n\t})\n}", "title": "" }, { "docid": "360f02bf9d9edc2ede21a5000930f82e", "score": "0.5870061", "text": "func (p *pruner) Prune(\n\timagePruner ImageDeleter,\n\tstreamPruner ImageStreamDeleter,\n\tlayerLinkPruner LayerLinkDeleter,\n\tblobPruner BlobDeleter,\n\tmanifestPruner ManifestDeleter,\n) error {\n\tallNodes := p.g.Nodes()\n\n\timageNodes := getImageNodes(allNodes)\n\tif len(imageNodes) == 0 {\n\t\treturn nil\n\t}\n\n\tprunableImageNodes, prunableImageIDs := calculatePrunableImages(p.g, imageNodes, p.algorithm)\n\n\terr := pruneStreams(p.g, prunableImageNodes, streamPruner, p.algorithm.keepYoungerThan)\n\t// if namespace is specified prune only ImageStreams and nothing more\n\t// if we have any errors after ImageStreams pruning this may mean that\n\t// we still have references to images.\n\tif len(p.algorithm.namespace) > 0 || err != nil {\n\t\treturn err\n\t}\n\n\tvar errs []error\n\n\tif p.algorithm.pruneRegistry {\n\t\tprunableComponents := getPrunableComponents(p.g, prunableImageIDs)\n\t\terrs = append(errs, pruneImageComponents(p.g, p.registryClient, p.registryURL, prunableComponents, layerLinkPruner)...)\n\t\terrs = append(errs, pruneBlobs(p.g, p.registryClient, p.registryURL, prunableComponents, blobPruner)...)\n\t\terrs = append(errs, pruneManifests(p.g, p.registryClient, p.registryURL, prunableImageNodes, manifestPruner)...)\n\n\t\tif len(errs) > 0 {\n\t\t\t// If we had any errors deleting layers, blobs, or manifest data from the registry,\n\t\t\t// stop here and don't delete any images. This way, you can rerun prune and retry\n\t\t\t// things that failed.\n\t\t\treturn kerrors.NewAggregate(errs)\n\t\t}\n\t}\n\n\terrs = pruneImages(p.g, prunableImageNodes, imagePruner)\n\treturn kerrors.NewAggregate(errs)\n}", "title": "" }, { "docid": "09ca68be8586db5706b27a0320c1df59", "score": "0.5862317", "text": "func rmCmd(c *cliconfig.RmValues) error {\n\tvar (\n\t\tdeleteFuncs []shared.ParallelWorkerInput\n\t)\n\n\tctx := getContext()\n\truntime, err := libpodruntime.GetRuntime(&c.PodmanCommand)\n\tif err != nil {\n\t\treturn errors.Wrapf(err, \"could not get runtime\")\n\t}\n\tdefer runtime.Shutdown(false)\n\n\tfailureCnt := 0\n\tdelContainers, err := getAllOrLatestContainers(&c.PodmanCommand, runtime, -1, \"all\")\n\tif err != nil {\n\t\tif c.Force && len(c.InputArgs) > 0 {\n\t\t\tif errors.Cause(err) == libpod.ErrNoSuchCtr {\n\t\t\t\terr = nil\n\t\t\t} else {\n\t\t\t\tfailureCnt++\n\t\t\t}\n\t\t\truntime.RemoveContainersFromStorage(c.InputArgs)\n\t\t}\n\t\tif len(delContainers) == 0 {\n\t\t\tif err != nil && failureCnt == 0 {\n\t\t\t\texitCode = 1\n\t\t\t}\n\t\t\treturn err\n\t\t}\n\t\tif err != nil {\n\t\t\tif errors.Cause(err) == libpod.ErrNoSuchCtr {\n\t\t\t\texitCode = 1\n\t\t\t}\n\t\t\tfmt.Println(err.Error())\n\t\t}\n\t}\n\n\tfor _, container := range delContainers {\n\t\tcon := container\n\t\tf := func() error {\n\t\t\treturn runtime.RemoveContainer(ctx, con, c.Force, c.Volumes)\n\t\t}\n\n\t\tdeleteFuncs = append(deleteFuncs, shared.ParallelWorkerInput{\n\t\t\tContainerID: con.ID(),\n\t\t\tParallelFunc: f,\n\t\t})\n\t}\n\tmaxWorkers := shared.Parallelize(\"rm\")\n\tif c.GlobalIsSet(\"max-workers\") {\n\t\tmaxWorkers = c.GlobalFlags.MaxWorks\n\t}\n\tlogrus.Debugf(\"Setting maximum workers to %d\", maxWorkers)\n\n\t// Run the parallel funcs\n\tdeleteErrors, errCount := shared.ParallelExecuteWorkerPool(maxWorkers, deleteFuncs)\n\terr = printParallelOutput(deleteErrors, errCount)\n\tif err != nil {\n\t\tfor _, result := range deleteErrors {\n\t\t\tif result != nil && errors.Cause(result) != image.ErrNoSuchCtr {\n\t\t\t\tfailureCnt++\n\t\t\t}\n\t\t}\n\t\tif failureCnt == 0 {\n\t\t\texitCode = 1\n\t\t}\n\t}\n\n\tif failureCnt > 0 {\n\t\texitCode = 125\n\t}\n\n\treturn err\n}", "title": "" }, { "docid": "82315ca80e70da9b69849168884ad9eb", "score": "0.5825101", "text": "func RecreateContainers(p DockerProvisioner, w io.Writer) error {\n\tcluster := p.Cluster()\n\tnodes, err := cluster.UnfilteredNodes()\n\tif err != nil {\n\t\treturn err\n\t}\n\terrChan := make(chan error, len(nodes))\n\twg := sync.WaitGroup{}\n\tlog.Debugf(\"[bs containers] recreating %d containers\", len(nodes))\n\tfor i := range nodes {\n\t\twg.Add(1)\n\t\tgo func(i int) {\n\t\t\tdefer wg.Done()\n\t\t\tnode := &nodes[i]\n\t\t\tpool := node.Metadata[\"pool\"]\n\t\t\tlog.Debugf(\"[bs containers] recreating container in %s [%s]\", node.Address, pool)\n\t\t\tfmt.Fprintf(w, \"relaunching bs container in the node %s [%s]\\n\", node.Address, pool)\n\t\t\tcreateErr := createContainer(node.Address, pool, p, true)\n\t\t\tif createErr != nil {\n\t\t\t\tmsg := fmt.Sprintf(\"[bs containers] failed to create container in %s [%s]: %s\", node.Address, pool, createErr)\n\t\t\t\tlog.Error(msg)\n\t\t\t\terrChan <- errors.New(msg)\n\t\t\t}\n\t\t}(i)\n\t}\n\twg.Wait()\n\tclose(errChan)\n\tvar allErrors []string\n\tfor err = range errChan {\n\t\tallErrors = append(allErrors, err.Error())\n\t}\n\tif len(allErrors) == 0 {\n\t\treturn nil\n\t}\n\treturn fmt.Errorf(\"multiple errors: %s\", strings.Join(allErrors, \", \"))\n}", "title": "" }, { "docid": "b8d0db0c0d8840cd659f80bf23547f05", "score": "0.58188003", "text": "func deployPrune(ctx context.Context, r *NodeFeatureDiscoveryReconciler, instance *nfdv1.NodeFeatureDiscovery) error {\n\tres, ctrl := addResourcesControls(\"/opt/nfd/prune\")\n\tn := NFD{\n\t\trec: r,\n\t\tins: instance,\n\t\tidx: 0,\n\t}\n\n\tn.controls = append(n.controls, ctrl)\n\tn.resources = append(n.resources, res)\n\n\t// Run through all control functions, return an error on any NotReady resource.\n\tfor {\n\t\terr := n.step()\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tif n.last() {\n\t\t\tbreak\n\t\t}\n\t}\n\n\t// wait until job is finished and then delete it\n\terr := wait.Poll(RetryInterval, time.Minute*3, func() (done bool, err error) {\n\t\tjob, err := r.getJob(ctx, instance.ObjectMeta.Namespace, nfdPruneApp)\n\t\tif err != nil {\n\t\t\treturn false, err\n\t\t}\n\t\tif job.Status.Succeeded > 0 {\n\t\t\treturn true, nil\n\t\t}\n\t\treturn false, nil\n\t})\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// delete job and RBAC objects\n\t// Attempt to delete the Job\n\terr = wait.Poll(RetryInterval, Timeout, func() (done bool, err error) {\n\t\terr = r.deleteJob(ctx, instance.ObjectMeta.Namespace, nfdPruneApp)\n\t\tif err != nil {\n\t\t\treturn false, interpretError(err, \"Prune Job\")\n\t\t}\n\t\tklog.Info(\"nfd-prune Job resource has been deleted.\")\n\t\treturn true, nil\n\t})\n\tif err != nil {\n\t\treturn err\n\t}\n\t// Attempt to delete the ServiceAccount\n\terr = wait.Poll(RetryInterval, Timeout, func() (done bool, err error) {\n\t\terr = r.deleteServiceAccount(ctx, instance.ObjectMeta.Namespace, nfdPruneApp)\n\t\tif err != nil {\n\t\t\treturn false, interpretError(err, \"Prune ServiceAccount\")\n\t\t}\n\t\tklog.Info(\"nfd-prune ServiceAccount resource has been deleted.\")\n\t\treturn true, nil\n\t})\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// Attempt to delete the ClusterRole\n\terr = wait.Poll(RetryInterval, Timeout, func() (done bool, err error) {\n\t\terr = r.deleteClusterRole(ctx, instance.ObjectMeta.Namespace, nfdPruneApp)\n\t\tif err != nil {\n\t\t\treturn false, interpretError(err, \"Prune ClusterRole\")\n\t\t}\n\t\tklog.Info(\"nfd-prune ClusterRole resource has been deleted.\")\n\t\treturn true, nil\n\t})\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// Attempt to delete the ClusterRoleBinding\n\terr = wait.Poll(RetryInterval, Timeout, func() (done bool, err error) {\n\t\terr = r.deleteClusterRoleBinding(ctx, instance.ObjectMeta.Namespace, nfdPruneApp)\n\t\tif err != nil {\n\t\t\treturn false, interpretError(err, \"Prune ClusterRoleBinding\")\n\t\t}\n\t\tklog.Info(\"nfd-prune ClusterRoleBinding resource has been deleted.\")\n\t\treturn true, nil\n\t})\n\tif err != nil {\n\t\treturn err\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "985e1ed94a3f29c29c0d48864cfc345a", "score": "0.5803249", "text": "func (d *Builder) removeContainers() error {\n\tcontainers, err := d.Docker.ContainerList(context.Background(), types.ContainerListOptions{\n\t\tAll: true,\n\t\tFilters: label(complementLabel),\n\t})\n\tif err != nil {\n\t\treturn err\n\t}\n\tfor _, c := range containers {\n\t\terr = d.Docker.ContainerRemove(context.Background(), c.ID, types.ContainerRemoveOptions{\n\t\t\tForce: true,\n\t\t})\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "48344620a069f380da8dd5a22a7e36c4", "score": "0.57339996", "text": "func prunePods(ms *store.ManifestState) {\n\t// Always remove pods that were manually deleted.\n\truntime := ms.K8sRuntimeState()\n\tfor key, pod := range runtime.Pods {\n\t\tif pod.Deleting {\n\t\t\tdelete(runtime.Pods, key)\n\t\t}\n\t}\n\t// Continue pruning until we have 1 pod.\n\tfor runtime.PodLen() > 1 {\n\t\tbestPod := ms.MostRecentPod()\n\n\t\tfor key, pod := range runtime.Pods {\n\t\t\t// Remove terminated pods if they aren't the most recent one.\n\t\t\tisDead := pod.Phase == string(v1.PodSucceeded) || pod.Phase == string(v1.PodFailed)\n\t\t\tif isDead && pod.Name != bestPod.Name {\n\t\t\t\tdelete(runtime.Pods, key)\n\t\t\t\tbreak\n\t\t\t}\n\t\t}\n\n\t\t// found nothing to delete, break out\n\t\t// NOTE(dmiller): above comment is probably erroneous, but disabling this check because I'm not sure if this is safe to change\n\t\t// original static analysis error:\n\t\t// SA4004: the surrounding loop is unconditionally terminated (staticcheck)\n\t\t//nolint:staticcheck\n\t\treturn\n\t}\n}", "title": "" }, { "docid": "56e8f25e46a97c45e9ad2ef2aa5252d6", "score": "0.5707619", "text": "func pruneBlobs(\n\tg graph.Graph,\n\tregistryClient *http.Client,\n\tregistryURL *url.URL,\n\tcomponentNodes []*imagegraph.ImageComponentNode,\n\tblobPruner BlobDeleter,\n) []error {\n\terrs := []error{}\n\n\tfor _, cn := range componentNodes {\n\t\tif err := blobPruner.DeleteBlob(registryClient, registryURL, cn.Component); err != nil {\n\t\t\terrs = append(errs, fmt.Errorf(\"error removing blob %s from the registry %s: %v\",\n\t\t\t\tcn.Component, registryURL.Host, err))\n\t\t}\n\t}\n\n\treturn errs\n}", "title": "" }, { "docid": "a4fe1fcccdeec8b304ec4fe984077511", "score": "0.5674663", "text": "func (d *DockerUtil) cleanupCaches(containers []types.Container) {\n\tliveContainers := make(map[string]struct{})\n\tliveImages := make(map[string]struct{})\n\tfor _, c := range containers {\n\t\tliveContainers[c.ID] = struct{}{}\n\t\tliveImages[c.Image] = struct{}{}\n\t}\n\td.Lock()\n\tfor cid := range d.networkMappings {\n\t\tif _, ok := liveContainers[cid]; !ok {\n\t\t\tdelete(d.networkMappings, cid)\n\t\t}\n\t}\n\tfor image := range d.imageNameBySha {\n\t\tif _, ok := liveImages[image]; !ok {\n\t\t\tdelete(d.imageNameBySha, image)\n\t\t}\n\t}\n\td.Unlock()\n}", "title": "" }, { "docid": "8a7592a0960f42480a6feffd46ac2e1d", "score": "0.5654485", "text": "func (docker *Docker) Clean() error {\n\terr := docker.client.ContainerRemove(\n\t\tcontext.Background(),\n\t\tdocker.serverContainerID,\n\t\ttypes.ContainerRemoveOptions{Force: true},\n\t)\n\tif err != nil {\n\t\treturn err\n\t}\n\tdocker.cancel()\n\treturn nil\n}", "title": "" }, { "docid": "13c38480496deb54a1d69cf1290a7cd6", "score": "0.56506306", "text": "func (k *KubernetesBackend) PruneOrphans() error {\n\n\tspan := ot.StartSpan(\"kubernetes_prune_orphaned_ns\")\n\tdefer span.Finish()\n\n\tnameSpaces, err := k.Client.CoreV1().Namespaces().List(metav1.ListOptions{\n\t\t// VERY Important to use this label selector, otherwise you'll nuke way more than you intended\n\t\tLabelSelector: fmt.Sprintf(\"antidoteManaged=yes,antidoteId=%s\", k.Config.InstanceID),\n\t})\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// No need to nuke if no namespaces exist with our ID\n\tif len(nameSpaces.Items) == 0 {\n\t\tspan.LogFields(log.Int(\"pruned_orphans\", 0))\n\t\treturn nil\n\t}\n\n\tvar wg sync.WaitGroup\n\twg.Add(len(nameSpaces.Items))\n\tfor n := range nameSpaces.Items {\n\n\t\tnsName := nameSpaces.Items[n].ObjectMeta.Name\n\t\tgo func() {\n\t\t\tdefer wg.Done()\n\t\t\tk.deleteNamespace(span.Context(), nsName)\n\t\t}()\n\t}\n\twg.Wait()\n\n\tspan.LogFields(log.Int(\"pruned_orphans\", len(nameSpaces.Items)))\n\treturn nil\n}", "title": "" }, { "docid": "95c3ef73dfa6c271d09dd3718eeeb95b", "score": "0.5626062", "text": "func RunImagePrune(dockerCli command.Cli, all bool, filter opts.FilterOpt) (uint64, string, error) {\n\treturn image.RunPrune(dockerCli, all, filter)\n}", "title": "" }, { "docid": "2fbc24dfe1c868d9f1be0c60826c625e", "score": "0.56194234", "text": "func (s *Server) wipeIfAppropriate(ctx context.Context, imagesToDelete []string) {\n\tctx, span := log.StartSpan(ctx)\n\tdefer span.End()\n\tif !s.config.InternalWipe {\n\t\treturn\n\t}\n\tvar (\n\t\tshouldWipeContainers, shouldWipeImages bool\n\t\terr error\n\t)\n\n\t// Check if our persistent version file is out of date.\n\t// If so, we have upgrade, and we should wipe images.\n\tshouldWipeImages, err = version.ShouldCrioWipe(s.config.VersionFilePersist)\n\tif err != nil {\n\t\tlog.Warnf(ctx, \"Error encountered when checking whether cri-o should wipe images: %v\", err)\n\t}\n\n\t// Unconditionally wipe containers if we should wipe images.\n\tif shouldWipeImages {\n\t\tshouldWipeContainers = true\n\t} else {\n\t\t// Check if our version file is out of date.\n\t\t// If so, we rebooted, and we should wipe containers.\n\t\tshouldWipeContainers, err = version.ShouldCrioWipe(s.config.VersionFile)\n\t\tif err != nil {\n\t\t\tlog.Warnf(ctx, \"Error encountered when checking whether cri-o should wipe containers: %v\", err)\n\t\t}\n\t}\n\n\t// Translate to a map so the images are only attempted to be deleted once.\n\timageMapToDelete := make(map[string]struct{})\n\tfor _, img := range imagesToDelete {\n\t\timageMapToDelete[img] = struct{}{}\n\t}\n\n\t// Attempt to wipe containers, adding the images that were removed on the way.\n\tif shouldWipeContainers {\n\t\t// Best-effort append to imageMapToDelete\n\t\tif ctrs, err := s.ContainerServer.ListContainers(); err == nil {\n\t\t\tfor _, ctr := range ctrs {\n\t\t\t\timageMapToDelete[ctr.ImageRef()] = struct{}{}\n\t\t\t}\n\t\t}\n\t\tfor _, sb := range s.ContainerServer.ListSandboxes() {\n\t\t\tif err := s.removePodSandbox(ctx, sb); err != nil {\n\t\t\t\tlog.Warnf(ctx, \"Failed to remove sandbox %s: %v\", sb.ID(), err)\n\t\t\t}\n\t\t}\n\t}\n\n\t// Note: some of these will fail if some aspect of the pod cleanup failed as well,\n\t// but this is best-effort anyway, as the Kubelet will eventually cleanup images when\n\t// disk usage gets too high.\n\tif shouldWipeImages {\n\t\tfor img := range imageMapToDelete {\n\t\t\tif err := s.removeImage(ctx, img); err != nil {\n\t\t\t\tlog.Warnf(ctx, \"Failed to remove image %s: %v\", img, err)\n\t\t\t}\n\t\t}\n\t}\n}", "title": "" }, { "docid": "8efeb5f64097c8692b2d0621b5780c0e", "score": "0.5593725", "text": "func Cleanup(ctx context.Context, logger grip.Journaler) error {\n\tdockerClient, err := client.NewClientWithOpts(client.WithAPIVersionNegotiation())\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"can't get Docker client\")\n\t}\n\n\tinfo, err := dockerClient.Info(ctx)\n\tif err != nil {\n\t\tlogger.Info(\"Can't connect to Docker. It's probably not running\")\n\t\treturn nil\n\t}\n\n\tlogger.Info(message.Fields{\n\t\t\"message\": \"removing docker artifacts\",\n\t\t\"containers_total\": info.Containers,\n\t\t\"containers_running\": info.ContainersRunning,\n\t\t\"containers_paused\": info.ContainersPaused,\n\t\t\"containers_stopped\": info.ContainersStopped,\n\t\t\"images\": info.Images,\n\t})\n\n\tcatcher := grip.NewBasicCatcher()\n\tcatcher.Add(cleanContainers(ctx, dockerClient))\n\tcatcher.Add(cleanImages(ctx, dockerClient))\n\tcatcher.Add(cleanVolumes(ctx, dockerClient, logger))\n\n\treturn catcher.Resolve()\n}", "title": "" }, { "docid": "c32c5f0a4625a93563c7a34492cc17bf", "score": "0.55428565", "text": "func (e *Execution) Clean(t testingT, dockerBinary string) {\n\tcli, err := client.NewEnvClient()\n\tif err != nil {\n\t\tt.Fatalf(\"%v\", err)\n\t}\n\tdefer cli.Close()\n\n\tif (e.DaemonPlatform() != \"windows\") || (e.DaemonPlatform() == \"windows\" && e.Isolation() == \"hyperv\") {\n\t\tunpauseAllContainers(t, dockerBinary)\n\t}\n\tdeleteAllContainers(t, dockerBinary)\n\tdeleteAllImages(t, dockerBinary, e.protectedElements.images)\n\tdeleteAllVolumes(t, cli)\n\tdeleteAllNetworks(t, cli, e.DaemonPlatform())\n\tif e.DaemonPlatform() == \"linux\" {\n\t\tdeleteAllPlugins(t, cli, dockerBinary)\n\t}\n}", "title": "" }, { "docid": "77dd32172965f349d58056c395bfece1", "score": "0.5518381", "text": "func pruneStreams(\n\tg graph.Graph,\n\tprunableImageNodes map[string]*imagegraph.ImageNode,\n\tstreamPruner ImageStreamDeleter,\n\tkeepYoungerThan time.Time,\n) error {\n\tglog.V(4).Infof(\"Removing pruned image references from streams\")\n\tfor _, node := range g.Nodes() {\n\t\tstreamNode, ok := node.(*imagegraph.ImageStreamNode)\n\t\tif !ok {\n\t\t\tcontinue\n\t\t}\n\t\tstreamName := getName(streamNode.ImageStream)\n\t\terr := retry.RetryOnConflict(retry.DefaultRetry, func() error {\n\t\t\tstream, err := streamPruner.GetImageStream(streamNode.ImageStream)\n\t\t\tif err != nil {\n\t\t\t\tif kerrapi.IsNotFound(err) {\n\t\t\t\t\tglog.V(4).Infof(\"Unable to get image stream %s: removed during prune\", streamName)\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\tupdatedTags := sets.NewString()\n\t\t\tdeletedTags := sets.NewString()\n\n\t\t\tfor tag := range stream.Status.Tags {\n\t\t\t\tif updated, deleted := pruneISTagHistory(g, prunableImageNodes, keepYoungerThan, streamName, stream, tag); deleted {\n\t\t\t\t\tdeletedTags.Insert(tag)\n\t\t\t\t} else if updated {\n\t\t\t\t\tupdatedTags.Insert(tag)\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif updatedTags.Len() == 0 && deletedTags.Len() == 0 {\n\t\t\t\treturn nil\n\t\t\t}\n\n\t\t\tupdatedStream, err := streamPruner.UpdateImageStream(stream)\n\t\t\tif err == nil {\n\t\t\t\tstreamPruner.NotifyImageStreamPrune(stream, updatedTags.List(), deletedTags.List())\n\t\t\t\tstreamNode.ImageStream = updatedStream\n\t\t\t}\n\n\t\t\tif kerrapi.IsNotFound(err) {\n\t\t\t\tglog.V(4).Infof(\"Unable to update image stream %s: removed during prune\", streamName)\n\t\t\t\treturn nil\n\t\t\t}\n\n\t\t\treturn err\n\t\t})\n\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"unable to prune stream %s: %v\", streamName, err)\n\t\t}\n\t}\n\n\tglog.V(4).Infof(\"Done removing pruned image references from streams\")\n\treturn nil\n}", "title": "" }, { "docid": "c13f1c3ae2e32b2065a5a0560ea4f051", "score": "0.5505462", "text": "func (containerRepository *ContainerRepository) DeleteContainers(pods []*datahub_v1alpha1.Pod) error {\n\tfor _, pod := range pods {\n\t\tif pod.GetNamespacedName() == nil || pod.GetAlamedaScaler() == nil {\n\t\t\tcontinue\n\t\t}\n\t\tpodNS := pod.GetNamespacedName().GetNamespace()\n\t\tpodName := pod.GetNamespacedName().GetName()\n\t\talaScalerNS := pod.GetAlamedaScaler().GetNamespace()\n\t\talaScalerName := pod.GetAlamedaScaler().GetName()\n\t\tcmd := fmt.Sprintf(\"DROP SERIES FROM %s WHERE \\\"%s\\\"='%s' AND \\\"%s\\\"='%s' AND \\\"%s\\\"='%s' AND \\\"%s\\\"='%s'\", Container,\n\t\t\tcluster_status_entity.ContainerNamespace, podNS, cluster_status_entity.ContainerPodName, podName,\n\t\t\tcluster_status_entity.ContainerAlamedaScalerNamespace, alaScalerNS, cluster_status_entity.ContainerAlamedaScalerName, alaScalerName)\n\t\tscope.Debugf(\"DeleteContainers command: %s\", cmd)\n\t\t_, err := containerRepository.influxDB.QueryDB(cmd, string(influxdb.ClusterStatus))\n\t\tif err != nil {\n\t\t\tscope.Errorf(err.Error())\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "7eb44967f5dfb403f8bd557af794953e", "score": "0.54893446", "text": "func (i *ImageService) ImagesPrune(ctx context.Context, pruneFilter filters.Args) (types.ImagesPruneReport, error) {\n\treturn types.ImagesPruneReport{}, nil\n}", "title": "" }, { "docid": "2480c1e15f8f11c70dc42f30f33ffce8", "score": "0.5487624", "text": "func Prune(ctx context.Context, globalOpts *GlobalOptions) ([]byte, error) {\n\tcmd := newCommand(\"prune\", cli.StructToCLI(globalOpts)...)\n\n\treturn cli.Run(ctx, cmd)\n}", "title": "" }, { "docid": "a44b457aa0c853332ea1357b5344c6f5", "score": "0.5482054", "text": "func Cleanup(sliceName string, hostnames []string) error {\n\tvar wg sync.WaitGroup\n\tcmds := []string{\n\t\t\"kill -9 -1\",\n\t\t\"cd && rm -rf *\",\n\t}\n\n\tfor _, hostname := range hostnames {\n\t\twg.Add(1)\n\t\tgo func(hostname string) {\n\t\t\tdefer wg.Done()\n\t\t\tlog.Printf(\"Cleaning up node %s\", hostname)\n\t\t\tfor _, c := range cmds {\n\t\t\t\terr := ExecCmdOnNode(sliceName, hostname, c, false)\n\t\t\t\tif err != nil {\n\t\t\t\t\tlog.Printf(\"Got error when executing command %s on %s: %v\", c, hostname, err)\n\t\t\t\t}\n\t\t\t}\n\n\t\t}(hostname)\n\t}\n\n\twg.Wait()\n\tlog.Print(\"Cleanup completed\")\n\n\treturn nil\n}", "title": "" }, { "docid": "0cc2f8d3c14277afee10212b18b2fc71", "score": "0.547825", "text": "func (woc *wfOperationCtx) killDeamonedChildren(nodeID string) error {\n\tlog.Infof(\"Checking deamon children of %s\", nodeID)\n\tvar firstErr error\n\tfor _, childNodeID := range woc.wf.Status.Nodes[nodeID].Children {\n\t\tfor _, grandChildID := range woc.wf.Status.Nodes[childNodeID].Children {\n\t\t\tgcNode := woc.wf.Status.Nodes[grandChildID]\n\t\t\tif gcNode.Daemoned == nil || !*gcNode.Daemoned {\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\terr := common.KillPodContainer(woc.controller.restConfig, woc.wf.ObjectMeta.Namespace, gcNode.ID, common.MainContainerName)\n\t\t\tif err != nil {\n\t\t\t\tlog.Errorf(\"Failed to kill %s: %+v\", gcNode, err)\n\t\t\t\tif firstErr == nil {\n\t\t\t\t\tfirstErr = err\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\treturn firstErr\n}", "title": "" }, { "docid": "3ad742afc85a122e04f6901992d69045", "score": "0.54545814", "text": "func (woc *wfOperationCtx) killDeamonedChildren(nodeID string) error {\n\twoc.log.Infof(\"Checking deamon children of %s\", nodeID)\n\tvar firstErr error\n\tfor _, childNodeID := range woc.wf.Status.Nodes[nodeID].Children {\n\t\tfor _, grandChildID := range woc.wf.Status.Nodes[childNodeID].Children {\n\t\t\tgcNode := woc.wf.Status.Nodes[grandChildID]\n\t\t\tif gcNode.Daemoned == nil || !*gcNode.Daemoned {\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\terr := common.KillPodContainer(woc.controller.restConfig, woc.wf.ObjectMeta.Namespace, gcNode.ID, common.MainContainerName)\n\t\t\tif err != nil {\n\t\t\t\twoc.log.Errorf(\"Failed to kill %s: %+v\", gcNode, err)\n\t\t\t\tif firstErr == nil {\n\t\t\t\t\tfirstErr = err\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\treturn firstErr\n}", "title": "" }, { "docid": "5bbf7e2da5f710e5128250a44f3e7ab2", "score": "0.54458946", "text": "func unpause(cr cruntime.Manager, r command.Runner, namespaces []string) ([]string, error) {\n\tids, err := cr.ListContainers(cruntime.ListContainersOptions{State: cruntime.Paused, Namespaces: namespaces})\n\tif err != nil {\n\t\treturn ids, errors.Wrap(err, \"list paused\")\n\t}\n\n\tif len(ids) == 0 {\n\t\tklog.Warningf(\"no paused containers found\")\n\t} else if err := cr.UnpauseContainers(ids); err != nil {\n\t\treturn ids, errors.Wrap(err, \"unpause\")\n\t}\n\n\tsm := sysinit.New(r)\n\n\tif err := sm.Start(\"kubelet\"); err != nil {\n\t\treturn ids, errors.Wrap(err, \"kubelet start\")\n\t}\n\n\tif doesNamespaceContainKubeSystem(namespaces) {\n\t\tpkgpause.RemovePausedFile(r)\n\t}\n\n\treturn ids, nil\n}", "title": "" }, { "docid": "44e9924070eb8a6db0926d2c45e71eea", "score": "0.5438436", "text": "func (n *PostFilteringScaleDownNodeProcessor) CleanUp() {\n}", "title": "" }, { "docid": "ee66ab64cf1383535f5df6eab20f077c", "score": "0.54227185", "text": "func RemoveFailedInitContainers(i *ispnv1.Infinispan, ctx pipeline.Context) {\n\tpodList, err := ctx.InfinispanPods()\n\tif err != nil {\n\t\treturn\n\t}\n\n\tstatefulSet := &appsv1.StatefulSet{}\n\tif err := ctx.Resources().Load(i.GetStatefulSetName(), statefulSet, pipeline.RetryOnErr); err != nil {\n\t\treturn\n\t}\n\n\tfor _, pod := range podList.Items {\n\t\tif !kube.IsInitContainersEqual(statefulSet.Spec.Template.Spec.InitContainers, pod.Spec.InitContainers) {\n\t\t\tif kube.InitContainerFailed(pod.Status.InitContainerStatuses) {\n\t\t\t\tif err := ctx.Resources().Delete(pod.Name, &pod); err != nil {\n\t\t\t\t\tctx.Requeue(err)\n\t\t\t\t\treturn\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n}", "title": "" }, { "docid": "a8c4310327748c631f3d3f8ae6083ece", "score": "0.5413799", "text": "func (m *nfdMaster) prune() error {\n\tcli, err := m.apihelper.GetClient()\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tnodes, err := m.apihelper.GetNodes(cli)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tfor _, node := range nodes.Items {\n\t\tstdoutLogger.Printf(\"pruning node %q...\", node.Name)\n\n\t\t// Prune labels and extended resources\n\t\terr := updateNodeFeatures(m.apihelper, node.Name, Labels{}, Annotations{}, ExtendedResources{})\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"failed to prune labels from node %q: %v\", node.Name, err)\n\t\t}\n\n\t\t// Prune annotations\n\t\tnode, err := m.apihelper.GetNode(cli, node.Name)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tfor a := range node.Annotations {\n\t\t\tif strings.HasPrefix(a, AnnotationNs) {\n\t\t\t\tdelete(node.Annotations, a)\n\t\t\t}\n\t\t}\n\t\terr = m.apihelper.UpdateNode(cli, node)\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"failed to prune annotations from node %q: %v\", node.Name, err)\n\t\t}\n\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "207d6f56f4713537975ec70dbd4c77b1", "score": "0.5399309", "text": "func pruneImages(g graph.Graph, imageNodes map[string]*imagegraph.ImageNode, imagePruner ImageDeleter) []error {\n\terrs := []error{}\n\n\tfor _, imageNode := range imageNodes {\n\t\tif err := imagePruner.DeleteImage(imageNode.Image); err != nil {\n\t\t\terrs = append(errs, fmt.Errorf(\"error removing image %q: %v\", imageNode.Image.Name, err))\n\t\t}\n\t}\n\n\treturn errs\n}", "title": "" }, { "docid": "6cd973c4099a8d7fee21ef5dadd17edf", "score": "0.5381964", "text": "func (r *DaemonReconciler) cleanupOldDaemonsets(namespace string) error {\n\tif r.deletedStaticProvisioner {\n\t\treturn nil\n\t}\n\tprovisioner := &appsv1.DaemonSet{}\n\terr := r.client.Get(context.TODO(), types.NamespacedName{Name: ProvisionerName, Namespace: namespace}, provisioner)\n\tif err == nil { // provisioner daemonset found\n\t\tr.reqLogger.Info(fmt.Sprintf(\"old daemonset %q found, cleaning up\", ProvisionerName))\n\t\terr = r.client.Delete(context.TODO(), provisioner)\n\t\tif err != nil && !errors.IsGone(err) {\n\t\t\tr.reqLogger.Error(err, fmt.Sprintf(\"could not delete daemonset %q\", ProvisionerName))\n\t\t\treturn err\n\t\t}\n\t} else if !errors.IsNotFound(err) { // unknown error\n\t\tr.reqLogger.Error(err, fmt.Sprintf(\"could not fetch daemonset %q to clean it up\", ProvisionerName))\n\t\treturn err\n\t}\n\n\t// wait for pods to die\n\terr = wait.ExponentialBackoff(wait.Backoff{\n\t\tCap: time.Minute * 2,\n\t\tDuration: time.Second,\n\t\tFactor: 1.7,\n\t\tJitter: 1,\n\t\tSteps: 20,\n\t}, func() (done bool, err error) {\n\t\tpodList := &corev1.PodList{}\n\t\tallGone := false\n\t\terr = r.client.List(context.TODO(), podList, client.MatchingLabels{\"app\": ProvisionerName})\n\t\tif err != nil && !errors.IsNotFound(err) {\n\t\t\treturn false, err\n\t\t} else if len(podList.Items) == 0 {\n\t\t\tallGone = true\n\t\t}\n\t\tr.reqLogger.Info(fmt.Sprintf(\"waiting for 0 pods with label app : %q\", ProvisionerName), \"numberFound\", len(podList.Items))\n\t\treturn allGone, nil\n\t})\n\tif err != nil {\n\t\tr.reqLogger.Error(err, \"could not determine that old provisioner pods were deleted\")\n\t\treturn err\n\t}\n\tr.deletedStaticProvisioner = true\n\treturn nil\n}", "title": "" }, { "docid": "5931ea40ae4013e732fa7fef0825599a", "score": "0.5359318", "text": "func (ic *ContainerEngine) NetworkPrune(ctx context.Context, options entities.NetworkPruneOptions) ([]*entities.NetworkPruneReport, error) {\n\topts := new(network.PruneOptions).WithFilters(options.Filters)\n\treturn network.Prune(ic.ClientCtx, opts)\n}", "title": "" }, { "docid": "55d99b3e6b3ec42283430055ece85954", "score": "0.5358947", "text": "func (container *Container) cleanup() {\n\tcontainer.ReleaseNetwork()\n\n\t// Disable all active links\n\tif container.activeLinks != nil {\n\t\tfor _, link := range container.activeLinks {\n\t\t\tlink.Disable()\n\t\t}\n\t}\n\n\tif err := container.Unmount(); err != nil {\n\t\tlog.Errorf(\"%v: Failed to umount filesystem: %v\", container.ID, err)\n\t}\n\n\tfor _, eConfig := range container.execCommands.s {\n\t\tcontainer.daemon.unregisterExecCommand(eConfig)\n\t}\n}", "title": "" }, { "docid": "2f0bf6ee49572fe8cd02375e53594982", "score": "0.5353491", "text": "func (p *PostFilteringScaleDownNodeProcessor) CleanUp() {\n}", "title": "" }, { "docid": "b59216b719a4e6942784d46435bace7e", "score": "0.5341593", "text": "func (e *ClientExecutor) Cleanup() error {\n\tif e.Container == nil {\n\t\treturn nil\n\t}\n\terr := e.Client.RemoveContainer(docker.RemoveContainerOptions{\n\t\tID: e.Container.ID,\n\t\tRemoveVolumes: true,\n\t\tForce: true,\n\t})\n\tif _, ok := err.(*docker.NoSuchContainer); err != nil && !ok {\n\t\treturn fmt.Errorf(\"unable to cleanup build container: %v\", err)\n\t}\n\te.Container = nil\n\treturn nil\n}", "title": "" }, { "docid": "c7d29ce13f5017ce5d9d588b91014920", "score": "0.5331301", "text": "func (r *LocalRuntime) KillContainers(ctx context.Context, cli *cliconfig.KillValues, signal syscall.Signal) ([]string, map[string]error, error) {\n\tvar (\n\t\tok = []string{}\n\t\tfailures = map[string]error{}\n\t)\n\n\tctrs, err := shortcuts.GetContainersByContext(cli.All, cli.Latest, cli.InputArgs, r.Runtime)\n\tif err != nil {\n\t\treturn ok, failures, err\n\t}\n\n\tfor _, c := range ctrs {\n\t\tif err := c.Kill(uint(signal)); err == nil {\n\t\t\tok = append(ok, c.ID())\n\t\t} else {\n\t\t\tfailures[c.ID()] = err\n\t\t}\n\t}\n\treturn ok, failures, nil\n}", "title": "" }, { "docid": "5f360fcd599baec8bc8010cd0d0ff5b7", "score": "0.5318488", "text": "func RunNetworkPrune(dockerCli command.Cli, filter opts.FilterOpt) (uint64, string, error) {\n\treturn network.RunPrune(dockerCli, filter)\n}", "title": "" }, { "docid": "9ee7c6d3e992d4bae1e735c416305649", "score": "0.5313103", "text": "func (cli *Controller) RemoveContainers(ctx context.Context, jobs []JobInfo) {\n\tfor _, job := range jobs {\n\t\tid := job.Name\n\t\terr := cli.ContainerRemove(ctx, id, types.ContainerRemoveOptions{Force: true})\n\t\tif err != nil {\n\t\t\tlog.Printf(\"Error removing job %v: %v\", id, err)\n\t\t} else {\n\t\t\tlog.Println(\"Removed job\", id)\n\t\t}\n\t}\n\n}", "title": "" }, { "docid": "0b654a84f74443506302351695ead278", "score": "0.53060865", "text": "func (dir *Dir) prune(dirs map[string]struct{}) error {\n\tfor cname, _ := range dirs {\n\t\tcdir_, err := dir.OpenDir(cname)\n\t\tif zutil.IsNoNode(err) {\n\t\t\tdelete(dirs, cname)\n\t\t\tcontinue\n\t\t} else if err != nil {\n\t\t\treturn err\n\t\t}\n\t\tcdir := cdir_.(*Dir)\n\t\t_, dfiles, err := cdir.Files()\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tif len(dfiles) > 0 {\n\t\t\tcontinue\n\t\t}\n\t\tddirs, dstat, err := cdir.syncDirs()\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tif len(ddirs) > 0 {\n\t\t\tcontinue\n\t\t}\n\t\tdelete(dirs, cname)\n\t\tif err = dir.fs.zookeeper.Delete(cdir.zdir(), dstat.Version()); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "bd0e8cdc751dae470b04a1bb722dca62", "score": "0.5302044", "text": "func RunVolumePrune(dockerCli command.Cli, filter opts.FilterOpt) (uint64, string, error) {\n\treturn volume.RunPrune(dockerCli, filter)\n}", "title": "" }, { "docid": "39247381e351a4808cab0e99ba26cfdc", "score": "0.52994686", "text": "func cleanupGitopsPipelines(ctx context.Context, k *kabanerov1alpha2.Kabanero, c client.Client, reqLogger logr.Logger) error {\n\treqLogger.Info(\"Removing Gitops pipelines.\")\n\n\townerIsController := false\n\tassetOwner := metav1.OwnerReference{\n\t\tAPIVersion: k.APIVersion,\n\t\tKind: k.Kind,\n\t\tName: k.Name,\n\t\tUID: k.UID,\n\t\tController: &ownerIsController,\n\t}\n\n\t// Run thru the status and delete everything.... we're just going to try once since it's unlikely\n\t// that anything that goes wrong here would be rectified by a retry.\n\tfor _, pipeline := range k.Status.Gitops.Pipelines {\n\t\tfor _, asset := range pipeline.ActiveAssets {\n\t\t\t// Old assets may not have a namespace set - correct that now.\n\t\t\tif len(asset.Namespace) == 0 {\n\t\t\t\tasset.Namespace = k.GetNamespace()\n\t\t\t}\n\t\t\t\n\t\t\tcutils.DeleteAsset(c, asset, assetOwner, reqLogger)\n\t\t}\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "820bb2965c4be4b71281a712e45cdc74", "score": "0.5280739", "text": "func (r *Reconciler) garbageCollectMonitorContainers(res luResource, monitor *monitor) {\n\t// All containers are guaranteed to have container IDs if they're still active.\n\tcontainerIDs := map[string]bool{}\n\tres.visitSelectedContainers(func(pod v1alpha1.Pod, c v1alpha1.Container) bool {\n\t\tif c.ID != \"\" {\n\t\t\tcontainerIDs[c.ID] = true\n\t\t}\n\t\treturn false\n\t})\n\n\tfor key := range monitor.containers {\n\t\tif !containerIDs[key.containerID] {\n\t\t\tdelete(monitor.containers, key)\n\t\t}\n\t}\n}", "title": "" }, { "docid": "4507e75abd8a094c2d90c2dae4b7da89", "score": "0.52766454", "text": "func unregisterContainers() (int, error) {\n\tcontainers, err := dockerclient.ListContainers(docker.ListContainersOptions{})\n\tif err != nil {\n\t\treturn 0, fmt.Errorf(\"listing containers: %v\", err)\n\t}\n\n\tcount := 0\n\tfor _, c := range containers {\n\t\tif err := skydns.Delete(image2service(c.Image, false), c.ID[:10]); err != nil {\n\t\t\treturn count, fmt.Errorf(\"adding skydns entry: %v\", err)\n\t\t} else {\n\t\t\tcount++\n\t\t}\n\t}\n\n\treturn count, nil\n}", "title": "" }, { "docid": "7992bdb480300fe0b01aa6a95b6d6bcd", "score": "0.52740765", "text": "func (tangle *Tangle) Prune() error {\n\tfor _, storage := range []*objectstorage.ObjectStorage{\n\t\ttangle.transactionStorage,\n\t\ttangle.transactionMetadataStorage,\n\t\ttangle.approverStorage,\n\t\ttangle.missingTransactionsStorage,\n\t} {\n\t\tif err := storage.Prune(); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "b461e274d51165bc3f5f9276f5fd2fac", "score": "0.52614427", "text": "func (s *Storage) Prune() (err error) {\n\tfor _, storagePrune := range []func() error{\n\t\ts.transactionStorage.Prune,\n\t\ts.transactionMetadataStorage.Prune,\n\t\ts.outputStorage.Prune,\n\t\ts.outputMetadataStorage.Prune,\n\t\ts.consumerStorage.Prune,\n\t} {\n\t\tif err = storagePrune(); err != nil {\n\t\t\terr = errors.WithMessagef(cerrors.ErrFatal, \"failed to prune the object storage (%v)\", err)\n\t\t\treturn\n\t\t}\n\t}\n\n\treturn\n}", "title": "" }, { "docid": "d9fe6a882d118fc321fd257038be8d5b", "score": "0.5257742", "text": "func (r *Runner) housekeeping(ctx context.Context, in chan copyJob) chan Event {\n\tlog := r.log.WithValues(\"Stage\", \"Housekeeping\")\n\tlog.Info(\"Cleaning up undesired images from mirror registry.\")\n\n\tlog.V(1).Info(\"Creating worker pool\", \"WorkerPoolSize\", ConfigNumWorkers)\n\tdeltags := make(chan string)\n\tvar evts []chan Event\n\tfor i := 0; i < int(ConfigNumWorkers); i++ {\n\t\t// Run tag deletion using worker pool\n\t\tevts = append(evts, r.deleteTag(ctx, deltags))\n\t}\n\n\t// Setup pre-processing in the background\n\t// 'deltags' channel is where the delete orders from processing will arrive\n\t// Prepare: Emits destination directory strings through a channel\n\tprepared := r.prepare(ctx, r.config.Spec.Destinations)\n\t// Resolve each destination directory into a list of image tags [worker pool]\n\tresolved, resolveEvtCh := r.resolve(ctx, prepared)\n\tevts = append(evts, resolveEvtCh)\n\tgo func() {\n\t\t// Track which tags should be deleted\n\t\tdelTagsMap := make(map[string]struct{})\n\n\t\t// Load all images + tags from destination paths\n\t\tfor td := range resolved {\n\t\t\tdelTagsMap[td.String()] = struct{}{}\n\t\t}\n\n\t\t// Remove all tags that we want to keep\n\t\tfor tag := range in {\n\t\t\tdelete(delTagsMap, tag.dst.String())\n\t\t}\n\n\t\t// Delete the rest\n\t\tfor x := range delTagsMap {\n\t\t\tdeltags <- x\n\t\t}\n\t\tclose(deltags)\n\t}()\n\n\treturn mergeEventChs(evts...)\n}", "title": "" }, { "docid": "7adb690e8c987534db5226da4ec39982", "score": "0.52553135", "text": "func (cs *containerSetup) stopContainers() error {\n\tcs.log.Debug(\"Stopping application containers\")\n\n\tcs.appMutex.RLock()\n\tdefer cs.appMutex.RUnlock()\n\n\tfor app, container := range cs.appContainers {\n\t\tif err := container.Destroy(); err != nil {\n\t\t\tcs.log.Errorf(\"error destroying app %q container: %v\", app, err)\n\t\t}\n\t}\n\n\tif cs.initContainer != nil {\n\t\tif err := cs.initContainer.Destroy(); err != nil {\n\t\t\tcs.log.Errorf(\"error destroying init container: %v\", err)\n\t\t}\n\t}\n\n\tcs.log.Debug(\"Done stopping application containers\")\n\treturn nil\n}", "title": "" }, { "docid": "d133000389880ad63ea1c7f8896ffa72", "score": "0.5230593", "text": "func Remove(c *cli.Context) error {\n\tinfoLogger.Println(\"Remove command executed\")\n\n\t// Extract flags\n\tserviceNames := c.Args().Slice()\n\tflagRun := c.Bool(\"run\")\n\tflagDetached := c.Bool(\"detached\")\n\tflagWithVolumes := c.Bool(\"with-volumes\")\n\tflagForce := c.Bool(\"force\")\n\tflagAdvanced := c.Bool(\"advanced\")\n\n\t// Check if Docker is running\n\tutil.EnsureDockerIsRunning()\n\n\t// Clear the screen for CG output\n\tutil.ClearScreen()\n\n\t// Ask for custom compose file\n\tcomposeFilePath := \"docker-compose.yml\"\n\tif flagAdvanced {\n\t\tcomposeFilePath = util.TextQuestionWithDefault(\"From with compose file do you want to load?\", \"./docker-compose.yml\")\n\t}\n\n\t// Load project\n\tspinner := util.StartProcess(\"Loading project ...\")\n\tproj := project.LoadProject(\n\t\tproject.LoadFromComposeFile(composeFilePath),\n\t)\n\tproj.AdvancedConfig = flagAdvanced\n\tproj.ForceConfig = flagForce\n\tproj.WithVolumesConfig = flagWithVolumes\n\tutil.StopProcess(spinner)\n\tutil.InfoLogger.Println(\"Loading project (done)\")\n\tutil.Pel()\n\n\t// Execute additional validation steps\n\tcommonPass.CommonCheckForDependencyCycles(proj)\n\n\t// Ask for services to remove\n\tif len(serviceNames) == 0 {\n\t\tserviceNames = proj.Composition.ServiceNames()\n\t\tif len(serviceNames) == 0 {\n\t\t\tutil.ErrorLogger.Println(\"Removal of 0 services. Therefore aborting\")\n\t\t\tlogError(\"No services found\", true)\n\t\t}\n\t\tserviceNames = util.MultiSelectMenuQuestion(\"Which services do you want to remove?\", serviceNames)\n\t}\n\n\t// Remove selected services\n\tfor _, serviceName := range serviceNames {\n\t\tremoveService(proj, serviceName, flagWithVolumes)\n\t}\n\n\t// Save project\n\tspinner = util.StartProcess(\"Saving project ...\")\n\tproject.SaveProject(proj)\n\tutil.StopProcess(spinner)\n\tutil.Pel()\n\tutil.InfoLogger.Println(\"Saving project (done)\")\n\n\t// Run if the corresponding flag is set\n\tif flagRun || flagDetached {\n\t\tutil.DockerComposeUp(flagDetached)\n\t}\n\tutil.InfoLogger.Println(\"Docker Compose command terminated\")\n\treturn nil\n}", "title": "" }, { "docid": "f85932036f75210a000b09510d49240b", "score": "0.52238595", "text": "func (c *changedFilesAgent) prune() {\n\tc.Lock()\n\tdefer c.Unlock()\n\tc.changeCache = c.nextChangeCache\n\tc.nextChangeCache = make(map[changeCacheKey][]string)\n}", "title": "" }, { "docid": "944295f9fc15e2b67ad3fbc4c5988142", "score": "0.521671", "text": "func (Q *BlanketBoltQueue) CleanupUnclaimedTasks() error {\n\t// FIXME: Implement me\n\t// Find all tasks in queue with a worker id that have a lastModifiedTs older than the TTL\n\t// Set the WorkerId of those tasks back to ObjectId{} to allow them to get processed\n\treturn nil\n}", "title": "" }, { "docid": "28ec67fbcdcd308f7eff404d5a06b957", "score": "0.51993734", "text": "func Prune(ctx context.Context) ([]byte, error) {\n\tcmd := cli.CommandType{\n\t\tBinary: binary,\n\t\tCommand: \"prune\",\n\t\tArgs: nil,\n\t}\n\treturn cli.Run(ctx, cmd)\n}", "title": "" }, { "docid": "2c03694a21c7fbb06c9d9f0f5abd98c7", "score": "0.51876503", "text": "func (handler *OciImageHandler) PruneImages(config *ImageCacheConfig) ([]string, error) {\n\tout := handler.getOutputWriter(config)\n\tPruneImages := []string{}\n\n\tmultiError := util.MultiError{}\n\tfor _, imageName := range config.CachedImages {\n\t\tfmt.Fprint(out, fmt.Sprintf(\"Deleting '%s' from the local cache\", imageName))\n\t\tvar err error\n\t\tprogressDots := progressdots.New()\n\t\tprogressDots.SetWriter(out)\n\t\tprogressDots.Start()\n\t\tif !handler.IsImageCached(config, imageName) {\n\t\t\treturn nil, fmt.Errorf(\"Image %s is not cached\", imageName)\n\t\t}\n\t\terr = handler.pruneImage(imageName, config)\n\t\thandler.endProgress(progressDots, out, handler.progressStatusForError(err))\n\t\tmultiError.Collect(err)\n\t\tif err != nil {\n\t\t\tPruneImages = append(PruneImages, imageName)\n\t\t}\n\t}\n\n\treturn PruneImages, multiError.ToError()\n}", "title": "" }, { "docid": "dc98d32e073303855c6c8962c2d848b0", "score": "0.51835084", "text": "func filterDaemonSets(pods []corev1.Pod) []corev1.Pod {\n\tfilteredPods := []corev1.Pod{}\n\tfor _, pod := range pods {\n\t\tfor _, or := range pod.OwnerReferences {\n\t\t\tif or.Kind != \"DaemonSet\" {\n\t\t\t\tfilteredPods = append(filteredPods, pod)\n\t\t\t}\n\t\t}\n\t}\n\treturn filteredPods\n}", "title": "" }, { "docid": "42c5a52508964e74968886b624cd39f4", "score": "0.51789063", "text": "func (w *Worker) Prune(ctx context.Context, ch chan client.UsageInfo, info ...client.PruneInfo) error {\n\treturn w.CacheManager().Prune(ctx, ch, info...)\n}", "title": "" }, { "docid": "6340387a8107f5d36c0a65c08c4f2e92", "score": "0.51642394", "text": "func CleanTests() {\n\tif useCluster() {\n\t\tkubectl(\"delete\", \"ns\", \"-l\", \"porter-test=true\").RunV()\n\t}\n}", "title": "" }, { "docid": "6848c1fb58e3e7d1cd2a940e92c0a9da", "score": "0.5162157", "text": "func (prune *Prune) Process() {\n\thasResourceErr := false\n\tresourceErr := query.GetExpiredResources(\n\t\tprune.providerFlag,\n\t\tprune.regionFlag,\n\t\tprune.typeFlag,\n\t\tprune.tagFlag,\n\t\tprune.maxAgeFlag,\n\t\tprune.expiryTagFlag,\n\t\tprune.expiryTagNAValueFlag,\n\t\tprune.expiryTagFormatFlag,\n\t\tfunc(resource *cloud.Resource, hasExpired bool, expiryTime time.Time, err error) {\n\t\t\tif err != nil {\n\t\t\t\tnotification.SendMessage(fmt.Errorf(\"Could not figure out which resources have expired: %w\", err).Error())\n\t\t\t\thasResourceErr = true\n\t\t\t\treturn\n\t\t\t}\n\n\t\t\tif !hasExpired {\n\t\t\t\treturn\n\t\t\t}\n\n\t\t\t// prune the resource\n\t\t},\n\t)\n\n\tif resourceErr != nil {\n\t\tnotification.SendMessage(resourceErr.Error())\n\t\thasResourceErr = true\n\t}\n\n\tif hasResourceErr {\n\t\tcli.ExitCommandExecutionError()\n\t}\n}", "title": "" }, { "docid": "19826714c7bff09633b2f4b9945b19ff", "score": "0.5161981", "text": "func (n *NetworkingTestConfig) CleanUp() error {\n\tif n.HostTestContainerPod != nil {\n\t\treturn n.Client.Delete(context.TODO(), n.HostTestContainerPod)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "08e8e4465687107072da2a35bebaa11c", "score": "0.5160671", "text": "func removeContainers(containers []corev1.Container, removed []string, path string) (patch []rfc6902PatchOperation) {\n\tnames := map[string]bool{}\n\tfor _, name := range removed {\n\t\tnames[name] = true\n\t}\n\tfor i := len(containers) - 1; i >= 0; i-- {\n\t\tif _, ok := names[containers[i].Name]; ok {\n\t\t\tpatch = append(patch, rfc6902PatchOperation{\n\t\t\t\tOp: \"remove\",\n\t\t\t\tPath: fmt.Sprintf(\"%v/%v\", path, i),\n\t\t\t})\n\t\t}\n\t}\n\treturn patch\n}", "title": "" }, { "docid": "83a94ec5cc64f07adc8454f669825767", "score": "0.5157365", "text": "func (h ContainerHealer) unhealthyRunningContainers(containers []container) []container {\n\tunhealthy := []container{}\n\tfor _, c := range containers {\n\t\tif !h.isHealthy(&c) && h.isRunning(&c) {\n\t\t\tunhealthy = append(unhealthy, c)\n\t\t}\n\t}\n\treturn unhealthy\n}", "title": "" }, { "docid": "0d710608d29e3396101a8b9231112e2a", "score": "0.5152054", "text": "func KillAll(ctx context.Context) {\n\tlog.Println(\"Killing all docker resources ...\")\n\n\tfor _, resource := range resources {\n\t\tif err := resource.Close(); err != nil {\n\t\t\tlog.Printf(\"Go error while closing the resource, %v\", err)\n\t\t}\n\t}\n\n\t// Clean the resource array\n\tresources = []io.Closer{}\n}", "title": "" }, { "docid": "8b561ba71a0fe8d3854bcbd97dc41d42", "score": "0.51271474", "text": "func killContainer(experimentsDetails *experimentTypes.ExperimentDetails, clients clients.ClientSets, eventsDetails *types.EventDetails, chaosDetails *types.ChaosDetails, resultDetails *types.ResultDetails) error {\n\n\t//ChaosStartTimeStamp contains the start timestamp, when the chaos injection begin\n\tChaosStartTimeStamp := time.Now()\n\tduration := int(time.Since(ChaosStartTimeStamp).Seconds())\n\n\tfor duration < experimentsDetails.ChaosDuration {\n\n\t\t//getRestartCount return the restart count of target container\n\t\trestartCountBefore, err := getRestartCount(experimentsDetails, experimentsDetails.TargetPods, clients)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\t//Obtain the container ID through Pod\n\t\t// this id will be used to select the container for the kill\n\t\tcontainerID, err := common.GetContainerID(experimentsDetails.AppNS, experimentsDetails.TargetPods, experimentsDetails.TargetContainer, clients)\n\t\tif err != nil {\n\t\t\treturn errors.Errorf(\"Unable to get the container id, %v\", err)\n\t\t}\n\n\t\tlog.InfoWithValues(\"[Info]: Details of application under chaos injection\", logrus.Fields{\n\t\t\t\"PodName\": experimentsDetails.TargetPods,\n\t\t\t\"ContainerName\": experimentsDetails.TargetContainer,\n\t\t\t\"RestartCountBefore\": restartCountBefore,\n\t\t})\n\n\t\t// record the event inside chaosengine\n\t\tif experimentsDetails.EngineName != \"\" {\n\t\t\tmsg := \"Injecting \" + experimentsDetails.ExperimentName + \" chaos on application pod\"\n\t\t\ttypes.SetEngineEventAttributes(eventsDetails, types.ChaosInject, msg, \"Normal\", chaosDetails)\n\t\t\tevents.GenerateEvents(eventsDetails, clients, chaosDetails, \"ChaosEngne\")\n\t\t}\n\n\t\tswitch experimentsDetails.ContainerRuntime {\n\t\tcase \"docker\":\n\t\t\tif err := stopDockerContainer(containerID, experimentsDetails.SocketPath, experimentsDetails.Signal); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\tcase \"containerd\", \"crio\":\n\t\t\tif err := stopContainerdContainer(containerID, experimentsDetails.SocketPath, experimentsDetails.Signal); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\tdefault:\n\t\t\treturn errors.Errorf(\"%v container runtime not supported\", experimentsDetails.ContainerRuntime)\n\t\t}\n\n\t\t//Waiting for the chaos interval after chaos injection\n\t\tif experimentsDetails.ChaosInterval != 0 {\n\t\t\tlog.Infof(\"[Wait]: Wait for the chaos interval %vs\", experimentsDetails.ChaosInterval)\n\t\t\tcommon.WaitForDuration(experimentsDetails.ChaosInterval)\n\t\t}\n\n\t\t//Check the status of restarted container\n\t\terr = common.CheckContainerStatus(experimentsDetails.AppNS, experimentsDetails.TargetPods, clients)\n\t\tif err != nil {\n\t\t\treturn errors.Errorf(\"application container is not in running state, %v\", err)\n\t\t}\n\n\t\t// It will verify that the restart count of container should increase after chaos injection\n\t\terr = verifyRestartCount(experimentsDetails, experimentsDetails.TargetPods, clients, restartCountBefore)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tduration = int(time.Since(ChaosStartTimeStamp).Seconds())\n\t}\n\tif err := result.AnnotateChaosResult(resultDetails.Name, chaosDetails.ChaosNamespace, \"targeted\", \"pod\", experimentsDetails.TargetPods); err != nil {\n\t\treturn err\n\t}\n\tlog.Infof(\"[Completion]: %v chaos has been completed\", experimentsDetails.ExperimentName)\n\treturn nil\n}", "title": "" }, { "docid": "1c271b08e287fff99eab33a23b64ecbb", "score": "0.5126536", "text": "func (o PruneDeploymentsOptions) Run() error {\n\tdeploymentConfigList, err := o.AppsClient.DeploymentConfigs(o.Namespace).List(metav1.ListOptions{})\n\tif err != nil {\n\t\treturn err\n\t}\n\tdeploymentConfigs := []*appsv1.DeploymentConfig{}\n\tfor i := range deploymentConfigList.Items {\n\t\tdeploymentConfigs = append(deploymentConfigs, &deploymentConfigList.Items[i])\n\t}\n\n\tdeploymentList, err := o.KubeClient.ReplicationControllers(o.Namespace).List(metav1.ListOptions{})\n\tif err != nil {\n\t\treturn err\n\t}\n\tdeployments := []*corev1.ReplicationController{}\n\tfor i := range deploymentList.Items {\n\t\tdeployments = append(deployments, &deploymentList.Items[i])\n\t}\n\n\toptions := PrunerOptions{\n\t\tKeepYoungerThan: o.KeepYoungerThan,\n\t\tOrphans: o.Orphans,\n\t\tKeepComplete: o.KeepComplete,\n\t\tKeepFailed: o.KeepFailed,\n\t\tDeploymentConfigs: deploymentConfigs,\n\t\tDeployments: deployments,\n\t}\n\tpruner := NewPruner(options)\n\n\tw := tabwriter.NewWriter(o.Out, 10, 4, 3, ' ', 0)\n\tdefer w.Flush()\n\n\tdeploymentDeleter := &describingDeploymentDeleter{w: w}\n\n\tif o.Confirm {\n\t\tdeploymentDeleter.delegate = NewDeploymentDeleter(o.KubeClient, o.KubeClient)\n\t} else {\n\t\tfmt.Fprintln(os.Stderr, \"Dry run enabled - no modifications will be made. Add --confirm to remove deployments\")\n\t}\n\n\treturn pruner.Prune(deploymentDeleter)\n}", "title": "" }, { "docid": "6478e25afb752556ced334bde5d8eb34", "score": "0.5121615", "text": "func TestContainerRemovalRaceCondition(t *testing.T) {\n\tt.Parallel()\n\n\tutilstest.RequireRoot(t)\n\n\tconst (\n\t\ttraceName = \"trace_exec\"\n\t\tmatchingContainer = \"foo\"\n\t\tnonMatchingContainer = \"bar\"\n\t\tmatchingCommand = \"cat\"\n\t\tnonMatchingCommand = \"touch\"\n\t)\n\n\teventCallback := func(event *types.Event) {\n\t\t// \"nonMatchingCommand\" is only executed in the\n\t\t// \"nonMatching\" container that doesn't match with the\n\t\t// filter\n\t\tif event.Comm == nonMatchingCommand {\n\t\t\tt.Fatalf(\"bad event captured\")\n\t\t}\n\t}\n\n\tcc := createTestEnv(t, traceName, matchingContainer, eventCallback)\n\n\trunContainerTest := func(\n\t\tcc *containercollection.ContainerCollection,\n\t\tname string,\n\t\tf func() error,\n\t\titerations int,\n\t) error {\n\t\tfor i := 0; i < iterations; i++ {\n\t\t\tr, err := utilstest.NewRunner(&utilstest.RunnerConfig{})\n\t\t\tif err != nil {\n\t\t\t\treturn fmt.Errorf(\"failed to create runner: %w\", err)\n\t\t\t}\n\n\t\t\tcontainer := &containercollection.Container{\n\t\t\t\tID: uuid.New().String(),\n\t\t\t\tName: name,\n\t\t\t\tMntns: r.Info.MountNsID,\n\t\t\t\tPid: uint32(r.Info.Tid),\n\t\t\t}\n\n\t\t\tcc.AddContainer(container)\n\n\t\t\tif err := r.Run(f); err != nil {\n\t\t\t\treturn fmt.Errorf(\"failed to run command: %w\", err)\n\t\t\t}\n\n\t\t\tr.Close()\n\n\t\t\t// Use a delay to simulate the time it requires Inspektor Gadget to remove the\n\t\t\t// container after it's notified. Notice that the container hooks are not blocking\n\t\t\t// on the remove events, hence when we get the notification the container is already\n\t\t\t// gone.\n\t\t\ttime.AfterFunc(1*time.Millisecond, func() { cc.RemoveContainer(container.ID) })\n\t\t}\n\n\t\treturn nil\n\t}\n\n\tconst n = 1000\n\n\terrs, _ := errgroup.WithContext(context.TODO())\n\n\terrs.Go(func() error {\n\t\tcatDevNull := func() error { return generateEvent(matchingCommand) }\n\t\treturn runContainerTest(cc, matchingContainer, catDevNull, n)\n\t})\n\terrs.Go(func() error {\n\t\ttouchDevNull := func() error { return generateEvent(nonMatchingCommand) }\n\t\treturn runContainerTest(cc, nonMatchingContainer, touchDevNull, n)\n\t})\n\n\tif err := errs.Wait(); err != nil {\n\t\tt.Fatalf(\"failed generating events: %s\", err)\n\t}\n}", "title": "" }, { "docid": "303508dcf93eb6a1c0bb0c9edfc0c040", "score": "0.5119971", "text": "func (j *Janitor) cleanOldDumps(pruneFn func(ctx context.Context) (int64, bool, error), bytesToFree uint64) error {\n\tfor bytesToFree > 0 {\n\t\tbytesRemoved, pruned, err := j.cleanOldDump(pruneFn)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tif !pruned {\n\t\t\tbreak\n\t\t}\n\n\t\tif bytesRemoved >= bytesToFree {\n\t\t\tbreak\n\t\t}\n\n\t\tbytesToFree -= bytesRemoved\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "b6e8fc2dff7311a6d2044c4d84352495", "score": "0.5119798", "text": "func MarkTasksAsContainerDeallocated(taskIDs []string) error {\n\tif len(taskIDs) == 0 {\n\t\treturn nil\n\t}\n\n\tif _, err := UpdateAll(bson.M{\n\t\tIdKey: bson.M{\"$in\": taskIDs},\n\t\tExecutionPlatformKey: ExecutionPlatformContainer,\n\t}, containerDeallocatedUpdate()); err != nil {\n\t\treturn errors.Wrap(err, \"updating tasks\")\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "b6daf0f4941973ba0c2e997a20cde342", "score": "0.5117236", "text": "func (engine *EngineOperations) CleanupContainer(fatal error, status syscall.WaitStatus) error {\n\tsylog.Debugf(\"Cleanup container\")\n\n\tif engine.EngineConfig.GetDeleteImage() {\n\t\timage := engine.EngineConfig.GetImage()\n\t\tsylog.Verbosef(\"Removing image %s\", image)\n\t\tsylog.Infof(\"Cleaning up image...\")\n\t\tif err := os.RemoveAll(image); err != nil {\n\t\t\tsylog.Errorf(\"failed to delete container image %s: %s\", image, err)\n\t\t}\n\t}\n\n\tif engine.EngineConfig.Network != nil {\n\t\tif err := engine.EngineConfig.Network.DelNetworks(); err != nil {\n\t\t\tsylog.Errorf(\"%s\", err)\n\t\t}\n\t}\n\n\tif engine.EngineConfig.Cgroups != nil {\n\t\tif err := engine.EngineConfig.Cgroups.Remove(); err != nil {\n\t\t\tsylog.Errorf(\"%s\", err)\n\t\t}\n\t}\n\n\tif engine.EngineConfig.GetInstance() {\n\t\tuid := os.Getuid()\n\n\t\tfile, err := instance.Get(engine.CommonConfig.ContainerID, instance.SingSubDir)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\tif file.PPid != os.Getpid() {\n\t\t\treturn nil\n\t\t}\n\n\t\tif file.Privileged {\n\t\t\tvar err error\n\n\t\t\tmainthread.Execute(func() {\n\t\t\t\tif err = syscall.Setresuid(0, 0, uid); err != nil {\n\t\t\t\t\terr = fmt.Errorf(\"failed to escalate privileges\")\n\t\t\t\t\treturn\n\t\t\t\t}\n\t\t\t\tdefer syscall.Setresuid(uid, uid, 0)\n\n\t\t\t\tif err = file.Delete(); err != nil {\n\t\t\t\t\treturn\n\t\t\t\t}\n\t\t\t})\n\t\t\treturn err\n\t\t}\n\t\treturn file.Delete()\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "dbd6e70ea47c31a7b0ffae90de413d35", "score": "0.5106553", "text": "func (m *NetworkManager) Prune(ctx context.Context, request *PruneRequest) (*PruneReply, error) {\n\tnetworkSet := map[string]struct{}{}\n\tfor _, ID := range request.IDs {\n\t\tname := fmt.Sprintf(\"%s%s\", networkPrefix, ID)\n\t\tnameLink, ok := truncLinkName(name)\n\t\tif ok {\n\t\t\tm.log.Debugf(\"truncated network name %s -> %s\", name, nameLink)\n\t\t}\n\n\t\tnetworkSet[nameLink] = struct{}{}\n\t}\n\n\tresult := map[string]error{}\n\n\tfilter := filters.NewArgs()\n\tfilter.Add(\"label\", tagSonmNetwork)\n\tnetworks, err := m.dockerClient.NetworkList(ctx, types.NetworkListOptions{\n\t\tFilters: filter,\n\t})\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tm.log.Debugw(\"found SONM networks\", zap.Any(\"networks\", networks))\n\n\tfor _, network := range networks {\n\t\tresult[network.Name] = m.dockerClient.NetworkRemove(ctx, network.ID)\n\t}\n\n\treturn &PruneReply{Result: result}, nil\n}", "title": "" }, { "docid": "fcb5c1683ae2f36498c1ef79d9e3fdb8", "score": "0.5099648", "text": "func (k8s *K8s) CleanupCRDs() {\n\t// Clean up Network Services\n\tservices, _ := k8s.versionedClientSet.NetworkserviceV1alpha1().NetworkServices(k8s.namespace).List(context.TODO(), metaV1.ListOptions{})\n\tfor _, service := range services.Items {\n\t\t_ = k8s.versionedClientSet.NetworkserviceV1alpha1().NetworkServices(k8s.namespace).Delete(context.TODO(), service.Name, metaV1.DeleteOptions{})\n\t}\n\n\t// Clean up Network Service Endpoints\n\tendpoints, _ := k8s.versionedClientSet.NetworkserviceV1alpha1().NetworkServiceEndpoints(k8s.namespace).List(context.TODO(), metaV1.ListOptions{})\n\tfor _, ep := range endpoints.Items {\n\t\t_ = k8s.versionedClientSet.NetworkserviceV1alpha1().NetworkServiceEndpoints(k8s.namespace).Delete(context.TODO(), ep.Name, metaV1.DeleteOptions{})\n\t}\n\n\t// Clean up Network Service Managers\n\tmanagers, _ := k8s.versionedClientSet.NetworkserviceV1alpha1().NetworkServiceManagers(k8s.namespace).List(context.TODO(), metaV1.ListOptions{})\n\tfor _, mgr := range managers.Items {\n\t\t_ = k8s.versionedClientSet.NetworkserviceV1alpha1().NetworkServiceManagers(k8s.namespace).Delete(context.TODO(), mgr.Name, metaV1.DeleteOptions{})\n\t}\n}", "title": "" }, { "docid": "ae34b91a68956c7b6f69ee95d46a9b38", "score": "0.5097758", "text": "func stopPreviousRun(c *client.Client, stages []*pipeline.Stage) error {\n\tfor _, stage := range stages {\n\t\terr := c.ContainerKill(context.Background(), stage.Name, \"9\")\n\t\tif err != nil {\n\t\t\tif !strings.Contains(err.Error(), \"No such\") &&\n\t\t\t\t!strings.Contains(err.Error(), \"not running\") {\n\t\t\t\treturn errors.Wrap(err, \"Could not kill container \"+stage.Name)\n\t\t\t}\n\t\t}\n\n\t\t// if the stage has caching enabled we can't remove it just yet. Its\n\t\t// exits codes etc. may be used in later pipeline runs\n\t\tif !stage.Cache {\n\t\t\terr = c.ContainerRemove(context.Background(), stage.Name,\n\t\t\t\ttypes.ContainerRemoveOptions{RemoveVolumes: true,\n\t\t\t\t\tForce: true})\n\t\t\tif err != nil {\n\t\t\t\tif !strings.Contains(err.Error(), \"No such\") {\n\t\t\t\t\treturn errors.Wrap(err, \"Could not remove container \"+stage.Name)\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "0f151678db83bf4bc969c21eb68c03e0", "score": "0.50945246", "text": "func KillContainer(experimentsDetails *experimentTypes.ExperimentDetails, clients clients.ClientSets, eventsDetails *types.EventDetails, chaosDetails *types.ChaosDetails) error {\n\n\t// getting the current timestamp, it will help to kepp track the total chaos duration\n\tChaosStartTimeStamp := time.Now().Unix()\n\n\tfor iteration := 0; iteration < experimentsDetails.Iterations; iteration++ {\n\n\t\t//Obtain the pod ID of the application pod\n\t\tpodID, err := GetPodID(experimentsDetails)\n\t\tif err != nil {\n\t\t\treturn errors.Errorf(\"Unable to get the pod id, %v\", err)\n\t\t}\n\n\t\t//GetRestartCount return the restart count of target container\n\t\trestartCountBefore, err := GetRestartCount(experimentsDetails, experimentsDetails.TargetPods, clients)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\t//Obtain the container ID through Pod\n\t\t// this id will be used to select the container for kill\n\t\tcontainerID, err := GetContainerID(experimentsDetails, podID)\n\t\tif err != nil {\n\t\t\treturn errors.Errorf(\"Unable to get the container id, %v\", err)\n\t\t}\n\n\t\tlog.InfoWithValues(\"[Info]: Details of application under chaos injection\", logrus.Fields{\n\t\t\t\"PodName\": experimentsDetails.TargetPods,\n\t\t\t\"ContainerName\": experimentsDetails.TargetContainer,\n\t\t\t\"RestartCountBefore\": restartCountBefore,\n\t\t})\n\n\t\t// record the event inside chaosengine\n\t\tif experimentsDetails.EngineName != \"\" {\n\t\t\tmsg := \"Injecting \" + experimentsDetails.ExperimentName + \" chaos on application pod\"\n\t\t\ttypes.SetEngineEventAttributes(eventsDetails, types.ChaosInject, msg, \"Normal\", chaosDetails)\n\t\t\tevents.GenerateEvents(eventsDetails, clients, chaosDetails, \"ChaosEngne\")\n\t\t}\n\n\t\t// killing the application container\n\t\tStopContainer(containerID)\n\n\t\t//Waiting for the chaos interval after chaos injection\n\t\tif experimentsDetails.ChaosInterval != 0 {\n\t\t\tlog.Infof(\"[Wait]: Wait for the chaos interval %vs\", experimentsDetails.ChaosInterval)\n\t\t\twaitForChaosInterval(experimentsDetails)\n\t\t}\n\n\t\t//Check the status of restarted container\n\t\terr = CheckContainerStatus(experimentsDetails, clients, experimentsDetails.TargetPods)\n\t\tif err != nil {\n\t\t\treturn errors.Errorf(\"Application container is not in running state, %v\", err)\n\t\t}\n\n\t\t// It will verify that the restart count of container should increase after chaos injection\n\t\terr = VerifyRestartCount(experimentsDetails, experimentsDetails.TargetPods, clients, restartCountBefore)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\t// generating the total duration of the experiment run\n\t\tChaosCurrentTimeStamp := time.Now().Unix()\n\t\tchaosDiffTimeStamp := ChaosCurrentTimeStamp - ChaosStartTimeStamp\n\n\t\t// terminating the execution after the timestamp exceed the total chaos duration\n\t\tif int(chaosDiffTimeStamp) >= experimentsDetails.ChaosDuration {\n\t\t\tbreak\n\t\t}\n\n\t}\n\tlog.Infof(\"[Completion]: %v chaos has been completed\", experimentsDetails.ExperimentName)\n\treturn nil\n\n}", "title": "" }, { "docid": "55da970707fe5bbcf9797c53b3fb8167", "score": "0.5092103", "text": "func DirtyCheck() {\n\tdriver, err := GetIPDriver()\n\tif err != nil {\n\t\tblog.Errorf(\"Get driver error in check mode, %s\", err.Error())\n\t\treturn\n\t}\n\thostIP := util.GetIPAddress()\n\thostInfo, err := driver.GetHostInfo(hostIP)\n\tif err != nil {\n\t\tblog.Errorf(\"Get host info in check mode failed, %s\", err.Error())\n\t\treturn\n\t}\n\tif hostInfo.Containers == nil || len(hostInfo.Containers) == 0 {\n\t\tblog.Infof(\"No active container & ip address in host %s, normal exit\", hostIP)\n\t\treturn\n\t}\n\tclient, err := dockerclient.NewClient(defaultContainerSock)\n\tif err != nil {\n\t\tblog.Errorf(\"Create docker container client err, %s\", err.Error())\n\t\treturn\n\t}\n\t//Get all running container info from Container Runtime\n\tcontainers, err := client.ListContainers(dockerclient.ListContainersOptions{All: false})\n\tif err != nil {\n\t\tblog.Errorf(\"List all docker container err, %s\", err.Error())\n\t\treturn\n\t}\n\t//ready to clean map in HostInfo\n\tfor _, container := range containers {\n\t\tif con, ok := hostInfo.Containers[container.ID]; ok {\n\t\t\tblog.Infof(\"Container %s is running with ip %s in host %s, skip.\", container.ID, con.IPAddr, hostInfo.IPAddr)\n\t\t\tdelete(hostInfo.Containers, container.ID)\n\t\t}\n\t}\n\tif len(hostInfo.Containers) == 0 {\n\t\tblog.Infof(\"No dirty Container data in storage, bcs-ipam check mode process finish.\")\n\t\treturn\n\t}\n\t//Now all left in HostInfo.Containers is dirty data\n\t//in database, ready to release ip address with Driver\n\tfor containerID, ipInst := range hostInfo.Containers {\n\t\tif ipInst.Container != containerID {\n\t\t\tblog.Warnf(\"##container info mismatch warnning, host: %s, ip inst: %s\", containerID, ipInst.Container)\n\t\t}\n\t\tipInfo := &nettypes.IPInfo{}\n\t\tblog.Errorf(\"Host %s release dirty ip %s in container %s\", hostIP, ipInst.IPAddr, containerID)\n\t\terr := driver.ReleaseIPAddr(hostIP, containerID, ipInfo)\n\t\tif err != nil {\n\t\t\tblog.Errorf(\"Host %s release container %s/%s err, %s\", hostIP, containerID, ipInst.IPAddr, err.Error())\n\t\t\tcontinue\n\t\t}\n\t}\n\tblog.Info(\"bcs-ipam check mode process finish.\")\n}", "title": "" }, { "docid": "969602e2404695ff0e947427880130c3", "score": "0.5077022", "text": "func quiesceDaemonSets(c client.Client, ns string) error {\n\tlist := appsv1.DaemonSetList{}\n\toptions := client.ListOptions{Namespace: ns}\n\terr := c.List(\n\t\tcontext.TODO(),\n\t\t&list,\n\t\t&options)\n\tif err != nil {\n\t\treturn err\n\t}\n\tfor _, set := range list.Items {\n\t\tif set.Annotations == nil {\n\t\t\tset.Annotations = make(map[string]string)\n\t\t}\n\t\tif set.Spec.Template.Spec.NodeSelector == nil {\n\t\t\tset.Spec.Template.Spec.NodeSelector = map[string]string{}\n\t\t} else if _, exist := set.Spec.Template.Spec.NodeSelector[QuiesceNodeSelector]; exist {\n\t\t\tcontinue\n\t\t}\n\t\tselector, err := json.Marshal(set.Spec.Template.Spec.NodeSelector)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tset.Annotations[NodeSelectorAnnotation] = string(selector)\n\t\tset.Spec.Template.Spec.NodeSelector[QuiesceNodeSelector] = \"true\"\n\t\terr = c.Update(context.TODO(), &set)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "d9b130b83a0b55806c968d38b045f26d", "score": "0.5062501", "text": "func (r *KubernetesReporter) Cleanup() {\n}", "title": "" }, { "docid": "ad72c221d7973b89efee82e34c7130f1", "score": "0.5054608", "text": "func (e *EngineOperations) CleanupContainer(context.Context, error, syscall.WaitStatus) error {\n\treturn nil\n}", "title": "" }, { "docid": "02823db1a682e1e4f6196ff10306455c", "score": "0.50410026", "text": "func prune(ctx context.Context, state *State, root string, getChildren existence.GetChildrenFunc) error {\n\tpaths := make([]string, 0, len(state.DocumentData))\n\tfor _, doc := range state.DocumentData {\n\t\tpaths = append(paths, doc.URI)\n\t}\n\n\tchecker, err := existence.NewExistenceChecker(ctx, root, paths, getChildren)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tfor documentID, doc := range state.DocumentData {\n\t\tif !checker.Exists(doc.URI) {\n\t\t\t// Document does not exist in git\n\t\t\tdelete(state.DocumentData, documentID)\n\t\t}\n\t}\n\n\tpruneFromDefinitionReferences(state, state.DefinitionData)\n\tpruneFromDefinitionReferences(state, state.ReferenceData)\n\treturn nil\n}", "title": "" }, { "docid": "fa4a457fee7332f180b49dcd31d317d3", "score": "0.5036881", "text": "func imageIsPrunable(g graph.Graph, imageNode *imagegraph.ImageNode, algorithm pruneAlgorithm) bool {\n\tif !algorithm.allImages {\n\t\tif imageNode.Image.Annotations[imageapi.ManagedByOpenShiftAnnotation] != \"true\" {\n\t\t\tglog.V(4).Infof(\"Image %q with DockerImageReference %q belongs to an external registry - skipping\",\n\t\t\t\timageNode.Image.Name, imageNode.Image.DockerImageReference)\n\t\t\treturn false\n\t\t}\n\t}\n\n\tif !algorithm.pruneOverSizeLimit && imageNode.Image.CreationTimestamp.Time.After(algorithm.keepYoungerThan) {\n\t\tglog.V(4).Infof(\"Image %q is younger than minimum pruning age\", imageNode.Image.Name)\n\t\treturn false\n\t}\n\n\tfor _, n := range g.To(imageNode) {\n\t\tglog.V(4).Infof(\"Examining predecessor %#v\", n)\n\t\tif edgeKind(g, n, imageNode, ReferencedImageEdgeKind) {\n\t\t\tglog.V(4).Infof(\"Strong reference detected\")\n\t\t\treturn false\n\t\t}\n\t}\n\n\treturn true\n}", "title": "" }, { "docid": "b9c9a51bd8e205c43945eb875b890284", "score": "0.5026645", "text": "func (repo *RepoMemory) CleanUp() {\n\n}", "title": "" }, { "docid": "30d4710d0e08ee9c32903671f21e44bb", "score": "0.50261766", "text": "func (p *staticPolicy) RemoveContainer(s state.State, podUID string, containerName string) {\n\tblocks := s.GetMemoryBlocks(podUID, containerName)\n\tif blocks == nil {\n\t\treturn\n\t}\n\n\tklog.InfoS(\"RemoveContainer\", \"podUID\", podUID, \"containerName\", containerName)\n\ts.Delete(podUID, containerName)\n\n\t// Mutate machine memory state to update free and reserved memory\n\tmachineState := s.GetMachineState()\n\tfor _, b := range blocks {\n\t\treleasedSize := b.Size\n\t\tfor _, nodeID := range b.NUMAAffinity {\n\t\t\tmachineState[nodeID].NumberOfAssignments--\n\n\t\t\t// once we do not have any memory allocations on this node, clear node groups\n\t\t\tif machineState[nodeID].NumberOfAssignments == 0 {\n\t\t\t\tmachineState[nodeID].Cells = []int{nodeID}\n\t\t\t}\n\n\t\t\t// we still need to pass over all NUMA node under the affinity mask to update them\n\t\t\tif releasedSize == 0 {\n\t\t\t\tcontinue\n\t\t\t}\n\n\t\t\tnodeResourceMemoryState := machineState[nodeID].MemoryMap[b.Type]\n\n\t\t\t// if the node does not have reserved memory to free, continue to the next node\n\t\t\tif nodeResourceMemoryState.Reserved == 0 {\n\t\t\t\tcontinue\n\t\t\t}\n\n\t\t\t// the reserved memory smaller than the amount of the memory that should be released\n\t\t\t// release as much as possible and move to the next node\n\t\t\tif nodeResourceMemoryState.Reserved < releasedSize {\n\t\t\t\treleasedSize -= nodeResourceMemoryState.Reserved\n\t\t\t\tnodeResourceMemoryState.Free += nodeResourceMemoryState.Reserved\n\t\t\t\tnodeResourceMemoryState.Reserved = 0\n\t\t\t\tcontinue\n\t\t\t}\n\n\t\t\t// the reserved memory big enough to satisfy the released memory\n\t\t\tnodeResourceMemoryState.Free += releasedSize\n\t\t\tnodeResourceMemoryState.Reserved -= releasedSize\n\t\t\treleasedSize = 0\n\t\t}\n\t}\n\n\ts.SetMachineState(machineState)\n}", "title": "" }, { "docid": "87c71eda19993214cd97d73115916fbe", "score": "0.50191647", "text": "func evictPods(ctx context.Context, cl client.Client, podList *corev1.PodList) error {\n\tfor i := range podList.Items {\n\t\tif err := evictPod(ctx, cl, &podList.Items[i]); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\tfor i := range podList.Items {\n\t\tif err := waitPodForDelete(ctx, cl, &podList.Items[i]); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "ad462a60f87a2523cbedc3ce5395ef0e", "score": "0.5011681", "text": "func pause(cr cruntime.Manager, r command.Runner, namespaces []string) ([]string, error) {\n\tids := []string{}\n\n\t// Disable the kubelet so it does not attempt to restart paused pods\n\tsm := sysinit.New(r)\n\tklog.Info(\"kubelet running: \", sm.Active(\"kubelet\"))\n\n\tif err := sm.DisableNow(\"kubelet\"); err != nil {\n\t\treturn ids, errors.Wrap(err, \"kubelet disable --now\")\n\t}\n\n\tids, err := cr.ListContainers(cruntime.ListContainersOptions{State: cruntime.Running, Namespaces: namespaces})\n\tif err != nil {\n\t\treturn ids, errors.Wrap(err, \"list running\")\n\t}\n\n\tif len(ids) == 0 {\n\t\tklog.Warningf(\"no running containers to pause\")\n\t\treturn ids, nil\n\t}\n\n\tif err := cr.PauseContainers(ids); err != nil {\n\t\treturn ids, errors.Wrap(err, \"pausing containers\")\n\t}\n\n\tif doesNamespaceContainKubeSystem(namespaces) {\n\t\tpkgpause.CreatePausedFile(r)\n\t}\n\n\treturn ids, nil\n}", "title": "" }, { "docid": "2bfb35e4a39fbaf43f43d44d2a857a40", "score": "0.50111514", "text": "func (pool *Pool) RemoveAll() {\n\n}", "title": "" }, { "docid": "0b54c5123cca13a729b468ae4b4bed99", "score": "0.5005292", "text": "func (policy *EnnPolicy) checkUnusedIPSets() error{\n\n\tglog.V(4).Infof(\"start to check unsued ipsets\")\n\tipsetsName, err := policy.ipsetInterface.ListIPSetsName()\n\tif err != nil{\n\t\treturn fmt.Errorf(\"check unused ipsets error %v\", err)\n\t}\n\tfor _, ipsetName := range ipsetsName{\n\t\t// check whech ipset is created by enn-policy\n\t\tif strings.HasPrefix(ipsetName, \"ENN\"){\n\t\t\t_, ok := policy.activeIPSets[ipsetName]\n\t\t\tif !ok{\n\t\t\t\tipset, err := policy.ipsetInterface.GetIPSet(ipsetName)\n\t\t\t\tif err!= nil{\n\t\t\t\t\tglog.Errorf(\"check unused ipsets error %v\", err)\n\t\t\t\t\tcontinue\n\t\t\t\t}\n\t\t\t\tglog.V(4).Infof(\"find unusd ipset %s type %s\", ipset.Name, ipset.Type)\n\t\t\t\terr = policy.ipsetInterface.DestroyIPSet(ipset)\n\t\t\t\tif err!= nil{\n\t\t\t\t\tglog.Errorf(\"check unused ipsets error %v\", err)\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\tfor namespaceLabel, ipset := range policy.podLabelSet{\n\t\tipsetName := ipset.Name\n\t\t_, ok := policy.activeIPSets[ipsetName]\n\t\tif !ok{\n\t\t\tglog.V(4).Infof(\"find inavtive ipset:%s in podLabelSet so delete it\", ipsetName)\n\t\t\tdelete(policy.podLabelSet, namespaceLabel)\n\t\t}\n\t}\n\n\tfor label, ipset := range policy.namespacePodLabelSet{\n\t\tipsetName := ipset.Name\n\t\t_, ok := policy.activeIPSets[ipsetName]\n\t\tif !ok{\n\t\t\tglog.V(4).Infof(\"find inavtive ipset:%s in namespacePodLabelSet so delete it\", ipsetName)\n\t\t\tdelete(policy.namespacePodLabelSet, label)\n\t\t}\n\t}\n\n\tfor namespace, ipset := range policy.namespacePodSet{\n\t\tipsetName := ipset.Name\n\t\t_, ok := policy.activeIPSets[ipsetName]\n\t\tif !ok{\n\t\t\tglog.V(4).Infof(\"find inavtive ipset:%s in namespacePodSet so delete it\", ipsetName)\n\t\t\tdelete(policy.namespacePodSet, namespace)\n\t\t}\n\t}\n\n\tfor namespacedName, ipset := range policy.podXLabelSet{\n\t\tipsetName := ipset.Name\n\t\t_, ok := policy.activeIPSets[ipsetName]\n\t\tif !ok{\n\t\t\tglog.V(4).Infof(\"find inavtive ipset:%s in podXLabelSet so delete it\", ipsetName)\n\t\t\tdelete(policy.podXLabelSet, namespacedName)\n\t\t}\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "784d0a6b2ecfd91747ea78b6b833ea5a", "score": "0.50051737", "text": "func Prune(jobConfig *prowconfig.JobConfig, generator Generator, pruneLabels labels.Set) (*prowconfig.JobConfig, error) {\n\tvar pruned prowconfig.JobConfig\n\tstaleSelector, err := staleSelectorFor(generator, pruneLabels)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tisStale := func(job prowconfig.JobBase) bool {\n\t\treturn staleSelector.Matches(labels.Set(job.Labels))\n\t}\n\tgeneratedSelector, err := generatedSelectorFor(generator)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tisGenerated := func(job prowconfig.JobBase) bool {\n\t\treturn generatedSelector.Matches(labels.Set(job.Labels))\n\t}\n\n\tfor repo, jobs := range jobConfig.PresubmitsStatic {\n\t\tfor _, job := range jobs {\n\t\t\tif isStale(job.JobBase) {\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tif isGenerated(job.JobBase) {\n\t\t\t\tdelete(job.Labels, string(generator))\n\t\t\t}\n\n\t\t\tif pruned.PresubmitsStatic == nil {\n\t\t\t\tpruned.PresubmitsStatic = map[string][]prowconfig.Presubmit{}\n\t\t\t}\n\n\t\t\tpruned.PresubmitsStatic[repo] = append(pruned.PresubmitsStatic[repo], job)\n\t\t}\n\t}\n\n\tfor repo, jobs := range jobConfig.PostsubmitsStatic {\n\t\tfor _, job := range jobs {\n\t\t\tif isStale(job.JobBase) {\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tif isGenerated(job.JobBase) {\n\t\t\t\tdelete(job.Labels, string(generator))\n\t\t\t}\n\t\t\tif pruned.PostsubmitsStatic == nil {\n\t\t\t\tpruned.PostsubmitsStatic = map[string][]prowconfig.Postsubmit{}\n\t\t\t}\n\n\t\t\tpruned.PostsubmitsStatic[repo] = append(pruned.PostsubmitsStatic[repo], job)\n\t\t}\n\t}\n\n\tfor _, job := range jobConfig.Periodics {\n\t\tif isStale(job.JobBase) {\n\t\t\tcontinue\n\t\t}\n\t\tif isGenerated(job.JobBase) {\n\t\t\tdelete(job.Labels, string(generator))\n\t\t}\n\n\t\tpruned.Periodics = append(pruned.Periodics, job)\n\t}\n\n\treturn &pruned, nil\n}", "title": "" }, { "docid": "5193250a45b3ffe9692fe91e3f042a5e", "score": "0.5004215", "text": "func Cleanup(namespace string, coreInterface kubernetes.Interface) error {\n\tgracePeriod := int64(0)\n\tdeleteOptions := metav1.DeleteOptions{GracePeriodSeconds: &gracePeriod}\n\tlistOptions := metav1.ListOptions{LabelSelector: \"app=test-counter-pod\"}\n\tif err := coreInterface.CoreV1().Pods(namespace).DeleteCollection(&deleteOptions, listOptions); err != nil {\n\t\treturn errors.Wrap(err, \"cannot delete test-counter-pod\")\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "859a562bbf49f496aab75f197f3a43af", "score": "0.5003004", "text": "func (s *Instances) cull() {\n\ts.mutex.Lock()\n\tdefer s.mutex.Unlock()\n\tsort.Sort(instanceSlice(s.pool))\n\tcull := s.pool[len(s.pool)-MIN_POOL_SIZE:]\n\tfor _, co := range cull {\n\t\tif co.uuid != \"\" {\n\t\t\tco.Stop()\n\t\t}\n\t}\n}", "title": "" }, { "docid": "038a8e4f76ad905de8a727c33dbac15a", "score": "0.49992907", "text": "func (p *Pod) Kill(signal uint) (map[string]error, error) {\n\tp.lock.Lock()\n\tdefer p.lock.Unlock()\n\n\tif !p.valid {\n\t\treturn nil, ErrPodRemoved\n\t}\n\n\tallCtrs, err := p.runtime.state.PodContainers(p)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\t// We need to lock all the containers\n\tfor _, ctr := range allCtrs {\n\t\tctr.lock.Lock()\n\t\tdefer ctr.lock.Unlock()\n\n\t\tif err := ctr.syncContainer(); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\n\tctrErrors := make(map[string]error)\n\n\t// Send a signal to all containers\n\tfor _, ctr := range allCtrs {\n\t\t// Ignore containers that are not running\n\t\tif ctr.state.State != ContainerStateRunning {\n\t\t\tcontinue\n\t\t}\n\n\t\tif err := ctr.runtime.ociRuntime.killContainer(ctr, signal); err != nil {\n\t\t\tctrErrors[ctr.ID()] = err\n\t\t\tcontinue\n\t\t}\n\n\t\tlogrus.Debugf(\"Killed container %s with signal %d\", ctr.ID(), signal)\n\t}\n\n\tif len(ctrErrors) > 0 {\n\t\treturn ctrErrors, nil\n\t}\n\n\treturn nil, nil\n}", "title": "" }, { "docid": "d1654b59be168f126d38967a42519192", "score": "0.4998526", "text": "func (s *Waller) removeOrphanRules(chain string, currentContainers map[string][]string) ([]string, error) {\n\tlogrus.Debugf(\"Retrieving iptables rules for %s\", chain)\n\trules, err1 := osutils.ExecShellf(\"iptables -L %s -v --line-number\", chain)\n\tif err1 != nil {\n\t\treturn nil, err1\n\t}\n\trul, err2 := dsutils.LinesToArray(rules)\n\tif err2 != nil {\n\t\treturn nil, err2\n\t}\n\n\tcidregex1, _ := regexp.Compile(\"match-set ([0-9a-zA-Z]+)-dst dst\")\n\tcidregex2, _ := regexp.Compile(\"nflog-prefix ([0-9a-zA-Z]+) nflog-group\")\n\tlineregex, _ := regexp.Compile(\"^([0-9]+)\")\n\n\t//invert rules order so that we can remove rules without changing the line numbers\n\trul = dsutils.ReverseArray(rul)\n\n\tocids := make([]string, 0)\n\tfor _, v := range rul {\n\t\tcid := \"\"\n\t\tss1 := cidregex1.FindStringSubmatch(v)\n\t\tif len(ss1) == 2 {\n\t\t\tcid = ss1[1]\n\t\t}\n\t\tss2 := cidregex2.FindStringSubmatch(v)\n\t\tif len(ss2) == 2 {\n\t\t\tcid = ss2[1]\n\t\t}\n\t\tif cid != \"\" {\n\t\t\tlogrus.Debugf(\"Found container %s in iptables rule %s\", cid, chain)\n\t\t\t_, exists := currentContainers[cid]\n\t\t\tif !exists {\n\t\t\t\tlogrus.Infof(\"Found iptables rule for %s, but it doesn't exist anymore. Removing. v=%s\", cid, v)\n\t\t\t\tls := lineregex.FindStringSubmatch(v)\n\t\t\t\tif len(ls) == 2 {\n\t\t\t\t\tline := ls[1]\n\n\t\t\t\t\t//IPTABLES RULES\n\t\t\t\t\tlogrus.Debugf(\"Found orphan rule %s for container %s. Removing it.\", line, cid)\n\t\t\t\t\t_, err4 := osutils.ExecShellf(\"iptables -D %s %s\", chain, line)\n\t\t\t\t\tif err4 != nil {\n\t\t\t\t\t\treturn nil, fmt.Errorf(\"Error removing rule on line %s for container %s. err=%s\", line, cid, err4)\n\t\t\t\t\t}\n\t\t\t\t\tocids = append(ocids, cid)\n\t\t\t\t\tlogrus.Infof(\"Rule for %s removed successfully\", cid)\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tlogrus.Debugf(\"Rules for %s are not orphan\", cid)\n\t\t\t}\n\t\t}\n\t}\n\treturn ocids, nil\n}", "title": "" }, { "docid": "48a5f599865806b40a321a30304db47b", "score": "0.49938533", "text": "func (h *hnsw) CleanUpTombstonedNodes(shouldAbort cyclemanager.ShouldAbortCallback) error {\n\t_, err := h.cleanUpTombstonedNodes(shouldAbort)\n\treturn err\n}", "title": "" } ]
349e3d2bf8f0cc82eca6491da0d6f526
Input: nums[2,1,2,5,3,2] Output: 2
[ { "docid": "10ad4e3f5ec769f6e841d879f49380e6", "score": "0.60500234", "text": "func repeatedNTimes(nums []int) int {\n\tvar l int = len (nums)\n\tfor i := 2;i < l;i++{\n\t\tif nums[i] == nums[i - 1] || nums[i] == nums[i - 2]{\n\t\t\treturn nums[i]\n\t\t}\n\t}\n\treturn nums[0]\n}", "title": "" } ]
[ { "docid": "73d6e4f3ceb8b970407c54e1e349ce70", "score": "0.66882926", "text": "func singleNumberII(nums []int) int {\n\tif len(nums) == 1 {\n\t\treturn nums[0]\n\t}\n\tquickSort(nums, 0, len(nums)-1)\n\ti := 0\n\tfor i < len(nums) - 1 {\n\t\tif nums[i] == nums[i+1] {\n\t\t\ti+=3\n\t\t\tcontinue\n\t\t} else {\n\t\t\treturn nums[i]\n\t\t}\n\t}\n\treturn nums[i]\n}", "title": "" }, { "docid": "9606dd5fc884b0dee0135be6b4f0e36f", "score": "0.665963", "text": "func findMin(nums []int) int {\n \n}", "title": "" }, { "docid": "0f4ebe0c38a608da0bdea631e8656fd2", "score": "0.6606764", "text": "func singleNumber(nums []int) int {\n\tmark := make(map[int]int)\n\tnum := 0\n\tfor _, v := range nums {\n\t\tif _, ok := mark[v]; ok {\n\t\t\tmark[v]++\n\t\t} else {\n\t\t\tmark[v] = 1\n\t\t}\n\t}\n\tfor k, v := range mark {\n\t\tif v == 1 {\n\t\t\tnum = k\n\t\t\tbreak\n\t\t}\n\t}\n\treturn num\n}", "title": "" }, { "docid": "67834458ea6d23310cc901917be78b9a", "score": "0.65425897", "text": "func majorityElement(nums []int) int {\n length := len(nums) >> 1 + 1\n answer := make(map[int]int, length);\n for _, v := range nums {\n answer[v]++\n }\n for i, v := range answer {\n if( v >= length){\n return i\n }\n }\n return nums[0]\n}", "title": "" }, { "docid": "15f7c918008ad0c04a762cdb88d5afbd", "score": "0.6506529", "text": "func sumOfUnique(nums []int) int {\n\tres := 0\n\tm := make([]int, 100)\n\tfor _, v := range nums {\n\t\tv--\n\t\tm[v]++\n\t\tif m[v] == 1 {\n\t\t\tres += v + 1\n\t\t} else if m[v] == 2 {\n\t\t\tres -= v + 1\n\t\t}\n\t}\n\treturn res\n}", "title": "" }, { "docid": "f7138b64db52a368c0c2369233d6076e", "score": "0.6447848", "text": "func countOf(nums []int, val int) int {\n\tcount := 0\n\n\tfor _, n := range nums {\n\t\tif n == val {\n\t\t\tcount++\n\t\t}\n\t}\n\n\treturn count\n}", "title": "" }, { "docid": "e8812bcfb11b943f8985f61e07082936", "score": "0.6407367", "text": "func missingNumber(nums []int) int {\n\n}", "title": "" }, { "docid": "630381439ef6e2e1d44e3d689615e0f0", "score": "0.6395553", "text": "func firstMissingPositive2(nums []int) int {\n\thash := map[int]bool{}\n\tfor _, v := range nums {\n\t\tif v > 0 {\n\t\t\thash[v] = true\n\t\t}\n\t}\n\n\tfor i := 1; i <= len(hash); i++ {\n\t\tif !hash[i] {\n\t\t\treturn i\n\t\t}\n\t}\n\treturn len(hash) + 1\n}", "title": "" }, { "docid": "0916ef5499fc49a79a540a0c6d6d0de9", "score": "0.6387456", "text": "func findFinalValue(nums []int, ori int) int {\n\tm := make(map[int]bool, len(nums))\n\tfor _, v := range nums {\n\t\tm[v] = true\n\t}\n\tfor m[ori] {\n\t\tori *= 2\n\t}\n\n\treturn ori\n}", "title": "" }, { "docid": "f01ec0fafa18f7bd8799fd89aa7c87d3", "score": "0.6360935", "text": "func Solution(A []int) int {\n\t// write your code in Go 1.4\n\n\tmaxValue := math.MinInt64\n\tseenNumbers := make(map[int]bool)\n\n\tfor _, el := range A {\n\t\tif maxValue < el {\n\t\t\tmaxValue = el\n\t\t}\n\n\t\tif el > 0 {\n\t\t\tseenNumbers[el] = true\n\t\t}\n\t}\n\n\tif maxValue <= 0 {\n\t\treturn 1\n\t}\n\n\tfor i := 1; i <= maxValue; i++ {\n\t\tfound := seenNumbers[i]\n\t\tif !found {\n\t\t\treturn i\n\t\t}\n\t}\n\n\treturn maxValue + 1\n}", "title": "" }, { "docid": "6687125a9c025518cfce7a77c45284be", "score": "0.6356832", "text": "func singleNonDuplicate(nums []int) int {\n l,r,m := 0, len(nums)-1, 0\n lst := len(nums) - 1\n for l < r {\n m = l + (r-l)/2\n if 1 == m%2 {\n m -= 1\n }\n if m == lst || nums[m] != nums[m+1] {\n r = m\n } else {\n l = m + 2\n }\n }\n return nums[l]\n}", "title": "" }, { "docid": "76e5aa47d61394aa2139c91ed91cb80a", "score": "0.63566166", "text": "func findMaxElementIndex(nums []int) int {\n\tmaxI := 0\n\tmaxV := 0\n\tfor i, v := range nums {\n\t\tif v > maxV {\n\t\t\tmaxI = i\n\t\t\tmaxV = v\n\t\t}\n\t}\n\treturn maxI\n}", "title": "" }, { "docid": "245724621fdac8d4aa3eaa256b2d3513", "score": "0.63426775", "text": "func findPeakElement1(nums []int) int {\n\tif len(nums) == 0 {\n\t\treturn -1\n\t}\n\n\tfor i := 0; i < len(nums); {\n\t\tif greater(nums, i, i-1) && greater(nums, i, i+1) {\n\t\t\treturn i\n\t\t} else {\n\t\t\tif greater(nums, i, i+1) {\n\t\t\t\ti = i + 2\n\t\t\t} else {\n\t\t\t\ti++\n\t\t\t}\n\t\t}\n\t}\n\n\treturn -1 // will not arrive\n}", "title": "" }, { "docid": "6ab91365708e1c64c99a73d7d9ed813e", "score": "0.6312709", "text": "func find(nums []int) (int, int) {\n\tvar index int\n\tif len(nums) < 1 {\n\t\treturn -1, -1\n\t}\n\n\t// this never overflows like the high-low implementations:\n\t// https://ai.googleblog.com/2006/06/extra-extra-read-all-about-it-nearly.html\n\tindex = len(nums) / 2\n\n\treturn index, nums[index]\n}", "title": "" }, { "docid": "3d96b9a6873797d0f7e64386d1e78000", "score": "0.62972236", "text": "func sumOfUnique(nums []int) int {\n\tn := len(nums)\n\tif n <= 1 {\n\t\treturn nums[0]\n\t}\n\n\tif n == 2 {\n\t\tif nums[0] != nums[1] {\n\t\t\treturn nums[0] + nums[1]\n\t\t}\n\t\treturn 0\n\t}\n\n\tsort.Ints(nums)\n\tvar total int\n\tfor i := 1; i < n-1; i++ {\n\t\tif nums[i] != nums[i-1] && nums[i] != nums[i+1] {\n\t\t\ttotal += nums[i]\n\t\t}\n\t}\n\n\tif nums[0] != nums[1] {\n\t\ttotal += nums[0]\n\t}\n\n\tif nums[n-1] != nums[n-2] {\n\t\ttotal += nums[n-1]\n\t}\n\n\treturn total\n}", "title": "" }, { "docid": "694ccbe57be23669e39c47edfc5aaa5f", "score": "0.6295973", "text": "func lengthOfLIS(nums []int) int {\n \n}", "title": "" }, { "docid": "2ef3e9f52e6b261e00d93c9db7d2ac11", "score": "0.62935543", "text": "func majorityElement(nums []int) int {\n\t// 1. 排序\n\t// sort.Ints(nums)\n\t// return nums[len(nums)/2]\n\n\t// 2 hash\n\t//m := make(map[int]int)\n\t//n := len(nums) / 2\n\t//for _, v := range nums {\n\t//\tm[v]++\n\t//\tif m[v] > n {\n\t//\t\treturn v\n\t//\t}\n\t//}\n\t//return 0\n\n\t// 3 分治\n\t// 整个数组的众数 简化为找寻n/2数组的众数\n\treturn majorityele(nums, 0, len(nums) - 1)\n}", "title": "" }, { "docid": "85316ba0fe3c7f5e4ccd0a5241c0eeb1", "score": "0.6288647", "text": "func findMaxLength(nums []int) int {\n\tif len(nums) <= 1 {\n\t\treturn 0\n\t}\n\tlookup := map[int]int{\n\t\t0: -1,\n\t}\n\n\tcounter := 0\n\tmax := 0\n\tfor i, v :=range nums {\n\t\tif v == 0 {\n\t\t\tcounter --\n\t\t}else if v == 1 {\n\t\t\tcounter++\n\t\t}\n\t\tif _, ok := lookup[counter]; !ok {\n\t\t\tlookup[counter] = i\n\t\t}else {\n\t\t\tif i - lookup[counter] > max {\n\t\t\t\tmax = i - lookup[counter]\n\t\t\t}\n\t\t}\n\t}\n\treturn max\n}", "title": "" }, { "docid": "c60188fe7f5f2746bfd90bedd38708a7", "score": "0.62806433", "text": "func countNum(nums []int, start, end int) int {\n\tcount := 0\n\tfor i := 0; i < len(nums); i++ {\n\t\tif nums[i] >= start && nums[i] <= end {\n\t\t\tcount++\n\t\t}\n\t}\n\treturn count\n}", "title": "" }, { "docid": "c200b078f8028f0897f01ee0c7a3189f", "score": "0.62741905", "text": "func findNumberOfLIS(nums []int) int {\n\tif len(nums) == 0 {\n\t\treturn 0\n\t}\n\tdp := make([]int, len(nums), len(nums))\n\tlisNum := make([]int, len(nums), len(nums))\n\tfor i := 0; i < len(dp); i ++ {\n\t\tdp[i] = 1\n\t\tlisNum[i] = 1\n\t}\n\tfor i := 1; i < len(dp); i ++ {\n\t\tfor j := 0; j < i; j ++ {\n\t\t\tif nums[j] < nums[i] {\n\t\t\t\tif dp[j] + 1 > dp[i] {\n\t\t\t\t\tdp[i] = dp[j] + 1\n\t\t\t\t\tlisNum[i] = lisNum[j]\n\t\t\t\t} else if dp[j] + 1 == dp[i] {\n\t\t\t\t\tlisNum[i] = lisNum[i] + lisNum[j]\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\tcount := 0\n\tval := 0\n\tfor i := 0; i < len(dp); i ++ {\n\t\tif count < dp[i] {\n\t\t\tcount = dp[i]\n\t\t\tval = lisNum[i]\n\t\t} else if count == dp[i] {\n\t\t\tval += lisNum[i]\n\t\t}\n\t}\n\treturn val\n}", "title": "" }, { "docid": "7a2043130a8481bbc2803f5bdbe295f9", "score": "0.6270458", "text": "func findDuplicate(nums []int) int {\n\tslow, fast := 0, 0\n\tfor true {\n\t\tslow = nums[slow]\n\t\tfast = nums[nums[fast]]\n\t\tif fast == slow {\n\t\t\tbreak\n\t\t}\n\t}\n\n\tslow = 0\n\tfor true {\n\t\tslow = nums[slow]\n\t\tfast = nums[fast]\n\t\tif slow == fast {\n\t\t\tbreak\n\t\t}\n\t}\n\n\treturn fast\n}", "title": "" }, { "docid": "894b1a9d4661c428f17c6b02dc89256e", "score": "0.6270145", "text": "func searchSlow(nums []int, target int) int {\n for i,n := range nums{\n if n == target{\n return i\n }\n }\n \n return -1\n}", "title": "" }, { "docid": "9ea4542dc9092d9ba6a8d1a5fbafca3b", "score": "0.62457687", "text": "func singleNumbers(nums []int) int {\n\n\tout := 0\n\tmapping := make(map[int] int)\n\n\tfor _,v := range nums {\n\t\tif _, ok := mapping[v]; ok {\n\t\t\tmapping[v] = 2\n\t\t} else {\n\t\t\tmapping[v] = 1\n\t\t}\n\t}\n\n\tfor k,v := range mapping {\n\t\tif v == 1{\n\t\t\tout = k\n\t\t\tbreak\n\t\t}\n\t}\n\treturn out\n}", "title": "" }, { "docid": "6d789f50bd0600bb4be0451a82435c7b", "score": "0.623088", "text": "func search(nums []int, target int) int {\n pt, left, right:=0, 0, len(nums)-1\n \n for left <= right{\n pt = left + (right-left)/2 \n if target > nums[pt]{\n left = pt+1\n } else if target < nums[pt]{\n right = pt-1\n } else {\n return pt\n }\n \n }\n \n return -1\n}", "title": "" }, { "docid": "158ef12d401d99fe5c2da9a14df67d6d", "score": "0.62249774", "text": "func sumOfUnique(nums []int) int {\n\tumap := make(map[int]int)\n\tfor _, num := range nums {\n\t\tumap[num] += 1\n\t}\n\tres := 0\n\tfor num, c := range umap {\n\t\tif c == 1 {\n\t\t\tres += num\n\t\t}\n\t}\n\treturn res\n}", "title": "" }, { "docid": "29e219a7570afe53a4cf813270ed4987", "score": "0.6218801", "text": "func largestDivisibleSubset(nums []int) []int {\n \n}", "title": "" }, { "docid": "193526b08dbdc0fb02922f14c3b1ebf9", "score": "0.6217241", "text": "func FindOdd(seq []int) int {\n seen := make(map[int]int)\n\n for _, i := range seq {\n seen[i]++\n }\n\n var oddN int\n\n for n, ocurrances := range seen {\n if ocurrances % 2 != 0 {\n oddN = n\n break\n }\n }\n\n return oddN\n}", "title": "" }, { "docid": "b46d49a9c25fe0f02d8778af9a66f198", "score": "0.6205803", "text": "func findMin(nums []int) int {\n\tstart := 0\n\tend := len(nums) - 1\n\tfor start+1 < end {\n\t\tif nums[start] < nums[end] {\n\t\t\treturn nums[start]\n\t\t}\n\n\t\tmid := start + (end-start)/2\n\t\tif nums[mid] > nums[end] {\n\t\t\tstart = mid\n\t\t} else {\n\t\t\tend = mid\n\t\t}\n\t}\n\treturn min(nums[start], nums[end])\n}", "title": "" }, { "docid": "366ad286758817e76995ed7c879978e6", "score": "0.62020004", "text": "func main() {\n\tallnums := readInput()\n\tfor i := 0; i < len(allnums); i++ {\n\t\tsum := allnums[i]\n\t\tfor j := i + 1; j < len(allnums); j++ {\n\t\t\tsum += allnums[j]\n\t\t\tif sum == 22406676 {\n\t\t\t\tarr := make([]int, (j-i)+1)\n\t\t\t\tcopy(arr, allnums[i:j+1])\n\t\t\t\tsort.Ints(arr)\n\t\t\t\tfmt.Printf(\"Sum found: %d\\n\", arr[0]+arr[len(arr)-1])\n\t\t\t}\n\t\t\tif sum > 22406676 {\n\t\t\t\tbreak\n\t\t\t}\n\t\t}\n\t}\n}", "title": "" }, { "docid": "ea3b85fcddec8ea822e9f08b9e3ccc2d", "score": "0.619278", "text": "func searchInsert(nums []int, target int) int {\n for k, v := range nums {\n if target <= v {\n return k\n }\n }\n return len(nums)\n}", "title": "" }, { "docid": "1cd39e610743cf581a8e1aacc6a40f20", "score": "0.61812955", "text": "func search(nums []int, target int) int {\n\ti := 0\n\tj := len(nums) - 1\n\tfor i <= j {\n\t\tm := i + (j-i)/2\n\t\tn := nums[m]\n\t\tif target == n {\n\t\t\treturn m\n\t\t} else if target > n {\n\t\t\ti = m + 1\n\t\t} else if target < n {\n\t\t\tj = m - 1\n\t\t}\n\t}\n\treturn -1\n}", "title": "" }, { "docid": "bb27fbe2aad47087ca8d50554a6e0fd6", "score": "0.61614263", "text": "func findMin(nums []int) int {\n\tif len(nums) <= 0 {\n\t\treturn -1\n\t}\n \tif len(nums) == 1 {\n \t\treturn nums[0]\n\t}\n\n\tleft, right := 0, len(nums) - 1\n\n\tif nums[right] > nums[0] {\n\t\treturn nums[0]\n\t}\n\n\tfor left <= right {\n\t\tmid := left + (right - left) / 2\n\t\tif nums[mid] > nums[mid + 1]{\n\t\t\treturn nums[mid + 1]\n\t\t}\n\t\tif nums[mid - 1] > nums[mid] {\n\t\t\treturn nums[mid]\n\t\t}\n\n\t\tif nums[mid] > nums[0] {\n\t\t\tleft = mid + 1\n\t\t} else {\n\t\t\tright = mid - 1\n\t\t}\n\t}\n\treturn -1\n}", "title": "" }, { "docid": "58dca757d10cc197eb7728731f3ade0d", "score": "0.61568666", "text": "func singleNumber(nums []int) int {\n\tx := 0\n\tsum := len(nums)\n\tfor i := 0; i < sum; i++ {\n\t\tx ^= nums[i]\n\t}\n\n\treturn x\n}", "title": "" }, { "docid": "b480f8d7acf966f2b936029d82e1d513", "score": "0.6149781", "text": "func rob(nums []int) int {\n\n}", "title": "" }, { "docid": "76ae89a62caf035e97d7affd11846237", "score": "0.61393535", "text": "func Solution3(A []int) int {\n\t// write your code in Go 1.4\n\tn := len(A)\n\tnums := make([]int, n)\n\tcopy(nums, A)\n\tsort.Ints(nums)\n\n\tres := 0\n\tmax := math.MinInt32\n\tfor i := 0; i < n; i++ {\n\t\tleft := 0\n\t\tright := n - 1\n\t\tindex := n\n\t\tfor left <= right {\n\t\t\tmid := left + (right - left)/2\n\t\t\tif nums[mid] == A[i] {\n\t\t\t\tindex = mid\n\t\t\t\tbreak\n\t\t\t} else if nums[mid] > A[i] {\n\t\t\t\tright = mid - 1\n\t\t\t} else {\n\t\t\t\tleft = mid + 1\n\t\t\t}\n\t\t}\n\t\tif index > max {\n\t\t\tmax = index\n\t\t}\n\t\tif max == i {\n\t\t\tres++\n\t\t\tmax = math.MinInt32\n\t\t}\n\t}\n\n\treturn res\n}", "title": "" }, { "docid": "750a2980f8bf20745235fde8f979b1b4", "score": "0.61303884", "text": "func singleNumber2(nums[] int) int {\n\tresult := 0\n\tfor i := 0 ;i < len(nums);i++ {\n\t\tresult ^= nums[i]\n\t}\n\treturn result\n\n}", "title": "" }, { "docid": "7fc676d47fa7eb0e3cb24212ec010ebf", "score": "0.6127731", "text": "func singleNumber(nums []int) int {\n\tnum := 0\n\tfor i := 0; i < len(nums); i++ {\n\t\tnum ^= nums[i]\n\t}\n\treturn num\n}", "title": "" }, { "docid": "ba4e9e1748d984186e6ad8045becda81", "score": "0.612685", "text": "func Solution(A []int) int {\n\t// write your code in Go 1.4\n\tset := make(map[int]int)\n\n\tfor index, value := range A {\n\t\tif _, okay := set[value]; okay {\n\t\t\tset[value]++\n\t\t\tif set[value] > len(A)/2 {\n\t\t\t\treturn index\n\t\t\t}\n\t\t} else {\n\t\t\tset[value] = 1\n\t\t}\n\t}\n\treturn -1\n}", "title": "" }, { "docid": "9cfcb2474c080b4b67babe59411ea367", "score": "0.6088049", "text": "func dominantIndex(nums []int) int {\n\tvar p1, v2 int\n\n\tswitch {\n\tcase len(nums) == 0:\n\t\treturn -1\n\tcase len(nums) == 1:\n\t\treturn 0\n\t}\n\n\tfor idx, val := range nums[1:] {\n\t\tif val > nums[p1] {\n\t\t\tif nums[p1] > v2 {\n\t\t\t\tv2 = nums[p1]\n\t\t\t}\n\n\t\t\tp1 = idx + 1\n\t\t} else if val > v2 {\n\t\t\tv2 = val\n\t\t}\n\t}\n\n\tif 2*v2 <= nums[p1] {\n\t\treturn p1\n\t}\n\n\treturn -1\n}", "title": "" }, { "docid": "300968156e14322f10bae5724760b957", "score": "0.6070308", "text": "func findPos(nums []int, target int, index int) int {\n\n\t//\tfmt.Printf(\"nums: %v, index: %d\\n\", nums, index)\n\ti := len(nums) - 1\n\tif i < 1 {\n\t\tpanic(fmt.Sprintf(\"Slice too short, must be at least 2:%v\", nums))\n\t}\n\t// divide nums into 2\n\n\tj := i / 2\n\n\t// Check either side of the division\n\n\tif target == nums[j] {\n\t\treturn index + j\n\t}\n\tif target == nums[j+1] {\n\t\treturn index + j + 1\n\t}\n\n\tif target > nums[j] && target < nums[j+1] {\n\t\treturn index + j + 1\n\t}\n\n\tif target < nums[j] {\n\t\treturn findPos(nums[:j+1], target, index)\n\t}\n\n\t// only option, target is in greater half\n\treturn findPos(nums[j:], target, index+j)\n\n}", "title": "" }, { "docid": "5a2db2dffe34ca4d6aad198e6e407c94", "score": "0.606216", "text": "func singleNumber(nums []int) int {\n\tr := 0\n\tfor _, v := range nums{\n\t\tr ^= v\n\t}\n\treturn r\n}", "title": "" }, { "docid": "ab19498b592adfa8ba6198163d390f1b", "score": "0.6057001", "text": "func search(nums []int, target int) int {\n\tnumsLen := len(nums)\n\tif numsLen == 0 {\n\t\treturn -1\n\t}\n\ti := 0\n\tj := numsLen - 1\n\tfirst := nums[0]\n\tmid := 0\n\tfor i <= j {\n\t\tmid = (i + j) / 2\n\t\tcurNum := nums[mid]\n\t\tif target == first {\n\t\t\treturn 0\n\t\t} else if target > first {\n\t\t\tif curNum == target {\n\t\t\t\treturn mid\n\t\t\t}\n\t\t\tif curNum < first {\n\t\t\t\tj = mid - 1\n\t\t\t} else {\n\t\t\t\tif target < curNum {\n\t\t\t\t\tj = mid - 1\n\t\t\t\t} else {\n\t\t\t\t\ti = mid + 1\n\t\t\t\t}\n\t\t\t}\n\t\t} else {\n\t\t\tif curNum == target {\n\t\t\t\treturn mid\n\t\t\t}\n\t\t\tif curNum >= first {\n\t\t\t\ti = mid + 1\n\t\t\t} else {\n\t\t\t\tif target > curNum {\n\t\t\t\t\ti = mid + 1\n\t\t\t\t} else {\n\t\t\t\t\tj = mid - 1\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\treturn -1\n}", "title": "" }, { "docid": "899ecfa53d45b614d7272c2c8810a49c", "score": "0.6055545", "text": "func singleNumber(nums []int) int {\n\t// if nums == nil || len(nums) == 0 {\n\t// \treturn 0\n\t// }\n\tres := nums[0]\n\tn := len(nums)\n\tfor i := 0; i < n; i++ {\n\t\tres = res ^ nums[i]\n\t}\n\treturn res\n}", "title": "" }, { "docid": "2557004a03c07c57b343309a8808cbfb", "score": "0.60420644", "text": "func search(nums []int, target int) int {\n\tfor i, j := 0, len(nums)-1; i <= j; {\n\t\tm := i + (j-i)/2\n\n\t\tif nums[m] == target {\n\t\t\treturn m\n\t\t}\n\n\t\tif nums[m] > target {\n\t\t\tj = m - 1\n\t\t} else {\n\t\t\ti = m + 1\n\t\t}\n\t}\n\n\treturn -1\n}", "title": "" }, { "docid": "b4914fb423b19d42f9e1b29964ae4bb4", "score": "0.60402", "text": "func maxProduct(nums []int) int {\n \n}", "title": "" }, { "docid": "e4421b95ebb43b0aeb2130b1051127fd", "score": "0.6016333", "text": "func Solution(A []int) int {\n\t// write your code in Go 1.4\n\tsize, value := 0, 0\n\tfor _, v := range A {\n\t\tif size == 0 {\n\t\t\tsize++\n\t\t\tvalue = v\n\t\t} else {\n\t\t\tif value != v {\n\t\t\t\tsize--\n\t\t\t} else {\n\t\t\t\tsize++\n\t\t\t}\n\t\t}\n\t}\n\n\tvar dominiCandidate int\n\tif size > 0 {\n\t\tdominiCandidate = value\n\t}\n\n\tcount, dominiIdx := 0, 0\n\tfor i, v := range A {\n\t\tif v == dominiCandidate {\n\t\t\tcount++\n\t\t\tdominiIdx = i\n\t\t}\n\t}\n\n\tif count > len(A)/2 {\n\t\treturn dominiIdx\n\t}\n\treturn -1\n}", "title": "" }, { "docid": "0f2d9c2776140495d7bfae7bebc1e23e", "score": "0.6005716", "text": "func findMin(nums []int) int {\n\tif len(nums) == 0 {\n\t\treturn 0\n\t}\n\tmin := nums[0]\n\tlo, hi := 0, len(nums)-1\n\tfor lo <= hi {\n\t\tmid := (lo + hi) / 2\n\t\tif mid-1 >= 0 && nums[mid] < nums[mid-1] {\n\t\t\tmin = nums[mid]\n\t\t\tbreak\n\t\t} else if nums[mid] >= nums[0] {\n\t\t\tlo = mid + 1\n\t\t} else {\n\t\t\thi = mid - 1\n\t\t}\n\t}\n\treturn min\n}", "title": "" }, { "docid": "b6d1f2fa7ef842081040405d34abfd22", "score": "0.59972644", "text": "func rob(nums []int) int {\n a := 0\n b := 0\n for _,v := range nums{\n old := a\n a = max(a, b+v)\n b = old\n }\n return a\n}", "title": "" }, { "docid": "4bbeb95f9893b9ebc98f936e476d478f", "score": "0.59952813", "text": "func nthSuperUglyNumber(n int, primes []int) int {\n \n}", "title": "" }, { "docid": "846a1991d75161f0577c06e07d971efe", "score": "0.59947133", "text": "func SortedNumberIn(n int, nums ...int) int {\n\tfor l, h := 0, len(nums)-1; l <= h; {\n\t\tm := l + (h-l)>>1\n\n\t\tif c := nums[m]; c == n {\n\t\t\treturn m\n\t\t} else if c < n {\n\t\t\tl = m + 1\n\t\t} else {\n\t\t\th = m - 1\n\t\t}\n\t}\n\n\treturn -1\n}", "title": "" }, { "docid": "59464e7f28fc2d34bf815ff5820a0e34", "score": "0.59939873", "text": "func singleNumber(nums []int) int {\n\tif len(nums) == 0 {\n\t\treturn 0\n\t}\n\tans := nums[0]\n\tfor i, n := range nums {\n\t\tif i != 0 {\n\t\t\tans ^= n\n\t\t}\n\t}\n\treturn ans\n}", "title": "" }, { "docid": "fc2d18d1b45f751cf73bd357e1755b8f", "score": "0.5981401", "text": "func singleNumber(nums []int) int {\n\tif len(nums) == 1 {\n\t\treturn nums[0]\n\t}\n\tresult := 0\n\tfor _, num := range nums {\n\t\tresult = result ^ num\n\t}\n\treturn result\n}", "title": "" }, { "docid": "3d02176d820a28cf2b5b318a42f8c0fd", "score": "0.5977173", "text": "func majorityElement1(nums []int) int {\n\tm := make(map[int]int)\n\tfor _,v := range nums {\n\t\tm[v]++\n\t\tif m[v] > len(nums)/2 {\n\t\t\treturn v \n\t\t}\n\t}\n\n\treturn 0\n}", "title": "" }, { "docid": "a756996c775ee403b503dfdd881c1876", "score": "0.59766257", "text": "func missingNumber(nums []int) int {\n n := len(nums)\n\tvar res int = n\n\tvar sum int\n\n\tfor i := 0; i < n; i++ {\n\t\tsum += nums[i]\n\t\tres += i\n\t}\n\treturn res - sum\n}", "title": "" }, { "docid": "2ea80593e93f15468d2759a1c4e68f6d", "score": "0.5970296", "text": "func maxSubArray(nums []int) int {\n\tcur := nums[0]\n\tsum := nums[0]\n\tfor i := 1; i < len(nums); i++ {\n\t\tif sum >= 0 {\n\t\t\tsum += nums[i]\n\t\t} else {\n\t\t\tsum = nums[i]\n\t\t}\n\t\tif cur < sum {\n\t\t\tcur = sum\n\t\t}\n\t}\n\treturn cur\n}", "title": "" }, { "docid": "34e980a5099d3386ec97f20f700900e6", "score": "0.59543", "text": "func singleNumber(nums []int) int {\n\ts := 0\n\tfor _, n := range nums {\n\t\ts ^= n\n\t}\n\treturn s\n}", "title": "" }, { "docid": "487ac566b7d369d1c19680a03fc61d28", "score": "0.59525234", "text": "func MissingNumber2(nums []int) int {\n\tvar result int\n\tresult = len(nums) * (len(nums) + 1) / 2\n\tfor _, v := range nums {\n\t\tresult -= v\n\t}\n\treturn result\n}", "title": "" }, { "docid": "0aa27c91cd1908c3a94e5df1d8a7682d", "score": "0.5947673", "text": "func removeDuplicates(nums []int) int {\n\tif len(nums) == 0 {\n\t\treturn 0\n\t}\n\t// To store index of next unique element\n\tj := 0\n\tfor i := 1; i < len(nums); i++ {\n\t\tif nums[j] != nums[i] { // increment j when you find a new number and replace\n\t\t\tj++\n\t\t\tif i != j { // replace jth position by the new number\n\t\t\t\tnums[j] = nums[i]\n\t\t\t}\n\t\t}\n\t}\n\tnums = nums[:j+1]\n\tfmt.Println(nums)\n\treturn j + 1\n}", "title": "" }, { "docid": "e31d0683708a328dcfa634356d735acf", "score": "0.5938025", "text": "func twoSum(nums []int, target int) []int {\n\t// hash\n\tmemo := make(map[int]int)\n\tfor i, v := range nums {\n\t\tif idx, ok := memo[v]; ok {\n\t\t\treturn []int{idx, i}\n\t\t}\n\t\tmemo[target-v] = i\n\t}\n\treturn nil\n\n\t// n数之和\n\t//sort.Ints(nums)\n\t//sums := make([][]int, 0)\n\t//n := 2\n\t//nSum(nums, &sums, nil, n, target) // n数之和\n\t//return sums[0]\n}", "title": "" }, { "docid": "c11b65785b5044e210698ff370780461", "score": "0.593675", "text": "func Solution(A []int) int {\n\t// write your code in Go 1.4\n\tfreq_map := make(map[int]int)\n\tfor i := 0; i < len(A); i++ {\n\t\tfreq_map[A[i]] += 1\n\t}\n\tres := 0\n\tfor _, val := range freq_map {\n\t\tif val > 1 {\n\t\t\tres += val - 1\n\t\t}\n\t}\n\treturn res\n}", "title": "" }, { "docid": "09d2c21d131691206e8d4169cb072105", "score": "0.59265476", "text": "func maxSubArray(nums []int) int {\n // Calculate min int value\n const MaxUint = ^uint(0)\n const MaxInt = int(MaxUint >> 1)\n maxSoFar, maxEndingHere :=-MaxInt - 1,0\n\n for _, value := range nums {\n maxEndingHere = maxEndingHere + value;\n if maxSoFar < maxEndingHere {\n maxSoFar = maxEndingHere\n }\n\n if maxEndingHere < 0 {\n maxEndingHere = 0\n }\n }\n\n return maxSoFar\n}", "title": "" }, { "docid": "f1a9cb140432c0bf4b009ca24501ac00", "score": "0.5925909", "text": "func twoSum(nums []int, target int) []int {\n\n\tlist := make(map[int]int)\n\n\tfor i := 0; i < len(nums); i++ {\n\t\tcomp := target - nums[i]\n\t\t// if the other half is present in the list - return\n\t\tif v, ok := list[comp]; ok {\n\t\t\treturn []int{v, i}\n\t\t}\n\t\t//if not add the current number to the map\n\t\tlist[nums[i]] = i\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "a258f8ce87519473e5593f5898c3086c", "score": "0.5920413", "text": "func Solution(N int) int {\n\t// write your code in Go 1.4\n\tx := N\n\td := 0\n\tmax := 0\n\tstarted := false\n for x > 0 {\n\t\ta := x % 2\n\t\tif a == 0 {\n\t\t\tif started {\n\t\t\t\td++\n\t\t\t}\n\t\t} else {\n\t\t\tif d > max {\n\t\t\t\tmax = d\n\t\t\t}\n\t\t\td = 0\n\t\t\tstarted = true\n\t\t}\n\t\tx /= 2\n\t}\n \n return max\n}", "title": "" }, { "docid": "53255f045fd144af6f0bd48b982905e3", "score": "0.5917882", "text": "func SolutionB(A []int) int {\n\n\tfor i, v := range A {\n\t\tn := 0\n\t\tfor i, _ := range A {\n\t\t\tif v == A[i] {\n\t\t\t\tn++\n\t\t\t}\n\t\t}\n\t\tif n%2 != 0 {\n\t\t\treturn A[i]\n\t\t}\n\t}\n\treturn -1\n}", "title": "" }, { "docid": "f2241e54a7b50b3db05029973616ba98", "score": "0.59146035", "text": "func search(nums []int, target int) int {\n\tl, r := 0, len(nums)-1\n\tvar mid int\n\tfor l <= r {\n\t\tmid = l + (r-l)/2\n\t\tif nums[mid] == target {\n\t\t\treturn mid\n\t\t}\n\t\tif nums[mid] < target {\n\t\t\tl = mid + 1\n\t\t} else {\n\t\t\tr = mid - 1\n\t\t}\n\t}\n\treturn -1\n}", "title": "" }, { "docid": "8d0e4bf9c97b432c132f018b80efbbb3", "score": "0.5914155", "text": "func findMagicIndex2(nums []int) int {\n\tfor k, v := range nums {\n\t\tif k == v {\n\t\t\treturn k\n\t\t}\n\t}\n\treturn -1\n}", "title": "" }, { "docid": "4cdab02e0720186783ea38ec11a04345", "score": "0.59100044", "text": "func removeElement2(nums []int, val int) int {\n\ti, n := 0, len(nums)\n\tfor i < n {\n\t\tif nums[i] == val {\n\t\t\tnums[i] = nums[n-1]\n\t\t\tn--\n\t\t} else {\n\t\t\ti++\n\t\t}\n\t}\n\n\treturn n\n}", "title": "" }, { "docid": "621f2e5bcaa6b509c4570b18adf3021d", "score": "0.5907905", "text": "func singleNumber(nums []int) int {\n\tvar i, j int\n\tfor _, num := range nums {\n\t\ti = i ^ num & ^j\n\t\tj = j ^ num & ^i\n\t}\n\treturn i | j\n}", "title": "" }, { "docid": "7884ab3b619a7f47179fd718d48de634", "score": "0.5903786", "text": "func Solution(A []int) (int){\r\n\tvar answer int\r\n keys := make(map[int]int)\r\n\t\r\n for _, entry := range A {\r\n keys[entry] +=1\r\n \r\n } \r\n\t\r\n\tfor key,val:=range keys{\r\n\t\tif val%2==1{\r\n\t\t answer = key\r\n\t\t break\r\n\t}\r\n}\r\n\treturn answer\r\n}", "title": "" }, { "docid": "1fe18cdfe1354d470db68f26a562b77a", "score": "0.59025025", "text": "func findDisappearedNumbers(nums []int) []int {\n\tl := len(nums)\n\tfor i := 1; i <= l; i++ {\n\t\tcurNum := nums[i-1]\n\t\tfor curNum != i && nums[curNum-1] != curNum {\n\t\t\tnums[i-1], nums[curNum-1] = nums[curNum-1], nums[i-1]\n\t\t\tcurNum = nums[i-1]\n\t\t}\n\t}\n\tresult := make([]int, 0)\n\tfor i := 1; i <= l; i++ {\n\t\tif nums[i-1] != i {\n\t\t\tresult = append(result, i)\n\t\t}\n\t}\n\treturn result\n}", "title": "" }, { "docid": "9f598b0b04bf816e82ff3d44097148c5", "score": "0.5895412", "text": "func countSmaller(nums []int) []int {\n\tif len(nums)==0 {\n\t\treturn []int{}\n\t}\n\tans := make([]int, len(nums))\n\n\t// build segment tree\n\ttree := make([][]int, len(nums)*4)\n\tbuild(tree, nums, 0, 0, len(nums)-1)\n\t\n\t// query\n\tfor i:=len(nums)-2; i>=0; i-- {\n\t\t// get how many numbers in nums[i+1:] that are less than nums[i]\n\t\tans[i] = query(tree, nums[i], 0, 0, len(nums)-1, i+1, len(nums)-1)\n\t}\n\treturn ans \n}", "title": "" }, { "docid": "50ea9212b301d603ba80aeb77030a3ed", "score": "0.58919454", "text": "func buyStockTwice(arr []int) int {\n\n}", "title": "" }, { "docid": "997605b41332e4e21ab3de154af833b9", "score": "0.5888823", "text": "func find(data []int) int {\n\tmax := data[0]\n\n\tfor _, elem := range data {\n\t\tif elem >= max {\n\t\t\tmax = elem\n\t\t}\n\t}\n\n\treturn max\n\n}", "title": "" }, { "docid": "46f0bdc8dd9f4fe5503412226089c3c5", "score": "0.5885867", "text": "func search(nums []int, target int) int {\n\tfor i, value := range nums {\n\t\tif value == target {\n\t\t\treturn i\n\t\t}\n\t}\n\treturn -1\n}", "title": "" }, { "docid": "d79398bac4c064dae9913d8f58341e78", "score": "0.5877382", "text": "func O1(nums []int) int {\n\tif len(nums) == 0 {\n\t\treturn 0\n\t}\n\n\tnonDup := 0\n\tfor i := 1; i < len(nums); i++ {\n\t\tif nums[i] != nums[i-1] {\n\t\t\tnonDup++\n\t\t\tnums[nonDup] = nums[i]\n\t\t}\n\t}\n\tuniqueNum := nonDup + 1\n\tnums = nums[:uniqueNum]\n\treturn uniqueNum\n}", "title": "" }, { "docid": "c1eee4a7a42aa8ed20e1c5f89610ed32", "score": "0.5870957", "text": "func Solution(A []int) int {\n\t// write your code in Go 1.4\n\ta_map := make(map[int]int)\n\tleader := 0\n\tleaderCnt := 0\n\tfor _, a := range A {\n\t\ta_map[a] = a_map[a] + 1\n\t\tif a_map[a] > leaderCnt {\n\t\t\tleaderCnt = a_map[a]\n\t\t\tleader = a\n\t\t}\n\t}\n\n\tleftLeader := 0\n\trightLeader := a_map[leader]\n\tresult := 0\n\tfor i, a := range A {\n\t\tif a == leader {\n\t\t\tleftLeader = leftLeader + 1\n\t\t\trightLeader = rightLeader - 1\n\t\t}\n\t\tif (i+1)/2 < leftLeader && (len(A)-i-1)/2 < rightLeader {\n\t\t\tresult = result + 1\n\t\t}\n\t}\n\treturn result\n}", "title": "" }, { "docid": "4b7c486c410e281767da3576656e8b5b", "score": "0.58703125", "text": "func singleNumber(nums []int) int {\n\tvar result int\n\tfor _, v := range nums {\n\t\tresult ^= v\n\t}\n\treturn result\n}", "title": "" }, { "docid": "c58b1eb7a0cd3baf25b22a2de71f3c97", "score": "0.5869564", "text": "func TwoSums(array []int64, minSum, maxSum int) int {\n // Initialiaze and populate the array hash set \n arrayMap := make(map[int64]int)\n for i := range(array) {\n if arrayMap[array[i]] == 1 {\n arrayMap[array[i]]++\n } else {\n arrayMap[array[i]] = 1\n }\n }\n // Count the number of occuring two elements sum\n sumsCounter := 0\n for j := minSum; j < maxSum+1; j++ {\n t := int64(j)\n for x := range(array) {\n if (arrayMap[t-array[x]] == 1 && (t-array[x]) != array[x]) || arrayMap[t-array[x]] > 1 {\n //fmt.Println(array[x], t)\n sumsCounter++\n break\n }\n }\n }\n \n return sumsCounter\n}", "title": "" }, { "docid": "6885867206d9cfce261e793037484b77", "score": "0.58617085", "text": "func twoSum(numbers []int, target int) []int {\n index1, index2 := 0, len(numbers) - 1\n for numbers[index1] + numbers[index2] != target {\n if numbers[index1] + numbers[index2] < target {\n index1++\n } else {\n index2--\n }\n }\n return []int{index1 + 1, index2 + 1}\n}", "title": "" }, { "docid": "2f07c97c51b668344a584b639b061aa0", "score": "0.58535224", "text": "func Solution(A []int) int {\n\tnums := make(map[int]bool)\n\n\tfor i := 0; i < len(A); i++ {\n\t\tnums[A[i]] = true\n\t}\n\tfor j := 1; j <= len(A)+1; j++ {\n\t\tif !nums[j] {\n\t\t\treturn j\n\t\t}\n\t}\n\treturn 1\n}", "title": "" }, { "docid": "c9cd19e69246fdb9e2784713115bbcbe", "score": "0.5852053", "text": "func findMaximumXOR(nums []int) int {\n\tmaxRes := 0\n\tfor _, num := range nums {\n\t\tfor _, anotherNum := range nums {\n\t\t\tif num == anotherNum {\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\ttmp := num ^ anotherNum\n\t\t\tif tmp > maxRes {\n\t\t\t\tmaxRes = tmp\n\t\t\t}\n\t\t}\n\t}\n\treturn maxRes\n}", "title": "" }, { "docid": "e372baeb9e3c3afed37d57b0a29d87dd", "score": "0.58506256", "text": "func findSumInSortedArray(nums []int, target int) []int {\n\tstart, end := 0, len(nums)-1\n\tfor start < end {\n\t\tsum := nums[start] + nums[end]\n\t\tif sum == target {\n\t\t\treturn []int{start, end}\n\t\t} else if sum > target {\n\t\t\tend--\n\t\t} else {\n\t\t\tstart++\n\t\t}\n\t}\n\treturn []int{}\n}", "title": "" }, { "docid": "9beebe4095546b2f236a20c307a89a94", "score": "0.5844938", "text": "func Solution(N int) int {\n // write your code in Go 1.4\n if N == 1 {\n return 1\n }\n result := 0\n curIndex := 1\n for {\n if curIndex * curIndex > N {\n break\n }\n if N % curIndex == 0{\n if (N / curIndex) == curIndex {\n result = result + 1\n break\n } else {\n result = result + 2\n }\n }\n curIndex = curIndex + 1\n }\n \n return result\n}", "title": "" }, { "docid": "cd26920639a7fb6c05cb41e84875c240", "score": "0.5842171", "text": "func searchInsert(nums []int, target int) int {\n \n}", "title": "" }, { "docid": "f6cbc01e5812fb6e8af7efad0868ff9b", "score": "0.58408445", "text": "func searchInsert(nums []int, target int) int {\n\tfor i, v := range nums {\n\t\tif v >= target {\n\t\t\treturn i\n\t\t}\n\t}\n\n\treturn len(nums)\n}", "title": "" }, { "docid": "091ad9c1c2b6d623931954a2afe4ca45", "score": "0.5831697", "text": "func searchTwoNumComposition(inputs []int, numberToSearch int) (int,int) {\n for _,s := range inputs {\n remainingHalf := numberToSearch - s\n\n\n if(itemExists(inputs,remainingHalf)) {\n\n return s,remainingHalf\n }\n }\n return 0,0\n}", "title": "" }, { "docid": "fce09bbb54f35a733ffa1384a7ee5bb7", "score": "0.58315784", "text": "func minOperations(nums []int) int {\n cnt := 0\n for !allzeros(nums) {\n oddcnt := odds(nums)\n cnt+=oddcnt\n divide2(nums)\n cnt++\n\n }\n if cnt==0 {\n return 0\n }\n return cnt-1\n}", "title": "" }, { "docid": "bdc470e59a9796668f46e2fec60f9fd4", "score": "0.5817052", "text": "func twoSum(nums []int, target int) []int {\r\n m := make(map[int]int)\r\n retArr := make([]int, 2)\r\n for i,v := range nums{\r\n if idx, ok := m[target - v]; ok{\r\n retArr[0] = idx\r\n retArr[1] = i\r\n break\r\n }else{\r\n m[v] = i\r\n }\r\n }\r\n return retArr\r\n}", "title": "" }, { "docid": "c15812a377d912c7b108e3a47860e106", "score": "0.5813285", "text": "func getPairCounts(nums []int, target int) int {\n\n\tlist := make(map[int]int)\n\n\tfor i := 0; i < len(nums); i++ {\n\n\t\tif _, ok := list[nums[i]]; !ok {\n\t\t\tlist[nums[i]] = 0\n\t\t}\n\t\tlist[nums[i]] = list[nums[i]] + 1\n\t}\n\tvar count int\n\tfor i := 0; i < len(nums); i++ {\n\t\tother := target - nums[i]\n\t\tif r, ok := list[other]; ok { // other half present\n\t\t\tcount += r\n\t\t}\n\t\tif other == nums[i] { // decrement if the same\n\t\t\tcount--\n\t\t}\n\t}\n\n\treturn count / 2\n}", "title": "" }, { "docid": "07b76e936cf62d8dd92d47f8123cd495", "score": "0.58107847", "text": "func maximumUniqueSubarray(nums []int) int {\n\tans, sum := 0, 0\n\tset := make(map[int]bool)\n\n\tfor i, j := 0, 0; i < len(nums) && j < len(nums); {\n\t\tif _, ok := set[nums[j]]; !ok {\n\t\t\tsum += nums[j]\n\t\t\tans = maxInt(ans, sum)\n\t\t\tset[nums[j]] = true\n\t\t\tj++\n\t\t} else {\n\t\t\tsum -= nums[i]\n\t\t\tdelete(set, nums[i])\n\t\t\ti++\n\t\t}\n\t}\n\n\treturn ans\n}", "title": "" }, { "docid": "6ba1156627608bb9752f5909a51cbefe", "score": "0.58098906", "text": "func maxNumber(nums1 []int, nums2 []int, k int) []int {\n \n}", "title": "" }, { "docid": "ff05620b8590f5b47a8d5a20b5f5face", "score": "0.58079535", "text": "func findMiddleIndex(nums []int) int {\n\tsum := 0\n\tfor _, v := range nums {\n\t\tsum += v\n\t}\n\n\tleft := 0\n\tfor i, v := range nums {\n\t\tsum -= v\n\t\tif sum == left {\n\t\t\treturn i\n\t\t}\n\t\tleft += v\n\t}\n\n\treturn -1\n}", "title": "" }, { "docid": "e804c8e3d6aa30a86ac2610b43808a06", "score": "0.5804598", "text": "func search(nums []int, target int) int {\n\tl, r := 0, len(nums)-1\n\tfor l <= r {\n\t\tm := l + (r-l)/2\n\t\tif nums[m] == target {\n\t\t\treturn m\n\t\t}\n\t\tif nums[l] <= nums[m] {\n\t\t\tif nums[m] > target && nums[l] <= target {\n\t\t\t\tr = m - 1\n\t\t\t} else {\n\t\t\t\tl = m + 1\n\t\t\t}\n\t\t} else {\n\t\t\tif nums[m] < target && nums[r] >= target {\n\t\t\t\tl = m + 1\n\t\t\t} else {\n\t\t\t\tr = m - 1\n\t\t\t}\n\t\t}\n\t}\n\treturn -1\n}", "title": "" }, { "docid": "cd7637ac749bdeeaba1f88dd8de76731", "score": "0.5800053", "text": "func min(nums ...int) int {\n a := nums[0]\n for i := 1; i < len(nums); i++ {\n if nums[i] < a {\n a = nums[i]\n }\n }\n return a\n}", "title": "" }, { "docid": "b46f084afe3cc4849402cd9db14b5402", "score": "0.5799761", "text": "func search(nums []int, target int) bool {\n\n}", "title": "" }, { "docid": "bbd641e8b4b9d4250c2be49a810126b7", "score": "0.57991195", "text": "func maxSubArray(nums []int) int {\n\tdp := nums[0]\n\tmax := dp\n\tfor i := 1; i < len(nums); i++ {\n\t\tif dp > 0 {\n\t\t\tdp += nums[i]\n\t\t} else {\n\t\t\tdp = nums[i]\n\t\t}\n\t\tif max < dp {\n\t\t\tmax = dp\n\t\t}\n\t}\n\treturn max\n}", "title": "" }, { "docid": "7de08a588dadb7149d5d479a2ebb2297", "score": "0.5797208", "text": "func Solution(A []int) int {\n\t// write your code in Go 1.4\n\tsort.Ints(A)\n\tn := len(A)\n\tresult := 0\n\tif n <= 2 || A[n-3] <= 0 {\n\t\treturn result\n\t}\n\tfor i := n - 1; i > 1; i-- {\n\t\tif A[i] < A[i-1]+A[i-2] {\n\t\t\tresult = 1\n\t\t}\n\t}\n\treturn result\n\n}", "title": "" }, { "docid": "ed843bea1786f569c16afe986ab164d6", "score": "0.57963836", "text": "func _0747(nums []int) int {\n\tif len(nums) == 0 {\n\t\treturn -1\n\t}\n\tmaxIndex := 0\n\tfor i, val := range nums {\n\t\tif nums[maxIndex] < val {\n\t\t\tmaxIndex = i\n\t\t}\n\t}\n\tif nums[maxIndex] <= 0 {\n\t\treturn maxIndex\n\t} else {\n\t\tnums[maxIndex] >>= 1\n\t}\n\tfor _, val := range nums {\n\t\tif val > nums[maxIndex] {\n\t\t\treturn -1\n\t\t}\n\t}\n\treturn maxIndex\n}", "title": "" }, { "docid": "5b78e7aa96eebbc6b5a62ec92eeb091e", "score": "0.5789425", "text": "func removeDuplicates(nums []int) int {\n\n\tif len(nums) == 0 {\n\t\treturn 0\n\t}\n\n\tp := 1\n\tfor i := 1; i < len(nums); i++ {\n\t\tif nums[i] != nums[i-1] {\n\t\t\tnums[p] = nums[i]\n\t\t\tp++\n\t\t}\n\t}\n\n\treturn p\n}", "title": "" }, { "docid": "80822d9329c8aa6cb36c1c0b7b2c1a34", "score": "0.57892954", "text": "func search(nums []int, target int) int {\n\tlength := len(nums)\n\tif length == 0 {\n\t\treturn -1\n\t}\n\t// first, find the smallest one's index\n\tnormalNums, beginIndex := findBeginIndex(nums, target)\n\t//fmt.Printf(\"beginIndex:%d\\n\", beginIndex)\n\t// second, ordinary binary search\n\tcurIndex := searchInsert33(normalNums, target)\n\tcurIndex = (curIndex + beginIndex) % len(nums)\n\tif nums[curIndex] == target {\n\t\treturn curIndex\n\t}\n\treturn -1\n}", "title": "" } ]
a7b049b7f722d69f244d50934886aa41
String returns a string representation of the function
[ { "docid": "37275c18584ad35668b3ab5775ef968b", "score": "0.7303606", "text": "func (f *FuncSpec) String() string {\n\twriter := newCodeWriter()\n\n\tif f.Comment != \"\" {\n\t\twriter.WriteCodeBlock(Comment(f.Comment))\n\t}\n\n\tsignature, args := f.Signature()\n\twriter.WriteStatement(newStatement(0, 1, fmt.Sprintf(\"func %s {\", signature), args...))\n\n\tfor _, st := range f.Statements {\n\t\twriter.WriteStatement(st)\n\t}\n\n\twriter.WriteStatement(newStatement(-1, 0, \"}\"))\n\n\treturn writer.String()\n}", "title": "" } ]
[ { "docid": "7485d75d87d60aff975e058ed479e54f", "score": "0.8123445", "text": "func (f *Function) String() string {\n\tvar out bytes.Buffer\n\tparams := []string{}\n\tfor _, p := range f.Parameters {\n\t\tparams = append(params, p.String())\n\t}\n\tout.WriteString(\"fn\")\n\tout.WriteString(\"(\")\n\tout.WriteString(strings.Join(params, \", \"))\n\tout.WriteString(\") {\\n\")\n\tout.WriteString(f.Body.String())\n\tout.WriteString(\"\\n}\")\n\treturn out.String()\n}", "title": "" }, { "docid": "1fcfab72287afe015daddc97c27a91cd", "score": "0.8072481", "text": "func (f *Func) String() string {\n\treturn f.signature(true)\n}", "title": "" }, { "docid": "dad3952ce51cbf6a35cbf98ed5dc4782", "score": "0.7651609", "text": "func (s UserDefinedFunction) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "a49ef7c1a9eb797a771ad29f4c8f7d96", "score": "0.7461128", "text": "func (e Function) String() string {\n\tswitch e {\n\tcase F_PING:\n\t\treturn \"F_PING\"\n\tcase F_IDENTIFY:\n\t\treturn \"F_IDENTIFY\"\n\tcase F_REBOOT:\n\t\treturn \"F_REBOOT\"\n\tcase F_UPGRADE:\n\t\treturn \"F_UPGRADE\"\n\tcase F_UBUS:\n\t\treturn \"F_UBUS\"\n\tdefault:\n\t\treturn \"\"\n\t}\n}", "title": "" }, { "docid": "d70fdcd7c3a68ebb67cfc646447cd468", "score": "0.74578774", "text": "func (f Function) String() string {\n\tvar output string\n\tif f.Constructor != \"\" && f.StructName != \"\" {\n\t\toutput += fmt.Sprintf(\"%s.%s => func %s() %s\\n\", f.Schema, f.Name, f.Constructor, f.StructName)\n\t} else {\n\t\toutput += fmt.Sprintf(\"%s.%s\\n\", f.Schema, f.Name)\n\t}\n\toutput += fmt.Sprintf(\" Arguments\\n\")\n\tfor _, field := range f.Arguments {\n\t\tif field.Constructor != \"\" && field.GoType != \"\" {\n\t\t\toutput += fmt.Sprintf(\" %s: %s\\n\", field.Name, field.GoType)\n\t\t} else {\n\t\t\toutput += fmt.Sprintf(\" %s\\n\", field.RawField)\n\t\t}\n\t}\n\toutput += fmt.Sprintf(\" Results\\n\")\n\tfor _, field := range f.Results {\n\t\tif field.Constructor != \"\" && field.FieldType != \"\" {\n\t\t\toutput += fmt.Sprintf(\" %s: %s\\n\", field.Name, field.FieldType)\n\t\t} else {\n\t\t\toutput += fmt.Sprintf(\" %s\\n\", field.RawField)\n\t\t}\n\t}\n\treturn output\n}", "title": "" }, { "docid": "6111b66bfc402e31f83371d21fe3452c", "score": "0.7320541", "text": "func (fn *FunctionLiteral) String() string {\n\tvar out bytes.Buffer\n\tparams := make([]string, 0)\n\tfor _, param := range fn.Parameters {\n\t\tparams = append(params, param.String())\n\t}\n\tout.WriteString(fn.TokenLiteral())\n\tout.WriteString(\"(\")\n\tout.WriteString(strings.Join(params, \", \"))\n\tout.WriteString(\") \")\n\tout.WriteString(fn.Body.String())\n\treturn out.String()\n}", "title": "" }, { "docid": "1e9f342f16af9351a576b8040292c81c", "score": "0.7214396", "text": "func (p *FuncProvider) String() string {\n\treturn p.Func.Type().String()\n}", "title": "" }, { "docid": "bad5ed82ae5b5455977c7c086c09a0a2", "score": "0.7204964", "text": "func (f FunctionSelector) String() string { return hexutil.Encode(f[:]) }", "title": "" }, { "docid": "d3762bc15f7e22654e9acf93a9db6c30", "score": "0.7189768", "text": "func (c logClosure) String() string {\n\treturn c()\n}", "title": "" }, { "docid": "0cba05d4b0e14bfbfdb0d1349453f90c", "score": "0.716081", "text": "func (me TglFuncType) String() string { return xsdt.String(me).String() }", "title": "" }, { "docid": "092e87c2bf4158e682b42963bdc22772", "score": "0.7085454", "text": "func (c Closure) String() string {\n\treturn c()\n}", "title": "" }, { "docid": "47aa07c4d7bb893d53d9e30089f1a926", "score": "0.7033597", "text": "func (c *Call) String() string {\n\t// Join arguments.\n\tvar str []string\n\tfor _, arg := range c.Args {\n\t\tstr = append(str, arg.String())\n\t}\n\n\t// Write function name and args.\n\treturn fmt.Sprintf(\"%s(%s)\", c.Name, strings.Join(str, \", \"))\n}", "title": "" }, { "docid": "934b437c65a0476779ca0224e6cf39c0", "score": "0.7032466", "text": "func (fn parseFn) String() string {\n\tfnName := runtime.FuncForPC(reflect.ValueOf(fn).Pointer()).Name()\n\treturn fnName[strings.LastIndex(fnName, \".\")+1:]\n}", "title": "" }, { "docid": "30b45ec7131cf51da881df3fd8ec41e2", "score": "0.70156986", "text": "func str() string", "title": "" }, { "docid": "24d5bb8e60a729aae261ef9d33335075", "score": "0.6850912", "text": "func (f GetterTypedFunc) String() string {\n\treturn cast.ToString(f())\n}", "title": "" }, { "docid": "a98344e2ba45867a1c7a2aba22eb9436", "score": "0.67965883", "text": "func (i invocation) String() string {\n\treturn fmt.Sprintf(\"%s %s\", i.name, strings.Join(i.allArgs(), \" \"))\n}", "title": "" }, { "docid": "eaad642e43ccb52b79efd36e7a64d69a", "score": "0.6793771", "text": "func (f CountersFunc) String() string {\n\tm := f()\n\tif m == nil {\n\t\treturn \"{}\"\n\t}\n\treturn counterToString(m)\n}", "title": "" }, { "docid": "924f74115875a8554bb9d22901884ed7", "score": "0.6775379", "text": "func (afi ActivationFunctionIndex) String() string {\n\treturn afi.goExpression(\"x\")\n}", "title": "" }, { "docid": "cbb834034e1154119e5395bb082a940e", "score": "0.6694833", "text": "func (op *Operation) String ( ) string {\n return toString(op)\n}", "title": "" }, { "docid": "8eb6d4c2d6e81c30d5bf0cdbef74868c", "score": "0.6684641", "text": "func (n *FnDeclNode) String() string {\n\tfnStr := \"fn\"\n\n\tif n.name != \"\" {\n\t\tfnStr += \" \" + n.name + \"(\"\n\t}\n\n\tfor i := 0; i < len(n.args); i++ {\n\t\tfnStr += n.args[i]\n\n\t\tif i < (len(n.args) - 1) {\n\t\t\tfnStr += \", \"\n\t\t}\n\t}\n\n\tfnStr += \") {\\n\"\n\n\ttree := n.Tree()\n\n\tstmts := strings.Split(tree.String(), \"\\n\")\n\n\tfor i := 0; i < len(stmts); i++ {\n\t\tif len(stmts[i]) > 0 {\n\t\t\tfnStr += \"\\t\" + stmts[i] + \"\\n\"\n\t\t} else {\n\t\t\tfnStr += \"\\n\"\n\t\t}\n\t}\n\n\tfnStr += \"}\"\n\n\treturn fnStr\n}", "title": "" }, { "docid": "3057caeb0290c5f8372d7c36da164b24", "score": "0.66768914", "text": "func main() {\n\tfmt.Println(strFunc())\n}", "title": "" }, { "docid": "3057caeb0290c5f8372d7c36da164b24", "score": "0.66768914", "text": "func main() {\n\tfmt.Println(strFunc())\n}", "title": "" }, { "docid": "d58bde64ddaa55b5d1a87b146ae75bd2", "score": "0.6669943", "text": "func (n *FnInvNode) string() (string, bool) {\n\tfnInvStr := n.name + \"(\"\n\n\tfor i := 0; i < len(n.args); i++ {\n\t\tfnInvStr += n.args[i].String()\n\n\t\tif i < (len(n.args) - 1) {\n\t\t\tfnInvStr += \", \"\n\t\t}\n\t}\n\n\tfnInvStr += \")\"\n\n\treturn fnInvStr, false\n}", "title": "" }, { "docid": "7920d99b3da5a9bfa9e0b7a4c3af9bad", "score": "0.663027", "text": "func (s UserDefinedFunctionInput) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "3ffeb013805c89c87c48ddb57cebcf97", "score": "0.65607303", "text": "func (as ActionSignature) String() (s string) {\n\ts = fmt.Sprintf(\"{\\n\\t%v,\\n\\t%v,\\n\\t%v,\\n}\", as.Oper, as.Func, as.Params)\n\treturn s\n}", "title": "" }, { "docid": "af92cf0c969093624588205e01b8f1e7", "score": "0.6388079", "text": "func (m Method) String() string {\n\treturn string(m)\n}", "title": "" }, { "docid": "7df6e7e075cd7999311a6509f5c289e2", "score": "0.638315", "text": "func (s StepFunctionsAction) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "0c170eb3c2b624a34e2db3ab020ddec7", "score": "0.6358395", "text": "func (inst *InstCall) String() string {\n\tident := &bytes.Buffer{}\n\tif !inst.Type().Equal(types.Void) {\n\t\tfmt.Fprintf(ident, \"%s = \", inst.Ident())\n\t}\n\t// Print callee signature instead of return type for variadic callees.\n\tcallconv := &bytes.Buffer{}\n\tif inst.CallConv != CallConvNone {\n\t\tfmt.Fprintf(callconv, \" %s\", inst.CallConv)\n\t}\n\tsig := inst.Sig\n\tret := sig.Ret.String()\n\tif sig.Variadic {\n\t\tret = sig.String()\n\t}\n\targs := &bytes.Buffer{}\n\tfor i, arg := range inst.Args {\n\t\tif i != 0 {\n\t\t\targs.WriteString(\", \")\n\t\t}\n\t\tfmt.Fprintf(args, \"%s %s\",\n\t\t\targ.Type(),\n\t\t\targ.Ident())\n\t}\n\tmd := metadataString(inst.Metadata, \",\")\n\treturn fmt.Sprintf(\"%scall%s %s %s(%s)%s\",\n\t\tident,\n\t\tcallconv,\n\t\tret,\n\t\tinst.Callee.Ident(),\n\t\targs,\n\t\tmd)\n}", "title": "" }, { "docid": "035975703990aedac92630621fe2ba5e", "score": "0.63313055", "text": "func (c clock) String() string {\n\treturn \"<native fun>\"\n}", "title": "" }, { "docid": "395c8a8f2c3d339b91fbc54de81d6022", "score": "0.6295992", "text": "func (f mockFuncMatcher) String() string {\n\treturn \"is satisfied by Func\"\n}", "title": "" }, { "docid": "131b5bfd86f6fad7d2ec193787eabb35", "score": "0.62918764", "text": "func stringFunc(q query, t iterator) interface{} {\n\tv := functionArgs(q).Evaluate(t)\n\treturn asString(t, v)\n}", "title": "" }, { "docid": "fd8d1443bb931fcc95b399b8828f3813", "score": "0.6269149", "text": "func (a Action) String() (s string) {\n\ts = fmt.Sprintf(\"{\\n\\t%v,\\n\\t%v,\\n\\t%v,\\n\\t%v,\\n}\", a.Oper, a.Func, a.Params, strings.Replace(a.Sign.String(), \"\\n\", \"\\n\\t\", -1))\n\treturn s\n}", "title": "" }, { "docid": "21a9d40268afffa1b268cc00a07496a8", "score": "0.6247717", "text": "func (n *BindFnNode) String() string {\n\treturn \"bindfn \" + n.name + \" \" + n.cmdname\n}", "title": "" }, { "docid": "b8aa38fb7727ae348c39b4dcab908068", "score": "0.62214416", "text": "func (r *Routine) String() string {\n\tif r.err != nil {\n\t\treturn r.colors.error + r.err.Error() + colorEnd\n\t}\n\n\tif r.time.Second()%2 == 0 {\n\t\treturn r.colors.normal + r.time.Format(r.formatA) + colorEnd\n\t}\n\treturn r.colors.normal + r.time.Format(r.formatB) + colorEnd\n}", "title": "" }, { "docid": "903baa75ca0047901e9ad934f725762b", "score": "0.62025386", "text": "func (f Fiat) String() string {\n\treturn string(f)\n}", "title": "" }, { "docid": "1b9aff23ff5f12e91cd4974021a525cd", "score": "0.6169707", "text": "func (me TglFuncType) ToXsdtString() xsdt.String { return xsdt.String(me) }", "title": "" }, { "docid": "16e92e3d0e4e9ed20fe7f88772242c73", "score": "0.61504036", "text": "func (op op) String() string {\n\tswitch op {\n\tcase add:\n\t\treturn \"+\"\n\tcase sub:\n\t\treturn \"-\"\n\tcase mul:\n\t\treturn \"*\"\n\tcase div:\n\t\treturn \"/\"\n\t}\n\treturn \"\"\n}", "title": "" }, { "docid": "45bee5cb46befde5d586fc5c3c6c0b2e", "score": "0.614462", "text": "func (o *Object) String() string {\n\tdecl := o.decl\n\tif funcDecl, ok := decl.(*ast.FuncDecl); ok {\n\t\t// Strip the body (forward declaration)\n\t\tdecl = &ast.FuncDecl{\n\t\t\tDoc: funcDecl.Doc,\n\t\t\tRecv: funcDecl.Recv,\n\t\t\tName: funcDecl.Name,\n\t\t\tType: funcDecl.Type,\n\t\t\tBody: nil,\n\t\t}\n\t}\n\tvar buf bytes.Buffer\n\terr := printer.Fprint(&buf, o.fset, decl)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn buf.String()\n}", "title": "" }, { "docid": "f428a3ce8b557fd519298d0fee0a43cf", "score": "0.61356634", "text": "func strDump(state *lua.State) int {\n\tstate.CheckType(1, lua.FuncType)\n\tstrip := state.ToBool(2)\n\tstate.SetTop(1)\n\tstate.Push(string(state.Dump(strip)))\n\treturn 1\n}", "title": "" }, { "docid": "9142c73a24136684b855f8b343e30cc3", "score": "0.61223924", "text": "func (m Method) String() string {\n\treturn Methods[m]\n}", "title": "" }, { "docid": "3cb82bd81d79fbce18169d6cb9a48982", "score": "0.6114067", "text": "func toString(i interface{}) string {\n\tv, err := toStringE(i)\n\tif err != nil {\n\t\t_, fn, line, _ := runtime.Caller(0)\n\t\tpanic(filepath.Base(fn) + \":\" + strconv.Itoa(line-2) + \" >> \" + err.Error() + \" >> \" + fmtDebugStack(string(debug.Stack())))\n\t}\n\treturn v\n}", "title": "" }, { "docid": "47cc107ed43fb989fe9d4cdbdfa161a3", "score": "0.6100626", "text": "func (s AwsLambdaTransformation) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "845a2a70958c1aa18a1675ac8509d0b8", "score": "0.6097919", "text": "func (cl *CeLogger) getFuncInfoString() string {\r\n\tif !cl.IsEnable {\r\n\t\treturn \"\"\r\n\t}\r\n\r\n\tif !(cl.IsLogCodeFilename || cl.IsLogCodeFuncName) {\r\n\t\treturn \"\"\r\n\t}\r\n\r\n\tskip := 4\r\n\tpc, filename, lineNumber, ok := runtime.Caller(skip)\r\n\tif !ok {\r\n\t\treturn \"\"\r\n\t}\r\n\r\n\tvar buf bytes.Buffer\r\n\r\n\tbuf.WriteString(\"(\")\r\n\r\n\tif cl.IsLogCodeFilename {\r\n\t\t_, f := path.Split(filename)\r\n\t\tbuf.WriteString(f)\r\n\r\n\t\tif cl.IsLogCodeLineNumber {\r\n\t\t\tbuf.WriteString(fmt.Sprintf(\":%d\", lineNumber))\r\n\t\t\t//buf.WriteString(\":\")\r\n\t\t\t//buf.WriteString(strconv.Itoa(lineNumber))\r\n\t\t}\r\n\t}\r\n\r\n\tif cl.IsLogCodeFuncName {\r\n\t\tif buf.Len() > 1 {\r\n\t\t\tbuf.WriteString(\"-\")\r\n\t\t}\r\n\t\t_, funcName := path.Split(runtime.FuncForPC(pc).Name())\r\n\r\n\t\tbuf.WriteString(funcName)\r\n\t}\r\n\r\n\tbuf.WriteString(\")\")\r\n\treturn buf.String()\r\n}", "title": "" }, { "docid": "c76f31356adf11983c6648dd850d2c09", "score": "0.6073412", "text": "func (p polynomial) String() string {\n\ts := make([]string, len(p))\n\tfor i := 0; i < len(p); i++ {\n\t\ts[i] = fmt.Sprintf(\"%dx^%d\", p[i], i)\n\t}\n\treturn strings.Join(s, \" + \")\n}", "title": "" }, { "docid": "41fc5c6848d4a2860beba7e574909421", "score": "0.6066103", "text": "func (f Frames) String() string {\n\tvar buf bytes.Buffer\n\tfor i, frame := range f {\n\t\tbuf.WriteString(frame.Func)\n\t\tbuf.WriteByte('(')\n\t\tbuf.WriteString(frame.File)\n\t\tbuf.WriteByte(':')\n\t\tbuf.WriteString(strconv.Itoa(frame.Line))\n\t\tbuf.WriteByte(')')\n\t\tif i < len(f)-1 {\n\t\t\tbuf.WriteByte(',')\n\t\t}\n\t}\n\treturn buf.String()\n}", "title": "" }, { "docid": "73a8bd1311f9b7618670e6198282eef9", "score": "0.6053585", "text": "func (g Goroutine) String() string {\n\ts := fmt.Sprintf(\"Goroutine ID: %d, state: %s, top function: %s\",\n\t\tg.ID, g.State, g.TopFunction)\n\tif g.CreatorFunction == \"\" {\n\t\treturn s\n\t}\n\ts += fmt.Sprintf(\", created by: %s, at: %s\",\n\t\tg.CreatorFunction, g.BornAt)\n\treturn s\n}", "title": "" }, { "docid": "273b643fa256b56bfafd773e5f729ced", "score": "0.6045109", "text": "func (s FeaturizationMethod) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "799afd1614ae6269d5d46f614b76328a", "score": "0.6033967", "text": "func (a *arithmetic) String() string {\n\treturn a.left.String() + a.op.String() + a.right.String()\n}", "title": "" }, { "docid": "79c10de02d1a0d42be5cf08f21c0d81a", "score": "0.6031022", "text": "func String(ins Instructions, buf *bytes.Buffer) {\n\tfor i, in := range ins {\n\t\tif i > 0 {\n\t\t\tbuf.WriteString(\" -> \")\n\t\t}\n\t\tstringFunc[in.Op](in.Arg, buf)\n\t}\n}", "title": "" }, { "docid": "7c57be9f896cdba3512bec120590a355", "score": "0.6024682", "text": "func (r *Routine) String() string {\n\tvar c string\n\n\tif r.err != nil {\n\t\treturn r.colors.error + r.err.Error() + colorEnd\n\t}\n\n\tif r.perc < 75 {\n\t\tc = r.colors.normal\n\t} else if r.perc < 90 {\n\t\tc = r.colors.warning\n\t} else {\n\t\tc = r.colors.error\n\t}\n\n\treturn fmt.Sprintf(\"%s%.1f%c/%.1f%c%s\", c, r.used, r.usedUnit, r.total, r.totalUnit, colorEnd)\n}", "title": "" }, { "docid": "a091a36f8a82f00865b3ef746e873cf0", "score": "0.60116166", "text": "func (s *Sleep) String() string {\n\treturn fmt.Sprintf(\"%s(%s)\", s.FunctionName(), s.Child)\n}", "title": "" }, { "docid": "20ebaf5e1fbe59a67014d13692fe6be9", "score": "0.60089594", "text": "func infostring(functionName string, args []string) string {\n\ts := functionName + \"(\"\n\tif len(args) > 0 {\n\t\ts += \"\\\"\" + strings.Join(args, \"\\\", \\\"\") + \"\\\"\"\n\t}\n\treturn s + \")\"\n}", "title": "" }, { "docid": "27601151acb094ee207cd934c2e10d94", "score": "0.60044485", "text": "func (expr Symbol) String() string {\n\treturn string(expr)\n}", "title": "" }, { "docid": "f471903178c4344eec324314f5cbcbb5", "score": "0.5978827", "text": "func (e *ReduceExpr) String() string {\n\treturn fmt.Sprintf(e.format, e.a)\n}", "title": "" }, { "docid": "03564941f0fd74c3f834376d72d58a7d", "score": "0.59775084", "text": "func StringAst(functionName string, goType ast.Expr) ast.Decl {\n\tselfIdent := NewIdent(\"self\")\n\tdeRef := DeRef(CastUnsafePtrOfTypeUuid(DeRef(goType), selfIdent))\n\tsprintf := FormatSprintf(\"%#v\", deRef)\n\n\tfuncDecl := &ast.FuncDecl{\n\t\tDoc: &ast.CommentGroup{\n\t\t\tList: ExportComments(functionName),\n\t\t},\n\t\tName: NewIdent(functionName),\n\t\tType: &ast.FuncType{\n\t\t\tParams: &ast.FieldList{\n\t\t\t\tList: []*ast.Field{\n\t\t\t\t\t{\n\t\t\t\t\t\tNames: []*ast.Ident{selfIdent},\n\t\t\t\t\t\tType: unsafePointer,\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t},\n\t\t\tResults: &ast.FieldList{\n\t\t\t\tList: []*ast.Field{\n\t\t\t\t\t{Type: charStarType},\n\t\t\t\t},\n\t\t\t},\n\t\t},\n\t\tBody: &ast.BlockStmt{\n\t\t\tList: []ast.Stmt{\n\t\t\t\tReturn(&ast.CallExpr{\n\t\t\t\t\tFun: cStringType,\n\t\t\t\t\tArgs: []ast.Expr{\n\t\t\t\t\t\tsprintf,\n\t\t\t\t\t},\n\t\t\t\t}),\n\t\t\t},\n\t\t},\n\t}\n\n\treturn funcDecl\n}", "title": "" }, { "docid": "96f743e501fc262a7118c5d9426c137e", "score": "0.59742486", "text": "func (cd decodedCallData) String() string {\n\targs := make([]string, len(cd.inputs))\n\tfor i, arg := range cd.inputs {\n\t\targs[i] = arg.String()\n\t}\n\treturn fmt.Sprintf(\"%s(%s)\", cd.name, strings.Join(args, \",\"))\n}", "title": "" }, { "docid": "7c03cdd0b6270aad0cabae2b02644c36", "score": "0.59720886", "text": "func (e *DArrowExpr) String() string {\n\treturn fmt.Sprintf(\"(%s => %s)\", e.lhs, e.fn)\n}", "title": "" }, { "docid": "1fb2b4dae4bde37f50e6d6246e166957", "score": "0.5962325", "text": "func ExprToString(expr Expr) string {\n\tif expr == nil {\n\t\treturn \"()\"\n\t}\n\treturn expr.String()\n}", "title": "" }, { "docid": "de6d594ff0fddcd0540244f36248cf16", "score": "0.59607303", "text": "func (g Generator) String() string {\n\ttxt := \"Generator [\"\n\ttxt += fmt.Sprintf(\"Id: %s, UID: %d, Function ID: %d, \", g.Id, g.Uid, g.Fid)\n\ttxt += fmt.Sprintf(\"Has Data: %t, \", (g.Data != nil))\n\ttxt += fmt.Sprintf(\"Has Resulter: %t, \", (g.Result != nil))\n\ttxt += fmt.Sprintf(\"Is Callback: %t, With Packet: %t\", g.IsCallback, g.WithPacket)\n\ttxt += \"]\"\n\treturn txt\n}", "title": "" }, { "docid": "c3381a32f31a1e370a43827a53bc8a90", "score": "0.59485674", "text": "func (s TimeSeriesTransformation) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "ddb6a3a4f32d51a198f4a0cfd584dbb2", "score": "0.5944768", "text": "func (d *Decorator) String() string {\n\treturn fmt.Sprintf(\"* %s (%v)\", d.name, d.Params)\n}", "title": "" }, { "docid": "ca921a1f9da31d84ab42ffbabc3d9446", "score": "0.5943551", "text": "func (c *jsiiProxy_CfnEndpoint) ToString() *string {\n\tvar returns *string\n\n\t_jsii_.Invoke(\n\t\tc,\n\t\t\"toString\",\n\t\tnil, // no parameters\n\t\t&returns,\n\t)\n\n\treturn returns\n}", "title": "" }, { "docid": "852eb142ee9726de775c8922da2e2619", "score": "0.5940613", "text": "func String(f Forth) string {\n\tc := f.Pop()\n\tswitch s := c.(type) {\n\tcase string:\n\t\treturn s\n\tdefault:\n\t\tpanic(fmt.Errorf(\"%v:%w\", c, strconv.ErrSyntax))\n\t}\n}", "title": "" }, { "docid": "9754cbf9c4c005e00b964645d5a86236", "score": "0.5921017", "text": "func (e *Expression) String() string {\n\tvar l, r, o string\n\tif e.lOperand != nil {\n\t\tl = *e.lOperand\n\t}\n\tif e.rOperand != nil {\n\t\tr = *e.rOperand\n\t}\n\tif e.operator != nil {\n\t\to = *e.operator\n\t}\n\ts := fmt.Sprintf(\"[ %s %s %s ]\", l, o, r)\n\treturn s\n}", "title": "" }, { "docid": "13ec3937372f65cf5967bf7d96d8722e", "score": "0.59190595", "text": "func (node *SubExpression) String() string {\n\treturn fmt.Sprintf(\"Sexp{Path:%s, Pos:%d}\", node.Expression.Path, node.Loc.Pos)\n}", "title": "" }, { "docid": "b40f493ac63323a186c86e3e3f82c3a6", "score": "0.59148926", "text": "func (f Feature) String() string {\n\treturn string(f)\n}", "title": "" }, { "docid": "fc87124f463ced07fcb1423062fc6bb1", "score": "0.59139544", "text": "func (f FilterOperator) String() string {\n\treturn string(f)\n}", "title": "" }, { "docid": "77b89e5cd6b60c1e5e5568c0c436c674", "score": "0.5913901", "text": "func (s *Script) String() string {\n\treturn fmt.Sprintf(`script(name: \"%s\", package: %s)`, s.name, s.pkg)\n}", "title": "" }, { "docid": "67051e31b9c53948ba403e3b4ae30b0f", "score": "0.59131736", "text": "func (s LambdaInvokeOperation) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "403a594322568af042bd70f092c3c625", "score": "0.5911557", "text": "func (f Stone) String() string { return fmt.Sprintf(\"%gst\", f) }", "title": "" }, { "docid": "6faf2bc4b854f1279ff4cc20446ca28d", "score": "0.59066546", "text": "func (t ShipmentRecalculate) String() string {\n\tjt, _ := json.Marshal(t)\n\treturn string(jt)\n}", "title": "" }, { "docid": "61daba3449c02f3f765e20ce493f3e83", "score": "0.5894639", "text": "func (n *Node) String() {\n\tfmt.Println(\"Stringify\")\n\tstringify(n, 0)\n}", "title": "" }, { "docid": "fe9c2e3cc550e424f0896dfe54cfbcee", "score": "0.5891622", "text": "func Stringify(exp Any, quote bool) (result string) {\n\tswitch exp {\n\tcase true:\n\t\treturn \"#t\"\n\tcase false:\n\t\treturn \"#f\"\n\tcase scanner.EOF: // rune(-1)\n\t\treturn \"#<EOF>\"\n\tcase Void:\n\t\treturn \"#<VOID>\"\n\tcase CallCCVal:\n\t\treturn \"#<call/cc>\"\n\tcase ApplyVal:\n\t\treturn \"#<apply>\"\n\t}\n\tswitch x := exp.(type) {\n\tcase *Cell:\n\t\tss := make([]string, 0, 100)\n\t\tfor x != Nil {\n\t\t\tss = append(ss, Stringify(x.Car, quote))\n\t\t\tif kdr, ok := x.Cdr.(*Cell); ok {\n\t\t\t\tx = kdr\n\t\t\t} else {\n\t\t\t\tss = append(ss, \".\")\n\t\t\t\tss = append(ss, Stringify(x.Cdr, quote))\n\t\t\t\tbreak\n\t\t\t}\n\t\t}\n\t\treturn \"(\" + strings.Join(ss, \" \") + \")\"\n\tcase *Environment:\n\t\tss := make([]string, 0, 100)\n\t\tfor x != nil {\n\t\t\tif x == GlobalEnv {\n\t\t\t\tss = append(ss, \"GlobalEnv\")\n\t\t\t\tbreak\n\t\t\t}\n\t\t\tif x.Sym == nil { // frame top\n\t\t\t\tss = append(ss, \"|\")\n\t\t\t} else {\n\t\t\t\tss = append(ss, string(*x.Sym))\n\t\t\t}\n\t\t\tx = x.Next\n\t\t}\n\t\treturn \"#<\" + strings.Join(ss, \" \") + \">\"\n\tcase *Closure:\n\t\tp := Stringify(x.Params, true)\n\t\tb := Stringify(x.Body, true)\n\t\te := Stringify(x.Env, true)\n\t\treturn \"#<\" + p + \":\" + b + \":\" + e + \">\"\n\tcase Continuation:\n\t\tss := make([]string, 0, 100)\n\t\tfor _, step := range x {\n\t\t\tp := OpStr[step.Op]\n\t\t\tv := Stringify(step.Val, true)\n\t\t\tss = append(ss, p+\" \"+v)\n\t\t}\n\t\treturn \"\\n\\t#<\" + strings.Join(ss, \"\\n\\t \") + \">\"\n\tcase *Symbol:\n\t\treturn string(*x)\n\tcase string:\n\t\tif quote {\n\t\t\treturn fmt.Sprintf(\"%q\", exp)\n\t\t}\n\tcase rune:\n\t\treturn fmt.Sprintf(\"#\\\\%c\", x)\n\tcase []Any:\n\t\tss := make([]string, 0, 100)\n\t\tfor _, e := range x {\n\t\t\tss = append(ss, Stringify(e, true))\n\t\t}\n\t\treturn \"#(\" + strings.Join(ss, \" \") + \")\"\n\t}\n\treturn fmt.Sprintf(\"%v\", exp)\n}", "title": "" }, { "docid": "7da654f3cda6f7c16e79bc16193de731", "score": "0.58873194", "text": "func (e PackageExpr) String() string {\n\treturn fmt.Sprintf(\"(//%s)\", e.a)\n}", "title": "" }, { "docid": "b4378710b7d07c53a7c9951588eec6a5", "score": "0.5887261", "text": "func (s *sqrt) String() string {\n\treturn \"sqrt(\" + s.arg.String() + \")\"\n}", "title": "" }, { "docid": "a7f8e4634510d7e4c743d6ca8e9757dc", "score": "0.588488", "text": "func (f *F) String() string {\n\ts, _ := f.val()\n\treturn s\n}", "title": "" }, { "docid": "4e8536a9eeb2f0d06f04934cc24a459b", "score": "0.58790743", "text": "func (me TMorphMethodType) String() string { return xsdt.String(me).String() }", "title": "" }, { "docid": "4255e0413d8b8634f006bd41d79a312e", "score": "0.58783525", "text": "func (r *routine) String() string {\n\tif r.err != nil {\n\t\treturn r.colors.error + r.err.Error() + COLOR_END\n\t}\n\n\tif r.time.Second() % 2 == 0 {\n\t\treturn r.colors.normal + r.time.Format(r.format_a) + COLOR_END\n\t} else {\n\t\treturn r.colors.normal + r.time.Format(r.format_b) + COLOR_END\n\t}\n}", "title": "" }, { "docid": "fdaf5a1528d9a5815af44d86e2b2e02c", "score": "0.58775824", "text": "func (node *Expression) String() string {\n\treturn fmt.Sprintf(\"Expr{Path:%s, Pos:%d}\", node.Path, node.Loc.Pos)\n}", "title": "" }, { "docid": "07ae072cb51f66340ea521e0eadaed0a", "score": "0.5875801", "text": "func (c ScheduledJob_Callback) String() string {\n\treturn fmt.Sprintf(\"%T(%v)\", c, capnp.Client(c))\n}", "title": "" }, { "docid": "cc23cf19ee392989a9ae9c677c7f9e86", "score": "0.5875496", "text": "func (ty *Type) String() string {\n\tswitch {\n\tcase ty.Kind.Cat() == Function && len(ty.Size) == 2:\n\t\tstr := \"func \"\n\t\tnpars := ty.Size[0]\n\t\tif ty.Kind.SubCat() == Method {\n\t\t\tstr += \"(\" + ty.Els.StringRange(0, 1) + \") \" + ty.Name + \"(\" + ty.Els.StringRange(1, npars-1) + \")\"\n\t\t} else {\n\t\t\tstr += ty.Name + \"(\" + ty.Els.StringRange(0, npars) + \")\"\n\t\t}\n\t\tnrets := ty.Size[1]\n\t\tif nrets == 1 {\n\t\t\ttel := ty.Els[npars]\n\t\t\tstr += \" \" + tel.Type\n\t\t} else if nrets > 1 {\n\t\t\tstr += \" (\" + ty.Els.StringRange(npars, nrets) + \")\"\n\t\t}\n\t\treturn str\n\tcase ty.Kind.SubCat() == Map:\n\t\treturn \"map[\" + ty.Els[0].Type + \"]\" + ty.Els[1].Type\n\tcase ty.Kind == String:\n\t\treturn \"string\"\n\tcase ty.Kind.SubCat() == List:\n\t\treturn \"[]\" + ty.Els[0].Type\n\t}\n\treturn ty.Name + \": \" + ty.Kind.String()\n}", "title": "" }, { "docid": "1c0d1220c57365825d91cae9d9c9764b", "score": "0.5872521", "text": "func (r *routine) String() string {\n\tvar c string\n\tvar b strings.Builder\n\n\tif r.err != nil {\n\t\treturn r.colors.error + r.err.Error() + COLOR_END\n\t}\n\n\tfor i, iface := range r.ilist {\n\t\tdown, down_u := shrink(iface.new_down - iface.old_down)\n\t\tup, up_u := shrink(iface.new_up - iface.old_up)\n\n\t\tif down_u == 'B' || up_u == 'B' || down_u == 'K' || up_u == 'K' {\n\t\t\tc = r.colors.normal\n\t\t} else if down_u == 'M' || up_u == 'M' {\n\t\t\tc = r.colors.warning\n\t\t} else {\n\t\t\tc = r.colors.error\n\t\t}\n\n\t\tif i > 0 {\n\t\t\tb.WriteString(\", \")\n\t\t}\n\t\tb.WriteString(c)\n\t\tfmt.Fprintf(&b, \"%s: %4v%c↓/%4v%c↑\", iface.name, down, down_u, up, up_u)\n\t\tb.WriteString(COLOR_END)\n\t}\n\n\treturn b.String()\n}", "title": "" }, { "docid": "c1d8641d250af009850f0855c9ecbaac", "score": "0.58708525", "text": "func String(x interface{}) string {\n if x == nil {\n return \"null\"\n }\n v := refl.ValueOf(x)\n if isNil(v) {\n return \"null\"\n }\n if v.Kind() == refl.Func {\n return v.Type().String()\n }\n return fmt.Sprint(x)\n}", "title": "" }, { "docid": "13c4bd5c1e8ef995ad78c506165d1af8", "score": "0.5854607", "text": "func (e *Executor) ToString(ctx query.FunctionContext) string {\n\tv, err := e.Exec(ctx)\n\tif err != nil {\n\t\tif rec, ok := err.(*query.ErrRecoverable); ok {\n\t\t\treturn query.IToString(rec.Recovered)\n\t\t}\n\t\treturn \"\"\n\t}\n\treturn query.IToString(v)\n}", "title": "" }, { "docid": "e0fa98c637a1c5745685360d021bd668", "score": "0.58500797", "text": "func (c *coefficient) String() string {\n\treturn string(*c)\n}", "title": "" }, { "docid": "a0725864ae2c240df739f9d05577b798", "score": "0.58409274", "text": "func (node *PathExpression) String() string {\n\treturn fmt.Sprintf(\"Path{Original:'%s', Pos:%d}\", node.Original, node.Loc.Pos)\n}", "title": "" }, { "docid": "cfc98ba8f406e0de96c081f52e983752", "score": "0.58320916", "text": "func (a Args) String() string {\n\tdata, _ := json.Marshal(a)\n\treturn string(data)\n}", "title": "" }, { "docid": "669e0fe1376079ca4c9a24251cb17edf", "score": "0.582913", "text": "func (gsm GenericStringMatcher) String() string {\n\treturn \"validation function\"\n}", "title": "" }, { "docid": "832a98ede4d8fb171ac68cd3369a2295", "score": "0.582699", "text": "func (cd DecodedCallData) String() string {\n\targs := make([]string, len(cd.Inputs))\n\tfor i, arg := range cd.Inputs {\n\t\targs[i] = arg.String()\n\t}\n\treturn fmt.Sprintf(\"%s(%s)\", cd.Name, strings.Join(args, \",\"))\n}", "title": "" }, { "docid": "e0d52a39a636bcf67fe11e303cf74353", "score": "0.5821845", "text": "func (me TglslFloat) String() string { return xsdt.Float(me).String() }", "title": "" }, { "docid": "d194895423cefd74d4ca75937daf55df", "score": "0.5820128", "text": "func (t ShipmentRecalculates) String() string {\n\tjt, _ := json.Marshal(t)\n\treturn string(jt)\n}", "title": "" }, { "docid": "831a919f338ccaaadd83cdf67c48f999", "score": "0.58184254", "text": "func (m *M3) String() string {\n x := m.matrix\n return fmt.Sprintf(\"%f %f %f\\n\"+\n \"%f %f %f\\n\"+\n \"%f %f %f\\n\",\n x[0], x[1], x[2],\n x[3], x[4], x[5],\n x[6], x[7], x[8])\n}", "title": "" }, { "docid": "18260c2256e06a40c3cbf0d9932e9dbc", "score": "0.5811398", "text": "func (a Algorithm) String() string {\n\tswitch a {\n\tcase RoundRobin:\n\t\treturn \"roundRobin\"\n\tcase Random:\n\t\treturn \"random\"\n\tcase ConsistentHash:\n\t\treturn \"consistentHash\"\n\tdefault:\n\t\treturn \"\"\n\t}\n}", "title": "" }, { "docid": "ced61fbe215f347f451993ee1c80ee88", "score": "0.58075076", "text": "func (f Float) String() string {\n\treturn strconv.FormatFloat(float64(f), 'f', -1, 64)\n}", "title": "" }, { "docid": "1fc5e33523d2d65e5ce7e103f04be201", "score": "0.58069897", "text": "func (o NetworkEndpointGroupCloudFunctionResponseOutput) Function() pulumi.StringOutput {\n\treturn o.ApplyT(func(v NetworkEndpointGroupCloudFunctionResponse) string { return v.Function }).(pulumi.StringOutput)\n}", "title": "" }, { "docid": "9f7ae5e3bf93ef79224f424b498b0f4b", "score": "0.5804742", "text": "func (s TransformOperation) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "70b37f32f9dbd51ae25dfbb01c51aa7c", "score": "0.5801634", "text": "func (e *BinaryExpr) String() string {\n\treturn fmt.Sprintf(\"%s %s %s\", e.LHS.String(), e.Op.String(), e.RHS.String())\n}", "title": "" }, { "docid": "83a46248829dad117db1e93104b4d910", "score": "0.5801272", "text": "func (i Instruction) String() string {\n\tvar str strings.Builder\n\n\tstr.WriteString(i.OpCode.String())\n\tstr.WriteRune(' ')\n\tstr.WriteString(strconv.Itoa(i.A))\n\tstr.WriteRune(' ')\n\tstr.WriteString(strconv.Itoa(i.B))\n\tstr.WriteRune(' ')\n\tstr.WriteString(strconv.Itoa(i.C))\n\n\treturn str.String()\n}", "title": "" }, { "docid": "006933b2148be08b114fd1b84cd50eef", "score": "0.57930887", "text": "func (i Instr) String() string {\n\treturn fmt.Sprintf(\"{%s %v %d}\", opNames[i.Opcode], i.Operand, i.SourceLine)\n}", "title": "" }, { "docid": "3c11fdc948466f261d7985ddb6ee8590", "score": "0.57882905", "text": "func (fa *facade) String() string { return fa.pkg.Preview(fa.ident) }", "title": "" } ]
d531c1a3af747a0a9eaef5d6887c94bd
NewIAMSys creates new config system object.
[ { "docid": "34b039cbc3be190ed50aecda21c9dd65", "score": "0.8430917", "text": "func NewIAMSys() *IAMSys {\n\treturn &IAMSys{\n\t\tusersSysType: MinIOUsersSysType,\n\t\tconfigLoaded: make(chan struct{}),\n\t}\n}", "title": "" } ]
[ { "docid": "848a045c754861042e750ecd0cbf0cab", "score": "0.63383436", "text": "func NewIAM(system string, appCode, appSecret, bkIAMHost, bkPaaSHost string) *IAM {\n\tiamBackendClient := client.NewIAMBackendClient(bkIAMHost, false, system, appCode, appSecret)\n\tesbClient := client.NewESBClient(bkPaaSHost, appCode, appSecret)\n\n\treturn &IAM{\n\t\tappCode: appCode,\n\t\tappSecret: appSecret,\n\n\t\tclient: iamBackendClient,\n\t\tesbClient: esbClient,\n\t}\n}", "title": "" }, { "docid": "59443b3d496cf780223fbb65cd8093cd", "score": "0.600759", "text": "func NewSystem(ipAddress string) System {\n\treturn &systemRepo{\n\t\tipAddress: ipAddress,\n\t}\n}", "title": "" }, { "docid": "2580649651173caf6ead5d5945e763d8", "score": "0.5878024", "text": "func (sys *IAMSys) Init(ctx context.Context, objAPI ObjectLayer, etcdClient *etcd.Client, iamRefreshInterval time.Duration) {\n\tbootstrapTrace(\"IAM initialization started\")\n\tglobalServerConfigMu.RLock()\n\ts := globalServerConfig\n\tglobalServerConfigMu.RUnlock()\n\n\topenidConfig, err := openid.LookupConfig(s,\n\t\tNewHTTPTransport(), xhttp.DrainBody, globalSite.Region)\n\tif err != nil {\n\t\tlogger.LogIf(ctx, fmt.Errorf(\"Unable to initialize OpenID: %w\", err))\n\t}\n\n\t// Initialize if LDAP is enabled\n\tldapConfig, err := xldap.Lookup(s, globalRootCAs)\n\tif err != nil {\n\t\tlogger.LogIf(ctx, fmt.Errorf(\"Unable to parse LDAP configuration: %w\", err))\n\t}\n\n\tstsTLSConfig, err := xtls.Lookup(s[config.IdentityTLSSubSys][config.Default])\n\tif err != nil {\n\t\tlogger.LogIf(ctx, fmt.Errorf(\"Unable to initialize X.509/TLS STS API: %w\", err))\n\t}\n\n\tif stsTLSConfig.InsecureSkipVerify {\n\t\tlogger.LogIf(ctx, fmt.Errorf(\"CRITICAL: enabling %s is not recommended in a production environment\", xtls.EnvIdentityTLSSkipVerify))\n\t}\n\n\tauthNPluginCfg, err := idplugin.LookupConfig(s[config.IdentityPluginSubSys][config.Default],\n\t\tNewHTTPTransport(), xhttp.DrainBody, globalSite.Region)\n\tif err != nil {\n\t\tlogger.LogIf(ctx, fmt.Errorf(\"Unable to initialize AuthNPlugin: %w\", err))\n\t}\n\n\tsetGlobalAuthNPlugin(idplugin.New(GlobalContext, authNPluginCfg))\n\n\tauthZPluginCfg, err := polplugin.LookupConfig(s, GetDefaultConnSettings(), xhttp.DrainBody)\n\tif err != nil {\n\t\tlogger.LogIf(ctx, fmt.Errorf(\"Unable to initialize AuthZPlugin: %w\", err))\n\t}\n\n\tif authZPluginCfg.URL == nil {\n\t\topaCfg, err := opa.LookupConfig(s[config.PolicyOPASubSys][config.Default],\n\t\t\tNewHTTPTransport(), xhttp.DrainBody)\n\t\tif err != nil {\n\t\t\tlogger.LogIf(ctx, fmt.Errorf(\"Unable to initialize AuthZPlugin from legacy OPA config: %w\", err))\n\t\t} else {\n\t\t\tauthZPluginCfg.URL = opaCfg.URL\n\t\t\tauthZPluginCfg.AuthToken = opaCfg.AuthToken\n\t\t\tauthZPluginCfg.Transport = opaCfg.Transport\n\t\t\tauthZPluginCfg.CloseRespFn = opaCfg.CloseRespFn\n\t\t}\n\t}\n\n\tsetGlobalAuthZPlugin(polplugin.New(authZPluginCfg))\n\n\tsys.Lock()\n\tdefer sys.Unlock()\n\n\tsys.LDAPConfig = ldapConfig\n\tsys.OpenIDConfig = openidConfig\n\tsys.STSTLSConfig = stsTLSConfig\n\n\tsys.iamRefreshInterval = iamRefreshInterval\n\n\t// Initialize IAM store\n\tsys.initStore(objAPI, etcdClient)\n\n\tretryCtx, cancel := context.WithCancel(ctx)\n\n\t// Indicate to our routine to exit cleanly upon return.\n\tdefer cancel()\n\n\tr := rand.New(rand.NewSource(time.Now().UnixNano()))\n\n\t// Migrate storage format if needed.\n\tfor {\n\t\t// Migrate IAM configuration, if necessary.\n\t\tif err := saveIAMFormat(retryCtx, sys.store); err != nil {\n\t\t\tif configRetriableErrors(err) {\n\t\t\t\tlogger.Info(\"Waiting for all MinIO IAM sub-system to be initialized.. possible cause (%v)\", err)\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tlogger.LogIf(ctx, fmt.Errorf(\"IAM sub-system is partially initialized, unable to write the IAM format: %w\", err))\n\t\t\treturn\n\t\t}\n\n\t\tbreak\n\t}\n\n\t// Load IAM data from storage.\n\tfor {\n\t\tif err := sys.Load(retryCtx); err != nil {\n\t\t\tif configRetriableErrors(err) {\n\t\t\t\tlogger.Info(\"Waiting for all MinIO IAM sub-system to be initialized.. possible cause (%v)\", err)\n\t\t\t\ttime.Sleep(time.Duration(r.Float64() * float64(5*time.Second)))\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tif err != nil {\n\t\t\t\tlogger.LogIf(ctx, fmt.Errorf(\"Unable to initialize IAM sub-system, some users may not be available: %w\", err))\n\t\t\t}\n\t\t}\n\t\tbreak\n\t}\n\n\tbootstrapTrace(\"finishing IAM loading\")\n\n\trefreshInterval := sys.iamRefreshInterval\n\n\t// Set up polling for expired accounts and credentials purging.\n\tswitch {\n\tcase sys.OpenIDConfig.ProviderEnabled():\n\t\tgo func() {\n\t\t\ttimer := time.NewTimer(refreshInterval)\n\t\t\tdefer timer.Stop()\n\t\t\tfor {\n\t\t\t\tselect {\n\t\t\t\tcase <-timer.C:\n\t\t\t\t\tsys.purgeExpiredCredentialsForExternalSSO(ctx)\n\n\t\t\t\t\ttimer.Reset(refreshInterval)\n\t\t\t\tcase <-ctx.Done():\n\t\t\t\t\treturn\n\t\t\t\t}\n\t\t\t}\n\t\t}()\n\tcase sys.LDAPConfig.Enabled():\n\t\tgo func() {\n\t\t\ttimer := time.NewTimer(refreshInterval)\n\t\t\tdefer timer.Stop()\n\n\t\t\tfor {\n\t\t\t\tselect {\n\t\t\t\tcase <-timer.C:\n\t\t\t\t\tsys.purgeExpiredCredentialsForLDAP(ctx)\n\t\t\t\t\tsys.updateGroupMembershipsForLDAP(ctx)\n\n\t\t\t\t\ttimer.Reset(refreshInterval)\n\t\t\t\tcase <-ctx.Done():\n\t\t\t\t\treturn\n\t\t\t\t}\n\t\t\t}\n\t\t}()\n\t}\n\n\t// Start watching changes to storage.\n\tgo sys.watch(ctx)\n\n\t// Load RoleARNs\n\tsys.rolesMap = make(map[arn.ARN]string)\n\n\t// From OpenID\n\tif riMap := sys.OpenIDConfig.GetRoleInfo(); riMap != nil {\n\t\tsys.validateAndAddRolePolicyMappings(ctx, riMap)\n\t}\n\n\t// From AuthN plugin if enabled.\n\tif authn := newGlobalAuthNPluginFn(); authn != nil {\n\t\triMap := authn.GetRoleInfo()\n\t\tsys.validateAndAddRolePolicyMappings(ctx, riMap)\n\t}\n\n\tsys.printIAMRoles()\n}", "title": "" }, { "docid": "8b6c47afc0eb65cd5ff61520600d5896", "score": "0.57887167", "text": "func NewSystem() *system {\n\tdefaultSys = &system{}\n\tdefaultSys.init()\n\treturn defaultSys\n}", "title": "" }, { "docid": "ac27a555e46e35d3fe6ad6a9553c0572", "score": "0.56544083", "text": "func New(quiet bool) *SysInfo {\n\tsysInfo := &SysInfo{}\n\treturn sysInfo\n}", "title": "" }, { "docid": "37ce5aac9b2c6903f65e7bfe31c8983d", "score": "0.56012034", "text": "func NewSystem() *System {\n\treturn &System{\n\t\tclasses: map[string]*Class{},\n\t\tclassOrder: []string{},\n\t}\n}", "title": "" }, { "docid": "cc6ee4b069f919fded6dc6dc274f5d83", "score": "0.55923563", "text": "func newAdSystem(id int, name string, canonicalDomain string) *adSystem {\n\treturn &adSystem{ID: id, Name: name, CanonicalDomain: canonicalDomain}\n}", "title": "" }, { "docid": "3da744943de58c0958c06fdbaf928fdf", "score": "0.55613464", "text": "func (mas *MoveAISystem) New(w *ecs.World) {\n\n}", "title": "" }, { "docid": "f76eb1ef7cc420cb479da26288907d18", "score": "0.54974955", "text": "func New(infos Infos, options *core.Options) *System {\n\treturn &System{\n\t\tInfos: infos,\n\t\tOptions: options,\n\t\tGames: map[string]*rom.Game{},\n\t\tRegionsStats: map[string]int{},\n\t}\n}", "title": "" }, { "docid": "7a00130487e00b48b60fd85909ad5e34", "score": "0.54725033", "text": "func NewSystem(name string) *System {\n\tvar ret System\n\tret.Name = name\n\tret.BaseUnits = make(map[Measure]*BaseUnit)\n\tret.units = make(map[string]Unit)\n\tret.nilu = &NilUnit{system: &ret}\n\n\treturn &ret\n}", "title": "" }, { "docid": "86e0a475d951c5cbb765a6ebbefaeb0c", "score": "0.541772", "text": "func NewSystem() *System {\n\tr := NewNode(\"\", nil)\n\treturn &System{\n\t\troot: r,\n\t\tslash: newDir(r.Open(\"\")),\n\t\tanchors: make(map[string]*Anchor),\n\t}\n}", "title": "" }, { "docid": "4b369734b7cd60e9c25138177f6793ef", "score": "0.52799386", "text": "func NewIntSysSvc(t mockConstructorTestingTNewIntSysSvc) *IntSysSvc {\n\tmock := &IntSysSvc{}\n\tmock.Mock.Test(t)\n\n\tt.Cleanup(func() { mock.AssertExpectations(t) })\n\n\treturn mock\n}", "title": "" }, { "docid": "d166e7ced22a9d2214fa0ee2bc59c5fb", "score": "0.5219006", "text": "func NewSystemConfig(defaultZoneConfig *zonepb.ZoneConfig) *SystemConfig {\n\tsc := &SystemConfig{}\n\tsc.DefaultZoneConfig = defaultZoneConfig\n\tsc.mu.zoneCache = map[SystemTenantObjectID]zoneEntry{}\n\tsc.mu.shouldSplitCache = map[SystemTenantObjectID]bool{}\n\treturn sc\n}", "title": "" }, { "docid": "34a8e8a7a110b67c129091e0fcfb4ce4", "score": "0.5216555", "text": "func generateSysNamespace(namespace string) *v1.Namespace {\n\tlabels := kudoinit.GenerateLabels(map[string]string{})\n\treturn &v1.Namespace{\n\t\tObjectMeta: metav1.ObjectMeta{\n\t\t\tLabels: labels,\n\t\t\tName: namespace,\n\t\t},\n\t\tTypeMeta: metav1.TypeMeta{\n\t\t\tKind: \"Namespace\",\n\t\t\tAPIVersion: \"v1\",\n\t\t},\n\t}\n}", "title": "" }, { "docid": "e04c52032b51b03f1f47f2aed01fba43", "score": "0.51870686", "text": "func NewAWSIAMConfiguration() *AWSIAMConfiguration {\n\tconf := &AWSIAMConfiguration{}\n\tSetObjectDefaults_AWSIAMConfiguration(conf)\n\treturn conf\n}", "title": "" }, { "docid": "7ccf5e6da9d4377df44d8b4ae77af440", "score": "0.50678635", "text": "func newSysboxMgr(ctx *cli.Context) (*SysboxMgr, error) {\n\tvar err error\n\n\terr = preFlightCheck()\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"preflight check failed: %s\", err)\n\t}\n\n\tsysboxLibDir = ctx.GlobalString(\"data-root\")\n\tif sysboxLibDir == \"\" {\n\t\tsysboxLibDir = sysboxLibDirDefault\n\t}\n\tlogrus.Infof(\"Sysbox data root: %s\", sysboxLibDir)\n\n\terr = setupWorkDirs()\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"failed to setup the sysbox work dirs: %v\", err)\n\t}\n\n\tsubidAlloc, err := setupSubidAlloc(ctx)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"failed to setup subid allocator: %v\", err)\n\t}\n\n\tdockerVolMgr, err := setupDockerVolMgr(ctx)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"failed to setup docker vol mgr: %v\", err)\n\t}\n\n\tkubeletVolMgr, err := setupKubeletVolMgr(ctx)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"failed to setup kubelet vol mgr: %v\", err)\n\t}\n\n\tcontainerdVolMgr, err := setupContainerdVolMgr(ctx)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"failed to setup containerd vol mgr: %v\", err)\n\t}\n\n\tshiftfsMgr, err := shiftfsMgr.New()\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"failed to setup shiftfs mgr: %v\", err)\n\t}\n\n\thostDistro, err := libutils.GetDistro()\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"failed to identify system's linux distribution: %v\", err)\n\t}\n\n\thostKernelHdrPath, err := libutils.GetLinuxHeaderPath(hostDistro)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"failed to identify system's linux-header path: %v\", err)\n\t}\n\n\tlinuxHeaderMounts, err := getLinuxHeaderMounts(hostKernelHdrPath)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"failed to compute linux header mounts: %v\", err)\n\t}\n\n\tlibModMounts, err := getLibModMounts()\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"failed to compute kernel-module mounts: %v\", err)\n\t}\n\n\tmgrCfg := &ipcLib.MgrConfig{\n\t\tAliasDns: ctx.GlobalBoolT(\"alias-dns\"),\n\t}\n\n\tif mgrCfg.AliasDns == true {\n\t\tlogrus.Infof(\"Sys container DNS aliasing enabled.\")\n\t} else {\n\t\tlogrus.Infof(\"Sys container DNS aliasing disabled.\")\n\t}\n\n\tmgr := &SysboxMgr{\n\t\tmgrCfg: mgrCfg,\n\t\tsubidAlloc: subidAlloc,\n\t\tdockerVolMgr: dockerVolMgr,\n\t\tkubeletVolMgr: kubeletVolMgr,\n\t\tcontainerdVolMgr: containerdVolMgr,\n\t\tshiftfsMgr: shiftfsMgr,\n\t\thostDistro: hostDistro,\n\t\thostKernelHdrPath: hostKernelHdrPath,\n\t\tlinuxHeaderMounts: linuxHeaderMounts,\n\t\tlibModMounts: libModMounts,\n\t\tcontTable: make(map[string]containerInfo),\n\t\trootfsTable: make(map[string]string),\n\t\trootfsMonStop: make(chan int),\n\t\texclMntTable: newExclusiveMntTable(),\n\t}\n\n\tcb := &grpc.ServerCallbacks{\n\t\tRegister: mgr.register,\n\t\tUnregister: mgr.unregister,\n\t\tSubidAlloc: mgr.allocSubid,\n\t\tReqMounts: mgr.reqMounts,\n\t\tPrepMounts: mgr.prepMounts,\n\t\tReqShiftfsMark: mgr.reqShiftfsMark,\n\t\tReqFsState: mgr.reqFsState,\n\t\tPause: mgr.pause,\n\t}\n\n\tmgr.grpcServer = grpc.NewServerStub(cb)\n\n\treturn mgr, nil\n}", "title": "" }, { "docid": "7008b7103aee7e78c6ee21a2d75ac497", "score": "0.5054347", "text": "func NewSystemsManager() SystemsManager {\n\treturn SystemsManager{\n\t\tlastEntityID: 0,\n\t\tSystemsMap: map[string]System{},\n\t\tshouldAddEntities: true,\n\t}\n}", "title": "" }, { "docid": "2409abcab13e205885d605b6fad558e8", "score": "0.5033298", "text": "func New(c remoteapprovalapi.Config) *ApprovalSystemAPI {\n\n\treturn &ApprovalSystemAPI{\n\t\tc: c,\n\t}\n\n}", "title": "" }, { "docid": "34e273740136d091a7b98a694e713ff1", "score": "0.5032459", "text": "func NewProvisioningSystem()(*ProvisioningSystem) {\n m := &ProvisioningSystem{\n Identity: *NewIdentity(),\n }\n odataTypeValue := \"#microsoft.graph.provisioningSystem\";\n m.SetOdataType(&odataTypeValue);\n return m\n}", "title": "" }, { "docid": "617ccdc4233e431e665e812de0b006f4", "score": "0.4995189", "text": "func NewLifecycleSys() *LifecycleSys {\n\treturn &LifecycleSys{}\n}", "title": "" }, { "docid": "6d0c3db87cc3b3b4af374190bbe095c8", "score": "0.49868095", "text": "func newAwsIamUserPolicies(c *TrussleV1Client, namespace string) *awsIamUserPolicies {\n\treturn &awsIamUserPolicies{\n\t\tclient: c.RESTClient(),\n\t\tns: namespace,\n\t}\n}", "title": "" }, { "docid": "d50aec35404a9b8b31ebf605f6c19a82", "score": "0.49844605", "text": "func New(auth *auth.Module, c *Config) (Driver, error) {\n\n\tswitch c.DriverType {\n\tcase TypeIstio:\n\t\treturn NewIstioDriver(auth, c)\n\tdefault:\n\t\treturn nil, fmt.Errorf(\"invalid driver type (%s) provided\", c.DriverType)\n\t}\n}", "title": "" }, { "docid": "1d1beaaeb428ba0c73fd8dfdeba088f6", "score": "0.49622333", "text": "func NewSystemControl(ctx context.Context) Control {\n\tconn, err := dbus.New()\n\tif err != nil {\n\t\tpanic(fmt.Sprintf(\"Unable to obtain dbus connection because %+v\", err))\n\t}\n\n\treturn Control{\n\t\tDaemonSupport: utils.NewDaemonSupport(ctx, \"system-control\"),\n\t\tunderlying: conn,\n\t}\n}", "title": "" }, { "docid": "d2c7aee38c5b19af8df7f0f91b549b1d", "score": "0.493404", "text": "func NewSystemClient(c config) *SystemClient {\n\treturn &SystemClient{config: c}\n}", "title": "" }, { "docid": "c834802a7e3e78a69203c1cada32efa4", "score": "0.49283364", "text": "func New(build, version string) *AISCLI {\n\taisCLI := AISCLI{\n\t\tapp: cli.NewApp(),\n\t\toutWriter: os.Stdout,\n\t\terrWriter: os.Stderr,\n\t\tlongRunParams: defaultLongRunParams(),\n\t}\n\taisCLI.init(build, version)\n\treturn &aisCLI\n}", "title": "" }, { "docid": "89934af766068f544031c5159a0b6d60", "score": "0.48429185", "text": "func (m *MapSystem) New(w *ecs.World, g *graphic.GraphicsFactory, scriptpath string) {\n\tlog.Println(\"MapSystem was added to the Scene\")\n\tm.World = w\n\tm.GraphicFactory = g\n\tm.MouseTracker.BasicEntity = ecs.NewBasic()\n\tm.MouseTracker.MouseComponent = common.MouseComponent{Track: true}\n\tm.scriptpath = scriptpath\n\tm.cycleLimit = 3000\n\ttmpscript, err := ioutil.ReadFile(m.scriptpath)\n\tif err != nil {\n\t\tlog.Fatalf(\"Define error: %v\\n\", err)\n\t}\n\tm.script = string(tmpscript)\n\tm.vmEnv = vm.NewEnv()\n\terr = m.vmEnv.Define(\"println\", fmt.Println)\n\terr = m.vmEnv.Define(\"returnFormat\", m.returnFormat)\n\tif err != nil {\n\t\tlog.Fatalf(\"Define error: %v\\n\", err)\n\t}\n\tm.Build(0, 0)\n\tfor _, system := range w.Systems() {\n\t\tswitch sys := system.(type) {\n\t\tcase *common.MouseSystem:\n\t\t\tsys.Add(&m.MouseTracker.BasicEntity, &m.MouseTracker.MouseComponent, nil, nil)\n\t\t}\n\t}\n}", "title": "" }, { "docid": "dcb14d8a839c920ea98fbf2181e4c5cc", "score": "0.48395383", "text": "func (t *SrlNokiaNetworkInstance_NetworkInstance_Protocols_Isis_Instance_Hostnames) NewSystemId(HostSystemId string) (*SrlNokiaNetworkInstance_NetworkInstance_Protocols_Isis_Instance_Hostnames_SystemId, error){\n\n\t// Initialise the list within the receiver struct if it has not already been\n\t// created.\n\tif t.SystemId == nil {\n\t\tt.SystemId = make(map[string]*SrlNokiaNetworkInstance_NetworkInstance_Protocols_Isis_Instance_Hostnames_SystemId)\n\t}\n\n\tkey := HostSystemId\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.SystemId[key]; ok {\n\t\treturn nil, fmt.Errorf(\"duplicate key %v for list SystemId\", key)\n\t}\n\n\tt.SystemId[key] = &SrlNokiaNetworkInstance_NetworkInstance_Protocols_Isis_Instance_Hostnames_SystemId{\n\t\tHostSystemId: &HostSystemId,\n\t}\n\n\treturn t.SystemId[key], nil\n}", "title": "" }, { "docid": "0fe394782ee1e26c26f9209daf5cb8dc", "score": "0.48281088", "text": "func NewSystemUseCase(datastore models.UserDatastore, client pb.TwProxyServiceClient, conf *config.Config, emailSender models.EmailSender) *SystemUseCase {\n\treturn &SystemUseCase{\n\t\tUserDatastore: datastore,\n\t\tRpcClient: client,\n\t\tConf: conf,\n\t\tEmailSender: emailSender}\n}", "title": "" }, { "docid": "8ca968b4905f8fc1299a1cd1d30ed251", "score": "0.48257476", "text": "func (sys Sys) Sys() *SysResource {\n\treturn &sys.sys\n}", "title": "" }, { "docid": "66502b44955f3ea3e306085e375636d3", "score": "0.4813693", "text": "func NewSystemResourceControl(resourceIdentifier string, resourceType portainer.ResourceControlType) *portainer.ResourceControl {\n\treturn &portainer.ResourceControl{\n\t\tType: resourceType,\n\t\tResourceID: resourceIdentifier,\n\t\tSubResourceIDs: []string{},\n\t\tUserAccesses: []portainer.UserResourceAccess{},\n\t\tTeamAccesses: []portainer.TeamResourceAccess{},\n\t\tAdministratorsOnly: false,\n\t\tPublic: true,\n\t\tSystem: true,\n\t}\n}", "title": "" }, { "docid": "ea5d98e319c7ed5704e7e8faab2a03ab", "score": "0.4813354", "text": "func NewGSI(name string, schema []*SDK.KeySchemaElement, tp *SDK.ProvisionedThroughput, projection ...string) *SDK.GlobalSecondaryIndex {\n\tgsi := &SDK.GlobalSecondaryIndex{\n\t\tIndexName: &name,\n\t\tKeySchema: schema,\n\t\tProvisionedThroughput: tp,\n\t}\n\n\tvar proj string\n\tif len(projection) > 0 {\n\t\tproj = projection[0]\n\t} else {\n\t\tproj = ProjectionTypeAll\n\t}\n\tgsi.Projection = &SDK.Projection{ProjectionType: &proj}\n\treturn gsi\n}", "title": "" }, { "docid": "c0eb33e872e9d0b3b2ef8df28c266365", "score": "0.4811251", "text": "func NewSysLogLevel(logLevelStr string) zap.AtomicLevel {\n\n\tvar (\n\t\terrOnce error\n\t)\n\n\tlogLevel := zap.NewAtomicLevel()\n\tif errOnce = logLevel.UnmarshalText([]byte(logLevelStr)); errOnce != nil {\n\t\tlogLevel.UnmarshalText([]byte(\"debug\"))\n\t}\n\n\treturn logLevel\n}", "title": "" }, { "docid": "cdab087b5f39043161416c8b8e8eb9cf", "score": "0.48011136", "text": "func (t *SrlNokiaSystem_System_Logging_Console) NewSubsystem(SubsystemName E_SrlNokiaLogging_SubsystemNameType) (*SrlNokiaSystem_System_Logging_Console_Subsystem, error){\n\n\t// Initialise the list within the receiver struct if it has not already been\n\t// created.\n\tif t.Subsystem == nil {\n\t\tt.Subsystem = make(map[E_SrlNokiaLogging_SubsystemNameType]*SrlNokiaSystem_System_Logging_Console_Subsystem)\n\t}\n\n\tkey := SubsystemName\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.Subsystem[key]; ok {\n\t\treturn nil, fmt.Errorf(\"duplicate key %v for list Subsystem\", key)\n\t}\n\n\tt.Subsystem[key] = &SrlNokiaSystem_System_Logging_Console_Subsystem{\n\t\tSubsystemName: SubsystemName,\n\t}\n\n\treturn t.Subsystem[key], nil\n}", "title": "" }, { "docid": "f1d4adae20227c5b785a3bca26e75532", "score": "0.47953478", "text": "func newAdSystemDomain(domain string, id int) *adSystemDomain {\n\treturn &adSystemDomain{Domain: domain, ID: id}\n}", "title": "" }, { "docid": "63cc403a59c8dcb2904e1f9991f8e662", "score": "0.47933796", "text": "func New() Interface {\n\treturn &systemd{}\n}", "title": "" }, { "docid": "ffb7caae9ba097dbefeb49a034e20c3f", "score": "0.4773968", "text": "func NewIAMStrategy(ctx context.Context, sm *gcpjwt.SigningMethodIAM, config *gcpjwt.IAMConfig) *IAMStrategy {\n\tsm.Override()\n\n\treturn &IAMStrategy{\n\t\tsigningMethod: sm,\n\t\tconfig: config,\n\t\tgcpStrategy: &gcpStrategy{\n\t\t\tsigningMethod: sm,\n\t\t\tkeyFunc: func(ctx context.Context) jwt.Keyfunc {\n\t\t\t\treturn gcpjwt.IAMVerfiyKeyfunc(ctx, config)\n\t\t\t},\n\t\t\tsignKey: func(ctx context.Context) interface{} {\n\t\t\t\treturn gcpjwt.NewIAMContext(ctx, config)\n\t\t\t},\n\t\t\thasher: crypto.SHA256,\n\t\t},\n\t}\n}", "title": "" }, { "docid": "8f584df0a8e11351f7320b4840a2d62e", "score": "0.47648498", "text": "func NewAPIGatewayIAM(system string, appCode, appSecret, bkAPIGatewayURL string) *IAM {\n\tapigatewayClient := client.NewIAMBackendClient(bkAPIGatewayURL, true, system, appCode, appSecret)\n\n\treturn &IAM{\n\t\tappCode: appCode,\n\t\tappSecret: appSecret,\n\n\t\tclient: apigatewayClient,\n\t\tesbClient: nil,\n\t}\n}", "title": "" }, { "docid": "342918ae5bd763f1996a5e8e5cabc44a", "score": "0.47607636", "text": "func NewIAMPolicy(properties IAMPolicyProperties, deps ...interface{}) IAMPolicy {\n\treturn IAMPolicy{\n\t\tType: \"AWS::IAM::Policy\",\n\t\tProperties: properties,\n\t\tDependsOn: deps,\n\t}\n}", "title": "" }, { "docid": "bb436aa23943de42727057099796608c", "score": "0.4742149", "text": "func NewBucketQuotaSys() *BucketQuotaSys {\n\treturn &BucketQuotaSys{}\n}", "title": "" }, { "docid": "c608bb62d5388de4a3272acd140c1f1d", "score": "0.47276562", "text": "func NewBoltdbSubsys(config boltdb.Config) (*inventory.GeneralSubsys, error) {\n\tclient, err := boltdb.NewClientFromConfig(config)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tsubsys := inventory.NewGeneralSubsys(client)\n\n\t// restore any previously added hosts\n\tassets, err := client.GetAllAssets()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tassets1 := assets.([]boltdb.Asset)\n\tfor _, asset := range assets1 {\n\t\ta := inventory.NewAssetWithState(client, asset.Name, inventory.AssetStatusVals[asset.Status],\n\t\t\tinventory.AssetStateVals[asset.State])\n\t\tif err := subsys.RestoreAsset(asset.Name, a); err != nil {\n\t\t\tlogrus.Infof(\"failed to restore asset %q. Error: %v\", asset.Name, err)\n\t\t\tcontinue\n\t\t}\n\t}\n\n\treturn subsys, nil\n}", "title": "" }, { "docid": "f5ff1af300507427c74d7daf76bb09f8", "score": "0.46863604", "text": "func New(parentCtx context.Context, name string, lakeHostname string) System {\n\tctx, cancel := context.WithCancel(parentCtx)\n\n\tif lakeHostname == \"\" {\n\t\tpanic(fmt.Errorf(\"invalid lake hostname\").Error())\n\t}\n\tif name == \"\" || name == \"[\" {\n\t\tpanic(fmt.Errorf(\"invalid system name\").Error())\n\t}\n\n\treturn System{\n\t\tName: name,\n\t\tctx: ctx,\n\t\tcancel: cancel,\n\t\tdone: make(chan interface{}),\n\t\tIsReady: make(chan interface{}),\n\t\tCanStart: make(chan interface{}),\n\t\tactors: &actorsMap{\n\t\t\tunderlying: make(map[string]*Actor),\n\t\t},\n\t\thost: lakeHostname,\n\t\tonMessage: func(msg string, to Coordinates, from Coordinates) {},\n\t\tpublish: make(chan string),\n\t\treceive: make(chan string),\n\t}\n}", "title": "" }, { "docid": "7574670964e75a5c8da6ca80d67fa16a", "score": "0.46845213", "text": "func (cfg *Config) New() (*Instance, error) {\n\tglobalContext := cfg.ctx\n\tif globalContext == nil {\n\t\tglobalContext = context.Background()\n\t}\n\n\tpolicies, err := policy.New(policy.FileConfig(filepath.Join(cfg.dir, defPoliciesFile)))\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"initialiaze policies: %w\", err)\n\t}\n\n\tbasePlatform, err := platform.New(filepath.Join(cfg.dir, defProjectFile))\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"initialize base platform: %w\", err)\n\t}\n\n\tqueueFactory := func(name string) (queue.Queue, error) {\n\t\treturn indir.New(filepath.Join(cfg.dir, defQueuesDir, name))\n\t}\n\n\tctx, cancel := context.WithCancel(globalContext)\n\n\tqueueManager, err := queuemanager.New(ctx, queuemanager.FileConfig(filepath.Join(cfg.dir, defQueuesFile)), basePlatform, queueFactory)\n\tif err != nil {\n\t\tcancel()\n\t\treturn nil, fmt.Errorf(\"initialize queues: %w\", err)\n\t}\n\n\tuseCases, err := cases.New(basePlatform, queueManager, policies, cfg.dir, filepath.Join(cfg.dir, defTemplatesDir))\n\tif err != nil {\n\t\tcancel()\n\t\treturn nil, fmt.Errorf(\"initialize use-cases: %w\", err)\n\t}\n\n\tif cfg.ssh {\n\t\terr = useCases.SetOrCreatePrivateSSHKeyFile(filepath.Join(cfg.dir, defSshKey))\n\t\tif err != nil {\n\t\t\tcancel()\n\t\t\treturn nil, fmt.Errorf(\"initialize SSH key: %w\", err)\n\t\t}\n\t}\n\n\ttracker, err := memlog.NewDumped(filepath.Join(cfg.dir, defStatsFile), cfg.statsDepth)\n\tif err != nil {\n\t\tcancel()\n\t\treturn nil, fmt.Errorf(\"initalize stats: %w\", err)\n\t}\n\n\tprojectApi := services.NewProjectSrv(useCases, tracker)\n\tlambdaApi := services.NewLambdaSrv(useCases, tracker)\n\tqueuesApi := services.NewQueuesSrv(queueManager)\n\tpoliciesApi := services.NewPoliciesSrv(policies)\n\tuserApi, err := services.CreateUserSrv(filepath.Join(cfg.dir, defServerFile), cfg.password)\n\tif err != nil {\n\t\tcancel()\n\t\treturn nil, fmt.Errorf(\"initialize admin API (user): %w\", err)\n\t}\n\tvar wg sync.WaitGroup\n\twg.Add(1)\n\tgo func() {\n\t\tdefer wg.Done()\n\t\tdumpTracker(ctx, cfg.dumpInterval, tracker)\n\t}()\n\n\twg.Add(1)\n\tgo func() {\n\t\tdefer wg.Done()\n\t\trunScheduler(ctx, cfg.schedulerInterval, useCases)\n\t}()\n\n\tdone := make(chan struct{})\n\tgo func() {\n\t\twg.Wait()\n\t\tclose(done)\n\t}()\n\n\tsrv := &server.Server{\n\t\tPolicies: policies,\n\t\tPlatform: basePlatform,\n\t\tCases: useCases,\n\t\tQueues: queueManager,\n\t\tTracker: tracker,\n\t\tTokenHandler: userApi,\n\t\tProjectAPI: projectApi,\n\t\tLambdaAPI: lambdaApi,\n\t\tUserAPI: userApi,\n\t\tQueuesAPI: queuesApi,\n\t\tPoliciesAPI: policiesApi,\n\t}\n\treturn &Instance{\n\t\tLocation: cfg.dir,\n\t\tserver: srv,\n\t\tctx: ctx,\n\t\tdone: done,\n\t\tcancel: cancel,\n\t}, nil\n}", "title": "" }, { "docid": "ab4cc228319b093a2679787fd4addc30", "score": "0.46797124", "text": "func NewInfra(resources []MappedResource) (Infra, error) {\n\treturn NewInfraWithTracer(resources, nil)\n}", "title": "" }, { "docid": "5e478efbf22448a034cd7dca575c0036", "score": "0.4675577", "text": "func NewGenProcSys(f GenProcFunc) GenProc {\n\tgps := &GenProcSys{}\n\tgps.genProc = f\n\n\treturn gps\n}", "title": "" }, { "docid": "3ba6325d11425995103edaed5c05d61f", "score": "0.46616754", "text": "func NewSecurityTrails(sys System) *SecurityTrails {\n\tst := &SecurityTrails{SourceType: requests.API}\n\n\tst.BaseService = *NewBaseService(st, \"SecurityTrails\", sys)\n\treturn st\n}", "title": "" }, { "docid": "bcac30e01f1b1640bf64f46fe44dc16d", "score": "0.46457222", "text": "func (c *FakeIoTInfrastructures) Create(ioTInfrastructure *iotv1.IoTInfrastructure) (result *iotv1.IoTInfrastructure, err error) {\n\tobj, err := c.Fake.\n\t\tInvokes(testing.NewCreateAction(iotinfrastructuresResource, c.ns, ioTInfrastructure), &iotv1.IoTInfrastructure{})\n\n\tif obj == nil {\n\t\treturn nil, err\n\t}\n\treturn obj.(*iotv1.IoTInfrastructure), err\n}", "title": "" }, { "docid": "51eab9a8470cb9216a89cf1990058910", "score": "0.46426654", "text": "func InitSysState() {\n\n\tLocalID, _ = locIP.LocalID()\n\n\t_, localSysExists := systems[LocalID]\n\n\tif !localSysExists {\n\t\tnewElevState := et.ElevState{ID: LocalID, E: et.EmptyElevator(), StartupTime: time.Now().Unix()}\n\n\t\tsystems[LocalID] = newElevState\n\t}\n\n\tinitialized = true\n\tlog.WithField(\"localID\", LocalID).Info(\"sysstate: Initialized\")\n\n}", "title": "" }, { "docid": "a8e0a864a4d27ea63948ed2e0d26a659", "score": "0.4625756", "text": "func NewSecurity() *Security {\n\tr := &Security{\n\t\tRealms: make(map[string]XpackRealm, 0),\n\t\tRoleMapping: make(map[string]XpackRoleMapping, 0),\n\t}\n\n\treturn r\n}", "title": "" }, { "docid": "c66fdc1d5cc5a36a3db208521a885190", "score": "0.46146855", "text": "func (ed *embeddedDirInfo) Sys() interface{} {\n\treturn nil\n}", "title": "" }, { "docid": "c030486eb9a432b820179f2a8df02ccd", "score": "0.46139824", "text": "func NewSystem() *System {\n\tsystem := &System{\n\t\tDone: make(chan bool),\n\t}\n\tif *sampleInterval > 0 {\n\t\tsystem.Ticker = time.NewTicker(*sampleInterval)\n\t} else {\n\t\tsystem.Ticker = time.NewTicker(time.Second)\n\t\tsystem.Ticker.Stop()\n\t}\n\treturn system\n}", "title": "" }, { "docid": "2290f3f4eac089e5ed5acf6c6c6cce17", "score": "0.46134332", "text": "func NewIosDeviceType()(*IosDeviceType) {\n m := &IosDeviceType{\n }\n m.backingStore = ie8677ce2c7e1b4c22e9c3827ecd078d41185424dd9eeb92b7d971ed2d49a392e.BackingStoreFactoryInstance();\n m.SetAdditionalData(make(map[string]any))\n return m\n}", "title": "" }, { "docid": "9dcb8db1646280753c54c3d419937c64", "score": "0.45671308", "text": "func NewACL(management bool, policies []*Policy) (*ACL, error) {\n\t// Hot-path management tokens\n\tif management {\n\t\treturn &ACL{management: true}, nil\n\t}\n\n\t// Create the ACL object\n\tacl := &ACL{}\n\tnsTxn := iradix.New().Txn()\n\n\tfor _, policy := range policies {\n\tNAMESPACES:\n\t\tfor _, ns := range policy.Namespaces {\n\t\t\t// Check for existing capabilities\n\t\t\tvar capabilities capabilitySet\n\t\t\traw, ok := nsTxn.Get([]byte(ns.Name))\n\t\t\tif ok {\n\t\t\t\tcapabilities = raw.(capabilitySet)\n\t\t\t} else {\n\t\t\t\tcapabilities = make(capabilitySet)\n\t\t\t\tnsTxn.Insert([]byte(ns.Name), capabilities)\n\t\t\t}\n\n\t\t\t// Deny always takes precedence\n\t\t\tif capabilities.Check(NamespaceCapabilityDeny) {\n\t\t\t\tcontinue NAMESPACES\n\t\t\t}\n\n\t\t\t// Add in all the capabilities\n\t\t\tfor _, cap := range ns.Capabilities {\n\t\t\t\tif cap == NamespaceCapabilityDeny {\n\t\t\t\t\t// Overwrite any existing capabilities\n\t\t\t\t\tcapabilities.Clear()\n\t\t\t\t\tcapabilities.Set(NamespaceCapabilityDeny)\n\t\t\t\t\tcontinue NAMESPACES\n\t\t\t\t}\n\t\t\t\tcapabilities.Set(cap)\n\t\t\t}\n\t\t}\n\n\t\t// Take the maximum privilege for agent, node, and operator\n\t\tif policy.Agent != nil {\n\t\t\tacl.agent = maxPrivilege(acl.agent, policy.Agent.Policy)\n\t\t}\n\t\tif policy.Node != nil {\n\t\t\tacl.node = maxPrivilege(acl.node, policy.Node.Policy)\n\t\t}\n\t\tif policy.Operator != nil {\n\t\t\tacl.operator = maxPrivilege(acl.operator, policy.Operator.Policy)\n\t\t}\n\t\tif policy.Quota != nil {\n\t\t\tacl.quota = maxPrivilege(acl.quota, policy.Quota.Policy)\n\t\t}\n\t}\n\n\t// Finalize the namespaces\n\tacl.namespaces = nsTxn.Commit()\n\treturn acl, nil\n}", "title": "" }, { "docid": "1b0810bcaaf09145ea714216667dc307", "score": "0.4564584", "text": "func New(ctx context.Context) (*Server, error) {\n\tfmt.Println(\"Loading config...\")\n\tcfg, err := config.Load(ctx)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tfmt.Println(\"Loading SAML config...\")\n\tsp, err := newSAMLMiddleware(cfg)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\ts := &Server{\n\t\tconfig: cfg,\n\t\tdone: make(chan struct{}),\n\t\tsaml: sp,\n\t}\n\n\tfmt.Println(\"Preparing session store...\")\n\trelaystate, sessions, err := s.openDynamoStores(cfg)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\ts.addSCS(relaystate, sessions)\n\n\tfmt.Println(\"Configuring routes...\")\n\ts.addRoutes()\n\treturn s, nil\n}", "title": "" }, { "docid": "07dbd0c07c95cd72eab1ba9d8dbd3048", "score": "0.4561933", "text": "func NewAWS(cfg *AWSConfig) (*AWS, error) {\n\ts3Svc, err := s3Svc(cfg)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn &AWS{s3Svc.Bucket(cfg.Bucket), dynamo(cfg), cfg}, nil\n}", "title": "" }, { "docid": "be65e3af88698c60b40f61e59132de7b", "score": "0.45581713", "text": "func (s S3ObjectInfo) Sys() interface{} {\n\treturn nil\n}", "title": "" }, { "docid": "d5d34b524d6e9c9108f38655c65e6edc", "score": "0.4550636", "text": "func NewSilo(config *Config) (*Silo, error) {\n\tkey, err := toKey(config.Misc.EncryptionKey)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\t// In future we'll switch here based on the storage driver, but for now there is only one\n\tsConn, err := newFilesystemStorge(config.Store)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn &Silo{\n\t\tconf: config,\n\t\tstore: sConn,\n\t\tkey: key,\n\t}, nil\n}", "title": "" }, { "docid": "30f6e8cc3ebbb96d29edac6647f36184", "score": "0.45499188", "text": "func New(m map[string]interface{}) (auth.Manager, error) {\n\tc, err := parseConfig(m)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tc.init()\n\n\treturn &mgr{c: c}, nil\n}", "title": "" }, { "docid": "b2175044e40daf83da5092f33c2c47d1", "score": "0.45493606", "text": "func NewScriptSystem(errors *ScriptErrors) *ScriptSystem {\n\tvar scriptSystem ScriptSystem\n\n\tscriptSystem.state = lua.NewState()\n\tscriptSystem.errors = errors\n\n\treturn &scriptSystem\n}", "title": "" }, { "docid": "215a9759f55e9726351fce2ff11bcf56", "score": "0.4537863", "text": "func (c *SystemClient) Create() *SystemCreate {\n\tmutation := newSystemMutation(c.config, OpCreate)\n\treturn &SystemCreate{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "title": "" }, { "docid": "8d8904f76d77b1de73a6b8dd73aeb6f5", "score": "0.4536864", "text": "func Create() *Module {\n\tif globalIstioModule != nil {\n\t\treturn globalIstioModule\n\t}\n\n\tmodule := Module{\n\t\tExists: false,\n\t\tProfile: DefaultProfile,\n\t\tModule: module.DeploymentToolsModule{\n\t\t\tName: \"Istio\",\n\t\t\tWindowsExecutableName: \"istioctl.exe\",\n\t\t\tLinuxExecutableName: \"istioctl\",\n\t\t\tExecPath: \"bin\",\n\t\t\tDownload: Download,\n\t\t\tGetLocalVersion: GetLocalVersion,\n\t\t\tGetOnlineVersions: GetOnlineVersions,\n\t\t\tProcess: Processor,\n\t\t\tPostInstall: PostInstall,\n\t\t},\n\t}\n\n\t// module.SetDependencies()\n\tmodule.Module.GetLatestCachedVersion()\n\n\tglobalIstioModule = &module\n\treturn globalIstioModule\n}", "title": "" }, { "docid": "fb7ceb07311b290fb0673eace91ae774", "score": "0.45253906", "text": "func (d *s3ObjectInfo) Sys() interface{} {\n\treturn nil\n}", "title": "" }, { "docid": "0f9a06d812f5ed470ba2d89a6eebc861", "score": "0.4520816", "text": "func New(ctx context.Context, id string) (string, error) {\n\tif sysSession == nil {\n\t\treturn \"\", errors.New(\"please init the session driver first\")\n\t}\n\n\treturn sysSession.New(ctx, id)\n}", "title": "" }, { "docid": "d77a8808e8d4953ad73a785e2ad85b30", "score": "0.45060882", "text": "func NewIO(id string, withStdin bool) *IO {\n\ts := streams.NewStream()\n\tif withStdin {\n\t\ts.NewStdinInput()\n\t} else {\n\t\ts.NewDiscardStdinInput()\n\t}\n\n\treturn &IO{\n\t\tid: id,\n\t\tuseStdin: withStdin,\n\t\tstream: s,\n\t}\n}", "title": "" }, { "docid": "d69aa2127a02e89d5c2a02319843086b", "score": "0.449922", "text": "func (i *RootInfo) Sys() interface{} { return nil }", "title": "" }, { "docid": "29f017894111ff9bb512c4df3064284c", "score": "0.44744706", "text": "func new(m map[string]interface{}) (*manager, error) {\n\tmgr := &manager{}\n\terr := mgr.Configure(m)\n\tif err != nil {\n\t\terr = errors.Wrap(err, \"error creating a new auth manager\")\n\t\treturn nil, err\n\t}\n\n\tmgr.db, err = accounts.New(\"unused\", nil, false, false, false)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn mgr, nil\n}", "title": "" }, { "docid": "b431a63771dd44213a6734933fc40c8d", "score": "0.44673404", "text": "func SysInit(app *ecomapp.Application) error {\n\tcms := &CMS{\n\t\tApp: app,\n\t\tMessage: \"Welcome to the CMS plugin\",\n\t}\n\tcms.SysInit(app)\n\n\tcmsList = append(cmsList, *cms)\n\n\treturn nil\n}", "title": "" }, { "docid": "ee4af3fb940c292bb8750a82ba620dd0", "score": "0.44551983", "text": "func (t *SrlNokiaSystem_System_Logging_File) NewSubsystem(SubsystemName E_SrlNokiaLogging_SubsystemNameType) (*SrlNokiaSystem_System_Logging_File_Subsystem, error){\n\n\t// Initialise the list within the receiver struct if it has not already been\n\t// created.\n\tif t.Subsystem == nil {\n\t\tt.Subsystem = make(map[E_SrlNokiaLogging_SubsystemNameType]*SrlNokiaSystem_System_Logging_File_Subsystem)\n\t}\n\n\tkey := SubsystemName\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.Subsystem[key]; ok {\n\t\treturn nil, fmt.Errorf(\"duplicate key %v for list Subsystem\", key)\n\t}\n\n\tt.Subsystem[key] = &SrlNokiaSystem_System_Logging_File_Subsystem{\n\t\tSubsystemName: SubsystemName,\n\t}\n\n\treturn t.Subsystem[key], nil\n}", "title": "" }, { "docid": "73bbde1eb24680740fe1e3f51576b990", "score": "0.4451314", "text": "func (c completedConfig) New(delegationTarget genericapiserver.DelegationTarget) (*SecurityAPIServer, error) {\n\tgenericServer, err := c.GenericConfig.New(\"security.openshift.io-apiserver\", delegationTarget)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\ts := &SecurityAPIServer{\n\t\tGenericAPIServer: genericServer,\n\t}\n\n\tv1Storage, err := c.V1RESTStorage()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tapiGroupInfo := genericapiserver.NewDefaultAPIGroupInfo(securityapiv1.GroupName, c.ExtraConfig.Scheme, metav1.ParameterCodec, c.ExtraConfig.Codecs)\n\tapiGroupInfo.VersionedResourcesStorageMap[securityapiv1.SchemeGroupVersion.Version] = v1Storage\n\tif err := s.GenericAPIServer.InstallAPIGroup(&apiGroupInfo); err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn s, nil\n}", "title": "" }, { "docid": "e4476720b746a8eaffc1c9b562684e57", "score": "0.44500592", "text": "func StorageSystemFromStruct(cfg *config.Config) map[string]interface{} {\n\trcfg := map[string]interface{}{\n\t\t\"shared\": map[string]interface{}{\n\t\t\t\"jwt_secret\": cfg.TokenManager.JWTSecret,\n\t\t\t\"gatewaysvc\": cfg.Reva.Address,\n\t\t\t\"skip_user_groups_in_token\": cfg.SkipUserGroupsInToken,\n\t\t\t\"grpc_client_options\": cfg.Reva.GetGRPCClientConfig(),\n\t\t},\n\t\t\"grpc\": map[string]interface{}{\n\t\t\t\"network\": cfg.GRPC.Protocol,\n\t\t\t\"address\": cfg.GRPC.Addr,\n\t\t\t\"tls_settings\": map[string]interface{}{\n\t\t\t\t\"enabled\": cfg.GRPC.TLS.Enabled,\n\t\t\t\t\"certificate\": cfg.GRPC.TLS.Cert,\n\t\t\t\t\"key\": cfg.GRPC.TLS.Key,\n\t\t\t},\n\t\t\t\"services\": map[string]interface{}{\n\t\t\t\t\"gateway\": map[string]interface{}{\n\t\t\t\t\t// registries are located on the gateway\n\t\t\t\t\t\"authregistrysvc\": \"com.owncloud.api.storage-system\",\n\t\t\t\t\t\"storageregistrysvc\": \"com.owncloud.api.storage-system\",\n\t\t\t\t\t// user metadata is located on the users services\n\t\t\t\t\t\"userprovidersvc\": \"com.owncloud.api.storage-system\",\n\t\t\t\t\t\"groupprovidersvc\": \"com.owncloud.api.storage-system\",\n\t\t\t\t\t\"permissionssvc\": \"com.owncloud.api.storage-system\",\n\t\t\t\t\t// other\n\t\t\t\t\t\"disable_home_creation_on_login\": true, // metadata manually creates a space\n\t\t\t\t\t// metadata always uses the simple upload, so no transfer secret or datagateway needed\n\t\t\t\t\t\"cache_store\": \"noop\",\n\t\t\t\t\t\"cache_database\": \"system\",\n\t\t\t\t},\n\t\t\t\t\"userprovider\": map[string]interface{}{\n\t\t\t\t\t\"driver\": \"memory\",\n\t\t\t\t\t\"drivers\": map[string]interface{}{\n\t\t\t\t\t\t\"memory\": map[string]interface{}{\n\t\t\t\t\t\t\t\"users\": map[string]interface{}{\n\t\t\t\t\t\t\t\t\"serviceuser\": map[string]interface{}{\n\t\t\t\t\t\t\t\t\t\"id\": map[string]interface{}{\n\t\t\t\t\t\t\t\t\t\t\"opaqueId\": cfg.SystemUserID,\n\t\t\t\t\t\t\t\t\t\t\"idp\": \"internal\",\n\t\t\t\t\t\t\t\t\t\t\"type\": userpb.UserType_USER_TYPE_PRIMARY,\n\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\"username\": \"serviceuser\",\n\t\t\t\t\t\t\t\t\t\"display_name\": \"System User\",\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t},\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t\t\"authregistry\": map[string]interface{}{\n\t\t\t\t\t\"driver\": \"static\",\n\t\t\t\t\t\"drivers\": map[string]interface{}{\n\t\t\t\t\t\t\"static\": map[string]interface{}{\n\t\t\t\t\t\t\t\"rules\": map[string]interface{}{\n\t\t\t\t\t\t\t\t\"machine\": \"com.owncloud.api.storage-system\",\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\t\"authprovider\": map[string]interface{}{\n\t\t\t\t\t\"auth_manager\": \"machine\",\n\t\t\t\t\t\"auth_managers\": map[string]interface{}{\n\t\t\t\t\t\t\"machine\": map[string]interface{}{\n\t\t\t\t\t\t\t\"api_key\": cfg.SystemUserAPIKey,\n\t\t\t\t\t\t\t\"gateway_addr\": \"com.owncloud.api.storage-system\",\n\t\t\t\t\t\t},\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t\t\"permissions\": map[string]interface{}{\n\t\t\t\t\t\"driver\": \"demo\",\n\t\t\t\t\t\"drivers\": map[string]interface{}{\n\t\t\t\t\t\t\"demo\": map[string]interface{}{},\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t\t\"storageregistry\": map[string]interface{}{\n\t\t\t\t\t\"driver\": \"static\",\n\t\t\t\t\t\"drivers\": map[string]interface{}{\n\t\t\t\t\t\t\"static\": map[string]interface{}{\n\t\t\t\t\t\t\t\"rules\": map[string]interface{}{\n\t\t\t\t\t\t\t\t\"/\": map[string]interface{}{\n\t\t\t\t\t\t\t\t\t\"address\": \"com.owncloud.api.storage-system\",\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t},\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t\t\"storageprovider\": map[string]interface{}{\n\t\t\t\t\t\"driver\": cfg.Driver,\n\t\t\t\t\t\"drivers\": metadataDrivers(cfg),\n\t\t\t\t\t\"data_server_url\": cfg.DataServerURL,\n\t\t\t\t},\n\t\t\t},\n\t\t\t\"interceptors\": map[string]interface{}{\n\t\t\t\t\"prometheus\": map[string]interface{}{\n\t\t\t\t\t\"namespace\": \"ocis\",\n\t\t\t\t\t\"subsystem\": \"storage_system\",\n\t\t\t\t},\n\t\t\t},\n\t\t},\n\t\t\"http\": map[string]interface{}{\n\t\t\t\"network\": cfg.HTTP.Protocol,\n\t\t\t\"address\": cfg.HTTP.Addr,\n\t\t\t// no datagateway needed as the metadata clients directly talk to the dataprovider with the simple protocol\n\t\t\t\"services\": map[string]interface{}{\n\t\t\t\t\"dataprovider\": map[string]interface{}{\n\t\t\t\t\t\"prefix\": \"data\",\n\t\t\t\t\t\"driver\": cfg.Driver,\n\t\t\t\t\t\"drivers\": metadataDrivers(cfg),\n\t\t\t\t\t\"data_txs\": map[string]interface{}{\n\t\t\t\t\t\t\"simple\": map[string]interface{}{\n\t\t\t\t\t\t\t\"cache_store\": \"noop\",\n\t\t\t\t\t\t\t\"cache_database\": \"system\",\n\t\t\t\t\t\t\t\"cache_table\": \"stat\",\n\t\t\t\t\t\t},\n\t\t\t\t\t\t\"spaces\": map[string]interface{}{\n\t\t\t\t\t\t\t\"cache_store\": \"noop\",\n\t\t\t\t\t\t\t\"cache_database\": \"system\",\n\t\t\t\t\t\t\t\"cache_table\": \"stat\",\n\t\t\t\t\t\t},\n\t\t\t\t\t\t\"tus\": map[string]interface{}{\n\t\t\t\t\t\t\t\"cache_store\": \"noop\",\n\t\t\t\t\t\t\t\"cache_database\": \"system\",\n\t\t\t\t\t\t\t\"cache_table\": \"stat\",\n\t\t\t\t\t\t},\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t},\n\t\t\t\"middlewares\": map[string]interface{}{\n\t\t\t\t\"prometheus\": map[string]interface{}{\n\t\t\t\t\t\"namespace\": \"ocis\",\n\t\t\t\t\t\"subsystem\": \"storage_system\",\n\t\t\t\t},\n\t\t\t},\n\t\t},\n\t}\n\treturn rcfg\n}", "title": "" }, { "docid": "ef1402ef1b8ba4ac39317d54615aa747", "score": "0.44485006", "text": "func NewSystemAuthConverter(t mockConstructorTestingTNewSystemAuthConverter) *SystemAuthConverter {\n\tmock := &SystemAuthConverter{}\n\tmock.Mock.Test(t)\n\n\tt.Cleanup(func() { mock.AssertExpectations(t) })\n\n\treturn mock\n}", "title": "" }, { "docid": "aff239a2aac416cb9fe9f9c92d2efd5d", "score": "0.44377458", "text": "func newNs(name string) (*namespace, error) {\n\tns := &namespace{\n\t\tname: name,\n\t\tsetMap: make(map[string]string),\n\t\tpodMap: make(map[types.UID]*corev1.Pod),\n\t\tnpMap: make(map[string]*networkingv1.NetworkPolicy),\n\t\ttMgr: vfpm.NewTagManager(),\n\t\trMgr: vfpm.NewRuleManager(),\n\t}\n\n\treturn ns, nil\n}", "title": "" }, { "docid": "955ffcf4d4bb97d50c4267e9861e0183", "score": "0.44322237", "text": "func newAwsSsmActivations(c *TrussleV1Client, namespace string) *awsSsmActivations {\n\treturn &awsSsmActivations{\n\t\tclient: c.RESTClient(),\n\t\tns: namespace,\n\t}\n}", "title": "" }, { "docid": "9e491c797262cf02dfcdff27d3f783c3", "score": "0.44250998", "text": "func New(d *ctl.ControlDefinition) *Cli {\n\tcli := &Cli{\n\t\tCtl: ctl.NewControl(d),\n\t}\n\n\tcli.flags.hsmConfig = d.App.Flag(\"hsm-cfg\", \"HSM provider configuration file\").Required().String()\n\n\treturn cli\n}", "title": "" }, { "docid": "c833262986f1d2c7032e98b652658463", "score": "0.44224265", "text": "func NewSSMAPI(t mockConstructorTestingTNewSSMAPI) *SSMAPI {\n\tmock := &SSMAPI{}\n\tmock.Mock.Test(t)\n\n\tt.Cleanup(func() { mock.AssertExpectations(t) })\n\n\treturn mock\n}", "title": "" }, { "docid": "7d5d68c1c8dd696d8556f22717fdea80", "score": "0.44145602", "text": "func NewIosVpnSecurityAssociationParameters()(*IosVpnSecurityAssociationParameters) {\n m := &IosVpnSecurityAssociationParameters{\n }\n m.backingStore = ie8677ce2c7e1b4c22e9c3827ecd078d41185424dd9eeb92b7d971ed2d49a392e.BackingStoreFactoryInstance();\n m.SetAdditionalData(make(map[string]any))\n return m\n}", "title": "" }, { "docid": "19b15738e3bf150bf20a31d711b6af8a", "score": "0.44076562", "text": "func (sys *IAMSys) NewServiceAccount(ctx context.Context, parentUser string, groups []string, opts newServiceAccountOpts) (auth.Credentials, time.Time, error) {\n\tif !sys.Initialized() {\n\t\treturn auth.Credentials{}, time.Time{}, errServerNotInitialized\n\t}\n\n\tif parentUser == \"\" {\n\t\treturn auth.Credentials{}, time.Time{}, errInvalidArgument\n\t}\n\n\tvar policyBuf []byte\n\tif opts.sessionPolicy != nil {\n\t\terr := opts.sessionPolicy.Validate()\n\t\tif err != nil {\n\t\t\treturn auth.Credentials{}, time.Time{}, err\n\t\t}\n\t\tpolicyBuf, err = json.Marshal(opts.sessionPolicy)\n\t\tif err != nil {\n\t\t\treturn auth.Credentials{}, time.Time{}, err\n\t\t}\n\t\tif len(policyBuf) > 2048 {\n\t\t\treturn auth.Credentials{}, time.Time{}, errSessionPolicyTooLarge\n\t\t}\n\t}\n\n\t// found newly requested service account, to be same as\n\t// parentUser, reject such operations.\n\tif parentUser == opts.accessKey {\n\t\treturn auth.Credentials{}, time.Time{}, errIAMActionNotAllowed\n\t}\n\tif siteReplicatorSvcAcc == opts.accessKey && !opts.allowSiteReplicatorAccount {\n\t\treturn auth.Credentials{}, time.Time{}, errIAMActionNotAllowed\n\t}\n\tm := make(map[string]interface{})\n\tm[parentClaim] = parentUser\n\n\tif len(policyBuf) > 0 {\n\t\tm[iampolicy.SessionPolicyName] = base64.StdEncoding.EncodeToString(policyBuf)\n\t\tm[iamPolicyClaimNameSA()] = embeddedPolicyType\n\t} else {\n\t\tm[iamPolicyClaimNameSA()] = inheritedPolicyType\n\t}\n\n\t// Add all the necessary claims for the service accounts.\n\tfor k, v := range opts.claims {\n\t\t_, ok := m[k]\n\t\tif !ok {\n\t\t\tm[k] = v\n\t\t}\n\t}\n\n\tvar accessKey, secretKey string\n\tvar err error\n\tif len(opts.accessKey) > 0 {\n\t\taccessKey, secretKey = opts.accessKey, opts.secretKey\n\t} else {\n\t\taccessKey, secretKey, err = auth.GenerateCredentials()\n\t\tif err != nil {\n\t\t\treturn auth.Credentials{}, time.Time{}, err\n\t\t}\n\t}\n\tcred, err := auth.CreateNewCredentialsWithMetadata(accessKey, secretKey, m, secretKey)\n\tif err != nil {\n\t\treturn auth.Credentials{}, time.Time{}, err\n\t}\n\tcred.ParentUser = parentUser\n\tcred.Groups = groups\n\tcred.Status = string(auth.AccountOn)\n\tcred.Name = opts.name\n\tcred.Description = opts.description\n\n\tif opts.expiration != nil {\n\t\texpirationInUTC := opts.expiration.UTC()\n\t\tif err := validateSvcExpirationInUTC(expirationInUTC); err != nil {\n\t\t\treturn auth.Credentials{}, time.Time{}, err\n\t\t}\n\t\tcred.Expiration = expirationInUTC\n\t}\n\n\tupdatedAt, err := sys.store.AddServiceAccount(ctx, cred)\n\tif err != nil {\n\t\treturn auth.Credentials{}, time.Time{}, err\n\t}\n\n\tsys.notifyForServiceAccount(ctx, cred.AccessKey)\n\treturn cred, updatedAt, nil\n}", "title": "" }, { "docid": "94b0e694c532030b7d33d62239685db6", "score": "0.4397075", "text": "func NewForConfig(c *rest.Config) (*IamClient, error) {\n\tconfigShallowCopy := *c\n\n\tvar ic IamClient\n\n\tvar err error\n\n\tic.apiV1, err = apiv1.NewForConfig(&configShallowCopy)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tic.authzV1, err = authzv1.NewForConfig(&configShallowCopy)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn &ic, nil\n}", "title": "" }, { "docid": "3095775d84aa69263ea12d9ff528de40", "score": "0.4389016", "text": "func (c *Client) CreateSystemACLPolicy(name string, contents io.Reader) error {\n\tif err := c.checkRequiredAPIVersion(responses.ACLResponse{}); err != nil {\n\t\treturn err\n\t}\n\turl := fmt.Sprintf(\"system/acl/%s.aclpolicy\", name)\n\tres, err := c.httpPost(url, withBody(contents),\n\t\taccept(\"application/json\"),\n\t\tcontentType(\"application/yaml\"),\n\t\trequestExpects(201),\n\t\trequestExpects(400))\n\tif err != nil {\n\t\treturn err\n\t}\n\tjsonError := &responses.FailedACLValidationResponse{}\n\tjsonErr := json.Unmarshal(res, jsonError)\n\tif jsonErr == nil {\n\t\tvar finalErr error\n\t\tfor _, v := range jsonError.Policies {\n\t\t\tline := fmt.Sprintf(\"%s: %s\", v.Policy, strings.Join(v.Errors, \",\"))\n\t\t\tfinalErr = multierror.Append(finalErr, fmt.Errorf(\"%s\", line))\n\t\t}\n\t\tif finalErr != nil {\n\t\t\treturn &PolicyValidationError{msg: finalErr.Error()}\n\t\t}\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "93b49b1620dd6565c19e64f857d5b9a3", "score": "0.4383014", "text": "func (fi bindataFileInfo) Sys() interface{} {\n\treturn nil\n}", "title": "" }, { "docid": "93b49b1620dd6565c19e64f857d5b9a3", "score": "0.4383014", "text": "func (fi bindataFileInfo) Sys() interface{} {\n\treturn nil\n}", "title": "" }, { "docid": "93b49b1620dd6565c19e64f857d5b9a3", "score": "0.4383014", "text": "func (fi bindataFileInfo) Sys() interface{} {\n\treturn nil\n}", "title": "" }, { "docid": "93b49b1620dd6565c19e64f857d5b9a3", "score": "0.4383014", "text": "func (fi bindataFileInfo) Sys() interface{} {\n\treturn nil\n}", "title": "" }, { "docid": "93b49b1620dd6565c19e64f857d5b9a3", "score": "0.4383014", "text": "func (fi bindataFileInfo) Sys() interface{} {\n\treturn nil\n}", "title": "" }, { "docid": "93b49b1620dd6565c19e64f857d5b9a3", "score": "0.4383014", "text": "func (fi bindataFileInfo) Sys() interface{} {\n\treturn nil\n}", "title": "" }, { "docid": "93b49b1620dd6565c19e64f857d5b9a3", "score": "0.4383014", "text": "func (fi bindataFileInfo) Sys() interface{} {\n\treturn nil\n}", "title": "" }, { "docid": "93b49b1620dd6565c19e64f857d5b9a3", "score": "0.4383014", "text": "func (fi bindataFileInfo) Sys() interface{} {\n\treturn nil\n}", "title": "" }, { "docid": "93b49b1620dd6565c19e64f857d5b9a3", "score": "0.4383014", "text": "func (fi bindataFileInfo) Sys() interface{} {\n\treturn nil\n}", "title": "" }, { "docid": "93b49b1620dd6565c19e64f857d5b9a3", "score": "0.4383014", "text": "func (fi bindataFileInfo) Sys() interface{} {\n\treturn nil\n}", "title": "" }, { "docid": "93b49b1620dd6565c19e64f857d5b9a3", "score": "0.4383014", "text": "func (fi bindataFileInfo) Sys() interface{} {\n\treturn nil\n}", "title": "" }, { "docid": "93b49b1620dd6565c19e64f857d5b9a3", "score": "0.4383014", "text": "func (fi bindataFileInfo) Sys() interface{} {\n\treturn nil\n}", "title": "" }, { "docid": "93b49b1620dd6565c19e64f857d5b9a3", "score": "0.4383014", "text": "func (fi bindataFileInfo) Sys() interface{} {\n\treturn nil\n}", "title": "" }, { "docid": "93b49b1620dd6565c19e64f857d5b9a3", "score": "0.4383014", "text": "func (fi bindataFileInfo) Sys() interface{} {\n\treturn nil\n}", "title": "" }, { "docid": "93b49b1620dd6565c19e64f857d5b9a3", "score": "0.4383014", "text": "func (fi bindataFileInfo) Sys() interface{} {\n\treturn nil\n}", "title": "" }, { "docid": "93b49b1620dd6565c19e64f857d5b9a3", "score": "0.4383014", "text": "func (fi bindataFileInfo) Sys() interface{} {\n\treturn nil\n}", "title": "" }, { "docid": "93b49b1620dd6565c19e64f857d5b9a3", "score": "0.4383014", "text": "func (fi bindataFileInfo) Sys() interface{} {\n\treturn nil\n}", "title": "" }, { "docid": "93b49b1620dd6565c19e64f857d5b9a3", "score": "0.4383014", "text": "func (fi bindataFileInfo) Sys() interface{} {\n\treturn nil\n}", "title": "" }, { "docid": "93b49b1620dd6565c19e64f857d5b9a3", "score": "0.4383014", "text": "func (fi bindataFileInfo) Sys() interface{} {\n\treturn nil\n}", "title": "" }, { "docid": "93b49b1620dd6565c19e64f857d5b9a3", "score": "0.4383014", "text": "func (fi bindataFileInfo) Sys() interface{} {\n\treturn nil\n}", "title": "" }, { "docid": "93b49b1620dd6565c19e64f857d5b9a3", "score": "0.4383014", "text": "func (fi bindataFileInfo) Sys() interface{} {\n\treturn nil\n}", "title": "" }, { "docid": "93b49b1620dd6565c19e64f857d5b9a3", "score": "0.4383014", "text": "func (fi bindataFileInfo) Sys() interface{} {\n\treturn nil\n}", "title": "" } ]
4e0e18abd53b60e883bbb4022d3f1e50
The URL of the docker registry.
[ { "docid": "0c90f5b42acc6426a2ccb3d20aedc6c9", "score": "0.71187437", "text": "func (o LinuxFunctionAppSiteConfigApplicationStackDockerOutput) RegistryUrl() pulumi.StringOutput {\n\treturn o.ApplyT(func(v LinuxFunctionAppSiteConfigApplicationStackDocker) string { return v.RegistryUrl }).(pulumi.StringOutput)\n}", "title": "" } ]
[ { "docid": "b37751f526c6a4f318eb9f3514a6ed98", "score": "0.7233889", "text": "func (cli *RegistryClient) URL() string {\n\treturn cli.webScheme() + cli.registry + \"/v2/\"\n}", "title": "" }, { "docid": "222885b24980fa0fe4a3e30bef5589ff", "score": "0.7102383", "text": "func (r Registry) URL() string {\n\tif strings.HasPrefix(r.Host, \"localhost:\") || r.Host == \"localhost\" {\n\t\treturn \"http://\" + r.Host + \"/\"\n\t}\n\treturn \"https://\" + r.Host + \"/\"\n}", "title": "" }, { "docid": "728f20585e40684d2db505321cc10ec9", "score": "0.7037107", "text": "func (o GetLinuxWebAppSiteConfigApplicationStackOutput) DockerRegistryUrl() pulumi.StringOutput {\n\treturn o.ApplyT(func(v GetLinuxWebAppSiteConfigApplicationStack) string { return v.DockerRegistryUrl }).(pulumi.StringOutput)\n}", "title": "" }, { "docid": "3744d835922cc43f4a9032ede9339cb1", "score": "0.70239806", "text": "func (o GetLinuxFunctionAppSiteConfigApplicationStackDockerOutput) RegistryUrl() pulumi.StringOutput {\n\treturn o.ApplyT(func(v GetLinuxFunctionAppSiteConfigApplicationStackDocker) string { return v.RegistryUrl }).(pulumi.StringOutput)\n}", "title": "" }, { "docid": "2f4aab9f92197abfc6623e7d61cb2445", "score": "0.69953704", "text": "func (o LinuxFunctionAppSlotSiteConfigApplicationStackDockerOutput) RegistryUrl() pulumi.StringOutput {\n\treturn o.ApplyT(func(v LinuxFunctionAppSlotSiteConfigApplicationStackDocker) string { return v.RegistryUrl }).(pulumi.StringOutput)\n}", "title": "" }, { "docid": "d135c3a0becd26ba8e60033274712e3a", "score": "0.69574904", "text": "func (o WindowsWebAppSiteConfigApplicationStackOutput) DockerRegistryUrl() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v WindowsWebAppSiteConfigApplicationStack) *string { return v.DockerRegistryUrl }).(pulumi.StringPtrOutput)\n}", "title": "" }, { "docid": "8d4cc520f0be770d864e9b9ec0eca7ec", "score": "0.69034827", "text": "func (o LinuxWebAppSiteConfigApplicationStackOutput) DockerRegistryUrl() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v LinuxWebAppSiteConfigApplicationStack) *string { return v.DockerRegistryUrl }).(pulumi.StringPtrOutput)\n}", "title": "" }, { "docid": "d473ed0f4aa6dcd7884948a696a6e3d2", "score": "0.68273574", "text": "func (o SourceControlGithubActionConfigurationContainerConfigurationOutput) RegistryUrl() pulumi.StringOutput {\n\treturn o.ApplyT(func(v SourceControlGithubActionConfigurationContainerConfiguration) string { return v.RegistryUrl }).(pulumi.StringOutput)\n}", "title": "" }, { "docid": "be07fe384fd292bdeb6961c028b9ae42", "score": "0.68186843", "text": "func (o WindowsWebAppSlotSiteConfigApplicationStackOutput) DockerRegistryUrl() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v WindowsWebAppSlotSiteConfigApplicationStack) *string { return v.DockerRegistryUrl }).(pulumi.StringPtrOutput)\n}", "title": "" }, { "docid": "002792994f1145770be946ce23495420", "score": "0.67883295", "text": "func (o LinuxWebAppSlotSiteConfigApplicationStackOutput) DockerRegistryUrl() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v LinuxWebAppSlotSiteConfigApplicationStack) *string { return v.DockerRegistryUrl }).(pulumi.StringPtrOutput)\n}", "title": "" }, { "docid": "4ecdc2d15bb1ca27881d220fb27f2750", "score": "0.671176", "text": "func (o SourceControlSlotGithubActionConfigurationContainerConfigurationOutput) RegistryUrl() pulumi.StringOutput {\n\treturn o.ApplyT(func(v SourceControlSlotGithubActionConfigurationContainerConfiguration) string { return v.RegistryUrl }).(pulumi.StringOutput)\n}", "title": "" }, { "docid": "5d5113eb86f4759e92b00fe7e5306383", "score": "0.6694348", "text": "func (o WindowsWebAppSiteConfigApplicationStackPtrOutput) DockerRegistryUrl() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v *WindowsWebAppSiteConfigApplicationStack) *string {\n\t\tif v == nil {\n\t\t\treturn nil\n\t\t}\n\t\treturn v.DockerRegistryUrl\n\t}).(pulumi.StringPtrOutput)\n}", "title": "" }, { "docid": "7e94075fbf13d63931dc0cc1c01dfc0a", "score": "0.66410404", "text": "func (o LinuxWebAppSiteConfigApplicationStackPtrOutput) DockerRegistryUrl() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v *LinuxWebAppSiteConfigApplicationStack) *string {\n\t\tif v == nil {\n\t\t\treturn nil\n\t\t}\n\t\treturn v.DockerRegistryUrl\n\t}).(pulumi.StringPtrOutput)\n}", "title": "" }, { "docid": "9afaa4193a4f0eebe85ce1ca8945aa67", "score": "0.6622245", "text": "func (o SourceControlGithubActionConfigurationContainerConfigurationPtrOutput) RegistryUrl() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v *SourceControlGithubActionConfigurationContainerConfiguration) *string {\n\t\tif v == nil {\n\t\t\treturn nil\n\t\t}\n\t\treturn &v.RegistryUrl\n\t}).(pulumi.StringPtrOutput)\n}", "title": "" }, { "docid": "88398b7fca17abf05ac62ab2616c11ab", "score": "0.6560827", "text": "func (o WindowsWebAppSlotSiteConfigApplicationStackPtrOutput) DockerRegistryUrl() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v *WindowsWebAppSlotSiteConfigApplicationStack) *string {\n\t\tif v == nil {\n\t\t\treturn nil\n\t\t}\n\t\treturn v.DockerRegistryUrl\n\t}).(pulumi.StringPtrOutput)\n}", "title": "" }, { "docid": "90e753974021ec6fa782ede54719edbc", "score": "0.6538531", "text": "func (o LinuxWebAppSlotSiteConfigApplicationStackPtrOutput) DockerRegistryUrl() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v *LinuxWebAppSlotSiteConfigApplicationStack) *string {\n\t\tif v == nil {\n\t\t\treturn nil\n\t\t}\n\t\treturn v.DockerRegistryUrl\n\t}).(pulumi.StringPtrOutput)\n}", "title": "" }, { "docid": "2bbd3000e8d726c7323fda1c0ccf0912", "score": "0.6504447", "text": "func (o SourceControlSlotGithubActionConfigurationContainerConfigurationPtrOutput) RegistryUrl() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v *SourceControlSlotGithubActionConfigurationContainerConfiguration) *string {\n\t\tif v == nil {\n\t\t\treturn nil\n\t\t}\n\t\treturn &v.RegistryUrl\n\t}).(pulumi.StringPtrOutput)\n}", "title": "" }, { "docid": "e8f77c9adb331501093c12af99561479", "score": "0.63949865", "text": "func (c RegistryConfig) RepositoriesURL() string {\n\treturn combine(c.RegistryUrl, RepositoriesURL())\n}", "title": "" }, { "docid": "618261955e822c1fc44fc8193c068b5f", "score": "0.636819", "text": "func (s *DockerServer) URL() string {\n\tif s.listener == nil {\n\t\treturn \"\"\n\t}\n\treturn \"http://\" + s.listener.Addr().String() + \"/\"\n}", "title": "" }, { "docid": "3de1f68678a3196a5a34bfca14666a20", "score": "0.6274154", "text": "func getRemoteRegistryURL() (*url.URL, error) {\n\tpc := conf.Extensions()\n\tif pc == nil || pc.RemoteRegistryURL == \"\" {\n\t\treturn nil, nil\n\t}\n\treturn url.Parse(pc.RemoteRegistryURL)\n}", "title": "" }, { "docid": "09e4e46e494856b0dfd48d1ad7fcf5a5", "score": "0.62345356", "text": "func (u util) ImageNameToRegistryURL(name string) string {\n var taggedRegex = regexp.MustCompile(`[a-z/.]*:[a-z]*`)\n if taggedRegex.MatchString(name) == false {\n name = fmt.Sprintf(\"%v:latest\", name)\n }\n\n var fullURLRegex = regexp.MustCompile(`docker.io/[a-z/.:]*`)\n if fullURLRegex.MatchString(name) == false {\n name = fmt.Sprintf(\"docker.io/%v\", name)\n }\n\n return name\n}", "title": "" }, { "docid": "6b34ec0addb2bcf1ca5768797ff43a92", "score": "0.62163216", "text": "func (r payloadBuilder) GetApplicationRegistryURL() string {\n\treturn fmt.Sprintf(applicationRegistryFormat, applicationRegistryPrefix, r.applicationName, applicationRegistrySuffix)\n}", "title": "" }, { "docid": "c695245347c80d7d8dc3498f0bcac182", "score": "0.61116976", "text": "func (r *Registry) URI() string {\n\treturn r.Scheme + \"://\" + r.Name + \":\" + r.Port + \"/v2\"\n}", "title": "" }, { "docid": "b581fb89232302ab3d4b544f80dd5b44", "score": "0.59208494", "text": "func (r *Registry) ClientURL(name string) (string, bool) {\n\tr.Lock()\n\tdefer r.Unlock()\n\treturn r.clientURL(name)\n}", "title": "" }, { "docid": "1909aa0f81aff12e114287066c7f90fb", "score": "0.5838318", "text": "func FindRepositoryURL(requirements *jxcore.RequirementsConfig, registryOrg, appName string) (string, error) {\n\tanswer := \"\"\n\tif requirements != nil {\n\t\tanswer = requirements.Cluster.ChartRepository\n\t}\n\tif answer == \"\" {\n\t\tanswer = os.Getenv(\"JX_CHART_REPOSITORY\")\n\t}\n\tif answer == \"\" {\n\t\tregistry := requirements.Cluster.Registry\n\t\tif requirements.Cluster.ChartKind == jxcore.ChartRepositoryTypeOCI && registryOrg != \"\" && appName != \"\" && registry != \"\" {\n\t\t\treturn stringhelpers.UrlJoin(registry, registryOrg, appName), nil\n\t\t}\n\t\tif requirements.Cluster.ChartKind != jxcore.ChartRepositoryTypeOCI && requirements.Cluster.ChartKind != jxcore.ChartRepositoryTypePages {\n\t\t\t// assume default chart museum\n\t\t\tanswer = \"http://jenkins-x-chartmuseum:8080\"\n\t\t}\n\t}\n\treturn answer, nil\n}", "title": "" }, { "docid": "c7528dd1e78b70a854886b3fb44fd98c", "score": "0.58343726", "text": "func ContainerRegistryFromURL(registryURL string) (string, error) {\n\tu, err := url.ParseRequestURI(registryURL)\n\tif err != nil {\n\t\treturn \"\", errors.Wrap(err, \"invalid registry url\")\n\t}\n\tif len(u.Host) == 0 {\n\t\treturn \"\", fmt.Errorf(\"invalid registry url\")\n\t}\n\treturn u.Host, nil\n}", "title": "" }, { "docid": "ecfa65ca324fe8a1b167eaf8501fdfe2", "score": "0.57548934", "text": "func (r *Registry) Endpoint() string {\n\treturn fmt.Sprintf(\"%s/%s\", RegistryHostname, r.Registry.Name)\n}", "title": "" }, { "docid": "8ba9d8fb56aabbfabfcb21e3dea83809", "score": "0.57292914", "text": "func (a *App) URL() string {\n\tscheme := \"http\"\n\tport := a.Config().Docker.Proxy.HTTPPort\n\tif len(a.Config().Docker.Proxy.HTTPSPort) > 0 {\n\t\tscheme = \"https\"\n\t\tport = a.Config().Docker.Proxy.HTTPSPort\n\t}\n\n\tif strings.Contains(port, \":\") {\n\t\tp := strings.Split(port, \":\")\n\t\tport = p[0]\n\t}\n\n\tif len(port) > 0 {\n\t\tport = \":\" + port\n\t}\n\n\tif port == \"443\" || port == \"80\" {\n\t\tport = \"\"\n\t}\n\n\thosts := strings.Split(a.Host(), \",\")\n\tfor i, host := range hosts {\n\t\thosts[i] = fmt.Sprintf(\"%s://%s%s\", scheme, strings.TrimSpace(host), port)\n\t}\n\n\treturn strings.Join(hosts, \", \")\n}", "title": "" }, { "docid": "1a91dab58bf147c3c92c74c126f1516e", "score": "0.57063", "text": "func (r Reference) Registry() string {\n\treturn r.named.Hostname()\n}", "title": "" }, { "docid": "3397e27bcccda56bc097496cd4a489ae", "score": "0.56541216", "text": "func URL(loc rsrc.Locator) (string, error) {\n\treturn loc.URL(APIKey)\n}", "title": "" }, { "docid": "461f20b1a9aca9c8da7562e7e877644b", "score": "0.56390804", "text": "func (d *Database) URL() string {\n\treturn parseConnConfig(d.Adapter, d.Hostname, d.Database, d.Username, d.Password, d.Description, d.Port)\n}", "title": "" }, { "docid": "8f6a10cc2454bfe0de94e2713be6f73f", "score": "0.5636576", "text": "func (r *ExpectRepository) URL() *url.URL { return r.RepoURL }", "title": "" }, { "docid": "e8d33ea98a2bc870afcc53f4ebbcaa91", "score": "0.5622177", "text": "func (c *DefaultClient) Registry() (registry string, err error) {\n\timageRegistry, err := c.getImageRegistry(c.cluster)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\tif imageRegistry == nil {\n\t\treturn \"\", nil\n\t}\n\tregistry = imageRegistry.Spec.Registry\n\treturn registry, nil\n}", "title": "" }, { "docid": "6774489b774b93cb93f0604cb11ebd84", "score": "0.5610417", "text": "func (c RegistryConfig) RepositoryTagsURL(repositoryName string) string {\n\treturn combine(c.RegistryUrl, RepositoryTagsURL(repositoryName))\n}", "title": "" }, { "docid": "2fd57a605c2a70a930c75c9adadeb1fd", "score": "0.55471045", "text": "func getContainerRegistry(url string) (string, string, error) {\n\tvar urlReg, registryReg, downReg *regexp.Regexp\n\tvar registry, downURL string\n\tvar err error\n\turlReg, err = regexp.Compile(`^docker:\\/\\/(?:.*).io\\/(?:.*)`)\n\tif err != nil {\n\t\treturn \"\", \"\", err\n\t}\n\tregistryReg, err = regexp.Compile(`(?:.*)(?:\\.io)`)\n\tif err != nil {\n\t\treturn \"\", \"\", err\n\t}\n\tdownReg, err = regexp.Compile(`(?:.*)(?:\\.io)\\/`)\n\tif err != nil {\n\t\treturn \"\", \"\", err\n\t}\n\tif urlReg.MatchString(url) {\n\t\tregistry = strings.TrimPrefix(registryReg.FindString(url), \"docker://\")\n\t\tdownURL = downReg.ReplaceAllString(url, \"docker://\")\n\t\treturn registry, downURL, nil\n\t}\n\treturn \"\", \"\", fmt.Errorf(\"Download URL is not formed properly\")\n}", "title": "" }, { "docid": "74366986588d2b8cd7e97cb1b296ee21", "score": "0.5527765", "text": "func (s *Service) URL() string {\n\treturn fmt.Sprintf(\"http://%s:%d\", s.Ip, s.Port)\n}", "title": "" }, { "docid": "88f8a6288591b5918d24e5b746850d55", "score": "0.54949385", "text": "func (creds *Credentials) URL() string {\n\treturn creds.provider.URL()\n}", "title": "" }, { "docid": "a22b727e784b4b53014f1025077097a2", "score": "0.54883075", "text": "func (self *DockerURL) String() string {\n\treturn self.Key()\n}", "title": "" }, { "docid": "46ce29a964fa8643066c7eb995131319", "score": "0.5486889", "text": "func (c *SessionConfig) URL() string {\n\treturn fmt.Sprintf(\"amqp://%s:%s@%s\", c.User, c.Password, c.Addr)\n}", "title": "" }, { "docid": "95bea6a35d9800cc1303b12e1c8c1e63", "score": "0.5468101", "text": "func DockerNode() string {\n\n\tvar docker_node string\n\tif os.Getenv(\"DOCKER_HOST\") != \"\" {\n\t\tdocker_node = os.Getenv(\"DOCKER_HOST\")\n\t} else {\n\t\tdocker_node = \"http://127.0.0.1:4243\"\n\t}\n\treturn docker_node\n}", "title": "" }, { "docid": "d5ac2d737deb023fcc46fdf1b499d6cf", "score": "0.5448247", "text": "func (c *Client) containerURL(container string) string {\n\treturn fmt.Sprintf(\"https://%s/%s/\", c.hostname(), container)\n}", "title": "" }, { "docid": "9cb1d248834eb361ede2cf27466dc294", "score": "0.5444112", "text": "func (r *Res) URL() string {\n\treturn fmt.Sprintf(\"http://localhost:%d/json\", r.port)\n}", "title": "" }, { "docid": "4cb803d5b40694ca76e9b349bbb28c6e", "score": "0.54364437", "text": "func (s *Client) URL() string {\n\treturn s.generated().Endpoint()\n}", "title": "" }, { "docid": "c89b927041b6996c2b37eb22cd86f225", "score": "0.5433048", "text": "func GetRegistryAddress(imageRef string) (string, error) {\n\tnormalizedRef, err := reference.ParseNormalizedNamed(imageRef)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\n\taddress := reference.Domain(normalizedRef)\n\n\tif address == DefaultRegistryDomain {\n\t\taddress = DefaultRegistryHost\n\t}\n\treturn address, nil\n}", "title": "" }, { "docid": "ff15a5619cc3c3b289a8257808be74fd", "score": "0.5420108", "text": "func (m *MacOSRestoreImage) URL() string {\n\treturn m.url\n}", "title": "" }, { "docid": "d4a17907d4f72971d6a35c1a37fdd422", "score": "0.5419271", "text": "func (provider *RefreshTokenProvider) URL() string {\n\treturn provider.creds.URL\n}", "title": "" }, { "docid": "6c3bb18df432dc84a6b75b56370650ff", "score": "0.5401595", "text": "func (bb *Client) URL() string {\n\treturn bb.generated().Endpoint()\n}", "title": "" }, { "docid": "a4303e4cfd4a4835d0e65c1f9b57e0e5", "score": "0.53669107", "text": "func (r *Registry) url(pathTemplate string, args ...interface{}) string {\n\tpathSuffix := fmt.Sprintf(pathTemplate, args...)\n\turl := fmt.Sprintf(\"%s%s\", r.URL, pathSuffix)\n\treturn url\n}", "title": "" }, { "docid": "2418b0b546763c30ef784bfe25fa90e4", "score": "0.53593487", "text": "func URL() string {\n\treturn \"https://\" + Domain()\n}", "title": "" }, { "docid": "9bcc256c19f7b2b5f5f2fb595ef1772c", "score": "0.5353941", "text": "func (z *Zenodo) URL() string {\n\tif z.sandbox {\n\t\treturn zenodo.SandboxBaseURL\n\t}\n\treturn z.base\n}", "title": "" }, { "docid": "ff89faa119ee520f1bfa8acbfb2bf287", "score": "0.5353843", "text": "func (d *DataBase) URL() string {\n\turl := \"http://\" + d.Host + \":\" + d.Port + \"/\" + d.DBName\n\treturn url\n}", "title": "" }, { "docid": "b23591f66a6252b87a4b763385d991d8", "score": "0.5338466", "text": "func (r DockerHubAdapter) RegistryName() string {\n\treturn dockerhubName\n}", "title": "" }, { "docid": "acabc5683ab30f9e15cf3ad036910c32", "score": "0.53208053", "text": "func registryPath(cluster string) string {\n\treturn path.Join(cluster, \"registry\")\n}", "title": "" }, { "docid": "e7513984c35a24c931c38940f430242b", "score": "0.5317356", "text": "func (s *Server) URL() string {\n\treturn fmt.Sprintf(\"127.0.0.1:%d\", s.Port)\n}", "title": "" }, { "docid": "2f45c0b587ad1e671f02279acb77f025", "score": "0.5291748", "text": "func (server Server) URL() string {\n\treturn fmt.Sprintf(\"%s:%s\", server.Host, server.Port)\n}", "title": "" }, { "docid": "f5dd7cb1d55db5ac27178390517db1ba", "score": "0.52603406", "text": "func (provider *DefaultImageProvider) DockerImageURLForDeployGroup(deploymentGroup string) (string, error) {\n\tvar image string\n\tregistry, err := provider.getDockerRegistry()\n\tif err != nil {\n\t\treturn \"\", fmt.Errorf(\"Failed to get docker registry: %s\", err)\n\t}\n\timage, err = provider.getImageForDeployGroup(deploymentGroup)\n\tif err != nil {\n\t\treturn \"\", fmt.Errorf(\n\t\t\t\"Unable to read from deployments.json for %s: %s\",\n\t\t\tprovider.Service, err,\n\t\t)\n\t}\n\n\treturn fmt.Sprintf(\"%s/%s\", registry, image), nil\n}", "title": "" }, { "docid": "fd60e3b3d00901ccbe98ca6ca6d088af", "score": "0.5246092", "text": "func (instance *TerrariumInstance) URL() (*url.URL, error) {\n\treturn url.Parse(\"https://\" + url.PathEscape(instance.ID) + \".\" + URLInstance)\n}", "title": "" }, { "docid": "6e1c86014e354ae55e49e03317b72e14", "score": "0.52459925", "text": "func (c *Client) URL() string {\n\treturn c.url\n}", "title": "" }, { "docid": "6e1c86014e354ae55e49e03317b72e14", "score": "0.52459925", "text": "func (c *Client) URL() string {\n\treturn c.url\n}", "title": "" }, { "docid": "84e37aa37b4d688901255e0c8893a69d", "score": "0.5234015", "text": "func dockerHost() string {\n\tvar u, _ = url.Parse(os.Getenv(\"DOCKER_HOST\"))\n\tif u.Host == \"\" {\n\t\tfmt.Println(\"Please install docker daemon or boot2docker and set DOCKER_HOST\")\n\t\tos.Exit(0)\n\t}\n\treturn strings.Split(u.Host, \":\")[0]\n}", "title": "" }, { "docid": "b80b3fa4e503843efc36c4ffdc3bc282", "score": "0.523193", "text": "func (w WeatherRemoteData) GetURL() string {\n\tconfig := config.GetCacheConfig()\n\treturn config.OpenWeatherMapURL\n}", "title": "" }, { "docid": "12234367c0b4162db12639eb8f4bafa1", "score": "0.5227528", "text": "func NewClient(registryURL string) (*Client, error) {\n\tbaseURL, err := url.Parse(registryURL)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tif baseURL.Scheme != \"https\" {\n\t\t// TODO: create package error variable and return it here\n\t\treturn nil, fmt.Errorf(\"docker registry url scheme should be https\")\n\t}\n\n\thttpclient := &http.Client{\n\t\tTimeout: 15 * time.Second,\n\t}\n\n\treturn &Client{BaseURL: baseURL, httpClient: httpclient}, nil\n}", "title": "" }, { "docid": "55312db80eb890db2c528aa1b469b6d9", "score": "0.5220123", "text": "func (g *GitHubActionsConfigProvider) GetRepoURL() string {\n\treturn getEnv(\"GITHUB_SERVER_URL\", \"n/a\") + \"/\" + getEnv(\"GITHUB_REPOSITORY\", \"n/a\")\n}", "title": "" }, { "docid": "5a45c6f2d94066a0a1d28de94569746b", "score": "0.5212181", "text": "func (app *App) ImageURL(server string) string {\n\treturn fmt.Sprintf(\"%s/%s-%s\", server, app.Name, app.Git.Revision)\n}", "title": "" }, { "docid": "a519bf5529d01d236f4d98b7c72da6b4", "score": "0.5207125", "text": "func (cl *CL) URL() (string, error) { return cl.ExternalID.URL() }", "title": "" }, { "docid": "27dab8434152000e66c23f9aee9e7a11", "score": "0.5178077", "text": "func (w *Worker) URL() string {\n\tproto := \"https\"\n\tif w.cfg.Server.SSLCert == \"\" && w.cfg.Server.SSLKey == \"\" {\n\t\tproto = \"http\"\n\t}\n\n\treturn fmt.Sprintf(\"%s://%s:%d/\", proto, w.cfg.Server.Hostname, w.cfg.Server.Port)\n}", "title": "" }, { "docid": "0252796559193a275ec0aa04b003a45a", "score": "0.5175861", "text": "func (driver GithubCodeHostingDriver) GetRepositoryURL(repository string) string {\n\treturn \"https://github.com/\" + repository\n}", "title": "" }, { "docid": "23b71f7c7a9ad4b9c2d834c00e4a26b4", "score": "0.5169264", "text": "func (i *image) URL() string {\n\treturn i.ImageURL\n}", "title": "" }, { "docid": "d02597a5ed965edc146ea7cbe7f233c2", "score": "0.51632124", "text": "func (o GroupSyncSpecProvidersKeycloakOutput) Url() pulumi.StringOutput {\n\treturn o.ApplyT(func(v GroupSyncSpecProvidersKeycloak) string { return v.Url }).(pulumi.StringOutput)\n}", "title": "" }, { "docid": "6baccbd7c99eed1c21de0a5b3d100447", "score": "0.51628", "text": "func (m *Command) URL() string { return m.API.Node().URI.String() }", "title": "" }, { "docid": "5be420d967f617d52a269b932ee149df", "score": "0.5150213", "text": "func (c *Connection) URL() string {\n\treturn c.apiURL.String()\n}", "title": "" }, { "docid": "3fe603016899a12990bcc4847693d4e7", "score": "0.51499367", "text": "func registryToString(reg types.AuthConfig) (string, error) {\n\t// Docker stores the username and password in an auth section types.AuthConfig\n\t// formatted as user:pass then base64ed. This is not documented clearly.\n\t// https://github.com/docker/cli/blob/master/cli/config/configfile/file.go#L76\n\tif reg.Auth != \"\" {\n\t\tbytes, err := base64.StdEncoding.DecodeString(reg.Auth)\n\t\tif err != nil {\n\t\t\treturn \"\", err\n\t\t}\n\t\tuserAndPass := strings.SplitN(string(bytes), \":\", 2)\n\t\tif len(userAndPass) != 2 {\n\t\t\treturn \"\", errors.Errorf(\"auth field of docker authConfig must be base64ed user:pass\")\n\t\t}\n\t\treg.Username, reg.Password = userAndPass[0], userAndPass[1]\n\t\treg.Auth = \"\"\n\t}\n\tbs, err := json.Marshal(reg)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\n\treturn base64.URLEncoding.EncodeToString(bs), nil\n}", "title": "" }, { "docid": "03ad033486f9f3f6fb85cc7f8a2b9256", "score": "0.5149067", "text": "func (r *Repository) URL() string {\n\trepo, err := git.PlainOpen(r.uri)\n\tif err != nil {\n\t\treturn \"\" // not a git repository\n\t}\n\n\tc, err := repo.Config()\n\tif err != nil {\n\t\treturn \"\" // Has no .git/config or other error.\n\t}\n\n\tif _, ok := c.Remotes[\"origin\"]; ok {\n\t\turls := c.Remotes[\"origin\"].URLs\n\t\tif len(urls) > 0 {\n\t\t\treturn urls[0]\n\t\t}\n\t}\n\treturn \"\"\n}", "title": "" }, { "docid": "32a4a4622964b4cd50fa6abe96a39f0a", "score": "0.5144871", "text": "func (s *StatsResourceConfig) Url() string {\n\treturn *s.url\n}", "title": "" }, { "docid": "b07291bbbbe435df932c3b841cef9a20", "score": "0.51430625", "text": "func (s ServiceURL) URL() url.URL {\n\treturn s.client.URL()\n}", "title": "" }, { "docid": "3f002c865d66506365b3f44de4b85a67", "score": "0.51339906", "text": "func getDockerEndPoint() (dep string, err error) {\n\tdockerHost := os.Getenv(\"DOCKER_HOST\")\n\tif dockerHost != \"\" {\n\t\tdep = dockerHost\n\t\treturn dep, nil\n\t}\n\treturn \"unix:///var/run/docker.sock\", nil\n}", "title": "" }, { "docid": "cd97f7b4b28f3140dfb75bd762e91ecd", "score": "0.51311934", "text": "func RepositoriesURL() string {\n\treturn \"/v2/_catalog\"\n}", "title": "" }, { "docid": "365c070f7c584d8b7ea0de57c3d2398f", "score": "0.5120446", "text": "func (r *Request) URL() string {\n\treturn fmt.Sprintf(\"%s/%s/%s/%s/%s/%s\",\n\t\tr.Host,\n\t\tr.Repo.Host,\n\t\tr.Repo.Owner,\n\t\tr.Repo.Name,\n\t\tr.Commit.Branch,\n\t\tr.Commit.Sha,\n\t)\n}", "title": "" }, { "docid": "5080d343467b6f5d234aa850d63b5f91", "score": "0.5116867", "text": "func (this Repository) GetURL() string { return this.URL }", "title": "" }, { "docid": "7eb727317677621b6b16ab9f2244df69", "score": "0.51109713", "text": "func (api *DebugNodeAPIClient) BaseURL() string {\n\treturn api.NodeHTTPAPIClient.BaseURL\n}", "title": "" }, { "docid": "ae401beee437273676a139cc70637f40", "score": "0.511091", "text": "func GetRegistry(image string) (string, error) {\n\t// It is possible to only have the registry name in the format \"myregistry/\"\n\t// if so, just trim the \"/\" from the end and return the registry name\n\tif strings.HasSuffix(image, \"/\") {\n\t\treturn strings.TrimSuffix(image, \"/\"), nil\n\t}\n\timgRef, err := reference.Parse(image)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\treturn reference.Domain(imgRef.(reference.Named)), nil\n}", "title": "" }, { "docid": "6336b9d752de7b948b6ed2fdd4bbe81f", "score": "0.50840336", "text": "func (q *QueueClient) URL() string {\n\treturn q.queueClient().Endpoint()\n}", "title": "" }, { "docid": "81d80840fe56311de253c75754b602a2", "score": "0.5083473", "text": "func (c *DockerClient) GetImageListOnRegistry() ([]Repositories, error) {\n\n\tvar err error\n\tvar last string // \"&last=<last image name from previous response>\"\n\n\t// https://<registry address>/v2/_catalog?n=<number>\n\turl := fmt.Sprintf(\"https://%s\", c.RegistryInterface)\n\turl += Catalog + \"?\" + N\n\n\trtn := []Repositories{} // image list\n\n\tfor {\n\t\t//create request GET + url\n\t\treq, err := http.NewRequest(\"GET\", url+last, nil)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\n\t\t//send request\n\t\tres, err := c.Cli.Do(req)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\n\t\tdefer res.Body.Close()\n\n\t\t//get result\n\t\tbody, err := ioutil.ReadAll(res.Body)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\n\t\trep := &Repositories{}\n\n\t\terr = json.Unmarshal(body, rep)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\n\t\trtn = append(rtn, *rep)\n\n\t\t// if there are no images to get on registry any more,\n\t\t// finish to get ones\n\t\tif len(res.Header[\"Link\"]) == 0 {\n\t\t\tbreak\n\t\t}\n\n\t\t// if there are still images to get on registry,\n\t\t// retrieve last image name from GET response\n\t\tfor _, l := range res.Header[\"Link\"] {\n\n\t\t\tif strings.Contains(l, Catalog) &&\n\t\t\t\tstrings.Contains(l, Last) &&\n\t\t\t\tstrings.Contains(l, N) &&\n\t\t\t\tstrings.Contains(l, \"rel=\\\"next\\\"\") {\n\n\t\t\t\tfr := strings.LastIndex(l, Last)\n\t\t\t\tif fr == -1 {\n\t\t\t\t\terr = errors.New(Errmsg)\n\t\t\t\t\treturn nil, err\n\t\t\t\t}\n\t\t\t\tfr += len(Last)\n\n\t\t\t\tto := strings.LastIndex(l, \"&\"+N)\n\t\t\t\tif to == -1 {\n\t\t\t\t\terr = errors.New(Errmsg)\n\t\t\t\t\treturn nil, err\n\t\t\t\t}\n\n\t\t\t\timg := l[fr:to]\n\n\t\t\t\timg = strings.Replace(img, \"%2F\", \"/\", 1)\n\n\t\t\t\tlast = \"&\" + Last + img\n\n\t\t\t\tbreak\n\t\t\t}\n\t\t}\n\t}\n\treturn rtn, err\n}", "title": "" }, { "docid": "ab5070e6df4a09e2003f194989ad3e8f", "score": "0.50619686", "text": "func ExpandAndVerifyRegistryUrl(hostname string) (string, error) {\n\tif strings.HasPrefix(hostname, \"http:\") || strings.HasPrefix(hostname, \"https:\") {\n\t\t// if there is no slash after https:// (8 characters) then we have no path in the url\n\t\tif strings.LastIndex(hostname, \"/\") < 9 {\n\t\t\t// there is no path given. Expand with default path\n\t\t\thostname = hostname + \"/v1/\"\n\t\t}\n\t\tif err := pingRegistryEndpoint(hostname); err != nil {\n\t\t\treturn \"\", errors.New(\"Invalid Registry endpoint: \" + err.Error())\n\t\t}\n\t\treturn hostname, nil\n\t}\n\tendpoint := fmt.Sprintf(\"https://%s/v1/\", hostname)\n\tif err := pingRegistryEndpoint(endpoint); err != nil {\n\t\tutils.Debugf(\"Registry %s does not work (%s), falling back to http\", endpoint, err)\n\t\tendpoint = fmt.Sprintf(\"http://%s/v1/\", hostname)\n\t\tif err = pingRegistryEndpoint(endpoint); err != nil {\n\t\t\t//TODO: triggering highland build can be done there without \"failing\"\n\t\t\treturn \"\", errors.New(\"Invalid Registry endpoint: \" + err.Error())\n\t\t}\n\t}\n\treturn endpoint, nil\n}", "title": "" }, { "docid": "320ebc5160da1da8212c4487c5cff6af", "score": "0.50593746", "text": "func (o GroupSyncSpecProvidersGithubOutput) Url() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v GroupSyncSpecProvidersGithub) *string { return v.Url }).(pulumi.StringPtrOutput)\n}", "title": "" }, { "docid": "bc73313e548d6a423bafa0b4c0290ab1", "score": "0.5058159", "text": "func (s *CloudRunService) URL(sampleDir string) (string, error) {\n\tif s.url != \"\" {\n\t\treturn s.url, nil\n\t}\n\n\ta := append(util.GcloudCommonFlags, \"run\", \"--platform=managed\", \"services\", \"describe\", s.Name,\n\t\t\"--format=value(status.url)\")\n\turl, err := util.ExecCommand(exec.Command(\"gcloud\", a...), sampleDir)\n\n\tif err != nil {\n\t\treturn \"\", fmt.Errorf(\"getting Cloud Run Service URL: %w\", err)\n\t}\n\n\ts.url = url\n\treturn url, err\n}", "title": "" }, { "docid": "f4da28476c5511d87341f14f1381f9bf", "score": "0.50502586", "text": "func (d *Driver) GetURL() (string, error) {\n\tip, err := d.GetIP()\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\tif ip == \"\" {\n\t\treturn \"\", nil\n\t}\n\treturn fmt.Sprintf(\"tcp://%s\", net.JoinHostPort(ip, strconv.Itoa(d.EnginePort))), nil\n}", "title": "" }, { "docid": "67a35bfd250c54b5a797c38fa75e74a3", "score": "0.5046039", "text": "func (c *Config) url(redactPassword bool) string {\n\tpassword := c.Password\n\tif redactPassword {\n\t\tpassword = redacted\n\t}\n\n\tquery := url.Values{}\n\tquery.Set(\"sslmode\", c.SSLMode)\n\tquery.Set(\"connect_timeout\", fmt.Sprintf(\"%v\", int(c.ConnectionTimeout.Seconds())))\n\tquery.Set(\"client_encoding\", c.Encoding)\n\n\tdatasource := url.URL{\n\t\tScheme: c.Driver,\n\t\tUser: url.UserPassword(c.User, password),\n\t\tHost: net.JoinHostPort(c.Host, strconv.Itoa(int(c.Port))),\n\t\tPath: c.DbName,\n\t\tRawQuery: query.Encode(),\n\t}\n\n\treturn datasource.String()\n}", "title": "" }, { "docid": "5a3497dd17a0c8ac12e1c0fe271aa676", "score": "0.5044669", "text": "func (t BucketReplicationTarget) URL() string {\n\tscheme := \"http\"\n\tif t.IsSSL {\n\t\tscheme = \"https\"\n\t}\n\treturn fmt.Sprintf(\"%s://%s\", scheme, t.Endpoint)\n}", "title": "" }, { "docid": "35e226bb82360502c7ce2a8820e3ac8a", "score": "0.50428075", "text": "func GetOrchestratorURL() string {\n\tif Configurations.Orchestrator.Host == \"\" || Configurations.Orchestrator.Port == 0 {\n\t\tpanic(\"No Orchestrator Information in Config File\")\n\t}\n\treturn urlPrefix + Configurations.Orchestrator.Host + \":\" + strconv.Itoa(Configurations.Orchestrator.Port) + \"/\" + urlVersion\n}", "title": "" }, { "docid": "c52836e33d8cf8155c2d23e1d7c9d1a4", "score": "0.5040965", "text": "func (l *LocalApp) URL() string {\n\treturn \"http://\" + l.AppConfig.Hostname()\n}", "title": "" }, { "docid": "04bf559bd14d3691a803e11cb2dc7827", "score": "0.5036021", "text": "func ReadDockerConfigFileFromURL(url string, client *http.Client, header *http.Header) (cfg credentialconfig.RegistryConfig, err error) {\n\tif contents, err := ReadURL(url, client, header); err == nil {\n\t\treturn ReadDockerConfigFileFromBytes(contents)\n\t}\n\n\treturn nil, err\n}", "title": "" }, { "docid": "19dd72867d9a431d8f5cb3c348f9f3e7", "score": "0.5034147", "text": "func (u *OpenStreetMapURLer) URL(zoom, x, y int) *url.URL {\n\tmapURL := *u.baseURL\n\tmapURL.Path = fmt.Sprintf(\"%v/%v/%v.png\", zoom, x, y)\n\treturn &mapURL\n}", "title": "" }, { "docid": "fb41e7a60c766d2dbe718301e80a13c4", "score": "0.5026657", "text": "func getURL(image imageInterface.Image) string {\n\treturn fmt.Sprintf(\"http://localhost/v1.24/images/%s/get\", urlEncodedName(image))\n}", "title": "" }, { "docid": "f26f999c48e27081a256eba72e883763", "score": "0.5026106", "text": "func (cf *Config) URL() string {\n\tu, q := cf.url()\n\treturn u.String() + \"?\" + q\n}", "title": "" }, { "docid": "9878053a01fc5243577733d683b2f3ee", "score": "0.5025968", "text": "func (h *TestHelper) GetRGWServiceURL() (string, error) {\n\tswitch h.platform {\n\tcase enums.Kubernetes:\n\t\thostip, err := h.GetPodHostID(\"rook-ceph-rgw\", h.namespace)\n\t\tif err != nil {\n\t\t\tpanic(fmt.Errorf(\"RGW pods not found/object store possibly not started\"))\n\t\t}\n\t\tendpoint := hostip + \":30001\"\n\t\treturn endpoint, err\n\tcase enums.StandAlone:\n\t\treturn \"NEED TO IMPLEMENT\", fmt.Errorf(\"NOT YET IMPLEMENTED\")\n\tdefault:\n\t\treturn \"\", fmt.Errorf(\"Unsupported Rook Platform Type\")\n\n\t}\n}", "title": "" }, { "docid": "8fd439a8615db26f7bb9fc76817df000", "score": "0.50227636", "text": "func (r *Repository) RemoteURL(name string) (string, error) {\n\tconfig, err := os.Open(filepath.Join(r.path, \"config\"))\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\tdefer config.Close()\n\tline := fmt.Sprintf(\"[remote %q]\", name)\n\tscanner := bufio.NewScanner(config)\n\tscanner.Split(bufio.ScanLines)\n\tfor scanner.Scan() {\n\t\tif scanner.Text() == line {\n\t\t\tscanner.Scan()\n\t\t\treturn strings.Split(scanner.Text(), \" = \")[1], nil\n\t\t}\n\t}\n\treturn \"\", fmt.Errorf(\"Remote %q not found.\", name)\n}", "title": "" }, { "docid": "e9e9bc90f9f1434e2423261a3ede0698", "score": "0.50143766", "text": "func (dsn Dsn) StoreAPIURL() *url.URL {\n\treturn dsn.getAPIURL(\"store\")\n}", "title": "" }, { "docid": "36acb6bbd10bb71ec9641f59af86c550", "score": "0.50091213", "text": "func (c *endpoint) URL() string {\n\tc.RLock()\n\tdefer c.RUnlock()\n\treturn c.url\n}", "title": "" }, { "docid": "3938db09e5db56649c361f908e463bb1", "score": "0.50045115", "text": "func (srv *Server) URL() string {\n\treturn srv.url\n}", "title": "" } ]
4bff07bba3158a947ec952676745a67c
NewHTML creates new template render with some option params
[ { "docid": "f372e13b7ce49fff1fb22536d73ffe67", "score": "0.5699843", "text": "func NewHTML(path, postfix string, enabledCache bool) *HTMLRender {\n\treturn New[*htmltemplate.Template, htmltemplate.Template, htmltemplate.FuncMap](path, postfix, enabledCache)\n}", "title": "" } ]
[ { "docid": "43cf8800f040265cfa9c9717058135cc", "score": "0.6831996", "text": "func newTemplate(funcMap template.FuncMap, filenames ...string) (TemplateExecutor, error) {\n\treturn template.New(\"html\").Funcs(funcMap).ParseFiles(filenames...)\n}", "title": "" }, { "docid": "8f972c44ebd835f42e11eeed7f29200f", "score": "0.6364115", "text": "func NewHTMLTemplate(tmpl ...string) (m *Mold, err error) {\n\tval := \"\"\n\tif len(tmpl) > 0 {\n\t\tval = tmpl[0]\n\t}\n\tm = &Mold{\n\t\tHTMLTemplate: val,\n\t}\n\tm.PDFGenerator, err = wkhtmltopdf.NewPDFGenerator()\n\treturn\n}", "title": "" }, { "docid": "eeb796ea4a602064f2bda9a01512ce1f", "score": "0.6042225", "text": "func createHTMLTemplates(appPaths paths.ApplicationPathsI, builder *tap.Builder, addAbout, addLocations bool, headTemplateFile string) error {\n\tfolderpaths := appPaths.GetPaths()\n\tif addAbout {\n\t\tbuilder.AddAbout()\n\t}\n\tcontents, err := buildIndexHTML(builder, addLocations, headTemplateFile)\n\tif err != nil {\n\t\treturn err\n\t}\n\tfpath := filepath.Join(folderpaths.OutputRendererTemplates, \"main.tmpl\")\n\tofile, err := os.OpenFile(fpath, os.O_CREATE|os.O_WRONLY, appPaths.GetFMode())\n\tif err != nil {\n\t\treturn err\n\t}\n\tif _, err = ofile.Write(contents); err != nil {\n\t\treturn err\n\t}\n\tif err := ofile.Close(); err != nil {\n\t\treturn err\n\t}\n\tservicePanelNamePathMap := builder.GenerateServiceEmptyInsidePanelNamePathMap()\n\tservicePanelMap := builder.GenerateServicePanelNameTemplateMap()\n\tfor service, nameMarkup := range servicePanelMap {\n\t\tpanelNamePathMap := servicePanelNamePathMap[service]\n\t\tfor name, markup := range nameMarkup {\n\t\t\tfolders := strings.Join(panelNamePathMap[name], string(os.PathSeparator))\n\t\t\tfolderPath := filepath.Join(folderpaths.OutputRendererTemplates, folders)\n\t\t\tif err := os.MkdirAll(folderPath, appPaths.GetDMode()); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t\tfname := fmt.Sprintf(\"%s.tmpl\", name)\n\t\t\tfpath := filepath.Join(folderPath, fname)\n\t\t\tofile, err := os.OpenFile(fpath, os.O_CREATE|os.O_WRONLY|os.O_TRUNC, appPaths.GetFMode())\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t\t_, err = ofile.Write([]byte(markup))\n\t\t\tif err := ofile.Close(); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "a391cc9da862c3c56c2d42a34ee5a87a", "score": "0.5840541", "text": "func newTemplateWithData(title string, data interface{}) *Template {\n\tpattern := filepath.Join(\"tmpl\", \"*.html\")\n\ttemplates := template.Must(template.ParseGlob(pattern))\n\treturn &Template{templates, title, data}\n}", "title": "" }, { "docid": "bc17b318127004fbf3252687489fd7e8", "score": "0.58334583", "text": "func Html(name, contentType, charSet string) template {\n\tif htmlTemp.Template == nil {\n\t\tpanic(\"Function `InitHtmlTemplates` should be called first.\")\n\t}\n\tif contentType == \"\" {\n\t\tcontentType = ContentTypeHTML\n\t}\n\tif charSet == \"\" {\n\t\tcharSet = CharSetUTF8\n\t}\n\theader := make(http.Header)\n\theader.Set(\"Content-Type\",\n\t\tfmt.Sprintf(\"%s; charset=%s\", contentType, charSet))\n\treturn template{&htmlTemp, name, header}\n}", "title": "" }, { "docid": "844366b4f9290de565a8dae645fc8034", "score": "0.5776967", "text": "func New(options ...Options) *Render {\n\tvar o Options\n\tif len(options) == 0 {\n\t\to = Options{}\n\t} else {\n\t\to = options[0]\n\t}\n\n\tr := Render{\n\t\topt: o,\n\t}\n\tr.opt.Charset = defaultCharset\n\tr.prepareOptions()\n\t//r.compileTemplates()\n\n\t// Create a new buffer pool for writing templates into.\n\tif bufPool == nil {\n\t\tbufPool = NewBufferPool(64)\n\t}\n\n\treturn &r\n}", "title": "" }, { "docid": "72daa5a6ce0690c77ab9d683e7071727", "score": "0.5769069", "text": "func generateHTML(writer http.ResponseWriter, data interface{}, fmap template.FuncMap, filenames ...string) {\n\n\tvar files []string\n\tfilenames = append([]string{\"layout.html\"}, filenames...) //prepend layout and pass variadic\n\tfor _, file := range filenames {\n\t\tfiles = append(files, fmt.Sprintf(\"templates/%s\", file))\n\t}\n\n\ttemplates := template.New(\"layout\")\n\ttemplates = templates.Funcs(fmap) //can be nil\n\ttemplates = template.Must(templates.ParseFiles(files...))\n\ttemplates.ExecuteTemplate(writer, \"layout\", data)\n}", "title": "" }, { "docid": "5e8b90146068494a5fc5509b6f5e4d5c", "score": "0.55898094", "text": "func New(options ...Options) *Render {\n\tvar o Options\n\tif len(options) > 0 {\n\t\to = options[0]\n\t}\n\n\tr := Render{opt: o}\n\n\tr.prepareOptions()\n\tr.CompileTemplates()\n\n\treturn &r\n}", "title": "" }, { "docid": "75b9ea6d652d508fdb1898d651af7136", "score": "0.5545938", "text": "func renderTemplate(w http.ResponseWriter, tmpl string, p *Page){\n err := templates.ExecuteTemplate(w, tmpl+\".html\", p)\n if err != nil{\n http.Error(w, err.Error(), http.StatusInternalServerError)\n }\n}", "title": "" }, { "docid": "8385ef8670effa17569e0e385a441a4f", "score": "0.5536315", "text": "func about(w http.ResponseWriter, r *http.Request) {\n data := struct {\n Title string\n About string\n }{\n \"About\",\n \"Lorem ipsum\",\n }\n templates.ExecuteTemplate(w, \"about.html\", &data)\n}", "title": "" }, { "docid": "d5afd9e3f79656e1380068e0afa92a8b", "score": "0.5494801", "text": "func TemplateNew(t *template.Template, name string) *template.Template", "title": "" }, { "docid": "ec318d3f85494b339dbcc5012578af6c", "score": "0.54813987", "text": "func TemplateOption(t *template.Template, opt ...string) *template.Template", "title": "" }, { "docid": "6353e5d8d9d01dd7681ebf46de385a62", "score": "0.5467392", "text": "func newTemplate(name string) *template.Template {\n\treturn template.New(name).Funcs(newTemplateFuncs())\n}", "title": "" }, { "docid": "4aa7e454a63864e1838decb535f0023a", "score": "0.5464403", "text": "func New(name string) *template.Template", "title": "" }, { "docid": "11e11712d5e1d0881db9b986762d76b3", "score": "0.5457878", "text": "func TemplateEmbed(writer http.ResponseWriter, request *http.Request) { //! dynamic template menggunakan directory\n\tt := template.Must(template.ParseFS(templates, \"template/*.gohtml\"))\n\tt.ExecuteTemplate(writer, \"simple.gohtml\", \"Hello Go Template HTML File\")\n}", "title": "" }, { "docid": "149dcf9605710ed75938227d736b2672", "score": "0.54151905", "text": "func newTemplate(name string) *template.Template {\n\tt := template.New(name).Funcs(templateFuncs)\n\treturn template.Must(vfstemplate.ParseFiles(templates.FileSystem, t, name))\n}", "title": "" }, { "docid": "7d8304355a72be12a17896fd13ff3d78", "score": "0.5408368", "text": "func writeImageWithTemplate(w http.ResponseWriter, img *image.Image, templStr string) {\r\n\r\n\tbuffer := new(bytes.Buffer)\r\n//\tif err := jpeg.Encode(buffer, *img, nil); err != nil {\r\n\tif err := png.Encode(buffer, *img); err != nil {\r\n\t\tlog.Fatalln(\"unable to encode image.\")\r\n\t}\r\n\r\n\tstr := base64.StdEncoding.EncodeToString(buffer.Bytes())\r\n\thtmlTemplate := \"FragenTemplate.html\"\r\n tmpl, err := template.ParseFiles(htmlTemplate)\r\n //tmpl, err := template.New(\"image\").Parse(templStr)\r\n\tif err != nil {\r\n\t\tlog.Println(\"unable to parse template.\")\r\n log.Println(htmlTemplate)\r\n\t} else {\r\n fmt.Printf(\"x0=%f, y0=%f, scale=%f, width=%d, height=%d\\n\", cfg.X0, cfg.Y0, cfg.Scale, cfg.Width, cfg.Height)\r\n\t\tdata := map[string]interface{} {\r\n \"Image\": str, \r\n \"Title\":\"Fragen\", \r\n \"scale\":cfg.Scale, \r\n \"width\":cfg.Width, \r\n \"height\":cfg.Height, \r\n \"x0\":cfg.X0, \r\n \"y0\":cfg.Y0,\r\n\t\t\t \"log\":duratn,\r\n\t\t\t \"paralel\":cfg.Parall,\r\n\t\t\t \"maxIter\":cfg.Max_iteration, \r\n\t\t\t \"showAxes\":getChecked(cfg.Axes),\r\n\t\t\t \"altMethod\":getChecked(method == 2),\r\n\t\t\t \"selPal\":selPal,\r\n\t\t\t \"palletes\":[]Option{Option{\"1\", \"Plan9\", selPal==\"1\"}, \r\n\t\t\t Option{\"2\", \"WebSafe\", selPal == \"2\"},\r\n\t\t\t Option{\"3\", \"Custom\", selPal==\"3\"},\r\n\t\t\t },\r\n\t\t\t }\r\n\t\t\r\n\t if (verbose) {\r\n log.Println(\"data = \") \r\n\t\t for k, v := range data {\t \r\n\t\t if (k != \"Image\") { log.Println(k, v) }\t\r\n\t\t } \r\n }\r\n\t\tif err = tmpl.Execute(w, data); err != nil {\r\n\t\t\tlog.Println(\"unable to execute template.\")\r\n\t\t}\r\n\t}\r\n}", "title": "" }, { "docid": "9e57e36dcde0c4ff0a03493e14d2bcf7", "score": "0.5391953", "text": "func template1Layout(w http.ResponseWriter, r *http.Request){\n http.ServeFile(w , r , \"template_struct.html\")\n}", "title": "" }, { "docid": "b13b6f2010f831ce6a4c79b1ee8fe42c", "score": "0.5366449", "text": "func renderTemplate(w io.Writer, name string, data interface{}) {\n\tif err := templates.ExecuteTemplate(w, name+\".html\", data); err != nil {\n\t\tpanic(err)\n\t}\n}", "title": "" }, { "docid": "b61257a6aad73303d39fbb11e8f03aad", "score": "0.5364281", "text": "func RenderTemplate(w http.ResponseWriter, tmpl string){\n tc, err := cache()\n\t if err != nil {\n\t\tlog.Fatal(err)\n\t}\n\n\ttemplate, ok := tc[tmpl]\n\tif !ok {\n\t\tlog.Fatal( err)\n\t}\n\n\t// add as bytes\n buff := new(bytes.Buffer)\n\t _ = template.Execute(buff, nil)\n\t_, err = buff.WriteTo(w)\n\t if err != nil {\n\t\tfmt.Printf(\"error writing template to browser. %+v\", err)\n\t}\n}", "title": "" }, { "docid": "f35704fef4b1aa900f3970f51e24e28a", "score": "0.5342781", "text": "func (op *Operator) NewHtml() *Html {\n\treturn &Html{\n\t\top,\n\t}\n}", "title": "" }, { "docid": "14d418131dc0fb81ccfbdf84ffb1b39d", "score": "0.5339264", "text": "func New(name string) *Template {}", "title": "" }, { "docid": "7a5fa58f4be47569bacf6c5ad06c25f3", "score": "0.5299821", "text": "func tmpl(page string) *template.Template { return template.Must(template.New(\"\").Parse(page)) }", "title": "" }, { "docid": "90d6a3d5844d1b1cfbfb67da08f16068", "score": "0.5294287", "text": "func GenerateHTML(elements Elements, w io.Writer) error {\n\t// Take the info from gg struct and json indent it to a string\n\n\tjsonString, err := json.MarshalIndent(elements, \"\", \" \")\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tvars := struct {\n\t\tElements string\n\t}{\n\t\tElements: string(jsonString),\n\t}\n\n\tt, err := template.New(\"graph\").Parse(htmlTemplate)\n\tif err != nil {\n\t\treturn err\n\t}\n\terr = t.Execute(w, vars)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "4618f5465086b6875a820eb8850d6c4b", "score": "0.52664703", "text": "func defTemplate(name string, text string) *template.Template {\n\treturn template.Must(rootTemplate.New(name).Parse(escape(text)))\n}", "title": "" }, { "docid": "10518ab706e1dd7d716d1dee2a904556", "score": "0.52580106", "text": "func main() {\n\terr := tmp.ExecuteTemplate(os.Stdout, \"tmp.html\", 5.0)\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n}", "title": "" }, { "docid": "8edc051c6c886e42499b72f11163353c", "score": "0.523674", "text": "func newappTemplate(filename string) *appTemplate {\n\tvar tmpl *template.Template\n\tpath := strings.Join([]string{\"tools/templates\", filename}, \"/\")\n\n\tif filename == \"index.html\" {\n\t\tb, err := ioutil.ReadFile(\"tools/templates/base.html\")\n\t\tif err != nil {\n\t\t\tpanic(fmt.Errorf(\"could not read template: %v\", err))\n\t\t}\n\t\tba := strings.Replace(string(b), \"{{template \\\"sidebar\\\" .User}}\", \"\", 1)\n\t\tba = strings.Replace(string(ba), \"w3-hide-small\\\" id=\\\"forIndex\\\"\", \"\\\" id=\\\"forIndexA\\\"\", 3)\n\t\ttmpl = template.Must(template.New(\"base\").Parse(ba))\n\t\ttmpl.ParseFiles(\"tools/templates/chat.html\", \"tools/templates/index.html\")\n\t} else if filename == \"market.html\" {\n\t\ttmpl = template.Must(template.ParseFiles(\"tools/templates/base.html\", \"tools/templates/chat.html\", \"tools/templates/sidebar.html\", path))\n\t} else {\n\t\ttmpl = template.Must(template.ParseFiles(\"tools/templates/base.html\", \"tools/templates/chat.html\", \"tools/templates/sidebar.html\", path))\n\t}\n\n\treturn &appTemplate{t: tmpl}\n}", "title": "" }, { "docid": "cbd3fb2e2380bc9010bb3bd53b0a8f4e", "score": "0.5236095", "text": "func (l *Life) renderTemplate() {\n\t// reach here means I can find the template and render it.\n\t// debug.Log(\"-755- [TemplateSelect] %v -> %v\", identity, templatePath)\n\tvar (\n\t\tengine *core.TemplateEngine\n\t\terr error\n\t)\n\tif _, engine, err = templates.LoadTemplates(l.registry, config.ReloadTemplate); err != nil {\n\t\tpanic(err)\n\t}\n\n\tif err := engine.RenderTemplate(&l.out, l.registry.Identity(), l.proton); err != nil {\n\t\tpanic(err)\n\t}\n\n\t// PageHeadBootstrap Replace\n\t// TODO BIG Performance issue.\n\tif l.kind == core.PAGE {\n\t\tvar start = time.Now().UnixNano()\n\t\tvar dur int64\n\t\tif headbs, ok := l.proton.Embed(\"PageHeadBootstrap\"); ok {\n\n\t\t\tvar blockhtml bytes.Buffer\n\t\t\tlife := headbs.FlowLife().(*Life)\n\n\t\t\t// BUG: What if this block not exists??\n\t\t\tif err := engine.RenderBlockIfExist(&blockhtml, life.registry.Identity(),\n\t\t\t\t\"page_head_bootstrap_defer_block\", headbs); err != nil {\n\t\t\t\tpanic(err)\n\t\t\t}\n\n\t\t\tvar PLACEHOLDER string = \"(____PageHeadBootstrap_replace_to_html____)\"\n\t\t\tnewbuf := replaceInBuffer(&l.out, PLACEHOLDER, blockhtml.Bytes())\n\t\t\tl.out = *newbuf\n\n\t\t\t// var html string = l.out.String()\n\t\t\t// if index := strings.Index(html, PLACEHOLDER); index > 0 {\n\t\t\t// \tvar newout bytes.Buffer\n\t\t\t// \tnewout.WriteString(html[:index])\n\n\t\t\t// \t// debug print time\n\t\t\t// \tdur = (time.Now().UnixNano() - start)\n\t\t\t// \tnewout.WriteString(fmt.Sprintf(\"<br/><br/><br/>Head duration is: %d ms\", dur/1000))\n\t\t\t// \t// append final\n\t\t\t// \tnewout.WriteString(html[index+len(PLACEHOLDER):])\n\t\t\t// \tl.out = newout\n\t\t\t// }\n\t\t}\n\n\t\tdur = (time.Now().UnixNano() - start)\n\t\tfmt.Println(\"[Performance] Time for ReplacePageHeadBootStrap is: \",\n\t\t\tdur/1000, \"ms.\")\n\t}\n}", "title": "" }, { "docid": "59edc5aa05736a8eadec506e3f521936", "score": "0.5230803", "text": "func serveTemplate(w http.ResponseWriter, r *http.Request) {\n\t// redirect /page/ to /page unless it's homepage\n\tif r.URL.Path != \"/\" && strings.HasSuffix(r.URL.Path, \"/\") {\n\t\ttrimmed := path.Join(config.Prefix, strings.TrimSuffix(r.URL.Path, \"/\"))\n\t\thttp.Redirect(w, r, trimmed, http.StatusFound)\n\t\treturn\n\t}\n\n\tc := newContext(r)\n\tr.ParseForm()\n\t_, wantsPartial := r.Form[\"partial\"]\n\t_, experimentShare := r.Form[\"experiment\"]\n\n\ttplname := strings.TrimPrefix(r.URL.Path, \"/\")\n\tif tplname == \"\" {\n\t\ttplname = \"home\"\n\t}\n\n\t// TODO: move all template-related stuff to template.go\n\tdata := &templateData{Canonical: canonicalURL(r, nil)}\n\tswitch {\n\tcase experimentShare:\n\t\tdata.OgTitle = defaultTitle\n\t\tdata.OgImage = ogImageExperiment\n\t\tdata.Desc = descExperiment\n\tcase !wantsPartial && r.URL.Path == \"/schedule\":\n\t\tsid := r.FormValue(\"sid\")\n\t\tif sid == \"\" {\n\t\t\tbreak\n\t\t}\n\t\ts, err := getSessionByID(c, sid)\n\t\tif err != nil {\n\t\t\tbreak\n\t\t}\n\t\tdata.Canonical = canonicalURL(r, url.Values{\"sid\": {sid}})\n\t\tdata.Title = s.Title + \" - Google I/O Schedule\"\n\t\tdata.OgTitle = data.Title\n\t\tdata.OgImage = s.Photo\n\t\tdata.Desc = s.Desc\n\t}\n\n\tw.Header().Set(\"Content-Type\", \"text/html;charset=utf-8\")\n\tif !isDevServer() {\n\t\tw.Header().Set(\"Content-Security-Policy\", \"upgrade-insecure-requests\")\n\t}\n\n\tb, err := renderTemplate(c, tplname, wantsPartial, data)\n\tif err == nil {\n\t\tw.Header().Set(\"Cache-Control\", \"public, max-age=300\")\n\t\tw.Write(b)\n\t\treturn\n\t}\n\n\terrorf(c, \"renderTemplate(%q): %v\", tplname, err)\n\tswitch err.(type) {\n\tcase *os.PathError:\n\t\tw.WriteHeader(http.StatusNotFound)\n\t\ttplname = \"error_404\"\n\tdefault:\n\t\tw.WriteHeader(http.StatusInternalServerError)\n\t\ttplname = \"error_500\"\n\t}\n\tif b, err = renderTemplate(c, tplname, false, nil); err == nil {\n\t\tw.Write(b)\n\t} else {\n\t\terrorf(c, \"renderTemplate(%q): %v\", tplname, err)\n\t}\n}", "title": "" }, { "docid": "adeb7a3b691594e6c544701abae9db52", "score": "0.52298915", "text": "func execTemplate(t *template.Template, name string, data interface{}) (template.HTML, error) {\n\tb := new(bytes.Buffer)\n\terr := t.ExecuteTemplate(b, name, data)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\treturn template.HTML(b.String()), nil\n}", "title": "" }, { "docid": "0017832cf7ef34b57b3cc9010cfdc883", "score": "0.52276057", "text": "func renderTemplate(w http.ResponseWriter, tmpl string, p *Page){\n\terr := templates.ExecuteTemplate(w, tmpl+\".html\", p)\n\tif err != nil{\n\t\thttp.Error(w, err.Error(), http.StatusInternalServerError)\n\t}\n}", "title": "" }, { "docid": "386a0751ea0b41281a2ecd1f701911b1", "score": "0.5218343", "text": "func doHTML(fields map[string]string) string {\n\thtmlLines := make([]string, len(fields))\n\tfieldNames := make([]string, len(fields))\n\tfieldNo := 0\n\tfor fieldName := range fields {\n\t\tfieldNames[fieldNo] = fieldName\n\t\tfieldNo++\n\t}\n\tsort.Sort(sort.StringSlice(fieldNames))\n\tfor lineNo, fieldName := range fieldNames {\n\t\tfieldType := fields[fieldName]\n\t\tfield := htmlInput{\n\t\t\tName: fieldName,\n\t\t\tType: fieldType,\n\t\t}\n\t\tvar htmlLine bytes.Buffer\n\t\thtmlLineTemplate.Execute(&htmlLine, field)\n\t\thtmlLines[lineNo] = htmlLine.String()\n\t}\n\treturn fmt.Sprintf(formTemplate, strings.Join(htmlLines, \"\\n\"))\n}", "title": "" }, { "docid": "e84865ea24d861323a8243ee6adb0747", "score": "0.52172345", "text": "func (r *REParams) Template() string {\n\treturn \"${remoteexec.Wrapper}\" + r.wrapperArgs()\n}", "title": "" }, { "docid": "15f7d60fad1821574145971887b12804", "score": "0.52160746", "text": "func AddHtmlTemplate(name string, htmpl *ht.Template) {\n\t_ctx.tmplsH[name] = htmpl\n}", "title": "" }, { "docid": "a092de5922007fc3ad648a3f28eadfdc", "score": "0.521385", "text": "func showTemplate(w http.ResponseWriter, values interface{}, htmlFilesInResource ...string) {\n\tt, err := template.ParseFiles(htmlFilesInResource...)\n\tif err != nil {\n\t\tlog.Println(err)\n\t\thttp.Error(w, `Error on Parsing Template`, http.StatusInternalServerError)\n\t\treturn\n\t}\n\tt.Execute(w, values)\n}", "title": "" }, { "docid": "b50cdedb102086b9f3abca9a0084e64f", "score": "0.52105767", "text": "func writeHTML(file string, results []result) error {\n\tbrowser := file == \"\"\n\n\ttmpl := template.Must(template.New(\"html\").Parse(htmlTemplate))\n\n\tif browser {\n\t\tdir, err := ioutil.TempDir(\"\", \"golinters\")\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\tfile = filepath.Join(dir, \"golinters.html\")\n\t}\n\n\tout, err := os.Create(file)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tdefer out.Close()\n\n\tdata := TemplateData{\n\t\tTimestamp: time.Now().Format(time.RFC1123),\n\t\tResults: results,\n\t}\n\n\terr = tmpl.Execute(out, data)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tif browser {\n\t\topen.Run(\"file://\" + out.Name())\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "38b559fc4c1c58be8595048cb224a7a8", "score": "0.5204592", "text": "func GetNewServerTemplate(cc CodeConfig) string {\n\treturn `\n\t{{$timeStampHeader := .TimeStampHeader true}}\n\tpackage webserver\n\n\t{{$timeStampHeader}}\n\n\timport (\n\t\t\"log\"\n\t\t\"net/http\"\n\t\t\"net/http/httputil\"\n\n\t\t\"github.com/go-martini/martini\"\n\t\t\"github.com/martini-contrib/cors\"\n\t\t\"github.com/martini-contrib/gorelic\"\n\t\t\"github.com/martini-contrib/render\"\n\t\t\"github.com/twinj/uuid\"\n\t\tcfg \"{{.GoPath}}/config\"\n\t\tgapi \"github.com/obieq/gson-api\"\n\t\troutes \"{{.GoPath}}/app/routes\"\n\t)\n\n // API_SERVER_INFO => used to construct relationship urls in responses\n\t// should pull values from config settings\n var API_SERVER_INFO = gapi.JSONApiServerInfo{BaseURL: \"http://my.domain\", Prefix: \"v1\"}\n\n\t// Server => Wrap the Martini server struct.\n\ttype Server *martini.ClassicMartini\n\n\t// NewServer => Constructor\n\tfunc NewServer() Server {\n\t\t// switch the uuid format\n\t\tuuid.SwitchFormat(uuid.CleanHyphen)\n\n\t\t// configure martini\n\t\tm := Server(martini.Classic())\n\n\t\t// configure NewRelic\n if cfg.Config.NewRelicKey != \"\" {\n gorelic.InitNewrelicAgent(cfg.Config.NewRelicKey, \"{{.AppName}}-\"+cfg.Config.Environment, true)\n m.Use(gorelic.Handler)\n }\n\n\t\t// Martini Renderer\n\t\tm.Use(render.Renderer())\n\n\t\tif cfg.Config.Debug {\n\t\t\t// Intercept all HTTP Requests and dump to console\n\t\t\tm.Use(func(req *http.Request) {\n\t\t\t\tlog.Println(\"-- BEGIN HTTP REQUEST INTERCEPTOR (DON'T RUN IN PRODUCTION!!) ---\")\n\t\t\t\tdump, _ := httputil.DumpRequest(req, true)\n\t\t\t\tlog.Println(string(dump))\n\t\t\t\tlog.Println(\"--- END HTTP REQUEST INTERCEPTOR (DON'T RUN IN PRODUCTION!!) ---\")\n\t\t\t})\n\t\t}\n\n\t\t// CORS configuration\n\t\tm.Use(cors.Allow(&cors.Options{\n\t\t\tAllowAllOrigins: true,\n\t\t\t//AllowOrigins:     []string{\"https://*.foo.com\"},\n\t\t\t// NOTE: no need to allow PUT b/c PATCH suffices\n\t\t\tAllowMethods: []string{\"PATCH\", \"GET\", \"POST\", \"DELETE\", \"OPTIONS\"},\n\t\t\tAllowHeaders: []string{\"Origin\", \"X-Requested-With\", \"Content-Type\", \"Accept\", \"X-AUTH-TOKEN\", \"X-API-VERSION\"},\n\t\t\tExposeHeaders: []string{\"Content-Length\"},\n\t\t\tAllowCredentials: true,\n\t\t}))\n\n\t\t// Default Route, which returns the App's Version and Deployment Environment\n\t m.Get(\"/\", func() (int, string) {\n\t\t\treturn 200, cfg.Config.Version + \"\\n\" + cfg.Config.Environment\n\t })\n\n\t // Controller Routes\n\t\tm.Group(\"/v1\", func(r martini.Router) {\n\t\t\t// routes.LoadExampleRoutes(r, API_SERVER_INFO)\n\t\t})\n\n\t\treturn m\n\t}`\n}", "title": "" }, { "docid": "ca22fcd5ef1b626d0f17024e2ed263d7", "score": "0.5184135", "text": "func (r *Renderer) executeHTMLTemplate(w io.Writer, name string, data interface{}) error {\n\tr.templatesLock.RLock()\n\tdefer r.templatesLock.RUnlock()\n\n\tif r.templates == nil {\n\t\treturn fmt.Errorf(\"no html templates are defined\")\n\t}\n\n\treturn r.templates.ExecuteTemplate(w, name, data)\n}", "title": "" }, { "docid": "3fe0fdfca434324adfaba862ef398ce2", "score": "0.5182317", "text": "func newPage(path, url string, data tpl.DataFunc) (*page, error) {\n\t// parse the template\n\tt, err := tpl.GetTemplate(path)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn &page{\n\t\t// store the template\n\t\tt,\n\t\t// store the template name\n\t\tfilepath.Base(path),\n\t\t// store the url\n\t\turl,\n\t\t// store the data function\n\t\tdata,\n\t\t// get the mime type from the file extension\n\t\tmime.TypeByExtension(filepath.Ext(path))}, nil\n}", "title": "" }, { "docid": "353a64153486ebce373bf02df4b813ae", "score": "0.51705015", "text": "func (c *Context) HTML(code int, name string, data interface{}) {\n\tc.SetHeader(\"Content-Type\", \"text/html\")\n\tc.Status(code)\n\tif err := c.engine.htmlTemplates.ExecuteTemplate(c.Writer, name, data); err != nil {\n\t\tc.Fail(500, err.Error())\n\t}\n}", "title": "" }, { "docid": "a06c120d83db20e41e9b8655c170d5a5", "score": "0.51625204", "text": "func executeTemplate(context *common.AppContext, name string, params map[string]interface{}) []byte {\n\tcontext.Log.Println(\"Executing template named\", name)\n\tt, err := template.ParseFiles(\"views/\" + name + \".html\")\n\tif err != nil {\n\t\treturn nil\n\t}\n\tmarkup := new(bytes.Buffer)\n\terr = t.Execute(markup, params)\n\tif err != nil {\n\t\tcontext.Log.Panic(err)\n\t\treturn nil\n\t}\n\treturn markup.Bytes()\n}", "title": "" }, { "docid": "4cb19426014dc618635758863e70e60e", "score": "0.515522", "text": "func renderTemplate(w http.ResponseWriter, tmpl string, p *Page) {\r\n t, err := template.ParseFiles(tmpl + \".html\")\r\n if err != nil {\r\n http.Error(w, err.Error(), http.StatusInternalServerError)\r\n return\r\n }\r\n err = t.Execute(w, p)\r\n if err != nil {\r\n http.Error(w, err.Error(), http.StatusInternalServerError)\r\n }\r\n}", "title": "" }, { "docid": "86148b7953ba95ba48ef801e22b63e54", "score": "0.5148607", "text": "func (ui *webInterface) render(w http.ResponseWriter, req *http.Request, tmpl string,\n\trpt *report.Report, errList, legend []string, data webArgs) {\n\tfile := getFromLegend(legend, \"File: \", \"unknown\")\n\tprofile := getFromLegend(legend, \"Type: \", \"unknown\")\n\tdata.Title = file + \" \" + profile\n\tdata.Errors = errList\n\tdata.Total = rpt.Total()\n\tdata.SampleTypes = sampleTypes(ui.prof)\n\tdata.Legend = legend\n\tdata.Help = ui.help\n\tdata.Configs = configMenu(ui.settingsFile, *req.URL)\n\n\thtml := &bytes.Buffer{}\n\tif err := ui.templates.ExecuteTemplate(html, tmpl, data); err != nil {\n\t\thttp.Error(w, \"internal template error\", http.StatusInternalServerError)\n\t\tui.options.UI.PrintErr(err)\n\t\treturn\n\t}\n\tw.Header().Set(\"Content-Type\", \"text/html\")\n\tw.Write(html.Bytes())\n}", "title": "" }, { "docid": "7d326fb3443e6de9bc38f4b78c2663bd", "score": "0.5144706", "text": "func TestCreateFromHtml(t *testing.T) {\n\tc := slidescloud.GetTestApiClient()\n\t_, e := c.SlidesApi.DeleteFile(folderName+\"/\"+fileName, \"\", \"\")\n\tif e != nil {\n\t\tt.Errorf(\"Error: %v.\", e)\n\t\treturn\n\t}\n\t_, _, e = c.SlidesApi.ImportFromHtml(fileName, \"<html><body>New Content</body></html>\", \"\", folderName, \"\")\n\tif e != nil {\n\t\tt.Errorf(\"Error: %v.\", e)\n\t\treturn\n\t}\n}", "title": "" }, { "docid": "0be143821e8eea9c87e0ee7b76f607f1", "score": "0.5118558", "text": "func renderTemplate(w http.ResponseWriter, tmpl string, p *Page) {\n\tt, _ := template.ParseFiles(\"./template/\" + tmpl + \".html\")\n\tt.Execute(w, p)\n\n\t// TODO: キャッシュ有効化templateFile\n\t// templateFile := \"./template/\" + tmpl + \".html\"\n\t// err := templates.ExecuteTemplate(w, templateFile, p)\n\t// if err != nil {\n\t// \tprintln(err.Error())\n\t// \thttp.Error(w, err.Error(), http.StatusInternalServerError)\n\t// }\n}", "title": "" }, { "docid": "c8cb9debcbd57b4c116ee869a178e919", "score": "0.5107951", "text": "func buildIndexHTML(builder *tap.Builder, addLocations bool, headTemplateFile string) ([]byte, error) {\n\thead, err := buildHead(builder, headTemplateFile)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tdata := &struct {\n\t\tClasses *tap.Classes\n\t\tHead string\n\t\tTabsMasterView string\n\t}{\n\t\tClasses: builder.Classes,\n\t\tHead: head,\n\t\tTabsMasterView: builder.ToHTML(tabsMasterViewID, initialIndent, addLocations),\n\t}\n\t// execute the template\n\tvar bb bytes.Buffer\n\tt := template.Must(template.New(\"index.html\").Parse(templates.IndexHTML))\n\tif err := t.Execute(&bb, data); err != nil {\n\t\treturn nil, err\n\t}\n\treturn bb.Bytes(), nil\n}", "title": "" }, { "docid": "8dd7236cc57bd685c702683353401a83", "score": "0.50809115", "text": "func SendHTMLTmpl(to, subject, tmplName string, data map[string]interface{}) {\n\tm := new(to, subject)\n\n\t// add host\n\tm.AddAlternativeWriter(\"text/html\", func(w io.Writer) error {\n\t\treturn tmpl.Lookup(tmplName).Execute(w, data)\n\t})\n\n\t// add to channel\n\tch <- m\n}", "title": "" }, { "docid": "c4ae2ef3483e96af999500abed37ec36", "score": "0.5080725", "text": "func renderTemplate(w http.ResponseWriter, tmpl string, p *Page) {\n\n\terr := temp.ExecuteTemplate(w, tmpl+\".html\", p)\n\tif err != nil {\n\t\thttp.Error(w, err.Error(), http.StatusInternalServerError)\n\t}\n}", "title": "" }, { "docid": "f061179fc6facf6a55585a479872240c", "score": "0.50734067", "text": "func RenderHTML(w http.ResponseWriter, r *http.Request, path string, data interface{}, funcs ...interface{}) {\n\tvar err error\n\tvar funcVal reflect.Value\n\tvar funcName string\n\n\tfuncMap := template.FuncMap{\n\t\t\"Tf\": Tf,\n\t\t\"CSRF\": func() string {\n\t\t\treturn getSession(r)\n\t\t},\n\t}\n\n\tfor i := range funcs {\n\t\tfuncVal = reflect.ValueOf(funcs[i])\n\t\tif funcVal.Type().Kind() != reflect.Func {\n\t\t\tTrail(WARNING, \"Interface passed to RenderHTML in funcs parameter should only be a function. Got (%s) in position %d\", funcVal.Type().Kind(), i)\n\t\t\tcontinue\n\t\t}\n\n\t\tfuncName = runtime.FuncForPC(funcVal.Pointer()).Name()\n\t\tfuncName = funcName[strings.LastIndex(funcName, \".\")+1:]\n\t\tfuncMap[funcName] = funcs[i]\n\t}\n\n\t// Check for ABTesting cookie\n\tif cookie, err := r.Cookie(\"abt\"); err != nil || cookie == nil {\n\t\tnow := time.Now().AddDate(0, 0, 1)\n\t\tcookie = &http.Cookie{\n\t\t\tName: \"abt\",\n\t\t\tValue: fmt.Sprint(now.Second()),\n\t\t\tPath: \"/\",\n\t\t\tExpires: time.Date(now.Year(), now.Month(), now.Day(), 0, 0, 0, 0, now.Location()),\n\t\t}\n\t\thttp.SetCookie(w, cookie)\n\t}\n\n\tt := template.New(\"\").Funcs(funcMap)\n\tt, err = t.ParseFiles(path)\n\tif err != nil {\n\t\tw.WriteHeader(500)\n\t\tfmt.Fprint(w, html.EscapeString(err.Error()))\n\t\tTrail(ERROR, \"RenderHTML unable to parse %s. %s\", path, err)\n\t\treturn\n\t}\n\n\tpath = filepath.Base(path)\n\terr = t.ExecuteTemplate(w, path, data)\n\tif err != nil {\n\t\tignoredErrors := []string{\n\t\t\t\"write tcp\",\n\t\t}\n\t\tfor i := range ignoredErrors {\n\t\t\tif strings.HasPrefix(err.Error(), ignoredErrors[i]) {\n\t\t\t\treturn\n\t\t\t}\n\t\t}\n\t\tTrail(ERROR, \"Unable to render html template file (%s). %s\", path, err)\n\t}\n}", "title": "" }, { "docid": "aeab3a29ba7447b35d03b1fd9f59ac31", "score": "0.5068767", "text": "func Render(w http.ResponseWriter, data interface{}, tmpls ...string) {\n\tif len(tmpls) < 1 {\n\t\tlg.Log.Printf(\"error Render()... tmpls<1\")\n\t\tpanic(\"at the disco\")\n\t}\n\n\t// this name is for my code to cache the template and\n\t// refer back to it. In my setup/scheme, it's the last\n\t// template that is the unique and defining one.\n\tpage := tmpls[len(tmpls)-1]\n\t//page := filepath.Base(tmpls[0])\n\n\tlg.Log.Printf(\"Render(%s)...\", page)\n\theaders := w.Header()\n\theaders.Add(\"Content-Type\", \"text/html\")\n\t_, tmpl_exists := _tmpls[page]\n\tif !tmpl_exists {\n\t\tdir, err := os.Getwd()\n\t\tif err != nil {\n\t\t\tpanic(err)\n\t\t}\n\t\tif e := os.Chdir(\"tmpl/\"); e != nil {\n\t\t\tpanic(e)\n\t\t}\n\n\t\t// this name is like saying {{define \"name\"}}...\n\t\t// which is a feature I don't use in this setup\n\t\tname := filepath.Base(tmpls[0])\n\t\tt := template.New(name)\n\t\tt.Funcs(GlobalFuncMap)\n\n\t\t_, err = t.ParseFiles(tmpls...)\n\t\tif err != nil {\n\t\t\tpanic(err)\n\t\t}\n\t\t_tmpls[page] = t\n\n\t\tif e := os.Chdir(dir); e != nil {\n\t\t\tpanic(e)\n\t\t}\n\t}\n\terr := _tmpls[page].Execute(w, data)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n}", "title": "" }, { "docid": "4e4965c8a7636568b08b57aba2cf1376", "score": "0.506354", "text": "func CreateIndexHTML() []byte {\n\n\ttempl := template.New(\"index.html\")\n\tt, err := templ.ParseFiles(\"./templates/index.html\")\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\n\tbuf := bytes.NewBuffer(nil)\n\n\terr = t.Execute(buf, config)\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\n\treturn buf.Bytes()\n}", "title": "" }, { "docid": "2a2f17526bfa4990650a6a5d94862443", "score": "0.5063064", "text": "func init(){\r\n\tallContent = make(map[string]htmlTemplateData,50) \r\n\tmyHtmlTemplate = template.Must(template.ParseFiles(\"templatePage.html\"))\r\n}", "title": "" }, { "docid": "40e64af8ec20c05face68197a0793ab1", "score": "0.5017043", "text": "func init() {\n\ttpl = template.Must(template.New(\"\").Funcs(fm).ParseFiles(\"tpl.gohtml\"))\n}", "title": "" }, { "docid": "76a84e02461c2d715dba1f301fb375ed", "score": "0.501565", "text": "func RenderTemplate(w http.ResponseWriter, r *http.Request, name string, data map[string]interface{}) {\n\tif data == nil {\n\t\tdata = map[string]interface{}{}\n\t}\n\tdata[\"CurrentUser\"] = RequestUser(r)\n\tdata[\"Flash\"] = r.URL.Query().Get(\"flash\")\n\tfuncs := template.FuncMap{\n\t\t\"yield\": func() (template.HTML, error) {\n\t\t\tbuf := bytes.NewBuffer(nil)\n\t\t\ttemplates.ExecuteTemplate(buf, name, data)\n\t\t\treturn template.HTML(buf.String()), nil\n\t\t},\n\t}\n\n\tcloneLayout, _ := layout.Clone()\n\tcloneLayout.Funcs(funcs)\n\n\terr := cloneLayout.Execute(w, data)\n\tif err != nil {\n\t\thttp.Error(w, fmt.Sprintf(errorTemplate, name, err), http.StatusInternalServerError)\n\t}\n}", "title": "" }, { "docid": "bcb7def8b79fdd210fd1c27c9564a784", "score": "0.50141746", "text": "func (c *Context) HTML(status int, name string) {\n\t// log.Infof(\"Template:%s\", name)\n\tc.Context.HTML(status, name)\n}", "title": "" }, { "docid": "b2d561f2cdba63f0fadb769388a1030a", "score": "0.49993396", "text": "func renderTemplate(w http.ResponseWriter, tmpl string, p *Page) {\n\terr := gTemplates.ExecuteTemplate(w, tmpl+\".html\", p)\n\tif err != nil {\n\t\thttp.Error(w, err.Error(), http.StatusInternalServerError)\n\t}\n}", "title": "" }, { "docid": "02b267d56ba9ce77f239e0562692ea18", "score": "0.49788302", "text": "func (e *Executor) render(templateCfg config.AnalysisTemplateSpec, customArgs map[string]string) (*config.AnalysisTemplateSpec, error) {\n\targs := templateArgs{\n\t\tArgs: customArgs,\n\t\tApp: struct {\n\t\t\tName string\n\t\t\tEnv string\n\t\t\t// TODO: Populate Env\n\t\t}{Name: e.Application.Name, Env: \"\"},\n\t}\n\tif e.config.Kind == config.KindKubernetesApp {\n\t\tnamespace := \"default\"\n\t\tif n := e.config.KubernetesDeploymentSpec.Input.Namespace; n != \"\" {\n\t\t\tnamespace = n\n\t\t}\n\t\targs.K8s = struct{ Namespace string }{Namespace: namespace}\n\t}\n\n\tcfg, err := json.Marshal(templateCfg)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"failed to marshal json: %w\", err)\n\t}\n\tt, err := template.New(\"AnalysisTemplate\").Parse(string(cfg))\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"failed to parse text: %w\", err)\n\t}\n\tb := new(bytes.Buffer)\n\tif err := t.Execute(b, args); err != nil {\n\t\treturn nil, fmt.Errorf(\"failed to apply template: %w\", err)\n\t}\n\tnewCfg := &config.AnalysisTemplateSpec{}\n\terr = json.Unmarshal(b.Bytes(), newCfg)\n\treturn newCfg, err\n}", "title": "" }, { "docid": "bec6106252db37b9c19af4e144063e3a", "score": "0.49583748", "text": "func handleTemplate(w http.ResponseWriter, arg string, queryParams url.Values) {\n\ttplFileName := filepath.Join(\"testdata\", arg+\".tpl\")\n\ttplFile, err := afero.ReadFile(fs, tplFileName)\n\tif os.IsNotExist(err) {\n\t\thandleHTTPCode(w, \"404\")\n\t\treturn\n\t}\n\tif handleError(w, err) {\n\t\treturn\n\t}\n\tt, err := template.New(\"response\").Parse(string(tplFile))\n\tif handleError(w, err) {\n\t\treturn\n\t}\n\tdata := map[string]string{}\n\tfor k, vs := range queryParams {\n\t\tdata[k] = vs[len(vs)-1]\n\t}\n\thandleError(w, t.Execute(w, data))\n}", "title": "" }, { "docid": "4d389fc637610e06faad2a6d4be4aad9", "score": "0.49451944", "text": "func CreateRawHtml(sections []OutputSection) string {\n\thtmlStart := `<!DOCTYPE html>\n <html>\n <head><meta charset=\"UTF-8\"></head>\n <body>\n <h1>Sponge</h1>`\n\thtmlEnd := \"</body></html>\"\n\n\tvar sectionsHtmlList []string\n\n\tfor _, section := range sections {\n\t\tsectionsHtmlList = append(sectionsHtmlList, section.toHtml())\n\t\tfmt.Printf(\"formatted %d %s items\\n\", len(section.Items), section.Name)\n\t}\n\n\tsectionsHtml := strings.Join(sectionsHtmlList, \"\")\n\n\treturn fmt.Sprintf(\"%s%s%s\", htmlStart, sectionsHtml, htmlEnd)\n}", "title": "" }, { "docid": "a8ee6a849d21723320eaf2a4dbb9250f", "score": "0.4944049", "text": "func service(w http.ResponseWriter, r *http.Request) {\n data := struct {\n Title string\n Service string\n }{\n \"Service\",\n \"this should be a list where I name the things I do\",\n }\n templates.ExecuteTemplate(w, \"service.html\", &data)\n}", "title": "" }, { "docid": "81ac3649a59ab18464debff66030018f", "score": "0.49407592", "text": "func RenderTemplate(w http.ResponseWriter, tmpl string, td *models.TemplateData) {\n\n\t// Develop mode / Production mode\n\t// use cached template if production mode\n\t// load new cache every time if development mode\n\tvar tc map[string]*template.Template\n\tif app.UseCache {\n\t\t// get templates cache from the app config\n\t\ttc = app.TemplateCache\n\t} else {\n\t\ttc, _ = CreateTemplateCache()\n\t}\n\n\t// get the current template\n\tt, ok := tc[tmpl]\n\tif !ok {\n\t\tlog.Fatal(\"could not get template the from templates cache\")\n\t}\n\n\t// allocates the memory as bytes\n\tbuf := new(bytes.Buffer)\n\n\t// wrting template to the buffer\n\ttd = addDefaultData(td)\n\t_ = t.Execute(buf, td)\n\n\t// drain the buffer to browser\n\t_, err := buf.WriteTo(w)\n\tif err != nil {\n\t\tfmt.Println(\"Error writing template to browser\", err)\n\t}\n\n}", "title": "" }, { "docid": "63ca6f23a8f95f9b7d7c61fa70a803f1", "score": "0.49375746", "text": "func (t *Template) Option(opt ...string) *Template {}", "title": "" }, { "docid": "28b22ffd85e7532de17f00b5493a251f", "score": "0.49363637", "text": "func (d *Doc) addTemplateInside(filename string, mountPoint string, data interface{}) *Doc {\n\tt := newTemplateWithData(filename, data)\n\n\tif mountPoint == \"\" {\n\t\td.Find(\"body\").SetHtml(t.String())\n\t} else {\n\t\td.Find(mountPoint).SetHtml(t.String())\n\t}\n\n\treturn d\n}", "title": "" }, { "docid": "678817a1fd24975a41bd49454b67cd5d", "score": "0.4926972", "text": "func (r TemplateHTML) Render(w http.ResponseWriter) error {\n\tr.WriteContentType(w)\n\tr.once.Do(func() {\n\t\tif r.Template == nil {\n\t\t\tr.Template = template.New(\"\")\n\t\t}\n\n\t\tif r.Delims != nil {\n\t\t\tr.Template.Delims(r.Delims.Left, r.Delims.Right)\n\t\t}\n\n\t\tif r.FuncMap != nil {\n\t\t\tr.Template.Funcs(r.FuncMap)\n\t\t}\n\n\t\tif len(r.Files) > 0 {\n\t\t\tr.Template = template.Must(r.Template.ParseFiles(r.Files...))\n\t\t}\n\t\tif r.Glob != \"\" {\n\t\t\tr.Template = template.Must(r.Template.ParseGlob(r.Glob))\n\t\t}\n\t})\n\n\tif r.Name == \"\" {\n\t\treturn r.Template.Execute(w, r.Data)\n\t}\n\treturn r.Template.ExecuteTemplate(w, r.Name, r.Data)\n}", "title": "" }, { "docid": "60bc11fd0f08b05583e30ac71468d14e", "score": "0.4914954", "text": "func renderTemplate(w http.ResponseWriter, tmpl string, p *Page) {\n\t//Let's handle the error executing the template files\n\terr := templates.ExecuteTemplate(w, tmpl+\".html\", p)\n\tif err != nil {\n\t\thttp.Error(w, err.Error(), http.StatusInternalServerError)\n\t}\n}", "title": "" }, { "docid": "70bb45a62cbaae5c51483a0a124fe879", "score": "0.49108058", "text": "func (c *Context) HTML(status int, name string) {\n\tlog.Trace(\"Template: %s\", name)\n\tc.Context.HTML(status, name)\n}", "title": "" }, { "docid": "ba0f033d3ef158eea493746b3e405daf", "score": "0.49076432", "text": "func renderTemplate(w http.ResponseWriter, tmpl string, p *Page) {\n\tt, err := template.ParseFiles(tmpl + \".html\")\n\tif err != nil {\n\t\thttp.Error(w, err.Error(), http.StatusInternalServerError)\n\t\treturn\n\t}\n\terr = t.Execute(w, p)\n\tif err != nil {\n\t\thttp.Error(w, err.Error(), http.StatusInternalServerError)\n\t}\n}", "title": "" }, { "docid": "febec4d0c27581244661b8d08db48370", "score": "0.49062255", "text": "func (app *application) createSnippetForm(w http.ResponseWriter, r *http.Request) {\n\tapp.render(w, r, \"create.page.tmpl\", &templateData{\n\t\tForm: forms.New(nil),\n\t})\n}", "title": "" }, { "docid": "6c515233b380e57e610ef3f8717c97cb", "score": "0.49023095", "text": "func RenderTemplate(w http.ResponseWriter, r *http.Request, tmpl string, data *models.TemplateData){\n\ttc := app.TemplateCache\n\n\tt, isExists := tc[tmpl]\n\tif !isExists{\n\t\tlog.Fatal(\"Template don't exists\")\n\t}\n\n\tdata = AddDefaultData(data, r)\n\n\tbuf := new(bytes.Buffer)\n\t_ = t.Execute(buf, data)\n\n\t_, err := buf.WriteTo(w)\n\tif err != nil{\n\t\tfmt.Println(\"Error writing template to browser\", err)\n\t}\n}", "title": "" }, { "docid": "3a3f7e552104c0b351102d7af6c0fe29", "score": "0.49010596", "text": "func CreateTest2(w http.ResponseWriter, r *http.Request, _ httprouter.Params) {\n\n\tdefer r.Body.Close()\n\n\thtmlData, err := ioutil.ReadAll(r.Body) //<--- here!\n\n\tif err != nil {\n\t\tfmt.Println(err)\n\t}\n\n\t// print out\n\tfmt.Fprintf(os.Stdout, string(htmlData)) //<-- here !\n\n}", "title": "" }, { "docid": "b5d29f9a75dde11e4b9058eb0ba1c631", "score": "0.4876471", "text": "func (t *Template) Render(kvs map[string]string) error {\n t.mutex.Lock()\n defer t.mutex.Unlock()\n\n fileMode, err := t.getExpectedFileMode()\n if err != nil {\n return err\n }\n\n if err := t.setKVs(kvs); err != nil {\n return err\n }\n\n stageFile, err := t.createStageFile(fileMode)\n if err != nil {\n return err\n }\n\n if err := t.sync(stageFile, fileMode, t.doNoOp); err != nil {\n return err\n }\n\n return nil\n}", "title": "" }, { "docid": "0f1fdc8acfa79caaf09b603737a52981", "score": "0.48652583", "text": "func IndexTpl(assetsBase, faviconBase string, cfg swgui.Config) string {\n\tsettings := map[string]string{\n\t\t\"url\": \"url\",\n\t\t\"dom_id\": \"'#swagger-ui'\",\n\t\t\"deepLinking\": \"true\",\n\t\t\"presets\": `[\n\t\t\t\tSwaggerUIBundle.presets.apis,\n\t\t\t\tSwaggerUIStandalonePreset\n\t\t\t]`,\n\t\t\"plugins\": `[\n\t\t\t\tSwaggerUIBundle.plugins.DownloadUrl\n\t\t\t]`,\n\t\t\"layout\": `\"StandaloneLayout\"`,\n\t\t\"showExtensions\": \"true\",\n\t\t\"showCommonExtensions\": \"true\",\n\t\t\"validatorUrl\": \"null\",\n\t\t\"defaultModelsExpandDepth\": \"-1\", // Hides schemas, override with value \"1\" in Config.SettingsUI to show schemas.\n\t\t`onComplete`: `function() {\n if (cfg.preAuthorizeApiKey) {\n for (var name in cfg.preAuthorizeApiKey) {\n ui.preauthorizeApiKey(name, cfg.preAuthorizeApiKey[name]);\n }\n }\n\n var dom = document.querySelector('.scheme-container select');\n for (var key in dom) {\n if (key.startsWith(\"__reactInternalInstance$\")) {\n var compInternals = dom[key]._currentElement;\n var compWrapper = compInternals._owner;\n compWrapper._instance.setScheme(window.location.protocol.slice(0,-1));\n }\n }\n }`,\n\t}\n\n\tfor k, v := range cfg.SettingsUI {\n\t\tsettings[k] = v\n\t}\n\n\tsettingsStr := make([]string, 0, len(settings))\n\tfor k, v := range settings {\n\t\tsettingsStr = append(settingsStr, \"\\t\\t\\t\"+k+\": \"+v)\n\t}\n\n\tsort.Strings(settingsStr)\n\n\treturn `\n<!DOCTYPE html>\n<html lang=\"en\">\n<head>\n <meta charset=\"UTF-8\">\n <title>{{ .Title }} - Swagger UI</title>\n <link rel=\"stylesheet\" type=\"text/css\" href=\"` + assetsBase + `swagger-ui.css\">\n <link rel=\"icon\" type=\"image/png\" href=\"` + faviconBase + `favicon-32x32.png\" sizes=\"32x32\"/>\n <link rel=\"icon\" type=\"image/png\" href=\"` + faviconBase + `favicon-16x16.png\" sizes=\"16x16\"/>\n <style>\n html {\n box-sizing: border-box;\n overflow: -moz-scrollbars-vertical;\n overflow-y: scroll;\n }\n\n *,\n *:before,\n *:after {\n box-sizing: inherit;\n }\n\n body {\n margin: 0;\n background: #fafafa;\n }\n </style>\n</head>\n\n<body>\n<div id=\"swagger-ui\"></div>\n\n<script src=\"` + assetsBase + `swagger-ui-bundle.js\"></script>\n<script src=\"` + assetsBase + `swagger-ui-standalone-preset.js\"></script>\n<script>\n window.onload = function () {\n var cfg = {{ .ConfigJson }};\n var url = window.location.protocol + \"//\" + window.location.host + cfg.swaggerJsonUrl;\n\n // Build a system\n var settings = {\n` + strings.Join(settingsStr, \",\\n\") + `\n };\n\n if (cfg.showTopBar == false) {\n settings.plugins.push(function () {\n return {\n components: {\n Topbar: function () {\n return null;\n }\n }\n }\n });\n }\n\n if (cfg.hideCurl) {\n settings.plugins.push(() => {return {wrapComponents: {curl: () => () => null}}});\n }\n\n window.ui = SwaggerUIBundle(settings);\n }\n</script>\n</body>\n</html>\n`\n}", "title": "" }, { "docid": "f1ec96ced683d1cb5e1398f7d2173461", "score": "0.4864722", "text": "func (self *TemplateSvc) RenderHtml(templateFileName string, params interface{}) (string, error) {\n\n\ttemplate, err := htmltemplate.ParseFiles(self.baseTemplateSvcDir + templateFileName)\n\tif err != nil { return nadaStr, err }\n\n\tvar out bytes.Buffer\n\tif err := template.ExecuteTemplate(&out, templateFileName, params); err != nil { return nadaStr, err }\n\treturn out.String(), nil\n}", "title": "" }, { "docid": "1ce6ab1cb57e3af72741c5df7a50e414", "score": "0.4850583", "text": "func WriteRepoHtml(w http.ResponseWriter, repoPresenter presenter.Presenter) {\n\terr := t.Execute(w, repoPresenter)\n\tif err != nil {\n\t\tlog.Println(\"t.Execute:\", err)\n\t\thttp.Error(w, err.Error(), http.StatusInternalServerError)\n\t}\n}", "title": "" }, { "docid": "d61bb9647493cf3b89a6451d763f8635", "score": "0.4847331", "text": "func render(w http.ResponseWriter, page string, data interface{}) {\n\tt := template.New(\"GitNGo\")\n\tt = t.Funcs(template.FuncMap{\n\t\t\"marshal\": func(v interface{}) template.JS {\n\t\t\ta, _ := json.Marshal(v)\n\t\t\treturn template.JS(a)\n\t\t},\n\t\t\"round\": func(v float64, n int) float64 {\n\t\t\treturn float64(int(v*math.Pow(10, float64(n)))) / math.Pow(10, float64(n))\n\t\t},\n\t\t\"title\": func(s string) string {\n\t\t\treturn strings.Title(s)\n\t\t},\n\t})\n\tt = template.Must(t.ParseFiles(RessourcePath+\"/html/layout.html.tmpl\", \"ressources/html/\"+page))\n\terr := t.ExecuteTemplate(w, \"layout\", data)\n\tif err != nil {\n\t\tlog.Fatal(err.Error())\n\t}\n}", "title": "" }, { "docid": "ef612dadfd0c044516ea1c9ee8e86e97", "score": "0.483808", "text": "func main() {\n\terr := tpl.ExecuteTemplate(os.Stdout, \"index.gohtml\", 42)\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n}", "title": "" }, { "docid": "44d703c30cde9d193ebc87789acdc142", "score": "0.48345357", "text": "func WriteNew(tl *Templates, jd *os.File) {\n\tj, err := json.MarshalIndent(tl.TemplateData, \"\", \"\\t\")\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\t_, err = jd.Write(j)\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n}", "title": "" }, { "docid": "4cc1bf4c90b833a989b2e73491f5fab2", "score": "0.48272666", "text": "func (md *TestDialect) RenderHtml(sn *SiteNode) (err error) {\n s := string(sn.IntermediateOutput())\n lines := strings.Split(s, \"\\n\")\n\n b := new(bytes.Buffer)\n\n for _, line := range lines {\n if strings.HasPrefix(line, \"## page-top | \") == true && strings.HasSuffix(line, \" ##\") == true {\n // Example: ## page-title | node_title ##\n\n pivot := 14\n content := line[pivot : len(line)-3]\n\n _, err := fmt.Fprintf(b, \"<header>%s</header>\\n\", content)\n log.PanicIf(err)\n } else if strings.HasPrefix(line, \"## widget | image | \") == true && strings.HasSuffix(line, \" ##\") == true {\n // Example: ## widget | image | image alt text | file://some/image/path ##\n\n pivot := 20\n content := line[pivot : len(line)-3]\n\n _, err := fmt.Fprintf(b, \"<widget>%s</widget>\\n\", content)\n log.PanicIf(err)\n } else if strings.HasPrefix(line, \"## page-bottom | \") == true && strings.HasSuffix(line, \" ##\") == true {\n // Example: ## page-title | node_title ##\n\n pivot := 17\n content := line[pivot : len(line)-3]\n\n _, err := fmt.Fprintf(b, \"<footer>%s</footer>\\n\", content)\n log.PanicIf(err)\n } else if len(line) == 0 {\n continue\n } else {\n log.Panicf(\"intermediate line not valid: [%s]\", line)\n }\n }\n\n finalOutput := b.Bytes()\n sn.SetFinalOutput(finalOutput)\n\n return nil\n}", "title": "" }, { "docid": "f4b1783f831b3a1c05d5e8502833c5c8", "score": "0.4825293", "text": "func New(baseContents string, funcs template.FuncMap) *Template {\n\tt := &Template{\n\t\tpages: make(map[string]page),\n\t\tpagesCached: make(pageCache),\n\t\tbaseTemplateFuncs: funcs, // functions available to all pages\n\t\taddPageDefine: true,\n\t\tbaseDefineName: baseDefineName,\n\t\tpageDefineName: pageDefineName,\n\t\ttranslationFunctionName: translationFunctionName,\n\t}\n\n\tt.baseTemplateContents = `{{define \"` + t.baseDefineName + `\"}}` + baseContents + `{{end}}`\n\n\treturn t\n}", "title": "" }, { "docid": "152c5e5aa06a4d870fc867497cc2ab64", "score": "0.48203033", "text": "func (m *Map) RenderHTML(name string) {}", "title": "" }, { "docid": "a672dd41d5aa9915b884e8763e609a83", "score": "0.48110333", "text": "func renderTemplate(w http.ResponseWriter, tmpl string, s *Stream){\n err := templates.ExecuteTemplate(w, tmpl+\".html\", s)\n if err != nil{\n http.Error(w, err.Error(), http.StatusInternalServerError)\n }\n}", "title": "" }, { "docid": "efd7dc8c48f1f6f257d839703ae6b85a", "score": "0.4809852", "text": "func HTML(w http.ResponseWriter, status int, name string, binding interface{}, htmlOpt ...render.HTMLOptions) {\n\tRender.HTML(w, status, name, binding, htmlOpt...)\n}", "title": "" }, { "docid": "64c1bf858696802f74a8d3fb3b95e983", "score": "0.48081353", "text": "func viewHandler(writer http.ResponseWriter, request *http.Request, title string, context *Context) {\n page, err := loadPage(title, context.Database)\n if err != nil {\n // If page can't be found, redirect to the form so we can create it\n http.Redirect(writer, request, \"/edit/\"+title, http.StatusFound)\n return\n }\n\n r := regexp.MustCompile(\"\\\\[([a-zA-Z]+)\\\\]\")\n if err != nil {\n http.Error(writer, err.Error(), http.StatusInternalServerError)\n return\n }\n page.Body = r.ReplaceAllFunc(page.Body, LinkTitle)\n renderTemplate(writer, \"view\", page)\n}", "title": "" }, { "docid": "a29cb814c3c628b030a4d29d5239faf2", "score": "0.48058227", "text": "func HTML(ctx Context, nodes ...nodes.Node) (htmlTemplate.HTML, error) {\n\tvar buf bytes.Buffer\n\tif err := WriteHTML(&buf, ctx.Env, ctx.Format, nodes...); err != nil {\n\t\treturn \"\", err\n\t}\n\treturn htmlTemplate.HTML(buf.String()), nil\n}", "title": "" }, { "docid": "84e7ba40b790d13bdd2d774e4fbddaa8", "score": "0.48053598", "text": "func New() *template.Template {\n\treturn template.New(\"\").Option(\"missingkey=error\").Funcs(tplfunc.FuncMap)\n}", "title": "" }, { "docid": "10b22cbcdad76a0008997c88434f5542", "score": "0.4804783", "text": "func buildTagPage(tagType, tag string, games []rdb.Game) {\n\tpath := filepath.Join(target, tagType, scrubIllegalChars(tag)+\".html\")\n\tf, err := os.OpenFile(path, os.O_CREATE|os.O_WRONLY, os.ModePerm)\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\tdefer f.Close()\n\n\terr = tmpl.ExecuteTemplate(f, \"tag.html\", struct {\n\t\tTagType string\n\t\tTag string\n\t\tGames []rdb.Game\n\t}{\n\t\ttagType,\n\t\ttag,\n\t\tgames,\n\t})\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n}", "title": "" }, { "docid": "35821deca0a632a5a5b6bebdf2b25654", "score": "0.48034286", "text": "func newInParamTemplate(param *gi.Parameter) *InParamTemplate {\n\ttpl := new(InParamTemplate)\n\ttpl.varForGo = getParamName(param.Name)\n\ttpl.varForC = param.Name + \"0\"\n\n\t// param.Type -> bridge\n\tcType, err := gi.ParseCType(param.Type.CType)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\ttpl.bridge, err = getBridge(param.Type.Name, cType)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\n\tif param.LengthForParameter != nil {\n\t\ttpl.lengthForParameter = param.LengthForParameter.Name\n\t}\n\n\tif param.ClosureParam != nil {\n\t\t// param is callback\n\t\ttpl.isClosure = true\n\t\tscope := param.Scope\n\t\tif scope == \"\" {\n\t\t\tscope = \"call\" // default scope is call\n\t\t}\n\t\ttpl.closureScope = scope\n\t}\n\n\treturn tpl\n}", "title": "" }, { "docid": "c4af84ae1622667a8619615bb188d549", "score": "0.47985995", "text": "func RenderTemplate(w http.ResponseWriter, tmpl string, p interface{}) {\n\t//err := templates.ExecuteTemplate(w, tmpl, p)\n\n\t// development debug\n\tasset, err := Asset(tmpl)\n\tt, err := template.New(\"main\").Parse(string(asset))\n\tt.Execute(w, p)\n\t// end\n\n\tif err != nil {\n\t\thttp.Error(w, err.Error(), http.StatusInternalServerError)\n\n\t}\n}", "title": "" }, { "docid": "7f761bc3490b6442cbd293816564fc09", "score": "0.47961336", "text": "func RenderNewSpellCommandTemplate(args []string) error {\n\tspell := appcontext.Current.Get(appcontext.Spell).(tooldomain.Spell)\n\trenderer := domain.GetRenderer()\n\tnewSpellCommandName := args[0]\n\tsafeNewSpellCommandName := strings.ReplaceAll(strings.ReplaceAll(newSpellCommandName, \"-\", \"\"), \" \", \"\")\n\tcurrentPath, err := os.Getwd()\n\tif err != nil {\n\t\tfmt.Printf(\"An error occurred while trying to create the new spell command. Error: %s\\n\", err.Error())\n\t\treturn err\n\t}\n\tmoduleName := toolconfig.GetModuleName(currentPath)\n\tglobalVariables := map[string]interface{}{\n\t\t\"NewSpellCommandName\": newSpellCommandName,\n\t\t\"SafeNewSpellCommandName\": safeNewSpellCommandName,\n\t\t\"ModuleName\": moduleName,\n\t}\n\n\terr = renderer.RenderTemplate(spell, \"addspellcommand\", globalVariables, nil)\n\tif err != nil {\n\t\tfmt.Printf(\"An error occurred while trying to create the new spell command. Error: %s\\n\", err.Error())\n\t\treturn err\n\t}\n\n\terr = renameTemplateFileNames(currentPath, newSpellCommandName)\n\tif err != nil {\n\t\tfmt.Printf(\"An error occurred while trying to create the new spell command. Error: %s\\n\", err.Error())\n\t\treturn err\n\t}\n\n\terr = addCommandToBuildConfigCommand(currentPath, args)\n\tif err != nil {\n\t\tfmt.Printf(\"An error occurred while trying to create the new spell command. Error: %s\\n\", err.Error())\n\t\treturn err\n\t}\n\n\terr = createTemplateDirectory(currentPath, newSpellCommandName)\n\tif err != nil {\n\t\tfmt.Printf(\"An error occurred while trying to create the new spell command. Error: %s\\n\", err.Error())\n\t\treturn err\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "5e1e38dc21af8d4ea4fb348af7736abd", "score": "0.47923556", "text": "func (rw *ReaderWriter) WriteHTML(w http.ResponseWriter, r *http.Request, p WriteHTMLParams) {\n\tif p.StatusCode == 0 && p.Error == nil {\n\t\tp.StatusCode = http.StatusOK\n\t}\n\n\tif p.StatusCode == 0 && p.Error != nil {\n\t\tp.StatusCode = http.StatusInternalServerError\n\t}\n\n\tif p.LayoutTemplate == \"\" {\n\t\tp.LayoutTemplate = \"main.html\"\n\t}\n\n\tif p.PageTemplate == \"\" && p.StatusCode == http.StatusInternalServerError {\n\t\tp.PageTemplate = \"internal-error.html\"\n\t}\n\n\tif p.PageTemplate == \"\" && p.StatusCode == http.StatusNotFound {\n\t\tp.PageTemplate = \"not-found.html\"\n\t}\n\n\tif p.Error != nil {\n\t\trw.logger.WithTags(map[string]interface{}{\n\t\t\t\"url\": r.URL.String(),\n\t\t}).Error(\"Failed to handle request\", p.Error)\n\t}\n\n\tif p.Error != nil && rw.renderError {\n\t\tw.WriteHeader(p.StatusCode)\n\t\tw.Header().Set(\"content-type\", \"text/html\")\n\n\t\terrorHTMLTmpl := template.Must(template.New(\"chtml/error.html\").Parse(errorHTML))\n\n\t\t_ = errorHTMLTmpl.Execute(w, map[string]interface{}{\n\t\t\t\"Error\": p.Error.Error(),\n\t\t})\n\n\t\treturn\n\t}\n\n\tout, err := rw.renderer.render(r, p.LayoutTemplate, p.PageTemplate, p.Data)\n\tif err != nil {\n\t\trw.logger.Error(\"Failed to render html template\", cerrors.WithTags(err, map[string]interface{}{\n\t\t\t\"layout\": p.LayoutTemplate,\n\t\t\t\"page\": p.PageTemplate,\n\t\t}))\n\t\tw.WriteHeader(http.StatusInternalServerError)\n\t\treturn\n\t}\n\n\tw.WriteHeader(p.StatusCode)\n\tw.Header().Set(\"content-type\", \"text/html\")\n\t_, _ = w.Write([]byte(out))\n}", "title": "" }, { "docid": "0bf35e33a01dd2f7de17b62aaf1da489", "score": "0.477743", "text": "func renderTemplate(w http.ResponseWriter, tmpl string) {\n\terr := templates.ExecuteTemplate(w, tmpl+\".html\", nil)\n\tif err != nil {\n\t\thttp.Error(w, err.Error(), http.StatusInternalServerError)\n\t}\n}", "title": "" }, { "docid": "499a420587415b7550e0c1b11b2e2cd6", "score": "0.47731024", "text": "func templateOption(next func(t *gen.Template) (*gen.Template, error)) Option {\n\treturn func(cfg *gen.Config) (err error) {\n\t\ttmpl, err := next(gen.NewTemplate(\"external\"))\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tcfg.Templates = append(cfg.Templates, tmpl)\n\t\treturn nil\n\t}\n}", "title": "" }, { "docid": "0d644711b55598babe09b2f96f5c0528", "score": "0.4771231", "text": "func applyTemplate() {\n var templateString = []byte(indexTemplate);\n req, err := http.NewRequest(\"POST\", \"http://localhost:9200\" + \"/_template/tbresults_template\", bytes.NewBuffer(templateString))\n req.Header.Set(\"Content-Type\", \"application/json\")\n httpClient := &http.Client{}\n resp, err := httpClient.Do(req)\n defer resp.Body.Close()\n if err != nil {\n\tpanic(err)\n } else {\n\tfmt.Println(\"Template created for the index\")\n\ttemplateApplied = true\n }\n}", "title": "" }, { "docid": "c7005a7f21c0770c680d8fc41cb649e8", "score": "0.47701138", "text": "func applyForm(t *testing.T, template string, data map[string]interface{}) string {\n\tservice := NewXMLServiceWithMockClock(\"../templates/\", mockedClock())\n\n\tapp := api.BlankApplication(-1, \"SF86\", \"2017-07\")\n\tp := newApplicationPackager(service, app)\n\n\tsnippet, err := p.defaultTemplate(template, data)\n\tif err != nil {\n\t\tt.Fatal(err)\n\t}\n\treturn string(snippet)\n}", "title": "" }, { "docid": "c1be610a174f2e31aaeebad65b88e6a4", "score": "0.4768702", "text": "func NewTemplate(td *TempalteData) *template.Template {\n\tprefix := td.Pkg.Name()\n\treturn template.New(prefix + \"_format\").Funcs(newFuncMap(td))\n}", "title": "" }, { "docid": "b9a3726ea8640cf7ae0631867ea6e8a8", "score": "0.47663844", "text": "func createHandler(w http.ResponseWriter, r *http.Request) {\n\texecuteTemplate(w, kCreate, makeFormFrameArgs(r, makeForm(), \"Create\"))\n}", "title": "" }, { "docid": "ac904d906b7a50984eb7b5c5902848e9", "score": "0.47662303", "text": "func CreateHandler(w http.ResponseWriter, r *http.Request) {\n\terr := r.ParseForm()\n\tif err != nil {\n\t\tfmt.Println(err)\n\t\terrorHandler(w, r, http.StatusBadRequest)\n\t\treturn\n\t}\n\n\tv := r.Form.Get(\"longurl\")\n\n\ttmpl := \"tmpl/create.html\"\n\tt, err := template.ParseFiles(tmpl)\n\tif err != nil {\n\t\tfmt.Printf(\"Could not parse template file '%v'. %v\\n\", tmpl, err.Error())\n\t\terrorHandler(w, r, http.StatusInternalServerError)\n\t\treturn\n\t}\n\n\ts, err := generateShortURL(v)\n\tif err != nil {\n\t\tfmt.Printf(\"Could not generate short url. %v\\n\", err.Error())\n\t\terrorHandler(w, r, http.StatusInternalServerError)\n\t\treturn\n\t}\n\n\terr = t.Execute(w, s)\n\tif err != nil {\n\t\tfmt.Printf(\"Could not execute template. %v\\n\", err.Error())\n\t\terrorHandler(w, r, http.StatusInternalServerError)\n\t\treturn\n\t}\n}", "title": "" }, { "docid": "205cb274660743fd2c02c39169537b78", "score": "0.47657812", "text": "func New() *render.Render {\n\tlogger.Traceln(nil, \"creating instance of render.Render\")\n\t// TODO make configurable?\n\treturn render.New(render.Options{\n\t\tAsset: assets.Asset,\n\t\tAssetNames: assets.AssetNames,\n\t\tDelims: render.Delims{Left: \"[:\", Right: \":]\"},\n\t\tLayout: \"layout\",\n\t\tFuncs: []template.FuncMap{template.FuncMap{\n\t\t\t\"map\": htmlform.Map,\n\t\t\t\"ext\": htmlform.Extend,\n\t\t\t\"fnn\": htmlform.FirstNotNil,\n\t\t}},\n\t})\n}", "title": "" }, { "docid": "451ea4750394df0f1c274209821a84d2", "score": "0.4764972", "text": "func newTemplateFromFile(fname, templateName string)error {\n templ := templates.New(templateName)\n templ.Delims(TEMPLATE_LEFT_DELIMITER, TEMPLATE_RIGHT_DELIMITER)\n\n fdata, err := ioutil.ReadFile(fname)\n if err != nil{\n return err\n }\n _, err = templ.Parse(string(fdata))\n if err != nil{\n return err\n }\n\n return nil\n}", "title": "" }, { "docid": "9c2e8701d11f9cd0b87efab626955bbe", "score": "0.4763452", "text": "func main() {\n\t// Player characters in my current d&d session\n\tNas := DndChar{\n\t\tName: \"nas locke\",\n\t\tClass: \"bard\",\n\t\tAlignment: \"chaotic neutral\",\n\t\tAlive: true,\n\t}\n\n\tNomini := DndChar{\n\t\tName: \"nomini\",\n\t\tClass: \"druid\",\n\t\tAlignment: \"neutral\",\n\t\tAlive: true,\n\t}\n\n\tPaulBunyan := DndChar{\n\t\tName: \"paul bunyan\",\n\t\tClass: \"barbarian\",\n\t\tAlignment: \"chaotic neutral\",\n\t\tAlive: true,\n\t}\n\n\tRogar := DndChar{\n\t\tName: \"rogar\",\n\t\tClass: \"rogue\",\n\t\tAlignment: \"chaotic neutral\",\n\t\tAlive: true,\n\t}\n\n\tJorbjorn := DndChar{\n\t\tName: \"jorbjorn\",\n\t\tClass: \"barbarian\",\n\t\tAlignment: \"chaotic good\",\n\t\tAlive: true,\n\t}\n\n\t// DM in my current d&d session\n\tLogan := DungeonMaster{\n\t\tName: \"logan thibodeaux\",\n\t\tYearsDming: 10,\n\t}\n\n\t// final struct to contain and pass all the data into the template\n\tcurrentDndSession := Dnd{\n\t\tDndChars: []DndChar{Nas, Nomini, PaulBunyan, Rogar, Jorbjorn},\n\t\tDungeonMasters: []DungeonMaster{Logan},\n\t}\n\n\terr := tpl.ExecuteTemplate(os.Stdout, \"tpl.gohtml\", currentDndSession)\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\n}", "title": "" } ]
7e4452b26ba413a6c00526a30788f1e4
Test_buildFizzBuzz Run test the builder which build the fizzbuzz string from parameters
[ { "docid": "4448aad0d5024232343c076869636255", "score": "0.75031203", "text": "func Test_buildFizzBuzz(t *testing.T) {\n\tmockCtrl := gomock.NewController(t)\n\tdefer mockCtrl.Finish()\n\t//TODO : REPLACE this by fixture files for more tests cases\n\ttests := map[string]struct {\n\t\tf Fizzbuzz\n\t\tres string\n\t}{\n\t\t\"original- short\": {f: Fizzbuzz{\n\t\t\tInt1: 3,\n\t\t\tInt2: 5,\n\t\t\tLimit: 30,\n\t\t\tStr1: \"fizz\",\n\t\t\tStr2: \"buzz\",\n\t\t}, res: \"1,2,fizz,4,buzz,fizz,7,8,fizz,buzz,11,fizz,13,14,fizzbuzz,16,17,fizz,19,buzz,fizz,22,23,fizz,buzz,26,fizz,28,29,fizzbuzz\"},\n\t\t\"1&1- short\": {f: Fizzbuzz{\n\t\t\tInt1: 1,\n\t\t\tInt2: 1,\n\t\t\tLimit: 20,\n\t\t\tStr1: \"fizz\",\n\t\t\tStr2: \"buzz\",\n\t\t}, res: \"fizzbuzz,fizzbuzz,fizzbuzz,fizzbuzz,fizzbuzz,fizzbuzz,fizzbuzz,fizzbuzz,fizzbuzz,fizzbuzz,fizzbuzz,fizzbuzz,fizzbuzz,fizzbuzz,fizzbuzz,fizzbuzz,fizzbuzz,fizzbuzz,fizzbuzz,fizzbuzz\"},\n\t\t\"0&0\": {f: Fizzbuzz{\n\t\t\tInt1: 0,\n\t\t\tInt2: 0,\n\t\t\tLimit: 10,\n\t\t\tStr1: \"fizz\",\n\t\t\tStr2: \"buzz\",\n\t\t}, res: \"1,2,3,4,5,6,7,8,9,10\"},\n\t}\n\n\tfor tName, tCase := range tests {\n\n\t\tt.Run(fmt.Sprintf(\"It should put error in response if params are invalids : %s\", tName), func(t *testing.T) {\n\t\t\tres := buildFizzBuzz(tCase.f)\n\n\t\t\tassert.Equal(t, res, tCase.res)\n\t\t})\n\n\t}\n\n}", "title": "" } ]
[ { "docid": "257e2d0a88f30ffe187d43d4c598b49e", "score": "0.68589085", "text": "func Test_fizzBuzz(t *testing.T) {\n\tcases := []kit.CaseEntry{\n\t\t{\n\t\t\tName: \"x1\",\n\t\t\tInput: 1,\n\t\t\tExpected: []string{\"1\"},\n\t\t},\n\t\t{\n\t\t\tName: \"x2\",\n\t\t\tInput: 5,\n\t\t\tExpected: []string{\"1\", \"2\", \"Fizz\", \"4\", \"Buzz\"},\n\t\t},\n\t\t{\n\t\t\tName: \"x3\",\n\t\t\tInput: 15,\n\t\t\tExpected: []string{\"1\", \"2\", \"Fizz\", \"4\", \"Buzz\", \"Fizz\", \"7\", \"8\", \"Fizz\", \"Buzz\", \"11\", \"Fizz\", \"13\", \"14\", \"FizzBuzz\"},\n\t\t},\n\t}\n\n\tfor _, tt := range cases {\n\t\tt.Run(tt.Name, func(t *testing.T) {\n\t\t\toutput := fizzBuzz(tt.Input.(int))\n\t\t\texpected := tt.Expected.([]string)\n\t\t\tassert.Equal(t, expected, output, \"equal\")\n\t\t})\n\t}\n}", "title": "" }, { "docid": "16f9b18fbafc20d20f53ad0b2713f50f", "score": "0.67598647", "text": "func TestFizzbuzz(t *testing.T) {\n\tt.Run(\"1 should say 1\", func(t *testing.T) {\n\t\tget := fizzbuzz.Say(1)\n\t\twant := \"1\"\n\t\tif want != get {\n\t\t\tt.Errorf(\"it should say %s but get %s\", want, get)\n\t\t}\n\t})\n}", "title": "" }, { "docid": "6af2a5a046be8bb69f742516a56eb888", "score": "0.6380122", "text": "func Fizzbuzz(n int) string {\n\tresult := \"\"\n\tif n%3 == 0 {\n\t\tresult += \"Fizz\"\n\t}\n\tif n%5 == 0 {\n\t\tresult += \"Buzz\"\n\t}\n\treturn result\n}", "title": "" }, { "docid": "ce77be5cee47576404cd26cc98f091e5", "score": "0.623261", "text": "func FizzBuzz(i int64) string {\n\ts := \"\"\n\tif i%3 == 0 {\n\t\ts = s + \"fizz\"\n\t}\n\tif i%5 == 0 {\n\t\ts = s + \"buzz\"\n\t}\n\treturn s\n}", "title": "" }, { "docid": "6bf07d715678cf578aff6abf82e7dc20", "score": "0.61365443", "text": "func FizzBuzz(n int) (s string) {\n\tvar three bool = n % 3 == 0\n\tvar five bool = n % 5 == 0\n\tvar threefive bool = three && five\n\n\t//s = \"\"\n\tswitch {\n\tcase threefive:\n\t\ts = \"FizzBuzz\"\n\tcase three:\n\t\ts = \"Fizz\"\n\tcase five:\n\t\ts = \"Buzz\"\n\tdefault:\n\t\ts = strconv.Itoa(n)\n\t}\n\n\treturn s\n}", "title": "" }, { "docid": "0f11c2c8117a046c3684797ea2e2e1e5", "score": "0.61227924", "text": "func FizzBuzz(max int64) string {\n\tresults := \"\"\n\tvar wg sync.WaitGroup\n\n\twg.Add(1)\n\n\tgo func() {\n\t\tfor i := int64(1); i <= max; i++ {\n\t\t\titer := \"\"\n\t\t\tif i%3 == 0 {\n\t\t\t\titer += \"Fizz\"\n\t\t\t}\n\t\t\tif i%5 == 0 {\n\t\t\t\titer += \"Buzz\"\n\t\t\t}\n\t\t\tif iter == \"\" {\n\t\t\t\tresults += fmt.Sprintf(\"%d\", i) + \"\\n\"\n\t\t\t} else {\n\t\t\t\tresults += iter + \"\\n\"\n\t\t\t}\n\t\t}\n\t\tdefer wg.Done()\n\t}()\n\n\twg.Wait()\n\treturn results\n}", "title": "" }, { "docid": "99fc768e29c7ad4e232485aa51182a6d", "score": "0.609889", "text": "func FizzBuzz(n int) string {\n\t// Atoi\n\t// Itoa\n\tif n%15 == 0 {\n\t\treturn \"fizzbuzz\"\n\t}\n\tif n%3 == 0 {\n\t\treturn \"fizz\"\n\t}\n\tif n%5 == 0 {\n\t\treturn \"buzz\"\n\t}\n\treturn strconv.Itoa(n)\n\n}", "title": "" }, { "docid": "eb416f618156d5c8ccd79e1f44b2596b", "score": "0.60959876", "text": "func Test_fizzBuzzCuckooClock(t *testing.T) {\n\ttype args struct {\n\t\ttime string\n\t}\n\ttests := []struct {\n\t\tname string\n\t\targs args\n\t\twant string\n\t}{\n\t\t// TODO: Add test cases.\n\t\t{name: \"default\", args: args{time: \"13:34\"}, want: \"tick\"},\n\t\t{name: \"case1\", args: args{time: \"21:00\"}, want: \"Cuckoo Cuckoo Cuckoo Cuckoo Cuckoo Cuckoo Cuckoo Cuckoo Cuckoo\"},\n\t\t{name: \"case2\", args: args{time: \"11:15\"}, want: \"Fizz Buzz\"},\n\t\t{name: \"case3\", args: args{time: \"03:03\"}, want: \"Fizz\"},\n\t\t{name: \"case4\", args: args{time: \"14:30\"}, want: \"Cuckoo\"},\n\t\t{name: \"case5\", args: args{time: \"08:55\"}, want: \"Buzz\"},\n\t\t{name: \"case6\", args: args{time: \"00:00\"}, want: \"Cuckoo Cuckoo Cuckoo Cuckoo Cuckoo Cuckoo Cuckoo Cuckoo Cuckoo Cuckoo Cuckoo Cuckoo\"},\n\t\t{name: \"case7\", args: args{time: \"12:00\"}, want: \"Cuckoo Cuckoo Cuckoo Cuckoo Cuckoo Cuckoo Cuckoo Cuckoo Cuckoo Cuckoo Cuckoo Cuckoo\"},\n\t}\n\tfor _, tt := range tests {\n\t\tt.Run(tt.name, func(t *testing.T) {\n\t\t\tif got := fizzBuzzCuckooClock(tt.args.time); got != tt.want {\n\t\t\t\tt.Errorf(\"fizzBuzzCuckooClock() = %v, want %v\", got, tt.want)\n\t\t\t}\n\t\t})\n\t}\n}", "title": "" }, { "docid": "134cec87725dc6ac702167cf4662fa69", "score": "0.60623205", "text": "func FizzBuzz(n int) []string {\n\tvar m3 bool\n\tvar m5 bool\n\tvar res []string\n\tvar attach string\n\n\tfor i := 1; i <= n; i++ {\n\t\tm3 = (i % 3) == 0\n\t\tm5 = (i % 5) == 0\n\t\tif m3 && m5 {\n\t\t\tattach = \"FizzBuzz\"\n\t\t} else if m3 {\n\t\t\tattach = \"Fizz\"\n\t\t} else if m5 {\n\t\t\tattach = \"Buzz\"\n\t\t} else {\n\t\t\tattach = strconv.Itoa(i)\n\t\t}\n\t\tres = append(res, attach)\n\t}\n\n\treturn res\n}", "title": "" }, { "docid": "75763ccc7c4c0e946705b45641a99352", "score": "0.59512824", "text": "func FizzBuzz(n int) {\n\tvar result strings.Builder\n\n\tfor i := 1; i <= n; i++ {\n\t\tif i%3 == 0 && i%5 == 0 {\n\t\t\tresult.WriteString(\"Fizz Buzz, \")\n\t\t} else if i%3 == 0 {\n\t\t\tresult.WriteString(\"Fizz, \")\n\t\t} else if i%5 == 0 {\n\t\t\tresult.WriteString(\"Buzz, \")\n\t\t} else {\n\t\t\tresult.WriteString(fmt.Sprintf(\"%d, \", i))\n\t\t}\n\t}\n\n\t// we could refactor this by adding:\n\t/*\n\t\tif i != n {\n\t\t\tresult.WriteString(\", \")\n\t\t}\n\t*/\n\t// inside the for loop\n\tif result.Len() > 2 && result.String()[result.Len()-2:] == \", \" {\n\t\ttmp := result.String()\n\t\tresult.Reset()\n\t\tresult.WriteString(tmp[:len(tmp)-2])\n\t}\n\n\tfmt.Println(result.String())\n}", "title": "" }, { "docid": "cade315ff7e3c7d36b530f81da0b10b4", "score": "0.5869168", "text": "func FizzBuzz1(n int) (s string) {\n\tvar three bool = n % 3 == 0\n\tvar five bool = n % 5 == 0\n\tvar threefive bool = three && five\n\n\ts = \"\"\n\tif threefive {\n\t\ts = \"FizzBuzz\"\n\t} else if three {\n\t\ts = \"Fizz\"\n\t} else if five {\n\t\ts = \"Buzz\"\n\t} else {\n\t\ts = strconv.Itoa(n)\n\t}\n\n\treturn s\n}", "title": "" }, { "docid": "10ea1a578e666b43ef0618e2d9209dd4", "score": "0.5853473", "text": "func Test_FizzBuzzHandler(t *testing.T) {\n\tmockCtrl := gomock.NewController(t)\n\tdefer mockCtrl.Finish()\n\ttests := map[string]struct {\n\t\turlParams string\n\t\texpectedCode int\n\t}{\n\t\t\"valid\": {urlParams: \"?int1=3&int2=3&limit=10&str1=fizz&str2=buzzzz\", expectedCode: http.StatusOK},\n\t\t\"missing required str2\": {urlParams: \"?int1=3&int2=3&limit=10&str1=fizz&str2=\", expectedCode: http.StatusBadRequest},\n\t\t\"missing required str1\": {urlParams: \"?int1=3&int2=3&limit=10&&str2=buzzzz\", expectedCode: http.StatusBadRequest},\n\t\t\"missing required limit\": {urlParams: \"?int1=3&int2=3&str1=fizz&str2=buzzzz\", expectedCode: http.StatusBadRequest},\n\t\t\"missing required int1\": {urlParams: \"?&int2=3&limit=10&str1=fizz&str2=buzzzz\", expectedCode: http.StatusBadRequest},\n\t\t\"missing required int2\": {urlParams: \"?int1=3&limit=10&str1=fizz&str2=buzzzz\", expectedCode: http.StatusBadRequest},\n\t\t\"invalid value for str1\": {urlParams: \"?int1=3&int2=3&limit=10&str1=&str2=buzzzz\", expectedCode: http.StatusBadRequest},\n\t\t\"invalid value for str2\": {urlParams: \"?int1=3&int2=3&limit=10&str1=fizz&str2=\", expectedCode: http.StatusBadRequest},\n\t\t\"invalid value for int1\": {urlParams: \"?int1=INVALIDMOCK&int2=3&limit=10&str1=fizz&str2=buzzzz\", expectedCode: http.StatusBadRequest},\n\t\t\"invalid value for int2\": {urlParams: \"?int1=3&int2=INVALIDMOCK&limit=10&str1=fizz&str2=buzzzz\", expectedCode: http.StatusBadRequest},\n\t\t\"invalid value for limit\": {urlParams: \"?int1=3&int2=3&limit=INVALIDMOCK&str1=fizz&str2=buzzzz\", expectedCode: http.StatusBadRequest},\n\t}\n\n\tfor tName, tCase := range tests {\n\n\t\tt.Run(fmt.Sprintf(\"It should put error in response if params are invalids : %s\", tName), func(t *testing.T) {\n\t\t\tw := httptest.NewRecorder()\n\t\t\tc, _ := gin.CreateTestContext(w)\n\t\t\tc.Request, _ = http.NewRequest(http.MethodGet, tCase.urlParams, nil)\n\n\t\t\tFizzBuzzHandler(c)\n\n\t\t\tassert.Equal(t, w.Code, tCase.expectedCode)\n\t\t})\n\n\t}\n\n}", "title": "" }, { "docid": "cd4663333a8f4b523d936ef863384236", "score": "0.58352405", "text": "func FizzBuzz(w http.ResponseWriter, r *http.Request) {\n\n\tint1, err := strconv.Atoi(r.FormValue(\"int1\"))\n\tif err != nil {\n\t\trespondWithError(w, http.StatusBadRequest, errors.New(\"error parsing int1\"), 1)\n\t\treturn\n\t}\n\tint2, err := strconv.Atoi(r.FormValue(\"int2\"))\n\tif err != nil {\n\t\trespondWithError(w, http.StatusBadRequest, errors.New(\"error parsing int2\"), 1)\n\t\treturn\n\t}\n\tstring1 := r.FormValue(\"string1\")\n\tstring2 := r.FormValue(\"string2\")\n\n\tlimit, err := strconv.Atoi(r.FormValue(\"limit\"))\n\tif err != nil {\n\t\trespondWithError(w, http.StatusBadRequest, errors.New(\"error parsing limit\"), 1)\n\t\treturn\n\t}\n\n\tfizzBuzzList, error, statusCode := FizzBuzzNaive(int1, int2, string1, string2, limit)\n\tif error != nil {\n\t\trespondWithError(w, http.StatusBadRequest, error, statusCode)\n\t\treturn\n\t}\n\trespondWithJSON(w, http.StatusOK, Response{StatusCode: statusCode, Result: fizzBuzzList, Message: \"\"})\n}", "title": "" }, { "docid": "b758a9342cef09230dc69abd44c90d84", "score": "0.5796944", "text": "func FizzBuzz(i int) (int, string) {\n\tif i%3 == 0 && i%5 == 0 {\n\t\treturn i, \"fizzbuzz\"\n\t} else if i%3 == 0 {\n\t\treturn i, \"fizz\"\n\t} else if i%5 == 0 {\n\t\treturn i, \"buzz\"\n\t}\n\n\treturn i, \"\"\n}", "title": "" }, { "docid": "9bd733135bab83c0063274d49a2c8ba9", "score": "0.5741371", "text": "func FizzBuzz(c int) []string {\n\tresult := make([]string, c)\n\n\tfor i := 1; i <= c; i++ {\n\t\tvar val string\n\n\t\tif i%3 != 0 && i%5 != 0 {\n\t\t\tval = strconv.Itoa(i)\n\t\t} else {\n\t\t\tif i%3 == 0 {\n\t\t\t\tval = \"Fizz\"\n\t\t\t}\n\t\t\tif i%5 == 0 {\n\t\t\t\tval += \"Buzz\"\n\t\t\t}\n\t\t}\n\t\tresult[i-1] = val\n\t}\n\n\treturn result\n}", "title": "" }, { "docid": "604b117ee238446c17ea781cc82e7bc5", "score": "0.57307416", "text": "func main() {\n\tfmt.Println(fizzbuzzlist(0))\n}", "title": "" }, { "docid": "f175efd4387f50946e4ce9c7a43081b6", "score": "0.57245266", "text": "func FuzzTestBuilder(data []byte) int {\n\tinitter.Do(onceInit)\n\tf := fuzz.NewConsumer(data)\n\tquery, err := f.GetSQLString()\n\tif err != nil {\n\t\treturn 0\n\t}\n\tkeyspace, err := f.GetString()\n\tif err != nil {\n\t\treturn 0\n\t}\n\ts, err := loadSchemaForFuzzing(f)\n\tif err != nil {\n\t\treturn 0\n\t}\n\tvschemaWrapper := &vschemaWrapper{\n\t\tv: s,\n\t\tsysVarEnabled: true,\n\t}\n\n\t_, err = TestBuilder(query, vschemaWrapper, keyspace)\n\tif err != nil {\n\t\treturn 0\n\t}\n\treturn 1\n}", "title": "" }, { "docid": "c85dd1b9a6270256e32f1952eb4cb074", "score": "0.56498885", "text": "func FizzBuzz(from, to, multiple1, multiple2 int, s1, s2 string) ([]string, error) {\n\tif from > to {\n\t\treturn nil, fmt.Errorf(\"from can't be greater than to (%d > %d)\", from, to)\n\t}\n\tif multiple1 < 1 || multiple2 < 1 {\n\t\treturn nil, fmt.Errorf(\"multiple can't be inferior to 1\")\n\t}\n\n\tresp := make([]string, to-from+1)\n\n\tfor i := 0; from <= to; from++ {\n\t\ttmp := \"\"\n\t\tif from%multiple1 == 0 {\n\t\t\ttmp += s1\n\t\t}\n\t\tif from%multiple2 == 0 {\n\t\t\ttmp += s2\n\t\t}\n\t\tif len(tmp) == 0 {\n\t\t\ttmp = fmt.Sprintf(\"%d\", from)\n\t\t}\n\t\tresp[i] = tmp\n\t\ti++\n\t}\n\treturn resp, nil\n}", "title": "" }, { "docid": "9fc47697af9b8a09bff322a35d49afa9", "score": "0.5543563", "text": "func FizzBuzz(c ruleArray, length int) (output []string) {\n\tsort.Sort(c)\n\tfor i := 1; i < length+1; i++ {\n\t\tvar result string\n\t\tfor _, rs := range c {\n\t\t\tif i%rs.Place == 0 {\n\t\t\t\tresult += rs.Rule\n\t\t\t}\n\t\t}\n\t\tif result == \"\" {\n\t\t\tresult = strconv.Itoa(i)\n\t\t}\n\t\toutput = append(output, result)\n\t}\n\treturn\n}", "title": "" }, { "docid": "98e1928bf4203551a95d485f0a910b24", "score": "0.5514242", "text": "func FizzBuzzRange(a, b int) (s string) {\n\tfor i := a; i <= b; i++ {\n\t\ts += FizzBuzz(i) + \"\\n\"\n\t}\n\treturn s\n}", "title": "" }, { "docid": "4349ac2cdf3459bf3b3980a5f3db342e", "score": "0.5475194", "text": "func FizzbuzzAlgo(fizzbuzz *Fizzbuzz) (resultfizzbuzz string) {\n\tfor i := 0; i <= fizzbuzz.Limit; i++ {\n\t\tif i%(fizzbuzz.Int1*fizzbuzz.Int2) == 0 {\n\t\t\tresultfizzbuzz += fizzbuzz.Fizz + fizzbuzz.Buzz + \",\"\n\t\t\tcontinue\n\t\t}\n\t\tif i == 0 {\n\t\t\tresultfizzbuzz += strconv.Itoa(i) + \",\"\n\t\t\tcontinue\n\t\t}\n\t\tif i%fizzbuzz.Int1 == 0 {\n\t\t\tresultfizzbuzz += fizzbuzz.Fizz + \",\"\n\t\t\tcontinue\n\t\t}\n\t\tif i%fizzbuzz.Int2 == 0 {\n\t\t\tresultfizzbuzz += fizzbuzz.Buzz + \",\"\n\t\t\tcontinue\n\t\t}\n\t\tresultfizzbuzz += strconv.Itoa(i) + \",\"\n\t}\n\treturn resultfizzbuzz[:len(resultfizzbuzz)-1]\n}", "title": "" }, { "docid": "81560750f500ac11eb76ea71af77dfbe", "score": "0.5464448", "text": "func NewFizzBuzzNoParams() *FizzBuzz {\n return NewFizzBuzz(1, 100)\n}", "title": "" }, { "docid": "a58fbf34be6147aa40697f49f0c7fa20", "score": "0.5445869", "text": "func TestBuild(t *testing.T) {\n stringAssertTests := []StringAssert{\n StringAssert{\n actual: build(\"say\",\"\\\"Hello world!\\\"\", \"using \\\"Fred\\\"\"),\n expected: \"say \\\"Hello world!\\\" using \\\"Fred\\\"\",\n },\n }\n\n runStringAssertTests(\"build\", stringAssertTests, t)\n}", "title": "" }, { "docid": "985bd8abab52b412375c46ad696b44a2", "score": "0.5441074", "text": "func PrintFizzBuzz(writer http.ResponseWriter, reader *http.Request) {\n\tparams := mux.Vars(reader)\n\n\tmax, err := strconv.ParseInt(params[\"max\"], 10, 64)\n\tif err != nil {\n\t\twriter.WriteHeader(http.StatusBadRequest)\n\t\twriter.Write([]byte(err.Error()))\n\t}\n\n\twriter.Write([]byte(FizzBuzz(max)))\n}", "title": "" }, { "docid": "d4e098be62513fa5de1032a1dd404341", "score": "0.5408192", "text": "func Fizzbuzz(int1, int2, limit int, str1, str2 string) ([]string, error) {\n\n\t// check parameters int1 int2 and limit are valides to avoid divid by 0 for\n\t// example\n\tif int1 < 1 {\n\t\treturn []string{}, errors.New(\"int1 can't be lower than 1\")\n\t}\n\n\tif int2 < 1 {\n\t\treturn []string{}, errors.New(\"int2 can't be lower than 1\")\n\t}\n\n\tif limit < 1 {\n\t\treturn []string{}, errors.New(\"limit can't be lower than 1\")\n\t}\n\n\tret := make([]string, 0, limit-1)\n\n\t// a simple fizzbuzz algorithm\n\tn := 1\n\tfor n <= limit {\n\t\tif n%int1 == 0 && n%int2 == 0 {\n\t\t\tret = append(ret, str1+str2)\n\t\t} else if n%int1 == 0 {\n\t\t\tret = append(ret, str1)\n\t\t} else if n%int2 == 0 {\n\t\t\tret = append(ret, str2)\n\t\t} else {\n\t\t\tret = append(ret, strconv.Itoa(n))\n\t\t}\n\t\tn++\n\t}\n\n\treturn ret, nil\n}", "title": "" }, { "docid": "f06a056452eea2e2d6e86f0754f1a109", "score": "0.5375312", "text": "func FizzBuzz(n int) {\n\tfor i := 1; i <= n; i++ {\n\t\tv := getFizzBuzzValue(i)\n\t\tfmt.Print(v)\n\t\tif i != n {\n\t\t\tfmt.Print(\", \")\n\t\t}\n\t}\n\tfmt.Println()\n}", "title": "" }, { "docid": "e0fb5a999e368cc050d1651bc14dec5e", "score": "0.53555095", "text": "func BuildFuzzingHarness(buildType buildskia.ReleaseType, isClean bool) (string, error) {\n\tsklog.Infof(\"Building %s fuzzing harness, or fetching from cache\", buildType)\n\tbuildArgs := []string{\n\t\tfmt.Sprintf(\"cc=%q\", filepath.Join(config.Generator.AflRoot, \"afl-clang-fast\")),\n\t\tfmt.Sprintf(\"cxx=%q\", filepath.Join(config.Generator.AflRoot, \"afl-clang-fast++\")),\n\t}\n\n\treturn buildOrGetCachedHarness(\"afl-instrumented\", buildType, isClean, buildArgs)\n}", "title": "" }, { "docid": "511f0a6f4b82a2e35eb990f0b960ea7c", "score": "0.53433967", "text": "func TestBuild(t *testing.T) {}", "title": "" }, { "docid": "a813d6a44ea69433bc6e78b49a988434", "score": "0.5332853", "text": "func Test_Band_CombinationUtil(t *testing.T) {\n\n}", "title": "" }, { "docid": "2d259802a62fef287e1e48cad4760273", "score": "0.53207123", "text": "func Test_OfTestUtils_ForTestFormat(t *testing.T) {\n\tvar msg = \"cmd subcmd -opt1 a -opt2 b x y z\"\n\targs := parseString(msg)\n\tif len(args) != 9 {\n\t\t// error message: more description, less misunderstanding\n\t\t// bad one\n\t\tt.Errorf(\"args=%s, to be %s\", args, []string{\"cmd\", \"subcmd\", \"-opt1\", \"a\", \"-opt2\", \"b\", \"x\", \"y\", \"z\"})\n\n\t\t// not values but YOU are (able) to tell what's happened!\n\t\tt.Errorf(\"test utilities broken! makeArgs() should parse %s into 9 pieces, but it returns %d.\", args, len(args))\n\t}\n}", "title": "" }, { "docid": "b991ce2a5d4ce85ca5e714118f6ef7f0", "score": "0.5280711", "text": "func tests() []testcase {\n\titems := [...]testcase{\n\t\t{1, \"1\"},\n\t\t{2, \"2\"},\n\t\t{3, \"Fizz\"},\n\t\t{4, \"4\"},\n\t\t{5, \"Buzz\"},\n\t\t{6, \"Fizz\"},\n\t\t{7, \"7\"},\n\t\t{8, \"8\"},\n\t\t{9, \"Fizz\"},\n\t\t{10, \"Buzz\"},\n\t\t{11, \"11\"},\n\t\t{12, \"Fizz\"},\n\t\t{13, \"13\"},\n\t\t{14, \"14\"},\n\t\t{15, \"FizzBuzz\"},\n\t\t{16, \"16\"},\n\t\t{17, \"17\"},\n\t\t{18, \"Fizz\"},\n\t\t{19, \"19\"},\n\t\t{20, \"Buzz\"},\n\t\t{30, \"FizzBuzz\"},\n\t}\n\treturn items[:]\n}", "title": "" }, { "docid": "bc5cc61e226cf04dc8028a781971b9f9", "score": "0.5264089", "text": "func createQuickstartTests(quickstartName string, batch bool) bool {\n\tdescription := \"\"\n\tif batch {\n\t\tdescription = \"[batch] \"\n\t}\n\treturn Describe(description+\"quickstart \"+quickstartName+\"\\n\", func() {\n\t\tvar T Test\n\n\t\tBeforeEach(func() {\n\t\t\tqsNameParts := strings.Split(quickstartName, \"-\")\n\t\t\tqsAbbr := \"\"\n\t\t\tfor s := range qsNameParts {\n\t\t\t\tqsAbbr = qsAbbr + qsNameParts[s][:1]\n\n\t\t\t}\n\t\t\tapplicationName := TempDirPrefix + qsAbbr + \"-\" + strconv.FormatInt(GinkgoRandomSeed(), 10)\n\t\t\tT = Test{\n\t\t\t\tApplicationName: applicationName,\n\t\t\t\tWorkDir: WorkDir,\n\t\t\t\tFactory: clients.NewFactory(),\n\t\t\t}\n\t\t\tT.GitProviderURL()\n\n\t\t\tutils.LogInfof(\"Creating application %s in dir %s\\n\", util.ColorInfo(applicationName), util.ColorInfo(WorkDir))\n\t\t})\n\n\t\tDescribe(\"Given valid parameters\", func() {\n\t\t\tContext(\"when operating on the quickstart\", func() {\n\t\t\t\tIt(\"creates a \"+quickstartName+\" quickstart and promotes it to staging\\n\", func() {\n\t\t\t\t\tc := \"jx\"\n\t\t\t\t\targs := []string{\"create\", \"quickstart\", \"-b\", \"--org\", T.GetGitOrganisation(), \"-p\", T.ApplicationName, \"-f\", quickstartName}\n\n\t\t\t\t\tgitProviderUrl, err := T.GitProviderURL()\n\t\t\t\t\tExpect(err).NotTo(HaveOccurred())\n\t\t\t\t\tif gitProviderUrl != \"\" {\n\t\t\t\t\t\tutils.LogInfof(\"Using Git provider URL %s\\n\", gitProviderUrl)\n\t\t\t\t\t\targs = append(args, \"--git-provider-url\", gitProviderUrl)\n\t\t\t\t\t}\n\t\t\t\t\tcommand := exec.Command(c, args...)\n\t\t\t\t\tcommand.Dir = T.WorkDir\n\t\t\t\t\tsession, err := gexec.Start(command, GinkgoWriter, GinkgoWriter)\n\t\t\t\t\tΩ(err).ShouldNot(HaveOccurred())\n\t\t\t\t\tsession.Wait(TimeoutAppTests)\n\t\t\t\t\tEventually(session).Should(gexec.Exit(0))\n\n\t\t\t\t\tapplicationName := T.GetApplicationName()\n\t\t\t\t\towner := T.GetGitOrganisation()\n\t\t\t\t\tjobName := owner + \"/\" + applicationName + \"/master\"\n\n\t\t\t\t\tif T.WaitForFirstRelease() {\n\t\t\t\t\t\tBy(\"wait for first release\")\n\t\t\t\t\t\t//FIXME Need to wait a little here to ensure that the build has started before asking for the log as the jx create quickstart command returns slightly before the build log is available\n\t\t\t\t\t\ttime.Sleep(30 * time.Second)\n\n\t\t\t\t\t\tT.ThereShouldBeAJobThatCompletesSuccessfully(jobName, 20*time.Minute)\n\t\t\t\t\t\tT.TheApplicationIsRunningInStaging(200)\n\n\t\t\t\t\t\tif T.TestPullRequest() {\n\t\t\t\t\t\t\tBy(\"perform a pull request on the source and assert that a preview environment is created\")\n\t\t\t\t\t\t\tT.CreatePullRequestAndGetPreviewEnvironment(200)\n\t\t\t\t\t\t}\n\t\t\t\t\t} else {\n\t\t\t\t\t\tBy(\"wait for first successful build of master\")\n\t\t\t\t\t\tT.ThereShouldBeAJobThatCompletesSuccessfully(jobName, 20*time.Minute)\n\t\t\t\t\t}\n\n\t\t\t\t\tif T.DeleteApplications() {\n\t\t\t\t\t\tBy(\"deletes the application\")\n\t\t\t\t\t\targs = []string{\"delete\", \"application\", \"-b\", T.ApplicationName}\n\t\t\t\t\t\tcommand = exec.Command(c, args...)\n\t\t\t\t\t\tcommand.Dir = T.WorkDir\n\t\t\t\t\t\tsession, err = gexec.Start(command, GinkgoWriter, GinkgoWriter)\n\t\t\t\t\t\tΩ(err).ShouldNot(HaveOccurred())\n\t\t\t\t\t\tsession.Wait(TimeoutAppTests)\n\t\t\t\t\t\tEventually(session).Should(gexec.Exit(0))\n\t\t\t\t\t}\n\n\t\t\t\t\tif T.DeleteRepos() {\n\t\t\t\t\t\tBy(\"deletes the repo\")\n\t\t\t\t\t\targs = []string{\"delete\", \"repo\", \"-b\", \"--github\", \"-o\", T.GetGitOrganisation(), \"-n\", T.ApplicationName}\n\t\t\t\t\t\tcommand = exec.Command(c, args...)\n\t\t\t\t\t\tcommand.Dir = T.WorkDir\n\t\t\t\t\t\tsession, err = gexec.Start(command, GinkgoWriter, GinkgoWriter)\n\t\t\t\t\t\tΩ(err).ShouldNot(HaveOccurred())\n\t\t\t\t\t\tsession.Wait(TimeoutAppTests)\n\t\t\t\t\t\tEventually(session).Should(gexec.Exit(0))\n\t\t\t\t\t}\n\t\t\t\t})\n\t\t\t})\n\t\t})\n\t\tDescribe(\"Given invalid parameters\", func() {\n\t\t\tContext(\"when -p param (project name) is missing\", func() {\n\t\t\t\tIt(\"exits with signal 1\\n\", func() {\n\t\t\t\t\tc := \"jx\"\n\t\t\t\t\targs := []string{\"create\", \"quickstart\", \"-b\", \"--org\", T.GetGitOrganisation(), \"-f\", quickstartName}\n\t\t\t\t\tT.ExpectCommandExecution(T.WorkDir, TimeoutAppTests, 1, c, args...)\n\t\t\t\t})\n\t\t\t})\n\t\t\tContext(\"when -f param (filter) does not match any quickstart\", func() {\n\t\t\t\tIt(\"exits with signal 1\\n\", func() {\n\t\t\t\t\tc := \"jx\"\n\t\t\t\t\targs := []string{\"create\", \"quickstart\", \"-b\", \"--org\", T.GetGitOrganisation(), \"-p\", T.ApplicationName, \"-f\", \"the_derek_zoolander_app_for_being_really_really_good_looking\"}\n\t\t\t\t\tT.ExpectCommandExecution(T.WorkDir, TimeoutAppTests, 1, c, args...)\n\t\t\t\t})\n\t\t\t})\n\t\t})\n\t})\n}", "title": "" }, { "docid": "6990b0d8643f0213dafef575eeb59910", "score": "0.52467674", "text": "func NewFizzBuzz() *FizzBuzz {\n\treturn &FizzBuzz{\n\t\trules: []Rule{\n\t\t\tNewDoubleModuloRule(3, 5, \"FizzBuzz\"),\n\t\t\tNewSingleModuloRule(3, \"Fizz\"),\n\t\t\tNewSingleModuloRule(5, \"Buzz\"),\n\t\t\t&NumberEchoRule{},\n\t\t},\n\t}\n}", "title": "" }, { "docid": "a56374ad6def40b0c95d70e690f5f0fe", "score": "0.52452856", "text": "func getFizzBuzzList(int1, int2, limit int, string1, string2 string) []string {\n\tif limit < 1 {\n\t\treturn []string{}\n\t}\n\tresult := make([]string, limit)\n\tfor i := 1; i <= limit; i++ {\n\t\tmod1 := i % int1\n\t\tmod2 := i % int2\n\t\tswitch {\n\t\tcase mod1 == 0 && mod2 == 0:\n\t\t\tresult[i-1] = string1 + string2\n\t\tcase mod1 == 0:\n\t\t\tresult[i-1] = string1\n\t\tcase mod2 == 0:\n\t\t\tresult[i-1] = string2\n\t\tdefault:\n\t\t\tresult[i-1] = strconv.FormatInt(int64(i), 10)\n\t\t}\n\t}\n\treturn result\n}", "title": "" }, { "docid": "a7be0c4d2204c61dee351d1c2d7dbf0c", "score": "0.5207089", "text": "func main() {\n\n\tswaggerSpec, err := loads.Embedded(restapi.SwaggerJSON, restapi.FlatSwaggerJSON)\n\tif err != nil {\n\t\tlog.Fatalln(err)\n\t}\n\n\tapi := operations.NewFizzbuzzAPI(swaggerSpec)\n\tserver := restapi.NewServer(api)\n\tdefer server.Shutdown()\n\n\tparser := flags.NewParser(server, flags.Default)\n\tparser.ShortDescription = \"A simple fizz-buzz REST server\"\n\tparser.LongDescription = \"The original fizz-buzz consists in writing all numbers from 1 to 100, and just replacing all multiples of 3 by 'fizz', all multiples of 5 by 'buzz', and all multiples of 15 by 'fizzbuzz'. This server exposes two main endpoint, one to return the fizz-buzz string given some parameters and the other to return stats about the most used request. This API is part of LeBonCoin's technical test.\"\n\tserver.ConfigureFlags()\n\tfor _, optsGroup := range api.CommandLineOptionsGroups {\n\t\t_, err := parser.AddGroup(optsGroup.ShortDescription, optsGroup.LongDescription, optsGroup.Options)\n\t\tif err != nil {\n\t\t\tlog.Fatalln(err)\n\t\t}\n\t}\n\n\tif _, err := parser.Parse(); err != nil {\n\t\tcode := 1\n\t\tif fe, ok := err.(*flags.Error); ok {\n\t\t\tif fe.Type == flags.ErrHelp {\n\t\t\t\tcode = 0\n\t\t\t}\n\t\t}\n\t\tos.Exit(code)\n\t}\n\n\tserver.ConfigureAPI()\n\n\tif err := server.Serve(); err != nil {\n\t\tlog.Fatalln(err)\n\t}\n\n}", "title": "" }, { "docid": "f0f2aeae35b6c342076a85b2f08d121a", "score": "0.5202337", "text": "func Extracts_fizzbuzz(req *http.Request) (Extracted_fizzbuzz, error) {\n\textracted_fizzbuzz := Extracted_fizzbuzz{}\n\n\textracted_fizzbuzz.Int1, _ = strconv.Atoi(req.URL.Query().Get(\"int1\"))\n\textracted_fizzbuzz.Int2, _ = strconv.Atoi(req.URL.Query().Get(\"int2\"))\n\textracted_fizzbuzz.Limit, _ = strconv.Atoi(req.URL.Query().Get(\"limit\"))\n\textracted_fizzbuzz.Str1 = req.URL.Query().Get(\"str1\")\n\textracted_fizzbuzz.Str2 = req.URL.Query().Get(\"str2\")\n\n\tif extracted_fizzbuzz.Int1 < 1 {\n\t\treturn extracted_fizzbuzz, errors.New(\"int1 is missing or not strictly positive or bad formated\")\n\t}\n\n\tif extracted_fizzbuzz.Int2 < 1 {\n\t\treturn extracted_fizzbuzz, errors.New(\"int2 is missing or not strictly positive or bad formated\")\n\t}\n\n\tif extracted_fizzbuzz.Limit < 1 {\n\t\treturn extracted_fizzbuzz, errors.New(\"limit is missing or not strictly positive or bad formated\")\n\t}\n\n\tif extracted_fizzbuzz.Int1 == extracted_fizzbuzz.Int2 {\n\t\treturn extracted_fizzbuzz, errors.New(\"int1 can't be equal to int2\")\n\t}\n\n\tif extracted_fizzbuzz.Int1 > extracted_fizzbuzz.Limit {\n\t\treturn extracted_fizzbuzz, errors.New(\"int1 cannot be greater than limit\")\n\t}\n\n\tif extracted_fizzbuzz.Int2 > extracted_fizzbuzz.Limit {\n\t\treturn extracted_fizzbuzz, errors.New(\"int2 cannot be greater than limit\")\n\t}\n\n\tif len(extracted_fizzbuzz.Str1) < 1 {\n\t\treturn extracted_fizzbuzz, errors.New(\"str1 is missing\")\n\t}\n\n\tif len(extracted_fizzbuzz.Str1) > 30 {\n\t\treturn extracted_fizzbuzz, errors.New(\"str1 cannot be more than 30 characters\")\n\t}\n\n\tif len(extracted_fizzbuzz.Str2) < 1 {\n\t\treturn extracted_fizzbuzz, errors.New(\"str2 is missing\")\n\t}\n\n\tif len(extracted_fizzbuzz.Str1) > 30 {\n\t\treturn extracted_fizzbuzz, errors.New(\"str1 cannot be more than 30 characters\")\n\t}\n\n\treturn extracted_fizzbuzz, nil\n}", "title": "" }, { "docid": "b523327231555c596288e619195db395", "score": "0.5041068", "text": "func main() {\n\tfor num := 0; num <= 100; num++ {\n\t\tif num%15 == 0 {\n\t\t\tfmt.Println(\"FizzBuzz\")\n\t\t} else if num%5 == 0 {\n\t\t\tfmt.Println(\"Buzz\")\n\t\t} else if num%3 == 0 {\n\t\t\tfmt.Println(\"Fizz\")\n\t\t} else {\n\t\t\tfmt.Println(num)\n\t\t}\n\t}\n}", "title": "" }, { "docid": "b1874b1a8e6b9ed3fdd043cff00a4d8a", "score": "0.50345904", "text": "func Init() {\n // host flag (required)\n Fuzz.Flags().StringVarP(&host, \"host\", \"H\", \"\",\n \"the target machine's IP address\")\n Fuzz.MarkFlagRequired(\"host\")\n\n // port flag (required)\n Fuzz.Flags().IntVarP(&port, \"port\", \"P\", 0,\n \"the port the target service is running on\")\n Fuzz.MarkFlagRequired(\"port\")\n\n // prefix and suffix flags (optional)\n Fuzz.Flags().StringVarP(&pref, \"prefix\", \"p\", \"\",\n \"(optional) prefix to put before payload\")\n Fuzz.Flags().StringVarP(&suff, \"suffix\", \"s\", \"\",\n \"(optional) suffix to put after payload\")\n\n // step size flag (required)\n Fuzz.Flags().IntVarP(&step, \"step\", \"S\", 0,\n \"the length by which each subsequent buffer is increased\")\n Fuzz.MarkFlagRequired(\"step\")\n}", "title": "" }, { "docid": "2e33ccc91f227be3f708f267f245daca", "score": "0.4999461", "text": "func (stats statsCalls) handleFizzBuzz(w http.ResponseWriter, r *http.Request) {\n\n\tswitch r.Method {\n\tcase http.MethodGet:\n\n\t\tvalues := r.URL.Query()\n\t\td1String := values.Get(\"int1\")\n\t\td2String := values.Get(\"int2\")\n\t\tlimitString := values.Get(\"limit\")\n\t\tstr1 := values.Get(\"str1\")\n\t\tstr2 := values.Get(\"str2\")\n\n\t\td1, err := strconv.ParseInt(d1String, 10, 64)\n\t\tif err != nil {\n\t\t\thttp.Error(w, fmt.Sprintf(\"malformatted 'int1' value: %s\", d1String), http.StatusBadRequest)\n\t\t\treturn\n\t\t}\n\n\t\td2, err := strconv.ParseInt(d2String, 10, 64)\n\t\tif err != nil {\n\t\t\thttp.Error(w, fmt.Sprintf(\"malformatted 'int2' value: %s\", d2String), http.StatusBadRequest)\n\t\t\treturn\n\t\t}\n\n\t\tlimit, err := strconv.ParseInt(limitString, 10, 64)\n\t\tif err != nil {\n\t\t\thttp.Error(w, fmt.Sprintf(\"malformatted 'limit' value: %s\", limitString), http.StatusBadRequest)\n\t\t\treturn\n\t\t}\n\n\t\tif int32Overflow(w, d1, \"int1\") || int32Overflow(w, d2, \"int2\") || int32Overflow(w, limit, \"limit\") {\n\t\t\treturn\n\t\t}\n\n\t\tp := transformQuery(int(d1), int(d2), int(limit), str1, str2)\n\t\tstats.add(p)\n\n\t\t_, err = w.Write(fizzBuzz(int(d1), int(d2), int(limit), str1, str2))\n\t\tif err != nil {\n\t\t\thttp.Error(w, \"internal server error\", http.StatusInternalServerError)\n\t\t\treturn\n\t\t}\n\n\tdefault:\n\t\thttp.Error(w, fmt.Sprintf(\"unsupported method: %s\", http.MethodPost), http.StatusMethodNotAllowed)\n\t\treturn\n\t}\n}", "title": "" }, { "docid": "47d2a0c8931a1b08f68ad893735cd621", "score": "0.4988622", "text": "func TestBuildGood(t *testing.T) {\n\tfor _, name := range testGoodNames {\n\t\tdstname := path.Join(\"test\", fmt.Sprintf(\"%s.go\", name))\n\t\tsrcname := path.Join(\"test\", fmt.Sprintf(\"%s.v\", name))\n\t\ttestBuildGood(t, dstname, srcname)\n\t}\n}", "title": "" }, { "docid": "ebb51dfcbd5a06ba7ebe0a02943e12e3", "score": "0.49013698", "text": "func main() {\n\n\tfor i := 0; i <= 100; i++ {\n\t\tif i == 0 {\n\t\t\tfmt.Println(i)\n\t\t} else if i%15 == 0 {\n\t\t\tfmt.Println(\"FizzBuzz\")\n\t\t} else if i%3 == 0 {\n\t\t\tfmt.Println(\"Fizz\")\n\t\t} else if i%5 == 0 {\n\t\t\tfmt.Println(\"Buzz\")\n\t\t} else {\n\t\t\tfmt.Println(i)\n\t\t}\n\t}\n}", "title": "" }, { "docid": "925537548361a742614d5fa8af85a783", "score": "0.4868893", "text": "func main() {\n\ttest(echo1, 1)\n\ttest(echo2, 2)\n\ttest(echo3, 3)\n}", "title": "" }, { "docid": "095e2837ceeb7f0643510c28d3acb96d", "score": "0.48549804", "text": "func makeTestFromDefinition(filePath string, testDefinition TestDefinition) ([]Test, error) {\n\tvar tests []Test\n\n\t// test definition has no cases, so using request/response as is\n\tif len(testDefinition.Cases) == 0 {\n\t\ttest := Test{TestDefinition: testDefinition, Filename: filePath}\n\t\ttest.Description = testDefinition.Description\n\t\ttest.Request = testDefinition.RequestTmpl\n\t\ttest.Responses = testDefinition.ResponseTmpls\n\t\ttest.ResponseHeaders = testDefinition.ResponseHeaders\n\t\ttest.BeforeScript = testDefinition.BeforeScriptParams.PathTmpl\n\t\ttest.AfterRequestScript = testDefinition.AfterRequestScriptParams.PathTmpl\n\t\ttest.DbQuery = testDefinition.DbQueryTmpl\n\t\ttest.DbResponse = testDefinition.DbResponseTmpl\n\t\ttest.CombinedVariables = testDefinition.Variables\n\n\t\tdbChecks := []models.DatabaseCheck{}\n\t\tfor _, check := range testDefinition.DatabaseChecks {\n\t\t\tdbChecks = append(dbChecks, &dbCheck{query: check.DbQueryTmpl, response: check.DbResponseTmpl})\n\t\t}\n\t\ttest.DbChecks = dbChecks\n\n\t\treturn append(tests, test), nil\n\t}\n\n\tvar err error\n\n\trequestTmpl := testDefinition.RequestTmpl\n\tbeforeScriptPathTmpl := testDefinition.BeforeScriptParams.PathTmpl\n\tafterRequestScriptPathTmpl := testDefinition.AfterRequestScriptParams.PathTmpl\n\trequestURLTmpl := testDefinition.RequestURL\n\tqueryParamsTmpl := testDefinition.QueryParams\n\theadersValTmpl := testDefinition.HeadersVal\n\tcookiesValTmpl := testDefinition.CookiesVal\n\tresponseHeadersTmpl := testDefinition.ResponseHeaders\n\tcombinedVariables := map[string]string{}\n\n\tif testDefinition.Variables != nil {\n\t\tcombinedVariables = testDefinition.Variables\n\t}\n\n\t// produce as many tests as cases defined\n\tfor caseIdx, testCase := range testDefinition.Cases {\n\t\ttest := Test{TestDefinition: testDefinition, Filename: filePath}\n\t\ttest.Name = fmt.Sprintf(\"%s #%d\", test.Name, caseIdx+1)\n\n\t\tif testCase.Description != \"\" {\n\t\t\ttest.Description = testCase.Description\n\t\t}\n\n\t\t// substitute RequestArgs to different parts of request\n\t\ttest.RequestURL, err = substituteArgs(requestURLTmpl, testCase.RequestArgs)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\n\t\ttest.Request, err = substituteArgs(requestTmpl, testCase.RequestArgs)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\n\t\ttest.QueryParams, err = substituteArgs(queryParamsTmpl, testCase.RequestArgs)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\n\t\ttest.HeadersVal, err = substituteArgsToMap(headersValTmpl, testCase.RequestArgs)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\n\t\ttest.CookiesVal, err = substituteArgsToMap(cookiesValTmpl, testCase.RequestArgs)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\n\t\t// substitute ResponseArgs to different parts of response\n\t\ttest.Responses = make(map[int]string)\n\t\tfor status, tpl := range testDefinition.ResponseTmpls {\n\t\t\targs, ok := testCase.ResponseArgs[status]\n\t\t\tif ok {\n\t\t\t\t// found args for response status\n\t\t\t\ttest.Responses[status], err = substituteArgs(tpl, args)\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn nil, err\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\t// not found args, using response as is\n\t\t\t\ttest.Responses[status] = tpl\n\t\t\t}\n\t\t}\n\n\t\ttest.ResponseHeaders = make(map[int]map[string]string)\n\t\tfor status, respHeaders := range responseHeadersTmpl {\n\t\t\targs, ok := testCase.ResponseArgs[status]\n\t\t\tif ok {\n\t\t\t\t// found args for response status\n\t\t\t\ttest.ResponseHeaders[status], err = substituteArgsToMap(respHeaders, args)\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn nil, err\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\t// not found args, using response as is\n\t\t\t\ttest.ResponseHeaders[status] = respHeaders\n\t\t\t}\n\t\t}\n\n\t\ttest.BeforeScript, err = substituteArgs(beforeScriptPathTmpl, testCase.BeforeScriptArgs)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\n\t\ttest.AfterRequestScript, err = substituteArgs(afterRequestScriptPathTmpl, testCase.AfterRequestScriptArgs)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\n\t\ttest.DbQuery, err = substituteArgs(testDefinition.DbQueryTmpl, testCase.DbQueryArgs)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\n\t\tfor key, value := range testCase.Variables {\n\t\t\tcombinedVariables[key] = value.(string)\n\t\t}\n\t\ttest.CombinedVariables = combinedVariables\n\n\t\t// compile DbResponse\n\t\tif testCase.DbResponse != nil {\n\t\t\t// DbResponse from test case has top priority\n\t\t\ttest.DbResponse = testCase.DbResponse\n\t\t} else {\n\t\t\tif len(testDefinition.DbResponseTmpl) != 0 {\n\t\t\t\t// compile DbResponse string by string\n\t\t\t\tfor _, tpl := range testDefinition.DbResponseTmpl {\n\t\t\t\t\tdbResponseString, err := substituteArgs(tpl, testCase.DbResponseArgs)\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\ttest.DbResponse = append(test.DbResponse, dbResponseString)\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\ttest.DbResponse = testDefinition.DbResponseTmpl\n\t\t\t}\n\t\t}\n\n\t\tdbChecks := []models.DatabaseCheck{}\n\t\tfor _, check := range testDefinition.DatabaseChecks {\n\t\t\tquery, err := substituteArgs(check.DbQueryTmpl, testCase.DbQueryArgs)\n\t\t\tif err != nil {\n\t\t\t\treturn nil, err\n\t\t\t}\n\n\t\t\tc := &dbCheck{query: query}\n\t\t\tfor _, tpl := range check.DbResponseTmpl {\n\t\t\t\tresponseString, err := substituteArgs(tpl, testCase.DbResponseArgs)\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\tc.response = append(c.response, responseString)\n\t\t\t}\n\n\t\t\tdbChecks = append(dbChecks, c)\n\t\t}\n\n\t\ttest.DbChecks = dbChecks\n\n\t\ttests = append(tests, test)\n\t}\n\n\treturn tests, nil\n}", "title": "" }, { "docid": "222c52340dd861ac57e00e78b1e66a3a", "score": "0.4852533", "text": "func main() {\n\n\t// creating input file in a current directory\n\tr, err := os.Create(\"inputdata\")\n\tif err != nil {\n\t\tfmt.Print(\"Enable to create input file\\n\")\n\t\treturn\n\t}\n\tr.Close()\n\n\tfmt.Printf(\"Welcome to fizzbuzz!\\nPlease, write your data to 'inputdata' file and press ENTER\\n\")\n\n\t// scanf is waiting for user to allow program to continue\n\tvar any byte\n\tfmt.Scanf(\"%c\", &any)\n\n\treader, _ := os.Open(\"inputdata\")\n\twriter, _ := os.Create(\"outputdata\")\n\n\terr = fizzbuzz.FizzBuzz(reader, writer)\n\n\tif err != nil {\n\t\tfmt.Printf(\"Ooop-s, something went wrong, check your input, error: %v \\n \", err)\n\t} else {\n\t\tfmt.Print(\"Check out the results in output file!=)\\n\")\n\t}\n\n\treader.Close()\n\twriter.Close()\n}", "title": "" }, { "docid": "d98e53a0634f723e67f393265a794d6f", "score": "0.4850591", "text": "func fzgoMain() int {\n\n\t// register our flags\n\tfs, err := fuzz.FlagSet(\"fzgo test -fuzz\", flagDefs, usage)\n\tif err != nil {\n\t\tfmt.Println(\"fzgo:\", err)\n\t\treturn OtherErr\n\t}\n\n\t// print our fzgo-specific help for variations like 'fzgo', 'fzgo help', 'fzgo -h', 'fzgo --help', 'fzgo help foo'\n\tif len(os.Args) < 2 || os.Args[1] == \"help\" {\n\t\tfs.Usage()\n\t\treturn ArgErr\n\t}\n\tif _, _, ok := fuzz.FindFlag(os.Args[1:2], []string{\"h\", \"help\"}); ok {\n\t\tfs.Usage()\n\t\treturn ArgErr\n\t}\n\n\tif os.Args[1] != \"test\" {\n\t\t// pass through to 'go' command\n\t\terr = fuzz.ExecGo(os.Args[1:], nil)\n\t\tif err != nil {\n\t\t\t// ExecGo prints error if 'go' tool is not in path.\n\t\t\t// Other than that, we currently rely on the 'go' tool to print any errors itself.\n\t\t\treturn OtherErr\n\t\t}\n\t\treturn Success\n\t}\n\n\t// 'test' command is specified.\n\t// check to see if we have a -fuzz flag, and if so, parse the args we will interpret.\n\tpkgPattern, err := fuzz.ParseArgs(os.Args[2:], fs)\n\tif err == flag.ErrHelp {\n\t\t// if we get here, we already printed usage.\n\t\treturn ArgErr\n\t} else if err != nil {\n\t\tfmt.Println(\"fzgo:\", err)\n\t\treturn ArgErr\n\t}\n\n\tif flagFuzzFunc == \"\" {\n\t\t// 'fzgo test' without '-fuzz'\n\t\t// We have not been asked to generate new fuzz-based inputs,\n\t\t// but will instead:\n\t\t// 1. we deterministically validate our corpus.\n\t\t// it might be a subset or a single file if have something like -run=Corpus/01FFABCD.\n\t\t// we don't try any crashers given those are expected to fail (prior to a fix, of course).\n\t\tstatus := verifyCorpus(os.Args,\n\t\t\tverifyCorpusOptions{run: flagRun, tryCrashers: false, verbose: flagVerbose})\n\t\tif status != Success {\n\t\t\treturn status\n\t\t}\n\t\t// Because -fuzz is not set, we also:\n\t\t// 2. pass our arguments through to the normal 'go' command, which will run normal 'go test'.\n\t\tif flagFuzzFunc == \"\" {\n\t\t\terr = fuzz.ExecGo(os.Args[1:], nil)\n\t\t\tif err != nil {\n\t\t\t\treturn OtherErr\n\t\t\t}\n\t\t}\n\t\treturn Success\n\t} else if flagFuzzFunc != \"\" && flagRun != \"\" {\n\t\t//'fzgo test -fuzz=foo -run=bar'\n\t\t// The -run means we have not been asked to generate new fuzz-based inputs,\n\t\t// but instead will run our corpus, and possibly any crashers if\n\t\t// -run matches (e.g., -run=TestCrashers or -run=TestCrashers/02ABCDEF).\n\t\t// Crashers will only be executed if the -run argument matches.\n\t\treturn verifyCorpus(os.Args,\n\t\t\tverifyCorpusOptions{run: flagRun, tryCrashers: true, verbose: flagVerbose})\n\t}\n\n\t// we now know we have been asked to do fuzzing.\n\t// gather the basic fuzzing settings from our flags.\n\tallowMultiFuzz := flagDebug != \"nomultifuzz\"\n\tparallel := flagParallel\n\tif parallel == 0 {\n\t\tparallel = runtime.GOMAXPROCS(0)\n\t}\n\tfuncTimeout := flagTimeout\n\tif funcTimeout == 0 {\n\t\tfuncTimeout = 10 * time.Second\n\t} else if funcTimeout < 1*time.Second {\n\t\tfmt.Printf(\"fzgo: fuzz function timeout value %s in -timeout flag is less than minimum of 1 second\\n\", funcTimeout)\n\t\treturn ArgErr\n\t}\n\n\t// look for the functions we have been asked to fuzz.\n\tfunctions, err := fuzz.FindFunc(pkgPattern, flagFuzzFunc, nil, allowMultiFuzz)\n\tif err != nil {\n\t\tfmt.Println(\"fzgo:\", err)\n\t\treturn OtherErr\n\t} else if len(functions) == 0 {\n\t\tfmt.Printf(\"fzgo: failed to find fuzz function for pattern %v and func %v\\n\", pkgPattern, flagFuzzFunc)\n\t\treturn OtherErr\n\t}\n\tif flagVerbose {\n\t\tvar names []string\n\t\tfor _, function := range functions {\n\t\t\tnames = append(names, function.String())\n\t\t}\n\t\tfmt.Printf(\"fzgo: found functions %s\\n\", strings.Join(names, \", \"))\n\t}\n\n\t// build our instrumented code, or find if is is already built in the fzgo cache\n\tvar targets []fuzz.Target\n\tfor _, function := range functions {\n\t\ttarget, err := fuzz.Instrument(function, flagVerbose)\n\t\tif err != nil {\n\t\t\tfmt.Println(\"fzgo:\", err)\n\t\t\treturn OtherErr\n\t\t}\n\t\ttargets = append(targets, target)\n\t}\n\n\tif flagCompile {\n\t\tfmt.Println(\"fzgo: finished instrumenting binaries\")\n\t\treturn Success\n\t}\n\n\t// run forever if flagFuzzTime was not set (that is, has default value of 0).\n\tloopForever := flagFuzzTime == 0\n\ttimeQuantum := 5 * time.Second\n\tfor {\n\t\tfor _, target := range targets {\n\t\t\t// pull our last bit of info out of our arguments.\n\t\t\tworkDir := determineWorkDir(target.UserFunc, flagFuzzDir)\n\n\t\t\t// seed our workDir with any other corpus that might exist from other known locations.\n\t\t\t// see comment for copyCachedCorpus for discussion of current behavior vs. desired behavior.\n\t\t\tif err = copyCachedCorpus(target.UserFunc, workDir); err != nil {\n\t\t\t\tfmt.Println(\"fzgo:\", err)\n\t\t\t\treturn OtherErr\n\t\t\t}\n\n\t\t\t// determine how long we will execute this particular fuzz invocation.\n\t\t\tvar fuzzDuration time.Duration\n\t\t\tif !loopForever {\n\t\t\t\tfuzzDuration = flagFuzzTime\n\t\t\t} else {\n\t\t\t\tif len(targets) > 1 {\n\t\t\t\t\tfuzzDuration = timeQuantum\n\t\t\t\t} else {\n\t\t\t\t\tfuzzDuration = 0 // unlimited\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t// fuzz!\n\t\t\terr = fuzz.Start(target, workDir, fuzzDuration, parallel, funcTimeout, flagVerbose)\n\t\t\tif err != nil {\n\t\t\t\tfmt.Println(\"fzgo:\", err)\n\t\t\t\treturn OtherErr\n\t\t\t}\n\t\t\tfmt.Println() // blank separator line at end of one target's fuzz run.\n\t\t}\n\t\t// run forever if flagFuzzTime was not set,\n\t\t// but otherwise break after fuzzing each target once for flagFuzzTime above.\n\t\tif !loopForever {\n\t\t\tbreak\n\t\t}\n\t\ttimeQuantum *= 2\n\t\tif timeQuantum > 10*time.Minute {\n\t\t\ttimeQuantum = 10 * time.Minute\n\t\t}\n\n\t}\n\treturn Success\n}", "title": "" }, { "docid": "4090c02cf5b5114844f2fc13c2ff8656", "score": "0.48489434", "text": "func TestBuildSimple(t *testing.T) {\n\n\tt.Log(\"stacksList is: \", stacksList)\n\n\t// if stacksList is empty there is nothing to test so return\n\tif stacksList == \"\" {\n\t\tt.Log(\"stacksList is empty, exiting test...\")\n\t\treturn\n\t}\n\n\t// split the appsodyStack env variable\n\tstackRaw := strings.Split(stacksList, \" \")\n\n\t// loop through the stacks\n\tfor i := range stackRaw {\n\n\t\tt.Log(\"***Testing stack: \", stackRaw[i], \"***\")\n\n\t\t// first add the test repo index\n\t\t_, cleanup, err := cmdtest.AddLocalFileRepo(\"LocalTestRepo\", \"../cmd/testdata/index.yaml\")\n\t\tif err != nil {\n\t\t\tt.Fatal(err)\n\t\t}\n\n\t\t// create a temporary dir to create the project and run the test\n\t\tprojectDir := cmdtest.GetTempProjectDir(t)\n\t\tdefer os.RemoveAll(projectDir)\n\t\tt.Log(\"Created project dir: \" + projectDir)\n\n\t\t// appsody init\n\t\tt.Log(\"Running appsody init...\")\n\t\t_, err = cmdtest.RunAppsodyCmd([]string{\"init\", stackRaw[i]}, projectDir)\n\t\tif err != nil {\n\t\t\tt.Fatal(err)\n\t\t}\n\n\t\t// appsody build\n\t\trunChannel := make(chan error)\n\t\timageName := \"testbuildimage\"\n\t\tgo func() {\n\t\t\t_, err = cmdtest.RunAppsodyCmd([]string{\"build\", \"--tag\", imageName}, projectDir)\n\t\t\trunChannel <- err\n\t\t}()\n\n\t\t// It will take a while for the image to build, so lets use docker image ls to wait for it\n\t\tt.Log(\"calling docker image ls to wait for the image\")\n\t\timageBuilt := false\n\t\tcount := 900\n\t\tfor {\n\t\t\tdockerOutput, dockerErr := cmdtest.RunDockerCmdExec([]string{\"image\", \"ls\", imageName})\n\t\t\tif dockerErr != nil {\n\t\t\t\tt.Log(\"Ignoring error running docker image ls \"+imageName, dockerErr)\n\t\t\t}\n\t\t\tif strings.Contains(dockerOutput, imageName) {\n\t\t\t\tt.Log(\"docker image \" + imageName + \" was found\")\n\t\t\t\timageBuilt = true\n\t\t\t} else {\n\t\t\t\ttime.Sleep(2 * time.Second)\n\t\t\t\tcount = count - 1\n\t\t\t}\n\t\t\tif count == 0 || imageBuilt {\n\t\t\t\tbreak\n\t\t\t}\n\t\t}\n\n\t\tif !imageBuilt {\n\t\t\tt.Fatal(\"image was never built\")\n\t\t}\n\n\t\t//delete the image\n\t\tdeleteImage(imageName)\n\n\t\t// clean up\n\t\tcleanup()\n\t}\n}", "title": "" }, { "docid": "10216cce992559f0f6d89cfe15e7f4cc", "score": "0.48398858", "text": "func generateName(prefix string, maxLen int) string {\n\t// The following lines step up the stack find the name of the test method\n\t// Note: the way to do this changed in go 1.12, refer to release notes for more info\n\tvar pcs [10]uintptr\n\tn := runtime.Callers(1, pcs[:])\n\tframes := runtime.CallersFrames(pcs[:n])\n\tname := \"TestFoo\" // default stub \"Foo\" is used if anything goes wrong with this procedure\n\tfor {\n\t\tframe, more := frames.Next()\n\t\tif strings.Contains(frame.Func.Name(), \"Suite\") {\n\t\t\tname = frame.Func.Name()\n\t\t\tbreak\n\t\t} else if !more {\n\t\t\tbreak\n\t\t}\n\t}\n\tfuncNameStart := strings.Index(name, \"Test\")\n\tname = name[funcNameStart+len(\"Test\"):] // Just get the name of the test and not any of the garbage at the beginning\n\tname = strings.ToLower(name) // Ensure it is a valid resource name\n\ttextualPortion := fmt.Sprintf(\"%s%s\", prefix, strings.ToLower(name))\n\tcurrentTime := time.Now()\n\tnumericSuffix := fmt.Sprintf(\"%02d%02d%d\", currentTime.Minute(), currentTime.Second(), currentTime.Nanosecond())\n\tif maxLen > 0 {\n\t\tmaxTextLen := maxLen - len(numericSuffix)\n\t\tif maxTextLen < 1 {\n\t\t\tpanic(\"max len too short\")\n\t\t}\n\t\tif len(textualPortion) > maxTextLen {\n\t\t\ttextualPortion = textualPortion[:maxTextLen]\n\t\t}\n\t}\n\tname = textualPortion + numericSuffix\n\treturn name\n}", "title": "" }, { "docid": "b0c57b9c16a21d668d3d32bc50500e89", "score": "0.4817685", "text": "func FizzBuzzWelcome() string {\n\treturn \"Welcome to FizzBuzz!\"\n}", "title": "" }, { "docid": "d7683bc4ea87ea69f9d747dd8caf4d2e", "score": "0.48136124", "text": "func test(b *specs.TasksCfgBuilder, name string, parts map[string]string, compileTaskName string, pkgs []*specs.CipdPackage) string {\n\ts := &specs.TaskSpec{\n\t\tCipdPackages: pkgs,\n\t\tDependencies: []string{compileTaskName},\n\t\tDimensions: swarmDimensions(parts),\n\t\tExecutionTimeout: 4 * time.Hour,\n\t\tExpiration: 20 * time.Hour,\n\t\tExtraArgs: []string{\n\t\t\t\"--workdir\", \"../../..\", \"swarm_test\",\n\t\t\tfmt.Sprintf(\"repository=%s\", specs.PLACEHOLDER_REPO),\n\t\t\tfmt.Sprintf(\"buildername=%s\", name),\n\t\t\t\"mastername=fake-master\",\n\t\t\t\"buildnumber=2\",\n\t\t\t\"slavename=fake-buildslave\",\n\t\t\t\"nobuildbot=True\",\n\t\t\tfmt.Sprintf(\"swarm_out_dir=%s\", specs.PLACEHOLDER_ISOLATED_OUTDIR),\n\t\t\tfmt.Sprintf(\"revision=%s\", specs.PLACEHOLDER_REVISION),\n\t\t\tfmt.Sprintf(\"patch_storage=%s\", specs.PLACEHOLDER_PATCH_STORAGE),\n\t\t\tfmt.Sprintf(\"patch_issue=%s\", specs.PLACEHOLDER_ISSUE),\n\t\t\tfmt.Sprintf(\"patch_set=%s\", specs.PLACEHOLDER_PATCHSET),\n\t\t},\n\t\tIoTimeout: 40 * time.Minute,\n\t\tIsolate: \"test_skia.isolate\",\n\t\tPriority: 0.8,\n\t}\n\tif strings.Contains(parts[\"extra_config\"], \"Valgrind\") {\n\t\ts.ExecutionTimeout = 9 * time.Hour\n\t\ts.Expiration = 48 * time.Hour\n\t\ts.IoTimeout = time.Hour\n\t} else if strings.Contains(parts[\"extra_config\"], \"MSAN\") {\n\t\ts.ExecutionTimeout = 9 * time.Hour\n\t}\n\tb.MustAddTask(name, s)\n\n\t// Upload results if necessary.\n\tif doUpload(name) {\n\t\tuploadName := fmt.Sprintf(\"%s%s%s\", PREFIX_UPLOAD, jobNameSchema.Sep, name)\n\t\tb.MustAddTask(uploadName, &specs.TaskSpec{\n\t\t\tDependencies: []string{name},\n\t\t\tDimensions: LINUX_GCE_DIMENSIONS,\n\t\t\tExtraArgs: []string{\n\t\t\t\t\"--workdir\", \"../../..\", \"upload_dm_results\",\n\t\t\t\tfmt.Sprintf(\"repository=%s\", specs.PLACEHOLDER_REPO),\n\t\t\t\tfmt.Sprintf(\"buildername=%s\", name),\n\t\t\t\t\"mastername=fake-master\",\n\t\t\t\t\"buildnumber=2\",\n\t\t\t\t\"slavename=fake-buildslave\",\n\t\t\t\t\"nobuildbot=True\",\n\t\t\t\tfmt.Sprintf(\"swarm_out_dir=%s\", specs.PLACEHOLDER_ISOLATED_OUTDIR),\n\t\t\t\tfmt.Sprintf(\"revision=%s\", specs.PLACEHOLDER_REVISION),\n\t\t\t\tfmt.Sprintf(\"patch_storage=%s\", specs.PLACEHOLDER_PATCH_STORAGE),\n\t\t\t\tfmt.Sprintf(\"patch_issue=%s\", specs.PLACEHOLDER_ISSUE),\n\t\t\t\tfmt.Sprintf(\"patch_set=%s\", specs.PLACEHOLDER_PATCHSET),\n\t\t\t},\n\t\t\tIsolate: \"upload_dm_results.isolate\",\n\t\t\tPriority: 0.8,\n\t\t})\n\t\treturn uploadName\n\t}\n\treturn name\n}", "title": "" }, { "docid": "f3a0a2fafd6a86d3d4a396eab0d3ce21", "score": "0.48086244", "text": "func Test_bandNameGenerator(t *testing.T) {\n\ttype args struct {\n\t\tword string\n\t}\n\ttests := []struct {\n\t\tname string\n\t\targs args\n\t\twant string\n\t}{\n\t\t// TODO: Add test cases.\n\t\t{name: \"default\", args: args{word: \"dolphin\"}, want: \"The Dolphin\"},\n\t\t{name: \"case1\", args: args{word: \"alaska\"}, want: \"Alaskalaska\"},\n\t\t{name: \"case2\", args: args{word: \"knife\"}, want: \"The Knife\"},\n\t\t{name: \"case3\", args: args{word: \"tart\"}, want: \"Tartart\"},\n\t\t{name: \"case4\", args: args{word: \"sandles\"}, want: \"Sandlesandles\"},\n\t\t{name: \"case5\", args: args{word: \"bed\"}, want: \"The Bed\"},\n\t}\n\tfor _, tt := range tests {\n\t\tt.Run(tt.name, func(t *testing.T) {\n\t\t\tif got := bandNameGenerator(tt.args.word); got != tt.want {\n\t\t\t\tt.Errorf(\"bandNameGenerator() = %v, want %v\", got, tt.want)\n\t\t\t}\n\t\t})\n\t}\n}", "title": "" }, { "docid": "6f487b1d105118705eb2fa079f23d749", "score": "0.48029152", "text": "func testFuzz(t *testing.T, fuzz func([]byte) int) {\n\tt.Helper()\n\n\tname := funcName(fuzz)\n\n\tworkdir := filepath.Join(\"testdata\", \"fuzz\", name)\n\tcorpus := filepath.Join(workdir, \"corpus\")\n\tcrashers := filepath.Join(workdir, \"crashers\")\n\n\twalkFn := func(path string, info os.FileInfo, err error) error {\n\t\tt.Helper()\n\n\t\tif err != nil {\n\t\t\t// Do nothing if the root directory does not exist.\n\t\t\t// Note that we expect testdata to be immutable\n\t\t\t// while running tests (but not fuzzing).\n\t\t\tif os.IsNotExist(err) {\n\t\t\t\treturn nil\n\t\t\t}\n\t\t\treturn err\n\t\t}\n\n\t\t// Don’t descend into subdirectories.\n\t\tif info.IsDir() && path != corpus && path != crashers {\n\t\t\treturn filepath.SkipDir\n\t\t}\n\n\t\tif !info.Mode().IsRegular() {\n\t\t\treturn nil\n\t\t}\n\n\t\t// Skip debug info in crashers directory.\n\t\tif path == crashers {\n\t\t\tif strings.HasSuffix(path, \".output\") || strings.HasSuffix(path, \".quoted\") {\n\t\t\t\treturn nil\n\t\t\t}\n\t\t}\n\n\t\tt.Run(info.Name(), func(t *testing.T) {\n\t\t\tt.Helper()\n\n\t\t\tdata, err := ioutil.ReadFile(path)\n\t\t\tif err != nil {\n\t\t\t\tt.Errorf(\"read test data: %v\", err)\n\t\t\t\treturn\n\t\t\t}\n\n\t\t\tfuzz(data)\n\t\t})\n\n\t\treturn nil\n\t}\n\n\troots := []string{corpus, crashers}\n\tfor _, root := range roots {\n\t\terr := filepath.Walk(root, walkFn)\n\t\tif err != nil {\n\t\t\tt.Errorf(\"walk %q: %v\", root, err)\n\t\t}\n\t}\n}", "title": "" }, { "docid": "fe0a2a7f0f71128d75afde3c740cb427", "score": "0.48025376", "text": "func FizzBuzzNaive(int1, int2 int, string1, string2 string, limit int) ([]string, error, uint) {\n\tvar result []string\n\tresult, err, code := fizzBuzzCheck(int1, int2, string1, string2, limit)\n\tif err != nil {\n\t\treturn result, err, code\n\t}\n\tfor i := 1; i <= limit; i++ {\n\t\tif i%int1 == 0 && i%int2 == 0 {\n\t\t\tresult = append(result, string1+string2)\n\t\t} else if i%int1 == 0 {\n\t\t\tresult = append(result, string1)\n\t\t} else if i%int2 == 0 {\n\t\t\tresult = append(result, string2)\n\t\t} else {\n\t\t\tresult = append(result, strconv.Itoa(i))\n\t\t}\n\t}\n\treturn result, nil, 0\n}", "title": "" }, { "docid": "e069ba91936f4a8c6326d372e9f32d86", "score": "0.47914708", "text": "func main() {\n\tflag.Parse()\n\tif len(flag.Args()) != 1 || len(flag.Arg(0)) == 0 {\n\t\tfailf(\"usage: go-fuzz-build pkg\")\n\t}\n\tGOROOT = os.Getenv(\"GOROOT\")\n\tif GOROOT == \"\" {\n\t\tout, err := exec.Command(\"go\", \"env\", \"GOROOT\").CombinedOutput()\n\t\tif err != nil || len(out) == 0 {\n\t\t\tfailf(\"GOROOT is not set and failed to locate it: 'go env GOROOT' returned '%s' (%v)\", out, err)\n\t\t}\n\t\tGOROOT = strings.Trim(string(out), \"\\n\\t \")\n\t}\n\tpkg := flag.Arg(0)\n\tif pkg[0] == '.' {\n\t\tfailf(\"relative import paths are not supported, please specify full package name\")\n\t}\n\n\t// To produce error messages (this is much faster and gives correct line numbers).\n\ttestNormalBuild(pkg)\n\n\tdeps := make(map[string]bool)\n\tfor _, p := range goListList(pkg, \"Deps\") {\n\t\tdeps[p] = true\n\t}\n\tdeps[pkg] = true\n\t// These packages are used by go-fuzz-dep, so we need to copy them regardless.\n\tdeps[\"runtime\"] = true\n\tdeps[\"syscall\"] = true\n\tdeps[\"time\"] = true\n\tdeps[\"errors\"] = true\n\tdeps[\"unsafe\"] = true\n\tdeps[\"sync\"] = true\n\tdeps[\"sync/atomic\"] = true\n\tdeps[\"internal/race\"] = true\n\tif runtime.GOOS == \"windows\" {\n\t\t// syscall depends on unicode/utf16.\n\t\t// Cross-compilation is not implemented.\n\t\tdeps[\"unicode/utf16\"] = true\n\t}\n\n\tlits := make(map[Literal]struct{})\n\tvar blocks, sonar []CoverBlock\n\tsonarBin := buildInstrumentedBinary(pkg, deps, nil, nil, &sonar)\n\tcoverBin := buildInstrumentedBinary(pkg, deps, lits, &blocks, nil)\n\tmetaData := createMeta(lits, blocks, sonar)\n\tdefer func() {\n\t\tos.Remove(coverBin)\n\t\tos.Remove(sonarBin)\n\t\tos.Remove(metaData)\n\t}()\n\n\tif *flagOut == \"\" {\n\t\t*flagOut = goListProps(pkg, \"Name\")[0] + \"-fuzz.zip\"\n\t}\n\toutf, err := os.Create(*flagOut)\n\tif err != nil {\n\t\tfailf(\"failed to create output file: %v\", err)\n\t}\n\tzipw := zip.NewWriter(outf)\n\tzipFile := func(name, datafile string) {\n\t\tw, err := zipw.Create(name)\n\t\tif err != nil {\n\t\t\tfailf(\"failed to create zip file: %v\", err)\n\t\t}\n\t\tif _, err := w.Write(readFile(datafile)); err != nil {\n\t\t\tfailf(\"failed to write to zip file: %v\", err)\n\t\t}\n\t}\n\tzipFile(\"cover.exe\", coverBin)\n\tzipFile(\"sonar.exe\", sonarBin)\n\tzipFile(\"metadata\", metaData)\n\tif err := zipw.Close(); err != nil {\n\t\tfailf(\"failed to close zip file: %v\", err)\n\t}\n\tif err := outf.Close(); err != nil {\n\t\tfailf(\"failed to close out file: %v\", err)\n\t}\n}", "title": "" }, { "docid": "756cc424a687e1b0df4c433703a6831e", "score": "0.4789889", "text": "func TestBuildBabyCluster(t *testing.T) {\n\tt.Skip(\"only enabled during testing\")\n\tf := farmer(t, \"baby\")\n\tdefer f.CollectLogs()\n\tif err := f.Resize(1); err != nil {\n\t\tt.Fatal(err)\n\t}\n\tf.Assert(t)\n}", "title": "" }, { "docid": "d06afd26fcd6d9e91340aef207ec644e", "score": "0.4755689", "text": "func Buildf(format string, arg ...interface{}) Builder {\n\targs := &Args{\n\t\tFlavor: DefaultFlavor,\n\t}\n\tvars := make([]interface{}, 0, len(arg))\n\n\tfor _, a := range arg {\n\t\tvars = append(vars, args.Add(a))\n\t}\n\n\treturn &compiledBuilder{\n\t\targs: args,\n\t\tformat: fmt.Sprintf(Escape(format), vars...),\n\t}\n}", "title": "" }, { "docid": "29c3a71e6a7e3b41038c8f3878ee1b4c", "score": "0.47448993", "text": "func TestBuilder(t *testing.T) {\n\tsuite.Run(t, new(TestBuilderSuite))\n}", "title": "" }, { "docid": "9dd847b4b2b258d2a29eeeae17a9a3da", "score": "0.47446373", "text": "func FuzzFoo(f *testing.F) {\n\tf.Add(5, \"hello\")\n\tf.Fuzz(func(t *testing.T, i int, s string) {\n\t\terr := Foo(i, s)\n\t\tif err != nil {\n\t\t\tt.Errorf(\"%v\", err)\n\t\t}\n\t})\n}", "title": "" }, { "docid": "0ba5c21a42c2c20017eaf6a49cae45bc", "score": "0.47297353", "text": "func Fizz(r io.Reader, w io.Writer) error {\n\tb, err := ioutil.ReadAll(r)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tcontent := string(b)\n\n\t// Old anko format\n\tfixed, err := Anko(content)\n\tif err != nil {\n\t\treturn err\n\t}\n\tif strings.TrimSpace(fixed) != strings.TrimSpace(content) {\n\t\tcontent = fixed\n\t}\n\n\t// Rewrite migrations to use t.Timestamps() if necessary\n\tfixed, err = AutoTimestampsOff(content)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tif strings.TrimSpace(fixed) != strings.TrimSpace(content) {\n\t\tif _, err := w.Write([]byte(fixed)); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "52fdd69c432776dd4041c0717df11cc0", "score": "0.47137758", "text": "func (_m *MockScript) Build(args ...string) error {\n\t_s := []interface{}{}\n\tfor _, _x := range args {\n\t\t_s = append(_s, _x)\n\t}\n\tret := _m.ctrl.Call(_m, \"Build\", _s...)\n\tret0, _ := ret[0].(error)\n\treturn ret0\n}", "title": "" }, { "docid": "4b692fcebffd57deb9889a7d6bf7d548", "score": "0.47063598", "text": "func main() {\n\tvar (\n\t\tfSheetId = flag.String(\"sheetId\", \"\", \"spreadsheetId\")\n\t\tfJunitFile = flag.String(\"junit\", \"\", \"junit file\")\n\t\tfPrNumber = flag.String(\"pr\", \"\", \"PR number\")\n\t\tfJobNumber = flag.String(\"job\", \"\", \"Job number\")\n\t\tfTestTile = flag.String(\"test\", \"\", \"Test title\")\n\t\tfLogFile = flag.String(\"logfile\", \"\", \"Log file including base\")\n\t)\n\n\tflag.Parse()\n\n\tif *fSheetId == \"\" {\n\t\tusage(\"--sheetId is missing\")\n\t}\n\tspreadsheetId := *fSheetId\n\n\tif *fJunitFile == \"\" {\n\t\tusage(\"--junit is missing\")\n\t}\n\tjunitFile := *fJunitFile\n\n\tif *fPrNumber == \"\" {\n\t\tusage(\"--pr is missing\")\n\t}\n\tprNumber := *fPrNumber\n\n\tif *fJobNumber == \"\" {\n\t\tusage(\"--job is missing\")\n\t}\n\tjobNumber := *fJobNumber\n\n\tif *fTestTile == \"\" {\n\t\tusage(\"--test is missing\")\n\t}\n\ttestTitle := *fTestTile\n\n\tif *fLogFile == \"\" {\n\t\tusage(\"--logfile is missing\")\n\t}\n\tlogFile := *fLogFile\n\n\tctx := context.Background()\n\n\tsuites, err := junit.IngestFile(junitFile)\n\tif err != nil {\n\t\tif errors.Is(err, os.ErrNotExist) {\n\t\t\tfmt.Printf(\"junit file %s not found. Exiting\\n\", junitFile)\n\t\t\treturn\n\t\t}\n\t\tpanic(err)\n\t}\n\n\tfor _, suite := range suites {\n\t\tfor _, test := range suite.Tests {\n\t\t\tif test.Error == nil {\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tcurrentTime := time.Now()\n\t\t\tdata := []interface{}{\n\t\t\t\t// Date must be set in this format, to be correctly comparable as strings\n\t\t\t\tcurrentTime.Format(\"2006-01-02\"),\n\t\t\t\ttest.Name,\n\t\t\t\ttest.Error.Error(),\n\t\t\t\tprNumber,\n\t\t\t\ttestTitle,\n\t\t\t\tlogFile,\n\t\t\t\tjobNumber,\n\t\t\t}\n\t\t\terr = db.SaveToSheet(ctx, spreadsheetId, data)\n\t\t\tif err != nil {\n\t\t\t\tlog.Fatalf(\"Unable to add data to sheet: %v\", err)\n\t\t\t}\n\t\t}\n\t}\n}", "title": "" }, { "docid": "c1ddf858e241ce77f9716d6fe8dbb480", "score": "0.47043732", "text": "func main() {\n\tname := \"Ricardo\"\n\tfmt.Println(\"Hello World\", name)\n\n\tvar nameenter string\n\tfmt.Print(\"Enter Name: \")\n\tfmt.Scan(&nameenter)\n\tfmt.Println(\"Hello \", nameenter)\n\n\tvar sn, ln int32\n\tfmt.Print(\"Enter Small Number: \")\n\tfmt.Scan(&sn)\n\tfmt.Print(\"Enter Larger Number: \")\n\tfmt.Scan(&ln)\n\tfmt.Println(\"Remainder: \", ln/sn)\n\n\tfor x := 0; x <= 100; x++ {\n\t\t//fmt.Println(x)\n\t\tif (x%2 != 0) {\n\t\t\tcontinue\n\t\t}\n\t\tfmt.Println(\"Even Number\", x)\n\t}\n\n\tfor y:= 1; y <=100; y++{\n\t\tif y%15 == 0{\n\t\t\tfmt.Println(y,\" FizzBuzz\")\n\t\t}else if y%5 == 0{\n\t\t\tfmt.Println(y,\" Buzz\")\n\t\t//}else if y%3 == 0 && y%5 == 0{\n\t\t}else if y%3 == 0{\n\t\t\tfmt.Println(y,\" Fizz\")\n\t\t}else{\n\t\tfmt.Println(y)\n\t\t}\n\t}\n\tsum :=0\n\tfor t:=0; t < 1000; t++ {\n\t\tif t%3==0 || t%5==0{\n\t\t\tfmt.Println( \"Test Numbers: \",t)\n\t\t\tsum += t\n\t\t}\n\t}\n\tfmt.Println(\"Sum all-->:\",sum)\n\n}", "title": "" }, { "docid": "b113f0d182f80371579e89fae1dcbee8", "score": "0.46868077", "text": "func NewAdvancedFizzBuzzer(matchs ...Match) (FizzBuzzer, error) {\n\treturn newAdvancedFizzBuzzer(matchs)\n}", "title": "" }, { "docid": "f5d18b73951b97a3139a4be5a4540d65", "score": "0.46587119", "text": "func (m *MockFizzBuzzComputer) ComputeFizzBuzz(arg0 context.Context, arg1 entity.FizzBuzzParams) (string, error) {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"ComputeFizzBuzz\", arg0, arg1)\n\tret0, _ := ret[0].(string)\n\tret1, _ := ret[1].(error)\n\treturn ret0, ret1\n}", "title": "" }, { "docid": "0dc479a44568d2c4bc9f841bdfeaeff2", "score": "0.46522945", "text": "func newAFLFuzzer(targetCommand []string, workdir string, dictPath string, timeoutMs int, memLimitMb int) Fuzzer {\n\tname, err := os.Hostname()\n\tif err != nil {\n\t\tlog.Fatal(\"Couldn't get hostname\", err)\n\t}\n\n\tid := mkFuzzerId(name)\n\tfileManager := types.NewAflFileManagerWithFuzzerId(workdir, id)\n\n\tfuzzCmd := aflFuzzCmd(\n\t\tid,\n\t\ttargetCommand,\n\t\tfileManager.OutputDirToPassIntoAfl(),\n\t\tfileManager.InputDir(),\n\t\tdictPath,\n\t\taflFuzzPath(),\n\t\ttimeoutMs,\n\t\tmemLimitMb,\n\t)\n\n\treturn Fuzzer{\n\t\tId: id,\n\t\tfileManager: fileManager,\n\t\tstarted: false,\n\t\tcmd: fuzzCmd,\n\t}\n}", "title": "" }, { "docid": "a3e076295a036928204d7f741a70c8d1", "score": "0.4636959", "text": "func TestComplexApplication(t *testing.T) {\n\n}", "title": "" }, { "docid": "5b8ecbf6db148d1753567fe5330c5549", "score": "0.46342066", "text": "func Fuzz() {\n\tvm := NewVM()\n\tcode := RandomBytes()\n\tvm.context.MaxGasAmount = 10000\n\tvm.context.ContractAccount.Contract = code\n\n\tdefer func() {\n\t\tif err := recover(); err != nil {\n\t\t\tlog.Println(\"Execution failed\", err, code)\n\t\t}\n\t}()\n\n\tvm.Exec(false)\n}", "title": "" }, { "docid": "ca5b1d6c88d546623a534dff57ee7c57", "score": "0.46129248", "text": "func Run(fixture interface{}, options ...Option) {\n\tconfig := new(config)\n\tfor _, option := range options {\n\t\toption(config)\n\t}\n\n\tfixtureValue := reflect.ValueOf(fixture)\n\tfixtureType := reflect.TypeOf(fixture)\n\tt := fixtureValue.Elem().FieldByName(\"T\").Interface().(*T)\n\n\tvar (\n\t\ttestNames []string\n\t\tskippedTestNames []string\n\t\tfocusedTestNames []string\n\t)\n\tfor x := 0; x < fixtureType.NumMethod(); x++ {\n\t\tname := fixtureType.Method(x).Name\n\t\tmethod := fixtureValue.MethodByName(name)\n\t\t_, isNiladic := method.Interface().(func())\n\t\tif !isNiladic {\n\t\t\tcontinue\n\t\t}\n\n\t\tif strings.HasPrefix(name, \"Test\") {\n\t\t\ttestNames = append(testNames, name)\n\t\t} else if strings.HasPrefix(name, \"LongTest\") {\n\t\t\ttestNames = append(testNames, name)\n\n\t\t} else if strings.HasPrefix(name, \"SkipLongTest\") {\n\t\t\tskippedTestNames = append(skippedTestNames, name)\n\t\t} else if strings.HasPrefix(name, \"SkipTest\") {\n\t\t\tskippedTestNames = append(skippedTestNames, name)\n\n\t\t} else if strings.HasPrefix(name, \"FocusLongTest\") {\n\t\t\tfocusedTestNames = append(focusedTestNames, name)\n\t\t} else if strings.HasPrefix(name, \"FocusTest\") {\n\t\t\tfocusedTestNames = append(focusedTestNames, name)\n\t\t}\n\t}\n\n\tif len(focusedTestNames) > 0 {\n\t\ttestNames = focusedTestNames\n\t}\n\n\tif len(testNames) == 0 {\n\t\tt.Skip(\"NOT IMPLEMENTED (no test cases defined, or they are all marked as skipped)\")\n\t\treturn\n\t}\n\n\tif config.parallelFixture {\n\t\tt.Parallel()\n\t}\n\n\tsetup, hasSetup := fixture.(setupSuite)\n\tif hasSetup {\n\t\tsetup.SetupSuite()\n\t}\n\n\tteardown, hasTeardown := fixture.(teardownSuite)\n\tif hasTeardown {\n\t\tdefer teardown.TeardownSuite()\n\t}\n\n\tfor _, name := range skippedTestNames {\n\t\ttestCase{t: t, manualSkip: true, name: name}.Run()\n\t}\n\n\tfor _, name := range testNames {\n\t\ttestCase{t, name, config, false, fixtureType, fixtureValue}.Run()\n\t}\n}", "title": "" }, { "docid": "f734b70e03d3f32387190ea9afe6695d", "score": "0.46115625", "text": "func Fuzz(data []byte) int {\n\tbuf := bytes.NewBuffer(data)\n\tp := New(&fuzzFile{buf})\n\tp.Parse()\n\treturn 0\n}", "title": "" }, { "docid": "058aada841dcc5059830c5e4de7c6a3a", "score": "0.4586135", "text": "func TestMakeButtonList(t *testing.T) {\n stringAssertTests := []StringAssert{\n StringAssert{\n actual: makeButtonList(\"One, Two, Three\"),\n expected: \"buttons {\\\"One\\\",\\\"Two\\\",\\\"Three\\\"}\",\n },\n StringAssert{\n actual: makeButtonList(\"One\"),\n expected: \"buttons {\\\"One\\\"}\",\n },\n StringAssert{\n actual: makeButtonList(\"One, Two, Three, Four\"),\n expected: \"buttons {\\\"One\\\",\\\"Two\\\",\\\"Three\\\"}\",\n },\n StringAssert{\n actual: makeButtonList(\"One,Two\"),\n expected: \"buttons {\\\"One\\\",\\\"Two\\\"}\",\n },\n }\n\n runStringAssertTests(\"makeButtonList\", stringAssertTests, t)\n}", "title": "" }, { "docid": "5b1ca7a54c7884689ac5060938526ab3", "score": "0.45747808", "text": "func AskTests(in *os.File) (string, string) {\n\tin = generateStdin(in)\n\tvar isTests string\n\tvar testFrameworkNumber int\n\tvar testFramework string\n\tfmt.Println(\"\\n\\nWill you write some unit tests for your project? Enter y for yes or any other key for no\")\n\tif _, err := fmt.Fscanf(in, \"%s\", &isTests); err != nil {\n\t\tlog.Fatal(err)\n\t}\n\tif isTests == \"y\" || isTests == \"Y\" {\n\t\tfmt.Println(\"\\nChoose a number which corresponds to the testing framework you will be using:\\n1.RSpec\")\n\t\tif _, err := fmt.Fscanf(in, \"%d\", &testFrameworkNumber); err != nil {\n\t\t\tlog.Fatal(err)\n\t\t}\n\t\tif testFrameworkNumber != 1 {\n\t\t\tfor i := 0; i < 5; i++ {\n\t\t\t\tfmt.Println(\"\\nChoose a number which corresponds to the testing framework you will be using:\\n1.RSpec\")\n\t\t\t\tif _, err := fmt.Fscanf(in, \"%d\", &testFrameworkNumber); err != nil {\n\t\t\t\t\tlog.Fatal(err)\n\t\t\t\t}\n\t\t\t\tif testFrameworkNumber == 1 {\n\t\t\t\t\tbreak\n\t\t\t\t}\n\t\t\t}\n\t\t\tfmt.Println(\"\\nThe testing framework you chose is not supported\")\n\t\t}\n\t}\n\tswitch testFrameworkNumber {\n\tcase 1:\n\t\ttestFramework = \"rspec\"\n\t}\n\treturn testFramework, isTests\n}", "title": "" }, { "docid": "5dc630d66a35bc747c410b270b733bfc", "score": "0.45712662", "text": "func FizzBuzzNoModulo(int1, int2 int, string1, string2 string, limit int) ([]string, error, uint) {\n\tvar result []string\n\tresult, err, code := fizzBuzzCheck(int1, int2, string1, string2, limit)\n\tif err != nil {\n\t\treturn result, err, code\n\t}\n\ti1 := 0\n\ti2 := 0\n\tfor i := 1; i <= limit; i++ {\n\t\ti1++\n\t\ti2++\n\t\tif i1 == int1 && i2 == int2 {\n\t\t\tresult = append(result, string1+string2)\n\t\t} else if i1 == int1 {\n\t\t\tresult = append(result, string1)\n\t\t\ti1 = 0\n\t\t} else if i2 == int2 {\n\t\t\tresult = append(result, string2)\n\t\t\ti2 = 0\n\t\t} else {\n\t\t\tresult = append(result, strconv.Itoa(i))\n\t\t}\n\t}\n\treturn result, nil, 0\n}", "title": "" }, { "docid": "2d6ae8eb6f521c8d5dde5ca333315efa", "score": "0.45464697", "text": "func TestConstructorInjection(t *testing.T) {\n\ttests := []struct {\n\t\tname string\n\t\tonlyExported bool\n\t\tqualifyAll bool\n\t\tinjectConstructors bool\n\t\twant string\n\t}{\n\t\t{\n\t\t\t// this corresponds roughly to:\n\t\t\t// genfuzzfuncs -ctors -pkg=github.com/thepudds/fzgo/genfuzzfuncs/examples/test-constructor-injection\n\t\t\tname: \"constructor injection: exported only, not local pkg\",\n\t\t\tonlyExported: true,\n\t\t\tqualifyAll: true,\n\t\t\tinjectConstructors: true,\n\t\t\twant: `package fuzzwrapexamplesfuzz // rename if needed\n\nimport (\n\t// fill in manually if needed, or run 'goimports'\n)\n\nfunc Fuzz_A_PtrMethodNoArg(c int) {\n\tr := fuzzwrapexamples.NewAPtr(c)\n\tr.PtrMethodNoArg()\n}\n\nfunc Fuzz_A_PtrMethodWithArg(c int, i int) {\n\tr := fuzzwrapexamples.NewAPtr(c)\n\tr.PtrMethodWithArg(i)\n}\n\nfunc Fuzz_B_PtrMethodNoArg(c int) {\n\tr := fuzzwrapexamples.NewBVal(c)\n\tr.PtrMethodNoArg()\n}\n\nfunc Fuzz_B_PtrMethodWithArg(c int, i int) {\n\tr := fuzzwrapexamples.NewBVal(c)\n\tr.PtrMethodWithArg(i)\n}\n\nfunc Fuzz_A_ValMethodNoArg(c int) {\n\tr := fuzzwrapexamples.NewAPtr(c)\n\tr.ValMethodNoArg()\n}\n\nfunc Fuzz_A_ValMethodWithArg(c int, i int) {\n\tr := fuzzwrapexamples.NewAPtr(c)\n\tr.ValMethodWithArg(i)\n}\n\nfunc Fuzz_B_ValMethodNoArg(c int) {\n\tr := fuzzwrapexamples.NewBVal(c)\n\tr.ValMethodNoArg()\n}\n\nfunc Fuzz_B_ValMethodWithArg(c int, i int) {\n\tr := fuzzwrapexamples.NewBVal(c)\n\tr.ValMethodWithArg(i)\n}\n\nfunc Fuzz_NewAPtr(c int) {\n\tfuzzwrapexamples.NewAPtr(c)\n}\n\nfunc Fuzz_NewBVal(c int) {\n\tfuzzwrapexamples.NewBVal(c)\n}\n\n`},\n\t\t{\n\t\t\t// this corresponds roughly to:\n\t\t\t// genfuzzfuncs -ctors=false -pkg=github.com/thepudds/fzgo/genfuzzfuncs/examples/test-constructor-injection\n\t\t\tname: \"no constructor injection: exported only, not local pkg\",\n\t\t\tonlyExported: true,\n\t\t\tqualifyAll: true,\n\t\t\tinjectConstructors: false,\n\t\t\twant: `package fuzzwrapexamplesfuzz // rename if needed\n\nimport (\n\t// fill in manually if needed, or run 'goimports'\n)\n\nfunc Fuzz_A_PtrMethodNoArg(r *fuzzwrapexamples.A) {\n\tif r == nil {\n\t\treturn\n\t}\n\tr.PtrMethodNoArg()\n}\n\nfunc Fuzz_A_PtrMethodWithArg(r *fuzzwrapexamples.A, i int) {\n\tif r == nil {\n\t\treturn\n\t}\n\tr.PtrMethodWithArg(i)\n}\n\nfunc Fuzz_B_PtrMethodNoArg(r *fuzzwrapexamples.B) {\n\tif r == nil {\n\t\treturn\n\t}\n\tr.PtrMethodNoArg()\n}\n\nfunc Fuzz_B_PtrMethodWithArg(r *fuzzwrapexamples.B, i int) {\n\tif r == nil {\n\t\treturn\n\t}\n\tr.PtrMethodWithArg(i)\n}\n\nfunc Fuzz_A_ValMethodNoArg(r fuzzwrapexamples.A) {\n\tr.ValMethodNoArg()\n}\n\nfunc Fuzz_A_ValMethodWithArg(r fuzzwrapexamples.A, i int) {\n\tr.ValMethodWithArg(i)\n}\n\nfunc Fuzz_B_ValMethodNoArg(r fuzzwrapexamples.B) {\n\tr.ValMethodNoArg()\n}\n\nfunc Fuzz_B_ValMethodWithArg(r fuzzwrapexamples.B, i int) {\n\tr.ValMethodWithArg(i)\n}\n\nfunc Fuzz_NewAPtr(c int) {\n\tfuzzwrapexamples.NewAPtr(c)\n}\n\nfunc Fuzz_NewBVal(c int) {\n\tfuzzwrapexamples.NewBVal(c)\n}\n\n`},\n\t\t{\n\t\t\t// this corresponds roughly to:\n\t\t\t// genfuzzfuncs -ctors -qualifyall=false -pkg=github.com/thepudds/fzgo/genfuzzfuncs/examples/test-constructor-injection\n\t\t\tname: \"constructor injection: exported only, local pkg\",\n\t\t\tonlyExported: true,\n\t\t\tqualifyAll: false,\n\t\t\tinjectConstructors: true,\n\t\t\twant: `package fuzzwrapexamples\n\nimport (\n\t// fill in manually if needed, or run 'goimports'\n)\n\nfunc Fuzz_A_PtrMethodNoArg(c int) {\n\tr := NewAPtr(c)\n\tr.PtrMethodNoArg()\n}\n\nfunc Fuzz_A_PtrMethodWithArg(c int, i int) {\n\tr := NewAPtr(c)\n\tr.PtrMethodWithArg(i)\n}\n\nfunc Fuzz_B_PtrMethodNoArg(c int) {\n\tr := NewBVal(c)\n\tr.PtrMethodNoArg()\n}\n\nfunc Fuzz_B_PtrMethodWithArg(c int, i int) {\n\tr := NewBVal(c)\n\tr.PtrMethodWithArg(i)\n}\n\nfunc Fuzz_A_ValMethodNoArg(c int) {\n\tr := NewAPtr(c)\n\tr.ValMethodNoArg()\n}\n\nfunc Fuzz_A_ValMethodWithArg(c int, i int) {\n\tr := NewAPtr(c)\n\tr.ValMethodWithArg(i)\n}\n\nfunc Fuzz_B_ValMethodNoArg(c int) {\n\tr := NewBVal(c)\n\tr.ValMethodNoArg()\n}\n\nfunc Fuzz_B_ValMethodWithArg(c int, i int) {\n\tr := NewBVal(c)\n\tr.ValMethodWithArg(i)\n}\n\nfunc Fuzz_NewAPtr(c int) {\n\tNewAPtr(c)\n}\n\nfunc Fuzz_NewBVal(c int) {\n\tNewBVal(c)\n}\n\n`},\n\t\t{\n\t\t\t// this corresponds roughly to:\n\t\t\t// genfuzzfuncs -ctors=false -qualifyall=false -pkg=github.com/thepudds/fzgo/genfuzzfuncs/examples/test-constructor-injection\n\t\t\tname: \"no constructor injection: exported only, local pkg\",\n\t\t\tonlyExported: true,\n\t\t\tqualifyAll: false,\n\t\t\tinjectConstructors: false,\n\t\t\twant: `package fuzzwrapexamples\n\nimport (\n\t// fill in manually if needed, or run 'goimports'\n)\n\nfunc Fuzz_A_PtrMethodNoArg(r *A) {\n\tif r == nil {\n\t\treturn\n\t}\n\tr.PtrMethodNoArg()\n}\n\nfunc Fuzz_A_PtrMethodWithArg(r *A, i int) {\n\tif r == nil {\n\t\treturn\n\t}\n\tr.PtrMethodWithArg(i)\n}\n\nfunc Fuzz_B_PtrMethodNoArg(r *B) {\n\tif r == nil {\n\t\treturn\n\t}\n\tr.PtrMethodNoArg()\n}\n\nfunc Fuzz_B_PtrMethodWithArg(r *B, i int) {\n\tif r == nil {\n\t\treturn\n\t}\n\tr.PtrMethodWithArg(i)\n}\n\nfunc Fuzz_A_ValMethodNoArg(r A) {\n\tr.ValMethodNoArg()\n}\n\nfunc Fuzz_A_ValMethodWithArg(r A, i int) {\n\tr.ValMethodWithArg(i)\n}\n\nfunc Fuzz_B_ValMethodNoArg(r B) {\n\tr.ValMethodNoArg()\n}\n\nfunc Fuzz_B_ValMethodWithArg(r B, i int) {\n\tr.ValMethodWithArg(i)\n}\n\nfunc Fuzz_NewAPtr(c int) {\n\tNewAPtr(c)\n}\n\nfunc Fuzz_NewBVal(c int) {\n\tNewBVal(c)\n}\n\n`},\n\t}\n\tfor _, tt := range tests {\n\t\tt.Run(tt.name, func(t *testing.T) {\n\t\t\tt.Parallel()\n\t\t\tpkgPattern := \"github.com/thepudds/fzgo/genfuzzfuncs/examples/test-constructor-injection\"\n\t\t\toptions := flagExcludeFuzzPrefix | flagAllowMultiFuzz\n\t\t\tif tt.onlyExported {\n\t\t\t\toptions |= flagRequireExported\n\t\t\t}\n\t\t\tfunctions, err := FindFunc(pkgPattern, \".\", nil, options)\n\t\t\tif err != nil {\n\t\t\t\tt.Errorf(\"FindFuncfail() failed: %v\", err)\n\t\t\t}\n\n\t\t\tvar b bytes.Buffer\n\t\t\twrapperOpts := wrapperOptions{\n\t\t\t\tqualifyAll: tt.qualifyAll,\n\t\t\t\tinsertConstructors: tt.injectConstructors,\n\t\t\t\tconstructorPattern: \"^New\",\n\t\t\t}\n\t\t\terr = createWrappers(&b, pkgPattern, functions, wrapperOpts)\n\t\t\tif err != nil {\n\t\t\t\tt.Errorf(\"createWrappers() failed: %v\", err)\n\t\t\t}\n\n\t\t\tgot := b.String()\n\t\t\tif diff := cmp.Diff(tt.want, got); diff != \"\" {\n\t\t\t\tt.Errorf(\"createWrappers() mismatch (-want +got):\\n%s\", diff)\n\t\t\t}\n\t\t})\n\t}\n}", "title": "" }, { "docid": "767313880ffab6451727f4a7d107d12e", "score": "0.45197544", "text": "func Test4_F6_F7_F8_F9_F10_F11_F12(t *testing.T) {\n\t// Test F6 function\n\tif f61, f62, f63 := compositeTypes.F6(); \"[April May June]\" != f61 || \"[June July August]\" != f62 || \"[June July August September October]\" != f63 {\n\t\tt.Errorf(\"Should be \\\"[April May June]\\\", \\\"[June July August]\\\", and \\\"[June July August September October]\\\"\")\n\t}\n\n\t// Test F7 function\n\tif f7 := compositeTypes.F7(); [...]int{5, 4, 3, 2, 1, 0} != f7 {\n\t\tt.Errorf(\"Should be [5 4 3 2 1 0]\")\n\t}\n\n\t// Test F8 function\n\tif f81, f82 := compositeTypes.F8(); 0 != f81 || 0 != f82 {\n\t\tt.Errorf(\"Should be 0 and 0\")\n\t}\n\n\t// Test F9 function\n\tif f91, f92 := compositeTypes.F9(); \"Hello, World!\" != f91 || nil == f92 {\n\t\tt.Errorf(\"Should be \\\"Hello, World!\\\"\")\n\t\tt.Errorf(\"Should not be nil\")\n\t}\n\n\t// Test F10 function\n\tif f10 := compositeTypes.F10(); \"[one three five]\" != f10 {\n\t\tt.Errorf(\"Should be \\\"[one three five]\\\"\")\n\t}\n\n\t// Test F11 function\n\tif f11 := compositeTypes.F11(); nil == f11 {\n\t\tt.Errorf(\"Should not be nil\")\n\t}\n\n\t// Test F12 function\n\tif f12 := compositeTypes.F12(); nil == f12 {\n\t\tt.Errorf(\"Should not be nil\")\n\t}\n}", "title": "" }, { "docid": "c2330d9a716a8b977df26ac96d2d6eb1", "score": "0.4517383", "text": "func TestFuzzedSpecs(t *testing.T) {\n\tred := color.New(color.Bold, color.FgRed).PrintlnFunc()\n\tyellow := color.New(color.Bold, color.FgYellow).PrintlnFunc()\n\tcyan := color.New(color.Bold, color.FgCyan).PrintlnFunc()\n\n\tfiles, err := ioutil.ReadDir(\"data\")\n\tif err != nil {\n\t\tt.Error(err)\n\t}\n\n\tfmt.Println(\"=============================\")\n\tfmt.Println(\"~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\")\n\tfmt.Println(\" FAULT FUZZ TESTING\")\n\tfmt.Println(\"~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\")\n\n\tfmt.Printf(\"Parsing %d fuzzed spec files...\\n\\n\", len(files))\n\tfailed := 0\n\n\tfor _, f := range files {\n\t\tdata, err := ioutil.ReadFile(fmt.Sprintf(\"data/%s\", f.Name()))\n\t\tif err != nil {\n\t\t\tt.Error(err)\n\t\t}\n\t\tspec := string(data)\n\t\tcode, err := evaluate(spec)\n\t\tswitch code {\n\t\tcase 0:\n\t\t\tfmt.Print(\"\\n\\n\")\n\t\t\tcyan(f.Name())\n\t\t\tfmt.Println(\"--------------------\")\n\t\t\tfmt.Println(spec)\n\t\t\tyellow(\"No syntax error caught, inspect spec to confirm valid\")\n\t\tcase 1: // Go Panic detected\n\t\t\tfailed++\n\t\t\tfmt.Print(\"\\n\\n\")\n\t\t\tcyan(f.Name())\n\t\t\tfmt.Println(\"--------------------\")\n\t\t\tfmt.Println(spec)\n\t\t\tred(\"Panic detected: \", err)\n\n\t\t}\n\t}\n\tfmt.Printf(\"\\nTest Complete: %d out of %d files with confirmed errors\", failed, len(files))\n\n}", "title": "" }, { "docid": "e311340c732969d52a2ac8940507fec3", "score": "0.4517363", "text": "func buildHarness(buildType buildskia.ReleaseType, isClean bool, buildArgs []string) (string, error) {\n\t// clean previous build if specified\n\n\tbuildLocation := filepath.Join(config.Common.SkiaRoot, \"skia\", \"out\", string(buildType))\n\tif isClean {\n\t\tif err := os.RemoveAll(buildLocation); err != nil {\n\t\t\treturn \"\", fmt.Errorf(\"Could not clear out %s before building: %s\", buildLocation, err)\n\t\t}\n\t}\n\n\tif err := buildskia.GNGen(config.Common.SkiaRoot, config.Common.DepotToolsPath, string(buildType), buildArgs); err != nil {\n\t\treturn \"\", fmt.Errorf(\"Failed GN: %s\", err)\n\t}\n\n\tbuiltExe := filepath.Join(buildLocation, TEST_HARNESS_NAME)\n\n\t_, err := buildskia.GNNinjaBuild(config.Common.SkiaRoot, config.Common.DepotToolsPath, string(buildType), TEST_HARNESS_NAME, config.Common.VerboseBuilds)\n\treturn builtExe, err\n}", "title": "" }, { "docid": "a178ac67fcf8de70fcb87bd9978f959a", "score": "0.4512175", "text": "func FuzzerFor(t *testing.T, version schema.GroupVersion, src rand.Source) *fuzz.Fuzzer {\n\tf := fuzz.New().NilChance(.5).NumElements(0, 1)\n\tif src != nil {\n\t\tf.RandSource(src)\n\t}\n\tf.Funcs(\n\t\tfunc(j *int, c fuzz.Continue) {\n\t\t\t*j = int(c.Int31())\n\t\t},\n\t\tfunc(j **int, c fuzz.Continue) {\n\t\t\tif c.RandBool() {\n\t\t\t\ti := int(c.Int31())\n\t\t\t\t*j = &i\n\t\t\t} else {\n\t\t\t\t*j = nil\n\t\t\t}\n\t\t},\n\t\tfunc(j *runtime.TypeMeta, c fuzz.Continue) {\n\t\t\t// We have to customize the randomization of TypeMetas because their\n\t\t\t// APIVersion and Kind must remain blank in memory.\n\t\t\tj.APIVersion = \"\"\n\t\t\tj.Kind = \"\"\n\t\t},\n\t\tfunc(j *metav1.TypeMeta, c fuzz.Continue) {\n\t\t\t// We have to customize the randomization of TypeMetas because their\n\t\t\t// APIVersion and Kind must remain blank in memory.\n\t\t\tj.APIVersion = \"\"\n\t\t\tj.Kind = \"\"\n\t\t},\n\t\tfunc(j *api.ObjectMeta, c fuzz.Continue) {\n\t\t\tj.Name = c.RandString()\n\t\t\tj.ResourceVersion = strconv.FormatUint(c.RandUint64(), 10)\n\t\t\tj.SelfLink = c.RandString()\n\t\t\tj.UID = types.UID(c.RandString())\n\t\t\tj.GenerateName = c.RandString()\n\n\t\t\tvar sec, nsec int64\n\t\t\tc.Fuzz(&sec)\n\t\t\tc.Fuzz(&nsec)\n\t\t\tj.CreationTimestamp = metav1.Unix(sec, nsec).Rfc3339Copy()\n\t\t},\n\t\tfunc(j *api.ObjectReference, c fuzz.Continue) {\n\t\t\t// We have to customize the randomization of TypeMetas because their\n\t\t\t// APIVersion and Kind must remain blank in memory.\n\t\t\tj.APIVersion = c.RandString()\n\t\t\tj.Kind = c.RandString()\n\t\t\tj.Namespace = c.RandString()\n\t\t\tj.Name = c.RandString()\n\t\t\tj.ResourceVersion = strconv.FormatUint(c.RandUint64(), 10)\n\t\t\tj.FieldPath = c.RandString()\n\t\t},\n\t\tfunc(j *metav1.ListMeta, c fuzz.Continue) {\n\t\t\tj.ResourceVersion = strconv.FormatUint(c.RandUint64(), 10)\n\t\t\tj.SelfLink = c.RandString()\n\t\t},\n\t\tfunc(j *runtime.Object, c fuzz.Continue) {\n\t\t\t// TODO: uncomment when round trip starts from a versioned object\n\t\t\tif true { //c.RandBool() {\n\t\t\t\t*j = &runtime.Unknown{\n\t\t\t\t\t// We do not set TypeMeta here because it is not carried through a round trip\n\t\t\t\t\tRaw: []byte(`{\"apiVersion\":\"unknown.group/unknown\",\"kind\":\"Something\",\"someKey\":\"someValue\"}`),\n\t\t\t\t\tContentType: runtime.ContentTypeJSON,\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\ttypes := []runtime.Object{&api.Pod{}, &api.ReplicationController{}}\n\t\t\t\tt := types[c.Rand.Intn(len(types))]\n\t\t\t\tc.Fuzz(t)\n\t\t\t\t*j = t\n\t\t\t}\n\t\t},\n\t\tfunc(r *runtime.RawExtension, c fuzz.Continue) {\n\t\t\t// Pick an arbitrary type and fuzz it\n\t\t\ttypes := []runtime.Object{&api.Pod{}, &extensions.Deployment{}, &api.Service{}}\n\t\t\tobj := types[c.Rand.Intn(len(types))]\n\t\t\tc.Fuzz(obj)\n\n\t\t\t// Find a codec for converting the object to raw bytes. This is necessary for the\n\t\t\t// api version and kind to be correctly set be serialization.\n\t\t\tvar codec runtime.Codec\n\t\t\tswitch obj.(type) {\n\t\t\tcase *api.Pod:\n\t\t\t\tcodec = testapi.Default.Codec()\n\t\t\tcase *extensions.Deployment:\n\t\t\t\tcodec = testapi.Extensions.Codec()\n\t\t\tcase *api.Service:\n\t\t\t\tcodec = testapi.Default.Codec()\n\t\t\tdefault:\n\t\t\t\tt.Errorf(\"Failed to find codec for object type: %T\", obj)\n\t\t\t\treturn\n\t\t\t}\n\n\t\t\t// Convert the object to raw bytes\n\t\t\tbytes, err := runtime.Encode(codec, obj)\n\t\t\tif err != nil {\n\t\t\t\tt.Errorf(\"Failed to encode object: %v\", err)\n\t\t\t\treturn\n\t\t\t}\n\n\t\t\t// Set the bytes field on the RawExtension\n\t\t\tr.Raw = bytes\n\t\t},\n\t\tfunc(is *servicecatalog.InstanceSpec, c fuzz.Continue) {\n\t\t\tc.FuzzNoCustom(is)\n\t\t\tis.OSBGUID = uuid.NewV4().String()\n\t\t\tparameters, err := createParameter(c)\n\t\t\tif err != nil {\n\t\t\t\tt.Errorf(\"Failed to create parameter object: %v\", err)\n\t\t\t\treturn\n\t\t\t}\n\t\t\tis.Parameters = parameters\n\t\t},\n\t\tfunc(bs *servicecatalog.BindingSpec, c fuzz.Continue) {\n\t\t\tc.FuzzNoCustom(bs)\n\t\t\tbs.OSBGUID = uuid.NewV4().String()\n\t\t\tparameters, err := createParameter(c)\n\t\t\tif err != nil {\n\t\t\t\tt.Errorf(\"Failed to create parameter object: %v\", err)\n\t\t\t\treturn\n\t\t\t}\n\t\t\tbs.Parameters = parameters\n\t\t},\n\t\tfunc(sc *servicecatalog.ServiceClass, c fuzz.Continue) {\n\t\t\tc.FuzzNoCustom(sc)\n\t\t\tmetadata, err := createServiceMetadata(c)\n\t\t\tif err != nil {\n\t\t\t\tt.Errorf(\"Failed to create metadata object: %v\", err)\n\t\t\t\treturn\n\t\t\t}\n\t\t\tsc.OSBMetadata = metadata\n\t\t},\n\t\tfunc(sp *servicecatalog.ServicePlan, c fuzz.Continue) {\n\t\t\tc.FuzzNoCustom(sp)\n\t\t\tmetadata, err := createPlanMetadata(c)\n\t\t\tif err != nil {\n\t\t\t\tt.Errorf(\"Failed to create metadata object: %v\", err)\n\t\t\t\treturn\n\t\t\t}\n\t\t\tsp.OSBMetadata = metadata\n\t\t},\n\t)\n\treturn f\n}", "title": "" }, { "docid": "fa0bdaae0c0ebc1f93f8fd9bf0418f57", "score": "0.4501991", "text": "func (FizzBuzz) Say(number int) string {\n\tfor _, divisor := range divisorOrderTable {\n\t\tif number%divisor == 0 {\n\t\t\treturn ruleTable[divisor]\n\t\t}\n\t}\n\treturn strconv.Itoa(number)\n}", "title": "" }, { "docid": "1626fa94285573ffd5bd3a0497dd05f6", "score": "0.4492692", "text": "func (k KubeListBenchmark) BenchBuilder(ctx context.Context, tc *client.TeleportClient) (WorkloadFunc, error) {\n\trestCfg, err := newKubernetesRestConfig(ctx, tc)\n\tif err != nil {\n\t\treturn nil, trace.Wrap(err)\n\t}\n\tclientset, err := kubernetes.NewForConfig(restCfg)\n\tif err != nil {\n\t\treturn nil, trace.Wrap(err)\n\t}\n\n\treturn func(ctx context.Context) error {\n\t\t// List all pods in all namespaces.\n\t\t_, err := clientset.CoreV1().Pods(k.Namespace).List(ctx, metav1.ListOptions{})\n\t\treturn trace.Wrap(err)\n\t}, nil\n}", "title": "" }, { "docid": "371b5c3b67b1653d57d6d72c8e27b115", "score": "0.44909766", "text": "func createExecutionSetup() {\n\tctx = testutils.Ctx\n\tmockClient = testutils.MockClient\n\t// TODO: migrate to new command context from testutils\n\tcmdCtx = cmdCore.NewCommandContext(mockClient, testutils.MockOutStream)\n\tsortedListLiteralType := core.Variable{\n\t\tType: &core.LiteralType{\n\t\t\tType: &core.LiteralType_CollectionType{\n\t\t\t\tCollectionType: &core.LiteralType{\n\t\t\t\t\tType: &core.LiteralType_Simple{\n\t\t\t\t\t\tSimple: core.SimpleType_INTEGER,\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t},\n\t\t},\n\t}\n\tvariableMap := map[string]*core.Variable{\n\t\t\"sorted_list1\": &sortedListLiteralType,\n\t\t\"sorted_list2\": &sortedListLiteralType,\n\t}\n\n\ttask1 := &admin.Task{\n\t\tId: &core.Identifier{\n\t\t\tName: \"task1\",\n\t\t\tVersion: \"v2\",\n\t\t},\n\t\tClosure: &admin.TaskClosure{\n\t\t\tCreatedAt: &timestamppb.Timestamp{Seconds: 1, Nanos: 0},\n\t\t\tCompiledTask: &core.CompiledTask{\n\t\t\t\tTemplate: &core.TaskTemplate{\n\t\t\t\t\tInterface: &core.TypedInterface{\n\t\t\t\t\t\tInputs: &core.VariableMap{\n\t\t\t\t\t\t\tVariables: variableMap,\n\t\t\t\t\t\t},\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t},\n\t\t},\n\t}\n\tmockClient.OnGetTaskMatch(ctx, mock.Anything).Return(task1, nil)\n\tparameterMap := map[string]*core.Parameter{\n\t\t\"numbers\": {\n\t\t\tVar: &core.Variable{\n\t\t\t\tType: &core.LiteralType{\n\t\t\t\t\tType: &core.LiteralType_CollectionType{\n\t\t\t\t\t\tCollectionType: &core.LiteralType{\n\t\t\t\t\t\t\tType: &core.LiteralType_Simple{\n\t\t\t\t\t\t\t\tSimple: core.SimpleType_INTEGER,\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\t\"numbers_count\": {\n\t\t\tVar: &core.Variable{\n\t\t\t\tType: &core.LiteralType{\n\t\t\t\t\tType: &core.LiteralType_Simple{\n\t\t\t\t\t\tSimple: core.SimpleType_INTEGER,\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t},\n\t\t},\n\t\t\"run_local_at_count\": {\n\t\t\tVar: &core.Variable{\n\t\t\t\tType: &core.LiteralType{\n\t\t\t\t\tType: &core.LiteralType_Simple{\n\t\t\t\t\t\tSimple: core.SimpleType_INTEGER,\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t},\n\t\t\tBehavior: &core.Parameter_Default{\n\t\t\t\tDefault: &core.Literal{\n\t\t\t\t\tValue: &core.Literal_Scalar{\n\t\t\t\t\t\tScalar: &core.Scalar{\n\t\t\t\t\t\t\tValue: &core.Scalar_Primitive{\n\t\t\t\t\t\t\t\tPrimitive: &core.Primitive{\n\t\t\t\t\t\t\t\t\tValue: &core.Primitive_Integer{\n\t\t\t\t\t\t\t\t\t\tInteger: 10,\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},\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t},\n\t\t},\n\t}\n\tlaunchPlan1 := &admin.LaunchPlan{\n\t\tId: &core.Identifier{\n\t\t\tName: \"core.advanced.run_merge_sort.merge_sort\",\n\t\t\tVersion: \"v3\",\n\t\t},\n\t\tSpec: &admin.LaunchPlanSpec{\n\t\t\tDefaultInputs: &core.ParameterMap{\n\t\t\t\tParameters: parameterMap,\n\t\t\t},\n\t\t},\n\t\tClosure: &admin.LaunchPlanClosure{\n\t\t\tCreatedAt: &timestamppb.Timestamp{Seconds: 0, Nanos: 0},\n\t\t\tExpectedInputs: &core.ParameterMap{\n\t\t\t\tParameters: parameterMap,\n\t\t\t},\n\t\t},\n\t}\n\tobjectGetRequest := &admin.ObjectGetRequest{\n\t\tId: &core.Identifier{\n\t\t\tResourceType: core.ResourceType_LAUNCH_PLAN,\n\t\t\tProject: config.GetConfig().Project,\n\t\t\tDomain: config.GetConfig().Domain,\n\t\t\tName: \"core.advanced.run_merge_sort.merge_sort\",\n\t\t\tVersion: \"v3\",\n\t\t},\n\t}\n\tmockClient.OnGetLaunchPlanMatch(ctx, objectGetRequest).Return(launchPlan1, nil)\n}", "title": "" }, { "docid": "87c45102f842f7f924e0d4501bb0b147", "score": "0.44886434", "text": "func StartAutomatedFuzzer(list *views.ListWidget, settings *config.Settings, gui *gocui.Gui) {\n\n\ttype fuzzState struct {\n\t\tcurrent int\n\t\tmax int\n\t}\n\n\tmin := func(a, b int) int {\n\t\tif a < b {\n\t\t\treturn a\n\t\t}\n\t\treturn b\n\t}\n\n\tshouldSkipActivityProvider := false\n\tshouldSkipMetricsProvider := false\n\tshouldSkip := func(currentNode *expanders.TreeNode, itemID string) (shouldSkip bool, maxToExpand int) {\n\t\t///\n\t\t/// Limit walking of things that have LOTS of nodes\n\t\t/// so we don't get stuck\n\t\t///\n\n\t\titemIDSegmentLength := len(strings.Split(currentNode.ID, \"/\"))\n\n\t\t// Only expand limitted set under container repositories\n\t\tif r := regexp.MustCompile(\".*/<repositories>/.*/.*\"); r.MatchString(itemID) {\n\t\t\treturn false, 1\n\t\t}\n\n\t\t// Only expand limitted set under activity log\n\t\tif r := regexp.MustCompile(\"/subscriptions/.*/resourceGroups/.*/<activitylog>\"); r.MatchString(itemID) {\n\t\t\t// Only walk the activity provider the first time we see it.\n\t\t\tdefer func() {\n\t\t\t\tshouldSkipActivityProvider = true\n\t\t\t}()\n\t\t\treturn shouldSkipActivityProvider, 1\n\t\t}\n\n\t\t// Only expand limitted set under deployments\n\t\tif r := regexp.MustCompile(\"/subscriptions/.*/resourceGroups/.*/providers/Microsoft.Resources/deployments\"); r.MatchString(itemID) && itemIDSegmentLength >= 7 {\n\t\t\treturn false, 1\n\t\t}\n\n\t\t// Only expand limitted set under metrics\n\t\tif strings.HasSuffix(itemID, \"providers/microsoft.insights/metricdefinitions\") {\n\t\t\tdefer func() {\n\t\t\t\tshouldSkipMetricsProvider = true\n\t\t\t}()\n\t\t\treturn shouldSkipMetricsProvider, 1\n\t\t}\n\n\t\treturn false, -1\n\t}\n\n\tstateMap := map[string]*fuzzState{}\n\n\tstartTime := time.Now()\n\tendTime := startTime.Add(time.Duration(settings.FuzzerDurationMinutes) * time.Minute)\n\tgo func() {\n\t\t// recover from panic, if one occurrs, and leave terminal usable\n\t\tdefer errorhandling.RecoveryWithCleanup()\n\n\t\tvar navigatedChannel chan interface{}\n\n\t\t// If used with `-navigate` wait for navigation to finish before fuzzing\n\t\tif settings.NavigateToID != \"\" {\n\t\t\tfor {\n\t\t\t\t<-time.After(time.Second * 1)\n\t\t\t\tif !processNavigations {\n\n\t\t\t\t\t// `-navigate` is finished, subscribe to nav events and get started\n\t\t\t\t\t// by expanding the current item\n\t\t\t\t\tnavigatedChannel = eventing.SubscribeToTopic(\"list.navigated\")\n\t\t\t\t\tlist.ExpandCurrentSelection()\n\n\t\t\t\t\tbreak\n\t\t\t\t}\n\t\t\t}\n\t\t} else {\n\t\t\tnavigatedChannel = eventing.SubscribeToTopic(\"list.navigated\")\n\t\t}\n\n\t\tfor {\n\t\t\tif time.Now().After(endTime) {\n\t\t\t\tgui.Close()\n\t\t\t\tfmt.Println(\"Fuzzer completed with no panics\")\n\t\t\t\tos.Exit(0)\n\t\t\t}\n\n\t\t\tnavigateStateInterface := <-navigatedChannel\n\n\t\t\tnavigateState := navigateStateInterface.(views.ListNavigatedEventState)\n\n\t\t\t// If started with `-navigate` don't walk outside the specified resource\n\t\t\tif settings.NavigateToID != \"\" && !strings.HasPrefix(navigateState.ParentNodeID, settings.NavigateToID) {\n\t\t\t\tfmt.Println(\"Fuzzer finished working on nodes under `-navigate` ID supplied\")\n\t\t\t\tst.Expect(testName(\"EXPECTED_limit_fuzz_to_navigate_node_id\"), navigateState.ParentNodeID, settings.NavigateToID)\n\t\t\t}\n\n\t\t\tnodeList := navigateState.NewNodes\n\n\t\t\t// Create or Retrieve the current status of the fuzzer for this\n\t\t\t// level in the tree\n\t\t\tstate, exists := stateMap[navigateState.ParentNodeID]\n\t\t\tif !exists {\n\t\t\t\tstate = &fuzzState{\n\t\t\t\t\tcurrent: 0,\n\t\t\t\t\tmax: len(nodeList),\n\t\t\t\t}\n\t\t\t\tstateMap[navigateState.ParentNodeID] = state\n\t\t\t}\n\n\t\t\t// Fuzzing completed on this level\n\t\t\tif state.current >= state.max {\n\t\t\t\t// Navigate back\n\t\t\t\tlist.GoBack()\n\t\t\t\tcontinue\n\t\t\t}\n\n\t\t\t// Get the current item to decide if we should skip or limit how many\n\t\t\t// children to expand\n\t\t\tcurrentItem := list.GetNodes()[state.current]\n\t\t\tskipItem, maxItem := shouldSkip(currentItem, navigateState.ParentNodeID)\n\t\t\tif maxItem != -1 {\n\t\t\t\tstate.max = min(maxItem, state.max)\n\t\t\t}\n\n\t\t\t// Store the resulting nodes so we can assert tests about expandedItem -> resultingNodes\n\t\t\t// behaved as expected\n\t\t\tvar resultNodes []*expanders.TreeNode\n\n\t\t\tif skipItem {\n\t\t\t\t// Skip the current item and expand\n\t\t\t\tstate.current++\n\n\t\t\t\t// If skip takes us to the end of the available items nav back up stack\n\t\t\t\tif state.current >= state.max {\n\t\t\t\t\t// Navigate back\n\t\t\t\t\tlist.GoBack()\n\t\t\t\t\tcontinue\n\t\t\t\t}\n\n\t\t\t\t// Move to next item\n\t\t\t\tlist.ChangeSelection(state.current)\n\n\t\t\t\t// Expand it\n\t\t\t\tlist.ExpandCurrentSelection()\n\n\t\t\t\tresultNodes = list.GetNodes()\n\t\t\t} else {\n\t\t\t\t// Move to current item\n\t\t\t\tlist.ChangeSelection(state.current)\n\t\t\t\t// Expand it\n\t\t\t\tlist.ExpandCurrentSelection()\n\t\t\t\tstate.current++\n\n\t\t\t\tresultNodes = list.GetNodes()\n\t\t\t}\n\n\t\t\t// Assert things about the navigation based on the current item and the result nodes\n\t\t\tassertNavigationCorrect(currentItem, resultNodes)\n\t\t}\n\t}()\n}", "title": "" }, { "docid": "a567af394de3727cbce089c2f1d815e1", "score": "0.448764", "text": "func main() {\n\tfor i := 1; i <= 100; i++ {\n\t\tswitch {\n\t\tcase i%3 == 0 && i%5 == 0:\n\t\t\tfmt.Println(\"FizzBuzz\")\n\t\tcase i%3 == 0:\n\t\t\tfmt.Println(\"Fizz\")\n\t\tcase i%5 == 0:\n\t\t\tfmt.Println(\"Buzz\")\n\t\tdefault:\n\t\t\tfmt.Println(i)\n\t\t}\n\t}\n}", "title": "" }, { "docid": "d48d4a253d4d4958a89a8e01db9dbd59", "score": "0.44855455", "text": "func stub(name string) string {\n\tstr := \"package migrations\\n\\n\"\n\tstr += \"type %s struct{}\\n\\n\"\n\tstr += \"func (m %[1]v) Up() bool {\\n\\t// setup db\\n\\treturn true\\n}\\n\\n\"\n\tstr += \"func (m %[1]v) Down() bool {\\n\\t// take down db\\n\\treturn true\\n}\"\n\n\treturn fmt.Sprintf(str, utils.ToUpperFirst(name))\n}", "title": "" }, { "docid": "41253c643c0a05b221887550037924e7", "score": "0.44601443", "text": "func TestConsumerBuilder(t *testing.T) {\n\n\tt.Run(\"name not set\", func(t *testing.T) {\n\t\tcb := NewConfluentConsumerBuilder(\"\")\n\t\tcon, err := cb.Build()\n\t\tassert.Error(t, err)\n\t\tassert.Nil(t, con)\n\t})\n\n\tt.Run(\"broker not set\", func(t *testing.T) {\n\t\tcb := NewConfluentConsumerBuilder(\"alpha\")\n\t\tcb.SetTopics([]string{\"a\", \"b\"})\n\t\tcon, err := cb.Build()\n\t\tassert.Error(t, err)\n\t\tassert.Nil(t, con)\n\t})\n\n\tt.Run(\"topics not set\", func(t *testing.T) {\n\t\tcb := NewConfluentConsumerBuilder(\"alpha\")\n\t\tcb.SetBroker([]string{\"a:9092\", \"b:9092\"})\n\t\tcon, err := cb.Build()\n\t\tassert.Error(t, err)\n\t\tassert.Nil(t, con)\n\t})\n\n\tt.Run(\"all good\", func(t *testing.T) {\n\t\tcb := NewConfluentConsumerBuilder(\"alpha\")\n\t\tcb.SetBroker([]string{\"a:9092\", \"b:9092\"})\n\t\tcb.SetTopics([]string{\"a\", \"b\"})\n\t\tcon, err := cb.Build()\n\t\tassert.NoError(t, err)\n\t\tassert.NotNil(t, con)\n\t})\n\n}", "title": "" }, { "docid": "26d063274c18dbed6b66f7e073d97e13", "score": "0.4459396", "text": "func Test4_F19_F20_F21_F22_F23_F24_F25_F26(t *testing.T) {\n\t// Test F19 function\n\tif f19 := compositeTypes.F19(); \"Johnny Bravo\" != f19.Name {\n\t\tt.Errorf(\"Should be \\\"Johnny Bravo\\\"\")\n\t}\n\n\t// Test F20 function\n\tif f20 := compositeTypes.F20(); \"Johnny Bravo\" != f20.Name {\n\t\tt.Errorf(\"Should be \\\"Johnny Bravo\\\"\")\n\t}\n\n\t// Test F21 function\n\tif f21 := compositeTypes.F21(compositeTypes.F20()); \"Principal Software Engineer\" != f21.Position || 10000 != f21.Salary {\n\t\tt.Errorf(\"Should be \\\"Principal Software Engineer\\\" and 10000\")\n\t}\n\n\t// Test F22 function\n\tif f22 := compositeTypes.F22(compositeTypes.F20(), \"Principal Software Engineer\", 10000); \"Principal Software Engineer\" != (*f22).Position || 10000 != (*f22).Salary {\n\t\tt.Errorf(\"Should be \\\"Principal Software Engineer\\\" and 10000\")\n\t}\n\n\t// Test F23 function\n\tif f231, f232 := compositeTypes.F23(); false != (f231 == f232) {\n\t\tt.Errorf(\"Should be false\")\n\t}\n\n\t// Test F24 function\n\tif f24 := compositeTypes.F24(); 1 != f24 {\n\t\tt.Errorf(\"Should be 1\")\n\t}\n\n\t// Test F25 function\n\tif f251, f252 := compositeTypes.F25(); true == ((f251.Circle.Center.X != f252.X) || (f251.Circle.Center.Y != f252.Y)) {\n\t\tt.Errorf(\"Should be true\")\n\t}\n\n\t// Test F26 function\n\tif f261, f262 := compositeTypes.F26(); true == ((f261.X != f262.X) || (f261.Y != f262.Y)) {\n\t\tt.Errorf(\"Should be true\")\n\t}\n}", "title": "" }, { "docid": "ff606a099a1f8515d8f76d79dbf08e17", "score": "0.44367537", "text": "func generateCF(indicator []int, i int, s string) {\n\tif i == 0 {\n\t\tif indicator[i] == 1 {\n\t\t\t// fuzz surname\n\t\t\tc := make(chan [3]string)\n\n\t\t\tgo fuzzAlphabet(c)\n\t\t\tfor sur := range c {\n\t\t\t\tsurname = sur[0] + sur[1] + sur[2]\n\t\t\t\tgenerateCF(indicator, 1, surname)\n\t\t\t}\n\t\t} else {\n\t\t\tgenerateCF(indicator, 1, surname)\n\t\t}\n\t}\n\tif i == 1 {\n\t\tif indicator[i] == 1 {\n\t\t\t//fuzz firstname\n\t\t\tc2 := make(chan [3]string)\n\t\t\tgo fuzzAlphabet(c2)\n\t\t\tfor fir := range c2 {\n\t\t\t\tfirstname = fir[0] + fir[1] + fir[2]\n\t\t\t\tcomposite := s + firstname\n\t\t\t\tgenerateCF(indicator, 2, composite)\n\t\t\t}\n\t\t} else {\n\t\t\tgenerateCF(indicator, 2, s+firstname)\n\t\t}\n\t}\n\tif i == 2 {\n\t\tif indicator[i] == 1 {\n\t\t\tvar start, end time.Time\n\t\t\t// set start and end time envelope to match min and max age if entered\n\t\t\tif minAge {\n\t\t\t\tstart = time.Now().AddDate(-minAgeInYears, 0, 0)\n\t\t\t} else {\n\t\t\t\tstart = time.Now()\n\t\t\t}\n\t\t\tif maxAge {\n\t\t\t\tend = time.Now().AddDate(-maxAgeInYears, 0, 0)\n\t\t\t} else {\n\t\t\t\tend = time.Now().AddDate(-80, 0, 0)\n\t\t\t}\n\t\t\tfor rd := rangeDate(start, end); ; {\n\t\t\t\tdaterange := rd()\n\t\t\t\t// bottom-out date range\n\t\t\t\tif daterange.Year() <= start.Year() {\n\t\t\t\t\tbirthYear := daterange.Year()\n\t\t\t\t\tbirthYear = birthYear % 100\n\t\t\t\t\tday := daterange.Day()\n\t\t\t\t\tmCode := m[daterange.Month().String()]\n\t\t\t\t\tif !fuzzSex {\n\t\t\t\t\t\tcomposite := s + fmt.Sprintf(\"%02d\", birthYear) + mCode + fmt.Sprintf(\"%02d\", day)\n\t\t\t\t\t\tgenerateCF(indicator, 3, composite)\n\t\t\t\t\t} else {\n\t\t\t\t\t\tcomposite := s + fmt.Sprintf(\"%02d\", birthYear) + mCode\n\t\t\t\t\t\tgenerateCF(indicator, 3, composite)\n\t\t\t\t\t}\n\t\t\t\t} else {\n\t\t\t\t\tbreak\n\t\t\t\t}\n\t\t\t}\n\t\t} else {\n\t\t\tif fuzzSex {\n\t\t\t\tgenerateCF(indicator, 3, s+fmt.Sprintf(\"%02d\", birthYear)+mCode)\n\t\t\t} else {\n\t\t\t\tgenerateCF(indicator, 3, s+fmt.Sprintf(\"%02d\", birthYear)+mCode+fmt.Sprintf(\"%02d\", day))\n\t\t\t}\n\t\t}\n\t}\n\tif i == 3 {\n\t\tif fuzzSex {\n\t\t\tcomposite := s + fmt.Sprintf(\"%02d\", day+40)\n\t\t\tgenerateCF(indicator, 4, composite)\n\t\t\tcomposite = s + fmt.Sprintf(\"%02d\", day)\n\t\t\tgenerateCF(indicator, 4, composite)\n\t\t} else {\n\t\t\tgenerateCF(indicator, 4, s)\n\t\t}\n\t}\n\tif i == 4 {\n\t\tif indicator[i] == 1 {\n\t\t\tc3 := make(chan string)\n\t\t\tgo fuzzComuneCode(c3)\n\t\t\tfor ccode := range c3 {\n\t\t\t\tcomposite := s + ccode\n\t\t\t\tcf := composite + calculateCheck(composite)\n\t\t\t\tfmt.Println(cf)\n\t\t\t\tif writeOut {\n\t\t\t\t\tf.WriteString(cf + \"\\n\")\n\t\t\t\t}\n\t\t\t}\n\t\t} else {\n\t\t\tcf := s + comuneCode + calculateCheck(s+comuneCode)\n\t\t\tfmt.Println(cf)\n\t\t\tf.WriteString(cf + \"\\n\")\n\t\t}\n\t}\n}", "title": "" }, { "docid": "c0dcd9752ce6347158d18a545e861d40", "score": "0.44358477", "text": "func FactoryDemo() {\n\tfmt.Println(\"Factory Demo.........\")\n\tyamOptions := []visitor.Option{\n\t\tvisitor.WithCount(3),\n\t\tvisitor.WithFarmRate(5),\n\t}\n\n\tcornOptions := []visitor.Option{\n\t\tvisitor.WithCount(3),\n\t\tvisitor.WithFarmRate(5),\n\t}\n\n\tfactory := NewFoodFactory()\n\n\tyam := factory.CreateYam(yamOptions...)\n\tcorn := factory.CreateCorn(cornOptions...)\n\trice := factory.CreateRice()\n\n\tfmt.Printf(\"We have: %+v\\n\", yam)\n\tfmt.Printf(\"We have: %+v\\n\", corn)\n\tfmt.Printf(\"We have: %+v\\n\", rice)\n}", "title": "" }, { "docid": "4b141a4743293b64fb562f96896c6c5c", "score": "0.44357473", "text": "func TestQuickstarter(t *testing.T) {\n\n\tvar quickstarterPaths []string\n\todsCoreRootPath := \"../..\"\n\ttarget := os.Args[len(os.Args)-1]\n\tif strings.HasPrefix(target, \".\") || strings.HasPrefix(target, \"/\") {\n\t\tif strings.HasSuffix(target, \"...\") {\n\t\t\tquickstarterPaths = collectTestableQuickstarters(\n\t\t\t\tt, strings.TrimSuffix(target, \"/...\"),\n\t\t\t)\n\t\t} else {\n\t\t\tquickstarterPaths = append(quickstarterPaths, target)\n\t\t}\n\t} else {\n\t\t// No slash = quickstarter in ods-quickstarters\n\t\t// Ending with ... = all quickstarters in given folder\n\t\t// otherwise = exactly one quickstarter\n\t\tif !strings.Contains(target, \"/\") {\n\t\t\tquickstarterPaths = []string{fmt.Sprintf(\"%s/../%s/%s\", odsCoreRootPath, \"ods-quickstarters\", target)}\n\t\t} else if strings.HasSuffix(target, \"...\") {\n\t\t\tquickstarterPaths = collectTestableQuickstarters(\n\t\t\t\tt, fmt.Sprintf(\"%s/../%s\", odsCoreRootPath, strings.TrimSuffix(target, \"/...\")),\n\t\t\t)\n\t\t} else {\n\t\t\tquickstarterPaths = []string{fmt.Sprintf(\"%s/../%s\", odsCoreRootPath, target)}\n\t\t}\n\t}\n\n\tconfig, err := utils.ReadConfiguration()\n\tif err != nil {\n\t\tt.Fatal(err)\n\t}\n\tcdUserPassword, err := b64.StdEncoding.DecodeString(config[\"CD_USER_PWD_B64\"])\n\tif err != nil {\n\t\tt.Fatalf(\"Error decoding cd_user password: %s\", err)\n\t}\n\n\tfmt.Printf(\"\\n\\nRunning test steps found in the following directories:\\n\")\n\tfor _, quickstarterPath := range quickstarterPaths {\n\t\tfmt.Printf(\"- %s\\n\", quickstarterPath)\n\t}\n\tfmt.Printf(\"\\n\\n\")\n\n\tfor _, quickstarterPath := range quickstarterPaths {\n\t\ttestdataPath := fmt.Sprintf(\"%s/testdata\", quickstarterPath)\n\t\tquickstarterRepo := filepath.Base(filepath.Dir(quickstarterPath))\n\t\tquickstarterName := filepath.Base(quickstarterPath)\n\n\t\tfmt.Printf(\"\\n\\n\\n\\n\")\n\t\tfmt.Printf(\"Running tests for quickstarter %s\\n\", quickstarterName)\n\t\tfmt.Printf(\"\\n\\n\")\n\n\t\tfreeUnusedResources(t)\n\t\trestartAtlassianSuiteIfLicenseExpiresInLessThan(t)\n\n\t\t// Run each quickstarter test in a subtest to avoid exiting early\n\t\t// when t.Fatal is used.\n\t\tt.Run(quickstarterName, func(t *testing.T) {\n\t\t\tt.Parallel()\n\t\t\ts, err := readSteps(testdataPath)\n\t\t\tif err != nil {\n\t\t\t\tt.Fatal(err)\n\t\t\t}\n\n\t\t\tfor i, step := range s.Steps {\n\t\t\t\t// Step might overwrite component ID\n\t\t\t\tif len(step.ComponentID) == 0 {\n\t\t\t\t\tstep.ComponentID = s.ComponentID\n\t\t\t\t}\n\t\t\t\tfmt.Printf(\n\t\t\t\t\t\"\\n\\nRun step #%d (%s) of quickstarter %s/%s ... %s\\n\",\n\t\t\t\t\t(i + 1),\n\t\t\t\t\tstep.Type,\n\t\t\t\t\tquickstarterRepo,\n\t\t\t\t\tquickstarterName,\n\t\t\t\t\tstep.Description,\n\t\t\t\t)\n\n\t\t\t\trepoName := fmt.Sprintf(\"%s-%s\", strings.ToLower(utils.PROJECT_NAME), step.ComponentID)\n\n\t\t\t\tif step.Type == \"upload\" {\n\t\t\t\t\tif len(step.UploadParams.Filename) == 0 {\n\t\t\t\t\t\tstep.UploadParams.Filename = filepath.Base(step.UploadParams.File)\n\t\t\t\t\t}\n\t\t\t\t\tstdout, stderr, err := utils.RunScriptFromBaseDir(\"tests/scripts/upload-file-to-bitbucket.sh\", []string{\n\t\t\t\t\t\tfmt.Sprintf(\"--bitbucket=%s\", config[\"BITBUCKET_URL\"]),\n\t\t\t\t\t\tfmt.Sprintf(\"--user=%s\", config[\"CD_USER_ID\"]),\n\t\t\t\t\t\tfmt.Sprintf(\"--password=%s\", cdUserPassword),\n\t\t\t\t\t\tfmt.Sprintf(\"--project=%s\", utils.PROJECT_NAME),\n\t\t\t\t\t\tfmt.Sprintf(\"--repository=%s\", repoName),\n\t\t\t\t\t\tfmt.Sprintf(\"--file=%s/%s\", testdataPath, step.UploadParams.File),\n\t\t\t\t\t\tfmt.Sprintf(\"--filename=%s\", step.UploadParams.Filename),\n\t\t\t\t\t}, []string{})\n\n\t\t\t\t\tif err != nil {\n\t\t\t\t\t\tt.Fatalf(\n\t\t\t\t\t\t\t\"Execution of `upload-file-to-bitbucket.sh` failed: \\nStdOut: %s\\nStdErr: %s\\nErr: %s\\n\",\n\t\t\t\t\t\t\tstdout,\n\t\t\t\t\t\t\tstderr,\n\t\t\t\t\t\t\terr)\n\t\t\t\t\t} else {\n\t\t\t\t\t\tfmt.Printf(\"Uploaded file %s to %s\\n\", step.UploadParams.File, config[\"BITBUCKET_URL\"])\n\t\t\t\t\t}\n\t\t\t\t\tcontinue\n\t\t\t\t}\n\n\t\t\t\tvar request utils.RequestBuild\n\t\t\t\tvar pipelineName string\n\t\t\t\tvar jenkinsfile string\n\t\t\t\tvar verify *TestStepVerify\n\t\t\t\ttmplData := templateData(config, step.ComponentID, \"\")\n\t\t\t\tif step.Type == \"provision\" {\n\t\t\t\t\t// cleanup and create bb resources for this test\n\t\t\t\t\terr = recreateBitbucketRepo(config, utils.PROJECT_NAME, repoName)\n\t\t\t\t\tif err != nil {\n\t\t\t\t\t\tt.Fatal(err)\n\t\t\t\t\t}\n\t\t\t\t\terr = deleteOpenShiftResources(utils.PROJECT_NAME, step.ComponentID, utils.PROJECT_NAME_DEV)\n\t\t\t\t\tif err != nil {\n\t\t\t\t\t\tt.Fatal(err)\n\t\t\t\t\t}\n\t\t\t\t\tbranch := config[\"ODS_GIT_REF\"]\n\t\t\t\t\tif len(step.ProvisionParams.Branch) > 0 {\n\t\t\t\t\t\tbranch = renderTemplate(t, step.ProvisionParams.Branch, tmplData)\n\t\t\t\t\t}\n\t\t\t\t\tagentImageTag := config[\"ODS_IMAGE_TAG\"]\n\t\t\t\t\tif len(step.ProvisionParams.AgentImageTag) > 0 {\n\t\t\t\t\t\tagentImageTag = renderTemplate(t, step.ProvisionParams.AgentImageTag, tmplData)\n\t\t\t\t\t}\n\t\t\t\t\tsharedLibraryRef := agentImageTag\n\t\t\t\t\tif len(step.ProvisionParams.SharedLibraryRef) > 0 {\n\t\t\t\t\t\tsharedLibraryRef = renderTemplate(t, step.ProvisionParams.SharedLibraryRef, tmplData)\n\t\t\t\t\t}\n\t\t\t\t\tenv := []utils.EnvPair{\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tName: \"ODS_NAMESPACE\",\n\t\t\t\t\t\t\tValue: config[\"ODS_NAMESPACE\"],\n\t\t\t\t\t\t},\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tName: \"ODS_GIT_REF\",\n\t\t\t\t\t\t\tValue: config[\"ODS_GIT_REF\"],\n\t\t\t\t\t\t},\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tName: \"ODS_IMAGE_TAG\",\n\t\t\t\t\t\t\tValue: config[\"ODS_IMAGE_TAG\"],\n\t\t\t\t\t\t},\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tName: \"ODS_BITBUCKET_PROJECT\",\n\t\t\t\t\t\t\tValue: config[\"ODS_BITBUCKET_PROJECT\"],\n\t\t\t\t\t\t},\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tName: \"AGENT_IMAGE_TAG\",\n\t\t\t\t\t\t\tValue: agentImageTag,\n\t\t\t\t\t\t},\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tName: \"SHARED_LIBRARY_REF\",\n\t\t\t\t\t\t\tValue: sharedLibraryRef,\n\t\t\t\t\t\t},\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tName: \"PROJECT_ID\",\n\t\t\t\t\t\t\tValue: utils.PROJECT_NAME,\n\t\t\t\t\t\t},\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tName: \"COMPONENT_ID\",\n\t\t\t\t\t\t\tValue: step.ComponentID,\n\t\t\t\t\t\t},\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tName: \"GIT_URL_HTTP\",\n\t\t\t\t\t\t\tValue: fmt.Sprintf(\"%s/%s/%s.git\", config[\"REPO_BASE\"], utils.PROJECT_NAME, repoName),\n\t\t\t\t\t\t},\n\t\t\t\t\t}\n\t\t\t\t\trequest = utils.RequestBuild{\n\t\t\t\t\t\tRepository: quickstarterRepo,\n\t\t\t\t\t\tBranch: branch,\n\t\t\t\t\t\tProject: config[\"ODS_BITBUCKET_PROJECT\"],\n\t\t\t\t\t\tEnv: append(env, step.ProvisionParams.Env...),\n\t\t\t\t\t}\n\t\t\t\t\t// If quickstarter is overwritten, use that value. Otherwise\n\t\t\t\t\t// we use the quickstarter under test.\n\t\t\t\t\tif len(step.ProvisionParams.Quickstarter) > 0 {\n\t\t\t\t\t\tjenkinsfile = fmt.Sprintf(\"%s/Jenkinsfile\", step.ProvisionParams.Quickstarter)\n\t\t\t\t\t} else {\n\t\t\t\t\t\tjenkinsfile = fmt.Sprintf(\"%s/Jenkinsfile\", quickstarterName)\n\t\t\t\t\t}\n\t\t\t\t\tpipelineName = step.ProvisionParams.Pipeline\n\t\t\t\t\tverify = step.ProvisionParams.Verify\n\t\t\t\t} else if step.Type == \"build\" {\n\t\t\t\t\tbranch := \"master\"\n\t\t\t\t\tif len(step.BuildParams.Branch) > 0 {\n\t\t\t\t\t\tbranch = renderTemplate(t, step.BuildParams.Branch, tmplData)\n\t\t\t\t\t}\n\t\t\t\t\trequest = utils.RequestBuild{\n\t\t\t\t\t\tRepository: repoName,\n\t\t\t\t\t\tBranch: branch,\n\t\t\t\t\t\tProject: utils.PROJECT_NAME,\n\t\t\t\t\t\tEnv: step.BuildParams.Env,\n\t\t\t\t\t}\n\t\t\t\t\tjenkinsfile = \"Jenkinsfile\"\n\t\t\t\t\tpipelineName = step.BuildParams.Pipeline\n\t\t\t\t\tverify = step.BuildParams.Verify\n\t\t\t\t}\n\t\t\t\tbuildName, err := utils.RunJenkinsPipeline(jenkinsfile, request, pipelineName)\n\t\t\t\tif err != nil {\n\t\t\t\t\tt.Fatal(err)\n\t\t\t\t}\n\n\t\t\t\tverifyPipelineRun(t, step, verify, testdataPath, repoName, buildName, config)\n\t\t\t}\n\t\t})\n\t}\n}", "title": "" }, { "docid": "507b8b1bc9808a1009c8408be59e3316", "score": "0.4429848", "text": "func testBuildGood(t *testing.T, dstname, srcname string) {\n\toutput, err := testBuild(t, dstname, srcname, nil)\n\tif err != nil {\n\t\tt.Errorf(\"build failed: %v, %s\", err, output)\n\t}\n}", "title": "" }, { "docid": "cd166cb07b9e918fb266b342a29fa8d9", "score": "0.4429297", "text": "func main() {\n\tp, err := parse(`\ndef fibo(n){\n\tif (n <= 1){\n\t\treturn 1;\n\t}\n\treturn fibo(n-1) + fibo(n-2);\n}\n\ndef main(){\n\tprint fibo(6);\n\tprint fibo(7);\n\tprint fibo(8);\n\treturn;\n}`)\n\tif err != nil {\n\t\treturn\n\t}\n\n\terr = check(p)\n\n\tops, start, err := gen(p)\n\tif err != nil {\n\t\tfmt.Printf(\"Error : %v\\n\", err)\n\t\treturn\n\t}\n\n\t// s, err := dump(ops, start)\n\t// if err != nil {\n\t// \tfmt.Printf(\"Error : %v\\n\", err)\n\t// \treturn\n\t// }\n\n\t// fmt.Println(s)\n\n\trun(ops, start, os.Stdout)\n}", "title": "" }, { "docid": "a3b5ec5ecb87e119877b64b4c5b97875", "score": "0.44251317", "text": "func Test_sumEvenFibonacci(t *testing.T) {\n\ttype args struct {\n\t\tlimit int\n\t}\n\ttests := []struct {\n\t\tname string\n\t\targs args\n\t\twant int\n\t}{\n\t\t// TODO: Add test cases.\n\t\t{name: \"default\", args: args{limit: 8}, want: 10},\n\t\t{name: \"case1\", args: args{limit: 111111}, want: 60696},\n\t\t{name: \"case2\", args: args{limit: 8675309}, want: 4613732},\n\t\t{name: \"case3\", args: args{limit: 1}, want: 2},\n\t\t{name: \"case4\", args: args{limit: 96746}, want: 60696},\n\t\t{name: \"case5\", args: args{limit: 144100000}, want: 82790070},\n\t\t{name: \"case6\", args: args{limit: 65140000}, want: 82790070},\n\t\t{name: \"case7\", args: args{limit: 7347000000}, want: 6293134512},\n\t\t{name: \"case8\", args: args{limit: 10000000000000}, want: 8583840088782},\n\t\t{name: \"case9\", args: args{limit: 123456789000000}, want: 154030760585064},\n\t\t{name: \"case10\", args: args{limit: 2}, want: 2},\n\t}\n\tfor _, tt := range tests {\n\t\tt.Run(tt.name, func(t *testing.T) {\n\t\t\tif got := sumEvenFibonacci(tt.args.limit); got != tt.want {\n\t\t\t\tt.Errorf(\"sumEvenFibonacci() = %v, want %v\", got, tt.want)\n\t\t\t}\n\t\t})\n\t}\n}", "title": "" }, { "docid": "a702e02caaf50d7e715aa2603cd45d84", "score": "0.4422478", "text": "func Test_OfExportOptionsParser(t *testing.T) {\n\n}", "title": "" }, { "docid": "d367de0c739033e6f93d35cdcfdb259f", "score": "0.44217202", "text": "func buildRunner(t *testing.T) string {\n\tbindir := filepath.Join(t.TempDir(), \"bin\")\n\terr := os.Mkdir(bindir, os.ModePerm)\n\tif err != nil {\n\t\tt.Fatal(err)\n\t}\n\tbinary := filepath.Join(bindir, \"runner\")\n\tif runtime.GOOS == \"windows\" {\n\t\tbinary += \".exe\"\n\t}\n\tcmd := exec.Command(\"go\", \"build\", \"-o\", binary)\n\tif err := cmd.Run(); err != nil {\n\t\tt.Fatalf(\"Building fuzz-runner: %v\", err)\n\t}\n\treturn binary\n}", "title": "" }, { "docid": "6dc1ecf9c2afaafe50077292b80573a7", "score": "0.44186437", "text": "func NewMockFizzBuzzParam(ctrl *gomock.Controller) *MockFizzBuzzParam {\n\tmock := &MockFizzBuzzParam{ctrl: ctrl}\n\tmock.recorder = &MockFizzBuzzParamMockRecorder{mock}\n\treturn mock\n}", "title": "" }, { "docid": "e802d410d49aa77703c472dfd38c8f51", "score": "0.44082618", "text": "func Test_param_Transfer_Bit(t *testing.T) {\r\n\tvar para model.Para\r\n\ttemp_strcode := \"\"\r\n\ttemp_strresultvalue := \"\"\r\n\tstrCode := &temp_strcode\r\n\tstrResultValue := &temp_strresultvalue\r\n\ttemp_strresult := temp_strresultvalue\r\n\tstrResult := &temp_strresult\r\n\tpara.ParaRangeList = make([]model.ParaRange, 4, 4)\r\n\ti := 0\r\n\tfor i < 4 {\r\n\t\tif i == 0 {\r\n\t\t\ttemp_strcode = \"1111\"\r\n\t\t\ttemp_strresultvalue = \"15\"\r\n\t\t\tpara.Process_type = \"raw\"\r\n\t\t\tpara.Process_unit = \"bit\"\r\n\t\t\tpara.Process_start = \"0\"\r\n\t\t\tpara.Process_end = \"0\"\r\n\t\t\tpara.ParaRangeList[i].ParaRangeSpecification = \"TestBit\"\r\n\t\t\tpara.ParaRangeList[i].Alarm_min = \"0\"\r\n\t\t\tpara.ParaRangeList[i].Alarm_min_equal = \"true\"\r\n\t\t\tpara.ParaRangeList[i].Alarm_max = \"1\"\r\n\t\t\tpara.ParaRangeList[i].Alarm_max_equal = \"true\"\r\n\t\t\tNormal, Error := controller.Param_Transfer(para, strCode, strResult, strResultValue)\r\n\t\t\tfmt.Printf(\"%s %s %s %t %s\\n\", *strCode, *strResult, *strResultValue, Normal, Error)\r\n\t\t} else if i == 1 {\r\n\t\t\ttemp_strcode = \"1111\"\r\n\t\t\ttemp_strresultvalue = \"15\"\r\n\t\t\tpara.Process_type = \"raw\"\r\n\t\t\tpara.Process_unit = \"bit\"\r\n\t\t\tpara.Process_start = \"0\"\r\n\t\t\tpara.Process_end = \"3\"\r\n\t\t\tpara.ParaRangeList[i].ParaRangeSpecification = \"TestBit\"\r\n\t\t\tpara.ParaRangeList[i].Alarm_min = \"0\"\r\n\t\t\tpara.ParaRangeList[i].Alarm_min_equal = \"true\"\r\n\t\t\tpara.ParaRangeList[i].Alarm_max = \"1\"\r\n\t\t\tpara.ParaRangeList[i].Alarm_max_equal = \"true\"\r\n\t\t\tNormal, Error := controller.Param_Transfer(para, strCode, strResult, strResultValue)\r\n\t\t\tfmt.Printf(\"%s %s %s %t %s\\n\", *strCode, *strResult, *strResultValue, Normal, Error)\r\n\t\t} else if i == 2 {\r\n\t\t\ttemp_strcode = \"11111111\"\r\n\t\t\ttemp_strresultvalue = \"238\"\r\n\t\t\tpara.Process_type = \"raw\"\r\n\t\t\tpara.Process_unit = \"bit\"\r\n\t\t\tpara.Process_start = \"0\"\r\n\t\t\tpara.Process_end = \"0\"\r\n\t\t\tpara.ParaRangeList[i].ParaRangeSpecification = \"TestBit\"\r\n\t\t\tpara.ParaRangeList[i].Alarm_min = \"0\"\r\n\t\t\tpara.ParaRangeList[i].Alarm_min_equal = \"true\"\r\n\t\t\tpara.ParaRangeList[i].Alarm_max = \"1\"\r\n\t\t\tpara.ParaRangeList[i].Alarm_max_equal = \"true\"\r\n\t\t\tNormal, Error := controller.Param_Transfer(para, strCode, strResult, strResultValue)\r\n\t\t\tfmt.Printf(\"%s %s %s %t %s\\n\", *strCode, *strResult, *strResultValue, Normal, Error)\r\n\t\t} else if i == 3 {\r\n\t\t\ttemp_strcode = \"11111111\"\r\n\t\t\ttemp_strresultvalue = \"238\"\r\n\t\t\tpara.Process_type = \"raw\"\r\n\t\t\tpara.Process_unit = \"bit\"\r\n\t\t\tpara.Process_start = \"0\"\r\n\t\t\tpara.Process_end = \"7\"\r\n\t\t\tpara.ParaRangeList[i].ParaRangeSpecification = \"TestBit\"\r\n\t\t\tpara.ParaRangeList[i].Alarm_min = \"0\"\r\n\t\t\tpara.ParaRangeList[i].Alarm_min_equal = \"true\"\r\n\t\t\tpara.ParaRangeList[i].Alarm_max = \"1\"\r\n\t\t\tpara.ParaRangeList[i].Alarm_max_equal = \"true\"\r\n\t\t\tNormal, Error := controller.Param_Transfer(para, strCode, strResult, strResultValue)\r\n\t\t\tfmt.Printf(\"%s %s %s %t %s\\n\", *strCode, *strResult, *strResultValue, Normal, Error)\r\n\t\t}\r\n\t\ti++\r\n\t}\r\n}", "title": "" }, { "docid": "02bd2e505d5a6662f25de36130fde74d", "score": "0.44030574", "text": "func TestComplexLibrary(t *testing.T) {\n\n}", "title": "" }, { "docid": "0b1e03a7a631b3052f046d4a3ffdf2c8", "score": "0.44026837", "text": "func runTest(ctx context.Context) error {\n\tm, err := downloadManifest(*manifestURL)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"unable to download the manifest from %q: %w\", *manifestURL, err)\n\t}\n\tlog.Printf(\"Successfully downloaded the JSON manifest from %s\", *manifestURL)\n\n\tif err := verifyConfigSHA(m, *configsURL); err != nil {\n\t\treturn fmt.Errorf(\"failed to cross-check configs digest specified in the manifest with the configs tarball: %w\", err)\n\t}\n\n\tlog.Printf(\"Creating a new Bazel test repository at %q.\", *destRoot)\n\n\tif err := createTestRepo(m, *configsURL, *srcRoot, *destRoot, *rbeInstance); err != nil {\n\t\treturn fmt.Errorf(\"error creating the test Bazel repository: %w\", err)\n\t}\n\n\tctxWithTimeout, cancel := context.WithTimeout(ctx, time.Duration(*timeoutSeconds)*time.Second)\n\tdefer cancel()\n\tlog.Printf(\"Running test build for Bazel %s using configs downloaded from %s with timeout set to %d seconds.\", m.BazelVersion, *configsURL, *timeoutSeconds)\n\tif err := runTestBuild(ctxWithTimeout, *destRoot, m.BazelVersion); err != nil {\n\t\treturn fmt.Errorf(\"test build for Bazel %s using configs downloaded from %s failed on RBE Instance %s: %w\", m.BazelVersion, *configsURL, *rbeInstance, err)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "2dbce767ac6457546e9da4be9b36d8e4", "score": "0.44019216", "text": "func genTests(wr io.Writer) {\n\tconst text = `\n{{ $All := .All}}\n{{range $type := $All}}\n\t\t{{- if .IsMainService}}\n\t\t\tfunc Test{{.Name}}(t *testing.T) {\n\t// Use reflection to verify that our composite type contains all the\n\t// same fields as the alpha type.\n\tcompositeType := reflect.TypeOf({{.Name}}{})\n\talphaType := reflect.TypeOf(computealpha.{{.Name}}{})\n\tbetaType := reflect.TypeOf(computebeta.{{.Name}}{})\n\tgaType := reflect.TypeOf(compute.{{.Name}}{})\n\n\t// For the composite type, remove the Version field from consideration\n\tcompositeTypeNumFields := compositeType.NumField() - 2\n\tif compositeTypeNumFields != alphaType.NumField() {\n\t\tt.Fatalf(\"%v should contain %v fields. Got %v\", alphaType.Name(), alphaType.NumField(), compositeTypeNumFields)\n\t}\n\n // Compare all the fields by doing a lookup since we can't guarantee that they'll be in the same order\n\t// Make sure that composite type is strictly alpha fields + internal bookkeeping\n\tfor i := 2; i < compositeType.NumField(); i++ {\n\t\tlookupField, found := alphaType.FieldByName(compositeType.Field(i).Name)\n\t\tif !found {\n\t\t\tt.Fatal(fmt.Errorf(\"Field %v not present in alpha type %v\", compositeType.Field(i), alphaType))\n\t\t}\n\t\tif err := compareFields(compositeType.Field(i), lookupField); err != nil {\n\t\t\tt.Fatal(err)\n\t\t}\n\t}\n\n // Verify that all beta fields are in composite type\n\tif err := typeEquality(betaType, compositeType, false); err != nil {\n\t\tt.Fatal(err)\n\t}\n\n\t// Verify that all GA fields are in composite type\n\tif err := typeEquality(gaType, compositeType, false); err != nil {\n\t\tt.Fatal(err)\n\t}\n}\n\n// TODO: these tests don't do anything as they are currently structured.\n// func TestTo{{.Name}}(t *testing.T)\n\n{{range $version, $extension := $.Versions}}\nfunc Test{{$type.Name}}To{{$version}}(t *testing.T) {\n\tcomposite := {{$type.Name}}{}\n\texpected := &compute{{$extension}}.{{$type.Name}}{}\n\tresult, err := composite.To{{$version}}()\n\tif err != nil {\n\t\tt.Fatalf(\"{{$type.Name}}.To{{$version}}() error: %v\", err)\n\t}\n\n\tif !reflect.DeepEqual(result, expected) {\n\t\tt.Fatalf(\"{{$type.Name}}.To{{$version}}() = \\ninput = %s\\n%s\\nwant = \\n%s\", pretty.Sprint(composite), pretty.Sprint(result), pretty.Sprint(expected))\n\t}\n}\n{{- end}}\n{{- else}}\n\nfunc Test{{.Name}}(t *testing.T) {\n\tcompositeType := reflect.TypeOf({{.Name}}{})\n\talphaType := reflect.TypeOf(computealpha.{{.Name}}{})\n\tif err := typeEquality(compositeType, alphaType, true); err != nil {\n\t\tt.Fatal(err)\n\t}\n}\n{{- end}}\n{{- end}}\n`\n\tdata := struct {\n\t\tAll []compositemeta.ApiService\n\t\tVersions map[string]string\n\t}{compositemeta.AllApiServices, compositemeta.Versions}\n\n\tfuncMap := template.FuncMap{\n\t\t\"ToLower\": strings.ToLower,\n\t}\n\n\ttmpl := template.Must(template.New(\"tests\").Funcs(funcMap).Parse(text))\n\tif err := tmpl.Execute(wr, data); err != nil {\n\t\tpanic(err)\n\t}\n}", "title": "" }, { "docid": "005928afa6684e59161bb16584af93b5", "score": "0.4399214", "text": "func generateName(prefix string) string {\n\t// These next lines up through the for loop are obtaining and walking up the stack\n\t// trace to extract the test name, which is stored in name\n\tpc := make([]uintptr, 10)\n\truntime.Callers(0, pc)\n\tframes := runtime.CallersFrames(pc)\n\tname := \"\"\n\tfor f, next := frames.Next(); next; f, next = frames.Next() {\n\t\tname = f.Function\n\t\tif strings.Contains(name, \"Suite\") {\n\t\t\tbreak\n\t\t}\n\t}\n\tfuncNameStart := strings.Index(name, \"Test\")\n\tname = name[funcNameStart+len(\"Test\"):] // Just get the name of the test and not any of the garbage at the beginning\n\tname = strings.ToLower(name) // Ensure it is a valid resource name\n\tcurrentTime := time.Now()\n\tname = fmt.Sprintf(\"%s%s%d%d%d\", prefix, strings.ToLower(name), currentTime.Minute(), currentTime.Second(), currentTime.Nanosecond())\n\treturn name\n}", "title": "" }, { "docid": "8ba5f8d826d1271ebe7b00b6d587407d", "score": "0.4388455", "text": "func BuildGenesisTest(t *testing.T) (*api.BuildGenesisArgs, []byte) {\n\treturn BuildGenesisTestWithArgs(t, nil)\n}", "title": "" }, { "docid": "2887d5786c3f28078814c1f64ebeae51", "score": "0.4386553", "text": "func VerifyPostQuizzes() {\n\n\tfmt.Printf(config.Config.FVT.Topic, \"VerifyPostQuizzes\")\n\turl := \"http://0.0.0.0:8080/v1/quizzes\"\n\tpayload := `{\n\t\"number\":%d,\n\t\"description\":\"test description.\",\n\t\"score\":3,\n\t\"option_a\":\"test A\",\n\t\"option_b\":\"test B\",\n\t\"option_c\":\"test C\",\n\t\"option_d\":\"test D\",\n\t\"answer\":\"A\"\n}`\n\tjsonStr := fmt.Sprintf(payload, testQuizNumber)\n\treq, err := http.NewRequest(\"POST\", url, bytes.NewBuffer([]byte(jsonStr)))\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\n\tfmt.Printf(config.Config.FVT.Section, \"New Quiz\")\n\tfmt.Printf(config.Config.FVT.Detail, \"method and url\")\n\tfmt.Printf(\"```\\n$ POST %s\\n```\\n\", url)\n\tfmt.Printf(config.Config.FVT.Detail, \"example payload\")\n\tfmt.Printf(\"```\\n%s\\n```\\n\", jsonStr)\n\tresp, err := client.Do(req)\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\tbodyBytes, err := ioutil.ReadAll(resp.Body)\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\tfmt.Printf(config.Config.FVT.Detail, \"example response\")\n\tfmt.Printf(\"```\\n%s\\n```\\n\", string(bodyBytes))\n\n\tfmt.Printf(config.Config.FVT.Section, \"Duplicate Quiz\")\n\tfmt.Printf(config.Config.FVT.Detail, \"method and url\")\n\tfmt.Printf(\"```\\n$ POST %s\\n```\\n\", url)\n\tfmt.Printf(config.Config.FVT.Detail, \"example payload\")\n\tfmt.Printf(\"```\\n%s\\n```\\n\", jsonStr)\n\tresp, err = client.Do(req)\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\tbodyBytes, err = ioutil.ReadAll(resp.Body)\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\tfmt.Printf(config.Config.FVT.Detail, \"example response\")\n\tfmt.Printf(\"```\\n%s\\n```\\n\", string(bodyBytes))\n}", "title": "" } ]
8f15b2769b3df71eb862c300c49bfd81
Deprecated: Use CreateLiveSessionRequest.ProtoReflect.Descriptor instead.
[ { "docid": "db996af17f43b2ee9fc075d827608091", "score": "0.74079317", "text": "func (*CreateLiveSessionRequest) Descriptor() ([]byte, []int) {\n\treturn file_google_cloud_video_stitcher_v1_video_stitcher_service_proto_rawDescGZIP(), []int{23}\n}", "title": "" } ]
[ { "docid": "d51c82a26e8fcd9e090f53043492d4e5", "score": "0.7218283", "text": "func (*GetLiveSessionRequest) Descriptor() ([]byte, []int) {\n\treturn file_google_cloud_video_stitcher_v1_video_stitcher_service_proto_rawDescGZIP(), []int{24}\n}", "title": "" }, { "docid": "b67a17a1b673bf3875a162be87199235", "score": "0.6762329", "text": "func (*CRemoteClient_CreateSession_Request) Descriptor() ([]byte, []int) {\n\treturn file_steam_steammessages_remoteclient_service_messages_proto_rawDescGZIP(), []int{0}\n}", "title": "" }, { "docid": "6f803f48e295d35469de1f41ffb8abba", "score": "0.6644125", "text": "func (*CRemotePlay_SessionStarted_Request) Descriptor() ([]byte, []int) {\n\treturn file_steam_steammessages_remoteclient_service_messages_proto_rawDescGZIP(), []int{25}\n}", "title": "" }, { "docid": "e98a35d6fe6cd51812338064fcc49e44", "score": "0.66212064", "text": "func (*CreateVodSessionRequest) Descriptor() ([]byte, []int) {\n\treturn file_google_cloud_video_stitcher_v1_video_stitcher_service_proto_rawDescGZIP(), []int{6}\n}", "title": "" }, { "docid": "c04be70acd7f171249309221cfa944fe", "score": "0.6407425", "text": "func (*GetVodSessionRequest) Descriptor() ([]byte, []int) {\n\treturn file_google_cloud_video_stitcher_v1_video_stitcher_service_proto_rawDescGZIP(), []int{7}\n}", "title": "" }, { "docid": "0c9c5a9943042a6e373cdac3b1a31c19", "score": "0.63953364", "text": "func (*CreateSessionRequest) Descriptor() ([]byte, []int) {\n\treturn file_google_showcase_v1beta1_testing_proto_rawDescGZIP(), []int{1}\n}", "title": "" }, { "docid": "da09ed1c95585d48fbc09be8e9b2c532", "score": "0.6166428", "text": "func (*StreamLiveMatchRequest) Descriptor() ([]byte, []int) {\n\treturn file_live_proto_rawDescGZIP(), []int{2}\n}", "title": "" }, { "docid": "1f33b6f97f5d52ff8b94a4b49c8e06e2", "score": "0.61179733", "text": "func (*DeleteSessionRequest) Descriptor() ([]byte, []int) {\n\treturn file_google_showcase_v1beta1_testing_proto_rawDescGZIP(), []int{5}\n}", "title": "" }, { "docid": "c3b858883db58c3bca37d35fe7f5bacd", "score": "0.6091472", "text": "func (*ServerLiveRequest) Descriptor() ([]byte, []int) {\n\treturn file_grpc_predict_v2_proto_rawDescGZIP(), []int{0}\n}", "title": "" }, { "docid": "44c89bddbbe948ef95444cecdca07d17", "score": "0.6043057", "text": "func (*StreamTodaysLiveMatchesRequest) Descriptor() ([]byte, []int) {\n\treturn file_live_proto_rawDescGZIP(), []int{6}\n}", "title": "" }, { "docid": "99550c5d2e76e164e51801aa207405e4", "score": "0.6042458", "text": "func (*SessionRequest) Descriptor() ([]byte, []int) {\n\treturn file_bbq_intake_v1_intake_service_proto_rawDescGZIP(), []int{2}\n}", "title": "" }, { "docid": "8543e26d75f09ce64aeb7a95b441a258", "score": "0.6021735", "text": "func (*CRemoteClient_AllocateTURNServer_Request) Descriptor() ([]byte, []int) {\n\treturn file_steam_steammessages_remoteclient_service_messages_proto_rawDescGZIP(), []int{17}\n}", "title": "" }, { "docid": "5f4cbb7bc87f3f2c3ff04bdf9b1d912f", "score": "0.6002435", "text": "func (*GetLiveAdTagDetailRequest) Descriptor() ([]byte, []int) {\n\treturn file_google_cloud_video_stitcher_v1_video_stitcher_service_proto_rawDescGZIP(), []int{16}\n}", "title": "" }, { "docid": "79caa9b224a02dce4d49baf2aa854b32", "score": "0.5962643", "text": "func (*GetLiveMatchRequest) Descriptor() ([]byte, []int) {\n\treturn file_live_proto_rawDescGZIP(), []int{0}\n}", "title": "" }, { "docid": "df01adf2a33101fe517ca47666a65c80", "score": "0.5945017", "text": "func (*SessionInfo) Descriptor() ([]byte, []int) {\n\treturn file_google_cloud_dialogflow_cx_v3beta1_webhook_proto_rawDescGZIP(), []int{10}\n}", "title": "" }, { "docid": "f80fd7681c786e17ee94a3d24f76e21d", "score": "0.5942589", "text": "func (*NewsVideoCreateRequest) Descriptor() ([]byte, []int) {\n\treturn file_contents_v1_news_video_proto_rawDescGZIP(), []int{8}\n}", "title": "" }, { "docid": "743ff53fad5592dbbf0ab3b64fb684ba", "score": "0.59401983", "text": "func (*CreatePlaybackRequest) Descriptor() ([]byte, []int) {\n\treturn file_api_proto_rawDescGZIP(), []int{10}\n}", "title": "" }, { "docid": "8654ae750abc2bf50c7ea14c8d4113f0", "score": "0.59121424", "text": "func (*CMsgTest_MessageToServer_Request) Descriptor() ([]byte, []int) {\n\treturn file_steammessages_unified_test_steamclient_proto_rawDescGZIP(), []int{3}\n}", "title": "" }, { "docid": "5768f2ee57d896e737612be354f0471d", "score": "0.5902904", "text": "func (*GetSessionRequest) Descriptor() ([]byte, []int) {\n\treturn file_google_showcase_v1beta1_testing_proto_rawDescGZIP(), []int{2}\n}", "title": "" }, { "docid": "18664cfee5189b09d20771c734c5695e", "score": "0.5901322", "text": "func (*NewsVideoUpdateRequest) Descriptor() ([]byte, []int) {\n\treturn file_contents_v1_news_video_proto_rawDescGZIP(), []int{10}\n}", "title": "" }, { "docid": "56dfb23b298692164ada13065cf3acde", "score": "0.58993924", "text": "func (*CMsgDOTAFantasyTeamCreateRequest) Descriptor() ([]byte, []int) {\n\treturn file_dota2_dota_gcmessages_client_fantasy_proto_rawDescGZIP(), []int{32}\n}", "title": "" }, { "docid": "53a3676ca366110b1cdd64c69955b227", "score": "0.589135", "text": "func (*CreateVideoRequest) Descriptor() ([]byte, []int) {\n\treturn file_api_proto_rawDescGZIP(), []int{4}\n}", "title": "" }, { "docid": "68363d48e82df8ec96b896d99aef12c1", "score": "0.5871683", "text": "func (*StreamingRequest) Descriptor() ([]byte, []int) {\n\treturn file_proto_notification_notification_proto_rawDescGZIP(), []int{3}\n}", "title": "" }, { "docid": "4c160d227539e44f54477dfb3038cec6", "score": "0.58517873", "text": "func (*AdminServiceCreatePlayerRequest) Descriptor() ([]byte, []int) {\n\treturn file_api_v1_admin_proto_rawDescGZIP(), []int{0}\n}", "title": "" }, { "docid": "d682fb7adc00d522d24416c39f14da37", "score": "0.5836884", "text": "func (*ListLiveAdTagDetailsRequest) Descriptor() ([]byte, []int) {\n\treturn file_google_cloud_video_stitcher_v1_video_stitcher_service_proto_rawDescGZIP(), []int{14}\n}", "title": "" }, { "docid": "069dc081372d48d9af1fae104cae2c23", "score": "0.58125395", "text": "func (*CreateRequest) Descriptor() ([]byte, []int) {\n\treturn file_service_language_proto_skill_skill_service_proto_rawDescGZIP(), []int{6}\n}", "title": "" }, { "docid": "5e3fbe65e919b26585466cfdab61114f", "score": "0.5793615", "text": "func (*AbortSessionRequest) Descriptor() ([]byte, []int) {\n\treturn file_lte_protos_abort_session_proto_rawDescGZIP(), []int{0}\n}", "title": "" }, { "docid": "849f043afe82e07ace5983e110c7a750", "score": "0.57879037", "text": "func (*MDLSessionRequest) Descriptor() ([]byte, []int) {\n\treturn file_process_userdata_walletnode_proto_rawDescGZIP(), []int{0}\n}", "title": "" }, { "docid": "993024665112efad7f1ae8d8b79bab0e", "score": "0.57868356", "text": "func (*CMsgDOTAMyTeamInfoRequest) Descriptor() ([]byte, []int) {\n\treturn file_dota_gcmessages_client_team_proto_rawDescGZIP(), []int{3}\n}", "title": "" }, { "docid": "30958d96d7adc63dec00c427d833a5a8", "score": "0.577818", "text": "func (*CreateRequest) Descriptor() ([]byte, []int) {\n\treturn file_service_board_proto_board_board_service_proto_rawDescGZIP(), []int{6}\n}", "title": "" }, { "docid": "4b3db30f6a6c3cd2639c232bc13beeb0", "score": "0.5753344", "text": "func (*EnableFaceDetectionRequest) Descriptor() ([]byte, []int) {\n\treturn file_messages_proto_rawDescGZIP(), []int{129}\n}", "title": "" }, { "docid": "017efdd9114277e946e1721aa570ea43", "score": "0.57498753", "text": "func (*ReportSessionRequest) Descriptor() ([]byte, []int) {\n\treturn file_google_showcase_v1beta1_testing_proto_rawDescGZIP(), []int{6}\n}", "title": "" }, { "docid": "0411fbbbbea5428e7cd5dedcb353181c", "score": "0.57398313", "text": "func (*CreateRequest) Descriptor() ([]byte, []int) {\n\treturn file_mkit_service_account_profile_v1_profile_service_proto_rawDescGZIP(), []int{4}\n}", "title": "" }, { "docid": "0fb09274e67876f1ff14ff6bf45e8311", "score": "0.57385236", "text": "func (*CRemoteClient_SetPairingInfo_Request) Descriptor() ([]byte, []int) {\n\treturn file_steam_steammessages_remoteclient_service_messages_proto_rawDescGZIP(), []int{4}\n}", "title": "" }, { "docid": "94f14823004cfbada520ab5b6469d03b", "score": "0.5735769", "text": "func (*BotEventsRequest) Descriptor() ([]byte, []int) {\n\treturn file_go_chromium_org_luci_swarming_proto_api_swarming_proto_rawDescGZIP(), []int{0}\n}", "title": "" }, { "docid": "69e34d8004cfd68671bbd6be3df80e8c", "score": "0.57299626", "text": "func (*CMsgTest_MessageToClient_Request) Descriptor() ([]byte, []int) {\n\treturn file_steammessages_unified_test_steamclient_proto_rawDescGZIP(), []int{0}\n}", "title": "" }, { "docid": "8ae9163a693ef5e12ffb35be1caa4deb", "score": "0.5729667", "text": "func (x *fastReflection_MsgRequest) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value {\n\tswitch fd.FullName() {\n\tcase \"testpb.MsgRequest.timestamp\":\n\t\tif x.Timestamp == nil {\n\t\t\tx.Timestamp = new(timestamppb.Timestamp)\n\t\t}\n\t\treturn protoreflect.ValueOfMessage(x.Timestamp.ProtoReflect())\n\tcase \"testpb.MsgRequest.duration\":\n\t\tif x.Duration == nil {\n\t\t\tx.Duration = new(durationpb.Duration)\n\t\t}\n\t\treturn protoreflect.ValueOfMessage(x.Duration.ProtoReflect())\n\tcase \"testpb.MsgRequest.a_message\":\n\t\tif x.AMessage == nil {\n\t\t\tx.AMessage = new(AMessage)\n\t\t}\n\t\treturn protoreflect.ValueOfMessage(x.AMessage.ProtoReflect())\n\tcase \"testpb.MsgRequest.a_coin\":\n\t\tif x.ACoin == nil {\n\t\t\tx.ACoin = new(v1beta1.Coin)\n\t\t}\n\t\treturn protoreflect.ValueOfMessage(x.ACoin.ProtoReflect())\n\tcase \"testpb.MsgRequest.page\":\n\t\tif x.Page == nil {\n\t\t\tx.Page = new(v1beta11.PageRequest)\n\t\t}\n\t\treturn protoreflect.ValueOfMessage(x.Page.ProtoReflect())\n\tcase \"testpb.MsgRequest.bools\":\n\t\tif x.Bools == nil {\n\t\t\tx.Bools = []bool{}\n\t\t}\n\t\tvalue := &_MsgRequest_21_list{list: &x.Bools}\n\t\treturn protoreflect.ValueOfList(value)\n\tcase \"testpb.MsgRequest.uints\":\n\t\tif x.Uints == nil {\n\t\t\tx.Uints = []uint32{}\n\t\t}\n\t\tvalue := &_MsgRequest_22_list{list: &x.Uints}\n\t\treturn protoreflect.ValueOfList(value)\n\tcase \"testpb.MsgRequest.strings\":\n\t\tif x.Strings == nil {\n\t\t\tx.Strings = []string{}\n\t\t}\n\t\tvalue := &_MsgRequest_23_list{list: &x.Strings}\n\t\treturn protoreflect.ValueOfList(value)\n\tcase \"testpb.MsgRequest.enums\":\n\t\tif x.Enums == nil {\n\t\t\tx.Enums = []Enum{}\n\t\t}\n\t\tvalue := &_MsgRequest_24_list{list: &x.Enums}\n\t\treturn protoreflect.ValueOfList(value)\n\tcase \"testpb.MsgRequest.durations\":\n\t\tif x.Durations == nil {\n\t\t\tx.Durations = []*durationpb.Duration{}\n\t\t}\n\t\tvalue := &_MsgRequest_25_list{list: &x.Durations}\n\t\treturn protoreflect.ValueOfList(value)\n\tcase \"testpb.MsgRequest.some_messages\":\n\t\tif x.SomeMessages == nil {\n\t\t\tx.SomeMessages = []*AMessage{}\n\t\t}\n\t\tvalue := &_MsgRequest_26_list{list: &x.SomeMessages}\n\t\treturn protoreflect.ValueOfList(value)\n\tcase \"testpb.MsgRequest.positional3_varargs\":\n\t\tif x.Positional3Varargs == nil {\n\t\t\tx.Positional3Varargs = []*v1beta1.Coin{}\n\t\t}\n\t\tvalue := &_MsgRequest_29_list{list: &x.Positional3Varargs}\n\t\treturn protoreflect.ValueOfList(value)\n\tcase \"testpb.MsgRequest.u32\":\n\t\tpanic(fmt.Errorf(\"field u32 of message testpb.MsgRequest is not mutable\"))\n\tcase \"testpb.MsgRequest.u64\":\n\t\tpanic(fmt.Errorf(\"field u64 of message testpb.MsgRequest is not mutable\"))\n\tcase \"testpb.MsgRequest.str\":\n\t\tpanic(fmt.Errorf(\"field str of message testpb.MsgRequest is not mutable\"))\n\tcase \"testpb.MsgRequest.bz\":\n\t\tpanic(fmt.Errorf(\"field bz of message testpb.MsgRequest is not mutable\"))\n\tcase \"testpb.MsgRequest.i32\":\n\t\tpanic(fmt.Errorf(\"field i32 of message testpb.MsgRequest is not mutable\"))\n\tcase \"testpb.MsgRequest.i64\":\n\t\tpanic(fmt.Errorf(\"field i64 of message testpb.MsgRequest is not mutable\"))\n\tcase \"testpb.MsgRequest.a_bool\":\n\t\tpanic(fmt.Errorf(\"field a_bool of message testpb.MsgRequest is not mutable\"))\n\tcase \"testpb.MsgRequest.an_enum\":\n\t\tpanic(fmt.Errorf(\"field an_enum of message testpb.MsgRequest is not mutable\"))\n\tcase \"testpb.MsgRequest.an_address\":\n\t\tpanic(fmt.Errorf(\"field an_address of message testpb.MsgRequest is not mutable\"))\n\tcase \"testpb.MsgRequest.positional1\":\n\t\tpanic(fmt.Errorf(\"field positional1 of message testpb.MsgRequest is not mutable\"))\n\tcase \"testpb.MsgRequest.positional2\":\n\t\tpanic(fmt.Errorf(\"field positional2 of message testpb.MsgRequest is not mutable\"))\n\tcase \"testpb.MsgRequest.deprecated_field\":\n\t\tpanic(fmt.Errorf(\"field deprecated_field of message testpb.MsgRequest is not mutable\"))\n\tcase \"testpb.MsgRequest.shorthand_deprecated_field\":\n\t\tpanic(fmt.Errorf(\"field shorthand_deprecated_field of message testpb.MsgRequest is not mutable\"))\n\tcase \"testpb.MsgRequest.hidden_bool\":\n\t\tpanic(fmt.Errorf(\"field hidden_bool of message testpb.MsgRequest is not mutable\"))\n\tcase \"testpb.MsgRequest.a_validator_address\":\n\t\tpanic(fmt.Errorf(\"field a_validator_address of message testpb.MsgRequest is not mutable\"))\n\tdefault:\n\t\tif fd.IsExtension() {\n\t\t\tpanic(fmt.Errorf(\"proto3 declared messages do not support extensions: testpb.MsgRequest\"))\n\t\t}\n\t\tpanic(fmt.Errorf(\"message testpb.MsgRequest does not contain field %s\", fd.FullName()))\n\t}\n}", "title": "" }, { "docid": "9d5a71aff3c97143432bc5c9167a603f", "score": "0.57283473", "text": "func (*GetVideoRequest) Descriptor() ([]byte, []int) {\n\treturn file_api_proto_rawDescGZIP(), []int{6}\n}", "title": "" }, { "docid": "90ee74aa74880d852417be107af2456a", "score": "0.5726168", "text": "func (*ListSessionsRequest) Descriptor() ([]byte, []int) {\n\treturn file_google_showcase_v1beta1_testing_proto_rawDescGZIP(), []int{3}\n}", "title": "" }, { "docid": "49a05d59b3e6440ec3783fcc770839df", "score": "0.57234174", "text": "func (*GeneratePlaybackRequest) Descriptor() ([]byte, []int) {\n\treturn file_api_proto_rawDescGZIP(), []int{0}\n}", "title": "" }, { "docid": "5bf465da4b2b809b21e2e6931d2e3274", "score": "0.57053316", "text": "func (*DebugInstanceRequest) Descriptor() ([]byte, []int) {\n\treturn file_google_appengine_v1_appengine_proto_rawDescGZIP(), []int{17}\n}", "title": "" }, { "docid": "b7a6c34c1f0ffd2f8be7b4dc5ee83037", "score": "0.5704875", "text": "func (*CreateGameRequest) Descriptor() ([]byte, []int) {\n\treturn file_proto_tronimoes_proto_rawDescGZIP(), []int{2}\n}", "title": "" }, { "docid": "3316339c61c3ff22b4a378478a728645", "score": "0.56875116", "text": "func (*UpdateTokenReq) Descriptor() ([]byte, []int) {\n\treturn file_interservice_authn_tokens_proto_rawDescGZIP(), []int{2}\n}", "title": "" }, { "docid": "aab0fa5cf9eae36a4c8cf731948d5f4e", "score": "0.5685453", "text": "func (*CreateStoredInfoTypeRequest) Descriptor() ([]byte, []int) {\n\treturn file_google_privacy_dlp_v2_dlp_proto_rawDescGZIP(), []int{128}\n}", "title": "" }, { "docid": "50b3630e0fba4d1e275e1d17c18842ba", "score": "0.5685432", "text": "func (*ValidateTokenRequest) Descriptor() ([]byte, []int) {\n\treturn file_spike_service_spike_proto_rawDescGZIP(), []int{3}\n}", "title": "" }, { "docid": "c976bf8d1d0031c9fcfcacf2db695450", "score": "0.5681318", "text": "func (*DeleteTokenRequest) Descriptor() ([]byte, []int) {\n\treturn file_apps_token_pb_request_proto_rawDescGZIP(), []int{7}\n}", "title": "" }, { "docid": "7d9c548b84de87f93144b7a84b7e209f", "score": "0.5681067", "text": "func (*CreateRequest) Descriptor() ([]byte, []int) {\n\treturn file_dashboard_api_proto_rawDescGZIP(), []int{6}\n}", "title": "" }, { "docid": "476baa50be6607e0f6af5c4326709117", "score": "0.567747", "text": "func (*CreateClientTlsPolicyRequest) Descriptor() ([]byte, []int) {\n\treturn file_google_cloud_networksecurity_v1beta1_client_tls_policy_proto_rawDescGZIP(), []int{4}\n}", "title": "" }, { "docid": "ea286b081d77178d51c03821cf255440", "score": "0.5673009", "text": "func (*CRemoteClient_StartPairing_Request) Descriptor() ([]byte, []int) {\n\treturn file_steam_steammessages_remoteclient_service_messages_proto_rawDescGZIP(), []int{2}\n}", "title": "" }, { "docid": "40af970047c0bf6f9545c2606f89c5d6", "score": "0.56727725", "text": "func (*CreateSpokeRequest) Descriptor() ([]byte, []int) {\n\treturn file_google_cloud_networkconnectivity_v1_hub_proto_rawDescGZIP(), []int{12}\n}", "title": "" }, { "docid": "0d49265036524d95367a1838adbbb381", "score": "0.5670341", "text": "func (*DisconnectRequest) Descriptor() ([]byte, []int) {\n\treturn file_ue_sim_proto_rawDescGZIP(), []int{3}\n}", "title": "" }, { "docid": "847e8682876952ea9aae37f6fd2db59e", "score": "0.566869", "text": "func (*ChangeNamespaceRequest) Descriptor() ([]byte, []int) {\n\treturn file_apps_token_pb_request_proto_rawDescGZIP(), []int{6}\n}", "title": "" }, { "docid": "7028a54c42bb7a60ed4f3585d23ed544", "score": "0.56674165", "text": "func (*VodGetPrivateDrmPlayAuthRequest) Descriptor() ([]byte, []int) {\n\treturn file_vod_request_request_vod_proto_rawDescGZIP(), []int{2}\n}", "title": "" }, { "docid": "57022b9b2b9a743f28370f85bfecf2a9", "score": "0.5666714", "text": "func (*CreateBotPlayersRequest) Descriptor() ([]byte, []int) {\n\treturn file_tmdatabase_tmdatabase_rr_proto_rawDescGZIP(), []int{6}\n}", "title": "" }, { "docid": "8225362a9f1212d0276acdcaa5571b14", "score": "0.56651986", "text": "func (*CRemoteClient_CancelPairing_Request) Descriptor() ([]byte, []int) {\n\treturn file_steam_steammessages_remoteclient_service_messages_proto_rawDescGZIP(), []int{8}\n}", "title": "" }, { "docid": "59d74f41b5ddfc6d931ca1686a24e5be", "score": "0.5649923", "text": "func (*CRemoteClient_CreateSession_Response) Descriptor() ([]byte, []int) {\n\treturn file_steam_steammessages_remoteclient_service_messages_proto_rawDescGZIP(), []int{1}\n}", "title": "" }, { "docid": "d5a347423b68e47e9d67d86b0b0e8785", "score": "0.5649359", "text": "func (*DisconnectPeerRequest) Descriptor() ([]byte, []int) {\n\treturn file_net_rpc_rpc_proto_rawDescGZIP(), []int{11}\n}", "title": "" }, { "docid": "fa0360eca4c571523178c105b499c23e", "score": "0.56464744", "text": "func (*VodGetOriginalPlayInfoRequest) Descriptor() ([]byte, []int) {\n\treturn file_vod_request_request_vod_proto_rawDescGZIP(), []int{1}\n}", "title": "" }, { "docid": "e4a1dde29acc9a4a05104f88596c10c0", "score": "0.5643028", "text": "func (*RefreshTokenRequest) Descriptor() ([]byte, []int) {\n\treturn file_api_sso_v1_sso_proto_rawDescGZIP(), []int{2}\n}", "title": "" }, { "docid": "e782cf575ed2a2f4d12856e36d340c0a", "score": "0.564227", "text": "func (*CreateWebhookRequest) Descriptor() ([]byte, []int) {\n\treturn file_google_cloud_dialogflow_cx_v3beta1_webhook_proto_rawDescGZIP(), []int{4}\n}", "title": "" }, { "docid": "4926c973a5c17c51a286210bc5639652", "score": "0.5638069", "text": "func (*UpdateStoredInfoTypeRequest) Descriptor() ([]byte, []int) {\n\treturn file_google_privacy_dlp_v2_dlp_proto_rawDescGZIP(), []int{129}\n}", "title": "" }, { "docid": "1d1d80e371efbabd3558ea4a5c59cd2e", "score": "0.5637398", "text": "func (*ListenerUpdateRequest) Descriptor() ([]byte, []int) {\n\treturn file_api_proto_rawDescGZIP(), []int{8}\n}", "title": "" }, { "docid": "c54bc16d36ccd7f2007ae9318f74c551", "score": "0.5632849", "text": "func (*RunningRequest) Descriptor() ([]byte, []int) {\n\treturn file_proto_sample_service_proto_rawDescGZIP(), []int{1}\n}", "title": "" }, { "docid": "643af1bf6d3a1131390d84d9dc346a6b", "score": "0.56314945", "text": "func (*UploadVideoRequest) Descriptor() ([]byte, []int) {\n\treturn file_logic_proto_api_proto_rawDescGZIP(), []int{18}\n}", "title": "" }, { "docid": "289c3fb0188cbe5d023c535f680a2798", "score": "0.5628384", "text": "func (*RefreshTokenReq) Descriptor() ([]byte, []int) {\n\treturn file_proto_mothership_proto_rawDescGZIP(), []int{4}\n}", "title": "" }, { "docid": "1fcd8283ac831de94cc668a49825006b", "score": "0.5621192", "text": "func (*TurnInPlaceRequest) Descriptor() ([]byte, []int) {\n\treturn file_messages_proto_rawDescGZIP(), []int{85}\n}", "title": "" }, { "docid": "cc38041c9b6348140d3c7781349193db", "score": "0.5616409", "text": "func (*RefreshTokenReq) Descriptor() ([]byte, []int) {\n\treturn file_users_users_proto_rawDescGZIP(), []int{4}\n}", "title": "" }, { "docid": "20717b1eee5a5f7c180590a768292579", "score": "0.56139654", "text": "func (*NewsVideoDeleteRequest) Descriptor() ([]byte, []int) {\n\treturn file_contents_v1_news_video_proto_rawDescGZIP(), []int{12}\n}", "title": "" }, { "docid": "585af5ca1f0256469359ca64db3e9991", "score": "0.56126744", "text": "func (*EnableMotionDetectionRequest) Descriptor() ([]byte, []int) {\n\treturn file_messages_proto_rawDescGZIP(), []int{131}\n}", "title": "" }, { "docid": "fa5faa662a924473ba09d31f1c03eacf", "score": "0.5608834", "text": "func (*CreateGameRequest) Descriptor() ([]byte, []int) {\n\treturn file_tmdatabase_tmdatabase_rr_proto_rawDescGZIP(), []int{10}\n}", "title": "" }, { "docid": "1f44217b9527e044b6f4000be9f08095", "score": "0.5608194", "text": "func (*WalletTokenUpdatedRequest) Descriptor() ([]byte, []int) {\n\treturn file_block_proto_rawDescGZIP(), []int{3}\n}", "title": "" }, { "docid": "f5ddd01ca2d49abd7806aee0100e5ecd", "score": "0.56075364", "text": "func (*StopContainer_Request) Descriptor() ([]byte, []int) {\n\treturn file_proto_container_server_Manage_proto_rawDescGZIP(), []int{12}\n}", "title": "" }, { "docid": "25cf318cff01b88dd8cf2ec30616747b", "score": "0.5606762", "text": "func (*CRemoteClient_AllocateRelayServer_Request) Descriptor() ([]byte, []int) {\n\treturn file_steam_steammessages_remoteclient_service_messages_proto_rawDescGZIP(), []int{19}\n}", "title": "" }, { "docid": "318901fabfc9cacdcf347f2cbaeeee11", "score": "0.56002873", "text": "func (*VersionRequest) Descriptor() ([]byte, []int) {\n\treturn file_automate_gateway_api_notifications_notifications_proto_rawDescGZIP(), []int{13}\n}", "title": "" }, { "docid": "5fff4a4fd76fe5cc600b3843b0eca04e", "score": "0.5596866", "text": "func (*Executor_Remote_RemoteSchemaRequest) Descriptor() ([]byte, []int) {\n\treturn file_github_com_solo_io_gloo_projects_gloo_api_external_envoy_extensions_graphql_graphql_proto_rawDescGZIP(), []int{23, 1, 1}\n}", "title": "" }, { "docid": "8aea285a568a4bbcfa20d28286831f64", "score": "0.5595627", "text": "func (*CreateUpdateRequest) Descriptor() ([]byte, []int) {\n\treturn file_service_todo_proto_todo_proto_rawDescGZIP(), []int{2}\n}", "title": "" }, { "docid": "f225526b2265b5d8df35f55397c1ab93", "score": "0.55952984", "text": "func (*CTwoFactor_ValidateToken_Request) Descriptor() ([]byte, []int) {\n\treturn file_steam_client_steammessages_twofactor_steamclient_proto_rawDescGZIP(), []int{14}\n}", "title": "" }, { "docid": "cda6200ed212f2fbaa0d7375fc87b4c7", "score": "0.5593251", "text": "func (*CTwoFactor_RemoveAuthenticator_Request) Descriptor() ([]byte, []int) {\n\treturn file_steam_client_steammessages_twofactor_steamclient_proto_rawDescGZIP(), []int{8}\n}", "title": "" }, { "docid": "abb093bf7d259cb9e48bd581ec2deefd", "score": "0.5589398", "text": "func (*CRemoteClient_AllocateSDR_Request) Descriptor() ([]byte, []int) {\n\treturn file_steam_steammessages_remoteclient_service_messages_proto_rawDescGZIP(), []int{21}\n}", "title": "" }, { "docid": "3dc5812a38d7479a08e09022b9196553", "score": "0.55892617", "text": "func (*CMsgDOTAEditFantasyTeamRequest) Descriptor() ([]byte, []int) {\n\treturn file_dota2_dota_gcmessages_client_fantasy_proto_rawDescGZIP(), []int{16}\n}", "title": "" }, { "docid": "c5579a47b00bc1cafcb35abebfb04166", "score": "0.55892015", "text": "func (*TargetOnlineRequest) Descriptor() ([]byte, []int) {\n\treturn file_legacy_upstream_lb_proto_rawDescGZIP(), []int{1}\n}", "title": "" }, { "docid": "d3d63f07c911953a7aafa9220385cb04", "score": "0.5587822", "text": "func (*CreateTokenReq) Descriptor() ([]byte, []int) {\n\treturn file_interservice_authn_tokens_proto_rawDescGZIP(), []int{0}\n}", "title": "" }, { "docid": "eb18dec72d6fdfa6cae22aca5b691cc7", "score": "0.5585641", "text": "func (s SessionContext_fulfillRequest_Params) NewDescriptor() (powerbox.PowerboxDescriptor, error) {\n\tss, err := powerbox.NewPowerboxDescriptor(s.Struct.Segment())\n\tif err != nil {\n\t\treturn powerbox.PowerboxDescriptor{}, err\n\t}\n\terr = s.Struct.SetPtr(2, ss.Struct.ToPtr())\n\treturn ss, err\n}", "title": "" }, { "docid": "26bfcfe852f833bc2569e865fb9d4e19", "score": "0.55808324", "text": "func (*RetrieveTokenRequest) Descriptor() ([]byte, []int) {\n\treturn file_logic_proto_api_proto_rawDescGZIP(), []int{8}\n}", "title": "" }, { "docid": "624a593b964fdbb8c408434bfe9b16b5", "score": "0.5578407", "text": "func (*LoginRequest) Descriptor() ([]byte, []int) {\n\treturn file_protos_chat_proto_rawDescGZIP(), []int{0}\n}", "title": "" }, { "docid": "f9530be07cdb763611546b41322795f7", "score": "0.5576928", "text": "func (*DeleteRequest) Descriptor() ([]byte, []int) {\n\treturn file_service_language_proto_skill_skill_service_proto_rawDescGZIP(), []int{10}\n}", "title": "" }, { "docid": "5849de102c68366a581dc4c8dc6681db", "score": "0.5576397", "text": "func (*Session) Descriptor() ([]byte, []int) {\n\treturn file_proto_tunnel_tunnel_proto_rawDescGZIP(), []int{1}\n}", "title": "" }, { "docid": "e3522c6f6986e26abba67ee059eb2efb", "score": "0.55757594", "text": "func (*CMsgClientToGCRequestSteamDatagramTicket) Descriptor() ([]byte, []int) {\n\treturn file_dota_gcmessages_client_match_management_proto_rawDescGZIP(), []int{50}\n}", "title": "" }, { "docid": "07ddb1e6d97cbc459649ec0c272c8528", "score": "0.5571021", "text": "func (*GetSpikeTokenRequest) Descriptor() ([]byte, []int) {\n\treturn file_spike_service_spike_proto_rawDescGZIP(), []int{1}\n}", "title": "" }, { "docid": "9716d8cba334815c18febf513dc2f367", "score": "0.5569195", "text": "func (*ChangePasswordRequest) Descriptor() ([]byte, []int) {\n\treturn file_internal_grpc_proto_service_proto_rawDescGZIP(), []int{3}\n}", "title": "" }, { "docid": "853d30e10b747069e9a8a71b9dde17d0", "score": "0.5566289", "text": "func (*RevolkTokenRequest) Descriptor() ([]byte, []int) {\n\treturn file_apps_token_pb_request_proto_rawDescGZIP(), []int{3}\n}", "title": "" }, { "docid": "edca44665d497cce89964d56ce23bc15", "score": "0.55651665", "text": "func (*CreateRuleRequest) Descriptor() ([]byte, []int) {\n\treturn file_go_chromium_org_luci_analysis_proto_v1_rules_proto_rawDescGZIP(), []int{4}\n}", "title": "" }, { "docid": "ed1632ec428b29d7cb4e1e9cb0cf0e59", "score": "0.55625105", "text": "func (*GetServiceRequest) Descriptor() ([]byte, []int) {\n\treturn file_google_appengine_v1_appengine_proto_rawDescGZIP(), []int{4}\n}", "title": "" }, { "docid": "60e09b08f272f84e6cd2bdb46b9cdc50", "score": "0.5561841", "text": "func (*RefreshTokenReq) Descriptor() ([]byte, []int) {\n\treturn file_api_sso_v1_sso_proto_rawDescGZIP(), []int{22}\n}", "title": "" }, { "docid": "365ea65eb814f23073bd759169ef7a07", "score": "0.5560846", "text": "func (*CRemoteClient_GetPairingInfo_Request) Descriptor() ([]byte, []int) {\n\treturn file_steam_steammessages_remoteclient_service_messages_proto_rawDescGZIP(), []int{6}\n}", "title": "" }, { "docid": "1009d7e0e1ecc317320fe5d8ab56b027", "score": "0.5560337", "text": "func (*DeleteStudioRequestRequest) Descriptor() ([]byte, []int) {\n\treturn file_buf_alpha_registry_v1alpha1_studio_request_proto_rawDescGZIP(), []int{4}\n}", "title": "" }, { "docid": "0654ded40a49244c810cb7bb01f412ab", "score": "0.5559329", "text": "func (*UpdateRequest) Descriptor() ([]byte, []int) {\n\treturn file_service_language_proto_skill_skill_service_proto_rawDescGZIP(), []int{8}\n}", "title": "" }, { "docid": "1f287b3aaa9cb7a4ce2776191cd1ae0f", "score": "0.5559147", "text": "func (*CreateTokenWithValueReq) Descriptor() ([]byte, []int) {\n\treturn file_interservice_authn_tokens_proto_rawDescGZIP(), []int{1}\n}", "title": "" }, { "docid": "e55f1b0621745f812517c40e03190356", "score": "0.5559131", "text": "func (*UpdateMessageRequest) Descriptor() ([]byte, []int) {\n\treturn file_protos_chatpb_chat_service_proto_rawDescGZIP(), []int{5}\n}", "title": "" }, { "docid": "49df8ba9046ba0f4ec64831a4f92dc4c", "score": "0.5558223", "text": "func (*CMsgGameMatchSignOutPermissionRequest) Descriptor() ([]byte, []int) {\n\treturn file_dota_gcmessages_server_proto_rawDescGZIP(), []int{22}\n}", "title": "" } ]
e68d4bb8a15cde19cb1d458f1587e8aa
Creates a new Redisbacked project store.
[ { "docid": "32506c2ec7a91d276eb2febac0b01cff", "score": "0.6957184", "text": "func NewRedisStore(client sky.Client, uri *url.URL) *RedisStore {\n return &RedisStore{\n client: client,\n uri: uri,\n projects: make(map[string]*Project),\n }\n}", "title": "" } ]
[ { "docid": "4c50f08632cadc936a46dfd119fa6636", "score": "0.63265985", "text": "func NewProjectStore(opt *dao.Options) (project.Store, error) {\n\tunprepared := map[string]string{\n\t\tCreateProject: `\n\t\t\tINSERT INTO projects (id, name, picture, latitude, longitude, enabled, owner_id, description, domain_id, create_at) \n\t\t\tVALUES (?,?,?,?,?,?,?,?,?,?);\n\t\t`,\n\t\tFindDomainPorjects: `\n\t\t\tSELECT id, name, picture, latitude, longitude, enabled, owner_id, description, domain_id, create_at, update_at \n\t\t\tFROM projects\n\t\t\tWHERE domain_id = ? \n\t\t\tORDER BY create_at \n\t\t\tDESC;\n\t\t`,\n\t\tFindUserProjects: `\n\t\t\tSELECT id, name, picture, latitude, longitude, enabled, owner_id, description, domain_id, create_at, update_at \n\t\t\tFROM projects p \n\t\t\tLEFT JOIN user_project_mappings m \n\t\t\tON p.id = m.project_id\n\t\t\tWHERE p.domain_id = ? \n\t\t\tAND m.user_id = ? \n\t\t\tORDER BY p.create_at \n\t\t\tDESC;\n\t\t`,\n\t\tFindProjectByID: `\n\t\t\tSELECT id, name, picture, latitude, longitude, enabled, owner_id, description, domain_id, create_at, update_at \n\t\t\tFROM projects\n\t\t\tWHERE id = ?;\n\t\t`,\n\t\tDeleteProjectByID: `\n\t\t\tDELETE FROM projects \n\t\t\tWHERE id = ?;\n\t\t`,\n\t\tDeleteProjectByName: `\n\t\t\tDELETE FROM projects \n\t\t\tWHERE name = ? \n\t\t\tAND domain_id = ?;\n\t\t`,\n\t\tCheckProjectExistByID: `\n\t\t\tSELECT id FROM projects \n\t\t\tWHERE id = ?;\n\t\t`,\n\t\tCheckProjectExistByName: `\n\t\t\tSELECT name \n\t\t\tFROM projects \n\t\t\tWHERE name = ? \n\t\t\tAND domain_id = ?;\n\t\t`,\n\t\tFindProjectUsers: `\n\t\t\tSELECT user_id \n\t\t\tFROM user_project_mappings\n\t\t\tWHERE project_id = ?;\n\t\t`,\n\t\tAddUsersToProject: `\n\t\t\tINSERT INTO user_project_mappings (user_id, project_id) \n\t\t\tVALUES (?,?);\n\t\t`,\n\t\tRemoveUsersFromProject: `\n\t\t\tDELETE FROM user_project_mappings \n\t\t\tWHERE user_id = ? \n\t\t\tAND project_id = ?;\n\t\t`,\n\t}\n\n\t// prepare all statements to verify syntax\n\tstmts, err := tools.PrepareStmts(opt.DB, unprepared)\n\tif err != nil {\n\t\treturn nil, exception.NewInternalServerError(\"prepare project store query statment error, %s\", err)\n\t}\n\n\ts := store{\n\t\tdb: opt.DB,\n\t\tstmts: stmts,\n\t}\n\n\treturn &s, nil\n}", "title": "" }, { "docid": "305694e826c3b9d3de286cb86b014af6", "score": "0.61021423", "text": "func newStore(db *bolt.DB) (*store, error) {\n\tif db == nil {\n\t\treturn nil, errors.New(\"new exchange store failed, db is nil\")\n\t}\n\n\tif err := db.Update(func(tx *bolt.Tx) error {\n\t\t// create exchange meta bucket if not exist\n\t\tif _, err := tx.CreateBucketIfNotExists(exchangeMetaBkt); err != nil {\n\t\t\treturn createBucketFailedErr(exchangeMetaBkt, err)\n\t\t}\n\n\t\t// create deposit status bucket if not exist\n\t\tif _, err := tx.CreateBucketIfNotExists(depositInfoBkt); err != nil {\n\t\t\treturn createBucketFailedErr(depositInfoBkt, err)\n\t\t}\n\n\t\t// create bind address bucket if not exist\n\t\tif _, err := tx.CreateBucketIfNotExists(bindAddressBkt); err != nil {\n\t\t\treturn createBucketFailedErr(bindAddressBkt, err)\n\t\t}\n\n\t\tif _, err := tx.CreateBucketIfNotExists(skyDepositSeqsIndexBkt); err != nil {\n\t\t\treturn createBucketFailedErr(skyDepositSeqsIndexBkt, err)\n\t\t}\n\n\t\treturn nil\n\t}); err != nil {\n\t\treturn nil, err\n\t}\n\n\t// load cache from db\n\tcache, err := loadCache(db)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn &store{\n\t\tdb: db,\n\t\tcache: cache,\n\t}, nil\n}", "title": "" }, { "docid": "9c65ed7fecccfe5094d1abdd7bd43a22", "score": "0.60323095", "text": "func New(path, name string, metaCache kv.Store) (kv.Store, error) {\n\t// mkdir\n\t_, err := os.Stat(path)\n\tif err != nil {\n\t\terr = os.MkdirAll(path, os.ModePerm)\n\t}\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\t// open the database\n\tfile := filepath.Join(path, name)\n\tdb, err := getDB(file)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\ts := &store{\n\t\tpath: path,\n\t\tname: name,\n\t\tmeta: &meta{},\n\t}\n\ts.io.db = db\n\treturn s, nil\n}", "title": "" }, { "docid": "27db9c393f754f6313f9cf1d5d83064f", "score": "0.5930477", "text": "func New(pool *redis.Pool, prefix string) *RedisStore {\n\treturn &RedisStore{\n\t\tpool: pool,\n\t\tprefix: prefix,\n\t}\n}", "title": "" }, { "docid": "fd5010912c889de7e6b1deae3134ea02", "score": "0.5887524", "text": "func NewStore(options Options) (kvstore.KvStore, error) {\n result := &Store{}\n\n // Set default values\n if options.BucketName == \"\" {\n options.BucketName = DefaultOptions.BucketName\n }\n if options.Path == \"\" {\n options.Path = DefaultOptions.Path\n }\n\n // Open DB\n db, err := bolt.Open(options.Path, 0600, nil)\n if err != nil {\n return result, err\n }\n\n // Create a bucket if it doesn't exist yet.\n // In bbolt key/value pairs are stored to and read from buckets.\n err = db.Update(func(tx *bolt.Tx) error {\n _, err := tx.CreateBucketIfNotExists([]byte(options.BucketName))\n if err != nil {\n return err\n }\n return nil\n })\n if err != nil {\n return result, err\n }\n\n result.db = db\n result.bucketName = options.BucketName\n return result, nil\n}", "title": "" }, { "docid": "292525bc77b1cff8f595eec7e36771f4", "score": "0.58668584", "text": "func NewStore(path string) (Store, error) {\n\tm := make(map[string]*Playlist)\n\ts, err := index.NewPersistStore(path, &m)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn &store{\n\t\tm: m,\n\t\tstore: s,\n\t}, nil\n}", "title": "" }, { "docid": "964078b1e468d31cd04d23468c381f85", "score": "0.5865887", "text": "func create(driver, config string) store.Store {\n\tdb, migrations := Open(driver, config)\n\treturn From(db, migrations, driver)\n}", "title": "" }, { "docid": "60ba90b1769284d10553c8858ecba51e", "score": "0.5861827", "text": "func New(o *Options) (*Store, error) {\n\tif o.Addr == \"\" {\n\t\treturn nil, fmt.Errorf(\"kv/redis: connection address is required\")\n\t}\n\n\tdb := redis.NewClient(\n\t\t&redis.Options{\n\t\t\tAddr: o.Addr,\n\t\t\tPassword: o.Password,\n\t\t\tDB: o.DB,\n\t\t\tTLSConfig: o.TLSConfig,\n\t\t})\n\n\tif _, err := db.Ping().Result(); err != nil {\n\t\treturn nil, fmt.Errorf(\"kv/redis: error connecting to redis: %w\", err)\n\t}\n\n\tmetrics.AddRedisMetrics(db.PoolStats)\n\treturn &Store{db: db}, nil\n}", "title": "" }, { "docid": "bcb1b59c5cd4807d4bc941ff2d4782f1", "score": "0.5852333", "text": "func (client *Client) StoreCreate(draft *StoreDraft) (result *Store, err error) {\n\terr = client.Create(StoreURLPath, nil, draft, &result)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn result, nil\n}", "title": "" }, { "docid": "c698131713128ac8a3975945bb0ab45d", "score": "0.57957107", "text": "func New(client ResourcesClient) *StackStore {\n\treturn &StackStore{\n\t\tclient: client,\n\t}\n}", "title": "" }, { "docid": "77ea04c3b171bcdef73ae74ecda5eca5", "score": "0.5743408", "text": "func newStore(c *Config, httpAddr, raftAddr string) *store {\n\ts := store{\n\t\tdata: &Data{\n\t\t\tIndex: 1,\n\t\t},\n\t\tclosing: make(chan struct{}),\n\t\tdataChanged: make(chan struct{}),\n\t\tpath: c.Dir,\n\t\tconfig: c,\n\t\thttpAddr: httpAddr,\n\t\traftAddr: raftAddr,\n\t}\n\tif c.LoggingEnabled {\n\t\ts.logger = log.New(os.Stderr, \"[metastore] \", log.LstdFlags)\n\t} else {\n\t\ts.logger = log.New(ioutil.Discard, \"\", 0)\n\t}\n\n\treturn &s\n}", "title": "" }, { "docid": "a6b877cfe81874b680f194469137e315", "score": "0.5740202", "text": "func CreateStore() *session.Store {\n\t// Load .env file with secrets\n\terr := godotenv.Load()\n\tif err != nil {\n\t\tlog.Fatal(\"Error loading .env file\")\n\t}\n\tDB_User := os.Getenv(\"DB_USER\")\n\tDB_Pass := os.Getenv(\"DB_PASSWORD\")\n\tDB_Name := os.Getenv(\"DB_NAME\")\n\n\t// Create storage\n\tstorage := postgres.New(postgres.Config{\n\t\tHost: \"localhost\",\n\t\tUsername: DB_User,\n\t\tPassword: DB_Pass,\n\t\tPort: 5432,\n\t\tDatabase: DB_Name,\n\t\tTable: \"session_storage\",\n\t})\n\n\tstore := session.New(session.Config{Storage: storage})\n\n\treturn store\n}", "title": "" }, { "docid": "0504c61ed342bc49f54cb9d142435805", "score": "0.56871897", "text": "func NewStore(config config.GeneralConfig, advisoryLock postgres.AdvisoryLocker, shutdownSignal gracefulpanic.Signal) (*Store, error) {\n\tif err := utils.EnsureDirAndMaxPerms(config.RootDir(), os.FileMode(0700)); err != nil {\n\t\treturn nil, errors.Wrap(err, \"error while creating project root dir\")\n\t}\n\n\torm, err := initializeORM(config, shutdownSignal)\n\tif err != nil {\n\t\treturn nil, errors.Wrap(err, \"failed to initialize ORM\")\n\t}\n\n\tstore := &Store{\n\t\tConfig: config,\n\t\tORM: orm,\n\t\tcloseOnce: &sync.Once{},\n\t}\n\treturn store, nil\n}", "title": "" }, { "docid": "10585d8d94ff3167b1751bf06383359b", "score": "0.56758374", "text": "func CreateCache() {\n\tredisClient = redis.NewClient(&redis.Options{\n\t\tAddr: getEnv(\"REDIS_HOST\", \"localhost\") + \":\" + getEnv(\"REDIS_PORT\", \"6379\"),\n\t\tPassword: \"\",\n\t\tDB: 0,\n\t})\n\tredisClient2 = redis.NewClient(&redis.Options{\n\t\tAddr: getEnv(\"REDIS_HOST\", \"localhost\") + \":\" + getEnv(\"REDIS_PORT\", \"6379\"),\n\t\tPassword: \"\",\n\t\tDB: 1,\n\t})\n\tredisClient3 = redis.NewClient(&redis.Options{\n\t\tAddr: getEnv(\"REDIS_HOST\", \"localhost\") + \":\" + getEnv(\"REDIS_PORT\", \"6379\"),\n\t\tPassword: \"\",\n\t\tDB: 2,\n\t})\n}", "title": "" }, { "docid": "92d55c88b6fd25abca09d1cf38d9315a", "score": "0.5642339", "text": "func NewStore(\n\ttopo *topology.Loader,\n\toperator *coliquic.ServiceClientOperator,\n\ttcpDialer libgrpc.Dialer,\n\tdb backend.DB,\n\tadmitter admission.Admitter,\n\tmasterKey []byte) (\n\t*Store, error) {\n\n\t// check that the admitter is well configured\n\tcap := admitter.Capacities()\n\tfor _, ifid := range append(topo.InterfaceIDs(), 0) {\n\t\tlog.Info(\"colibri admission capacity\", \"ifid\", ifid,\n\t\t\t\"ingress\", cap.CapacityIngress(uint16(ifid)),\n\t\t\t\"egress\", cap.CapacityEgress(uint16(ifid)))\n\t}\n\tcolibriKeyBytes := scrypto.DeriveColibriMacKey(masterKey)\n\tcolibriKey, err := libcolibri.InitColibriKey(colibriKeyBytes)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn &Store{\n\t\tlocalIA: topo.IA(),\n\t\tisCore: topo.Core(),\n\t\tdb: db,\n\t\tadmitter: admitter,\n\t\toperator: operator,\n\t\tauthenticator: NewDRKeyAuthenticator(topo.IA(), tcpDialer),\n\t\tcolibriKey: colibriKey,\n\t}, nil\n}", "title": "" }, { "docid": "7bca084ef10adb7c6f6d2af1026c8a51", "score": "0.5618918", "text": "func New(db *gorm.DB) Store {\n\treturn &concreteStore{\n\t\tdb: db,\n\t}\n}", "title": "" }, { "docid": "a7f42e148842a1c240a845f63cd25a9b", "score": "0.5617969", "text": "func NewStore(env *config.EnvConfig) (store.Store, error) {\n\tdbMap := &gorp.DbMap{Db: getDb(env), Dialect: gorpFlavorMap[env.DbCredentials.Flavor]}\n\tdbMap.TraceOn(\"[gorp]\", log.New(os.Stdout, \"Holly:\", log.Lmicroseconds))\n\ttx, err := dbMap.Begin()\n\tstore := &SQLStore{dbMap: dbMap, Tx: tx}\n\tstore.createStores()\n\tstore.createTables()\n\treturn store, err\n}", "title": "" }, { "docid": "9de976cb2984f8f2799f24f3107ef314", "score": "0.5615213", "text": "func Create() storage.GraphStore {\n\treturn &store{}\n}", "title": "" }, { "docid": "aa47fef1b99b9ade18a04f2d1cbee22a", "score": "0.55959314", "text": "func New(ds *kt.Datastore) (*Store, error) {\n\treturn &Store{\n\t\tds: ds,\n\t}, nil\n}", "title": "" }, { "docid": "625d51921627b4e6ae76cb40f3d0beec", "score": "0.5591165", "text": "func newStore(db *sql.DB) (*store, error) {\n\ts := &store{\n\t\tdb: db,\n\t}\n\n\ts.channel = &channelServiceProvider{\n\t\tstore: s,\n\t}\n\n\ts.singleMessage = &singleMessageServiceProvider{\n\t\tstore: s,\n\t}\n\n\ts.channelMessage = &channelMessageServiceProvider{\n\t\tstore: s,\n\t}\n\n\ts.channelUser = &channelUserServiceProvider{\n\t\tstore: s,\n\t}\n\n\treturn s, nil\n}", "title": "" }, { "docid": "5ffb8e2628321943dd77845343d31331", "score": "0.5590244", "text": "func New(db models.XODB) *Store {\n\treturn &Store{db: db}\n}", "title": "" }, { "docid": "3b1071556ba3af1d6c0b44bdf09c5a59", "score": "0.5575112", "text": "func CreateStore(backend Backend) (*Store, error) {\n\ts := new(Store)\n\ts.backend = backend\n\ts.naturalSort = true\n\terr := s.BackendLoad()\n\treturn s, err\n}", "title": "" }, { "docid": "0dca4737430499a17271f3724ba84ec6", "score": "0.5549923", "text": "func createRDB() *rdb.RDB {\n\tvar c redis.UniversalClient\n\tif viper.GetBool(\"cluster\") {\n\t\taddrs := strings.Split(viper.GetString(\"cluster_addrs\"), \",\")\n\t\tc = redis.NewClusterClient(&redis.ClusterOptions{\n\t\t\tAddrs: addrs,\n\t\t\tPassword: viper.GetString(\"password\"),\n\t\t\tTLSConfig: getTLSConfig(),\n\t\t})\n\t} else {\n\t\tc = redis.NewClient(&redis.Options{\n\t\t\tAddr: viper.GetString(\"uri\"),\n\t\t\tDB: viper.GetInt(\"db\"),\n\t\t\tPassword: viper.GetString(\"password\"),\n\t\t\tTLSConfig: getTLSConfig(),\n\t\t})\n\t}\n\treturn rdb.NewRDB(c)\n}", "title": "" }, { "docid": "c84c4a9ab0785bddea9b2959ecb90f2a", "score": "0.5536282", "text": "func NewRedisStore(addr, password, db string, logger *log.Logger, prefix string) Store {\n\treturn &RedisStore{\n\t\taddr: addr,\n\t\tpassword: password,\n\t\tdb: db,\n\t\tsumKey: \"shield:sum\",\n\t\tclassKey: \"shield:class\",\n\t\tclassesKey: \"shield:classes\",\n\t\tlogger: logger,\n\t\tprefix: prefix,\n\t}\n}", "title": "" }, { "docid": "ff1499485133726794caa0efa3ad2a52", "score": "0.55329704", "text": "func New(address string) *Store {\n\turl, err := url.Parse(address)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\tredis := redis.NewClient(&redis.Options{Addr: url.Hostname() + \":\" + url.Port()})\n\treturn &Store{\n\t\tredis: redis,\n\t\tcache: &cache.Codec{\n\t\t\tRedis: redis,\n\t\t\tMarshal: func(v interface{}) ([]byte, error) {\n\t\t\t\treturn msgpack.Marshal(v)\n\t\t\t},\n\t\t\tUnmarshal: func(b []byte, v interface{}) error {\n\t\t\t\treturn msgpack.Unmarshal(b, v)\n\t\t\t},\n\t\t},\n\t}\n}", "title": "" }, { "docid": "a814c5cd59fb1e573e5c12317b417087", "score": "0.55178326", "text": "func Create(s *structs.Config) (st.Storage, error) {\n\tif s == nil {\n\t\treturn nil, errors.New(\"config is not defined\")\n\t}\n\targs := \"dbname=selitra\"\n\tif s.DBName != \"\" && s.DBPassword != \"\" && s.DBUser != \"\" {\n\t\targs += fmt.Sprintf(\" user=%s dbname=%s password=%s\", s.DBUser, s.DBName, s.DBPassword)\n\t}\n\tdb, err := gorm.Open(\"postgres\", args)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"unable to open db: %v\", err)\n\t}\n\tdb.AutoMigrate(&st.LogRequest{})\n\treturn &storage{\n\t\tdb: db,\n\t}, nil\n}", "title": "" }, { "docid": "269714a179dbd396d35af81b9bc12298", "score": "0.55146503", "text": "func (c *redisGCaches) Create(ctx context.Context, redisGCache *v1alpha1.RedisGCache, opts v1.CreateOptions) (result *v1alpha1.RedisGCache, err error) {\n\tresult = &v1alpha1.RedisGCache{}\n\terr = c.client.Post().\n\t\tNamespace(c.ns).\n\t\tResource(\"redisgcaches\").\n\t\tVersionedParams(&opts, scheme.ParameterCodec).\n\t\tBody(redisGCache).\n\t\tDo(ctx).\n\t\tInto(result)\n\treturn\n}", "title": "" }, { "docid": "916677365e6e526663944f5cbeeae82d", "score": "0.55092037", "text": "func CreateStore(uri string) (store *MongoDB, err error) {\n\tconnString, err := connstring.Parse(uri)\n\n\tspew.Dump(connString)\n\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tclient, err := mongo.NewClientFromConnString(connString)\n\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tstore = &MongoDB{\n\t\tClient: client,\n\t\tDatabase: client.Database(\"goa-simple-crud\"),\n\t}\n\n\treturn store, nil\n}", "title": "" }, { "docid": "7181ade890c52d81b45556194e3ec206", "score": "0.550309", "text": "func makeBoltStore(siteNames []string, path string) engine.Interface {\n\tsites := []engine.BoltSite{}\n\tfor _, site := range siteNames {\n\t\tsites = append(sites, engine.BoltSite{SiteID: site, FileName: fmt.Sprintf(\"%s/%s.db\", path, site)})\n\t}\n\tresult, err := engine.NewBoltDB(bolt.Options{Timeout: 30 * time.Second}, sites...)\n\tif err != nil {\n\t\tlog.Fatalf(\"[ERROR] can't initialize data store, %+v\", err)\n\t}\n\treturn result\n}", "title": "" }, { "docid": "e304d775a5b3fe70aed0bee896cdd517", "score": "0.54876244", "text": "func NewStore(ctx context.Context, bqDataset, btTable, projectID, schemaPath string,\n\tsubTypeMap map[string]string, containedIn map[util.TypePair][]string,\n\topts ...option.ClientOption) (Interface, error) {\n\t// BigQuery.\n\tbqClient, err := bigquery.NewClient(ctx, projectID, opts...)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tfiles, err := ioutil.ReadDir(schemaPath)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tmappings := []*base.Mapping{}\n\tfor _, f := range files {\n\t\tif strings.HasSuffix(f.Name(), \".mcf\") {\n\t\t\tmappingStr, err := ioutil.ReadFile(filepath.Join(schemaPath, f.Name()))\n\t\t\tif err != nil {\n\t\t\t\treturn nil, err\n\t\t\t}\n\t\t\tmapping, err := translator.ParseMapping(string(mappingStr))\n\t\t\tif err != nil {\n\t\t\t\treturn nil, err\n\t\t\t}\n\t\t\tmappings = append(mappings, mapping...)\n\t\t}\n\t}\n\toutArcInfo := map[string]map[string][]translator.OutArcInfo{}\n\tinArcInfo := map[string][]translator.InArcInfo{}\n\n\t// Bigtable.\n\tbtClient, err := bigtable.NewClient(ctx, util.BtProject, util.BtInstance, opts...)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn &store{bqDataset, bqClient, mappings, outArcInfo, inArcInfo,\n\t\tsubTypeMap, containedIn, btClient.Open(btTable)}, nil\n}", "title": "" }, { "docid": "2796ab402e70f3c8a8357232c76e35c2", "score": "0.54670835", "text": "func New(db *sqlite3_db.Db) Store {\n\treturn Store{db}\n}", "title": "" }, { "docid": "e2ff1e669753d02d0dd4cf4c480868d9", "score": "0.54659355", "text": "func NewStore(pid uint64, sequential bool) Store {\n\tvar store Store\n\n\t// Create the type-specific data structures\n\tif sequential {\n\t\t// Create a sequential store on demand.\n\t\tstore = new(SequentialStore)\n\t\tinfo(\"created sequential consistency storage\")\n\t} else {\n\t\t// The default is a linearizable store.\n\t\tstore = new(LinearizableStore)\n\t\tinfo(\"created linearizable consistency storage\")\n\t}\n\n\t// Initialize the store and return\n\tstore.Init(pid)\n\treturn store\n\n}", "title": "" }, { "docid": "e03a81830974e1da04ee8563905c72fd", "score": "0.5452195", "text": "func New(c kubernetes.Interface, namespace string) storage.Store {\n\treturn &store{\n\t\tclient: c,\n\t\tnamespace: namespace,\n\t\tapiCache: apicache.New(c, namespace, time.Duration(60)*time.Second),\n\t}\n}", "title": "" }, { "docid": "90a41aa8aa9733ad419e74281ae6920d", "score": "0.54472744", "text": "func NewStore(redis *redis.Client, keyPairs ...[]byte) *Store {\n\tstore := &Store{\n\t\tCodecs: securecookie.CodecsFromPairs(keyPairs...),\n\t\tOptions: &sessions.Options{\n\t\t\tPath: \"/\",\n\t\t\tMaxAge: 86400 * 7,\n\t\t\tHttpOnly: true,\n\t\t},\n\t\tredis: redis,\n\t}\n\n\tstore.MaxAge(store.Options.MaxAge)\n\treturn store\n}", "title": "" }, { "docid": "4b38f0de9f0076d69fea10b4158952bd", "score": "0.5447084", "text": "func Create(name string, parameters map[string]string) (metrics.Datastore, error) {\n\tf, ok := datastoreFactories[name]\n\tif !ok {\n\t\treturn nil, errors.Errorf(\"unknown datastore: %s\", name)\n\t}\n\tv, err := f(parameters)\n\treturn v, errors.Wrap(err, \"failed to create datastore\")\n}", "title": "" }, { "docid": "da3f686f288830f2a2f9c7f3d7cab705", "score": "0.5442333", "text": "func New() *Store {\n\treturn &Store{\n\t\tjobs: map[int64]*storage.Job{},\n\t}\n}", "title": "" }, { "docid": "6a85a8923cd479b5f82c5cad53e9dde6", "score": "0.5435958", "text": "func NewStore(log logger.Entry, cfg Config) (*Store, error) {\n\n\t// Open bolt database\n\t// TODO: move 0644 to Config\n\tdb, err := bolt.Open(cfg.File, 0644, nil)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tlog.WithField(\"config\", cfg).Debug(\"Create store\")\n\ts := Store{\n\t\tBucket: []byte(cfg.Bucket),\n\t\tNumberKey: []byte(cfg.NumberKey),\n\t\tSettingsKey: []byte(cfg.SettingsKey),\n\t\tdb: db,\n\t\tlog: log,\n\t}\n\treturn &s, nil\n\n}", "title": "" }, { "docid": "9c9149eda4b14ea89fbe1b1ea2ab4d59", "score": "0.5435839", "text": "func NewStore() (*Store, error) {\n\tstore := &Store{\n\t\t// Store and Stream ara using the same Redis instance. That's fine but incidental.\n\t\t// They could perfectly use different instances if needed for scalability.\n\t\tclient: *redis.NewClient(&redis.Options{\n\t\t\tAddr: \"redis:6379\",\n\t\t\tPassword: \"\", // no password set\n\t\t\tDB: 0, // use default database\n\t\t}),\n\t}\n\treturn store, nil\n}", "title": "" }, { "docid": "763eda52f00bfba1012dbb29268bcce7", "score": "0.54277045", "text": "func CreateStore(ctx context.Context, conf *StoreConfig) *Store {\n\ts := new(Store)\n\ts.NodeID = conf.NodeID\n\ts.EngineName = conf.EngineName\n\ts.EngineConf = conf.EngineConfig\n\ts.Meta = conf.Meta\n\ts.RaftPath = conf.RaftPath\n\ts.RaftConfig = conf.RaftConfig\n\ts.RaftServer = conf.RaftServer\n\ts.EventListener = conf.EventListener\n\ts.Ctx, s.CtxCancel = context.WithCancel(ctx)\n\ts.Meta.Status = metapb.PA_NOTREAD\n\n\treturn s\n}", "title": "" }, { "docid": "61531a2f407c997997ace70e3bdeb2d1", "score": "0.54223144", "text": "func NewDB(path string) (Datastore, error) {\n\tbDb, err := bbolt.Open(path, 0666, nil)\n\tif err != nil {\n\t\treturn (*db)(nil), err\n\t}\n\n\tif err := bDb.Update(func(tx *bbolt.Tx) error {\n\t\t_, err := tx.CreateBucketIfNotExists([]byte(keysDB))\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"create bucket: %s\", err)\n\t\t}\n\n\t\treturn nil\n\t}); err != nil {\n\t\treturn (*db)(nil), err\n\t}\n\n\treturn &db{DB: bDb}, nil\n}", "title": "" }, { "docid": "cf4cbd1c86303e86058504b5c677cc0e", "score": "0.54112715", "text": "func NewDataStore(c map[string]string) (interface{}, error) {\n\treturn &dataStore{\n\t\tpool: &redis.Pool{\n\t\t\tMaxIdle: conf.GetInt(keyRedisMaxIdel),\n\t\t\t// When zero, there is no limit on the number of connections in the pool.\n\t\t\tMaxActive: conf.GetInt(keyRedisMaxActive),\n\t\t\tIdleTimeout: conf.GetDuration(keyRedisIdelTimeout) * time.Second,\n\t\t\tDial: func() (redis.Conn, error) {\n\t\t\t\tconn, err := redis.Dial(\"tcp\", conf.GetString(keyRedisServer)+\":\"+conf.GetString(keyRedisPort))\n\t\t\t\tif err != nil {\n\t\t\t\t\tconf.Log.WithError(err).Error(\"Redis pool dial error\")\n\t\t\t\t}\n\t\t\t\treturn conn, err\n\t\t\t},\n\t\t},\n\t}, nil\n}", "title": "" }, { "docid": "76aa60a634f032a6ae6e13d016130416", "score": "0.5408107", "text": "func New(project *Project, metainfo *metainfo.Client, streams streams.Store, segments segments.Store, encStore *encryption.Store) *DB {\n\treturn &DB{\n\t\tproject: project,\n\t\tmetainfo: metainfo,\n\t\tstreams: streams,\n\t\tsegments: segments,\n\t\tencStore: encStore,\n\t}\n}", "title": "" }, { "docid": "4423c461a4e13ae71a4c35cc79f0e45f", "score": "0.5403376", "text": "func New() (IStore, error) {\n\tappConfig, err := config.ReadConfig()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tif appConfig.Project == \"\" {\n\t\treturn nil, errors.New(\"invalid project name\")\n\t}\n\n\tswitch appConfig.Store {\n\tcase \"aws\":\n\t\tif appConfig.AWSProfile == \"\" {\n\t\t\treturn nil, errors.New(\"invalid aws profile\")\n\t\t}\n\n\t\tif appConfig.AWSRegion == \"\" {\n\t\t\treturn nil, errors.New(\"invalid aws region\")\n\t\t}\n\n\t\tos.Setenv(\"AWS_PROFILE\", appConfig.AWSProfile)\n\t\tos.Setenv(\"AWS_REGION\", appConfig.AWSRegion)\n\n\t\treturn aws.NewStore(appConfig.Project, appConfig.AWSRegion)\n\tdefault:\n\t\treturn nil, errors.New(\"unsupported store\")\n\t}\n}", "title": "" }, { "docid": "3ebf7085f12f3c1e5afd2f36690aecd0", "score": "0.54010946", "text": "func (p *LogProject) CreateLogStore(name string, ttl, shardCnt int) error {\n\ttype Body struct {\n\t\tName string `json:\"logstoreName\"`\n\t\tTTL int `json:\"ttl\"`\n\t\tShardCount int `json:\"shardCount\"`\n\t}\n\tstore := &Body{\n\t\tName: name,\n\t\tTTL: ttl,\n\t\tShardCount: shardCnt,\n\t}\n\tbody, err := json.Marshal(store)\n\tif err != nil {\n\t\treturn NewClientError(err.Error())\n\t}\n\n\th := map[string]string{\n\t\t\"x-log-bodyrawsize\": fmt.Sprintf(\"%v\", len(body)),\n\t\t\"Content-Type\": \"application/json\",\n\t\t\"Accept-Encoding\": \"deflate\", // TODO: support lz4\n\t}\n\n\tr, err := request(p, \"POST\", \"/logstores\", h, body)\n\tif err != nil {\n\t\treturn NewClientError(err.Error())\n\t}\n\n\tbody, _ = ioutil.ReadAll(r.Body)\n\tif r.StatusCode != http.StatusOK {\n\t\terr := new(Error)\n\t\tjson.Unmarshal(body, err)\n\t\treturn err\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "7c99f48a4d5c976555b4d71fbfa1f740", "score": "0.5400552", "text": "func (client *Client) StoreCreate(ctx context.Context, draft *StoreDraft, opts ...RequestOption) (result *Store, err error) {\n\tparams := url.Values{}\n\tfor _, opt := range opts {\n\t\topt(&params)\n\t}\n\n\tendpoint := \"stores\"\n\terr = client.create(ctx, endpoint, params, draft, &result)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn result, nil\n}", "title": "" }, { "docid": "d88576afdbfb1763e63dda2e6fb85d03", "score": "0.54000175", "text": "func New(options ...Option) (*Store, error) {\n\t// setup with defaults\n\tstore := &Store{\n\t\tDataDirectory: DefaultStoreDirectory,\n\t\tDataFileName: DefaultStoreFileName,\n\t}\n\t// apply functional options to override\n\tfor _, option := range options {\n\t\toption(store)\n\t}\n\tlog.L.Debug(\"creating SQLite3 database\", zap.String(\"data directory\", store.DataDirectory), zap.String(\"data file name\", store.DataFileName))\n\t// open the local database\n\tdb, err := initialise(filepath.Join(store.DataDirectory, store.DataFileName), migrations.Migrations)\n\tif err != nil {\n\t\tlog.L.Error(\"error opening database\", zap.Error(err))\n\t\treturn nil, err\n\t}\n\t// test the connection\n\tif err = db.Ping(); err != nil {\n\t\tlog.L.Error(\"cannot ping database\", zap.Error(err))\n\t\treturn nil, err\n\t}\n\tstore.DB = db\n\tlog.L.Debug(\"database loaded\")\n\treturn store, nil\n}", "title": "" }, { "docid": "e098d145938bdab7620a47d3d612dc41", "score": "0.5391913", "text": "func newStoreWithKeyStore(\n\tconfig *orm.Config,\n\tethClient eth.Client,\n\tadvisoryLocker postgres.AdvisoryLocker,\n\tkeyStoreGenerator KeyStoreGenerator,\n\tshutdownSignal gracefulpanic.Signal,\n) (*Store, error) {\n\tif err := utils.EnsureDirAndMaxPerms(config.RootDir(), os.FileMode(0700)); err != nil {\n\t\treturn nil, errors.Wrap(err, \"error while creating project root dir\")\n\t}\n\n\torm, err := initializeORM(config, shutdownSignal)\n\tif err != nil {\n\t\treturn nil, errors.Wrap(err, \"failed to initialize ORM\")\n\t}\n\tif e := orm.ClobberDiskKeyStoreWithDBKeys(config.KeysDir()); e != nil {\n\t\treturn nil, errors.Wrap(err, \"error migrating key store to disk\")\n\t}\n\n\tkeyStore := keyStoreGenerator(config)\n\tscryptParams := utils.GetScryptParams(config)\n\n\tstore := &Store{\n\t\tClock: utils.Clock{},\n\t\tAdvisoryLocker: advisoryLocker,\n\t\tConfig: config,\n\t\tKeyStore: keyStore,\n\t\tOCRKeyStore: offchainreporting.NewKeyStore(orm.DB, scryptParams),\n\t\tORM: orm,\n\t\tEthClient: ethClient,\n\t\tcloseOnce: &sync.Once{},\n\t}\n\tstore.VRFKeyStore = NewVRFKeyStore(store)\n\treturn store, nil\n}", "title": "" }, { "docid": "ec76a4564f98d25b4135b46c2099153e", "score": "0.53883743", "text": "func NewRedis(ctx *pulumi.Context,\n\tname string, args *RedisArgs, opts ...pulumi.ResourceOption) (*Redis, error) {\n\tif args == nil {\n\t\treturn nil, errors.New(\"missing one or more required arguments\")\n\t}\n\n\tif args.Plan == nil {\n\t\treturn nil, errors.New(\"invalid value for required argument 'Plan'\")\n\t}\n\tif args.Project == nil {\n\t\treturn nil, errors.New(\"invalid value for required argument 'Project'\")\n\t}\n\tif args.ServiceName == nil {\n\t\treturn nil, errors.New(\"invalid value for required argument 'ServiceName'\")\n\t}\n\tsecrets := pulumi.AdditionalSecretOutputs([]string{\n\t\t\"servicePassword\",\n\t\t\"serviceUri\",\n\t})\n\topts = append(opts, secrets)\n\topts = internal.PkgResourceDefaultOpts(opts)\n\tvar resource Redis\n\terr := ctx.RegisterResource(\"aiven:index/redis:Redis\", name, args, &resource, opts...)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn &resource, nil\n}", "title": "" }, { "docid": "39e6972d775b6aac4b087ca6fb554a71", "score": "0.5382189", "text": "func New(ctx provider) (*Store, error) {\n\tstore, err := ctx.StorageProvider().OpenStore(NameSpace)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"failed to open did store: %w\", err)\n\t}\n\n\terr = ctx.StorageProvider().SetStoreConfig(NameSpace, storage.StoreConfiguration{TagNames: []string{didNameKey}})\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"failed to set store configuration: %w\", err)\n\t}\n\n\treturn &Store{store: store}, nil\n}", "title": "" }, { "docid": "8cb7ab9b28dca9d80db842eb874010cd", "score": "0.53813475", "text": "func New(db *sqlx.DB) model.JobStore {\n\treturn &jobStore{db}\n}", "title": "" }, { "docid": "7521c4a3eb2e0e5b7d83f0a710dd6fbe", "score": "0.5378182", "text": "func (p *LogProject) CreateLogStore(name string, ttl, shardCnt int, autoSplit bool, maxSplitShard int) error {\n\ttype Body struct {\n\t\tName string `json:\"logstoreName\"`\n\t\tTTL int `json:\"ttl\"`\n\t\tShardCount int `json:\"shardCount\"`\n\t\tAutoSplit bool `json:\"autoSplit\"`\n\t\tMaxSplitShard int `json:\"maxSplitShard\"`\n\t\tWebTracking bool `json:\"enable_tracking\"`\n\t}\n\tstore := &Body{\n\t\tName: name,\n\t\tTTL: ttl,\n\t\tShardCount: shardCnt,\n\t\tAutoSplit: autoSplit,\n\t\tMaxSplitShard: maxSplitShard,\n\t}\n\tbody, err := json.Marshal(store)\n\tif err != nil {\n\t\treturn NewClientError(err)\n\t}\n\n\th := map[string]string{\n\t\t\"x-log-bodyrawsize\": fmt.Sprintf(\"%v\", len(body)),\n\t\t\"Content-Type\": \"application/json\",\n\t\t\"Accept-Encoding\": \"deflate\", // TODO: support lz4\n\t}\n\n\tr, err := request(p, \"POST\", \"/logstores\", h, body)\n\tif err != nil {\n\t\treturn NewClientError(err)\n\t}\n\tdefer r.Body.Close()\n\tbody, _ = ioutil.ReadAll(r.Body)\n\tif r.StatusCode != http.StatusOK {\n\t\terr := new(Error)\n\t\tjson.Unmarshal(body, err)\n\t\treturn err\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "f86bf19e21739aeee6401bbf6ad4a395", "score": "0.535995", "text": "func New(driver, url, dir string, workers int) *Store {\n\tvar err error\n\ts := new(Store)\n\ts.db, err = sql.New(driver, url, dir, workers)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn s\n}", "title": "" }, { "docid": "eb445200d848c9408f67aa081dbc4384", "score": "0.5356283", "text": "func NewStore() Store {\n\treturn Store{\n\t\tdata: make(map[string][]byte),\n\t}\n}", "title": "" }, { "docid": "e19855f90b7b440b8a1c2bad3e747eff", "score": "0.5351833", "text": "func newRedisRepo(name string, client *redis.Client) redisRepo {\n\treturn redisRepo{\n\t\tidentifier: name,\n\t\tclient: client,\n\t}\n}", "title": "" }, { "docid": "3b0ad175396e01a937e9b2406b96fb63", "score": "0.53493655", "text": "func (m *manager) Store(ctx context.Context, project *domain.ProjectAdd) error {\n\treturn m.service.Store(ctx, project)\n}", "title": "" }, { "docid": "80c69e87999425c4007aaa4a16a2b9fe", "score": "0.534555", "text": "func New(options Options) (store.Service, error) {\n\tdb, err := sql.Open(\"postgres\", options.connectionInfo())\n\tif err != nil {\n\t\treturn nil, errors.Wrap(err, \"connecting to postgres database\")\n\t}\n\n\t_, err = db.Exec(usersTableCreationQuery)\n\tif err != nil {\n\t\treturn nil, errors.Wrap(err, \"creating todos table\")\n\t}\n\n\t_, err = db.Exec(resourcesTableCreationQuery)\n\tif err != nil {\n\t\treturn nil, errors.Wrap(err, \"creating resources table\")\n\t}\n\n\treturn &service{db: db}, nil\n}", "title": "" }, { "docid": "84f9a7e3959ae6890e36995457cb615b", "score": "0.53435206", "text": "func (sw *storageWrapper) Create(key string, obj runtime.Object) error {\n\tvar buf bytes.Buffer\n\tif obj != nil {\n\t\tif err := sw.backendSerializer.Encode(obj, &buf); err != nil {\n\t\t\tklog.Errorf(\"failed to encode object in create for %s, %v\", key, err)\n\t\t\treturn err\n\t\t}\n\t}\n\n\tif err := sw.store.Create(key, buf.Bytes()); err != nil {\n\t\treturn err\n\t}\n\n\tif obj != nil && isCacheKey(key) {\n\t\tsw.Lock()\n\t\tsw.cache[key] = obj\n\t\tsw.Unlock()\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "9c8c7f16331eaeddcfa49bfe1c9ab70d", "score": "0.53425914", "text": "func New(cfg *types.DplatformOSConfig) queue.Module {\n\tmcfg := cfg.GetModuleConfig().Store\n\tsub := cfg.GetSubConfig().Store\n\ts, err := store.Load(mcfg.Name)\n\tif err != nil {\n\t\tpanic(\"Unsupported store type:\" + mcfg.Name + \" \" + err.Error())\n\t}\n\tsubcfg, ok := sub[mcfg.Name]\n\tif !ok {\n\t\tsubcfg = nil\n\t}\n\treturn s(mcfg, subcfg, cfg)\n}", "title": "" }, { "docid": "59ed4c60758c3cec0db7e5f8dc7ab810", "score": "0.5339268", "text": "func NewRedisStore(ctx context.Context, tableName string, config redis.Options) (*RedisStore, error) {\n\tvar red RedisStore\n\tred.ctx = ctx\n\tred.tableName = tableName\n\tred.hashList = tableName + \"_keys\"\n\tred.hashElem = tableName + \"_item\"\n\tred.Config = &config\n\tif err := red.createConnection(); err != nil {\n\t\treturn nil, nerror.WrapOnly(err)\n\t}\n\treturn &red, nil\n}", "title": "" }, { "docid": "2c36647864a796b6053f42872faadff2", "score": "0.53366816", "text": "func New(inmem bool , dbport string) *Store {\n dbo := newdbConeection(dbport)\n fmt.Print(\"create db object\")\n collection:= dbo.createCollection(\"abc\",\"pqr\")\n // data := []byte(`{\"a\":\"m\", \"c\":5, \"d\": [\"e\", \"f\"]}`)\n // dbobject.insertData(data,collection)\n \n \n \n\treturn &Store{\n\t\tm: make(map[string]string),\n\t\tinmem: inmem,\n\t\tlogger: log.New(os.Stderr, \"[store] \", log.LstdFlags),\n\t\tcollection : collection,\n\t\tdbobject : dbo,\n\t}\n}", "title": "" }, { "docid": "d05f1bd5aaaeaf6878e3b347746e663c", "score": "0.53359497", "text": "func NewStore() *Store {\n\treturn &Store{\n\t\tdata: make(map[string][]byte),\n\t\treplications: make(map[string]time.Time),\n\t}\n}", "title": "" }, { "docid": "75071b98ec5ce52b19d91dc28724d6b1", "score": "0.5326795", "text": "func NewStore(path string) (Store, error) {\n\tm := make(map[string]Value)\n\ts, err := index.NewPersistStore(path, &m)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn &store{\n\t\tm: m,\n\t\tstore: s,\n\t}, nil\n}", "title": "" }, { "docid": "f6830c9b66278f72cccc2cb557852c32", "score": "0.5325774", "text": "func (ro *ObjectOperation) Create(namespace, storeName string, replicaCount int32) error {\n\n\tlogger.Infof(\"creating the object store via CRD\")\n\tstoreSpec := fmt.Sprintf(`apiVersion: ceph.rook.io/v1beta1\nkind: ObjectStore\nmetadata:\n name: %s\n namespace: %s\nspec:\n metadataPool:\n replicated:\n size: 1\n dataPool:\n replicated:\n size: 1\n gateway:\n type: s3\n sslCertificateRef:\n port: %d\n securePort:\n instances: %d\n allNodes: false\n`, storeName, namespace, rgwPort, replicaCount)\n\n\tif _, err := ro.k8sh.ResourceOperation(\"create\", storeSpec); err != nil {\n\t\treturn err\n\t}\n\n\terr := ro.k8sh.WaitForLabeledPodToRun(fmt.Sprintf(\"rook_object_store=%s\", storeName), namespace)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"rgw did not start via crd. %+v\", err)\n\t}\n\n\t// create the external service\n\treturn ro.k8sh.CreateExternalRGWService(namespace, storeName)\n}", "title": "" }, { "docid": "0b8db52784d18f5feca4c787a2818344", "score": "0.5323868", "text": "func CreateNewStorage(projectName, bucketName string) StorageRepository {\n\tctx := context.Background()\n\tstorageClient, err := storage.NewClient(ctx)\n\tif err != nil {\n\t\tpanic(\"Failed to create client: \" + err.Error())\n\t}\n\n\tstore := StorageRepository{\n\t\tclient: storageClient,\n\t\tprojectID: projectName,\n\t\tbucketName: bucketName,\n\t}\n\n\tstore.createBucket(ctx, store.bucketName)\n\n\treturn store\n}", "title": "" }, { "docid": "b4e9e408342b2d3dc80701394532146d", "score": "0.53235555", "text": "func New(cfg *Config) (gokvstores.KVStore, error) {\n\tif cfg == nil {\n\t\treturn gokvstores.DummyStore{}, nil\n\t}\n\n\tswitch cfg.Type {\n\tcase dummyKVStoreType:\n\t\treturn gokvstores.DummyStore{}, nil\n\tcase redisClusterKVStoreType:\n\t\tredis := cfg.RedisCluster\n\n\t\ts, err := gokvstores.NewRedisClusterStore(&gokvstores.RedisClusterOptions{\n\t\t\tAddrs: redis.Addrs,\n\t\t\tPassword: redis.Password,\n\t\t}, time.Duration(redis.Expiration)*time.Second)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\n\t\treturn &kvstoreWrapper{s, cfg.Prefix}, nil\n\tcase redisKVStoreType:\n\t\tredis := cfg.Redis\n\n\t\ts, err := gokvstores.NewRedisClientStore(&gokvstores.RedisClientOptions{\n\t\t\tAddr: redis.Addr(),\n\t\t\tDB: redis.DB,\n\t\t\tPassword: redis.Password,\n\t\t}, time.Duration(redis.Expiration)*time.Second)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\n\t\treturn &kvstoreWrapper{s, cfg.Prefix}, nil\n\tcase cacheKVStoreType:\n\t\tcache := cfg.Cache\n\n\t\ts, err := gokvstores.NewMemoryStore(\n\t\t\ttime.Duration(cache.Expiration)*time.Second,\n\t\t\ttime.Duration(cache.CleanupInterval)*time.Second)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\n\t\treturn &kvstoreWrapper{s, cfg.Prefix}, nil\n\t}\n\n\treturn nil, fmt.Errorf(\"kvstore %s does not exist\", cfg.Type)\n}", "title": "" }, { "docid": "2eddc761d4fc5dbe8c2797a6958e3fda", "score": "0.5314391", "text": "func Create(root string) (*Storage, error) {\n\tfs := &Storage{\n\t\troot: root,\n\t\tnextSeq: 0,\n\t}\n\n\treturn fs, nil\n}", "title": "" }, { "docid": "31a04a60ee53c851e62364206c186fd7", "score": "0.5313817", "text": "func New(s *Store) (*Store, error) {\n\tif s.OnCreate != nil {\n\t\tfor _, create := range s.OnCreate {\n\t\t\terr := create(s)\n\t\t\tif err != nil {\n\t\t\t\treturn nil, err\n\t\t\t}\n\t\t}\n\t}\n\n\tif s.Data == nil {\n\t\treturn nil, errors.New(\"store data is nil\")\n\t}\n\n\treturn s, nil\n}", "title": "" }, { "docid": "c67adfdfdae5acd19b3c0c302b9a41b0", "score": "0.5309009", "text": "func newDatastore(ctx context.Context) (db.Database, error) {\n\t// Use this for Cloud datastore.\n\treturn db.NewDatastore(ctx, db.GetProjectID(ctx))\n\t// Use this for testing.\n\t//return db.NewMemoryDB(), nil\n}", "title": "" }, { "docid": "e5d4a51da80c28b2dcb61cb76defd6ec", "score": "0.5308605", "text": "func (s storeService) Create(c *gin.Context) (entity.Store, error) {\n\tlog.Debug().Caller().Msg(\"stores create\")\n\tsr := s.storeRepository\n\tvar u entity.Store\n\n\t//UUID生成\n\tid, err := uuid.NewRandom()\n\tif err != nil {\n\t\tlog.Error().Caller().Err(err).Send()\n\t\treturn u, err\n\t}\n\tu.Id = id.String()\n\n\tif err := c.BindJSON(&u); err != nil {\n\t\treturn u, err\n\t}\n\n\tvalidate := validator.New()\n\tif err := validate.Struct(u); err != nil {\n\t\treturn u, err\n\t}\n\n\t// SQSに接続\n\tstores_svc := StoresInit()\n\tresult, err := stores_svc.SendMessage(&sqs.SendMessageInput{\n\t\tMessageBody: aws.String(u.Id),\n\t\tQueueUrl: aws.String(stores_queue_url),\n\t\tDelaySeconds: aws.Int64(10),\n\t})\n\tif err != nil {\n\t\tlog.Error().Caller().Msg(\"Store SendMessage Error\")\n\t\treturn u, err\n\t} else {\n\t\tlog.Info().Caller().Msg(\"Store Success:\" + string(*result.MessageId))\n\t}\n\n\tu.Status = \"PENDING_CREATE\"\n\tu.CreatedAt = internal.JstTime()\n\n\tu, err = sr.Create(u)\n\tif err != nil {\n\t\treturn u, err\n\t}\n\n\treturn u, nil\n}", "title": "" }, { "docid": "aa11273a55f2f78a6dcdcbc067d88d23", "score": "0.52954626", "text": "func NewRedisDatastore(address string) (*RedisDatastore, error) {\n\t// Connect via tcp with a size of 10.\n\tconnectionPool, err := pool.New(\"tcp\", address, 10)\n\tlog.Printf(\"Creating a Redis connection pool.\\n\")\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn &RedisDatastore{Pool: connectionPool}, nil\n}", "title": "" }, { "docid": "0e24a9fe77115e1f2e725f6a55d30abc", "score": "0.5294222", "text": "func NewStore(snapshotter *snap.Snapshotter, proposeC chan<- string, commitC <-chan *string, errorC <-chan error, wg *sync.WaitGroup) *Store {\n\ts := &Store{proposeC: proposeC, WalletStore: make(map[[ed25519.PublicKeySize]byte]Account), snapshotter: snapshotter}\n\ts.readCommits(commitC, errorC)\n\tgo func() {\n\t\ts.readCommits(commitC, errorC)\n\t\twg.Done()\n\t}()\n\treturn s\n}", "title": "" }, { "docid": "f8beafd332ba10fa37fb3e4463d8c937", "score": "0.5293484", "text": "func New() Store {\n\ts := Store{\n\t\tLogger: olog.NewLogger(),\n\t}\n\n\t// default to the current working directory if not configured\n\tdir, err := filepath.Abs(filepath.Dir(os.Args[0]))\n\tif err != nil {\n\t\ts.Logger.Err(err).Msg(\"initializing accounts store\")\n\t}\n\n\tdest := filepath.Join(dir, StoreName)\n\tif _, err := os.Stat(dest); err != nil {\n\t\ts.Logger.Info().Msgf(\"creating container on %v\", dest)\n\t\tos.Mkdir(dest, 0700)\n\t}\n\n\ts.mountPath = dest\n\treturn s\n}", "title": "" }, { "docid": "bf38184fa3f142ed3d2c881c8ed782bb", "score": "0.5293235", "text": "func New() *Store {\n\treturn &Store{}\n}", "title": "" }, { "docid": "3cb8542e6b3b5f7b031ad02b37a2a80e", "score": "0.52910274", "text": "func (provider *BoltDb) CreateStore() (store.Store, error) {\n\tprovider.storeType = store.BOLTDB\n\tboltdb.Register()\n\treturn provider.createStore()\n}", "title": "" }, { "docid": "3d750ebe3f4826269b67fa50ed3551ea", "score": "0.52860653", "text": "func New(ds datastore.Datastore) (*Store, error) {\n\treturn &Store{ds: ds}, nil\n}", "title": "" }, { "docid": "99e6948091d7bfae2336d65dd94a575f", "score": "0.5282602", "text": "func New() (*Store, error) {\n\tstore := &Store{\n\t\tData: map[string][]byte{},\n\t\tSequence: 0,\n\t}\n\treturn store, nil\n}", "title": "" }, { "docid": "f39fa00a624d278b9e5352cf45e1d281", "score": "0.5277728", "text": "func (ps ProjectStore) NewProject(name string) (Project, error) {\n\tid := bson.NewObjectID()\n\tproject := Project{\n\t\tID: id,\n\t\tName: name,\n\t\tCreated: time.Now(),\n\t}\n\n\terr := ps.DS.Insert(bson.NewObjectID(), project)\n\tif err != nil {\n\t\treturn project, err\n\t}\n\n\treturn project, nil\n}", "title": "" }, { "docid": "dce4cb58ac89de3f41dad33734d8435e", "score": "0.52775776", "text": "func New(db *sqlx.DB) model.HostStore {\n\treturn &hostStore{db}\n}", "title": "" }, { "docid": "054f0fc590b909db8649be19e1744eb3", "score": "0.5273456", "text": "func Create(config Config) (State, error) {\n\tswitch config.Type {\n\tcase \"KV\":\n\t\treturn &KVStore{\n\t\t\tDbFileName: config.KVConfig.DbFileName,\n\t\t\tBucketName: config.KVConfig.BucketName,\n\t\t}, nil\n\tcase \"Count\":\n\t\treturn &Counter{}, nil\n\t}\n\n\treturn nil, fmt.Errorf(\"Invalid state type: %v\", config.Type)\n}", "title": "" }, { "docid": "d01dc958fca9bcf625a2fa2482ad5bee", "score": "0.52695584", "text": "func NewStore(s *redis.Service) *Store {\n\treturn &Store{\n\t\tService: s,\n\t}\n}", "title": "" }, { "docid": "698f51a3cf5a461ca5140ba94e8b984d", "score": "0.5265859", "text": "func Create(\n\tctx context.Context,\n\tdb database.Database,\n\tyorkieConf *yorkie.Config,\n\tprojectName string,\n) (*types.ProjectInfo, error) {\n\tprojectInfo, err := db.CreateProject(ctx, projectName)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\t// TODO(youngteac.hong): Extract yorkie packages such as database.\n\tcli, err := client.Dial(yorkieConf.RPCAddr, client.Option{\n\t\tToken: yorkieConf.WebhookToken,\n\t})\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tdefer func() {\n\t\tif err := cli.Close(); err != nil {\n\t\t\tlog.Logger.Error(err)\n\t\t}\n\t}()\n\n\tif err := cli.Activate(ctx); err != nil {\n\t\treturn nil, err\n\t}\n\tdefer func() {\n\t\tif err := cli.Deactivate(ctx); err != nil {\n\t\t\tlog.Logger.Error(err)\n\t\t}\n\t}()\n\n\tdoc := document.New(yorkieConf.Collection, projectInfo.ID.String())\n\tif err := cli.Attach(ctx, doc); err != nil {\n\t\treturn nil, err\n\t}\n\n\tproject := types.NewProject(projectInfo.ID.String(), projectInfo.Name)\n\tif err := updateProject(doc, project); err != nil {\n\t\treturn nil, err\n\t}\n\n\tif err := cli.Detach(ctx, doc); err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn projectInfo, nil\n}", "title": "" }, { "docid": "0c038093900ce83994a55583549a8c16", "score": "0.5262324", "text": "func NewStore(dsn string, watch bool) (Store, error) {\n\tif strings.HasPrefix(dsn, \"mysql://\") || strings.HasPrefix(dsn, \"postgres://\") {\n\t\treturn NewDatabaseStore(dsn)\n\t}\n\n\treturn NewFileStore(dsn, watch)\n}", "title": "" }, { "docid": "5de8bc030dbd2402df39007093dd1edb", "score": "0.5253493", "text": "func NewRedisStorage() *RedisStorage {\n\tredisPool := map[string]*redis.Pool{}\n\tring := ketama.NewRing(ketamaBase)\n\tfor n, addr := range Conf.RedisSource {\n\t\tnw := strings.Split(n, \":\")\n\t\tif len(nw) != 2 {\n\t\t\terr := errors.New(\"node config error, it's nodeN:W\")\n\t\t\tlog.Error(\"strings.Split(\\\"%s\\\", :) failed (%v)\", n, err)\n\t\t\tpanic(err)\n\t\t}\n\t\tw, err := strconv.Atoi(nw[1])\n\t\tif err != nil {\n\t\t\tlog.Error(\"strconv.Atoi(\\\"%s\\\") failed (%v)\", nw[1], err)\n\t\t\tpanic(err)\n\t\t}\n\t\t// get protocol and addr\n\t\tpw := strings.Split(addr, \"@\")\n\t\tif len(pw) != 2 {\n\t\t\tlog.Error(\"strings.Split(\\\"%s\\\", \\\"%s\\\") failed (%v)\", addr, redisProtocolSpliter, err)\n\t\t\tpanic(fmt.Sprintf(\"config redis.source node:\\\"%s\\\" format error\", addr))\n\t\t}\n\t\ttmpProto := pw[0]\n\t\ttmpAddr := pw[1]\n\t\t// WARN: closures use\n\t\t//tmp := addr\n\t\tlog.Info(tmpProto,\" | \",tmpAddr)\n\t\tredisPool[nw[0]] = &redis.Pool{\n\t\t\tMaxIdle: Conf.RedisMaxIdle,\n\t\t\tMaxActive: Conf.RedisMaxActive,\n\t\t\tIdleTimeout: Conf.RedisIdleTimeout,\n\t\t\tDial: func() (redis.Conn, error) {\n\t\t\t\tconn, err := redis.Dial(\"tcp\", tmpAddr)\n\t\t\t\tif err != nil {\n\t\t\t\t\tlog.Error(\"redis.Dial(\\\"tcp\\\", \\\"%s\\\") error(%v)\", tmpAddr, err)\n\t\t\t\t\treturn nil, err\n\t\t\t\t}\n\t\t\t\treturn conn, err\n\t\t\t},\n\t\t}\n\t\t// add node to ketama hash\n\t\tring.AddNode(nw[0], w)\n\t}\n\tring.Bake()\n\ts := &RedisStorage{pool: redisPool, ring: ring}\n\treturn s\n}", "title": "" }, { "docid": "ff055753703774042ab43df9414b3d40", "score": "0.5247768", "text": "func New() (datastore.DataStore, error) {\n\treturn newPlugin(\"file::memory:?cache=shared\")\n}", "title": "" }, { "docid": "026112d7de5525b2492bd862e6ad1471", "score": "0.5241422", "text": "func NewMemoryStorage(addr, password string, db int) (Cache, error) {\n\tlog.Println(chalk.Green, \"redis: connecting....\")\n\tclient := redis.NewClient(&redis.Options{\n\t\tAddr:addr,\n\t\tPassword:password,\n\t\tDB: db,\n\t})\n\n\t_, err := client.Ping().Result()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tlog.Println(chalk.Green, \"redis: connected\")\n\treturn &RedisStore{client: client}, nil\n}", "title": "" }, { "docid": "48f8c75b2d8f1943851b833df5381c78", "score": "0.5236091", "text": "func New2(conf string) (*RedisStore, error) {\n\trs := new(RedisStore)\n\treturn rs, rs.Init(conf)\n}", "title": "" }, { "docid": "f404ce5b9acebea2e2c92b28b6ab4e32", "score": "0.5233011", "text": "func New(dbPath string, names []string) (*Storage, error) {\n\tvar str Storage\n\tvar err error\n\n\tif str.Db, err = bolt.Open(dbPath, 0600, nil); err != nil {\n\t\treturn nil, errors.Wrapf(err, \"bold.Open(%s...)\", dbPath)\n\t}\n\n\t// create buckets if needed\n\tfor _, name := range names {\n\t\terr = str.Db.Update(func(tx *bolt.Tx) error {\n\t\t\t_, err = tx.CreateBucketIfNotExists([]byte(name))\n\t\t\tif err != nil {\n\t\t\t\treturn errors.Errorf(\"create bucket: %s\", err)\n\t\t\t}\n\t\t\treturn nil\n\t\t})\n\t\tif err != nil {\n\t\t\treturn nil, errors.Wrapf(err, \"CreateBucketIfNotExists(%s)\", name)\n\t\t}\n\t}\n\n\treturn &str, nil\n}", "title": "" }, { "docid": "2ef7784489e4f4307a2b245223a9e23a", "score": "0.5228756", "text": "func NewStore(o *Options) store.Store {\n\tif o == nil {\n\t\to = &Options{}\n\t}\n\n\tif len(o.Addr) == 0 {\n\t\to.Addr = \"localhost:6379\"\n\t}\n\n\treturn &Store{\n\t\tclient: goredis.NewClient(o),\n\t}\n}", "title": "" }, { "docid": "2e7fddb995008b53c9a05b0a6b35ad62", "score": "0.5222877", "text": "func NewRedisDatastore(address string) (*RedisDatastore, error) {\n\n\tconnectionPool, err := pool.New(\"tcp\", address, 10)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn &RedisDatastore{\n\t\tPool: connectionPool,\n\t}, nil\n}", "title": "" }, { "docid": "1840ae84d01ff808236f2d0d79fe4c2c", "score": "0.5220005", "text": "func CreateStoreAndBootstrap(t *testing.T) (kv.Storage, *domain.Domain) {\n\ttestenv.SetGOMAXPROCSForTest()\n\tstore, err := mockstore.NewMockStore()\n\trequire.NoError(t, err)\n\tdom, err := BootstrapSession(store)\n\trequire.NoError(t, err)\n\treturn store, dom\n}", "title": "" }, { "docid": "e2f35305a67383867dfb1dd3dc46a305", "score": "0.52189976", "text": "func NewStore(cfg Cfg) Store {\n\ts := new(store)\n\ts.cfg = cfg\n\ts.meta = meta.StoreMeta{\n\t\tAddr: cfg.ShardingAddr,\n\t\tClientAddr: cfg.Addr,\n\t\tLabels: cfg.Labels,\n\t}\n\n\ts.resources = make(map[string][]meta.ResourceManager)\n\ts.replicates = &sync.Map{}\n\ts.bootOnce = &sync.Once{}\n\n\ts.runner = task.NewRunner()\n\n\tif s.cfg.storeID != 0 {\n\t\ts.meta.ID = s.cfg.storeID\n\t}\n\n\tif s.cfg.storage != nil {\n\t\ts.storage = s.cfg.storage\n\t}\n\n\tif cfg.shardingTrans != nil {\n\t\ts.trans = cfg.shardingTrans\n\t} else {\n\t\ts.trans = newShardingTransport(s)\n\t}\n\n\tif cfg.seataTrans != nil {\n\t\ts.seataTrans = s.cfg.seataTrans\n\t} else {\n\t\ts.seataTrans = transport.NewTransport(cfg.TransWorkerCount, s.rmAddrDetecter, cfg.TransSendCB)\n\t}\n\n\treturn s\n}", "title": "" }, { "docid": "67ec853bccc3a031c14c4136e37533f8", "score": "0.5217971", "text": "func (m *MetaDB) CreateStore(ctx context.Context, store *store.Store) (*store.Store, error) {\n\tstore.Timestamps = timestamps.New()\n\tkey := m.createStoreKey(store.Key)\n\tmut := ds.NewInsert(key, store)\n\tif err := m.mutateSingle(ctx, mut); err != nil {\n\t\treturn nil, err\n\t}\n\treturn store, nil\n}", "title": "" }, { "docid": "63ca78a15b9ea16a184c92ba744f58a9", "score": "0.52087545", "text": "func newStore() (store *Store) {\n\ts := make(Store, 0)\n\treturn &s\n}", "title": "" }, { "docid": "5093904ca021ade752b50cc09dd0fe70", "score": "0.5188307", "text": "func NewStore(dbs *flushable.SyncedPool, cfg StoreConfig) *Store {\n\ts := &Store{\n\t\tdbs: dbs,\n\t\tcfg: cfg,\n\t\tmainDb: dbs.GetDb(\"gossip-main\"),\n\t\tInstance: logger.MakeInstance(),\n\t}\n\n\ttable.MigrateTables(&s.table, s.mainDb)\n\n\tevmTable := nokeyiserr.Wrap(table.New(s.mainDb, []byte(\"M\"))) // ETH expects that \"not found\" is an error\n\ts.table.Evm = rawdb.NewDatabase(evmTable)\n\ts.table.EvmState = state.NewDatabaseWithCache(s.table.Evm, 16)\n\ts.table.EvmLogs = topicsdb.New(table.New(s.mainDb, []byte(\"L\")))\n\n\ts.initTmpDbs()\n\ts.initCache()\n\ts.initMutexes()\n\n\treturn s\n}", "title": "" }, { "docid": "ebc71ca2572940cfdf94394f065a486f", "score": "0.5188234", "text": "func New(cfg Config, types *runtime.Types, codec store.Codec) (store.Interface, error) {\n\tif len(cfg.Endpoints) == 0 {\n\t\tcfg.Endpoints = []string{\"localhost:2379\"}\n\t}\n\n\tclient, err := etcd.New(etcd.Config{\n\t\tEndpoints: cfg.Endpoints,\n\t\tDialTimeout: dialTimeout,\n\t\tDialKeepAliveTime: keepaliveTime,\n\t\tDialKeepAliveTimeout: keepaliveTimeout,\n\t})\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"error while connecting to etcd: %s\", err)\n\t}\n\n\tcfg.Prefix = strings.Trim(cfg.Prefix, \"/\")\n\tif cfg.Prefix != \"\" {\n\t\tcfg.Prefix = \"/\" + cfg.Prefix\n\t\tclient.KV = namespace.NewKV(client.KV, cfg.Prefix)\n\t\tclient.Lease = namespace.NewLease(client.Lease, cfg.Prefix)\n\t\tclient.Watcher = namespace.NewWatcher(client.Watcher, cfg.Prefix)\n\t}\n\n\t// todo run compactor?\n\n\treturn &etcdStore{\n\t\tclient: client,\n\t\ttypes: types,\n\t\tcodec: codec,\n\t}, nil\n}", "title": "" }, { "docid": "8b9328336e184b89443f618e330e62f2", "score": "0.5186605", "text": "func newStore(sess *session.Session, table string, codec runtime.Codec) *store {\n\tversioner := APIObjectVersioner{}\n\tdb := awsdb.New(sess)\n\n\tif len(table) == 0 {\n\t\ttable = defaultTable\n\t}\n\tdesc, err := CreateTable(db, table)\n\tif err != nil {\n\t\tklog.Fatalf(\"table not active, error : %v\", err)\n\t\treturn nil\n\t}\n\tklog.V(5).Infof(\"Got table(%v) description: %v\", table, desc)\n\n\treturn &store{\n\t\tcodec: codec,\n\t\tversioner: versioner,\n\t\tdbHandler: db,\n\t\ttable: table,\n\t}\n}", "title": "" }, { "docid": "67d163110e36bbff13eaf37951bfe728", "score": "0.51854175", "text": "func CreateNewKVStorage() *KVStorage {\n\treturn &KVStorage{data: make(map[string]string)}\n}", "title": "" }, { "docid": "517f6ffe508d2539fec4d0135e0e090e", "score": "0.51842016", "text": "func NewStore(cfg StoreConfig, eng engine.Engine, nodeDesc *multiraftbase.NodeDescriptor) *Store {\n\tcfg.SetDefaults()\n\n\ts := &Store{\n\t\tcfg: cfg,\n\t}\n\n\ts.raftEntryCache = newRaftEntryCache(16 * 1024 * 1024)\n\ts.scheduler = newRaftScheduler(s, storeSchedulerConcurrency)\n\ts.nodeDesc = nodeDesc\n\ts.sysEng = eng\n\ts.coalescedMu.Lock()\n\ts.coalescedMu.heartbeats = map[multiraftbase.StoreIdent][]multiraftbase.RaftHeartbeat{}\n\ts.coalescedMu.heartbeatResponses = map[multiraftbase.StoreIdent][]multiraftbase.RaftHeartbeat{}\n\ts.coalescedMu.Unlock()\n\ts.Db = client.NewDB(s)\n\ts.draining.Store(false)\n\n\t//if s.cfg.Gossip != nil {\n\t// Add range scanner and configure with queues.\n\tcfg.ScanInterval = 10 * time.Minute\n\tcfg.ScanMaxIdleTime = 200 * time.Millisecond\n\ts.scanner = newReplicaScanner(\n\t\ts.cfg.AmbientCtx, cfg.ScanInterval, cfg.ScanMaxIdleTime, newStoreReplicaVisitor(s),\n\t)\n\ts.raftLogQueue = newRaftLogQueue(s, s.Db)\n\ts.raftSnapshotQueue = newRaftSnapshotQueue(s)\n\ts.transferLeaderQueue = newTransferLeaderQueue(s, s.Db)\n\ts.scanner.AddQueues(s.raftSnapshotQueue, s.raftLogQueue, s.transferLeaderQueue)\n\t//}\n\n\ts.mu.Lock()\n\ts.mu.uninitReplicas = map[multiraftbase.GroupID]*Replica{}\n\ts.mu.Unlock()\n\treturn s\n}", "title": "" }, { "docid": "6e96aba6aedbb7fd573ef113c9ef93ba", "score": "0.5180578", "text": "func (c *Client) CreateDatastore(workspace string, datastore *Datastore) (err error) {\n\tpayload, _ := xml.Marshal(&datastore)\n\tstatusCode, body, err := c.doRequest(\"POST\", fmt.Sprintf(\"/workspaces/%s/datastores\", workspace), bytes.NewBuffer(payload))\n\tif err != nil {\n\t\treturn\n\t}\n\n\tswitch statusCode {\n\tcase 401:\n\t\terr = fmt.Errorf(\"unauthorized\")\n\t\treturn\n\tcase 201:\n\t\treturn\n\tdefault:\n\t\terr = fmt.Errorf(\"unknown error: %d - %s\", statusCode, body)\n\t\treturn\n\t}\n}", "title": "" }, { "docid": "33b438112d6eb5a72b9d91650621fd2d", "score": "0.51781285", "text": "func New(client *redis.Client) *DB {\n\treturn &DB{\n\t\tclient: client,\n\t}\n}", "title": "" } ]
b21c4cb12bee8c645f5dda1954c44207
DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.
[ { "docid": "c4708191ae8d445c39ee48f8a2d731fb", "score": "0.0", "text": "func (in *AwsDmsReplicationTaskList) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "title": "" } ]
[ { "docid": "bd2fb087faf6fd36035969a4647b2674", "score": "0.71806866", "text": "func (in *KmakeRun) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "0a4430654c5a630b94e58b57e1165fa8", "score": "0.7092955", "text": "func (in *FlaskEcho) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "68d14caf7171922b00d89f68fe096ae3", "score": "0.7062947", "text": "func (in *Inference) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "77d4c420de8692d84df6137b4c483b41", "score": "0.704181", "text": "func (in *Version) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "51c7b116933b8ebf439e820b69618123", "score": "0.70403934", "text": "func (in *BuildRun) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "09c39b4213041a54b184e874ef3f440d", "score": "0.7017318", "text": "func (in *Virtlogd) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "2b3a92ab030cd608c8050bd65b7755e9", "score": "0.700895", "text": "func (in *Greetings) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "02a207bd10c79fb598e919429c77ad1b", "score": "0.7004505", "text": "func (in *Zdyfapi) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "bee9a463822e5fee9890aeb1b2d86da6", "score": "0.7000213", "text": "func (in *Darp) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "f348c67e9bc9f5cc2e8dfb3953ee1d29", "score": "0.69834495", "text": "func (in *ConsoleApplication) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "0259175fc24715ebdbd2ea4493cf0768", "score": "0.6976131", "text": "func (in *Generator) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "e79dac2a2bb5859c630f2bd07870d946", "score": "0.6954423", "text": "func (in *Execution) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "7c77f43745302990497cc4cbebbb76ad", "score": "0.6947743", "text": "func (in *SlackBinding) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "24076188584648b7f1bd4ae8b290a868", "score": "0.6941479", "text": "func (in *Kmake) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "2532a0fc2b3f337dcaf07b387fa6d090", "score": "0.69409657", "text": "func (in *VPCLink) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "a883db5a7c29e9bc605c75894201aa28", "score": "0.6917121", "text": "func (in *Command) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "8ad4f43ed923edc24ade90a7da821618", "score": "0.69078887", "text": "func (in *Language) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "759ca181162fbfbf9cf782594593c55f", "score": "0.69062126", "text": "func (in *Denier) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "88cc9b4e36d23f3a712c1ca3de63c2b2", "score": "0.68999183", "text": "func (in *DanmNet) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "01ef96db7917035031e8bed9f7b74205", "score": "0.6899742", "text": "func (in *GitWebHookExecution) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "78552fe6c216b4395a45998e1c100c3d", "score": "0.6899602", "text": "func (in *KmakeRunList) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "1ced4151745d908e17d9dcef3eee8318", "score": "0.6889123", "text": "func (in *Engine) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "b1ef561a8a602cdcafa8754c294d68d8", "score": "0.68881685", "text": "func (in *RelayCore) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "9af3a3c0bb288f6546f8b1015c6d5320", "score": "0.68867046", "text": "func (in *External) DeepCopyObject() runtime.Object {\n\treturn in.DeepCopy()\n}", "title": "" }, { "docid": "39edc8b3a1807a549700e564132d3f84", "score": "0.68793213", "text": "func (in *DanmEp) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "0f393f4d81685440645beb19295246c9", "score": "0.68767834", "text": "func (in *InferenceList) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "936fe0a13d89a613491cc82df7e2694d", "score": "0.68736786", "text": "func (in *Busybox) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "6c35739341d2a4f08265603b2a7db004", "score": "0.6872797", "text": "func (in *Stdio) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "bb10ea74ad5524ff0457c32d3c978784", "score": "0.6868764", "text": "func (in *SlimCNP) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "3cc1db4bcd86e808735592fbd459cfcc", "score": "0.68657804", "text": "func (in *Kubemanager) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "ffd4f9be07665f9707875a568ab33a85", "score": "0.68506706", "text": "func (in *VMSingle) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "3de10c3fd4d74e04ad823a886fd5a87c", "score": "0.6849488", "text": "func (in *Space) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "47873f0593624111dc977964e679e6b1", "score": "0.68396884", "text": "func (in *Build) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "74274e1054ffd74ff956b6c9261df392", "score": "0.6839505", "text": "func (obj *Object) Copy() *Object {\n\tnewObj := &Object{\n\t\tPropertyMap: NewPropertyMap(),\n\t\tclsName: obj.ClassName(),\n\t\tname: obj.Name(),\n\t\tcodes: make([]byte, ObjectCodeSize),\n\t\tlistener: nil,\n\t\tparentNode: nil,\n\t}\n\n\tnewObj.SetCode(newObj.Code())\n\tnewObj.SetParentObject(newObj)\n\tfor _, prop := range obj.Properties() {\n\t\tnewObj.AddProperty(prop.Copy())\n\t}\n\n\treturn newObj\n}", "title": "" }, { "docid": "9918294bbe68763445fa96ff575807cf", "score": "0.68391377", "text": "func (in *KafkaMirrorMaker2) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "686ff00b62204806d68c9301afec2fbd", "score": "0.683787", "text": "func (in *Fluentd) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "6c5bc76a65e2ae38d6a7bfd459a6a652", "score": "0.68377644", "text": "func (s *Stack) DeepCopyObject() runtime.Object {\n\treturn s.clone()\n}", "title": "" }, { "docid": "6c5bc76a65e2ae38d6a7bfd459a6a652", "score": "0.68377644", "text": "func (s *Stack) DeepCopyObject() runtime.Object {\n\treturn s.clone()\n}", "title": "" }, { "docid": "a6650a0619f539964035b77d25c6a0dc", "score": "0.6836174", "text": "func (in *GeneratorClass) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "cec982c248e17e890d06d41e885c72d6", "score": "0.6835318", "text": "func (in *SecretEngine) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "9ce4494bcf223366cae1a86094020740", "score": "0.6832465", "text": "func (in *TestRun) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "b40d62941763c1d416e9d31ab26c911f", "score": "0.6831149", "text": "func (in *Redis) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "f33db046143dcbe474e55a211a421bb0", "score": "0.6830575", "text": "func (in *S2iRun) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "ef5bb17c0e49c4ae9b346443b8498af1", "score": "0.68303144", "text": "func (in *TektonAddon) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "ef5bb17c0e49c4ae9b346443b8498af1", "score": "0.68303144", "text": "func (in *TektonAddon) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "2ddfe99b8b7fa31ec05b187ba14458bc", "score": "0.68301105", "text": "func (in *KVMMachine) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "43e56e8718833d6c7d02a9403f0ec041", "score": "0.6829813", "text": "func (in *GeneratorList) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "a265141112547fcd98d0b7b53401d509", "score": "0.68240345", "text": "func (in *EngineImage) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "fe23113b6735f6d23368bab2a071efec", "score": "0.68224955", "text": "func (in *Blueprint) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "58e2333b9a1c908c9c0d266b9b5cdf60", "score": "0.6821501", "text": "func (in *EphemeralRunner) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "0c081abd84ec361694400b7fcc9b2211", "score": "0.6817182", "text": "func (in *FabricNetwork) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "6ede6d7a19c5f7963af9be00256070a1", "score": "0.68159634", "text": "func (in *SwiftProxy) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "62f7c802c833a12f16a4c20738ecd523", "score": "0.6814963", "text": "func (in *Test) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "e7812f4458e6515c6a27452bf00aea25", "score": "0.6812721", "text": "func (in *BuildRunList) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "01fc2d93032ed81630667f78d3e1dc38", "score": "0.6812673", "text": "func (in *JavaAutoInstrumentation) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "20cbe326359b6bac56eec046752685ab", "score": "0.6811766", "text": "func (in *CommandList) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "b39ae56742f8e4a55802c3e1c63a0851", "score": "0.6805418", "text": "func (in *Iter8ExperimentObject) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "9eb35c69c56bbccc9f564f1808c1b5c5", "score": "0.6803676", "text": "func (in *ConsoleApplicationList) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "541ace7c5e578e9c049a2a3d289066b2", "score": "0.6803128", "text": "func (in *IDPortenClient) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "1ef7c62c12f497bfec5c213d9b3f4c8a", "score": "0.6803092", "text": "func (in *BuildStrategy) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "2e07c0e05bd52a36751946bec246b17b", "score": "0.68028873", "text": "func (in *Method) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "be83456a27bdd9682b5e37ce4124bcf2", "score": "0.68011993", "text": "func (in *DarpList) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "00e766e9282fb1b97758068a17381059", "score": "0.6800433", "text": "func (in *MaskinportenClient) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "1178ba239c9084f6080280983c48febf", "score": "0.6799177", "text": "func (in *GreetingsList) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "e6fe0766cfd26afc546256e8b4bf9c73", "score": "0.67966914", "text": "func (in *KmakeScheduleRun) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "c61d50424f2607139a96ccec62ab594e", "score": "0.6795731", "text": "func (in *GitWebHookReceiver) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "327b61c2e32eb9daeba70bcf2adf557d", "score": "0.67929715", "text": "func (in *GlobalService) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "327b61c2e32eb9daeba70bcf2adf557d", "score": "0.67929715", "text": "func (in *GlobalService) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "611790e4ab42aa6b848b368efd55ad86", "score": "0.6792503", "text": "func (in *FlaskEchoList) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "5f56ff243fdfc6b73a3149d1cf7d5111", "score": "0.6792211", "text": "func (in *AwsDxConnection) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "664f400cfd16cfa554dfb0ce04bf7923", "score": "0.67915076", "text": "func (in *TwitterBinding) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "db04075ecaad0fd07adf97c7813f0122", "score": "0.67899877", "text": "func (in *SlackBindingList) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "636657e7ff806c2716c17562a4a39a7b", "score": "0.67854184", "text": "func (in *VirtlogdList) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "d3bf2a5b1461b6e2df53b8b016718b5c", "score": "0.67853713", "text": "func (in *HyperConverged) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "7572d69b2dd2c987a0dab55ee5c453ea", "score": "0.6785361", "text": "func (in *ExecutionList) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "0787ac40613a17481adcdf5d3b18df65", "score": "0.6784257", "text": "func (in *Sandbox) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "25a155b2a12099e23ed2847a7c8cff50", "score": "0.6780577", "text": "func (in *Addon) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "28b1834196fa8fc1a5eb89fcc30ca68d", "score": "0.6779878", "text": "func (in *Libvirtd) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "f0884fd90ac83bdcb2597f1292a083d0", "score": "0.67783487", "text": "func (in *SQLBinding) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "0d81f07dc543757c389fdc14fd9be70b", "score": "0.6773923", "text": "func (in *Kubernetesenv) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "a9bd994630e8fb7ff880c4e51f5c5581", "score": "0.67686224", "text": "func (in *Signalfx) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "a058a4e0b3f9e8272738bea1d47ab8d9", "score": "0.6763582", "text": "func (in *OracleTarget) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "3c0b20015b422af799f17ab9d80212a7", "score": "0.67625946", "text": "func (in *Ironic) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "77b0964a7705d83567cdc7e3a4a7436a", "score": "0.6761619", "text": "func (in *WebSphereLibertyDump) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "0d3b18387a7316b8f29028755b0b218f", "score": "0.6759072", "text": "func (in *DatafuseComputeInstance) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "0cba259650095753d3251fce10a9bc04", "score": "0.67586976", "text": "func (in *Export) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "fa83ae1dd03485032611d11d7c61e2a8", "score": "0.67583066", "text": "func (in *HostTailer) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "913b3c7e78f4b7eb823878f85d662d68", "score": "0.6751993", "text": "func (in *FireLite) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "7878a187b2dd2ae65f235ffb8fa74edb", "score": "0.67489916", "text": "func (in *EmbeddedTest) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "4040ab9c4c5d9d7bc04e048091e59b3d", "score": "0.6746313", "text": "func (in *EnterpriseRecyclerList) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "946f36ccf29de0396d2b5a10ec2f68bf", "score": "0.67449003", "text": "func (in *DanmEpList) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "f9a8c3e1101326cc84345d76a2004394", "score": "0.67444307", "text": "func (in *VPCLinkList) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "2dce76d7c9f55603b041e9ed5af5500f", "score": "0.67414635", "text": "func (in *Memcached) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "2dce76d7c9f55603b041e9ed5af5500f", "score": "0.67414635", "text": "func (in *Memcached) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "6ffb7ee075d003d884c6708fc7694c95", "score": "0.6741413", "text": "func (in *User) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "a19163503cbb2065582d4673b9da35f6", "score": "0.67413336", "text": "func (in *TestType1) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "2a6bf7c07d324afcfd7d6c1247718e9e", "score": "0.67400783", "text": "func (in *PodView) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "d5bc98c1ff2d063db4c0b73e98f862f1", "score": "0.67338455", "text": "func (in *Cassandra) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "d5bc98c1ff2d063db4c0b73e98f862f1", "score": "0.67338455", "text": "func (in *Cassandra) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "721fd0405d9ea9652d3b07de0694a458", "score": "0.6731889", "text": "func (in *PodViewList) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "372bfcf115165dda2d8039086eef76ca", "score": "0.67314243", "text": "func (in *BusyboxList) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "title": "" } ]
4c4f3247055b97e9e410294e69ed14d0
/ A POST to /hash should accept a password; it should return a job identifier immediate; it should then wait 5 seconds and compute the password hash. The hashing algorithm should be SHA512. Also track the time of a hash request, for use by GetStats. Handler for the /hash endpoint
[ { "docid": "bed4c50214fedc1d4f070c628feb20dd", "score": "0.76005536", "text": "func PostHash(d *data.Data) http.Handler {\n return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {\n\n // Track hash time\n start := time.Now()\n\n defer r.Body.Close()\n\n val, err := ioutil.ReadAll(r.Body)\n if err != nil {\n http.Error(w, \"error reading data\", http.StatusBadRequest)\n return\n }\n\n // valildate the expected input\n sVal := strings.Split(string(val), \"=\")\n if len(sVal) != 2 || sVal[0] != \"password\" {\n http.Error(w, \"invalida data\", http.StatusBadRequest)\n return\n }\n\n // Add a job and get its jobId\n jobId := d.AddJob()\n\n // Compute hash in goroutine\n go d.ComputeHash(jobId, string(sVal[1]))\n\n // Write the response, the jobId\n w.WriteHeader(http.StatusCreated)\n fmt.Fprintf(w, \"%d\", jobId)\n\n // Record the hash time\n elapsed := time.Since(start)\n d.AddToHashTime(elapsed.Nanoseconds())\n })\n}", "title": "" } ]
[ { "docid": "7ddfdf5ab2b7a7f270d319f23326372b", "score": "0.7951232", "text": "func hashPostHandler(w http.ResponseWriter, r *http.Request) {\n log.Println(\"/hash POST request received\")\n\n processStartTime := time.Now()\n\n // ensure request is POST method\n if r.Method != http.MethodPost { // Only POST is supported\n http.Error(w, \"405 Method Not Allowed\", 405)\n return\n }\n\n // check for request body and password\n password := passwordFromRequest(r.Body)\n if password == \"\" {\n http.Error(w, \"400 Bad Request\", 400)\n return\n }\n\n // generate and return a token for this request\n token := generateHashToken()\n w.Write([]byte(token))\n\n // per interview requirements, schedule actual password hashing 5 seconds from now\n go func() {\n pendingHashingTasksMutex.Lock()\n pendingHashingTasks[token] = time.Now().Unix()\n pendingHashingTasksMutex.Unlock()\n time.Sleep(1000 * 5 * time.Millisecond)\n\n // SHA512 hash the password, then base64\n base64HashedPassword := base64_hash(password)\n\n // remove, hashing task completed\n pendingHashingTasksMutex.Lock()\n delete(pendingHashingTasks, token)\n pendingHashingTasksMutex.Unlock()\n\n processEndTime := time.Now()\n duration := processEndTime.Sub(processStartTime)\n\n //////////////////////////////////////////////\n // update totalTimeSpent in a thread-safe manner\n totalTimeSpentMutex.Lock()\n\n hashedPasswords[token] = base64HashedPassword // store token with hashed password\n totalTimeSpent += duration.Nanoseconds()\n\n totalTimeSpentMutex.Unlock()\n //////////////////////////////////////////////\n }()\n}", "title": "" }, { "docid": "81d096ab6b40fa4da2312813b9ba656b", "score": "0.7585514", "text": "func hashEndpoint(w http.ResponseWriter, req *http.Request) {\n\n // inital time of request\n start := time.Now().Nanosecond() / 1000\n \n passwd := \"\"\n\n switch req.Method {\n // technically not supporting GET Methods\n case \"GET\":\n\t for k, v := range req.URL.Query() {\n\t fmt.Printf(\"%s: %s\\n\", k, v)\n \t }\n case \"POST\":\n \t if err := req.ParseForm(); err != nil {\n\t fmt.Printf(\"ERROR parsing form: %s\", err)\n \t } else {\n\t passwd = req.Form.Get(\"password\")\n\t }\n }\n\n // end time of request - processed the password, not going to include the time to REPOST\n \n // Technically the the task states that we need to provide the average number of microseconds\n // to process the requests to the /hash endpoint. It does NOT state that we need to process\n // the average time to /hash and its sub-endpoints\n end := time.Now().Nanosecond() / 1000\n\n // only write valid handles back\n if len(passwd) > 0 {\n // write the value back to the user that sent the request\n sm := state.GetStateManager()\n\n updated_hash_request := sm.CreateRequest(int(end-start))\n\n fmt.Fprintf(w, \"%d\", updated_hash_request)\n\n // first use of a true go routine\n // Necessary with this design because the write or Fprintf\n // was waiting until the end of the function before we would\n // received it at the client, causing ~5 delay just to get the request id\n go associateHash(passwd, updated_hash_request, 5)\n \n } else {\n fmt.Fprintf(w, \"Error: no password provided\")\n }\n}", "title": "" }, { "docid": "f4d961a8f0a843aeb125a522a4e409b9", "score": "0.75505525", "text": "func (server Serve) hash(w http.ResponseWriter, req *http.Request) {\n\t// if the shutdown signal was sent, no more requests should be made\n\tif server.isStopping {\n\t\tw.Write([]byte(\"Server is shutting down, no more requests\"))\n\t\treturn\n\t}\n\n\t// the waitgroup for handling if their are still requests in process\n\tserver.wg.Add(1)\n\tdefer server.wg.Done()\n\n\tswitch req.Method {\n\tcase \"POST\":\n\n\t\terr := req.ParseForm()\n\t\tif err != nil {\n\t\t\tpanic(err)\n\t\t}\n\t\t// Perform the hashing\n\t\tinput := req.Form.Get(\"password\")\n\t\thmac512 := hmac.New(sha512.New, []byte(\"secret\"))\n\t\thmac512.Write([]byte(input))\n\t\thashed_code := base64.StdEncoding.EncodeToString(hmac512.Sum(nil))\n\n\t\tserver.returnId(w, hashed_code)\n\t\t// Keeping the socket open for 5 seconds. This may be wrong, but I do not know enough\n\t\t// about sockets and 'keep alve' to know for sure.\n\t\ttime.Sleep(5 * time.Second)\n\n\t\tlog.Println(hashed_code)\n\t\tw.Write([]byte(hashed_code))\n\n\tcase \"GET\":\n\t\tid_str := req.URL.Path[len(\"/hash/\"):]\n\t\tid, err := strconv.Atoi(id_str)\n\t\tif err != nil {\n\t\t\tlog.Fatal(\"Could not get ID\")\n\t\t}\n\t\thash := server.passMap[id]\n\t\tw.Write([]byte(hash))\n\n\tdefault:\n\t\tlog.Println(\"You didnt Post/GEt\")\n\t}\n}", "title": "" }, { "docid": "4c93deb6770cf7b25bd9febfe75d448f", "score": "0.75242615", "text": "func createHash(response http.ResponseWriter, request *http.Request) {\n\tlog.Print(\"POST hash\");\n\t\n\t// Check for shutdown\n\tif(isShutdown == true) {\n\t\thttp.Error(response, \"503 Service unavailable.\", http.StatusServiceUnavailable)\n\t\tlog.Print(\"POST hash: 503 Service unavailable\");\n\t\treturn\n\t}\n\t\n\t// Only allow POST requests\n\tif request.Method != http.MethodPost {\n\t\thttp.Error(response, \"405 Method not allowed.\", http.StatusMethodNotAllowed)\n\t\tlog.Print(\"POST hash: 405 Method not allowed\");\n\t\treturn\n\t}\n\t\n\t// Keep track of request stats\n\tdefer statsTracker(time.Now())\n\t\n\t// Get the password from the POST form\n\tpassword := request.PostFormValue(\"password\");\n\tif password == \"\" {\n\t\thttp.Error(response, \"400 Bad request.\", http.StatusBadRequest)\n\t\tlog.Print(\"POST hash: 400 Bad request\");\n\t\treturn\n\t}\n\t\n\t// Convert string to bytes\n\tpasswordBytes := []byte(password)\n\t\n\t// Calculate SHA512 Hash\n\thasher := sha512.New()\n\thasher.Write(passwordBytes)\n\t\n\t// Convert to base 64 encoding\n\thash64 := base64.StdEncoding.EncodeToString(hasher.Sum(nil))\n\t\n\t// Get ID\n\tid := idCounter.FetchAndIncrement();\n\t\n\t// delay storing the hash in the map for 5 second\n\ttimer := time.NewTimer(5 * time.Second)\n\tgo func() {\n\t\t// Wait 5 seconds\n\t\t<-timer.C\n\t\t\n\t\t// Store in map\n\t\tm[id] = hash64;\n\t}()\n\t\n\tfmt.Fprintf(response, \"%d\", id)\n\t\n\tlog.Print(\"POST hash: id=\", id);\n\tlog.Print(\"POST hash: Done\");\n}", "title": "" }, { "docid": "847b58cd43742bd888ff7b6ca352f91a", "score": "0.7483298", "text": "func hashHandler(w http.ResponseWriter, r *http.Request) {\n\tif shuttingDown {\n\t\tw.WriteHeader(http.StatusServiceUnavailable)\n\t\tw.Write([]byte(\"503 - Service Unavailable - shutting down\"))\n\t\treturn\n\t}\n\tupCounter()\n\tr.ParseForm()\n\tpassword := r.FormValue(\"password\")\n\tif password == \"\" {\n\t\tw.WriteHeader(http.StatusBadRequest)\n\t\tw.Write([]byte(\"400 - Bad Request - password field missing or invalid\"))\n\t\treturn\n\t}\n\ttime.Sleep(5 * time.Second)\n\tpwHash := jchash.HashPassword(password)\n\tw.Write([]byte(pwHash))\n\tdownCounter()\n}", "title": "" }, { "docid": "5d14885a74c23aaa402afe4a7d405353", "score": "0.7232757", "text": "func (svr *ServerType) HashPassword(resp http.ResponseWriter, req *http.Request) {\r\n\tnow := time.Now() //Duration is customer experience. Prioritize this metric over checking shutdown\r\n\tsvr.mux.RLock()\r\n\tstop := svr.shutdown\r\n\tsvr.mux.RUnlock()\r\n\tif stop {\r\n\t\t//Uncomment to provide a shutdown response\r\n\t\t//resp.Write([]byte(fmt.Sprintf(\"Shutting service down\\n\")))\r\n\t\treturn\r\n\t}\r\n\t//pathArgs := strings.Split(strings.Trim(req.URL.Path, \"/\"), \"/\")\r\n\t//m, _ := url.ParseQuery(req.URL.RawQuery)\r\n\t//svr.infoLog.Printf(\"Path args: %+v, raw %s, m %+v\\n\", pathArgs, req.URL.RawQuery, m)\r\n\tvar passwd types.HashData\r\n\r\n\t//If JSON header exists, process as JSON. If not, parse form data.\r\n\tuseJSON := false\r\n\tif req.Header.Get(\"Content-type\") == \"application/json\" {\r\n\t\terr := decodeBody(req, &passwd)\r\n\t\tif err != nil {\r\n\t\t\trespondErr(resp, req, http.StatusBadRequest, \" Failed to decode body: \", err)\r\n\t\t\tsvr.errorLog.Printf(\"Error in HashPassword: %v\", err)\r\n\t\t\treturn\r\n\t\t}\r\n\t\tuseJSON = true\r\n\t} else {\r\n\t\treq.ParseForm()\r\n\t\tvalue, ok := req.Form[\"password\"]\r\n\t\tif ok {\r\n\t\t\tpasswd.Password = value[0]\r\n\t\t} else {\r\n\t\t\tresp.Write([]byte(fmt.Sprintf(\"Bad request: No password. Use \\\"password=<value>\\\"\\n\")))\r\n\t\t\tsvr.errorLog.Printf(\"Error in HashPassword: No password. Use \\\"password=<value>\\\"\")\r\n\t\t\treturn\r\n\t\t}\r\n\t}\r\n\r\n\tvar safeHead int\r\n\tswitch req.Method {\r\n\tcase \"POST\":\r\n\t\tsvr.mux.Lock()\r\n\t\tsvr.Head++\r\n\t\tsafeHead = svr.Head\r\n\t\tsvr.IDMap[safeHead] = types.IDData{Password: passwd.Password, FirstCall: now}\r\n\t\telapsed := time.Since(now)\r\n\t\tsvr.Average = ((svr.Average + elapsed.Nanoseconds()) / int64(safeHead))\r\n\t\tsvr.mux.Unlock()\r\n\r\n\t\t//Wait for 5 seconds before calculating hash\r\n\t\tgo func() {\r\n\t\t\ttime.Sleep(time.Second * 5)\r\n\t\t\thashedPW := hashAndEncode(passwd.Password)\r\n\t\t\tsvr.mux.Lock()\r\n\t\t\tsvr.IDMap[safeHead] = types.IDData{Password: hashedPW, FirstCall: now}\r\n\t\t\tsvr.mux.Unlock()\r\n\t\t}()\r\n\r\n\t\t//Meanwhile, write out the ID to an http response after incrementing head position above\r\n\t\tif useJSON {\r\n\t\t\trespond(resp, req, http.StatusOK, &types.HashData{Password: passwd.Password, ID: safeHead})\r\n\t\t} else {\r\n\t\t\tresp.Write([]byte(fmt.Sprintf(\"%s\\n\", strconv.Itoa(safeHead))))\r\n\t\t}\r\n\t\tsvr.infoLog.Printf(\"Response return for HashPassword: %v\", types.HashData{Password: passwd.Password, ID: safeHead})\r\n\t\treturn\r\n\tdefault:\r\n\t\tif useJSON {\r\n\t\t\trespondHTTPErr(resp, req, http.StatusBadRequest)\r\n\t\t} else {\r\n\t\t\tresp.Write([]byte(fmt.Sprintf(\"Bad request: No POST\\n\")))\r\n\t\t}\r\n\t\tsvr.errorLog.Printf(\"Error in HashPassword: %v\", types.HashData{Password: passwd.Password, ID: safeHead})\r\n\t\treturn\r\n\t}\r\n}", "title": "" }, { "docid": "09b0454ce6d159e5354bd76642c31baa", "score": "0.7095068", "text": "func newHandleHash(stats *Statistics) func(w http.ResponseWriter, r *http.Request) {\n\treturn func(w http.ResponseWriter, r *http.Request) {\n\t\tstartTime := time.Now()\n\t\ttimer := time.NewTimer(hashResponseTime * time.Second)\n\t\tlog.Println(\"INFO: Received request:\", r)\n\n\t\t//verify correct method\n\t\tif r.Method != \"POST\" {\n\t\t\twriteMethodNotAllowed(w, \"POST\")\n\t\t\tlog.Println(\"ERROR: Received invalid /hash request method\")\n\t\t\treturn\n\t\t}\n\n\t\t//calculate the encoded hash\n\t\thasher := sha512.New()\n\t\terr := readBodyIntoHash(r, hasher)\n\t\tif err != nil {\n\t\t\twriteBadRequest(w)\n\t\t\tlog.Println(\"ERROR: Unable to decode body in POST /hash request\")\n\t\t\treturn\n\t\t}\n\t\tsha := base64.StdEncoding.EncodeToString(hasher.Sum(nil))\n\t\tlog.Println(\"INFO: Calculated encoded hash\", sha)\n\n\t\t//write the response\n\t\trespBody := HashResponseBody{sha}\n\t\tmarshalledResp, err := json.Marshal(respBody)\n\t\tif err != nil {\n\t\t\twriteInternalServer(w)\n\t\t\treturn\n\t\t}\n\t\tw.WriteHeader(http.StatusOK)\n\t\tw.Write(marshalledResp)\n\n\t\t//calculate the latency\n\t\tlatency := time.Now().Sub(startTime)\n\t\tlatencyMs := int(latency.Nanoseconds() / 1000)\n\t\tgo stats.add(latencyMs)\n\n\t\t//wait for the timer to expire\n\t\t<-timer.C\n\t\tlog.Println(\"INFO: Request complete\")\n\t}\n}", "title": "" }, { "docid": "8487a610f0a8d01988b1806525e0bf43", "score": "0.6981377", "text": "func hashGetHandler(w http.ResponseWriter, r *http.Request) {\n log.Println(\"/hash/<token> GET request received\")\n\n // ensure request is GET method\n if r.Method != http.MethodGet { // Only GET is supported\n http.Error(w, \"405 Method Not Allowed\", 405)\n return\n }\n\n // ensure token was provided in the request\n token := tokenFromHashGetRequestURL(r.URL)\n if token == \"\" {\n http.Error(w, \"400 Bad Request\", 400)\n return\n }\n\n totalTimeSpentMutex.Lock()\n base64HashedPassword := hashedPasswords[token]\n totalTimeSpentMutex.Unlock()\n\n if base64HashedPassword == \"\" { // result not yet available or not found\n http.Error(w, \"404 Not Found\", 404)\n return\n }\n\n // return the base64HashedPassword\n w.Write([]byte(base64HashedPassword))\n}", "title": "" }, { "docid": "1a3291a70fd0f03ae2f40ddc9b727ee7", "score": "0.68109405", "text": "func HashHandlerFunc(w http.ResponseWriter, req *http.Request) {\n\tif req.Method == http.MethodPost {\n\t\terr := req.ParseForm()\n\t\tif err != nil {\n\t\t\tpanic(err)\n\t\t}\n\t\tpassword := req.PostFormValue(\"password\")\n\n\t\t//time.sleep is okay to use here\n\t\t//the HTTP handler is run in a separate goroutine for each request so it is non-blocking\n\t\t//This is verified in the TestHashHandlerFunc in ./routes_test.go\n\t\ttime.Sleep(5 * time.Second)\n\t\tio.WriteString(w, util.EncryptPassword(password))\n\t} else {\n\t\tw.WriteHeader(http.StatusNotFound)\n\t\tio.WriteString(w, \"404: Not Found\")\n\t}\n}", "title": "" }, { "docid": "9eb7138a32d8b8e3d49a44fb72a7c738", "score": "0.678492", "text": "func GetHashHandler(w *worker.HashWorker) http.HandlerFunc {\n\thash := hashHandler{\n\t\tworker: w,\n\t}\n\n\treturn func(w http.ResponseWriter, r *http.Request) {\n\t\tif r.Method == \"POST\" {\n\t\t\t//The worker was terminated, no new requests can be processed\n\t\t\tif !hash.worker.IsRunning() {\n\t\t\t\tw.WriteHeader(http.StatusForbidden)\n\t\t\t\treturn\n\t\t\t}\n\n\t\t\tfmt.Println(\"Generating Hash\")\n\n\t\t\tpassword := r.URL.Query().Get(\"password\")\n\n\t\t\trequestID := hash.worker.NewRequest(password)\n\n\t\t\tw.WriteHeader(http.StatusCreated)\n\t\t\tw.Header().Add(\"location\", fmt.Sprintf(\"http://localhost:8080/hash/%d\", requestID))\n\t\t\tw.Write([]byte(strconv.Itoa(requestID)))\n\n\t\t\treturn\n\t\t}\n\n\t\tif r.Method == \"GET\" {\n\t\t\tfmt.Println(\"Getting Hash\")\n\n\t\t\tpath := r.URL.Path\n\t\t\tlastSlash := strings.LastIndex(path, \"/\")\n\n\t\t\tif lastSlash == -1 {\n\t\t\t\tfmt.Println(\"Missing requestID\")\n\t\t\t\tw.WriteHeader(http.StatusBadRequest)\n\t\t\t\treturn\n\t\t\t}\n\n\t\t\tsegment := path[lastSlash+1]\n\t\t\tvar encoded = \"\"\n\n\t\t\tif requestID, error := strconv.Atoi(string(segment)); error == nil {\n\t\t\t\thashResponse := hash.worker.GetRequest(requestID)\n\n\t\t\t\t//The hash generated is the raw bytes, need to convert it to a base64 encoded string\n\t\t\t\tencoded = base64.StdEncoding.EncodeToString(hashResponse.Hash)\n\t\t\t}\n\n\t\t\tw.WriteHeader(http.StatusOK)\n\t\t\tw.Write([]byte(encoded))\n\n\t\t\treturn\n\t\t}\n\n\t\tfmt.Println(\"No Route Found\")\n\n\t\tw.WriteHeader(http.StatusNotFound)\n\t}\n}", "title": "" }, { "docid": "3343903194b6d6784ce9f1292350b70d", "score": "0.6651373", "text": "func associateHash(passwd string, request_id int, sleep_time_secs int) {\n if len(passwd) > 0 {\n \n // instructions said that the hash SHOULD NOT be computed for 5 seconds\n // technically it doesn't matter when it is computed, just don't do anything\n // with it for 5 seconds, but let's follow instructions\n time.Sleep(5 * time.Second)\n\n hasher := sha512.New()\n hasher.Write([]byte(passwd))\n\n // assuming URL encoding due to the nature of the tasking\n // Can just as easily make this StdEncoding\n url_encoded_str := base64.URLEncoding.EncodeToString(hasher.Sum(nil))\n\n // add the map entry here\n sm := state.GetStateManager()\n sm.AddHash(strconv.Itoa(request_id), url_encoded_str)\n }\n}", "title": "" }, { "docid": "bdfa36abf7b57bd88acd53f33c2b6389", "score": "0.6412349", "text": "func fetchHash(response http.ResponseWriter, request *http.Request) {\n\tlog.Print(\"GET hash\");\n\t// Check for shutdown\n\tif(isShutdown == true) {\n\t\thttp.Error(response, \"503 Service unavailable.\", http.StatusServiceUnavailable)\n\t\tlog.Print(\"GET hash: 503 Service unavailable\");\n\t\treturn\n\t}\n\t\n\t// Only allow GET requests\n\tif request.Method != http.MethodGet {\n\t\thttp.Error(response, \"405 Method not allowed.\", http.StatusMethodNotAllowed)\n\t\tlog.Print(\"GET hash: 405 Method not allowed\");\n\t\treturn\n\t}\n\t\n\t// Parse the id from the path\n\tp := strings.Split(request.URL.Path, \"/\")\n\tvar id int64\n\tvar err error\n\tid, err = strconv.ParseInt(p[len(p)-1], 10, 64)\n\tif(err != nil) {\n\t\thttp.Error(response, \"400 Bad request.\", http.StatusBadRequest)\n\t\tlog.Print(\"GET hash: 400 Bad request, id=\", id);\n\t\treturn\n\t}\n\t\n\tlog.Print(\"GET hash: id=\", id);\n\t\n\t// lookup the hashed password\n\thash := m[id]\n\t\n\t// Did we find the hashed password?\n\tif(hash == \"\") {\n\t\thttp.Error(response, \"404 Not found.\", http.StatusNotFound)\n\t\tlog.Print(\"GET hash: 404 Not found\");\n\t\treturn\n\t}\n\t\n\tfmt.Fprintf(response, \"%s\", hash)\n\tlog.Print(\"GET hash: Done\");\n}", "title": "" }, { "docid": "05b24d28ea94078a264ea49734f6dd9b", "score": "0.62714475", "text": "func handleHashRequest_rootOnly(w http.ResponseWriter, req *http.Request) {\n\tstartTime := time.Now()\n\n\t// Do the one time read of req.Body data (it is an io.ReadCloser which is strictly read-once)\n\tbodyData, err := ioutil.ReadAll(req.Body)\n\tif err != nil {\n\t\tlog.Print(err)\n\t\treturn\n\t}\n\t// From the Golang doc at https://golang.org/pkg/net/http/:\n\t//\t\"The HTTP Client's Transport is responsible for calling the Close method\"\n\t//\t\"The Server will close the request body. The ServeHTTP Handler does not need to.\"\n\t//\t-> We only need to close this if we're a client and not a server\n\t//req.Body.Close()\n\n\tqueryVals, err := parseURLParams(req, &bodyData)\n\tif err != nil {\n\t\tlog.Print(err)\n\t\treturn\n\t}\n\n\tparamVals, paramExists := queryVals[\"password\"]\n\tif (paramExists) {\n\t\tpwPlainText := paramVals[0]\n\t\thashVal := sha512.Sum512([]byte(pwPlainText))\n\n\t\tpasswordDataMutex.Lock()\n\t\tpasswordData = append(passwordData, passwordDataElement{\n\t\t\trequestedTime: startTime,\n\t\t\tencodedPasswordHash: base64.StdEncoding.EncodeToString(hashVal[:]),\n\t\t})\n\t\tpassID := len(passwordData)\n\t\tpasswordDataMutex.Unlock()\n\t\tfmt.Fprint(w, passID, \"\\n\")\n\t} else {\n\t\tfmt.Fprint(w, \"Error: no password given\\n\")\n\t}\n\n\tserverStats.Lock()\n\tserverStats.newHashNumRequests++\n\tserverStats.newHashNSecs += time.Now().Sub(startTime).Nanoseconds()\n\tserverStats.Unlock()\n}", "title": "" }, { "docid": "c231badbc4baa2f881b5750283f0b87c", "score": "0.61589617", "text": "func (e Endpoints) Hash(ctx context.Context, password string) (string, error) {\n\treq := HashRequest{Password: password}\n\tresp, err := e.HashEndpoint(ctx, req)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\thashResp := resp.(HashResponse)\n\tif hashResp.Err != \"\" {\n\t\treturn \"\", errors.New(hashResp.Err)\n\t}\n\treturn hashResp.Hash, nil\n}", "title": "" }, { "docid": "0c663068a1e47bbb8ba86fb8e5c6e285", "score": "0.6119079", "text": "func Hash(password string) (string, error) {\n\tif len(strings.TrimSpace(password)) == 0 {\n\t\treturn \"\", errors.New(\"password cannot be empty\")\n\t}\n\tsalt, err := generateSalt()\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\n\tunencodedHash := argon2.IDKey([]byte(password), []byte(salt), time, memory, parallelism, keyLen)\n\tencodedHash := base64.StdEncoding.EncodeToString(unencodedHash)\n\tphc := fmt.Sprintf(\"$%s$m=%d,t=%d,p=%d$%s$%s\", id, memory, time, parallelism, salt, encodedHash)\n\treturn phc, nil\n}", "title": "" }, { "docid": "a9544f321a3a5e9d3f170a8a1df13a57", "score": "0.6033594", "text": "func GetHashToCrack(w http.ResponseWriter, req *http.Request) {\n fmt.Println(w, \"getting hash to crack\")\n decoder := json.NewDecoder(req.Body)\n var t model.HashInfo\n err := decoder.Decode(&t)\n if err != nil {\n panic(err)\n }\n defer req.Body.Close()\n var result model.StartInfo\n\n result.StartHash = service.GetHashToCrack(t.Hash)\n result.Iterations = service.GetConfiguration().Iterations\n result.Algorithm = \"MD5\"\n b := new(bytes.Buffer)\n json.NewEncoder(b).Encode(result)\n fmt.Fprintln(w, b)\n\n}", "title": "" }, { "docid": "3cd51f7be6005373c6de3fe51d448f76", "score": "0.59979606", "text": "func createHash(password string) (string, error) {\n\tsalt := make([]byte, slatBytes)\n\t_, err := rand.Read(salt)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\n\thash := pbkdf2.Key([]byte(password), salt, pbkdf2Iterations, hashBytes, sha512.New)\n\n\t/* format: algorithm:iterations:salt:hash */\n\treturn fmt.Sprintf(\n\t\t\"%s:%d:%s:%s\", \"sha512\", pbkdf2Iterations,\n\t\tbase64.StdEncoding.EncodeToString(salt), base64.StdEncoding.EncodeToString(hash),\n\t), err\n}", "title": "" }, { "docid": "94df629d01ebdf6b8333f25f77f7ee6b", "score": "0.59676355", "text": "func makeFunc_handleHashRequest() func\n\t(w http.ResponseWriter, req *http.Request,\n) {\n\tcompiledNewHashRegex := regexp.MustCompile(\"/hash/*$\")\n\tcompiledHashIDRegex := regexp.MustCompile(\"/hash/([0-9]+)/*$\")\n\n\treturn func (w http.ResponseWriter, req *http.Request) {\n\t\tif compiledNewHashRegex.MatchString(req.RequestURI) {\n\t\t\thandleHashRequest_rootOnly(w, req)\n\t\t\treturn\n\t\t} else if matchedStrings := compiledHashIDRegex.FindStringSubmatch(req.RequestURI); len(matchedStrings) == 2 {\n\t\t\ti, err := strconv.Atoi(matchedStrings[1])\n\t\t\tif err != nil {\n\t\t\t\thttp.NotFound(w, req) // somehow this didn't translate (the previous regex should have made this impossible) - send 404 response\n\t\t\t\treturn\n\t\t\t}\n\n\t\t\tvar encodedPasswordHash string\n\t\t\tencodedPasswordHashAvailable := false\n\t\t\tpasswordDataMutex.RLock()\n\t\t\tif (1 <= i) && (i <= len(passwordData)) && (time.Since(passwordData[i-1].requestedTime).Seconds() >= 5) {\n\t\t\t\tencodedPasswordHashAvailable = true\n\t\t\t\tencodedPasswordHash = passwordData[i-1].encodedPasswordHash\n\t\t\t}\n\t\t\tpasswordDataMutex.RUnlock()\n\n\t\t\tif encodedPasswordHashAvailable {\n\t\t\t\tio.WriteString(w, encodedPasswordHash + \"\\n\")\n\t\t\t\treturn\n\t\t\t} else {\n\t\t\t\thttp.NotFound(w, req) // no pattern matched (no corresponding hash ID available yet) - send 404 response\n\t\t\t\treturn\n\t\t\t}\n\t\t} else {\n\t\t\thttp.NotFound(w, req) // no pattern matched (an invalid ID was given) - send 404 response\n\t\t\treturn\n\t\t}\n\t}\n}", "title": "" }, { "docid": "ae6a852c27d08ba7f92aa6228190cab5", "score": "0.5936346", "text": "func HashPassword(qr *queryRunner, pass string) (string, error) {\n\t// Hashing parameters\n\tconst saltLenBytes = 16\n\tconst iterations = 25000\n\tconst hashLenBytes = 64\n\n\tif qr.secSalt == \"\" {\n\t\t// Retrieve the database-specific random salt\n\t\tsecuritySalt, err := qr.Query(\"SELECT value FROM keys WHERE name='SECURITY_PASSWORD_SALT';\")\n\t\tif err != nil {\n\t\t\treturn \"\", err\n\t\t}\n\t\tqr.secSalt = securitySalt\n\t}\n\n\t// This looks strange, but the algorithm really does use the byte\n\t// representation of the string (i.e. string isn't base64 or other\n\t// encoding format)\n\tsaltBytes := []byte(qr.secSalt)\n\n\t// Generate a \"new\" password derived from the provided password\n\t// Satisfies OWASP sec. 2.4.5: 'provide additional iteration of a key derivation'\n\tmac := hmac.New(sha512.New, saltBytes)\n\tmac.Write([]byte(pass))\n\tmacBytes := mac.Sum(nil)\n\tmacBase64 := base64.StdEncoding.EncodeToString(macBytes)\n\n\t// Generate random salt for the pbkdf2 run, this is the salt that ends\n\t// up in the salt field of the returned hash\n\thashSalt := make([]byte, saltLenBytes)\n\tif _, err := rand.Read(hashSalt); err != nil {\n\t\treturn \"\", err\n\t}\n\n\thashed := pbkdf2.Key([]byte(macBase64), hashSalt, iterations, hashLenBytes, sha512.New)\n\n\t// Base64 encode and convert to storage format expected by Flask-Security\n\tsaltEncoded := strings.ReplaceAll(base64.RawStdEncoding.EncodeToString(hashSalt), \"+\", \".\")\n\tkeyEncoded := strings.ReplaceAll(base64.RawStdEncoding.EncodeToString(hashed), \"+\", \".\")\n\n\treturn fmt.Sprintf(\"$pbkdf2-sha512$%d$%s$%s\", iterations, saltEncoded, keyEncoded), nil\n}", "title": "" }, { "docid": "9d25310cfaa28e426dd94b079835e594", "score": "0.58391404", "text": "func hashPassword(password []byte) (*hashed, error) {\n\n if countLog2 < MinHashCount {\n countLog2 = DefaultHashCount\n }\n p := new(hashed)\n p.count = countLog2\n\n newSalt, err := generateSalt(countLog2)\n if err != nil {\n return nil, err\n }\n p.salt = newSalt\n\n hash, err := encrypt(password, p.salt)\n if err != nil {\n return nil, err\n }\n p.hash = hash\n return p, err \n}", "title": "" }, { "docid": "8c538c8a7a919041f801194f73c3f918", "score": "0.5838029", "text": "func GeneratePasswordHash(password string) string {\n\tHash := sha512.New()\n\tBytes := []byte(password + HASH_SALT)\n\tResult := Hash.Sum(Bytes)\n\treturn base64.URLEncoding.EncodeToString(Result)\n}", "title": "" }, { "docid": "0b35498f4614bc56b93a817cfd99ad13", "score": "0.5827116", "text": "func (ps passwordService) Hash(password string) (string, error) {\n\tp, err := bcrypt.GenerateFromPassword([]byte(password), ps.cost)\n\n\tif err != nil {\n\t\treturn \"\", fmt.Errorf(\"bcrypt: create password: %w\", err)\n\t}\n\n\treturn string(p), nil\n}", "title": "" }, { "docid": "e9bcb413aa01801468fc16e7972882d3", "score": "0.58036906", "text": "func main() {\n\n url := \"http://localhost:8080\"\n hash_url := url + \"/hash\"\n getHash_url := url + \"/hash/\"\n stats_url := url + \"/stats\"\n\n var data = \"password=angryMonkey\"\n\n getUrl(stats_url)\n\n for i := 0; i<1010; i++ {\n go postUrl(hash_url, data)\n time.Sleep(time.Millisecond)\n }\n\n // Note, only getting the first 1000 hashes\n for j := 1; j<=1000; j++ {\n get_url := getHash_url + strconv.Itoa(j)\n getUrl(get_url)\n getUrl(stats_url)\n\n time.Sleep(1 * time.Millisecond)\n }\n\n get_url := getHash_url + strconv.Itoa(1000)\n\n getUrl(get_url)\n getUrl(stats_url)\n\n}", "title": "" }, { "docid": "2387db5fea0c47cd995839bc965e5d3e", "score": "0.57873726", "text": "func NewHashHandler(stats *model.Stats, waitGroup *sync.WaitGroup) *HashHandler {\n\th := new(HashHandler)\n\th.keyStore = make(map[int]string)\n\th.run.Store(true)\n\th.delay = 5 * time.Second\n\th.stats = stats\n\th.hasher = NewHasher()\n\th.waitGroup = waitGroup\n\treturn h\n}", "title": "" }, { "docid": "3df1bc754291316eb70f6a040b934f99", "score": "0.57862264", "text": "func Hash(rw io.ReadWriter, alg Algorithm, buf tpmutil.U16Bytes, hierarchy tpmutil.Handle) (digest []byte, validation *Ticket, err error) {\n\tresp, err := runCommand(rw, TagNoSessions, CmdHash, buf, alg, hierarchy)\n\tif err != nil {\n\t\treturn nil, nil, err\n\t}\n\treturn decodeHash(resp)\n}", "title": "" }, { "docid": "4f5b11898fbd8c1f27baf8124aadcd84", "score": "0.57790697", "text": "func challengeHash(peerChallenge []byte, authChallenge []byte, userName []byte) []byte {\n\tenc := sha1.New()\n\tenc.Write(peerChallenge)\n\tenc.Write(authChallenge)\n\tenc.Write(userName)\n\treturn enc.Sum(nil)[:8]\n}", "title": "" }, { "docid": "ab33428cd18a1956b5a73c388c26dbc6", "score": "0.57597244", "text": "func (s *service) Hash(password string) ([]byte, error) {\n\treturn bcrypt.GenerateFromPassword([]byte(password), bcrypt.DefaultCost)\n}", "title": "" }, { "docid": "8d239d5eac10c934680460c92563b8d2", "score": "0.5739616", "text": "func (*Service) Hash(data string) (string, error) {\n\tbytes, err := bcrypt.GenerateFromPassword([]byte(data), bcrypt.DefaultCost)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\treturn string(bytes), err\n}", "title": "" }, { "docid": "5aae2bd88de3579621739654223e7d49", "score": "0.5739399", "text": "func (s *service) Hash(pwd string) string {\n\treturn s.hasher.Hash(pwd)\n}", "title": "" }, { "docid": "f59037088352dd0f81c2c9d49de6f419", "score": "0.56808", "text": "func HashPassword(password string) (hash, salt string) {\n\tl := saltLength + len(password)\n\tsp := make([]byte, l, l)\n\n\tfor i := 0; i < saltLength; i++ {\n\t\tsp[i] = byte('!' + rand.Intn('~'-'!'))\n\t}\n\n\tcopy(sp[saltLength:], password)\n\n\th := sha512.Sum512(sp)\n\n\thash = base64.URLEncoding.EncodeToString(h[:])\n\tsalt = string(sp[:saltLength])\n\n\treturn\n}", "title": "" }, { "docid": "85ce1d0342de7d1c7d7517f188a1bd39", "score": "0.5676632", "text": "func ReturnHashedNumber(w http.ResponseWriter, r *http.Request) {\n\tfmt.Println(\"Method: \", r.Method)\n\tif r.Method != \"POST\" {\n\t\tfmt.Println(\"hasher called with Method other than POST\")\n\t\treturn\n\t}\n\n\tfmt.Println(\"hasher called with Method POST\")\n\tdata, _ := ioutil.ReadAll(r.Body)\n\tfmt.Println(string(data))\n\tdat := make(map[string]string)\n\terr := json.Unmarshal(data, &dat)\n\tif err != nil {\n\t\tfmt.Println(\"error_46 : \", err)\n\t\tpanic(err)\n\t}\n\tfmt.Println(\"Unmarshal done\", dat[\"token\"])\n\n\tfmt.Println(\"Hasher Input : \", dat[\"token\"])\n\tsha1_hash := Hasher(dat[\"token\"])\n\tm := make(map[string]string)\n\tm[\"hash\"] = sha1_hash\n\tjs, err := json.Marshal(m)\n\tif err != nil {\n\t\tfmt.Println(\"Error Marshaling\")\n\t\thttp.Error(w, err.Error(), http.StatusInternalServerError)\n\t\treturn\n\t}\n\tfmt.Println(\"JSON Output \", js)\n\tw.Header().Set(\"Content-Type\", \"application/json\")\n\tw.Write(js)\n}", "title": "" }, { "docid": "d85d91c9901b0a1fee7be91caceadfe5", "score": "0.5629511", "text": "func Hash(password, pepper string) (string, error) {\n\thash, err := HashBytes([]byte(password), []byte(pepper))\n\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\n\treturn string(hash), nil\n}", "title": "" }, { "docid": "36d819d179239d90ab57f2c5ee7afd59", "score": "0.5622409", "text": "func hash(password string) ([]byte, error) {\n\treturn bcrypt.GenerateFromPassword([]byte(password), bcrypt.DefaultCost)\n}", "title": "" }, { "docid": "bd40a5ff4ea5bcfb5b8b4f596625da62", "score": "0.55864197", "text": "func passhash(user, pass string) string {\n\th := crypto.SHA256.New()\n\th.Write([]byte(\"TESTING\" + user + \"|\" + pass + \"|\" + user + \"TESTING\"))\n\tx := h.Sum(nil)\n\treturn hex.EncodeToString(x)\n}", "title": "" }, { "docid": "6e0de2ffd82fa0007037337e65101e22", "score": "0.55851626", "text": "func shaHMAC(password string, engineID string) []byte {\n\thash := sha1.New()\n\tvar pi int // password index\n\tfor i := 0; i < 1048576; i += 64 {\n\t\tvar chunk []byte\n\t\tfor e := 0; e < 64; e++ {\n\t\t\tchunk = append(chunk, password[pi%len(password)])\n\t\t\tpi++\n\t\t}\n\t\thash.Write(chunk)\n\t}\n\thashed := hash.Sum(nil)\n\tlocal := sha1.New()\n\tlocal.Write(hashed)\n\tlocal.Write([]byte(engineID))\n\tlocal.Write(hashed)\n\tfinal := local.Sum(nil)\n\treturn final\n}", "title": "" }, { "docid": "f4a7dacfa1b5266a278c0aac016c61bd", "score": "0.55791104", "text": "func (j *HS256JWTStrategy) Hash(ctx context.Context, in []byte) ([]byte, error) {\n\t// SigningMethodRS256\n\thash := sha256.New()\n\t_, err := hash.Write(in)\n\tif err != nil {\n\t\treturn []byte{}, errors.WithStack(err)\n\t}\n\treturn hash.Sum([]byte{}), nil\n}", "title": "" }, { "docid": "47f0c59a3fc5f7b8ae347eceb05e41a6", "score": "0.55714464", "text": "func hash_auth_check(password string) {\n\t//Various Hashes, in order of increasing security\n\t// dont use this\n\tmd5_password_hash := crypto.MD5.New()\n\tmd5_password_hash.Sum([]byte(password))\n\t// or this\n\tsha1_password_hash := crypto.MD5SHA1.New()\n\tsha1_password_hash.Sum([]byte(password))\n\t// this is ok-ish, if you have a long password\n\tsha256_password_hash := crypto.SHA512_256.New()\n\tsha256_password_hash.Sum([]byte(password))\n}", "title": "" }, { "docid": "dcacd3c2cafbc3c69bce167a47dedb01", "score": "0.55687505", "text": "func (c *Curl) Hash(trits trinary.Trits) (trinary.Trits, error) {\n\tresult := <-c.SubmitHash(trits)\n\treturn result.Hash, result.Err\n}", "title": "" }, { "docid": "63564e17428ef5e463ed62e19fefa011", "score": "0.5560725", "text": "func showHash(w http.ResponseWriter, r *http.Request) {\r\n\tlog.Printf(\"URL.Path = %s\\n\", r.URL.Path)\r\n\tw.Write([]byte(\"SHA256 for key...\\n\"))\r\n}", "title": "" }, { "docid": "67fd6ce062ba01a0a0d22cb69564638f", "score": "0.55598253", "text": "func Hash(password string) (*HashedPassword, error) {\n\t// verify the password is not too long to reasonably calculate\n\t// a hash for (avoid DOS)\n\tif len(password) > maxPasswordSize {\n\t\treturn nil, fmt.Errorf(\"Password exceeds max length of %v\", maxPasswordSize)\n\t}\n\n\t// generate salt\n\tsalt := make([]byte, saltSize)\n\t_, err := rand.Read(salt)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\t// do the hashing\n\tderivedKey := pbkdf2.Key([]byte(password), salt, iterationCount, keySize, sha256.New)\n\n\t// base64 encode\n\tencodedKey := base64.StdEncoding.EncodeToString(derivedKey)\n\tencodedSalt := base64.StdEncoding.EncodeToString(salt)\n\n\treturn &HashedPassword{IterationCount: iterationCount, Salt: encodedSalt, Hash: encodedKey, Alg: \"sha256\"}, nil\n}", "title": "" }, { "docid": "42b75149275af9a30d5f510834f5b3ee", "score": "0.5552386", "text": "func Hash(password string) ([]byte, HashParams, error) {\n\tparams, err := NewHashParams()\n\tif err != nil {\n\t\treturn nil, HashParams{}, errors.Wrap(err, \"failed to create password hash params\")\n\t}\n\n\thash := HashWithParams(password, params)\n\n\treturn hash, params, nil\n}", "title": "" }, { "docid": "188886bf8e1fa0cd98f5ed4cd22da32a", "score": "0.55255747", "text": "func (c *Curl) SubmitHash(trits trinary.Trits) <-chan CurlResult {\n\tresult := make(chan CurlResult, 1)\n\tif len(trits) != c.inputSize {\n\t\tresult <- CurlResult{nil, consts.ErrInvalidTritsLength}\n\t\treturn result\n\t}\n\n\tselect {\n\tcase c.jobs <- job{trits, result}:\n\t\treturn result\n\tcase <-c.closing:\n\t\tresult <- CurlResult{nil, ErrClosed}\n\t\treturn result\n\t}\n}", "title": "" }, { "docid": "41ee48415378c346739ea2055f53f1f5", "score": "0.5512571", "text": "func (h Mock) Hash(password []byte) ([]byte, error) {\n\treturn password, nil\n}", "title": "" }, { "docid": "106c5dbca0a84e563adaaa4d19f698e1", "score": "0.5506925", "text": "func hashtoolkit(h Hash) (string, error) {\n re := regexp.MustCompile(`(?m)/generate-hash/\\?text=(.+)\\\"`)\n\n const apiEndPoint = \"https://hashtoolkit.com/reverse-hash/?hash=%s\"\n requestUrl := fmt.Sprintf(apiEndPoint, h.Value)\n\n resp, err := GetClient().Get(requestUrl)\n if err != nil {\n return \"\", fmt.Errorf(\"hashtoolkit: %w\", err)\n }\n defer resp.Body.Close()\n\n if resp.StatusCode != http.StatusOK {\n return \"\", errors.New(\"hashtoolkit: Invalid Status Code\")\n }\n\n rbody, err := ioutil.ReadAll(resp.Body)\n if err != nil {\n return \"\", fmt.Errorf(\"hastoolkit: %w\", err)\n }\n\n matches := re.FindStringSubmatch(string(rbody))\n if len(matches) < 2 {\n return \"\", errors.New(\"hashtoolkit: Couldn't find the result in response\")\n }\n\n result := matches[1]\n\n if result == \"\" {\n return \"\", errors.New(\"hashtoolkit: The result is empty\")\n }\n\n return result, nil\n}", "title": "" }, { "docid": "96bf9251512f224eaed15e111ef784ec", "score": "0.5504165", "text": "func hashWithSha512(input string) (string, error) {\n\thasher := sha512.New()\n\thasher.Write([]byte(input))\n\treturn hex.EncodeToString(hasher.Sum(nil)), nil\n}", "title": "" }, { "docid": "37f86485fd5fc3c3d11d1e13aa09b0c1", "score": "0.5502469", "text": "func Hash(password string) ([]byte, error) {\n\treturn bcrypt.GenerateFromPassword([]byte(password), HashCost)\n}", "title": "" }, { "docid": "9acc7948d3a84ec1cbdf6174c1f4f670", "score": "0.5487678", "text": "func Hash(password string) ([]byte, []byte, error) {\n\tcostFactorN := 32768\n\tblockSizeFactorR := 8\n\tparallelizationFactorP := 1\n\tdesiredKeyLength := 64\n\tsalt := make([]byte, 12)\n\t_, err := rand.Read(salt)\n\tif err != nil {\n\t\treturn nil, nil, err\n\t}\n\thash, err := scrypt.Key([]byte(password), salt, costFactorN, blockSizeFactorR, parallelizationFactorP, desiredKeyLength)\n\tif err != nil {\n\t\treturn nil, nil, err\n\t}\n\treturn salt, hash, nil\n}", "title": "" }, { "docid": "b33224df6586475e62df09691c6fd20e", "score": "0.54847133", "text": "func (r *Request) Hash() uint32 {\n\th := fnv.New32a()\n\th.Write(r.GetVal())\n\treturn h.Sum32()\n}", "title": "" }, { "docid": "85d2d148f154bd33afbeedf78d3eb5a8", "score": "0.5483326", "text": "func hash(text string) string {\n\treturn fmt.Sprintf(\"%x\", sha512.Sum512([]byte(text)))\n}", "title": "" }, { "docid": "e2bea34fec85f28176d7e518f59f030d", "score": "0.54655755", "text": "func processHashFetch (response http.ResponseWriter, url string) {\n\n // The last field in the path contains the key we need to locate\n // Tokenize the path and grab the last field\n urlTokens := strings.Split (url, \"/\")\n keyStr := string (urlTokens[len (urlTokens) - 1])\n\n // Convert string token to an integer\n key, err := strconv.Atoi (keyStr)\n\n if nil != err {\n // This should really happen, as the regular expression match prevents anything but /hash/[digits] in the url, so Atoi should always work\n httpError (response, http.StatusBadRequest, \"Invalid key encountered\")\n return\n }\n\n // Check for the key in the map\n g_shaValueMapMutex.Lock()\n value, ok := g_shaValueMap[uint64(key)]\n g_shaValueMapMutex.Unlock()\n\n if false == ok {\n // key not found (or isn't ready yet)\n httpError (response, http.StatusBadRequest, \"requested key and token data not ready or invalid key submitted\")\n return\n }\n\n // Populate the response message with the sha value\n fmt.Fprintf (response, \"%s\\n\", value)\n}", "title": "" }, { "docid": "8f03ed1ad931e850f99331a463003051", "score": "0.5457402", "text": "func (c Debug) GetHash(password string) revel.Result {\n\thash, _ := bcrypt.GenerateFromPassword([]byte(password), bcrypt.DefaultCost)\n\tretval := struct{ Password []byte }{Password: hash}\n\treturn c.RenderJSON(retval)\n}", "title": "" }, { "docid": "c3d0fc2d79ea164903594c7e886c7b97", "score": "0.54496616", "text": "func httpRequestRouter (response http.ResponseWriter, request *http.Request) {\n\n switch request.Method {\n\n case \"GET\":\n switch {\n // Fetch hashed password result\n case g_regHashFetch.MatchString (request.URL.Path):\n processHashFetch (response, request.URL.Path)\n\n // Dump stats request\n case g_regStats.MatchString (request.URL.Path):\n processStatsRequest (response)\n\n // Initiate shutdown sequence\n case g_regShutdown.MatchString (request.URL.Path):\n processShutdownRequest (response)\n\n // for all malformed, invalid, not existent URLs\n default:\n httpError (response, http.StatusNotFound, \"Unknown URL path `\" + request.URL.Path + \"` encountered in \" + request.Method + \" request\")\n }\n\n case \"POST\":\n switch {\n // Perform a password hash request\n case g_regHashReq.MatchString (request.URL.Path):\n // make sure a shutdown has not been requested\n g_shutdownMutex.Lock()\n if true == g_pendingShutdown {\n httpError (response, http.StatusServiceUnavailable, \"shutdown underway\")\n g_shutdownMutex.Unlock()\n return\n }\n g_shutdownMutex.Unlock()\n\n atomic.AddInt64(&g_activeHashThreads, 1)\n processHashRequest (response, request)\n\n // for all malformed, invalid, not existent URLs\n default:\n httpError (response, http.StatusNotFound, \"Unknown URL path `\" + request.URL.Path + \"` encountered in \" + request.Method + \" request\")\n }\n\n default:\n httpError (response, http.StatusMethodNotAllowed, \"Unsupported Method Type: \" + request.Method )\n }\n}", "title": "" }, { "docid": "88f82ff7208e92662a290db62c1ef657", "score": "0.5404475", "text": "func Hash(password string) string {\n\thash, _ := bcrypt.GenerateFromPassword([]byte(password), bcrypt.DefaultCost)\n\treturn string(hash)\n}", "title": "" }, { "docid": "c54ed1944e85cb3278d299c037d16f7a", "score": "0.5397919", "text": "func New() hash.Hash { return &digest{Hash: sha512.New()} }", "title": "" }, { "docid": "31d130f326c283235d5f45a76d41996f", "score": "0.5393147", "text": "func (d Driver) GetHash(alg string, password string) (string, error) {\n\tvar hash []byte\n\tswitch alg {\n\t/* Weak cryptographic primitive blacklisted\n\tcase \"MD5\":\n\t\thash = makehash(md5.New(), password, false)\n\tcase \"SMD5\":\n\t\thash = makehash(md5.New(), password, true)\n\tcase \"SHA\", \"SHA1\":\n\t\thash = makehash(sha1.New(), password, false)\n\tcase \"SSHA\", \"SSHA1\":\n\t\thash = makehash(sha1.New(), password, true) */\n\tcase \"SHA224\":\n\t\thash = makehash(sha256.New224(), password, false)\n\tcase \"SSHA224\":\n\t\thash = makehash(sha256.New224(), password, true)\n\tcase \"SHA256\":\n\t\thash = makehash(sha256.New(), password, false)\n\tcase \"SSHA256\":\n\t\thash = makehash(sha256.New(), password, true)\n\tcase \"SHA384\":\n\t\thash = makehash(sha512.New384(), password, false)\n\tcase \"SSHA384\":\n\t\thash = makehash(sha512.New384(), password, true)\n\tcase \"SHA512\":\n\t\thash = makehash(sha512.New(), password, false)\n\tcase \"SSHA512\":\n\t\thash = makehash(sha512.New(), password, true)\n\tcase \"SHA3-224\":\n\t\thash = makehash(sha3.New224(), password, false)\n\tcase \"SSHA3-224\":\n\t\thash = makehash(sha3.New224(), password, true)\n\tcase \"SHA3-256\":\n\t\thash = makehash(sha3.New256(), password, false)\n\tcase \"SSHA3-256\":\n\t\thash = makehash(sha3.New256(), password, true)\n\tcase \"SHA3-384\":\n\t\thash = makehash(sha3.New384(), password, false)\n\tcase \"SSHA3-384\":\n\t\thash = makehash(sha3.New384(), password, true)\n\tcase \"SHA3-512\":\n\t\thash = makehash(sha3.New512(), password, false)\n\tcase \"SSHA3-512\":\n\t\thash = makehash(sha3.New512(), password, true)\n\tcase \"SHAKE128\":\n\t\thash = makeshakehash(sha3.NewShake128(), 32, password, false)\n\tcase \"SSHAKE128\":\n\t\thash = makeshakehash(sha3.NewShake128(), 32, password, true)\n\tcase \"SHAKE256\":\n\t\thash = makeshakehash(sha3.NewShake256(), 64, password, false)\n\tcase \"SSHAKE256\":\n\t\thash = makeshakehash(sha3.NewShake256(), 64, password, true)\n\tdefault:\n\t\treturn \"\", fmt.Errorf(\"invalid password hash algorithm: %v\", alg)\n\t}\n\n\tb64 := base64.StdEncoding.EncodeToString(hash)\n\tresult := fmt.Sprintf(\"{%s}%s\", alg, b64)\n\n\treturn result, nil\n}", "title": "" }, { "docid": "22e4532550c2ca209e2844f0fd841d6d", "score": "0.5373939", "text": "func (v *WorkGenerateInput) GetHash() string { return v.Hash }", "title": "" }, { "docid": "599dd20c1503a2ccc509ada4deaa3e66", "score": "0.5372266", "text": "func processHashedResponse(w http.ResponseWriter, req *http.Request) {\n\n sm := state.GetStateManager()\n\n trimmed := strings.ReplaceAll(req.URL.Path, \"/hash/\", \"\")\n\n if hashed_value, isOk := sm.GetHash(trimmed); isOk {\n \tfmt.Fprintf(w, hashed_value)\n } else {\n fmt.Fprintf(w, \"ERROR, invalid link %s\", req.URL.Path)\n }\n\n}", "title": "" }, { "docid": "da9b76b65235bfb7c10d3a2d1932eae8", "score": "0.5367655", "text": "func HashPassword(password string) (string, error) {\r\n\tconst cost = 10 // min=4, max=31, default=10\r\n\tbytes, err := bcrypt.GenerateFromPassword([]byte(password), cost)\r\n\treturn string(bytes), err\r\n}", "title": "" }, { "docid": "b90069b54791385313f4ab834a4a1df1", "score": "0.5365007", "text": "func generateTokenHash(login string) string {\n\tHash := sha512.New()\n\tTime := strconv.FormatInt(time.Now().Unix(), 10)\n\trand.Seed(time.Now().UnixNano())\n\tBytes := []byte(login + Time + strconv.FormatInt(rand.Int63(), 10))\n\tResult := Hash.Sum(Bytes)\n\treturn base64.URLEncoding.EncodeToString(Result)\n}", "title": "" }, { "docid": "7704407df65c3dfe4bd15a9de2b298fb", "score": "0.5358527", "text": "func hash(key string) []byte {\n\thasher := sha256.New()\n\thasher.Write([]byte(key))\n\tout := hashPool.Get()\n\tdefer hashPool.Put(out[:0])\n\tout = hasher.Sum(out[:0])\n\treturn out\n}", "title": "" }, { "docid": "53b5d88becf35eaf5510d3202b099fd6", "score": "0.5357063", "text": "func (service BcryptService) HashPassword(password string) (string, error) {\n\tbytes, err := bcrypt.GenerateFromPassword([]byte(password), bcrypt.DefaultCost)\n\treturn string(bytes), err\n}", "title": "" }, { "docid": "f5fffd23527ea33a601b2404d583c062", "score": "0.53501564", "text": "func (bc *bCrypt) HashPassword(password string) string {\n\t// Convert password string to byte slice\n\tpasswordBytes := []byte(password)\n\n\t// Create sha-512 hasher\n\tsha512Hasher := sha512.New()\n\n\t// Append salt to password\n\tpasswordBytes = append(passwordBytes, bc.Salt...)\n\n\t// Write password bytes to the hasher\n\tsha512Hasher.Write(passwordBytes)\n\n\t// Get the SHA-512 hashed password\n\thashedPasswordBytes := sha512Hasher.Sum(nil)\n\n\t// Convert the hashed password to a base64 encoded string\n\tbase64EncodedPasswordHash := base64.URLEncoding.EncodeToString(hashedPasswordBytes)\n\n\treturn base64EncodedPasswordHash\n}", "title": "" }, { "docid": "5c7feea8078584b1475b4e3d3fab7b04", "score": "0.53327775", "text": "func generateHashToken() string {\n time := time.Now()\n return base64_hash(time.String())\n}", "title": "" }, { "docid": "b7fe01e0d6f7f972650842bef04f72f2", "score": "0.53313434", "text": "func AuthHash(commitHash, challenge [32]byte) [32]byte {\n\treturn concatAndHash(commitHash[:], challenge[:])\n}", "title": "" }, { "docid": "9e7fbd1a131158581025d3753a08a253", "score": "0.5328873", "text": "func hashPassword(password string) (string, error) {\n\t// Hash the password with bcrypt Note: bcrypt autosalts!\n\tpasswordHash, err := bcrypt.GenerateFromPassword([]byte(password), bcrypt.DefaultCost)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\n\t// Base64 encode the hash so we can transport it more easily\n\tencodedPasswordHash := base64.URLEncoding.EncodeToString(passwordHash)\n\n\treturn encodedPasswordHash, nil\n}", "title": "" }, { "docid": "8eeb101c5bceee8e8c3c94f9168ffdaf", "score": "0.53221345", "text": "func (s *Item) Hash(password string) (string, error) {\n\treturn HashString(password)\n}", "title": "" }, { "docid": "3c24797858810aa7402e8f02cce9a679", "score": "0.5319828", "text": "func (p *password) Hash(password string) (string, error) {\n\thash, err := bcrypt.GenerateFromPassword([]byte(password), bcrypt.DefaultCost)\n\n\treturn string(hash), err\n}", "title": "" }, { "docid": "e1ab828d50a096bfa2d47911acf87b47", "score": "0.5311089", "text": "func Hash(data ...string) string {\n\th := sha512.New()\n\tfor _, d := range data {\n\t\th.Write([]byte(d))\n\t}\n\th.Write([]byte(config.Get().Salt))\n\treturn base64.StdEncoding.EncodeToString(h.Sum(nil))\n}", "title": "" }, { "docid": "055a5ce2989d6967e0621703e807e6dc", "score": "0.53104776", "text": "func NewHash(t *Testing.t) *Hash {\n}", "title": "" }, { "docid": "611bd1002fbd298b31a88de1361a000c", "score": "0.53083766", "text": "func getHash(pcrBank SHAAlgorithm) hash.Hash {\n\tvar hash hash.Hash\n\n\tswitch pcrBank {\n\tcase SHA1:\n\t\thash = sha1.New()\n\tcase SHA256:\n\t\thash = sha256.New()\n\tcase SHA384:\n\t\thash = sha512.New384()\n\tcase SHA512:\n\t\thash = sha512.New()\n\t}\n\n\treturn hash\n}", "title": "" }, { "docid": "358bc9ea2d801444d29143e09899c6af", "score": "0.5293426", "text": "func (_Fed *FedSession) PERMITTYPEHASH() ([32]byte, error) {\n\treturn _Fed.Contract.PERMITTYPEHASH(&_Fed.CallOpts)\n}", "title": "" }, { "docid": "400ebaa295ee64d0264353b297149686", "score": "0.52908415", "text": "func calculateHash(obj interface{}) (string, error) {\r\n\tbytes, err := json.Marshal(obj)\r\n\tif err != nil {\r\n\t\tlog.Println(\"Error serializing message\", err)\r\n\t\treturn \"\", err\r\n\t}\r\n\t// Sign the content of block including the hash of DarkMatter\r\n\trawContent := fmt.Sprintf(\"%s:%s\", ServiceHash, bytes)\r\n\r\n\t// Double hash for the content\r\n\tdoubleHash := fmt.Sprintf(\"%x\", sha256.Sum256([]byte(rawContent)))\r\n\tdoubleHash = fmt.Sprintf(\"%x\", sha256.Sum256([]byte(doubleHash)))\r\n\r\n\treturn doubleHash, nil\r\n}", "title": "" }, { "docid": "d931547304f2b10443518879eed98d12", "score": "0.52847767", "text": "func (s *hashService) HashPassword(password string) (string, error) {\n\tbytes, err := bcrypt.GenerateFromPassword([]byte(password), s.salt)\n\treturn string(bytes), err\n}", "title": "" }, { "docid": "e78c491150935a5970dd0db20eec3724", "score": "0.5278659", "text": "func hashPassword(p string) (password string, err error) {\n\tv, err := bcrypt.GenerateFromPassword([]byte(p), DEFAULT_COST)\n\n\tif err != nil {\n\t\treturn \"\", errors.New(\"err\")\n\t}\n\n\treturn string(v), nil\n}", "title": "" }, { "docid": "6e041e5f2ef7a3c9ae21e417533628d3", "score": "0.5274444", "text": "func QueryTxHashRequest(rpcAddr string) http.HandlerFunc {\n\treturn func(w http.ResponseWriter, r *http.Request) {\n\t\tqueries := mux.Vars(r)\n\t\thash := queries[\"hash\"]\n\t\trequest := types.InterxRequest{\n\t\t\tMethod: r.Method,\n\t\t\tEndpoint: config.QueryTransactionHash,\n\t\t\tParams: []byte(hash),\n\t\t}\n\t\tresponse := common.GetResponseFormat(request, rpcAddr)\n\t\tstatusCode := http.StatusOK\n\n\t\tcommon.GetLogger().Info(\"[query-txhash] Entering transaction hash query: \", hash)\n\n\t\tif !common.RPCMethods[\"GET\"][config.QueryTransactionHash].Enabled {\n\t\t\tresponse.Response, response.Error, statusCode = common.ServeError(0, \"\", \"API disabled\", http.StatusForbidden)\n\t\t} else {\n\t\t\tif common.RPCMethods[\"GET\"][config.QueryTransactionHash].CachingEnabled {\n\t\t\t\tfound, cacheResponse, cacheError, cacheStatus := common.SearchCache(request, response)\n\t\t\t\tif found {\n\t\t\t\t\tresponse.Response, response.Error, statusCode = cacheResponse, cacheError, cacheStatus\n\t\t\t\t\tcommon.WrapResponse(w, request, *response, statusCode, false)\n\n\t\t\t\t\tcommon.GetLogger().Info(\"[query-txhash] Returning from the cache: \", hash)\n\t\t\t\t\treturn\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tresponse.Response, response.Error, statusCode = queryTxHashHandle(hash, rpcAddr)\n\t\t}\n\n\t\tcommon.WrapResponse(w, request, *response, statusCode, common.RPCMethods[\"GET\"][config.QueryTransactionHash].CachingEnabled)\n\t}\n}", "title": "" }, { "docid": "95024c20c5bc563a1c17c7678bf047ab", "score": "0.52718014", "text": "func (s *grpcServer) Hash(ctx context.Context, r *pb.HashRequest) (*pb.HashResponse, error) {\r\n\r\n\t_, resp, err := s.hash.ServeGRPC(ctx, r)\r\n\tif err != nil {\r\n\t\treturn nil, err\r\n\t}\r\n\r\n\treturn resp.(*pb.HashResponse), nil\r\n}", "title": "" }, { "docid": "5276fb18f6d32a4685e674ff2366eb99", "score": "0.52508616", "text": "func (t *UserServlet) generate_password_hash(password, salt []byte) []byte {\n\treturn pbkdf2.Key(password, salt, 4096, 64, sha256.New)\n}", "title": "" }, { "docid": "e104fc1ed556c6a9fd3c8da4cfb86bfa", "score": "0.5245939", "text": "func HashAndEncodePassword(pw string) string {\n hashed := sha512.Sum512([]byte(pw))\n return base64.StdEncoding.EncodeToString([]byte(hashed[:]))\n}", "title": "" }, { "docid": "05caeca0e3a6fffe6c21015550a09882", "score": "0.52426183", "text": "func (s *sha3_512Algo) ComputeHash(data []byte) Hash {\n\ts.Reset()\n\t_, _ = s.Write(data)\n\tdigest := make(Hash, 0, HashLenSha3_512)\n\treturn s.Sum(digest)\n}", "title": "" }, { "docid": "5a5f4966022ead42ceb1f13373d2637c", "score": "0.5238376", "text": "func hash(text string) string {\n\th := sha512.Sum512([]byte(text))\n\treturn base64.StdEncoding.EncodeToString(h[:])[:VrfTagHashLen]\n}", "title": "" }, { "docid": "6fcd5df50a63903e329311a5cd034286", "score": "0.5235222", "text": "func Hash(password string) ([]byte, error) {\n\treturn bcrypt.GenerateFromPassword([]byte(password), bcrypt.DefaultCost)\n}", "title": "" }, { "docid": "6fcd5df50a63903e329311a5cd034286", "score": "0.5235222", "text": "func Hash(password string) ([]byte, error) {\n\treturn bcrypt.GenerateFromPassword([]byte(password), bcrypt.DefaultCost)\n}", "title": "" }, { "docid": "6fcd5df50a63903e329311a5cd034286", "score": "0.5235222", "text": "func Hash(password string) ([]byte, error) {\n\treturn bcrypt.GenerateFromPassword([]byte(password), bcrypt.DefaultCost)\n}", "title": "" }, { "docid": "07d9cbeac472eeb07040d9a5094569c4", "score": "0.5233841", "text": "func HashPassword(password string) string {\n\th, _ := scrypto.Hash(password)\n\treturn h\n}", "title": "" }, { "docid": "c507749873eb7e2b0c63a329ab203a79", "score": "0.52302694", "text": "func (m *Secret) DoHash() {\n\th := sha1.New()\n\th.Write([]byte(m.SecretText + m.CreatedAt.String()))\n\tbs := h.Sum(nil)\n\n\tm.Hash = base64.URLEncoding.EncodeToString(bs)\n}", "title": "" }, { "docid": "6eaed6bb66098cbc00074b7d613ed3d0", "score": "0.522901", "text": "func hash(input string) string {\n\th := sha1.New()\n\t_, _ = h.Write([]byte(input))\n\treturn base64.RawURLEncoding.EncodeToString(h.Sum(nil))\n}", "title": "" }, { "docid": "7b3135b2626821b3f404f24bf0274274", "score": "0.52280575", "text": "func (h *StdHasher) HashPassword(username string, domain string, password string) string {\n\th.mutex.Lock()\n\tsalt := buildSecret(username, domain, password, h.salt)\n\th.mutex.Unlock()\n\tbytes, _ := bcrypt.GenerateFromPassword(salt[:], 14)\n\n\treturn string(bytes)\n}", "title": "" }, { "docid": "ce9bef53a0b513d615660b80a9d702b5", "score": "0.5226032", "text": "func (_AplpacaLpToken *AplpacaLpTokenSession) PERMITTYPEHASH() ([32]byte, error) {\n\treturn _AplpacaLpToken.Contract.PERMITTYPEHASH(&_AplpacaLpToken.CallOpts)\n}", "title": "" }, { "docid": "3ec4e4fb117cadf43eb2f6e42435ff93", "score": "0.5223849", "text": "func getHash(endpoint, contextInfo string) string {\n\tstrToHash := endpoint + contextInfo\n\th := fnv.New128().Sum([]byte(strToHash))\n\treturn string(h)\n}", "title": "" }, { "docid": "814e4ca41473da651b408e8d1a038ee9", "score": "0.5219472", "text": "func (*nap) hash(n int) uint {\n\tstr := []byte(strconv.Itoa(n))\n\th := sha256.Sum256(str)\n\treturn uint(h[0]) % size\n}", "title": "" }, { "docid": "c4f4064a3af190d844dbdda866eb9246", "score": "0.52188003", "text": "func HashPassword(password string) (string, error) {\n\tif password == \"\" {\n\t\treturn \"\", errors.New(\"Password is empty\")\n\t}\n\tchecksum := sha256.Sum256([]byte(password))\n\thashedPass := string(base64.StdEncoding.EncodeToString(checksum[:]))\n\treturn hashedPass, nil\n}", "title": "" }, { "docid": "ae46d9395e2c4ac072ea83a8e5a8604e", "score": "0.5217119", "text": "func (u *User) hash() {\n\n\tkey, err := scrypt.Key([]byte(u.pwplain), []byte(u.PasswordSalt), 16384, 8, 1, 32)\n\tif err == nil {\n\t\tu.PasswordHash = string(key)\n\t}\n}", "title": "" }, { "docid": "e5b8157d8a014ec46a9b26ff3769fe48", "score": "0.5210908", "text": "func hashPacket(client *http.Client, hashURL string, shutdownURL string, pool *sync.Pool, doneChan <-chan struct{}, writeOut chan<- PacketStruct, numConcurrentJobs int, wg *sync.WaitGroup) {\n\t// Close wait group when done\n\tdefer wg.Done()\n\n // Execute this goroutine on its own exclusive OS thread\n runtime.LockOSThread()\n\n\t// Create a separate wait group for all requests made to the backend\n\tvar wgBackend sync.WaitGroup\n\n\t// Create a channel to limit the number of concurrent goroutines\n\t// This acts like a counting semaphore / rate limiter\n\t// numConcurrentJobs must be less than ulimit -n (max number of open file descriptors)\n\tvar tokens = make(chan struct{}, numConcurrentJobs)\n\n\t// Extract packets from a pool and spawn a goroutine to get the fnv1a hash of the packet and\n // append it to the packet's payload before inserting it into the write channel\n\thashLoop:\n\t\tfor {\n\t\t\tselect {\n case <-doneChan:\n // We are done receiving messages from client, so no longer need to reflect any back\n log.Println(\"Stopped receiving, so no need to communicate with backend.\")\n break hashLoop\n default:\n // Get a packet from the pool\n packet := pool.Get().(*PacketStruct)\n\n // Verify that the packet has contents and is not an empty struct\n // by checking its address field\n if ((*packet).Addr.String() != \"<nil>\") {\n // Acquire a token for communicating with HTTP backend\n // If the max number of goroutines (numConcurrentJobs) for communicating with the backend\n // has been reached, this action blocks until one of those goroutines has finished\n tokens <- struct{}{}\n\n // Add a process to the wait group for backend communication\n wgBackend.Add(1)\n\n // Communicate with the HTTP backend server\n go commBackend(client, hashURL, *packet, writeOut, tokens, &wgBackend)\n }\n }\n }\n\n\t// Wait for all requests to the backend to finish\n\twgBackend.Wait()\n log.Println(\"All remaining goroutine communication with backend are complete\")\n\n\t// Close the channel when done hashing the packets\n\tclose(writeOut)\n\n\t// Create a request to shutdown the HTTP backend server\n\trequest, err := http.NewRequest(\"GET\", shutdownURL, nil)\n\tif err != nil {\n log.Println(err)\n }\n // Send the request and output the response\n resp, err := client.Do(request)\n if err != nil {\n log.Println(err)\n }\n body, err := ioutil.ReadAll(resp.Body)\n resp.Body.Close()\n if err != nil {\n log.Printf(\"Could not shutdown HTTP backend: %v\\n\", err)\n } else {\n log.Println(string(body))\n }\n\n // Close all idle connections for the HTTP backend client\n client.CloseIdleConnections()\n\n // Unlock the OS thread for other goroutines to use\n runtime.UnlockOSThread()\n}", "title": "" }, { "docid": "7805d4ca7c5f06fb87de738811877e5e", "score": "0.52061695", "text": "func hashPassword(password string) (string, error) {\n\tpw, err := bcrypt.GenerateFromPassword([]byte(password), bcrypt.DefaultCost)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\treturn string(pw), nil\n}", "title": "" }, { "docid": "a5ab8aa21b3e5381537c4b4ab29043c3", "score": "0.5205739", "text": "func hashPassword(password string) (string, error) {\n\tpw, err := bcrypt.GenerateFromPassword([]byte(password), bcrypt.DefaultCost)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\n\treturn string(pw), nil\n}", "title": "" }, { "docid": "bfa509f0b9b65ce4fe707bd5ec0940e3", "score": "0.520507", "text": "func HashPassword(pwd string) (string, error) {\n\thash, err := bcrypt.GenerateFromPassword([]byte(pwd), bcrypt.MinCost)\n\tif err != nil {\n\t\treturn \"\", gerrs.Wrap(ErrCryptoHash, err)\n\t}\n\n\treturn string(hash), nil\n}", "title": "" }, { "docid": "e14b10c023c1376ab6fe5a5ee12aed59", "score": "0.52045965", "text": "func hashAndEncode(password string) string {\r\n\thash512 := sha512.New()\r\n\thash512.Write([]byte(password))\r\n\tencoded := base64.StdEncoding.EncodeToString(hash512.Sum(nil))\r\n\treturn string(encoded)\r\n}", "title": "" }, { "docid": "0d3fc50b098808e1f6dd972c8ba356c6", "score": "0.51919365", "text": "func (r *RaquetteRefereeResolver) PasswordHash() string {\n\treturn r.ref.PasswordHash\n}", "title": "" }, { "docid": "e7cf4a1f9bd27431965d503e4300fb5a", "score": "0.51872385", "text": "func hashPassword(password string) string {\n\thash, err := bcrypt.GenerateFromPassword([]byte(password), bcrypt.DefaultCost)\n\tif err != nil {\n\t\tlogging.ErrorLogger.Println(err.Error())\n\t}\n\treturn string(hash)\n}", "title": "" }, { "docid": "c1daebf529191d7e3fb248d9c8dd76c5", "score": "0.51847726", "text": "func (_Fed *FedCallerSession) PERMITTYPEHASH() ([32]byte, error) {\n\treturn _Fed.Contract.PERMITTYPEHASH(&_Fed.CallOpts)\n}", "title": "" } ]
5d4400e18569a9ac02d42c208cdd4e2e
UnmarshalJSON unmarshals this object with a polymorphic type from a JSON structure
[ { "docid": "9291c17477c471cc196582c0310d85d2", "score": "0.0", "text": "func (m *ProjectPrincipalsAssignment) UnmarshalJSON(raw []byte) error {\n\tvar data struct {\n\t\tModify json.RawMessage `json:\"modify\"`\n\n\t\tRemove json.RawMessage `json:\"remove\"`\n\t}\n\tbuf := bytes.NewBuffer(raw)\n\tdec := json.NewDecoder(buf)\n\tdec.UseNumber()\n\n\tif err := dec.Decode(&data); err != nil {\n\t\treturn err\n\t}\n\n\tvar propModify []PrincipalRole\n\tif string(data.Modify) != \"null\" {\n\t\tmodify, err := UnmarshalPrincipalRoleSlice(bytes.NewBuffer(data.Modify), runtime.JSONConsumer())\n\t\tif err != nil && err != io.EOF {\n\t\t\treturn err\n\t\t}\n\t\tpropModify = modify\n\t}\n\tvar propRemove []PrincipalRole\n\tif string(data.Remove) != \"null\" {\n\t\tremove, err := UnmarshalPrincipalRoleSlice(bytes.NewBuffer(data.Remove), runtime.JSONConsumer())\n\t\tif err != nil && err != io.EOF {\n\t\t\treturn err\n\t\t}\n\t\tpropRemove = remove\n\t}\n\n\tvar result ProjectPrincipalsAssignment\n\n\t// modify\n\tresult.modifyField = propModify\n\n\t// remove\n\tresult.removeField = propRemove\n\n\t*m = result\n\n\treturn nil\n}", "title": "" } ]
[ { "docid": "f4d64ad56c019d0e64b460fb433ae2cb", "score": "0.74282986", "text": "func (m *item) UnmarshalPolymorphicJSON(data []byte) (interface{}, error) {\n\n if data == nil || string(data) == \"null\" {\n return nil, nil\n }\n\n var err error\n switch(m.Type) {\n case \"limit\":\n mm := LimitItem{}\n err = json.Unmarshal(data, &mm)\n return mm, err\n case \"tech\":\n mm := TechSupportItem{}\n err = json.Unmarshal(data, &mm)\n return mm, err\n case \"activity\":\n mm := ActivityItem{}\n err = json.Unmarshal(data, &mm)\n return mm, err\n default:\n return *m, nil\n }\n}", "title": "" }, { "docid": "61bbe8455ed0d29bac91cb2b3d071e95", "score": "0.670512", "text": "func (p *FieldType) 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\n\tf, ok := FieldTypeFromItemTypeString(j)\n\tif !ok {\n\t\treturn fmt.Errorf(\"unknown field type: %s\", j)\n\t}\n\t*p = f\n\treturn nil\n}", "title": "" }, { "docid": "e1aa3bd3a2d646357efc4440d3688b19", "score": "0.6605277", "text": "func (b *BaseModel) 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\", b, 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\", &b.ID)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"name\":\n\t\t\terr = unpopulate(val, \"Name\", &b.Name)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"type\":\n\t\t\terr = unpopulate(val, \"Type\", &b.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\", b, err)\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "b8bd33c282f8c2726624888a467aca2d", "score": "0.6580673", "text": "func (t *TargetServiceBase) 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 \"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}", "title": "" }, { "docid": "be148b77d26be1353ad9b5c1e0d7294b", "score": "0.6555966", "text": "func (t *Type) UnmarshalJSON(data []byte) error {\n\ttp := strings.ToUpper(strings.TrimSpace(string(data)))\n\ttyp := NONE\n\tswitch tp {\n\tcase MD5.value:\n\t\ttyp = MD5\n\tcase SHA1.value:\n\t\ttyp = SHA1\n\tcase SHA256.value:\n\t\ttyp = SHA256\n\t}\n\n\tt.value = typ.value\n\tt.Name = typ.Name\n\tt.order = typ.order\n\treturn nil\n}", "title": "" }, { "docid": "af2a6aa58921fbd709c45073d06f9a7e", "score": "0.65349257", "text": "func (p *Parent) UnmarshalJSON(b []byte) error {\n\tm := make(map[string]interface{})\n\tif err := json.Unmarshal(b, &m); err != nil {\n\t\treturn err\n\t}\n\tif t, ok := m[\"type\"].(string); ok {\n\t\tp.Type = ParentTypeEnum(t)\n\t} else {\n\t\treturn fmt.Errorf(\"the type parameter of parent is not a string\")\n\t}\n\n\tif id, ok := m[string(p.Type)].(string); ok {\n\t\tp.ID = id\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "7aa66e4eabb985b24d53a44922e273ce", "score": "0.6494348", "text": "func (s *Serialization) 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 \"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}", "title": "" }, { "docid": "3c626d9045d2e2dc48a009238a93a423", "score": "0.64566773", "text": "func (v *easyType) UnmarshalJSON(data []byte) error {\n\tr := jlexer.Lexer{Data: data}\n\teasyjson42239ddeDecodeGithubComLibforJson(&r, v)\n\treturn r.Error()\n}", "title": "" }, { "docid": "74cbfc3e3264bcdab386b1fa59a2b503", "score": "0.6444134", "text": "func (m *backuplocation) UnmarshalPolymorphicJSON(data []byte) (interface{}, error) {\n\n\tif data == nil || string(data) == \"null\" {\n\t\treturn nil, nil\n\t}\n\n\tvar err error\n\tswitch m.Destination {\n\tcase \"BUCKET\":\n\t\tmm := BackupLocationBucket{}\n\t\terr = json.Unmarshal(data, &mm)\n\t\treturn mm, err\n\tcase \"PRE_AUTHENTICATED_REQUEST_URI\":\n\t\tmm := BackupLocationUri{}\n\t\terr = json.Unmarshal(data, &mm)\n\t\treturn mm, err\n\tdefault:\n\t\treturn *m, nil\n\t}\n}", "title": "" }, { "docid": "e84f2fb736ca3c12911d143ca4b3bbef", "score": "0.6440177", "text": "func (t *DeepCachingType) UnmarshalJSON(data []byte) error {\n\tif string(data) == \"null\" {\n\t\t*t = DeepCachingTypeNever\n\t\treturn nil\n\t}\n\ts, err := strconv.Unquote(string(data))\n\tif err != nil {\n\t\treturn errors.New(string(data) + \" JSON not quoted\")\n\t}\n\t*t = DeepCachingTypeFromString(s)\n\tif *t == DeepCachingTypeInvalid {\n\t\treturn errors.New(string(data) + \" is not a DeepCachingType\")\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "f3e12d5db89079c33997048001197113", "score": "0.64387435", "text": "func (t *UpdateType) UnmarshalJSON(s []byte) error {\n\trepresentation := strings.Trim(string(s), \"\\\"\")\n\tswitch representation {\n\tcase \"add\":\n\t\t*t = AddUpdateType\n\tcase \"delete\":\n\t\t*t = DeleteUpdateType\n\tdefault:\n\t\treturn errUpdateType\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "0cd95a80dff5ee0fc993ed55ccb84201", "score": "0.64056313", "text": "func (t *BlobType) UnmarshalJSON(buf []byte) error {\n\tswitch string(buf) {\n\tcase `\"data\"`:\n\t\t*t = DataBlob\n\tcase `\"tree\"`:\n\t\t*t = TreeBlob\n\tdefault:\n\t\treturn errors.New(\"unknown blob type\")\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "79e2b583fc4508a72cbd2bc59b6f40bb", "score": "0.6376976", "text": "func (x *Type) 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 = Type(num)\n\treturn nil\n}", "title": "" }, { "docid": "ac68425fc5d46404afa50c63f210471c", "score": "0.63642853", "text": "func (m *fsucollectionsummary) UnmarshalPolymorphicJSON(data []byte) (interface{}, error) {\n\n\tif data == nil || string(data) == \"null\" {\n\t\treturn nil, nil\n\t}\n\n\tvar err error\n\tswitch m.Type {\n\tcase \"GI\":\n\t\tmm := GiFsuCollectionSummary{}\n\t\terr = json.Unmarshal(data, &mm)\n\t\treturn mm, err\n\tcase \"DB\":\n\t\tmm := DbFsuCollectionSummary{}\n\t\terr = json.Unmarshal(data, &mm)\n\t\treturn mm, err\n\tdefault:\n\t\tcommon.Logf(\"Recieved unsupported enum value for FsuCollectionSummary: %s.\", m.Type)\n\t\treturn *m, nil\n\t}\n}", "title": "" }, { "docid": "49ccccb7a3832ee17f8daaaef997b152", "score": "0.63620394", "text": "func (t *ActivityType) UnmarshalJSON(bytes []byte) error {\n\tt.ObjectType = NewObject()\n\tt.activity = &activityType{}\n\n\treturn UnmarshalJSON(bytes, t.ObjectType, t.activity)\n}", "title": "" }, { "docid": "62c253846db1740dd70651269a77eee1", "score": "0.63526726", "text": "func (t *LoRaUplinkType) UnmarshalJSON(b []byte) error {\n\tvar tp string\n\terr := json.Unmarshal(b, &tp)\n\tif err != nil {\n\t\treturn err\n\t}\n\tswitch tp {\n\tcase uplinkUplinkType:\n\t\t*t = UplinkUplinkType\n\tcase modemUplinkType:\n\t\t*t = ModemUplinkType\n\tcase joiningUplinkType:\n\t\t*t = JoiningUplinkType\n\tcase gnssUplinkType:\n\t\t*t = GNSSUplinkType\n\tcase wifiUplinkType:\n\t\t*t = WiFiUplinkType\n\tdefault:\n\t\t*t = UnknownUplinkType\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "84815dddd6ab83dca992994de7df2b88", "score": "0.63482803", "text": "func (i *MatcherType) UnmarshalJSON(data []byte) error {\n\tvar s string\n\tif err := json.Unmarshal(data, &s); err != nil {\n\t\treturn fmt.Errorf(\"MatcherType should be a string, got %s\", data)\n\t}\n\n\tvar err error\n\t*i, err = ParseMatcherTypeString(s)\n\treturn err\n}", "title": "" }, { "docid": "7760631277da4f79b590ddb26bfffab1", "score": "0.63309044", "text": "func (r *TempBasalType) UnmarshalJSON(data []byte) error {\n\tvar err error\n\tswitch string(data) {\n\tcase `\"Absolute\"`:\n\t\t*r = Absolute\n\tcase `\"Percent\"`:\n\t\t*r = Percent\n\tdefault:\n\t\terr = fmt.Errorf(\"unknown TempBasalType (%s)\", data)\n\t}\n\treturn err\n}", "title": "" }, { "docid": "6f07ab648b7b659703482bb13aea60f8", "score": "0.6328156", "text": "func (x *ImagesServiceTransform_Type) 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 = ImagesServiceTransform_Type(num)\n\treturn nil\n}", "title": "" }, { "docid": "53d887735a2dadba4b10023f0a2fa4bf", "score": "0.6321081", "text": "func (s *SecretInfoBase) 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 \"secretType\":\n\t\t\terr = unpopulate(val, \"SecretType\", &s.SecretType)\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}", "title": "" }, { "docid": "12407ba8262936855bdbfb417200eb18", "score": "0.6320882", "text": "func (v *BaseObject) UnmarshalJSON(data []byte) error {\n\tr := jlexer.Lexer{Data: data}\n\teasyjsonC7452bc1DecodeGithubComStek29Vk87(&r, v)\n\treturn r.Error()\n}", "title": "" }, { "docid": "67b2fec17152c9f63ee38aed2ffbc49d", "score": "0.6319536", "text": "func (m *Action) UnmarshalJSON(b []byte) (err error) {\n\ttype discriminator struct {\n\t\tKind string `json:\"kind\"`\n\t}\n\tvar d discriminator\n\terr = json.Unmarshal(b, &d)\n\tif err != nil {\n\t\treturn err\n\t}\n\t// Resolve into respective struct based on the discriminator value\n\tswitch d.Kind {\n\tcase \"email\":\n\t\tm.emailAction = &EmailAction{}\n\t\treturn json.Unmarshal(b, m.emailAction)\n\tcase \"webhook\":\n\t\tm.webhookAction = &WebhookAction{}\n\t\treturn json.Unmarshal(b, m.webhookAction)\n\t}\n\t// Unknown discriminator value (this type may not yet be supported)\n\t// unmarhsal to raw interface\n\tvar raw interface{}\n\terr = json.Unmarshal(b, &raw)\n\tif err != nil {\n\t\treturn err\n\t}\n\tm.raw = raw\n\treturn nil\n}", "title": "" }, { "docid": "e9084801781850f941744f8d380fb1dd", "score": "0.63093", "text": "func (s *Sub) UnmarshalJSON(data []byte) error {\r\n\ttype sub Sub\r\n\tvar ss sub\r\n\terr := json.Unmarshal(data, &ss)\r\n\tif err == nil {\r\n\t\t*s = Sub(ss)\r\n\t} else {\r\n\t\t// the id is surrounded by \"\\\" characters, so strip them\r\n\t\ts.ID = string(data[1 : len(data)-1])\r\n\t}\r\n\r\n\treturn nil\r\n}", "title": "" }, { "docid": "a6c3a36e6a2c3b2b71a1661819da2a13", "score": "0.62703884", "text": "func (v *WidgetVizType) UnmarshalJSON(src []byte) error {\n\tvar value string\n\terr := json.Unmarshal(src, &value)\n\tif err != nil {\n\t\treturn err\n\t}\n\t*v = WidgetVizType(value)\n\treturn nil\n}", "title": "" }, { "docid": "8afe867e054553603ee41c8123356faf", "score": "0.62488985", "text": "func (dt *Type) UnmarshalJSON(data []byte) error {\n\tvar s string\n\tif err := json.Unmarshal(data, &s); err != nil {\n\t\treturn fmt.Errorf(\"Filed type should be a string, got %s\", data)\n\t}\n\n\tt := TypeFromString(s)\n\n\tif t == TypeUnknown {\n\t\treturn fmt.Errorf(\"Unknown datatype '%s'\", s)\n\t}\n\n\t*dt = t\n\treturn nil\n}", "title": "" }, { "docid": "523eb815e387cf090700a8f048124e05", "score": "0.62466776", "text": "func (m *dashboard) UnmarshalPolymorphicJSON(data []byte) (interface{}, error) {\n\n\tif data == nil || string(data) == \"null\" {\n\t\treturn nil, nil\n\t}\n\n\tvar err error\n\tswitch m.SchemaVersion {\n\tcase \"V1\":\n\t\tmm := V1Dashboard{}\n\t\terr = json.Unmarshal(data, &mm)\n\t\treturn mm, err\n\tdefault:\n\t\tcommon.Logf(\"Recieved unsupported enum value for Dashboard: %s.\", m.SchemaVersion)\n\t\treturn *m, nil\n\t}\n}", "title": "" }, { "docid": "1cafd6bf2afb7a59c349f2738958259b", "score": "0.6240267", "text": "func (u *TemplateFilterBase) UnmarshalJSON(body []byte) error {\n\ttype wrap struct {\n\t\tdropbox.Tagged\n\t\t// FilterSome : Only templates with an ID in the supplied list will be\n\t\t// returned (a subset of templates will be returned).\n\t\tFilterSome []string `json:\"filter_some,omitempty\"`\n\t}\n\tvar w wrap\n\tvar err error\n\tif err = json.Unmarshal(body, &w); err != nil {\n\t\treturn err\n\t}\n\tu.Tag = w.Tag\n\tswitch u.Tag {\n\tcase \"filter_some\":\n\t\tu.FilterSome = w.FilterSome\n\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "7abc2e9fa97e01b4c3897539ff6d7278", "score": "0.6227222", "text": "func (a *okxAssetType) UnmarshalJSON(data []byte) error {\n\tvar t string\n\terr := json.Unmarshal(data, &t)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\ta.Item = GetAssetTypeFromInstrumentType(strings.ToUpper(t))\n\treturn nil\n}", "title": "" }, { "docid": "3e27ed8973aab859cb0ca07b12592d41", "score": "0.6220483", "text": "func (j *Bot) UnmarshalJSON(input []byte) error {\n\tfs := fflib.NewFFLexer(input)\n\treturn j.UnmarshalJSONFFLexer(fs, fflib.FFParse_map_start)\n}", "title": "" }, { "docid": "88d5e96c2dd5525182f3eed85f836b18", "score": "0.6217511", "text": "func (t *Then) UnmarshalJSON(data []byte) error {\n\tvar sch Schema\n\tif err := json.Unmarshal(data, &sch); err != nil {\n\t\treturn err\n\t}\n\t*t = Then(sch)\n\treturn nil\n}", "title": "" }, { "docid": "a44a0f4d2bb53cd1a2d1ee14e64d74e4", "score": "0.6210341", "text": "func (responseType *ResponseType) UnmarshalJSON(b []byte) error {\n\tvar str string\n\tif err := json.Unmarshal(b, &str); err != nil {\n\t\treturn err\n\t}\n\treturn responseType.UnmarshalString(str)\n}", "title": "" }, { "docid": "334ade55ffcd1b6e65a825f25dc0fb35", "score": "0.62086195", "text": "func (j *Rich) UnmarshalJSON(input []byte) error {\n\tfs := fflib.NewFFLexer(input)\n\treturn j.UnmarshalJSONFFLexer(fs, fflib.FFParse_map_start)\n}", "title": "" }, { "docid": "f9f05ebc0750c97f478797f36b420aac", "score": "0.61806697", "text": "func (x *NamePart_Type) 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 = NamePart_Type(num)\n\treturn nil\n}", "title": "" }, { "docid": "233bad1b6f048f08e0bd745afc5da63f", "score": "0.6179697", "text": "func (targetType *TargetType) UnmarshalJSON(byteResult []byte) error {\n\tvar stringValue string\n\tif err := json.Unmarshal(byteResult, &stringValue); err != nil {\n\t\treturn err\n\t}\n\n\ttypes := map[string]TargetType{\n\t\t\"\": TargetType(0),\n\t\tendpoint: ManagedEndpoint,\n\t\tdg: DynamicGroup,\n\t\tsite: Site,\n\t\tdynamicSite: DynamicSite,\n\t}\n\n\tvar ok bool\n\t*targetType, ok = types[stringValue]\n\tif !ok {\n\t\treturn fmt.Errorf(\"incorrect Type of Targets: %s\", stringValue)\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "6abdcd9c971e0ca151a46b945fa13f49", "score": "0.6177382", "text": "func (m *TUF) UnmarshalJSON(raw []byte) error {\n\tvar data struct {\n\n\t\t// api version\n\t\t// Required: true\n\t\t// Pattern: ^(0|[1-9]\\d*)\\.(0|[1-9]\\d*)\\.(0|[1-9]\\d*)(?:-((?:0|[1-9]\\d*|\\d*[a-zA-Z-][0-9a-zA-Z-]*)(?:\\.(?:0|[1-9]\\d*|\\d*[a-zA-Z-][0-9a-zA-Z-]*))*))?(?:\\+([0-9a-zA-Z-]+(?:\\.[0-9a-zA-Z-]+)*))?$\n\t\tAPIVersion *string `json:\"apiVersion\"`\n\n\t\t// spec\n\t\t// Required: true\n\t\tSpec TUFSchema `json:\"spec\"`\n\t}\n\tbuf := bytes.NewBuffer(raw)\n\tdec := json.NewDecoder(buf)\n\tdec.UseNumber()\n\n\tif err := dec.Decode(&data); err != nil {\n\t\treturn err\n\t}\n\n\tvar base struct {\n\t\t/* Just the base type fields. Used for unmashalling polymorphic types.*/\n\n\t\tKind string `json:\"kind\"`\n\t}\n\tbuf = bytes.NewBuffer(raw)\n\tdec = json.NewDecoder(buf)\n\tdec.UseNumber()\n\n\tif err := dec.Decode(&base); err != nil {\n\t\treturn err\n\t}\n\n\tvar result TUF\n\n\tif base.Kind != result.Kind() {\n\t\t/* Not the type we're looking for. */\n\t\treturn errors.New(422, \"invalid kind value: %q\", base.Kind)\n\t}\n\n\tresult.APIVersion = data.APIVersion\n\tresult.Spec = data.Spec\n\n\t*m = result\n\n\treturn nil\n}", "title": "" }, { "docid": "e057c18b3aec055f6e8f3f2833a81ae7", "score": "0.6175011", "text": "func (x *ETeamFanContentAssetType) 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 = ETeamFanContentAssetType(num)\n\treturn nil\n}", "title": "" }, { "docid": "1fd4fd9b9daea7a08d60273f5fb85506", "score": "0.6152137", "text": "func (a *AttributeTypeAndValue) UnmarshalJSON(b []byte) error {\n\taux := auxAttributeTypeAndValue{}\n\tif err := json.Unmarshal(b, &aux); err != nil {\n\t\treturn err\n\t}\n\ta.Type = nil\n\tif len(aux.Type) > 0 {\n\t\tparts := strings.Split(aux.Type, \".\")\n\t\tfor _, part := range parts {\n\t\t\ti, err := strconv.Atoi(part)\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t\ta.Type = append(a.Type, i)\n\t\t}\n\t}\n\ta.Value = aux.Value\n\treturn nil\n}", "title": "" }, { "docid": "7ddfa923953af75db239e1570a43195e", "score": "0.61520946", "text": "func (j *JSONSerialization) 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 \"properties\":\n\t\t\terr = unpopulate(val, \"Properties\", &j.Properties)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"type\":\n\t\t\terr = unpopulate(val, \"Type\", &j.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\", j, err)\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "7ddfa923953af75db239e1570a43195e", "score": "0.61520946", "text": "func (j *JSONSerialization) 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 \"properties\":\n\t\t\terr = unpopulate(val, \"Properties\", &j.Properties)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"type\":\n\t\t\terr = unpopulate(val, \"Type\", &j.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\", j, err)\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "cd580942e6c29744c13b3179c081a3de", "score": "0.61519474", "text": "func (x *PeerType) 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 = PeerType(num)\n\treturn nil\n}", "title": "" }, { "docid": "f58026e7396560bcbed47111ae522ea5", "score": "0.61490184", "text": "func (x *QueryType) 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 = QueryType(num)\n\treturn nil\n}", "title": "" }, { "docid": "c4123caa370d3636ac84cc8c0ef9d879", "score": "0.614099", "text": "func (n *InterfaceCommon) UnmarshalJSON(b []byte) error {\n\tn.P, n.Error = nil, nil\n\tvar value interface{}\n\tif err := json.Unmarshal(b, &value); err != nil {\n\t\tn.Error = err\n\t\treturn err\n\t}\n\tif value == nil {\n\t\treturn nil\n\t}\n\tn.P = value\n\treturn nil\n}", "title": "" }, { "docid": "3afcec1ef9707e4e1d086e6473221509", "score": "0.6137945", "text": "func (strct *ValueOrMethodCall) UnmarshalJSON(b []byte) error {\n\tvar err error\n\n\tif err = json.Unmarshal(b, &strct.Call); err == nil {\n\t\treturn nil\n\t}\n\tif err = json.Unmarshal(b, &strct.Single); err == nil {\n\t\treturn nil\n\t}\n\n\treturn err\n}", "title": "" }, { "docid": "07edf180a27b04dc4df6649253f1a43d", "score": "0.6131168", "text": "func (c *Channel) UnmarshalJSON(b []byte) error {\n\tvar raw map[string]interface{}\n\tif err := json.Unmarshal(b, &raw); err != nil {\n\t\treturn err\n\t}\n\tct, ok := raw[\"type\"]\n\tif ok {\n\t\tc.Type = ct.(string)\n\t\tc.Raw = raw\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "f113f5c10e17575e00dc79c479d9f15b", "score": "0.6130035", "text": "func (r *RequestType) UnmarshalJSON(data []byte) error {\n\trt := RequestTypeUndefined\n\t// Convert to string whilst removing quotes\n\tx := string(data)[1 : len(data)-1]\n\t// Find the type in the range of values\n\tfor i, s := range requestTypeStrings {\n\t\tif strings.ToLower(s) == strings.ToLower(x) {\n\t\t\trt = RequestType(i)\n\t\t}\n\t}\n\t*r = rt\n\treturn nil\n}", "title": "" }, { "docid": "986fdc4b1457290ffb8f0434b23341a8", "score": "0.6127075", "text": "func (v *Common) UnmarshalJSON(data []byte) error {\n\tr := jlexer.Lexer{Data: data}\n\teasyjson1c889379DecodeGithubComToomoreLazyflickrgoJsonstruct25(&r, v)\n\treturn r.Error()\n}", "title": "" }, { "docid": "60e1704eb6a23869694b282ad16e785e", "score": "0.6122967", "text": "func (a *AuthInfoBase) 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 \"authType\":\n\t\t\terr = unpopulate(val, \"AuthType\", &a.AuthType)\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}", "title": "" }, { "docid": "abfe84080a4836e91a470e3de0f869cc", "score": "0.61211437", "text": "func (obj *ProductTypeUpdate) UnmarshalJSON(data []byte) error {\n\ttype Alias ProductTypeUpdate\n\tif err := json.Unmarshal(data, (*Alias)(obj)); err != nil {\n\t\treturn err\n\t}\n\tfor i := range obj.Actions {\n\t\tvar err error\n\t\tobj.Actions[i], err = mapDiscriminatorProductTypeUpdateAction(obj.Actions[i])\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "2288c3b2cd845560ec0cd49349ad9fcc", "score": "0.61193573", "text": "func (obj *expRelationshipType) UnmarshalJSON(data []byte) error {\n\tvar ok bool\n\tif *obj, ok = genJSONStrToRelationshipType[noQuotes(data)]; !ok {\n\t\treturn fmt.Errorf(\"unrecognized RelationshipType value %v\", string(data))\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "8c412e46d79bf097be448f308190b1ee", "score": "0.6117125", "text": "func (t *memoryType) UnmarshalJSON(data []byte) error {\n\tival := 0\n\tif err := json.Unmarshal(data, &ival); err == nil {\n\t\t*t = memoryType(ival)\n\t\treturn nil\n\t}\n\n\tvalue := \"\"\n\tif err := json.Unmarshal(data, &value); err != nil {\n\t\treturn policyError(\"failed to unmarshal memoryType '%s': %v\",\n\t\t\tstring(data), err)\n\t}\n\n\tmtype, err := parseMemoryType(value)\n\tif err != nil {\n\t\treturn policyError(\"failed parse memoryType '%s': %v\", value, err)\n\t}\n\n\t*t = mtype\n\treturn nil\n}", "title": "" }, { "docid": "75e3154797bad07bc52d6c279ef5f304", "score": "0.6107412", "text": "func (m *Type2) UnmarshalJSON(raw []byte) error {\n\tvar data struct {\n\t\tType string `json:\"type,omitempty\"`\n\n\t\t/* length\n\t\t */\n\t\tLength int64 `json:\"length,omitempty\"`\n\t}\n\n\tbuf := bytes.NewBuffer(raw)\n\tdec := json.NewDecoder(buf)\n\tdec.UseNumber()\n\n\tif err := dec.Decode(&data); err != nil {\n\t\treturn err\n\t}\n\n\tm.Length = data.Length\n\n\treturn nil\n}", "title": "" }, { "docid": "d97f5552e2c87ea5b4c5418235d37799", "score": "0.61039674", "text": "func (v *PostUniverseIdsInventoryType) UnmarshalJSON(data []byte) error {\n\tr := jlexer.Lexer{Data: data}\n\teasyjsonD77d07e3DecodeGithubComAntihaxGoesiEsi1(&r, v)\n\treturn r.Error()\n}", "title": "" }, { "docid": "5af6816f562e54070e2a117e69e6e176", "score": "0.60912347", "text": "func (rt *ResourceType) 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\tvar v *json.RawMessage\n\n\tv = m[\"properties\"]\n\tif v != nil {\n\t\tvar properties ReadableProperties\n\t\terr = json.Unmarshal(*m[\"properties\"], &properties)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\trt.ReadableProperties = &properties\n\t}\n\n\tv = m[\"id\"]\n\tif v != nil {\n\t\tvar ID string\n\t\terr = json.Unmarshal(*m[\"id\"], &ID)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\trt.ID = &ID\n\t}\n\n\tv = m[\"name\"]\n\tif v != nil {\n\t\tvar name string\n\t\terr = json.Unmarshal(*m[\"name\"], &name)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\trt.Name = &name\n\t}\n\n\tv = m[\"type\"]\n\tif v != nil {\n\t\tvar typeVar string\n\t\terr = json.Unmarshal(*m[\"type\"], &typeVar)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\trt.Type = &typeVar\n\t}\n\n\tv = m[\"location\"]\n\tif v != nil {\n\t\tvar location string\n\t\terr = json.Unmarshal(*m[\"location\"], &location)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\trt.Location = &location\n\t}\n\n\tv = m[\"tags\"]\n\tif v != nil {\n\t\tvar tags map[string]*string\n\t\terr = json.Unmarshal(*m[\"tags\"], &tags)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\trt.Tags = &tags\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "e8bf44134c15c559736087d5487d77c4", "score": "0.6088964", "text": "func (rt *ResourceType) 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 readableProperties ReadableProperties\n\t\t\t\terr = json.Unmarshal(*v, &readableProperties)\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn err\n\t\t\t\t}\n\t\t\t\trt.ReadableProperties = &readableProperties\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\trt.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\trt.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\trt.Type = &typeVar\n\t\t\t}\n\t\tcase \"location\":\n\t\t\tif v != nil {\n\t\t\t\tvar location string\n\t\t\t\terr = json.Unmarshal(*v, &location)\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn err\n\t\t\t\t}\n\t\t\t\trt.Location = &location\n\t\t\t}\n\t\tcase \"tags\":\n\t\t\tif v != nil {\n\t\t\t\tvar tags map[string]*string\n\t\t\t\terr = json.Unmarshal(*v, &tags)\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn err\n\t\t\t\t}\n\t\t\t\trt.Tags = tags\n\t\t\t}\n\t\t}\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "c1752d46dcc868a02b8096a7f60e7487", "score": "0.60823196", "text": "func (pt *PersistenceType) UnmarshalJSON(data []byte) error {\n\tvar j string\n\terr := json.Unmarshal(data, &j)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tresult, ok := persistenceTypeToEnum[j]\n\tif !ok {\n\t\treturn errors.New(\"couldn't find matching PersistenceType enum value\")\n\t}\n\n\t*pt = result\n\treturn nil\n}", "title": "" }, { "docid": "24713b980f6ebea7394edf7630d220e5", "score": "0.60753906", "text": "func (x *EChatRoomType) 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 = EChatRoomType(num)\n\treturn nil\n}", "title": "" }, { "docid": "3e56bde33416f128b630fe05e73f8d9c", "score": "0.60667676", "text": "func (o *DataItemViber) UnmarshalJSON(raw []byte) error {\n\t// AO0\n\tvar dataAO0 struct {\n\t\tID string `json:\"ID,omitempty\"`\n\n\t\tType string `json:\"type,omitempty\"`\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.Type = dataAO0.Type\n\n\t// AO1\n\tvar aO1 models.ChannelParamsViber\n\tif err := swag.ReadJSON(raw, &aO1); err != nil {\n\t\treturn err\n\t}\n\to.ChannelParamsViber = aO1\n\n\treturn nil\n}", "title": "" }, { "docid": "c8e843d9c1c9c6e51c372c0e88ccbb18", "score": "0.6057933", "text": "func (x *CloseType) 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 = CloseType(num)\n\treturn nil\n}", "title": "" }, { "docid": "3694e828a781bddc808c6bf5af5857c2", "score": "0.6054923", "text": "func (x *FrameType) 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 = FrameType(num)\n\treturn nil\n}", "title": "" }, { "docid": "71798c7707793c4ad57c02bad57dec33", "score": "0.6053299", "text": "func (f *If) UnmarshalJSON(data []byte) error {\n\tvar sch Schema\n\tif err := json.Unmarshal(data, &sch); err != nil {\n\t\treturn err\n\t}\n\t*f = If(sch)\n\treturn nil\n}", "title": "" }, { "docid": "ed6660690a91635697a596842c240b05", "score": "0.60504895", "text": "func (a *AzureResourcePropertiesBase) 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 \"type\":\n\t\t\terr = unpopulate(val, \"Type\", &a.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\", a, err)\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "d0dfe2e12a1eb5a3a8b637da79b7ef6a", "score": "0.6032973", "text": "func (p *Payment) UnmarshalJSON(data []byte) error {\n\terr := json.Unmarshal(data, &p.paymentData)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tvar detail Detail\n\tif p.Type == \"ach\" {\n\t\tdetail = new(achDetail)\n\t} else if p.Type == \"credit_card\" {\n\t\tdetail = new(cardDetail)\n\t} else {\n\t\treturn fmt.Errorf(\"unrecognized type\")\n\t}\n\n\terr = json.Unmarshal(p.paymentData.Detail, detail)\n\tif err != nil {\n\t\treturn err\n\t}\n\tp.Detail = detail\n\treturn nil\n}", "title": "" }, { "docid": "32a08ccce851236f3748062f542b3ab0", "score": "0.60325253", "text": "func (v *MyBody) UnmarshalJSON(data []byte) error {\n\tr := jlexer.Lexer{Data: data}\n\teasyjson635ef9aeDecodeGithubComUberZanzibarRuntime(&r, v)\n\treturn r.Error()\n}", "title": "" }, { "docid": "738f9fa15128fb78c6229a2cd911400c", "score": "0.602751", "text": "func (bt *BettingType) UnmarshalJSON(data []byte) error {\n\tvar j string\n\terr := json.Unmarshal(data, &j)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tresult, ok := bettingTypeToEnum[j]\n\tif !ok {\n\t\treturn errors.New(\"couldn't find matching BettingType enum value\")\n\t}\n\n\t*bt = result\n\treturn nil\n}", "title": "" }, { "docid": "91f2ba6963e429ece13b883033f7058a", "score": "0.6027233", "text": "func (v *GetUniverseTypesTypeIdOk) UnmarshalJSON(data []byte) error {\n\tr := jlexer.Lexer{Data: data}\n\teasyjson2d81da92DecodeGithubComAntihaxGoesiEsi1(&r, v)\n\treturn r.Error()\n}", "title": "" }, { "docid": "6557ba6ef9c56b699d813522ca5b055e", "score": "0.60267204", "text": "func (rt *RecordType) UnmarshalJSON(data []byte) error {\n\tvar s string\n\tif err := json.Unmarshal(data, &s); err != nil {\n\t\treturn err\n\t}\n\tt, err := recordTypeParse(s)\n\tif err != nil {\n\t\treturn err\n\t}\n\t*rt = *t\n\treturn nil\n}", "title": "" }, { "docid": "6ae02c0fc5db3ff53b1b90ad277bb774", "score": "0.6017027", "text": "func UnmarshalJSON(data []byte, v interface{}) error {\n\tif vm, ok := v.(easyjson.Unmarshaler); ok {\n\t\treturn easyjson.Unmarshal(data, vm)\n\t}\n\n\tif vm, ok := v.(json.Unmarshaler); ok {\n\t\treturn vm.UnmarshalJSON(data)\n\t}\n\n\treturn json.Unmarshal(data, v)\n}", "title": "" }, { "docid": "629e6bd81817411606301d9d66585e52", "score": "0.60137635", "text": "func (powercontrol *PowerControl) UnmarshalJSON(b []byte) error { //nolint:dupl\n\ttype temp PowerControl\n\ttype t1 struct {\n\t\ttemp\n\t}\n\tvar t t1\n\n\terr := json.Unmarshal(b, &t)\n\tif err != nil {\n\t\t// See if we need to handle converting MemberID\n\t\tvar t2 struct {\n\t\t\tt1\n\t\t\tMemberID int `json:\"MemberId\"`\n\t\t}\n\t\terr2 := json.Unmarshal(b, &t2)\n\n\t\tif err2 != nil {\n\t\t\t// Return the original error\n\t\t\treturn err\n\t\t}\n\n\t\t// Convert the numeric member ID to a string\n\t\tt = t2.t1\n\t\tt.temp.MemberID = strconv.Itoa(t2.MemberID)\n\t}\n\n\t// Extract the links to other entities for later\n\t*powercontrol = PowerControl(t.temp)\n\n\treturn nil\n}", "title": "" }, { "docid": "08bb2a499fd6163e72a87280be5d7915", "score": "0.601182", "text": "func (v *BaseObjectWithName) UnmarshalJSON(data []byte) error {\n\tr := jlexer.Lexer{Data: data}\n\teasyjsonC7452bc1DecodeGithubComStek29Vk86(&r, v)\n\treturn r.Error()\n}", "title": "" }, { "docid": "7fbd62795420fe97d9a071f3dc6ab0e6", "score": "0.6009801", "text": "func (command *Command) UnmarshalJSON(data []byte) error {\n\n\t// Helper struct to get type\n\ttemp := struct {\n\t\tType string `json:\"type\"`\n\t}{}\n\tif err := json.Unmarshal(data, &temp); err != nil {\n\t\treturn err\n\t}\n\n\tif temp.Type == \"GetStatus\" {\n\t\tcommand.GetStatus = &GetStatus{}\n\n\t} else if temp.Type == \"Connect\" {\n\t\terr := json.Unmarshal(data, &command.Connect)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t} else if temp.Type == \"Disconnect\" {\n\t\tcommand.Disconnect = &Disconnect{}\n\n\t} else if temp.Type == \"Discover\" {\n\n\t\terr := json.Unmarshal(data, &command.Discover)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t} else {\n\t\treturn errors.New(\"can not decode unknown command\")\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "90aeaf99d95ce81e623f1733bbe9cf71", "score": "0.6003918", "text": "func (s *Source) UnmarshalJSON(data []byte) error {\n\ttype source Source\n\tvar v source\n\tif err := json.Unmarshal(data, &v); err != nil {\n\t\treturn err\n\t}\n\t*s = Source(v)\n\n\tvar raw map[string]interface{}\n\tif err := json.Unmarshal(data, &raw); err != nil {\n\t\treturn err\n\t}\n\n\tif d, ok := raw[s.Type]; ok {\n\t\tif m, ok := d.(map[string]interface{}); ok {\n\t\t\ts.TypeData = m\n\t\t}\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "83db67abdc9f9fba03eb0fb3bf789b0c", "score": "0.59931004", "text": "func (i *ItemFull) UnmarshalJSON(data []byte) error {\n\t// Step 1.\n\tfields := map[string]interface{}{}\n\terr := json.Unmarshal(data, &fields)\n\tif err != nil {\n\t\treturn errors.New(\"invalid JSON in item data\")\n\t}\n\n\t*i = ItemFull{}\n\t// Step 2 - Format owner as UserModel.Info struct\n\trawOwner, ok := fields[\"owner\"]\n\tif ok {\n\t\tjsonOwner, err := json.Marshal(rawOwner)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\towner := model.Info{}\n\t\tif err = json.Unmarshal(jsonOwner, &owner); err != nil {\n\t\t\treturn err\n\t\t}\n\t\ti.Owner = &owner\n\n\t}\n\n\tchassis.StringField(&i.ID, fields, \"id\")\n\tchassis.StringField(&i.Slug, fields, \"slug\")\n\ttmp := \"\"\n\tchassis.StringField(&tmp, fields, \"item_type\")\n\tif err = i.ItemType.FromString(tmp); err != nil {\n\t\treturn errors.New(\"invalid item type '\" + tmp + \"'\")\n\t}\n\n\tchassis.StringField(&i.Lang, fields, \"lang\")\n\tchassis.StringField(&i.Name, fields, \"name\")\n\tchassis.StringField(&i.Description, fields, \"description\")\n\tchassis.StringField(&i.FeaturedPicture, fields, \"featured_picture\")\n\n\t// we are deleting this fields because they are not needed when calling internally\n\tdelete(fields, \"upvotes\")\n\tdelete(fields, \"user_upvoted\")\n\tdelete(fields, \"rank\")\n\tdelete(fields, \"collections\")\n\tdelete(fields, \"links\")\n\n\t// Step 7.\n\ti.Attrs = fields\n\n\treturn nil\n}", "title": "" }, { "docid": "66c5359648c7e2f5b9f77d4c2ccd634f", "score": "0.59886837", "text": "func (dst *CloudBaseSkuRelationship) UnmarshalJSON(data []byte) error {\n\tvar err error\n\t// this object is nullable so check if the payload is null or empty string\n\tif string(data) == \"\" || string(data) == \"{}\" {\n\t\treturn nil\n\t}\n\n\t// use discriminator value to speed up the lookup\n\tvar jsonDict map[string]interface{}\n\terr = newStrictDecoder(data).Decode(&jsonDict)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"Failed to unmarshal JSON into map for the discriminator lookup.\")\n\t}\n\n\t// check if the discriminator value is 'cloud.BaseSku'\n\tif jsonDict[\"ClassId\"] == \"cloud.BaseSku\" {\n\t\t// try to unmarshal JSON data into CloudBaseSku\n\t\terr = json.Unmarshal(data, &dst.CloudBaseSku)\n\t\tif err == nil {\n\t\t\treturn nil // data stored in dst.CloudBaseSku, return on the first match\n\t\t} else {\n\t\t\tdst.CloudBaseSku = nil\n\t\t\treturn fmt.Errorf(\"Failed to unmarshal CloudBaseSkuRelationship as CloudBaseSku: %s\", err.Error())\n\t\t}\n\t}\n\n\t// check if the discriminator value is 'mo.MoRef'\n\tif jsonDict[\"ClassId\"] == \"mo.MoRef\" {\n\t\t// try to unmarshal JSON data into MoMoRef\n\t\terr = json.Unmarshal(data, &dst.MoMoRef)\n\t\tif err == nil {\n\t\t\treturn nil // data stored in dst.MoMoRef, return on the first match\n\t\t} else {\n\t\t\tdst.MoMoRef = nil\n\t\t\treturn fmt.Errorf(\"Failed to unmarshal CloudBaseSkuRelationship as MoMoRef: %s\", err.Error())\n\t\t}\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "a695e742ceaa5695ddb2a1bc0eb52574", "score": "0.5985186", "text": "func (v *ItemUnion) UnmarshalJSON(data []byte) error {\n\tr := jlexer.Lexer{Data: data}\n\teasyjsonD2b7633eDecodeGithubComRestreamGophercon2019FtTesterModels1(&r, v)\n\treturn r.Error()\n}", "title": "" }, { "docid": "58ab619a579450ee5324b0176cb594e7", "score": "0.59809417", "text": "func (r *CarbUnitsType) UnmarshalJSON(data []byte) error {\n\tvar err error\n\tswitch string(data) {\n\tcase `\"Grams\"`:\n\t\t*r = Grams\n\tcase `\"Exchanges\"`:\n\t\t*r = Exchanges\n\tdefault:\n\t\terr = fmt.Errorf(\"unknown CarbUnitsType (%s)\", data)\n\t}\n\treturn err\n}", "title": "" }, { "docid": "2423f0b034b1e4a855e6a78ee7e54bd6", "score": "0.5979137", "text": "func (v *MessageTypingState) UnmarshalJSON(data []byte) error {\n\tr := jlexer.Lexer{Data: data}\n\teasyjsonC7452bc1DecodeGithubComStek29Vk40(&r, v)\n\treturn r.Error()\n}", "title": "" }, { "docid": "f481c34b713758542d3940d6f84e008e", "score": "0.5978141", "text": "func (v *Post) UnmarshalJSON(data []byte) error {\n\tr := jlexer.Lexer{Data: data}\n\teasyjsonD2b7633eDecodeForumApplicationModels11(&r, v)\n\treturn r.Error()\n}", "title": "" }, { "docid": "9f0f66946c1bfc40c84d3c27eddea5ab", "score": "0.59779596", "text": "func (p *Provider) 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 statusResult StatusResult\n\t\t\t\terr = json.Unmarshal(*v, &statusResult)\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn err\n\t\t\t\t}\n\t\t\t\tp.StatusResult = &statusResult\n\t\t\t}\n\t\tcase \"tags\":\n\t\t\tif v != nil {\n\t\t\t\tvar tags map[string]*string\n\t\t\t\terr = json.Unmarshal(*v, &tags)\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn err\n\t\t\t\t}\n\t\t\t\tp.Tags = tags\n\t\t\t}\n\t\tcase \"location\":\n\t\t\tif v != nil {\n\t\t\t\tvar location string\n\t\t\t\terr = json.Unmarshal(*v, &location)\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn err\n\t\t\t\t}\n\t\t\t\tp.Location = &location\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\tp.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\tp.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\tp.Type = &typeVar\n\t\t\t}\n\t\t}\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "174ed52302d6774b3ab6c99989b57e50", "score": "0.59758556", "text": "func (v *BaseResponse) UnmarshalJSON(data []byte) error {\n\tr := jlexer.Lexer{Data: data}\n\teasyjsonC5a4559bDecodeBattleshipAppGeneratedModels14(&r, v)\n\treturn r.Error()\n}", "title": "" }, { "docid": "fb5dc6f739801e79acfe28d95c84609e", "score": "0.5969708", "text": "func (v *Actor) UnmarshalJSON(data []byte) error {\n\tr := jlexer.Lexer{Data: data}\n\teasyjsonA97f39aeDecodeGithubComGoParkMailRu20202JigglypufInternalPkgModels8(&r, v)\n\treturn r.Error()\n}", "title": "" }, { "docid": "203dd39ddbf528bf295b51965c507aec", "score": "0.59671146", "text": "func (st *SegmentType) UnmarshalJSON(data []byte) error {\n\tvar j string\n\terr := json.Unmarshal(data, &j)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tresult, ok := segmentTypeToEnum[j]\n\tif !ok {\n\t\treturn errors.New(\"couldn't find matching SegmentType enum value\")\n\t}\n\n\t*st = result\n\treturn nil\n}", "title": "" }, { "docid": "25b1246babadcebc25d8be285d4b615b", "score": "0.59601295", "text": "func (rid *RelationID) UnmarshalJSON(b []byte) error {\n\tr := new(relationID)\n\tif err := unmarshalJSONFlattenByType(b, r); err != nil {\n\t\treturn err\n\t}\n\n\t*rid = RelationID(*r)\n\treturn nil\n}", "title": "" }, { "docid": "05bcfc664d884a07f61c649dc08fcc80", "score": "0.59421515", "text": "func (x *NetworkDevice_TypeId) 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 = NetworkDevice_TypeId(num)\n\treturn nil\n}", "title": "" }, { "docid": "91716cc4c556826b37e0dc5ba48a612e", "score": "0.5941384", "text": "func (j *OEmbed) UnmarshalJSON(input []byte) error {\n\tfs := fflib.NewFFLexer(input)\n\treturn j.UnmarshalJSONFFLexer(fs, fflib.FFParse_map_start)\n}", "title": "" }, { "docid": "74aaab48bb13acf1f76259a2e0a18429", "score": "0.5939016", "text": "func (v *WidgetSummaryType) UnmarshalJSON(src []byte) error {\n\tvar value string\n\terr := json.Unmarshal(src, &value)\n\tif err != nil {\n\t\treturn err\n\t}\n\t*v = WidgetSummaryType(value)\n\treturn nil\n}", "title": "" }, { "docid": "6026dcbb6e7346352a52cf07d16b5f04", "score": "0.5938954", "text": "func (v *Vote) UnmarshalJSON(data []byte) error {\n\tr := jlexer.Lexer{Data: data}\n\teasyjsonD2b7633eDecodeForumApplicationModels(&r, v)\n\treturn r.Error()\n}", "title": "" }, { "docid": "9f7dbc63bae53150dac2c6c30376d729", "score": "0.5938809", "text": "func (u *Unstructured) UnmarshalJSON(b []byte) error {\n\treturn json.Unmarshal(b, &u.Object)\n}", "title": "" }, { "docid": "f07bf73cce2b42b2bcebf52c07b49422", "score": "0.59378093", "text": "func (p *ParquetSerialization) 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\", p, err)\n\t}\n\tfor key, val := range rawMsg {\n\t\tvar err error\n\t\tswitch key {\n\t\tcase \"properties\":\n\t\t\terr = unpopulate(val, \"Properties\", &p.Properties)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"type\":\n\t\t\terr = unpopulate(val, \"Type\", &p.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\", p, err)\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "f07bf73cce2b42b2bcebf52c07b49422", "score": "0.59378093", "text": "func (p *ParquetSerialization) 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\", p, err)\n\t}\n\tfor key, val := range rawMsg {\n\t\tvar err error\n\t\tswitch key {\n\t\tcase \"properties\":\n\t\t\terr = unpopulate(val, \"Properties\", &p.Properties)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"type\":\n\t\t\terr = unpopulate(val, \"Type\", &p.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\", p, err)\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "00524ffdc541c21f77e9509ca134233d", "score": "0.5937006", "text": "func (f *File) UnmarshalJSON(b []byte) error {\n\tff := new(file)\n\tif err := unmarshalJSONFlattenByType(b, ff); err != nil {\n\t\treturn err\n\t}\n\n\t*f = File(*ff)\n\treturn nil\n}", "title": "" }, { "docid": "8fc359a7750b2be9198e10daa82fc4e3", "score": "0.5931501", "text": "func (e *ShadowRootType) UnmarshalJSON(data []byte) error {\n\tswitch string(data) {\n\tcase \"null\":\n\t\t*e = 0\n\tcase \"\\\"user-agent\\\"\":\n\t\t*e = 1\n\tcase \"\\\"open\\\"\":\n\t\t*e = 2\n\tcase \"\\\"closed\\\"\":\n\t\t*e = 3\n\tdefault:\n\t\treturn fmt.Errorf(\"dom.ShadowRootType: UnmarshalJSON on bad input: %s\", data)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "66ae89accfad33f11f7d3fea09fe3ab4", "score": "0.59277844", "text": "func UnmarshalJSON(body io.ReadCloser, v interface{}) error {\n\tdefer body.Close()\n\terr := json.NewDecoder(body).Decode(&v)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "5aa41d68d3546cbacff524bd0ea3e8ba", "score": "0.59258986", "text": "func (r *ResourceType) UnmarshalJSON(b []byte) error {\n\ttype tmp ResourceType\n\tvar s struct {\n\t\ttmp\n\t\tAttributes map[string]interface{} `json:\"attributes\"`\n\t}\n\terr := json.Unmarshal(b, &s)\n\tif err != nil {\n\t\treturn err\n\t}\n\t*r = ResourceType(s.tmp)\n\n\tif s.Attributes == nil {\n\t\treturn nil\n\t}\n\n\t// Populate attributes from the JSON map structure.\n\tattributes := make(map[string]Attribute)\n\tfor attributeName, attributeValues := range s.Attributes {\n\t\tattribute := new(Attribute)\n\t\tattribute.Details = make(map[string]interface{})\n\n\t\tattributeValuesMap, ok := attributeValues.(map[string]interface{})\n\t\tif !ok {\n\t\t\t// Got some strange resource type attribute representation, skip it.\n\t\t\tcontinue\n\t\t}\n\n\t\t// Populate extra and type attribute values.\n\t\tfor k, v := range attributeValuesMap {\n\t\t\tif k == \"type\" {\n\t\t\t\tif attributeType, ok := v.(string); ok {\n\t\t\t\t\tattribute.Type = attributeType\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tattribute.Details[k] = v\n\t\t\t}\n\t\t}\n\t\tattributes[attributeName] = *attribute\n\t}\n\n\tr.Attributes = attributes\n\n\treturn err\n}", "title": "" }, { "docid": "1304ddf4be7c6b1558d4e69aec586bf2", "score": "0.59258354", "text": "func (u *EventType) UnmarshalJSON(body []byte) error {\n\ttype wrap struct {\n\t\tdropbox.Tagged\n\t}\n\tvar w wrap\n\tvar err error\n\tif err = json.Unmarshal(body, &w); err != nil {\n\t\treturn err\n\t}\n\tu.Tag = w.Tag\n\tswitch u.Tag {\n\tcase \"admin_alerting_alert_state_changed\":\n\t\tif err = json.Unmarshal(body, &u.AdminAlertingAlertStateChanged); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"admin_alerting_changed_alert_config\":\n\t\tif err = json.Unmarshal(body, &u.AdminAlertingChangedAlertConfig); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"admin_alerting_triggered_alert\":\n\t\tif err = json.Unmarshal(body, &u.AdminAlertingTriggeredAlert); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"app_blocked_by_permissions\":\n\t\tif err = json.Unmarshal(body, &u.AppBlockedByPermissions); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"app_link_team\":\n\t\tif err = json.Unmarshal(body, &u.AppLinkTeam); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"app_link_user\":\n\t\tif err = json.Unmarshal(body, &u.AppLinkUser); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"app_unlink_team\":\n\t\tif err = json.Unmarshal(body, &u.AppUnlinkTeam); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"app_unlink_user\":\n\t\tif err = json.Unmarshal(body, &u.AppUnlinkUser); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"integration_connected\":\n\t\tif err = json.Unmarshal(body, &u.IntegrationConnected); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"integration_disconnected\":\n\t\tif err = json.Unmarshal(body, &u.IntegrationDisconnected); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"file_add_comment\":\n\t\tif err = json.Unmarshal(body, &u.FileAddComment); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"file_change_comment_subscription\":\n\t\tif err = json.Unmarshal(body, &u.FileChangeCommentSubscription); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"file_delete_comment\":\n\t\tif err = json.Unmarshal(body, &u.FileDeleteComment); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"file_edit_comment\":\n\t\tif err = json.Unmarshal(body, &u.FileEditComment); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"file_like_comment\":\n\t\tif err = json.Unmarshal(body, &u.FileLikeComment); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"file_resolve_comment\":\n\t\tif err = json.Unmarshal(body, &u.FileResolveComment); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"file_unlike_comment\":\n\t\tif err = json.Unmarshal(body, &u.FileUnlikeComment); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"file_unresolve_comment\":\n\t\tif err = json.Unmarshal(body, &u.FileUnresolveComment); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"governance_policy_add_folders\":\n\t\tif err = json.Unmarshal(body, &u.GovernancePolicyAddFolders); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"governance_policy_add_folder_failed\":\n\t\tif err = json.Unmarshal(body, &u.GovernancePolicyAddFolderFailed); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"governance_policy_content_disposed\":\n\t\tif err = json.Unmarshal(body, &u.GovernancePolicyContentDisposed); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"governance_policy_create\":\n\t\tif err = json.Unmarshal(body, &u.GovernancePolicyCreate); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"governance_policy_delete\":\n\t\tif err = json.Unmarshal(body, &u.GovernancePolicyDelete); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"governance_policy_edit_details\":\n\t\tif err = json.Unmarshal(body, &u.GovernancePolicyEditDetails); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"governance_policy_edit_duration\":\n\t\tif err = json.Unmarshal(body, &u.GovernancePolicyEditDuration); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"governance_policy_export_created\":\n\t\tif err = json.Unmarshal(body, &u.GovernancePolicyExportCreated); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"governance_policy_export_removed\":\n\t\tif err = json.Unmarshal(body, &u.GovernancePolicyExportRemoved); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"governance_policy_remove_folders\":\n\t\tif err = json.Unmarshal(body, &u.GovernancePolicyRemoveFolders); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"governance_policy_report_created\":\n\t\tif err = json.Unmarshal(body, &u.GovernancePolicyReportCreated); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"governance_policy_zip_part_downloaded\":\n\t\tif err = json.Unmarshal(body, &u.GovernancePolicyZipPartDownloaded); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"legal_holds_activate_a_hold\":\n\t\tif err = json.Unmarshal(body, &u.LegalHoldsActivateAHold); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"legal_holds_add_members\":\n\t\tif err = json.Unmarshal(body, &u.LegalHoldsAddMembers); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"legal_holds_change_hold_details\":\n\t\tif err = json.Unmarshal(body, &u.LegalHoldsChangeHoldDetails); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"legal_holds_change_hold_name\":\n\t\tif err = json.Unmarshal(body, &u.LegalHoldsChangeHoldName); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"legal_holds_export_a_hold\":\n\t\tif err = json.Unmarshal(body, &u.LegalHoldsExportAHold); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"legal_holds_export_cancelled\":\n\t\tif err = json.Unmarshal(body, &u.LegalHoldsExportCancelled); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"legal_holds_export_downloaded\":\n\t\tif err = json.Unmarshal(body, &u.LegalHoldsExportDownloaded); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"legal_holds_export_removed\":\n\t\tif err = json.Unmarshal(body, &u.LegalHoldsExportRemoved); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"legal_holds_release_a_hold\":\n\t\tif err = json.Unmarshal(body, &u.LegalHoldsReleaseAHold); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"legal_holds_remove_members\":\n\t\tif err = json.Unmarshal(body, &u.LegalHoldsRemoveMembers); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"legal_holds_report_a_hold\":\n\t\tif err = json.Unmarshal(body, &u.LegalHoldsReportAHold); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"device_change_ip_desktop\":\n\t\tif err = json.Unmarshal(body, &u.DeviceChangeIpDesktop); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"device_change_ip_mobile\":\n\t\tif err = json.Unmarshal(body, &u.DeviceChangeIpMobile); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"device_change_ip_web\":\n\t\tif err = json.Unmarshal(body, &u.DeviceChangeIpWeb); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"device_delete_on_unlink_fail\":\n\t\tif err = json.Unmarshal(body, &u.DeviceDeleteOnUnlinkFail); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"device_delete_on_unlink_success\":\n\t\tif err = json.Unmarshal(body, &u.DeviceDeleteOnUnlinkSuccess); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"device_link_fail\":\n\t\tif err = json.Unmarshal(body, &u.DeviceLinkFail); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"device_link_success\":\n\t\tif err = json.Unmarshal(body, &u.DeviceLinkSuccess); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"device_management_disabled\":\n\t\tif err = json.Unmarshal(body, &u.DeviceManagementDisabled); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"device_management_enabled\":\n\t\tif err = json.Unmarshal(body, &u.DeviceManagementEnabled); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"device_sync_backup_status_changed\":\n\t\tif err = json.Unmarshal(body, &u.DeviceSyncBackupStatusChanged); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"device_unlink\":\n\t\tif err = json.Unmarshal(body, &u.DeviceUnlink); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"dropbox_passwords_exported\":\n\t\tif err = json.Unmarshal(body, &u.DropboxPasswordsExported); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"dropbox_passwords_new_device_enrolled\":\n\t\tif err = json.Unmarshal(body, &u.DropboxPasswordsNewDeviceEnrolled); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"emm_refresh_auth_token\":\n\t\tif err = json.Unmarshal(body, &u.EmmRefreshAuthToken); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"external_drive_backup_eligibility_status_checked\":\n\t\tif err = json.Unmarshal(body, &u.ExternalDriveBackupEligibilityStatusChecked); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"external_drive_backup_status_changed\":\n\t\tif err = json.Unmarshal(body, &u.ExternalDriveBackupStatusChanged); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"account_capture_change_availability\":\n\t\tif err = json.Unmarshal(body, &u.AccountCaptureChangeAvailability); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"account_capture_migrate_account\":\n\t\tif err = json.Unmarshal(body, &u.AccountCaptureMigrateAccount); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"account_capture_notification_emails_sent\":\n\t\tif err = json.Unmarshal(body, &u.AccountCaptureNotificationEmailsSent); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"account_capture_relinquish_account\":\n\t\tif err = json.Unmarshal(body, &u.AccountCaptureRelinquishAccount); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"disabled_domain_invites\":\n\t\tif err = json.Unmarshal(body, &u.DisabledDomainInvites); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"domain_invites_approve_request_to_join_team\":\n\t\tif err = json.Unmarshal(body, &u.DomainInvitesApproveRequestToJoinTeam); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"domain_invites_decline_request_to_join_team\":\n\t\tif err = json.Unmarshal(body, &u.DomainInvitesDeclineRequestToJoinTeam); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"domain_invites_email_existing_users\":\n\t\tif err = json.Unmarshal(body, &u.DomainInvitesEmailExistingUsers); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"domain_invites_request_to_join_team\":\n\t\tif err = json.Unmarshal(body, &u.DomainInvitesRequestToJoinTeam); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"domain_invites_set_invite_new_user_pref_to_no\":\n\t\tif err = json.Unmarshal(body, &u.DomainInvitesSetInviteNewUserPrefToNo); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"domain_invites_set_invite_new_user_pref_to_yes\":\n\t\tif err = json.Unmarshal(body, &u.DomainInvitesSetInviteNewUserPrefToYes); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"domain_verification_add_domain_fail\":\n\t\tif err = json.Unmarshal(body, &u.DomainVerificationAddDomainFail); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"domain_verification_add_domain_success\":\n\t\tif err = json.Unmarshal(body, &u.DomainVerificationAddDomainSuccess); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"domain_verification_remove_domain\":\n\t\tif err = json.Unmarshal(body, &u.DomainVerificationRemoveDomain); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"enabled_domain_invites\":\n\t\tif err = json.Unmarshal(body, &u.EnabledDomainInvites); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"apply_naming_convention\":\n\t\tif err = json.Unmarshal(body, &u.ApplyNamingConvention); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"create_folder\":\n\t\tif err = json.Unmarshal(body, &u.CreateFolder); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"file_add\":\n\t\tif err = json.Unmarshal(body, &u.FileAdd); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"file_copy\":\n\t\tif err = json.Unmarshal(body, &u.FileCopy); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"file_delete\":\n\t\tif err = json.Unmarshal(body, &u.FileDelete); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"file_download\":\n\t\tif err = json.Unmarshal(body, &u.FileDownload); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"file_edit\":\n\t\tif err = json.Unmarshal(body, &u.FileEdit); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"file_get_copy_reference\":\n\t\tif err = json.Unmarshal(body, &u.FileGetCopyReference); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"file_locking_lock_status_changed\":\n\t\tif err = json.Unmarshal(body, &u.FileLockingLockStatusChanged); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"file_move\":\n\t\tif err = json.Unmarshal(body, &u.FileMove); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"file_permanently_delete\":\n\t\tif err = json.Unmarshal(body, &u.FilePermanentlyDelete); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"file_preview\":\n\t\tif err = json.Unmarshal(body, &u.FilePreview); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"file_rename\":\n\t\tif err = json.Unmarshal(body, &u.FileRename); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"file_restore\":\n\t\tif err = json.Unmarshal(body, &u.FileRestore); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"file_revert\":\n\t\tif err = json.Unmarshal(body, &u.FileRevert); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"file_rollback_changes\":\n\t\tif err = json.Unmarshal(body, &u.FileRollbackChanges); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"file_save_copy_reference\":\n\t\tif err = json.Unmarshal(body, &u.FileSaveCopyReference); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"folder_overview_description_changed\":\n\t\tif err = json.Unmarshal(body, &u.FolderOverviewDescriptionChanged); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"folder_overview_item_pinned\":\n\t\tif err = json.Unmarshal(body, &u.FolderOverviewItemPinned); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"folder_overview_item_unpinned\":\n\t\tif err = json.Unmarshal(body, &u.FolderOverviewItemUnpinned); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"object_label_added\":\n\t\tif err = json.Unmarshal(body, &u.ObjectLabelAdded); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"object_label_removed\":\n\t\tif err = json.Unmarshal(body, &u.ObjectLabelRemoved); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"object_label_updated_value\":\n\t\tif err = json.Unmarshal(body, &u.ObjectLabelUpdatedValue); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"organize_folder_with_tidy\":\n\t\tif err = json.Unmarshal(body, &u.OrganizeFolderWithTidy); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"rewind_folder\":\n\t\tif err = json.Unmarshal(body, &u.RewindFolder); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"undo_naming_convention\":\n\t\tif err = json.Unmarshal(body, &u.UndoNamingConvention); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"undo_organize_folder_with_tidy\":\n\t\tif err = json.Unmarshal(body, &u.UndoOrganizeFolderWithTidy); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"user_tags_added\":\n\t\tif err = json.Unmarshal(body, &u.UserTagsAdded); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"user_tags_removed\":\n\t\tif err = json.Unmarshal(body, &u.UserTagsRemoved); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"email_ingest_receive_file\":\n\t\tif err = json.Unmarshal(body, &u.EmailIngestReceiveFile); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"file_request_change\":\n\t\tif err = json.Unmarshal(body, &u.FileRequestChange); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"file_request_close\":\n\t\tif err = json.Unmarshal(body, &u.FileRequestClose); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"file_request_create\":\n\t\tif err = json.Unmarshal(body, &u.FileRequestCreate); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"file_request_delete\":\n\t\tif err = json.Unmarshal(body, &u.FileRequestDelete); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"file_request_receive_file\":\n\t\tif err = json.Unmarshal(body, &u.FileRequestReceiveFile); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"group_add_external_id\":\n\t\tif err = json.Unmarshal(body, &u.GroupAddExternalId); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"group_add_member\":\n\t\tif err = json.Unmarshal(body, &u.GroupAddMember); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"group_change_external_id\":\n\t\tif err = json.Unmarshal(body, &u.GroupChangeExternalId); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"group_change_management_type\":\n\t\tif err = json.Unmarshal(body, &u.GroupChangeManagementType); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"group_change_member_role\":\n\t\tif err = json.Unmarshal(body, &u.GroupChangeMemberRole); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"group_create\":\n\t\tif err = json.Unmarshal(body, &u.GroupCreate); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"group_delete\":\n\t\tif err = json.Unmarshal(body, &u.GroupDelete); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"group_description_updated\":\n\t\tif err = json.Unmarshal(body, &u.GroupDescriptionUpdated); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"group_join_policy_updated\":\n\t\tif err = json.Unmarshal(body, &u.GroupJoinPolicyUpdated); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"group_moved\":\n\t\tif err = json.Unmarshal(body, &u.GroupMoved); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"group_remove_external_id\":\n\t\tif err = json.Unmarshal(body, &u.GroupRemoveExternalId); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"group_remove_member\":\n\t\tif err = json.Unmarshal(body, &u.GroupRemoveMember); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"group_rename\":\n\t\tif err = json.Unmarshal(body, &u.GroupRename); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"account_lock_or_unlocked\":\n\t\tif err = json.Unmarshal(body, &u.AccountLockOrUnlocked); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"emm_error\":\n\t\tif err = json.Unmarshal(body, &u.EmmError); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"guest_admin_signed_in_via_trusted_teams\":\n\t\tif err = json.Unmarshal(body, &u.GuestAdminSignedInViaTrustedTeams); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"guest_admin_signed_out_via_trusted_teams\":\n\t\tif err = json.Unmarshal(body, &u.GuestAdminSignedOutViaTrustedTeams); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"login_fail\":\n\t\tif err = json.Unmarshal(body, &u.LoginFail); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"login_success\":\n\t\tif err = json.Unmarshal(body, &u.LoginSuccess); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"logout\":\n\t\tif err = json.Unmarshal(body, &u.Logout); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"reseller_support_session_end\":\n\t\tif err = json.Unmarshal(body, &u.ResellerSupportSessionEnd); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"reseller_support_session_start\":\n\t\tif err = json.Unmarshal(body, &u.ResellerSupportSessionStart); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"sign_in_as_session_end\":\n\t\tif err = json.Unmarshal(body, &u.SignInAsSessionEnd); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"sign_in_as_session_start\":\n\t\tif err = json.Unmarshal(body, &u.SignInAsSessionStart); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"sso_error\":\n\t\tif err = json.Unmarshal(body, &u.SsoError); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"create_team_invite_link\":\n\t\tif err = json.Unmarshal(body, &u.CreateTeamInviteLink); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"delete_team_invite_link\":\n\t\tif err = json.Unmarshal(body, &u.DeleteTeamInviteLink); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"member_add_external_id\":\n\t\tif err = json.Unmarshal(body, &u.MemberAddExternalId); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"member_add_name\":\n\t\tif err = json.Unmarshal(body, &u.MemberAddName); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"member_change_admin_role\":\n\t\tif err = json.Unmarshal(body, &u.MemberChangeAdminRole); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"member_change_email\":\n\t\tif err = json.Unmarshal(body, &u.MemberChangeEmail); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"member_change_external_id\":\n\t\tif err = json.Unmarshal(body, &u.MemberChangeExternalId); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"member_change_membership_type\":\n\t\tif err = json.Unmarshal(body, &u.MemberChangeMembershipType); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"member_change_name\":\n\t\tif err = json.Unmarshal(body, &u.MemberChangeName); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"member_change_reseller_role\":\n\t\tif err = json.Unmarshal(body, &u.MemberChangeResellerRole); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"member_change_status\":\n\t\tif err = json.Unmarshal(body, &u.MemberChangeStatus); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"member_delete_manual_contacts\":\n\t\tif err = json.Unmarshal(body, &u.MemberDeleteManualContacts); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"member_delete_profile_photo\":\n\t\tif err = json.Unmarshal(body, &u.MemberDeleteProfilePhoto); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"member_permanently_delete_account_contents\":\n\t\tif err = json.Unmarshal(body, &u.MemberPermanentlyDeleteAccountContents); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"member_remove_external_id\":\n\t\tif err = json.Unmarshal(body, &u.MemberRemoveExternalId); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"member_set_profile_photo\":\n\t\tif err = json.Unmarshal(body, &u.MemberSetProfilePhoto); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"member_space_limits_add_custom_quota\":\n\t\tif err = json.Unmarshal(body, &u.MemberSpaceLimitsAddCustomQuota); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"member_space_limits_change_custom_quota\":\n\t\tif err = json.Unmarshal(body, &u.MemberSpaceLimitsChangeCustomQuota); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"member_space_limits_change_status\":\n\t\tif err = json.Unmarshal(body, &u.MemberSpaceLimitsChangeStatus); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"member_space_limits_remove_custom_quota\":\n\t\tif err = json.Unmarshal(body, &u.MemberSpaceLimitsRemoveCustomQuota); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"member_suggest\":\n\t\tif err = json.Unmarshal(body, &u.MemberSuggest); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"member_transfer_account_contents\":\n\t\tif err = json.Unmarshal(body, &u.MemberTransferAccountContents); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"pending_secondary_email_added\":\n\t\tif err = json.Unmarshal(body, &u.PendingSecondaryEmailAdded); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"secondary_email_deleted\":\n\t\tif err = json.Unmarshal(body, &u.SecondaryEmailDeleted); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"secondary_email_verified\":\n\t\tif err = json.Unmarshal(body, &u.SecondaryEmailVerified); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"secondary_mails_policy_changed\":\n\t\tif err = json.Unmarshal(body, &u.SecondaryMailsPolicyChanged); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"binder_add_page\":\n\t\tif err = json.Unmarshal(body, &u.BinderAddPage); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"binder_add_section\":\n\t\tif err = json.Unmarshal(body, &u.BinderAddSection); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"binder_remove_page\":\n\t\tif err = json.Unmarshal(body, &u.BinderRemovePage); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"binder_remove_section\":\n\t\tif err = json.Unmarshal(body, &u.BinderRemoveSection); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"binder_rename_page\":\n\t\tif err = json.Unmarshal(body, &u.BinderRenamePage); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"binder_rename_section\":\n\t\tif err = json.Unmarshal(body, &u.BinderRenameSection); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"binder_reorder_page\":\n\t\tif err = json.Unmarshal(body, &u.BinderReorderPage); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"binder_reorder_section\":\n\t\tif err = json.Unmarshal(body, &u.BinderReorderSection); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"paper_content_add_member\":\n\t\tif err = json.Unmarshal(body, &u.PaperContentAddMember); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"paper_content_add_to_folder\":\n\t\tif err = json.Unmarshal(body, &u.PaperContentAddToFolder); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"paper_content_archive\":\n\t\tif err = json.Unmarshal(body, &u.PaperContentArchive); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"paper_content_create\":\n\t\tif err = json.Unmarshal(body, &u.PaperContentCreate); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"paper_content_permanently_delete\":\n\t\tif err = json.Unmarshal(body, &u.PaperContentPermanentlyDelete); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"paper_content_remove_from_folder\":\n\t\tif err = json.Unmarshal(body, &u.PaperContentRemoveFromFolder); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"paper_content_remove_member\":\n\t\tif err = json.Unmarshal(body, &u.PaperContentRemoveMember); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"paper_content_rename\":\n\t\tif err = json.Unmarshal(body, &u.PaperContentRename); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"paper_content_restore\":\n\t\tif err = json.Unmarshal(body, &u.PaperContentRestore); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"paper_doc_add_comment\":\n\t\tif err = json.Unmarshal(body, &u.PaperDocAddComment); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"paper_doc_change_member_role\":\n\t\tif err = json.Unmarshal(body, &u.PaperDocChangeMemberRole); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"paper_doc_change_sharing_policy\":\n\t\tif err = json.Unmarshal(body, &u.PaperDocChangeSharingPolicy); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"paper_doc_change_subscription\":\n\t\tif err = json.Unmarshal(body, &u.PaperDocChangeSubscription); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"paper_doc_deleted\":\n\t\tif err = json.Unmarshal(body, &u.PaperDocDeleted); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"paper_doc_delete_comment\":\n\t\tif err = json.Unmarshal(body, &u.PaperDocDeleteComment); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"paper_doc_download\":\n\t\tif err = json.Unmarshal(body, &u.PaperDocDownload); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"paper_doc_edit\":\n\t\tif err = json.Unmarshal(body, &u.PaperDocEdit); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"paper_doc_edit_comment\":\n\t\tif err = json.Unmarshal(body, &u.PaperDocEditComment); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"paper_doc_followed\":\n\t\tif err = json.Unmarshal(body, &u.PaperDocFollowed); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"paper_doc_mention\":\n\t\tif err = json.Unmarshal(body, &u.PaperDocMention); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"paper_doc_ownership_changed\":\n\t\tif err = json.Unmarshal(body, &u.PaperDocOwnershipChanged); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"paper_doc_request_access\":\n\t\tif err = json.Unmarshal(body, &u.PaperDocRequestAccess); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"paper_doc_resolve_comment\":\n\t\tif err = json.Unmarshal(body, &u.PaperDocResolveComment); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"paper_doc_revert\":\n\t\tif err = json.Unmarshal(body, &u.PaperDocRevert); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"paper_doc_slack_share\":\n\t\tif err = json.Unmarshal(body, &u.PaperDocSlackShare); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"paper_doc_team_invite\":\n\t\tif err = json.Unmarshal(body, &u.PaperDocTeamInvite); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"paper_doc_trashed\":\n\t\tif err = json.Unmarshal(body, &u.PaperDocTrashed); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"paper_doc_unresolve_comment\":\n\t\tif err = json.Unmarshal(body, &u.PaperDocUnresolveComment); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"paper_doc_untrashed\":\n\t\tif err = json.Unmarshal(body, &u.PaperDocUntrashed); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"paper_doc_view\":\n\t\tif err = json.Unmarshal(body, &u.PaperDocView); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"paper_external_view_allow\":\n\t\tif err = json.Unmarshal(body, &u.PaperExternalViewAllow); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"paper_external_view_default_team\":\n\t\tif err = json.Unmarshal(body, &u.PaperExternalViewDefaultTeam); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"paper_external_view_forbid\":\n\t\tif err = json.Unmarshal(body, &u.PaperExternalViewForbid); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"paper_folder_change_subscription\":\n\t\tif err = json.Unmarshal(body, &u.PaperFolderChangeSubscription); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"paper_folder_deleted\":\n\t\tif err = json.Unmarshal(body, &u.PaperFolderDeleted); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"paper_folder_followed\":\n\t\tif err = json.Unmarshal(body, &u.PaperFolderFollowed); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"paper_folder_team_invite\":\n\t\tif err = json.Unmarshal(body, &u.PaperFolderTeamInvite); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"paper_published_link_change_permission\":\n\t\tif err = json.Unmarshal(body, &u.PaperPublishedLinkChangePermission); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"paper_published_link_create\":\n\t\tif err = json.Unmarshal(body, &u.PaperPublishedLinkCreate); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"paper_published_link_disabled\":\n\t\tif err = json.Unmarshal(body, &u.PaperPublishedLinkDisabled); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"paper_published_link_view\":\n\t\tif err = json.Unmarshal(body, &u.PaperPublishedLinkView); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"password_change\":\n\t\tif err = json.Unmarshal(body, &u.PasswordChange); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"password_reset\":\n\t\tif err = json.Unmarshal(body, &u.PasswordReset); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"password_reset_all\":\n\t\tif err = json.Unmarshal(body, &u.PasswordResetAll); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"classification_create_report\":\n\t\tif err = json.Unmarshal(body, &u.ClassificationCreateReport); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"classification_create_report_fail\":\n\t\tif err = json.Unmarshal(body, &u.ClassificationCreateReportFail); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"emm_create_exceptions_report\":\n\t\tif err = json.Unmarshal(body, &u.EmmCreateExceptionsReport); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"emm_create_usage_report\":\n\t\tif err = json.Unmarshal(body, &u.EmmCreateUsageReport); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"export_members_report\":\n\t\tif err = json.Unmarshal(body, &u.ExportMembersReport); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"export_members_report_fail\":\n\t\tif err = json.Unmarshal(body, &u.ExportMembersReportFail); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"external_sharing_create_report\":\n\t\tif err = json.Unmarshal(body, &u.ExternalSharingCreateReport); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"external_sharing_report_failed\":\n\t\tif err = json.Unmarshal(body, &u.ExternalSharingReportFailed); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"no_expiration_link_gen_create_report\":\n\t\tif err = json.Unmarshal(body, &u.NoExpirationLinkGenCreateReport); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"no_expiration_link_gen_report_failed\":\n\t\tif err = json.Unmarshal(body, &u.NoExpirationLinkGenReportFailed); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"no_password_link_gen_create_report\":\n\t\tif err = json.Unmarshal(body, &u.NoPasswordLinkGenCreateReport); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"no_password_link_gen_report_failed\":\n\t\tif err = json.Unmarshal(body, &u.NoPasswordLinkGenReportFailed); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"no_password_link_view_create_report\":\n\t\tif err = json.Unmarshal(body, &u.NoPasswordLinkViewCreateReport); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"no_password_link_view_report_failed\":\n\t\tif err = json.Unmarshal(body, &u.NoPasswordLinkViewReportFailed); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"outdated_link_view_create_report\":\n\t\tif err = json.Unmarshal(body, &u.OutdatedLinkViewCreateReport); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"outdated_link_view_report_failed\":\n\t\tif err = json.Unmarshal(body, &u.OutdatedLinkViewReportFailed); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"paper_admin_export_start\":\n\t\tif err = json.Unmarshal(body, &u.PaperAdminExportStart); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"smart_sync_create_admin_privilege_report\":\n\t\tif err = json.Unmarshal(body, &u.SmartSyncCreateAdminPrivilegeReport); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"team_activity_create_report\":\n\t\tif err = json.Unmarshal(body, &u.TeamActivityCreateReport); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"team_activity_create_report_fail\":\n\t\tif err = json.Unmarshal(body, &u.TeamActivityCreateReportFail); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"collection_share\":\n\t\tif err = json.Unmarshal(body, &u.CollectionShare); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"file_transfers_file_add\":\n\t\tif err = json.Unmarshal(body, &u.FileTransfersFileAdd); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"file_transfers_transfer_delete\":\n\t\tif err = json.Unmarshal(body, &u.FileTransfersTransferDelete); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"file_transfers_transfer_download\":\n\t\tif err = json.Unmarshal(body, &u.FileTransfersTransferDownload); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"file_transfers_transfer_send\":\n\t\tif err = json.Unmarshal(body, &u.FileTransfersTransferSend); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"file_transfers_transfer_view\":\n\t\tif err = json.Unmarshal(body, &u.FileTransfersTransferView); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"note_acl_invite_only\":\n\t\tif err = json.Unmarshal(body, &u.NoteAclInviteOnly); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"note_acl_link\":\n\t\tif err = json.Unmarshal(body, &u.NoteAclLink); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"note_acl_team_link\":\n\t\tif err = json.Unmarshal(body, &u.NoteAclTeamLink); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"note_shared\":\n\t\tif err = json.Unmarshal(body, &u.NoteShared); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"note_share_receive\":\n\t\tif err = json.Unmarshal(body, &u.NoteShareReceive); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"open_note_shared\":\n\t\tif err = json.Unmarshal(body, &u.OpenNoteShared); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"sf_add_group\":\n\t\tif err = json.Unmarshal(body, &u.SfAddGroup); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"sf_allow_non_members_to_view_shared_links\":\n\t\tif err = json.Unmarshal(body, &u.SfAllowNonMembersToViewSharedLinks); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"sf_external_invite_warn\":\n\t\tif err = json.Unmarshal(body, &u.SfExternalInviteWarn); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"sf_fb_invite\":\n\t\tif err = json.Unmarshal(body, &u.SfFbInvite); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"sf_fb_invite_change_role\":\n\t\tif err = json.Unmarshal(body, &u.SfFbInviteChangeRole); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"sf_fb_uninvite\":\n\t\tif err = json.Unmarshal(body, &u.SfFbUninvite); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"sf_invite_group\":\n\t\tif err = json.Unmarshal(body, &u.SfInviteGroup); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"sf_team_grant_access\":\n\t\tif err = json.Unmarshal(body, &u.SfTeamGrantAccess); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"sf_team_invite\":\n\t\tif err = json.Unmarshal(body, &u.SfTeamInvite); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"sf_team_invite_change_role\":\n\t\tif err = json.Unmarshal(body, &u.SfTeamInviteChangeRole); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"sf_team_join\":\n\t\tif err = json.Unmarshal(body, &u.SfTeamJoin); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"sf_team_join_from_oob_link\":\n\t\tif err = json.Unmarshal(body, &u.SfTeamJoinFromOobLink); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"sf_team_uninvite\":\n\t\tif err = json.Unmarshal(body, &u.SfTeamUninvite); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"shared_content_add_invitees\":\n\t\tif err = json.Unmarshal(body, &u.SharedContentAddInvitees); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"shared_content_add_link_expiry\":\n\t\tif err = json.Unmarshal(body, &u.SharedContentAddLinkExpiry); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"shared_content_add_link_password\":\n\t\tif err = json.Unmarshal(body, &u.SharedContentAddLinkPassword); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"shared_content_add_member\":\n\t\tif err = json.Unmarshal(body, &u.SharedContentAddMember); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"shared_content_change_downloads_policy\":\n\t\tif err = json.Unmarshal(body, &u.SharedContentChangeDownloadsPolicy); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"shared_content_change_invitee_role\":\n\t\tif err = json.Unmarshal(body, &u.SharedContentChangeInviteeRole); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"shared_content_change_link_audience\":\n\t\tif err = json.Unmarshal(body, &u.SharedContentChangeLinkAudience); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"shared_content_change_link_expiry\":\n\t\tif err = json.Unmarshal(body, &u.SharedContentChangeLinkExpiry); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"shared_content_change_link_password\":\n\t\tif err = json.Unmarshal(body, &u.SharedContentChangeLinkPassword); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"shared_content_change_member_role\":\n\t\tif err = json.Unmarshal(body, &u.SharedContentChangeMemberRole); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"shared_content_change_viewer_info_policy\":\n\t\tif err = json.Unmarshal(body, &u.SharedContentChangeViewerInfoPolicy); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"shared_content_claim_invitation\":\n\t\tif err = json.Unmarshal(body, &u.SharedContentClaimInvitation); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"shared_content_copy\":\n\t\tif err = json.Unmarshal(body, &u.SharedContentCopy); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"shared_content_download\":\n\t\tif err = json.Unmarshal(body, &u.SharedContentDownload); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"shared_content_relinquish_membership\":\n\t\tif err = json.Unmarshal(body, &u.SharedContentRelinquishMembership); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"shared_content_remove_invitees\":\n\t\tif err = json.Unmarshal(body, &u.SharedContentRemoveInvitees); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"shared_content_remove_link_expiry\":\n\t\tif err = json.Unmarshal(body, &u.SharedContentRemoveLinkExpiry); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"shared_content_remove_link_password\":\n\t\tif err = json.Unmarshal(body, &u.SharedContentRemoveLinkPassword); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"shared_content_remove_member\":\n\t\tif err = json.Unmarshal(body, &u.SharedContentRemoveMember); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"shared_content_request_access\":\n\t\tif err = json.Unmarshal(body, &u.SharedContentRequestAccess); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"shared_content_restore_invitees\":\n\t\tif err = json.Unmarshal(body, &u.SharedContentRestoreInvitees); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"shared_content_restore_member\":\n\t\tif err = json.Unmarshal(body, &u.SharedContentRestoreMember); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"shared_content_unshare\":\n\t\tif err = json.Unmarshal(body, &u.SharedContentUnshare); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"shared_content_view\":\n\t\tif err = json.Unmarshal(body, &u.SharedContentView); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"shared_folder_change_link_policy\":\n\t\tif err = json.Unmarshal(body, &u.SharedFolderChangeLinkPolicy); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"shared_folder_change_members_inheritance_policy\":\n\t\tif err = json.Unmarshal(body, &u.SharedFolderChangeMembersInheritancePolicy); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"shared_folder_change_members_management_policy\":\n\t\tif err = json.Unmarshal(body, &u.SharedFolderChangeMembersManagementPolicy); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"shared_folder_change_members_policy\":\n\t\tif err = json.Unmarshal(body, &u.SharedFolderChangeMembersPolicy); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"shared_folder_create\":\n\t\tif err = json.Unmarshal(body, &u.SharedFolderCreate); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"shared_folder_decline_invitation\":\n\t\tif err = json.Unmarshal(body, &u.SharedFolderDeclineInvitation); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"shared_folder_mount\":\n\t\tif err = json.Unmarshal(body, &u.SharedFolderMount); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"shared_folder_nest\":\n\t\tif err = json.Unmarshal(body, &u.SharedFolderNest); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"shared_folder_transfer_ownership\":\n\t\tif err = json.Unmarshal(body, &u.SharedFolderTransferOwnership); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"shared_folder_unmount\":\n\t\tif err = json.Unmarshal(body, &u.SharedFolderUnmount); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"shared_link_add_expiry\":\n\t\tif err = json.Unmarshal(body, &u.SharedLinkAddExpiry); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"shared_link_change_expiry\":\n\t\tif err = json.Unmarshal(body, &u.SharedLinkChangeExpiry); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"shared_link_change_visibility\":\n\t\tif err = json.Unmarshal(body, &u.SharedLinkChangeVisibility); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"shared_link_copy\":\n\t\tif err = json.Unmarshal(body, &u.SharedLinkCopy); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"shared_link_create\":\n\t\tif err = json.Unmarshal(body, &u.SharedLinkCreate); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"shared_link_disable\":\n\t\tif err = json.Unmarshal(body, &u.SharedLinkDisable); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"shared_link_download\":\n\t\tif err = json.Unmarshal(body, &u.SharedLinkDownload); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"shared_link_remove_expiry\":\n\t\tif err = json.Unmarshal(body, &u.SharedLinkRemoveExpiry); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"shared_link_settings_add_expiration\":\n\t\tif err = json.Unmarshal(body, &u.SharedLinkSettingsAddExpiration); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"shared_link_settings_add_password\":\n\t\tif err = json.Unmarshal(body, &u.SharedLinkSettingsAddPassword); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"shared_link_settings_allow_download_disabled\":\n\t\tif err = json.Unmarshal(body, &u.SharedLinkSettingsAllowDownloadDisabled); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"shared_link_settings_allow_download_enabled\":\n\t\tif err = json.Unmarshal(body, &u.SharedLinkSettingsAllowDownloadEnabled); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"shared_link_settings_change_audience\":\n\t\tif err = json.Unmarshal(body, &u.SharedLinkSettingsChangeAudience); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"shared_link_settings_change_expiration\":\n\t\tif err = json.Unmarshal(body, &u.SharedLinkSettingsChangeExpiration); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"shared_link_settings_change_password\":\n\t\tif err = json.Unmarshal(body, &u.SharedLinkSettingsChangePassword); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"shared_link_settings_remove_expiration\":\n\t\tif err = json.Unmarshal(body, &u.SharedLinkSettingsRemoveExpiration); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"shared_link_settings_remove_password\":\n\t\tif err = json.Unmarshal(body, &u.SharedLinkSettingsRemovePassword); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"shared_link_share\":\n\t\tif err = json.Unmarshal(body, &u.SharedLinkShare); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"shared_link_view\":\n\t\tif err = json.Unmarshal(body, &u.SharedLinkView); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"shared_note_opened\":\n\t\tif err = json.Unmarshal(body, &u.SharedNoteOpened); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"shmodel_disable_downloads\":\n\t\tif err = json.Unmarshal(body, &u.ShmodelDisableDownloads); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"shmodel_enable_downloads\":\n\t\tif err = json.Unmarshal(body, &u.ShmodelEnableDownloads); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"shmodel_group_share\":\n\t\tif err = json.Unmarshal(body, &u.ShmodelGroupShare); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"showcase_access_granted\":\n\t\tif err = json.Unmarshal(body, &u.ShowcaseAccessGranted); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"showcase_add_member\":\n\t\tif err = json.Unmarshal(body, &u.ShowcaseAddMember); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"showcase_archived\":\n\t\tif err = json.Unmarshal(body, &u.ShowcaseArchived); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"showcase_created\":\n\t\tif err = json.Unmarshal(body, &u.ShowcaseCreated); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"showcase_delete_comment\":\n\t\tif err = json.Unmarshal(body, &u.ShowcaseDeleteComment); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"showcase_edited\":\n\t\tif err = json.Unmarshal(body, &u.ShowcaseEdited); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"showcase_edit_comment\":\n\t\tif err = json.Unmarshal(body, &u.ShowcaseEditComment); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"showcase_file_added\":\n\t\tif err = json.Unmarshal(body, &u.ShowcaseFileAdded); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"showcase_file_download\":\n\t\tif err = json.Unmarshal(body, &u.ShowcaseFileDownload); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"showcase_file_removed\":\n\t\tif err = json.Unmarshal(body, &u.ShowcaseFileRemoved); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"showcase_file_view\":\n\t\tif err = json.Unmarshal(body, &u.ShowcaseFileView); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"showcase_permanently_deleted\":\n\t\tif err = json.Unmarshal(body, &u.ShowcasePermanentlyDeleted); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"showcase_post_comment\":\n\t\tif err = json.Unmarshal(body, &u.ShowcasePostComment); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"showcase_remove_member\":\n\t\tif err = json.Unmarshal(body, &u.ShowcaseRemoveMember); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"showcase_renamed\":\n\t\tif err = json.Unmarshal(body, &u.ShowcaseRenamed); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"showcase_request_access\":\n\t\tif err = json.Unmarshal(body, &u.ShowcaseRequestAccess); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"showcase_resolve_comment\":\n\t\tif err = json.Unmarshal(body, &u.ShowcaseResolveComment); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"showcase_restored\":\n\t\tif err = json.Unmarshal(body, &u.ShowcaseRestored); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"showcase_trashed\":\n\t\tif err = json.Unmarshal(body, &u.ShowcaseTrashed); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"showcase_trashed_deprecated\":\n\t\tif err = json.Unmarshal(body, &u.ShowcaseTrashedDeprecated); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"showcase_unresolve_comment\":\n\t\tif err = json.Unmarshal(body, &u.ShowcaseUnresolveComment); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"showcase_untrashed\":\n\t\tif err = json.Unmarshal(body, &u.ShowcaseUntrashed); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"showcase_untrashed_deprecated\":\n\t\tif err = json.Unmarshal(body, &u.ShowcaseUntrashedDeprecated); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"showcase_view\":\n\t\tif err = json.Unmarshal(body, &u.ShowcaseView); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"sso_add_cert\":\n\t\tif err = json.Unmarshal(body, &u.SsoAddCert); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"sso_add_login_url\":\n\t\tif err = json.Unmarshal(body, &u.SsoAddLoginUrl); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"sso_add_logout_url\":\n\t\tif err = json.Unmarshal(body, &u.SsoAddLogoutUrl); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"sso_change_cert\":\n\t\tif err = json.Unmarshal(body, &u.SsoChangeCert); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"sso_change_login_url\":\n\t\tif err = json.Unmarshal(body, &u.SsoChangeLoginUrl); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"sso_change_logout_url\":\n\t\tif err = json.Unmarshal(body, &u.SsoChangeLogoutUrl); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"sso_change_saml_identity_mode\":\n\t\tif err = json.Unmarshal(body, &u.SsoChangeSamlIdentityMode); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"sso_remove_cert\":\n\t\tif err = json.Unmarshal(body, &u.SsoRemoveCert); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"sso_remove_login_url\":\n\t\tif err = json.Unmarshal(body, &u.SsoRemoveLoginUrl); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"sso_remove_logout_url\":\n\t\tif err = json.Unmarshal(body, &u.SsoRemoveLogoutUrl); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"team_folder_change_status\":\n\t\tif err = json.Unmarshal(body, &u.TeamFolderChangeStatus); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"team_folder_create\":\n\t\tif err = json.Unmarshal(body, &u.TeamFolderCreate); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"team_folder_downgrade\":\n\t\tif err = json.Unmarshal(body, &u.TeamFolderDowngrade); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"team_folder_permanently_delete\":\n\t\tif err = json.Unmarshal(body, &u.TeamFolderPermanentlyDelete); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"team_folder_rename\":\n\t\tif err = json.Unmarshal(body, &u.TeamFolderRename); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"team_selective_sync_settings_changed\":\n\t\tif err = json.Unmarshal(body, &u.TeamSelectiveSyncSettingsChanged); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"account_capture_change_policy\":\n\t\tif err = json.Unmarshal(body, &u.AccountCaptureChangePolicy); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"admin_email_reminders_changed\":\n\t\tif err = json.Unmarshal(body, &u.AdminEmailRemindersChanged); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"allow_download_disabled\":\n\t\tif err = json.Unmarshal(body, &u.AllowDownloadDisabled); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"allow_download_enabled\":\n\t\tif err = json.Unmarshal(body, &u.AllowDownloadEnabled); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"app_permissions_changed\":\n\t\tif err = json.Unmarshal(body, &u.AppPermissionsChanged); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"camera_uploads_policy_changed\":\n\t\tif err = json.Unmarshal(body, &u.CameraUploadsPolicyChanged); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"capture_transcript_policy_changed\":\n\t\tif err = json.Unmarshal(body, &u.CaptureTranscriptPolicyChanged); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"classification_change_policy\":\n\t\tif err = json.Unmarshal(body, &u.ClassificationChangePolicy); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"computer_backup_policy_changed\":\n\t\tif err = json.Unmarshal(body, &u.ComputerBackupPolicyChanged); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"content_administration_policy_changed\":\n\t\tif err = json.Unmarshal(body, &u.ContentAdministrationPolicyChanged); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"data_placement_restriction_change_policy\":\n\t\tif err = json.Unmarshal(body, &u.DataPlacementRestrictionChangePolicy); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"data_placement_restriction_satisfy_policy\":\n\t\tif err = json.Unmarshal(body, &u.DataPlacementRestrictionSatisfyPolicy); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"device_approvals_add_exception\":\n\t\tif err = json.Unmarshal(body, &u.DeviceApprovalsAddException); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"device_approvals_change_desktop_policy\":\n\t\tif err = json.Unmarshal(body, &u.DeviceApprovalsChangeDesktopPolicy); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"device_approvals_change_mobile_policy\":\n\t\tif err = json.Unmarshal(body, &u.DeviceApprovalsChangeMobilePolicy); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"device_approvals_change_overage_action\":\n\t\tif err = json.Unmarshal(body, &u.DeviceApprovalsChangeOverageAction); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"device_approvals_change_unlink_action\":\n\t\tif err = json.Unmarshal(body, &u.DeviceApprovalsChangeUnlinkAction); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"device_approvals_remove_exception\":\n\t\tif err = json.Unmarshal(body, &u.DeviceApprovalsRemoveException); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"directory_restrictions_add_members\":\n\t\tif err = json.Unmarshal(body, &u.DirectoryRestrictionsAddMembers); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"directory_restrictions_remove_members\":\n\t\tif err = json.Unmarshal(body, &u.DirectoryRestrictionsRemoveMembers); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"dropbox_passwords_policy_changed\":\n\t\tif err = json.Unmarshal(body, &u.DropboxPasswordsPolicyChanged); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"email_ingest_policy_changed\":\n\t\tif err = json.Unmarshal(body, &u.EmailIngestPolicyChanged); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"emm_add_exception\":\n\t\tif err = json.Unmarshal(body, &u.EmmAddException); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"emm_change_policy\":\n\t\tif err = json.Unmarshal(body, &u.EmmChangePolicy); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"emm_remove_exception\":\n\t\tif err = json.Unmarshal(body, &u.EmmRemoveException); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"extended_version_history_change_policy\":\n\t\tif err = json.Unmarshal(body, &u.ExtendedVersionHistoryChangePolicy); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"external_drive_backup_policy_changed\":\n\t\tif err = json.Unmarshal(body, &u.ExternalDriveBackupPolicyChanged); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"file_comments_change_policy\":\n\t\tif err = json.Unmarshal(body, &u.FileCommentsChangePolicy); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"file_locking_policy_changed\":\n\t\tif err = json.Unmarshal(body, &u.FileLockingPolicyChanged); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"file_provider_migration_policy_changed\":\n\t\tif err = json.Unmarshal(body, &u.FileProviderMigrationPolicyChanged); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"file_requests_change_policy\":\n\t\tif err = json.Unmarshal(body, &u.FileRequestsChangePolicy); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"file_requests_emails_enabled\":\n\t\tif err = json.Unmarshal(body, &u.FileRequestsEmailsEnabled); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"file_requests_emails_restricted_to_team_only\":\n\t\tif err = json.Unmarshal(body, &u.FileRequestsEmailsRestrictedToTeamOnly); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"file_transfers_policy_changed\":\n\t\tif err = json.Unmarshal(body, &u.FileTransfersPolicyChanged); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"google_sso_change_policy\":\n\t\tif err = json.Unmarshal(body, &u.GoogleSsoChangePolicy); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"group_user_management_change_policy\":\n\t\tif err = json.Unmarshal(body, &u.GroupUserManagementChangePolicy); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"integration_policy_changed\":\n\t\tif err = json.Unmarshal(body, &u.IntegrationPolicyChanged); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"invite_acceptance_email_policy_changed\":\n\t\tif err = json.Unmarshal(body, &u.InviteAcceptanceEmailPolicyChanged); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"member_requests_change_policy\":\n\t\tif err = json.Unmarshal(body, &u.MemberRequestsChangePolicy); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"member_send_invite_policy_changed\":\n\t\tif err = json.Unmarshal(body, &u.MemberSendInvitePolicyChanged); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"member_space_limits_add_exception\":\n\t\tif err = json.Unmarshal(body, &u.MemberSpaceLimitsAddException); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"member_space_limits_change_caps_type_policy\":\n\t\tif err = json.Unmarshal(body, &u.MemberSpaceLimitsChangeCapsTypePolicy); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"member_space_limits_change_policy\":\n\t\tif err = json.Unmarshal(body, &u.MemberSpaceLimitsChangePolicy); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"member_space_limits_remove_exception\":\n\t\tif err = json.Unmarshal(body, &u.MemberSpaceLimitsRemoveException); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"member_suggestions_change_policy\":\n\t\tif err = json.Unmarshal(body, &u.MemberSuggestionsChangePolicy); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"microsoft_office_addin_change_policy\":\n\t\tif err = json.Unmarshal(body, &u.MicrosoftOfficeAddinChangePolicy); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"network_control_change_policy\":\n\t\tif err = json.Unmarshal(body, &u.NetworkControlChangePolicy); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"paper_change_deployment_policy\":\n\t\tif err = json.Unmarshal(body, &u.PaperChangeDeploymentPolicy); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"paper_change_member_link_policy\":\n\t\tif err = json.Unmarshal(body, &u.PaperChangeMemberLinkPolicy); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"paper_change_member_policy\":\n\t\tif err = json.Unmarshal(body, &u.PaperChangeMemberPolicy); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"paper_change_policy\":\n\t\tif err = json.Unmarshal(body, &u.PaperChangePolicy); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"paper_default_folder_policy_changed\":\n\t\tif err = json.Unmarshal(body, &u.PaperDefaultFolderPolicyChanged); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"paper_desktop_policy_changed\":\n\t\tif err = json.Unmarshal(body, &u.PaperDesktopPolicyChanged); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"paper_enabled_users_group_addition\":\n\t\tif err = json.Unmarshal(body, &u.PaperEnabledUsersGroupAddition); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"paper_enabled_users_group_removal\":\n\t\tif err = json.Unmarshal(body, &u.PaperEnabledUsersGroupRemoval); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"password_strength_requirements_change_policy\":\n\t\tif err = json.Unmarshal(body, &u.PasswordStrengthRequirementsChangePolicy); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"permanent_delete_change_policy\":\n\t\tif err = json.Unmarshal(body, &u.PermanentDeleteChangePolicy); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"reseller_support_change_policy\":\n\t\tif err = json.Unmarshal(body, &u.ResellerSupportChangePolicy); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"rewind_policy_changed\":\n\t\tif err = json.Unmarshal(body, &u.RewindPolicyChanged); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"send_for_signature_policy_changed\":\n\t\tif err = json.Unmarshal(body, &u.SendForSignaturePolicyChanged); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"sharing_change_folder_join_policy\":\n\t\tif err = json.Unmarshal(body, &u.SharingChangeFolderJoinPolicy); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"sharing_change_link_allow_change_expiration_policy\":\n\t\tif err = json.Unmarshal(body, &u.SharingChangeLinkAllowChangeExpirationPolicy); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"sharing_change_link_default_expiration_policy\":\n\t\tif err = json.Unmarshal(body, &u.SharingChangeLinkDefaultExpirationPolicy); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"sharing_change_link_enforce_password_policy\":\n\t\tif err = json.Unmarshal(body, &u.SharingChangeLinkEnforcePasswordPolicy); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"sharing_change_link_policy\":\n\t\tif err = json.Unmarshal(body, &u.SharingChangeLinkPolicy); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"sharing_change_member_policy\":\n\t\tif err = json.Unmarshal(body, &u.SharingChangeMemberPolicy); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"showcase_change_download_policy\":\n\t\tif err = json.Unmarshal(body, &u.ShowcaseChangeDownloadPolicy); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"showcase_change_enabled_policy\":\n\t\tif err = json.Unmarshal(body, &u.ShowcaseChangeEnabledPolicy); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"showcase_change_external_sharing_policy\":\n\t\tif err = json.Unmarshal(body, &u.ShowcaseChangeExternalSharingPolicy); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"smarter_smart_sync_policy_changed\":\n\t\tif err = json.Unmarshal(body, &u.SmarterSmartSyncPolicyChanged); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"smart_sync_change_policy\":\n\t\tif err = json.Unmarshal(body, &u.SmartSyncChangePolicy); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"smart_sync_not_opt_out\":\n\t\tif err = json.Unmarshal(body, &u.SmartSyncNotOptOut); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"smart_sync_opt_out\":\n\t\tif err = json.Unmarshal(body, &u.SmartSyncOptOut); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"sso_change_policy\":\n\t\tif err = json.Unmarshal(body, &u.SsoChangePolicy); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"team_branding_policy_changed\":\n\t\tif err = json.Unmarshal(body, &u.TeamBrandingPolicyChanged); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"team_extensions_policy_changed\":\n\t\tif err = json.Unmarshal(body, &u.TeamExtensionsPolicyChanged); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"team_selective_sync_policy_changed\":\n\t\tif err = json.Unmarshal(body, &u.TeamSelectiveSyncPolicyChanged); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"team_sharing_whitelist_subjects_changed\":\n\t\tif err = json.Unmarshal(body, &u.TeamSharingWhitelistSubjectsChanged); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"tfa_add_exception\":\n\t\tif err = json.Unmarshal(body, &u.TfaAddException); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"tfa_change_policy\":\n\t\tif err = json.Unmarshal(body, &u.TfaChangePolicy); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"tfa_remove_exception\":\n\t\tif err = json.Unmarshal(body, &u.TfaRemoveException); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"two_account_change_policy\":\n\t\tif err = json.Unmarshal(body, &u.TwoAccountChangePolicy); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"viewer_info_policy_changed\":\n\t\tif err = json.Unmarshal(body, &u.ViewerInfoPolicyChanged); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"watermarking_policy_changed\":\n\t\tif err = json.Unmarshal(body, &u.WatermarkingPolicyChanged); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"web_sessions_change_active_session_limit\":\n\t\tif err = json.Unmarshal(body, &u.WebSessionsChangeActiveSessionLimit); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"web_sessions_change_fixed_length_policy\":\n\t\tif err = json.Unmarshal(body, &u.WebSessionsChangeFixedLengthPolicy); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"web_sessions_change_idle_length_policy\":\n\t\tif err = json.Unmarshal(body, &u.WebSessionsChangeIdleLengthPolicy); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"data_residency_migration_request_successful\":\n\t\tif err = json.Unmarshal(body, &u.DataResidencyMigrationRequestSuccessful); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"data_residency_migration_request_unsuccessful\":\n\t\tif err = json.Unmarshal(body, &u.DataResidencyMigrationRequestUnsuccessful); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"team_merge_from\":\n\t\tif err = json.Unmarshal(body, &u.TeamMergeFrom); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"team_merge_to\":\n\t\tif err = json.Unmarshal(body, &u.TeamMergeTo); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"team_profile_add_background\":\n\t\tif err = json.Unmarshal(body, &u.TeamProfileAddBackground); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"team_profile_add_logo\":\n\t\tif err = json.Unmarshal(body, &u.TeamProfileAddLogo); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"team_profile_change_background\":\n\t\tif err = json.Unmarshal(body, &u.TeamProfileChangeBackground); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"team_profile_change_default_language\":\n\t\tif err = json.Unmarshal(body, &u.TeamProfileChangeDefaultLanguage); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"team_profile_change_logo\":\n\t\tif err = json.Unmarshal(body, &u.TeamProfileChangeLogo); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"team_profile_change_name\":\n\t\tif err = json.Unmarshal(body, &u.TeamProfileChangeName); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"team_profile_remove_background\":\n\t\tif err = json.Unmarshal(body, &u.TeamProfileRemoveBackground); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"team_profile_remove_logo\":\n\t\tif err = json.Unmarshal(body, &u.TeamProfileRemoveLogo); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"tfa_add_backup_phone\":\n\t\tif err = json.Unmarshal(body, &u.TfaAddBackupPhone); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"tfa_add_security_key\":\n\t\tif err = json.Unmarshal(body, &u.TfaAddSecurityKey); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"tfa_change_backup_phone\":\n\t\tif err = json.Unmarshal(body, &u.TfaChangeBackupPhone); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"tfa_change_status\":\n\t\tif err = json.Unmarshal(body, &u.TfaChangeStatus); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"tfa_remove_backup_phone\":\n\t\tif err = json.Unmarshal(body, &u.TfaRemoveBackupPhone); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"tfa_remove_security_key\":\n\t\tif err = json.Unmarshal(body, &u.TfaRemoveSecurityKey); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"tfa_reset\":\n\t\tif err = json.Unmarshal(body, &u.TfaReset); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"changed_enterprise_admin_role\":\n\t\tif err = json.Unmarshal(body, &u.ChangedEnterpriseAdminRole); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"changed_enterprise_connected_team_status\":\n\t\tif err = json.Unmarshal(body, &u.ChangedEnterpriseConnectedTeamStatus); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"ended_enterprise_admin_session\":\n\t\tif err = json.Unmarshal(body, &u.EndedEnterpriseAdminSession); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"ended_enterprise_admin_session_deprecated\":\n\t\tif err = json.Unmarshal(body, &u.EndedEnterpriseAdminSessionDeprecated); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"enterprise_settings_locking\":\n\t\tif err = json.Unmarshal(body, &u.EnterpriseSettingsLocking); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"guest_admin_change_status\":\n\t\tif err = json.Unmarshal(body, &u.GuestAdminChangeStatus); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"started_enterprise_admin_session\":\n\t\tif err = json.Unmarshal(body, &u.StartedEnterpriseAdminSession); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"team_merge_request_accepted\":\n\t\tif err = json.Unmarshal(body, &u.TeamMergeRequestAccepted); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"team_merge_request_accepted_shown_to_primary_team\":\n\t\tif err = json.Unmarshal(body, &u.TeamMergeRequestAcceptedShownToPrimaryTeam); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"team_merge_request_accepted_shown_to_secondary_team\":\n\t\tif err = json.Unmarshal(body, &u.TeamMergeRequestAcceptedShownToSecondaryTeam); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"team_merge_request_auto_canceled\":\n\t\tif err = json.Unmarshal(body, &u.TeamMergeRequestAutoCanceled); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"team_merge_request_canceled\":\n\t\tif err = json.Unmarshal(body, &u.TeamMergeRequestCanceled); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"team_merge_request_canceled_shown_to_primary_team\":\n\t\tif err = json.Unmarshal(body, &u.TeamMergeRequestCanceledShownToPrimaryTeam); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"team_merge_request_canceled_shown_to_secondary_team\":\n\t\tif err = json.Unmarshal(body, &u.TeamMergeRequestCanceledShownToSecondaryTeam); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"team_merge_request_expired\":\n\t\tif err = json.Unmarshal(body, &u.TeamMergeRequestExpired); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"team_merge_request_expired_shown_to_primary_team\":\n\t\tif err = json.Unmarshal(body, &u.TeamMergeRequestExpiredShownToPrimaryTeam); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"team_merge_request_expired_shown_to_secondary_team\":\n\t\tif err = json.Unmarshal(body, &u.TeamMergeRequestExpiredShownToSecondaryTeam); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"team_merge_request_rejected_shown_to_primary_team\":\n\t\tif err = json.Unmarshal(body, &u.TeamMergeRequestRejectedShownToPrimaryTeam); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"team_merge_request_rejected_shown_to_secondary_team\":\n\t\tif err = json.Unmarshal(body, &u.TeamMergeRequestRejectedShownToSecondaryTeam); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"team_merge_request_reminder\":\n\t\tif err = json.Unmarshal(body, &u.TeamMergeRequestReminder); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"team_merge_request_reminder_shown_to_primary_team\":\n\t\tif err = json.Unmarshal(body, &u.TeamMergeRequestReminderShownToPrimaryTeam); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"team_merge_request_reminder_shown_to_secondary_team\":\n\t\tif err = json.Unmarshal(body, &u.TeamMergeRequestReminderShownToSecondaryTeam); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"team_merge_request_revoked\":\n\t\tif err = json.Unmarshal(body, &u.TeamMergeRequestRevoked); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"team_merge_request_sent_shown_to_primary_team\":\n\t\tif err = json.Unmarshal(body, &u.TeamMergeRequestSentShownToPrimaryTeam); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"team_merge_request_sent_shown_to_secondary_team\":\n\t\tif err = json.Unmarshal(body, &u.TeamMergeRequestSentShownToSecondaryTeam); err != nil {\n\t\t\treturn err\n\t\t}\n\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "9dccfb2886c2bc8e786ac512e5076df1", "score": "0.5925372", "text": "func (dst *FeedHome) UnmarshalJSON(data []byte) error {\n\tvar err error\n\t// use discriminator value to speed up the lookup\n\tvar jsonDict map[string]interface{}\n\terr = json.Unmarshal(data, &jsonDict)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"Failed to unmarshal JSON into map for the discrimintor lookup.\")\n\t}\n\n\t// check if the discriminator value is 'Article'\n\tif jsonDict[\"type\"] == \"Article\" {\n\t\t// try to unmarshal JSON data into Article\n\t\terr = json.Unmarshal(data, &dst.Article)\n\t\tif err == nil {\n\t\t\treturn nil // data stored in dst.Article, return on the first match\n\t\t} else {\n\t\t\tdst.Article = nil\n\t\t\treturn fmt.Errorf(\"Failed to unmarshal FeedHome as Article: %s\", err.Error())\n\t\t}\n\t}\n\n\t// check if the discriminator value is 'PersonHome'\n\tif jsonDict[\"type\"] == \"PersonHome\" {\n\t\t// try to unmarshal JSON data into PersonHome\n\t\terr = json.Unmarshal(data, &dst.PersonHome)\n\t\tif err == nil {\n\t\t\treturn nil // data stored in dst.PersonHome, return on the first match\n\t\t} else {\n\t\t\tdst.PersonHome = nil\n\t\t\treturn fmt.Errorf(\"Failed to unmarshal FeedHome as PersonHome: %s\", err.Error())\n\t\t}\n\t}\n\n\t// check if the discriminator value is 'article'\n\tif jsonDict[\"type\"] == \"article\" {\n\t\t// try to unmarshal JSON data into Article\n\t\terr = json.Unmarshal(data, &dst.Article)\n\t\tif err == nil {\n\t\t\treturn nil // data stored in dst.Article, return on the first match\n\t\t} else {\n\t\t\tdst.Article = nil\n\t\t\treturn fmt.Errorf(\"Failed to unmarshal FeedHome as Article: %s\", err.Error())\n\t\t}\n\t}\n\n\t// check if the discriminator value is 'person'\n\tif jsonDict[\"type\"] == \"person\" {\n\t\t// try to unmarshal JSON data into PersonHome\n\t\terr = json.Unmarshal(data, &dst.PersonHome)\n\t\tif err == nil {\n\t\t\treturn nil // data stored in dst.PersonHome, return on the first match\n\t\t} else {\n\t\t\tdst.PersonHome = nil\n\t\t\treturn fmt.Errorf(\"Failed to unmarshal FeedHome as PersonHome: %s\", err.Error())\n\t\t}\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "fff06a66fd2db8641f4ba4394fa17d5f", "score": "0.5924949", "text": "func (rt *RecordType) UnmarshalJSON(b []byte) error {\n\tif b[0] == '\"' && b[len(b)-1] == '\"' {\n\t\tb = b[1 : len(b)-1]\n\t} else {\n\t\treturn fmt.Errorf(\"unable to parse a RecordType from %#v\", string(b))\n\t}\n\t*rt = RecordType(string(b))\n\treturn nil\n}", "title": "" }, { "docid": "118e6533cd14243dcd04957be007bdb4", "score": "0.5924605", "text": "func (i *Interface) 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 \"etag\":\n\t\t\terr = unpopulate(val, \"Etag\", &i.Etag)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"id\":\n\t\t\terr = unpopulate(val, \"ID\", &i.ID)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"location\":\n\t\t\terr = unpopulate(val, \"Location\", &i.Location)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"name\":\n\t\t\terr = unpopulate(val, \"Name\", &i.Name)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"properties\":\n\t\t\terr = unpopulate(val, \"Properties\", &i.Properties)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"tags\":\n\t\t\terr = unpopulate(val, \"Tags\", &i.Tags)\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\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}", "title": "" }, { "docid": "05889c4ecf9333717919017350eeb6f0", "score": "0.59208626", "text": "func (v *tag) UnmarshalJSON(data []byte) error {\n\tr := jlexer.Lexer{Data: data}\n\teasyjson1c889379DecodeGithubComToomoreLazyflickrgoJsonstruct1(&r, v)\n\treturn r.Error()\n}", "title": "" }, { "docid": "9869befa76ee00d48b59912569b1d268", "score": "0.59191746", "text": "func (r *ResultType) UnmarshalJSON(data []byte) error {\n\tvar asInt int\n\tvar intErr error\n\n\tif err := json.Unmarshal(data, &asInt); err != nil {\n\t\tintErr = err\n\t} else {\n\t\t*r = ResultType(asInt)\n\t\treturn nil\n\t}\n\n\tvar asString string\n\n\tif err := json.Unmarshal(data, &asString); err != nil {\n\t\treturn fmt.Errorf(\"unsupported value type, neither int nor string: %w\", multierror.Append(intErr, err).ErrorOrNil())\n\t}\n\n\tswitch asString {\n\tcase \"TaskRunResult\":\n\t\t*r = TaskRunResultType\n\tcase \"InternalTektonResult\":\n\t\t*r = InternalTektonResultType\n\tdefault:\n\t\t*r = UnknownResultType\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "9869befa76ee00d48b59912569b1d268", "score": "0.59191746", "text": "func (r *ResultType) UnmarshalJSON(data []byte) error {\n\tvar asInt int\n\tvar intErr error\n\n\tif err := json.Unmarshal(data, &asInt); err != nil {\n\t\tintErr = err\n\t} else {\n\t\t*r = ResultType(asInt)\n\t\treturn nil\n\t}\n\n\tvar asString string\n\n\tif err := json.Unmarshal(data, &asString); err != nil {\n\t\treturn fmt.Errorf(\"unsupported value type, neither int nor string: %w\", multierror.Append(intErr, err).ErrorOrNil())\n\t}\n\n\tswitch asString {\n\tcase \"TaskRunResult\":\n\t\t*r = TaskRunResultType\n\tcase \"InternalTektonResult\":\n\t\t*r = InternalTektonResultType\n\tdefault:\n\t\t*r = UnknownResultType\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "cbb93550e7dc2743ba10b8cd2a235865", "score": "0.5916881", "text": "func (obj *expRemedyType) UnmarshalJSON(data []byte) error {\n\tvar ok bool\n\tif *obj, ok = genJSONStrToRemedyType[noQuotes(data)]; !ok {\n\t\treturn fmt.Errorf(\"unrecognized RemedyType value %v\", string(data))\n\t}\n\treturn nil\n}", "title": "" } ]
8012cec5305bae015196c6bcf4e375af
UnmarshalJSON is the custom unmarshaler for WaitStatisticsInput struct.
[ { "docid": "44248f9ebc7b2f97eea070682bb8cf97", "score": "0.77997386", "text": "func (wsi *WaitStatisticsInput) 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 waitStatisticsInputProperties WaitStatisticsInputProperties\n\t\t\t\terr = json.Unmarshal(*v, &waitStatisticsInputProperties)\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn err\n\t\t\t\t}\n\t\t\t\twsi.WaitStatisticsInputProperties = &waitStatisticsInputProperties\n\t\t\t}\n\t\t}\n\t}\n\n\treturn nil\n}", "title": "" } ]
[ { "docid": "f38ba97b21e35902c0bc0f5ddb84eded", "score": "0.78960603", "text": "func (w *WaitStatisticsInput) 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\", w, err)\n\t}\n\tfor key, val := range rawMsg {\n\t\tvar err error\n\t\tswitch key {\n\t\tcase \"properties\":\n\t\t\terr = unpopulate(val, \"Properties\", &w.Properties)\n\t\t\tdelete(rawMsg, key)\n\t\t}\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"unmarshalling type %T: %v\", w, err)\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "a2ff0261f1601b5ec0c664a3873d979f", "score": "0.73833895", "text": "func (w *WaitStatisticsInputProperties) 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\", w, err)\n\t}\n\tfor key, val := range rawMsg {\n\t\tvar err error\n\t\tswitch key {\n\t\tcase \"aggregationWindow\":\n\t\t\terr = unpopulate(val, \"AggregationWindow\", &w.AggregationWindow)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"observationEndTime\":\n\t\t\terr = unpopulateTimeRFC3339(val, \"ObservationEndTime\", &w.ObservationEndTime)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"observationStartTime\":\n\t\t\terr = unpopulateTimeRFC3339(val, \"ObservationStartTime\", &w.ObservationStartTime)\n\t\t\tdelete(rawMsg, key)\n\t\t}\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"unmarshalling type %T: %v\", w, err)\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "53027a2c351e2871247f8bec45394558", "score": "0.72561955", "text": "func (w *WaitStatistic) 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\", w, 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\", &w.ID)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"name\":\n\t\t\terr = unpopulate(val, \"Name\", &w.Name)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"properties\":\n\t\t\terr = unpopulate(val, \"Properties\", &w.Properties)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"type\":\n\t\t\terr = unpopulate(val, \"Type\", &w.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\", w, err)\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "592aaf9de7ee2a8b2ffb9f9e78724141", "score": "0.7137388", "text": "func (ws *WaitStatistic) 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 waitStatisticProperties WaitStatisticProperties\n\t\t\t\terr = json.Unmarshal(*v, &waitStatisticProperties)\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn err\n\t\t\t\t}\n\t\t\t\tws.WaitStatisticProperties = &waitStatisticProperties\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\tws.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\tws.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\tws.Type = &typeVar\n\t\t\t}\n\t\t}\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "271809b0621cf36c5ff60f4dafba823a", "score": "0.6829393", "text": "func (w *WaitStatisticProperties) 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\", w, err)\n\t}\n\tfor key, val := range rawMsg {\n\t\tvar err error\n\t\tswitch key {\n\t\tcase \"count\":\n\t\t\terr = unpopulate(val, \"Count\", &w.Count)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"databaseName\":\n\t\t\terr = unpopulate(val, \"DatabaseName\", &w.DatabaseName)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"endTime\":\n\t\t\terr = unpopulateTimeRFC3339(val, \"EndTime\", &w.EndTime)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"eventName\":\n\t\t\terr = unpopulate(val, \"EventName\", &w.EventName)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"eventTypeName\":\n\t\t\terr = unpopulate(val, \"EventTypeName\", &w.EventTypeName)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"queryId\":\n\t\t\terr = unpopulate(val, \"QueryID\", &w.QueryID)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"startTime\":\n\t\t\terr = unpopulateTimeRFC3339(val, \"StartTime\", &w.StartTime)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"totalTimeInMs\":\n\t\t\terr = unpopulate(val, \"TotalTimeInMs\", &w.TotalTimeInMs)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"userId\":\n\t\t\terr = unpopulate(val, \"UserID\", &w.UserID)\n\t\t\tdelete(rawMsg, key)\n\t\t}\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"unmarshalling type %T: %v\", w, err)\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "e07cd8fd2cf9bf44ac4d531930ffe58c", "score": "0.6558587", "text": "func (w *WaitStatisticsResultList) 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\", w, err)\n\t}\n\tfor key, val := range rawMsg {\n\t\tvar err error\n\t\tswitch key {\n\t\tcase \"nextLink\":\n\t\t\terr = unpopulate(val, \"NextLink\", &w.NextLink)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"value\":\n\t\t\terr = unpopulate(val, \"Value\", &w.Value)\n\t\t\tdelete(rawMsg, key)\n\t\t}\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"unmarshalling type %T: %v\", w, err)\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "995b0acdd3c7b2f9de4e359e15cb20c0", "score": "0.6499694", "text": "func (t *TopQueryStatisticsInput) 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 \"properties\":\n\t\t\terr = unpopulate(val, \"Properties\", &t.Properties)\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}", "title": "" }, { "docid": "60ee443ad0b4dbc6e2aa9f519740b5a7", "score": "0.6304211", "text": "func (tqsi *TopQueryStatisticsInput) 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 topQueryStatisticsInputProperties TopQueryStatisticsInputProperties\n\t\t\t\terr = json.Unmarshal(*v, &topQueryStatisticsInputProperties)\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn err\n\t\t\t\t}\n\t\t\t\ttqsi.TopQueryStatisticsInputProperties = &topQueryStatisticsInputProperties\n\t\t\t}\n\t\t}\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "e8426037a0caeb9b80b384e11aaf6d52", "score": "0.6243444", "text": "func (t *TopQueryStatisticsInputProperties) 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 \"aggregationFunction\":\n\t\t\terr = unpopulate(val, \"AggregationFunction\", &t.AggregationFunction)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"aggregationWindow\":\n\t\t\terr = unpopulate(val, \"AggregationWindow\", &t.AggregationWindow)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"numberOfTopQueries\":\n\t\t\terr = unpopulate(val, \"NumberOfTopQueries\", &t.NumberOfTopQueries)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"observationEndTime\":\n\t\t\terr = unpopulateTimeRFC3339(val, \"ObservationEndTime\", &t.ObservationEndTime)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"observationStartTime\":\n\t\t\terr = unpopulateTimeRFC3339(val, \"ObservationStartTime\", &t.ObservationStartTime)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"observedMetric\":\n\t\t\terr = unpopulate(val, \"ObservedMetric\", &t.ObservedMetric)\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}", "title": "" }, { "docid": "1c45b811d7d4f81d2509ff48ad62dc27", "score": "0.6051253", "text": "func (q *QueryStatistic) 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\", q, err)\n\t}\n\tfor key, val := range rawMsg {\n\t\tvar err error\n\t\tswitch key {\n\t\tcase \"intervals\":\n\t\t\terr = unpopulate(val, \"Intervals\", &q.Intervals)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"queryId\":\n\t\t\terr = unpopulate(val, \"QueryID\", &q.QueryID)\n\t\t\tdelete(rawMsg, key)\n\t\t}\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"unmarshalling type %T: %v\", q, err)\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "4512ccefd3e2de32b2ee6b50f425f9b1", "score": "0.60094744", "text": "func (o *IntegrationInstanceStatPartial) 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\treturn nil\n}", "title": "" }, { "docid": "0e5f3e45d65ece1744a6c94bbf1f199e", "score": "0.5952422", "text": "func (qs *QueryStatistic) 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 queryStatisticProperties QueryStatisticProperties\n\t\t\t\terr = json.Unmarshal(*v, &queryStatisticProperties)\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn err\n\t\t\t\t}\n\t\t\t\tqs.QueryStatisticProperties = &queryStatisticProperties\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\tqs.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\tqs.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\tqs.Type = &typeVar\n\t\t\t}\n\t\t}\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "d8356f48ee2f6fd4c884700d5b38ccd7", "score": "0.5893708", "text": "func (q *QueryStatistic) 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\", q, 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\", &q.ID)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"name\":\n\t\t\terr = unpopulate(val, \"Name\", &q.Name)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"properties\":\n\t\t\terr = unpopulate(val, \"Properties\", &q.Properties)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"type\":\n\t\t\terr = unpopulate(val, \"Type\", &q.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\", q, err)\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "a1d82ca6923cc5a0adb6eaa44cb7bdcc", "score": "0.57954806", "text": "func (qs *QueryStatistics) 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 queryStatisticsProperties QueryStatisticsProperties\n\t\t\t\terr = json.Unmarshal(*v, &queryStatisticsProperties)\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn err\n\t\t\t\t}\n\t\t\t\tqs.QueryStatisticsProperties = &queryStatisticsProperties\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\tqs.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\tqs.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\tqs.Type = &typeVar\n\t\t\t}\n\t\t}\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "8191b4edac65e39b5e8e4b1ac6224d65", "score": "0.57066625", "text": "func (v *VMwareCbtResyncInput) 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 \"instanceType\":\n\t\t\terr = unpopulate(val, \"InstanceType\", &v.InstanceType)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"skipCbtReset\":\n\t\t\terr = unpopulate(val, \"SkipCbtReset\", &v.SkipCbtReset)\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}", "title": "" }, { "docid": "46efcb8fb324d18138b21ebfb8d697bf", "score": "0.5643283", "text": "func (q *QueryStatisticProperties) 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\", q, err)\n\t}\n\tfor key, val := range rawMsg {\n\t\tvar err error\n\t\tswitch key {\n\t\tcase \"aggregationFunction\":\n\t\t\terr = unpopulate(val, \"AggregationFunction\", &q.AggregationFunction)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"databaseNames\":\n\t\t\terr = unpopulate(val, \"DatabaseNames\", &q.DatabaseNames)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"endTime\":\n\t\t\terr = unpopulateTimeRFC3339(val, \"EndTime\", &q.EndTime)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"metricDisplayName\":\n\t\t\terr = unpopulate(val, \"MetricDisplayName\", &q.MetricDisplayName)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"metricName\":\n\t\t\terr = unpopulate(val, \"MetricName\", &q.MetricName)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"metricValue\":\n\t\t\terr = unpopulate(val, \"MetricValue\", &q.MetricValue)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"metricValueUnit\":\n\t\t\terr = unpopulate(val, \"MetricValueUnit\", &q.MetricValueUnit)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"queryExecutionCount\":\n\t\t\terr = unpopulate(val, \"QueryExecutionCount\", &q.QueryExecutionCount)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"queryId\":\n\t\t\terr = unpopulate(val, \"QueryID\", &q.QueryID)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"startTime\":\n\t\t\terr = unpopulateTimeRFC3339(val, \"StartTime\", &q.StartTime)\n\t\t\tdelete(rawMsg, key)\n\t\t}\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"unmarshalling type %T: %v\", q, err)\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "5bd3aed884126007aea9acf3954efa29", "score": "0.5589135", "text": "func (t *Threshold) UnmarshalJSON(b []byte) error {\n\ttdRaws := new(thresholdDecode)\n\tif err := json.Unmarshal(b, tdRaws); err != nil {\n\t\treturn err\n\t}\n\tt.Base = tdRaws.Base\n\tfor _, tdRaw := range tdRaws.Thresholds {\n\t\tswitch tdRaw.Type {\n\t\tcase \"lesser\":\n\t\t\ttd := &Lesser{\n\t\t\t\tThresholdConfigBase: tdRaw.ThresholdConfigBase,\n\t\t\t\tValue: tdRaw.Value,\n\t\t\t}\n\t\t\tt.Thresholds = append(t.Thresholds, td)\n\t\tcase \"greater\":\n\t\t\ttd := &Greater{\n\t\t\t\tThresholdConfigBase: tdRaw.ThresholdConfigBase,\n\t\t\t\tValue: tdRaw.Value,\n\t\t\t}\n\t\t\tt.Thresholds = append(t.Thresholds, td)\n\t\tcase \"range\":\n\t\t\ttd := &Range{\n\t\t\t\tThresholdConfigBase: tdRaw.ThresholdConfigBase,\n\t\t\t\tMin: tdRaw.Min,\n\t\t\t\tMax: tdRaw.Max,\n\t\t\t\tWithin: tdRaw.Within,\n\t\t\t}\n\t\t\tt.Thresholds = append(t.Thresholds, td)\n\t\tdefault:\n\t\t\treturn &influxdb.Error{\n\t\t\t\tMsg: fmt.Sprintf(\"invalid threshold type %s\", tdRaw.Type),\n\t\t\t}\n\t\t}\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "e38d9131f82798b722b975f55ef01545", "score": "0.5583606", "text": "func (i *IncludedQuantityUtilizationSummary) 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 \"id\":\n\t\t\terr = unpopulate(val, \"ID\", &i.ID)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"kind\":\n\t\t\terr = unpopulate(val, \"Kind\", &i.Kind)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"name\":\n\t\t\terr = unpopulate(val, \"Name\", &i.Name)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"properties\":\n\t\t\terr = unpopulate(val, \"Properties\", &i.Properties)\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\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}", "title": "" }, { "docid": "cbb2f040e090af18f5106e452c808346", "score": "0.55680406", "text": "func (i *IntegrationRuntimeNodeMonitoringData) 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 \"availableMemoryInMB\":\n\t\t\terr = unpopulate(val, \"AvailableMemoryInMB\", &i.AvailableMemoryInMB)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"cpuUtilization\":\n\t\t\terr = unpopulate(val, \"CPUUtilization\", &i.CPUUtilization)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"concurrentJobsLimit\":\n\t\t\terr = unpopulate(val, \"ConcurrentJobsLimit\", &i.ConcurrentJobsLimit)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"concurrentJobsRunning\":\n\t\t\terr = unpopulate(val, \"ConcurrentJobsRunning\", &i.ConcurrentJobsRunning)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"maxConcurrentJobs\":\n\t\t\terr = unpopulate(val, \"MaxConcurrentJobs\", &i.MaxConcurrentJobs)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"nodeName\":\n\t\t\terr = unpopulate(val, \"NodeName\", &i.NodeName)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"receivedBytes\":\n\t\t\terr = unpopulate(val, \"ReceivedBytes\", &i.ReceivedBytes)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"sentBytes\":\n\t\t\terr = unpopulate(val, \"SentBytes\", &i.SentBytes)\n\t\t\tdelete(rawMsg, key)\n\t\tdefault:\n\t\t\tif i.AdditionalProperties == nil {\n\t\t\t\ti.AdditionalProperties = map[string]any{}\n\t\t\t}\n\t\t\tif val != nil {\n\t\t\t\tvar aux any\n\t\t\t\terr = json.Unmarshal(val, &aux)\n\t\t\t\ti.AdditionalProperties[key] = aux\n\t\t\t}\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}", "title": "" }, { "docid": "ef2a3db1dda42bb70e08755f8100b2b1", "score": "0.55654275", "text": "func (rt *RandomTicker) UnmarshalJSON(data []byte) error {\n \n var s struct{\n Duration string `json:\"duration\"`\n Minimum string `json:\"minimum\"`\n Maximum string `json:\"maximum\"`\n }\n \n err := json.Unmarshal(data, &s)\n if err != nil { return err }\n \n rt.Duration, err = time.ParseDuration(s.Duration)\n if err != nil { return err }\n \n rt.Minimum, err = time.ParseDuration(s.Minimum)\n if err != nil { return err }\n \n rt.Maximum, err = time.ParseDuration(s.Maximum)\n if err != nil { return err }\n \n return nil\n}", "title": "" }, { "docid": "af19710d90c6539941e8999bd982b87e", "score": "0.55349064", "text": "func (w *WorkloadClassifierProperties) 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\", w, err)\n\t}\n\tfor key, val := range rawMsg {\n\t\tvar err error\n\t\tswitch key {\n\t\tcase \"context\":\n\t\t\terr = unpopulate(val, \"Context\", &w.Context)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"endTime\":\n\t\t\terr = unpopulate(val, \"EndTime\", &w.EndTime)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"importance\":\n\t\t\terr = unpopulate(val, \"Importance\", &w.Importance)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"label\":\n\t\t\terr = unpopulate(val, \"Label\", &w.Label)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"memberName\":\n\t\t\terr = unpopulate(val, \"MemberName\", &w.MemberName)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"startTime\":\n\t\t\terr = unpopulate(val, \"StartTime\", &w.StartTime)\n\t\t\tdelete(rawMsg, key)\n\t\t}\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"unmarshalling type %T: %v\", w, err)\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "82c3ed483dc2efddd7b17dd6e87e2e6d", "score": "0.55263114", "text": "func (x *ECsgoSteamUserStat) 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 = ECsgoSteamUserStat(num)\n\treturn nil\n}", "title": "" }, { "docid": "7e10c8d7fb4d1904b6b3da1439d581d8", "score": "0.5511837", "text": "func (g *GenerateDetailedCostReportOperationStatuses) 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\", g, err)\n\t}\n\tfor key, val := range rawMsg {\n\t\tvar err error\n\t\tswitch key {\n\t\tcase \"endTime\":\n\t\t\terr = unpopulate(val, \"EndTime\", &g.EndTime)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"error\":\n\t\t\terr = unpopulate(val, \"Error\", &g.Error)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"id\":\n\t\t\terr = unpopulate(val, \"ID\", &g.ID)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"name\":\n\t\t\terr = unpopulate(val, \"Name\", &g.Name)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"properties\":\n\t\t\terr = unpopulate(val, \"Properties\", &g.Properties)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"startTime\":\n\t\t\terr = unpopulate(val, \"StartTime\", &g.StartTime)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"status\":\n\t\t\terr = unpopulate(val, \"Status\", &g.Status)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"type\":\n\t\t\terr = unpopulate(val, \"Type\", &g.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\", g, err)\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "21a629fdbf3b8e2b3fd691fb49d4ca2b", "score": "0.55088276", "text": "func (v *VMwareCbtPolicyCreationInput) 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 \"appConsistentFrequencyInMinutes\":\n\t\t\terr = unpopulate(val, \"AppConsistentFrequencyInMinutes\", &v.AppConsistentFrequencyInMinutes)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"crashConsistentFrequencyInMinutes\":\n\t\t\terr = unpopulate(val, \"CrashConsistentFrequencyInMinutes\", &v.CrashConsistentFrequencyInMinutes)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"instanceType\":\n\t\t\terr = unpopulate(val, \"InstanceType\", &v.InstanceType)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"recoveryPointHistoryInMinutes\":\n\t\t\terr = unpopulate(val, \"RecoveryPointHistoryInMinutes\", &v.RecoveryPointHistoryInMinutes)\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}", "title": "" }, { "docid": "942f0c80717eb7376e643040a443450e", "score": "0.5507156", "text": "func (s *SelfHostedIntegrationRuntimeStatus) 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 \"dataFactoryName\":\n\t\t\terr = unpopulate(val, \"DataFactoryName\", &s.DataFactoryName)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"state\":\n\t\t\terr = unpopulate(val, \"State\", &s.State)\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\tcase \"typeProperties\":\n\t\t\terr = unpopulate(val, \"TypeProperties\", &s.TypeProperties)\n\t\t\tdelete(rawMsg, key)\n\t\tdefault:\n\t\t\tif s.AdditionalProperties == nil {\n\t\t\t\ts.AdditionalProperties = map[string]any{}\n\t\t\t}\n\t\t\tif val != nil {\n\t\t\t\tvar aux any\n\t\t\t\terr = json.Unmarshal(val, &aux)\n\t\t\t\ts.AdditionalProperties[key] = aux\n\t\t\t}\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}", "title": "" }, { "docid": "ef79b7e7f85651a3f4c484ca7e829264", "score": "0.5499857", "text": "func (t *TopQueryStatisticsResultList) 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 \"nextLink\":\n\t\t\terr = unpopulate(val, \"NextLink\", &t.NextLink)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"value\":\n\t\t\terr = unpopulate(val, \"Value\", &t.Value)\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}", "title": "" }, { "docid": "1a174bde753a6f1fbba7700f6cbaff12", "score": "0.54855776", "text": "func (h *HardwareProfileUpdate) 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\", h, err)\n\t}\n\tfor key, val := range rawMsg {\n\t\tvar err error\n\t\tswitch key {\n\t\tcase \"cpuCount\":\n\t\t\terr = unpopulate(val, \"CPUCount\", &h.CPUCount)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"dynamicMemoryEnabled\":\n\t\t\terr = unpopulate(val, \"DynamicMemoryEnabled\", &h.DynamicMemoryEnabled)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"dynamicMemoryMaxMB\":\n\t\t\terr = unpopulate(val, \"DynamicMemoryMaxMB\", &h.DynamicMemoryMaxMB)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"dynamicMemoryMinMB\":\n\t\t\terr = unpopulate(val, \"DynamicMemoryMinMB\", &h.DynamicMemoryMinMB)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"limitCpuForMigration\":\n\t\t\terr = unpopulate(val, \"LimitCPUForMigration\", &h.LimitCPUForMigration)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"memoryMB\":\n\t\t\terr = unpopulate(val, \"MemoryMB\", &h.MemoryMB)\n\t\t\tdelete(rawMsg, key)\n\t\t}\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"unmarshalling type %T: %v\", h, err)\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "8369a69605880c0b3ae4681eb89a5806", "score": "0.5475338", "text": "func (v *StatsData) UnmarshalJSON(data []byte) error {\n\tr := jlexer.Lexer{Data: data}\n\teasyjsonC80ae7adDecodeGithubComKamaiuIbCpGoClientV1RestModel4(&r, v)\n\treturn r.Error()\n}", "title": "" }, { "docid": "4611b9aa79e99acd7b377281aed9d800", "score": "0.54704505", "text": "func (i *InMageRcmFailbackPolicyCreationInput) 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 \"appConsistentFrequencyInMinutes\":\n\t\t\terr = unpopulate(val, \"AppConsistentFrequencyInMinutes\", &i.AppConsistentFrequencyInMinutes)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"crashConsistentFrequencyInMinutes\":\n\t\t\terr = unpopulate(val, \"CrashConsistentFrequencyInMinutes\", &i.CrashConsistentFrequencyInMinutes)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"instanceType\":\n\t\t\terr = unpopulate(val, \"InstanceType\", &i.InstanceType)\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}", "title": "" }, { "docid": "ba9bab178edfad9de294d3f29daf0563", "score": "0.54463047", "text": "func (i *IntegrationRuntimeMonitoringData) 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 \"name\":\n\t\t\terr = unpopulate(val, \"Name\", &i.Name)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"nodes\":\n\t\t\terr = unpopulate(val, \"Nodes\", &i.Nodes)\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}", "title": "" }, { "docid": "09b6d889a5ad6c5dd7f3818bfae8f496", "score": "0.54326385", "text": "func (i *IntegrationServiceEnvironmentSubnetNetworkHealth) 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 \"networkDependencyHealthState\":\n\t\t\terr = unpopulate(val, \"NetworkDependencyHealthState\", &i.NetworkDependencyHealthState)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"outboundNetworkDependencies\":\n\t\t\terr = unpopulate(val, \"OutboundNetworkDependencies\", &i.OutboundNetworkDependencies)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"outboundNetworkHealth\":\n\t\t\terr = unpopulate(val, \"OutboundNetworkHealth\", &i.OutboundNetworkHealth)\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}", "title": "" }, { "docid": "669ce33758c2b55e3a0200cd0b48b62f", "score": "0.5422731", "text": "func (v *Timings) UnmarshalJSON(data []byte) error {\n\tr := jlexer.Lexer{Data: data}\n\teasyjsonC5a4559bDecodeGithubComChromedpCdprotoHar(&r, v)\n\treturn r.Error()\n}", "title": "" }, { "docid": "de4eaad5297f988fc85821d151242135", "score": "0.54149795", "text": "func (i *IncludedQuantityUtilizationSummaryProperties) 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 \"armSkuName\":\n\t\t\terr = unpopulate(val, \"ArmSKUName\", &i.ArmSKUName)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"benefitId\":\n\t\t\terr = unpopulate(val, \"BenefitID\", &i.BenefitID)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"benefitOrderId\":\n\t\t\terr = unpopulate(val, \"BenefitOrderID\", &i.BenefitOrderID)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"benefitType\":\n\t\t\terr = unpopulate(val, \"BenefitType\", &i.BenefitType)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"usageDate\":\n\t\t\terr = unpopulateTimeRFC3339(val, \"UsageDate\", &i.UsageDate)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"utilizationPercentage\":\n\t\t\terr = unpopulate(val, \"UtilizationPercentage\", &i.UtilizationPercentage)\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}", "title": "" }, { "docid": "f1bafff404b460cec62ba9d577792d7b", "score": "0.5412787", "text": "func (v *EventConsoleProfileStarted) UnmarshalJSON(data []byte) error {\n\tr := jlexer.Lexer{Data: data}\n\teasyjsonC5a4559bDecodeGithubComKnqChromedpCdpProfiler15(&r, v)\n\treturn r.Error()\n}", "title": "" }, { "docid": "98b522512ed9ccb9b006cf87232ad161", "score": "0.5407391", "text": "func (j *ReportInputParams) UnmarshalJSON(input []byte) error {\n\tfs := fflib.NewFFLexer(input)\n\treturn j.UnmarshalJSONFFLexer(fs, fflib.FFParse_map_start)\n}", "title": "" }, { "docid": "c734fedad0a6bde9e3fe77473ff5e349", "score": "0.5398568", "text": "func (j *JobStatus) 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 \"executionCount\":\n\t\t\terr = unpopulate(val, \"ExecutionCount\", &j.ExecutionCount)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"failureCount\":\n\t\t\terr = unpopulate(val, \"FailureCount\", &j.FailureCount)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"faultedCount\":\n\t\t\terr = unpopulate(val, \"FaultedCount\", &j.FaultedCount)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"lastExecutionTime\":\n\t\t\terr = unpopulateTimeRFC3339(val, \"LastExecutionTime\", &j.LastExecutionTime)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"nextExecutionTime\":\n\t\t\terr = unpopulateTimeRFC3339(val, \"NextExecutionTime\", &j.NextExecutionTime)\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}", "title": "" }, { "docid": "cfae669136ee4c10f4a886cf507d06e1", "score": "0.53974915", "text": "func (p *PartitionMetric) 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\", p, err)\n\t}\n\tfor key, val := range rawMsg {\n\t\tvar err error\n\t\tswitch key {\n\t\tcase \"endTime\":\n\t\t\terr = unpopulateTimeRFC3339(val, \"EndTime\", &p.EndTime)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"metricValues\":\n\t\t\terr = unpopulate(val, \"MetricValues\", &p.MetricValues)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"name\":\n\t\t\terr = unpopulate(val, \"Name\", &p.Name)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"partitionId\":\n\t\t\terr = unpopulate(val, \"PartitionID\", &p.PartitionID)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"partitionKeyRangeId\":\n\t\t\terr = unpopulate(val, \"PartitionKeyRangeID\", &p.PartitionKeyRangeID)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"startTime\":\n\t\t\terr = unpopulateTimeRFC3339(val, \"StartTime\", &p.StartTime)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"timeGrain\":\n\t\t\terr = unpopulate(val, \"TimeGrain\", &p.TimeGrain)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"unit\":\n\t\t\terr = unpopulate(val, \"Unit\", &p.Unit)\n\t\t\tdelete(rawMsg, key)\n\t\t}\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"unmarshalling type %T: %v\", p, err)\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "12d4b35a5dd0021da9f8c69d3a99f183", "score": "0.53925854", "text": "func (v *VMwareCbtMigrateInput) 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 \"instanceType\":\n\t\t\terr = unpopulate(val, \"InstanceType\", &v.InstanceType)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"performShutdown\":\n\t\t\terr = unpopulate(val, \"PerformShutdown\", &v.PerformShutdown)\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}", "title": "" }, { "docid": "40c9e79dec2b8280bb6ce256d83a5600", "score": "0.5387847", "text": "func (wsi WaitStatisticsInput) MarshalJSON() ([]byte, error) {\n\tobjectMap := make(map[string]interface{})\n\tif wsi.WaitStatisticsInputProperties != nil {\n\t\tobjectMap[\"properties\"] = wsi.WaitStatisticsInputProperties\n\t}\n\treturn json.Marshal(objectMap)\n}", "title": "" }, { "docid": "1a5c72d71869a4538a9ed993ad584a93", "score": "0.5386591", "text": "func (s *SavingsPlanUtilizationSummaryProperties) 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 \"armSkuName\":\n\t\t\terr = unpopulate(val, \"ArmSKUName\", &s.ArmSKUName)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"avgUtilizationPercentage\":\n\t\t\terr = unpopulate(val, \"AvgUtilizationPercentage\", &s.AvgUtilizationPercentage)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"benefitId\":\n\t\t\terr = unpopulate(val, \"BenefitID\", &s.BenefitID)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"benefitOrderId\":\n\t\t\terr = unpopulate(val, \"BenefitOrderID\", &s.BenefitOrderID)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"benefitType\":\n\t\t\terr = unpopulate(val, \"BenefitType\", &s.BenefitType)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"maxUtilizationPercentage\":\n\t\t\terr = unpopulate(val, \"MaxUtilizationPercentage\", &s.MaxUtilizationPercentage)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"minUtilizationPercentage\":\n\t\t\terr = unpopulate(val, \"MinUtilizationPercentage\", &s.MinUtilizationPercentage)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"usageDate\":\n\t\t\terr = unpopulateTimeRFC3339(val, \"UsageDate\", &s.UsageDate)\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}", "title": "" }, { "docid": "a1d658239436afbc18feb6e4c756e424", "score": "0.5384393", "text": "func (s *SyncRequestMsg) UnmarshalJSON(b []byte) error {\n\traw := struct {\n\t\tTime int64\n\t\tGremlinFilter *string\n\t}{}\n\n\tif err := json.Unmarshal(b, &raw); err != nil {\n\t\treturn err\n\t}\n\n\tif raw.Time != 0 {\n\t\ts.TimeSlice = common.NewTimeSlice(raw.Time, raw.Time)\n\t}\n\ts.GremlinFilter = raw.GremlinFilter\n\n\treturn nil\n}", "title": "" }, { "docid": "b053b55ef3028e596bdb714cebf1cc92", "score": "0.5382777", "text": "func (b *BenefitUtilizationSummary) 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\", b, 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\", &b.ID)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"kind\":\n\t\t\terr = unpopulate(val, \"Kind\", &b.Kind)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"name\":\n\t\t\terr = unpopulate(val, \"Name\", &b.Name)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"type\":\n\t\t\terr = unpopulate(val, \"Type\", &b.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\", b, err)\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "014b94570a5c178f07a8655d91b7510f", "score": "0.53799576", "text": "func (d *DatabaseStatistics) 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\", d, err)\n\t}\n\tfor key, val := range rawMsg {\n\t\tvar err error\n\t\tswitch key {\n\t\tcase \"size\":\n\t\t\terr = unpopulate(val, \"Size\", &d.Size)\n\t\t\tdelete(rawMsg, key)\n\t\t}\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"unmarshalling type %T: %v\", d, err)\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "6b0db89e038ce6374cd782ceae0680fd", "score": "0.537133", "text": "func (j *JobFilter) 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 \"startTime\":\n\t\t\terr = unpopulateTimeRFC3339(val, \"StartTime\", &j.StartTime)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"status\":\n\t\t\terr = unpopulate(val, \"Status\", &j.Status)\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}", "title": "" }, { "docid": "d2222f94e1fe33b9b6abeac136950654", "score": "0.5362924", "text": "func (o *IntegrationInstanceStat) 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}", "title": "" }, { "docid": "c3bf72f7006273f9076ec49a128cb8d6", "score": "0.53604823", "text": "func (w *WorkloadClassifier) 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\", w, 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\", &w.ID)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"name\":\n\t\t\terr = unpopulate(val, \"Name\", &w.Name)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"properties\":\n\t\t\terr = unpopulate(val, \"Properties\", &w.Properties)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"type\":\n\t\t\terr = unpopulate(val, \"Type\", &w.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\", w, err)\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "2664e22483377c69d731702a54ed4adc", "score": "0.53578025", "text": "func (w *WorkflowRunFilter) 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\", w, err)\n\t}\n\tfor key, val := range rawMsg {\n\t\tvar err error\n\t\tswitch key {\n\t\tcase \"status\":\n\t\t\terr = unpopulate(val, \"Status\", &w.Status)\n\t\t\tdelete(rawMsg, key)\n\t\t}\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"unmarshalling type %T: %v\", w, err)\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "3bc8c636366ba71adfe7f79818a65353", "score": "0.5356899", "text": "func (b *Baseline) 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\", b, err)\n\t}\n\tfor key, val := range rawMsg {\n\t\tvar err error\n\t\tswitch key {\n\t\tcase \"expectedResults\":\n\t\t\terr = unpopulate(val, \"ExpectedResults\", &b.ExpectedResults)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"updatedTime\":\n\t\t\terr = unpopulateTimeRFC3339(val, \"UpdatedTime\", &b.UpdatedTime)\n\t\t\tdelete(rawMsg, key)\n\t\t}\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"unmarshalling type %T: %v\", b, err)\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "61a48fa91b9387d88a9612a4c9a186e7", "score": "0.535473", "text": "func (w *WorkloadGroupProperties) 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\", w, err)\n\t}\n\tfor key, val := range rawMsg {\n\t\tvar err error\n\t\tswitch key {\n\t\tcase \"importance\":\n\t\t\terr = unpopulate(val, \"Importance\", &w.Importance)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"maxResourcePercent\":\n\t\t\terr = unpopulate(val, \"MaxResourcePercent\", &w.MaxResourcePercent)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"maxResourcePercentPerRequest\":\n\t\t\terr = unpopulate(val, \"MaxResourcePercentPerRequest\", &w.MaxResourcePercentPerRequest)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"minResourcePercent\":\n\t\t\terr = unpopulate(val, \"MinResourcePercent\", &w.MinResourcePercent)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"minResourcePercentPerRequest\":\n\t\t\terr = unpopulate(val, \"MinResourcePercentPerRequest\", &w.MinResourcePercentPerRequest)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"queryExecutionTimeout\":\n\t\t\terr = unpopulate(val, \"QueryExecutionTimeout\", &w.QueryExecutionTimeout)\n\t\t\tdelete(rawMsg, key)\n\t\t}\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"unmarshalling type %T: %v\", w, err)\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "d4e2a2524c0a7302da56f918f062dc94", "score": "0.53490204", "text": "func (v *SetSamplingIntervalParams) UnmarshalJSON(data []byte) error {\n\tr := jlexer.Lexer{Data: data}\n\teasyjsonC5a4559bDecodeGithubComKnqChromedpCdpProfiler7(&r, v)\n\treturn r.Error()\n}", "title": "" }, { "docid": "05bb1b74c7b483fb12871267a2d2d7f3", "score": "0.53427243", "text": "func (p *PercentileMetric) 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\", p, err)\n\t}\n\tfor key, val := range rawMsg {\n\t\tvar err error\n\t\tswitch key {\n\t\tcase \"endTime\":\n\t\t\terr = unpopulateTimeRFC3339(val, \"EndTime\", &p.EndTime)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"metricValues\":\n\t\t\terr = unpopulate(val, \"MetricValues\", &p.MetricValues)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"name\":\n\t\t\terr = unpopulate(val, \"Name\", &p.Name)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"startTime\":\n\t\t\terr = unpopulateTimeRFC3339(val, \"StartTime\", &p.StartTime)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"timeGrain\":\n\t\t\terr = unpopulate(val, \"TimeGrain\", &p.TimeGrain)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"unit\":\n\t\t\terr = unpopulate(val, \"Unit\", &p.Unit)\n\t\t\tdelete(rawMsg, key)\n\t\t}\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"unmarshalling type %T: %v\", p, err)\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "5b2550bee9aec0da8175de4a78bc2d03", "score": "0.5341984", "text": "func (v *EventConsoleProfileFinished) UnmarshalJSON(data []byte) error {\n\tr := jlexer.Lexer{Data: data}\n\teasyjsonC5a4559bDecodeGithubComKnqChromedpCdpProfiler16(&r, v)\n\treturn r.Error()\n}", "title": "" }, { "docid": "3fb6dddbf2c72af322ba792d195b35f6", "score": "0.5339327", "text": "func (i *InMageAzureV2ApplyRecoveryPointInput) 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 \"instanceType\":\n\t\t\terr = unpopulate(val, \"InstanceType\", &i.InstanceType)\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}", "title": "" }, { "docid": "fad006fd81a9e94948cd3229589715a1", "score": "0.53391254", "text": "func (q *QueryPerformanceInsightResetDataResult) 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\", q, err)\n\t}\n\tfor key, val := range rawMsg {\n\t\tvar err error\n\t\tswitch key {\n\t\tcase \"message\":\n\t\t\terr = unpopulate(val, \"Message\", &q.Message)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"status\":\n\t\t\terr = unpopulate(val, \"Status\", &q.Status)\n\t\t\tdelete(rawMsg, key)\n\t\t}\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"unmarshalling type %T: %v\", q, err)\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "f8c68de8c8ad5274f6f98027f8832e3e", "score": "0.5332355", "text": "func (i *IntegrationRuntimeStatus) 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 \"dataFactoryName\":\n\t\t\terr = unpopulate(val, \"DataFactoryName\", &i.DataFactoryName)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"state\":\n\t\t\terr = unpopulate(val, \"State\", &i.State)\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\tdefault:\n\t\t\tif i.AdditionalProperties == nil {\n\t\t\t\ti.AdditionalProperties = map[string]any{}\n\t\t\t}\n\t\t\tif val != nil {\n\t\t\t\tvar aux any\n\t\t\t\terr = json.Unmarshal(val, &aux)\n\t\t\t\ti.AdditionalProperties[key] = aux\n\t\t\t}\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}", "title": "" }, { "docid": "8868e5a21468595f24a2fb27c003de3f", "score": "0.53176814", "text": "func (b *Baseline) 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 \"expectedResults\":\n\t\t\terr = unpopulate(val, &b.ExpectedResults)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"updatedTime\":\n\t\t\terr = unpopulateTimeRFC3339(val, &b.UpdatedTime)\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}", "title": "" }, { "docid": "eddd961158628f16bfad27dd6317042d", "score": "0.53154457", "text": "func (x *RequestTickBarUpdate_Request) 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 = RequestTickBarUpdate_Request(num)\n\treturn nil\n}", "title": "" }, { "docid": "1eb8a27b91e1ee2349f1671685a7c5e1", "score": "0.53117085", "text": "func (ss *StatsSummary) UnmarshalJSON(data []byte) error {\n\ttype Alias StatsSummary\n\tresp := struct {\n\t\tSummaryTime string `json:\"summaryTime\"`\n\t\tStatDate *string `json:\"statDate\"`\n\t\t*Alias\n\t}{\n\t\tAlias: (*Alias)(ss),\n\t}\n\terr := json.Unmarshal(data, &resp)\n\tif err != nil {\n\t\treturn err\n\t}\n\tif resp.StatDate != nil {\n\t\tstatDate, err := parseTime(*resp.StatDate)\n\t\tif err != nil {\n\t\t\treturn errors.New(\"invalid timestamp given for statDate\")\n\t\t}\n\t\tss.StatDate = &statDate\n\t}\n\n\tss.SummaryTime, err = parseTime(resp.SummaryTime)\n\tif err != nil {\n\t\treturn errors.New(\"invalid timestamp given for summaryTime\")\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "99b0226c0feb71f328c1dca1098f5185", "score": "0.52991223", "text": "func (u *Usage) 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 \"currentValue\":\n\t\t\terr = unpopulate(val, \"CurrentValue\", &u.CurrentValue)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"limit\":\n\t\t\terr = unpopulate(val, \"Limit\", &u.Limit)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"name\":\n\t\t\terr = unpopulate(val, \"Name\", &u.Name)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"quotaPeriod\":\n\t\t\terr = unpopulate(val, \"QuotaPeriod\", &u.QuotaPeriod)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"unit\":\n\t\t\terr = unpopulate(val, \"Unit\", &u.Unit)\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}", "title": "" }, { "docid": "507e2a8dd784e16d9e1c900d4fe8a78c", "score": "0.52903533", "text": "func (u *UsagesLimits) 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 \"nextLink\":\n\t\t\terr = unpopulate(val, \"NextLink\", &u.NextLink)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"value\":\n\t\t\terr = unpopulate(val, \"Value\", &u.Value)\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}", "title": "" }, { "docid": "0bbdb21d13159d607f37946421ff7b94", "score": "0.5285048", "text": "func (i *InMagePolicyInput) 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 \"appConsistentFrequencyInMinutes\":\n\t\t\terr = unpopulate(val, \"AppConsistentFrequencyInMinutes\", &i.AppConsistentFrequencyInMinutes)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"instanceType\":\n\t\t\terr = unpopulate(val, \"InstanceType\", &i.InstanceType)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"multiVmSyncStatus\":\n\t\t\terr = unpopulate(val, \"MultiVMSyncStatus\", &i.MultiVMSyncStatus)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"recoveryPointHistory\":\n\t\t\terr = unpopulate(val, \"RecoveryPointHistory\", &i.RecoveryPointHistory)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"recoveryPointThresholdInMinutes\":\n\t\t\terr = unpopulate(val, \"RecoveryPointThresholdInMinutes\", &i.RecoveryPointThresholdInMinutes)\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}", "title": "" }, { "docid": "8ecf7a2b55b8462403197a34bb6b4f40", "score": "0.52843606", "text": "func (t *TestMigrateInputProperties) 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 \"providerSpecificDetails\":\n\t\t\tt.ProviderSpecificDetails, err = unmarshalTestMigrateProviderSpecificInputClassification(val)\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}", "title": "" }, { "docid": "27a0779c169ca8b19c3d201b6219ac36", "score": "0.528075", "text": "func (u *Usage) 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 \"currentValue\":\n\t\t\terr = unpopulate(val, \"CurrentValue\", &u.CurrentValue)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"limit\":\n\t\t\terr = unpopulate(val, \"Limit\", &u.Limit)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"name\":\n\t\t\terr = unpopulate(val, \"Name\", &u.Name)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"unit\":\n\t\t\terr = unpopulate(val, \"Unit\", &u.Unit)\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}", "title": "" }, { "docid": "1bd22efe527cb1582b2e2b5f9224dcad", "score": "0.52789044", "text": "func (t *TwinUpdatesNotInAllowedRange) 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 \"description\":\n\t\t\terr = unpopulate(val, \"Description\", &t.Description)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"displayName\":\n\t\t\terr = unpopulate(val, \"DisplayName\", &t.DisplayName)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"isEnabled\":\n\t\t\terr = unpopulate(val, \"IsEnabled\", &t.IsEnabled)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"maxThreshold\":\n\t\t\terr = unpopulate(val, \"MaxThreshold\", &t.MaxThreshold)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"minThreshold\":\n\t\t\terr = unpopulate(val, \"MinThreshold\", &t.MinThreshold)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"ruleType\":\n\t\t\terr = unpopulate(val, \"RuleType\", &t.RuleType)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"timeWindowSize\":\n\t\t\terr = unpopulate(val, \"TimeWindowSize\", &t.TimeWindowSize)\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}", "title": "" }, { "docid": "30f9d0c8b02b1b0a284a1dad0219f23e", "score": "0.5268955", "text": "func (s *SavingsPlanUtilizationSummary) 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 \"kind\":\n\t\t\terr = unpopulate(val, \"Kind\", &s.Kind)\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 \"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}", "title": "" }, { "docid": "bfb5274fa49731cb007636101628c385", "score": "0.5264574", "text": "func (i *Invocation) UnmarshalJSON(buf []byte) error {\n\ttmp := []interface{}{&i.Name, &i.Arguments, &i.MethodCallID}\n\twantLen := len(tmp)\n\tif err := json.Unmarshal(buf, &tmp); err != nil {\n\t\treturn err\n\t}\n\tif g, e := len(tmp), wantLen; g != e {\n\t\treturn fmt.Errorf(\"wrong number of fields in Notification: %d != %d\", g, e)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "b3a5164f1a496be14ab423ab92663e89", "score": "0.52590376", "text": "func (k *KustoPoolUpdate) 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\", k, 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\", &k.ID)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"name\":\n\t\t\terr = unpopulate(val, \"Name\", &k.Name)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"properties\":\n\t\t\terr = unpopulate(val, \"Properties\", &k.Properties)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"sku\":\n\t\t\terr = unpopulate(val, \"SKU\", &k.SKU)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"tags\":\n\t\t\terr = unpopulate(val, \"Tags\", &k.Tags)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"type\":\n\t\t\terr = unpopulate(val, \"Type\", &k.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\", k, err)\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "e8dba77c1fbc4c7a09d4e878777de9ca", "score": "0.52527773", "text": "func (v *ThreadInput) UnmarshalJSON(data []byte) error {\n\tr := jlexer.Lexer{Data: data}\n\teasyjsonC8d74561DecodeGithubComPringleskateTPDBHomeworkInternalModels4(&r, v)\n\treturn r.Error()\n}", "title": "" }, { "docid": "ad5cf0e9b1dd1d282d67cbe929b30b5d", "score": "0.52517104", "text": "func (p *PatchBackupVaultInput) 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\", p, err)\n\t}\n\tfor key, val := range rawMsg {\n\t\tvar err error\n\t\tswitch key {\n\t\tcase \"featureSettings\":\n\t\t\terr = unpopulate(val, \"FeatureSettings\", &p.FeatureSettings)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"monitoringSettings\":\n\t\t\terr = unpopulate(val, \"MonitoringSettings\", &p.MonitoringSettings)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"securitySettings\":\n\t\t\terr = unpopulate(val, \"SecuritySettings\", &p.SecuritySettings)\n\t\t\tdelete(rawMsg, key)\n\t\t}\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"unmarshalling type %T: %v\", p, err)\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "40f3b3f23122ae91a9ba92649f5f8e61", "score": "0.52466464", "text": "func (p *PercentileMetricListResult) 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\", p, err)\n\t}\n\tfor key, val := range rawMsg {\n\t\tvar err error\n\t\tswitch key {\n\t\tcase \"value\":\n\t\t\terr = unpopulate(val, \"Value\", &p.Value)\n\t\t\tdelete(rawMsg, key)\n\t\t}\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"unmarshalling type %T: %v\", p, err)\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "e12db7e13db4021b2c78ddc678e52f20", "score": "0.524539", "text": "func (u *UsagesResult) 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 \"value\":\n\t\t\terr = unpopulate(val, \"Value\", &u.Value)\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}", "title": "" }, { "docid": "b47ea123cbcaf6174b3657a4904acf67", "score": "0.52448016", "text": "func (r *RollingCounter) UnmarshalJSON(b []byte) error {\n\tvar into jsonCounter\n\tif err := json.Unmarshal(b, &into); err != nil {\n\t\treturn err\n\t}\n\tr.buckets = into.Buckets\n\tr.rollingSum = *into.RollingSum\n\tr.totalSum = *into.TotalSum\n\tr.rollingBucket = *into.RollingBucket\n\treturn nil\n}", "title": "" }, { "docid": "da14f26185d033a985d5c13e9a0b8d61", "score": "0.5237744", "text": "func (i *InMageAzureV2PolicyInput) 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 \"appConsistentFrequencyInMinutes\":\n\t\t\terr = unpopulate(val, \"AppConsistentFrequencyInMinutes\", &i.AppConsistentFrequencyInMinutes)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"crashConsistentFrequencyInMinutes\":\n\t\t\terr = unpopulate(val, \"CrashConsistentFrequencyInMinutes\", &i.CrashConsistentFrequencyInMinutes)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"instanceType\":\n\t\t\terr = unpopulate(val, \"InstanceType\", &i.InstanceType)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"multiVmSyncStatus\":\n\t\t\terr = unpopulate(val, \"MultiVMSyncStatus\", &i.MultiVMSyncStatus)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"recoveryPointHistory\":\n\t\t\terr = unpopulate(val, \"RecoveryPointHistory\", &i.RecoveryPointHistory)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"recoveryPointThresholdInMinutes\":\n\t\t\terr = unpopulate(val, \"RecoveryPointThresholdInMinutes\", &i.RecoveryPointThresholdInMinutes)\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}", "title": "" }, { "docid": "cf0215793f1eb740f97ed2e21e9f834c", "score": "0.52295744", "text": "func (s *SecretBase) 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 \"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}", "title": "" }, { "docid": "40d2a5d6e7a7abe56ca6cf4efb31837d", "score": "0.5228421", "text": "func (f *FeatureValidationRequestBase) 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\", f, err)\n\t}\n\tfor key, val := range rawMsg {\n\t\tvar err error\n\t\tswitch key {\n\t\tcase \"objectType\":\n\t\t\terr = unpopulate(val, \"ObjectType\", &f.ObjectType)\n\t\t\tdelete(rawMsg, key)\n\t\t}\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"unmarshalling type %T: %v\", f, err)\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "da1e557c5a48bc620816d25dfde2c4fc", "score": "0.52279323", "text": "func (p *PartitionUsagesResult) 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\", p, err)\n\t}\n\tfor key, val := range rawMsg {\n\t\tvar err error\n\t\tswitch key {\n\t\tcase \"value\":\n\t\t\terr = unpopulate(val, \"Value\", &p.Value)\n\t\t\tdelete(rawMsg, key)\n\t\t}\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"unmarshalling type %T: %v\", p, err)\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "5ffa71e7e5ac7032f8873d1834b95d9c", "score": "0.5225232", "text": "func (e *EntityGetInsightsParameters) 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 \"addDefaultExtendedTimeRange\":\n\t\t\terr = unpopulate(val, \"AddDefaultExtendedTimeRange\", &e.AddDefaultExtendedTimeRange)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"endTime\":\n\t\t\terr = unpopulateTimeRFC3339(val, \"EndTime\", &e.EndTime)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"insightQueryIds\":\n\t\t\terr = unpopulate(val, \"InsightQueryIDs\", &e.InsightQueryIDs)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"startTime\":\n\t\t\terr = unpopulateTimeRFC3339(val, \"StartTime\", &e.StartTime)\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}", "title": "" }, { "docid": "4774367418301ba3108c9c7a393cc87a", "score": "0.522398", "text": "func (a *A2AApplyRecoveryPointInput) 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 \"instanceType\":\n\t\t\terr = unpopulate(val, \"InstanceType\", &a.InstanceType)\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}", "title": "" }, { "docid": "d8b46073ab3cc29d118f563d0f6123d7", "score": "0.5220972", "text": "func (m *Metric) 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 \"endTime\":\n\t\t\terr = unpopulateTimeRFC3339(val, \"EndTime\", &m.EndTime)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"metricValues\":\n\t\t\terr = unpopulate(val, \"MetricValues\", &m.MetricValues)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"name\":\n\t\t\terr = unpopulate(val, \"Name\", &m.Name)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"startTime\":\n\t\t\terr = unpopulateTimeRFC3339(val, \"StartTime\", &m.StartTime)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"timeGrain\":\n\t\t\terr = unpopulate(val, \"TimeGrain\", &m.TimeGrain)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"unit\":\n\t\t\terr = unpopulate(val, \"Unit\", &m.Unit)\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}", "title": "" }, { "docid": "d7ceb053c9b4809babfba6db3c0adfc6", "score": "0.5219294", "text": "func (w *WorkloadGroup) 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\", w, 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\", &w.ID)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"name\":\n\t\t\terr = unpopulate(val, \"Name\", &w.Name)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"properties\":\n\t\t\terr = unpopulate(val, \"Properties\", &w.Properties)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"type\":\n\t\t\terr = unpopulate(val, \"Type\", &w.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\", w, err)\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "e7de3c4003eca3ef651d91103b1ce517", "score": "0.5219156", "text": "func (h *HyperVReplicaAzurePolicyInput) 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\", h, err)\n\t}\n\tfor key, val := range rawMsg {\n\t\tvar err error\n\t\tswitch key {\n\t\tcase \"applicationConsistentSnapshotFrequencyInHours\":\n\t\t\terr = unpopulate(val, \"ApplicationConsistentSnapshotFrequencyInHours\", &h.ApplicationConsistentSnapshotFrequencyInHours)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"instanceType\":\n\t\t\terr = unpopulate(val, \"InstanceType\", &h.InstanceType)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"onlineReplicationStartTime\":\n\t\t\terr = unpopulate(val, \"OnlineReplicationStartTime\", &h.OnlineReplicationStartTime)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"recoveryPointHistoryDuration\":\n\t\t\terr = unpopulate(val, \"RecoveryPointHistoryDuration\", &h.RecoveryPointHistoryDuration)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"replicationInterval\":\n\t\t\terr = unpopulate(val, \"ReplicationInterval\", &h.ReplicationInterval)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"storageAccounts\":\n\t\t\terr = unpopulate(val, \"StorageAccounts\", &h.StorageAccounts)\n\t\t\tdelete(rawMsg, key)\n\t\t}\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"unmarshalling type %T: %v\", h, err)\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "1c1d9b5aa546fe24e4a7205bc00d5443", "score": "0.5217799", "text": "func (h *HyperVReplicaAzureFailbackProviderInput) 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\", h, err)\n\t}\n\tfor key, val := range rawMsg {\n\t\tvar err error\n\t\tswitch key {\n\t\tcase \"dataSyncOption\":\n\t\t\terr = unpopulate(val, \"DataSyncOption\", &h.DataSyncOption)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"instanceType\":\n\t\t\terr = unpopulate(val, \"InstanceType\", &h.InstanceType)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"providerIdForAlternateRecovery\":\n\t\t\terr = unpopulate(val, \"ProviderIDForAlternateRecovery\", &h.ProviderIDForAlternateRecovery)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"recoveryVmCreationOption\":\n\t\t\terr = unpopulate(val, \"RecoveryVMCreationOption\", &h.RecoveryVMCreationOption)\n\t\t\tdelete(rawMsg, key)\n\t\t}\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"unmarshalling type %T: %v\", h, err)\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "9cee511aef76900445d581e016c19b6b", "score": "0.5216882", "text": "func (u *UpdateIntegrationRuntimeNodeRequest) 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 \"concurrentJobsLimit\":\n\t\t\terr = unpopulate(val, \"ConcurrentJobsLimit\", &u.ConcurrentJobsLimit)\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}", "title": "" }, { "docid": "238af8128a9373743e6509196adcf65f", "score": "0.5210783", "text": "func (p *PartitionUsage) 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\", p, err)\n\t}\n\tfor key, val := range rawMsg {\n\t\tvar err error\n\t\tswitch key {\n\t\tcase \"currentValue\":\n\t\t\terr = unpopulate(val, \"CurrentValue\", &p.CurrentValue)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"limit\":\n\t\t\terr = unpopulate(val, \"Limit\", &p.Limit)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"name\":\n\t\t\terr = unpopulate(val, \"Name\", &p.Name)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"partitionId\":\n\t\t\terr = unpopulate(val, \"PartitionID\", &p.PartitionID)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"partitionKeyRangeId\":\n\t\t\terr = unpopulate(val, \"PartitionKeyRangeID\", &p.PartitionKeyRangeID)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"quotaPeriod\":\n\t\t\terr = unpopulate(val, \"QuotaPeriod\", &p.QuotaPeriod)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"unit\":\n\t\t\terr = unpopulate(val, \"Unit\", &p.Unit)\n\t\t\tdelete(rawMsg, key)\n\t\t}\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"unmarshalling type %T: %v\", p, err)\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "6d3e78f23db2929129249d49f3f4c6b7", "score": "0.52075464", "text": "func (j *JobHistoryFilter) 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 \"status\":\n\t\t\terr = unpopulate(val, \"Status\", &j.Status)\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}", "title": "" }, { "docid": "de2c7e6914c995e068d44b8dfb38504b", "score": "0.52003306", "text": "func (i *IntegrationRuntimeStopOperationStatus) 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 \"error\":\n\t\t\terr = unpopulate(val, \"Error\", &i.Error)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"name\":\n\t\t\terr = unpopulate(val, \"Name\", &i.Name)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"properties\":\n\t\t\terr = unpopulate(val, \"Properties\", &i.Properties)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"status\":\n\t\t\terr = unpopulate(val, \"Status\", &i.Status)\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}", "title": "" }, { "docid": "7ce37504a1236f67603200bae1565149", "score": "0.5199893", "text": "func (m *ComparisonReportInput) UnmarshalJSON(raw []byte) error {\n\t// AO0\n\tvar aO0 ComparisonReportGeneric\n\tif err := swag.ReadJSON(raw, &aO0); err != nil {\n\t\treturn err\n\t}\n\tm.ComparisonReportGeneric = aO0\n\n\t// AO1\n\tvar dataAO1 struct {\n\t\tChecks []*ComparisonCheckInput `json:\"checks\"`\n\n\t\tLocations []int32 `json:\"locations\"`\n\t}\n\tif err := swag.ReadJSON(raw, &dataAO1); err != nil {\n\t\treturn err\n\t}\n\n\tm.Checks = dataAO1.Checks\n\n\tm.Locations = dataAO1.Locations\n\n\treturn nil\n}", "title": "" }, { "docid": "71c5ad947ead1878cd8b6f11ca0f517b", "score": "0.5194293", "text": "func (k *KustoPoolCheckNameRequest) 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\", k, 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\", &k.Name)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"type\":\n\t\t\terr = unpopulate(val, \"Type\", &k.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\", k, err)\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "5ca61d6962f099d4a0ea8c146792b405", "score": "0.51933074", "text": "func (r *ResizeOperationStatus) 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 \"errors\":\n\t\t\terr = unpopulate(val, \"Errors\", &r.Errors)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"nodeDeallocationOption\":\n\t\t\terr = unpopulate(val, \"NodeDeallocationOption\", &r.NodeDeallocationOption)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"resizeTimeout\":\n\t\t\terr = unpopulate(val, \"ResizeTimeout\", &r.ResizeTimeout)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"startTime\":\n\t\t\terr = unpopulateTimeRFC3339(val, \"StartTime\", &r.StartTime)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"targetDedicatedNodes\":\n\t\t\terr = unpopulate(val, \"TargetDedicatedNodes\", &r.TargetDedicatedNodes)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"targetLowPriorityNodes\":\n\t\t\terr = unpopulate(val, \"TargetLowPriorityNodes\", &r.TargetLowPriorityNodes)\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}", "title": "" }, { "docid": "f858f1a6a2846ebde729254f5ae289cb", "score": "0.51932865", "text": "func (r *RuleResultsInput) 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 \"latestScan\":\n\t\t\terr = unpopulate(val, \"LatestScan\", &r.LatestScan)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"results\":\n\t\t\terr = unpopulate(val, \"Results\", &r.Results)\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}", "title": "" }, { "docid": "fc9471a17ab0fbe33ff1cfb9884138c4", "score": "0.51929456", "text": "func (a *AzureFabricCreationInput) 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 \"instanceType\":\n\t\t\terr = unpopulate(val, \"InstanceType\", &a.InstanceType)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"location\":\n\t\t\terr = unpopulate(val, \"Location\", &a.Location)\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}", "title": "" }, { "docid": "5d8d56f0e5350ce064f5aeb58cb59541", "score": "0.518974", "text": "func (h *HTTPC2DRejectedMessagesNotInAllowedRange) 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\", h, err)\n\t}\n\tfor key, val := range rawMsg {\n\t\tvar err error\n\t\tswitch key {\n\t\tcase \"description\":\n\t\t\terr = unpopulate(val, \"Description\", &h.Description)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"displayName\":\n\t\t\terr = unpopulate(val, \"DisplayName\", &h.DisplayName)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"isEnabled\":\n\t\t\terr = unpopulate(val, \"IsEnabled\", &h.IsEnabled)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"maxThreshold\":\n\t\t\terr = unpopulate(val, \"MaxThreshold\", &h.MaxThreshold)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"minThreshold\":\n\t\t\terr = unpopulate(val, \"MinThreshold\", &h.MinThreshold)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"ruleType\":\n\t\t\terr = unpopulate(val, \"RuleType\", &h.RuleType)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"timeWindowSize\":\n\t\t\terr = unpopulate(val, \"TimeWindowSize\", &h.TimeWindowSize)\n\t\t\tdelete(rawMsg, key)\n\t\t}\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"unmarshalling type %T: %v\", h, err)\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "67c8d113a3007d708d10a9d91763cc00", "score": "0.51858294", "text": "func (ss *StatsSummaryLastUpdated) UnmarshalJSON(data []byte) error {\n\tresp := struct {\n\t\tSummaryTime *string `json:\"summaryTime\"`\n\t}{}\n\terr := json.Unmarshal(data, &resp)\n\tif err != nil {\n\t\treturn err\n\t}\n\tif resp.SummaryTime != nil {\n\t\tvar summaryTime time.Time\n\t\tsummaryTime, err = time.Parse(time.RFC3339, *resp.SummaryTime)\n\t\tif err == nil {\n\t\t\tss.SummaryTime = &summaryTime\n\t\t\treturn nil\n\t\t}\n\t\tsummaryTime, err = time.Parse(TimeLayout, *resp.SummaryTime)\n\t\tss.SummaryTime = &summaryTime\n\t\treturn err\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "450ff94ba2a4075608e52488916a4bc1", "score": "0.51796746", "text": "func (r *ResourceStatusBase) 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 \"lastModified\":\n\t\t\terr = unpopulateTimeRFC3339(val, \"LastModified\", &r.LastModified)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"timeCreated\":\n\t\t\terr = unpopulateTimeRFC3339(val, \"TimeCreated\", &r.TimeCreated)\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}", "title": "" }, { "docid": "0158ec2a2d1c854aa13472548448ca15", "score": "0.5178272", "text": "func (w *WorkflowRunActionFilter) 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\", w, err)\n\t}\n\tfor key, val := range rawMsg {\n\t\tvar err error\n\t\tswitch key {\n\t\tcase \"status\":\n\t\t\terr = unpopulate(val, \"Status\", &w.Status)\n\t\t\tdelete(rawMsg, key)\n\t\t}\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"unmarshalling type %T: %v\", w, err)\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "220e2b04306b7fce8e81c1f55db2398a", "score": "0.5175119", "text": "func (w WaitStatisticsInputProperties) MarshalJSON() ([]byte, error) {\n\tobjectMap := make(map[string]any)\n\tpopulate(objectMap, \"aggregationWindow\", w.AggregationWindow)\n\tpopulateTimeRFC3339(objectMap, \"observationEndTime\", w.ObservationEndTime)\n\tpopulateTimeRFC3339(objectMap, \"observationStartTime\", w.ObservationStartTime)\n\treturn json.Marshal(objectMap)\n}", "title": "" }, { "docid": "cd810297c13dcd02f72459ef2e9e7666", "score": "0.51740193", "text": "func (i *IntegrationServiceEnvironmentSKUCapacity) 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 \"default\":\n\t\t\terr = unpopulate(val, \"Default\", &i.Default)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"maximum\":\n\t\t\terr = unpopulate(val, \"Maximum\", &i.Maximum)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"minimum\":\n\t\t\terr = unpopulate(val, \"Minimum\", &i.Minimum)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"scaleType\":\n\t\t\terr = unpopulate(val, \"ScaleType\", &i.ScaleType)\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}", "title": "" }, { "docid": "4c6ea75b33d6777d2b40bdd5ea8ab9cc", "score": "0.5166725", "text": "func (x *QuoteStatistics_PresenceBits) 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 = QuoteStatistics_PresenceBits(num)\n\treturn nil\n}", "title": "" }, { "docid": "f072e46856ba964685f32f6fbbac069a", "score": "0.5164001", "text": "func (i *InMageRcmApplyRecoveryPointInput) 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 \"instanceType\":\n\t\t\terr = unpopulate(val, \"InstanceType\", &i.InstanceType)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"recoveryPointId\":\n\t\t\terr = unpopulate(val, \"RecoveryPointID\", &i.RecoveryPointID)\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}", "title": "" }, { "docid": "cceedd6eaca64ef4070cc784b2dc901d", "score": "0.5162939", "text": "func (p *PercentileMetricValue) 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\", p, err)\n\t}\n\tfor key, val := range rawMsg {\n\t\tvar err error\n\t\tswitch key {\n\t\tcase \"average\":\n\t\t\terr = unpopulate(val, \"Average\", &p.Average)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"_count\":\n\t\t\terr = unpopulate(val, \"Count\", &p.Count)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"maximum\":\n\t\t\terr = unpopulate(val, \"Maximum\", &p.Maximum)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"minimum\":\n\t\t\terr = unpopulate(val, \"Minimum\", &p.Minimum)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"P10\":\n\t\t\terr = unpopulate(val, \"P10\", &p.P10)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"P25\":\n\t\t\terr = unpopulate(val, \"P25\", &p.P25)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"P50\":\n\t\t\terr = unpopulate(val, \"P50\", &p.P50)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"P75\":\n\t\t\terr = unpopulate(val, \"P75\", &p.P75)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"P90\":\n\t\t\terr = unpopulate(val, \"P90\", &p.P90)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"P95\":\n\t\t\terr = unpopulate(val, \"P95\", &p.P95)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"P99\":\n\t\t\terr = unpopulate(val, \"P99\", &p.P99)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"timestamp\":\n\t\t\terr = unpopulateTimeRFC3339(val, \"Timestamp\", &p.Timestamp)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"total\":\n\t\t\terr = unpopulate(val, \"Total\", &p.Total)\n\t\t\tdelete(rawMsg, key)\n\t\t}\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"unmarshalling type %T: %v\", p, err)\n\t\t}\n\t}\n\treturn nil\n}", "title": "" } ]
175f9087d73bd8e42dbb1da85bb93d4d
GetEmailsOk returns a tuple with the Emails field value and a boolean to check if the value has been set.
[ { "docid": "888cbbb411efc0db1538e92628a6bbdd", "score": "0.83266884", "text": "func (o *User) GetEmailsOk() (*[]Email, bool) {\n\tif o == nil {\n\t\treturn nil, false\n\t}\n\treturn &o.Emails, true\n}", "title": "" } ]
[ { "docid": "1beaff2ce2e88822aef4dd92a0bd067d", "score": "0.82279813", "text": "func (o *ConsumerReportUserIdentity) GetEmailsOk() (*[]string, bool) {\n\tif o == nil {\n\t\treturn nil, false\n\t}\n\treturn &o.Emails, true\n}", "title": "" }, { "docid": "936f40d5d15806ddaa60486c04fa1ba9", "score": "0.7124718", "text": "func (o *InlineObject636) GetEmailAddressesOk() ([]string, bool) {\n\tif o == nil || o.EmailAddresses == nil {\n\t\tvar ret []string\n\t\treturn ret, false\n\t}\n\treturn *o.EmailAddresses, true\n}", "title": "" }, { "docid": "c92c580ca7cfd526922b1f8e9cf860e3", "score": "0.65997094", "text": "func (o *SubscriberCountByType) GetEmailOk() (*int32, bool) {\n\tif o == nil || o.Email == nil {\n\t\treturn nil, false\n\t}\n\treturn o.Email, true\n}", "title": "" }, { "docid": "ad2eda44bdb143d72c8547900ca4d6f5", "score": "0.65837336", "text": "func (o *ServiceAccountCreateAttributes) GetEmailOk() (*string, bool) {\n\tif o == nil {\n\t\treturn nil, false\n\t}\n\treturn &o.Email, true\n}", "title": "" }, { "docid": "4d6c3c472e8a4756eddab53b56461781", "score": "0.6401395", "text": "func (o *SubmitSelfServiceRecoveryFlowWithCodeMethodBody) GetEmailOk() (*string, bool) {\n\tif o == nil || o.Email == nil {\n\t\treturn nil, false\n\t}\n\treturn o.Email, true\n}", "title": "" }, { "docid": "f78c21da0281893d07d12c2c17cacb38", "score": "0.63919264", "text": "func (o *User) GetEmailOk() (*string, bool) {\n\tif o == nil {\n\t\treturn nil, false\n\t}\n\treturn &o.Email, true\n}", "title": "" }, { "docid": "b115321aadc0fafd83155ba8399dc31f", "score": "0.6375589", "text": "func (o *EmailVerifyRequest) GetEmailOk() (*string, bool) {\n\tif o == nil || o.Email == nil {\n\t\treturn nil, false\n\t}\n\treturn o.Email, true\n}", "title": "" }, { "docid": "f20a8777ca043ede9cb5b695db9decbb", "score": "0.6367504", "text": "func (o *GroupLifecyclePolicy) GetAlternateNotificationEmailsOk() (string, bool) {\n\tif o == nil || o.AlternateNotificationEmails == nil {\n\t\tvar ret string\n\t\treturn ret, false\n\t}\n\treturn *o.AlternateNotificationEmails, true\n}", "title": "" }, { "docid": "90fb6ab502cd9ae7eeaa4646de7e87db", "score": "0.63644475", "text": "func (o *EntityScreeningHitEmails) GetEmailAddressOk() (*string, bool) {\n\tif o == nil {\n\t\treturn nil, false\n\t}\n\treturn &o.EmailAddress, true\n}", "title": "" }, { "docid": "bb5733976c0ba777485f0fc7e2ac8055", "score": "0.6307483", "text": "func (o *User) GetEmailOk() (string, bool) {\n\tif o == nil || o.Email == nil {\n\t\tvar ret string\n\t\treturn ret, false\n\t}\n\treturn *o.Email, true\n}", "title": "" }, { "docid": "d70ad01a18779c09d1108a2ccb5ebff7", "score": "0.6306821", "text": "func (o *MicrosoftGraphOrganization) GetMarketingNotificationEmailsOk() ([]string, bool) {\n\tif o == nil || o.MarketingNotificationEmails == nil {\n\t\tvar ret []string\n\t\treturn ret, false\n\t}\n\treturn *o.MarketingNotificationEmails, true\n}", "title": "" }, { "docid": "99ccdb254776419ce6ac7c3442ef9a41", "score": "0.6287305", "text": "func (o *User) GetEmailOk() (*string, bool) {\n\tif o == nil || o.Email == nil {\n\t\treturn nil, false\n\t}\n\treturn o.Email, true\n}", "title": "" }, { "docid": "9ba274bca96a14e4e099b935a6a3ca82", "score": "0.626213", "text": "func (o *PageAccessUser) GetEmailOk() (*string, bool) {\n\tif o == nil || o.Email == nil {\n\t\treturn nil, false\n\t}\n\treturn o.Email, true\n}", "title": "" }, { "docid": "281cd4b2bdc41bd99878ee94debd4b46", "score": "0.61869085", "text": "func (o *BeaconUserData) GetEmailAddressOk() (*string, bool) {\n\tif o == nil {\n\t\treturn nil, false\n\t}\n\treturn o.EmailAddress.Get(), o.EmailAddress.IsSet()\n}", "title": "" }, { "docid": "fd71b73e92aa58c6a0402ef5f4bfe573", "score": "0.61273754", "text": "func (o *MicrosoftGraphSharingInvitation) GetEmailOk() (string, bool) {\n\tif o == nil || o.Email == nil {\n\t\tvar ret string\n\t\treturn ret, false\n\t}\n\treturn *o.Email, true\n}", "title": "" }, { "docid": "22b2c03993e30d34898df2059fd91153", "score": "0.605129", "text": "func NewGetUserEmailsOK() *GetUserEmailsOK {\n\treturn &GetUserEmailsOK{}\n}", "title": "" }, { "docid": "1885fac7ec4eea05861bc0837d4ca7bd", "score": "0.60358477", "text": "func (o *ConsumerReportUserIdentity) GetEmails() []string {\n\tif o == nil {\n\t\tvar ret []string\n\t\treturn ret\n\t}\n\n\treturn o.Emails\n}", "title": "" }, { "docid": "bb11e2ba6f29f54620b120f3541dbc9d", "score": "0.6021077", "text": "func (o *LicenseUser) GetEmailOk() (*string, bool) {\n\tif o == nil || IsNil(o.Email) {\n\t\treturn nil, false\n\t}\n\treturn o.Email, true\n}", "title": "" }, { "docid": "8188021efa6e250bb4f7eb86172d6860", "score": "0.6020913", "text": "func (o *BankTransferUser) GetEmailAddressOk() (*string, bool) {\n\tif o == nil {\n\t\treturn nil, false\n\t}\n\treturn o.EmailAddress.Get(), o.EmailAddress.IsSet()\n}", "title": "" }, { "docid": "8e052a62a72b06259649b58dfede374a", "score": "0.6008745", "text": "func (o *User) GetEmails() []Email {\n\tif o == nil {\n\t\tvar ret []Email\n\t\treturn ret\n\t}\n\n\treturn o.Emails\n}", "title": "" }, { "docid": "9c8fcce9a0b84025161c8470d5ffbb49", "score": "0.5949255", "text": "func (o *TipoNotificacao) GetMensagemEmailOk() (*string, bool) {\n\tif o == nil {\n\t\treturn nil, false\n\t}\n\treturn o.MensagemEmail.Get(), o.MensagemEmail.IsSet()\n}", "title": "" }, { "docid": "0dcfb35ed5824a6b995e01d73bb547b4", "score": "0.5919381", "text": "func (o UptimeAlertNotificationOutput) Emails() pulumi.StringArrayOutput {\n\treturn o.ApplyT(func(v UptimeAlertNotification) []string { return v.Emails }).(pulumi.StringArrayOutput)\n}", "title": "" }, { "docid": "b54846194dcace243694487480b2f151", "score": "0.5886538", "text": "func (o *TipoNotificacaoUtilizador) GetPorEmailOk() (*bool, bool) {\n\tif o == nil {\n\t\treturn nil, false\n\t}\n\treturn o.PorEmail.Get(), o.PorEmail.IsSet()\n}", "title": "" }, { "docid": "25362d2ff2eaa7edbe8fba89b90c851a", "score": "0.5878537", "text": "func (o *FullIdentity) GetEmailAddressOk() (*string, bool) {\n\tif o == nil || o.EmailAddress == nil {\n\t\treturn nil, false\n\t}\n\treturn o.EmailAddress, true\n}", "title": "" }, { "docid": "e6b1c56cd298673f1aed82e56891f99b", "score": "0.5819919", "text": "func (d *Dialer) GetEmails(uids ...int) (emails map[int]*Email, err error) {\n\temails, err = d.GetOverviews(uids...)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tif len(emails) == 0 {\n\t\treturn\n\t}\n\n\tuidsStr := strings.Builder{}\n\tif len(uids) == 0 {\n\t\tuidsStr.WriteString(\"1:*\")\n\t} else {\n\t\ti := 0\n\t\tfor u := range emails {\n\t\t\tif u == 0 {\n\t\t\t\tcontinue\n\t\t\t}\n\n\t\t\tif i != 0 {\n\t\t\t\tuidsStr.WriteByte(',')\n\t\t\t}\n\t\t\tuidsStr.WriteString(strconv.Itoa(u))\n\t\t\ti++\n\t\t}\n\t}\n\n\tvar records [][]*Token\n\terr = retry.Retry(func() (err error) {\n\t\tr, err := d.Exec(\"UID FETCH \"+uidsStr.String()+\" BODY.PEEK[]\", true, 0, nil)\n\t\tif err != nil {\n\t\t\treturn\n\t\t}\n\n\t\trecords, err = d.ParseFetchResponse(r)\n\t\tif err != nil {\n\t\t\treturn\n\t\t}\n\n\t\tfor _, tks := range records {\n\t\t\te := &Email{}\n\t\t\tskip := 0\n\t\t\tsuccess := true\n\t\t\tfor i, t := range tks {\n\t\t\t\tif skip > 0 {\n\t\t\t\t\tskip--\n\t\t\t\t\tcontinue\n\t\t\t\t}\n\t\t\t\tif err = d.CheckType(t, []TType{TLiteral}, tks, \"in root\"); err != nil {\n\t\t\t\t\treturn\n\t\t\t\t}\n\t\t\t\tswitch t.Str {\n\t\t\t\tcase \"BODY[]\":\n\t\t\t\t\tif err = d.CheckType(tks[i+1], []TType{TAtom}, tks, \"after BODY[]\"); err != nil {\n\t\t\t\t\t\treturn\n\t\t\t\t\t}\n\t\t\t\t\tmsg := tks[i+1].Str\n\t\t\t\t\tr := strings.NewReader(msg)\n\n\t\t\t\t\tenv, err := enmime.ReadEnvelope(r)\n\t\t\t\t\tif err != nil {\n\t\t\t\t\t\tif Verbose {\n\t\t\t\t\t\t\tlog(d.ConnNum, d.Folder, aurora.Yellow(aurora.Sprintf(\"email body could not be parsed, skipping: %s\", err)))\n\t\t\t\t\t\t\tspew.Dump(env)\n\t\t\t\t\t\t\tspew.Dump(msg)\n\t\t\t\t\t\t\t// os.Exit(0)\n\t\t\t\t\t\t}\n\t\t\t\t\t\tsuccess = false\n\n\t\t\t\t\t\t// continue RecL\n\t\t\t\t\t} else {\n\n\t\t\t\t\t\te.Subject = env.GetHeader(\"Subject\")\n\t\t\t\t\t\te.Text = env.Text\n\t\t\t\t\t\te.HTML = env.HTML\n\n\t\t\t\t\t\tif len(env.Attachments) != 0 {\n\t\t\t\t\t\t\tfor _, a := range env.Attachments {\n\t\t\t\t\t\t\t\te.Attachments = append(e.Attachments, Attachment{\n\t\t\t\t\t\t\t\t\tName: a.FileName,\n\t\t\t\t\t\t\t\t\tMimeType: a.ContentType,\n\t\t\t\t\t\t\t\t\tContent: a.Content,\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\n\t\t\t\t\t\tif len(env.Inlines) != 0 {\n\t\t\t\t\t\t\tfor _, a := range env.Inlines {\n\t\t\t\t\t\t\t\te.Attachments = append(e.Attachments, Attachment{\n\t\t\t\t\t\t\t\t\tName: a.FileName,\n\t\t\t\t\t\t\t\t\tMimeType: a.ContentType,\n\t\t\t\t\t\t\t\t\tContent: a.Content,\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\n\t\t\t\t\t\tfor _, a := range []struct {\n\t\t\t\t\t\t\tdest *EmailAddresses\n\t\t\t\t\t\t\theader string\n\t\t\t\t\t\t}{\n\t\t\t\t\t\t\t{&e.From, \"From\"},\n\t\t\t\t\t\t\t{&e.ReplyTo, \"Reply-To\"},\n\t\t\t\t\t\t\t{&e.To, \"To\"},\n\t\t\t\t\t\t\t{&e.CC, \"cc\"},\n\t\t\t\t\t\t\t{&e.BCC, \"bcc\"},\n\t\t\t\t\t\t} {\n\t\t\t\t\t\t\talist, _ := env.AddressList(a.header)\n\t\t\t\t\t\t\t(*a.dest) = make(map[string]string, len(alist))\n\t\t\t\t\t\t\tfor _, addr := range alist {\n\t\t\t\t\t\t\t\t(*a.dest)[strings.ToLower(addr.Address)] = addr.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\t\tskip++\n\t\t\t\tcase \"UID\":\n\t\t\t\t\tif err = d.CheckType(tks[i+1], []TType{TNumber}, tks, \"after UID\"); err != nil {\n\t\t\t\t\t\treturn\n\t\t\t\t\t}\n\t\t\t\t\te.UID = tks[i+1].Num\n\t\t\t\t\tskip++\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif success {\n\t\t\t\temails[e.UID].Subject = e.Subject\n\t\t\t\temails[e.UID].From = e.From\n\t\t\t\temails[e.UID].ReplyTo = e.ReplyTo\n\t\t\t\temails[e.UID].To = e.To\n\t\t\t\temails[e.UID].CC = e.CC\n\t\t\t\temails[e.UID].BCC = e.BCC\n\t\t\t\temails[e.UID].Text = e.Text\n\t\t\t\temails[e.UID].HTML = e.HTML\n\t\t\t\temails[e.UID].Attachments = e.Attachments\n\t\t\t} else {\n\t\t\t\tdelete(emails, e.UID)\n\t\t\t}\n\t\t}\n\t\treturn\n\t}, RetryCount, func(err error) error {\n\t\tlog(d.ConnNum, d.Folder, aurora.Red(aurora.Bold(err)))\n\t\td.Close()\n\t\treturn nil\n\t}, func() error {\n\t\treturn d.Reconnect()\n\t})\n\n\treturn\n}", "title": "" }, { "docid": "30cd0bcc2a175ab43fb58d2bb73a4a24", "score": "0.5684687", "text": "func (o *MicrosoftGraphOrganization) GetTechnicalNotificationMailsOk() ([]string, bool) {\n\tif o == nil || o.TechnicalNotificationMails == nil {\n\t\tvar ret []string\n\t\treturn ret, false\n\t}\n\treturn *o.TechnicalNotificationMails, true\n}", "title": "" }, { "docid": "1c5036fe04378119c88fa484e5608458", "score": "0.5657318", "text": "func (r *AutoRoller) GetEmails() []string {\n\tr.emailsMtx.RLock()\n\tdefer r.emailsMtx.RUnlock()\n\trv := make([]string, len(r.emails))\n\tcopy(rv, r.emails)\n\treturn rv\n}", "title": "" }, { "docid": "1c5036fe04378119c88fa484e5608458", "score": "0.5657318", "text": "func (r *AutoRoller) GetEmails() []string {\n\tr.emailsMtx.RLock()\n\tdefer r.emailsMtx.RUnlock()\n\trv := make([]string, len(r.emails))\n\tcopy(rv, r.emails)\n\treturn rv\n}", "title": "" }, { "docid": "e559238282b03d9c34cf0c17b4c610d3", "score": "0.5640997", "text": "func (o *InlineResponse20039Person) GetEmailAddressOk() (*string, bool) {\n\tif o == nil || o.EmailAddress == nil {\n\t\treturn nil, false\n\t}\n\treturn o.EmailAddress, true\n}", "title": "" }, { "docid": "3435809bd322731de03c4ddc3eb66f5a", "score": "0.56086946", "text": "func (ds *DataService) GetEmails() ([]Email, error) {\n\t// Get any matching birthdays for our current date\n\tquery, sqlParam := ds.GetEmailQuery()\n\trows, err := ds.Db.Query(query, sqlParam)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tdefer rows.Close()\n\n\tsenderNickname := config.GetString(\"sender_nickname\")\n\temails := make([]Email, 0)\n\tfor rows.Next() {\n\t\tvar email Email\n\t\terr = rows.Scan(&email.FirstName, &email.LastName, &email.Nickname,\n\t\t\t&email.Email, &email.Phone, &email.Birthday, &email.Type)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\t// Set our sender nickname\n\t\temail.SenderNickname = senderNickname\n\t\temails = append(emails, email)\n\t}\n\n\treturn emails, nil\n}", "title": "" }, { "docid": "d6ee6359f2cfe058eb1e9eaf60a4769d", "score": "0.5602771", "text": "func (o *SubscriberCountByType) HasEmail() bool {\n\tif o != nil && o.Email != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "7aab250e94c6c21764a254de271bc216", "score": "0.55007535", "text": "func (o *CompaniesIdJsonCompany) GetEmailTwoOk() (*string, bool) {\n\tif o == nil || o.EmailTwo == nil {\n\t\treturn nil, false\n\t}\n\treturn o.EmailTwo, true\n}", "title": "" }, { "docid": "c810e32143d3d93e25b5421ba913b047", "score": "0.5377938", "text": "func (o *SubmitSelfServiceRecoveryFlowWithCodeMethodBody) HasEmail() bool {\n\tif o != nil && o.Email != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "952d86ce332c96ee6c4769ef4f81168e", "score": "0.5344042", "text": "func ListEmails( w http.ResponseWriter, r *http.Request ) {\r\n\t\tvars := mux.Vars( r )\r\n\t\tuser := vars[ \"user\" ]\r\n\t\tbox := inOrOut(vars[\"box\"])\t\t\r\n\t\tif email, ok := box[ user ]; ok {\r\n\t\t\tw.WriteHeader( http.StatusOK )\r\n\t\t\tif len(email) !=0{\r\n\t\t\t\tif enc, err := json.Marshal( email ); err == nil {\r\n\t\t\t\t\tw.Write( []byte( enc ) )\r\n\t\t\t\t}else {\r\n\t\t\t\t\tw.WriteHeader( http.StatusInternalServerError )\r\n\t\t\t\t}\r\n\t\t\t}else{\r\n\t\t\t\tfmt.Println(\"Nothing in \", vars[\"box\"], \" for user :\", user)\r\n\t\t\t}\r\n\t\t} else {\r\n\t\t\tw.WriteHeader( http.StatusNotFound )\r\n\t\t} \r\n\t}", "title": "" }, { "docid": "37eca013dac8e53365f1652f930bf722", "score": "0.53436404", "text": "func ListValidEmails(region string) ([]string, error) {\n\tregion = validateRegion(region)\n\tvar listValidEmails []string\n\t// Initialize a session in us-west-2 that the SDK will use to load\n\t// credentials from the shared credentials file ~/.aws/credentials.\n\tsess, err := session.NewSession(&aws.Config{\n\t\tRegion: aws.String(region)},\n\t)\n\n\t// Create SES service client\n\tsvc := ses.New(sess)\n\n\tresult, err := svc.ListIdentities(&ses.ListIdentitiesInput{IdentityType: aws.String(\"EmailAddress\")})\n\t// Sample Data in result\n\t// {\n\t// \tIdentities: [\n\t// \t \t \t\"akash_sisodiya@test.com\",\n\t// \t\t]\n\t// }\n\tif err != nil {\n\t\tfmt.Println(err)\n\t\treturn nil, err\n\t}\n\n\tfor _, email := range result.Identities {\n\t\t// Use *email to get its value\n\t\t// result.Identities is non-interface type []*string\n\t\tvar e = []*string{email}\n\n\t\tverified, err := svc.GetIdentityVerificationAttributes(&ses.GetIdentityVerificationAttributesInput{Identities: e})\n\t\t// Sample Data in verified\n\t\t// {\n\t\t// \tVerificationAttributes: {\n\t\t// \t akash_sisodiya@test.com: {\n\t\t// \t\tVerificationStatus: \"Success\"\n\t\t// \t }\n\t\t// \t }\n\t\t// }\n\t\tif err != nil {\n\t\t\tfmt.Println(err)\n\t\t\treturn nil, err\n\t\t}\n\n\t\tfor _, va := range verified.VerificationAttributes {\n\t\t\tif *va.VerificationStatus == \"Success\" {\n\t\t\t\t// fmt.Println(*email)\n\t\t\t\tlistValidEmails = append(listValidEmails, *email)\n\t\t\t}\n\t\t}\n\t}\n\treturn listValidEmails, nil\n}", "title": "" }, { "docid": "74960d388ab3e02dd9c280f3b9bad820", "score": "0.53355426", "text": "func (o *GCPSTSServiceAccountAttributes) GetClientEmailOk() (*string, bool) {\n\tif o == nil || o.ClientEmail == nil {\n\t\treturn nil, false\n\t}\n\treturn o.ClientEmail, true\n}", "title": "" }, { "docid": "05b5b5af5978b2b73fe7bee129b20a71", "score": "0.53270555", "text": "func (o *MicrosoftGraphOrganization) GetSecurityComplianceNotificationMailsOk() ([]string, bool) {\n\tif o == nil || o.SecurityComplianceNotificationMails == nil {\n\t\tvar ret []string\n\t\treturn ret, false\n\t}\n\treturn *o.SecurityComplianceNotificationMails, true\n}", "title": "" }, { "docid": "bb88ef5c846cd6932ba21ba35f8cfcbb", "score": "0.52823097", "text": "func (sg *SGClient) GetInvalidEmails() ([]Activity, error) {\n\treturn sg.getActivities(invalidEmailsAPI)\n}", "title": "" }, { "docid": "b4471cc958fb9b7ee7bcdf738fc4cd11", "score": "0.5264537", "text": "func (o *MicrosoftGraphMessageRulePredicates) GetIsVoicemailOk() (bool, bool) {\n\tif o == nil || o.IsVoicemail == nil {\n\t\tvar ret bool\n\t\treturn ret, false\n\t}\n\treturn *o.IsVoicemail, true\n}", "title": "" }, { "docid": "4f727b47558fb4135d2480e4f03661a9", "score": "0.52628857", "text": "func Emails(text string) []string {\n\treturn matchString(text, EmailRegex)\n}", "title": "" }, { "docid": "85c3ba4bc2b2f8f77afd0e5caee8d21e", "score": "0.52566653", "text": "func (o *EmailVerifyRequest) HasEmail() bool {\n\tif o != nil && o.Email != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "efa5ccd4e44e618497e1eefa991d71ca", "score": "0.5219032", "text": "func (o *InlineObject636) GetMailTipsOptionsOk() (AnyOfmicrosoftGraphMailTipsType, bool) {\n\tif o == nil || o.MailTipsOptions == nil {\n\t\tvar ret AnyOfmicrosoftGraphMailTipsType\n\t\treturn ret, false\n\t}\n\treturn *o.MailTipsOptions, true\n}", "title": "" }, { "docid": "e5f34df0acdc9fa1413819931054dd7d", "score": "0.5169138", "text": "func (o *InlineObject636) HasEmailAddresses() bool {\n\tif o != nil && o.EmailAddresses != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "2b8bab17efee843e5419954fb5990a47", "score": "0.51592976", "text": "func (o *GlobalSettings) GetGeoIpUpdatesOk() (*bool, bool) {\n\tif o == nil || o.GeoIpUpdates == nil {\n\t\treturn nil, false\n\t}\n\treturn o.GeoIpUpdates, true\n}", "title": "" }, { "docid": "c3b5141a5f6a014a53c469d91e10c6e3", "score": "0.5154399", "text": "func (o *MicrosoftGraphLocationConstraintItem) GetLocationEmailAddressOk() (string, bool) {\n\tif o == nil || o.LocationEmailAddress == nil {\n\t\tvar ret string\n\t\treturn ret, false\n\t}\n\treturn *o.LocationEmailAddress, true\n}", "title": "" }, { "docid": "8612869dd66fbec481d7442589240685", "score": "0.515044", "text": "func (u *UserEmails) HasValues() bool {\n\tif u == nil || u.Values == nil {\n\t\treturn false\n\t}\n\n\tif len(u.Values) == 0 {\n\t\treturn false\n\t}\n\treturn true\n}", "title": "" }, { "docid": "03e3744144e231b15f9d5b29c3ee22ab", "score": "0.5149976", "text": "func (o *PolicyEvalNotificationData) GetNotificationUserEmailOk() (*string, bool) {\n\tif o == nil || o.NotificationUserEmail == nil {\n\t\treturn nil, false\n\t}\n\treturn o.NotificationUserEmail, true\n}", "title": "" }, { "docid": "d1f6cacaa1472f25e9f85848c929cd50", "score": "0.5141825", "text": "func Emails(text string) []string {\n\treturn match(text, _regexp.EmailRegex)\n}", "title": "" }, { "docid": "6eaa6a77e7b9dffed8145a2752b0d764", "score": "0.51167417", "text": "func (o *MicrosoftGraphMessageRulePredicates) GetSentToAddressesOk() ([]AnyOfmicrosoftGraphRecipient, bool) {\n\tif o == nil || o.SentToAddresses == nil {\n\t\tvar ret []AnyOfmicrosoftGraphRecipient\n\t\treturn ret, false\n\t}\n\treturn *o.SentToAddresses, true\n}", "title": "" }, { "docid": "9a7391252c676fb8ff775431b7d48f7e", "score": "0.5112868", "text": "func (o *GlobalSettings) GetFipsOk() (*bool, bool) {\n\tif o == nil || o.Fips == nil {\n\t\treturn nil, false\n\t}\n\treturn o.Fips, true\n}", "title": "" }, { "docid": "e5a891613d58b5de32ec7ce3bcd0ca4e", "score": "0.51015353", "text": "func (o *GroupLifecyclePolicy) HasAlternateNotificationEmails() bool {\n\tif o != nil && o.AlternateNotificationEmails != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "d2a11c8a8c4976274fb46581e6887209", "score": "0.5085981", "text": "func (o *InlineObject636) GetEmailAddresses() []string {\n\tif o == nil || o.EmailAddresses == nil {\n\t\tvar ret []string\n\t\treturn ret\n\t}\n\treturn *o.EmailAddresses\n}", "title": "" }, { "docid": "bda25e47bae393cecbd7a19cdd02ced7", "score": "0.5072682", "text": "func (o *CompaniesIdJsonCompany) GetEmailThreeOk() (*string, bool) {\n\tif o == nil || o.EmailThree == nil {\n\t\treturn nil, false\n\t}\n\treturn o.EmailThree, true\n}", "title": "" }, { "docid": "8cc08ed020d74dadb48b7008c1c952ce", "score": "0.50640994", "text": "func GetAuthCheckEmailAvailability(email string) (AuthBool, error) {\n\tdata := new(AuthBool)\n\treq, reqErr := CreateRequest(\"GET\", os.Getenv(\"DOMAIN\")+\"/identity/v2/auth/email\", \"\")\n\tif reqErr != nil {\n\t\treturn *data, reqErr\n\t}\n\n\tq := req.URL.Query()\n\tq.Add(\"apikey\", os.Getenv(\"APIKEY\"))\n\tq.Add(\"email\", email)\n\treq.URL.RawQuery = q.Encode()\n\treq.Header.Add(\"content-Type\", \"application/x-www-form-urlencoded\")\n\n\terr := RunRequest(req, data)\n\treturn *data, err\n}", "title": "" }, { "docid": "f4a4da796ea53cc495d242659da2333b", "score": "0.5063569", "text": "func (o *MicrosoftGraphEventMessage) GetBccRecipientsOk() ([]AnyOfmicrosoftGraphRecipient, bool) {\n\tif o == nil || o.BccRecipients == nil {\n\t\tvar ret []AnyOfmicrosoftGraphRecipient\n\t\treturn ret, false\n\t}\n\treturn *o.BccRecipients, true\n}", "title": "" }, { "docid": "09660cd9c21684e90b9ea275e1ff02bb", "score": "0.5056543", "text": "func (m *UserMutation) Email() (r string, exists bool) {\n\tv := m.email\n\tif v == nil {\n\t\treturn\n\t}\n\treturn *v, true\n}", "title": "" }, { "docid": "09660cd9c21684e90b9ea275e1ff02bb", "score": "0.5056543", "text": "func (m *UserMutation) Email() (r string, exists bool) {\n\tv := m.email\n\tif v == nil {\n\t\treturn\n\t}\n\treturn *v, true\n}", "title": "" }, { "docid": "09660cd9c21684e90b9ea275e1ff02bb", "score": "0.5056543", "text": "func (m *UserMutation) Email() (r string, exists bool) {\n\tv := m.email\n\tif v == nil {\n\t\treturn\n\t}\n\treturn *v, true\n}", "title": "" }, { "docid": "09660cd9c21684e90b9ea275e1ff02bb", "score": "0.5056543", "text": "func (m *UserMutation) Email() (r string, exists bool) {\n\tv := m.email\n\tif v == nil {\n\t\treturn\n\t}\n\treturn *v, true\n}", "title": "" }, { "docid": "09660cd9c21684e90b9ea275e1ff02bb", "score": "0.5056543", "text": "func (m *UserMutation) Email() (r string, exists bool) {\n\tv := m.email\n\tif v == nil {\n\t\treturn\n\t}\n\treturn *v, true\n}", "title": "" }, { "docid": "bdbeb12f4f9fc8ed829a379382a04970", "score": "0.503973", "text": "func (o *SignalEvaluateCoreAttributes) GetEmailChangeCount90dOk() (*int32, bool) {\n\tif o == nil {\n\t\treturn nil, false\n\t}\n\treturn o.EmailChangeCount90d.Get(), o.EmailChangeCount90d.IsSet()\n}", "title": "" }, { "docid": "cdd438e3362e030c3d38091265328766", "score": "0.5035194", "text": "func (m *PasswordMutation) Email() (r string, exists bool) {\n\tv := m.email\n\tif v == nil {\n\t\treturn\n\t}\n\treturn *v, true\n}", "title": "" }, { "docid": "e0a87986eb5fba497dd7a1e148a0de9c", "score": "0.5034149", "text": "func (entity *MessageEntity) IsEmail() bool {\n\treturn entity != nil && entity.Type == EntityEmail\n}", "title": "" }, { "docid": "cdc8f92e0f8f3016c0a2840f91250265", "score": "0.50306463", "text": "func (o *PageAccessUser) HasEmail() bool {\n\tif o != nil && o.Email != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "a86b01dbc5b846bff398744ffae1d483", "score": "0.5026347", "text": "func (o *ConsumerReportUserIdentity) SetEmails(v []string) {\n\to.Emails = v\n}", "title": "" }, { "docid": "bc765ddafc35ccb6b526aa90d1107120", "score": "0.5014992", "text": "func LoadUserEmails(m MetaContext) (emails []keybase1.Email, err error) {\n\tuid := m.G().GetMyUID()\n\tres, err := m.G().API.Get(m, APIArg{\n\t\tEndpoint: \"user/private\",\n\t\tSessionType: APISessionTypeREQUIRED,\n\t\tArgs: HTTPArgs{\n\t\t\t\"uid\": UIDArg(uid),\n\t\t},\n\t})\n\tif err != nil {\n\t\treturn\n\t}\n\n\temailPayloads, err := jsonhelpers.JSONGetChildren(res.Body.AtKey(\"them\").AtKey(\"emails\").AtKey(\"emails\"))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tfor _, emailPayload := range emailPayloads {\n\t\temail, err := emailPayload.AtKey(\"email\").GetString()\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tisPrimary, err := emailPayload.AtKey(\"is_primary\").GetInt()\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tisVerified, err := emailPayload.AtKey(\"is_verified\").GetInt()\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tvisibilityCode, err := emailPayload.AtKey(\"visibility\").GetInt()\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\n\t\tvar lastVerifyEmailDate int64\n\t\tlastVerifyEmailDateNode := emailPayload.AtKey(\"last_verify_email_date\")\n\t\tif lastVerifyEmailDateNode.IsOk() && !lastVerifyEmailDateNode.IsNil() {\n\t\t\tlastVerifyEmailDate, err = lastVerifyEmailDateNode.GetInt64()\n\t\t\tif err != nil {\n\t\t\t\treturn nil, err\n\t\t\t}\n\t\t}\n\n\t\temails = append(emails, keybase1.Email{\n\t\t\tEmail: keybase1.EmailAddress(email),\n\t\t\tIsVerified: isVerified == 1,\n\t\t\tIsPrimary: isPrimary == 1,\n\t\t\tVisibility: keybase1.IdentityVisibility(visibilityCode),\n\t\t\tLastVerifyEmailDate: keybase1.UnixTime(lastVerifyEmailDate),\n\t\t})\n\t}\n\n\treturn\n}", "title": "" }, { "docid": "2ab327161f45a322e22cc3e4e2cd51c4", "score": "0.5014205", "text": "func (o *CompaniesIdJsonCompany) GetEmailOneOk() (*string, bool) {\n\tif o == nil || o.EmailOne == nil {\n\t\treturn nil, false\n\t}\n\treturn o.EmailOne, true\n}", "title": "" }, { "docid": "075c61ecadea49f9e25a24bbc902d387", "score": "0.499692", "text": "func (o *MicrosoftGraphEventMessage) GetToRecipientsOk() ([]AnyOfmicrosoftGraphRecipient, bool) {\n\tif o == nil || o.ToRecipients == nil {\n\t\tvar ret []AnyOfmicrosoftGraphRecipient\n\t\treturn ret, false\n\t}\n\treturn *o.ToRecipients, true\n}", "title": "" }, { "docid": "941764eda306adc21f29403992c743b4", "score": "0.499313", "text": "func (o *ApplianceAllOfMetricsAggregator) GetSitesOk() ([]string, bool) {\n\tif o == nil || o.Sites == nil {\n\t\treturn nil, false\n\t}\n\treturn o.Sites, true\n}", "title": "" }, { "docid": "9a1c6fedc4756267a3a7ea0dee2013f1", "score": "0.49833056", "text": "func IsEmail(v string) bool {\n\treturn isEmailRegexp.MatchString(v)\n}", "title": "" }, { "docid": "7491977c87ec4c9e979bfa92f7c0cf2f", "score": "0.49797955", "text": "func (m *StudentMutation) Email() (r string, exists bool) {\n\tv := m.email\n\tif v == nil {\n\t\treturn\n\t}\n\treturn *v, true\n}", "title": "" }, { "docid": "ec067a325ce2468ba87c405307b3eb7b", "score": "0.4979521", "text": "func EmailMatches(value string, rx *regexp.Regexp) bool {\n\treturn rx.MatchString(value)\n}", "title": "" }, { "docid": "c8840e676da7fc7bed6dc7a27795c2db", "score": "0.49787316", "text": "func (o *IamUserSettingAllOf) GetUserIdOrEmailOk() (*string, bool) {\n\tif o == nil || o.UserIdOrEmail == nil {\n\t\treturn nil, false\n\t}\n\treturn o.UserIdOrEmail, true\n}", "title": "" }, { "docid": "6f0d26a7d79188538d39e91ae7e6e019", "score": "0.49787283", "text": "func (o *CompaniesIdJsonCompany) HasEmailTwo() bool {\n\tif o != nil && o.EmailTwo != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "2470936f278059f8f744e31fdfb4bb05", "score": "0.4978587", "text": "func (o *MicrosoftGraphSharingInvitation) HasEmail() bool {\n\tif o != nil && o.Email != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "2173297f462461153b6f02012d97587d", "score": "0.4977325", "text": "func (o *InlineResponse200118) GetEventsOk() (*[]InlineResponse2002People12345Company, bool) {\n\tif o == nil || o.Events == nil {\n\t\treturn nil, false\n\t}\n\treturn o.Events, true\n}", "title": "" }, { "docid": "b4716ebf3a9458ea0e965686883e7662", "score": "0.4970484", "text": "func (o GetTemplatesResultOutput) EmailTemplates() GetTemplatesEmailTemplateArrayOutput {\n\treturn o.ApplyT(func(v GetTemplatesResult) []GetTemplatesEmailTemplate { return v.EmailTemplates }).(GetTemplatesEmailTemplateArrayOutput)\n}", "title": "" }, { "docid": "8bd77bf1f4ab2d64b99d9f1e8a3d46ed", "score": "0.49590513", "text": "func (o *SignalEvaluateCoreAttributes) GetEmailChangeCount28dOk() (*int32, bool) {\n\tif o == nil {\n\t\treturn nil, false\n\t}\n\treturn o.EmailChangeCount28d.Get(), o.EmailChangeCount28d.IsSet()\n}", "title": "" }, { "docid": "25ca83053d49c385cbec2d759ec286e6", "score": "0.49464178", "text": "func (o *Alerts) GetAlertsOk() (*[]Alert, bool) {\n\tif o == nil || o.Alerts == nil {\n\t\treturn nil, false\n\t}\n\treturn o.Alerts, true\n}", "title": "" }, { "docid": "01d3caabbf3e95c6a87ac3eef9c6974a", "score": "0.49346957", "text": "func (a *App) getEmailRecipients(ctx context.Context, roles, suggestedReviewers []string) []string {\n\tlog := logger.Get(ctx)\n\tvalidEmailRecipients := []string{}\n\n\trecipients := a.conf.RoleToRecipients.GetRawRecipientsFor(roles, suggestedReviewers)\n\n\tfor _, recipient := range recipients {\n\t\tif !lib.IsEmail(recipient) {\n\t\t\tlog.Warningf(\"Failed to notify a reviewer: %q does not look like a valid email\", recipient)\n\t\t\tcontinue\n\t\t}\n\n\t\tvalidEmailRecipients = append(validEmailRecipients, recipient)\n\t}\n\n\treturn validEmailRecipients\n}", "title": "" }, { "docid": "1e08feb830f440cb5e8d0644888eeb2a", "score": "0.49330372", "text": "func (m *ProfessorMutation) Email() (r string, exists bool) {\n\tv := m.email\n\tif v == nil {\n\t\treturn\n\t}\n\treturn *v, true\n}", "title": "" }, { "docid": "0122bd27f2d7905f5ba7bf3bac4ddb8b", "score": "0.49232447", "text": "func (m *PharmacistMutation) Email() (r string, exists bool) {\n\tv := m.email\n\tif v == nil {\n\t\treturn\n\t}\n\treturn *v, true\n}", "title": "" }, { "docid": "2fa8983b74c19e68b9c37101dfe52528", "score": "0.49158362", "text": "func (o *User) HasEmail() bool {\n\tif o != nil && o.Email != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "2fa8983b74c19e68b9c37101dfe52528", "score": "0.49158362", "text": "func (o *User) HasEmail() bool {\n\tif o != nil && o.Email != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "16b3e43b027e26278b72e5f2a96b62e6", "score": "0.49157593", "text": "func (m *RefreshTokenMutation) ClaimsEmail() (r string, exists bool) {\n\tv := m.claims_email\n\tif v == nil {\n\t\treturn\n\t}\n\treturn *v, true\n}", "title": "" }, { "docid": "ecda2bb1b669aed736d8562190ed0bb0", "score": "0.4907812", "text": "func (o *DeviceManagement) GetDetectedAppsOk() ([]MicrosoftGraphDetectedApp, bool) {\n\tif o == nil || o.DetectedApps == nil {\n\t\tvar ret []MicrosoftGraphDetectedApp\n\t\treturn ret, false\n\t}\n\treturn *o.DetectedApps, true\n}", "title": "" }, { "docid": "5cca12520af830f9544b8f51c767446e", "score": "0.49050203", "text": "func (o *ConsumerReportUserIdentity) GetPhoneNumbersOk() (*[]string, bool) {\n\tif o == nil {\n\t\treturn nil, false\n\t}\n\treturn &o.PhoneNumbers, true\n}", "title": "" }, { "docid": "12a5c059694d09ec1c24e4d66fbaaf14", "score": "0.48906717", "text": "func (o *CalendareventsIdJsonEvent) GetRemindersOk() (*[]CalendareventsIdJsonEventReminders, bool) {\n\tif o == nil || o.Reminders == nil {\n\t\treturn nil, false\n\t}\n\treturn o.Reminders, true\n}", "title": "" }, { "docid": "e20dd1fcf2db35006e2b4172e5ee7add", "score": "0.48905304", "text": "func NewGetEmailCampaignsOK() *GetEmailCampaignsOK {\n\treturn &GetEmailCampaignsOK{}\n}", "title": "" }, { "docid": "e4a15edae9b505867f168c2d5ac6e526", "score": "0.48880553", "text": "func ExtractEmails(s string) ([]string, error) {\n\temails := regexEmail.FindAllString(s, -1)\n\tif emails == nil {\n\t\treturn []string{}, ErrNotFound\n\t}\n\treturn emails, nil\n}", "title": "" }, { "docid": "4a4f0e3dd76d5ea44dcc522592f4e887", "score": "0.4886381", "text": "func loadEmails() map[string]bool {\n\tmapOemailToReturn := make(map[string]bool) //Email to load our values into\n\t//Call our crudOperations Microservice in order to get our Emails\n\t//Create a context for timing out\n\treq, err := http.Get(GETUSEREMAILS)\n\tif err != nil {\n\t\ttheErr := \"There was an error getting Emails in loadEmails: \" + err.Error()\n\t\tlogWriter(theErr)\n\t\tfmt.Println(theErr)\n\t}\n\n\tif req.StatusCode >= 300 || req.StatusCode <= 199 {\n\t\ttheErr := \"There was an error reaching out to get Email API: \" + strconv.Itoa(req.StatusCode)\n\t\tfmt.Println(theErr)\n\t\tlogWriter(theErr)\n\t} else if err != nil {\n\t\ttheErr := \"Error from response to loadEmails: \" + err.Error()\n\t\tfmt.Println(theErr)\n\t\tlogWriter(theErr)\n\t}\n\tdefer req.Body.Close()\n\n\tbody, err := ioutil.ReadAll(req.Body)\n\tif err != nil {\n\t\ttheErr := \"There was an error getting a response for Emails in loadEmails: \" + err.Error()\n\t\tlogWriter(theErr)\n\t\tfmt.Println(theErr)\n\t}\n\n\t//Marshal the response into a type we can read\n\ttype ReturnMessage struct {\n\t\tTheErr []string `json:\"TheErr\"`\n\t\tResultMsg []string `json:\"ResultMsg\"`\n\t\tSuccOrFail int `json:\"SuccOrFail\"`\n\t\tReturnedEmailMap map[string]bool `json:\"ReturnedEmailMap\"`\n\t}\n\tvar returnedMessage ReturnMessage\n\tjson.Unmarshal(body, &returnedMessage)\n\n\t//Assign our map variable to the map varialbe and see if it's okay\n\tif returnedMessage.SuccOrFail != 0 {\n\t\terrString := \"\"\n\t\tfor l := 0; l < len(returnedMessage.TheErr); l++ {\n\t\t\terrString = errString + returnedMessage.TheErr[l]\n\t\t}\n\t\tlogWriter(errString)\n\t\tfmt.Println(errString)\n\t} else {\n\t\tmapOemailToReturn = returnedMessage.ReturnedEmailMap\n\t}\n\n\treturn mapOemailToReturn\n}", "title": "" }, { "docid": "1ff05229bd1789db098ab0f117cbd8a1", "score": "0.48840904", "text": "func (o *StorageNetAppIpInterfaceAllOf) GetEventsOk() ([]StorageNetAppIpInterfaceEventRelationship, bool) {\n\tif o == nil || o.Events == nil {\n\t\treturn nil, false\n\t}\n\treturn o.Events, true\n}", "title": "" }, { "docid": "425f5f804091febd4032b27f888a7170", "score": "0.4883564", "text": "func (o *NullableClass) GetArrayAndItemsNullablePropOk() ([]map[string]interface{}, bool) {\n\tif o == nil || o.ArrayAndItemsNullableProp == nil {\n\t\tvar ret []map[string]interface{}\n\t\treturn ret, false\n\t}\n\treturn *o.ArrayAndItemsNullableProp, true\n}", "title": "" }, { "docid": "425f5f804091febd4032b27f888a7170", "score": "0.4883564", "text": "func (o *NullableClass) GetArrayAndItemsNullablePropOk() ([]map[string]interface{}, bool) {\n\tif o == nil || o.ArrayAndItemsNullableProp == nil {\n\t\tvar ret []map[string]interface{}\n\t\treturn ret, false\n\t}\n\treturn *o.ArrayAndItemsNullableProp, true\n}", "title": "" }, { "docid": "8edb6610e771f48081ca01b40d9857ba", "score": "0.48808476", "text": "func (s *Service) GetUserApproverEmails(user string) ([]string, error) {\n\tif user == \"\" {\n\t\treturn nil, ErrEmptyUserEmailParam\n\t}\n\n\tapproverEmails, err := s.client.GetManagerEmails(user)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tif len(approverEmails) == 0 {\n\t\treturn nil, ErrEmptyApprovers\n\t}\n\n\treturn approverEmails, nil\n}", "title": "" }, { "docid": "b4062cf2802ad3dca27c94fe41458af4", "score": "0.4879487", "text": "func (m *AuthCodeMutation) ClaimsEmail() (r string, exists bool) {\n\tv := m.claims_email\n\tif v == nil {\n\t\treturn\n\t}\n\treturn *v, true\n}", "title": "" }, { "docid": "3d293a3db91766e61db8c1963688dca0", "score": "0.48752564", "text": "func (m *AuthRequestMutation) ClaimsEmail() (r string, exists bool) {\n\tv := m.claims_email\n\tif v == nil {\n\t\treturn\n\t}\n\treturn *v, true\n}", "title": "" }, { "docid": "62bfb6b56bda558a5d51291fee06d28e", "score": "0.4865451", "text": "func (o *WebhookCreate) GetFetchTagsOk() (*bool, bool) {\n\tif o == nil || o.FetchTags == nil {\n\t\treturn nil, false\n\t}\n\treturn o.FetchTags, true\n}", "title": "" }, { "docid": "abea3ed1c0cdd6e9ea3cbdd0d5a9c79e", "score": "0.48502165", "text": "func (o *Webhooks) GetWebhooksOk() (*[]Webhook, bool) {\n\tif o == nil || o.Webhooks == nil {\n\t\treturn nil, false\n\t}\n\treturn o.Webhooks, true\n}", "title": "" }, { "docid": "399356a63f7eea29b198ab1e672c9dcb", "score": "0.48467803", "text": "func (o *InlineResponse200114) GetMessagesOk() (*[]map[string]interface{}, bool) {\n\tif o == nil || o.Messages == nil {\n\t\treturn nil, false\n\t}\n\treturn o.Messages, true\n}", "title": "" } ]
82b17266179ac6be05c9e072e49a5eb1
HasVendor returns a boolean if a field has been set.
[ { "docid": "dd97e4c54f05836ba2238813913571e8", "score": "0.82069296", "text": "func (o *Wireless) HasVendor() bool {\n\tif o != nil && o.Vendor != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" } ]
[ { "docid": "6b4a2e844564058b12d7cb2448609d01", "score": "0.8141895", "text": "func (o *AdminInfo) HasVendor() bool {\n\tif o != nil && o.Vendor != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "f3f8705028f50441a7cb288cca8443da", "score": "0.7927531", "text": "func (o *NetworkLicenseFile) HasVendor() bool {\n\tif o != nil && o.Vendor != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "41663e58faa7a47998a8e4a35aaac1ad", "score": "0.77961934", "text": "func (o *EquipmentIdentityAllOf) HasVendor() bool {\n\tif o != nil && o.Vendor != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "2a45f485d67abb426c0c371275461c7c", "score": "0.75907296", "text": "func (o *NetworkElementSummaryAllOf) HasVendor() bool {\n\tif o != nil && o.Vendor != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "892e762e55549f7b6408fd11f1f95d07", "score": "0.72819155", "text": "func (c *Module) HasVendorVariant() bool {\n\treturn c.IsVndk() || Bool(c.VendorProperties.Vendor_available)\n}", "title": "" }, { "docid": "2a29cf193a516cdeb7be5905a72a2a1c", "score": "0.7043841", "text": "func (o *SecureScore) HasVendorInformation() bool {\n\tif o != nil && o.VendorInformation != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "c6feafac3d97a9530710dd2c4211cab5", "score": "0.68947494", "text": "func VendorExists(ctx context.Context, exec boil.ContextExecutor, iD int) (bool, error) {\n\tvar exists bool\n\tsql := \"select exists(select 1 from `vendors` where `id`=? limit 1)\"\n\n\tif boil.DebugMode {\n\t\tfmt.Fprintln(boil.DebugWriter, sql)\n\t\tfmt.Fprintln(boil.DebugWriter, iD)\n\t}\n\n\trow := exec.QueryRowContext(ctx, sql, iD)\n\n\terr := row.Scan(&exists)\n\tif err != nil {\n\t\treturn false, errors.Wrap(err, \"models: unable to check if vendors exists\")\n\t}\n\n\treturn exists, nil\n}", "title": "" }, { "docid": "c0fa85c9694bdc6d584be42b5c363277", "score": "0.6858872", "text": "func (o *IaasDeviceStatusAllOf) HasDeviceVendor() bool {\n\tif o != nil && o.DeviceVendor != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "c8a603fc9c1158c92572a7f3ea089978", "score": "0.6664004", "text": "func (o *VirtualizationBaseHostPciDeviceAllOf) HasVendorId() bool {\n\tif o != nil && o.VendorId != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "de596ae54348f31b2f84417c2e1afbeb", "score": "0.6592126", "text": "func (m *MediaType) IsVendor() bool {\n\treturn len(m.Vendor) > 0\n}", "title": "" }, { "docid": "b67b882eedd16a9c4e286b3b2e405d6f", "score": "0.6543187", "text": "func IsVendor(path string) bool {\n\treturn enry.IsVendor(path)\n}", "title": "" }, { "docid": "6465e5aae71078fb21f1eb5b898b2530", "score": "0.65384525", "text": "func (o *InfraBasePciConfigurationAllOf) HasVendorId() bool {\n\tif o != nil && o.VendorId != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "aaf91f9d841a2b637f797369c1ce201e", "score": "0.6476438", "text": "func (o *VirtualizationBaseHostPciDeviceAllOf) HasVendorName() bool {\n\tif o != nil && o.VendorName != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "6c257d2495ebd42339b1528c12e67c2f", "score": "0.6412579", "text": "func (d UserData) HasCommercialPartner() bool {\n\treturn d.ModelData.Has(models.NewFieldName(\"CommercialPartner\", \"commercial_partner_id\"))\n}", "title": "" }, { "docid": "d93238efa877c142c8085f7acbef9df5", "score": "0.6329439", "text": "func (o *Wireless) GetVendorOk() (string, bool) {\n\tif o == nil || o.Vendor == nil {\n\t\tvar ret string\n\t\treturn ret, false\n\t}\n\treturn *o.Vendor, true\n}", "title": "" }, { "docid": "dc15bf1dc761ed5b0a9221a90285b39b", "score": "0.62852544", "text": "func (o *Invoice) HasBuyer() bool {\n\tif o != nil && o.Buyer != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "efa144f48797eeb7c737e1b93345f70e", "score": "0.6200168", "text": "func (o *Invoice) HasSeller() bool {\n\tif o != nil && o.Seller != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "9f76efb6f78c7a31834dda0f7b7cbf1a", "score": "0.61945856", "text": "func (a Annotations) Vendor() (string, bool) {\n\treturn a.Get(VendorAnnotation)\n}", "title": "" }, { "docid": "99a19bace18573b594977fc1f64d7bda", "score": "0.6176622", "text": "func (c *Module) inVendor() bool {\n\treturn c.Properties.ImageVariationPrefix == VendorVariationPrefix\n}", "title": "" }, { "docid": "f04866bd4521a7d443fe1ff57128e989", "score": "0.610651", "text": "func (d UserData) HasPartner() bool {\n\treturn d.ModelData.Has(models.NewFieldName(\"Partner\", \"partner_id\"))\n}", "title": "" }, { "docid": "8e551b7a85f25a960968c7971b87d83e", "score": "0.60156393", "text": "func (o *AdminInfo) GetVendorOk() (*Vendor, bool) {\n\tif o == nil || o.Vendor == nil {\n\t\treturn nil, false\n\t}\n\treturn o.Vendor, true\n}", "title": "" }, { "docid": "e244b4cbcb1f2577ae64fa9e7b40ba2e", "score": "0.59917325", "text": "func (o *IosVppEBook) HasSeller() bool {\n\tif o != nil && o.Seller != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "0098ed99008eacdf01efc82e416b3228", "score": "0.5983846", "text": "func (o *Service) HasMacVendors() bool {\n\tif o != nil && o.MacVendors != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "568ea3298c8ff01d603dc5ed8e41b698", "score": "0.59628016", "text": "func (c *Configuration) Has(field string) bool {\n\tout := getField(c.App, field)\n\tif out == nil {\n\t\tout = getField(c.Base, field)\n\t}\n\n\treturn out != nil\n}", "title": "" }, { "docid": "b1ba1b81672a07bdff49ff9d8d2ea59b", "score": "0.5955873", "text": "func (o *NetworkLicenseFile) GetVendorOk() (*string, bool) {\n\tif o == nil || o.Vendor == nil {\n\t\treturn nil, false\n\t}\n\treturn o.Vendor, true\n}", "title": "" }, { "docid": "128c66de07e7657c778856c7699043b1", "score": "0.59494853", "text": "func (o *AdminInfo) HasSupportVendorIds() bool {\n\tif o != nil && o.SupportVendorIds != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "13afbed211eed5135b82fa91a55899f9", "score": "0.5912123", "text": "func (d UserData) HasIndustry() bool {\n\treturn d.ModelData.Has(models.NewFieldName(\"Industry\", \"industry_id\"))\n}", "title": "" }, { "docid": "7874eadd2a80d1448984843a75ee6a49", "score": "0.5880656", "text": "func (d UserData) HasVAT() bool {\n\treturn d.ModelData.Has(models.NewFieldName(\"VAT\", \"vat\"))\n}", "title": "" }, { "docid": "9ce67378a4e6de371d7ad2aa2f90b42a", "score": "0.58423316", "text": "func (o *EquipmentIdentityAllOf) GetVendorOk() (*string, bool) {\n\tif o == nil || o.Vendor == nil {\n\t\treturn nil, false\n\t}\n\treturn o.Vendor, true\n}", "title": "" }, { "docid": "bfbc96694ed48400cb2aee5838ccba86", "score": "0.58421576", "text": "func (o *Service) HasNewestMacVendor() bool {\n\tif o != nil && o.NewestMacVendor != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "8da387b4efc145f7088180de904532e9", "score": "0.58264786", "text": "func (d UserData) HasCommercialCompanyName() bool {\n\treturn d.ModelData.Has(models.NewFieldName(\"CommercialCompanyName\", \"commercial_company_name\"))\n}", "title": "" }, { "docid": "8251bfa1b25e9def66c176c2b199b8d2", "score": "0.57885844", "text": "func (o *StorageNetAppHighAvailability) HasPartnerUuid() bool {\n\tif o != nil && o.PartnerUuid != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "df156be221fa701c7c98698de27ff06a", "score": "0.5778331", "text": "func (o *VirtualizationBaseHostPciDeviceAllOf) HasSubVendorId() bool {\n\tif o != nil && o.SubVendorId != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "a040de4c75cff517f47098450d09a9df", "score": "0.57580054", "text": "func (o *CartaoProduto) HasUsr() bool {\n\tif o != nil && o.Usr.IsSet() {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "ed1ba7a7e08ffbd4b631720d8102bdc0", "score": "0.5748729", "text": "func (d UserData) HasActivePartner() bool {\n\treturn d.ModelData.Has(models.NewFieldName(\"ActivePartner\", \"active_partner\"))\n}", "title": "" }, { "docid": "494707d7b31c9e428966a17ad4efc9a6", "score": "0.57330835", "text": "func (o *NetworkElementSummaryAllOf) GetVendorOk() (*string, bool) {\n\tif o == nil || o.Vendor == nil {\n\t\treturn nil, false\n\t}\n\treturn o.Vendor, true\n}", "title": "" }, { "docid": "9bf92951d18d6f1e8f9c897d926049b8", "score": "0.5694571", "text": "func (q vendorQuery) Exists(ctx context.Context, exec boil.ContextExecutor) (bool, error) {\n\tvar count int64\n\n\tqueries.SetSelect(q.Query, nil)\n\tqueries.SetCount(q.Query)\n\tqueries.SetLimit(q.Query, 1)\n\n\terr := q.Query.QueryRowContext(ctx, exec).Scan(&count)\n\tif err != nil {\n\t\treturn false, errors.Wrap(err, \"models: failed to check if vendors exists\")\n\t}\n\n\treturn count > 0, nil\n}", "title": "" }, { "docid": "a924f115aed80edcf968ae59c5b6dd52", "score": "0.56771046", "text": "func (d UserData) HasCountry() bool {\n\treturn d.ModelData.Has(models.NewFieldName(\"Country\", \"country_id\"))\n}", "title": "" }, { "docid": "59458d39b1df27047f2b7c602052c477", "score": "0.5668004", "text": "func (o *Wireless) GetVendor() string {\n\tif o == nil || o.Vendor == nil {\n\t\tvar ret string\n\t\treturn ret\n\t}\n\treturn *o.Vendor\n}", "title": "" }, { "docid": "3497e51350e83bac643230c392fa153e", "score": "0.5658993", "text": "func (o *EquipmentFanModule) HasSku() bool {\n\tif o != nil && o.Sku != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "8e565d4157b21564440369caae1843c9", "score": "0.5655856", "text": "func (o *EquipmentIoCardBase) HasSku() bool {\n\tif o != nil && o.Sku != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "b18c292f24e4d2c315e0a533ed317f02", "score": "0.5654019", "text": "func (d UserData) HasBarcode() bool {\n\treturn d.ModelData.Has(models.NewFieldName(\"Barcode\", \"barcode\"))\n}", "title": "" }, { "docid": "e69716f440f3f0e2514549f30c6ac0b6", "score": "0.56294817", "text": "func (config *Config) IsVendorAllowed(vendorName string) bool {\n\t// vendor whitelist is empty, allow everything\n\tif len(config.VendorWhitelist) == 0 {\n\t\treturn true\n\t}\n\n\t// vendor whitelist is enabled, only allow specified vendors\n\tfor _, name := range config.VendorWhitelist {\n\t\tif name == vendorName {\n\t\t\treturn true\n\t\t}\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "e2877d7214bc6d1d7d4e864df98982e1", "score": "0.5612573", "text": "func (d UserData) HasPartnerShare() bool {\n\treturn d.ModelData.Has(models.NewFieldName(\"PartnerShare\", \"partner_share\"))\n}", "title": "" }, { "docid": "b3082fbece95ac6835568b598a87adea", "score": "0.5544759", "text": "func (o *ReservationModel) HasCompany() bool {\n\tif o != nil && o.Company != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "0fa340f84e2d9c4336046014e6fbcb1b", "score": "0.5542052", "text": "func (x *fastReflection_Supply) Has(fd protoreflect.FieldDescriptor) bool {\n\tswitch fd.FullName() {\n\tcase \"cosmos.bank.v1beta1.Supply.total\":\n\t\treturn len(x.Total) != 0\n\tdefault:\n\t\tif fd.IsExtension() {\n\t\t\tpanic(fmt.Errorf(\"proto3 declared messages do not support extensions: cosmos.bank.v1beta1.Supply\"))\n\t\t}\n\t\tpanic(fmt.Errorf(\"message cosmos.bank.v1beta1.Supply does not contain field %s\", fd.FullName()))\n\t}\n}", "title": "" }, { "docid": "10a5eca53e07ccd6e433294090a6ac2f", "score": "0.5535231", "text": "func (o *User) HasLicenseDetails() bool {\n\tif o != nil && o.LicenseDetails != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "6acedd203d93009ea1c24dd0c61ed112", "score": "0.5521692", "text": "func (d UserData) HasCompany() bool {\n\treturn d.ModelData.Has(models.NewFieldName(\"Company\", \"company_id\"))\n}", "title": "" }, { "docid": "fdd7a07b64450fe09d9fed6b892354f0", "score": "0.5504182", "text": "func (o *Wireless) SetVendor(v string) {\n\to.Vendor = &v\n}", "title": "" }, { "docid": "a04cef9b6332a4828b2df7b7e9ba6bae", "score": "0.5493609", "text": "func (x *fastReflection_SendEnabled) Has(fd protoreflect.FieldDescriptor) bool {\n\tswitch fd.FullName() {\n\tcase \"cosmos.bank.v1beta1.SendEnabled.denom\":\n\t\treturn x.Denom != \"\"\n\tcase \"cosmos.bank.v1beta1.SendEnabled.enabled\":\n\t\treturn x.Enabled != false\n\tdefault:\n\t\tif fd.IsExtension() {\n\t\t\tpanic(fmt.Errorf(\"proto3 declared messages do not support extensions: cosmos.bank.v1beta1.SendEnabled\"))\n\t\t}\n\t\tpanic(fmt.Errorf(\"message cosmos.bank.v1beta1.SendEnabled does not contain field %s\", fd.FullName()))\n\t}\n}", "title": "" }, { "docid": "336a52fa7ffbbde689018727bc37c8d0", "score": "0.54885894", "text": "func (o *SoftwareTechs) HasVersion() bool {\n\tif o != nil && o.Version != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "0921bad039ececad6152d1fb5ec47208", "score": "0.5481736", "text": "func (o *CapabilitySiocModuleManufacturingDef) HasSku() bool {\n\tif o != nil && o.Sku != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "a0b0c18c5068a31ee4b2771667deefd9", "score": "0.5480606", "text": "func (o *NetworkLicenseFile) SetVendor(v string) {\n\to.Vendor = &v\n}", "title": "" }, { "docid": "f09e4265fa0bcd80d254e7e54a2d7f97", "score": "0.5458119", "text": "func isVendorPackage(pkg *types.Package) bool {\n\tvendorPattern := string(os.PathSeparator) + \"vendor\" + string(os.PathSeparator)\n\treturn strings.Contains(pkg.SourcePath, vendorPattern)\n}", "title": "" }, { "docid": "9f657c7978a767fbd87b43ef9dd893c8", "score": "0.5449383", "text": "func (o *StorageNetAppHighAvailability) HasPartnerModel() bool {\n\tif o != nil && o.PartnerModel != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "6ddf657fd093251ab15a067c10c19ba0", "score": "0.5436117", "text": "func (x ApmDatabaseInstanceEntity) GetVendor() string {\n\treturn x.Vendor\n}", "title": "" }, { "docid": "d7cc06b8e95e55983e91daba7f68e2f2", "score": "0.5407316", "text": "func (o *VulnerabilitiesRequest) HasReleasever() bool {\n\tif o != nil && o.Releasever != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "3e1269f678c2e1bfd7cde4d6e1073a86", "score": "0.5405449", "text": "func (o *Drive) GetVendor(ctx context.Context) (vendor string, err error) {\n\terr = o.object.CallWithContext(ctx, \"org.freedesktop.DBus.Properties.Get\", 0, InterfaceDrive, \"Vendor\").Store(&vendor)\n\treturn\n}", "title": "" }, { "docid": "b65d03be93ee72abf0bac168b8d89b08", "score": "0.53935754", "text": "func (o *Invoice) HasCompany() bool {\n\tif o != nil && o.Company != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "073cddfadb19024c0628d5a0dddc5cca", "score": "0.53850824", "text": "func (o *IosVppEBook) HasUsedLicenseCount() bool {\n\tif o != nil && o.UsedLicenseCount != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "0c765b7b6a70779d72c48fd1f96ccbd8", "score": "0.53844404", "text": "func (o *IaasDeviceStatusAllOf) GetDeviceVendorOk() (*string, bool) {\n\tif o == nil || o.DeviceVendor == nil {\n\t\treturn nil, false\n\t}\n\treturn o.DeviceVendor, true\n}", "title": "" }, { "docid": "bf54403d9ad4c0afe26b9f7f5fa374f9", "score": "0.53590465", "text": "func (o *Ga4ghTumourboard) HasPatientOrFamilyInformedOfGermlineVariant() bool {\n\tif o != nil && o.PatientOrFamilyInformedOfGermlineVariant != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "9c5c0f234bcb4e6f1b320664cfdb387a", "score": "0.5341962", "text": "func (o *NetworkElementSummaryAllOf) SetVendor(v string) {\n\to.Vendor = &v\n}", "title": "" }, { "docid": "c5f1c645f40cb5c5cfc1c9f0ec35e4f9", "score": "0.5326783", "text": "func (o *EquipmentIdentityAllOf) SetVendor(v string) {\n\to.Vendor = &v\n}", "title": "" }, { "docid": "4ebc2ba4ef052960f4031ed41783014f", "score": "0.5323085", "text": "func (o *NetworkLicenseFile) GetVendor() string {\n\tif o == nil || o.Vendor == nil {\n\t\tvar ret string\n\t\treturn ret\n\t}\n\treturn *o.Vendor\n}", "title": "" }, { "docid": "4297c1f1108b4d4c0d0bd7feb9ad996d", "score": "0.53219616", "text": "func (o *User) HasPostalCode() bool {\n\tif o != nil && o.PostalCode != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "becef2ff8de39f292461ed0d641922a2", "score": "0.5304194", "text": "func (o *VnicEthAdapterPolicyInventory) HasGeneveEnabled() bool {\n\tif o != nil && o.GeneveEnabled != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "dd6c1bca7868998b3a5aa6f8be12d61d", "score": "0.53005445", "text": "func (o *ReservationModel) HasExternalCode() bool {\n\tif o != nil && o.ExternalCode != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "ef1a6f888ad6685d8d4062e065723812", "score": "0.52956235", "text": "func (o *HyperflexSoftwareVersionPolicy) HasHxdpVersion() bool {\n\tif o != nil && o.HxdpVersion != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "729302c00f29ac2b2c6fc46152196e0e", "score": "0.5294155", "text": "func (o *EquipmentIdentityAllOf) GetVendor() string {\n\tif o == nil || o.Vendor == nil {\n\t\tvar ret string\n\t\treturn ret\n\t}\n\treturn *o.Vendor\n}", "title": "" }, { "docid": "bf1a26289c96997221efe2f6f2dbc1e4", "score": "0.52866185", "text": "func (o *InlineObject753) HasDatePurchased() bool {\n\tif o != nil && o.DatePurchased != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "9c7480616a144c54d4964e9dffa16ec9", "score": "0.5271612", "text": "func (o *UpdatesV3Request) HasReleasever() bool {\n\tif o != nil && o.Releasever != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "d2cf5188255732fdf6de71e565168020", "score": "0.5260304", "text": "func (o *V0037JobProperties) HasLicenses() bool {\n\tif o != nil && o.Licenses != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "5342032b23087c3ed30d03ab912aa581", "score": "0.525932", "text": "func (o *AdminInfo) GetVendor() Vendor {\n\tif o == nil || o.Vendor == nil {\n\t\tvar ret Vendor\n\t\treturn ret\n\t}\n\treturn *o.Vendor\n}", "title": "" }, { "docid": "cb6f0fb1c3cc72fc248a78c01eb6fba6", "score": "0.52409375", "text": "func (o *AdminInfo) HasCountry() bool {\n\tif o != nil && o.Country != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "1cf3c82dae9afc5d598b2ad91799dcc8", "score": "0.5237333", "text": "func (o *SoftwareTechs) HasTechnology() bool {\n\tif o != nil && o.Technology != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "6529eef57188a153410c3928d4cdcfdd", "score": "0.5235331", "text": "func (o *Invoice) HasOrganisation() bool {\n\tif o != nil && o.Organisation != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "fee1fb25a6f659334db634989377698a", "score": "0.5228786", "text": "func (d UserData) HasHexyaVersion() bool {\n\treturn d.ModelData.Has(models.NewFieldName(\"HexyaVersion\", \"hexya_version\"))\n}", "title": "" }, { "docid": "53cd215358217d55b1c460c325073191", "score": "0.52251637", "text": "func (o *User) HasDrives() bool {\n\tif o != nil && o.Drives != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "53cd215358217d55b1c460c325073191", "score": "0.52251637", "text": "func (o *User) HasDrives() bool {\n\tif o != nil && o.Drives != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "c7ac6ffca003d882c0f0c1761f11514a", "score": "0.5223993", "text": "func (m *Model) HasField(field string) (bool, error) {\n\treturn m.db.GetCore().HasField(m.GetCtx(), m.tablesInit, field)\n}", "title": "" }, { "docid": "60c69599c51be510d6f7e1c2f1e326b5", "score": "0.52100736", "text": "func (o *ReservationModel) HasCorporateCode() bool {\n\tif o != nil && o.CorporateCode != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "97303cbc85b30a79422962b3ca032077", "score": "0.5208605", "text": "func (s *Structx) HasField(name string) bool {\n\t_, ok := s.value.Type().FieldByName(name)\n\treturn ok\n}", "title": "" }, { "docid": "64d3ea014c2a031d879c632f421db410", "score": "0.52041644", "text": "func (o *HyperflexSoftwareVersionPolicy) HasHxdpVersionInfo() bool {\n\tif o != nil && o.HxdpVersionInfo != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "e8604e1242f54c2383b161b4d1add3e7", "score": "0.520349", "text": "func (o *SyntheticsGlobalVariableParseTestOptions) HasField() bool {\n\treturn o != nil && o.Field != nil\n}", "title": "" }, { "docid": "d920f25d1a705f7a462b9485eeae3780", "score": "0.5194614", "text": "func (o *CreatedByClient) HasIsDevice() bool {\n\tif o != nil && o.IsDevice != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "c8efbbdd5810807af8c66a9e4d645e37", "score": "0.5182052", "text": "func (x *fastReflection_ModuleOptions) Has(fd protoreflect.FieldDescriptor) bool {\n\tswitch fd.FullName() {\n\tcase \"cosmos.autocli.v1.ModuleOptions.tx\":\n\t\treturn x.Tx != nil\n\tcase \"cosmos.autocli.v1.ModuleOptions.query\":\n\t\treturn x.Query != nil\n\tdefault:\n\t\tif fd.IsExtension() {\n\t\t\tpanic(fmt.Errorf(\"proto3 declared messages do not support extensions: cosmos.autocli.v1.ModuleOptions\"))\n\t\t}\n\t\tpanic(fmt.Errorf(\"message cosmos.autocli.v1.ModuleOptions does not contain field %s\", fd.FullName()))\n\t}\n}", "title": "" }, { "docid": "4ff8e0772a0686d8c14cef1e4f5dc734", "score": "0.51713383", "text": "func (d UserData) HasIsCompany() bool {\n\treturn d.ModelData.Has(models.NewFieldName(\"IsCompany\", \"is_company\"))\n}", "title": "" }, { "docid": "b39414da1b961c8043cdcceeb73bac79", "score": "0.51704013", "text": "func (d UserData) HasWebsite() bool {\n\treturn d.ModelData.Has(models.NewFieldName(\"Website\", \"website\"))\n}", "title": "" }, { "docid": "cb2bdbf25ff8d24c0125ae9940248ea5", "score": "0.5167124", "text": "func (o *AdminInfo) SetVendor(v Vendor) {\n\to.Vendor = &v\n}", "title": "" }, { "docid": "0d05021cbe828a1dedf7830b6fed52f1", "score": "0.51659346", "text": "func (o *VirtualizationBaseHostPciDeviceAllOf) GetVendorIdOk() (*int64, bool) {\n\tif o == nil || o.VendorId == nil {\n\t\treturn nil, false\n\t}\n\treturn o.VendorId, true\n}", "title": "" }, { "docid": "68e3dbb83a1f337195939f3365c0493a", "score": "0.5161732", "text": "func (o *VulnerabilitiesRequest) HasThirdParty() bool {\n\tif o != nil && o.ThirdParty != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "4742ebdaf32f572dc143d9cf831d5de4", "score": "0.5156567", "text": "func (o *ShowSystem) HasUuid() bool {\n\tif o != nil && !IsNil(o.Uuid) {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "915cc20c3a255889a24f5662f11e1dbb", "score": "0.51544255", "text": "func (ls Set) Has(field string) bool {\n\t_, exists := ls[field]\n\treturn exists\n}", "title": "" }, { "docid": "efc6ce0dabaad2c3296c6a465d7d24eb", "score": "0.51476955", "text": "func (o *User) HasAssignedLicenses() bool {\n\tif o != nil && o.AssignedLicenses != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "0aab75c8d3e4c47d19894615e52b2371", "score": "0.5144149", "text": "func (o *NetworkElementSummaryAllOf) GetVendor() string {\n\tif o == nil || o.Vendor == nil {\n\t\tvar ret string\n\t\treturn ret\n\t}\n\treturn *o.Vendor\n}", "title": "" }, { "docid": "312134dd7d3993322f4775733fa2d06f", "score": "0.5138201", "text": "func (o *CartaoProduto) HasUpd() bool {\n\tif o != nil && o.Upd.IsSet() {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "c958d788fde7f6d323b7f034d723a19f", "score": "0.5137209", "text": "func (o *Transaction) HasMerchantName() bool {\n\tif o != nil && o.MerchantName.IsSet() {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "a4ecee4325bff396e74cb6f0dc455120", "score": "0.5130866", "text": "func (o *BaseReportTransaction) HasMerchantName() bool {\n\tif o != nil && o.MerchantName.IsSet() {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "8798fdacf2b8faa60485c1af2c9097dc", "score": "0.51134837", "text": "func (o *StorageNetAppHighAvailability) HasPartnerName() bool {\n\tif o != nil && o.PartnerName != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" } ]
7cda788902ff41cda0984d904f854308
mergeMetadata merges the metadata but preserves existing entries
[ { "docid": "62e93eb8761574dc0c6f6e0e59c80e17", "score": "0.7235758", "text": "func mergeMetadata(current, new map[string]string) map[string]string {\n\tif len(new) == 0 {\n\t\treturn current\n\t}\n\n\tif current == nil {\n\t\tcurrent = map[string]string{}\n\t}\n\n\tfor k, v := range new {\n\t\tif _, ok := current[k]; !ok {\n\t\t\tcurrent[k] = v\n\t\t}\n\t}\n\n\treturn current\n}", "title": "" } ]
[ { "docid": "5a93b6ee4bc779c7180c861b5aed68eb", "score": "0.73510385", "text": "func (ns *NetworkServer) mergeMetadata(ctx context.Context, up *ttnpb.UplinkMessage) {\n\tmds, err := ns.uplinkDeduplicator.AccumulatedMetadata(ctx, up)\n\tif err != nil {\n\t\tlog.FromContext(ctx).WithError(err).Error(\"Failed to merge metadata\")\n\t\treturn\n\t}\n\tup.RxMetadata = mds\n\tlog.FromContext(ctx).WithField(\"metadata_count\", len(up.RxMetadata)).Debug(\"Merged metadata\")\n\tregisterMergeMetadata(ctx, up)\n}", "title": "" }, { "docid": "f8fef8dfad0d85b88302db80e2be2347", "score": "0.7349703", "text": "func mergeMetadata(ctx context.Context, md metadata.MD) context.Context {\n\tmdCopy, _ := metadata.FromContext(ctx)\n\treturn metadata.NewContext(ctx, metadata.Join(mdCopy, md))\n}", "title": "" }, { "docid": "44765a317b2cb193353d7cb42c1f4b8c", "score": "0.72036487", "text": "func (st AnalysisSetTable) MergeMetadata() map[string]interface{} {\n\tmdout := make(map[string]interface{})\n\n\tsources := make([]string, 0)\n\tconflictingKeys := make(map[string]struct{})\n\n\tfor setid := range st {\n\n\t\t// track sources\n\t\tsource := st[setid].Link()\n\t\tif source != \"\" {\n\t\t\tsources = append(sources, source)\n\t\t}\n\n\t\t// inherit arbitrary metadata for all keys without conflict\n\t\tfor k, newval := range st[setid].Metadata {\n\t\t\tif _, ok := conflictingKeys[k]; ok {\n\t\t\t\tcontinue\n\t\t\t} else {\n\t\t\t\texistval, ok := mdout[k]\n\t\t\t\tif !ok {\n\t\t\t\t\tmdout[k] = newval\n\t\t\t\t} else if fmt.Sprintf(\"%v\", existval) != fmt.Sprintf(\"%v\", newval) {\n\t\t\t\t\tdelete(mdout, k)\n\t\t\t\t\tconflictingKeys[k] = struct{}{}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\tif len(sources) > 0 {\n\t\tmdout[\"_sources\"] = sources\n\t}\n\n\treturn mdout\n}", "title": "" }, { "docid": "58691fd8bdd1c4fdf712678bf7699add", "score": "0.68732643", "text": "func mergeMetadata(secret *v1.Secret, externalSecret *esv1alpha1.ExternalSecret) {\n\tif secret.ObjectMeta.Labels == nil {\n\t\tsecret.ObjectMeta.Labels = make(map[string]string)\n\t}\n\tif secret.ObjectMeta.Annotations == nil {\n\t\tsecret.ObjectMeta.Annotations = make(map[string]string)\n\t}\n\tif externalSecret.Spec.Target.Template == nil {\n\t\tutils.MergeStringMap(secret.ObjectMeta.Labels, externalSecret.ObjectMeta.Labels)\n\t\tutils.MergeStringMap(secret.ObjectMeta.Annotations, externalSecret.ObjectMeta.Annotations)\n\t\treturn\n\t}\n\t// if template is defined: use those labels/annotations\n\tsecret.Type = externalSecret.Spec.Target.Template.Type\n\tutils.MergeStringMap(secret.ObjectMeta.Labels, externalSecret.Spec.Target.Template.Metadata.Labels)\n\tutils.MergeStringMap(secret.ObjectMeta.Annotations, externalSecret.Spec.Target.Template.Metadata.Annotations)\n}", "title": "" }, { "docid": "9ddd7aff6b5f0ca3fb1b4a8e4811a62c", "score": "0.6796591", "text": "func DeepMerge(b, a Metadata) Metadata {\n\tout := Metadata{}\n\tfor k, v := range b {\n\t\tout[k] = v\n\t}\n\tfor k, v := range a {\n\n\t\tmaybe, err := Metadatify(v)\n\t\tif err != nil {\n\t\t\t// if the new value is not meta. just overwrite the dest vaue\n\t\t\tout[k] = v\n\t\t\tcontinue\n\t\t}\n\n\t\t// it is meta. What about dest?\n\t\toutv, exists := out[k]\n\t\tif !exists {\n\t\t\t// the new value is meta, but there's no dest value. just write it\n\t\t\tout[k] = v\n\t\t\tcontinue\n\t\t}\n\n\t\toutMetadataValue, err := Metadatify(outv)\n\t\tif err != nil {\n\t\t\t// the new value is meta and there's a dest value, but the dest\n\t\t\t// value isn't meta. just overwrite\n\t\t\tout[k] = v\n\t\t\tcontinue\n\t\t}\n\n\t\t// both are meta. merge them.\n\t\tout[k] = DeepMerge(outMetadataValue, maybe)\n\t}\n\treturn out\n}", "title": "" }, { "docid": "9b93e9e196959d5fb188819f7e4d68ec", "score": "0.6117472", "text": "func (s1 ServicesMetadata) Merge(s2 ServicesMetadata) {\n\tfor k, v := range s2 {\n\t\ts1[k] = v\n\t}\n}", "title": "" }, { "docid": "0d87bc865ded67c161c670fd57bc3b0c", "score": "0.5938659", "text": "func (s *store) AddVulnerabilityMetadata(metadata ...v2.VulnerabilityMetadata) error {\n\tfor _, m := range metadata {\n\t\texisting, err := s.GetVulnerabilityMetadata(m.ID, m.RecordSource)\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"failed to verify existing entry: %w\", err)\n\t\t}\n\n\t\tif existing != nil {\n\t\t\t// merge with the existing entry\n\n\t\t\tcvssV3Diffs := deep.Equal(existing.CvssV3, m.CvssV3)\n\t\t\tcvssV2Diffs := deep.Equal(existing.CvssV2, m.CvssV2)\n\n\t\t\tswitch {\n\t\t\tcase existing.Severity != m.Severity:\n\t\t\t\treturn fmt.Errorf(\"existing metadata has mismatched severity (%q!=%q)\", existing.Severity, m.Severity)\n\t\t\tcase existing.Description != m.Description:\n\t\t\t\treturn fmt.Errorf(\"existing metadata has mismatched description (%q!=%q)\", existing.Description, m.Description)\n\t\t\tcase existing.CvssV2 != nil && len(cvssV2Diffs) > 0:\n\t\t\t\treturn fmt.Errorf(\"existing metadata has mismatched cvss-v2: %+v\", cvssV2Diffs)\n\t\t\tcase existing.CvssV3 != nil && len(cvssV3Diffs) > 0:\n\t\t\t\treturn fmt.Errorf(\"existing metadata has mismatched cvss-v3: %+v\", cvssV3Diffs)\n\t\t\tdefault:\n\t\t\t\texisting.CvssV2 = m.CvssV2\n\t\t\t\texisting.CvssV3 = m.CvssV3\n\t\t\t}\n\n\t\t\tlinks := stringutil.NewStringSetFromSlice(existing.Links)\n\t\t\tfor _, l := range m.Links {\n\t\t\t\tlinks.Add(l)\n\t\t\t}\n\n\t\t\texisting.Links = links.ToSlice()\n\t\t\tsort.Strings(existing.Links)\n\n\t\t\tnewModel := model.NewVulnerabilityMetadataModel(*existing)\n\t\t\tresult := s.db.Save(&newModel)\n\n\t\t\tif result.RowsAffected != 1 {\n\t\t\t\treturn fmt.Errorf(\"unable to merge vulnerability metadata (%d rows affected)\", result.RowsAffected)\n\t\t\t}\n\n\t\t\tif result.Error != nil {\n\t\t\t\treturn result.Error\n\t\t\t}\n\t\t} else {\n\t\t\t// this is a new entry\n\t\t\tnewModel := model.NewVulnerabilityMetadataModel(m)\n\t\t\tresult := s.db.Create(&newModel)\n\t\t\tif result.Error != nil {\n\t\t\t\treturn result.Error\n\t\t\t}\n\n\t\t\tif result.RowsAffected != 1 {\n\t\t\t\treturn fmt.Errorf(\"unable to add vulnerability metadata (%d rows affected)\", result.RowsAffected)\n\t\t\t}\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "881dca71eb924a583576f071915ae31d", "score": "0.588016", "text": "func (l *Log) flushMetadata() error {\n\t// make sure there's actually something in the metadata file to flush\n\tsize, err := func() (int64, error) {\n\t\tl.mu.Lock()\n\t\tdefer l.mu.Unlock()\n\n\t\tif l.metaFile == nil {\n\t\t\treturn 0, nil\n\t\t}\n\t\tst, err := l.metaFile.Stat()\n\t\tif err != nil {\n\t\t\treturn 0, err\n\t\t}\n\n\t\treturn st.Size(), nil\n\t}()\n\tif err != nil {\n\t\treturn err\n\t} else if size == 0 {\n\t\treturn nil\n\t}\n\n\t// we have data, get a list of the existing files and rotate to a new one, then flush\n\tfiles, err := l.metadataFiles()\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tif err := l.nextMetaFile(); err != nil {\n\t\treturn err\n\t}\n\n\tmeasurements := make(map[string]*tsdb.MeasurementFields)\n\tseries := make([]*tsdb.SeriesCreate, 0)\n\n\t// read all the measurement fields and series from the metafiles\n\tfor _, fn := range files {\n\t\ta, err := l.readMetadataFile(fn)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\tfor _, sf := range a {\n\t\t\tfor k, mf := range sf.Fields {\n\t\t\t\tmeasurements[k] = mf\n\t\t\t}\n\n\t\t\tseries = append(series, sf.Series...)\n\t\t}\n\t}\n\n\tstartTime := time.Now()\n\tif l.EnableLogging {\n\t\tl.logger.Printf(\"Flushing %d measurements and %d series to index\\n\", len(measurements), len(series))\n\t}\n\t// write them to the index\n\tif err := l.Index.WriteIndex(nil, measurements, series); err != nil {\n\t\treturn err\n\t}\n\tif l.EnableLogging {\n\t\tl.logger.Println(\"Metadata flush took\", time.Since(startTime))\n\t}\n\n\t// remove the old files now that we've persisted them elsewhere\n\tfor _, fn := range files {\n\t\tif err := os.Remove(fn); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "c1e6ea869e9bd9c2bbe94e6a46acd396", "score": "0.58304065", "text": "func (db *BoltDatabase) updateMetadata(tx *bolt.Tx) error {\n\tbucket, err := tx.CreateBucketIfNotExists([]byte(\"Metadata\"))\n\tif err != nil {\n\t\treturn err\n\t}\n\terr = bucket.Put([]byte(\"Header\"), []byte(db.Header))\n\tif err != nil {\n\t\treturn err\n\t}\n\terr = bucket.Put([]byte(\"Version\"), []byte(db.Version))\n\tif err != nil {\n\t\treturn err\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "3dab24174f04887e858a31760e285a68", "score": "0.5764083", "text": "func (c EdgeMetadatas) Merge(other EdgeMetadatas) EdgeMetadatas {\n\tvar (\n\t\tcSize = c.Size()\n\t\totherSize = other.Size()\n\t\toutput = c.psMap\n\t\titer = other.psMap\n\t)\n\tswitch {\n\tcase cSize == 0:\n\t\treturn other\n\tcase otherSize == 0:\n\t\treturn c\n\tcase cSize < otherSize:\n\t\toutput, iter = iter, output\n\t}\n\titer.ForEach(func(key string, otherVal interface{}) {\n\t\tif val, ok := output.Lookup(key); ok {\n\t\t\toutput = output.Set(key, otherVal.(EdgeMetadata).Merge(val.(EdgeMetadata)))\n\t\t} else {\n\t\t\toutput = output.Set(key, otherVal)\n\t\t}\n\t})\n\treturn EdgeMetadatas{output}\n}", "title": "" }, { "docid": "9fde7e814e8dd9b6d59bbe16348a984a", "score": "0.57047856", "text": "func (node *node) syncMetadata() {\n\tif node.metaInSync {\n\t\treturn\n\t}\n\t// update metadata map\n\tif mapping, hasMapping := node.graph.mappings[node.metadataMap]; hasMapping {\n\t\tif node.metadataAdded {\n\t\t\tif node.metadata == nil {\n\t\t\t\tmapping.Delete(node.label)\n\t\t\t\tnode.metadataAdded = false\n\t\t\t} else {\n\t\t\t\tprevMeta, _ := mapping.GetValue(node.label)\n\t\t\t\tif !reflect.DeepEqual(prevMeta, node.metadata) {\n\t\t\t\t\tmapping.Update(node.label, node.metadata)\n\t\t\t\t}\n\t\t\t}\n\t\t} else if node.metadata != nil {\n\t\t\tmapping.Put(node.label, node.metadata)\n\t\t\tnode.metadataAdded = true\n\t\t}\n\t}\n\tnode.metaInSync = true\n}", "title": "" }, { "docid": "4bfc589420cf0fb2a2366659853b3829", "score": "0.56336904", "text": "func (g *Generator) merge(src, dst *redskyappsv1alpha1.Application) {\n\tif src.Name != \"\" {\n\t\tdst.Name = src.Name\n\t}\n\n\tif src.Namespace != \"\" {\n\t\tdst.Namespace = src.Namespace\n\t}\n\n\tif len(dst.Labels) > 0 {\n\t\tfor k, v := range src.Labels {\n\t\t\tdst.Labels[k] = v\n\t\t}\n\t} else {\n\t\tdst.Labels = src.Labels\n\t}\n\n\tif len(dst.Annotations) > 0 {\n\t\tfor k, v := range src.Annotations {\n\t\t\tdst.Annotations[k] = v\n\t\t}\n\t} else {\n\t\tdst.Annotations = src.Annotations\n\t}\n\n\tdst.Resources = append(dst.Resources, src.Resources...)\n\tdst.Scenarios = append(dst.Scenarios, src.Scenarios...)\n\tdst.Objectives = append(dst.Objectives, src.Objectives...)\n}", "title": "" }, { "docid": "be00008cda6d27635f8e39ffc5cbac73", "score": "0.54907495", "text": "func (o *object) ForceAddMetadata(newMetadata abstract.ObjectStorageItemMetadata) fail.Error {\n\tif o.IsNull() {\n\t\treturn fail.InvalidInstanceError()\n\t}\n\n\tdefer debug.NewTracer(nil, tracing.ShouldTrace(\"objectstorage\"), \"\").Entering().Exiting()\n\n\tfor k, v := range newMetadata {\n\t\to.metadata[k] = v\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "c9c5f6626b42b6f5d1bcebafe040019d", "score": "0.54735535", "text": "func AddToMetainfo(addPath, metaPath string) error {\n\tmetaFile, err := os.OpenFile(metaPath, os.O_APPEND|os.O_WRONLY, 0644) // Opens for appending\n\tif err != nil {\n\t\tfmt.Println(err)\n\t\treturn err\n\t}\n\n\taddStat, err := os.Stat(addPath)\n\tif err != nil {\n\t\tfmt.Println(err)\n\t\treturn err\n\t}\n\n\tParseMetainfo(metaPath)\n\tlynkName := GetLynkName(metaPath)\n\tlynk := lynxutil.GetLynk(lynks, lynkName)\n\n\ti := 0\n\tfor i < len(lynk.Files) {\n\t\tif lynk.Files[i].Name == addStat.Name() {\n\t\t\treturn errors.New(\"Can't Add Duplicates To Metainfo\")\n\t\t}\n\t\ti++\n\t}\n\n\tlengthStr := strconv.FormatInt(addStat.Size(), 10) // Convert int64 to string\n\tmetaFile.WriteString(\"length:::\" + lengthStr + \"\\n\")\n\n\ttempPath, err := filepath.Abs(addPath) // Find the path of the current file\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// Write to metainfo file using ::: to separate keys and values\n\tmetaFile.WriteString(\"path:::\" + tempPath + \"\\n\")\n\tmetaFile.WriteString(\"name:::\" + addStat.Name() + \"\\n\")\n\tmetaFile.WriteString(\"chunkLength:::32\\n\")\n\tmetaFile.WriteString(\"chunks:::256\\n\")\n\tmetaFile.WriteString(endOfEntry + \"\\n\")\n\treturn metaFile.Close()\n}", "title": "" }, { "docid": "752eefd36b017bc56690eb66e84f1293", "score": "0.5472353", "text": "func parseMetadataAppend(flags []string) ([]v2.MetadataStream, error) {\n\tmd := make([]v2.MetadataStream, 0, len(flags))\n\tfor _, v := range flags {\n\t\t// Example metadata: 'appendmetadata:pluginid12:{\"moo\":\"lala\"}'\n\n\t\t// Parse append metadata tag. This is the 'appendmetadata:' part\n\t\t// of the example metadata.\n\t\tappendTag := regexAppendMD.FindString(v)\n\t\tif appendTag == \"\" {\n\t\t\t// This is not a metadata append\n\t\t\tcontinue\n\t\t}\n\n\t\t// Parse the full metatdata ID string. This is the \"pluginid12:\"\n\t\t// part of the example metadata.\n\t\tmdID := regexMDID.FindString(v)\n\n\t\t// Parse the plugin ID and stream ID\n\t\tpluginID, streamID, err := parseMetadataIDs(mdID)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\n\t\tmd = append(md, v2.MetadataStream{\n\t\t\tPluginID: pluginID,\n\t\t\tStreamID: streamID,\n\t\t\tPayload: v[len(appendTag)+len(mdID):],\n\t\t})\n\t}\n\n\treturn md, nil\n}", "title": "" }, { "docid": "c7c0082aa2167ede1bb904372ac26be4", "score": "0.54383326", "text": "func (m *MetadataManager) PopulateMetadataTables(mysqld MysqlDaemon, localMetadata map[string]string, dbName string) error {\n\tlog.Infof(\"Populating _vt.local_metadata table...\")\n\n\t// Get a non-pooled DBA connection.\n\tconn, err := mysqld.GetDbaConnection(context.TODO())\n\tif err != nil {\n\t\treturn err\n\t}\n\tdefer conn.Close()\n\n\t// Disable replication on this session. We close the connection after using\n\t// it, so there's no need to re-enable replication when we're done.\n\tif _, err := conn.ExecuteFetch(\"SET @@session.sql_log_bin = 0\", 0, false); err != nil {\n\t\treturn err\n\t}\n\n\t// Create the database and table if necessary.\n\tif err := createMetadataTables(conn, dbName); err != nil {\n\t\treturn err\n\t}\n\n\t// Populate local_metadata from the passed list of values.\n\treturn upsertLocalMetadata(conn, localMetadata, dbName)\n}", "title": "" }, { "docid": "c8403dd01f39fabf7c2eb09dafa72793", "score": "0.540479", "text": "func m2(files ...*backuppb.DataFileInfo) *backuppb.Metadata {\n\tmeta := &backuppb.Metadata{\n\t\t// Hacking: use the store_id as the identity for metadata.\n\t\tStoreId: int64(atomic.AddUint64(&id, 1)),\n\t\tMinTs: uint64(math.MaxUint64),\n\t\tMetaVersion: backuppb.MetaVersion_V2,\n\t}\n\tfileGroups := &backuppb.DataFileGroup{\n\t\tPath: fmt.Sprintf(\"default-%06d\", meta.StoreId),\n\t\tMinTs: uint64(math.MaxUint64),\n\t}\n\tfor _, file := range files {\n\t\tif fileGroups.MaxTs < file.MaxTs {\n\t\t\tfileGroups.MaxTs = file.MaxTs\n\t\t}\n\t\tif fileGroups.MinTs > file.MinTs {\n\t\t\tfileGroups.MinTs = file.MinTs\n\t\t}\n\t\tfileGroups.DataFilesInfo = append(fileGroups.DataFilesInfo, file)\n\t}\n\tmeta.MaxTs = fileGroups.MaxTs\n\tmeta.MinTs = fileGroups.MinTs\n\tmeta.FileGroups = append(meta.FileGroups, fileGroups)\n\treturn meta\n}", "title": "" }, { "docid": "9d2cc1ba9ef07410b265d9752d9c1dd6", "score": "0.540388", "text": "func MetadataUpdate(oldMDMap map[string]interface{}, newMDMap map[string]interface{}, serverMD *compute.Metadata) {\n\ttpgcompute.MetadataUpdate(oldMDMap, newMDMap, serverMD)\n}", "title": "" }, { "docid": "86014e73288c8925e916330c26bd7440", "score": "0.53874314", "text": "func merge(target, source headers) headers {\n\tif len(source) == 0 {\n\t\treturn target\n\t}\n\tif len(target) == 0 {\n\t\treturn source\n\t}\n\tfor k, v := range source {\n\t\tif _, exists := target[k]; !exists {\n\t\t\ttarget[k] = v\n\t\t}\n\t}\n\treturn target\n}", "title": "" }, { "docid": "b16007b4992eb5c78772bed58e69da1c", "score": "0.5380634", "text": "func parseMetadataOverwrite(flags []string) ([]v2.MetadataStream, error) {\n\tmd := make([]v2.MetadataStream, 0, len(flags))\n\tfor _, v := range flags {\n\t\t// Example metadata: 'overwritemetadata:pluginid12:{\"moo\":\"lala\"}'\n\n\t\t// Parse overwrite metadata tag. This is the 'overwritemetadata:'\n\t\t// part of the example metadata.\n\t\toverwriteTag := regexOverwriteMD.FindString(v)\n\t\tif overwriteTag == \"\" {\n\t\t\t// This is not a metadata overwrite\n\t\t\tcontinue\n\t\t}\n\n\t\t// Parse the full metatdata ID string. This is the \"pluginid12:\"\n\t\t// part of the example metadata.\n\t\tmdID := regexMDID.FindString(v)\n\n\t\t// Parse the plugin ID and stream ID\n\t\tpluginID, streamID, err := parseMetadataIDs(mdID)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\n\t\tmd = append(md, v2.MetadataStream{\n\t\t\tPluginID: pluginID,\n\t\t\tStreamID: streamID,\n\t\t\tPayload: v[len(overwriteTag)+len(mdID):],\n\t\t})\n\t}\n\n\treturn md, nil\n}", "title": "" }, { "docid": "3ee83db4df7346122c9449719a13eeac", "score": "0.5370937", "text": "func updateMetadata(\n\tresType client.ResourceType,\n\td *schema.ResourceData,\n\tapiClient *client.Client) error {\n\n\tvar err error\n\n\t// Retrieve metadata changes\n\to, n := d.GetChange(\"metadata\")\n\toldMeta := o.(map[string]interface{})\n\tnewMeta := n.(map[string]interface{})\n\n\t// Update new and changed metadata\n\tfor key, newVal := range newMeta {\n\t\tif oldVal, exists := oldMeta[key]; exists {\n\t\t\tif oldVal != newVal {\n\t\t\t\t// Old key, value changing\n\t\t\t\terr = apiClient.SetMetadata(resType, d.Id(), key, newVal.(string))\n\t\t\t}\n\t\t} else {\n\t\t\t// New key\n\t\t\terr = apiClient.SetMetadata(resType, d.Id(), key, newVal.(string))\n\t\t}\n\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"Unable to change metadata: %v\", err)\n\t\t}\n\t}\n\n\t// Find deleted metadata keys\n\tfor key := range oldMeta {\n\t\tif _, exists := newMeta[key]; !exists {\n\t\t\terr = apiClient.DeleteMetadata(resType, d.Id(), key)\n\t\t\tif err != nil {\n\t\t\t\treturn fmt.Errorf(\"Unable to delete metadata key: %v\", err)\n\t\t\t}\n\t\t}\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "d5513db4c0ddad33745d2aacd8363005", "score": "0.5353131", "text": "func copyFieldsMetadata(sourceConfig *TerragruntConfig, targetConfig *TerragruntConfig) {\n\tif sourceConfig.FieldsMetadata != nil {\n\t\tif targetConfig.FieldsMetadata == nil {\n\t\t\ttargetConfig.FieldsMetadata = map[string]map[string]interface{}{}\n\t\t}\n\t\tfor k, v := range sourceConfig.FieldsMetadata {\n\t\t\ttargetConfig.FieldsMetadata[k] = v\n\t\t}\n\t}\n}", "title": "" }, { "docid": "916c065ed1aec4ebba3a8bdafe36bb41", "score": "0.5328654", "text": "func buildMetadataMets(mets Mets, target string) (string, string) {\n\tmanifestObject := ObjectMetsManifest{}\n packageName := getParentPackage(mets.StructMap)\n\n if mets.DescriptiveSec == nil {\n log.Fatal(\"Descriptive metadata (dmdSec) missing.\")\n }\n\n file_count, files, transferLevelDc := extractMetadataMetsFile(mets)\n manifestObject.Title = transferLevelDc.Title\n if manifestObject.Title == \"\" {\n manifestObject.Title = packageName\n }\n manifestObject.CollectionCall = transferLevelDc.Identifier\n manifestObject.Description = transferLevelDc.Description\n manifestObject.BaggingDate = mets.Header.CreateDate\n manifestObject.FileCount = file_count\n\n manifest := manifestMetsJSON{}\n e := getSiegfriedMetadata(mets.AdminSec)\n if e != nil {\n sieg := getSiegfriedVersion(e.Detail)\n manifest.Siegfried = sieg[\"version\"]\n manifest.Scandate = e.DateTime\n }\n manifest.Files = files\n identifier := Identifiers{}\n var identifiers []Identifiers\n identifiers = append(identifiers, identifier)\n manifest.Identifiers = identifiers\n manifestObject.Manifest = manifest\n manifestObject.StorageLocation = packageName\n manifestObject.SchemaVersion = \"0.2.0\"\n\n\t// target += \"/\" + manifestObject.Title + \"_\" + \"metadata.json\"\n target += \"/\" + packageName + \"_\" + \"metadata.json\"\n\n\t//Write struct to file\n\twriteNewStructToFile(target, manifestObject)\n\treturn target, \"\"\n}", "title": "" }, { "docid": "d60c4f4f3885123985608f1b3854ebc0", "score": "0.5290485", "text": "func (d *Data) readMerge(ctx context.Context, source *Source, _ ...string) ([]byte, error) {\n\topaque := source.URL.Opaque\n\tparts := strings.Split(opaque, \"|\")\n\tif len(parts) < 2 {\n\t\treturn nil, fmt.Errorf(\"need at least 2 datasources to merge\")\n\t}\n\tdata := make([]map[string]interface{}, len(parts))\n\tfor i, part := range parts {\n\t\t// supports either URIs or aliases\n\t\tsubSource, err := d.lookupSource(part)\n\t\tif err != nil {\n\t\t\t// maybe it's a relative filename?\n\t\t\tu, uerr := datafs.ParseSourceURL(part)\n\t\t\tif uerr != nil {\n\t\t\t\treturn nil, uerr\n\t\t\t}\n\t\t\tsubSource = &Source{\n\t\t\t\tAlias: part,\n\t\t\t\tURL: u,\n\t\t\t}\n\t\t}\n\t\tsubSource.inherit(source)\n\n\t\tb, err := d.readSource(ctx, subSource)\n\t\tif err != nil {\n\t\t\treturn nil, fmt.Errorf(\"couldn't read datasource '%s': %w\", part, err)\n\t\t}\n\n\t\tmimeType, err := subSource.mimeType(\"\")\n\t\tif err != nil {\n\t\t\treturn nil, fmt.Errorf(\"failed to read datasource %s: %w\", subSource.URL, err)\n\t\t}\n\n\t\tdata[i], err = parseMap(mimeType, string(b))\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\n\t// Merge the data together\n\tb, err := mergeData(data)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tsource.mediaType = yamlMimetype\n\treturn b, nil\n}", "title": "" }, { "docid": "3641e60f06bbfd2f88d5f1eda227cd2a", "score": "0.5234171", "text": "func (adData *AdData) MergeWithAd(otherOlderAdData *AdData) {\n\tadData.MetaData_DateSeenFirst = otherOlderAdData.MetaData_DateSeenFirst\n}", "title": "" }, { "docid": "317cd1c679fe4bcdee0794df6fa44c24", "score": "0.5219488", "text": "func (ingestor *DBIngestor) ingestMetadata(metadata []prompb.MetricMetadata, releaseMem func()) (uint64, error) {\n\tnum := len(metadata)\n\tdata := make([]model.Metadata, num)\n\tfor i := 0; i < num; i++ {\n\t\ttmp := metadata[i]\n\t\tdata[i] = model.Metadata{\n\t\t\tMetricFamily: tmp.MetricFamilyName,\n\t\t\tUnit: tmp.Unit,\n\t\t\tType: tmp.Type.String(),\n\t\t\tHelp: tmp.Help,\n\t\t}\n\t}\n\treleaseMem()\n\tnumMetadataIngested, errMetadata := ingestor.dispatcher.InsertMetadata(data)\n\tif errMetadata != nil {\n\t\treturn 0, errMetadata\n\t}\n\treturn numMetadataIngested, nil\n}", "title": "" }, { "docid": "f32b5bb46780bf1133dc6dda507cd7bb", "score": "0.5216808", "text": "func merge(res result.Results) result.Results {\n\tlog.Println(\"Merging %d results ...\", len(res))\n\tm := make(map[string]result.Result)\n\tfor _, r := range res {\n\t\tkey := r.SiteKey()\n\t\t// Merge availability data.\n\t\tif val, exists := m[key]; exists {\n\t\t\tlog.Println(\"%s: Appending availability: %+v (previous: %+v)\", key, r.Availability, val.Availability)\n\t\t\tval.Availability = append(val.Availability, r.Availability...)\n\t\t\t// map items are immutable.\n\t\t\tm[key] = val\n\t\t\tlog.Println(\"%s availability now: %+v\", key, m[key].Availability)\n\t\t} else {\n\t\t\tlog.Println(\"%s: Not yet seen: %+v\", key, r)\n\t\t\tdata.Merge(&r)\n\t\t\tm[key] = r\n\t\t}\n\t}\n\n\tvar merged result.Results\n\tfor k, v := range m {\n\t\tlog.Println(\"%s: %+v\", k, v)\n\t\tmerged = append(merged, v)\n\t}\n\tsort.Sort(merged)\n\treturn merged\n}", "title": "" }, { "docid": "4496b636f5724b7508296102b563993b", "score": "0.52141166", "text": "func flattenMetadata(metadata *compute.Metadata) map[string]interface{} {\n\treturn tpgcompute.FlattenMetadata(metadata)\n}", "title": "" }, { "docid": "4b03075485d89a629f4e7e13bba616f3", "score": "0.5206888", "text": "func PutMetadata(m model.EditMetadata) dataset.EditableMetadata {\n\tmetadata := dataset.EditableMetadata{\n\t\tCanonicalTopic: m.Dataset.CanonicalTopic,\n\t\tDescription: m.Dataset.Description,\n\t\tDimensions: m.Version.Dimensions,\n\t\tLatestChanges: &m.Version.LatestChanges,\n\t\tLicense: m.Dataset.License,\n\t\tNationalStatistic: &m.Dataset.NationalStatistic,\n\t\tNextRelease: m.Dataset.NextRelease,\n\t\tQMI: &m.Dataset.QMI,\n\t\tReleaseDate: m.Version.ReleaseDate,\n\t\tReleaseFrequency: m.Dataset.ReleaseFrequency,\n\t\tSubtopics: m.Dataset.Subtopics,\n\t\tSurvey: m.Dataset.Survey,\n\t\tTitle: m.Dataset.Title,\n\t\tUnitOfMeasure: m.Dataset.UnitOfMeasure,\n\t}\n\n\tif m.Dataset.Contacts != nil {\n\t\tmetadata.Contacts = *m.Dataset.Contacts\n\t}\n\tif m.Dataset.Keywords != nil {\n\t\tmetadata.Keywords = *m.Dataset.Keywords\n\t}\n\tif m.Dataset.Methodologies != nil {\n\t\tmetadata.Methodologies = *m.Dataset.Methodologies\n\t}\n\tif m.Dataset.Publications != nil {\n\t\tmetadata.Publications = *m.Dataset.Publications\n\t}\n\tif m.Dataset.RelatedDatasets != nil {\n\t\tmetadata.RelatedDatasets = *m.Dataset.RelatedDatasets\n\t}\n\tif m.Dataset.RelatedContent != nil {\n\t\tmetadata.RelatedContent = *m.Dataset.RelatedContent\n\t}\n\n\tif m.Version.Alerts != nil {\n\t\tmetadata.Alerts = m.Version.Alerts\n\t}\n\tif m.Version.UsageNotes != nil {\n\t\tmetadata.UsageNotes = m.Version.UsageNotes\n\t}\n\n\treturn metadata\n}", "title": "" }, { "docid": "b8bb076e63353fb4e11b97b35fc0f7e2", "score": "0.5189865", "text": "func (o *object) AddMetadata(newMetadata abstract.ObjectStorageItemMetadata) fail.Error {\n\tif o.IsNull() {\n\t\treturn fail.InvalidInstanceError()\n\t}\n\n\tdefer debug.NewTracer(nil, tracing.ShouldTrace(\"objectstorage\"), \"\").Entering().Exiting()\n\n\tfor k, v := range newMetadata {\n\t\t_, found := o.metadata[k]\n\t\tif !found {\n\t\t\to.metadata[k] = v\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "6dfa742a2b4be42010a1b3adab9dfe32", "score": "0.5184908", "text": "func mergeTypeInfo(dst, src *types.Info) {\n\tfor k, v := range src.Types {\n\t\tdst.Types[k] = v\n\t}\n\tfor k, v := range src.Defs {\n\t\tdst.Defs[k] = v\n\t}\n\tfor k, v := range src.Uses {\n\t\tdst.Uses[k] = v\n\t}\n\tfor k, v := range src.Selections {\n\t\tdst.Selections[k] = v\n\t}\n}", "title": "" }, { "docid": "cad5263711b3aed5d3f03ed0c581fac1", "score": "0.51818347", "text": "func Metadata(name string, value ...string) {\n\tif at, ok := attributeDefinition(false); ok {\n\t\tif at.Metadata == nil {\n\t\t\tat.Metadata = make(map[string][]string)\n\t\t}\n\t\tat.Metadata[name] = append(at.Metadata[name], value...)\n\t\treturn\n\t}\n\tif mt, ok := mediaTypeDefinition(false); ok {\n\t\tif mt.Metadata == nil {\n\t\t\tmt.Metadata = make(map[string][]string)\n\t\t}\n\t\tmt.Metadata[name] = append(mt.Metadata[name], value...)\n\t\treturn\n\t}\n\tif act, ok := actionDefinition(false); ok {\n\t\tif act.Metadata == nil {\n\t\t\tact.Metadata = make(map[string][]string)\n\t\t}\n\t\tact.Metadata[name] = append(act.Metadata[name], value...)\n\t\treturn\n\t}\n\tif res, ok := resourceDefinition(false); ok {\n\t\tif res.Metadata == nil {\n\t\t\tres.Metadata = make(map[string][]string)\n\t\t}\n\t\tres.Metadata[name] = append(res.Metadata[name], value...)\n\t\treturn\n\t}\n\tif rd, ok := responseDefinition(false); ok {\n\t\tif rd.Metadata == nil {\n\t\t\trd.Metadata = make(map[string][]string)\n\t\t}\n\t\trd.Metadata[name] = append(rd.Metadata[name], value...)\n\t\treturn\n\t}\n\tif api, ok := apiDefinition(true); ok {\n\t\tif api.Metadata == nil {\n\t\t\tapi.Metadata = make(map[string][]string)\n\t\t}\n\t\tapi.Metadata[name] = append(api.Metadata[name], value...)\n\t\treturn\n\t}\n}", "title": "" }, { "docid": "f0c552b2ac5e20bf2c407254cff00dbc", "score": "0.5178599", "text": "func (f *FileWriter) AppendImageMetadata(imageMetadata []ImageMetadataInfo) {\n\tblog.Info(\"Appending image metadata to file...\")\n\tf.format = \"json\"\n\tf.handleImageMetadata(imageMetadata, \"ADD\")\n}", "title": "" }, { "docid": "b44b8beacf57e25f816ec0ad7e788f33", "score": "0.5163134", "text": "func updateMetadataFile(mrRoot, path string, localRepo bool, metadata *metadatapb.Metadata) error {\n\tmdFilePath := getMdFilePath(path)\n\t// detect license info\n\tlicenseDatabasePath := filepath.Join(mrRoot, \"tools/vendor_bender/LicenseDatabase\")\n\tlicense, err := detectLicense(licenseDatabasePath, path)\n\tif err != nil {\n\t\tfmt.Printf(\"WARNING: LICENSE detection failed: %v\\n\", err)\n\t}\n\t// Update vendoring date\n\tnow := time.Now()\n\tdate := &metadatapb.Date{\n\t\tYear: int32(now.Year()),\n\t\tMonth: int32(now.Month()),\n\t\tDay: int32(now.Day()),\n\t}\n\tmetadata.ThirdParty.License = license\n\tmetadata.ThirdParty.IsLocalRepository = localRepo\n\tmetadata.ThirdParty.LastUpgradeDate = date\n\t// Write the info into METADATA\n\tmo := prototext.MarshalOptions{Multiline: true}\n\tbuf, err := mo.Marshal(metadata)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"failed to marshal the METADATA file: %v\", err)\n\t}\n\tif err := ioutil.WriteFile(mdFilePath, buf, 0666); err != nil {\n\t\treturn fmt.Errorf(\"failed to update METADATA file %s: %v\", mdFilePath, err)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "7dc739d5ab070f9c5f4eec29ff838be0", "score": "0.51500523", "text": "func addMetadataToCodelab(m map[string]string, c *types.Codelab) {\n\tfor k, v := range m {\n\t\tswitch k {\n\t\tcase metaAuthor:\n\t\t\t// Directly assign the summary to the codelab field.\n\t\t\tc.Author = v\n\t\tcase metaSummary:\n\t\t\t// Directly assign the summary to the codelab field.\n\t\t\tc.Summary = v\n\t\t\tbreak\n\t\tcase metaID:\n\t\t\t// Directly assign the ID to the codelab field.\n\t\t\tc.ID = v\n\t\t\tbreak\n\t\tcase metaCategories:\n\t\t\t// Standardize the categories and append to codelab field.\n\t\t\tc.Categories = append(c.Categories, standardSplit(v)...)\n\t\t\tbreak\n\t\tcase metaEnvironments:\n\t\t\t// Standardize the tags and append to the codelab field.\n\t\t\tc.Tags = append(c.Tags, standardSplit(v)...)\n\t\t\tbreak\n\t\tcase metaStatus:\n\t\t\t// Standardize the statuses and append to the codelab field.\n\t\t\tstatuses := standardSplit(v)\n\t\t\tstatusesAsLegacy := types.LegacyStatus(statuses)\n\t\t\tc.Status = &statusesAsLegacy\n\t\t\tbreak\n\t\tcase metaFeedbackLink:\n\t\t\t// Directly assign the feedback link to the codelab field.\n\t\t\tc.Feedback = v\n\t\t\tbreak\n\t\tcase metaAnalyticsAccount:\n\t\t\t// Directly assign the GA id to the codelab field.\n\t\t\tc.GA = v\n\t\t\tbreak\n\t\tcase metaTags:\n\t\t\t// Standardize the tags and append to the codelab field.\n\t\t\tc.Tags = append(c.Tags, standardSplit(v)...)\n\t\t\tbreak\n\t\tdefault:\n\t\t\tbreak\n\t\t}\n\t}\n}", "title": "" }, { "docid": "5f95c4a39feb4e4c1242a4e77c11b05c", "score": "0.5146488", "text": "func (entry *localFileEntry) GetOrSetMetadata(md metadata.Metadata) error {\n\tif entry.metadata.Has(md.GetSuffix()) {\n\t\treturn entry.GetMetadata(md)\n\t}\n\tb, err := md.Serialize()\n\tif err != nil {\n\t\treturn fmt.Errorf(\"marshal metadata: %s\", err)\n\t}\n\tfilePath := filepath.Join(filepath.Dir(entry.GetPath()), md.GetSuffix())\n\tif _, err := compareAndWriteFile(filePath, b); err != nil {\n\t\treturn err\n\t}\n\tentry.metadata.Add(md.GetSuffix())\n\treturn nil\n}", "title": "" }, { "docid": "d47437a892922850bcf09a6931c30799", "score": "0.512727", "text": "func combineResponseMetadata(all, this *Response) error {\n\tcombinedConsumedCapacity := make([]capacity.ConsumedCapacity, 0)\n\tfor _, this_cc := range this.ConsumedCapacity {\n\t\tvar cc capacity.ConsumedCapacity\n\t\tcc.TableName = this_cc.TableName\n\t\tcc.CapacityUnits = this_cc.CapacityUnits\n\t\tfor _, all_cc := range all.ConsumedCapacity {\n\t\t\tif all_cc.TableName == this_cc.TableName {\n\t\t\t\tcc.CapacityUnits += all_cc.CapacityUnits\n\t\t\t}\n\t\t}\n\t\tcombinedConsumedCapacity = append(combinedConsumedCapacity, cc)\n\t}\n\tall.ConsumedCapacity = combinedConsumedCapacity\n\tfor tn, _ := range this.ItemCollectionMetrics {\n\t\tfor _, icm := range this.ItemCollectionMetrics[tn] {\n\t\t\tif _, tn_is_all := all.ItemCollectionMetrics[tn]; !tn_is_all {\n\t\t\t\tall.ItemCollectionMetrics[tn] =\n\t\t\t\t\tmake([]*itemcollectionmetrics.ItemCollectionMetrics, 0)\n\t\t\t}\n\t\t\tall.ItemCollectionMetrics[tn] = append(all.ItemCollectionMetrics[tn], icm)\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "283e124af5548eaa225a73c3931cadd1", "score": "0.5111094", "text": "func writeMetaData( metadata2 Metadata) (success bool){\n\n\treturn success\n}", "title": "" }, { "docid": "a0dda244c6bec6c9732bbb6fdfa1996b", "score": "0.5103304", "text": "func FinalMerge(data map[string]interface{}) []interface{} {\n\tfinalAttributes := map[string]interface{}{}\n\tfinalSampleSets := map[string]interface{}{}\n\n\t// store all flat attributes in final attributes\n\t// store detected samples in SampleSets\n\tfor key := range data {\n\t\tif !strings.Contains(key, \"Samples\") {\n\t\t\tfinalAttributes[key] = data[key]\n\t\t} else {\n\t\t\tfinalSampleSets[key] = data[key]\n\t\t}\n\t}\n\n\tvar finalMergedSamples []interface{}\n\tfor sampleSet := range finalSampleSets {\n\t\tswitch ss := finalSampleSets[sampleSet].(type) {\n\t\tcase []interface{}:\n\t\t\tfor _, sample := range ss {\n\t\t\t\tswitch sample := sample.(type) {\n\t\t\t\tcase map[string]interface{}:\n\t\t\t\t\tnewSample := sample\n\t\t\t\t\tnewSample[\"event_type\"] = sampleSet\n\t\t\t\t\tfor attribute := range finalAttributes {\n\t\t\t\t\t\tnewSample[attribute] = finalAttributes[attribute]\n\t\t\t\t\t}\n\t\t\t\t\tfinalMergedSamples = append(finalMergedSamples, newSample)\n\t\t\t\tdefault:\n\t\t\t\t\tload.Logrus.Debugf(\"processor-flattener: unsupported data type %T\", sample)\n\t\t\t\t\tload.Logrus.Debug(sample)\n\t\t\t\t}\n\t\t\t}\n\t\tcase map[string]interface{}:\n\t\t\tnewSample := ss\n\t\t\tnewSample[\"event_type\"] = sampleSet\n\t\t\tfor attribute := range finalAttributes {\n\t\t\t\tnewSample[attribute] = finalAttributes[attribute]\n\t\t\t}\n\t\t\tfinalMergedSamples = append(finalMergedSamples, newSample)\n\t\t}\n\t}\n\n\tif len(finalMergedSamples) > 0 {\n\t\treturn finalMergedSamples\n\t}\n\n\tfinalMergedSamples = append(finalMergedSamples, finalAttributes)\n\treturn finalMergedSamples\n}", "title": "" }, { "docid": "9536285590158b359699b5c8c96aa643", "score": "0.50949264", "text": "func merge(series []*monitoring.TimeSeries, logger adapter.Logger) []*monitoring.TimeSeries {\n\tgrouped := groupBySeries(series)\n\treturn mergeSeries(grouped, logger)\n}", "title": "" }, { "docid": "38e69ebc648a39afaf70bbbecfa08e39", "score": "0.50764304", "text": "func (mr *Master) merge() {\n\tdebug(\"Merge phase\")\n\tkvs := make(map[string]string)\n\tfor i := 0; i < mr.nReduce; i++ {\n\t\tp := mergeName(mr.jobName, i)\n\t\tfmt.Printf(\"Merge: read %s\\n\", p)\n\t\tfile, err := os.Open(p)\n\t\tif err != nil {\n\t\t\tlog.Fatal(\"Merge: \", err)\n\t\t}\n\t\tdec := json.NewDecoder(file)\n\t\tfor {\n\t\t\tvar kv KeyValue\n\t\t\terr = dec.Decode(&kv)\n\t\t\tif err != nil {\n\t\t\t\tbreak\n\t\t\t}\n\t\t\tkvs[kv.Key] = kv.Value\n\t\t}\n\t\tfile.Close()\n\t}\n\tvar keys []string\n\tfor k := range kvs {\n\t\tkeys = append(keys, k)\n\t}\n\tsort.Strings(keys)\n\n\tfile, err := os.Create(\"mrtmp.\" + mr.jobName)\n\tif err != nil {\n\t\tlog.Fatal(\"Merge: create \", err)\n\t}\n\tw := bufio.NewWriter(file)\n\tfor _, k := range keys {\n\t\tfmt.Fprintf(w, \"%s: %s\\n\", k, kvs[k])\n\t}\n\tw.Flush()\n\tfile.Close()\n}", "title": "" }, { "docid": "cefe7c50339406b5cbc068bfee2f2662", "score": "0.50622404", "text": "func (e EdgeMetadata) Merge(other EdgeMetadata) EdgeMetadata {\n\tcp := e.Copy()\n\tcp.EgressPacketCount = merge(cp.EgressPacketCount, other.EgressPacketCount, sum)\n\tcp.IngressPacketCount = merge(cp.IngressPacketCount, other.IngressPacketCount, sum)\n\tcp.EgressByteCount = merge(cp.EgressByteCount, other.EgressByteCount, sum)\n\tcp.IngressByteCount = merge(cp.IngressByteCount, other.IngressByteCount, sum)\n\treturn cp\n}", "title": "" }, { "docid": "f29740f928e666d6d1537d86ebea032c", "score": "0.50576454", "text": "func (m *merger) Merge(key uint32, metricBlocks [][]byte) error {\n\tblockCount := len(metricBlocks)\n\t// 1. prepare readers and metric level data(field/time slot/series ids)\n\tmergeCtx, err := m.prepare(metricBlocks)\n\tif err != nil {\n\t\treturn err\n\t}\n\t// 2. Prepare metric\n\tm.dataFlusher.PrepareMetric(key, mergeCtx.targetFields)\n\t// 3. merge series data by roaring container\n\thighKeys := mergeCtx.seriesIDs.GetHighKeys()\n\tdecodeStreams := make([]*encoding.TSDDecoder, blockCount) // make decodeStreams for reuse\n\tdefer func() {\n\t\tfor _, stream := range decodeStreams {\n\t\t\tencoding.ReleaseTSDDecoder(stream)\n\t\t}\n\t}()\n\tfieldReaders := make([]FieldReader, blockCount)\n\tfor idx, highKey := range highKeys {\n\t\tcontainer := mergeCtx.seriesIDs.GetContainerAtIndex(idx)\n\t\tit := container.PeekableIterator()\n\t\tfor it.HasNext() {\n\t\t\tlowSeriesID := it.Next()\n\t\t\t// maybe series id not exist in some values block\n\t\t\tfor blockIdx, scanner := range mergeCtx.scanners {\n\t\t\t\tseriesEntry := scanner.scan(highKey, lowSeriesID)\n\t\t\t\tif len(seriesEntry) == 0 {\n\t\t\t\t\tcontinue\n\t\t\t\t}\n\t\t\t\ttimeRange := scanner.slotRange()\n\t\t\t\tif fieldReaders[blockIdx] == nil {\n\t\t\t\t\tfieldReaders[blockIdx] = newFieldReader(scanner.fieldIndexes(), seriesEntry, timeRange)\n\t\t\t\t} else {\n\t\t\t\t\tfieldReaders[blockIdx].Reset(seriesEntry, timeRange)\n\t\t\t\t}\n\t\t\t}\n\t\t\tif err := m.seriesMerger.merge(mergeCtx, decodeStreams, fieldReaders); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t\t// flush series id\n\t\t\tif err := m.dataFlusher.FlushSeries(encoding.ValueWithHighLowBits(uint32(highKey)<<16, lowSeriesID)); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\t// flush metric data\n\tif err := m.dataFlusher.CommitMetric(mergeCtx.targetRange); err != nil {\n\t\treturn err\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "0ff8fc4137691ffcf4db3dfa551c26c6", "score": "0.50571877", "text": "func FinalMerge(data map[string]interface{}) []interface{} {\n\tfinalAttributes := map[string]interface{}{}\n\tfinalSampleSets := map[string]interface{}{}\n\n\t// store all flat attributes in final attributes\n\t// store detected samples in SampleSets\n\tfor key := range data {\n\t\tif !strings.Contains(key, \"Samples\") {\n\t\t\tfinalAttributes[key] = data[key]\n\t\t} else {\n\t\t\tfinalSampleSets[key] = data[key]\n\t\t}\n\t}\n\n\tfinalMergedSamples := []interface{}{}\n\tfor sampleSet := range finalSampleSets {\n\t\tswitch ss := finalSampleSets[sampleSet].(type) {\n\t\tcase []interface{}:\n\t\t\tfor _, sample := range ss {\n\t\t\t\tswitch sample := sample.(type) {\n\t\t\t\tcase map[string]interface{}:\n\t\t\t\t\tnewSample := sample\n\t\t\t\t\tnewSample[\"event_type\"] = sampleSet\n\t\t\t\t\tfor attribute := range finalAttributes {\n\t\t\t\t\t\tnewSample[attribute] = finalAttributes[attribute]\n\t\t\t\t\t}\n\t\t\t\t\tfinalMergedSamples = append(finalMergedSamples, newSample)\n\t\t\t\tdefault:\n\t\t\t\t\tload.Logrus.Debug(\"processor: flattener - not sure what to do with this?\")\n\t\t\t\t\tload.Logrus.Debug(sample)\n\t\t\t\t}\n\t\t\t}\n\t\tcase map[string]interface{}:\n\t\t\tnewSample := ss\n\t\t\tnewSample[\"event_type\"] = sampleSet\n\t\t\tfor attribute := range finalAttributes {\n\t\t\t\tnewSample[attribute] = finalAttributes[attribute]\n\t\t\t}\n\t\t\tfinalMergedSamples = append(finalMergedSamples, newSample)\n\t\t}\n\t}\n\n\tif len(finalMergedSamples) > 0 {\n\t\treturn finalMergedSamples\n\t}\n\n\tfinalMergedSamples = append(finalMergedSamples, finalAttributes)\n\treturn finalMergedSamples\n}", "title": "" }, { "docid": "9ebd3f1d8eaa8b36c62bc7cf7cdece28", "score": "0.50552076", "text": "func (ms *MarkerSet) Merge(other *MarkerSet) *MarkerSet {\n\tswitch {\n\tcase other == nil || other.storage.Size() == 0:\n\t\treturn ms\n\tcase ms == nil || ms.storage.Size() == 0:\n\t\treturn other\n\tdefault:\n\t\tunion := NewMarkerSet()\n\t\tunion.storage.AddAll(ms.storage)\n\t\tunion.storage.AddAll(other.storage)\n\t\treturn union\n\t}\n}", "title": "" }, { "docid": "e4fb7a263bcd48948de331ef615f58b1", "score": "0.5042462", "text": "func (kv *KVv2) PatchMetadata(ctx context.Context, secretPath string, metadata KVMetadataPatchInput) error {\n\tpathToWriteTo := fmt.Sprintf(\"%s/metadata/%s\", kv.mountPath, secretPath)\n\n\tmd, err := toMetadataMap(metadata)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"unable to create map for JSON merge patch request: %w\", err)\n\t}\n\n\t_, err = kv.c.Logical().JSONMergePatch(ctx, pathToWriteTo, md)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"error patching metadata at %s: %w\", pathToWriteTo, err)\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "d96abe80795044d0105cb15cf2b010e6", "score": "0.50407803", "text": "func (kv KV) merge(other KV) {\n\tfor k, v := range other {\n\t\tif _, ok := kv[k]; !ok {\n\t\t\tkv[k] = v\n\t\t}\n\t}\n}", "title": "" }, { "docid": "500a98e3d095938566ea6d6667edf038", "score": "0.5026862", "text": "func mergeUpdates(batch []state.UpdateTime) (out []state.UpdateTime) {\n\tm := make(map[core.BlobID]int) // index in out\n\tfor _, tu := range batch {\n\t\tif i, ok := m[tu.Blob]; ok {\n\t\t\t// merge\n\t\t\tif tu.MTime > out[i].MTime {\n\t\t\t\tout[i].MTime = tu.MTime\n\t\t\t}\n\t\t\tif tu.ATime > out[i].ATime {\n\t\t\t\tout[i].ATime = tu.ATime\n\t\t\t}\n\t\t} else {\n\t\t\t// add\n\t\t\tm[tu.Blob] = len(out)\n\t\t\tout = append(out, tu)\n\t\t}\n\t}\n\treturn\n}", "title": "" }, { "docid": "ac1a488217fc986c14704a91c41ddccf", "score": "0.50259465", "text": "func (mapping *Mapping) Merge(newThing manager.Thing) error {\n\treturn errors.New(\"Not implemented\", errors.NotImplemented, \"mapping.Merge\", true)\n}", "title": "" }, { "docid": "5fef37e62f21697b35fdbda3462b3102", "score": "0.502156", "text": "func (m *AttributeDefinition) SetMetadata(value []AttributeDefinitionMetadataEntryable)() {\n err := m.GetBackingStore().Set(\"metadata\", value)\n if err != nil {\n panic(err)\n }\n}", "title": "" }, { "docid": "873b46fd53d91e6a45dec293e127396d", "score": "0.50118834", "text": "func merge(dst, src *specs.Spec) *specs.Spec {\n\terr := mergo.Merge(dst, src, mergo.WithAppendSlice)\n\tif err != nil {\n\t\tpanic(fmt.Errorf(\n\t\t\t\"failed to merge specs %v %v - programming mistake? %w\",\n\t\t\tdst, src, err,\n\t\t))\n\t}\n\n\treturn dst\n}", "title": "" }, { "docid": "6d28091fab9c2a7d5d0099b1dc86bf19", "score": "0.5011722", "text": "func merge(mergedFile string, archFiles ...string) error {\n\t// extract and validate the GOOS part of the merged filename\n\tgoos, ok := getValidGOOS(mergedFile)\n\tif !ok {\n\t\treturn fmt.Errorf(\"invalid GOOS in merged file name %s\", mergedFile)\n\t}\n\n\t// Read architecture files\n\tvar inSrc []srcFile\n\tfor _, file := range archFiles {\n\t\tsrc, err := ioutil.ReadFile(file)\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"cannot read archfile %s: %w\", file, err)\n\t\t}\n\n\t\tinSrc = append(inSrc, srcFile{file, src})\n\t}\n\n\t// 1. Construct the set of top-level declarations common for all files\n\tcommonSet, err := getCommonSet(inSrc)\n\tif err != nil {\n\t\treturn err\n\t}\n\tif commonSet.isEmpty() {\n\t\t// No common code => do not modify any files\n\t\treturn nil\n\t}\n\n\t// 2. Write the merged file\n\tmergedSrc, err := filter(inSrc[0].src, commonSet.keepCommon)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tf, err := os.Create(mergedFile)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tbuf := bufio.NewWriter(f)\n\tfmt.Fprintln(buf, \"// Code generated by mkmerge.go; DO NOT EDIT.\")\n\tfmt.Fprintln(buf)\n\tfmt.Fprintf(buf, \"// +build %s\\n\", goos)\n\tfmt.Fprintln(buf)\n\tbuf.Write(mergedSrc)\n\n\terr = buf.Flush()\n\tif err != nil {\n\t\treturn err\n\t}\n\terr = f.Close()\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// 3. Remove duplicate declarations from the architecture files\n\tfor _, inFile := range inSrc {\n\t\tsrc, err := filter(inFile.src, commonSet.keepArchSpecific)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\terr = ioutil.WriteFile(inFile.name, src, 0644)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "ac14e99e8811698ecbf0251fa95ed954", "score": "0.50108516", "text": "func (sf *SiaFile) saveMetadata() ([]writeaheadlog.Update, error) {\n\t// Marshal the pubKeyTable.\n\tpubKeyTable, err := marshalPubKeyTable(sf.pubKeyTable)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\t// Sanity check the length of the pubKeyTable to find out if the length of\n\t// the table changed. We should never just save the metadata if the table\n\t// changed as well as it might lead to corruptions.\n\tif sf.staticMetadata.PubKeyTableOffset+int64(len(pubKeyTable)) != sf.staticMetadata.ChunkOffset {\n\t\tpanic(\"never call saveMetadata if the pubKeyTable changed, call saveHeader instead\")\n\t}\n\t// Marshal the metadata.\n\tmetadata, err := marshalMetadata(sf.staticMetadata)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\t// If the header doesn't fit in the space between the beginning of the file\n\t// and the pubKeyTable, we need to call saveHeader since the pubKeyTable\n\t// needs to be moved as well and saveHeader is already handling that\n\t// edgecase.\n\tif int64(len(metadata)) > sf.staticMetadata.PubKeyTableOffset {\n\t\treturn sf.saveHeader()\n\t}\n\t// Otherwise we can create and return the updates.\n\treturn []writeaheadlog.Update{sf.createInsertUpdate(0, metadata)}, nil\n}", "title": "" }, { "docid": "11c7fa1be5896d8b5e02afb91d93ca68", "score": "0.50081766", "text": "func (m Machine) compareMetadata(other Machine) bool {\n\tif len(m.Metadata) != len(other.Metadata) {\n\t\treturn false\n\t}\n\tfor k, v := range m.Metadata {\n\t\tif v != other.Metadata[k] {\n\t\t\treturn false\n\t\t}\n\t}\n\treturn true\n}", "title": "" }, { "docid": "d705f5c218596c031ca915cab6d31e8c", "score": "0.50044245", "text": "func (this *Parser) MergeTags(newTags map[string][]string) {\n\tthis.tags.Import(newTags)\n}", "title": "" }, { "docid": "2d51f48ea3f6cf7441eb12a5a6027797", "score": "0.49884987", "text": "func BetaMetadataUpdate(oldMDMap map[string]interface{}, newMDMap map[string]interface{}, serverMD *compute.Metadata) {\n\ttpgcompute.BetaMetadataUpdate(oldMDMap, newMDMap, serverMD)\n}", "title": "" }, { "docid": "77e1629bf5f58c53004fc611dd815c8a", "score": "0.4979696", "text": "func updateRepoMetadata(repo *Repository, remote *github.Repository) {\n\trepo.HasIssues = *remote.HasIssues\n\trepo.HasWiki = *remote.HasWiki\n\trepo.OpenIssuesCount = *remote.OpenIssuesCount\n\trepo.ForksCount = *remote.ForksCount\n\trepo.WatchersCount = *remote.WatchersCount\n\trepo.UpdatedAt = (*remote.UpdatedAt).Format(\"2006-01-02\")\n\trepo.LastSync = time.Now()\n}", "title": "" }, { "docid": "b409ec671fb67e3263a60e4ace038a50", "score": "0.49786875", "text": "func (c *jsiiProxy_CfnReplicationSubnetGroup) AddMetadata(key *string, value interface{}) {\n\t_jsii_.InvokeVoid(\n\t\tc,\n\t\t\"addMetadata\",\n\t\t[]interface{}{key, value},\n\t)\n}", "title": "" }, { "docid": "022dad4279741d574ee990a8c18132e4", "score": "0.49746656", "text": "func mergeTags(defaultTags, extraTags map[string]string) map[string]string {\n\tnewTags := map[string]string{}\n\n\tfor k, v := range defaultTags {\n\t\tnewTags[k] = v\n\t}\n\tfor k, v := range extraTags {\n\t\tnewTags[k] = v\n\t}\n\n\treturn newTags\n}", "title": "" }, { "docid": "b670cd614f8269b6d319e1780fd2a2b5", "score": "0.4974275", "text": "func (s *SnapshotStore) saveMetadata() error {\n\tbz, err := json.Marshal(s.metadata)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// save the file to a new file and move it to make saving atomic.\n\tnewFile := filepath.Join(s.dir, \"metadata.json.new\")\n\tfile := filepath.Join(s.dir, \"metadata.json\")\n\terr = os.WriteFile(newFile, bz, 0o644) //nolint: gosec\n\tif err != nil {\n\t\treturn err\n\t}\n\treturn os.Rename(newFile, file)\n}", "title": "" }, { "docid": "e799a4086e73042da6e5f940e535d0d5", "score": "0.4969345", "text": "func addMetadata(span *trace.Span, grouping paramtools.Params, leftDigestCount int) {\n\tgroupingStr, _ := json.Marshal(grouping)\n\tspan.AddAttributes(\n\t\ttrace.StringAttribute(\"grouping\", string(groupingStr)),\n\t\ttrace.Int64Attribute(\"additional_digests\", int64(leftDigestCount)))\n}", "title": "" }, { "docid": "873b9f2aad630cfcd3e945d45c19e39e", "score": "0.4968082", "text": "func (vdb *VersionedDB) batchRetrieveMetaData(namespace string, keys []string) error {\n\n\tversionMap := vdb.committedDataCache.committedVersions\n\trevMap := vdb.committedDataCache.revisionNumbers\n\n\tdb, err := vdb.getNamespaceDBHandle(namespace)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tdocumentMetadataArray, err := db.BatchRetrieveDocumentMetadata(keys)\n\n\tif err != nil {\n\t\tlogger.Errorf(\"Batch retrieval of document metadata failed %s\\n\", err.Error())\n\t\treturn err\n\t}\n\n\tfor _, documentMetadata := range documentMetadataArray {\n\n\t\tif len(documentMetadata.Version) != 0 {\n\t\t\tcompositeKey := statedb.CompositeKey{Namespace: namespace, Key: documentMetadata.ID}\n\n\t\t\tvdb.committedDataCache.mux.Lock()\n\t\t\tversionMap[compositeKey] = createVersionHeightFromVersionString(documentMetadata.Version)\n\t\t\trevMap[compositeKey] = documentMetadata.Rev\n\t\t\tvdb.committedDataCache.mux.Unlock()\n\t\t}\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "31c898d0bae603ce3f4ab595b8f18a45", "score": "0.4965018", "text": "func (r *RepoMetadata) MirrorMetadata(sizeCheck bool, concurrent int) {\n\tdata := r.Data\n\n\tfor _, d := range data {\n\t\td.MirrorCond(sizeCheck)\n\t}\n}", "title": "" }, { "docid": "4825e830875b7d18c421c18b1616f75b", "score": "0.49626112", "text": "func mergeDocs(a map[string]interface{}, b map[string]interface{}) (map[string]interface{}, error) {\n\n\tmerged := map[string]interface{}{}\n\tfor k := range a {\n\t\tmerged[k] = a[k]\n\t}\n\n\tfor k := range b {\n\n\t\tadd := b[k]\n\t\texist, ok := merged[k]\n\t\tif !ok {\n\t\t\tmerged[k] = add\n\t\t\tcontinue\n\t\t}\n\n\t\texistObj, existOk := exist.(map[string]interface{})\n\t\taddObj, addOk := add.(map[string]interface{})\n\t\tif !existOk || !addOk {\n\t\t\treturn nil, fmt.Errorf(\"%v: merge error: %T cannot merge into %T\", k, add, exist)\n\t\t}\n\n\t\tmergedObj, err := mergeDocs(existObj, addObj)\n\t\tif err != nil {\n\t\t\treturn nil, errors.Wrapf(err, k)\n\t\t}\n\n\t\tmerged[k] = mergedObj\n\t}\n\n\treturn merged, nil\n}", "title": "" }, { "docid": "0146c2babf83ee8954a4e5e740f6d42b", "score": "0.49596024", "text": "func (h *Handler) buildMetadata() (*Metadata, error) {\n\tvar op internalerrors.Op = \"projectmetadata.Handler.buildMetadata\"\n\tmetadataMap, err := h.buildMetadataMap()\n\tif err != nil {\n\t\treturn nil, internalerrors.E(op, err)\n\t}\n\treturn GenMetadataFromMap(metadataMap)\n}", "title": "" }, { "docid": "51d156b463faf9c4317ffd1c1ff1f7de", "score": "0.49408576", "text": "func (m Metrics) Merge(other Metrics) Metrics {\n\tresult := m.Copy()\n\tfor k, v := range other {\n\t\tresult[k] = result[k].Merge(v)\n\t}\n\treturn result\n}", "title": "" }, { "docid": "d7bed636a8821cb6b345d5afc32d38d3", "score": "0.49333087", "text": "func mergeTags(defaultTags, MetricTags map[string]string) map[string]string {\n\toutput := make(map[string]string)\n\n\tif defaultTags != nil {\n\t\tfor key, value := range defaultTags {\n\t\t\toutput[key] = value\n\t\t}\n\t}\n\n\tif MetricTags != nil {\n\t\tfor key, value := range MetricTags {\n\t\t\toutput[key] = value\n\t\t}\n\t}\n\n\treturn output\n}", "title": "" }, { "docid": "f1c47686e6f807fc81d34be1a8b9b467", "score": "0.49310553", "text": "func metadataEquals(m1, m2 resource.Metadata) bool {\n\tif !strMapEquals(m1.Labels, m2.Labels) || !strMapEquals(m1.Annotations, m2.Annotations) {\n\t\treturn false\n\t}\n\n\treturn true\n}", "title": "" }, { "docid": "4b918ecce4de6fab24781d98be29bb2a", "score": "0.49224395", "text": "func ImportMetadata(ctx context.Context, client gateway.GatewayAPIClient, ns string, fileData FilesMetaData) error {\n\tm := make(map[string]string)\n\tif fileData.Etag != \"\" {\n\t\t// TODO sanitize etag? eg double quotes at beginning and end?\n\t\tm[\"etag\"] = fileData.Etag\n\t}\n\tif fileData.MTime != 0 {\n\t\tm[\"mtime\"] = strconv.Itoa(fileData.MTime)\n\t}\n\t//TODO permissions? is done via share? but this is owner permissions\n\n\tif len(m) > 0 {\n\t\tresourcePath := path.Join(ns, strings.TrimPrefix(fileData.Path, \"/files/\"))\n\t\tsamReq := &storageprovider.SetArbitraryMetadataRequest{\n\t\t\tRef: &storageprovider.Reference{\n\t\t\t\tSpec: &storageprovider.Reference_Path{Path: resourcePath},\n\t\t\t},\n\t\t\tArbitraryMetadata: &storageprovider.ArbitraryMetadata{\n\t\t\t\tMetadata: m,\n\t\t\t},\n\t\t}\n\t\tsamResp, err := client.SetArbitraryMetadata(ctx, samReq)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\tif samResp.Status.Code == rpc.Code_CODE_NOT_FOUND {\n\t\t\tlog.Print(\"File does not exist on target system, skipping metadata import: \" + resourcePath)\n\t\t}\n\t\tif samResp.Status.Code != rpc.Code_CODE_OK {\n\t\t\tlog.Print(\"Error importing metadata, skipping metadata import: \" + resourcePath + \", \" + samResp.Status.Message)\n\t\t}\n\t} else {\n\t\tlog.Print(\"no etag or mtime for : \" + fileData.Path)\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "17d3366014b4c3f60d543a4414d608db", "score": "0.4920929", "text": "func mergeYAML(a []byte, b []byte) (outyaml []byte) {\n\t// split config into multiple config delimited by ---\n\tasplit := RegSplit(string(a), \"(?m:^[-]{3,})\")\n\tbsplit := RegSplit(string(b), \"(?m:^[-]{3,})\")\n\tunuseds := make([]string, len(asplit)) // tell if there is some unused configs\n\tcopy(unuseds, asplit)\n\tfor _, cb := range bsplit {\n\t\tyamlb, nb, kb := parseConfig(cb)\n\t\tismerged := false // try to merge ca with cb if matched\n\t\tfor _, ca := range asplit { // should cache ca\n\t\t\tyamla, na, ka := parseConfig(ca)\n\t\t\tif na != nb || ka != kb {\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tunuseds = removeString(unuseds, ca)\n\t\t\tret := mergeStruct(yamla, yamlb)\n\t\t\tmergedyaml, err := yaml.Marshal(ret)\n\t\t\tif err != nil {\n\t\t\t\tpanic(err)\n\t\t\t}\n\t\t\toutyaml = append(outyaml, \"\\n---\\n\"...)\n\t\t\toutyaml = append(outyaml, mergedyaml...)\n\t\t\tismerged = true\n\t\t\tbreak\n\t\t}\n\n\t\tif !ismerged { // still keep if not match\n\t\t\toutyaml = append(outyaml, (\"\\n---\\n\" + cb)...)\n\t\t}\n\t}\n\n\tfor _, unused := range unuseds {\n\t\tif unused != \"\" {\n\t\t\t_, name, kind := parseConfig(unused)\n\t\t\tfmt.Printf(\"WARN: unused config kind %s, name %s\\n\", kind, name)\n\t\t}\n\t}\n\treturn\n}", "title": "" }, { "docid": "53326aa1540a1aeba5c1643925118b4a", "score": "0.49179658", "text": "func (i *IndexFile) Merge(f *IndexFile) {\n\tfor _, cvs := range f.Entries {\n\t\tfor _, cv := range cvs {\n\t\t\tif !i.Has(cv.Name, cv.Version) {\n\t\t\t\te := i.Entries[cv.Name]\n\t\t\t\ti.Entries[cv.Name] = append(e, cv)\n\t\t\t}\n\t\t}\n\t}\n}", "title": "" }, { "docid": "53326aa1540a1aeba5c1643925118b4a", "score": "0.49179658", "text": "func (i *IndexFile) Merge(f *IndexFile) {\n\tfor _, cvs := range f.Entries {\n\t\tfor _, cv := range cvs {\n\t\t\tif !i.Has(cv.Name, cv.Version) {\n\t\t\t\te := i.Entries[cv.Name]\n\t\t\t\ti.Entries[cv.Name] = append(e, cv)\n\t\t\t}\n\t\t}\n\t}\n}", "title": "" }, { "docid": "a9e82f2d4de5e364bd8e40e522e6be75", "score": "0.49177188", "text": "func (c *ComponentMetadata) AppendBuiltin() error {\n\tcompType := mdutils.ComponentType(c.Type)\n\tswitch compType {\n\tcase mdutils.StateStoreType:\n\t\tif c.Metadata == nil {\n\t\t\tc.Metadata = []Metadata{}\n\t\t}\n\n\t\tif slices.Contains(c.Capabilities, \"actorStateStore\") {\n\t\t\tc.Metadata = append(c.Metadata,\n\t\t\t\tMetadata{\n\t\t\t\t\tName: \"actorStateStore\",\n\t\t\t\t\tType: \"bool\",\n\t\t\t\t\tDescription: \"Use this state store for actors. Defaults to `false`.\",\n\t\t\t\t\tExample: `\"false\"`,\n\t\t\t\t},\n\t\t\t)\n\t\t}\n\n\t\tc.Metadata = append(c.Metadata,\n\t\t\tMetadata{\n\t\t\t\tName: \"keyPrefix\",\n\t\t\t\tType: \"string\",\n\t\t\t\tDescription: \"Prefix added to keys in the state store.\",\n\t\t\t\tExample: `\"appid\"`,\n\t\t\t\tDefault: \"appid\",\n\t\t\t\tURL: &URL{\n\t\t\t\t\tTitle: \"Documentation\",\n\t\t\t\t\tURL: \"https://docs.dapr.io/developing-applications/building-blocks/state-management/howto-share-state/\",\n\t\t\t\t},\n\t\t\t},\n\t\t)\n\tcase mdutils.LockStoreType:\n\t\tif c.Metadata == nil {\n\t\t\tc.Metadata = []Metadata{}\n\t\t}\n\t\tc.Metadata = append(c.Metadata,\n\t\t\tMetadata{\n\t\t\t\tName: \"keyPrefix\",\n\t\t\t\tType: \"string\",\n\t\t\t\tDescription: \"Prefix added to keys in the state store.\",\n\t\t\t\tExample: `\"appid\"`,\n\t\t\t\tDefault: \"appid\",\n\t\t\t},\n\t\t)\n\tcase mdutils.PubSubType:\n\t\tif c.Metadata == nil {\n\t\t\tc.Metadata = []Metadata{}\n\t\t}\n\t\tc.Metadata = append(c.Metadata,\n\t\t\tMetadata{\n\t\t\t\tName: \"consumerID\",\n\t\t\t\tType: \"string\",\n\t\t\t\tDescription: \"Set the consumer ID to control namespacing. Defaults to the app's ID.\",\n\t\t\t\tExample: `\"{namespace}\"`,\n\t\t\t\tURL: &URL{\n\t\t\t\t\tTitle: \"Documentation\",\n\t\t\t\t\tURL: \"https://docs.dapr.io/developing-applications/building-blocks/pubsub/howto-namespace/\",\n\t\t\t\t},\n\t\t\t},\n\t\t\tMetadata{\n\t\t\t\tName: \"allowedTopics\",\n\t\t\t\tType: \"string\",\n\t\t\t\tDescription: \"A comma-separated list of allowed topics for all applications. If empty (default) apps can publish and subscribe to all topics, notwithstanding `publishingScopes` and `subscriptionScopes`.\",\n\t\t\t\tExample: `\"app1=topic1;app2=topic2,topic3\"`,\n\t\t\t\tURL: &URL{\n\t\t\t\t\tTitle: \"Documentation\",\n\t\t\t\t\tURL: \"https://docs.dapr.io/developing-applications/building-blocks/pubsub/pubsub-scopes/\",\n\t\t\t\t},\n\t\t\t},\n\t\t\tMetadata{\n\t\t\t\tName: \"publishingScopes\",\n\t\t\t\tType: \"string\",\n\t\t\t\tDescription: \"A semicolon-separated list of applications and comma-separated topic lists, allowing that app to publish to that list of topics. If empty (default), apps can publish to all topics.\",\n\t\t\t\tExample: `\"app1=topic1;app2=topic2,topic3;app3=\"`,\n\t\t\t\tURL: &URL{\n\t\t\t\t\tTitle: \"Documentation\",\n\t\t\t\t\tURL: \"https://docs.dapr.io/developing-applications/building-blocks/pubsub/pubsub-scopes/\",\n\t\t\t\t},\n\t\t\t},\n\t\t\tMetadata{\n\t\t\t\tName: \"subscriptionScopes\",\n\t\t\t\tType: \"string\",\n\t\t\t\tDescription: \"A semicolon-separated list of applications and comma-separated topic lists, allowing that app to subscribe to that list of topics. If empty (default), apps can subscribe to all topics.\",\n\t\t\t\tExample: `\"app1=topic1;app2=topic2,topic3\"`,\n\t\t\t\tURL: &URL{\n\t\t\t\t\tTitle: \"Documentation\",\n\t\t\t\t\tURL: \"https://docs.dapr.io/developing-applications/building-blocks/pubsub/pubsub-scopes/\",\n\t\t\t\t},\n\t\t\t},\n\t\t\tMetadata{\n\t\t\t\tName: \"protectedTopics\",\n\t\t\t\tType: \"string\",\n\t\t\t\tDescription: `A comma-separated list of topics marked as \"protected\" for all applications. If a topic is marked as protected then an application must be explicitly granted publish or subscribe permissions through 'publishingScopes' or 'subscriptionScopes' to publish or subscribe to it.`,\n\t\t\t\tExample: `\"topic1,topic2\"`,\n\t\t\t\tURL: &URL{\n\t\t\t\t\tTitle: \"Documentation\",\n\t\t\t\t\tURL: \"https://docs.dapr.io/developing-applications/building-blocks/pubsub/pubsub-scopes/\",\n\t\t\t\t},\n\t\t\t},\n\t\t)\n\tcase mdutils.BindingType:\n\t\tif c.Binding != nil {\n\t\t\tif c.Metadata == nil {\n\t\t\t\tc.Metadata = []Metadata{}\n\t\t\t}\n\n\t\t\tif c.Binding.Input {\n\t\t\t\tdirection := bindingDirectionInput\n\t\t\t\tallowedValues := []string{\n\t\t\t\t\tbindingDirectionInput,\n\t\t\t\t}\n\n\t\t\t\tif c.Binding.Output {\n\t\t\t\t\tdirection = fmt.Sprintf(\"%s,%s\", bindingDirectionInput, bindingDirectionOutput)\n\t\t\t\t\tallowedValues = append(allowedValues, bindingDirectionOutput, direction)\n\t\t\t\t}\n\n\t\t\t\tc.Metadata = append(c.Metadata,\n\t\t\t\t\tMetadata{\n\t\t\t\t\t\tName: bindingDirectionMetadataKey,\n\t\t\t\t\t\tType: \"string\",\n\t\t\t\t\t\tDescription: \"Indicates the direction of the binding component.\",\n\t\t\t\t\t\tExample: `\"` + direction + `\"`,\n\t\t\t\t\t\tURL: &URL{\n\t\t\t\t\t\t\tTitle: \"Documentation\",\n\t\t\t\t\t\t\tURL: \"https://docs.dapr.io/reference/api/bindings_api/#binding-direction-optional\",\n\t\t\t\t\t\t},\n\t\t\t\t\t\tAllowedValues: allowedValues,\n\t\t\t\t\t},\n\t\t\t\t)\n\n\t\t\t\tc.Metadata = append(c.Metadata,\n\t\t\t\t\tMetadata{\n\t\t\t\t\t\tName: bindingRouteMetadataKey,\n\t\t\t\t\t\tType: \"string\",\n\t\t\t\t\t\tDescription: \"Specifies a custom route for incoming events.\",\n\t\t\t\t\t\tExample: `\"/custom-path\"`,\n\t\t\t\t\t\tURL: &URL{\n\t\t\t\t\t\t\tTitle: \"Documentation\",\n\t\t\t\t\t\t\tURL: \"https://docs.dapr.io/developing-applications/building-blocks/bindings/howto-triggers/#specifying-a-custom-route\",\n\t\t\t\t\t\t},\n\t\t\t\t\t},\n\t\t\t\t)\n\t\t\t}\n\t\t}\n\t}\n\n\t// Sanity check to ensure the data is in sync\n\tbuiltin := compType.BuiltInMetadataProperties()\n\tallKeys := make(map[string]struct{}, len(c.Metadata))\n\tfor _, v := range c.Metadata {\n\t\tallKeys[v.Name] = struct{}{}\n\t}\n\tfor _, k := range builtin {\n\t\t_, ok := allKeys[k]\n\t\tif k == \"actorStateStore\" {\n\t\t\thasCapability := slices.Contains(c.Capabilities, \"actorStateStore\")\n\t\t\tif hasCapability && !ok {\n\t\t\t\treturn errors.New(\"expected to find built-in property 'actorStateStore'\")\n\t\t\t} else if !hasCapability && ok {\n\t\t\t\treturn errors.New(\"found property 'actorStateStore' in component that does not have the 'actorStateStore' capability\")\n\t\t\t}\n\t\t} else if !ok {\n\t\t\treturn fmt.Errorf(\"expected to find built-in property %s\", k)\n\t\t}\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "358c14cb69f7ad248939cbf709b620e8", "score": "0.49159232", "text": "func merge(source, target *seiteki.Config) {\n\tif source == nil {\n\t\treturn\n\t}\n\n\tif source.Addr != \"\" {\n\t\ttarget.Addr = source.Addr\n\t}\n\tif source.CacheDuration != \"\" {\n\t\ttarget.CacheDuration = source.CacheDuration\n\t}\n\tif source.CertFile != \"\" {\n\t\ttarget.CertFile = source.CertFile\n\t}\n\tif source.Compress {\n\t\ttarget.Compress = source.Compress\n\t}\n\tif source.IndexFile != \"\" {\n\t\ttarget.IndexFile = source.IndexFile\n\t}\n\tif source.KeyFile != \"\" {\n\t\ttarget.KeyFile = source.KeyFile\n\t}\n\tif source.StaticDir != \"\" {\n\t\ttarget.StaticDir = source.StaticDir\n\t}\n\tif source.RouteMode != \"\" {\n\t\ttarget.RouteMode = source.RouteMode\n\t}\n}", "title": "" }, { "docid": "e0429e17c9bd331fed94fd8588b4a66f", "score": "0.4906288", "text": "func mergeItems(primary ApplicationData, secondary ApplicationData) ApplicationData {\n\tmerged := primary\n\tif primary.ApplicationType == \"\" {\n\t\tmerged.ApplicationType = secondary.ApplicationType\n\t}\n\tif primary.Architecture == \"\" {\n\t\tmerged.Architecture = secondary.Architecture\n\t}\n\tif primary.CompType == ComponentType(0) {\n\t\tmerged.CompType = secondary.CompType\n\t}\n\tif primary.InstalledTime == \"\" {\n\t\tmerged.InstalledTime = secondary.InstalledTime\n\t}\n\tif primary.Publisher == \"\" {\n\t\tmerged.Publisher = secondary.Publisher\n\t}\n\tif primary.URL == \"\" {\n\t\tmerged.URL = secondary.URL\n\t}\n\treturn merged\n}", "title": "" }, { "docid": "b418a229359ea47a2574fe9c409585fb", "score": "0.4900713", "text": "func updateMeta(ctx *base.Context, filename string) error {\n\t// TODO: For some situations (older format repos) we should use\n\t// meta.Sha256 instead of re-hashing.\n\tfmt.Printf(\"hashing... \")\n\thash, err := base.GetSha256(filename)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"getting sha256: %w\", err)\n\t}\n\n\terr = createHardLinkIfNeeded(ctx, filename, hash)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"creating hard link: %w\", err)\n\t}\n\n\terr = writeFileMeta(ctx, filename, hash)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"writing file metadata: %w\", err)\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "b82dbe00616f2ce84edd8adc04590564", "score": "0.4892669", "text": "func Merge(a, b *Config) {\n\tif b.AlbumTitle != \"\" {\n\t\ta.AlbumTitle = b.AlbumTitle\n\t}\n\tif b.AlbumDir != \"\" {\n\t\ta.AlbumDir = b.AlbumDir\n\t}\n\n\tif b.BodyArgs != \"\" {\n\t\ta.BodyArgs = b.BodyArgs\n\t}\n\n\tif b.ThumbnailUse != \"\" {\n\t\ta.ThumbnailUse = b.ThumbnailUse\n\t}\n\n\tif b.ThumbnailWidth > 0 {\n\t\ta.ThumbnailWidth = b.ThumbnailWidth\n\t}\n\n\tif b.ThumbnailAspect != \"\" {\n\t\ta.ThumbnailAspect = b.ThumbnailAspect\n\t}\n\n\tif b.ThumbDir != \"\" {\n\t\ta.ThumbDir = b.ThumbDir\n\t}\n\n\tif b.SlideShowDelay > 0 {\n\t\ta.SlideShowDelay = b.SlideShowDelay\n\t}\n\n\tif b.NumberOfColumns > 0 {\n\t\ta.NumberOfColumns = b.NumberOfColumns\n\t}\n\n\tif b.EditMode {\n\t\ta.EditMode = true\n\t}\n\n\tif b.AllowFinalResize {\n\t\ta.AllowFinalResize = true\n\t}\n\tif b.ReverseDirs {\n\t\ta.ReverseDirs = true\n\t}\n\n\tif b.ReversePics {\n\t\ta.ReversePics = true\n\t}\n}", "title": "" }, { "docid": "edf72e785828e3dc93646a534cbbb249", "score": "0.48883298", "text": "func (pf *ParsedFile) parseMetadata() (err error) {\n\tvar count int\n\n\tfor pf.scanner.Scan() {\n\t\tcount++\n\t\tline := pf.scanner.Text()\n\n\t\t// In case that the metadata starts like :date:\n\t\tif strings.HasPrefix(line, \":\") {\n\t\t\tline = line[1:]\n\t\t}\n\t\tmetadataSplited := strings.Split(line, \":\")\n\t\tkey := strings.ToLower(metadataSplited[0])\n\t\tvalue := strings.Trim(strings.Join(metadataSplited[1:], \":\"), \" \")\n\n\t\tswitch key {\n\t\tcase \"---\":\n\t\t\t// If the metadata is enclosed between lines like this: '---'\n\t\t\t// (Jekyll style) we need to return after process it.\n\t\t\tif count > 1 {\n\t\t\t\tgoto END\n\t\t\t}\n\t\tcase \"tags\":\n\t\t\t// Remove all the spaces between comma and tag and\n\t\t\t// add one comma at the beginning and other at the end, this will\n\t\t\t// make the querying much simpler\n\t\t\tfor _, tag := range strings.Split(value, \",\") {\n\t\t\t\tpf.Tags = append(pf.Tags, strings.Replace(tag, \" \", \"\", -1))\n\t\t\t}\n\t\tcase \"date\":\n\t\t\tpf.Date, err = parseDate(value)\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\tcase \"slug\":\n\t\t\tprefix := \"/\"\n\t\t\tif strings.HasPrefix(value, \"/\") {\n\t\t\t\tprefix = \"\" // Just to be sure that we don't duplicate the /\n\t\t\t}\n\t\t\tsuffix := \".html\"\n\t\t\tif strings.HasSuffix(value, \".html\") || strings.HasSuffix(value, \".html\") {\n\t\t\t\tsuffix = \"\" // And don't duplicate the html either\n\t\t\t}\n\t\t\tpf.Slug = fmt.Sprintf(\"%s%s%s\", prefix, value, suffix)\n\t\tcase \"status\":\n\t\t\tpf.status = value\n\t\tcase \"summary\":\n\t\t\tpf.summary = value\n\t\tcase \"author\":\n\t\t\tpf.Author = value\n\t\tcase \"title\":\n\t\t\tpf.Title = value\n\t\tdefault:\n\t\t\tgoto END\n\t\t}\n\t}\n\nEND:\n\t// TODO: not the best way to check this. Find a cleaner way.\n\tallUnset := func() bool {\n\t\treturn (pf.Tags == nil && pf.Date.IsZero() && pf.Slug == \"\" && pf.status == \"\" && pf.Summary == \"\" && pf.Author == \"\" && pf.Title == \"\")\n\t}\n\tif count <= 2 && allUnset() {\n\t\treturn NoMetadataFound\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "67fb4217e00c33d64bd44ba36145cfa7", "score": "0.48849022", "text": "func (i *imageMeta) Union(other *imageMeta) {\n\tif other.Repository != \"\" {\n\t\ti.Repository = other.Repository\n\t}\n\tif other.Tag != \"\" {\n\t\ti.Tag = other.Tag\n\t}\n}", "title": "" }, { "docid": "3d3827331029fabf0e7bf6553e62339c", "score": "0.48816276", "text": "func (r RelationMap) Merge(other RelationMap) {\n\tfor fqn, relations := range other {\n\t\tfor otherFQN := range relations {\n\t\t\tr.Relate(fqn, otherFQN)\n\t\t}\n\t}\n}", "title": "" }, { "docid": "8f738c0d0b861307f1d66dee365d4046", "score": "0.4875076", "text": "func (p *FileLinkParams) AddMetadata(key string, value string) {\n\tif p.Metadata == nil {\n\t\tp.Metadata = make(map[string]string)\n\t}\n\n\tp.Metadata[key] = value\n}", "title": "" }, { "docid": "f7bdc2c8e7aecbca7d1203c6023534b8", "score": "0.48722813", "text": "func mergeSections(a, b Section) Section {\n\tfor bk, ba := range b.Aliases {\n\t\t// Section b's alias overwrites the existing alias in Section a\n\t\tif _, ok := a.Aliases[bk]; ok {\n\t\t\tlog.Infof(\"Redefined alias found: %v\", bk)\n\t\t}\n\t\ta.Aliases[bk] = ba\n\t}\n\treturn a\n}", "title": "" }, { "docid": "7fd51b3951ea4edd922fd7ea14905679", "score": "0.48680198", "text": "func UnmarshalMetadata(source interface{}) (object *Metadata, err error) {\n\titerator, err := helpers.NewIterator(source)\n\tif err != nil {\n\t\treturn\n\t}\n\tobject = readMetadata(iterator)\n\terr = iterator.Error\n\treturn\n}", "title": "" }, { "docid": "169e6f331fb5ba907438faf6772e2608", "score": "0.4866533", "text": "func (ccm *ContractChaincodeMetadata) Append(source ContractChaincodeMetadata) {\n\tif ccm.Info == nil {\n\t\tccm.Info = source.Info\n\t}\n\n\tif len(ccm.Contracts) == 0 {\n\t\tif ccm.Contracts == nil {\n\t\t\tccm.Contracts = make(map[string]ContractMetadata)\n\t\t}\n\n\t\tfor key, value := range source.Contracts {\n\t\t\tccm.Contracts[key] = value\n\t\t}\n\t}\n\n\tif reflect.DeepEqual(ccm.Components, ComponentMetadata{}) {\n\t\tccm.Components = source.Components\n\t}\n}", "title": "" }, { "docid": "2e1b3ec1ccb03a9f8a1ba4c576d087e7", "score": "0.48623005", "text": "func SetMetadata(m fyne.AppMetadata) {\n\tmeta = m\n\n\tif meta.Custom == nil {\n\t\tmeta.Custom = map[string]string{}\n\t}\n}", "title": "" }, { "docid": "f6308d5e573cb107f29e785c1038f9a1", "score": "0.48519543", "text": "func UnmarshalImportOfferingBodyMetadata(m map[string]json.RawMessage, result interface{}) (err error) {\n\tobj := new(ImportOfferingBodyMetadata)\n\terr = core.UnmarshalModel(m, \"operating_system\", &obj.OperatingSystem, UnmarshalImportOfferingBodyMetadataOperatingSystem)\n\tif err != nil {\n\t\treturn\n\t}\n\terr = core.UnmarshalModel(m, \"file\", &obj.File, UnmarshalImportOfferingBodyMetadataFile)\n\tif err != nil {\n\t\treturn\n\t}\n\terr = core.UnmarshalPrimitive(m, \"minimum_provisioned_size\", &obj.MinimumProvisionedSize)\n\tif err != nil {\n\t\treturn\n\t}\n\terr = core.UnmarshalModel(m, \"images\", &obj.Images, UnmarshalImportOfferingBodyMetadataImagesItem)\n\tif err != nil {\n\t\treturn\n\t}\n\treflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj))\n\treturn\n}", "title": "" }, { "docid": "a824d0369502c05ad5d4503df4fce3ea", "score": "0.48409086", "text": "func (fs *MemFS) merge(l *memLayer) error {\n\tfs.layers = append(fs.layers, l)\n\n\tif err := l.rangeFiles(func(f memFile) error {\n\t\treturn f.updateMemFS(fs.tree)\n\t}); err != nil {\n\t\treturn fmt.Errorf(\"range files: %s\", err)\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "c7c949747ce6f11c5de4feb1104837e4", "score": "0.4832717", "text": "func Merge(appname string, outputFile string) error {\n\tappname, cleanup, err := Extract(appname)\n\tif err != nil {\n\t\treturn err\n\t}\n\tdefer cleanup()\n\tvar target io.Writer\n\tif outputFile == \"-\" {\n\t\ttarget = os.Stdout\n\t} else {\n\t\ttarget, err = os.Create(outputFile)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tdefer target.(io.WriteCloser).Close()\n\t}\n\tnames := []string{\"metadata.yml\", \"docker-compose.yml\", \"settings.yml\"}\n\tfor i, n := range names {\n\t\tinput, err := ioutil.ReadFile(filepath.Join(appname, n))\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\ttarget.Write(input)\n\t\tif i != 2 {\n\t\t\tio.WriteString(target, \"\\n--\\n\")\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "4e831843818c91f15e9514e10c337670", "score": "0.4828602", "text": "func (g *Node) UpdateMetadata(md []byte) {\n\tg.disc.UpdateMetadata(md)\n}", "title": "" }, { "docid": "ffab2d12a929f1058804e7518fd82862", "score": "0.48189437", "text": "func (m *Mount) addMetadata(path string, md metadata.Metadata) error {\n\tif err := md.CheckValidity(); err != nil {\n\t\treturn errors.Wrap(ErrInvalidMetadata, err.Error())\n\t}\n\n\tdata, err := proto.Marshal(md)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tlog.Printf(\"writing metadata to %q\", path)\n\treturn m.writeDataAtomic(path, data)\n}", "title": "" }, { "docid": "834518db7d1bb6e48a7c9b567cd42772", "score": "0.4816884", "text": "func (m *Mount) RemoveAllMetadata() error {\n\tif err := m.CheckSetup(); err != nil {\n\t\treturn err\n\t}\n\t// temp will hold the old metadata temporarily\n\ttemp, err := m.tempMount()\n\tif err != nil {\n\t\treturn m.err(err)\n\t}\n\tdefer os.RemoveAll(temp.Path)\n\n\t// Move directory into temp (to be destroyed on defer)\n\treturn m.err(os.Rename(m.BaseDir(), temp.BaseDir()))\n}", "title": "" }, { "docid": "e89ba885d31bd2c623d53d99e997d8d8", "score": "0.48143947", "text": "func (bag MetricsBag) Merge(other MetricsBag) {\n\tfor key, val := range other {\n\t\tswitch key[0] {\n\t\tcase 'c', 'd':\n\t\t\t// Counters and deltas should be summed\n\t\t\tif _, ok := bag[key]; !ok {\n\t\t\t\tbag[key] = int64(0)\n\t\t\t}\n\t\t\tbag[key] = bag[key].(int64) + val.(int64)\n\t\tcase 'g':\n\t\t\t// Gauges must be averaged\n\t\t\tif _, ok := bag[key]; !ok {\n\t\t\t\tbag[key] = val.(float64)\n\t\t\t}\n\t\t\tbag[key] = (bag[key].(float64) + val.(float64)) / 2\n\n\t\tcase 'h':\n\t\t\t// Histograms are concatenated\n\t\t\tif _, ok := bag[key]; !ok {\n\t\t\t\tbag[key] = []float64{}\n\t\t\t}\n\t\t\tbag[key] = append(bag[key].([]float64), val.([]float64)...)\n\n\t\tcase 't':\n\t\t\t// timings are concatenated\n\t\t\tif _, ok := bag[key]; !ok {\n\t\t\t\tbag[key] = []time.Duration{}\n\t\t\t}\n\t\t\tbag[key] = append(bag[key].([]time.Duration), val.([]time.Duration)...)\n\n\t\tdefault:\n\t\t\tpanic(fmt.Errorf(\"unsupported key %q\", key))\n\t\t}\n\t}\n}", "title": "" }, { "docid": "e0171da7977aee8daa41d36d617555b4", "score": "0.48097104", "text": "func (c *jsiiProxy_CfnUserPoolUserToGroupAttachment) AddMetadata(key *string, value interface{}) {\n\t_jsii_.InvokeVoid(\n\t\tc,\n\t\t\"addMetadata\",\n\t\t[]interface{}{key, value},\n\t)\n}", "title": "" }, { "docid": "fe73c236a7fe49ac0327e733f8eea833", "score": "0.48037088", "text": "func (h *Headers) Merge(h2 Headers) {\n\tif h.vals == nil {\n\t\th.vals = map[string]string{}\n\t}\n\tif h2.vals == nil {\n\t\treturn\n\t}\n\tfor k, v := range h2.vals {\n\t\th.vals[k] = v\n\t}\n}", "title": "" }, { "docid": "17aae654f5590facb8189ad961ad362f", "score": "0.4802408", "text": "func (h *Handler) WriteMetadata(files map[string][]byte) error {\n\tvar op internalerrors.Op = \"projectmetadata.Handler.WriteMetadata\"\n\tfor name, content := range files {\n\t\tfs := afero.NewOsFs()\n\t\tif err := fs.MkdirAll(filepath.Dir(name), os.ModePerm); err != nil {\n\t\t\treturn internalerrors.E(op, err)\n\t\t}\n\t\terr := afero.WriteFile(fs, name, content, 0644)\n\t\tif err != nil {\n\t\t\treturn internalerrors.E(op, fmt.Errorf(\"creating metadata file %s failed: %w\", name, err))\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "3cd1f0ce5ce85e77723ed7416a288827", "score": "0.48016304", "text": "func (r *Result) Merge(other *Result) {\n\tr.Cluster = append(r.Cluster, other.Cluster...)\n\tr.Velero = append(r.Velero, other.Velero...)\n\tfor k, v := range other.Namespaces {\n\t\tif r.Namespaces == nil {\n\t\t\tr.Namespaces = make(map[string][]string)\n\t\t}\n\t\tr.Namespaces[k] = append(r.Namespaces[k], v...)\n\t}\n}", "title": "" }, { "docid": "22a3dde71f290657e7932b6a0e6015d7", "score": "0.48009604", "text": "func (r *RPCTask) Metadata(m map[string]string) {\n\tr.updateTaskLogs(&pbf.UpdateTaskLogsRequest{\n\t\tId: r.taskID,\n\t\tTaskLog: &tes.TaskLog{\n\t\t\tMetadata: m,\n\t\t},\n\t})\n}", "title": "" }, { "docid": "2ebaa836b1e019ea9fadeaf920b80222", "score": "0.48008272", "text": "func writeMetadata(config map[string]string, migrations []string) {\n\n\tfor _, m := range migrations {\n\t\tsql := \"Insert into fragmenta_metadata(updated_at,fragmenta_version,migration_version,status) VALUES(NOW(),$1,$2,100);\"\n\t\tresult, err := query.ExecSQL(sql, fragmentaVersion, m)\n\t\tif err != nil {\n\t\t\tlog.Printf(\"Database ERROR %s %s\", err, result)\n\t\t}\n\t}\n\n}", "title": "" }, { "docid": "12081e593010632ae61d916f8bde2003", "score": "0.4796461", "text": "func (p *PaymentIntentPaymentMethodDataParams) AddMetadata(key string, value string) {\n\tif p.Metadata == nil {\n\t\tp.Metadata = make(map[string]string)\n\t}\n\n\tp.Metadata[key] = value\n}", "title": "" }, { "docid": "7088f7238b0ca24c91841c6879dcbf44", "score": "0.47959757", "text": "func (c *jsiiProxy_CfnXssMatchSet) AddMetadata(key *string, value interface{}) {\n\t_jsii_.InvokeVoid(\n\t\tc,\n\t\t\"addMetadata\",\n\t\t[]interface{}{key, value},\n\t)\n}", "title": "" } ]
e89be585d1a22efba4e65ff3068ef51a
Get the list of authorizations.
[ { "docid": "16e96514ca9c9882a8355c1785dccc42", "score": "0.7124509", "text": "func (c *Itsyouonline) GetAllAuthorizations(username string, headers, queryParams map[string]interface{}) ([]Authorization, *http.Response, error) {\n\tqsParam := buildQueryString(queryParams)\n\tvar u []Authorization\n\n\t// create request object\n\treq, err := http.NewRequest(\"GET\", rootURL+\"/users/\"+username+\"/authorizations\"+qsParam, nil)\n\tif err != nil {\n\t\treturn u, nil, err\n\t}\n\n\tif c.AuthHeader != \"\" {\n\t\treq.Header.Set(\"Authorization\", c.AuthHeader)\n\t}\n\n\tfor k, v := range headers {\n\t\treq.Header.Set(k, fmt.Sprintf(\"%v\", v))\n\t}\n\n\t//do the request\n\tresp, err := c.client.Do(req)\n\tif err != nil {\n\t\treturn u, nil, err\n\t}\n\tdefer resp.Body.Close()\n\n\treturn u, resp, json.NewDecoder(resp.Body).Decode(&u)\n}", "title": "" } ]
[ { "docid": "3631d4161ad3c62209b11e1751f89ae5", "score": "0.76021975", "text": "func (a *AccountAuthorizations) GetAuthorizations() (value []Authorization) {\n\tif a == nil {\n\t\treturn\n\t}\n\treturn a.Authorizations\n}", "title": "" }, { "docid": "2a04e7f6a3c168e0d6ad1da63cf1292f", "score": "0.6805187", "text": "func (c *Client) GetAuthorizations(order *protocol.Order) ([]*protocol.Authorization, error) {\n\tr := make([]*protocol.Authorization, len(order.AuthorizationURLs))\n\n\tfor i, v := range order.AuthorizationURLs {\n\t\tauth, err := protocol.GetAuthorization(v)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\n\t\tr[i] = auth\n\t}\n\n\treturn r, nil\n}", "title": "" }, { "docid": "9051b50419fd326b3dcfadf1a8a0123c", "score": "0.657385", "text": "func (c *Client) AccountGetAuthorizations(ctx context.Context) (*AccountAuthorizations, error) {\n\tvar result AccountAuthorizations\n\n\trequest := &AccountGetAuthorizationsRequest{}\n\tif err := c.rpc.Invoke(ctx, request, &result); err != nil {\n\t\treturn nil, err\n\t}\n\treturn &result, nil\n}", "title": "" }, { "docid": "04631300a591d0b0768368f2372ab383", "score": "0.62372375", "text": "func (s *cacheService) Authorities() ([]Authority, error) {\n\ts.mutex.Lock()\n\tdefer s.mutex.Unlock()\n\n\tif len(s.authorities) > 0 {\n\t\treturn s.authorities, nil\n\t}\n\tres, err := s.service.Authorities()\n\tif err == nil {\n\t\ts.authorities = res\n\t}\n\treturn res, err\n}", "title": "" }, { "docid": "b13b771c149be128ad895d62987f2a20", "score": "0.61610043", "text": "func (c *Client) Organizations() gitprovider.OrganizationsClient {\n\treturn c.orgs\n}", "title": "" }, { "docid": "f8a5471804e7bfb2ef639ba2eec02930", "score": "0.6160899", "text": "func (c *organizations) List() ([]types.Organization, error) {\n\tpath := \"/v3/organizations\"\n\tout := make([]types.Organization, 0)\n\treturn out, c.client.Get(path, &out)\n}", "title": "" }, { "docid": "7a3a5d84ab5cefe342d4e452cf8d7f91", "score": "0.6105154", "text": "func (o *User) GetAuthorities() []GrantedAuthority {\n\tif o == nil || o.Authorities == nil {\n\t\tvar ret []GrantedAuthority\n\t\treturn ret\n\t}\n\treturn *o.Authorities\n}", "title": "" }, { "docid": "42d92d16da720ded85305b74702877a3", "score": "0.5975819", "text": "func (a *AuthCommand) ListAuthorities(client *auth.TunClient) error {\n\t// by default show authorities of both types:\n\tauthTypes := []services.CertAuthType{\n\t\tservices.UserCA,\n\t\tservices.HostCA,\n\t}\n\t// but if there was a --type switch, only select those:\n\tif a.authType != \"\" {\n\t\tauthTypes = []services.CertAuthType{services.CertAuthType(a.authType)}\n\t\tif err := authTypes[0].Check(); err != nil {\n\t\t\treturn trace.Wrap(err)\n\t\t}\n\t}\n\tlocalAuthName, err := client.GetDomainName()\n\tif err != nil {\n\t\treturn trace.Wrap(err)\n\t}\n\tvar (\n\t\tlocalCAs []*services.CertAuthority\n\t\ttrustedCAs []*services.CertAuthority\n\t)\n\tfor _, t := range authTypes {\n\t\tcas, err := client.GetCertAuthorities(t, false)\n\t\tif err != nil {\n\t\t\treturn trace.Wrap(err)\n\t\t}\n\t\tfor i := range cas {\n\t\t\tif cas[i].DomainName == localAuthName {\n\t\t\t\tlocalCAs = append(localCAs, cas[i])\n\t\t\t} else {\n\t\t\t\ttrustedCAs = append(trustedCAs, cas[i])\n\t\t\t}\n\t\t}\n\t}\n\tlocalCAsView := func() string {\n\t\tt := goterm.NewTable(0, 10, 5, ' ', 0)\n\t\tprintHeader(t, []string{\"CA Type\", \"Fingerprint\"})\n\t\tfor _, a := range localCAs {\n\t\t\tfor _, keyBytes := range a.CheckingKeys {\n\t\t\t\tfingerprint, err := sshutils.AuthorizedKeyFingerprint(keyBytes)\n\t\t\t\tif err != nil {\n\t\t\t\t\tfingerprint = fmt.Sprintf(\"<bad key: %v\", err)\n\t\t\t\t}\n\t\t\t\tfmt.Fprintf(t, \"%v\\t%v\\n\", a.Type, fingerprint)\n\t\t\t}\n\t\t}\n\t\treturn fmt.Sprintf(\"CA keys for the local cluster %v:\\n\\n\", localAuthName) +\n\t\t\tt.String()\n\t}\n\ttrustedCAsView := func() string {\n\t\tt := goterm.NewTable(0, 10, 5, ' ', 0)\n\t\tprintHeader(t, []string{\"Cluster Name\", \"CA Type\", \"Fingerprint\", \"Allowed Logins\"})\n\t\tfor _, a := range trustedCAs {\n\t\t\tfor _, keyBytes := range a.CheckingKeys {\n\t\t\t\tfingerprint, err := sshutils.AuthorizedKeyFingerprint(keyBytes)\n\t\t\t\tif err != nil {\n\t\t\t\t\tfingerprint = fmt.Sprintf(\"<bad key: %v\", err)\n\t\t\t\t}\n\t\t\t\tvar logins string\n\t\t\t\tif a.Type == services.HostCA {\n\t\t\t\t\tlogins = \"N/A\"\n\t\t\t\t} else {\n\t\t\t\t\tlogins = strings.Join(a.AllowedLogins, \",\")\n\t\t\t\t\tif logins == \"\" {\n\t\t\t\t\t\tlogins = \"<nobody>\"\n\t\t\t\t\t} else if logins == \"*\" {\n\t\t\t\t\t\tlogins = \"<everyone>\"\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tfmt.Fprintf(t, \"%v\\t%v\\t%v\\t%v\\n\", a.DomainName, a.Type, fingerprint, logins)\n\t\t\t}\n\t\t}\n\t\treturn \"\\nCA Keys for Trusted Clusters:\\n\\n\" + t.String()\n\t}\n\tfmt.Printf(localCAsView())\n\tif len(trustedCAs) > 0 {\n\t\tfmt.Printf(trustedCAsView())\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "4d20b135b096be8652e75139ef99e49a", "score": "0.5957002", "text": "func (m *RegionalAndLanguageSettings) GetAuthoringLanguages()([]LocaleInfoable) {\n val, err := m.GetBackingStore().Get(\"authoringLanguages\")\n if err != nil {\n panic(err)\n }\n if val != nil {\n return val.([]LocaleInfoable)\n }\n return nil\n}", "title": "" }, { "docid": "38be22bc5b5eb08a5e81e58daba16c6e", "score": "0.58755296", "text": "func listFileAuthorizations() ([]string, error) {\n\tvar output []string\n\n\thomeDIR, err := os.UserHomeDir()\n\tif err != nil {\n\t\treturn output, err\n\t}\n\n\tbasePath := homeDIR + authorizeFolder\n\n\tfiles, err := ioutil.ReadDir(basePath)\n\tif err != nil {\n\t\treturn output, err\n\t}\n\n\tfor _, file := range files {\n\t\tif file.Name() != generalConfigurationFileName {\n\t\t\toutput = append(output, basePath+\"/\"+file.Name())\n\t\t}\n\t}\n\n\treturn output, nil\n}", "title": "" }, { "docid": "92e44653dc6158a1592ec36b289f286e", "score": "0.58446825", "text": "func getAuthorities(contractID string) ([]string, error) {\n\tauthorityResponse, err := dnsv2.GetAuthorities(contractID)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"getAuthorities - contractid %s: authorities retrieval failed. Error: %s\",\n\t\t\tcontractID, err.Error())\n\t}\n\tcontracts := authorityResponse.Contracts\n\tif len(contracts) != 1 {\n\t\treturn nil, fmt.Errorf(\"getAuthorities - contractid %s: Expected 1 element in array but got %d\",\n\t\t\tcontractID, len(contracts))\n\t}\n\tcid := contracts[0].ContractID\n\tif cid != contractID {\n\t\treturn nil, fmt.Errorf(\"getAuthorities - contractID %s: got authorities for wrong contractID (%s)\",\n\t\t\tcontractID, cid)\n\t}\n\tauthorities := contracts[0].Authorities\n\treturn authorities, nil\n}", "title": "" }, { "docid": "a7330d6850957f9f11d465f649918c47", "score": "0.5758454", "text": "func (imageCreator EcsImageCreator) GetOrganizations() (*[]string, error) {\n\n\trepositoryResult := newRepositoryResult()\n\n\terr := imageCreator.getResults(repositoryResult)\n\n\treturn repositoryResult.getResults(), err\n}", "title": "" }, { "docid": "653333e5d26631894a3c2c971647ede0", "score": "0.5737049", "text": "func (s *OrganizationsService) ListOrganizations(queryParams *ListOrganizationsQueryParams) (*Organizations, *resty.Response, error) {\n\n\tpath := \"/organizations/\"\n\n\tqueryParamsString, _ := query.Values(queryParams)\n\n\tresponse, err := RestyClient.R().\n\t\tSetQueryString(queryParamsString.Encode()).\n\t\tSetResult(&Organizations{}).\n\t\tGet(path)\n\n\tif err != nil {\n\t\treturn nil, nil, err\n\t}\n\n\tresult := response.Result().(*Organizations)\n\treturn result, response, err\n\n}", "title": "" }, { "docid": "c4e791c34616dba8f265b0855be149bb", "score": "0.5720942", "text": "func (s *AccountService) List(ctx context.Context, pagination *Pagination) ([]models.Account, *Response, error) {\n\tpath := fmt.Sprintf(\"v1/organisation/accounts\")\n\tpath, err := addOptions(path, pagination)\n\tif err != nil {\n\t\treturn nil, nil, err\n\t}\n\n\treq, err := s.client.NewRequest(ctx, http.MethodGet, path, nil)\n\tvar accounts []models.Account\n\tresp, err := s.client.Do(ctx, req, &accounts)\n\tif err != nil {\n\t\treturn nil, resp, err\n\t}\n\treturn accounts, resp, nil\n}", "title": "" }, { "docid": "08e1f1e8caa52e4e2bcbee2c29c97a68", "score": "0.57161164", "text": "func (repository Repository) GetAccouts() ([]models.Account, error) {\n\trows, err := repository.db.Query(`\n\t\tselect\n\t\t\tid,\n\t\t\tname,\n\t\t\tcpf,\n\t\t\tsecret,\n\t\t\tbalance,\n\t\t\tcreated_at\n\t\tfrom\n\t\t\taccounts;`)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tdefer rows.Close()\n\n\tvar accouts []models.Account\n\n\tfor rows.Next() {\n\t\tvar account models.Account\n\n\t\tif err := rows.Scan(\n\t\t\t&account.ID,\n\t\t\t&account.Name,\n\t\t\t&account.CPF,\n\t\t\t&account.Secret,\n\t\t\t&account.Balance,\n\t\t\t&account.Created_at,\n\t\t); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\n\t\taccouts = append(accouts, account)\n\t}\n\n\treturn accouts, nil\n}", "title": "" }, { "docid": "7d2ad237367857eeb1b02eb945699fa3", "score": "0.569903", "text": "func (r *OrganizationsService) List() *OrganizationsListCall {\n\tc := &OrganizationsListCall{s: r.s, urlParams_: make(gensupport.URLParams)}\n\treturn c\n}", "title": "" }, { "docid": "461fa501138f644962c8cdba7029dacd", "score": "0.56915903", "text": "func (a OAuthApi) GetOauthAuthorizations(acceptLanguage string) (*Oauthauthorizationlisting, *APIResponse, error) {\n\tvar httpMethod = \"GET\"\n\t// create path and map variables\n\tpath := a.Configuration.BasePath + \"/api/v2/oauth/authorizations\"\n\tdefaultReturn := new(Oauthauthorizationlisting)\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\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\n\t// header params \"Accept-Language\"\n\theaderParams[\"Accept-Language\"] = acceptLanguage\n\n\tvar successPayload *Oauthauthorizationlisting\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 \"Oauthauthorizationlisting\" == \"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}", "title": "" }, { "docid": "8f4f2b20c6b8ae2c4873bd265d012936", "score": "0.56576884", "text": "func (c *Client) FindAuthorizations(ctx context.Context, filter platform.AuthorizationFilter, opt ...platform.FindOptions) ([]*platform.Authorization, int, error) {\n\tif filter.ID != nil {\n\t\ta, err := c.FindAuthorizationByID(ctx, *filter.ID)\n\t\tif err != nil {\n\t\t\treturn nil, 0, &platform.Error{\n\t\t\t\tErr: err,\n\t\t\t\tOp: getOp(platform.OpFindAuthorizations),\n\t\t\t}\n\t\t}\n\n\t\treturn []*platform.Authorization{a}, 1, nil\n\t}\n\n\tif filter.Token != nil {\n\t\ta, err := c.FindAuthorizationByToken(ctx, *filter.Token)\n\t\tif err != nil {\n\t\t\treturn nil, 0, &platform.Error{\n\t\t\t\tErr: err,\n\t\t\t\tOp: getOp(platform.OpFindAuthorizations),\n\t\t\t}\n\t\t}\n\n\t\treturn []*platform.Authorization{a}, 1, nil\n\t}\n\n\tas := []*platform.Authorization{}\n\terr := c.db.View(func(tx *bolt.Tx) error {\n\t\tauths, err := c.findAuthorizations(ctx, tx, filter)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tas = auths\n\t\treturn nil\n\t})\n\n\tif err != nil {\n\t\treturn nil, 0, &platform.Error{\n\t\t\tErr: err,\n\t\t\tOp: getOp(platform.OpFindAuthorizations),\n\t\t}\n\t}\n\n\treturn as, len(as), nil\n}", "title": "" }, { "docid": "3f8cc310c3d3291c04f1c42a536bacb8", "score": "0.5657298", "text": "func (s *organizations) List(ctx context.Context, options *OrganizationListOptions) (*OrganizationList, error) {\n\treq, err := s.client.NewRequest(\"GET\", \"organizations\", options)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\torgl := &OrganizationList{}\n\terr = req.Do(ctx, orgl)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn orgl, nil\n}", "title": "" }, { "docid": "b3583cf1f309ed7f3168a634ff3ecafe", "score": "0.5645384", "text": "func (o RouteOutput) Authorizers() AuthorizerArrayOutput {\n\treturn o.ApplyT(func(v Route) []Authorizer { return v.Authorizers }).(AuthorizerArrayOutput)\n}", "title": "" }, { "docid": "79a0fd00d36e8dadcabb3163e811394b", "score": "0.56349695", "text": "func (c *Organizations) GetAll() ([]models.Organization, error) {\n\tvar err error\n\tvar result models.GetOrganizationsResponse\n\n\terr = c.r.get(\"/organizations\", &result, nil)\n\n\treturn result.Organizations, err\n}", "title": "" }, { "docid": "dda8939ca8b43617d11328bde157fd57", "score": "0.56242865", "text": "func (c *Client) List(loo ...ListOption) ([]OrganisationAccount, error) {\n\toptions := listOptions{}\n\tfor _, lo := range loo {\n\t\tlo(&options)\n\t}\n\n\turl, err := url.Parse(fmt.Sprintf(\"%s/v1/organisation/accounts\", c.baseURL))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\turlQuery := url.Query()\n\n\tif options.pageNumber != 0 {\n\t\turlQuery.Set(\"page[number]\", strconv.Itoa(options.pageNumber))\n\t}\n\n\tif options.pageSize != 0 {\n\t\turlQuery.Set(\"page[size]\", strconv.Itoa(options.pageSize))\n\t}\n\n\turl.RawQuery = urlQuery.Encode()\n\n\tresp, err := c.performRequest(\n\t\thttp.MethodGet,\n\t\turl.String(),\n\t\tnil,\n\t)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tdefer resp.Body.Close()\n\n\terr = c.checkErrorMessage(resp)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tvar organisationAccounts struct {\n\t\tData []OrganisationAccount `json:\"data\"`\n\t}\n\terr = json.NewDecoder(resp.Body).Decode(&organisationAccounts)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn organisationAccounts.Data, nil\n}", "title": "" }, { "docid": "efb01b7225f40b8e93d5c7c64bd8ecfd", "score": "0.55631346", "text": "func AuthorizeFindAuthorizations(ctx context.Context, rs []*influxdb.Authorization) ([]*influxdb.Authorization, int, error) {\n\t// This filters without allocating\n\t// https://github.com/golang/go/wiki/SliceTricks#filtering-without-allocating\n\trrs := rs[:0]\n\tfor _, r := range rs {\n\t\t_, _, err := AuthorizeRead(ctx, influxdb.AuthorizationsResourceType, r.ID, r.OrgID)\n\t\tif err != nil && errors.ErrorCode(err) != errors.EUnauthorized {\n\t\t\treturn nil, 0, err\n\t\t}\n\t\tif errors.ErrorCode(err) == errors.EUnauthorized {\n\t\t\tcontinue\n\t\t}\n\t\t_, _, err = AuthorizeReadResource(ctx, influxdb.UsersResourceType, r.UserID)\n\t\tif err != nil && errors.ErrorCode(err) != errors.EUnauthorized {\n\t\t\treturn nil, 0, err\n\t\t}\n\t\tif errors.ErrorCode(err) == errors.EUnauthorized {\n\t\t\tcontinue\n\t\t}\n\t\trrs = append(rrs, r)\n\t}\n\treturn rrs, len(rrs), nil\n}", "title": "" }, { "docid": "ea6304bd68596b011d500cb1bff9d19c", "score": "0.54767096", "text": "func (v *version) OAuthClientAuthorizations() OAuthClientAuthorizationInformer {\n\treturn &oAuthClientAuthorizationInformer{factory: v.SharedInformerFactory}\n}", "title": "" }, { "docid": "d58fbdb3fb4d7ba1f4264075870d80ac", "score": "0.5447875", "text": "func (client *KeystoneClientImpl) Organizations() *Organizations {\n\treturn &Organizations{\n\t\tlog: log.New(log.Writer(), \"[Organizations] \", 0),\n\t\tr: client.r,\n\t}\n}", "title": "" }, { "docid": "a59cd60fa0175953b790c14d1442bbbb", "score": "0.5443557", "text": "func List() []string {\n\tapproversM.RLock()\n\tdefer approversM.RUnlock()\n\n\tret := make([]string, 0, len(approvers))\n\tfor k := range approvers {\n\t\tret = append(ret, k)\n\t}\n\n\treturn ret\n}", "title": "" }, { "docid": "debb8b25307a473d1818f324caec9d22", "score": "0.54307413", "text": "func GetAllORCIDs(config *Config, repoID string) ([]string, error) {\n\tvalues, err := sqlQueryStringIDs(config, repoID, `SELECT creators_orcid\n FROM eprint_creators_orcid\n WHERE creators_orcid IS NOT NULL\n GROUP BY creators_orcid ORDER BY creators_orcid`)\n\treturn values, err\n}", "title": "" }, { "docid": "36a00fb74e89d6c52469001c6ade15b8", "score": "0.5419736", "text": "func GetAuthers(c *gin.Context) {\n\tc.JSON(http.StatusOK, gin.H{})\n}", "title": "" }, { "docid": "6202e2e79a23d1bb71aa96eba0edf6c7", "score": "0.54049265", "text": "func (store *Cache) RetrieveOrganizations() ([]common.StoredOrganization, common.SyncServiceError) {\n\treturn store.Store.RetrieveOrganizations()\n}", "title": "" }, { "docid": "e4ee4582d636d45d88c77ad3c03c67a3", "score": "0.5401844", "text": "func listAccts() (RespAccountList, error) {\n\turl := client.BaseUrl + client.Accts\n\tdata, _ := client.IbGet(url)\n\tvar accts RespAccountList\n\tjson.Unmarshal([]byte(data), &accts)\n\treturn accts, nil\n}", "title": "" }, { "docid": "be71cf53391bf486a3cc6d3b5581f796", "score": "0.5366392", "text": "func (api *Client) ListEventAuthorizationsContext(ctx context.Context, eventContext string) ([]EventAuthorization, error) {\n\tresp := &listEventAuthorizationsResponse{}\n\n\trequest, _ := json.Marshal(map[string]string{\n\t\t\"event_context\": eventContext,\n\t})\n\n\terr := postJSON(ctx, api.httpclient, api.endpoint+\"apps.event.authorizations.list\", api.appLevelToken, request, &resp, api)\n\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tif !resp.Ok {\n\t\treturn nil, resp.Err()\n\t}\n\n\treturn resp.Authorizations, nil\n}", "title": "" }, { "docid": "3d554d575a634601fb673cca64910b33", "score": "0.5335269", "text": "func (s *OrganizationsService) ListAll(ctx context.Context) ([]*Organization, *http.Response, error) {\n\to := \"account/organizations\"\n\n\treq, err := s.client.NewRequest(\"GET\", o, nil)\n\tif err != nil {\n\t\treturn nil, nil, err\n\t}\n\tvar orgs []*Organization\n\tresp, err := s.client.Do(ctx, req, &orgs)\n\tif err != nil {\n\t\treturn nil, resp, err\n\t}\n\n\treturn orgs, resp, nil\n}", "title": "" }, { "docid": "9b1f351975ce92b757508ee98be79e56", "score": "0.53223217", "text": "func (c Client) ListAuthenticators(provider requests.ProviderID, authenticator auth.Authenticator) ([]*listauthenticators.AuthenticatorInfo, error) {\n\treq := &listauthenticators.Operation{}\n\tresp := &listauthenticators.Result{}\n\terr := c.operation(provider, authenticator, requests.OpListAuthenticators, req, resp)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn resp.GetAuthenticators(), nil\n}", "title": "" }, { "docid": "a609f32e298f79f74c080c11df6d1e4a", "score": "0.52911663", "text": "func (s *OrganizationsOp) List(ctx context.Context, opt *OrganizationsListOptions) (*OrganizationsList, *http.Response, error) {\n\tpath := katelloOrganizationsPath\n\tpath, err := addOptions(path, opt)\n\tif err != nil {\n\t\treturn nil, nil, err\n\t}\n\n\treq, err := s.client.NewRequest(ctx, http.MethodGet, path, nil)\n\tif err != nil {\n\t\treturn nil, nil, err\n\t}\n\n\torgs := new(OrganizationsList)\n\tresp, err := s.client.Do(ctx, req, orgs)\n\tif err != nil {\n\t\treturn nil, resp, err\n\t}\n\n\treturn orgs, resp, err\n}", "title": "" }, { "docid": "fb1fc2d57a3779f8960eaf510b9dddab", "score": "0.5287682", "text": "func (service *AccessTokensService) List() *Collection {\n\tpath := fmt.Sprint(\"/users/me/access_tokens\")\n\tmethod := \"GET\"\n\n\treq, err := service.c.newRequest(method, path, nil, nil)\n\tif err != nil {\n\t\treturn &Collection{}\n\t}\n\n\tcol := NewCollection(&CollectionOptions{})\n\tcol.c = service.c\n\tcol.req = req\n\n\treturn col\n}", "title": "" }, { "docid": "9348348556ae9dc58149c407573e5c15", "score": "0.52765447", "text": "func LoadAuthorizations(backend interface{}) (err error) {\n\tswitch v := backend.(type) {\n\tcase AuthorizationStore:\n\t\tauthorizations = v\n\tcase io.Reader:\n\t\terr = LoadAuthorizationsFromReader(v)\n\tcase string: // assume filename\n\t\tf, e := os.Open(v)\n\t\tif e != nil {\n\t\t\treturn e\n\t\t}\n\n\t\tLoadAuthorizations(f)\n\tdefault:\n\t\terr = errors.New(\"don't know how to handle backend\")\n\t}\n\n\treturn\n}", "title": "" }, { "docid": "8021b76a0fecd9445228784e99ce2d28", "score": "0.52760005", "text": "func (c *OrganizationService) List() ([]Organization, *http.Response, error) {\n\tresponse := new(organizationListResponse)\n\tapiError := new(APIError)\n\tresp, err := c.sling.New().Get(\"\").Receive(response, apiError)\n\treturn response.Results, resp, relevantError(err, *apiError)\n}", "title": "" }, { "docid": "2972f3574626054d126825ae8902de52", "score": "0.5254512", "text": "func (ctrl OrganizationController) All(c *gin.Context) {\n\tuser := c.MustGet(cUser).(common.User)\n\n\tparser := util.NewQueryParser(c)\n\tmatch := bson.M{}\n\tmatch = parser.Lookups([]string{\"name\", \"description\"}, match)\n\tquery := db.Organizations().Find(match)\n\tif order := parser.OrderBy(); order != \"\" {\n\t\tquery.Sort(order)\n\t}\n\n\troles := new(rbac.Organization)\n\tvar organizations []common.Organization\n\titer := query.Iter()\n\tvar tmpOrganization common.Organization\n\tfor iter.Next(&tmpOrganization) {\n\t\tif !roles.Read(user, tmpOrganization) {\n\t\t\tcontinue\n\t\t}\n\t\tmetadata.OrganizationMetadata(&tmpOrganization)\n\t\torganizations = append(organizations, tmpOrganization)\n\t}\n\tif err := iter.Close(); err != nil {\n\t\tAbortWithError(LogFields{Context: c, Status: http.StatusGatewayTimeout,\n\t\t\tMessage: \"Error while getting Organization\",\n\t\t\tLog: logrus.Fields{\"Error\": err.Error()},\n\t\t})\n\t\treturn\n\t}\n\n\tcount := len(organizations)\n\tpgi := util.NewPagination(c, count)\n\tif pgi.HasPage() {\n\t\tAbortWithError(LogFields{Context: c, Status: http.StatusNotFound,\n\t\t\tMessage: \"#\" + strconv.Itoa(pgi.Page()) + \" page contains no results.\",\n\t\t})\n\t\treturn\n\t}\n\n\tc.JSON(http.StatusOK, common.Response{\n\t\tCount: count,\n\t\tNext: pgi.NextPage(),\n\t\tPrevious: pgi.PreviousPage(),\n\t\tData: organizations[pgi.Skip():pgi.End()],\n\t})\n}", "title": "" }, { "docid": "895aa70977495d29c0d6768ef4eceb17", "score": "0.5251183", "text": "func (store *InMemoryStorage) RetrieveOrganizations() ([]common.StoredOrganization, common.SyncServiceError) {\n\treturn nil, nil\n}", "title": "" }, { "docid": "ad8b0e9fe14f63cb96da0f0040eb1485", "score": "0.52302825", "text": "func (r *Repository) authorizedAccounts() ([]accountClient, error) {\n\tvar accounts []accountClient\n\tfor _, pa := range getAccounts() {\n\t\tcreds, err := r.getCredentials(pa)\n\t\tif err != nil {\n\t\t\treturn nil, fmt.Errorf(\"getting credentials: %v\", err)\n\t\t}\n\t\tclient, err := pa.provider.NewClient(creds)\n\t\tif err != nil {\n\t\t\treturn nil, fmt.Errorf(\"getting authenticated client: %v\", err)\n\t\t}\n\t\taccounts = append(accounts, accountClient{\n\t\t\taccount: pa,\n\t\t\tclient: client,\n\t\t})\n\t}\n\treturn accounts, nil\n}", "title": "" }, { "docid": "bea53865d2adb276cebfbea1f995cc48", "score": "0.52161366", "text": "func (ac *ApplicationConfig) Organizations() map[string]ApplicationOrg {\n\treturn ac.applicationOrgs\n}", "title": "" }, { "docid": "4fda7233a6c728710f61d2b1423c5507", "score": "0.5213244", "text": "func handleGetOrganizations(writer http.ResponseWriter, request *http.Request) {\n\tsetResponseHeaders(writer)\n\n\tif !common.Running {\n\t\twriter.WriteHeader(http.StatusServiceUnavailable)\n\t\treturn\n\t}\n\n\tcode, userOrg, _ := security.Authenticate(request)\n\tif code != security.AuthAdmin && code != security.AuthSyncAdmin {\n\t\twriter.WriteHeader(http.StatusForbidden)\n\t\twriter.Write(unauthorizedBytes)\n\t\treturn\n\t}\n\n\tif request.Method != http.MethodGet {\n\t\twriter.WriteHeader(http.StatusMethodNotAllowed)\n\t}\n\tif trace.IsLogging(logger.DEBUG) {\n\t\ttrace.Debug(\"In handleGetOrganizations. Get the list of organizations.\\n\")\n\t}\n\tif orgs, err := getOrganizations(); err != nil {\n\t\tcommunications.SendErrorResponse(writer, err, \"Failed to fetch the list of organizations. Error: \", 0)\n\t} else {\n\t\tif len(orgs) == 0 {\n\t\t\twriter.WriteHeader(http.StatusNotFound)\n\t\t} else {\n\t\t\torgsList := make([]organization, 0)\n\t\t\tfor _, org := range orgs {\n\t\t\t\tif code == security.AuthSyncAdmin || userOrg == org.OrgID {\n\t\t\t\t\torgsList = append(orgsList, organization{OrgID: org.OrgID, Address: org.Address})\n\t\t\t\t}\n\t\t\t}\n\t\t\tif data, err := json.MarshalIndent(orgsList, \"\", \" \"); err != nil {\n\t\t\t\tcommunications.SendErrorResponse(writer, err, \"Failed to marshal the list of organizations. Error: \", 0)\n\t\t\t} else {\n\t\t\t\twriter.Header().Add(contentType, applicationJSON)\n\t\t\t\twriter.WriteHeader(http.StatusOK)\n\t\t\t\tif _, err := writer.Write(data); err != nil && log.IsLogging(logger.ERROR) {\n\t\t\t\t\tlog.Error(\"Failed to write response body, error: \" + err.Error())\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n}", "title": "" }, { "docid": "7fc4a2a3316792185f24f097f420e77e", "score": "0.51981264", "text": "func (r *ProjectsLocationsCaPoolsCertificateAuthoritiesService) List(parent string) *ProjectsLocationsCaPoolsCertificateAuthoritiesListCall {\n\tc := &ProjectsLocationsCaPoolsCertificateAuthoritiesListCall{s: r.s, urlParams_: make(gensupport.URLParams)}\n\tc.parent = parent\n\treturn c\n}", "title": "" }, { "docid": "f6eaf19d7ad32b6543d82a967186aca1", "score": "0.51960087", "text": "func (a *Actors) Accounts() []Account {\n\treturn a.accounts\n}", "title": "" }, { "docid": "13c605dae5111be63a8701f266a6a2ba", "score": "0.5195762", "text": "func (d *driver) GetOrganizations(public bool) ([]organization.Organization, error) {\n\trows, err := d.db.Query(\"SELECT id, name, created_on, is_public,\"+\n\t\t\" (SELECT count(*) FROM member_of WHERE id=org_id),\"+\n\t\t\" (SELECT count(*) FROM team WHERE team.org_id=organization.id)\"+\n\t\t\" FROM organization WHERE is_public=$1 and is_deleted=false\"+\n\t\t\" order by name\", public)\n\tif err != nil {\n\t\tlog.Printf(\"Unable to receive organizations from the db: %v\", err)\n\t\treturn nil, err\n\t}\n\n\torgs := make([]organization.Organization, 0)\n\tfor rows.Next() {\n\t\torg := organization.Organization{}\n\t\terr := rows.Scan(&org.ID, &org.Name, &org.CreatedOn, &org.IsPublic, &org.MemberCount, &org.TeamCount)\n\t\tif err != nil {\n\t\t\tlog.Printf(\"Received error scanning in data from database: %v\", err)\n\t\t\tcontinue\n\t\t}\n\t\torgs = append(orgs, org)\n\t}\n\n\treturn orgs, err\n}", "title": "" }, { "docid": "6458a246bd9e4fc17e826a0eebda4284", "score": "0.51886266", "text": "func (kc *Consumers) GetACL() []string {\n\n\tacls := make([]string, 0)\n\n\tif len(kc.consumer.ID) > 0 {\n\n\t\tkc.kong.Session.AddQueryParam(\"size\", RequestSize)\n\t\tpath := fmt.Sprintf(\"%s/%s/acls\", ConsumersURI, kc.consumer.ID)\n\n\t\tlist := &ACLConsumer{}\n\t\tfor {\n\t\t\tkc.fail.Message = \"\"\n\t\t\tif _, err := kc.kong.Session.BodyAsJSON(nil).Get(path, list, kc.fail); err != nil {\n\t\t\t\treturn nil\n\t\t\t}\n\n\t\t\tif len(list.Data) > 0 && len(kc.fail.Message) == 0 {\n\t\t\t\tfor _, acl := range list.Data {\n\t\t\t\t\tacls = append(acls, acl.Group)\n\t\t\t\t}\n\t\t\t}\n\t\t\tif len(list.Next) > 0 && path != list.Next {\n\t\t\t\tpath = list.Next\n\t\t\t} else {\n\t\t\t\tbreak\n\t\t\t}\n\t\t\tlist.Data = []ACL{}\n\t\t\tlist.Next = \"\"\n\t\t}\n\t}\n\treturn acls\n}", "title": "" }, { "docid": "9fb6576f24a9bfa302feaefed883d021", "score": "0.5171936", "text": "func GetAuthorization(w http.ResponseWriter, r *http.Request) {\n\tctx := r.Context()\n\tdb := acme.MustDatabaseFromContext(ctx)\n\tlinker := acme.MustLinkerFromContext(ctx)\n\n\tacc, err := accountFromContext(ctx)\n\tif err != nil {\n\t\trender.Error(w, err)\n\t\treturn\n\t}\n\taz, err := db.GetAuthorization(ctx, chi.URLParam(r, \"authzID\"))\n\tif err != nil {\n\t\trender.Error(w, acme.WrapErrorISE(err, \"error retrieving authorization\"))\n\t\treturn\n\t}\n\tif acc.ID != az.AccountID {\n\t\trender.Error(w, acme.NewError(acme.ErrorUnauthorizedType,\n\t\t\t\"account '%s' does not own authorization '%s'\", acc.ID, az.ID))\n\t\treturn\n\t}\n\tif err = az.UpdateStatus(ctx, db); err != nil {\n\t\trender.Error(w, acme.WrapErrorISE(err, \"error updating authorization status\"))\n\t\treturn\n\t}\n\n\tlinker.LinkAuthorization(ctx, az)\n\n\tw.Header().Set(\"Location\", linker.GetLink(ctx, acme.AuthzLinkType, az.ID))\n\trender.JSON(w, az)\n}", "title": "" }, { "docid": "325689ac5ea8a5524e0fae056cfb21b6", "score": "0.5167422", "text": "func (c *Client) AuthorizationList(user string,target string,effective string) ([]*AuthorizationStruct, error) {\nvar err error\nvar result []*AuthorizationStruct\nreturn result, err\n}", "title": "" }, { "docid": "afaf1e7a30d994133b10d540477f8ff2", "score": "0.5164369", "text": "func (s *oAuthLister) List(selector labels.Selector) (ret []*v1.OAuth, err error) {\n\terr = cache.ListAll(s.indexer, selector, func(m interface{}) {\n\t\tret = append(ret, m.(*v1.OAuth))\n\t})\n\treturn ret, err\n}", "title": "" }, { "docid": "8b9822a6cc76401c5ce8f7ed4257f606", "score": "0.514113", "text": "func (c *client) ListOrganizations(opts *ListOptions) ([]Organization, error) {\n\tparams, err := query.Values(opts)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tout := new(APIPayload)\n\terr = c.get(\"/api/v2/organizations.json?\"+params.Encode(), out)\n\treturn out.Organizations, err\n}", "title": "" }, { "docid": "ef0a9e8e88c349d15829b0e34f095c86", "score": "0.5140149", "text": "func (c *Client) AuthorizationList(user string, target string, effective string) ([]*AuthorizationStruct, error) {\n\tvar err error\n\tvar result []*AuthorizationStruct\n\tobj, err := c.executeListAndReturnResults(\"/authorization\")\n\tfor _, i := range obj {\n\t\tresult = append(result, i.(*AuthorizationStruct))\n\t}\n\treturn result, err\n}", "title": "" }, { "docid": "5ee67059f804b3a36ea8cc885d9a1453", "score": "0.5124234", "text": "func AuthorizeFindOrganizations(ctx context.Context, rs []*influxdb.Organization) ([]*influxdb.Organization, int, error) {\n\t// This filters without allocating\n\t// https://github.com/golang/go/wiki/SliceTricks#filtering-without-allocating\n\trrs := rs[:0]\n\tfor _, r := range rs {\n\t\t_, _, err := AuthorizeReadOrg(ctx, r.ID)\n\t\tif err != nil && errors.ErrorCode(err) != errors.EUnauthorized {\n\t\t\treturn nil, 0, err\n\t\t}\n\t\tif errors.ErrorCode(err) == errors.EUnauthorized {\n\t\t\tcontinue\n\t\t}\n\t\trrs = append(rrs, r)\n\t}\n\treturn rrs, len(rrs), nil\n}", "title": "" }, { "docid": "586a5d8966fe189ed3ea1e85428d918c", "score": "0.5120284", "text": "func (ac *AuthorizationCache) List(userInfo user.Info) (*kapi.NamespaceList, error) {\n\tkeys := sets.String{}\n\tuser := userInfo.GetName()\n\tgroups := userInfo.GetGroups()\n\n\tobj, exists, _ := ac.userSubjectRecordStore.GetByKey(user)\n\tif exists {\n\t\tsubjectRecord := obj.(*subjectRecord)\n\t\tkeys.Insert(subjectRecord.namespaces.List()...)\n\t}\n\n\tfor _, group := range groups {\n\t\tobj, exists, _ := ac.groupSubjectRecordStore.GetByKey(group)\n\t\tif exists {\n\t\t\tsubjectRecord := obj.(*subjectRecord)\n\t\t\tkeys.Insert(subjectRecord.namespaces.List()...)\n\t\t}\n\t}\n\n\tallowedNamespaces, err := scope.ScopesToVisibleNamespaces(userInfo.GetExtra()[authorizationapi.ScopesKey], ac.clusterPolicyLister.ClusterPolicies())\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tnamespaceList := &kapi.NamespaceList{}\n\tfor key := range keys {\n\t\tnamespaceObj, exists, err := ac.namespaceStore.GetByKey(key)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tif exists {\n\t\t\tnamespace := *namespaceObj.(*kapi.Namespace)\n\t\t\tif allowedNamespaces.Has(\"*\") || allowedNamespaces.Has(namespace.Name) {\n\t\t\t\tnamespaceList.Items = append(namespaceList.Items, namespace)\n\t\t\t}\n\t\t}\n\t}\n\treturn namespaceList, nil\n}", "title": "" }, { "docid": "557c7da3d2975943514d104833dba510", "score": "0.5112881", "text": "func (c *Ctx) Accounts() Accounts {\n\tc.requireInit()\n\tif len(c.acs) == 0 {\n\t\treturn nil\n\t}\n\ti, acs := 0, make(Accounts, len(c.acs))\n\tfor _, ac := range c.acs {\n\t\tacs[i] = ac\n\t\ti++\n\t}\n\treturn acs.SortByName()\n}", "title": "" }, { "docid": "3a9b429373acc87fb58e5e01fafdf40a", "score": "0.5111573", "text": "func FetchOrganizations(personalToken string) ([]string, error) {\n\tresponse := []organization{}\n\n\t_, err := http.Client.R().\n\t\tSetHeader(\"Authorization\", \"token \"+personalToken).\n\t\tSetResult(&response).\n\t\tGet(organizationsURL)\n\n\tif err != nil {\n\t\tfmt.Println(err)\n\n\t\treturn []string{}, err\n\t}\n\n\torganizations := []string{}\n\tfor _, organization := range response {\n\t\torganizations = append(organizations, organization.Login)\n\t}\n\n\treturn organizations, nil\n}", "title": "" }, { "docid": "a6b6d17b026d6c228233576df60a0868", "score": "0.51008373", "text": "func (api *API) ListOrganizations() ([]Organization, ResultInfo, error) {\n\tvar r organizationResponse\n\tres, err := api.makeRequest(\"GET\", \"/user/organizations\", nil)\n\tif err != nil {\n\t\treturn []Organization{}, ResultInfo{}, errors.Wrap(err, errMakeRequestError)\n\t}\n\n\terr = json.Unmarshal(res, &r)\n\tif err != nil {\n\t\treturn []Organization{}, ResultInfo{}, errors.Wrap(err, errUnmarshalError)\n\t}\n\n\treturn r.Result, r.ResultInfo, nil\n}", "title": "" }, { "docid": "a1446406677f2f0bd5a73b74c88b4b0d", "score": "0.5098813", "text": "func (c *ACLConfig) List(serviceID string, version uint) ([]*ACL, *http.Response, error) {\n\tu := fmt.Sprintf(\"/service/%s/version/%d/acl\", serviceID, version)\n\n\treq, err := c.client.NewRequest(\"GET\", u, nil)\n\tif err != nil {\n\t\treturn nil, nil, err\n\t}\n\n\tacls := new([]*ACL)\n\tresp, err := c.client.Do(req, acls)\n\tif err != nil {\n\t\treturn nil, resp, err\n\t}\n\n\tsort.Stable(aclsByName(*acls))\n\n\treturn *acls, resp, nil\n}", "title": "" }, { "docid": "f3949a18c45e33e57e834e44be0351bd", "score": "0.5086508", "text": "func (h *Handler) Authors(c echo.Context) error {\n\n authors, err := h.authorStore.Authors()\n if err != nil {\n fmt.Println(\"Authors error:\", err)\n return c.JSON(http.StatusInternalServerError, err)\n }\n\n\treturn c.JSON(http.StatusOK, authors)\n}", "title": "" }, { "docid": "6ebe69ad3d5b976bc4ab67d05be3f322", "score": "0.5081198", "text": "func (o *Organizations) RetrieveOrganizations() (BitlyOrganizations, error) {\n\tdata, err := o.Call(organizationsEndpoint, http.MethodGet, nil)\n\tif err != nil {\n\t\treturn BitlyOrganizations{}, err\n\t}\n\n\treturn unmarshalBitlyOrganizations(data)\n}", "title": "" }, { "docid": "f79cc54f1b551fe9a492442ed5b84bd7", "score": "0.5075083", "text": "func (c OAuthCredentials) Authorizer() (autorest.Authorizer, error) {\n\treturn createAuthorizerFromOAuthToken(c.OAuthToken)\n}", "title": "" }, { "docid": "7397d8e5e10325c8dbb214c1d143739e", "score": "0.5072839", "text": "func (pca *PublicClientApplication) Accounts() []msalbase.Account {\n\treturn pca.clientApplication.getAccounts()\n}", "title": "" }, { "docid": "cf5877799a040caba65b94b1042d886a", "score": "0.5063767", "text": "func (client *Client) GetOrganizations(query ...Query) ([]Organization, Warnings, error) {\n\trequest, err := client.newHTTPRequest(requestOptions{\n\t\tRequestName: internal.GetOrganizationsRequest,\n\t\tQuery: query,\n\t})\n\tif err != nil {\n\t\treturn nil, nil, err\n\t}\n\n\tvar fullOrgsList []Organization\n\twarnings, err := client.paginate(request, Organization{}, func(item interface{}) error {\n\t\tif app, ok := item.(Organization); ok {\n\t\t\tfullOrgsList = append(fullOrgsList, app)\n\t\t} else {\n\t\t\treturn ccerror.UnknownObjectInListError{\n\t\t\t\tExpected: Organization{},\n\t\t\t\tUnexpected: item,\n\t\t\t}\n\t\t}\n\t\treturn nil\n\t})\n\n\treturn fullOrgsList, warnings, err\n}", "title": "" }, { "docid": "3fe4cd1c367d11e0d89cf7c7ef7358cc", "score": "0.5049108", "text": "func (a *accessor) RetrieveAllowedAccounts(ctx context.Context, subject, verb string) ([]string, error) {\n\taccounts := map[string]bool{}\n\n\t// Retrieve Cluster Roles\n\tclusterRoleBindingList := rbacv1.ClusterRoleBindingList{}\n\tif err := a.client.List(ctx, &clusterRoleBindingList, client.MatchingFields{constants.IndexBySubjects: subject}); err != nil {\n\t\treturn nil, err\n\t}\n\n\tfor _, clusterRoleBinding := range clusterRoleBindingList.Items {\n\t\tif clusterRoleBinding.RoleRef.APIGroup == rbacv1.GroupName && clusterRoleBinding.RoleRef.Kind == \"ClusterRole\" {\n\t\t\tclusterRole := &rbacv1.ClusterRole{}\n\t\t\terr := a.client.Get(ctx, types.NamespacedName{Name: clusterRoleBinding.RoleRef.Name}, clusterRole)\n\t\t\tif err != nil {\n\t\t\t\tif kerrors.IsNotFound(err) {\n\t\t\t\t\tcontinue\n\t\t\t\t}\n\n\t\t\t\treturn nil, err\n\t\t\t}\n\n\t\t\tfor _, rule := range clusterRole.Rules {\n\t\t\t\tif VerbMatches(&rule, verb) && APIGroupMatches(&rule, configv1alpha1.GroupVersion.Group) && ResourceMatches(&rule, \"accounts\", \"\") {\n\t\t\t\t\tif len(rule.ResourceNames) == 0 {\n\t\t\t\t\t\taccounts[rbacv1.ResourceAll] = true\n\t\t\t\t\t} else {\n\t\t\t\t\t\tfor _, rn := range rule.ResourceNames {\n\t\t\t\t\t\t\taccounts[rn] = true\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\tdelete(accounts, \"\")\n\n\t// Get other subject Accounts for viewing\n\tif verb == \"list\" || verb == \"get\" || verb == \"watch\" {\n\t\taccountList := &configv1alpha1.AccountList{}\n\t\terr := a.client.List(ctx, accountList, client.MatchingFields{constants.IndexBySubjects: subject})\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\n\t\tfor _, account := range accountList.Items {\n\t\t\taccounts[account.Name] = true\n\t\t}\n\t}\n\n\tretAccounts := make([]string, 0, len(accounts))\n\tfor account := range accounts {\n\t\tretAccounts = append(retAccounts, account)\n\t}\n\n\treturn retAccounts, nil\n}", "title": "" }, { "docid": "8776279b21993374fdcff75f220413a7", "score": "0.5039703", "text": "func (*AccountGetAuthorizationsRequest) TypeName() string {\n\treturn \"account.getAuthorizations\"\n}", "title": "" }, { "docid": "489cff734102352baecdab4bc6e8d5cc", "score": "0.50396353", "text": "func (router Router) getAccounts(w http.ResponseWriter, r *http.Request) {\n\tif !router.setUpHeaders(w, r) {\n\t\treturn //request was an OPTIONS which was handled.\n\t}\n\n\tvar request types.GetAccountsRequest\n\tif err := json.NewDecoder(r.Body).Decode(&request); err != nil {\n\t\tfmt.Fprintln(os.Stderr, \"GetAccounts Error: \"+err.Error())\n\t\trouter.errorResponse(w, 406, 5, \"Invalid Request\")\n\t\treturn\n\t}\n\n\ttokens := &types.AuthTokens{\n\t\tAccessToken: router.getAccessToken(r),\n\t}\n\n\taccounts, err := router.Authorize.GetAccounts(tokens, request.Roles)\n\tif err != nil {\n\t\tfmt.Fprintln(os.Stderr, \"GetAccounts Error: \"+err.Error())\n\t\trouter.errorResponse(w, 406, 5, \"Invalid Request\")\n\t\treturn\n\t}\n\n\tdata, err := json.Marshal(types.AllUsersResponse{Accounts: accounts})\n\tif err != nil {\n\t\tfmt.Fprintln(os.Stderr, \"GetAccounts Error: \"+err.Error())\n\t\trouter.errorResponse(w, 406, 5, \"Invalid Request\")\n\t\treturn\n\t}\n\n\tw.WriteHeader(200)\n\tw.Write(data)\n\n}", "title": "" }, { "docid": "2c9f552a2d1fd0b6f4863aaabe2fd38f", "score": "0.50247097", "text": "func (c *Course) GetAuthors() error {\n\treturn handler.Model(c).Related(&c.Authors).Error\n}", "title": "" }, { "docid": "2c36903ccd535720e4ad3d0ba339917c", "score": "0.50171155", "text": "func (client *Client) GetOrganizations(query ...Query) ([]Organization, Warnings, error) {\n\tvar resources []Organization\n\n\t_, warnings, err := client.MakeListRequest(RequestParams{\n\t\tRequestName: internal.GetOrganizationsRequest,\n\t\tQuery: query,\n\t\tResponseBody: Organization{},\n\t\tAppendToList: func(item interface{}) error {\n\t\t\tresources = append(resources, item.(Organization))\n\t\t\treturn nil\n\t\t},\n\t})\n\n\treturn resources, warnings, err\n}", "title": "" }, { "docid": "226f5c50be1f6ef2297ec483c95e2386", "score": "0.5014613", "text": "func (s *accountsService) List(params *URLParameters) ([]*Account, error) {\n\turl := s.getResourceURL() + encodeURLParameters((params))\n\tres, err := s.httpClient.Get(url)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tdefer res.Body.Close()\n\n\tbody, err := ioutil.ReadAll(res.Body)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tdata := &topLevelJSONArray{}\n\tjson.Unmarshal(body, data)\n\n\treturn data.Data, checkAPIError(res, body)\n}", "title": "" }, { "docid": "e7f6366f78c6f7f4fe34e73d76949e8f", "score": "0.5009625", "text": "func (v *SourceStyleScheme) GetAuthors() []string {\n\treturn toGoStringArrayNoFree(C.gtk_source_style_scheme_get_authors(v.native()))\n}", "title": "" }, { "docid": "e027654d7ae97eb32ea99b12f07b9f97", "score": "0.49912924", "text": "func GetAll() (*aadpodid.AzureAssignedIdentityList, error) {\n\tcmd := exec.Command(\"kubectl\", \"get\", \"AzureAssignedIdentity\", \"-ojson\")\n\tutil.PrintCommand(cmd)\n\tout, err := cmd.CombinedOutput()\n\tif err != nil {\n\t\treturn nil, errors.Wrap(err, \"Failed to get AzureAssignedIdentity from the Kubernetes cluster\")\n\t}\n\n\tlist := aadpodid.AzureAssignedIdentityList{}\n\tif err := json.Unmarshal(out, &list); err != nil {\n\t\treturn nil, errors.Wrap(err, \"Failed to unmarshall json\")\n\t}\n\n\treturn &list, nil\n}", "title": "" }, { "docid": "574db613cbb3de2376db55e5216b77bd", "score": "0.49683335", "text": "func (in *ConsoleAuthorisationList) DeepCopy() *ConsoleAuthorisationList {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(ConsoleAuthorisationList)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "3e1907f38f46bd2885e339b6d1e24535", "score": "0.4962681", "text": "func (companyClient *CompanyClient) List() ([]*Company, error) {\n\treturn companyClient.list(25, 0)\n}", "title": "" }, { "docid": "44d59267787e1e2d64fc8b45821e9113", "score": "0.49622944", "text": "func (c AzureKeyVaultOAuthCredentials) Authorizer() (autorest.Authorizer, error) {\n\treturn createAuthorizerFromOAuthToken(c.OAuthToken)\n}", "title": "" }, { "docid": "646e6ec617decf3f5354db2d31f4e0ab", "score": "0.49580452", "text": "func (o ManagedCertificateOutput) DnsAuthorizations() pulumi.StringArrayOutput {\n\treturn o.ApplyT(func(v ManagedCertificate) []string { return v.DnsAuthorizations }).(pulumi.StringArrayOutput)\n}", "title": "" }, { "docid": "27f44660bdfa1c08855be1103be7ab9d", "score": "0.49578223", "text": "func ListOrganizations(\n\tctx context.Context,\n\topts ListOrganizationsOpts,\n) (ListOrganizationsResponse, error) {\n\treturn DefaultClient.ListOrganizations(ctx, opts)\n}", "title": "" }, { "docid": "69f62e184768cd7e0c6b98395d296af1", "score": "0.495062", "text": "func (o ManagedCertificateResponseOutput) DnsAuthorizations() pulumi.StringArrayOutput {\n\treturn o.ApplyT(func(v ManagedCertificateResponse) []string { return v.DnsAuthorizations }).(pulumi.StringArrayOutput)\n}", "title": "" }, { "docid": "1855a974a8a03629daa99a6182cebf2e", "score": "0.4938686", "text": "func (c *authorizationRoles) List(opts v1.ListOptions) (result *v3.AuthorizationRoleList, err error) {\n\tvar timeout time.Duration\n\tif opts.TimeoutSeconds != nil {\n\t\ttimeout = time.Duration(*opts.TimeoutSeconds) * time.Second\n\t}\n\tresult = &v3.AuthorizationRoleList{}\n\terr = c.client.Get().\n\t\tNamespace(c.ns).\n\t\tResource(\"authorizationroles\").\n\t\tVersionedParams(&opts, scheme.ParameterCodec).\n\t\tTimeout(timeout).\n\t\tDo().\n\t\tInto(result)\n\treturn\n}", "title": "" }, { "docid": "ede51ff5e58798d6a349e8b6749d3d6e", "score": "0.4926516", "text": "func (h *KafkaACLHandler) List(project, serviceName string) ([]*KafkaACL, error) {\n\t// There's no API for listing Kafka ACL entries. Need to get them from\n\t// service info instead\n\tservice, err := h.client.Services.Get(project, serviceName)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn service.ACL, nil\n}", "title": "" }, { "docid": "2cde8a340819dae390980792808e1bd6", "score": "0.4924588", "text": "func GetAuthorizationPolicies(env *Environment) (*AuthorizationPolicies, error) {\n\tpolicy := &AuthorizationPolicies{\n\t\tNamespaceToV1beta1Policies: map[string][]AuthorizationPolicyConfig{},\n\t\tRootNamespace: env.Mesh().GetRootNamespace(),\n\t}\n\n\tpolicies, err := env.List(collections.IstioSecurityV1Beta1Authorizationpolicies.Resource().GroupVersionKind(), NamespaceAll)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tsortConfigByCreationTime(policies)\n\tpolicy.addAuthorizationPolicies(policies)\n\n\treturn policy, nil\n}", "title": "" }, { "docid": "0419bf19a887deaf9529f811629a9fb5", "score": "0.49128467", "text": "func GetAllAuthors(httpResponse http.ResponseWriter, httpRequest *http.Request) {\n\n\t//\tget all authors from database\n\tvar authorList []model.Author\n\n\tauthorList, err := store.GetAllAuthor()\n\tif err != nil {\n\t\thttpResponse.WriteHeader(http.StatusInternalServerError)\n\t\treturn\n\t}\n\n\t//\tTODO: implement pagination\n\n\t//\tfill response payload\n\tvar responseData = authorListResponse{}\n\n\tfor _, item := range authorList {\n\n\t\tvar author = authorResponse{}\n\n\t\tauthor.ID = item.Id\n\t\tauthor.Name = item.Name\n\n\t\tresponseData.Author = append(responseData.Author, author)\n\t}\n\n\thttpResponse.Header().Add(\"Content-Type\", \"application/json\")\n\thttpResponse.WriteHeader(http.StatusOK)\n\tjson.NewEncoder(httpResponse).Encode(responseData)\n}", "title": "" }, { "docid": "dc9fbdcd52a4969a9c9d778afc2c044c", "score": "0.48898676", "text": "func (o CertificateManagedOutput) DnsAuthorizations() pulumi.StringArrayOutput {\n\treturn o.ApplyT(func(v CertificateManaged) []string { return v.DnsAuthorizations }).(pulumi.StringArrayOutput)\n}", "title": "" }, { "docid": "df9ed4d2b5f63276cea86f7b847f93c1", "score": "0.4865609", "text": "func All(ctx context.Context) (map[string]model.Author, error) {\n\tauthors := make(map[string]model.Author)\n\n\torganisationID, err := util.GetOrganisation(ctx)\n\n\tif err != nil {\n\t\treturn authors, err\n\t}\n\n\tuserID, err := middlewarex.GetUser(ctx)\n\n\tif err != nil {\n\t\treturn authors, err\n\t}\n\n\tauthors = Mapper(organisationID, userID)\n\n\treturn authors, nil\n\n}", "title": "" }, { "docid": "7dfc1905f30a3e2d15f10a332d695d3f", "score": "0.48652676", "text": "func (o *User) GetAuthoritiesOk() ([]GrantedAuthority, bool) {\n\tif o == nil || o.Authorities == nil {\n\t\tvar ret []GrantedAuthority\n\t\treturn ret, false\n\t}\n\treturn *o.Authorities, true\n}", "title": "" }, { "docid": "e6f7504574a0f1687d487210c5e1a675", "score": "0.48588675", "text": "func Authorize(auths ...Authorizer) apollo.Constructor {\n\treturn apollo.Constructor(func(next apollo.Handler) apollo.Handler {\n\t\treturn apollo.HandlerFunc(func(ctx context.Context, w http.ResponseWriter, r *http.Request) {\n\t\t\tfor _, auth := range auths {\n\t\t\t\tauthCtx := auth.Authorize(ctx, r)\n\t\t\t\tif authCtx != nil {\n\t\t\t\t\tnext.ServeHTTP(authCtx, w, r)\n\t\t\t\t\treturn\n\t\t\t\t}\n\t\t\t}\n\n\t\t\thttp.Error(w, \"Request not authorized\", http.StatusUnauthorized)\n\t\t})\n\t})\n}", "title": "" }, { "docid": "4031d59973c116750d3ebd782ef2fc86", "score": "0.4857146", "text": "func (c *Catalog) Origins() []*Origin {\n\tc.RLock()\n\tdefer c.RUnlock()\n\n\torigins := originList{}\n\tfor _, o := range c.origins {\n\t\torigins = append(origins, o)\n\t}\n\tsort.Sort(origins)\n\n\treturn origins\n}", "title": "" }, { "docid": "0a2e435673c722d5d901f129052be5b1", "score": "0.48562023", "text": "func (c *FakeCertificateManagerDNSAuthorizations) List(ctx context.Context, opts v1.ListOptions) (result *v1alpha1.CertificateManagerDNSAuthorizationList, err error) {\n\tobj, err := c.Fake.\n\t\tInvokes(testing.NewListAction(certificatemanagerdnsauthorizationsResource, certificatemanagerdnsauthorizationsKind, c.ns, opts), &v1alpha1.CertificateManagerDNSAuthorizationList{})\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.CertificateManagerDNSAuthorizationList{ListMeta: obj.(*v1alpha1.CertificateManagerDNSAuthorizationList).ListMeta}\n\tfor _, item := range obj.(*v1alpha1.CertificateManagerDNSAuthorizationList).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}", "title": "" }, { "docid": "441e36f1c16425cd5121138c28f6c76e", "score": "0.48548105", "text": "func (s *RoleService) List(ctx context.Context) ([]RoleRepresentation, error) {\n\n\tpath := \"/realms/{realm}/roles\"\n\n\tvar roles []RoleRepresentation\n\n\t_, err := s.client.newRequest(ctx).\n\t\tSetPathParams(map[string]string{\n\t\t\t\"realm\": s.client.Realm,\n\t\t}).\n\t\tSetResult(&roles).\n\t\tGet(path)\n\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn roles, nil\n}", "title": "" }, { "docid": "b047246d2074bae35de0558f2bb90b74", "score": "0.48540294", "text": "func GetContanerList() []string {\n\tctx := context.Background()\n\tcli, err := client.NewClientWithOpts(client.FromEnv, client.WithAPIVersionNegotiation())\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\n\tcontainers, err := cli.ContainerList(ctx, types.ContainerListOptions{})\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\n\tvar containerList []string\n\tfor _, container := range containers {\n\t\tfor _, name := range container.Names {\n\t\t\tcontainerList = append(containerList, strings.TrimLeft(name, \"/\"))\n\t\t}\n\t}\n\n\treturn containerList\n}", "title": "" }, { "docid": "6e7a0fbcd9935eebd8478a215f5bdd51", "score": "0.48535362", "text": "func Accounts() ([]interface{}, error) {\n\tres, err := get(\"accounts\", nil)\n\n\tdata := res.(map[string]interface{})\n\treturn data[\"accounts\"].([]interface{}), err\n}", "title": "" }, { "docid": "e027d26beec100e8607fb8d64cdbac5b", "score": "0.48518762", "text": "func (o SourceResponseOutput) AuthorizedResources() pulumi.StringArrayOutput {\n\treturn o.ApplyT(func(v SourceResponse) []string { return v.AuthorizedResources }).(pulumi.StringArrayOutput)\n}", "title": "" }, { "docid": "0dd4239d1e8da26c1190f4df00ecdf85", "score": "0.4850522", "text": "func (recv *AboutDialog) GetAuthors() []string {\n\tretC := C.gtk_about_dialog_get_authors((*C.GtkAboutDialog)(recv.native))\n\tretGo := []string{}\n\tfor p := retC; *p != nil; p = (**C.char)(C.gpointer((uintptr(C.gpointer(p)) + uintptr(C.sizeof_gpointer)))) {\n\t\ts := C.GoString(*p)\n\t\tretGo = append(retGo, s)\n\t}\n\n\treturn retGo\n}", "title": "" }, { "docid": "5d6894f996bb23e984037accc558c5ef", "score": "0.4837741", "text": "func (r *GraphServiceOrganizationCollectionRequest) Get(ctx context.Context) ([]Organization, error) {\n\treturn r.GetN(ctx, 0)\n}", "title": "" }, { "docid": "893a3a3beec237f5601002ef426858e0", "score": "0.4830315", "text": "func (m *MockRoute53API) ListVPCAssociationAuthorizations(arg0 *route53.ListVPCAssociationAuthorizationsInput) (*route53.ListVPCAssociationAuthorizationsOutput, error) {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"ListVPCAssociationAuthorizations\", arg0)\n\tret0, _ := ret[0].(*route53.ListVPCAssociationAuthorizationsOutput)\n\tret1, _ := ret[1].(error)\n\treturn ret0, ret1\n}", "title": "" }, { "docid": "e3cc4c8be46a7a22fa815bc8f8bce20f", "score": "0.48284695", "text": "func (a *DefaultApiService) ApiAccountsMgmtV1OrganizationsGet(ctx _context.Context) ApiApiAccountsMgmtV1OrganizationsGetRequest {\n\treturn ApiApiAccountsMgmtV1OrganizationsGetRequest{\n\t\tApiService: a,\n\t\tctx: ctx,\n\t}\n}", "title": "" }, { "docid": "5cad1882c0b25953831cbe2c05765870", "score": "0.48218393", "text": "func (p *PoliciesClient) List(ctx context.Context, orgID *identity.ID, name string) ([]PoliciesResult, error) {\n\tv := &url.Values{}\n\tif orgID != nil {\n\t\tv.Set(\"org_id\", orgID.String())\n\t}\n\tif name != \"\" {\n\t\tv.Set(\"name\", name)\n\t}\n\n\treq, _, err := p.client.NewRequest(\"GET\", \"/policies\", v, nil, true)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tpolicies := []PoliciesResult{}\n\t_, err = p.client.Do(ctx, req, &policies, nil, nil)\n\treturn policies, err\n}", "title": "" }, { "docid": "b4ecf3327880490d8ee2e25f1b287d97", "score": "0.48212585", "text": "func GetAccounts(w http.ResponseWriter, r *http.Request) {\n\tdb, err := db.ConectDB()\n\tif err != nil {\n\t\tresposta.Erro(w, http.StatusInternalServerError, err)\n\t\treturn\n\t}\n\n\tdefer db.Close()\n\n\trepository := repository.AccountsRepository(db)\n\n\taccounts, err := repository.GetAcc outs()\n\tif err != nil {\n\t\tresposta.Erro(w, http.StatusInternalServerError, err)\n\t\treturn\n\t}\n\n\tresposta.JSON(w, http.StatusAccepted, accounts)\n\n}", "title": "" }, { "docid": "139dd34e9ea9efe2de91ff1055b00478", "score": "0.48175558", "text": "func (s *Service) List(ctx context.Context) (*Roles, error) {\n\tvar roles Roles\n\tif err := s.Repository.List(ctx, &roles); err != nil {\n\t\treturn nil, errors.Wrap(err, \"list of roles\")\n\t}\n\treturn &roles, nil\n}", "title": "" }, { "docid": "0b15815dd72d31b96e4ec78eefa65b3c", "score": "0.48173317", "text": "func (c *Itsyouonline) GetCompanyList(headers, queryParams map[string]interface{}) ([]Company, *http.Response, error) {\n\tqsParam := buildQueryString(queryParams)\n\tvar u []Company\n\n\t// create request object\n\treq, err := http.NewRequest(\"GET\", rootURL+\"/companies\"+qsParam, nil)\n\tif err != nil {\n\t\treturn u, nil, err\n\t}\n\n\tif c.AuthHeader != \"\" {\n\t\treq.Header.Set(\"Authorization\", c.AuthHeader)\n\t}\n\n\tfor k, v := range headers {\n\t\treq.Header.Set(k, fmt.Sprintf(\"%v\", v))\n\t}\n\n\t//do the request\n\tresp, err := c.client.Do(req)\n\tif err != nil {\n\t\treturn u, nil, err\n\t}\n\tdefer resp.Body.Close()\n\n\treturn u, resp, json.NewDecoder(resp.Body).Decode(&u)\n}", "title": "" }, { "docid": "91c8d311ae9db0ff86f103c4fcd03aa1", "score": "0.48131767", "text": "func (_IAssetProxy *IAssetProxySession) GetAuthorizedAddresses() ([]common.Address, error) {\n\treturn _IAssetProxy.Contract.GetAuthorizedAddresses(&_IAssetProxy.CallOpts)\n}", "title": "" }, { "docid": "565e184759a8f6d6886ed67e1b10f2bc", "score": "0.48080373", "text": "func getOrganizationAccounts(config config.Config) map[string]string {\n\t// Create organization service client\n\tvar c Clients\n\tsvc := c.Organization(config.Region, config.MasterAccountID, config.OrganizationRole)\n\t// Create variable for the list of accounts and initialize input\n\torganizationAccounts := make(map[string]string)\n\tinput := &organizations.ListAccountsInput{}\n\t// Start a do-while loop\n\tfor {\n\t\t// Retrieve the accounts with a limit of 20 per call\n\t\torganizationAccountsPaginated, err := svc.ListAccounts(input)\n\t\t// Append the accounts from the current call to the total list\n\t\tfor _, account := range organizationAccountsPaginated.Accounts {\n\t\t\torganizationAccounts[*account.Name] = *account.Id\n\t\t}\n\t\tcheckError(\"Could not retrieve account list\", err)\n\t\t// Check if more accounts need to be retrieved using api token, otherwise break the loop\n\t\tif organizationAccountsPaginated.NextToken == nil {\n\t\t\tbreak\n\t\t} else {\n\t\t\tinput = &organizations.ListAccountsInput{NextToken: organizationAccountsPaginated.NextToken}\n\t\t}\n\t}\n\treturn organizationAccounts\n}", "title": "" } ]
bb263b319b7678ff6e57fd8b8540fddd
HandleMetadataUpdate runs whenever there is a change to the metadata of a chaincode in the context of a specific channel
[ { "docid": "2abd2547d0e977632caaeeb2bdae92eb", "score": "0.82022786", "text": "func (handleMetadataUpdate HandleMetadataUpdateFunc) HandleMetadataUpdate(channel string, chaincodes chaincode.MetadataSet) {\n\thandleMetadataUpdate(channel, chaincodes)\n}", "title": "" } ]
[ { "docid": "74c77ac1fcd9ab38d727ef2abfeede85", "score": "0.8178194", "text": "func (_m *MetadataChangeListener) HandleMetadataUpdate(channel string, chaincodes chaincode.MetadataSet) {\n\t_m.Called(channel, chaincodes)\n}", "title": "" }, { "docid": "6cd75588a35d7b55e784dc63a051339e", "score": "0.61573225", "text": "func HandleMetadata(client *Client, metadata string) {\n\n}", "title": "" }, { "docid": "f6bb83357c1adc91970e8227a8840cee", "score": "0.5604848", "text": "func (client *WebAppsClient) updateMetadataHandleResponse(resp *http.Response) (WebAppsClientUpdateMetadataResponse, error) {\n\tresult := WebAppsClientUpdateMetadataResponse{}\n\tif err := runtime.UnmarshalAsJSON(resp, &result.StringDictionary); err != nil {\n\t\treturn WebAppsClientUpdateMetadataResponse{}, err\n\t}\n\treturn result, nil\n}", "title": "" }, { "docid": "4d7c3198fdcf4e62772ac480dc566f4a", "score": "0.55048656", "text": "func handleModify(ctx *downloaderContext, key string,\n\tconfig types.DownloaderConfig, status *types.DownloaderStatus,\n\treceiveChan chan<- CancelChannel) {\n\n\tlog.Functionf(\"handleModify(%s) for %s\", status.ImageSha256, status.Name)\n\n\tstatus.PendingModify = true\n\tpublishDownloaderStatus(ctx, status)\n\n\tlog.Functionf(\"handleModify(%s) RefCount %d to %d, Expired %v for %s\",\n\t\tstatus.ImageSha256, status.RefCount, config.RefCount,\n\t\tstatus.Expired, status.Name)\n\n\t// If RefCount from zero to non-zero and status has error\n\t// or status is not downloaded then do install\n\tif config.RefCount != 0 && (status.HasError() || status.State != types.DOWNLOADED) {\n\t\tlog.Functionf(\"handleModify installing %s\", config.Name)\n\t\thandleCreate(ctx, config, status, key, receiveChan)\n\t} else if status.RefCount != config.RefCount {\n\t\tlog.Functionf(\"handleModify RefCount change %s from %d to %d\",\n\t\t\tconfig.Name, status.RefCount, config.RefCount)\n\t\tstatus.RefCount = config.RefCount\n\t}\n\tstatus.LastUse = time.Now()\n\tstatus.Expired = (status.RefCount == 0) // Start delete handshake\n\tstatus.ClearPendingStatus()\n\tpublishDownloaderStatus(ctx, status)\n\tlog.Functionf(\"handleModify done for %s\", config.Name)\n}", "title": "" }, { "docid": "4e831843818c91f15e9514e10c337670", "score": "0.54342383", "text": "func (g *Node) UpdateMetadata(md []byte) {\n\tg.disc.UpdateMetadata(md)\n}", "title": "" }, { "docid": "400affd302ab0b4c8a011a4d00f8a9ea", "score": "0.5425905", "text": "func (c *Client) OnChannelUpdate(fn func(channel_id, clear string, payload map[string]interface{})) {\n\tc.OnChannelUpdateFunctions = append(c.OnChannelUpdateFunctions, fn)\n}", "title": "" }, { "docid": "d64fae1974c3a7496daee413422874b0", "score": "0.53287774", "text": "func (client *NotificationChannelsClient) updateHandleResponse(resp *http.Response) (NotificationChannelsClientUpdateResponse, error) {\n\tresult := NotificationChannelsClientUpdateResponse{}\n\tif err := runtime.UnmarshalAsJSON(resp, &result.NotificationChannel); err != nil {\n\t\treturn NotificationChannelsClientUpdateResponse{}, err\n\t}\n\treturn result, nil\n}", "title": "" }, { "docid": "68f235e52cc991d4c5188a7c4c1160b6", "score": "0.5327246", "text": "func (a *GCPActuator) UpdateMetadata() error {\n\t// Nothing to do here since GCP CloudDNS doesn't support tags.\n\treturn nil\n}", "title": "" }, { "docid": "9d2cc1ba9ef07410b265d9752d9c1dd6", "score": "0.5314834", "text": "func MetadataUpdate(oldMDMap map[string]interface{}, newMDMap map[string]interface{}, serverMD *compute.Metadata) {\n\ttpgcompute.MetadataUpdate(oldMDMap, newMDMap, serverMD)\n}", "title": "" }, { "docid": "c1e6ea869e9bd9c2bbe94e6a46acd396", "score": "0.52565974", "text": "func (db *BoltDatabase) updateMetadata(tx *bolt.Tx) error {\n\tbucket, err := tx.CreateBucketIfNotExists([]byte(\"Metadata\"))\n\tif err != nil {\n\t\treturn err\n\t}\n\terr = bucket.Put([]byte(\"Header\"), []byte(db.Header))\n\tif err != nil {\n\t\treturn err\n\t}\n\terr = bucket.Put([]byte(\"Version\"), []byte(db.Version))\n\tif err != nil {\n\t\treturn err\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "5422dc61e98d81291ea2421398b69254", "score": "0.52473974", "text": "func (b *ElasticSearchBackend) MetadataUpdated(i interface{}) bool {\n\tif !b.updateTimes(i) {\n\t\treturn false\n\t}\n\n\tsuccess := true\n\tswitch i := i.(type) {\n\tcase *Node:\n\t\tsuccess = b.createNode(i)\n\tcase *Edge:\n\t\tsuccess = b.createEdge(i)\n\t}\n\n\treturn success\n}", "title": "" }, { "docid": "c22c0cedb12cbef21e7419dc25761e88", "score": "0.5243409", "text": "func (_m *Channel) OnUpdate(cb func(*channel.State, *channel.State)) {\n\t_m.Called(cb)\n}", "title": "" }, { "docid": "926e49f3239be3480c35c3b3172c74d5", "score": "0.52136177", "text": "func (e *etcdSchemaRegistry) update(ctx context.Context, metadata Metadata) error {\n\tif !e.closer.AddRunning() {\n\t\treturn ErrClosed\n\t}\n\tdefer e.closer.Done()\n\tkey, err := metadata.key()\n\tif err != nil {\n\t\treturn err\n\t}\n\tgetResp, err := e.client.Get(ctx, key)\n\tif err != nil {\n\t\treturn err\n\t}\n\tif getResp.Count > 1 {\n\t\treturn errUnexpectedNumberOfEntities\n\t}\n\tval, err := proto.Marshal(metadata.Spec.(proto.Message))\n\tif err != nil {\n\t\treturn err\n\t}\n\treplace := getResp.Count > 0\n\tif replace {\n\t\texistingVal, innerErr := metadata.Unmarshal(getResp.Kvs[0].Value)\n\t\tif innerErr != nil {\n\t\t\treturn innerErr\n\t\t}\n\t\t// directly return if we have the same entity\n\t\tif metadata.equal(existingVal) {\n\t\t\treturn nil\n\t\t}\n\n\t\tmodRevision := getResp.Kvs[0].ModRevision\n\t\ttxnResp, txnErr := e.client.Txn(ctx).\n\t\t\tIf(clientv3.Compare(clientv3.ModRevision(key), \"=\", modRevision)).\n\t\t\tThen(clientv3.OpPut(key, string(val))).\n\t\t\tCommit()\n\t\tif txnErr != nil {\n\t\t\treturn txnErr\n\t\t}\n\t\tif !txnResp.Succeeded {\n\t\t\treturn errConcurrentModification\n\t\t}\n\t} else {\n\t\treturn ErrGRPCResourceNotFound\n\t}\n\te.notifyUpdate(metadata)\n\treturn nil\n}", "title": "" }, { "docid": "8fc1c087b26f056917819430f9d67b9e", "score": "0.51858324", "text": "func (client *WebAppsClient) updateMetadataSlotHandleResponse(resp *http.Response) (WebAppsClientUpdateMetadataSlotResponse, error) {\n\tresult := WebAppsClientUpdateMetadataSlotResponse{}\n\tif err := runtime.UnmarshalAsJSON(resp, &result.StringDictionary); err != nil {\n\t\treturn WebAppsClientUpdateMetadataSlotResponse{}, err\n\t}\n\treturn result, nil\n}", "title": "" }, { "docid": "2dbd547b62f5521a5082534f7c20f7ae", "score": "0.5181287", "text": "func (m *Methods) ModifyChannel(params *ChParams, reply *GenericReply) error {\n\tdata, err := m.db.inst.Get([]byte(params.ChannelUid), nil)\n\tif err != nil && err.Error() == \"leveldb: not found\" {\n\t\t*reply = GenericReply{Status: \"OK\", Description: \"Channel not found\"}\n\t\treturn nil\n\t} else if err != nil {\n\t\tlog.Println(\"ModifyChannel m.db.inst.Get error:\", err)\n\t\t*reply = GenericReply{Status: \"error\", Description: err.Error()}\n\t\treturn err\n\t}\n\n\tvar channel ChParams\n\tif err := json.Unmarshal(data, &channel); err != nil {\n\t\tlog.Println(\"ModifyChannel json.Unmarshal error:\", err)\n\t\treturn err\n\t}\n\n\t// Copy old values if new ones are not provided\n\t// goleveldb doesn't support modifying\n\t// FIXME: is there a smarter way?\n\tif params.Type != \"\" {\n\t\tchannel.Type = params.Type\n\t}\n\tif params.Address != \"\" {\n\t\tchannel.Address = params.Address\n\t}\n\tif params.Port != \"\" {\n\t\tchannel.Port = params.Port\n\t}\n\tif params.Client != \"\" {\n\t\tchannel.Client = params.Client\n\t}\n\n\tj, err := json.Marshal(channel)\n\tif err != nil {\n\t\tlog.Println(\"AddChannel json.Marshal error:\", err)\n\t\t*reply = GenericReply{Status: \"error\", Description: err.Error()}\n\t\treturn err\n\t}\n\n\tlog.Println(\"Modifying channel:\", params.ChannelUid)\n\tif err := m.db.inst.Put([]byte(params.ChannelUid), j, nil); err != nil {\n\t\tlog.Println(\"AddChannel json.Marshal error:\", err)\n\t\t*reply = GenericReply{Status: \"error\", Description: err.Error()}\n\t\treturn err\n\t}\n\n\t*reply = GenericReply{Status: \"OK\"}\n\treturn nil\n}", "title": "" }, { "docid": "23ec43cfefeaa9495f828656dd338f8c", "score": "0.5169882", "text": "func (a *Ari) onMetaChanged(evt string) {\n\ta.logger.Debug(fmt.Sprintf(\"meta changed evt:%s\", evt))\n\t// if meta deleted, all db dropped, close all waiters\n\tif evt == \"DELETE\" {\n\t\ta.Fatal(errors.New(\"meta deleted\"), \"\")\n\t\treturn\n\t}\n\tmeta := a.GetMeta()\n\t// ignore nil meta\n\tif meta == nil {\n\t\treturn\n\t}\n\t\n\tif evt == \"CREATE\" || evt == \"UPDATE\" {\n\t\t// notify all waiters to check db meta\n\t\ta.logger.Debug(\"notify all waiters to update metas\")\n\t\ta.lock.Lock()\n\t\tfor dbName, wt := range a.waiters {\n\t\t\tm, ok := meta.Dbs[dbName]\n\t\t\tif ok {\n\t\t\t\twt.CheckDbMeta(*m)\n\t\t\t}\n\t\t\t// todo: what to do if the db meta deleted ?\n\t\t}\n\t\ta.lock.Unlock()\n\t}\n}", "title": "" }, { "docid": "b44b8beacf57e25f816ec0ad7e788f33", "score": "0.51285803", "text": "func updateMetadataFile(mrRoot, path string, localRepo bool, metadata *metadatapb.Metadata) error {\n\tmdFilePath := getMdFilePath(path)\n\t// detect license info\n\tlicenseDatabasePath := filepath.Join(mrRoot, \"tools/vendor_bender/LicenseDatabase\")\n\tlicense, err := detectLicense(licenseDatabasePath, path)\n\tif err != nil {\n\t\tfmt.Printf(\"WARNING: LICENSE detection failed: %v\\n\", err)\n\t}\n\t// Update vendoring date\n\tnow := time.Now()\n\tdate := &metadatapb.Date{\n\t\tYear: int32(now.Year()),\n\t\tMonth: int32(now.Month()),\n\t\tDay: int32(now.Day()),\n\t}\n\tmetadata.ThirdParty.License = license\n\tmetadata.ThirdParty.IsLocalRepository = localRepo\n\tmetadata.ThirdParty.LastUpgradeDate = date\n\t// Write the info into METADATA\n\tmo := prototext.MarshalOptions{Multiline: true}\n\tbuf, err := mo.Marshal(metadata)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"failed to marshal the METADATA file: %v\", err)\n\t}\n\tif err := ioutil.WriteFile(mdFilePath, buf, 0666); err != nil {\n\t\treturn fmt.Errorf(\"failed to update METADATA file %s: %v\", mdFilePath, err)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "3ee83db4df7346122c9449719a13eeac", "score": "0.5113663", "text": "func updateMetadata(\n\tresType client.ResourceType,\n\td *schema.ResourceData,\n\tapiClient *client.Client) error {\n\n\tvar err error\n\n\t// Retrieve metadata changes\n\to, n := d.GetChange(\"metadata\")\n\toldMeta := o.(map[string]interface{})\n\tnewMeta := n.(map[string]interface{})\n\n\t// Update new and changed metadata\n\tfor key, newVal := range newMeta {\n\t\tif oldVal, exists := oldMeta[key]; exists {\n\t\t\tif oldVal != newVal {\n\t\t\t\t// Old key, value changing\n\t\t\t\terr = apiClient.SetMetadata(resType, d.Id(), key, newVal.(string))\n\t\t\t}\n\t\t} else {\n\t\t\t// New key\n\t\t\terr = apiClient.SetMetadata(resType, d.Id(), key, newVal.(string))\n\t\t}\n\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"Unable to change metadata: %v\", err)\n\t\t}\n\t}\n\n\t// Find deleted metadata keys\n\tfor key := range oldMeta {\n\t\tif _, exists := newMeta[key]; !exists {\n\t\t\terr = apiClient.DeleteMetadata(resType, d.Id(), key)\n\t\t\tif err != nil {\n\t\t\t\treturn fmt.Errorf(\"Unable to delete metadata key: %v\", err)\n\t\t\t}\n\t\t}\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "3b181409984bf1d2801f9ccf57ac8478", "score": "0.5109754", "text": "func (imp *Implementation) ConsumeMetadata(m *metadata.Digest) error {\n\tflog.Info(\"Consuming meta-data\",\n\t\tflog.Fields{\n\t\t\tEvent: \"distro.Implementation.ConsumeMetadata\",\n\t\t},\n\t)\n\n\tif err := imp.setHostname(m.Hostname); err != nil {\n\t\tflog.Error(\"Failed to set hostname\",\n\t\t\tflog.Fields{\n\t\t\t\tEvent: \"distro.Implementation.setHostname\",\n\t\t\t},\n\t\t\tflog.Details{\n\t\t\t\t\"name\": m.Hostname,\n\t\t\t},\n\t\t)\n\t\treturn err\n\t}\n\n\timp.consumeSSHKeys(m.SSHKeys)\n\n\tflog.Info(\"Finished consuming meta-data\",\n\t\tflog.Fields{\n\t\t\tEvent: \"distro.Implementation.ConsumeUserdata\",\n\t\t},\n\t)\n\n\treturn nil\n}", "title": "" }, { "docid": "e86299e1123ab9808473fc43fb252fd4", "score": "0.51018184", "text": "func (c *CustomController) notifyChannelOnUpdate(oldObj, newObj interface{}) error {\n\tc.eventNotificationChan <- GenericEvent{\n\t\tEventType: UPDATE,\n\t\tOldObject: oldObj.(client.Object),\n\t\tObject: newObj.(client.Object),\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "7bbdf500269701aabddecc776998c491", "score": "0.5095673", "text": "func (f *FluentdConfigDS) handleFDChange(obj interface{}) {\n\t// If the controller is monitoring all namespaces, it needs to react\n\t// to all notifications of changes to FluentdConfigs resources.\n\t// If instead only a subset of namespaces is being monitored, there\n\t// is no need to run the control loop unless the changed FluentdConfig\n\t// resource is in one of the monitored namespaces\n\tif len(f.Cfg.Namespaces) != 0 {\n\t\tvar object metav1.Object\n\t\tvar ok bool\n\t\tif object, ok = obj.(metav1.Object); !ok {\n\t\t\ttombstone, ok := obj.(cache.DeletedFinalStateUnknown)\n\t\t\tif !ok {\n\t\t\t\tlogrus.Warnf(\"error decoding object, invalid type\")\n\t\t\t\treturn\n\t\t\t}\n\t\t\tobject, ok = tombstone.Obj.(metav1.Object)\n\t\t\tif !ok {\n\t\t\t\tlogrus.Warnf(\"error decoding object tombstone, invalid type\")\n\t\t\t\treturn\n\t\t\t}\n\t\t}\n\n\t\ttoProcess := false\n\t\tfor _, ns := range f.Cfg.Namespaces {\n\t\t\tif object.GetNamespace() == ns {\n\t\t\t\ttoProcess = true\n\t\t\t\tbreak\n\t\t\t}\n\t\t}\n\t\tif !toProcess {\n\t\t\treturn\n\t\t}\n\t}\n\n\tselect {\n\tcase f.UpdateChan <- time.Now():\n\tdefault:\n\t\t// There is already one pending notification. Useless to send another one since, when\n\t\t// the pending one will be processed all new changes will be reloaded.\n\t}\n}", "title": "" }, { "docid": "773fa56313da9b2f368431352aeda71a", "score": "0.5079883", "text": "func UpdateChannel(c *gin.Context) {\n\tf := li.GetFile()\n\tvar err error\n\tvar standardLogger = li.NewLogger()\n\tstandardLogger.SetOutput(f)\n\tvar info serializers.ChannelInfo\n\tif err := c.BindJSON(&info); err != nil {\n\t\tve, ok := err.(validator.ValidationErrors)\n\t\tif !ok {\n\t\t\tc.JSON(http.StatusBadRequest, gin.H{\"error\": constants.Errors().InvalidDataType})\n\t\t\treturn\n\t\t}\n\t\tvar errors []string\n\t\tfor _, value := range ve {\n\t\t\tif value.Tag() != \"max\" {\n\t\t\t\terrors = append(errors, fmt.Sprintf(\"%s is %s\", value.Field(), value.Tag()))\n\t\t\t} else {\n\t\t\t\terrors = append(errors, fmt.Sprintf(\"%s cannot have more than %s characters\", value.Field(), value.Param()))\n\t\t\t}\n\t\t}\n\t\tc.JSON(http.StatusBadRequest, gin.H{\"error\": errors})\n\t\treturn\n\t}\n\t_, found := misc.FindInSlice(constants.ChannelIntType(), int(info.Type))\n\tif !found {\n\t\tc.JSON(http.StatusBadRequest, gin.H{\"error\": constants.Errors().InvalidType})\n\t\treturn\n\t}\n\tif info.Priority > constants.MaxPriority {\n\t\tc.JSON(http.StatusBadRequest, gin.H{\"error\": constants.Errors().InvalidPriority})\n\t\treturn\n\t}\n\n\tchannelID, err := strconv.ParseUint(c.Param(\"id\"), 10, 64)\n\tif err != nil {\n\t\tc.JSON(http.StatusBadRequest, gin.H{\n\t\t\t\"error\": constants.Errors().InvalidID,\n\t\t})\n\t\treturn\n\t}\n\n\tchannel, err := channels.GetChannelWithID(uint(channelID))\n\tif err == gorm.ErrRecordNotFound {\n\t\tc.JSON(http.StatusBadRequest, gin.H{\n\t\t\t\"error\": constants.Errors().IDNotInRecords,\n\t\t})\n\t\treturn\n\t} else if err != nil {\n\t\tstandardLogger.InternalServerError(err.Error())\n\t\tc.JSON(http.StatusInternalServerError, gin.H{\"error\": constants.Errors().InternalError})\n\t\treturn\n\t}\n\n\ttestChannel, err := channels.GetChannelWithName(strings.ToLower(info.Name))\n\tif err != gorm.ErrRecordNotFound && err != nil {\n\t\tstandardLogger.InternalServerError(err.Error())\n\t\tc.JSON(http.StatusInternalServerError, gin.H{\"error\": constants.Errors().InternalError})\n\t\treturn\n\t} else if testChannel.ID != channel.ID && err != gorm.ErrRecordNotFound {\n\t\tc.JSON(http.StatusBadRequest, gin.H{\"error\": constants.Errors().ChannelNamePresent})\n\t\treturn\n\t}\n\n\ttestChannel, err = channels.GetChannelWithType(uint(info.Type))\n\tif err != gorm.ErrRecordNotFound && err != nil {\n\t\tstandardLogger.InternalServerError(err.Error())\n\t\tc.JSON(http.StatusInternalServerError, gin.H{\"error\": constants.Errors().InternalError})\n\t\treturn\n\t} else if testChannel.ID != channel.ID && err != gorm.ErrRecordNotFound {\n\t\tc.JSON(http.StatusBadRequest, gin.H{\"error\": constants.Errors().ChannelTypePresent})\n\t\treturn\n\t}\n\n\tif info.Configuration != \"\" {\n\t\terr := serializers.ChannelConfigValidation(&info)\n\n\t\tif err != nil && err.Error() == constants.Errors().InternalError {\n\t\t\tstandardLogger.InternalServerError(err.Error())\n\t\t\tc.JSON(http.StatusInternalServerError, gin.H{\"error\": constants.Errors().InternalError})\n\t\t\treturn\n\t\t} else if err != nil {\n\t\t\tc.JSON(http.StatusBadRequest, gin.H{\"error\": err.Error()})\n\t\t\treturn\n\t\t}\n\t}\n\n\tserializers.ChannelInfoToChannelModel(&info, channel)\n\n\terr = channels.PatchChannel(channel)\n\tif err != nil {\n\t\tstandardLogger.InternalServerError(err.Error())\n\t\tc.JSON(http.StatusInternalServerError, gin.H{\"error\": constants.Errors().InternalError})\n\t\treturn\n\t}\n\n\tlogs.AddLogs(constants.InfoLog, fmt.Sprintf(\"Channel %s updated\", channel.Name))\n\tc.JSON(http.StatusOK, gin.H{\n\t\t\"status\": \"ok\",\n\t})\n}", "title": "" }, { "docid": "376dee80c11959ba4a6141cfb6713100", "score": "0.50733685", "text": "func (cb *ConsulBackend) handleWatch(b watch.BlockingParamVal, update interface{}) {\n\tpair, ok := update.(*api.KVPair)\n\tif !ok {\n\t\tlog.Println(\"watch: invalid update\")\n\t\treturn\n\t}\n\tif pair == nil {\n\t\treturn\n\t}\n\tcb.mutex.Lock()\n\tdefer cb.mutex.Unlock()\n\tif err := proto.Unmarshal(pair.Value, &cb.cache); err != nil {\n\t\tlog.Println(\"watch: failed to parse state: %w\", err)\n\t}\n\tcb.lastIndex = pair.ModifyIndex\n}", "title": "" }, { "docid": "442a490696a93d9277e691b32b444e19", "score": "0.5065858", "text": "func (s *SqlBackend) UpdateMetadata(m *Metadata) error {\n\tquery := \"UPDATE metadata SET folder_id = ?, path = ? WHERE id = ?;\"\n\ttx := s.db.MustBegin()\n\ttx.Exec(query, m.FolderID, m.Path, m.ID)\n\treturn tx.Commit()\n}", "title": "" }, { "docid": "40dbcfa448dbbee9f973985d89137551", "score": "0.50324434", "text": "func (m *Maestro) handleContainerUpdate(r *eventsocketclient.Received) {\n\tcontainerID := (*r.Message.Payload)[\"ContainerID\"].(string)\n\n\tlog.WithField(\"maestro\", config.Maestro.Host).WithField(\"containerID\", containerID).Info(\"Handling batond-container-update\")\n\n\tm.batondChanContainerUpdate <- containerID\n}", "title": "" }, { "docid": "51d044480cd44ea148f771dff0eb960b", "score": "0.5016176", "text": "func (m *MySQLStore) HandlePeerUpdates() chan PeerTrackerDelta {\n\tpeerUpdatesChan := make(chan PeerTrackerDelta)\n\n\tgo func() {\n\t\tfor {\n\t\t\tupdate := <-peerUpdatesChan\n\t\t\tswitch update.Event {\n\t\t\tcase PEERUPDATE:\n\t\t\t\tm.UpdatePeerStats(update.Uploaded, update.Downloaded, update.IP)\n\t\t\tcase TRACKERUPDATE:\n\t\t\t\tm.UpdateStats(update.Uploaded, update.Downloaded)\n\t\t\tcase TORRENTUPDATE:\n\t\t\t\tm.UpdateTorrentStats(int64(update.Uploaded), int64(update.Downloaded))\n\t\t\t}\n\t\t}\n\t}()\n\n\treturn peerUpdatesChan\n}", "title": "" }, { "docid": "322ab830be99f51daaa4f2077f1fa8c6", "score": "0.50074524", "text": "func (m *defaultManager) UpdateVolumeMetadata(ctx context.Context, spec *cnstypes.CnsVolumeMetadataUpdateSpec) error {\n\tinternalUpdateVolumeMetadata := func() error {\n\t\tlog := logger.GetLogger(ctx)\n\t\terr := validateManager(ctx, m)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\t// Set up the VC connection\n\t\terr = m.virtualCenter.ConnectCns(ctx)\n\t\tif err != nil {\n\t\t\tlog.Errorf(\"ConnectCns failed with err: %+v\", err)\n\t\t\treturn err\n\t\t}\n\t\t// If the VSphereUser in the VolumeMetadataUpdateSpec is different from session user, update the VolumeMetadataUpdateSpec\n\t\ts, err := m.virtualCenter.Client.SessionManager.UserSession(ctx)\n\t\tif err != nil {\n\t\t\tlog.Errorf(\"failed to get usersession with err: %v\", err)\n\t\t\treturn err\n\t\t}\n\t\tif s.UserName != spec.Metadata.ContainerCluster.VSphereUser {\n\t\t\tlog.Debugf(\"Update VSphereUser from %s to %s\", spec.Metadata.ContainerCluster.VSphereUser, s.UserName)\n\t\t\tspec.Metadata.ContainerCluster.VSphereUser = s.UserName\n\t\t}\n\t\tvar cnsUpdateSpecList []cnstypes.CnsVolumeMetadataUpdateSpec\n\t\tcnsUpdateSpec := cnstypes.CnsVolumeMetadataUpdateSpec{\n\t\t\tVolumeId: cnstypes.CnsVolumeId{\n\t\t\t\tId: spec.VolumeId.Id,\n\t\t\t},\n\t\t\tMetadata: spec.Metadata,\n\t\t}\n\t\tcnsUpdateSpecList = append(cnsUpdateSpecList, cnsUpdateSpec)\n\t\ttask, err := m.virtualCenter.CnsClient.UpdateVolumeMetadata(ctx, cnsUpdateSpecList)\n\t\tif err != nil {\n\t\t\tlog.Errorf(\"CNS UpdateVolume failed from vCenter %q with err: %v\", m.virtualCenter.Config.Host, err)\n\t\t\treturn err\n\t\t}\n\t\t// Get the taskInfo\n\t\ttaskInfo, err := cns.GetTaskInfo(ctx, task)\n\t\tif err != nil || taskInfo == nil {\n\t\t\tlog.Errorf(\"failed to get taskInfo for UpdateVolume task from vCenter %q with err: %v\", m.virtualCenter.Config.Host, err)\n\t\t\treturn err\n\t\t}\n\t\tlog.Infof(\"UpdateVolumeMetadata: volumeID: %q, opId: %q\", spec.VolumeId.Id, taskInfo.ActivationId)\n\t\t// Get the task results for the given task\n\t\ttaskResult, err := cns.GetTaskResult(ctx, taskInfo)\n\t\tif err != nil {\n\t\t\tlog.Errorf(\"unable to find the task result for UpdateVolume task from vCenter %q with taskID %q, opId: %q and updateResults %+v\",\n\t\t\t\tm.virtualCenter.Config.Host, taskInfo.Task.Value, taskInfo.ActivationId, taskResult)\n\t\t\treturn err\n\t\t}\n\t\tif taskResult == nil {\n\t\t\tlog.Errorf(\"taskResult is empty for UpdateVolume task: %q, opId: %q\", taskInfo.Task.Value, taskInfo.ActivationId)\n\t\t\treturn errors.New(\"taskResult is empty\")\n\t\t}\n\t\tvolumeOperationRes := taskResult.GetCnsVolumeOperationResult()\n\t\tif volumeOperationRes.Fault != nil {\n\t\t\tmsg := fmt.Sprintf(\"failed to update volume. updateSpec: %q, fault: %q, opID: %q\", spew.Sdump(spec), spew.Sdump(volumeOperationRes.Fault), taskInfo.ActivationId)\n\t\t\tlog.Error(msg)\n\t\t\treturn errors.New(msg)\n\t\t}\n\t\tlog.Infof(\"UpdateVolumeMetadata: Volume metadata updated successfully. volumeID: %q, opId: %q\", spec.VolumeId.Id, taskInfo.ActivationId)\n\t\treturn nil\n\t}\n\tstart := time.Now()\n\terr := internalUpdateVolumeMetadata()\n\tif err != nil {\n\t\tprometheus.CnsControlOpsHistVec.WithLabelValues(prometheus.PrometheusCnsUpdateVolumeMetadataOpType,\n\t\t\tprometheus.PrometheusFailStatus).Observe(time.Since(start).Seconds())\n\t} else {\n\t\tprometheus.CnsControlOpsHistVec.WithLabelValues(prometheus.PrometheusCnsUpdateVolumeMetadataOpType,\n\t\t\tprometheus.PrometheusPassStatus).Observe(time.Since(start).Seconds())\n\t}\n\treturn err\n}", "title": "" }, { "docid": "ceb000f671f7211405675c34e29d5920", "score": "0.49912825", "text": "func SetMetadataInTapHandle(ctx context.Context, _ *tap.Info) (context.Context, error) {\n\t// Because metadata.FromIncomingContext re-allocates the entire map every time to ensure the keys are lowercased, we can do it once and re-use that after\n\tmeta, ok := grpcMetadata.FromIncomingContext(ctx)\n\tif ok && len(meta) > 0 {\n\t\tctx = context.WithValue(ctx, ctxKey{}, meta)\n\t}\n\treturn ctx, nil\n}", "title": "" }, { "docid": "e04db68cbaa9fd1a1b90311444fed2ae", "score": "0.4987238", "text": "func (c *UpdateIdea) Handle(tx ideaservice.Transaction, timestamp time.Time) (*ideaservice.Event, error) {\n\tvar oid int\n\tsql := \"UPDATE ideas SET description = $1, last_updated = $2, name = $3 WHERE id = $4 RETURNING organization_id\"\n\tif err := tx.QueryRow(sql, c.Description, timestamp, c.Name, c.IdeaID).Scan(&oid); err != nil {\n\t\tif err.Error() == ideaservice.MsgNoRows {\n\t\t\treturn nil, ideaservice.ErrNotFound\n\t\t}\n\t\treturn nil, err\n\t}\n\tlog.Printf(\"commands: successfully updated idea '%s' with id: %d\", c.Name, c.IdeaID)\n\treturn &ideaservice.Event{\n\t\tIdeaID: c.IdeaID,\n\t\tOrganizationID: oid,\n\t\tPayload: map[string]interface{}{\"id\": c.IdeaID, \"name\": c.Name},\n\t\tTimestamp: timestamp,\n\t\tType: ideaUpdated}, nil\n}", "title": "" }, { "docid": "ceb4321bb09e69e1d0f12294614277b8", "score": "0.4984079", "text": "func (npc *grafanaConfigController) handleConfigMapUpdate(oldObj, newObj interface{}) {\n\tconfigMap := newObj.(*corev1.ConfigMap)\n\t// oldConfigMap := oldObj.(*corev1.ConfigMap)\n\tglog.V(11).Infof(\"Received update for ConfigMap: %s/%s\", configMap.Namespace, configMap.Name)\n\tif npc.isWatchedLabel(configMap) {\n\t\tnpc.processConfigMap(configMap, false)\n\t} else {\n\t\tglog.V(12).Infof(\"Skipping non grafana labeled ConfigMap: %s/%s\", configMap.Namespace, configMap.Name)\n\t}\n}", "title": "" }, { "docid": "08be9f011d38490ab2295727c93edcc4", "score": "0.4960928", "text": "func (c *RelabelConfigController) handleSecretUpdate(oldObj, newObj interface{}) {\n\tklog.V(4).Infof(\"AlertRelabelConfig %q secret updated\", secretName)\n\tc.enqueue(fmt.Sprintf(\"secret/%s/%s\", c.client.Namespace(), secretName))\n}", "title": "" }, { "docid": "e66703a597d1993fcd10c8dc2e36b422", "score": "0.49247977", "text": "func handleDatastoreConfigModify(ctxArg interface{}, key string,\n\tconfigArg interface{}) {\n\n\tctx := ctxArg.(*downloaderContext)\n\tconfig := configArg.(types.DatastoreConfig)\n\tlog.Infof(\"handleDatastoreConfigModify for %s\\n\", key)\n\tcheckAndUpdateDownloadableObjects(ctx, config.UUID)\n\tlog.Infof(\"handleDatastoreConfigModify for %s, done\\n\", key)\n}", "title": "" }, { "docid": "f979d1510554db7ed2e73090dc94923f", "score": "0.49171326", "text": "func (sc *Chaincode) update(stub shim.ChaincodeStubInterface, args []string) peer.Response {\n}", "title": "" }, { "docid": "ee4c59783d3d47621a944198f7052c88", "score": "0.49135393", "text": "func (c *CNPStatusEventHandler) OnUpdate(key store.Key) {\n\tcnpStatusUpdate, ok := key.(*CNPNSWithMeta)\n\tif !ok {\n\t\tlog.WithFields(logrus.Fields{\"kvstore-event\": \"update\", \"key\": key.GetKeyName()}).\n\t\t\tError(\"Not updating CNP Status; error converting key to CNPNSWithMeta\")\n\t\treturn\n\t}\n\n\tcnpKey := getKeyFromObject(cnpStatusUpdate)\n\n\tlog.WithFields(logrus.Fields{\n\t\t\"uid\": cnpStatusUpdate.UID,\n\t\t\"name\": cnpStatusUpdate.Name,\n\t\t\"namespace\": cnpStatusUpdate.Namespace,\n\t\t\"node\": cnpStatusUpdate.Node,\n\t\t\"key\": cnpKey,\n\t}).Debug(\"received update event from kvstore\")\n\n\t// Send the update to the corresponding controller for the\n\t// CNP which sends all status updates to the K8s apiserver.\n\t// If the namespace is empty for the status update then the cnpKey\n\t// will correspond to the ccnpKey.\n\tupdater, ok := c.eventMap.lookup(cnpKey)\n\tif !ok {\n\t\tlog.WithField(\"cnp\", cnpKey).Debug(\"received event from kvstore for cnp for which we do not have any updater goroutine\")\n\t\treturn\n\t}\n\tnsu := &NodeStatusUpdate{node: cnpStatusUpdate.Node}\n\tnsu.CiliumNetworkPolicyNodeStatus = &(cnpStatusUpdate.CiliumNetworkPolicyNodeStatus)\n\n\t// Given that select is not deterministic, ensure that we check\n\t// for shutdown first. If not shut down, then try to send on\n\t// channel, or wait for shutdown so that we don't block forever\n\t// in case the channel is full and the updater is stopped.\n\tselect {\n\tcase <-updater.stopChan:\n\t\t// This goroutine is the only sender on this channel; we can\n\t\t// close safely if the stop channel is closed.\n\t\tclose(updater.updateChan)\n\n\tdefault:\n\t\tselect {\n\t\t// If the update is sent and we shut down after, the event\n\t\t// is 'lost'; we don't care because this means the CNP\n\t\t// was deleted anyway.\n\t\tcase updater.updateChan <- nsu:\n\t\tcase <-updater.stopChan:\n\t\t\t// This goroutine is the only sender on this channel; we can\n\t\t\t// close safely if the stop channel is closed.\n\t\t\tclose(updater.updateChan)\n\t\t}\n\t}\n}", "title": "" }, { "docid": "0c6f15e5cc832dae9ce4228d50b73b40", "score": "0.48970762", "text": "func (*StreamEvent_ChannelUpdated) Descriptor() ([]byte, []int) {\n\treturn file_chat_v1_stream_proto_rawDescGZIP(), []int{2, 4}\n}", "title": "" }, { "docid": "eb9835cf5ac6f3001f0fd4eeabbab1c2", "score": "0.48948106", "text": "func updateMetadataObjectWrapper(uuid string, configInfo *ConfigInfo, body string) {\n\tif configInfo.MetadataService != (MetadataServiceInfo{}) {\n\t\tlog.Printf(\"Attempting to update object with guid %s in Metadata Service. Request Body: %s\", uuid, body)\n\t\tresp, err := UpdateMetadataObject(uuid, &configInfo.MetadataService, []byte(body))\n\t\tif err != nil {\n\t\t\tlog.Printf(\"Could not update object with guid %s in Metadata Service. Error: %s\", uuid, err)\n\t\t} else if resp.StatusCode != http.StatusOK {\n\t\t\tlogMessage := fmt.Sprintf(\"Could not update object with guid %s in Metadata Service. Response Status Code: %d. \", uuid, resp.StatusCode)\n\t\t\tlogMessage = logMessage +\n\t\t\t\t\"If using gen3-client, a 404 here does not necessarily indicate a problem, as we would \" +\n\t\t\t\t\"only expect there to be a corresponding object in the Metadata Service if --metadata \" +\n\t\t\t\t\"was supplied to the gen3-client upload command.\"\n\t\t\tlog.Print(logMessage)\n\t\t} else {\n\t\t\tlog.Printf(\"Updated object with guid %s in Metadata Service. Response Status Code: %d\", uuid, resp.StatusCode)\n\t\t}\n\t} else {\n\t\tlog.Printf(\"Not attempting to update object with guid %s in Metadata Service because Metadata Service creds were not configured\", uuid)\n\t}\n}", "title": "" }, { "docid": "9aee2da3577cd2c99d43f51c7522875f", "score": "0.48890898", "text": "func HandleUpdateSection(app *kingpin.Application, packageQueries *queries.Package, planQueries *queries.Plan) {\n\tHandleUpdateCommands(app.Command(\"update\", \"Updates the package version or configuration for this DC/OS service\"), packageQueries, planQueries)\n}", "title": "" }, { "docid": "839fcf27d7c5784accc176a20e7cab3a", "score": "0.48725837", "text": "func HandleStatUpdate(writer http.ResponseWriter, req *http.Request) {\n\tvar peerRequest tracker.PeerRequest\n\n\tjson.NewDecoder(req.Body).Decode(&peerRequest)\n\tlogger.LogMsg(LogSign, fmt.Sprintf(\"Received update request from IP = %s\", req.RemoteAddr))\n\n\tok := dbwrapper.UpdatePeerDownload(peerRequest.Downloaded, peerRequest.Uploaded, peerRequest.Left,\n\t\tpeerRequest.Event, peerRequest.PeerID, peerRequest.InfoHash)\n\n\tif ok == true {\n\t\tlogger.LogMsg(LogSign, \"Update succeeded\")\n\t}\n}", "title": "" }, { "docid": "a931d1d7c4bd0eab459152838f7561d9", "score": "0.48492292", "text": "func (client *IdentityProviderClient) updateHandleResponse(resp *http.Response) (IdentityProviderClientUpdateResponse, error) {\n\tresult := IdentityProviderClientUpdateResponse{}\n\tif val := resp.Header.Get(\"ETag\"); val != \"\" {\n\t\tresult.ETag = &val\n\t}\n\tif err := runtime.UnmarshalAsJSON(resp, &result.IdentityProviderContract); err != nil {\n\t\treturn IdentityProviderClientUpdateResponse{}, err\n\t}\n\treturn result, nil\n}", "title": "" }, { "docid": "b418a229359ea47a2574fe9c409585fb", "score": "0.4847765", "text": "func updateMeta(ctx *base.Context, filename string) error {\n\t// TODO: For some situations (older format repos) we should use\n\t// meta.Sha256 instead of re-hashing.\n\tfmt.Printf(\"hashing... \")\n\thash, err := base.GetSha256(filename)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"getting sha256: %w\", err)\n\t}\n\n\terr = createHardLinkIfNeeded(ctx, filename, hash)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"creating hard link: %w\", err)\n\t}\n\n\terr = writeFileMeta(ctx, filename, hash)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"writing file metadata: %w\", err)\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "03e00a7d9ac25f017fb444eaa47bbdaa", "score": "0.48371595", "text": "func (c *Code) Update(r *http.Request) error {\n\tcode := c.Code\n\tif r != nil {\n\t\tcode = r.FormValue(\"Code\")\n\t}\n\ts, d, err := source.ExtractChannelIdents(code)\n\tif err != nil {\n\t\treturn err\n\t}\n\tc.Code = code\n\tc.chansRd, c.chansWr = s, d\n\treturn nil\n}", "title": "" }, { "docid": "6c381b24e3fe4823872a2efecf88662c", "score": "0.48367435", "text": "func (h *KVHandler) HandleUpdate(repo repository.Repo) error {\n\tw, err := repo.Worktree()\n\tconfig := repo.GetConfig()\n\trepo.Lock()\n\tdefer repo.Unlock()\n\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tfor _, branch := range config.Branches {\n\t\terr := w.Checkout(&git.CheckoutOptions{\n\t\t\tBranch: plumbing.ReferenceName(fmt.Sprintf(\"refs/heads/%s\", branch)),\n\t\t\tForce: true,\n\t\t})\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\terr = h.UpdateToHead(repo)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "cc5108fdaff8b95fea06b49b3884659c", "score": "0.48342577", "text": "func (c *clusterNode) handleResp(clusterUpdate resource.ClusterUpdate, err error) {\n\tc.clusterHandler.clusterMutex.Lock()\n\tdefer c.clusterHandler.clusterMutex.Unlock()\n\tif err != nil { // Write this error for run() to pick up in CDS LB policy.\n\t\t// For a ClusterUpdate, the only update CDS cares about is the most\n\t\t// recent one, so opportunistically drain the update channel before\n\t\t// sending the new update.\n\t\tselect {\n\t\tcase <-c.clusterHandler.updateChannel:\n\t\tdefault:\n\t\t}\n\t\tc.clusterHandler.updateChannel <- clusterHandlerUpdate{err: err}\n\t\treturn\n\t}\n\n\tc.receivedUpdate = true\n\tc.clusterUpdate = clusterUpdate\n\n\t// If the cluster was a leaf node, if the cluster update received had change\n\t// in the cluster update then the overall cluster update would change and\n\t// there is a possibility for the overall update to build so ping cluster\n\t// handler to return. Also, if there was any children from previously,\n\t// delete the children, as the cluster type is no longer an aggregate\n\t// cluster.\n\tif clusterUpdate.ClusterType != resource.ClusterTypeAggregate {\n\t\tfor _, child := range c.children {\n\t\t\tchild.delete()\n\t\t}\n\t\tc.children = nil\n\t\t// This is an update in the one leaf node, should try to send an update\n\t\t// to the parent CDS balancer.\n\t\t//\n\t\t// Note that this update might be a duplicate from the previous one.\n\t\t// Because the update contains not only the cluster name to watch, but\n\t\t// also the extra fields (e.g. security config). There's no good way to\n\t\t// compare all the fields.\n\t\tc.clusterHandler.constructClusterUpdate()\n\t\treturn\n\t}\n\n\t// Aggregate cluster handling.\n\tnewChildren := make(map[string]bool)\n\tfor _, childName := range clusterUpdate.PrioritizedClusterNames {\n\t\tnewChildren[childName] = true\n\t}\n\n\t// These booleans help determine whether this callback will ping the overall\n\t// clusterHandler to try and construct an update to send back to CDS. This\n\t// will be determined by whether there would be a change in the overall\n\t// clusterUpdate for the whole tree (ex. change in clusterUpdate for current\n\t// cluster or a deleted child) and also if there's even a possibility for\n\t// the update to build (ex. if a child is created and a watch is started,\n\t// that child hasn't received an update yet due to the mutex lock on this\n\t// callback).\n\tvar createdChild, deletedChild bool\n\n\t// This map will represent the current children of the cluster. It will be\n\t// first added to in order to represent the new children. It will then have\n\t// any children deleted that are no longer present. Then, from the cluster\n\t// update received, will be used to construct the new child list.\n\tmapCurrentChildren := make(map[string]*clusterNode)\n\tfor _, child := range c.children {\n\t\tmapCurrentChildren[child.clusterUpdate.ClusterName] = child\n\t}\n\n\t// Add and construct any new child nodes.\n\tfor child := range newChildren {\n\t\tif _, inChildrenAlready := mapCurrentChildren[child]; !inChildrenAlready {\n\t\t\tcreatedChild = true\n\t\t\tmapCurrentChildren[child] = createClusterNode(child, c.clusterHandler.parent.xdsClient, c.clusterHandler)\n\t\t}\n\t}\n\n\t// Delete any child nodes no longer in the aggregate cluster's children.\n\tfor child := range mapCurrentChildren {\n\t\tif _, stillAChild := newChildren[child]; !stillAChild {\n\t\t\tdeletedChild = true\n\t\t\tmapCurrentChildren[child].delete()\n\t\t\tdelete(mapCurrentChildren, child)\n\t\t}\n\t}\n\n\t// The order of the children list matters, so use the clusterUpdate from\n\t// xdsclient as the ordering, and use that logical ordering for the new\n\t// children list. This will be a mixture of child nodes which are all\n\t// already constructed in the mapCurrentChildrenMap.\n\tvar children = make([]*clusterNode, 0, len(clusterUpdate.PrioritizedClusterNames))\n\n\tfor _, orderedChild := range clusterUpdate.PrioritizedClusterNames {\n\t\t// The cluster's already have watches started for them in xds client, so\n\t\t// you can use these pointers to construct the new children list, you\n\t\t// just have to put them in the correct order using the original cluster\n\t\t// update.\n\t\tcurrentChild := mapCurrentChildren[orderedChild]\n\t\tchildren = append(children, currentChild)\n\t}\n\n\tc.children = children\n\n\t// If the cluster is an aggregate cluster, if this callback created any new\n\t// child cluster nodes, then there's no possibility for a full cluster\n\t// update to successfully build, as those created children will not have\n\t// received an update yet. However, if there was simply a child deleted,\n\t// then there is a possibility that it will have a full cluster update to\n\t// build and also will have a changed overall cluster update from the\n\t// deleted child.\n\tif deletedChild && !createdChild {\n\t\tc.clusterHandler.constructClusterUpdate()\n\t}\n}", "title": "" }, { "docid": "f02c9f1afbcc30ba3beabadcb4ec4d6e", "score": "0.4831028", "text": "func UpdateChannelRoute(router *gin.RouterGroup) {\n\trouter.PUT(\":id\", UpdateChannel)\n}", "title": "" }, { "docid": "62457eea8ad7a3e9e6d8422c92f811a8", "score": "0.4830747", "text": "func (c *context) metadata(m metadataType, args Args) {\n\tc.emit(&event{Type: eventMetadata, Name: string(m), Args: args})\n}", "title": "" }, { "docid": "90ddb738638786d185b66c224d0f9c24", "score": "0.4812856", "text": "func (spv *Validator) HandleUpdate(ctx context.Context, req *admission.Request) admission.Response {\n\tshadowpod, err := spv.DecodeShadowPod(req.Object)\n\tif err != nil {\n\t\treturn admission.Errored(http.StatusInternalServerError, fmt.Errorf(\"failed decoding of ShadowPod: %w\", err))\n\t}\n\n\toldShadowpod, err := spv.DecodeShadowPod(req.OldObject)\n\tif err != nil {\n\t\treturn admission.Errored(http.StatusInternalServerError, fmt.Errorf(\"failed decoding of ShadowPod: %w\", err))\n\t}\n\n\t// Check existence and get shadow pod origin Cluster ID label\n\tclusterID, found := shadowpod.Labels[forge.LiqoOriginClusterIDKey]\n\tif !found {\n\t\tklog.Warningf(\"Missing origin Cluster ID label on ShadowPod %q\", shadowpod.Name)\n\t\treturn admission.Denied(\"missing origin Cluster ID label\")\n\t}\n\n\t// Check existence and get old shadow pod origin Cluster ID label\n\toldClusterID, found := oldShadowpod.Labels[forge.LiqoOriginClusterIDKey]\n\tif !found {\n\t\tklog.Warningf(\"Missing origin Cluster ID label on ShadowPod %q\", oldShadowpod.Name)\n\t\treturn admission.Denied(\"missing origin Cluster ID label\")\n\t}\n\n\tif clusterID != oldClusterID {\n\t\tklog.Warningf(\"The Cluster ID label of the updated shadowpod %s is different from the old one %s\", clusterID, oldClusterID)\n\t\treturn admission.Denied(\"shadopow Cluster ID label is changed\")\n\t}\n\n\tif pod.CheckShadowPodUpdate(&shadowpod.Spec.Pod, &oldShadowpod.Spec.Pod) {\n\t\treturn admission.Allowed(\"\")\n\t}\n\n\treturn admission.Denied(\"\")\n}", "title": "" }, { "docid": "3f5822aa201a5a755145c9757283f696", "score": "0.48076096", "text": "func UpdateHandler(response http.ResponseWriter, req *http.Request, rcvr *Receiver) {\n\tdefer req.Body.Close()\n\tresponse.Header().Set(\"Content-Type\", \"application/json\")\n\n\tdata, err := ioutil.ReadAll(req.Body)\n\tif err != nil {\n\t\tmessage, _ := json.Marshal(ApiErrors{[]string{err.Error()}})\n\t\tresponse.WriteHeader(http.StatusInternalServerError)\n\t\t_, err := response.Write(message)\n\t\tif err != nil {\n\t\t\tlog.Errorf(\"Error replying to client when failed to read the request body: %s\", err)\n\t\t}\n\t\treturn\n\t}\n\n\tvar evt catalog.StateChangedEvent\n\terr = json.Unmarshal(data, &evt)\n\tif err != nil {\n\t\tmessage, _ := json.Marshal(ApiErrors{[]string{err.Error()}})\n\t\tresponse.WriteHeader(http.StatusInternalServerError)\n\t\t_, err := response.Write(message)\n\t\tif err != nil {\n\t\t\tlog.Errorf(\"Error replying to client when failed to unmarshal the request JSON: %s\", err)\n\t\t}\n\t\treturn\n\t}\n\n\trcvr.StateLock.Lock()\n\tdefer rcvr.StateLock.Unlock()\n\n\tif rcvr.CurrentState == nil || rcvr.CurrentState.LastChanged.Before(evt.State.LastChanged) {\n\t\trcvr.CurrentState = evt.State\n\t\trcvr.LastSvcChanged = &evt.ChangeEvent.Service\n\n\t\tif ShouldNotify(evt.ChangeEvent.PreviousStatus, evt.ChangeEvent.Service.Status) {\n\t\t\tif !rcvr.IsSubscribed(evt.ChangeEvent.Service.Name) {\n\t\t\t\treturn\n\t\t\t}\n\n\t\t\tif rcvr.OnUpdate == nil {\n\t\t\t\tlog.Errorf(\"No OnUpdate() callback registered!\")\n\t\t\t\treturn\n\t\t\t}\n\t\t\trcvr.EnqueueUpdate()\n\t\t}\n\t}\n}", "title": "" }, { "docid": "b63e1474414835db71b99ae9e6bd70c1", "score": "0.47994268", "text": "func (e *EventHandler) Update(evt event.UpdateEvent, q workqueue.RateLimitingInterface) {\n\te.Log.V(1).Info(\"event handler received update event\",\n\t\t\"name\", evt.MetaNew.GetName(),\n\t\t\"old generation\", evt.MetaOld.GetGeneration(),\n\t\t\"old resource version\", evt.MetaOld.GetResourceVersion(),\n\t\t\"new generation\", evt.MetaNew.GetGeneration(),\n\t\t\"new resource version\", evt.MetaNew.GetResourceVersion(),\n\t)\n\n\tvar req reconcile.Request\n\tif evt.MetaOld != nil {\n\t\treq = reconcile.Request{NamespacedName: types.NamespacedName{\n\t\t\tName: evt.MetaOld.GetName(),\n\t\t\tNamespace: evt.MetaOld.GetNamespace(),\n\t\t}}\n\n\t\te.Log.Info(\"adding event to queue since old meta is not nil\")\n\t} else if evt.MetaNew != nil {\n\t\treq = reconcile.Request{NamespacedName: types.NamespacedName{\n\t\t\tName: evt.MetaNew.GetName(),\n\t\t\tNamespace: evt.MetaNew.GetNamespace(),\n\t\t}}\n\t\te.Log.Info(\"adding event to queue since new meta is not nil\")\n\t} else {\n\t\te.Log.Error(nil, \"UpdateEvent received with no new or old metadata\", \"event\", evt)\n\t}\n\tq.Add(req)\n\treturn\n}", "title": "" }, { "docid": "bb732f0a384c90e03e1426efe750e073", "score": "0.47937107", "text": "func messageUpdate(s *discordgo.Session, m *discordgo.MessageUpdate) {\n if m.BeforeUpdate != nil {\n s.ChannelMessageSend(m.ChannelID, \"Updated: \" + m.BeforeUpdate.Content)\n }\n}", "title": "" }, { "docid": "188dfcbb3511660881bfa390a68b298d", "score": "0.478737", "text": "func (m *MetadataManager) Metadata(channel string, cc string, collections ...string) *chaincode.Metadata {\n\tqueryCreator := m.queryCreatorsByChannel[channel]\n\tif queryCreator == nil {\n\t\tLogger.Warning(\"Requested Metadata for non-existent channel\", channel)\n\t\treturn nil\n\t}\n\t// Search the metadata in our local cache, and if it exists - return it, but only if\n\t// no collections were specified in the invocation.\n\tif md, found := m.deployedCCsByChannel[channel].Lookup(cc); found && len(collections) == 0 {\n\t\tLogger.Debug(\"Returning metadata for channel\", channel, \", chaincode\", cc, \":\", md)\n\t\treturn &md\n\t}\n\tquery, err := queryCreator.NewQuery()\n\tif err != nil {\n\t\tLogger.Error(\"Failed obtaining new query for channel\", channel, \":\", err)\n\t\treturn nil\n\t}\n\tmd, err := DeployedChaincodes(query, AcceptAll, len(collections) > 0, cc)\n\tif err != nil {\n\t\tLogger.Error(\"Failed querying LSCC for channel\", channel, \":\", err)\n\t\treturn nil\n\t}\n\tif len(md) == 0 {\n\t\tLogger.Warn(\"Chaincode\", cc, \"isn't defined in channel\", channel)\n\t\treturn nil\n\t}\n\n\treturn &md[0]\n}", "title": "" }, { "docid": "d3211c7c6183802ff7ed15dd40741e5d", "score": "0.47863317", "text": "func (*StreamEvent_GuildUpdated) Descriptor() ([]byte, []int) {\n\treturn file_chat_v1_stream_proto_rawDescGZIP(), []int{2, 8}\n}", "title": "" }, { "docid": "7aaca5f6b043aaac3559a2a43089c5fa", "score": "0.47713372", "text": "func (c *jsiiProxy_CfnBaiduChannel) AddMetadata(key *string, value interface{}) {\n\t_jsii_.InvokeVoid(\n\t\tc,\n\t\t\"addMetadata\",\n\t\t[]interface{}{key, value},\n\t)\n}", "title": "" }, { "docid": "322a1e66d769b12746c8dd8d218ed6d5", "score": "0.47686157", "text": "func (r *xdsResolver) handleServiceUpdate(su serviceUpdate, err error) {\n\tif r.closed.HasFired() {\n\t\t// Do not pass updates to the ClientConn once the resolver is closed.\n\t\treturn\n\t}\n\t// Remove any existing entry in updateCh and replace with the new one.\n\tselect {\n\tcase <-r.updateCh:\n\tdefault:\n\t}\n\tr.updateCh <- suWithError{su: su, err: err}\n}", "title": "" }, { "docid": "6f2eb8c9bd21048c0ddc310377a84351", "score": "0.47650996", "text": "func (w *Watcher) Update(channel string, identity string) error {\n\tev, err := json.Marshal(&event{\n\t\tId: w.id,\n\t\tPayload: identity,\n\t})\n\n\tif err != nil {\n\t\treturn err\n\t}\n\n\treturn w.conn.Publish(channel, ev).Err()\n}", "title": "" }, { "docid": "9fde7e814e8dd9b6d59bbe16348a984a", "score": "0.474356", "text": "func (node *node) syncMetadata() {\n\tif node.metaInSync {\n\t\treturn\n\t}\n\t// update metadata map\n\tif mapping, hasMapping := node.graph.mappings[node.metadataMap]; hasMapping {\n\t\tif node.metadataAdded {\n\t\t\tif node.metadata == nil {\n\t\t\t\tmapping.Delete(node.label)\n\t\t\t\tnode.metadataAdded = false\n\t\t\t} else {\n\t\t\t\tprevMeta, _ := mapping.GetValue(node.label)\n\t\t\t\tif !reflect.DeepEqual(prevMeta, node.metadata) {\n\t\t\t\t\tmapping.Update(node.label, node.metadata)\n\t\t\t\t}\n\t\t\t}\n\t\t} else if node.metadata != nil {\n\t\t\tmapping.Put(node.label, node.metadata)\n\t\t\tnode.metadataAdded = true\n\t\t}\n\t}\n\tnode.metaInSync = true\n}", "title": "" }, { "docid": "77e1629bf5f58c53004fc611dd815c8a", "score": "0.47348395", "text": "func updateRepoMetadata(repo *Repository, remote *github.Repository) {\n\trepo.HasIssues = *remote.HasIssues\n\trepo.HasWiki = *remote.HasWiki\n\trepo.OpenIssuesCount = *remote.OpenIssuesCount\n\trepo.ForksCount = *remote.ForksCount\n\trepo.WatchersCount = *remote.WatchersCount\n\trepo.UpdatedAt = (*remote.UpdatedAt).Format(\"2006-01-02\")\n\trepo.LastSync = time.Now()\n}", "title": "" }, { "docid": "5de2bb2a3627731b835a3bb24a9d0c59", "score": "0.47134215", "text": "func updateMetadata(writer http.ResponseWriter, request *http.Request, _ httprouter.Params) {\n\tvar pmErrorList pd.PrintmapsErrorList\n\tvar pmDataPost pd.PrintmapsData\n\tvar pmData pd.PrintmapsData\n\tvar pmState pd.PrintmapsState\n\n\tverifyContentType(request, &pmErrorList)\n\tverifyAccept(request, &pmErrorList)\n\n\tbodyBytes, err := ioutil.ReadAll(request.Body)\n\tif err != nil {\n\t\tmessage := fmt.Sprintf(\"error <%v> at ioutil.ReadAll()\", err)\n\t\thttp.Error(writer, message, http.StatusInternalServerError)\n\t\tlog.Printf(\"Response %d - %s\", http.StatusInternalServerError, message)\n\t\treturn\n\t}\n\n\tif err = json.Unmarshal(bodyBytes, &pmDataPost); err != nil {\n\t\tappendError(&pmErrorList, \"2001\", \"error = \"+err.Error(), \"\")\n\t}\n\n\tid := pmDataPost.Data.ID\n\tuserFiles := \"\"\n\n\t// verify ID\n\t_, err = uuid.FromString(id)\n\tif err != nil {\n\t\tappendError(&pmErrorList, \"4001\", \"error = \"+err.Error(), \"\")\n\t}\n\n\t// map directory must exist\n\tif len(pmErrorList.Errors) == 0 {\n\t\tif !pd.IsExistMapDirectory(id) {\n\t\t\tappendError(&pmErrorList, \"4002\", \"requested ID not found: \"+id, id)\n\t\t}\n\t}\n\n\t// the update data set must contains all map elements (changed + unchanged)\n\tif len(pmErrorList.Errors) == 0 {\n\t\tif err = json.Unmarshal(bodyBytes, &pmData); err != nil {\n\t\t\tappendError(&pmErrorList, \"2001\", \"error = \"+err.Error(), id)\n\t\t} else {\n\t\t\tverifyMetadata(pmData, &pmErrorList)\n\t\t}\n\t}\n\n\tif len(pmErrorList.Errors) == 0 {\n\t\t// request ok, response with updated data, persist data\n\t\tif err := pd.WriteMetadata(pmData); err != nil {\n\t\t\tmessage := fmt.Sprintf(\"error <%v> at writeMetadata()\", err)\n\t\t\thttp.Error(writer, message, http.StatusInternalServerError)\n\t\t\tlog.Printf(\"Response %d - %s\", http.StatusInternalServerError, message)\n\t\t\treturn\n\t\t}\n\n\t\tpmData.Data.Attributes.UserFiles = userFiles\n\t\tcontent, err := json.MarshalIndent(pmData, pd.IndentPrefix, pd.IndexString)\n\t\tif err != nil {\n\t\t\tmessage := fmt.Sprintf(\"error <%v> at json.MarshalIndent()\", err)\n\t\t\thttp.Error(writer, message, http.StatusInternalServerError)\n\t\t\tlog.Printf(\"Response %d - %s\", http.StatusInternalServerError, message)\n\t\t\treturn\n\t\t}\n\n\t\t// read state\n\t\tif err := pd.ReadMapstate(&pmState, id); err != nil {\n\t\t\tif !os.IsNotExist(err) {\n\t\t\t\tmessage := fmt.Sprintf(\"error <%v> at readMapstate(), id = <%s>\", err, id)\n\t\t\t\thttp.Error(writer, message, http.StatusInternalServerError)\n\t\t\t\tlog.Printf(\"Response %d - %s\", http.StatusInternalServerError, message)\n\t\t\t\treturn\n\t\t\t}\n\t\t}\n\n\t\t// write (update) state\n\t\tpmState.Data.Attributes.MapMetadataWritten = time.Now().Format(time.RFC3339)\n\t\tpmState.Data.Attributes.MapOrderSubmitted = \"\"\n\t\tpmState.Data.Attributes.MapBuildStarted = \"\"\n\t\tpmState.Data.Attributes.MapBuildCompleted = \"\"\n\t\tpmState.Data.Attributes.MapBuildSuccessful = \"\"\n\t\tpmState.Data.Attributes.MapBuildMessage = \"\"\n\t\tpmState.Data.Attributes.MapBuildBoxMillimeter = pd.BoxMillimeter{}\n\t\tpmState.Data.Attributes.MapBuildBoxPixel = pd.BoxPixel{}\n\t\tpmState.Data.Attributes.MapBuildBoxProjection = pd.BoxProjection{}\n\t\tpmState.Data.Attributes.MapBuildBoxWGS84 = pd.BoxWGS84{}\n\t\tif err = pd.WriteMapstate(pmState); err != nil {\n\t\t\tmessage := fmt.Sprintf(\"error <%v> at updateMapstate()\", err)\n\t\t\thttp.Error(writer, message, http.StatusInternalServerError)\n\t\t\tlog.Printf(\"Response %d - %s\", http.StatusInternalServerError, message)\n\t\t\treturn\n\t\t}\n\n\t\twriter.Header().Set(\"Content-Type\", pd.JSONAPIMediaType)\n\t\twriter.Header().Set(\"Content-Length\", strconv.Itoa(len(content)))\n\t\twriter.WriteHeader(http.StatusOK)\n\t\twriter.Write(content)\n\t} else {\n\t\t// request not ok, response with error list\n\t\tcontent, err := json.MarshalIndent(pmErrorList, pd.IndentPrefix, pd.IndexString)\n\t\tif err != nil {\n\t\t\tmessage := fmt.Sprintf(\"error <%v> at json.MarshalIndent()\", err)\n\t\t\thttp.Error(writer, message, http.StatusInternalServerError)\n\t\t\tlog.Printf(\"Response %d - %s\", http.StatusInternalServerError, message)\n\t\t\treturn\n\t\t}\n\n\t\twriter.Header().Set(\"Content-Type\", pd.JSONAPIMediaType)\n\t\twriter.Header().Set(\"Content-Length\", strconv.Itoa(len(content)))\n\t\twriter.WriteHeader(http.StatusBadRequest)\n\t\twriter.Write(content)\n\t}\n}", "title": "" }, { "docid": "e0c1d096aa9da4fa16ec32e69bb10d4d", "score": "0.46886957", "text": "func updateProjectMetadata() {\n\ttargetURL := projectURL + \"/\" + strconv.FormatInt(prjMetaUpdate.projectID, 10) + \"/metadatas\"\n\n\tp, err := json.Marshal(&prjMetaUpdate)\n\tif err != nil {\n\t\tfmt.Println(\"error:\", err)\n\t\treturn\n\t}\n\n\tutils.Put(targetURL, string(p))\n}", "title": "" }, { "docid": "79c81e1b959a0e51f2d757b01c79eab2", "score": "0.46876577", "text": "func (m GCEMonitor) MonitorUpdate(key string, handler UpdateHandler) error {\n\treturn gcemetadata.Subscribe(key, func(v string, ok bool) error {\n\t\tif ok {\n\t\t\terr := handler(key, []byte(v))\n\t\t\tif err != nil {\n\t\t\t\tlog.\n\t\t\t\t\tWithError(err).\n\t\t\t\t\tError(\"Failed to handle a metadata update\")\n\t\t\t}\n\t\t} else {\n\t\t\tlog.Info(\"Checking a metadata updated\")\n\t\t}\n\t\treturn nil\n\t})\n}", "title": "" }, { "docid": "d08920894bc887dab79fc292a9893491", "score": "0.4674575", "text": "func HandleInfoCommand(s *discordgo.Session, m *discordgo.Message, t0 time.Time) {\n\n\tt1 := time.Now()\n\tchannel, err := s.Channel(m.ChannelID)\n\tif err != nil {\n\t\tfmt.Println(\"[ERROR] Issue finding channel by ID: \", err)\n\t\treturn\n\t}\n\n\tchannelName := channel.Name\n\tmessage := \"```txt\\n%s\\n%s\\n%-16s%-20s\\n%-16s%-20s\\n%-16s%-20s```\"\n\tmessage = fmt.Sprintf(message, \"GameBot Information\", strings.Repeat(\"-\", len(\"GameBot Information\")), \"ChannelID\", m.ChannelID, \"Channel Name\", channelName, \"Uptime\", (t1.Sub(t0).String()))\n\ts.ChannelMessageSend(m.ChannelID, message)\n}", "title": "" }, { "docid": "bed6e7893d56c1e8e53e154281ef3399", "score": "0.46730635", "text": "func (g *gitstoreRepoImpl) UpdateCallback(ctx context.Context, graph *Graph) error {\n\treturn nil\n}", "title": "" }, { "docid": "781e50ab25527e500677c772a7d6e2fb", "score": "0.46659264", "text": "func (obj *TGDBConnection) GetGraphMetadata(refresh bool) (types.TGGraphMetadata, types.TGError) {\n\tlogger.Log(fmt.Sprint(\"Entering TGDBConnection:GetGraphMetadata\"))\n\tif refresh {\n\t\tobj.connPoolImpl.AdminLock()\n\t\tdefer obj.connPoolImpl.AdminUnlock()\n\n\t\tlogger.Debug(fmt.Sprint(\"Inside TGDBConnection::GetGraphMetadata about to createChannelRequest() for: pdu.VerbMetadataRequest\"))\n\t\t// Create a channel request\n\t\tmsgRequest, channelResponse, err := createChannelRequest(obj, pdu.VerbMetadataRequest)\n\t\tif err != nil {\n\t\t\tlogger.Error(fmt.Sprintf(\"ERROR: Returning TGDBConnection:GetGraphMetadata - unable to createChannelRequest(pdu.VerbMetadataRequest w/ error: '%s'\", err.Error()))\n\t\t\treturn nil, err\n\t\t}\n\t\tmetaRequest := msgRequest.(*pdu.MetadataRequest)\n\t\tlogger.Debug(fmt.Sprintf(\"Inside TGDBConnection::GetGraphMetadata createChannelRequest() returned MsgRequest: '%+v' ChannelResponse: '%+v'\", msgRequest, channelResponse.(*channel.BlockingChannelResponse)))\n\n\t\tlogger.Debug(fmt.Sprint(\"Inside TGDBConnection::GetGraphMetadata about to obj.GetChannel().SendRequest() for: pdu.VerbMetadataRequest\"))\n\t\t// Execute request on channel and get the response\n\t\tmsgResponse, channelErr := obj.GetChannel().SendRequest(metaRequest, channelResponse.(*channel.BlockingChannelResponse))\n\t\tif channelErr != nil {\n\t\t\tlogger.Error(fmt.Sprintf(\"ERROR: Returning TGDBConnection:GetGraphMetadata - unable to channel.SendRequest() w/ error: '%s'\", channelErr.Error()))\n\t\t\treturn nil, channelErr\n\t\t}\n\t\t//logger.Debug(fmt.Sprintf(\"Inside TGDBConnection::GetGraphMetadata received response for: pdu.VerbMetadataRequest as '%+v'\", msgResponse))\n\n\t\tresponse := msgResponse.(*pdu.MetadataResponse)\n\t\tattrDescList := response.GetAttrDescList()\n\t\tedgeTypeList := response.GetEdgeTypeList()\n\t\tnodeTypeList := response.GetNodeTypeList()\n\n\t\tgmd := obj.graphObjFactory.GetGraphMetaData()\n\t\tlogger.Debug(fmt.Sprint(\"Inside TGDBConnection::GetGraphMetadata about to update GraphMetadata\"))\n\t\tuErr := gmd.UpdateMetadata(attrDescList, nodeTypeList, edgeTypeList)\n\t\tif uErr != nil {\n\t\t\tlogger.Error(fmt.Sprintf(\"ERROR: Returning TGDBConnection:GetGraphMetadata - unable to gmd.UpdateMetadata() w/ error: '%s'\", uErr.Error()))\n\t\t\treturn nil, uErr\n\t\t}\n\t\tlogger.Debug(fmt.Sprint(\"Inside TGDBConnection::GetGraphMetadata successfully updated GraphMetadata\"))\n\t}\n\tlogger.Log(fmt.Sprint(\"Returning TGDBConnection:GetGraphMetadata\"))\n\treturn obj.graphObjFactory.GetGraphMetaData(), nil\n}", "title": "" }, { "docid": "c83edd5f5b2d9c9256409c36b91b4461", "score": "0.46609053", "text": "func (rs *RuntimeClassSyncer) handleUpdateEvent(old, new interface{}) {\n\tnewRuntimeCLass := new.(*v1beta1.RuntimeClass)\n\toldRuntimeCLass := old.(*v1beta1.RuntimeClass)\n\tif newRuntimeCLass.ResourceVersion == oldRuntimeCLass.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\trs.addKindAndVersion(newRuntimeCLass)\n\tklog.V(4).Infof(\"update runtimeclass: %s\", newRuntimeCLass.Name)\n\n\tgo syncToNode(watch.Modified, util.ResourceRuntimeClass, newRuntimeCLass)\n\n\tsyncToStorage(rs.ctx, watch.Modified, util.ResourceRuntimeClass, newRuntimeCLass)\n}", "title": "" }, { "docid": "84404c1be1daa6136f9bf58bdd58361e", "score": "0.46542728", "text": "func (npc *ingressConfigController) handleIngressUpdate(oldObj, newObj interface{}) {\n\tingress := newObj.(*extensionsv1beta.Ingress)\n\t// oldingress := oldObj.(*extensionsv1beta.Ingress)\n\tglog.V(11).Infof(\"Received update for ingress: %s/%s\", ingress.Namespace, ingress.Name)\n\tif npc.isWatchedLabel(ingress) {\n\t\tsvc := npc.options.NewService(ingress)\n\t\tnpc.options.Data.Services[string(ingress.UID)] = svc\n\t} else {\n\t\tglog.V(12).Infof(\"Skipping non ingress labeled ingress: %s/%s\", ingress.Namespace, ingress.Name)\n\t}\n\n}", "title": "" }, { "docid": "769b80aa374433388a7c7f766cd355f3", "score": "0.46507964", "text": "func (dm *InfoManager) HandleNodeInfo(ctx context.Context, peerID string, msg *iotextypes.NodeInfo) {\n\tlog.L().Debug(\"nodeinfo manager handle node info\")\n\t// recover pubkey\n\thash := hashNodeInfo(msg.Info)\n\tpubKey, err := crypto.RecoverPubkey(hash[:], msg.Signature)\n\tif err != nil {\n\t\tlog.L().Warn(\"nodeinfo manager recover pubkey failed\", zap.Error(err))\n\t\treturn\n\t}\n\t// verify signature\n\tif addr := pubKey.Address().String(); addr != msg.Info.Address {\n\t\tlog.L().Warn(\"nodeinfo manager node info message verify failed\", zap.String(\"expected\", addr), zap.String(\"recieved\", msg.Info.Address))\n\t\treturn\n\t}\n\n\tdm.updateNode(&Info{\n\t\tVersion: msg.Info.Version,\n\t\tHeight: msg.Info.Height,\n\t\tTimestamp: msg.Info.Timestamp.AsTime(),\n\t\tAddress: msg.Info.Address,\n\t\tPeerID: peerID,\n\t})\n}", "title": "" }, { "docid": "1f658c83b9857a6820f3f391f0936f70", "score": "0.46488148", "text": "func patchMetadataTypeCB(payload []byte, resolver func() string) []byte {\n\tif containsMetadataType(payload) {\n\t\treturn payload\n\t}\n\treturn patchMetadataType(payload, resolver())\n}", "title": "" }, { "docid": "a446a95fe56f2122fdf753fdd85d084c", "score": "0.4646484", "text": "func (mc *MetricsCache) start() error {\n\n\tgo func() {\n\t\tfor {\n\t\t\tselect {\n\n\t\t\tcase resp := <-mc.responseChan:\n\t\t\t\t// Handle V3io update expression responses\n\n\t\t\t\tmetric, ok := resp.Context.(*MetricState)\n\t\t\t\trespErr := resp.Error\n\n\t\t\t\tif respErr != nil {\n\t\t\t\t\tmc.logger.ErrorWith(\"failed v3io Update request\", \"metric\", resp.ID, \"err\", respErr,\n\t\t\t\t\t\t\"request\", *resp.Request().Input.(*v3io.UpdateItemInput).Expression, \"key\",\n\t\t\t\t\t\tresp.Request().Input.(*v3io.UpdateItemInput).Path)\n\t\t\t\t\t// TODO: how to handle further ?\n\t\t\t\t} else {\n\t\t\t\t\tmc.logger.DebugWith(\"Process Update resp\", \"id\", resp.ID,\n\t\t\t\t\t\t\"request\", *resp.Request().Input.(*v3io.UpdateItemInput).Expression, \"key\",\n\t\t\t\t\t\tresp.Request().Input.(*v3io.UpdateItemInput).Path)\n\t\t\t\t}\n\n\t\t\t\tresp.Release()\n\n\t\t\t\tif ok {\n\t\t\t\t\t// process the response and initialize a new request to update uncommitted samples\n\t\t\t\t\tmetric.Lock()\n\t\t\t\t\tif respErr == nil {\n\t\t\t\t\t\t// Set fields so next write will not include redundant info (bytes, lables, init_array)\n\t\t\t\t\t\tmetric.store.ProcessWriteResp()\n\t\t\t\t\t} else {\n\t\t\t\t\t\tmetric.retryCount++\n\t\t\t\t\t\tif metric.retryCount == MAX_WRITE_RETRY {\n\t\t\t\t\t\t\tmetric.err = errors.Wrap(respErr, \"chunk update failed\")\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\n\t\t\t\t\terr := metric.store.WriteChunks(mc, metric)\n\t\t\t\t\tif err != nil {\n\t\t\t\t\t\tmc.logger.ErrorWith(\"Submit failed\", \"metric\", metric.Lset, \"err\", err)\n\t\t\t\t\t\tmetric.err = errors.Wrap(err, \"chunk write submit failed\")\n\t\t\t\t\t}\n\n\t\t\t\t\tmetric.Unlock()\n\n\t\t\t\t} else {\n\t\t\t\t\tmc.logger.ErrorWith(\"Resp doesnt have a metric pointer\", \"id\", resp.ID)\n\t\t\t\t}\n\n\t\t\tcase resp := <-mc.nameUpdateChan:\n\t\t\t\t// Handle V3io putItem in names table\n\n\t\t\t\tmetric, ok := resp.Context.(*MetricState)\n\t\t\t\tif ok {\n\t\t\t\t\tmetric.Lock()\n\t\t\t\t\tif resp.Error != nil {\n\t\t\t\t\t\tmc.logger.ErrorWith(\"Process Update name failed\", \"id\", resp.ID, \"name\", metric.name)\n\t\t\t\t\t} else {\n\t\t\t\t\t\tmc.logger.DebugWith(\"Process Update name resp\", \"id\", resp.ID, \"name\", metric.name)\n\t\t\t\t\t}\n\t\t\t\t\tmetric.Unlock()\n\t\t\t\t}\n\n\t\t\t\tresp.Release()\n\n\t\t\tcase app := <-mc.asyncAppendChan:\n\t\t\t\t// Handle append requests (Add / AddFast)\n\n\t\t\t\tmetric := app.metric\n\t\t\t\tmetric.Lock()\n\n\t\t\t\t// if its the first Append we need to get the metric state from the DB\n\t\t\t\tif metric.store.GetState() == storeStateInit {\n\t\t\t\t\terr := metric.store.GetChunksState(mc, metric, app.t)\n\t\t\t\t\tif err != nil {\n\t\t\t\t\t\tmetric.err = err\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tmetric.store.Append(app.t, app.v)\n\n\t\t\t\tif metric.store.IsReady() {\n\t\t\t\t\t// if there are no in flight requests, update the DB\n\t\t\t\t\terr := metric.store.WriteChunks(mc, metric)\n\t\t\t\t\tif err != nil {\n\t\t\t\t\t\tmc.logger.ErrorWith(\"Async Submit failed\", \"metric\", metric.Lset, \"err\", err)\n\t\t\t\t\t\tmetric.err = err\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tmetric.Unlock()\n\n\t\t\tcase resp := <-mc.getRespChan:\n\t\t\t\t// Handle V3io GetItem responses\n\n\t\t\t\tmetric, ok := resp.Context.(*MetricState)\n\t\t\t\trespErr := resp.Error\n\n\t\t\t\tif respErr != nil {\n\t\t\t\t\tmc.logger.DebugWith(\"failed v3io GetItem request\", \"metric\", resp.ID, \"err\", respErr,\n\t\t\t\t\t\t\"key\", resp.Request().Input.(*v3io.GetItemInput).Path)\n\t\t\t\t} else {\n\t\t\t\t\tmc.logger.DebugWith(\"Process GetItem resp\", \"id\", resp.ID,\n\t\t\t\t\t\t\"key\", resp.Request().Input.(*v3io.GetItemInput).Path)\n\t\t\t\t}\n\n\t\t\t\tif ok {\n\t\t\t\t\t// process the Get response (update metric state) and commit pending samples to the DB\n\t\t\t\t\tmetric.Lock()\n\t\t\t\t\tmetric.store.ProcessGetResp(mc, metric, resp)\n\n\t\t\t\t\tif metric.store.IsReady() {\n\t\t\t\t\t\t// if there are no in flight requests, update the DB\n\t\t\t\t\t\terr := metric.store.WriteChunks(mc, metric)\n\t\t\t\t\t\tif err != nil {\n\t\t\t\t\t\t\tmc.logger.ErrorWith(\"Async Submit failed\", \"metric\", metric.Lset, \"err\", err)\n\t\t\t\t\t\t\tmetric.err = err\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\n\t\t\t\t\tmetric.Unlock()\n\t\t\t\t} else {\n\t\t\t\t\tmc.logger.ErrorWith(\"GetItem Req ID not found\", \"id\", resp.ID)\n\t\t\t\t}\n\n\t\t\t\tresp.Release()\n\n\t\t\t}\n\t\t}\n\t}()\n\n\treturn nil\n}", "title": "" }, { "docid": "2778be6330009132bff6abc90901f297", "score": "0.46266872", "text": "func (*UpdateChannelInformationResponse) Descriptor() ([]byte, []int) {\n\treturn file_chat_v1_channels_proto_rawDescGZIP(), []int{7}\n}", "title": "" }, { "docid": "38bbf889c1084c7bb042898bbccb5035", "score": "0.4616925", "text": "func metadataFromOldJson(jsonMetadata string) *Metadata {\n\toldMd := &oldMetadata{}\n\terr := json.Unmarshal([]byte(jsonMetadata), oldMd)\n\tif err != nil {\n\t\tpanic(\"Unable to parse trigger oldMetadata: \" + err.Error())\n\t}\n\n\tmd := &Metadata{}\n\n\tmd.ID = oldMd.Ref\n\n\tif len(oldMd.Settings) > 0 {\n\t\tmd.Settings = make(map[string]data.TypedValue, len(oldMd.Settings))\n\t\tfor _, attr := range oldMd.Settings {\n\t\t\tmd.Settings[attr.Name()] = data.NewTypedValue(attr.Type(), attr.Value())\n\t\t}\n\t}\n\tif len(oldMd.Output) > 0 {\n\t\tmd.Output = make(map[string]data.TypedValue, len(oldMd.Output))\n\t\tfor _, attr := range oldMd.Output {\n\t\t\tmd.Output[attr.Name()] = data.NewTypedValue(attr.Type(), attr.Value())\n\t\t}\n\t}\n\n\tif len(oldMd.Reply) > 0 {\n\t\tmd.Reply = make(map[string]data.TypedValue, len(oldMd.Reply))\n\t\tfor _, attr := range oldMd.Reply {\n\t\t\tmd.Reply[attr.Name()] = data.NewTypedValue(attr.Type(), attr.Value())\n\t\t}\n\t}\n\tif oldMd.Handler != nil && len(oldMd.Handler.Settings) > 0 {\n\t\tmd.HandlerSettings = make(map[string]data.TypedValue, len(oldMd.Handler.Settings))\n\t\tfor _, attr := range oldMd.Handler.Settings {\n\t\t\tmd.HandlerSettings[attr.Name()] = data.NewTypedValue(attr.Type(), attr.Value())\n\t\t}\n\t}\n\n\treturn md\n}", "title": "" }, { "docid": "c98e81565b73b6b0468f813b88a4ec8a", "score": "0.4599885", "text": "func (us *UdpSession) handleMetaData(b []byte, udpAddr *net.UDPAddr) error {\n\tif !us.isListener { // dialer should not get session meta data.\n\t\treturn nil\n\t}\n\n\tsessData, err := parseSessionData(b)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tswitch sessData.MsgType {\n\tcase pb.MsgType_SESSIONID:\n\t\tmetadata := &pb.SessionMetadata{}\n\t\terr = proto.Unmarshal(sessData.Data, metadata)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tusa := &udpSessionAddr{sessionID: metadata.Id, remoteNknAddr: metadata.DialerNknAddr, udpAddr: udpAddr}\n\t\tif _, ok := us.sessKeyToSessAddr[usa.String()]; ok { // This session is exist already\n\t\t\treturn nil\n\t\t}\n\n\t\tus.Lock()\n\t\tus.sessKeyToSessAddr[usa.String()] = usa\n\t\tus.udpAddrToSessAddr[udpAddr.String()] = usa\n\t\tus.Unlock()\n\t\tus.addCodec(udpAddr, metadata.DialerNknAddr) // listener add codec\n\n\tcase pb.MsgType_CLOSE:\n\t\tif usa, ok := us.udpAddrToSessAddr[udpAddr.String()]; ok {\n\t\t\tus.handleConnClosed(usa.String())\n\t\t}\n\n\tdefault:\n\t\treturn ErrWrongMsgFormat\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "ce7722ab9dc40d31530c54aad505e701", "score": "0.4598054", "text": "func FileUpdateMetaHandler(w http.ResponseWriter, r *http.Request) {\n\tr.ParseForm()\n\topType := r.Form.Get(\"op\")\n\tif opType != \"0\" {\n\t\tw.WriteHeader(http.StatusForbidden)\n\t\treturn\n\t}\n\n\tif r.Method != \"POST\" {\n\t\tw.WriteHeader(http.StatusMethodNotAllowed)\n\t\treturn\n\t}\n\tfMD5 := r.Form.Get(\"filemd5\")\n\tfilename := r.Form.Get(\"filename\")\n\n\tfileMeta := filemeta.GetFileMeta(fMD5)\n\tfileMeta.FileName = filename\n\tfilemeta.UpdateFileMeta(fileMeta)\n\tdata, err := json.Marshal(fileMeta)\n\tif err != nil {\n\t\tw.WriteHeader(http.StatusInternalServerError)\n\t\treturn\n\t}\n\tw.WriteHeader(http.StatusOK)\n\tw.Write(data)\n}", "title": "" }, { "docid": "a8ae01e709f9ae31368771a6df576491", "score": "0.4595389", "text": "func (c *jsiiProxy_CfnGCMChannel) AddMetadata(key *string, value interface{}) {\n\t_jsii_.InvokeVoid(\n\t\tc,\n\t\t\"addMetadata\",\n\t\t[]interface{}{key, value},\n\t)\n}", "title": "" }, { "docid": "8d1620eee1480e270968e2cd29aa173d", "score": "0.45922682", "text": "func Consumer(db *gorm.DB, ch <-chan *util.ChanMetaData) (err error) {\n\ttx := db.Begin()\n\tdefer func() {\n\t\tif err == nil {\n\t\t\ttx.Commit()\n\t\t\tlogrus.Info(\"tx commit successfully\")\n\t\t} else {\n\t\t\ttx.Rollback()\n\t\t\tlogrus.Error(err, \"rollback...\")\n\t\t}\n\t}()\n\nLoop:\n\tfor {\n\t\tselect {\n\t\tcase metadata, ok := <-ch:\n\t\t\tif !ok {\n\t\t\t\tbreak Loop\n\t\t\t}\n\t\t\ttx.Model(&model.Student{ID: metadata.ID}).Update(metadata.Col, metadata.NewData)\n\t\t}\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "aedba92407023a91c13c14a973ad3dd9", "score": "0.45902142", "text": "func (c *jsiiProxy_CfnADMChannel) AddMetadata(key *string, value interface{}) {\n\t_jsii_.InvokeVoid(\n\t\tc,\n\t\t\"addMetadata\",\n\t\t[]interface{}{key, value},\n\t)\n}", "title": "" }, { "docid": "2d51f48ea3f6cf7441eb12a5a6027797", "score": "0.45844868", "text": "func BetaMetadataUpdate(oldMDMap map[string]interface{}, newMDMap map[string]interface{}, serverMD *compute.Metadata) {\n\ttpgcompute.BetaMetadataUpdate(oldMDMap, newMDMap, serverMD)\n}", "title": "" }, { "docid": "ecac3c28f3140d061f078880a0eb3386", "score": "0.45694438", "text": "func TelegramEventHandler(\n\ttelegramBot *tgbotapi.BotAPI, ghClient *github.Client, ghCtx context.Context, config *Config) {\n\n\tlogger.Infof(\"[TelegramBot] Authorized on account %s\", telegramBot.Self.UserName)\n\tu := tgbotapi.NewUpdate(0)\n\tu.Timeout = 60\n\n\t// check if the version has changed\n\n\tif config.Version != Version {\n\t\thandlerArgs := &MessageHandlerArgs{\n\t\t\tbot: telegramBot,\n\t\t\targuments: \"\",\n\t\t\tconfig: config,\n\t\t}\n\t\tOnVersionChangedHandler(*handlerArgs)\n\t}\n\n\tupdates, err := telegramBot.GetUpdatesChan(u)\n\tif err != nil {\n\t\tlogger.Fatal(\"Failed to GetChannel updates channel\")\n\t\treturn\n\t}\n\n\t// initialize the message counters\n\tfor k := range config.Channels {\n\t\tTempChanAttrs[k] = &TempChanAttr{\n\t\t\tPluses: config.ChanAttr[k].Pluses,\n\t\t\tMessageCount: config.ChanAttr[k].MessageCount,\n\t\t}\n\t}\n\n\tc := cron.New()\n\t// set the cron jobs\n\tScheduleCronFromConfig(config, telegramBot, c)\n\tgo c.Start()\n\n\tfor update := range updates {\n\t\tif update.Message == nil { // ignore any non-Message Updates\n\t\t\tcontinue\n\t\t}\n\n\t\thandlerArgs := &MessageHandlerArgs{\n\t\t\tbot: telegramBot,\n\t\t\tupdate: update,\n\t\t\targuments: \"\",\n\t\t\tconfig: config,\n\t\t\tcronMgr: c,\n\t\t\tgh: ghClient,\n\t\t\tghCtx: ghCtx,\n\t\t}\n\n\t\t// call the handler\n\t\tTelegramOnMessageHandler(*handlerArgs)\n\t}\n\n}", "title": "" }, { "docid": "13ce210ed2a74e7f499dece9408e6b70", "score": "0.45666564", "text": "func (h *downstreamHandle) autoEmitMetadata() {\n\tmetadata, err := metadata.Get(h.CloseContext())\n\tif err != nil {\n\t\tlog.Warnf(\"Failed to get agent metadata: %v\", err)\n\t\treturn\n\t}\n\tmsg := proto.UpstreamInventoryAgentMetadata{\n\t\tOS: metadata.OS,\n\t\tOSVersion: metadata.OSVersion,\n\t\tHostArchitecture: metadata.HostArchitecture,\n\t\tGlibcVersion: metadata.GlibcVersion,\n\t\tInstallMethods: metadata.InstallMethods,\n\t\tContainerRuntime: metadata.ContainerRuntime,\n\t\tContainerOrchestrator: metadata.ContainerOrchestrator,\n\t\tCloudEnvironment: metadata.CloudEnvironment,\n\t}\n\tfor {\n\t\t// Wait for stream to be opened.\n\t\tvar sender DownstreamSender\n\t\tselect {\n\t\tcase sender = <-h.Sender():\n\t\tcase <-h.CloseContext().Done():\n\t\t\treturn\n\t\t}\n\n\t\t// Send metadata.\n\t\tif err := sender.Send(h.CloseContext(), msg); err != nil {\n\t\t\tlog.Warnf(\"Failed to send agent metadata: %v\", err)\n\t\t}\n\n\t\t// Block for the duration of the stream.\n\t\tselect {\n\t\tcase <-sender.Done():\n\t\tcase <-h.CloseContext().Done():\n\t\t\treturn\n\t\t}\n\t}\n}", "title": "" }, { "docid": "6de85a358c43e58bad5e09b21ef34a93", "score": "0.45605683", "text": "func (*StreamEvent_ReactionUpdated) Descriptor() ([]byte, []int) {\n\treturn file_chat_v1_stream_proto_rawDescGZIP(), []int{2, 25}\n}", "title": "" }, { "docid": "e969e334b4ff1065a1f25dc13af65e0a", "score": "0.4558134", "text": "func (s *Server) handleConfigUpdate(msg *proto.ConfigUpdate) (err error) {\n\tif s.state != StateConnected {\n\t\treturn fmt.Errorf(\"Received ConfigUpdate but server is not in Connected state! state: %v\", s.state)\n\t}\n\ts.log.Infof(\"Got config from felix: %+v\", msg)\n\ts.state = StateSyncing\n\n\toldFelixConfig := s.felixConfig\n\tremoveFelixConfigFileField(msg.Config)\n\ts.felixConfig = felixConfig.New()\n\t_, err = s.felixConfig.UpdateFrom(msg.Config, felixConfig.InternalOverride)\n\tif err != nil {\n\t\treturn err\n\t}\n\tchanged := !reflect.DeepEqual(oldFelixConfig.RawValues(), s.felixConfig.RawValues())\n\n\t// Note: This function will be called each time the Felix config changes.\n\t// If we start handling config settings that require agent restart,\n\t// we'll need to add a mechanism for that\n\tif !s.felixConfigReceived {\n\t\ts.felixConfigReceived = true\n\t\ts.FelixConfigChan <- s.felixConfig\n\t}\n\n\tif !changed {\n\t\treturn nil\n\t}\n\n\tcommon.SendEvent(common.CalicoVppEvent{\n\t\tType: common.FelixConfChanged,\n\t\tNew: s.felixConfig,\n\t\tOld: oldFelixConfig,\n\t})\n\n\tif s.felixConfig.DefaultEndpointToHostAction != oldFelixConfig.DefaultEndpointToHostAction {\n\t\ts.log.Infof(\"Change in EndpointToHostAction to %+v\", s.getEndpointToHostAction())\n\t\tworkloadsToHostAllowRule := &Rule{\n\t\t\tVppID: types.InvalidID,\n\t\t\tRule: &types.Rule{\n\t\t\t\tAction: s.getEndpointToHostAction(),\n\t\t\t},\n\t\t\tSrcIPSetNames: []string{\"calico-vpp-wep-addr-ipset\"},\n\t\t}\n\t\tpolicy := s.workloadsToHostPolicy.DeepCopy()\n\t\tpolicy.InboundRules = []*Rule{workloadsToHostAllowRule}\n\t\terr := s.workloadsToHostPolicy.Update(s.vpp, policy,\n\t\t\t&PolicyState{IPSets: map[string]*IPSet{\"calico-vpp-wep-addr-ipset\": s.allPodsIpset}})\n\t\tif err != nil {\n\t\t\treturn errors.Wrap(err, \"error updating workloadsToHostPolicy\")\n\t\t}\n\t}\n\tif !protoPortListEqual(s.felixConfig.FailsafeInboundHostPorts, oldFelixConfig.FailsafeInboundHostPorts) ||\n\t\t!protoPortListEqual(s.felixConfig.FailsafeOutboundHostPorts, oldFelixConfig.FailsafeOutboundHostPorts) {\n\t\terr = s.createFailSafePolicies()\n\t\tif err != nil {\n\t\t\treturn errors.Wrap(err, \"error updating FailSafePolicies\")\n\t\t}\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "48e25a185a7db0883c4d17104dd3bc0d", "score": "0.45569342", "text": "func (mc *MetricsCache) handleResponse(metric *MetricState, resp *v3io.Response, canWrite bool) bool {\n\tdefer resp.Release()\n\tmetric.Lock()\n\tdefer metric.Unlock()\n\n\treqInput := resp.Request().Input\n\n\tif resp.Error != nil && metric.getState() != storeStateGet {\n\t\treq := reqInput.(*v3io.UpdateItemInput)\n\t\tmc.logger.DebugWith(\"I/O failure\", \"id\", resp.ID, \"err\", resp.Error, \"key\", metric.key,\n\t\t\t\"in-flight\", mc.updatesInFlight, \"mqueue\", mc.metricQueue.Length(),\n\t\t\t\"numsamples\", metric.store.samplesQueueLength(), \"path\", req.Path, \"update expression\", req.Expression)\n\t} else {\n\t\tmc.logger.DebugWith(\"I/O response\", \"id\", resp.ID, \"err\", resp.Error, \"key\", metric.key, \"request type\",\n\t\t\treflect.TypeOf(reqInput), \"request\", reqInput)\n\t}\n\n\tclear := func() {\n\t\tresp.Release()\n\t\tmetric.store = newChunkStore(mc.logger, metric.Lset.LabelNames(), metric.store.isAggr())\n\t\tmetric.retryCount = 0\n\t\tmetric.setState(storeStateInit)\n\t\tmc.cacheMetricMap.ResetMetric(metric.hash)\n\t}\n\n\tif metric.getState() == storeStateGet {\n\t\t// Handle Get response, sync metric state with the DB\n\t\tmetric.store.processGetResp(mc, metric, resp)\n\n\t} else {\n\t\t// Handle Update Expression responses\n\t\tif resp.Error == nil {\n\t\t\tif !metric.store.isAggr() {\n\t\t\t\t// Set fields so next write won't include redundant info (bytes, labels, init_array)\n\t\t\t\tmetric.store.ProcessWriteResp()\n\t\t\t}\n\t\t\tmetric.retryCount = 0\n\t\t} else {\n\t\t\t// Count errors\n\t\t\tmc.performanceReporter.IncrementCounter(\"ChunkUpdateRetries\", 1)\n\n\t\t\t// Metrics with too many update errors go into Error state\n\t\t\tmetric.retryCount++\n\t\t\tif e, hasStatusCode := resp.Error.(v3ioerrors.ErrorWithStatusCode); hasStatusCode && e.StatusCode() != http.StatusServiceUnavailable {\n\t\t\t\t// If condition was evaluated as false log this and report this error upstream.\n\t\t\t\tif utils.IsFalseConditionError(resp.Error) {\n\t\t\t\t\treq := reqInput.(*v3io.UpdateItemInput)\n\t\t\t\t\t// This might happen on attempt to add metric value of wrong type, i.e. float <-> string\n\t\t\t\t\terrMsg := fmt.Sprintf(\"failed to ingest values of incompatible data type into metric %s.\", req.Path)\n\t\t\t\t\tmc.logger.DebugWith(errMsg)\n\t\t\t\t\tsetError(mc, metric, errors.New(errMsg))\n\t\t\t\t} else {\n\t\t\t\t\tmc.logger.ErrorWith(fmt.Sprintf(\"Chunk update failed with status code %d.\", e.StatusCode()))\n\t\t\t\t\tsetError(mc, metric, errors.Wrap(resp.Error, fmt.Sprintf(\"Chunk update failed due to status code %d.\", e.StatusCode())))\n\t\t\t\t}\n\t\t\t\tclear()\n\t\t\t\treturn false\n\t\t\t} else if metric.retryCount == maxRetriesOnWrite {\n\t\t\t\tmc.logger.ErrorWith(fmt.Sprintf(\"Chunk update failed - exceeded %d retries\", maxRetriesOnWrite), \"metric\", metric.Lset)\n\t\t\t\tsetError(mc, metric, errors.Wrap(resp.Error, fmt.Sprintf(\"Chunk update failed after %d retries.\", maxRetriesOnWrite)))\n\t\t\t\tclear()\n\n\t\t\t\t// Count errors\n\t\t\t\tmc.performanceReporter.IncrementCounter(\"ChunkUpdateRetryExceededError\", 1)\n\t\t\t\treturn false\n\t\t\t}\n\t\t}\n\t}\n\n\tmetric.setState(storeStateReady)\n\n\tvar sent bool\n\tvar err error\n\n\t// In case our data spreads across multiple partitions, get the new state for the current partition\n\tif metric.shouldGetState {\n\t\tsent, err = mc.sendGetMetricState(metric)\n\t\tif err != nil {\n\t\t\tclear()\n\t\t\treturn false\n\t\t}\n\t\tif sent {\n\t\t\tmc.updatesInFlight++\n\t\t}\n\t} else if canWrite {\n\t\tsent, err = mc.writeChunksAndGetState(metric)\n\t\tif err != nil {\n\t\t\tclear()\n\t\t\treturn false\n\t\t}\n\t} else if metric.store.samplesQueueLength() > 0 {\n\t\tmc.metricQueue.Push(metric)\n\t\tmetric.setState(storeStateAboutToUpdate)\n\t}\n\tif !sent && metric.store.numNotProcessed == 0 && metric.store.pending.Len() == 0 {\n\t\tmc.cacheMetricMap.ResetMetric(metric.hash)\n\t}\n\n\treturn sent\n}", "title": "" }, { "docid": "579d9468941daee46a7d0150b43f20b7", "score": "0.45563892", "text": "func (s *Server) HandleModifyTopic(w http.ResponseWriter, r *http.Request) {\n\tif r.Body == nil {\n\t\theaders.SetError(w, headers.ErrInvalidBodyMissing)\n\t\treturn\n\t}\n\tdefer func() {\n\t\t_ = r.Body.Close()\n\t}()\n\n\ttopic, err := getTopic(r)\n\tif err != nil {\n\t\theaders.SetError(w, err)\n\t\treturn\n\t}\n\n\tvar request headers.ModifyRequest\n\tif err = json.NewDecoder(r.Body).Decode(&request); err != nil {\n\t\theaders.SetError(w, headers.ErrInvalidBodyJSON)\n\t\treturn\n\t}\n\n\tif request.Truncate == 0 {\n\t\tw.WriteHeader(http.StatusNoContent)\n\t\treturn\n\t}\n\n\tinfo, err := s.q.ModifyTopic(topic, request)\n\tif err != nil {\n\t\theaders.SetError(w, err)\n\t\treturn\n\t}\n\tw.Header()[headers.ContentType] = []string{\"application/json\"}\n\tw.WriteHeader(http.StatusOK)\n\t_ = json.NewEncoder(w).Encode(&info)\n}", "title": "" }, { "docid": "92ee2c3df5389f2bff8a0726a84e335f", "score": "0.45497862", "text": "func (h handler) Handle(ctx controller.Context, eventData []byte) error {\n\t//parse event data from stream, a JSON message, into our own message struct\n\tmsg := Message{}\n\tif err := json.Unmarshal(eventData, &msg); err != nil {\n\t\tpanic(fmt.Errorf(\"ERROR: cannot parse message as JSON: %v\", err))\n\t}\n\n\t//todo: start background + context...\n\t// auditEvent := audit.Event{\n\t// \tHeader: audit.EventHeader{\n\t// \t\tStartTime: time.Now(),\n\t// \t\tType: msg.Type,\n\t// \t\tTrace: string(msg.TraceID),\n\t// \t},\n\t// \tData: nil,\n\t// }\n\t//errCode := \"ERROR\"\n\terr := h.consumer.Exec(ctx, msg.Type, msg.Request)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"type(%s) failed: %v\", msg.Type, err)\n\t}\n\n\t// if err != nil {\n\t// \tauditEvent.Result = audit.Result{\n\t// \t\tSuccess: false,\n\t// \t\tErrCode: errCode,\n\t// \t\tErrDesc: fmt.Sprintf(\"%v\", err),\n\t// \t}\n\t// } else {\n\t// \tauditEvent.Result = audit.Result{\n\t// \t\tSuccess: true,\n\t// \t}\n\t// }\n\n\t// //todo: set request data when parsing generically here before handler!\n\t// //todo: add metrics to audits\n\t// audit.Write(auditEvent)\n\treturn nil\n}", "title": "" }, { "docid": "10a3a83f9e083d545b324f3c35231fda", "score": "0.45492536", "text": "func (r *VpDeploymentTargetReconciler) handleUpdate(req ctrl.Request, vpDepTarget ververicaplatformv1beta1.VpDeploymentTarget, depTarget vpAPI.DeploymentTarget) (ctrl.Result, error) {\n\t// Now update the k8s resource\n\terr := r.updateResource(&vpDepTarget, &depTarget)\n\treturn ctrl.Result{}, err\n}", "title": "" }, { "docid": "c9c8ab3b2b4905105a7db1d689847020", "score": "0.45489064", "text": "func HandleCMDC(dat *Data, od *Command, ch chan<- string, key string) {\n\tsend := func() {\n\t\tdat.Message = \"\"\n\t\tdat.CMD = *od\n\t\tbuf := MakeJSON(dat)\n\t\tch <- Encrypt(buf, key)\n\t}\n\thelp := func() {\n\t\tfmt.Println(\"Usage: \")\n\t\tfmt.Println(\"/help \t\t\tshow usage\")\n\t\tfmt.Println(\"/list \t\t\tlist all users\")\n\t\tfmt.Println(\"/name <username> reset your name\")\n\t}\n\tswitch val := \"\"; {\n\tcase strings.HasPrefix(dat.Message, \"/help\"):\n\t\thelp()\n\tcase strings.HasPrefix(dat.Message, \"/list\"):\n\t\tod.Is = true\n\t\tod.Key = \"list\"\n\t\tsend()\n\tcase strings.HasPrefix(dat.Message, \"/name\"):\n\t\tfmt.Sscanf(dat.Message, \"/name%s\", &val)\n\t\tif val == \"\" {\n\t\t\tfmt.Println(\"/name: err args\")\n\t\t} else {\n\t\t\tod.Is = true\n\t\t\tod.Key = \"name\"\n\t\t\tod.Val = val\n\t\t\tsend()\n\t\t}\n\tdefault:\n\t\tfmt.Printf(\"unknown cmd: %s\\n\", dat.Message)\n\t\thelp()\n\t}\n}", "title": "" }, { "docid": "3da815a51e54a9328415e128b8ce67eb", "score": "0.45414162", "text": "func updateHandler(oldObj, newObj interface{}) {\n\tbrokerConfiguration, ok := newObj.(*v1.ServiceBrokerConfig)\n\tif !ok {\n\t\tglog.Error(\"unexpected object type in config update\")\n\t\treturn\n\t}\n\n\tif brokerConfiguration.Name != ConfigurationName {\n\t\tglog.V(log.LevelDebug).Info(\"unexpected object name in config update:\", brokerConfiguration.Name)\n\t\treturn\n\t}\n\n\tif err := updateStatus(brokerConfiguration); err != nil {\n\t\tglog.Info(\"service broker configuration invalid, see resource status for details\")\n\t\tglog.V(1).Info(err)\n\n\t\tc.lock.Lock()\n\t\tdefer c.lock.Unlock()\n\n\t\tc.config = nil\n\n\t\treturn\n\t}\n\n\tglog.Info(\"service broker configuration updated\")\n\n\tif glog.V(1) {\n\t\tobject, err := json.Marshal(brokerConfiguration)\n\t\tif err == nil {\n\t\t\tglog.V(1).Info(string(object))\n\t\t}\n\t}\n\n\tc.lock.Lock()\n\tdefer c.lock.Unlock()\n\n\tc.config = brokerConfiguration\n}", "title": "" }, { "docid": "bc637824a4b9a6a8db010e9eb8779a9d", "score": "0.45274243", "text": "func UpdateExtraChannel(db *sqlx.DB, c *ExtraChannel) error {\n\tif err := c.Validate(); err != nil {\n\t\treturn errors.Wrap(err, \"validate error\")\n\t}\n\n\tnow := time.Now()\n\tres, err := db.Exec(`\n\t\tupdate extra_channel set\n\t\t\tchannel_configuration_id = $2,\n\t\t\tupdated_at = $3,\n\t\t\tmodulation = $4,\n\t\t\tfrequency = $5,\n\t\t\tbandwidth = $6,\n\t\t\tbit_rate = $7,\n\t\t\tspread_factors = $8\n\t\twhere\n\t\t\tid = $1`,\n\t\tc.ID,\n\t\tc.ChannelConfigurationID,\n\t\tnow,\n\t\tc.Modulation,\n\t\tc.Frequency,\n\t\tc.BandWidth,\n\t\tc.BitRate,\n\t\tpq.Array(c.SpreadFactors),\n\t)\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"update error\")\n\t}\n\tra, err := res.RowsAffected()\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"get rows affected error\")\n\t}\n\tif ra == 0 {\n\t\treturn ErrDoesNotExist\n\t}\n\tc.UpdatedAt = now\n\tlog.WithFields(log.Fields{\n\t\t\"channel_configuration_id\": c.ChannelConfigurationID,\n\t\t\"id\": c.ID,\n\t}).Info(\"extra channel updated\")\n\n\t_, err = db.Exec(`\n\t\tupdate channel_configuration\n\t\tset\n\t\t\tupdated_at = $2\n\t\twhere\n\t\t\tid = $1\n\t`, c.ChannelConfigurationID, now)\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"update error\")\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "e299a6bb6b8ee2373aa8ce51412fb8eb", "score": "0.45265618", "text": "func (c *RoomController) handleUpdate(w http.ResponseWriter, r *http.Request) {\n\tc.Srv.SendTelemetry()\n\tw.WriteHeader(http.StatusNoContent)\n}", "title": "" }, { "docid": "1f450f01c2a0860fe5ab52bab20015fa", "score": "0.45205784", "text": "func (m FileMonitor) MonitorUpdate(key string, handler UpdateHandler) error {\n\twatcher, err := fsnotify.NewWatcher()\n\tif err != nil {\n\t\tlog.\n\t\t\tWithError(err).\n\t\t\tError(\"Failed to instantiate a filesystem watcher\")\n\t\treturn err\n\t}\n\tdefer watcher.Close()\n\n\tdone := make(chan bool)\n\tgo func() {\n\t\tfor {\n\t\t\tselect {\n\t\t\tcase event := <-watcher.Events:\n\t\t\t\tif event.Op&fsnotify.Write == fsnotify.Write {\n\t\t\t\t\tdata, err := ioutil.ReadFile(key)\n\t\t\t\t\tif err != nil {\n\t\t\t\t\t\tlog.\n\t\t\t\t\t\t\tWithError(err).\n\t\t\t\t\t\t\tWithField(\"path\", key).\n\t\t\t\t\t\t\tError(\"Failed to read data from a path\")\n\t\t\t\t\t}\n\t\t\t\t\terr = handler(key, data)\n\t\t\t\t\tif err != nil {\n\t\t\t\t\t\tlog.\n\t\t\t\t\t\t\tWithError(err).\n\t\t\t\t\t\t\tError(\"Failed to handle a metadata update\")\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\tcase err = <-watcher.Errors:\n\t\t\t\tlog.Info(\"Checking a metadata updated\")\n\t\t\t}\n\t\t}\n\t}()\n\n\terr = watcher.Add(key)\n\tif err != nil {\n\t\tlog.\n\t\t\tWithError(err).\n\t\t\tWithField(\"path\", key).\n\t\t\tError(\"Failed to watch a path to filesystem\")\n\t\treturn err\n\t}\n\t<-done\n\n\treturn nil\n}", "title": "" }, { "docid": "b1f987501be5465ee2c155c33733f4dc", "score": "0.451579", "text": "func UpdateChannel(id, data, token string) {\n\turl := fmt.Sprintf(\"%s/%s/%s\", serverAddr, channelsEP, id)\n\treq, err := http.NewRequest(\"PUT\", url, strings.NewReader(data))\n\tSendRequest(req, token, err)\n}", "title": "" }, { "docid": "e996af996d6a553abb4ca89888309e3e", "score": "0.45156118", "text": "func (c *Client) ModifyChannel(channelID discord.ChannelID, data ModifyChannelData) error {\n\treturn c.FastRequest(\"PATCH\", EndpointChannels+channelID.String(), httputil.WithJSONBody(data))\n}", "title": "" }, { "docid": "6848be2c50238d3af43cec3f1c79448b", "score": "0.45029268", "text": "func (c *jsiiProxy_CfnBaiduChannel) GetMetadata(key *string) interface{} {\n\tvar returns interface{}\n\n\t_jsii_.Invoke(\n\t\tc,\n\t\t\"getMetadata\",\n\t\t[]interface{}{key},\n\t\t&returns,\n\t)\n\n\treturn returns\n}", "title": "" }, { "docid": "bfc9492d1387247a7ff8e74be9767971", "score": "0.45023617", "text": "func UpdateMetainfo(metaPath string) error {\n\tParseMetainfo(metaPath)\n\tlynkName := GetLynkName(metaPath)\n\tlynk := lynxutil.GetLynk(lynks, lynkName)\n\n\terr := os.Remove(metaPath)\n\tif err != nil {\n\t\tfmt.Println(err)\n\t\treturn err\n\t}\n\n\tnewMetainfo, err := os.Create(metaPath)\n\tif err != nil {\n\t\tfmt.Println(err)\n\t\treturn err\n\t}\n\n\tnewMetainfo.WriteString(\"announce:::\" + lynk.Tracker + \"\\n\") // Write tracker IP\n\tnewMetainfo.WriteString(\"lynkName:::\" + lynk.Name + \"\\n\")\n\tnewMetainfo.WriteString(\"owner:::\" + lynk.Owner + \"\\n\")\n\ti := 0\n\tfor i < len(lynk.Files) {\n\t\tnewMetainfo.WriteString(\"length:::\" + strconv.Itoa(lynk.Files[i].Length) + \"\\n\") // str conv\n\t\tnewMetainfo.WriteString(\"path:::\" + lynk.Files[i].Path + \"\\n\")\n\t\tnewMetainfo.WriteString(\"name:::\" + lynk.Files[i].Name + \"\\n\")\n\t\tnewMetainfo.WriteString(\"chunkLength:::\" + strconv.Itoa(lynk.Files[i].ChunkLength) + \"\\n\")\n\t\tnewMetainfo.WriteString(\"chunks:::\" + lynk.Files[i].Chunks + \"\\n\")\n\t\tnewMetainfo.WriteString(endOfEntry + \"\\n\")\n\t\ti++\n\t}\n\n\treturn newMetainfo.Close()\n}", "title": "" }, { "docid": "be7a4129ac3ad7a4c80914f9205c3737", "score": "0.44990194", "text": "func Update(ctx *base.Context) error {\n\tfmt.Printf(\"Performing update:\\n\")\n\n\tcfg, err := config.ReadConfig(ctx.ConfigPath)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"reading config %s: %w\", ctx.ConfigPath, err)\n\t}\n\tctx.TooBig = cfg\n\n\terr = os.Chdir(ctx.DataPath)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"reading config %s: %w\", ctx.ConfigPath, err)\n\t}\n\n\tfmt.Printf(\"Updating data directory...\\n\")\n\tcnt := 0\n\tupdated := 0\n\terr = base.Walk(\".\", func(path string, info os.FileInfo) error {\n\t\tcnt += 1\n\t\tvalid, er2 := verifyMeta(ctx, path)\n\t\tif er2 != nil {\n\t\t\treturn fmt.Errorf(\"verifying metadata: %w\", er2)\n\t\t}\n\t\tif valid {\n\t\t\treturn nil\n\t\t}\n\n\t\tfmt.Printf(\"Updating %s... \", path)\n\t\ter2 = updateMeta(ctx, path)\n\t\tif er2 != nil {\n\t\t\tfmt.Printf(\"\\n\")\n\t\t\treturn fmt.Errorf(\"updating metadata: %w\", er2)\n\t\t}\n\n\t\tupdated += 0\n\t\tfmt.Printf(\"metadata updated.\\n\")\n\t\treturn nil\n\t})\n\tif err != nil {\n\t\treturn fmt.Errorf(\"updating data directory: %w\", err)\n\t}\n\tfmt.Printf(\"%d files checked, %d metadata files updated.\\n\\n\", cnt, updated)\n\n\terr = os.Chdir(ctx.GitRepoPath)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"changing directory %s: %w\", ctx.GitRepoPath, err)\n\t}\n\n\tfmt.Printf(\"Removing uneeded files in git directory...\\n\")\n\tcnt = 0\n\tupdated = 0\n\t// Walk all \"meta\" files in the git repo.\n\terr = base.Walk(\".\", func(path string, info os.FileInfo) error {\n\t\tcnt += 1\n\t\texists, er := base.FileExists(ctx.DataPath + \"/\" + path)\n\t\tif er != nil {\n\t\t\treturn fmt.Errorf(\"check file existence %s: %w\", path, er)\n\t\t}\n\n\t\tif !exists {\n\t\t\tupdated += 1\n\t\t\tfmt.Printf(\"Removing: %s\\n\", path)\n\t\t\ter = os.Remove(path)\n\t\t\tif er != nil {\n\t\t\t\treturn fmt.Errorf(\"removing file %s: %w\", path, er)\n\t\t\t}\n\t\t}\n\t\treturn nil\n\t})\n\tif err != nil {\n\t\treturn fmt.Errorf(\"removing files: %w\", err)\n\t}\n\tfmt.Printf(\"%d files checked, %d metadata files removed.\\n\\n\", cnt, updated)\n\n\tfmt.Printf(\"Update complete.\\n\")\n\n\t// TODO: How many hashes are no longer needed? Space savings if we delete?\n\t// TODO: Are there duplicate files?\n\n\treturn nil\n}", "title": "" }, { "docid": "fbfd9bfa13c23f0f1994743271326423", "score": "0.44910416", "text": "func (client *PrivateLinkServicesClient) updatePrivateEndpointConnectionHandleResponse(resp *http.Response) (PrivateLinkServicesUpdatePrivateEndpointConnectionResponse, error) {\n\tresult := PrivateLinkServicesUpdatePrivateEndpointConnectionResponse{RawResponse: resp}\n\tif err := runtime.UnmarshalAsJSON(resp, &result.PrivateEndpointConnection); err != nil {\n\t\treturn PrivateLinkServicesUpdatePrivateEndpointConnectionResponse{}, runtime.NewResponseError(err, resp)\n\t}\n\treturn result, nil\n}", "title": "" }, { "docid": "06810ec7f0e3a2f5dd440c8359dc8fc8", "score": "0.4483722", "text": "func (message *Message) SetMetadata(key string, value interface{}) {\n\tmessage.Metadata[key] = value\n}", "title": "" }, { "docid": "0d3101362068247f0378816d23e856d7", "score": "0.4475344", "text": "func (client *ArtifactSourcesClient) updateHandleResponse(resp *http.Response) (ArtifactSourcesClientUpdateResponse, error) {\n\tresult := ArtifactSourcesClientUpdateResponse{}\n\tif err := runtime.UnmarshalAsJSON(resp, &result.ArtifactSource); err != nil {\n\t\treturn ArtifactSourcesClientUpdateResponse{}, err\n\t}\n\treturn result, nil\n}", "title": "" }, { "docid": "de2fd9dbb7629ed8dcf6122e105aa90b", "score": "0.44743237", "text": "func (c *NamespaceController) onUpdate(oldObj, newObj interface{}) {\n\t//oldNs := oldObj.(*v1.Namespace)\n\tnewNs := newObj.(*v1.Namespace)\n\tlog.Debugf(\"[NamespaceController] onUpdate ns=%s\", newNs.ObjectMeta.SelfLink)\n\n\tlabels := newNs.GetObjectMeta().GetLabels()\n\tif labels[config.LABEL_VENDOR] != config.LABEL_CRUNCHY || labels[config.LABEL_PGO_INSTALLATION_NAME] != operator.InstallationName {\n\t\tlog.Debugf(\"NamespaceController: onUpdate skipping namespace that is not crunchydata %s\", newNs.ObjectMeta.SelfLink)\n\t\treturn\n\t} else {\n\t\tlog.Debugf(\"NamespaceController: onUpdate crunchy namespace updated %s\", newNs.ObjectMeta.SelfLink)\n\t\tc.ThePodController.SetupWatch(newNs.Name)\n\t\tc.TheJobController.SetupWatch(newNs.Name)\n\t\tc.ThePgpolicyController.SetupWatch(newNs.Name)\n\t\tc.ThePgbackupController.SetupWatch(newNs.Name)\n\t\tc.ThePgreplicaController.SetupWatch(newNs.Name)\n\t\tc.ThePgclusterController.SetupWatch(newNs.Name)\n\t\tc.ThePgtaskController.SetupWatch(newNs.Name)\n\t}\n\n}", "title": "" }, { "docid": "8e7fc767f98c01df1b4a248ccddbce79", "score": "0.44703183", "text": "func (c *consensus) HandleViewChange(m proto.Message, done chan bool) error {\n\treturn c.scheme.Handle(m)\n}", "title": "" }, { "docid": "63c1812d5a2659791b1e84cf04caf9c5", "score": "0.44676405", "text": "func (h *VolumeEventHandler) updated(redis RedisSetter, msg pubsub.Message) error {\n\tvar event Event\n\tvar payload VolumePayload\n\tif err := json.Unmarshal(msg.Payload, &event); err != nil {\n\t\treturn err\n\t}\n\tif err := json.Unmarshal(event.Payload, &payload); err != nil {\n\t\treturn err\n\t}\n\tif err := redis.Set(\"fm:player:volume\", payload.Level, 0).Err(); err != nil {\n\t\treturn err\n\t}\n\tlgcy, err := json.Marshal(&LegacyVolumeEventBody{\n\t\tEvent: LegacyVolumeChangedEvent,\n\t\tVolume: payload.Level,\n\t})\n\tif err != nil {\n\t\treturn err\n\t}\n\toutC <- pubsub.Message{\n\t\tTopic: LegacyEvents,\n\t\tPayload: lgcy,\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "cd9acf7e58690847819959177f48ca64", "score": "0.4466772", "text": "func (c *jsiiProxy_CfnEmailChannel) AddMetadata(key *string, value interface{}) {\n\t_jsii_.InvokeVoid(\n\t\tc,\n\t\t\"addMetadata\",\n\t\t[]interface{}{key, value},\n\t)\n}", "title": "" } ]
00a77fb2056a6add06e42a180f795424
String returns a string representation of an Operation.
[ { "docid": "8bd2d1bbed3d997428f4d1323e460aae", "score": "0.84449714", "text": "func (op *Operation) String() string {\n\tvar b strings.Builder\n\n\tfmt.Fprintf(&b, \"type: %s\\n\", op.Type().String())\n\tfmt.Fprint(&b, \"pin:\\n\")\n\tpinstr := op.Pin().String()\n\tpinstrs := strings.Split(pinstr, \"\\n\")\n\tfor _, s := range pinstrs {\n\t\tfmt.Fprintf(&b, \"\\t%s\\n\", s)\n\t}\n\tfmt.Fprintf(&b, \"phase: %s\\n\", op.Phase().String())\n\tfmt.Fprintf(&b, \"attemptCount: %d\\n\", op.AttemptCount())\n\tfmt.Fprintf(&b, \"error: %s\\n\", op.Error())\n\tfmt.Fprintf(&b, \"timestamp: %s\\n\", op.Timestamp().String())\n\n\treturn b.String()\n}", "title": "" } ]
[ { "docid": "178dec02b1c0ea7791fe890df06c2f29", "score": "0.8526", "text": "func (s Operation) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "bbbd85579eb233f55330efc923400c2d", "score": "0.82311386", "text": "func (op operationName) String() string {\n\treturn string(op)\n}", "title": "" }, { "docid": "bbbd85579eb233f55330efc923400c2d", "score": "0.82311386", "text": "func (op operationName) String() string {\n\treturn string(op)\n}", "title": "" }, { "docid": "986779d91963bb5d422a7809a86ae4b7", "score": "0.8193817", "text": "func (op Operation) String() (str string) {\n\tswitch op {\n\tcase OpSet:\n\t\tstr = \"set\"\n\tcase OpDel:\n\t\tstr = \"del\"\n\tdefault:\n\t\tstr = \"invalid\"\n\t}\n\n\treturn\n}", "title": "" }, { "docid": "62d04af4ae0cca68c9f7b77dfff6e6f2", "score": "0.7946865", "text": "func (op Operation) String() string {\n\tswitch op {\n\tcase Latest:\n\t\treturn \"latest\"\n\tcase IsImmutable:\n\t\treturn \"isImmutable\"\n\tcase IsTemporal:\n\t\treturn \"isTemporal\"\n\tdefault:\n\t\treturn fmt.Sprintf(`not defined filter operation \"%d\"`, op)\n\t}\n}", "title": "" }, { "docid": "84635d4e9e33a16025196b1ed371eecd", "score": "0.7771898", "text": "func (e DomainOperation) String() string {\n\tw := int32(e)\n\tswitch w {\n\tcase 0:\n\t\treturn \"Create\"\n\tcase 1:\n\t\treturn \"Update\"\n\t}\n\treturn fmt.Sprintf(\"DomainOperation(%d)\", w)\n}", "title": "" }, { "docid": "f67a362ae3b345711ba78bc3c8f74685", "score": "0.768653", "text": "func (op Op) String() string {\n\treturn opNames[op]\n}", "title": "" }, { "docid": "23c42062516afcee5d2346fe1deb3a7c", "score": "0.766732", "text": "func (id OperationId) String() string {\n\tcomponents := []string{\n\t\tfmt.Sprintf(\"Subscription: %q\", id.SubscriptionId),\n\t\tfmt.Sprintf(\"Resource Group Name: %q\", id.ResourceGroupName),\n\t\tfmt.Sprintf(\"Workspace Name: %q\", id.WorkspaceName),\n\t\tfmt.Sprintf(\"Purge: %q\", id.PurgeId),\n\t}\n\treturn fmt.Sprintf(\"Operation (%s)\", strings.Join(components, \"\\n\"))\n}", "title": "" }, { "docid": "81ce14f0d8d3616960826100df1ed64a", "score": "0.7615448", "text": "func (s GetOperationOutput) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "e89ec9d2e559ae35a6ea6e7277f29b05", "score": "0.75927097", "text": "func (s AttributeOperation) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "5fc7521aa4789c9a09490dee7cc44a79", "score": "0.74377733", "text": "func (op OperationType) String() string {\n\treturn operationTypeNames[op]\n}", "title": "" }, { "docid": "41ae5955f3b4fd5f730ce51d25891143", "score": "0.7422605", "text": "func (u *unOp) String() string {\n\treturn fmt.Sprintf(\"op1: %v operand: %v\\n\", u.operand, u.op)\n}", "title": "" }, { "docid": "8a5b48e5b9518c9149fb168e42b4a326", "score": "0.74189913", "text": "func (s GetOperationInput) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "44e428fb7564997f5b9204f7f5a694be", "score": "0.73315966", "text": "func (o Operator) String() string {\n\treturn string(o)\n}", "title": "" }, { "docid": "78ed488aa2922814dc54112915622ad1", "score": "0.7285184", "text": "func (o FetchOp) String() string {\n\treturn fmt.Sprintf(\"type: %s. name: %s, range: %v, offset: %v, matchers: %v\",\n\t\to.OpType(), o.Name, o.Range, o.Offset, o.Matchers)\n}", "title": "" }, { "docid": "c890b0e0b7b00866d16dffb29b35fca0", "score": "0.72492194", "text": "func (s GetOperationsOutput) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "83aaea3a82b158ff058bd0162de21f46", "score": "0.71392614", "text": "func (b *binOp) String() string {\n\treturn fmt.Sprintf(\"op1: %s op2: %s, operand: %v\\n\", b.leftOp.String(), b.rightOp.String(), b.op)\n}", "title": "" }, { "docid": "aaa0334550bacbde9381a5e949b18e8c", "score": "0.7130096", "text": "func (o Opcode) String() string {\n\tif o >= 0 && int(o) < len(OpNames) {\n\t\treturn OpNames[o]\n\t}\n\treturn strconv.Itoa(int(o))\n}", "title": "" }, { "docid": "ab43cf64e32ce34d6495a54d08bcda65", "score": "0.71156245", "text": "func (s GetOperationsInput) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "a9b2725db4628f15c58dfa1f4d06081c", "score": "0.707206", "text": "func (c OperationalConstraint) String() string {\n\treturn \"OperationalConstraint\"\n}", "title": "" }, { "docid": "fe6eb037dd33e863d7dae5e2dd2e6be6", "score": "0.70399463", "text": "func (opcode OpCode) String() string {\n\tswitch opcode {\n\tcase OPCODE_QUERY:\n\t\treturn \"query\"\n\tcase OPCODE_IQUERY:\n\t\treturn \"iquery\"\n\tcase OPCODE_STATUS:\n\t\treturn \"status\"\n\tcase OPCODE_UNASSIGNED:\n\t\treturn \"unassigned\"\n\tcase OPCODE_NOTIFY:\n\t\treturn \"notify\"\n\tcase OPCODE_UPDATE:\n\t\treturn \"update\"\n\t}\n\treturn \"Unknown opcode\"\n}", "title": "" }, { "docid": "5b3864ea2c221c63dacfffd2fbabad9b", "score": "0.6945383", "text": "func (av AttributeSchemaOperationType) String() string {\n\tswitch av {\n\tcase AttributeSchemaOperationTypeRead:\n\t\treturn \"read\"\n\tcase AttributeSchemaOperationTypeWrite:\n\t\treturn \"write\"\n\tcase AttributeSchemaOperationTypeMerge:\n\t\treturn \"merge\"\n\t}\n\treturn \"\"\n}", "title": "" }, { "docid": "57eea640cf67a10783064495060ba257", "score": "0.69351", "text": "func (s WAFTagOperationException) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "c9e5b708171ba4a984becedc8a69da00", "score": "0.6888596", "text": "func (i Operator) String() string {\n\tswitch i {\n\tcase OperatorClear:\n\t\treturn \"OperatorClear\"\n\tcase OperatorSource:\n\t\treturn \"OperatorSource\"\n\tcase OperatorOver:\n\t\treturn \"OperatorOver\"\n\tcase OperatorIn:\n\t\treturn \"OperatorIn\"\n\tcase OperatorOut:\n\t\treturn \"OperatorOut\"\n\tcase OperatorAtop:\n\t\treturn \"OperatorAtop\"\n\tcase OperatorDest:\n\t\treturn \"OperatorDest\"\n\tcase OperatorDestOver:\n\t\treturn \"OperatorDestOver\"\n\tcase OperatorDestIn:\n\t\treturn \"OperatorDestIn\"\n\tcase OperatorDestOut:\n\t\treturn \"OperatorDestOut\"\n\tcase OperatorDestAtop:\n\t\treturn \"OperatorDestAtop\"\n\tcase OperatorXOR:\n\t\treturn \"OperatorXOR\"\n\tcase OperatorAdd:\n\t\treturn \"OperatorAdd\"\n\tcase OperatorSaturate:\n\t\treturn \"OperatorSaturate\"\n\tcase OperatorMultiply:\n\t\treturn \"OperatorMultiply\"\n\tcase OperatorScreen:\n\t\treturn \"OperatorScreen\"\n\tcase OperatorOverlay:\n\t\treturn \"OperatorOverlay\"\n\tcase OperatorDarken:\n\t\treturn \"OperatorDarken\"\n\tcase OperatorLighten:\n\t\treturn \"OperatorLighten\"\n\tcase OperatorColorDodge:\n\t\treturn \"OperatorColorDodge\"\n\tcase OperatorColorBurn:\n\t\treturn \"OperatorColorBurn\"\n\tcase OperatorHardLight:\n\t\treturn \"OperatorHardLight\"\n\tcase OperatorSoftLight:\n\t\treturn \"OperatorSoftLight\"\n\tcase OperatorDifference:\n\t\treturn \"OperatorDifference\"\n\tcase OperatorExclusion:\n\t\treturn \"OperatorExclusion\"\n\tcase OperatorHslHue:\n\t\treturn \"OperatorHslHue\"\n\tcase OperatorHslSaturation:\n\t\treturn \"OperatorHslSaturation\"\n\tcase OperatorHslColor:\n\t\treturn \"OperatorHslColor\"\n\tcase OperatorHslLuminosity:\n\t\treturn \"OperatorHslLuminosity\"\n\tdefault:\n\t\treturn fmt.Sprintf(\"Operator(%d)\", i)\n\t}\n}", "title": "" }, { "docid": "52ccab9545f1041f000590cd4838397c", "score": "0.68426234", "text": "func (i Instruction) String() string {\n\treturn fmt.Sprintf(\"Op: %s, Arg1: %s, Arg2: %s, Ret: %s\\n\", i.Op, i.Arg1, i.Arg2, i.Ret)\n}", "title": "" }, { "docid": "8ece723f923c48816a66df59e8e9ef9d", "score": "0.6842022", "text": "func (s ListOperationsOutput) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "457cf75cf40ad0be565fb4966409940d", "score": "0.6801546", "text": "func (i Instruction) String() string {\n\treturn fmt.Sprintf(\"%s %03d\", i.op, i.addr)\n}", "title": "" }, { "docid": "ca0410977fdae988802619ff21cb9e65", "score": "0.6763738", "text": "func (e *Expression) opString() string {\n\treturn *e.Op\n}", "title": "" }, { "docid": "93f75e4f832e8f7b6d08a9c5fb6b4fde", "score": "0.6712567", "text": "func (fileop FileOp) String() string {\n\tvar bld strings.Builder\n\tfileop.Save(&bld)\n\treturn bld.String()\n}", "title": "" }, { "docid": "5c01cd2890a6f1e687aeb2dd7c98312c", "score": "0.6618134", "text": "func (r Operator) String() (string, error) {\n\ts, ok := _OperatorValueToName[r]\n\tif !ok {\n\t\treturn \"\", fmt.Errorf(\"invalid Operator: %d\", r)\n\t}\n\treturn s, nil\n}", "title": "" }, { "docid": "c926fd8d294dca7e0cd4f78223ada778", "score": "0.66121215", "text": "func (s ListOperationsInput) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "705080d6c8502a9f16e6ee0160eb1ccd", "score": "0.6599464", "text": "func (s GetOperationsForResourceOutput) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "729eb20513766407339b582697d34b27", "score": "0.6598152", "text": "func (e *expr) String() string {\n\tswitch {\n\tcase e.op == op_number:\n\t\treturn fmt.Sprintf(\"%d\", e.number)\n\tcase e.op == op_identifier:\n\t\treturn e.identifier.str\n\tcase e.op.isBinary():\n\t\treturn fmt.Sprintf(\"%s %s %s\", e.child0.String(), e.child1.String(), e.op.symbol())\n\tcase !e.op.isBinary():\n\t\treturn fmt.Sprintf(\"%s [%s]\", e.child0.String(), e.op.symbol())\n\tdefault:\n\t\treturn \"\"\n\t}\n}", "title": "" }, { "docid": "800a23956026fa857648fa3d281457b9", "score": "0.65844524", "text": "func (me TxsdFeCompositeTypeOperator) String() string { return xsdt.String(me).String() }", "title": "" }, { "docid": "520bd318e8eded1e4ced33689f3148bd", "score": "0.65841365", "text": "func (s CommandInvocation) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "d3d22900cd738ffd0ae99f680bb5afdd", "score": "0.6499547", "text": "func (o AlarmModelDynamoDbOutput) Operation() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v AlarmModelDynamoDb) *string { return v.Operation }).(pulumi.StringPtrOutput)\n}", "title": "" }, { "docid": "7ed50c1fb4f79beda438f6a4722224cc", "score": "0.64739", "text": "func (s GetOperationsForResourceInput) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "c4e5208c4373172208b6fa6d7e6d9137", "score": "0.6465398", "text": "func (op *Relation) String() string { return op.Str }", "title": "" }, { "docid": "70ff8b4eef5e2b63e0731791b836a0ac", "score": "0.6440613", "text": "func (m *MessageOpMsg) String() string {\n\tvar flags []string\n\tif m.Flags&wiremessage.ChecksumPresent == wiremessage.ChecksumPresent {\n\t\tflags = append(flags, \"ChecksumPresent\")\n\t}\n\tif m.Flags&wiremessage.MoreToCome == wiremessage.MoreToCome {\n\t\tflags = append(flags, \"MoreToCome\")\n\t}\n\tif m.Flags&wiremessage.ExhaustAllowed == wiremessage.ExhaustAllowed {\n\t\tflags = append(flags, \"ExhaustAllowed\")\n\t}\n\treturn fmt.Sprintf(\"OpMsg(Body=%s, Documents=%s, Flags=%v)\",\n\t\tm.BodySection, m.DocumentSequenceSections, strings.Join(flags, \",\"))\n}", "title": "" }, { "docid": "9c061d38bc332a7223d80e3ef8c79a56", "score": "0.6423262", "text": "func (cmd AddNodeCommand) String() string {\n\treturn string(cmd)\n}", "title": "" }, { "docid": "0468899f77a2b5e87823f064aef16d73", "score": "0.6420844", "text": "func (o DetectorModelDynamoDbOutput) Operation() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v DetectorModelDynamoDb) *string { return v.Operation }).(pulumi.StringPtrOutput)\n}", "title": "" }, { "docid": "40d2c1956cd6b078cfa747b22318dc61", "score": "0.64018285", "text": "func (a *ActionExpr) String() string {\n\treturn fmt.Sprintf(\"%s: %T{Expr: %v, Code: %v}\", a.p, a, a.Expr, a.Code)\n}", "title": "" }, { "docid": "abf3a00b765fc86f38eb65f3f768a55f", "score": "0.6398103", "text": "func (op InlineOp) String() string {\n\tswitch op.Type {\n\tcase OpText, OpCodeSpan, OpRawHTML, OpAutolink:\n\t\treturn op.Text\n\tcase OpNewLine:\n\t\treturn \"\\n\"\n\tcase OpImage:\n\t\treturn op.Alt\n\t}\n\treturn \"\"\n}", "title": "" }, { "docid": "57dd06fdfff20120aa566920184626d4", "score": "0.63947666", "text": "func (f *Flow) String() string {\n\tret := bytes.NewBuffer(nil)\n\tfmt.Fprintf(ret, \"Flow\\n\")\n\t// consts\n\tfmt.Fprintf(ret, \"consts:\\n\")\n\tfor i, v := range f.consts {\n\t\tfmt.Fprintf(ret, \" [%v] %v\\n\", i, v)\n\t}\n\tfmt.Fprintf(ret, \"data:\\n\") // Or variable\n\n\tf.Data.Range(func(k, v interface{}) bool {\n\t\tfmt.Fprintf(ret, \" [%v] %v\\n\", k, v)\n\t\treturn true\n\t})\n\n\tfmt.Fprintf(ret, \"operations:\\n\")\n\tfor k, op := range f.operations {\n\t\tfmt.Fprintf(ret, \" [%v] %s(\", k, op.name)\n\t\tfor j, in := range op.inputs {\n\t\t\tif j != 0 {\n\t\t\t\tfmt.Fprintf(ret, \", \")\n\t\t\t}\n\t\t\tif in.kind == \"const\" {\n\t\t\t\tv, _ := in.Process()\n\t\t\t\tfmt.Fprintf(ret, \"%s[%v](%v)\", in.kind, j, v)\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\t// Find operation index\n\t\t\tfor t := range f.operations {\n\t\t\t\tif f.operations[t] == in {\n\t\t\t\t\tfmt.Fprintf(ret, \"%s[%v]\", in.kind, t)\n\t\t\t\t\tbreak\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tfmt.Fprintf(ret, \")\\n\")\n\t}\n\n\treturn ret.String()\n}", "title": "" }, { "docid": "5bc2468c40504e5566e68cc8d58d1200", "score": "0.6363714", "text": "func (oce *ObjectCallExpression) String() string {\n\tvar out bytes.Buffer\n\tout.WriteString(oce.Object.String())\n\tout.WriteString(\".\")\n\tout.WriteString(oce.Call.String())\n\n\treturn out.String()\n}", "title": "" }, { "docid": "bf4231c49cdfea87322994370cd79aa7", "score": "0.6306934", "text": "func (v EntityCmd) String() string {\n\treturn fmt.Sprintf(\"Name: [%s], Descr: [%s], LastUpdated: [%s], LastOperator: [%s]\",\n\t\tv.Name, v.Descr, v.LastUpdated, v.LastOperator)\n}", "title": "" }, { "docid": "c8043129b8f06b65487ff00ca4da8817", "score": "0.6302143", "text": "func (o AlarmModelDynamoDbPtrOutput) Operation() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v *AlarmModelDynamoDb) *string {\n\t\tif v == nil {\n\t\t\treturn nil\n\t\t}\n\t\treturn v.Operation\n\t}).(pulumi.StringPtrOutput)\n}", "title": "" }, { "docid": "e09014e936b7d6a942234b0fd3d075da", "score": "0.6288911", "text": "func (e E_OpenconfigInterfaces_Interfaces_Interface_State_OperStatus) String() string {\n\treturn ygot.EnumLogString(e, int64(e), \"E_OpenconfigInterfaces_Interfaces_Interface_State_OperStatus\")\n}", "title": "" }, { "docid": "5febdfb718063fe1590fb404773734e1", "score": "0.6287447", "text": "func (o *ResizeOperation) String() string {\n\t// Validate operation\n\tif err := o.Validate(); err != nil {\n\t\treturn \"\"\n\t}\n\n\t// Form return value\n\tstr := OPERATION_NAME_RESIZE + QUERY_STRING_ENTRY_DELIMITER\n\tstr += \"{w}\" + values.DIMENSION_DELIMITER + \"{h}\"\n\n\t// Replace macros\n\tstr = strings.Replace(str, \"{w}\", helpers.Int642String(o.values.Width), -1)\n\tstr = strings.Replace(str, \"{h}\", helpers.Int642String(o.values.Height), -1)\n\n\treturn str\n}", "title": "" }, { "docid": "39363b4f2b207e3d851d4f830912aa4b", "score": "0.62458724", "text": "func (s OpsAggregator) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "c70766cf6bdeac019fc39b859f68827c", "score": "0.623604", "text": "func (o VolumeModifyIterRequestQuery) String() string {\n\treturn ToString(reflect.ValueOf(o))\n}", "title": "" }, { "docid": "28d02557f2e64d5c15d67df6691bf34d", "score": "0.6232582", "text": "func (s GetOpsSummaryOutput) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "4ea337acc3975bb6294adf549dec708b", "score": "0.6231931", "text": "func (av AttributeVolumeOperationType) String() string {\n\tswitch av {\n\tcase AttributeVolumeOperationTypeRead:\n\t\treturn \"read\"\n\tcase AttributeVolumeOperationTypeWrite:\n\t\treturn \"write\"\n\t}\n\treturn \"\"\n}", "title": "" }, { "docid": "192ab6eeb8a1c73d7dc51b971d1517fa", "score": "0.62191415", "text": "func (x PerconaXtraDBOpsRequestType) String() string {\n\treturn string(x)\n}", "title": "" }, { "docid": "8695794a688b112b25440d078ed00b99", "score": "0.6212282", "text": "func (o DrawOp) String() string {\n\treturn fmt.Sprintf(\"Draw Screen (V%X, V%X) Height: %X\", o.xRegister, o.yRegister, o.height)\n}", "title": "" }, { "docid": "f087badb37fad060adbfb8c6d1d9dff0", "score": "0.6193772", "text": "func (o VolumeModifyIterRequest) String() string {\n\treturn ToString(reflect.ValueOf(o))\n}", "title": "" }, { "docid": "287781edf476016ccb493d4f6c25a111", "score": "0.61823595", "text": "func (oe *InfixExpression) String() string {\n\tvar out bytes.Buffer\n\n\tout.WriteString(\"(\")\n\tout.WriteString(oe.Left.String())\n\tout.WriteString(\" \" + oe.Operator + \" \")\n\tout.WriteString(oe.Right.String())\n\tout.WriteString(\")\")\n\treturn out.String()\n}", "title": "" }, { "docid": "0e188b9015cfd31772bf908edf966aad", "score": "0.6181683", "text": "func (me TxsdFeMorphologyTypeOperator) String() string { return xsdt.String(me).String() }", "title": "" }, { "docid": "552b0b7ab484ab8907d4ed7efb9d84c3", "score": "0.61761355", "text": "func (e *Expression) String() string {\n\treturn fmt.Sprintf(\"<%s %s %s>\", e.Key, e.Op, strings.Join(e.Values, \",\"))\n}", "title": "" }, { "docid": "a745a16303b67f69f9b415d4c886b101", "score": "0.61692226", "text": "func (c CmdInstruction) String() string {\n\treturn c.Name()\n}", "title": "" }, { "docid": "ac8d5e1584c11eddf7a366860f34dd85", "score": "0.6165265", "text": "func (s OpsEntity) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "abdbdbabb4a2b483cb30454374819b85", "score": "0.61592066", "text": "func (x ElasticsearchOpsRequestType) String() string {\n\treturn string(x)\n}", "title": "" }, { "docid": "62ea2c5a316352b2d3c48e5d6f8e6217", "score": "0.61559415", "text": "func (op *output) String() string {\n\treturn op.pt.String()\n}", "title": "" }, { "docid": "142fd0e1fb0e8171e22e399bcb41e13d", "score": "0.6134744", "text": "func (oe *InfixExpression) String() string {\n\tvar out bytes.Buffer\n\n\tout.WriteString(\"(\")\n\tout.WriteString(oe.Left.String())\n\tout.WriteString(\" \")\n\tout.WriteString(oe.Operator)\n\tout.WriteString(\" \")\n\tout.WriteString(oe.Right.String())\n\tout.WriteString(\")\")\n\n\treturn out.String()\n}", "title": "" }, { "docid": "78334b19d7d5b3511919fba45e62c035", "score": "0.61312836", "text": "func (d *MockServiceQuery) String() string {\n\treturn fmt.Sprintf(\"catalog.service(%s)\", d.name)\n}", "title": "" }, { "docid": "454b2242fb2ccfc438229093ad75b1ff", "score": "0.61196905", "text": "func (o DetectorModelDynamoDbPtrOutput) Operation() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v *DetectorModelDynamoDb) *string {\n\t\tif v == nil {\n\t\t\treturn nil\n\t\t}\n\t\treturn v.Operation\n\t}).(pulumi.StringPtrOutput)\n}", "title": "" }, { "docid": "4a70f1885f3c079ebd780e093fddc11e", "score": "0.61167884", "text": "func (o *Order) String() string {\n\tvar builder strings.Builder\n\tbuilder.WriteString(\"Order(\")\n\tbuilder.WriteString(fmt.Sprintf(\"id=%v\", o.ID))\n\tbuilder.WriteByte(')')\n\treturn builder.String()\n}", "title": "" }, { "docid": "d9e4fdb5c2d51aa80de9d819286a4d2d", "score": "0.609224", "text": "func (e E_OnfSwitch_Switch_Port_State_OperStatus) String() string {\n\treturn ygot.EnumLogString(e, int64(e), \"E_OnfSwitch_Switch_Port_State_OperStatus\")\n}", "title": "" }, { "docid": "b5a2b2768fc58654b0e843ae61fa4bee", "score": "0.60869527", "text": "func (o *OneOrMoreExpr) String() string {\n\treturn fmt.Sprintf(\"%s: %T{Expr: %v}\", o.p, o, o.Expr)\n}", "title": "" }, { "docid": "982bacf28253d77a452d7305c1766b57", "score": "0.60728896", "text": "func (s OrStatement) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "982bacf28253d77a452d7305c1766b57", "score": "0.60728896", "text": "func (s OrStatement) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "f5e0a459a2222250cde432dbfc252df0", "score": "0.6063118", "text": "func (z *ZeroOrMoreExpr) String() string {\n\treturn fmt.Sprintf(\"%s: %T{Expr: %v}\", z.p, z, z.Expr)\n}", "title": "" }, { "docid": "479d9806f474915f9bb980d774c63e5a", "score": "0.60518295", "text": "func (s Operation) GoString() string {\n\treturn s.String()\n}", "title": "" }, { "docid": "a6339ac4e79a2efddcb0af31ae8523bb", "score": "0.60475695", "text": "func (s Command) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "a6339ac4e79a2efddcb0af31ae8523bb", "score": "0.60475695", "text": "func (s Command) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "86266308d82a08b1cf7f66771ec371d7", "score": "0.6029029", "text": "func (i InfoMessage) String() string {\n\treturn fmt.Sprintf(\"%v %v\", i.Operation, i.Source)\n}", "title": "" }, { "docid": "f3a472ca0de85db44d76ff176d50e4d9", "score": "0.6018418", "text": "func (c *Command) String() string {\n\tif len(c.Params) > 0 {\n\t\treturn fmt.Sprintf(\"%s %s\", c.Name, string(bytes.Join(c.Params, byteSpace)))\n\t}\n\treturn string(c.Name)\n}", "title": "" }, { "docid": "7717c696690819c204d834b38254701c", "score": "0.6015387", "text": "func (o Order) String() string {\n\tb := strings.Builder{}\n\tb.WriteString(\"Order:\\n\")\n\tb.WriteString(fmt.Sprintf(\" ID: %s\\n\", o.ID.String()))\n\tb.WriteString(fmt.Sprintf(\" Owner: %s\\n\", o.Owner.String()))\n\tb.WriteString(fmt.Sprintf(\" Direction: %s\\n\", o.Direction.String()))\n\tb.WriteString(fmt.Sprintf(\" Price: %s\\n\", o.Price.String()))\n\tif o.Direction == Bid {\n\t\tb.WriteString(fmt.Sprintf(\" QQuantity: %s\\n\", o.Market.QuoteCurrency.UintToDec(o.Quantity).String()))\n\t} else {\n\t\tb.WriteString(fmt.Sprintf(\" BQuantity: %s\\n\", o.Market.BaseCurrency.UintToDec(o.Quantity).String()))\n\t}\n\tb.WriteString(fmt.Sprintf(\" Ttl: %s\\n\", o.Ttl.String()))\n\tb.WriteString(fmt.Sprintf(\" CreatedAt: %s\\n\", o.CreatedAt.String()))\n\tb.WriteString(fmt.Sprintf(\" UpdatedAt: %s\\n\", o.UpdatedAt.String()))\n\tb.WriteString(o.Market.String())\n\n\treturn b.String()\n}", "title": "" }, { "docid": "a14348400ad8d8013ddb530d8c7d78f9", "score": "0.60134166", "text": "func (ct CommandType) String() string {\n\treturn string(ct)\n}", "title": "" }, { "docid": "11c49e58e6cce6a5c2b1677623598752", "score": "0.6009222", "text": "func (o Order) String() string {\n\treturn fmt.Sprintf(\"%s,%s\", o.Key, o.Direction)\n}", "title": "" }, { "docid": "61ceed26c942769b5de70f15250c3238", "score": "0.5995952", "text": "func (e *ExprAdd) String() string {\n\treturn fmt.Sprintf(\"%v %v\", e.Type(), e.Ident())\n}", "title": "" }, { "docid": "980fa02a88a681868bd94b4dca28832e", "score": "0.59851587", "text": "func (inst Instructions) String() string {\n\n\tvar out bytes.Buffer\n\n\ti := 0\n\tfor i < len(inst) {\n\t\tdef, err := Lookup(OpCode(inst[i]))\n\t\tif err != nil {\n\t\t\tfmt.Fprintf(&out, \"ERROR : %s\\n\", err)\n\t\t\tcontinue\n\t\t}\n\n\t\toperands, read := ReadOperands(def, inst[i+1:])\n\n\t\tfmt.Fprintf(&out, \"%04d %s\\n\", i, inst.FormatInstruction(def, operands))\n\n\t\ti += 1 + read\n\n\t}\n\n\treturn out.String()\n}", "title": "" }, { "docid": "694c395eeffc0eced49ae3f80730f841", "score": "0.59727246", "text": "func (a *chartAction) String() string {\n\tvar props = &chartActionProps{}\n\n\tif a.props != nil {\n\t\tprops = a.props\n\t}\n\n\treturn props.tr(a.log, nil)\n}", "title": "" }, { "docid": "8f2480ee67c923ba99c5994de1c7f18e", "score": "0.5972375", "text": "func (r RunInstruction) String() string {\n\treturn r.Name()\n}", "title": "" }, { "docid": "f57cce8a80729632f7fc697c6b968a9f", "score": "0.5971214", "text": "func (s CreateLayerOutput) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "7fded55823b68e4b89665e1fc1d371ea", "score": "0.59672016", "text": "func (s DescribeServiceActionOutput) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "714a27bf677255ec0ace5b28620352a5", "score": "0.5966264", "text": "func (e E_OpenconfigPlatformTypes_COMPONENT_OPER_STATUS) String() string {\n\treturn ygot.EnumLogString(e, int64(e), \"E_OpenconfigPlatformTypes_COMPONENT_OPER_STATUS\")\n}", "title": "" }, { "docid": "1e9839260668292ec0c1a472b0e48344", "score": "0.5962838", "text": "func (o *Order) String(decayModifier int) string {\n\treturn fmt.Sprintf(\"Order{id=%s, value=%.3f}\", o.Id, o.Value(decayModifier))\n}", "title": "" }, { "docid": "acf492227d4c71935dc62da2c8e85e0c", "score": "0.59610945", "text": "func (wc *WriteCommand) toString() string {\n\treturn fmt.Sprintf(\"WC[%v] WALKeyPath:%s (len:%d, off:%d, idx:%d, dsize:%d)\", wc.RecordType, wc.WALKeyPath, wc.VarRecLen, wc.Offset, wc.Index, len(wc.Data))\n}", "title": "" }, { "docid": "df3404021c8a17bb79a3ae1267e2837c", "score": "0.595959", "text": "func (tr *Transport) Operation() string {\n\treturn tr.operation\n}", "title": "" }, { "docid": "0d2af9794ff7e32e31b50997c2eb048b", "score": "0.5958329", "text": "func (p *Plus) String() string {\n\tif neg, ok := p.B.(*Negate); ok {\n\t\treturn fmt.Sprintf(\"(%s - %s)\", p.A, neg.Elem)\n\t}\n\treturn fmt.Sprintf(\"(%s + %s)\", p.A, p.B)\n}", "title": "" }, { "docid": "560cbbfc2031b8c58741a8a3220bbdc8", "score": "0.59558904", "text": "func (t *TimestampOpinion) String() string {\n\treturn stringify.Struct(\"TimestampOpinion\",\n\t\tstringify.StructField(\"MessageID\", t.MessageID),\n\t\tstringify.StructField(\"Value\", t.Value),\n\t\tstringify.StructField(\"LoK\", t.LoK),\n\t)\n}", "title": "" }, { "docid": "f2a78e5418fcb53aafa1287e3c0ee6c3", "score": "0.5941574", "text": "func (op DomainOutpoint) String() string {\n\treturn fmt.Sprintf(\"(%s: %d)\", op.TransactionID, op.Index)\n}", "title": "" }, { "docid": "72ae246e1b386be982fdeda7fbbd7c33", "score": "0.5941007", "text": "func (s GetOpsSummaryInput) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "fe7b25061f80203157d36fbdff65ff05", "score": "0.5937235", "text": "func (this *ook) String() string {\n\treturn fmt.Sprintf(\"<sensors.protocol>{ name='%v' mode=%v }\", this.Name(), this.Mode())\n}", "title": "" }, { "docid": "e106ce80512ae7a77df796a9f261cad3", "score": "0.59267825", "text": "func (ie *InfixExpression) String() string {\n\tvar out bytes.Buffer\n\tout.WriteString(\"(\")\n\tout.WriteString(ie.Left.String())\n\tout.WriteString(\" \" + ie.Operator + \" \")\n\tout.WriteString(ie.Right.String())\n\tout.WriteString(\")\")\n\treturn out.String()\n}", "title": "" }, { "docid": "e106ce80512ae7a77df796a9f261cad3", "score": "0.59267825", "text": "func (ie *InfixExpression) String() string {\n\tvar out bytes.Buffer\n\tout.WriteString(\"(\")\n\tout.WriteString(ie.Left.String())\n\tout.WriteString(\" \" + ie.Operator + \" \")\n\tout.WriteString(ie.Right.String())\n\tout.WriteString(\")\")\n\treturn out.String()\n}", "title": "" }, { "docid": "e106ce80512ae7a77df796a9f261cad3", "score": "0.59267825", "text": "func (ie *InfixExpression) String() string {\n\tvar out bytes.Buffer\n\tout.WriteString(\"(\")\n\tout.WriteString(ie.Left.String())\n\tout.WriteString(\" \" + ie.Operator + \" \")\n\tout.WriteString(ie.Right.String())\n\tout.WriteString(\")\")\n\treturn out.String()\n}", "title": "" }, { "docid": "febfa2bfcddc5fdbc1e00deb1bb782a3", "score": "0.592451", "text": "func (c *t) String() string {\n\treturn c.actDesc.String()\n}", "title": "" }, { "docid": "5c4e6db5908440ccf44a41277db24802", "score": "0.59168017", "text": "func OperationFromString(operationString string) Operation {\n\tswitch operationString {\n\tcase Average.String():\n\t\treturn Average\n\tcase Minimum.String():\n\t\treturn Minimum\n\tcase Maximum.String():\n\t\treturn Maximum\n\t}\n\treturn UnknownOperation\n}", "title": "" } ]
909d486e584ce5d1e8838c79e209386e
close closes the s immediately.
[ { "docid": "aefcf1dbce1cbc16b73078144e57c13f", "score": "0.6005816", "text": "func (s *server) close() error {\n\treturn s.server.Close()\n}", "title": "" } ]
[ { "docid": "5d9a9e1702c978b919a08f8d477fd00b", "score": "0.6652895", "text": "func (s *stream) Close() error {\n\treturn nil\n}", "title": "" }, { "docid": "34ed33b2ed88a2a966e841110309aa0c", "score": "0.637582", "text": "func (s *Sniffer) close() error {\n\tif err := unix.Close(s.fd); err != nil {\n\t\treturn fmt.Errorf(\"can't close sniffer socket: %w\", err)\n\t}\n\ts.fd = -1\n\treturn nil\n}", "title": "" }, { "docid": "42b2d173209a79bef9980836bd64697a", "score": "0.63669014", "text": "func (s *Sun) Close() {\n\ts.open = false\n}", "title": "" }, { "docid": "a94ccb415684e5ae2e0adacbbbd887f4", "score": "0.6357707", "text": "func (fss *StreamingService) Close() error { return nil }", "title": "" }, { "docid": "76558571bdcb76dcb27178ec5ad87636", "score": "0.6298902", "text": "func (s *Subscriber) close() {\n\ts.quit <- s\n}", "title": "" }, { "docid": "5ec72837d18378a62d533e11d1d07090", "score": "0.6261912", "text": "func (s *server) close() error {\n\treturn s.ln.Close()\n}", "title": "" }, { "docid": "6825dd9c59f18dc63ad6bb76e91a628a", "score": "0.62357974", "text": "func (s *NullEventSpool) Close() {\n}", "title": "" }, { "docid": "48629846884f19a01b6e30798489c37f", "score": "0.619736", "text": "func (c *minecraftConn) close() error {\n\treturn c.closeKnown(true)\n}", "title": "" }, { "docid": "7b9645eb91d6e9bd094a2e9d74f72ad7", "score": "0.61867154", "text": "func (s *Speaker) Close() error { return nil }", "title": "" }, { "docid": "12c618651cdb3e976bfa36cb90eb2629", "score": "0.6159349", "text": "func (c *Conn) close() {\n\tc.evaction = evio.Close\n\tc.wake()\n}", "title": "" }, { "docid": "4207e1418a1e8420e680dea1c58931ab", "score": "0.61582416", "text": "func (r *body) Close() error { return nil }", "title": "" }, { "docid": "1abc93b51b4a06c207703ca487c3533f", "score": "0.614021", "text": "func (s *Source) Close() {\n\ts.ifOpen(func() { C.del_aubio_source(s.s) })\n\ts.s = nil\n}", "title": "" }, { "docid": "e7c97ea6022d79f4c70f34162179e3df", "score": "0.61003566", "text": "func (s *SecondStateMachine) Close() {}", "title": "" }, { "docid": "5716649622a606e53cc8f00abe49a7aa", "score": "0.609256", "text": "func (s *SeekerWrapper) Close() error { return s.s.Close() }", "title": "" }, { "docid": "a7cab7933a732901b49ed1b9716c0a41", "score": "0.60700595", "text": "func (n *Node) close() {\n\tn.closeOnce.Do(func() {\n\t\tfmt.Printf(\"closing %v\\n\", n.ID)\n\t\t//closing logic of all the resources of this stream\n\t\t//in case it is relying on has external data source, eg. a stream reader\n\t\tif n.externalSource != nil {\n\t\t\t_ = n.externalSource.Shutdown()\n\t\t\t<-n.externalSource.Done()\n\t\t}\n\t\t//here we should assume all parents/external source that will insert to data channel are closed when reached here\n\t\t//that means the following check is not necessary. eg:\n\t\t/*\n\t\t\tfor p := range n.Parents {\n\t\t\t\t<-p.done()\n\t\t\t}\n\t\t*/\n\t\tclose(n.DataCh)\n\t\t//when data channel is closed, wait all routine/job replying on it to auto-close\n\t\t//eg. Map/Filter function's conversion job routine\n\t\tn.wg.Wait()\n\t\tclose(n.doneCh)\n\t\tfmt.Printf(\"closed %v\\n\", n.ID)\n\t})\n}", "title": "" }, { "docid": "96ad5e0b8c0ac7510fe9069d6f1caa14", "score": "0.60397446", "text": "func (c *causality) close() {\n\tclose(c.outCh)\n}", "title": "" }, { "docid": "c4f0134547a2309b849b69feadd2003e", "score": "0.60364425", "text": "func (s *Stream) forceClose() {\n\ts.stateLock.Lock()\n\ts.state = streamClosed\n\ts.stateLock.Unlock()\n\ts.notifyWaiting()\n}", "title": "" }, { "docid": "e98e8458de85cc37188ae7180d9296ab", "score": "0.60064775", "text": "func (b *ballotMaster) close() {\n\t// Nothing to do now (jsut placeholder). The current ballot\n\t// is closed when the ballot resultch is closed.\n\t// Instead of doing it in this method, should\n\t// do it in the poll worker to avoid race condition.\n}", "title": "" }, { "docid": "42e37b87874eb1511dee10893ef0ac0a", "score": "0.60013247", "text": "func (c *Client) Close() {}", "title": "" }, { "docid": "42e37b87874eb1511dee10893ef0ac0a", "score": "0.60013247", "text": "func (c *Client) Close() {}", "title": "" }, { "docid": "aba985e7e38337da404d408d05a5dffc", "score": "0.59968734", "text": "func (s *StaticSource) Close() error {\n\treturn nil\n}", "title": "" }, { "docid": "3fdd0c07b5234a6804b337e11093acd3", "score": "0.5971246", "text": "func (c *client) close() {\n\tc.leave()\n\tc.Conn.Close()\n\tc.Message <- \"/quit\"\n}", "title": "" }, { "docid": "f2c75140e5744b8ad42277e3dc803c85", "score": "0.5959162", "text": "func (nopCloser) Close() error { return nil }", "title": "" }, { "docid": "279fded9c9f642134cfea1e9db5c55ea", "score": "0.59438336", "text": "func (t *tcp) close() error {\n\tif !t.isopen {\n\t\treturn nil\n\t}\n\tt.isopen = false\n\t// closing this channel means that anyone readong from the channel is auto-selected in a Select statement\n\tclose(t.closed)\n\tt.conn.Close()\n\treturn nil\n}", "title": "" }, { "docid": "3afb26a18e4c7ad7b7248417143f9b76", "score": "0.593013", "text": "func (c *Client) close(reason string) (err error) {\n\tc.closer.Do(func() {\n\t\tif reason != \"\" {\n\t\t\tc.Logln(LogConn, \"Close reason:\", reason)\n\t\t}\n\t\tif err = c.t.Close(false); err != nil {\n\t\t\tc.Logln(LogConn, \"Close error:\", err)\n\t\t}\n\t})\n\treturn\n}", "title": "" }, { "docid": "735e2ece30bad708dd03f73356533471", "score": "0.59148276", "text": "func (s IOStreams) Close() error {\n\t// TODO\n\treturn nil\n}", "title": "" }, { "docid": "c20024259ec537b2c07a8833bb3aa34b", "score": "0.5907509", "text": "func (c *conn) close(err error) {\n\tc.l.Debugf(\"close livereload socket with error: %s\", err)\n\tc.closer.Do(func() {\n\t\tc.l.Debugf(\"actually closing livereload socket\")\n\t\tcloseCode := websocket.CloseInternalServerErr\n\t\tif closeErr, ok := err.(*websocket.CloseError); ok {\n\t\t\tcloseCode = closeErr.Code\n\t\t}\n\n\t\tmsg := err.Error()\n\t\tcloseMsg := websocket.FormatCloseMessage(closeCode, msg)\n\t\tdeadline := time.Now().Add(time.Second)\n\n\t\twriteErr := c.ws.WriteControl(websocket.CloseMessage, closeMsg, deadline)\n\t\tif writeErr != nil && !errors.Is(writeErr, websocket.ErrCloseSent) {\n\t\t\tc.l.Debugf(\"failed to write websocket close message: %s\", writeErr)\n\t\t}\n\t\tcloseErr := c.ws.Close()\n\t\tif closeErr != nil {\n\t\t\tc.l.Errorf(\"failed to close websocket: :%s\", closeErr)\n\t\t}\n\t\tclose(c.send)\n\t})\n}", "title": "" }, { "docid": "1231c4df7faef796d488f9dba5df399e", "score": "0.59067035", "text": "func (s socket) Close() error {\n\ts.done <- true\n\treturn nil\n}", "title": "" }, { "docid": "afce92c23b771f2f4adf781c06b7b72f", "score": "0.58930564", "text": "func (c FinalOutput) Close() {}", "title": "" }, { "docid": "15c56922fade1e32820f7a7ceac610f0", "score": "0.58873355", "text": "func (u *EtcdUtil) Close() {\n\tclose(u.s)\n\tu.c.Close()\n}", "title": "" }, { "docid": "b3c7c4c7ee99358461375b2da86be755", "score": "0.5859895", "text": "func (s *Service) Close() {\n}", "title": "" }, { "docid": "b3c7c4c7ee99358461375b2da86be755", "score": "0.5859895", "text": "func (s *Service) Close() {\n}", "title": "" }, { "docid": "b3c7c4c7ee99358461375b2da86be755", "score": "0.5859895", "text": "func (s *Service) Close() {\n}", "title": "" }, { "docid": "b3c7c4c7ee99358461375b2da86be755", "score": "0.5859895", "text": "func (s *Service) Close() {\n}", "title": "" }, { "docid": "38339192d9cc070c599bb51541508de0", "score": "0.58532083", "text": "func (fn Closer) Close() error {\n\treturn fn()\n}", "title": "" }, { "docid": "19763428a58dbe3ef250e0b78efc5590", "score": "0.584862", "text": "func (f CloserFn) Close() {\n\tf()\n}", "title": "" }, { "docid": "19763428a58dbe3ef250e0b78efc5590", "score": "0.584862", "text": "func (f CloserFn) Close() {\n\tf()\n}", "title": "" }, { "docid": "ec9bc5ccf48217ef4ce8cbc931ee8887", "score": "0.58461267", "text": "func (t *task) close() {\n\tt.once.Do(func() {\n\t\tclose(t.C)\n\t})\n}", "title": "" }, { "docid": "5bf99ef797f2ba8226de6fadf25dc5c4", "score": "0.5833622", "text": "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}", "title": "" }, { "docid": "d329c37528c13faa939bb59c5157914e", "score": "0.58279634", "text": "func (c *Circuit) close(now time.Time, forceClosed bool) {\n\tif !c.IsOpen() {\n\t\t// Not open. Don't need to close it\n\t\treturn\n\t}\n\tif c.threadSafeConfig.CircuitBreaker.ForceOpen.Get() {\n\t\treturn\n\t}\n\tif forceClosed || c.OpenToClose.ShouldClose(now) {\n\t\tc.CircuitMetricsCollector.Closed(now)\n\t\tc.isOpen.Set(false)\n\t}\n}", "title": "" }, { "docid": "c64d15b9544f5520447cf62f0be7f098", "score": "0.5824104", "text": "func (d *daemon) close() error {\n\tif d.closed {\n\t\treturn errors.New(\"connection to daemon already closed\")\n\t}\n\td.closed = true\n\treturn d.text.Close()\n}", "title": "" }, { "docid": "c38aeeabdfe6e7a61f89addd2ff2e117", "score": "0.5810999", "text": "func (s *stmt) Close() error {\n\treturn nil\n}", "title": "" }, { "docid": "5a940bc77fd7aed5a46b65b1f67e6ab8", "score": "0.5810265", "text": "func (s *RaftStateMachine) Close() {\n\ts.closer()\n}", "title": "" }, { "docid": "7150f4c8ff11efe6beb6ba03fc37e1c6", "score": "0.58024645", "text": "func (s *stor) Close() {\n\tif s.d == nil {\n\t\treturn\n\t}\n\ts.d.Close()\n}", "title": "" }, { "docid": "39cb137571c7a507225915e2f2d519d9", "score": "0.57793593", "text": "func (ts *TimedSched) Close() { ts.dieOnce.Do(func() { close(ts.die) }) }", "title": "" }, { "docid": "39cb137571c7a507225915e2f2d519d9", "score": "0.57793593", "text": "func (ts *TimedSched) Close() { ts.dieOnce.Do(func() { close(ts.die) }) }", "title": "" }, { "docid": "12d8407507a3db41c261d3ce1a159820", "score": "0.57760143", "text": "func (c *Mock) Close() { c.Closed = true }", "title": "" }, { "docid": "a69a834600a13f496734af7080c37be1", "score": "0.5775577", "text": "func (s *Stream) Close() error {\n\tlog.Print(\"[INFO] Closing \", s.URL)\n\treturn s.rc.Close()\n}", "title": "" }, { "docid": "cb61e375e26134a77c0452f8e441099c", "score": "0.5769827", "text": "func (s *UDPServer) close() {\n\ts.sock.Close()\n}", "title": "" }, { "docid": "04d65336e5e8f4d2b8c506cb73bf49af", "score": "0.575634", "text": "func Close() {\n\t//Nothing to do\n}", "title": "" }, { "docid": "a099502e844d9c1af0b46794b8f6b124", "score": "0.57471365", "text": "func (sb *closableStringBuilder) Close() error {\n\treturn nil\n}", "title": "" }, { "docid": "caaa001d69be3ed0f5d798684a05b145", "score": "0.5746764", "text": "func (c *Client) Close() {\n}", "title": "" }, { "docid": "caaa001d69be3ed0f5d798684a05b145", "score": "0.5746764", "text": "func (c *Client) Close() {\n}", "title": "" }, { "docid": "10ce008760ad026ecf45ec31490574d5", "score": "0.57467", "text": "func (self *Client) close() {\n\t// TODO: Cleanly close connection to remote\n}", "title": "" }, { "docid": "f78cda1b51cfcab94880af39c34d274b", "score": "0.5741123", "text": "func (sm *RegularStateMachine) Close() {\n\tsm.sm.Close()\n}", "title": "" }, { "docid": "ecaa57dbcd3c7980b45a6fd5fb290846", "score": "0.5740039", "text": "func (c *WSCodec) Close() {\n\tc.closer.Do(func() {\n\t\tclose(c.closed)\n\t})\n}", "title": "" }, { "docid": "86f16710bcbed7c11016d29c1189f05e", "score": "0.573959", "text": "func (c *client) Close() error { return c.c.Close() }", "title": "" }, { "docid": "07c0abd90cad02d33b88212379838983", "score": "0.5733352", "text": "func (response *S3Response) Close() {\n if ! response.hasBeenClosed {\n response.httpResponse.Body.Close()\n response.hasBeenClosed = true\n }\n}", "title": "" }, { "docid": "4b240ed4a97fea4ae1f373a5d589d1b3", "score": "0.5706924", "text": "func (s *WriterAtStream) Close() {\n\tclose(s.closed)\n\t<-s.done\n}", "title": "" }, { "docid": "8e27a6da8cf99a2c752b0caacaf7c899", "score": "0.57029206", "text": "func (s *Stmt) Close() error {\n\treturn nil\n}", "title": "" }, { "docid": "37ed2c1bc030de9288d3d8f1edc87b23", "score": "0.5702516", "text": "func (s *Stream) closeTimeout() {\n\t// Close our side forcibly\n\ts.forceClose()\n\n\t// Free the stream from the session map\n\ts.session.closeStream(s.id)\n\n\t// Send a RST so the remote side closes too.\n\ts.sendLock.Lock()\n\tdefer s.sendLock.Unlock()\n\ts.sendHdr.encode(typeWindowUpdate, flagRST, s.id, 0)\n\ts.session.sendNoWait(s.sendHdr)\n}", "title": "" }, { "docid": "ad05e80b6f12b4ae80c89d65ed005c55", "score": "0.5702098", "text": "func (f *Filterdata) Close() {\r\n\tatomic.StoreInt32(&f.isclose, 1)\r\n}", "title": "" }, { "docid": "25ec0face368460825c1116afaf9a1c4", "score": "0.5699508", "text": "func (it *RandomBeaconDkgMaliciousResultSlashedIterator) Close() error {\n\tit.sub.Unsubscribe()\n\treturn nil\n}", "title": "" }, { "docid": "cabb56e1bf366ac8a91d3278fc5a44ad", "score": "0.5696891", "text": "func (i *Injector) close() error {\n\tif err := unix.Close(i.fd); err != nil {\n\t\treturn fmt.Errorf(\"can't close sniffer socket: %w\", err)\n\t}\n\ti.fd = -1\n\treturn nil\n}", "title": "" }, { "docid": "183c6da1016cd1d71fb45d164459225d", "score": "0.56953776", "text": "func (stream *Stream) Close() {\n\tstream.closeOnce.Do(func() {\n\t\tclose(stream.closer)\n\t})\n}", "title": "" }, { "docid": "28cba6bb5286cfa7385c9cf50c85c00e", "score": "0.56874883", "text": "func (e *HTTPExecuter) Close() {}", "title": "" }, { "docid": "730a7d09a6fdbef20e8d31c27c850d36", "score": "0.5683482", "text": "func (s *packetManager) close() {\n\t// pause until current packets are processed\n\ts.working.Wait()\n\tclose(s.fini)\n}", "title": "" }, { "docid": "730a7d09a6fdbef20e8d31c27c850d36", "score": "0.5683482", "text": "func (s *packetManager) close() {\n\t// pause until current packets are processed\n\ts.working.Wait()\n\tclose(s.fini)\n}", "title": "" }, { "docid": "fe7b256ec55e31594bed17c18f1a03fe", "score": "0.5680067", "text": "func (s *Stream) Close() error {\n\treturn s.s.Close()\n}", "title": "" }, { "docid": "3c3cc97698be5ad361fea400f2e85644", "score": "0.56763166", "text": "func (s *Service) Close() {\n\tif s.closer != nil {\n\t\ts.closer()\n\t}\n}", "title": "" }, { "docid": "1a1ea72a978099f2af0f2cc3306c21ff", "score": "0.5674629", "text": "func (b *bitWriter) close() error {\n\t// End mark\n\tb.addBits16Clean(1, 1)\n\t// flush until next byte.\n\tb.flushAlign()\n\treturn nil\n}", "title": "" }, { "docid": "922e827a15b8029f64c121e6fcc441ed", "score": "0.5674081", "text": "func (n *NoOP) Close() {}", "title": "" }, { "docid": "a8cc8c76594b1bc577429154c4b3c0c9", "score": "0.56708133", "text": "func (c *Client) Close() { c.streamLayer.Close() }", "title": "" }, { "docid": "3cb9575c4f3f2d02b4f8448d0967d9b1", "score": "0.56674904", "text": "func (buf *logBuffer) close() {\n\tbuf.Flush()\n\tbuf.file.Close()\n\treturn\n}", "title": "" }, { "docid": "d4325ecbce9dc4b175c2633d37c538de", "score": "0.56668824", "text": "func (w *responseWriter) close() (err error) {\n\tif w.closed {\n\t\treturn errAlreadyClosed\n\t}\n\terr = w.w.Close()\n\tw.closed = true\n\treturn\n}", "title": "" }, { "docid": "f64541faac9c4461c3c16a5c12230a65", "score": "0.5665517", "text": "func (t *Tag) Close(p *Processor, attr string) {\n\tp.Write(t.close)\n}", "title": "" }, { "docid": "524b0bf86d998f9fafa7683a16f2765e", "score": "0.566549", "text": "func (connection *SSEConnection) Close() {\n\tconnection.isClosed = true\n}", "title": "" }, { "docid": "55f6cab346ef0c69a54c304b9a5b9bc8", "score": "0.56541514", "text": "func (t *Client) Close() error { return nil }", "title": "" }, { "docid": "08bded6f4113ff975fe343f993613e23", "score": "0.5644552", "text": "func (s *HTTPServer) Close() error { s.ln.Close(); return nil }", "title": "" }, { "docid": "1f5a9b7d08dd34db95d939737ba49523", "score": "0.5636657", "text": "func (s *SessionSRTCP) Close() error {\n\treturn nil\n}", "title": "" }, { "docid": "ba6627270bfcbb638ac4391c39d1de53", "score": "0.56331146", "text": "func (s SecureCodec) Close() error {\n\terr := s.closer.Close()\n\treturn err\n}", "title": "" }, { "docid": "4859055a7591a9117db82f916a357e04", "score": "0.5630565", "text": "func (c *Counter) Close() {}", "title": "" }, { "docid": "507610c49fda9b99ca2cc8e146679ffe", "score": "0.56300074", "text": "func (stmt *statement) Close() {\n\treuseStmt(stmt)\n}", "title": "" }, { "docid": "babbe7d69c0ceaaaa9ffcf9fd57f29d2", "score": "0.56296486", "text": "func (s *Stream) Close() {\n\ts.session.deleteStream(s.ID)\n}", "title": "" }, { "docid": "5a1a80ff1fd07243fdd4ca043a8c411a", "score": "0.56272227", "text": "func (s *Sink) Close() {\n\ts.ifOpen(func() { C.del_aubio_sink(s.s) })\n\ts.s = nil\n}", "title": "" }, { "docid": "6870237460d0339e177ddfc2957d050a", "score": "0.56212884", "text": "func (upload *Upload) close() error {\n\tupload.mu.Lock()\n\tdefer upload.mu.Unlock()\n\n\tif upload.closed {\n\t\treturn Error.New(\"already closed\")\n\t}\n\n\tupload.closed = true\n\treturn nil\n}", "title": "" }, { "docid": "53b62d6c0fefcb2a4e5b703928cd77c7", "score": "0.56100947", "text": "func (h *ihash) Close() error {\n\treturn h.s.Close()\n}", "title": "" }, { "docid": "2e63ac246f90b85423dfdafd1b2c82f4", "score": "0.56091136", "text": "func (s Stemmer) Close() {\n C.sb_stemmer_delete(s.stemmer)\n}", "title": "" }, { "docid": "bbd641f45564022adf3abe9952f8c6a0", "score": "0.5606114", "text": "func (s *BoltState) Close() error {\n\ts.valid = false\n\treturn nil\n}", "title": "" }, { "docid": "9ab96996114208d311d6acd27e6c2956", "score": "0.56041116", "text": "func (r *Receiver) Close() error { return nil }", "title": "" }, { "docid": "f6e94731fc8616bb4fe5cc1d0c2391df", "score": "0.5600132", "text": "func (sr *shardResult) Close() {\n\tfor _, series := range sr.blocks {\n\t\tseries.Blocks.Close()\n\t}\n}", "title": "" }, { "docid": "06ddf7bfa29a2603bb86fc1b61ad7761", "score": "0.5599611", "text": "func (s *service) Close() error {\n\treturn nil\n}", "title": "" }, { "docid": "17b9b4ce6c3eff555925a0545f33fd93", "score": "0.55987215", "text": "func (s *socket) close() error {\n\tfor _, c := range s.Channels {\n\t\tc.close()\n\t\ts.removeChannel(c)\n\t}\n\n\ts.mu.Lock()\n\tdefer s.mu.Unlock()\n\n\tlog.Printf(\"ZeroRPC socket closed\")\n\treturn s.zmqSocket.Close()\n}", "title": "" }, { "docid": "d157fe5e2094d6a64fb80a260d375366", "score": "0.5597956", "text": "func (ch *Channel) Close() {}", "title": "" }, { "docid": "85934641971ce6868c88b49eeebea987", "score": "0.55977887", "text": "func (s *Iterator) Close() {\n\ts.i.Close()\n}", "title": "" }, { "docid": "8bc32117cc1dd1124affe139ed7275fd", "score": "0.55969846", "text": "func Close() {\n}", "title": "" }, { "docid": "4fc9fe01aa34c099eed9b2ba8f3c86c8", "score": "0.5593171", "text": "func (a *adjudicatorPubSub) close() {\n\ta.once.Do(func() { close(a.pipe) })\n}", "title": "" }, { "docid": "8543877d778f862f99561cd83ed88956", "score": "0.5591593", "text": "func (s *Fs) Close() error {\n\treturn nil\n}", "title": "" }, { "docid": "e07d71052ccc7e5e554c489f00887955", "score": "0.557473", "text": "func (s *Session) Close() {\n\ts.Sid = DefaultSid\n}", "title": "" }, { "docid": "305b9eb10939dbad6a07ce490559850c", "score": "0.5565615", "text": "func (b *Browser) Close() {\n\tif err := b.c.Close(); err != nil {\n\t\tlog.Println(err)\n\t}\n\tif err := b.s.Close(); err != nil {\n\t\tlog.Println(err)\n\t}\n}", "title": "" } ]
06e7ff8a9f90de3f5d7697a41bff18e3
getLockRefs get lock IDs specified on the prefix and timestamp key
[ { "docid": "bad6c484ae8dbd04f477f6561fc65f7e", "score": "0.6548246", "text": "func (k Keeper) getLegacyLockRefs(ctx sdk.Context, key []byte) []uint64 {\n\tstore := ctx.KVStore(k.storeKey)\n\tlockIDs := []uint64{}\n\tif store.Has(key) {\n\t\tbz := store.Get(key)\n\t\terr := json.Unmarshal(bz, &lockIDs)\n\t\tif err != nil {\n\t\t\tpanic(err)\n\t\t}\n\t}\n\treturn lockIDs\n}", "title": "" } ]
[ { "docid": "645da04579373e620f82ed178369f6ba", "score": "0.54917765", "text": "func (b *BookingModel) GetLockFileNames() []string {\n\tvar names []string\n\tnames = append(names, \"lock_\"+b.CheckInDate.Format(\"2006-01-02\")+\"_\"+b.RoomId)\n\treturn names\n}", "title": "" }, { "docid": "6dd9ed7f030ac7573b481dc2b92bdc3e", "score": "0.53986907", "text": "func (l *Lock) getTempLockListKey() {\n\tl.TempListKey = \"tc.\" + l.appid + \".\" + l.tid\n}", "title": "" }, { "docid": "bb846cdc0a99819e6b748c947106f6c6", "score": "0.52759117", "text": "func (mvcc *MVCCLevelDB) ScanLock(startKey, endKey []byte, maxTS uint64) ([]*kvrpcpb.LockInfo, error) {\n\tmvcc.mu.RLock()\n\tdefer mvcc.mu.RUnlock()\n\n\titer, currKey, err := newScanIterator(mvcc.getDB(\"\"), startKey, endKey)\n\tdefer iter.Release()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tvar locks []*kvrpcpb.LockInfo\n\tfor iter.Valid() {\n\t\tdec := lockDecoder{expectKey: currKey}\n\t\tok, err := dec.Decode(iter)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tif ok && dec.lock.startTS <= maxTS {\n\t\t\tlocks = append(locks, &kvrpcpb.LockInfo{\n\t\t\t\tPrimaryLock: dec.lock.primary,\n\t\t\t\tLockVersion: dec.lock.startTS,\n\t\t\t\tKey: currKey,\n\t\t\t})\n\t\t}\n\n\t\tskip := skipDecoder{currKey: currKey}\n\t\t_, err = skip.Decode(iter)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tcurrKey = skip.currKey\n\t}\n\treturn locks, nil\n}", "title": "" }, { "docid": "8712dd12f83a82f8d5c077395f5b85e0", "score": "0.5274783", "text": "func (r *reaper) scanLocks(key string, handler func(k string, v int64) error) error {\n\tconn := r.pool.Get()\n\tdefer func() {\n\t\tif err := conn.Close(); err != nil {\n\t\t\tlogger.Errorf(\"Failed to close redis connection: %v\", err)\n\t\t}\n\t}()\n\n\tvar cursor int64\n\n\tfor {\n\t\treply, err := redis.Values(conn.Do(\"HSCAN\", key, cursor, \"MATCH\", \"*\", \"COUNT\", 100))\n\t\tif err != nil {\n\t\t\treturn errors.Wrap(err, \"scan locks\")\n\t\t}\n\n\t\tif len(reply) != 2 {\n\t\t\treturn errors.New(\"expect 2 elements returned\")\n\t\t}\n\n\t\t// Get next cursor\n\t\tcursor, err = strconv.ParseInt(string(reply[0].([]uint8)), 10, 64)\n\t\tif err != nil {\n\t\t\treturn errors.Wrap(err, \"scan locks\")\n\t\t}\n\n\t\tif values, ok := reply[1].([]interface{}); ok {\n\t\t\tfor i := 0; i < len(values); i += 2 {\n\t\t\t\tk := string(values[i].([]uint8))\n\t\t\t\tlc, err := strconv.ParseInt(string(values[i+1].([]uint8)), 10, 64)\n\t\t\t\tif err != nil {\n\t\t\t\t\t// Ignore and continue\n\t\t\t\t\tlogger.Errorf(\"Malformed lock object for %s: %v\", k, err)\n\t\t\t\t\tcontinue\n\t\t\t\t}\n\t\t\t\t// Call handler to handle the data\n\t\t\t\tif err := handler(k, lc); err != nil {\n\t\t\t\t\t// Log and ignore the error\n\t\t\t\t\tlogger.Errorf(\"Failed to call reap handler: %v\", err)\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\t// Check if we have reached the end\n\t\tif cursor == 0 {\n\t\t\treturn nil\n\t\t}\n\t}\n}", "title": "" }, { "docid": "9f20e621f06f9f20016bcc8bcf6b3272", "score": "0.5231698", "text": "func (d *DynamoDBBackend) List(ctx context.Context, prefix string) ([]string, error) {\n\tdefer metrics.MeasureSince([]string{\"dynamodb\", \"list\"}, time.Now())\n\n\tprefix = strings.TrimSuffix(prefix, \"/\")\n\n\tkeys := []string{}\n\tprefix = escapeEmptyPath(prefix)\n\tqueryInput := &dynamodb.QueryInput{\n\t\tTableName: aws.String(d.table),\n\t\tConsistentRead: aws.Bool(true),\n\t\tKeyConditions: map[string]*dynamodb.Condition{\n\t\t\t\"Path\": {\n\t\t\t\tComparisonOperator: aws.String(\"EQ\"),\n\t\t\t\tAttributeValueList: []*dynamodb.AttributeValue{{\n\t\t\t\t\tS: aws.String(prefix),\n\t\t\t\t}},\n\t\t\t},\n\t\t},\n\t}\n\n\td.permitPool.Acquire()\n\tdefer d.permitPool.Release()\n\n\terr := d.client.QueryPages(queryInput, func(out *dynamodb.QueryOutput, lastPage bool) bool {\n\t\tvar record DynamoDBRecord\n\t\tfor _, item := range out.Items {\n\t\t\tdynamodbattribute.UnmarshalMap(item, &record)\n\t\t\tif !strings.HasPrefix(record.Key, DynamoDBLockPrefix) {\n\t\t\t\tkeys = append(keys, record.Key)\n\t\t\t}\n\t\t}\n\t\treturn !lastPage\n\t})\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn keys, nil\n}", "title": "" }, { "docid": "1f15f38659329608e82ffc60e32d2894", "score": "0.5217994", "text": "func (r *Runtime) LockConflicts() (map[uint32][]string, []uint32, error) {\n\t// Make an internal map to store what lock is associated with what\n\tlocksInUse := make(map[uint32][]string)\n\n\tctrs, err := r.state.AllContainers(false)\n\tif err != nil {\n\t\treturn nil, nil, err\n\t}\n\tfor _, ctr := range ctrs {\n\t\tlockNum := ctr.lock.ID()\n\t\tctrString := fmt.Sprintf(\"container %s\", ctr.ID())\n\t\tlocksInUse[lockNum] = append(locksInUse[lockNum], ctrString)\n\t}\n\n\tpods, err := r.state.AllPods()\n\tif err != nil {\n\t\treturn nil, nil, err\n\t}\n\tfor _, pod := range pods {\n\t\tlockNum := pod.lock.ID()\n\t\tpodString := fmt.Sprintf(\"pod %s\", pod.ID())\n\t\tlocksInUse[lockNum] = append(locksInUse[lockNum], podString)\n\t}\n\n\tvolumes, err := r.state.AllVolumes()\n\tif err != nil {\n\t\treturn nil, nil, err\n\t}\n\tfor _, vol := range volumes {\n\t\tlockNum := vol.lock.ID()\n\t\tvolString := fmt.Sprintf(\"volume %s\", vol.Name())\n\t\tlocksInUse[lockNum] = append(locksInUse[lockNum], volString)\n\t}\n\n\t// Now go through and find any entries with >1 item associated\n\ttoReturn := make(map[uint32][]string)\n\tfor lockNum, objects := range locksInUse {\n\t\t// If debug logging is requested, just spit out *every* lock in\n\t\t// use.\n\t\tlogrus.Debugf(\"Lock number %d is in use by %v\", lockNum, objects)\n\n\t\tif len(objects) > 1 {\n\t\t\ttoReturn[lockNum] = objects\n\t\t}\n\t}\n\n\tlocksHeld, err := r.lockManager.LocksHeld()\n\tif err != nil {\n\t\tif errors.Is(err, define.ErrNotImplemented) {\n\t\t\tlogrus.Warnf(\"Could not retrieve currently taken locks as the lock backend does not support this operation\")\n\t\t\treturn toReturn, []uint32{}, nil\n\t\t}\n\n\t\treturn nil, nil, err\n\t}\n\n\treturn toReturn, locksHeld, nil\n}", "title": "" }, { "docid": "fb6877d3c7a2d99b36e4dd2366c3dfb1", "score": "0.5192465", "text": "func (db *DB) MultiLock(ctx context.Context, lockIDs []string, ttl time.Duration) (UnlockFn, error) {\n\tlogger := logging.FromContext(ctx).Named(\"database.MultiLock\")\n\n\tif len(lockIDs) == 0 {\n\t\treturn nil, fmt.Errorf(\"no lockIDs\")\n\t}\n\n\tlockOrder := make([]string, len(lockIDs))\n\t// Make a copy of the slice so that we have a stable slice in the unlcok function.\n\tcopy(lockOrder, lockIDs)\n\tsort.Strings(lockOrder)\n\n\tvar expires time.Time\n\tif err := db.InTx(ctx, pgx.ReadCommitted, func(tx pgx.Tx) error {\n\t\tfor _, lockID := range lockOrder {\n\t\t\trow := tx.QueryRow(ctx, `SELECT AcquireLock($1, $2)`, lockID, int32(ttl.Seconds()))\n\t\t\tif err := row.Scan(&expires); err != nil {\n\t\t\t\treturn fmt.Errorf(\"failed to scan multilock.expires: %w\", err)\n\t\t\t}\n\t\t\tif expires.Before(thePast) {\n\t\t\t\treturn ErrAlreadyLocked\n\t\t\t}\n\t\t}\n\t\treturn nil\n\t}); err != nil {\n\t\treturn nil, err\n\t}\n\n\tlogger.Debugw(\"acquired locks\", \"locks\", lockOrder)\n\treturn makeMultiUnlockFn(ctx, db, lockOrder, expires), nil\n}", "title": "" }, { "docid": "e6b382b8cb13c9ea26478c3ea4e707b9", "score": "0.51849633", "text": "func (c *Locker) generateLocks(pctx context.Context) error {\n\tlog.Info(\"genLock started\")\n\n\tconst maxTxnSize = 1000\n\n\t// How many keys should be in the next transaction.\n\tnextTxnSize := rand.Intn(maxTxnSize) + 1 // 0 is not allowed.\n\n\t// How many keys has been scanned since last time sending request.\n\tscannedKeys := 0\n\tvar batch []int64\n\n\tctx, cancel := context.WithCancel(context.Background())\n\tdefer cancel()\n\tfor rowID := int64(0); ; rowID = (rowID + 1) % c.tableSize {\n\t\tselect {\n\t\tcase <-pctx.Done():\n\t\t\tlog.Info(\"genLock done\")\n\t\t\treturn nil\n\t\tdefault:\n\t\t}\n\n\t\tscannedKeys++\n\n\t\t// Randomly decide whether to lock current key.\n\t\tlockThis := rand.Intn(2) == 0\n\n\t\tif lockThis {\n\t\t\tbatch = append(batch, rowID)\n\n\t\t\tif len(batch) >= nextTxnSize {\n\t\t\t\t// The batch is large enough to start the transaction\n\t\t\t\terr := c.lockKeys(ctx, batch)\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn errors.Annotate(err, \"lock keys failed\")\n\t\t\t\t}\n\n\t\t\t\t// Start the next loop\n\t\t\t\tbatch = batch[:0]\n\t\t\t\tscannedKeys = 0\n\t\t\t\tnextTxnSize = rand.Intn(maxTxnSize) + 1\n\t\t\t}\n\t\t}\n\t}\n}", "title": "" }, { "docid": "06e80b8837d7d3f5136a9745c9cfde61", "score": "0.5167724", "text": "func (db *RedisDB) GetLockKey(key string) string {\n\treturn \"LOCK_KEY::\" + key\n}", "title": "" }, { "docid": "ec063a7222ac847c348955357d1d1393", "score": "0.51577735", "text": "func getLockPath(path string) string {\n\treturn path + \".lock\"\n}", "title": "" }, { "docid": "ec063a7222ac847c348955357d1d1393", "score": "0.51577735", "text": "func getLockPath(path string) string {\n\treturn path + \".lock\"\n}", "title": "" }, { "docid": "c49f14310d35f17450efc78a6fb4b94f", "score": "0.5141363", "text": "func (k Keeper) getAccountsLockedTo(ctx sdk.Context, poolName string) (lockerAddrList types.AccAddrList) {\n\tstore := ctx.KVStore(k.storeKey)\n\titerator := sdk.KVStorePrefixIterator(store, append(types.Pool2AddressPrefix, []byte(poolName)...))\n\tdefer iterator.Close()\n\n\tsplitIndex := 1 + len(poolName)\n\tfor ; iterator.Valid(); iterator.Next() {\n\t\tlockerAddrList = append(lockerAddrList, iterator.Key()[splitIndex:])\n\t}\n\n\treturn\n}", "title": "" }, { "docid": "ffbf763bb54bc06f38e990e35d0647f3", "score": "0.5137093", "text": "func getLockTimeBucketKey(lockValue types.LockValue) string {\n\treturn lockedByTimestampOutputsKeyPrefix + (lockValue - lockValue%7200).String()\n}", "title": "" }, { "docid": "320564ccdb60997e5e2ae39e7ca97c04", "score": "0.5105511", "text": "func (s deploymentLockNamespaceLister) List(selector labels.Selector) (ret []*lock.DeploymentLock, err error) {\n\terr = cache.ListAllByNamespace(s.indexer, s.namespace, selector, func(m interface{}) {\n\t\tret = append(ret, m.(*lock.DeploymentLock))\n\t})\n\treturn ret, err\n}", "title": "" }, { "docid": "f58e1810c81c8b578b4f2d9f34e8408a", "score": "0.5079352", "text": "func (ca *clusterApi) cleanLock(c *gin.Context) {\n\tctx, _ := c.Get(Ctx)\n\n\tremoved := make([]string, 0, 1)\n\n\tif keys, _, err := ca.service.PrefixScan(ctx.(context.Context), entity.PrefixLock); err != nil {\n\t\tginutil.NewAutoMehtodName(c, ca.monitor).Send(&mspb.GetDBsResponse{Header: entity.Err(err)})\n\t\treturn\n\t} else {\n\t\tfor _, key := range keys {\n\t\t\tif err := ca.service.Delete(ctx.(context.Context), string(key)); err != nil {\n\t\t\t\tginutil.NewAutoMehtodName(c, ca.monitor).Send(&mspb.GetDBsResponse{Header: entity.Err(err)})\n\t\t\t\treturn\n\t\t\t}\n\t\t\tremoved = append(removed, string(key))\n\t\t}\n\t}\n\n\tresult := &struct {\n\t\tHeader *mspb.ResponseHeader `json:\"header\"`\n\t\tRemoved []string `json:\"removed\"`\n\t}{\n\t\tHeader: entity.OK(),\n\t\tRemoved: removed,\n\t}\n\n\tginutil.NewAutoMehtodName(c, ca.monitor).SendJson(result)\n}", "title": "" }, { "docid": "5f1e4cbf50332a16ab3d4d67261446b9", "score": "0.5060354", "text": "func (s *deploymentLockLister) List(selector labels.Selector) (ret []*lock.DeploymentLock, err error) {\n\terr = cache.ListAll(s.indexer, selector, func(m interface{}) {\n\t\tret = append(ret, m.(*lock.DeploymentLock))\n\t})\n\treturn ret, err\n}", "title": "" }, { "docid": "7ffab8582bc6bb83a21a79e32fed87c1", "score": "0.5043579", "text": "func tokenBucketKeys(prefix string) []string {\n\t// Redis Cluster uses a hashing algorithm on keys to determine which slot\n\t// they map to in its backend. Normally this is a problem for EVAL/EVALSHA\n\t// because multiple keys in a script will likely map to different slots\n\t// and cause Redis Cluster to reject the request.\n\t//\n\t// It's addressed with the idea of a \"hash tag\":\n\t//\n\t// https://redis.io/topics/cluster-tutorial#redis-cluster-data-sharding\n\t//\n\t// If a key name contains a string inside of \"{}\" then _just_ that string\n\t// is hashed to be used slotting purposes, thereby giving users some\n\t// control over mapping consistently to certain slots. For example,\n\t// `this{foo}key` and `another{foo}key` are guaranteed to both map to the\n\t// same slot.\n\t//\n\t// We take advantage of this idea here by making sure to hash only the\n\t// common identifier in these keys by using \"{}\".\n\treturn []string{\n\t\tfmt.Sprintf(\"{%s}.tokens\", prefix),\n\t\tfmt.Sprintf(\"{%s}.refreshed\", prefix),\n\t\tfmt.Sprintf(\"{%s}.refreshed_us\", prefix),\n\t}\n}", "title": "" }, { "docid": "03977a3dc724ee1e973a5bc62b9c2c40", "score": "0.5032813", "text": "func getAllowedLeaderElectionResourceLocks() []string {\n\treturn []string{\n\t\t\"endpoints\",\n\t\t\"configmaps\",\n\t\t\"leases\",\n\t\t\"endpointsleases\",\n\t\t\"configmapsleases\",\n\t}\n}", "title": "" }, { "docid": "ae52589ead53415b38428fe58931b782", "score": "0.5031571", "text": "func KeyPeriodicLock(namespace string) string {\n\treturn fmt.Sprintf(\"%s:%s\", KeyPeriod(namespace), \"lock\")\n}", "title": "" }, { "docid": "770685c35686e39da82ce7fcc6096803", "score": "0.50026226", "text": "func (s *Semaphore) findLock(pairs KVPairs) *KVPair {\n\tkey := path.Join(s.opts.Prefix, DefaultSemaphoreKey)\n\tfor _, pair := range pairs {\n\t\tif pair.Key == key {\n\t\t\treturn pair\n\t\t}\n\t}\n\treturn &KVPair{Flags: SemaphoreFlagValue}\n}", "title": "" }, { "docid": "00f8fffba0bb78a4013274b2817cf4ac", "score": "0.49413997", "text": "func (m *packetEndpointListRWMutex) Lock() {\n\tlocking.AddGLock(packetEndpointListprefixIndex, -1)\n\tm.mu.Lock()\n}", "title": "" }, { "docid": "293ee9ce590c1d1b5c719d0675c8e08c", "score": "0.49004203", "text": "func lockQueue(r string) string {\n\treturn r + \".lock\"\n}", "title": "" }, { "docid": "59030a7a836657d5127345995e7928e0", "score": "0.48904493", "text": "func loadSnapshotTreeIDs(repo *repository.Repository) (backend.IDs, []error) {\n\tvar trees struct {\n\t\tIDs backend.IDs\n\t\tsync.Mutex\n\t}\n\n\tvar errs struct {\n\t\terrs []error\n\t\tsync.Mutex\n\t}\n\n\tsnapshotWorker := func(strID string, done <-chan struct{}) error {\n\t\tid, err := backend.ParseID(strID)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\tdebug.Log(\"Checker.Snaphots\", \"load snapshot %v\", id.Str())\n\n\t\ttreeID, err := loadTreeFromSnapshot(repo, id)\n\t\tif err != nil {\n\t\t\terrs.Lock()\n\t\t\terrs.errs = append(errs.errs, err)\n\t\t\terrs.Unlock()\n\t\t\treturn nil\n\t\t}\n\n\t\tdebug.Log(\"Checker.Snaphots\", \"snapshot %v has tree %v\", id.Str(), treeID.Str())\n\t\ttrees.Lock()\n\t\ttrees.IDs = append(trees.IDs, treeID)\n\t\ttrees.Unlock()\n\n\t\treturn nil\n\t}\n\n\terr := repository.FilesInParallel(repo.Backend(), backend.Snapshot, defaultParallelism, snapshotWorker)\n\tif err != nil {\n\t\terrs.errs = append(errs.errs, err)\n\t}\n\n\treturn trees.IDs, errs.errs\n}", "title": "" }, { "docid": "0e66944f817df07c2fa821202f0149e2", "score": "0.48762235", "text": "func (oc *Controller) getNamespaceLock(ns string) *sync.Mutex {\n\t// lock the list of namespaces, get the mutex\n\toc.namespaceMutexMutex.Lock()\n\tmutex, ok := oc.namespaceMutex[ns]\n\toc.namespaceMutexMutex.Unlock()\n\tif !ok {\n\t\treturn nil\n\t}\n\n\t// lock the individual namespace\n\tmutex.Lock()\n\n\t// check that the namespace wasn't deleted between getting the two locks\n\tif _, ok := oc.namespaceMutex[ns]; !ok {\n\t\tmutex.Unlock()\n\t\treturn nil\n\t}\n\n\treturn mutex\n}", "title": "" }, { "docid": "505082d1e9876117b8f6f66612128935", "score": "0.48661453", "text": "func (txn *RoTxn) GetLock(key []byte) (*Lock, error) {\n\tbytes, err := txn.Reader.GetCF(engine_util.CfLock, key)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tif bytes == nil {\n\t\treturn nil, nil\n\t}\n\n\tlock, err := ParseLock(bytes)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn lock, nil\n}", "title": "" }, { "docid": "c47c8d1dcd981919f44efc6b2359f74f", "score": "0.4863756", "text": "func (mvcc *MVCCLevelDB) BatchResolveLock(startKey, endKey []byte, txnInfos map[uint64]uint64) error {\n\tmvcc.mu.Lock()\n\tdefer mvcc.mu.Unlock()\n\n\titer, currKey, err := newScanIterator(mvcc.getDB(\"\"), startKey, endKey)\n\tdefer iter.Release()\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tbatch := &leveldb.Batch{}\n\tfor iter.Valid() {\n\t\tdec := lockDecoder{expectKey: currKey}\n\t\tok, err := dec.Decode(iter)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tif ok {\n\t\t\tif commitTS, ok := txnInfos[dec.lock.startTS]; ok {\n\t\t\t\tif commitTS > 0 {\n\t\t\t\t\terr = commitLock(batch, dec.lock, currKey, dec.lock.startTS, commitTS)\n\t\t\t\t} else {\n\t\t\t\t\terr = rollbackLock(batch, currKey, dec.lock.startTS)\n\t\t\t\t}\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\tskip := skipDecoder{currKey: currKey}\n\t\t_, err = skip.Decode(iter)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tcurrKey = skip.currKey\n\t}\n\treturn mvcc.getDB(\"\").Write(batch, nil)\n}", "title": "" }, { "docid": "cea2f09d73480d98170770fb5f4e2d43", "score": "0.4861129", "text": "func (b *Bucket) GetAndLock(key string, lockTime uint32, valuePtr interface{}) (Cas, error) {\n\treturn b.hlpGetExec(valuePtr, func(cb ioGetCallback) (pendingOp, error) {\n\t\top, err := b.client.GetAndLock([]byte(key), lockTime, gocbcore.GetCallback(cb))\n\t\treturn op, err\n\t})\n}", "title": "" }, { "docid": "9417951b5ce17bc23e263ace37866bfd", "score": "0.48608398", "text": "func (cfg *Config) lockKey(op, domainName string) string {\n\treturn fmt.Sprintf(\"%s_%s\", op, domainName)\n}", "title": "" }, { "docid": "5e1a465b76d8675a6cf0c76812e3fcaa", "score": "0.4855115", "text": "func (b BoltLocker) List() ([]models.ProjectLock, error) {\n\tvar locks []models.ProjectLock\n\tvar locksBytes [][]byte\n\terr := b.db.View(func(tx *bolt.Tx) error {\n\t\tbucket := tx.Bucket(b.bucket)\n\t\tc := bucket.Cursor()\n\t\tfor k, v := c.First(); k != nil; k, v = c.Next() {\n\t\t\tlocksBytes = append(locksBytes, v)\n\t\t}\n\t\treturn nil\n\t})\n\tif err != nil {\n\t\treturn locks, errors.Wrap(err, \"DB transaction failed\")\n\t}\n\n\t// deserialize bytes into the proper objects\n\tfor k, v := range locksBytes {\n\t\tvar lock models.ProjectLock\n\t\tif err := json.Unmarshal(v, &lock); err != nil {\n\t\t\treturn locks, errors.Wrap(err, fmt.Sprintf(\"failed to deserialize lock at key %q\", string(k)))\n\t\t}\n\t\tlocks = append(locks, lock)\n\t}\n\n\treturn locks, nil\n}", "title": "" }, { "docid": "39da363c7aa9c315e38742c4cf36b271", "score": "0.48459223", "text": "func packetEndpointListinitLockNames() {}", "title": "" }, { "docid": "6015db86541834ae56e7f79b40d73b04", "score": "0.47983393", "text": "func (c *Cache) GetLocks(ctx context.Context, inForceOnly bool, targets ...types.LockTarget) ([]types.Lock, error) {\n\tctx, span := c.Tracer.Start(ctx, \"cache/GetLocks\")\n\tdefer span.End()\n\n\trg, err := readCollectionCache(c, c.collections.locks)\n\tif err != nil {\n\t\treturn nil, trace.Wrap(err)\n\t}\n\tdefer rg.Release()\n\treturn rg.reader.GetLocks(ctx, inForceOnly, targets...)\n}", "title": "" }, { "docid": "ac71568bb63589ca6647374be6dc0901", "score": "0.47949675", "text": "func (p *BinlogAdapter) getShardingListByPrimaryInt64(primaryKeys []int64,\n\ttimestampList []int64,\n\tmemoryData []ShardData,\n\tintDeletedList map[int64]uint64) ([]int32, error) {\n\tif len(timestampList) != len(primaryKeys) {\n\t\tlog.Warn(\"Binlog adapter: primary key length is not equal to timestamp list length\",\n\t\t\tzap.Int(\"primaryKeysLen\", len(primaryKeys)), zap.Int(\"timestampLen\", len(timestampList)))\n\t\treturn nil, fmt.Errorf(\"primary key length %d is not equal to timestamp list length %d\", len(primaryKeys), len(timestampList))\n\t}\n\n\tlog.Info(\"Binlog adapter: building shard list\", zap.Int(\"pkLen\", len(primaryKeys)), zap.Int(\"tsLen\", len(timestampList)))\n\n\tactualDeleted := 0\n\texcluded := 0\n\tshardList := make([]int32, 0, len(primaryKeys))\n\tprimaryKey := p.collectionInfo.PrimaryKey\n\tfor i, key := range primaryKeys {\n\t\t// if this entity's timestamp is greater than the tsEndPoint, or less than tsStartPoint, set shardID = -1 to skip this entity\n\t\t// timestamp is stored as int64 type in log file, actually it is uint64, compare with uint64\n\t\tts := timestampList[i]\n\t\tif uint64(ts) > p.tsEndPoint || uint64(ts) < p.tsStartPoint {\n\t\t\tshardList = append(shardList, -1)\n\t\t\texcluded++\n\t\t\tcontinue\n\t\t}\n\n\t\t_, deleted := intDeletedList[key]\n\t\t// if the key exists in intDeletedList, that means this entity has been deleted\n\t\tif deleted {\n\t\t\tshardList = append(shardList, -1) // this entity has been deleted, set shardID = -1 and skip this entity\n\t\t\tactualDeleted++\n\t\t} else {\n\t\t\thash, _ := typeutil.Hash32Int64(key)\n\t\t\tshardID := hash % uint32(p.collectionInfo.ShardNum)\n\t\t\tpartitions := memoryData[shardID] // initBlockData() can ensure the existence, no need to check bound here\n\t\t\tfields := partitions[p.collectionInfo.PartitionIDs[0]] // NewBinlogAdapter() can ensure only one partition\n\t\t\tfield := fields[primaryKey.GetFieldID()] // initBlockData() can ensure the existence, no need to check here\n\n\t\t\t// append the entity to primary key's FieldData\n\t\t\tfield.(*storage.Int64FieldData).Data = append(field.(*storage.Int64FieldData).Data, key)\n\n\t\t\tshardList = append(shardList, int32(shardID))\n\t\t}\n\t}\n\tlog.Info(\"Binlog adapter: succeed to calculate a shard list\", zap.Int(\"actualDeleted\", actualDeleted),\n\t\tzap.Int(\"excluded\", excluded), zap.Int(\"len\", len(shardList)))\n\n\treturn shardList, nil\n}", "title": "" }, { "docid": "2b5b345fe160cd3a762e747438be1dec", "score": "0.47770357", "text": "func (m *packetEndpointListRWMutex) NestedLock(i packetEndpointListlockNameIndex) {\n\tlocking.AddGLock(packetEndpointListprefixIndex, int(i))\n\tm.mu.Lock()\n}", "title": "" }, { "docid": "1bae222f28a1704e86c3d1c69135ed20", "score": "0.47626975", "text": "func (client *GCPClient) Locks() ([]byte, error) {\n\tdirectorPublicIP, err := client.outputs.Get(\"DirectorPublicIP\")\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn client.boshCLI.Locks(boshcli.GCPEnvironment{\n\t\tExternalIP: directorPublicIP,\n\t}, directorPublicIP, client.config.GetDirectorPassword(), client.config.GetDirectorCACert())\n\n}", "title": "" }, { "docid": "a6d2eaf5112b6a8cbf6ac9a06a75ee7d", "score": "0.4759207", "text": "func (status Status) JobIds() ([]string, error) {\n\tconn := redisPool.Get()\n\tdefer conn.Close()\n\treturn redis.Strings(conn.Do(\"ZREVRANGE\", status.Key(), 0, -1))\n}", "title": "" }, { "docid": "3d622057058e5f624adaa8eb16051658", "score": "0.47343913", "text": "func (fs *Decomposedfs) GetLock(ctx context.Context, ref *provider.Reference) (*provider.Lock, error) {\n\tctx, span := tracer.Start(ctx, \"GetLock\")\n\tdefer span.End()\n\tnode, err := fs.lu.NodeFromResource(ctx, ref)\n\tif err != nil {\n\t\treturn nil, errors.Wrap(err, \"Decomposedfs: error resolving ref\")\n\t}\n\n\tif !node.Exists {\n\t\terr = errtypes.NotFound(filepath.Join(node.ParentID, node.Name))\n\t\treturn nil, err\n\t}\n\n\trp, err := fs.p.AssemblePermissions(ctx, node)\n\tswitch {\n\tcase err != nil:\n\t\treturn nil, err\n\tcase !rp.InitiateFileDownload:\n\t\tf, _ := storagespace.FormatReference(ref)\n\t\tif rp.Stat {\n\t\t\treturn nil, errtypes.PermissionDenied(f)\n\t\t}\n\t\treturn nil, errtypes.NotFound(f)\n\t}\n\n\treturn node.ReadLock(ctx, false)\n}", "title": "" }, { "docid": "f3403f86831349aa53fb74bf30a6bc1d", "score": "0.4732072", "text": "func (rt *RadixTree) KeysWithPrefix(s string) <-chan string {\n\n\tprefixNode, path := rt.root.getNodeForPrefix(s, make([]string, 0))\n\tif prefixNode != nil {\n\t\treturn prefixNode.keys(path)\n\t}\n\tch := make(chan string)\n\tclose(ch)\n\treturn ch\n}", "title": "" }, { "docid": "289dadba6c9a11b0f8e3d03af6d974d1", "score": "0.47206306", "text": "func GetLock(obj Object) (Lock, error) {\n\t// Validate metadata.\n\tmeta, err := getValidMeta(obj)\n\tif err != nil {\n\t\treturn Lock(0), err\n\t}\n\n\tkey := meta.Key()\n\n\t// Get and lock in couchbase.\n\tvar cas gocb.Cas\n\tcas, err = Buckets[meta.Bucket].couch.GetAndLock(key, LOCK_INTERVAL, obj)\n\tif err != nil {\n\t\tlog.Errorf(\"%s GraphGetLock() error: key %s: %v\", Buckets[meta.Bucket].name, key, err)\n\t\treturn Lock(cas), util.ErrNotFound\n\t}\n\n\treturn Lock(cas), err\n}", "title": "" }, { "docid": "78cc8fed244a9f40357d82ecbc1bbc08", "score": "0.47021338", "text": "func getLogKeys(bucket string, op getLogsOperation) ([]string, error) {\n\tlog.Printf(\"INFO: using time range: %s - %s\", op.beginTime.Format(time.RFC3339), op.endTime.Format(time.RFC3339))\n\tstate := state{ op: &op }\n\tscanTime := op.beginTime.Add(-LogLookbackTimeInHours * time.Hour)\n\tscanDir := op.token\n\tstartDay := scanTime.Format(\"/2006/01/02/\")\n\tstartFile := scanTime.Format(\"Fuze-2006-01-02-15-04-05\")\n\tstartAfter := scanDir + startDay + startFile\n\terr := awsList(bucket, scanDir, startAfter, \n\t\tfunc (key string) bool {\n\t\t\treturn handleKey(key, &state)\n\t\t})\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn state.gathered, nil\n}", "title": "" }, { "docid": "efbe2280ac0c75f18d1f61ac9226b00a", "score": "0.4699707", "text": "func (c *imageCache) getIDToRefs(id string) []string {\n\tc.Lock()\n\tdefer c.Unlock()\n\n\trefs := []string{}\n\tid = strings.TrimPrefix(id, \"sha256:\")\n\tfor tag, v := range c.idToTags[id] {\n\t\tif v {\n\t\t\trefs = append(refs, tag)\n\t\t}\n\t}\n\tfor digest, v := range c.idToDigests[id] {\n\t\tif v {\n\t\t\trefs = append(refs, digest)\n\t\t}\n\t}\n\n\treturn refs\n}", "title": "" }, { "docid": "bfc763cbf872020e72b76261b7fef791", "score": "0.46978253", "text": "func GetLockedPatches(patches map[string]utilsapi.PatchSpec, config *rest.Config, logger logr.Logger) ([]LockedPatch, error) {\n\tlockedPatches := []LockedPatch{}\n\tfor key, patch := range patches {\n\t\ttemplate, err := template.New(patch.PatchTemplate).Funcs(utilstemplate.AdvancedTemplateFuncMap(config, logger)).Parse(patch.PatchTemplate)\n\t\tif err != nil {\n\t\t\tlog.Error(err, \"unable to parse \", \"template\", patch.PatchTemplate)\n\t\t\treturn []LockedPatch{}, err\n\t\t}\n\t\tlockedPatches = append(lockedPatches, LockedPatch{\n\t\t\tSourceObjectRefs: patch.SourceObjectRefs,\n\t\t\tPatchTemplate: patch.PatchTemplate,\n\t\t\tPatchType: patch.PatchType,\n\t\t\tTargetObjectRef: patch.TargetObjectRef,\n\t\t\tTemplate: *template,\n\t\t\tName: key,\n\t\t})\n\t}\n\treturn lockedPatches, nil\n}", "title": "" }, { "docid": "c32802c1fdb53557b0f2dcc35e70a4d9", "score": "0.46947402", "text": "func (store *DBStore) GetClockedInJobByJobUUID(uuid string) ([]*JobClockInInfo, error) {\n\trows, err := store.DB.Query(`SELECT users_clocked_in.job_uuid, users_to_job.user_current_job_hours, jobs.actual_total_hours, \n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tjobs.estimated_total_hours, jobs.title, jobs.project_title \n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tFROM jobs\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tJOIN users_to_job ON users_to_job.job_uuid = jobs.uuid\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tJOIN users_clocked_in ON users_clocked_in.job_uuid = jobs.uuid\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tWHERE users_clocked_in.job_uuid = $1`, uuid)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tclockedInJobInfo, err := formatClockInJobQuery_Helper(rows)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn clockedInJobInfo, nil\n}", "title": "" }, { "docid": "3ea34d379ae0ab6ead348d6474e55d4e", "score": "0.4693528", "text": "func (k Keeper) GetLegacyPeriodLocks(ctx sdk.Context) ([]types.PeriodLock, error) {\n\tmaxID := int(k.GetLastLockID(ctx) + 1)\n\n\tlocks := make([]types.PeriodLock, 0, maxID)\n\tstore := ctx.KVStore(k.storeKey)\n\tfor lockID := 0; lockID < maxID; lockID++ {\n\t\tif lockID%10000 == 0 {\n\t\t\tctx.Logger().Info(fmt.Sprintf(\"Fetched %d locks\", lockID))\n\t\t}\n\t\t// Copy in GetLockByID logic, with optimizations for hotloop\n\t\tlockKey := lockStoreKey(uint64(lockID))\n\t\tif !store.Has(lockKey) {\n\t\t\tcontinue\n\t\t}\n\t\tlock := types.PeriodLock{}\n\t\tbz := store.Get(lockKey)\n\t\terr := proto.Unmarshal(bz, &lock)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tlocks = append(locks, lock)\n\t}\n\treturn locks, nil\n}", "title": "" }, { "docid": "73ab4793034f600597da8b972ba07a0a", "score": "0.46894053", "text": "func (store *DBStore) GetClockedInJobByUserUUID(uuid string) ([]*JobClockInInfo, error) {\n\trows, err := store.DB.Query(`SELECT users_clocked_in.job_uuid, users_to_job.user_current_job_hours, jobs.actual_total_hours, \n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tjobs.estimated_total_hours, jobs.title, jobs.project_title \n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tFROM jobs\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tJOIN users_to_job ON users_to_job.job_uuid = jobs.uuid\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tJOIN users_clocked_in ON users_clocked_in.job_uuid = jobs.uuid\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tWHERE users_clocked_in.user_uuid = $1`, uuid)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tclockedInJobInfo, err := formatClockInJobQuery_Helper(rows)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn clockedInJobInfo, nil\n\n}", "title": "" }, { "docid": "8127f1bad54445b190929cbdb36eceb7", "score": "0.46883416", "text": "func (mvcc *MVCCLevelDB) ResolveLock(startKey, endKey []byte, startTS, commitTS uint64) error {\n\tmvcc.mu.Lock()\n\tdefer mvcc.mu.Unlock()\n\n\titer, currKey, err := newScanIterator(mvcc.getDB(\"\"), startKey, endKey)\n\tdefer iter.Release()\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tbatch := &leveldb.Batch{}\n\tfor iter.Valid() {\n\t\tdec := lockDecoder{expectKey: currKey}\n\t\tok, err := dec.Decode(iter)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tif ok && dec.lock.startTS == startTS {\n\t\t\tif commitTS > 0 {\n\t\t\t\terr = commitLock(batch, dec.lock, currKey, startTS, commitTS)\n\t\t\t} else {\n\t\t\t\terr = rollbackLock(batch, currKey, startTS)\n\t\t\t}\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t\tskip := skipDecoder{currKey: currKey}\n\t\t_, err = skip.Decode(iter)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tcurrKey = skip.currKey\n\t}\n\treturn mvcc.getDB(\"\").Write(batch, nil)\n}", "title": "" }, { "docid": "867fb0889947a411e66ef2479e462a4a", "score": "0.46803477", "text": "func (l *DynamoDBLock) watch(lost chan struct{}) {\n\tretries := DynamoDBWatchRetryMax\n\n\tticker := time.NewTicker(l.watchRetryInterval)\nWatchLoop:\n\tfor {\n\t\tselect {\n\t\tcase <-ticker.C:\n\t\t\tresp, err := l.backend.client.GetItem(&dynamodb.GetItemInput{\n\t\t\t\tTableName: aws.String(l.backend.table),\n\t\t\t\tConsistentRead: aws.Bool(true),\n\t\t\t\tKey: map[string]*dynamodb.AttributeValue{\n\t\t\t\t\t\"Path\": {S: aws.String(recordPathForVaultKey(l.key))},\n\t\t\t\t\t\"Key\": {S: aws.String(recordKeyForVaultKey(l.key))},\n\t\t\t\t},\n\t\t\t})\n\t\t\tif err != nil {\n\t\t\t\tretries--\n\t\t\t\tif retries == 0 {\n\t\t\t\t\tbreak WatchLoop\n\t\t\t\t}\n\t\t\t\tcontinue\n\t\t\t}\n\n\t\t\tif resp == nil {\n\t\t\t\tbreak WatchLoop\n\t\t\t}\n\t\t\trecord := &DynamoDBLockRecord{}\n\t\t\terr = dynamodbattribute.UnmarshalMap(resp.Item, record)\n\t\t\tif err != nil || string(record.Identity) != l.identity {\n\t\t\t\tbreak WatchLoop\n\t\t\t}\n\t\t}\n\t}\n\n\tclose(lost)\n}", "title": "" }, { "docid": "a1e800b35a4504feacb1b807f5d8d3a5", "score": "0.4675814", "text": "func (b *backend) secretIDAccessorLock(secretIDAccessor string) *sync.RWMutex {\n\tvar lock *sync.RWMutex\n\tvar ok bool\n\tif len(secretIDAccessor) >= 2 {\n\t\tlock, ok = b.secretIDAccessorLocksMap[secretIDAccessor[0:2]]\n\t}\n\tif !ok || lock == nil {\n\t\t// Fall back for custom lock to make sure that this method\n\t\t// never returns nil\n\t\tlock = b.secretIDAccessorLocksMap[\"custom\"]\n\t}\n\treturn lock\n}", "title": "" }, { "docid": "4aad0e8258621029c09c2d43ef6c1d4b", "score": "0.46664178", "text": "func openLock(deadends []string, target string) int {\n \n}", "title": "" }, { "docid": "429b8530576dcbee6dcf4e5ffc7d3629", "score": "0.46617818", "text": "func (s *svc) GetLock(ctx context.Context, req *provider.GetLockRequest) (*provider.GetLockResponse, error) {\n\tc, err := s.find(ctx, req.Ref)\n\tif err != nil {\n\t\treturn &provider.GetLockResponse{\n\t\t\tStatus: status.NewStatusFromErrType(ctx, \"GetLock ref=\"+req.Ref.String(), err),\n\t\t}, nil\n\t}\n\n\tres, err := c.GetLock(ctx, req)\n\tif err != nil {\n\t\tif gstatus.Code(err) == codes.PermissionDenied {\n\t\t\treturn &provider.GetLockResponse{Status: &rpc.Status{Code: rpc.Code_CODE_PERMISSION_DENIED}}, nil\n\t\t}\n\t\treturn nil, errors.Wrap(err, \"gateway: error calling GetLock\")\n\t}\n\n\treturn res, nil\n}", "title": "" }, { "docid": "7004015d720e9e5f271db863019aba18", "score": "0.46557397", "text": "func TransactionKey(txId string) []string {\n\treturn []string{txId}\n}", "title": "" }, { "docid": "fa706659823ce688e3ce75c62b2d71ec", "score": "0.4652746", "text": "func (pdb *db) ReadLockExecutions(\n\tctx context.Context,\n\tfilter sqlplugin.ExecutionsFilter,\n) (int64, int64, error) {\n\tvar executionVersion sqlplugin.ExecutionVersion\n\terr := pdb.conn.GetContext(ctx,\n\t\t&executionVersion,\n\t\treadLockExecutionQuery,\n\t\tfilter.ShardID,\n\t\tfilter.NamespaceID,\n\t\tfilter.WorkflowID,\n\t\tfilter.RunID,\n\t)\n\treturn executionVersion.DBRecordVersion, executionVersion.NextEventID, err\n}", "title": "" }, { "docid": "89faad0c17baf55987a6e85dc3db9ed2", "score": "0.46480596", "text": "func (fd *LockFD) Locks() *FileLocks {\n\treturn fd.locks\n}", "title": "" }, { "docid": "383a28631127604101ec14f5b449758a", "score": "0.46468577", "text": "func SnapshotCacheKeys(proxies v1.ProxyList) []string {\n\tvar keys []string\n\t// Get keys from proxies\n\tfor _, proxy := range proxies {\n\t\t// This is where we correlate Node ID with proxy namespace~name\n\t\tkeys = append(keys, SnapshotCacheKey(proxy))\n\t}\n\treturn keys\n}", "title": "" }, { "docid": "c6e0fac16a552ec55663f536892cbe02", "score": "0.46373373", "text": "func (_TKTimeLock *TKTimeLockCaller) TokenLock(opts *bind.CallOpts) (common.Address, error) {\n\tvar out []interface{}\n\terr := _TKTimeLock.contract.Call(opts, &out, \"tokenLock\")\n\n\tif err != nil {\n\t\treturn *new(common.Address), err\n\t}\n\n\tout0 := *abi.ConvertType(out[0], new(common.Address)).(*common.Address)\n\n\treturn out0, err\n\n}", "title": "" }, { "docid": "a00683287aabdb4317a73632d03e8deb", "score": "0.4631871", "text": "func (self *LockStore) ListLock(uname string, cList *common.List) error {\n\tif cList == nil {\n\t\treturn nil\n\t}\n\tcList.L = self.ds.GetUserLock(uname)\n\n\treturn nil\n}", "title": "" }, { "docid": "c5b6b97a6710249b105c53af36abb5ad", "score": "0.46316984", "text": "func (b *backend) secretIDLock(secretIDHMAC string) *sync.RWMutex {\n\tvar lock *sync.RWMutex\n\tvar ok bool\n\tif len(secretIDHMAC) >= 2 {\n\t\tlock, ok = b.secretIDLocksMap[secretIDHMAC[0:2]]\n\t}\n\tif !ok || lock == nil {\n\t\t// Fall back for custom lock to make sure that this method\n\t\t// never returns nil\n\t\tlock = b.secretIDLocksMap[\"custom\"]\n\t}\n\treturn lock\n}", "title": "" }, { "docid": "19901ce69434adec1f7b68d67af5baf9", "score": "0.46249995", "text": "func (t *Trie) KeysWithPrefix(prefix string) []string {\n\tif t.IsEmpty() {\n\t\treturn nil\n\t}\n\n\tn := t.root\n\tfor _, ch := range prefix {\n\t\tif n.slots[ch] == nil {\n\t\t\t// No key exists with full prefix.\n\t\t\treturn nil\n\t\t}\n\n\t\tn = n.slots[ch]\n\t}\n\n\treturn collectKeys(n, []rune(prefix), nil)\n}", "title": "" }, { "docid": "fe4153b41c8f841ac18c7a3025c16282", "score": "0.46219653", "text": "func (_LockGatewayLogicV1 *LockGatewayLogicV1Filterer) WatchLogLock(opts *bind.WatchOpts, sink chan<- *LockGatewayLogicV1LogLock, _n []*big.Int, _indexedTo [][]byte) (event.Subscription, error) {\n\n\tvar _nRule []interface{}\n\tfor _, _nItem := range _n {\n\t\t_nRule = append(_nRule, _nItem)\n\t}\n\tvar _indexedToRule []interface{}\n\tfor _, _indexedToItem := range _indexedTo {\n\t\t_indexedToRule = append(_indexedToRule, _indexedToItem)\n\t}\n\n\tlogs, sub, err := _LockGatewayLogicV1.contract.WatchLogs(opts, \"LogLock\", _nRule, _indexedToRule)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn event.NewSubscription(func(quit <-chan struct{}) error {\n\t\tdefer sub.Unsubscribe()\n\t\tfor {\n\t\t\tselect {\n\t\t\tcase log := <-logs:\n\t\t\t\t// New log arrived, parse the event and forward to the user\n\t\t\t\tevent := new(LockGatewayLogicV1LogLock)\n\t\t\t\tif err := _LockGatewayLogicV1.contract.UnpackLog(event, \"LogLock\", log); err != nil {\n\t\t\t\t\treturn err\n\t\t\t\t}\n\t\t\t\tevent.Raw = log\n\n\t\t\t\tselect {\n\t\t\t\tcase sink <- event:\n\t\t\t\tcase err := <-sub.Err():\n\t\t\t\t\treturn err\n\t\t\t\tcase <-quit:\n\t\t\t\t\treturn nil\n\t\t\t\t}\n\t\t\tcase err := <-sub.Err():\n\t\t\t\treturn err\n\t\t\tcase <-quit:\n\t\t\t\treturn nil\n\t\t\t}\n\t\t}\n\t}), nil\n}", "title": "" }, { "docid": "a6fa866a837976df98a3112d249ff80b", "score": "0.46153456", "text": "func (_ERC20AtlasManager *ERC20AtlasManagerFilterer) WatchLocked(opts *bind.WatchOpts, sink chan<- *ERC20AtlasManagerLocked, token []common.Address, sender []common.Address) (event.Subscription, error) {\n\n\tvar tokenRule []interface{}\n\tfor _, tokenItem := range token {\n\t\ttokenRule = append(tokenRule, tokenItem)\n\t}\n\tvar senderRule []interface{}\n\tfor _, senderItem := range sender {\n\t\tsenderRule = append(senderRule, senderItem)\n\t}\n\n\tlogs, sub, err := _ERC20AtlasManager.contract.WatchLogs(opts, \"Locked\", tokenRule, senderRule)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn event.NewSubscription(func(quit <-chan struct{}) error {\n\t\tdefer sub.Unsubscribe()\n\t\tfor {\n\t\t\tselect {\n\t\t\tcase log := <-logs:\n\t\t\t\t// New log arrived, parse the event and forward to the user\n\t\t\t\tevent := new(ERC20AtlasManagerLocked)\n\t\t\t\tif err := _ERC20AtlasManager.contract.UnpackLog(event, \"Locked\", log); err != nil {\n\t\t\t\t\treturn err\n\t\t\t\t}\n\t\t\t\tevent.Raw = log\n\n\t\t\t\tselect {\n\t\t\t\tcase sink <- event:\n\t\t\t\tcase err := <-sub.Err():\n\t\t\t\t\treturn err\n\t\t\t\tcase <-quit:\n\t\t\t\t\treturn nil\n\t\t\t\t}\n\t\t\tcase err := <-sub.Err():\n\t\t\t\treturn err\n\t\t\tcase <-quit:\n\t\t\t\treturn nil\n\t\t\t}\n\t\t}\n\t}), nil\n}", "title": "" }, { "docid": "9657299a2c761804e727e045f30a71d8", "score": "0.46101993", "text": "func getWrapping(contents string, key string) (hash string, timestamp int64) {\r\n\r\n\ttimestamp = getNowTimestamp()\r\n\r\n\thash = getWrappingHash(contents, timestamp, key)\r\n\r\n\treturn hash, timestamp\r\n}", "title": "" }, { "docid": "d3f8283421006a31a71fbdb5f2065b17", "score": "0.46065378", "text": "func (ka *keepAlive) getAckIDs() (live, expired []string) {\n\tka.mu.Lock()\n\tdefer ka.mu.Unlock()\n\n\tnow := time.Now()\n\tfor id, expiry := range ka.items {\n\t\tif expiry.Before(now) {\n\t\t\texpired = append(expired, id)\n\t\t} else {\n\t\t\tlive = append(live, id)\n\t\t}\n\t}\n\treturn live, expired\n}", "title": "" }, { "docid": "a1c71ca74f3e8f83ccfab3188f09cd80", "score": "0.4606402", "text": "func (l *resourceLocker) Lock(resource string, gid uint64, keys ...meta.LockKey) (bool, string, error) {\n\tif len(keys) == 0 {\n\t\treturn true, \"\", nil\n\t}\n\n\tconn := l.cell.Get()\n\targs := make([]interface{}, 0, len(keys)+2)\n\targs = append(args, resource)\n\targs = append(args, gid)\n\tfor _, key := range keys {\n\t\targs = append(args, key.Value())\n\t}\n\n\trsp, err := redis.String(conn.Do(\"LOCK\", args...))\n\tconn.Close()\n\n\tif err != nil {\n\t\treturn false, \"\", err\n\t}\n\n\treturn rsp == \"OK\", rsp, nil\n}", "title": "" }, { "docid": "9fd619b8c249525edbd6357abcf580d5", "score": "0.46015313", "text": "func (m *Manager) getKeys(now time.Time) (keys []Key) {\n\tm.mu.RLock()\n\tif m.shouldRotate(now) {\n\t\tm.mu.RUnlock()\n\t\tm.mu.Lock()\n\t\tdefer m.mu.Unlock()\n\t\tif m.shouldRotate(now) {\n\t\t\tm.rotate(now)\n\t\t}\n\t} else {\n\t\tdefer m.mu.RUnlock()\n\t}\n\n\tkeys = make([]Key, len(m.keys))\n\tcopy(keys, m.keys)\n\n\treturn keys\n}", "title": "" }, { "docid": "28a34fff0e570fad6d7d370f2669a260", "score": "0.45967054", "text": "func (s *deploymentLockLister) DeploymentLocks(namespace string) DeploymentLockNamespaceLister {\n\treturn deploymentLockNamespaceLister{indexer: s.indexer, namespace: namespace}\n}", "title": "" }, { "docid": "0ce7d1552d976dd9feef7c4559154930", "score": "0.45776904", "text": "func Lock(w http.ResponseWriter, req *http.Request) {\n\tparams := mux.Vars(req)\n\tfor _, item := range locks {\n\t\tif item.ID == params[\"id\"] {\n\t\t\tjson.NewEncoder(w).Encode(item)\n\t\t\treturn\n\t\t}\n\t}\n\tjson.NewEncoder(w).Encode(models.NewDreadlocks(\"\", \"brr\", \"\", \"\"))\n}", "title": "" }, { "docid": "225b529b1bc6a754cc89a4a88b1ca0a2", "score": "0.45757833", "text": "func (c *Contract) KeyPrefix() string { return c.ct.KeyPrefix }", "title": "" }, { "docid": "908cd6ddd8acd01163f5c8617360affc", "score": "0.45753443", "text": "func (fs *FSKeyStore) kubeCredLockfilePath(idx KeyIndex) string {\n\treturn keypaths.KubeCredLockfilePath(fs.KeyDir, idx.ProxyHost)\n}", "title": "" }, { "docid": "3d538f4c0e2126d9e70891728ed9a893", "score": "0.45671073", "text": "func (c *Collection) GetAndLock(key string, expiration uint32, opts *GetAndLockOptions) (docOut *GetResult, errOut error) {\n\tif opts == nil {\n\t\topts = &GetAndLockOptions{}\n\t}\n\n\tspan := c.startKvOpTrace(opts.ParentSpanContext, \"GetAndLock\")\n\tdefer span.Finish()\n\n\tdeadlinedCtx := opts.Context\n\tif deadlinedCtx == nil {\n\t\tdeadlinedCtx = context.Background()\n\t}\n\n\td := c.deadline(deadlinedCtx, time.Now(), opts.Timeout)\n\tdeadlinedCtx, cancel := context.WithDeadline(deadlinedCtx, d)\n\tdefer cancel()\n\n\tagent, err := c.getKvProvider()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tctrl := c.newOpManager(deadlinedCtx)\n\terr = ctrl.wait(agent.GetAndLockEx(gocbcore.GetAndLockOptions{\n\t\tKey: []byte(key),\n\t\tCollectionID: c.collectionID(),\n\t\tLockTime: expiration,\n\t\tTraceContext: span.Context(),\n\t}, func(res *gocbcore.GetAndLockResult, err error) {\n\t\tif err != nil {\n\t\t\tif gocbcore.IsErrorStatus(err, gocbcore.StatusCollectionUnknown) {\n\t\t\t\tc.setCollectionUnknown()\n\t\t\t}\n\n\t\t\terrOut = maybeEnhanceErr(err, key)\n\t\t\tctrl.resolve()\n\t\t\treturn\n\t\t}\n\t\tif res != nil {\n\t\t\tdoc := &GetResult{\n\t\t\t\tid: key,\n\t\t\t\tcontents: res.Value,\n\t\t\t\tflags: res.Flags,\n\t\t\t\tcas: Cas(res.Cas),\n\t\t\t}\n\n\t\t\tdocOut = doc\n\t\t}\n\n\t\tctrl.resolve()\n\t}))\n\tif err != nil {\n\t\terrOut = err\n\t}\n\n\treturn\n}", "title": "" }, { "docid": "7464aa9603e147c4445bc527bfe45923", "score": "0.4562578", "text": "func (s *localLocker) Lock(ctx context.Context, key string) (context.Context, context.CancelFunc) {\n\ts.Mutex.Lock()\n\tdefer s.Mutex.Unlock()\n\tfor _, exists := s.m[key]; exists; _, exists = s.m[key] {\n\t\ts.wait.Wait()\n\t}\n\ts.m[key] = struct{}{}\n\tc, f := context.WithCancel(ctx)\n\treturn c, s.cancelfunc(key, f)\n}", "title": "" }, { "docid": "6f72eaafc2f1118b5319db9a480cc7cf", "score": "0.45552534", "text": "func GetLeaders(ctx context.Context, t *testing.T, client kubernetes.Interface, deploymentName, namespace string) ([]string, error) {\n\tleases, err := client.CoordinationV1().Leases(namespace).List(ctx, metav1.ListOptions{})\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"error getting leases for deployment %q: %w\", deploymentName, err)\n\t}\n\tret := make([]string, 0, len(leases.Items))\n\tfor _, lease := range leases.Items {\n\t\tif lease.Spec.HolderIdentity == nil {\n\t\t\tcontinue\n\t\t}\n\t\tpod := strings.SplitN(*lease.Spec.HolderIdentity, \"_\", 2)[0]\n\n\t\t// Deconstruct the pod name and look for the deployment. This won't work for very long deployment names.\n\t\tif extractDeployment(pod) != deploymentName {\n\t\t\tcontinue\n\t\t}\n\t\tret = append(ret, pod)\n\t}\n\treturn ret, nil\n}", "title": "" }, { "docid": "e2a3d3ef2556b3df1e640914587b8790", "score": "0.45360824", "text": "func (c *Store) GetLock(ref string) (*types.Lock, error) {\n\tctx, cancelFunc := newContext(&c.queryTimeout)\n\tdefer cancelFunc()\n\n\tresult := c.collection(c.lockCollectionName).FindOne(ctx, bson.M{\"ref\": ref}, &options.FindOneOptions{})\n\tif err := result.Err(); err != nil {\n\t\treturn nil, err\n\t}\n\n\tvar lock types.LockDocument\n\tif err := result.Decode(&lock); err != nil {\n\t\tif err == mongo.ErrNoDocuments {\n\t\t\treturn nil, store.ErrNotFound\n\t\t}\n\t\treturn nil, err\n\t}\n\n\treturn &lock.Lock, nil\n}", "title": "" }, { "docid": "89433f872aef154013ea8cbdd649f9ad", "score": "0.45326987", "text": "func (s *ShardedLock) GetLock(ctx context.Context, key SimplePull) (*semaphore.Weighted, error) {\n\tif err := s.mapLock.Acquire(ctx, 1); err != nil {\n\t\treturn nil, err\n\t}\n\tdefer s.mapLock.Release(1)\n\tif _, exists := s.locks[key]; !exists {\n\t\ts.locks[key] = semaphore.NewWeighted(1)\n\t}\n\treturn s.locks[key], nil\n}", "title": "" }, { "docid": "2f4023e1e7fca049bc5d13f61aba5dc2", "score": "0.45239237", "text": "func lockWatcher() {\n\n\tfor shutdown := false; !shutdown; {\n\t\tselect {\n\t\tcase <-globals.stopChan:\n\t\t\tshutdown = true\n\t\t\tlogger.Infof(\"trackedlock lock watcher shutting down\")\n\t\t\t// fall through and perform one last check\n\n\t\tcase <-globals.lockCheckChan:\n\t\t\t// fall through and perform checks\n\t\t}\n\n\t\t// LongLockHolders holds information about locks for locks that have\n\t\t// been held longer then globals.lockHoldTimeLimit, upto a maximum of\n\t\t// globals.lockWatcherLocksLogged locks. They are sorted longest to\n\t\t// shortest.\n\t\t//\n\t\t// longestDuration is the minimum lock hold time needed to be added to the\n\t\t// slice, which increases once the slice is full.\n\t\t//\n\t\t// Note that this could be running after lock tracking or the lock watcher\n\t\t// has been disabled (globals.lockHoldTimeLimit and/or\n\t\t// globals.lockCheckPeriod could be 0).\n\t\tvar (\n\t\t\tlongLockHolders = make([]*longLockHolder, 0)\n\t\t\tlongestDuration = time.Duration(atomic.LoadInt64(&globals.lockHoldTimeLimit))\n\t\t)\n\t\tif atomic.LoadInt64(&globals.lockHoldTimeLimit) == 0 {\n\t\t\t// ignore locks held less than 10 years\n\t\t\tlongestDuration, _ = time.ParseDuration(\"24h\")\n\t\t\tlongestDuration *= 365 * 10\n\t\t}\n\n\t\t// now does not change during a loop iteration\n\t\tnow := time.Now()\n\n\t\t// See if any Mutex has been held longer then the limit and, if\n\t\t// so, find the one held the longest.\n\t\t//\n\t\t// Go guarantees that looking at mutex.tracker.lockTime is safe even if\n\t\t// we don't hold the mutex (in practice, looking at tracker.lockCnt\n\t\t// should be safe as well, though go doesn't guarantee that).\n\t\tglobals.mapMutex.Lock()\n\t\tfor mt, lockPtr := range globals.mutexMap {\n\n\t\t\t// If the lock is not locked then skip it; if it has been idle\n\t\t\t// for the lockCheckPeriod then drop it from the locks being\n\t\t\t// watched.\n\t\t\t//\n\t\t\t// Note that this is the only goroutine that deletes locks from\n\t\t\t// globals.mutexMap so any mt pointer we save after this point\n\t\t\t// will continue to be valid until the next iteration.\n\t\t\tif atomic.LoadInt32(&mt.lockCnt) == 0 {\n\t\t\t\tlastLocked := now.Sub(mt.lockTime)\n\t\t\t\tif lastLocked >= time.Duration(atomic.LoadInt64(&globals.lockCheckPeriod)) {\n\t\t\t\t\tmt.isWatched = false\n\t\t\t\t\tdelete(globals.mutexMap, mt)\n\t\t\t\t}\n\t\t\t\tcontinue\n\t\t\t}\n\n\t\t\tlockedDuration := now.Sub(mt.lockTime)\n\t\t\tif lockedDuration > longestDuration {\n\n\t\t\t\t// We do not hold a lock that prevents mt.lockStack.stackTrace\n\t\t\t\t// from changing if the Mutex were to be unlocked right now,\n\t\t\t\t// although its unlikely since the mutex has been held so long,\n\t\t\t\t// so try to copy the stack robustly. If it does change it\n\t\t\t\t// might be reused and now hold another stack and this stack\n\t\t\t\t// trace would be wrong.\n\t\t\t\tvar (\n\t\t\t\t\tmtStackTraceObj *stackTraceObj = mt.lockStack\n\t\t\t\t\tmtStack string\n\t\t\t\t)\n\t\t\t\tif mt.lockStack != nil {\n\t\t\t\t\tmtStack = string(mtStackTraceObj.stackTrace)\n\t\t\t\t}\n\t\t\t\tlongHolder := &longLockHolder{\n\t\t\t\t\tlockPtr: lockPtr,\n\t\t\t\t\tlockTime: mt.lockTime,\n\t\t\t\t\tlockerGoId: mt.lockerGoId,\n\t\t\t\t\tlockStackStr: mtStack,\n\t\t\t\t\tlockOp: \"Lock()\",\n\t\t\t\t\tmutexTrack: mt,\n\t\t\t\t}\n\t\t\t\tlongLockHolders = recordLongLockHolder(longLockHolders, longHolder)\n\n\t\t\t\t// if we've hit the maximum number of locks then bump\n\t\t\t\t// longestDuration\n\t\t\t\tif len(longLockHolders) == globals.lockWatcherLocksLogged {\n\t\t\t\t\tlongestDuration = lockedDuration\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tglobals.mapMutex.Unlock()\n\n\t\t// give other routines a chance to get the global lock\n\t\ttime.Sleep(10 * time.Millisecond)\n\n\t\t// see if any RWMutex has been held longer then the limit and, if\n\t\t// so, find the one held the longest.\n\t\t//\n\t\t// looking at the rwMutex.tracker.* fields is safe per the\n\t\t// argument for Mutex, but looking at rTracker maps requires we\n\t\t// get rtracker.sharedStateLock for each lock.\n\t\tglobals.mapMutex.Lock()\n\t\tfor rwmt, lockPtr := range globals.rwMutexMap {\n\n\t\t\t// If the lock is not locked then skip it. If it has been\n\t\t\t// idle for the lockCheckPeriod (rwmt.tracker.lockTime is\n\t\t\t// updated when the lock is locked shared or exclusive) then\n\t\t\t// drop it from the locks being watched.\n\t\t\tif atomic.LoadInt32(&rwmt.tracker.lockCnt) == 0 {\n\t\t\t\tlastLocked := now.Sub(rwmt.tracker.lockTime)\n\t\t\t\tif lastLocked >= time.Duration(atomic.LoadInt64(&globals.lockCheckPeriod)) {\n\t\t\t\t\trwmt.tracker.isWatched = false\n\t\t\t\t\tdelete(globals.rwMutexMap, rwmt)\n\t\t\t\t}\n\t\t\t\tcontinue\n\t\t\t}\n\n\t\t\tif atomic.LoadInt32(&rwmt.tracker.lockCnt) < 0 {\n\t\t\t\tlockedDuration := now.Sub(rwmt.tracker.lockTime)\n\t\t\t\tif lockedDuration > longestDuration {\n\n\t\t\t\t\t// We do not hold a lock that prevents\n\t\t\t\t\t// rwmt.lockStack.stackTrace from changing if the\n\t\t\t\t\t// RWMutex were to be unlocked right now, although its\n\t\t\t\t\t// unlikely since the rwmutex has been held so long, so\n\t\t\t\t\t// try to copy the stack robustly. If it does change i\n\t\t\t\t\t// it might be reused and now hold another stack.\n\t\t\t\t\t// might be reused and now hold another stack and this\n\t\t\t\t\t// stack trace would be wrong.\n\n\t\t\t\t\tvar (\n\t\t\t\t\t\trwmtStackTraceObj *stackTraceObj = rwmt.tracker.lockStack\n\t\t\t\t\t\trwmtStack string\n\t\t\t\t\t)\n\t\t\t\t\tif rwmt.tracker.lockStack != nil {\n\t\t\t\t\t\trwmtStack = string(rwmtStackTraceObj.stackTrace)\n\t\t\t\t\t}\n\t\t\t\t\tlongHolder := &longLockHolder{\n\t\t\t\t\t\tlockPtr: lockPtr,\n\t\t\t\t\t\tlockTime: rwmt.tracker.lockTime,\n\t\t\t\t\t\tlockerGoId: rwmt.tracker.lockerGoId,\n\t\t\t\t\t\tlockStackStr: rwmtStack,\n\t\t\t\t\t\tlockOp: \"Lock()\",\n\t\t\t\t\t\trwMutexTrack: rwmt,\n\t\t\t\t\t}\n\t\t\t\t\tlongLockHolders = recordLongLockHolder(longLockHolders, longHolder)\n\t\t\t\t\tif len(longLockHolders) == globals.lockWatcherLocksLogged {\n\t\t\t\t\t\tlongestDuration = lockedDuration\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tcontinue\n\t\t\t}\n\n\t\t\trwmt.sharedStateLock.Lock()\n\n\t\t\tfor goId, lockTime := range rwmt.rLockTime {\n\t\t\t\tlockedDuration := now.Sub(lockTime)\n\t\t\t\tif lockedDuration > longestDuration {\n\n\t\t\t\t\t// we do hold a lock that protects rwmt.rLockStack\n\t\t\t\t\tlongHolder := &longLockHolder{\n\t\t\t\t\t\tlockPtr: lockPtr,\n\t\t\t\t\t\tlockTime: lockTime,\n\t\t\t\t\t\tlockerGoId: goId,\n\t\t\t\t\t\tlockStackStr: string(rwmt.rLockStack[goId].stackTrace),\n\t\t\t\t\t\tlockOp: \"RLock()\",\n\t\t\t\t\t\trwMutexTrack: rwmt,\n\t\t\t\t\t}\n\t\t\t\t\tlongLockHolders = recordLongLockHolder(longLockHolders, longHolder)\n\t\t\t\t\tif len(longLockHolders) == globals.lockWatcherLocksLogged {\n\t\t\t\t\t\tlongestDuration = lockedDuration\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\trwmt.sharedStateLock.Unlock()\n\t\t}\n\t\tglobals.mapMutex.Unlock()\n\n\t\tif len(longLockHolders) == 0 {\n\t\t\t// nothing to see! move along!\n\t\t\tcontinue\n\t\t}\n\n\t\t// log a Warning for each lock that has been held too long,\n\t\t// from longest to shortest\n\t\tfor i := 0; i < len(longLockHolders); i += 1 {\n\t\t\tlogger.Warnf(\"trackedlock watcher: %T at %p locked for %f sec rank %d;\"+\n\t\t\t\t\" stack at call to %s:\\n%s\\n\",\n\t\t\t\tlongLockHolders[i].lockPtr, longLockHolders[i].lockPtr,\n\t\t\t\tfloat64(now.Sub(longLockHolders[i].lockTime))/float64(time.Second), i,\n\t\t\t\tlongLockHolders[i].lockOp, longLockHolders[i].lockStackStr)\n\n\t\t}\n\t}\n\n\tglobals.doneChan <- struct{}{}\n}", "title": "" }, { "docid": "b4cbca3f858b01873bfdf0ce348e201a", "score": "0.45221114", "text": "func (c *Cache) ListKeys() []interface{} {\n\tc.mutex.Lock()\n\tdefer c.mutex.Unlock()\n\tret := make([]interface{}, c.queue.Len())\n\tfor i, item := 0, c.queue.Front(); item != nil; i, item = i+1, item.Next() {\n\t\tret[i] = item.Value.(*entry).key\n\t}\n\treturn ret\n}", "title": "" }, { "docid": "93ac00ca71670566a001a44171de2a5b", "score": "0.4518524", "text": "func (s *adminCmd) ListLocks(query *ListLocksQuery, reply *ListLocksReply) error {\n\tif err := query.IsAuthenticated(); err != nil {\n\t\treturn err\n\t}\n\tvolLocks := listLocksInfo(query.Bucket, query.Prefix, query.Duration)\n\t*reply = ListLocksReply{VolLocks: volLocks}\n\treturn nil\n}", "title": "" }, { "docid": "d79b093702013c7f2884f473a3ae47e1", "score": "0.45081186", "text": "func (p *Pool) Locks() time.Time {\n\treturn p.locks\n}", "title": "" }, { "docid": "bffd3bc0a234616ed0caef7b69b7af32", "score": "0.45059142", "text": "func (s deploymentLockNamespaceLister) Get(name string) (*lock.DeploymentLock, 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(lock.Resource(\"deploymentlock\"), name)\n\t}\n\treturn obj.(*lock.DeploymentLock), nil\n}", "title": "" }, { "docid": "fb8922985208fdabe50aa77d8efb2393", "score": "0.45048192", "text": "func (oidx *oidxFile) getOids(keys ...int) ([]*system.Oid, error) {\n\tif oidx.file == nil {\n\t\treturn nil, ErrObjectIndexClosed\n\t}\n\tif len(keys) == 0 {\n\t\treturn []*system.Oid{}, nil\n\t}\n\tkeys, e := oidx.validateQueryArgs(keys...)\n\tif e != nil {\n\t\treturn nil, e\n\t}\n\tvar oids = make([]*system.Oid, len(keys))\n\tfor i, k := range keys {\n\t\toffset := (k << 5) + objectsHeaderSize\n\t\toid, e := system.NewOid(oidx.buf[offset : offset+objectsRecordSize])\n\t\tif e != nil {\n\t\t\treturn nil, e\n\t\t}\n\t\toids[i] = oid\n\t}\n\n\treturn oids, nil\n}", "title": "" }, { "docid": "03e7c95ccbc0399e54e661689587b5ba", "score": "0.45028666", "text": "func getLockHeightBucketKey(lockValue types.LockValue) string {\n\treturn lockedByHeightOutputsKeyPrefix + lockValue.String()\n}", "title": "" }, { "docid": "c5ac62bc0480c29524365afcb37ff0fd", "score": "0.45009577", "text": "func (ipc *IPCache) LookupByPrefixRLocked(prefix string) (identity identity.NumericIdentity, exists bool) {\n\tif _, cidr, err := net.ParseCIDR(prefix); err == nil {\n\t\t// If it's a fully specfied prefix, attempt to find the host\n\t\tones, bits := cidr.Mask.Size()\n\t\tif ones == bits {\n\t\t\tidentity, exists = ipc.ipToIdentityCache[cidr.IP.String()]\n\t\t\tif exists {\n\t\t\t\treturn\n\t\t\t}\n\t\t}\n\t}\n\tidentity, exists = ipc.ipToIdentityCache[prefix]\n\treturn\n}", "title": "" }, { "docid": "5ae0bea3671f7d799953bc2321d98b1a", "score": "0.44966662", "text": "func rowRefs(columnKeys []string, rowNumber int) []string {\n\tvar refs []string\n\trowNum := strconv.Itoa(rowNumber)\n\tfor _, c := range columnKeys {\n\t\tr := c + rowNum\n\t\trefs = append(refs, r)\n\t}\n\treturn refs\n}", "title": "" }, { "docid": "8b46db8321b7aa2ba773c92c5c74e948", "score": "0.44959825", "text": "func getListWork(bucket *s3.Bucket, prefix string, searchDepth int) []listWork {\n\tcurrentPrefixes := []listWork{listWork{prefix, \"\"}}\n\tresults := []listWork{}\n\tfor i := 0; i < searchDepth; i++ {\n\t\tnewPrefixes := []listWork{}\n\t\tfor _, pfx := range currentPrefixes {\n\t\t\tfor res := range List(bucket, pfx.prefix, defaultDelimiter) {\n\t\t\t\tif len(res.CommonPrefixes) != 0 {\n\t\t\t\t\tfor _, newPfx := range res.CommonPrefixes {\n\t\t\t\t\t\tnewPrefixes = append(newPrefixes, listWork{newPfx, \"\"})\n\t\t\t\t\t}\n\t\t\t\t\t// catches the case where keys and common prefixes live in the same place\n\t\t\t\t\tif len(res.Contents) > 0 {\n\t\t\t\t\t\tresults = append(results, listWork{pfx.prefix, \"/\"})\n\t\t\t\t\t}\n\t\t\t\t} else {\n\t\t\t\t\tresults = append(results, listWork{pfx.prefix, \"\"})\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tcurrentPrefixes = newPrefixes\n\t}\n\tfor _, pfx := range currentPrefixes {\n\t\tresults = append(results, pfx)\n\t}\n\treturn results\n}", "title": "" }, { "docid": "29df51d4697cd049a84711aa03968d04", "score": "0.44932464", "text": "func packetsPendingLinkResolutioninitLockNames() {}", "title": "" }, { "docid": "c55e934aa5ea2a3ca0848e9f2a4c354a", "score": "0.44892603", "text": "func allServiceRefkeys(\n\troleNames []string,\n\tserviceName string,\n\tconnectedClusterName string,\n) refkeysMap {\n\n\tresult := make(refkeysMap)\n\tfor _, r := range roleNames {\n\t\tvar refKeyList []string\n\t\tif connectedClusterName != \"\" {\n\t\t\trefKeyList = []string{\"connections\", \"clusters\", connectedClusterName}\n\t\t}\n\t\trefKeyList = append(refKeyList, \"nodegroups\", \"1\", \"roles\", r, \"services\", serviceName)\n\t\tresult[r] = refkeys{\n\t\t\tBdvlibRefKey: refKeyList,\n\t\t}\n\t}\n\treturn result\n}", "title": "" }, { "docid": "3b155d34f157d5456ed34bdfdf49bb8a", "score": "0.4481431", "text": "func (k Keeper) IterateAllLockInfos(\n\tctx sdk.Context, handler func(lockInfo types.LockInfo) (stop bool),\n) {\n\tstore := ctx.KVStore(k.storeKey)\n\titer := sdk.KVStorePrefixIterator(store, types.Address2PoolPrefix)\n\tdefer iter.Close()\n\tfor ; iter.Valid(); iter.Next() {\n\t\tvar lockInfo types.LockInfo\n\t\tk.cdc.MustUnmarshalBinaryLengthPrefixed(iter.Value(), &lockInfo)\n\t\tif handler(lockInfo) {\n\t\t\tbreak\n\t\t}\n\t}\n}", "title": "" }, { "docid": "6e18426407b9debd16f26864e5401d11", "score": "0.44813043", "text": "func libc_getgrouplist_trampoline()", "title": "" }, { "docid": "f688ac200513af60510977129a69640b", "score": "0.4473618", "text": "func (_ERC20AtlasManager *ERC20AtlasManagerTransactorSession) LockTokenFor(hynTokenAddr common.Address, userAddr common.Address, amount *big.Int, recipient common.Address) (*types.Transaction, error) {\n\treturn _ERC20AtlasManager.Contract.LockTokenFor(&_ERC20AtlasManager.TransactOpts, hynTokenAddr, userAddr, amount, recipient)\n}", "title": "" }, { "docid": "3d6405906740ccea5c7e773e6b055690", "score": "0.44706112", "text": "func (t *SymbolTable) KeysWithPrefix(prefix string) []string {\n\tresults := new(stringQueue)\n\tx := t.get(t.root, []rune(prefix), 0)\n\tt.collect(x, []rune(prefix), results)\n\treturn results.slice()\n}", "title": "" }, { "docid": "c9c66da2cd3cd9011eef9c79ee107656", "score": "0.44701615", "text": "func GetLFSLockByRepoID(ctx context.Context, repoID int64, page, pageSize int) ([]*LFSLock, error) {\n\te := db.GetEngine(ctx)\n\tif page >= 0 && pageSize > 0 {\n\t\tstart := 0\n\t\tif page > 0 {\n\t\t\tstart = (page - 1) * pageSize\n\t\t}\n\t\te.Limit(pageSize, start)\n\t}\n\tlfsLocks := make([]*LFSLock, 0, pageSize)\n\treturn lfsLocks, e.Find(&lfsLocks, &LFSLock{RepoID: repoID})\n}", "title": "" }, { "docid": "c81c022e2d3c6031dd4bb8f6ffd58787", "score": "0.44653475", "text": "func split(lock uint64, mask uint32) (uint32, uint32, uint32) {\n\thi := uint32(lock >> 32)\n\tlo := uint32(lock)\n\th0 := lo & mask\n\th1 := h0 ^ (lo >> 29)\n\treturn hi, h0, h1\n}", "title": "" }, { "docid": "fda5bb2497df0ed2fa9b24d9be73b0e5", "score": "0.44631705", "text": "func depreciated_ListWithCommonPrefixes(bucket *s3.Bucket, prefix string) chan s3.Key {\n\tch := make(chan s3.Key, 1000)\n\tgo func() {\n\t\tdefer close(ch)\n\t\tfor listResp := range List(bucket, prefix, defaultDelimiter) {\n\t\t\tfor _, prefix := range listResp.CommonPrefixes {\n\t\t\t\tch <- s3.Key{prefix, \"\", -1, \"\", \"\", s3.Owner{}}\n\t\t\t}\n\t\t\tfor _, key := range listResp.Contents {\n\t\t\t\tch <- key\n\t\t\t}\n\t\t}\n\t}()\n\treturn ch\n}", "title": "" }, { "docid": "dc23d52151528859e34ec02298a71431", "score": "0.4458495", "text": "func (m MsgLock) GetSigners() []sdk.AccAddress {\n\treturn []sdk.AccAddress{m.Owner}\n}", "title": "" }, { "docid": "f07e4785a2666cb985ca42fc1797bef0", "score": "0.44478557", "text": "func (g *Gauges) Locks() *prometheus.GaugeVec {\n\tvar gauge = prometheus.NewGaugeVec(\n\t\tprometheus.GaugeOpts{\n\t\t\tName: \"postgresql_locks\",\n\t\t\tHelp: \"Number of active locks on the database by locktype and mode\",\n\t\t\tConstLabels: g.labels,\n\t\t},\n\t\t[]string{\"locktype\", \"mode\"},\n\t)\n\tgo func() {\n\t\tfor {\n\t\t\tgauge.Reset()\n\t\t\tvar locks []locks\n\t\t\tif err := g.query(\n\t\t\t\t`\n\t\t\t\t\tSELECT locktype, mode, count(*) as count\n\t\t\t\t\tFROM pg_locks\n\t\t\t\t\tWHERE database = (\n\t\t\t\t\t\tSELECT datid\n\t\t\t\t\t\tFROM pg_stat_database\n\t\t\t\t\t\tWHERE datname = current_database()\n\t\t\t\t\t) GROUP BY locktype, mode;\n\t\t\t\t`,\n\t\t\t\t&locks,\n\t\t\t\temptyParams,\n\t\t\t); err == nil {\n\t\t\t\tfor _, lock := range locks {\n\t\t\t\t\tgauge.With(prometheus.Labels{\n\t\t\t\t\t\t\"locktype\": lock.Type,\n\t\t\t\t\t\t\"mode\": lock.Mode,\n\t\t\t\t\t}).Set(lock.Count)\n\t\t\t\t}\n\t\t\t}\n\t\t\ttime.Sleep(g.interval)\n\t\t}\n\t}()\n\treturn gauge\n}", "title": "" }, { "docid": "4a277f01a1de2fc0df9ffb48cf9eb38f", "score": "0.44473004", "text": "func ExampleGlacier_GetVaultLock_shared00() {\n\tsvc := glacier.New(session.New())\n\tinput := &glacier.GetVaultLockInput{\n\t\tAccountId: aws.String(\"-\"),\n\t\tVaultName: aws.String(\"examplevault\"),\n\t}\n\n\tresult, err := svc.GetVaultLock(input)\n\tif err != nil {\n\t\tif aerr, ok := err.(awserr.Error); ok {\n\t\t\tswitch aerr.Code() {\n\t\t\tcase glacier.ErrCodeResourceNotFoundException:\n\t\t\t\tfmt.Println(glacier.ErrCodeResourceNotFoundException, aerr.Error())\n\t\t\tcase glacier.ErrCodeInvalidParameterValueException:\n\t\t\t\tfmt.Println(glacier.ErrCodeInvalidParameterValueException, aerr.Error())\n\t\t\tcase glacier.ErrCodeMissingParameterValueException:\n\t\t\t\tfmt.Println(glacier.ErrCodeMissingParameterValueException, aerr.Error())\n\t\t\tcase glacier.ErrCodeServiceUnavailableException:\n\t\t\t\tfmt.Println(glacier.ErrCodeServiceUnavailableException, aerr.Error())\n\t\t\tdefault:\n\t\t\t\tfmt.Println(aerr.Error())\n\t\t\t}\n\t\t} else {\n\t\t\t// Print the error, cast err to awserr.Error to get the Code and\n\t\t\t// Message from an error.\n\t\t\tfmt.Println(err.Error())\n\t\t}\n\t\treturn\n\t}\n\n\tfmt.Println(result)\n}", "title": "" }, { "docid": "4ea45b9edacc37aa616e0c2d9c19dabb", "score": "0.44438148", "text": "func TestLeasingInterval(t *testing.T) {\n\tintegration2.BeforeTest(t)\n\tclus := integration2.NewCluster(t, &integration2.ClusterConfig{Size: 1})\n\tdefer clus.Terminate(t)\n\n\tlkv, closeLKV, err := leasing.NewKV(clus.Client(0), \"pfx/\")\n\ttestutil.AssertNil(t, err)\n\tdefer closeLKV()\n\n\tkeys := []string{\"abc/a\", \"abc/b\", \"abc/a/a\"}\n\tfor _, k := range keys {\n\t\tif _, err = clus.Client(0).Put(context.TODO(), k, \"v\"); err != nil {\n\t\t\tt.Fatal(err)\n\t\t}\n\t}\n\n\tresp, err := lkv.Get(context.TODO(), \"abc/\", clientv3.WithPrefix())\n\tif err != nil {\n\t\tt.Fatal(err)\n\t}\n\tif len(resp.Kvs) != 3 {\n\t\tt.Fatalf(\"expected keys %+v, got response keys %+v\", keys, resp.Kvs)\n\t}\n\n\t// load into cache\n\tif _, err = lkv.Get(context.TODO(), \"abc/a\"); err != nil {\n\t\tt.Fatal(err)\n\t}\n\n\t// get when prefix is also a cached key\n\tif resp, err = lkv.Get(context.TODO(), \"abc/a\", clientv3.WithPrefix()); err != nil {\n\t\tt.Fatal(err)\n\t}\n\tif len(resp.Kvs) != 2 {\n\t\tt.Fatalf(\"expected keys %+v, got response keys %+v\", keys, resp.Kvs)\n\t}\n}", "title": "" }, { "docid": "17e13e8dfdeb42c9b9147530c5f0bdb6", "score": "0.44416577", "text": "func GetValidatorSlashEventKeyPrefix(v sdk.ValAddress, height uint64) []byte {\n\theightBz := make([]byte, 8)\n\tbinary.BigEndian.PutUint64(heightBz, height)\n\treturn append(\n\t\tValidatorSlashEventPrefix,\n\t\tappend(v.Bytes(), heightBz...)...,\n\t)\n}", "title": "" }, { "docid": "f7d985289e7a50b4e49bb1a9d0aeb2ed", "score": "0.44397128", "text": "func (s *KeyMaster) KeyIDs() []string {\n\t// Some singing and verifying keys might have the same key ID. Since Go\n\t// does not have a set type, a map is used to filter out duplicates.\n\tidsMap := make(map[string]bool)\n\tfor _, signer := range s.signers {\n\t\tidsMap[signer.KeyID()] = true\n\t}\n\tfor _, verifier := range s.verifiers {\n\t\tidsMap[verifier.KeyID()] = true\n\t}\n\n\tids := make([]string, 0, len(idsMap))\n\tfor id := range idsMap {\n\t\tids = append(ids, id)\n\t}\n\treturn ids\n}", "title": "" }, { "docid": "a7624810ab786391bab124f50b4ed072", "score": "0.4438782", "text": "func (a *ShardMap) LockGet(key string) *interface{} {\n\t//println(\"get key: \", key)\n\tshard := a.DjbHash(key) & uint32(a.shards-1)\n\n\ta.shardMap[shard].Lock.Lock()\n\tdefer a.shardMap[shard].Lock.Unlock()\n\n\treturn a.shardMap[shard].InternalMap[key]\n}", "title": "" }, { "docid": "cb9bef4ccabd011e35a25505858b3e6d", "score": "0.44368204", "text": "func getReferenceList(obj contrail.IObject) UIDList {\n\trefList := make([]UID, 0, 8)\n\tvalue := reflect.ValueOf(obj).Elem()\n\ttypeval := value.Type()\n\n\tfor i := 0; i < value.NumField(); i++ {\n\t\tname := typeval.Field(i).Name\n\t\tif strings.HasSuffix(name, \"_back_refs\") {\n\t\t\tcontinue\n\t\t}\n\t\tif strings.HasSuffix(name, \"_refs\") {\n\t\t\tfield := value.Field(i)\n\t\t\tfor i := 0; i < field.Len(); i++ {\n\t\t\t\tv := field.Index(i)\n\t\t\t\tref := (*contrail.Reference)(unsafe.Pointer(v.UnsafeAddr()))\n\t\t\t\trefList = append(refList, parseUID(ref.Uuid))\n\t\t\t}\n\t\t}\n\t}\n\treturn refList\n}", "title": "" }, { "docid": "48e8ab2f0160eafda0474a97258c3bfd", "score": "0.4429434", "text": "func (c *Cache) GetItemIDs(prfx string) (itmIDs []string) {\n\tc.RLock()\n\tfor itmID := range c.cache {\n\t\tif strings.HasPrefix(itmID, prfx) {\n\t\t\titmIDs = append(itmIDs, itmID)\n\t\t}\n\t}\n\tc.RUnlock()\n\treturn\n}", "title": "" } ]
96c0d0328ba2ea053863c2f2fc007a9d
Adds an override to a resource property. Syntactic sugar for `addOverride("Properties.", value)`. Experimental.
[ { "docid": "44e5c345f7b644dc63493d6b9750a91f", "score": "0.7225125", "text": "func (c *jsiiProxy_CfnAnomalyDetector) AddPropertyOverride(propertyPath *string, value interface{}) {\n\t_jsii_.InvokeVoid(\n\t\tc,\n\t\t\"addPropertyOverride\",\n\t\t[]interface{}{propertyPath, value},\n\t)\n}", "title": "" } ]
[ { "docid": "c024a411bd9f2fe3a304633acb478a10", "score": "0.7908425", "text": "func (c *jsiiProxy_CfnResourceUpdateConstraint) AddPropertyOverride(propertyPath *string, value interface{}) {\n\t_jsii_.InvokeVoid(\n\t\tc,\n\t\t\"addPropertyOverride\",\n\t\t[]interface{}{propertyPath, value},\n\t)\n}", "title": "" }, { "docid": "c7b6470db74f184aadd769d948f12dff", "score": "0.78306806", "text": "func (c *jsiiProxy_CfnAddon) AddPropertyOverride(propertyPath *string, value interface{}) {\n\t_jsii_.InvokeVoid(\n\t\tc,\n\t\t\"addPropertyOverride\",\n\t\t[]interface{}{propertyPath, value},\n\t)\n}", "title": "" }, { "docid": "c565cf98199d1c0852458c457f566385", "score": "0.7788929", "text": "func (c *jsiiProxy_CfnInsightRule) AddPropertyOverride(propertyPath *string, value interface{}) {\n\t_jsii_.InvokeVoid(\n\t\tc,\n\t\t\"addPropertyOverride\",\n\t\t[]interface{}{propertyPath, value},\n\t)\n}", "title": "" }, { "docid": "ecb936a62bf69842ed080c7deed7a432", "score": "0.77371585", "text": "func (c *jsiiProxy_CfnPolicy) AddPropertyOverride(propertyPath *string, value interface{}) {\n\t_jsii_.InvokeVoid(\n\t\tc,\n\t\t\"addPropertyOverride\",\n\t\t[]interface{}{propertyPath, value},\n\t)\n}", "title": "" }, { "docid": "48335498548afffa4ed2a34b0c966da8", "score": "0.77175593", "text": "func (c *jsiiProxy_CfnApi) AddPropertyOverride(propertyPath *string, value interface{}) {\n\t_jsii_.InvokeVoid(\n\t\tc,\n\t\t\"addPropertyOverride\",\n\t\t[]interface{}{propertyPath, value},\n\t)\n}", "title": "" }, { "docid": "c5009e0d9126eed6041676d628d68b7e", "score": "0.77139485", "text": "func (c *jsiiProxy_CfnDeployment) AddPropertyOverride(propertyPath *string, value interface{}) {\n\t_jsii_.InvokeVoid(\n\t\tc,\n\t\t\"addPropertyOverride\",\n\t\t[]interface{}{propertyPath, value},\n\t)\n}", "title": "" }, { "docid": "152f42cff14cc1246125c4bf49bb429f", "score": "0.7712866", "text": "func (c *jsiiProxy_CfnOIDCProvider) AddPropertyOverride(propertyPath *string, value interface{}) {\n\t_jsii_.InvokeVoid(\n\t\tc,\n\t\t\"addPropertyOverride\",\n\t\t[]interface{}{propertyPath, value},\n\t)\n}", "title": "" }, { "docid": "5b8793fc269a969160b865d113998a0c", "score": "0.7710471", "text": "func (c *jsiiProxy_CfnCloudFormationProduct) AddPropertyOverride(propertyPath *string, value interface{}) {\n\t_jsii_.InvokeVoid(\n\t\tc,\n\t\t\"addPropertyOverride\",\n\t\t[]interface{}{propertyPath, value},\n\t)\n}", "title": "" }, { "docid": "ea2a0ed25e244a42242fab86ad0aafa8", "score": "0.77035344", "text": "func (c *jsiiProxy_CfnConformancePack) AddPropertyOverride(propertyPath *string, value interface{}) {\n\t_jsii_.InvokeVoid(\n\t\tc,\n\t\t\"addPropertyOverride\",\n\t\t[]interface{}{propertyPath, value},\n\t)\n}", "title": "" }, { "docid": "f09b203fff5f3769329046cbeb952714", "score": "0.76686054", "text": "func (c *jsiiProxy_CfnPipeline) AddPropertyOverride(propertyPath *string, value interface{}) {\n\t_jsii_.InvokeVoid(\n\t\tc,\n\t\t\"addPropertyOverride\",\n\t\t[]interface{}{propertyPath, value},\n\t)\n}", "title": "" }, { "docid": "5a0cfbdf833854bdc2468ec87043465b", "score": "0.7645945", "text": "func (c *jsiiProxy_CfnRole) AddPropertyOverride(propertyPath *string, value interface{}) {\n\t_jsii_.InvokeVoid(\n\t\tc,\n\t\t\"addPropertyOverride\",\n\t\t[]interface{}{propertyPath, value},\n\t)\n}", "title": "" }, { "docid": "31c3048786a700cee144151c3a8c10bd", "score": "0.7642439", "text": "func (c *jsiiProxy_CfnAuthorizer) AddPropertyOverride(propertyPath *string, value interface{}) {\n\t_jsii_.InvokeVoid(\n\t\tc,\n\t\t\"addPropertyOverride\",\n\t\t[]interface{}{propertyPath, value},\n\t)\n}", "title": "" }, { "docid": "2728064f94369ec14d63ff662236ae37", "score": "0.7610925", "text": "func (c *jsiiProxy_CfnApiGatewayManagedOverrides) AddPropertyOverride(propertyPath *string, value interface{}) {\n\t_jsii_.InvokeVoid(\n\t\tc,\n\t\t\"addPropertyOverride\",\n\t\t[]interface{}{propertyPath, value},\n\t)\n}", "title": "" }, { "docid": "c13ed21f1c5d9861598807bae47c80b3", "score": "0.7609614", "text": "func (c *jsiiProxy_CfnConfigRule) AddPropertyOverride(propertyPath *string, value interface{}) {\n\t_jsii_.InvokeVoid(\n\t\tc,\n\t\t\"addPropertyOverride\",\n\t\t[]interface{}{propertyPath, value},\n\t)\n}", "title": "" }, { "docid": "331404110d1593e51b19e380f5015112", "score": "0.7573376", "text": "func (c *jsiiProxy_CfnIntegration) AddPropertyOverride(propertyPath *string, value interface{}) {\n\t_jsii_.InvokeVoid(\n\t\tc,\n\t\t\"addPropertyOverride\",\n\t\t[]interface{}{propertyPath, value},\n\t)\n}", "title": "" }, { "docid": "cd681c06d39d0a1e2b23191bef365954", "score": "0.7568444", "text": "func (c *jsiiProxy_CfnRuleGroup) AddPropertyOverride(propertyPath *string, value interface{}) {\n\t_jsii_.InvokeVoid(\n\t\tc,\n\t\t\"addPropertyOverride\",\n\t\t[]interface{}{propertyPath, value},\n\t)\n}", "title": "" }, { "docid": "41d4d3d466926574d0fcac1b3d116cf4", "score": "0.75664675", "text": "func (c *jsiiProxy_CfnCloudFormationProvisionedProduct) AddPropertyOverride(propertyPath *string, value interface{}) {\n\t_jsii_.InvokeVoid(\n\t\tc,\n\t\t\"addPropertyOverride\",\n\t\t[]interface{}{propertyPath, value},\n\t)\n}", "title": "" }, { "docid": "ab04e2845b0bbf958c15360098366392", "score": "0.7557431", "text": "func (c *jsiiProxy_CfnLifecyclePolicy) AddPropertyOverride(propertyPath *string, value interface{}) {\n\t_jsii_.InvokeVoid(\n\t\tc,\n\t\t\"addPropertyOverride\",\n\t\t[]interface{}{propertyPath, value},\n\t)\n}", "title": "" }, { "docid": "bd0eedbfa559a9f4a5c370d7b7c2bb94", "score": "0.7553346", "text": "func (c *jsiiProxy_CfnServiceAction) AddPropertyOverride(propertyPath *string, value interface{}) {\n\t_jsii_.InvokeVoid(\n\t\tc,\n\t\t\"addPropertyOverride\",\n\t\t[]interface{}{propertyPath, value},\n\t)\n}", "title": "" }, { "docid": "ec06f94cea807a244a269b4638d0bc1c", "score": "0.75427276", "text": "func (c *jsiiProxy_CfnInstanceProfile) AddPropertyOverride(propertyPath *string, value interface{}) {\n\t_jsii_.InvokeVoid(\n\t\tc,\n\t\t\"addPropertyOverride\",\n\t\t[]interface{}{propertyPath, value},\n\t)\n}", "title": "" }, { "docid": "3268486365c53d16583be4e37368e7c5", "score": "0.75412613", "text": "func (c *jsiiProxy_CfnEndpointGroup) AddPropertyOverride(propertyPath *string, value interface{}) {\n\t_jsii_.InvokeVoid(\n\t\tc,\n\t\t\"addPropertyOverride\",\n\t\t[]interface{}{propertyPath, value},\n\t)\n}", "title": "" }, { "docid": "c8b3aede74729f5fe45156886fa9e957", "score": "0.75395375", "text": "func (c *jsiiProxy_CfnConfigurationAggregator) AddPropertyOverride(propertyPath *string, value interface{}) {\n\t_jsii_.InvokeVoid(\n\t\tc,\n\t\t\"addPropertyOverride\",\n\t\t[]interface{}{propertyPath, value},\n\t)\n}", "title": "" }, { "docid": "a86d51eadbd8f4796275357af09afff0", "score": "0.75315154", "text": "func (c *jsiiProxy_CfnChannel) AddPropertyOverride(propertyPath *string, value interface{}) {\n\t_jsii_.InvokeVoid(\n\t\tc,\n\t\t\"addPropertyOverride\",\n\t\t[]interface{}{propertyPath, value},\n\t)\n}", "title": "" }, { "docid": "34012ce607831e76fa2d3a565f8d62da", "score": "0.75226647", "text": "func (c *jsiiProxy_CfnRemediationConfiguration) AddPropertyOverride(propertyPath *string, value interface{}) {\n\t_jsii_.InvokeVoid(\n\t\tc,\n\t\t\"addPropertyOverride\",\n\t\t[]interface{}{propertyPath, value},\n\t)\n}", "title": "" }, { "docid": "4536fe67e5b7d19b25ee93f014371d71", "score": "0.75214285", "text": "func (c *jsiiProxy_CfnManagedPolicy) AddPropertyOverride(propertyPath *string, value interface{}) {\n\t_jsii_.InvokeVoid(\n\t\tc,\n\t\t\"addPropertyOverride\",\n\t\t[]interface{}{propertyPath, value},\n\t)\n}", "title": "" }, { "docid": "f379f360db07ab858993d4f2592542d5", "score": "0.7504854", "text": "func (c *jsiiProxy_CfnListener) AddPropertyOverride(propertyPath *string, value interface{}) {\n\t_jsii_.InvokeVoid(\n\t\tc,\n\t\t\"addPropertyOverride\",\n\t\t[]interface{}{propertyPath, value},\n\t)\n}", "title": "" }, { "docid": "17660dec3ff1ea272c3015e4b8f47792", "score": "0.75035965", "text": "func (c *jsiiProxy_CfnWebACL) AddPropertyOverride(propertyPath *string, value interface{}) {\n\t_jsii_.InvokeVoid(\n\t\tc,\n\t\t\"addPropertyOverride\",\n\t\t[]interface{}{propertyPath, value},\n\t)\n}", "title": "" }, { "docid": "07f00957645bc732532bd92bd9754df4", "score": "0.75014204", "text": "func (c *jsiiProxy_CfnStage) AddPropertyOverride(propertyPath *string, value interface{}) {\n\t_jsii_.InvokeVoid(\n\t\tc,\n\t\t\"addPropertyOverride\",\n\t\t[]interface{}{propertyPath, value},\n\t)\n}", "title": "" }, { "docid": "9a7491912367f4acc83d19bff2bb8306", "score": "0.74975514", "text": "func (c *jsiiProxy_CfnConfigurationRecorder) AddPropertyOverride(propertyPath *string, value interface{}) {\n\t_jsii_.InvokeVoid(\n\t\tc,\n\t\t\"addPropertyOverride\",\n\t\t[]interface{}{propertyPath, value},\n\t)\n}", "title": "" }, { "docid": "8ed08590b9aeed9d7ff1a32cc422965b", "score": "0.74904245", "text": "func (c *jsiiProxy_CfnAlarm) AddPropertyOverride(propertyPath *string, value interface{}) {\n\t_jsii_.InvokeVoid(\n\t\tc,\n\t\t\"addPropertyOverride\",\n\t\t[]interface{}{propertyPath, value},\n\t)\n}", "title": "" }, { "docid": "00fe12c2b3727594edfd0ad0c16accc7", "score": "0.74902", "text": "func (c *jsiiProxy_CfnIntegrationResponse) AddPropertyOverride(propertyPath *string, value interface{}) {\n\t_jsii_.InvokeVoid(\n\t\tc,\n\t\t\"addPropertyOverride\",\n\t\t[]interface{}{propertyPath, value},\n\t)\n}", "title": "" }, { "docid": "e342614c73ab41b61fc78c9022f7cdd8", "score": "0.74886084", "text": "func (c *jsiiProxy_CfnTagOption) AddPropertyOverride(propertyPath *string, value interface{}) {\n\t_jsii_.InvokeVoid(\n\t\tc,\n\t\t\"addPropertyOverride\",\n\t\t[]interface{}{propertyPath, value},\n\t)\n}", "title": "" }, { "docid": "097a99fe8c222b060cc29ed1c47e7e90", "score": "0.74738336", "text": "func (c *jsiiProxy_CfnServiceActionAssociation) AddPropertyOverride(propertyPath *string, value interface{}) {\n\t_jsii_.InvokeVoid(\n\t\tc,\n\t\t\"addPropertyOverride\",\n\t\t[]interface{}{propertyPath, value},\n\t)\n}", "title": "" }, { "docid": "71eb4ff87c34022657a79e9650166c50", "score": "0.7471682", "text": "func (c *jsiiProxy_CfnFargateProfile) AddPropertyOverride(propertyPath *string, value interface{}) {\n\t_jsii_.InvokeVoid(\n\t\tc,\n\t\t\"addPropertyOverride\",\n\t\t[]interface{}{propertyPath, value},\n\t)\n}", "title": "" }, { "docid": "d07d36202cd916d775f0ed08bffc1223", "score": "0.74576294", "text": "func (c *jsiiProxy_CfnApiMapping) AddPropertyOverride(propertyPath *string, value interface{}) {\n\t_jsii_.InvokeVoid(\n\t\tc,\n\t\t\"addPropertyOverride\",\n\t\t[]interface{}{propertyPath, value},\n\t)\n}", "title": "" }, { "docid": "140d39a0883f283ada90e9b084733d20", "score": "0.74352574", "text": "func (c *jsiiProxy_CfnOrganizationConformancePack) AddPropertyOverride(propertyPath *string, value interface{}) {\n\t_jsii_.InvokeVoid(\n\t\tc,\n\t\t\"addPropertyOverride\",\n\t\t[]interface{}{propertyPath, value},\n\t)\n}", "title": "" }, { "docid": "c7f9ea8541002a7f2b7a0e53a5d3d217", "score": "0.7428901", "text": "func (c *jsiiProxy_CfnResolverRule) AddPropertyOverride(propertyPath *string, value interface{}) {\n\t_jsii_.InvokeVoid(\n\t\tc,\n\t\t\"addPropertyOverride\",\n\t\t[]interface{}{propertyPath, value},\n\t)\n}", "title": "" }, { "docid": "3060db5d36f39eb2757d8cc1d2b57636", "score": "0.7419863", "text": "func (c *jsiiProxy_CfnAccelerator) AddPropertyOverride(propertyPath *string, value interface{}) {\n\t_jsii_.InvokeVoid(\n\t\tc,\n\t\t\"addPropertyOverride\",\n\t\t[]interface{}{propertyPath, value},\n\t)\n}", "title": "" }, { "docid": "00c3775be701e3976b7f9f9e49638181", "score": "0.741071", "text": "func (c *jsiiProxy_CfnGroup) AddPropertyOverride(propertyPath *string, value interface{}) {\n\t_jsii_.InvokeVoid(\n\t\tc,\n\t\t\"addPropertyOverride\",\n\t\t[]interface{}{propertyPath, value},\n\t)\n}", "title": "" }, { "docid": "44be9456bb570f3c6463674236e48d39", "score": "0.73985916", "text": "func (c *jsiiProxy_CfnResolverEndpoint) AddPropertyOverride(propertyPath *string, value interface{}) {\n\t_jsii_.InvokeVoid(\n\t\tc,\n\t\t\"addPropertyOverride\",\n\t\t[]interface{}{propertyPath, value},\n\t)\n}", "title": "" }, { "docid": "06ea8b10a51063d533cbb20efc7c1f1e", "score": "0.7396722", "text": "func (c *jsiiProxy_CfnResolverDNSSECConfig) AddPropertyOverride(propertyPath *string, value interface{}) {\n\t_jsii_.InvokeVoid(\n\t\tc,\n\t\t\"addPropertyOverride\",\n\t\t[]interface{}{propertyPath, value},\n\t)\n}", "title": "" }, { "docid": "1e35dcde7b57bf24c40e13f7d9654477", "score": "0.7391393", "text": "func (c *jsiiProxy_CfnWebACLAssociation) AddPropertyOverride(propertyPath *string, value interface{}) {\n\t_jsii_.InvokeVoid(\n\t\tc,\n\t\t\"addPropertyOverride\",\n\t\t[]interface{}{propertyPath, value},\n\t)\n}", "title": "" }, { "docid": "5e595e270162cfdaf7bcd09b09e75aa6", "score": "0.73845357", "text": "func (c *jsiiProxy_CfnResolverRuleAssociation) AddPropertyOverride(propertyPath *string, value interface{}) {\n\t_jsii_.InvokeVoid(\n\t\tc,\n\t\t\"addPropertyOverride\",\n\t\t[]interface{}{propertyPath, value},\n\t)\n}", "title": "" }, { "docid": "7a736ffb1ceef87570c3910fa99a5689", "score": "0.7380944", "text": "func (c *jsiiProxy_CfnAccessKey) AddPropertyOverride(propertyPath *string, value interface{}) {\n\t_jsii_.InvokeVoid(\n\t\tc,\n\t\t\"addPropertyOverride\",\n\t\t[]interface{}{propertyPath, value},\n\t)\n}", "title": "" }, { "docid": "037b5414fb7933b111a46955221dcc29", "score": "0.7379986", "text": "func (c *jsiiProxy_CfnUser) AddPropertyOverride(propertyPath *string, value interface{}) {\n\t_jsii_.InvokeVoid(\n\t\tc,\n\t\t\"addPropertyOverride\",\n\t\t[]interface{}{propertyPath, value},\n\t)\n}", "title": "" }, { "docid": "f4f8d51f3af440f99c4f63171c8034fa", "score": "0.7378163", "text": "func (c *jsiiProxy_CfnServerCertificate) AddPropertyOverride(propertyPath *string, value interface{}) {\n\t_jsii_.InvokeVoid(\n\t\tc,\n\t\t\"addPropertyOverride\",\n\t\t[]interface{}{propertyPath, value},\n\t)\n}", "title": "" }, { "docid": "e44d1c864dbc698e00281093c5fc80fc", "score": "0.7377881", "text": "func (c *jsiiProxy_CfnSAMLProvider) AddPropertyOverride(propertyPath *string, value interface{}) {\n\t_jsii_.InvokeVoid(\n\t\tc,\n\t\t\"addPropertyOverride\",\n\t\t[]interface{}{propertyPath, value},\n\t)\n}", "title": "" }, { "docid": "41c276756f42d6b589d08ad260ae98b1", "score": "0.7364263", "text": "func (c *jsiiProxy_CfnDomain) AddPropertyOverride(propertyPath *string, value interface{}) {\n\t_jsii_.InvokeVoid(\n\t\tc,\n\t\t\"addPropertyOverride\",\n\t\t[]interface{}{propertyPath, value},\n\t)\n}", "title": "" }, { "docid": "84fbd5b95b0eb34ff93072b00040da65", "score": "0.7355302", "text": "func (c *jsiiProxy_CfnDatastore) AddPropertyOverride(propertyPath *string, value interface{}) {\n\t_jsii_.InvokeVoid(\n\t\tc,\n\t\t\"addPropertyOverride\",\n\t\t[]interface{}{propertyPath, value},\n\t)\n}", "title": "" }, { "docid": "ac68d0091910a81442dc6406c5c7b673", "score": "0.734858", "text": "func (c *jsiiProxy_CfnDashboard) AddPropertyOverride(propertyPath *string, value interface{}) {\n\t_jsii_.InvokeVoid(\n\t\tc,\n\t\t\"addPropertyOverride\",\n\t\t[]interface{}{propertyPath, value},\n\t)\n}", "title": "" }, { "docid": "b094d67add0ba756f692de1c51d6b8d5", "score": "0.73431426", "text": "func (c *jsiiProxy_CfnFirewallRuleGroup) AddPropertyOverride(propertyPath *string, value interface{}) {\n\t_jsii_.InvokeVoid(\n\t\tc,\n\t\t\"addPropertyOverride\",\n\t\t[]interface{}{propertyPath, value},\n\t)\n}", "title": "" }, { "docid": "528d092a42ffebad2d26ca70548bc1f2", "score": "0.73342186", "text": "func (c *jsiiProxy_CfnOrganizationConfigRule) AddPropertyOverride(propertyPath *string, value interface{}) {\n\t_jsii_.InvokeVoid(\n\t\tc,\n\t\t\"addPropertyOverride\",\n\t\t[]interface{}{propertyPath, value},\n\t)\n}", "title": "" }, { "docid": "973f18687bf5a65b5a677b9f910fbe6a", "score": "0.732618", "text": "func (c *jsiiProxy_CfnIPSet) AddPropertyOverride(propertyPath *string, value interface{}) {\n\t_jsii_.InvokeVoid(\n\t\tc,\n\t\t\"addPropertyOverride\",\n\t\t[]interface{}{propertyPath, value},\n\t)\n}", "title": "" }, { "docid": "b47ed8e92797c1a6fc2a00104999a7c3", "score": "0.7324", "text": "func (c *jsiiProxy_CfnNode) AddPropertyOverride(propertyPath *string, value interface{}) {\n\t_jsii_.InvokeVoid(\n\t\tc,\n\t\t\"addPropertyOverride\",\n\t\t[]interface{}{propertyPath, value},\n\t)\n}", "title": "" }, { "docid": "fb516dbf10d1a8bf4964ae1c33f306c6", "score": "0.7308971", "text": "func (c *jsiiProxy_CfnEnvironment) AddPropertyOverride(propertyPath *string, value interface{}) {\n\t_jsii_.InvokeVoid(\n\t\tc,\n\t\t\"addPropertyOverride\",\n\t\t[]interface{}{propertyPath, value},\n\t)\n}", "title": "" }, { "docid": "c238d21a51c1a34bd69beb4f8d842a0b", "score": "0.7304583", "text": "func (c *jsiiProxy_CfnCompositeAlarm) AddPropertyOverride(propertyPath *string, value interface{}) {\n\t_jsii_.InvokeVoid(\n\t\tc,\n\t\t\"addPropertyOverride\",\n\t\t[]interface{}{propertyPath, value},\n\t)\n}", "title": "" }, { "docid": "51ddc8945b3086d808fcbacb941f011d", "score": "0.72910416", "text": "func (c *jsiiProxy_CfnFirewallRuleGroupAssociation) AddPropertyOverride(propertyPath *string, value interface{}) {\n\t_jsii_.InvokeVoid(\n\t\tc,\n\t\t\"addPropertyOverride\",\n\t\t[]interface{}{propertyPath, value},\n\t)\n}", "title": "" }, { "docid": "7b2d86f0bfcc603c05aef83994de64a7", "score": "0.7279147", "text": "func (c *jsiiProxy_CfnMember) AddPropertyOverride(propertyPath *string, value interface{}) {\n\t_jsii_.InvokeVoid(\n\t\tc,\n\t\t\"addPropertyOverride\",\n\t\t[]interface{}{propertyPath, value},\n\t)\n}", "title": "" }, { "docid": "9f39b2520215cba5db5e8e0b74af16e3", "score": "0.72779465", "text": "func (c *jsiiProxy_CfnRoute) AddPropertyOverride(propertyPath *string, value interface{}) {\n\t_jsii_.InvokeVoid(\n\t\tc,\n\t\t\"addPropertyOverride\",\n\t\t[]interface{}{propertyPath, value},\n\t)\n}", "title": "" }, { "docid": "9555dd97f420968ec80b3bdc0ddac289", "score": "0.7277615", "text": "func (c *jsiiProxy_CfnLaunchRoleConstraint) AddPropertyOverride(propertyPath *string, value interface{}) {\n\t_jsii_.InvokeVoid(\n\t\tc,\n\t\t\"addPropertyOverride\",\n\t\t[]interface{}{propertyPath, value},\n\t)\n}", "title": "" }, { "docid": "c85c7098fcbb42d255c42dbf0f935db7", "score": "0.72755736", "text": "func (c *jsiiProxy_CfnServiceLinkedRole) AddPropertyOverride(propertyPath *string, value interface{}) {\n\t_jsii_.InvokeVoid(\n\t\tc,\n\t\t\"addPropertyOverride\",\n\t\t[]interface{}{propertyPath, value},\n\t)\n}", "title": "" }, { "docid": "ef78bf73e5bf33044047e0c0c47c12a6", "score": "0.72713524", "text": "func (c *jsiiProxy_CfnCluster) AddPropertyOverride(propertyPath *string, value interface{}) {\n\t_jsii_.InvokeVoid(\n\t\tc,\n\t\t\"addPropertyOverride\",\n\t\t[]interface{}{propertyPath, value},\n\t)\n}", "title": "" }, { "docid": "b037afe12df518f0d75829942a4f2128", "score": "0.7255667", "text": "func (c *jsiiProxy_CfnVpcLink) AddPropertyOverride(propertyPath *string, value interface{}) {\n\t_jsii_.InvokeVoid(\n\t\tc,\n\t\t\"addPropertyOverride\",\n\t\t[]interface{}{propertyPath, value},\n\t)\n}", "title": "" }, { "docid": "df5ed1e96ef807dc3f1352f93d861b0e", "score": "0.72484136", "text": "func (c *jsiiProxy_CfnTagOptionAssociation) AddPropertyOverride(propertyPath *string, value interface{}) {\n\t_jsii_.InvokeVoid(\n\t\tc,\n\t\t\"addPropertyOverride\",\n\t\t[]interface{}{propertyPath, value},\n\t)\n}", "title": "" }, { "docid": "a38600a5aad188db6ec88e4019b66613", "score": "0.72350883", "text": "func (c *jsiiProxy_CfnRouteResponse) AddPropertyOverride(propertyPath *string, value interface{}) {\n\t_jsii_.InvokeVoid(\n\t\tc,\n\t\t\"addPropertyOverride\",\n\t\t[]interface{}{propertyPath, value},\n\t)\n}", "title": "" }, { "docid": "ed7c49b454ff896f95ba8e84f2382fa8", "score": "0.7227595", "text": "func (c *jsiiProxy_CfnMetricStream) AddPropertyOverride(propertyPath *string, value interface{}) {\n\t_jsii_.InvokeVoid(\n\t\tc,\n\t\t\"addPropertyOverride\",\n\t\t[]interface{}{propertyPath, value},\n\t)\n}", "title": "" }, { "docid": "a380a6bafd8d3ccf0931abddbd736981", "score": "0.7216074", "text": "func (c *jsiiProxy_CfnModel) AddPropertyOverride(propertyPath *string, value interface{}) {\n\t_jsii_.InvokeVoid(\n\t\tc,\n\t\t\"addPropertyOverride\",\n\t\t[]interface{}{propertyPath, value},\n\t)\n}", "title": "" }, { "docid": "8a7d43706289a019c5c1ee3fd6c2fcec", "score": "0.72105205", "text": "func (c *jsiiProxy_CfnDomainName) AddPropertyOverride(propertyPath *string, value interface{}) {\n\t_jsii_.InvokeVoid(\n\t\tc,\n\t\t\"addPropertyOverride\",\n\t\t[]interface{}{propertyPath, value},\n\t)\n}", "title": "" }, { "docid": "57a5b71597763fb27985586c2bf69ed8", "score": "0.71946836", "text": "func (c *jsiiProxy_CfnPortfolioShare) AddPropertyOverride(propertyPath *string, value interface{}) {\n\t_jsii_.InvokeVoid(\n\t\tc,\n\t\t\"addPropertyOverride\",\n\t\t[]interface{}{propertyPath, value},\n\t)\n}", "title": "" }, { "docid": "a58d3a0908af1bb25635a873e37f2348", "score": "0.7168962", "text": "func (c *jsiiProxy_CfnDeliveryChannel) AddPropertyOverride(propertyPath *string, value interface{}) {\n\t_jsii_.InvokeVoid(\n\t\tc,\n\t\t\"addPropertyOverride\",\n\t\t[]interface{}{propertyPath, value},\n\t)\n}", "title": "" }, { "docid": "4635219ad1f98aeb63fb483bfc11a886", "score": "0.7161739", "text": "func (c *jsiiProxy_CfnPortfolioProductAssociation) AddPropertyOverride(propertyPath *string, value interface{}) {\n\t_jsii_.InvokeVoid(\n\t\tc,\n\t\t\"addPropertyOverride\",\n\t\t[]interface{}{propertyPath, value},\n\t)\n}", "title": "" }, { "docid": "168255f006cf97073e544a6c5797a75c", "score": "0.7154524", "text": "func (c *jsiiProxy_CfnAggregationAuthorization) AddPropertyOverride(propertyPath *string, value interface{}) {\n\t_jsii_.InvokeVoid(\n\t\tc,\n\t\t\"addPropertyOverride\",\n\t\t[]interface{}{propertyPath, value},\n\t)\n}", "title": "" }, { "docid": "4510b5fbcb0d4369700e93793607538a", "score": "0.7143689", "text": "func (c *jsiiProxy_CfnDataset) AddPropertyOverride(propertyPath *string, value interface{}) {\n\t_jsii_.InvokeVoid(\n\t\tc,\n\t\t\"addPropertyOverride\",\n\t\t[]interface{}{propertyPath, value},\n\t)\n}", "title": "" }, { "docid": "f24efe0d1cbab6af0c0ca84dc4a58918", "score": "0.71306115", "text": "func (c *jsiiProxy_CfnLaunchNotificationConstraint) AddPropertyOverride(propertyPath *string, value interface{}) {\n\t_jsii_.InvokeVoid(\n\t\tc,\n\t\t\"addPropertyOverride\",\n\t\t[]interface{}{propertyPath, value},\n\t)\n}", "title": "" }, { "docid": "b81fca1c92b775ef171e47a055d824b4", "score": "0.70878905", "text": "func (c *jsiiProxy_CfnStackSetConstraint) AddPropertyOverride(propertyPath *string, value interface{}) {\n\t_jsii_.InvokeVoid(\n\t\tc,\n\t\t\"addPropertyOverride\",\n\t\t[]interface{}{propertyPath, value},\n\t)\n}", "title": "" }, { "docid": "f9e7045554e04b31a96f9e4acd6ba5d3", "score": "0.7071595", "text": "func (c *jsiiProxy_CfnNodegroup) AddPropertyOverride(propertyPath *string, value interface{}) {\n\t_jsii_.InvokeVoid(\n\t\tc,\n\t\t\"addPropertyOverride\",\n\t\t[]interface{}{propertyPath, value},\n\t)\n}", "title": "" }, { "docid": "b24e5bb3a3c1c35ea644c5543c46fa81", "score": "0.70418614", "text": "func (c *jsiiProxy_CfnPortfolio) AddPropertyOverride(propertyPath *string, value interface{}) {\n\t_jsii_.InvokeVoid(\n\t\tc,\n\t\t\"addPropertyOverride\",\n\t\t[]interface{}{propertyPath, value},\n\t)\n}", "title": "" }, { "docid": "e1e4700c20901f8dd30dfb734c988f16", "score": "0.7039357", "text": "func (c *jsiiProxy_CfnAcceptedPortfolioShare) AddPropertyOverride(propertyPath *string, value interface{}) {\n\t_jsii_.InvokeVoid(\n\t\tc,\n\t\t\"addPropertyOverride\",\n\t\t[]interface{}{propertyPath, value},\n\t)\n}", "title": "" }, { "docid": "cae12210e3972128f5dfff6f25cbf3e9", "score": "0.70368654", "text": "func (c *jsiiProxy_CfnDeliveryStream) AddPropertyOverride(propertyPath *string, value interface{}) {\n\t_jsii_.InvokeVoid(\n\t\tc,\n\t\t\"addPropertyOverride\",\n\t\t[]interface{}{propertyPath, value},\n\t)\n}", "title": "" }, { "docid": "05f0ecf7201c0cb592c7589bbf73e32f", "score": "0.70357525", "text": "func (c *jsiiProxy_CfnLaunchTemplateConstraint) AddPropertyOverride(propertyPath *string, value interface{}) {\n\t_jsii_.InvokeVoid(\n\t\tc,\n\t\t\"addPropertyOverride\",\n\t\t[]interface{}{propertyPath, value},\n\t)\n}", "title": "" }, { "docid": "0b2c50fe1e14674756c7ee181759a953", "score": "0.6934079", "text": "func (c *jsiiProxy_CfnRegexPatternSet) AddPropertyOverride(propertyPath *string, value interface{}) {\n\t_jsii_.InvokeVoid(\n\t\tc,\n\t\t\"addPropertyOverride\",\n\t\t[]interface{}{propertyPath, value},\n\t)\n}", "title": "" }, { "docid": "ba32eee06a738d41ceb1b0e80f50b2a8", "score": "0.69322485", "text": "func (c *jsiiProxy_CfnPortfolioPrincipalAssociation) AddPropertyOverride(propertyPath *string, value interface{}) {\n\t_jsii_.InvokeVoid(\n\t\tc,\n\t\t\"addPropertyOverride\",\n\t\t[]interface{}{propertyPath, value},\n\t)\n}", "title": "" }, { "docid": "a585aa8ed4c84a0278b3e6494b3cb6d0", "score": "0.69052404", "text": "func (c *jsiiProxy_CfnUserToGroupAddition) AddPropertyOverride(propertyPath *string, value interface{}) {\n\t_jsii_.InvokeVoid(\n\t\tc,\n\t\t\"addPropertyOverride\",\n\t\t[]interface{}{propertyPath, value},\n\t)\n}", "title": "" }, { "docid": "60f56f28abba5a4e4a4075ac8a82d352", "score": "0.6800287", "text": "func (c *jsiiProxy_CfnResolverQueryLoggingConfigAssociation) AddPropertyOverride(propertyPath *string, value interface{}) {\n\t_jsii_.InvokeVoid(\n\t\tc,\n\t\t\"addPropertyOverride\",\n\t\t[]interface{}{propertyPath, value},\n\t)\n}", "title": "" }, { "docid": "6186459825e0f29bd0893925c5656dd0", "score": "0.6793006", "text": "func (c *jsiiProxy_CfnVirtualMFADevice) AddPropertyOverride(propertyPath *string, value interface{}) {\n\t_jsii_.InvokeVoid(\n\t\tc,\n\t\t\"addPropertyOverride\",\n\t\t[]interface{}{propertyPath, value},\n\t)\n}", "title": "" }, { "docid": "d2e22ac8c8b09ab3bbb521fb745725d6", "score": "0.67662627", "text": "func (c *jsiiProxy_CfnFirewallDomainList) AddPropertyOverride(propertyPath *string, value interface{}) {\n\t_jsii_.InvokeVoid(\n\t\tc,\n\t\t\"addPropertyOverride\",\n\t\t[]interface{}{propertyPath, value},\n\t)\n}", "title": "" }, { "docid": "366a5590346c31bc800977a8afb3f5ea", "score": "0.67420787", "text": "func (c *jsiiProxy_CfnResolverQueryLoggingConfig) AddPropertyOverride(propertyPath *string, value interface{}) {\n\t_jsii_.InvokeVoid(\n\t\tc,\n\t\t\"addPropertyOverride\",\n\t\t[]interface{}{propertyPath, value},\n\t)\n}", "title": "" }, { "docid": "733b28952e6e6ebd8247f3c952f041ce", "score": "0.6711054", "text": "func (c *jsiiProxy_CfnStoredQuery) AddPropertyOverride(propertyPath *string, value interface{}) {\n\t_jsii_.InvokeVoid(\n\t\tc,\n\t\t\"addPropertyOverride\",\n\t\t[]interface{}{propertyPath, value},\n\t)\n}", "title": "" }, { "docid": "8e28fa080f976448428dd132cd8ed40c", "score": "0.6621076", "text": "func (c *jsiiProxy_CfnResourceUpdateConstraint) AddPropertyDeletionOverride(propertyPath *string) {\n\t_jsii_.InvokeVoid(\n\t\tc,\n\t\t\"addPropertyDeletionOverride\",\n\t\t[]interface{}{propertyPath},\n\t)\n}", "title": "" }, { "docid": "62ac64ce2dbf6c7718262bbc30cac47b", "score": "0.6474703", "text": "func (c *jsiiProxy_CfnOIDCProvider) AddPropertyDeletionOverride(propertyPath *string) {\n\t_jsii_.InvokeVoid(\n\t\tc,\n\t\t\"addPropertyDeletionOverride\",\n\t\t[]interface{}{propertyPath},\n\t)\n}", "title": "" }, { "docid": "538c0614dad4733ce1856a3b4134325c", "score": "0.64657825", "text": "func (c *jsiiProxy_CfnPolicy) AddPropertyDeletionOverride(propertyPath *string) {\n\t_jsii_.InvokeVoid(\n\t\tc,\n\t\t\"addPropertyDeletionOverride\",\n\t\t[]interface{}{propertyPath},\n\t)\n}", "title": "" }, { "docid": "121d13d08b687d5bab0ba6ed6937f348", "score": "0.64214635", "text": "func (c *jsiiProxy_CfnAddon) AddPropertyDeletionOverride(propertyPath *string) {\n\t_jsii_.InvokeVoid(\n\t\tc,\n\t\t\"addPropertyDeletionOverride\",\n\t\t[]interface{}{propertyPath},\n\t)\n}", "title": "" }, { "docid": "9e5774ef24f31defaa9846a5e0c256e5", "score": "0.6408236", "text": "func (c *jsiiProxy_CfnAuthorizer) AddPropertyDeletionOverride(propertyPath *string) {\n\t_jsii_.InvokeVoid(\n\t\tc,\n\t\t\"addPropertyDeletionOverride\",\n\t\t[]interface{}{propertyPath},\n\t)\n}", "title": "" }, { "docid": "f10f9c806e9d78f3f89c90a9619c2864", "score": "0.64011407", "text": "func (c *jsiiProxy_CfnCloudFormationProduct) AddPropertyDeletionOverride(propertyPath *string) {\n\t_jsii_.InvokeVoid(\n\t\tc,\n\t\t\"addPropertyDeletionOverride\",\n\t\t[]interface{}{propertyPath},\n\t)\n}", "title": "" }, { "docid": "1556f8c807d1cf869959eda98bd67a71", "score": "0.63765633", "text": "func (c *jsiiProxy_CfnInsightRule) AddPropertyDeletionOverride(propertyPath *string) {\n\t_jsii_.InvokeVoid(\n\t\tc,\n\t\t\"addPropertyDeletionOverride\",\n\t\t[]interface{}{propertyPath},\n\t)\n}", "title": "" }, { "docid": "098d68590b1322799c594a9258aa57c5", "score": "0.6343477", "text": "func (c *jsiiProxy_CfnCloudFormationProvisionedProduct) AddPropertyDeletionOverride(propertyPath *string) {\n\t_jsii_.InvokeVoid(\n\t\tc,\n\t\t\"addPropertyDeletionOverride\",\n\t\t[]interface{}{propertyPath},\n\t)\n}", "title": "" }, { "docid": "5ce1cffe9fe260ca8920ece5af93711d", "score": "0.63291466", "text": "func (c *jsiiProxy_CfnAlarm) AddPropertyDeletionOverride(propertyPath *string) {\n\t_jsii_.InvokeVoid(\n\t\tc,\n\t\t\"addPropertyDeletionOverride\",\n\t\t[]interface{}{propertyPath},\n\t)\n}", "title": "" }, { "docid": "576a6b3c3d2c1f7b1799bad0c3e0ca0c", "score": "0.63124084", "text": "func (c *jsiiProxy_CfnApiGatewayManagedOverrides) AddPropertyDeletionOverride(propertyPath *string) {\n\t_jsii_.InvokeVoid(\n\t\tc,\n\t\t\"addPropertyDeletionOverride\",\n\t\t[]interface{}{propertyPath},\n\t)\n}", "title": "" }, { "docid": "325255875810c9d367bd2192bcb4c826", "score": "0.63044316", "text": "func (c *jsiiProxy_CfnFargateProfile) AddPropertyDeletionOverride(propertyPath *string) {\n\t_jsii_.InvokeVoid(\n\t\tc,\n\t\t\"addPropertyDeletionOverride\",\n\t\t[]interface{}{propertyPath},\n\t)\n}", "title": "" }, { "docid": "7b47135faf8ff278ae17e16fa54bc523", "score": "0.63037103", "text": "func (c *jsiiProxy_CfnPipeline) AddPropertyDeletionOverride(propertyPath *string) {\n\t_jsii_.InvokeVoid(\n\t\tc,\n\t\t\"addPropertyDeletionOverride\",\n\t\t[]interface{}{propertyPath},\n\t)\n}", "title": "" } ]
39fa3b67770ed5f00e3e2f4061146d6e
MarshalFields encodes the AWS API shape using the passed in protocol encoder.
[ { "docid": "c794ebc7336327df7f37a9914beba22f", "score": "0.0", "text": "func (s DescribeJobExecutionInput) MarshalFields(e protocol.FieldEncoder) error {\n\n\tif s.JobId != nil {\n\t\tv := *s.JobId\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.PathTarget, \"jobId\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\tif s.ThingName != nil {\n\t\tv := *s.ThingName\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.PathTarget, \"thingName\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\tif s.ExecutionNumber != nil {\n\t\tv := *s.ExecutionNumber\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.QueryTarget, \"executionNumber\", protocol.Int64Value(v), metadata)\n\t}\n\tif s.IncludeJobDocument != nil {\n\t\tv := *s.IncludeJobDocument\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.QueryTarget, \"includeJobDocument\", protocol.BoolValue(v), metadata)\n\t}\n\treturn nil\n}", "title": "" } ]
[ { "docid": "73ca9b9cab01046c72be539540de8fed", "score": "0.65665513", "text": "func (s InputService3TestShapeSubStructure) MarshalFields(e protocol.FieldEncoder) error {\n\tif s.Bar != nil {\n\t\tv := *s.Bar\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"Bar\", protocol.StringValue(v), metadata)\n\t}\n\tif s.Foo != nil {\n\t\tv := *s.Foo\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"Foo\", protocol.StringValue(v), metadata)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "7eb15ba3c1d525b21d875b980dd3a0ab", "score": "0.65615827", "text": "func (s InputService4TestShapeSubStructure) MarshalFields(e protocol.FieldEncoder) error {\n\tif s.Bar != nil {\n\t\tv := *s.Bar\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"Bar\", protocol.StringValue(v), metadata)\n\t}\n\tif s.Foo != nil {\n\t\tv := *s.Foo\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"Foo\", protocol.StringValue(v), metadata)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "c4150e7384334c2d823d5d7d05b4b07f", "score": "0.6449835", "text": "func (s InputService10TestShapeStructureShape) MarshalFields(e protocol.FieldEncoder) error {\n\tif s.B != nil {\n\t\tv := s.B\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"b\", protocol.BytesValue(v), metadata)\n\t}\n\tif s.T != nil {\n\t\tv := *s.T\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"t\", protocol.TimeValue{V: v, Format: protocol.ISO8601TimeFormat}, metadata)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "38121d78686235de8b36acb6cff5b58d", "score": "0.63476956", "text": "func (s InputService18TestShapeFooShape) MarshalFields(e protocol.FieldEncoder) error {\n\tif s.Baz != nil {\n\t\tv := *s.Baz\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"baz\", protocol.StringValue(v), metadata)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "32d5ae7af6ee75312249012f7c5f4e3d", "score": "0.6345885", "text": "func (s UpdateFlowOutputInput) MarshalFields(e protocol.FieldEncoder) error {\n\te.SetValue(protocol.HeaderTarget, \"Content-Type\", protocol.StringValue(\"application/json\"), protocol.Metadata{})\n\n\tif s.CidrAllowList != nil {\n\t\tv := s.CidrAllowList\n\n\t\tmetadata := protocol.Metadata{}\n\t\tls0 := e.List(protocol.BodyTarget, \"cidrAllowList\", metadata)\n\t\tls0.Start()\n\t\tfor _, v1 := range v {\n\t\t\tls0.ListAddValue(protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v1)})\n\t\t}\n\t\tls0.End()\n\n\t}\n\tif s.Description != nil {\n\t\tv := *s.Description\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"description\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\tif s.Destination != nil {\n\t\tv := *s.Destination\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"destination\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\tif s.Encryption != nil {\n\t\tv := s.Encryption\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetFields(protocol.BodyTarget, \"encryption\", v, metadata)\n\t}\n\tif s.MaxLatency != nil {\n\t\tv := *s.MaxLatency\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"maxLatency\", protocol.Int64Value(v), metadata)\n\t}\n\tif s.Port != nil {\n\t\tv := *s.Port\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"port\", protocol.Int64Value(v), metadata)\n\t}\n\tif len(s.Protocol) > 0 {\n\t\tv := s.Protocol\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"protocol\", protocol.QuotedValue{ValueMarshaler: v}, metadata)\n\t}\n\tif s.RemoteId != nil {\n\t\tv := *s.RemoteId\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"remoteId\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\tif s.SmoothingLatency != nil {\n\t\tv := *s.SmoothingLatency\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"smoothingLatency\", protocol.Int64Value(v), metadata)\n\t}\n\tif s.StreamId != nil {\n\t\tv := *s.StreamId\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"streamId\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\tif s.VpcInterfaceAttachment != nil {\n\t\tv := s.VpcInterfaceAttachment\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetFields(protocol.BodyTarget, \"vpcInterfaceAttachment\", v, metadata)\n\t}\n\tif s.FlowArn != nil {\n\t\tv := *s.FlowArn\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.PathTarget, \"flowArn\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\tif s.OutputArn != nil {\n\t\tv := *s.OutputArn\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.PathTarget, \"outputArn\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "f63b3ae271c2922490c4a28f543209a6", "score": "0.6273051", "text": "func (s CreateFunctionInput) MarshalFields(e protocol.FieldEncoder) error {\n\te.SetValue(protocol.HeaderTarget, \"Content-Type\", protocol.StringValue(\"application/json\"), protocol.Metadata{})\n\n\tif s.Code != nil {\n\t\tv := s.Code\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetFields(protocol.BodyTarget, \"Code\", v, metadata)\n\t}\n\tif s.DeadLetterConfig != nil {\n\t\tv := s.DeadLetterConfig\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetFields(protocol.BodyTarget, \"DeadLetterConfig\", v, metadata)\n\t}\n\tif s.Description != nil {\n\t\tv := *s.Description\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"Description\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\tif s.Environment != nil {\n\t\tv := s.Environment\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetFields(protocol.BodyTarget, \"Environment\", v, metadata)\n\t}\n\tif s.FunctionName != nil {\n\t\tv := *s.FunctionName\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"FunctionName\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\tif s.Handler != nil {\n\t\tv := *s.Handler\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"Handler\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\tif s.KMSKeyArn != nil {\n\t\tv := *s.KMSKeyArn\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"KMSKeyArn\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\tif s.Layers != nil {\n\t\tv := s.Layers\n\n\t\tmetadata := protocol.Metadata{}\n\t\tls0 := e.List(protocol.BodyTarget, \"Layers\", metadata)\n\t\tls0.Start()\n\t\tfor _, v1 := range v {\n\t\t\tls0.ListAddValue(protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v1)})\n\t\t}\n\t\tls0.End()\n\n\t}\n\tif s.MemorySize != nil {\n\t\tv := *s.MemorySize\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"MemorySize\", protocol.Int64Value(v), metadata)\n\t}\n\tif s.Publish != nil {\n\t\tv := *s.Publish\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"Publish\", protocol.BoolValue(v), metadata)\n\t}\n\tif s.Role != nil {\n\t\tv := *s.Role\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"Role\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\tif len(s.Runtime) > 0 {\n\t\tv := s.Runtime\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"Runtime\", protocol.QuotedValue{ValueMarshaler: v}, metadata)\n\t}\n\tif s.Tags != nil {\n\t\tv := s.Tags\n\n\t\tmetadata := protocol.Metadata{}\n\t\tms0 := e.Map(protocol.BodyTarget, \"Tags\", metadata)\n\t\tms0.Start()\n\t\tfor k1, v1 := range v {\n\t\t\tms0.MapSetValue(k1, protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v1)})\n\t\t}\n\t\tms0.End()\n\n\t}\n\tif s.Timeout != nil {\n\t\tv := *s.Timeout\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"Timeout\", protocol.Int64Value(v), metadata)\n\t}\n\tif s.TracingConfig != nil {\n\t\tv := s.TracingConfig\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetFields(protocol.BodyTarget, \"TracingConfig\", v, metadata)\n\t}\n\tif s.VpcConfig != nil {\n\t\tv := s.VpcConfig\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetFields(protocol.BodyTarget, \"VpcConfig\", v, metadata)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "a537451784263aac27660509e2cc9187", "score": "0.61108416", "text": "func (s InvokeEndpointInput) MarshalFields(e protocol.FieldEncoder) error {\n\n\tif s.Accept != nil {\n\t\tv := *s.Accept\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.HeaderTarget, \"Accept\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\tif s.ContentType != nil {\n\t\tv := *s.ContentType\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.HeaderTarget, \"Content-Type\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\tif s.EndpointName != nil {\n\t\tv := *s.EndpointName\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.PathTarget, \"EndpointName\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\tif s.Body != nil {\n\t\tv := s.Body\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetStream(protocol.PayloadTarget, \"Body\", protocol.BytesStream(v), metadata)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "a3d058cbebba86f7179c8604b1fcc2da", "score": "0.6095838", "text": "func (s InputSerialization) MarshalFields(e protocol.FieldEncoder) error {\n\tif s.CSV != nil {\n\t\tv := s.CSV\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetFields(protocol.BodyTarget, \"CSV\", v, metadata)\n\t}\n\tif len(s.CompressionType) > 0 {\n\t\tv := s.CompressionType\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"CompressionType\", v, metadata)\n\t}\n\tif s.JSON != nil {\n\t\tv := s.JSON\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetFields(protocol.BodyTarget, \"JSON\", v, metadata)\n\t}\n\tif s.Parquet != nil {\n\t\tv := s.Parquet\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetFields(protocol.BodyTarget, \"Parquet\", v, metadata)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "cd1ba99417004941ff3f9823ca68e90a", "score": "0.6067071", "text": "func (s InvokeEndpointOutput) MarshalFields(e protocol.FieldEncoder) error {\n\tif s.ContentType != nil {\n\t\tv := *s.ContentType\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.HeaderTarget, \"Content-Type\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\tif s.InvokedProductionVariant != nil {\n\t\tv := *s.InvokedProductionVariant\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.HeaderTarget, \"x-Amzn-Invoked-Production-Variant\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\tif s.Body != nil {\n\t\tv := s.Body\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetStream(protocol.PayloadTarget, \"Body\", protocol.BytesStream(v), metadata)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "9d0297692590464dfd9be6224fef90c3", "score": "0.6012219", "text": "func (s PutMethodResponseInput) MarshalFields(e protocol.FieldEncoder) error {\n\te.SetValue(protocol.HeaderTarget, \"Content-Type\", protocol.StringValue(\"application/json\"), protocol.Metadata{})\n\n\tif s.ResponseModels != nil {\n\t\tv := s.ResponseModels\n\n\t\tmetadata := protocol.Metadata{}\n\t\tms0 := e.Map(protocol.BodyTarget, \"responseModels\", metadata)\n\t\tms0.Start()\n\t\tfor k1, v1 := range v {\n\t\t\tms0.MapSetValue(k1, protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v1)})\n\t\t}\n\t\tms0.End()\n\n\t}\n\tif s.ResponseParameters != nil {\n\t\tv := s.ResponseParameters\n\n\t\tmetadata := protocol.Metadata{}\n\t\tms0 := e.Map(protocol.BodyTarget, \"responseParameters\", metadata)\n\t\tms0.Start()\n\t\tfor k1, v1 := range v {\n\t\t\tms0.MapSetValue(k1, protocol.BoolValue(v1))\n\t\t}\n\t\tms0.End()\n\n\t}\n\tif s.HttpMethod != nil {\n\t\tv := *s.HttpMethod\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.PathTarget, \"http_method\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\tif s.ResourceId != nil {\n\t\tv := *s.ResourceId\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.PathTarget, \"resource_id\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\tif s.RestApiId != nil {\n\t\tv := *s.RestApiId\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.PathTarget, \"restapi_id\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\tif s.StatusCode != nil {\n\t\tv := *s.StatusCode\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.PathTarget, \"status_code\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "bebd67f9025c5210479c7094ec9abed5", "score": "0.5985911", "text": "func (s CreateFacetInput) MarshalFields(e protocol.FieldEncoder) error {\n\te.SetValue(protocol.HeaderTarget, \"Content-Type\", protocol.StringValue(\"application/json\"), protocol.Metadata{})\n\n\tif s.Attributes != nil {\n\t\tv := s.Attributes\n\n\t\tmetadata := protocol.Metadata{}\n\t\tls0 := e.List(protocol.BodyTarget, \"Attributes\", metadata)\n\t\tls0.Start()\n\t\tfor _, v1 := range v {\n\t\t\tls0.ListAddFields(v1)\n\t\t}\n\t\tls0.End()\n\n\t}\n\tif len(s.FacetStyle) > 0 {\n\t\tv := s.FacetStyle\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"FacetStyle\", protocol.QuotedValue{ValueMarshaler: v}, metadata)\n\t}\n\tif s.Name != nil {\n\t\tv := *s.Name\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"Name\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\tif len(s.ObjectType) > 0 {\n\t\tv := s.ObjectType\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"ObjectType\", protocol.QuotedValue{ValueMarshaler: v}, metadata)\n\t}\n\tif s.SchemaArn != nil {\n\t\tv := *s.SchemaArn\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.HeaderTarget, \"x-amz-data-partition\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "779b1ec9e00588547820062e7811e953", "score": "0.5977689", "text": "func (s CreateFunctionOutput) MarshalFields(e protocol.FieldEncoder) error {\n\tif s.CodeSha256 != nil {\n\t\tv := *s.CodeSha256\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"CodeSha256\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\tif s.CodeSize != nil {\n\t\tv := *s.CodeSize\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"CodeSize\", protocol.Int64Value(v), metadata)\n\t}\n\tif s.DeadLetterConfig != nil {\n\t\tv := s.DeadLetterConfig\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetFields(protocol.BodyTarget, \"DeadLetterConfig\", v, metadata)\n\t}\n\tif s.Description != nil {\n\t\tv := *s.Description\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"Description\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\tif s.Environment != nil {\n\t\tv := s.Environment\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetFields(protocol.BodyTarget, \"Environment\", v, metadata)\n\t}\n\tif s.FunctionArn != nil {\n\t\tv := *s.FunctionArn\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"FunctionArn\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\tif s.FunctionName != nil {\n\t\tv := *s.FunctionName\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"FunctionName\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\tif s.Handler != nil {\n\t\tv := *s.Handler\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"Handler\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\tif s.KMSKeyArn != nil {\n\t\tv := *s.KMSKeyArn\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"KMSKeyArn\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\tif s.LastModified != nil {\n\t\tv := *s.LastModified\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"LastModified\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\tif len(s.LastUpdateStatus) > 0 {\n\t\tv := s.LastUpdateStatus\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"LastUpdateStatus\", protocol.QuotedValue{ValueMarshaler: v}, metadata)\n\t}\n\tif s.LastUpdateStatusReason != nil {\n\t\tv := *s.LastUpdateStatusReason\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"LastUpdateStatusReason\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\tif len(s.LastUpdateStatusReasonCode) > 0 {\n\t\tv := s.LastUpdateStatusReasonCode\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"LastUpdateStatusReasonCode\", protocol.QuotedValue{ValueMarshaler: v}, metadata)\n\t}\n\tif s.Layers != nil {\n\t\tv := s.Layers\n\n\t\tmetadata := protocol.Metadata{}\n\t\tls0 := e.List(protocol.BodyTarget, \"Layers\", metadata)\n\t\tls0.Start()\n\t\tfor _, v1 := range v {\n\t\t\tls0.ListAddFields(v1)\n\t\t}\n\t\tls0.End()\n\n\t}\n\tif s.MasterArn != nil {\n\t\tv := *s.MasterArn\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"MasterArn\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\tif s.MemorySize != nil {\n\t\tv := *s.MemorySize\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"MemorySize\", protocol.Int64Value(v), metadata)\n\t}\n\tif s.RevisionId != nil {\n\t\tv := *s.RevisionId\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"RevisionId\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\tif s.Role != nil {\n\t\tv := *s.Role\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"Role\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\tif len(s.Runtime) > 0 {\n\t\tv := s.Runtime\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"Runtime\", protocol.QuotedValue{ValueMarshaler: v}, metadata)\n\t}\n\tif len(s.State) > 0 {\n\t\tv := s.State\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"State\", protocol.QuotedValue{ValueMarshaler: v}, metadata)\n\t}\n\tif s.StateReason != nil {\n\t\tv := *s.StateReason\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"StateReason\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\tif len(s.StateReasonCode) > 0 {\n\t\tv := s.StateReasonCode\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"StateReasonCode\", protocol.QuotedValue{ValueMarshaler: v}, metadata)\n\t}\n\tif s.Timeout != nil {\n\t\tv := *s.Timeout\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"Timeout\", protocol.Int64Value(v), metadata)\n\t}\n\tif s.TracingConfig != nil {\n\t\tv := s.TracingConfig\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetFields(protocol.BodyTarget, \"TracingConfig\", v, metadata)\n\t}\n\tif s.Version != nil {\n\t\tv := *s.Version\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"Version\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\tif s.VpcConfig != nil {\n\t\tv := s.VpcConfig\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetFields(protocol.BodyTarget, \"VpcConfig\", v, metadata)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "ca3902ba00f07eb7a8ef0692a93e7165", "score": "0.59694713", "text": "func (s PutIntegrationResponseInput) MarshalFields(e protocol.FieldEncoder) error {\n\te.SetValue(protocol.HeaderTarget, \"Content-Type\", protocol.StringValue(\"application/json\"), protocol.Metadata{})\n\n\tif len(s.ContentHandling) > 0 {\n\t\tv := s.ContentHandling\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"contentHandling\", protocol.QuotedValue{ValueMarshaler: v}, metadata)\n\t}\n\tif s.ResponseParameters != nil {\n\t\tv := s.ResponseParameters\n\n\t\tmetadata := protocol.Metadata{}\n\t\tms0 := e.Map(protocol.BodyTarget, \"responseParameters\", metadata)\n\t\tms0.Start()\n\t\tfor k1, v1 := range v {\n\t\t\tms0.MapSetValue(k1, protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v1)})\n\t\t}\n\t\tms0.End()\n\n\t}\n\tif s.ResponseTemplates != nil {\n\t\tv := s.ResponseTemplates\n\n\t\tmetadata := protocol.Metadata{}\n\t\tms0 := e.Map(protocol.BodyTarget, \"responseTemplates\", metadata)\n\t\tms0.Start()\n\t\tfor k1, v1 := range v {\n\t\t\tms0.MapSetValue(k1, protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v1)})\n\t\t}\n\t\tms0.End()\n\n\t}\n\tif s.SelectionPattern != nil {\n\t\tv := *s.SelectionPattern\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"selectionPattern\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\tif s.HttpMethod != nil {\n\t\tv := *s.HttpMethod\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.PathTarget, \"http_method\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\tif s.ResourceId != nil {\n\t\tv := *s.ResourceId\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.PathTarget, \"resource_id\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\tif s.RestApiId != nil {\n\t\tv := *s.RestApiId\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.PathTarget, \"restapi_id\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\tif s.StatusCode != nil {\n\t\tv := *s.StatusCode\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.PathTarget, \"status_code\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "1b39288397695f238ae0af27ac78bd9c", "score": "0.5968039", "text": "func (s UpdateFunctionCodeInput) MarshalFields(e protocol.FieldEncoder) error {\n\te.SetValue(protocol.HeaderTarget, \"Content-Type\", protocol.StringValue(\"application/json\"), protocol.Metadata{})\n\n\tif s.DryRun != nil {\n\t\tv := *s.DryRun\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"DryRun\", protocol.BoolValue(v), metadata)\n\t}\n\tif s.Publish != nil {\n\t\tv := *s.Publish\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"Publish\", protocol.BoolValue(v), metadata)\n\t}\n\tif s.RevisionId != nil {\n\t\tv := *s.RevisionId\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"RevisionId\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\tif s.S3Bucket != nil {\n\t\tv := *s.S3Bucket\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"S3Bucket\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\tif s.S3Key != nil {\n\t\tv := *s.S3Key\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"S3Key\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\tif s.S3ObjectVersion != nil {\n\t\tv := *s.S3ObjectVersion\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"S3ObjectVersion\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\tif s.ZipFile != nil {\n\t\tv := s.ZipFile\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"ZipFile\", protocol.QuotedValue{ValueMarshaler: protocol.BytesValue(v)}, metadata)\n\t}\n\tif s.FunctionName != nil {\n\t\tv := *s.FunctionName\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.PathTarget, \"FunctionName\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "75907178b0048f49deb3c36703817121", "score": "0.5933884", "text": "func (s GetSchemaAsJsonInput) MarshalFields(e protocol.FieldEncoder) error {\n\te.SetValue(protocol.HeaderTarget, \"Content-Type\", protocol.StringValue(\"application/json\"), protocol.Metadata{})\n\n\tif s.SchemaArn != nil {\n\t\tv := *s.SchemaArn\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.HeaderTarget, \"x-amz-data-partition\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "8da9f81087b75b8cfb6e8858bb32b28a", "score": "0.5932063", "text": "func (s InputService18TestShapeInputService18TestCaseOperation4Input) MarshalFields(e protocol.FieldEncoder) error {\n\n\tif s.Foo != nil {\n\t\tv := s.Foo\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetFields(protocol.PayloadTarget, \"foo\", v, metadata)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "7dd25551024f2b6bf87965f9d52f94e4", "score": "0.5914896", "text": "func (s GetSchemaAsJsonOutput) MarshalFields(e protocol.FieldEncoder) error {\n\tif s.Document != nil {\n\t\tv := *s.Document\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"Document\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\tif s.Name != nil {\n\t\tv := *s.Name\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"Name\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "66a662a2283b0762cacee8fa2b400ea7", "score": "0.5897871", "text": "func (s InputService4TestShapeInputService4TestCaseOperation1Input) MarshalFields(e protocol.FieldEncoder) error {\n\n\te.SetFields(protocol.BodyTarget, \"OperationRequest\", protocol.FieldMarshalerFunc(func(e protocol.FieldEncoder) error {\n\t\tif s.Description != nil {\n\t\t\tv := *s.Description\n\n\t\t\tmetadata := protocol.Metadata{}\n\t\t\te.SetValue(protocol.BodyTarget, \"Description\", protocol.StringValue(v), metadata)\n\t\t}\n\t\tif s.SubStructure != nil {\n\t\t\tv := s.SubStructure\n\n\t\t\tmetadata := protocol.Metadata{}\n\t\t\te.SetFields(protocol.BodyTarget, \"SubStructure\", v, metadata)\n\t\t}\n\t\treturn nil\n\t}), protocol.Metadata{XMLNamespaceURI: \"https://foo/\"})\n\treturn nil\n}", "title": "" }, { "docid": "8fbe71aba7928b9b476b5688aeae25c5", "score": "0.58953464", "text": "func (s Channel) MarshalFields(e protocol.FieldEncoder) error {\n\tif s.Arn != nil {\n\t\tv := *s.Arn\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"arn\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\tif s.IngestEndpoint != nil {\n\t\tv := *s.IngestEndpoint\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"ingestEndpoint\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\tif len(s.LatencyMode) > 0 {\n\t\tv := s.LatencyMode\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"latencyMode\", protocol.QuotedValue{ValueMarshaler: v}, metadata)\n\t}\n\tif s.Name != nil {\n\t\tv := *s.Name\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"name\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\tif s.PlaybackUrl != nil {\n\t\tv := *s.PlaybackUrl\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"playbackUrl\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\tif s.Tags != nil {\n\t\tv := s.Tags\n\n\t\tmetadata := protocol.Metadata{}\n\t\tms0 := e.Map(protocol.BodyTarget, \"tags\", metadata)\n\t\tms0.Start()\n\t\tfor k1, v1 := range v {\n\t\t\tms0.MapSetValue(k1, protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v1)})\n\t\t}\n\t\tms0.End()\n\n\t}\n\tif len(s.Type) > 0 {\n\t\tv := s.Type\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"type\", protocol.QuotedValue{ValueMarshaler: v}, metadata)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "f59a25ba0a4d54763795ba902450ebc2", "score": "0.5881657", "text": "func (s UploadPartInput) MarshalFields(e protocol.FieldEncoder) error {\n\n\tif s.ContentLength != nil {\n\t\tv := *s.ContentLength\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.HeaderTarget, \"Content-Length\", protocol.Int64Value(v), metadata)\n\t}\n\tif s.ContentMD5 != nil {\n\t\tv := *s.ContentMD5\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.HeaderTarget, \"Content-MD5\", protocol.StringValue(v), metadata)\n\t}\n\tif len(s.RequestPayer) > 0 {\n\t\tv := s.RequestPayer\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.HeaderTarget, \"x-amz-request-payer\", v, metadata)\n\t}\n\tif s.SSECustomerAlgorithm != nil {\n\t\tv := *s.SSECustomerAlgorithm\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.HeaderTarget, \"x-amz-server-side-encryption-customer-algorithm\", protocol.StringValue(v), metadata)\n\t}\n\tif s.SSECustomerKey != nil {\n\t\tv := *s.SSECustomerKey\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.HeaderTarget, \"x-amz-server-side-encryption-customer-key\", protocol.StringValue(v), metadata)\n\t}\n\tif s.SSECustomerKeyMD5 != nil {\n\t\tv := *s.SSECustomerKeyMD5\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.HeaderTarget, \"x-amz-server-side-encryption-customer-key-MD5\", protocol.StringValue(v), metadata)\n\t}\n\tif s.Bucket != nil {\n\t\tv := *s.Bucket\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.PathTarget, \"Bucket\", protocol.StringValue(v), metadata)\n\t}\n\tif s.Key != nil {\n\t\tv := *s.Key\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.PathTarget, \"Key\", protocol.StringValue(v), metadata)\n\t}\n\tif s.Body != nil {\n\t\tv := s.Body\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetStream(protocol.PayloadTarget, \"Body\", protocol.ReadSeekerStream{V: v}, metadata)\n\t}\n\tif s.PartNumber != nil {\n\t\tv := *s.PartNumber\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.QueryTarget, \"partNumber\", protocol.Int64Value(v), metadata)\n\t}\n\tif s.UploadId != nil {\n\t\tv := *s.UploadId\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.QueryTarget, \"uploadId\", protocol.StringValue(v), metadata)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "076ecb241f7d1bddd249780b5d69c15b", "score": "0.5869871", "text": "func (s PublishSchemaInput) MarshalFields(e protocol.FieldEncoder) error {\n\te.SetValue(protocol.HeaderTarget, \"Content-Type\", protocol.StringValue(\"application/json\"), protocol.Metadata{})\n\n\tif s.MinorVersion != nil {\n\t\tv := *s.MinorVersion\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"MinorVersion\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\tif s.Name != nil {\n\t\tv := *s.Name\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"Name\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\tif s.Version != nil {\n\t\tv := *s.Version\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"Version\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\tif s.DevelopmentSchemaArn != nil {\n\t\tv := *s.DevelopmentSchemaArn\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.HeaderTarget, \"x-amz-data-partition\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "270e452d11395063b0f299e7f882a840", "score": "0.58528084", "text": "func (s OutputSerialization) MarshalFields(e protocol.FieldEncoder) error {\n\tif s.CSV != nil {\n\t\tv := s.CSV\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetFields(protocol.BodyTarget, \"CSV\", v, metadata)\n\t}\n\tif s.JSON != nil {\n\t\tv := s.JSON\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetFields(protocol.BodyTarget, \"JSON\", v, metadata)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "fa1c7d41bfead71a988421a0560a3c8f", "score": "0.582563", "text": "func (s TestInvokeAuthorizerInput) MarshalFields(e protocol.FieldEncoder) error {\n\te.SetValue(protocol.HeaderTarget, \"Content-Type\", protocol.StringValue(\"application/json\"), protocol.Metadata{})\n\n\tif s.AdditionalContext != nil {\n\t\tv := s.AdditionalContext\n\n\t\tmetadata := protocol.Metadata{}\n\t\tms0 := e.Map(protocol.BodyTarget, \"additionalContext\", metadata)\n\t\tms0.Start()\n\t\tfor k1, v1 := range v {\n\t\t\tms0.MapSetValue(k1, protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v1)})\n\t\t}\n\t\tms0.End()\n\n\t}\n\tif s.Body != nil {\n\t\tv := *s.Body\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"body\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\tif s.Headers != nil {\n\t\tv := s.Headers\n\n\t\tmetadata := protocol.Metadata{}\n\t\tms0 := e.Map(protocol.BodyTarget, \"headers\", metadata)\n\t\tms0.Start()\n\t\tfor k1, v1 := range v {\n\t\t\tms0.MapSetValue(k1, protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v1)})\n\t\t}\n\t\tms0.End()\n\n\t}\n\tif s.MultiValueHeaders != nil {\n\t\tv := s.MultiValueHeaders\n\n\t\tmetadata := protocol.Metadata{}\n\t\tms0 := e.Map(protocol.BodyTarget, \"multiValueHeaders\", metadata)\n\t\tms0.Start()\n\t\tfor k1, v1 := range v {\n\t\t\tls1 := ms0.List(k1)\n\t\t\tls1.Start()\n\t\t\tfor _, v2 := range v1 {\n\t\t\t\tls1.ListAddValue(protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v2)})\n\t\t\t}\n\t\t\tls1.End()\n\t\t}\n\t\tms0.End()\n\n\t}\n\tif s.PathWithQueryString != nil {\n\t\tv := *s.PathWithQueryString\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"pathWithQueryString\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\tif s.StageVariables != nil {\n\t\tv := s.StageVariables\n\n\t\tmetadata := protocol.Metadata{}\n\t\tms0 := e.Map(protocol.BodyTarget, \"stageVariables\", metadata)\n\t\tms0.Start()\n\t\tfor k1, v1 := range v {\n\t\t\tms0.MapSetValue(k1, protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v1)})\n\t\t}\n\t\tms0.End()\n\n\t}\n\tif s.AuthorizerId != nil {\n\t\tv := *s.AuthorizerId\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.PathTarget, \"authorizer_id\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\tif s.RestApiId != nil {\n\t\tv := *s.RestApiId\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.PathTarget, \"restapi_id\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "4294f310cbcb95d77c521bdc37a65313", "score": "0.5823661", "text": "func (s CreateModelInput) MarshalFields(e protocol.FieldEncoder) error {\n\te.SetValue(protocol.HeaderTarget, \"Content-Type\", protocol.StringValue(\"application/json\"), protocol.Metadata{})\n\n\tif s.ContentType != nil {\n\t\tv := *s.ContentType\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"contentType\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\tif s.Description != nil {\n\t\tv := *s.Description\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"description\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\tif s.Name != nil {\n\t\tv := *s.Name\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"name\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\tif s.Schema != nil {\n\t\tv := *s.Schema\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"schema\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\tif s.RestApiId != nil {\n\t\tv := *s.RestApiId\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.PathTarget, \"restapi_id\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "b36a33a0e23b3ef70edc0c3c367ea367", "score": "0.58225983", "text": "func (s UpdateDocumentationPartInput) MarshalFields(e protocol.FieldEncoder) error {\n\te.SetValue(protocol.HeaderTarget, \"Content-Type\", protocol.StringValue(\"application/json\"), protocol.Metadata{})\n\n\tif s.PatchOperations != nil {\n\t\tv := s.PatchOperations\n\n\t\tmetadata := protocol.Metadata{}\n\t\tls0 := e.List(protocol.BodyTarget, \"patchOperations\", metadata)\n\t\tls0.Start()\n\t\tfor _, v1 := range v {\n\t\t\tls0.ListAddFields(v1)\n\t\t}\n\t\tls0.End()\n\n\t}\n\tif s.DocumentationPartId != nil {\n\t\tv := *s.DocumentationPartId\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.PathTarget, \"part_id\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\tif s.RestApiId != nil {\n\t\tv := *s.RestApiId\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.PathTarget, \"restapi_id\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "9f3e3d4260b5801798d19c65c74dbc98", "score": "0.5817397", "text": "func (v *GuessProtocolStruct) Encode(sw stream.Writer) error {\n\tif err := sw.WriteStructBegin(); err != nil {\n\t\treturn err\n\t}\n\n\tif v.MapField != nil {\n\t\tif err := sw.WriteFieldBegin(stream.FieldHeader{ID: 7, Type: wire.TMap}); err != nil {\n\t\t\treturn err\n\t\t}\n\t\tif err := _Map_String_String_Encode(v.MapField, sw); err != nil {\n\t\t\treturn err\n\t\t}\n\t\tif err := sw.WriteFieldEnd(); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\treturn sw.WriteStructEnd()\n}", "title": "" }, { "docid": "10ecf9ff8d325fd94e11a6fb2336bfdd", "score": "0.5813608", "text": "func (s CreateVirtualServiceInput) MarshalFields(e protocol.FieldEncoder) error {\n\te.SetValue(protocol.HeaderTarget, \"Content-Type\", protocol.StringValue(\"application/x-amz-json-1.1\"), protocol.Metadata{})\n\n\tvar ClientToken string\n\tif s.ClientToken != nil {\n\t\tClientToken = *s.ClientToken\n\t} else {\n\t\tClientToken = protocol.GetIdempotencyToken()\n\t}\n\t{\n\t\tv := ClientToken\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"clientToken\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\tif s.Spec != nil {\n\t\tv := s.Spec\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetFields(protocol.BodyTarget, \"spec\", v, metadata)\n\t}\n\tif len(s.Tags) > 0 {\n\t\tv := s.Tags\n\n\t\tmetadata := protocol.Metadata{}\n\t\tls0 := e.List(protocol.BodyTarget, \"tags\", metadata)\n\t\tls0.Start()\n\t\tfor _, v1 := range v {\n\t\t\tls0.ListAddFields(v1)\n\t\t}\n\t\tls0.End()\n\n\t}\n\tif s.VirtualServiceName != nil {\n\t\tv := *s.VirtualServiceName\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"virtualServiceName\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\tif s.MeshName != nil {\n\t\tv := *s.MeshName\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.PathTarget, \"meshName\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "bedb1ea85e4eefca0cd12d7b57421224", "score": "0.58092666", "text": "func (s UpdateFunctionCodeOutput) MarshalFields(e protocol.FieldEncoder) error {\n\tif s.CodeSha256 != nil {\n\t\tv := *s.CodeSha256\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"CodeSha256\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\tif s.CodeSize != nil {\n\t\tv := *s.CodeSize\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"CodeSize\", protocol.Int64Value(v), metadata)\n\t}\n\tif s.DeadLetterConfig != nil {\n\t\tv := s.DeadLetterConfig\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetFields(protocol.BodyTarget, \"DeadLetterConfig\", v, metadata)\n\t}\n\tif s.Description != nil {\n\t\tv := *s.Description\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"Description\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\tif s.Environment != nil {\n\t\tv := s.Environment\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetFields(protocol.BodyTarget, \"Environment\", v, metadata)\n\t}\n\tif s.FunctionArn != nil {\n\t\tv := *s.FunctionArn\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"FunctionArn\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\tif s.FunctionName != nil {\n\t\tv := *s.FunctionName\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"FunctionName\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\tif s.Handler != nil {\n\t\tv := *s.Handler\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"Handler\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\tif s.KMSKeyArn != nil {\n\t\tv := *s.KMSKeyArn\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"KMSKeyArn\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\tif s.LastModified != nil {\n\t\tv := *s.LastModified\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"LastModified\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\tif len(s.LastUpdateStatus) > 0 {\n\t\tv := s.LastUpdateStatus\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"LastUpdateStatus\", protocol.QuotedValue{ValueMarshaler: v}, metadata)\n\t}\n\tif s.LastUpdateStatusReason != nil {\n\t\tv := *s.LastUpdateStatusReason\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"LastUpdateStatusReason\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\tif len(s.LastUpdateStatusReasonCode) > 0 {\n\t\tv := s.LastUpdateStatusReasonCode\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"LastUpdateStatusReasonCode\", protocol.QuotedValue{ValueMarshaler: v}, metadata)\n\t}\n\tif s.Layers != nil {\n\t\tv := s.Layers\n\n\t\tmetadata := protocol.Metadata{}\n\t\tls0 := e.List(protocol.BodyTarget, \"Layers\", metadata)\n\t\tls0.Start()\n\t\tfor _, v1 := range v {\n\t\t\tls0.ListAddFields(v1)\n\t\t}\n\t\tls0.End()\n\n\t}\n\tif s.MasterArn != nil {\n\t\tv := *s.MasterArn\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"MasterArn\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\tif s.MemorySize != nil {\n\t\tv := *s.MemorySize\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"MemorySize\", protocol.Int64Value(v), metadata)\n\t}\n\tif s.RevisionId != nil {\n\t\tv := *s.RevisionId\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"RevisionId\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\tif s.Role != nil {\n\t\tv := *s.Role\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"Role\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\tif len(s.Runtime) > 0 {\n\t\tv := s.Runtime\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"Runtime\", protocol.QuotedValue{ValueMarshaler: v}, metadata)\n\t}\n\tif len(s.State) > 0 {\n\t\tv := s.State\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"State\", protocol.QuotedValue{ValueMarshaler: v}, metadata)\n\t}\n\tif s.StateReason != nil {\n\t\tv := *s.StateReason\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"StateReason\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\tif len(s.StateReasonCode) > 0 {\n\t\tv := s.StateReasonCode\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"StateReasonCode\", protocol.QuotedValue{ValueMarshaler: v}, metadata)\n\t}\n\tif s.Timeout != nil {\n\t\tv := *s.Timeout\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"Timeout\", protocol.Int64Value(v), metadata)\n\t}\n\tif s.TracingConfig != nil {\n\t\tv := s.TracingConfig\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetFields(protocol.BodyTarget, \"TracingConfig\", v, metadata)\n\t}\n\tif s.Version != nil {\n\t\tv := *s.Version\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"Version\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\tif s.VpcConfig != nil {\n\t\tv := s.VpcConfig\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetFields(protocol.BodyTarget, \"VpcConfig\", v, metadata)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "9a5e0e3a594ef29058222098c39201ad", "score": "0.58075964", "text": "func (s GetServiceGraphInput) MarshalFields(e protocol.FieldEncoder) error {\n\n\tif s.EndTime != nil {\n\t\tv := *s.EndTime\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"EndTime\", protocol.TimeValue{V: v, Format: protocol.UnixTimeFormat}, metadata)\n\t}\n\tif s.NextToken != nil {\n\t\tv := *s.NextToken\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"NextToken\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\tif s.StartTime != nil {\n\t\tv := *s.StartTime\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"StartTime\", protocol.TimeValue{V: v, Format: protocol.UnixTimeFormat}, metadata)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "9a48a5fa3c887e48c45d39c705da694f", "score": "0.57860124", "text": "func (s GetFunctionDefinitionOutput) MarshalFields(e protocol.FieldEncoder) error {\n\tif s.Arn != nil {\n\t\tv := *s.Arn\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"Arn\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\tif s.CreationTimestamp != nil {\n\t\tv := *s.CreationTimestamp\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"CreationTimestamp\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\tif s.Id != nil {\n\t\tv := *s.Id\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"Id\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\tif s.LastUpdatedTimestamp != nil {\n\t\tv := *s.LastUpdatedTimestamp\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"LastUpdatedTimestamp\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\tif s.LatestVersion != nil {\n\t\tv := *s.LatestVersion\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"LatestVersion\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\tif s.LatestVersionArn != nil {\n\t\tv := *s.LatestVersionArn\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"LatestVersionArn\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\tif s.Name != nil {\n\t\tv := *s.Name\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"Name\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\tif s.Tags != nil {\n\t\tv := s.Tags\n\n\t\tmetadata := protocol.Metadata{}\n\t\tms0 := e.Map(protocol.BodyTarget, \"tags\", metadata)\n\t\tms0.Start()\n\t\tfor k1, v1 := range v {\n\t\t\tms0.MapSetValue(k1, protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v1)})\n\t\t}\n\t\tms0.End()\n\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "9986039cc35e06d6f80c7b7e124446fb", "score": "0.5785832", "text": "func (s GetSlotTypeOutput) MarshalFields(e protocol.FieldEncoder) error {\n\tif s.Checksum != nil {\n\t\tv := *s.Checksum\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"checksum\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\tif s.CreatedDate != nil {\n\t\tv := *s.CreatedDate\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"createdDate\",\n\t\t\tprotocol.TimeValue{V: v, Format: protocol.UnixTimeFormatName, QuotedFormatTime: true}, metadata)\n\t}\n\tif s.Description != nil {\n\t\tv := *s.Description\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"description\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\tif s.EnumerationValues != nil {\n\t\tv := s.EnumerationValues\n\n\t\tmetadata := protocol.Metadata{}\n\t\tls0 := e.List(protocol.BodyTarget, \"enumerationValues\", metadata)\n\t\tls0.Start()\n\t\tfor _, v1 := range v {\n\t\t\tls0.ListAddFields(v1)\n\t\t}\n\t\tls0.End()\n\n\t}\n\tif s.LastUpdatedDate != nil {\n\t\tv := *s.LastUpdatedDate\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"lastUpdatedDate\",\n\t\t\tprotocol.TimeValue{V: v, Format: protocol.UnixTimeFormatName, QuotedFormatTime: true}, metadata)\n\t}\n\tif s.Name != nil {\n\t\tv := *s.Name\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"name\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\tif s.ParentSlotTypeSignature != nil {\n\t\tv := *s.ParentSlotTypeSignature\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"parentSlotTypeSignature\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\tif s.SlotTypeConfigurations != nil {\n\t\tv := s.SlotTypeConfigurations\n\n\t\tmetadata := protocol.Metadata{}\n\t\tls0 := e.List(protocol.BodyTarget, \"slotTypeConfigurations\", metadata)\n\t\tls0.Start()\n\t\tfor _, v1 := range v {\n\t\t\tls0.ListAddFields(v1)\n\t\t}\n\t\tls0.End()\n\n\t}\n\tif len(s.ValueSelectionStrategy) > 0 {\n\t\tv := s.ValueSelectionStrategy\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"valueSelectionStrategy\", protocol.QuotedValue{ValueMarshaler: v}, metadata)\n\t}\n\tif s.Version != nil {\n\t\tv := *s.Version\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"version\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "3db90b155a75e6d400f6f9de10819833", "score": "0.57821923", "text": "func (s UpdateMeshInput) MarshalFields(e protocol.FieldEncoder) error {\n\te.SetValue(protocol.HeaderTarget, \"Content-Type\", protocol.StringValue(\"application/x-amz-json-1.1\"), protocol.Metadata{})\n\n\tvar ClientToken string\n\tif s.ClientToken != nil {\n\t\tClientToken = *s.ClientToken\n\t} else {\n\t\tClientToken = protocol.GetIdempotencyToken()\n\t}\n\t{\n\t\tv := ClientToken\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"clientToken\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\tif s.Spec != nil {\n\t\tv := s.Spec\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetFields(protocol.BodyTarget, \"spec\", v, metadata)\n\t}\n\tif s.MeshName != nil {\n\t\tv := *s.MeshName\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.PathTarget, \"meshName\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "fee425be5be7d7653c0cfd8295c0ba6d", "score": "0.5780622", "text": "func (s GetSlotTypeInput) MarshalFields(e protocol.FieldEncoder) error {\n\te.SetValue(protocol.HeaderTarget, \"Content-Type\", protocol.StringValue(\"application/json\"), protocol.Metadata{})\n\n\tif s.Name != nil {\n\t\tv := *s.Name\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.PathTarget, \"name\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\tif s.Version != nil {\n\t\tv := *s.Version\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.PathTarget, \"version\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "efc18f9b4e561936294d0566c22c6602", "score": "0.57669896", "text": "func (s CreatePresetInput) MarshalFields(e protocol.FieldEncoder) error {\n\te.SetValue(protocol.HeaderTarget, \"Content-Type\", protocol.StringValue(\"application/json\"), protocol.Metadata{})\n\n\tif s.Audio != nil {\n\t\tv := s.Audio\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetFields(protocol.BodyTarget, \"Audio\", v, metadata)\n\t}\n\tif s.Container != nil {\n\t\tv := *s.Container\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"Container\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\tif s.Description != nil {\n\t\tv := *s.Description\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"Description\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\tif s.Name != nil {\n\t\tv := *s.Name\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"Name\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\tif s.Thumbnails != nil {\n\t\tv := s.Thumbnails\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetFields(protocol.BodyTarget, \"Thumbnails\", v, metadata)\n\t}\n\tif s.Video != nil {\n\t\tv := s.Video\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetFields(protocol.BodyTarget, \"Video\", v, metadata)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "42dc7977e83a388eaeec5eeabedf1c00", "score": "0.5763238", "text": "func (s InputService10TestShapeInputService10TestCaseOperation1Input) MarshalFields(e protocol.FieldEncoder) error {\n\n\te.SetFields(protocol.BodyTarget, \"OperationRequest\", protocol.FieldMarshalerFunc(func(e protocol.FieldEncoder) error {\n\t\tif s.StructureParam != nil {\n\t\t\tv := s.StructureParam\n\n\t\t\tmetadata := protocol.Metadata{}\n\t\t\te.SetFields(protocol.BodyTarget, \"StructureParam\", v, metadata)\n\t\t}\n\t\treturn nil\n\t}), protocol.Metadata{XMLNamespaceURI: \"https://foo/\"})\n\treturn nil\n}", "title": "" }, { "docid": "40f08d624af303f3b541549fad1e4b5f", "score": "0.5750582", "text": "func (s CreateMeshInput) MarshalFields(e protocol.FieldEncoder) error {\n\te.SetValue(protocol.HeaderTarget, \"Content-Type\", protocol.StringValue(\"application/x-amz-json-1.1\"), protocol.Metadata{})\n\n\tvar ClientToken string\n\tif s.ClientToken != nil {\n\t\tClientToken = *s.ClientToken\n\t} else {\n\t\tClientToken = protocol.GetIdempotencyToken()\n\t}\n\t{\n\t\tv := ClientToken\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"clientToken\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\tif s.MeshName != nil {\n\t\tv := *s.MeshName\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"meshName\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\tif s.Spec != nil {\n\t\tv := s.Spec\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetFields(protocol.BodyTarget, \"spec\", v, metadata)\n\t}\n\tif len(s.Tags) > 0 {\n\t\tv := s.Tags\n\n\t\tmetadata := protocol.Metadata{}\n\t\tls0 := e.List(protocol.BodyTarget, \"tags\", metadata)\n\t\tls0.Start()\n\t\tfor _, v1 := range v {\n\t\t\tls0.ListAddFields(v1)\n\t\t}\n\t\tls0.End()\n\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "f53b0e18e70b02c2189e6702d4f81ce7", "score": "0.57438606", "text": "func (s UpdateVirtualServiceInput) MarshalFields(e protocol.FieldEncoder) error {\n\te.SetValue(protocol.HeaderTarget, \"Content-Type\", protocol.StringValue(\"application/x-amz-json-1.1\"), protocol.Metadata{})\n\n\tvar ClientToken string\n\tif s.ClientToken != nil {\n\t\tClientToken = *s.ClientToken\n\t} else {\n\t\tClientToken = protocol.GetIdempotencyToken()\n\t}\n\t{\n\t\tv := ClientToken\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"clientToken\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\tif s.Spec != nil {\n\t\tv := s.Spec\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetFields(protocol.BodyTarget, \"spec\", v, metadata)\n\t}\n\tif s.MeshName != nil {\n\t\tv := *s.MeshName\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.PathTarget, \"meshName\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\tif s.VirtualServiceName != nil {\n\t\tv := *s.VirtualServiceName\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.PathTarget, \"virtualServiceName\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "f367d02ef2da479a1c906f45b10b365a", "score": "0.57433677", "text": "func (s StopCanaryInput) MarshalFields(e protocol.FieldEncoder) error {\n\te.SetValue(protocol.HeaderTarget, \"Content-Type\", protocol.StringValue(\"application/json\"), protocol.Metadata{})\n\n\tif s.Name != nil {\n\t\tv := *s.Name\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.PathTarget, \"name\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "a4e4be4f41a403ca086fdf58592f6255", "score": "0.5743364", "text": "func EncodeSchema(src interface{}, dst map[string][]string) error {\n\treturn encoder.Encode(src, dst)\n}", "title": "" }, { "docid": "3b84349c5344bef25459f17b9bfd7632", "score": "0.57412094", "text": "func (s InputService19TestShapeGrantee) MarshalFields(e protocol.FieldEncoder) error {\n\tif s.EmailAddress != nil {\n\t\tv := *s.EmailAddress\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"EmailAddress\", protocol.StringValue(v), metadata)\n\t}\n\t// Skipping Type XML Attribute.\n\treturn nil\n}", "title": "" }, { "docid": "ef63b014dbbea3b831676c7d145d9dec", "score": "0.57280993", "text": "func (s CreateModelOutput) MarshalFields(e protocol.FieldEncoder) error {\n\tif s.ContentType != nil {\n\t\tv := *s.ContentType\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"contentType\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\tif s.Description != nil {\n\t\tv := *s.Description\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"description\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\tif s.Id != nil {\n\t\tv := *s.Id\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"id\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\tif s.Name != nil {\n\t\tv := *s.Name\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"name\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\tif s.Schema != nil {\n\t\tv := *s.Schema\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"schema\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "047586500a8e61b4f93340aecbda3de1", "score": "0.5727811", "text": "func (s InputService3TestShapeInputService3TestCaseOperation2Input) MarshalFields(e protocol.FieldEncoder) error {\n\n\te.SetFields(protocol.BodyTarget, \"OperationRequest\", protocol.FieldMarshalerFunc(func(e protocol.FieldEncoder) error {\n\t\tif s.Description != nil {\n\t\t\tv := *s.Description\n\n\t\t\tmetadata := protocol.Metadata{}\n\t\t\te.SetValue(protocol.BodyTarget, \"Description\", protocol.StringValue(v), metadata)\n\t\t}\n\t\tif s.SubStructure != nil {\n\t\t\tv := s.SubStructure\n\n\t\t\tmetadata := protocol.Metadata{}\n\t\t\te.SetFields(protocol.BodyTarget, \"SubStructure\", v, metadata)\n\t\t}\n\t\treturn nil\n\t}), protocol.Metadata{XMLNamespaceURI: \"https://foo/\"})\n\treturn nil\n}", "title": "" }, { "docid": "6a3e5e853d42cb4b74ceb4c9adff8ca0", "score": "0.5718529", "text": "func (s CreateVirtualNodeInput) MarshalFields(e protocol.FieldEncoder) error {\n\te.SetValue(protocol.HeaderTarget, \"Content-Type\", protocol.StringValue(\"application/x-amz-json-1.1\"), protocol.Metadata{})\n\n\tvar ClientToken string\n\tif s.ClientToken != nil {\n\t\tClientToken = *s.ClientToken\n\t} else {\n\t\tClientToken = protocol.GetIdempotencyToken()\n\t}\n\t{\n\t\tv := ClientToken\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"clientToken\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\tif s.Spec != nil {\n\t\tv := s.Spec\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetFields(protocol.BodyTarget, \"spec\", v, metadata)\n\t}\n\tif len(s.Tags) > 0 {\n\t\tv := s.Tags\n\n\t\tmetadata := protocol.Metadata{}\n\t\tls0 := e.List(protocol.BodyTarget, \"tags\", metadata)\n\t\tls0.Start()\n\t\tfor _, v1 := range v {\n\t\t\tls0.ListAddFields(v1)\n\t\t}\n\t\tls0.End()\n\n\t}\n\tif s.VirtualNodeName != nil {\n\t\tv := *s.VirtualNodeName\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"virtualNodeName\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\tif s.MeshName != nil {\n\t\tv := *s.MeshName\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.PathTarget, \"meshName\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "fcaad77f0f20fcb233b04e22e499b5ef", "score": "0.5718527", "text": "func (s UpdateTypeInput) MarshalFields(e protocol.FieldEncoder) error {\n\te.SetValue(protocol.HeaderTarget, \"Content-Type\", protocol.StringValue(\"application/json\"), protocol.Metadata{})\n\n\tif s.Definition != nil {\n\t\tv := *s.Definition\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"definition\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\tif len(s.Format) > 0 {\n\t\tv := s.Format\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"format\", protocol.QuotedValue{ValueMarshaler: v}, metadata)\n\t}\n\tif s.ApiId != nil {\n\t\tv := *s.ApiId\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.PathTarget, \"apiId\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\tif s.TypeName != nil {\n\t\tv := *s.TypeName\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.PathTarget, \"typeName\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "4041ed30b3a1bbf3d2bcc2c305f66adc", "score": "0.5718312", "text": "func (s VirtualNodeSpec) MarshalFields(e protocol.FieldEncoder) error {\n\tif len(s.Backends) > 0 {\n\t\tv := s.Backends\n\n\t\tmetadata := protocol.Metadata{}\n\t\tls0 := e.List(protocol.BodyTarget, \"backends\", metadata)\n\t\tls0.Start()\n\t\tfor _, v1 := range v {\n\t\t\tls0.ListAddFields(v1)\n\t\t}\n\t\tls0.End()\n\n\t}\n\tif len(s.Listeners) > 0 {\n\t\tv := s.Listeners\n\n\t\tmetadata := protocol.Metadata{}\n\t\tls0 := e.List(protocol.BodyTarget, \"listeners\", metadata)\n\t\tls0.Start()\n\t\tfor _, v1 := range v {\n\t\t\tls0.ListAddFields(v1)\n\t\t}\n\t\tls0.End()\n\n\t}\n\tif s.Logging != nil {\n\t\tv := s.Logging\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetFields(protocol.BodyTarget, \"logging\", v, metadata)\n\t}\n\tif s.ServiceDiscovery != nil {\n\t\tv := s.ServiceDiscovery\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetFields(protocol.BodyTarget, \"serviceDiscovery\", v, metadata)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "a91e7e272608438727d29af42c7640ad", "score": "0.570769", "text": "func (s StreamKey) MarshalFields(e protocol.FieldEncoder) error {\n\tif s.Arn != nil {\n\t\tv := *s.Arn\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"arn\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\tif s.ChannelArn != nil {\n\t\tv := *s.ChannelArn\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"channelArn\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\tif s.Tags != nil {\n\t\tv := s.Tags\n\n\t\tmetadata := protocol.Metadata{}\n\t\tms0 := e.Map(protocol.BodyTarget, \"tags\", metadata)\n\t\tms0.Start()\n\t\tfor k1, v1 := range v {\n\t\t\tms0.MapSetValue(k1, protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v1)})\n\t\t}\n\t\tms0.End()\n\n\t}\n\tif s.Value != nil {\n\t\tv := *s.Value\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"value\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "8efcf85e8cc9549f85047b9eed0c251e", "score": "0.5707057", "text": "func (s InputService8TestShapeInputService8TestCaseOperation1Input) MarshalFields(e protocol.FieldEncoder) error {\n\n\te.SetFields(protocol.BodyTarget, \"OperationRequest\", protocol.FieldMarshalerFunc(func(e protocol.FieldEncoder) error {\n\t\tif len(s.ListParam) > 0 {\n\t\t\tv := s.ListParam\n\n\t\t\tmetadata := protocol.Metadata{Flatten: true}\n\t\t\tls0 := e.List(protocol.BodyTarget, \"item\", metadata)\n\t\t\tls0.Start()\n\t\t\tfor _, v1 := range v {\n\t\t\t\tls0.ListAddValue(protocol.StringValue(v1))\n\t\t\t}\n\t\t\tls0.End()\n\n\t\t}\n\t\treturn nil\n\t}), protocol.Metadata{XMLNamespaceURI: \"https://foo/\"})\n\treturn nil\n}", "title": "" }, { "docid": "cfd9571d26973f375557695a68f1376a", "score": "0.57025623", "text": "func (s InputService9TestShapeSingleFieldStruct) MarshalFields(e protocol.FieldEncoder) error {\n\tif s.Element != nil {\n\t\tv := *s.Element\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"value\", protocol.StringValue(v), metadata)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "601a6ea8021984828efe2ae9a87a4b89", "score": "0.5701311", "text": "func (s CreateResolverInput) MarshalFields(e protocol.FieldEncoder) error {\n\te.SetValue(protocol.HeaderTarget, \"Content-Type\", protocol.StringValue(\"application/json\"), protocol.Metadata{})\n\n\tif s.CachingConfig != nil {\n\t\tv := s.CachingConfig\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetFields(protocol.BodyTarget, \"cachingConfig\", v, metadata)\n\t}\n\tif s.DataSourceName != nil {\n\t\tv := *s.DataSourceName\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"dataSourceName\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\tif s.FieldName != nil {\n\t\tv := *s.FieldName\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"fieldName\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\tif len(s.Kind) > 0 {\n\t\tv := s.Kind\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"kind\", protocol.QuotedValue{ValueMarshaler: v}, metadata)\n\t}\n\tif s.PipelineConfig != nil {\n\t\tv := s.PipelineConfig\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetFields(protocol.BodyTarget, \"pipelineConfig\", v, metadata)\n\t}\n\tif s.RequestMappingTemplate != nil {\n\t\tv := *s.RequestMappingTemplate\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"requestMappingTemplate\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\tif s.ResponseMappingTemplate != nil {\n\t\tv := *s.ResponseMappingTemplate\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"responseMappingTemplate\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\tif s.SyncConfig != nil {\n\t\tv := s.SyncConfig\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetFields(protocol.BodyTarget, \"syncConfig\", v, metadata)\n\t}\n\tif s.ApiId != nil {\n\t\tv := *s.ApiId\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.PathTarget, \"apiId\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\tif s.TypeName != nil {\n\t\tv := *s.TypeName\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.PathTarget, \"typeName\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "dc7cfbbffb818db17226d2cfe69d44e0", "score": "0.5680451", "text": "func (s CreateRouteInput) MarshalFields(e protocol.FieldEncoder) error {\n\te.SetValue(protocol.HeaderTarget, \"Content-Type\", protocol.StringValue(\"application/x-amz-json-1.1\"), protocol.Metadata{})\n\n\tvar ClientToken string\n\tif s.ClientToken != nil {\n\t\tClientToken = *s.ClientToken\n\t} else {\n\t\tClientToken = protocol.GetIdempotencyToken()\n\t}\n\t{\n\t\tv := ClientToken\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"clientToken\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\tif s.RouteName != nil {\n\t\tv := *s.RouteName\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"routeName\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\tif s.Spec != nil {\n\t\tv := s.Spec\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetFields(protocol.BodyTarget, \"spec\", v, metadata)\n\t}\n\tif len(s.Tags) > 0 {\n\t\tv := s.Tags\n\n\t\tmetadata := protocol.Metadata{}\n\t\tls0 := e.List(protocol.BodyTarget, \"tags\", metadata)\n\t\tls0.Start()\n\t\tfor _, v1 := range v {\n\t\t\tls0.ListAddFields(v1)\n\t\t}\n\t\tls0.End()\n\n\t}\n\tif s.MeshName != nil {\n\t\tv := *s.MeshName\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.PathTarget, \"meshName\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\tif s.VirtualRouterName != nil {\n\t\tv := *s.VirtualRouterName\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.PathTarget, \"virtualRouterName\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "771199f11c724ed0fb824cd0af92b555", "score": "0.5677694", "text": "func (s ParquetInput) MarshalFields(e protocol.FieldEncoder) error {\n\treturn nil\n}", "title": "" }, { "docid": "66716d9c02c991e5a584e541ae7343a6", "score": "0.56712705", "text": "func (s CreateMultipartUploadOutput) MarshalFields(e protocol.FieldEncoder) error {\n\tif s.Bucket != nil {\n\t\tv := *s.Bucket\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"Bucket\", protocol.StringValue(v), metadata)\n\t}\n\tif s.Key != nil {\n\t\tv := *s.Key\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"Key\", protocol.StringValue(v), metadata)\n\t}\n\tif s.UploadId != nil {\n\t\tv := *s.UploadId\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"UploadId\", protocol.StringValue(v), metadata)\n\t}\n\tif s.AbortDate != nil {\n\t\tv := *s.AbortDate\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.HeaderTarget, \"x-amz-abort-date\", protocol.TimeValue{V: v, Format: protocol.RFC822TimeFromat}, metadata)\n\t}\n\tif s.AbortRuleId != nil {\n\t\tv := *s.AbortRuleId\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.HeaderTarget, \"x-amz-abort-rule-id\", protocol.StringValue(v), metadata)\n\t}\n\tif len(s.RequestCharged) > 0 {\n\t\tv := s.RequestCharged\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.HeaderTarget, \"x-amz-request-charged\", v, metadata)\n\t}\n\tif s.SSECustomerAlgorithm != nil {\n\t\tv := *s.SSECustomerAlgorithm\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.HeaderTarget, \"x-amz-server-side-encryption-customer-algorithm\", protocol.StringValue(v), metadata)\n\t}\n\tif s.SSECustomerKeyMD5 != nil {\n\t\tv := *s.SSECustomerKeyMD5\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.HeaderTarget, \"x-amz-server-side-encryption-customer-key-MD5\", protocol.StringValue(v), metadata)\n\t}\n\tif s.SSEKMSKeyId != nil {\n\t\tv := *s.SSEKMSKeyId\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.HeaderTarget, \"x-amz-server-side-encryption-aws-kms-key-id\", protocol.StringValue(v), metadata)\n\t}\n\tif len(s.ServerSideEncryption) > 0 {\n\t\tv := s.ServerSideEncryption\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.HeaderTarget, \"x-amz-server-side-encryption\", v, metadata)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "7a70665d5c7f1a9b41e7562581c294bd", "score": "0.5670698", "text": "func (s GetObjectInformationOutput) MarshalFields(e protocol.FieldEncoder) error {\n\tif s.ObjectIdentifier != nil {\n\t\tv := *s.ObjectIdentifier\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"ObjectIdentifier\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\tif s.SchemaFacets != nil {\n\t\tv := s.SchemaFacets\n\n\t\tmetadata := protocol.Metadata{}\n\t\tls0 := e.List(protocol.BodyTarget, \"SchemaFacets\", metadata)\n\t\tls0.Start()\n\t\tfor _, v1 := range v {\n\t\t\tls0.ListAddFields(v1)\n\t\t}\n\t\tls0.End()\n\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "d2f339896d1898a1ef3feabd0fc9853f", "score": "0.5664963", "text": "func (s DisposePackageVersionsInput) MarshalFields(e protocol.FieldEncoder) error {\n\te.SetValue(protocol.HeaderTarget, \"Content-Type\", protocol.StringValue(\"application/json\"), protocol.Metadata{})\n\n\tif len(s.ExpectedStatus) > 0 {\n\t\tv := s.ExpectedStatus\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"expectedStatus\", protocol.QuotedValue{ValueMarshaler: v}, metadata)\n\t}\n\tif s.VersionRevisions != nil {\n\t\tv := s.VersionRevisions\n\n\t\tmetadata := protocol.Metadata{}\n\t\tms0 := e.Map(protocol.BodyTarget, \"versionRevisions\", metadata)\n\t\tms0.Start()\n\t\tfor k1, v1 := range v {\n\t\t\tms0.MapSetValue(k1, protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v1)})\n\t\t}\n\t\tms0.End()\n\n\t}\n\tif s.Versions != nil {\n\t\tv := s.Versions\n\n\t\tmetadata := protocol.Metadata{}\n\t\tls0 := e.List(protocol.BodyTarget, \"versions\", metadata)\n\t\tls0.Start()\n\t\tfor _, v1 := range v {\n\t\t\tls0.ListAddValue(protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v1)})\n\t\t}\n\t\tls0.End()\n\n\t}\n\tif s.Domain != nil {\n\t\tv := *s.Domain\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.QueryTarget, \"domain\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\tif s.DomainOwner != nil {\n\t\tv := *s.DomainOwner\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.QueryTarget, \"domain-owner\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\tif len(s.Format) > 0 {\n\t\tv := s.Format\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.QueryTarget, \"format\", protocol.QuotedValue{ValueMarshaler: v}, metadata)\n\t}\n\tif s.Namespace != nil {\n\t\tv := *s.Namespace\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.QueryTarget, \"namespace\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\tif s.Package != nil {\n\t\tv := *s.Package\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.QueryTarget, \"package\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\tif s.Repository != nil {\n\t\tv := *s.Repository\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.QueryTarget, \"repository\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "71cc8eab036b097efb81047f3a830f8b", "score": "0.5660142", "text": "func (s UpdateRouteInput) MarshalFields(e protocol.FieldEncoder) error {\n\te.SetValue(protocol.HeaderTarget, \"Content-Type\", protocol.StringValue(\"application/x-amz-json-1.1\"), protocol.Metadata{})\n\n\tvar ClientToken string\n\tif s.ClientToken != nil {\n\t\tClientToken = *s.ClientToken\n\t} else {\n\t\tClientToken = protocol.GetIdempotencyToken()\n\t}\n\t{\n\t\tv := ClientToken\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"clientToken\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\tif s.Spec != nil {\n\t\tv := s.Spec\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetFields(protocol.BodyTarget, \"spec\", v, metadata)\n\t}\n\tif s.MeshName != nil {\n\t\tv := *s.MeshName\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.PathTarget, \"meshName\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\tif s.RouteName != nil {\n\t\tv := *s.RouteName\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.PathTarget, \"routeName\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\tif s.VirtualRouterName != nil {\n\t\tv := *s.VirtualRouterName\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.PathTarget, \"virtualRouterName\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "8373dbfbe93a61f9015b1c49bd2ada56", "score": "0.5659719", "text": "func (s UpdateVirtualNodeInput) MarshalFields(e protocol.FieldEncoder) error {\n\te.SetValue(protocol.HeaderTarget, \"Content-Type\", protocol.StringValue(\"application/x-amz-json-1.1\"), protocol.Metadata{})\n\n\tvar ClientToken string\n\tif s.ClientToken != nil {\n\t\tClientToken = *s.ClientToken\n\t} else {\n\t\tClientToken = protocol.GetIdempotencyToken()\n\t}\n\t{\n\t\tv := ClientToken\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"clientToken\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\tif s.Spec != nil {\n\t\tv := s.Spec\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetFields(protocol.BodyTarget, \"spec\", v, metadata)\n\t}\n\tif s.MeshName != nil {\n\t\tv := *s.MeshName\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.PathTarget, \"meshName\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\tif s.VirtualNodeName != nil {\n\t\tv := *s.VirtualNodeName\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.PathTarget, \"virtualNodeName\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "dabbf899bc93e7aacf440f877ff3ccf4", "score": "0.5648174", "text": "func (s AssociateDeviceWithPlacementInput) MarshalFields(e protocol.FieldEncoder) error {\n\te.SetValue(protocol.HeaderTarget, \"Content-Type\", protocol.StringValue(\"application/json\"), protocol.Metadata{})\n\n\tif s.DeviceId != nil {\n\t\tv := *s.DeviceId\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"deviceId\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\tif s.DeviceTemplateName != nil {\n\t\tv := *s.DeviceTemplateName\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.PathTarget, \"deviceTemplateName\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\tif s.PlacementName != nil {\n\t\tv := *s.PlacementName\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.PathTarget, \"placementName\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\tif s.ProjectName != nil {\n\t\tv := *s.ProjectName\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.PathTarget, \"projectName\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "2bb4e10a3d80747f11a3c9b886eee23e", "score": "0.56463826", "text": "func (s InputService16TestShapeInputService16TestCaseOperation1Input) MarshalFields(e protocol.FieldEncoder) error {\n\n\tif s.Foo != nil {\n\t\tv := *s.Foo\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetStream(protocol.PayloadTarget, \"foo\", protocol.StringStream(v), metadata)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "b0bc5089d8457089ac0b6d0769df808a", "score": "0.5645618", "text": "func (s EnableMacieInput) MarshalFields(e protocol.FieldEncoder) error {\n\te.SetValue(protocol.HeaderTarget, \"Content-Type\", protocol.StringValue(\"application/json\"), protocol.Metadata{})\n\n\tvar ClientToken string\n\tif s.ClientToken != nil {\n\t\tClientToken = *s.ClientToken\n\t} else {\n\t\tClientToken = protocol.GetIdempotencyToken()\n\t}\n\t{\n\t\tv := ClientToken\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"clientToken\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\tif len(s.FindingPublishingFrequency) > 0 {\n\t\tv := s.FindingPublishingFrequency\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"findingPublishingFrequency\", protocol.QuotedValue{ValueMarshaler: v}, metadata)\n\t}\n\tif len(s.Status) > 0 {\n\t\tv := s.Status\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"status\", protocol.QuotedValue{ValueMarshaler: v}, metadata)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "51178a1c9b6305e35ff016293223897d", "score": "0.563724", "text": "func (s PutBucketEncryptionInput) MarshalFields(e protocol.FieldEncoder) error {\n\n\tif s.Bucket != nil {\n\t\tv := *s.Bucket\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.PathTarget, \"Bucket\", protocol.StringValue(v), metadata)\n\t}\n\tif s.ServerSideEncryptionConfiguration != nil {\n\t\tv := s.ServerSideEncryptionConfiguration\n\n\t\tmetadata := protocol.Metadata{XMLNamespaceURI: \"http://s3.amazonaws.com/doc/2006-03-01/\"}\n\t\te.SetFields(protocol.PayloadTarget, \"ServerSideEncryptionConfiguration\", v, metadata)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "cf43c28eb257e29c48ae9e4164c98911", "score": "0.56351215", "text": "func (s GetServiceGraphOutput) MarshalFields(e protocol.FieldEncoder) error {\n\tif s.EndTime != nil {\n\t\tv := *s.EndTime\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"EndTime\", protocol.TimeValue{V: v, Format: protocol.UnixTimeFormat}, metadata)\n\t}\n\tif s.NextToken != nil {\n\t\tv := *s.NextToken\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"NextToken\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\tif len(s.Services) > 0 {\n\t\tv := s.Services\n\n\t\tmetadata := protocol.Metadata{}\n\t\tls0 := e.List(protocol.BodyTarget, \"Services\", metadata)\n\t\tls0.Start()\n\t\tfor _, v1 := range v {\n\t\t\tls0.ListAddFields(v1)\n\t\t}\n\t\tls0.End()\n\n\t}\n\tif s.StartTime != nil {\n\t\tv := *s.StartTime\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"StartTime\", protocol.TimeValue{V: v, Format: protocol.UnixTimeFormat}, metadata)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "0f065117ea222a502ed322a46714b686", "score": "0.5634804", "text": "func (s PutMethodResponseOutput) MarshalFields(e protocol.FieldEncoder) error {\n\tif s.ResponseModels != nil {\n\t\tv := s.ResponseModels\n\n\t\tmetadata := protocol.Metadata{}\n\t\tms0 := e.Map(protocol.BodyTarget, \"responseModels\", metadata)\n\t\tms0.Start()\n\t\tfor k1, v1 := range v {\n\t\t\tms0.MapSetValue(k1, protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v1)})\n\t\t}\n\t\tms0.End()\n\n\t}\n\tif s.ResponseParameters != nil {\n\t\tv := s.ResponseParameters\n\n\t\tmetadata := protocol.Metadata{}\n\t\tms0 := e.Map(protocol.BodyTarget, \"responseParameters\", metadata)\n\t\tms0.Start()\n\t\tfor k1, v1 := range v {\n\t\t\tms0.MapSetValue(k1, protocol.BoolValue(v1))\n\t\t}\n\t\tms0.End()\n\n\t}\n\tif s.StatusCode != nil {\n\t\tv := *s.StatusCode\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"statusCode\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "016212dfdb0763d03b69e4db329e7d95", "score": "0.563335", "text": "func (s InputService19TestShapeGrant) MarshalFields(e protocol.FieldEncoder) error {\n\tif s.Grantee != nil {\n\t\tv := s.Grantee\n\t\tattrs := make([]protocol.Attribute, 0, 1)\n\n\t\tif s.Grantee.Type != nil {\n\t\t\tv := *s.Grantee.Type\n\t\t\tattrs = append(attrs, protocol.Attribute{Name: \"xsi:type\", Value: protocol.StringValue(v), Meta: protocol.Metadata{}})\n\t\t}\n\t\tmetadata := protocol.Metadata{Attributes: attrs, XMLNamespacePrefix: \"xsi\", XMLNamespaceURI: \"http://www.w3.org/2001/XMLSchema-instance\"}\n\t\te.SetFields(protocol.BodyTarget, \"Grantee\", v, metadata)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "f4e0f94e7071162007f01d78b60df1bd", "score": "0.56325084", "text": "func (s UpdateDeviceStateInput) MarshalFields(e protocol.FieldEncoder) error {\n\te.SetValue(protocol.HeaderTarget, \"Content-Type\", protocol.StringValue(\"application/x-amz-json-1.1\"), protocol.Metadata{})\n\n\tif s.Enabled != nil {\n\t\tv := *s.Enabled\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"enabled\", protocol.BoolValue(v), metadata)\n\t}\n\tif s.DeviceId != nil {\n\t\tv := *s.DeviceId\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.PathTarget, \"deviceId\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "35bf6561bfab158b28b10872803cb539", "score": "0.563058", "text": "func (s InputService9TestShapeInputService9TestCaseOperation1Input) MarshalFields(e protocol.FieldEncoder) error {\n\n\te.SetFields(protocol.BodyTarget, \"OperationRequest\", protocol.FieldMarshalerFunc(func(e protocol.FieldEncoder) error {\n\t\tif len(s.ListParam) > 0 {\n\t\t\tv := s.ListParam\n\n\t\t\tmetadata := protocol.Metadata{Flatten: true}\n\t\t\tls0 := e.List(protocol.BodyTarget, \"item\", metadata)\n\t\t\tls0.Start()\n\t\t\tfor _, v1 := range v {\n\t\t\t\tls0.ListAddFields(v1)\n\t\t\t}\n\t\t\tls0.End()\n\n\t\t}\n\t\treturn nil\n\t}), protocol.Metadata{XMLNamespaceURI: \"https://foo/\"})\n\treturn nil\n}", "title": "" }, { "docid": "43bcb33e54f788b514382241d21c6c81", "score": "0.56257564", "text": "func (s InvokeDeviceMethodInput) MarshalFields(e protocol.FieldEncoder) error {\n\te.SetValue(protocol.HeaderTarget, \"Content-Type\", protocol.StringValue(\"application/x-amz-json-1.1\"), protocol.Metadata{})\n\n\tif s.DeviceMethod != nil {\n\t\tv := s.DeviceMethod\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetFields(protocol.BodyTarget, \"deviceMethod\", v, metadata)\n\t}\n\tif s.DeviceMethodParameters != nil {\n\t\tv := *s.DeviceMethodParameters\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"deviceMethodParameters\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\tif s.DeviceId != nil {\n\t\tv := *s.DeviceId\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.PathTarget, \"deviceId\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "517350cd5c8f4fa5a82789a43ee693f9", "score": "0.5624055", "text": "func (s InputService11TestShapeInputService11TestCaseOperation1Input) MarshalFields(e protocol.FieldEncoder) error {\n\n\tif len(s.Foo) > 0 {\n\t\tv := s.Foo\n\n\t\tmetadata := protocol.Metadata{}\n\t\tms0 := e.Map(protocol.HeadersTarget, \"x-foo-\", metadata)\n\t\tms0.Start()\n\t\tfor k1, v1 := range v {\n\t\t\tms0.MapSetValue(k1, protocol.StringValue(v1))\n\t\t}\n\t\tms0.End()\n\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "fb1276a2216b97e4a59a3223cb4bef4f", "score": "0.56170136", "text": "func (s GetDeviceMethodsInput) MarshalFields(e protocol.FieldEncoder) error {\n\te.SetValue(protocol.HeaderTarget, \"Content-Type\", protocol.StringValue(\"application/x-amz-json-1.1\"), protocol.Metadata{})\n\n\tif s.DeviceId != nil {\n\t\tv := *s.DeviceId\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.PathTarget, \"deviceId\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "eb8c4baf8302c44be27b044a9848d6f7", "score": "0.5613542", "text": "func (s UploadPartOutput) MarshalFields(e protocol.FieldEncoder) error {\n\tif s.ETag != nil {\n\t\tv := *s.ETag\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.HeaderTarget, \"ETag\", protocol.StringValue(v), metadata)\n\t}\n\tif len(s.RequestCharged) > 0 {\n\t\tv := s.RequestCharged\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.HeaderTarget, \"x-amz-request-charged\", v, metadata)\n\t}\n\tif s.SSECustomerAlgorithm != nil {\n\t\tv := *s.SSECustomerAlgorithm\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.HeaderTarget, \"x-amz-server-side-encryption-customer-algorithm\", protocol.StringValue(v), metadata)\n\t}\n\tif s.SSECustomerKeyMD5 != nil {\n\t\tv := *s.SSECustomerKeyMD5\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.HeaderTarget, \"x-amz-server-side-encryption-customer-key-MD5\", protocol.StringValue(v), metadata)\n\t}\n\tif s.SSEKMSKeyId != nil {\n\t\tv := *s.SSEKMSKeyId\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.HeaderTarget, \"x-amz-server-side-encryption-aws-kms-key-id\", protocol.StringValue(v), metadata)\n\t}\n\tif len(s.ServerSideEncryption) > 0 {\n\t\tv := s.ServerSideEncryption\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.HeaderTarget, \"x-amz-server-side-encryption\", v, metadata)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "2870f01a9d8bfe1b880bf2e33bf7ce00", "score": "0.5613287", "text": "func (s CreateTypedLinkFacetInput) MarshalFields(e protocol.FieldEncoder) error {\n\te.SetValue(protocol.HeaderTarget, \"Content-Type\", protocol.StringValue(\"application/json\"), protocol.Metadata{})\n\n\tif s.Facet != nil {\n\t\tv := s.Facet\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetFields(protocol.BodyTarget, \"Facet\", v, metadata)\n\t}\n\tif s.SchemaArn != nil {\n\t\tv := *s.SchemaArn\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.HeaderTarget, \"x-amz-data-partition\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "a6aacdc6e9200428873a55af663f244a", "score": "0.56114304", "text": "func (s UpdateDocumentationPartOutput) MarshalFields(e protocol.FieldEncoder) error {\n\tif s.Id != nil {\n\t\tv := *s.Id\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"id\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\tif s.Location != nil {\n\t\tv := s.Location\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetFields(protocol.BodyTarget, \"location\", v, metadata)\n\t}\n\tif s.Properties != nil {\n\t\tv := *s.Properties\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"properties\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "d592829d76271b9f9c5f72c86e2244ba", "score": "0.5611317", "text": "func (s OutputLocation) MarshalFields(e protocol.FieldEncoder) error {\n\tif s.S3 != nil {\n\t\tv := s.S3\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetFields(protocol.BodyTarget, \"S3\", v, metadata)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "cff464559d072e6f078da12e8a3f471f", "score": "0.5608475", "text": "func (s SubscribeToDatasetInput) MarshalFields(e protocol.FieldEncoder) error {\n\te.SetValue(protocol.HeaderTarget, \"Content-Type\", protocol.StringValue(\"application/json\"), protocol.Metadata{})\n\n\tif s.DatasetName != nil {\n\t\tv := *s.DatasetName\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.PathTarget, \"DatasetName\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\tif s.DeviceId != nil {\n\t\tv := *s.DeviceId\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.PathTarget, \"DeviceId\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\tif s.IdentityId != nil {\n\t\tv := *s.IdentityId\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.PathTarget, \"IdentityId\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\tif s.IdentityPoolId != nil {\n\t\tv := *s.IdentityPoolId\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.PathTarget, \"IdentityPoolId\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "b6f01f70308056ae3985b50ad94d6e9b", "score": "0.56068474", "text": "func (s CreatePhoneNumberOrderInput) MarshalFields(e protocol.FieldEncoder) error {\n\te.SetValue(protocol.HeaderTarget, \"Content-Type\", protocol.StringValue(\"application/json\"), protocol.Metadata{})\n\n\tif s.E164PhoneNumbers != nil {\n\t\tv := s.E164PhoneNumbers\n\n\t\tmetadata := protocol.Metadata{}\n\t\tls0 := e.List(protocol.BodyTarget, \"E164PhoneNumbers\", metadata)\n\t\tls0.Start()\n\t\tfor _, v1 := range v {\n\t\t\tls0.ListAddValue(protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v1)})\n\t\t}\n\t\tls0.End()\n\n\t}\n\tif len(s.ProductType) > 0 {\n\t\tv := s.ProductType\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"ProductType\", protocol.QuotedValue{ValueMarshaler: v}, metadata)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "08aadbae97cb8c514284af78b69f88d5", "score": "0.5604231", "text": "func (s GetStreamKeyInput) MarshalFields(e protocol.FieldEncoder) error {\n\te.SetValue(protocol.HeaderTarget, \"Content-Type\", protocol.StringValue(\"application/json\"), protocol.Metadata{})\n\n\tif s.Arn != nil {\n\t\tv := *s.Arn\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"arn\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "f93127a294fde65d919f00aa90a565c6", "score": "0.56026995", "text": "func (s PutBucketVersioningInput) MarshalFields(e protocol.FieldEncoder) error {\n\n\tif s.MFA != nil {\n\t\tv := *s.MFA\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.HeaderTarget, \"x-amz-mfa\", protocol.StringValue(v), metadata)\n\t}\n\tif s.Bucket != nil {\n\t\tv := *s.Bucket\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.PathTarget, \"Bucket\", protocol.StringValue(v), metadata)\n\t}\n\tif s.VersioningConfiguration != nil {\n\t\tv := s.VersioningConfiguration\n\n\t\tmetadata := protocol.Metadata{XMLNamespaceURI: \"http://s3.amazonaws.com/doc/2006-03-01/\"}\n\t\te.SetFields(protocol.PayloadTarget, \"VersioningConfiguration\", v, metadata)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "0566f8a6a10f1c0b6077dbc5b6cafc42", "score": "0.558629", "text": "func (s CreateBucketOutput) MarshalFields(e protocol.FieldEncoder) error {\n\tif s.Location != nil {\n\t\tv := *s.Location\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.HeaderTarget, \"Location\", protocol.StringValue(v), metadata)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "7c03593ceaf1db9fcbd7a96fb697a161", "score": "0.5586218", "text": "func (s GetDiscoveredSchemaInput) MarshalFields(e protocol.FieldEncoder) error {\n\te.SetValue(protocol.HeaderTarget, \"Content-Type\", protocol.StringValue(\"application/json\"), protocol.Metadata{})\n\n\tif s.Events != nil {\n\t\tv := s.Events\n\n\t\tmetadata := protocol.Metadata{}\n\t\tls0 := e.List(protocol.BodyTarget, \"Events\", metadata)\n\t\tls0.Start()\n\t\tfor _, v1 := range v {\n\t\t\tls0.ListAddValue(protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v1)})\n\t\t}\n\t\tls0.End()\n\n\t}\n\tif len(s.Type) > 0 {\n\t\tv := s.Type\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"Type\", protocol.QuotedValue{ValueMarshaler: v}, metadata)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "217bf40c26d177f20dbbe5dfebce1541", "score": "0.55839384", "text": "func (s Input) MarshalFields(e protocol.FieldEncoder) error {\n\tif s.InputConfiguration != nil {\n\t\tv := s.InputConfiguration\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetFields(protocol.BodyTarget, \"inputConfiguration\", v, metadata)\n\t}\n\tif s.InputDefinition != nil {\n\t\tv := s.InputDefinition\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetFields(protocol.BodyTarget, \"inputDefinition\", v, metadata)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "69b8898b157138a5077bbe8b488a7f64", "score": "0.55822897", "text": "func (s CreateCommentInput) MarshalFields(e protocol.FieldEncoder) error {\n\te.SetValue(protocol.HeaderTarget, \"Content-Type\", protocol.StringValue(\"application/json\"), protocol.Metadata{})\n\n\tif s.NotifyCollaborators != nil {\n\t\tv := *s.NotifyCollaborators\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"NotifyCollaborators\", protocol.BoolValue(v), metadata)\n\t}\n\tif s.ParentId != nil {\n\t\tv := *s.ParentId\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"ParentId\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\tif s.Text != nil {\n\t\tv := *s.Text\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"Text\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\tif s.ThreadId != nil {\n\t\tv := *s.ThreadId\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"ThreadId\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\tif len(s.Visibility) > 0 {\n\t\tv := s.Visibility\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"Visibility\", protocol.QuotedValue{ValueMarshaler: v}, metadata)\n\t}\n\tif s.AuthenticationToken != nil {\n\t\tv := *s.AuthenticationToken\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.HeaderTarget, \"Authentication\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\tif s.DocumentId != nil {\n\t\tv := *s.DocumentId\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.PathTarget, \"DocumentId\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\tif s.VersionId != nil {\n\t\tv := *s.VersionId\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.PathTarget, \"VersionId\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "3694bdc6b5ecd4190c3fe11de4bd5838", "score": "0.5582076", "text": "func (s PutIntegrationResponseOutput) MarshalFields(e protocol.FieldEncoder) error {\n\tif len(s.ContentHandling) > 0 {\n\t\tv := s.ContentHandling\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"contentHandling\", protocol.QuotedValue{ValueMarshaler: v}, metadata)\n\t}\n\tif s.ResponseParameters != nil {\n\t\tv := s.ResponseParameters\n\n\t\tmetadata := protocol.Metadata{}\n\t\tms0 := e.Map(protocol.BodyTarget, \"responseParameters\", metadata)\n\t\tms0.Start()\n\t\tfor k1, v1 := range v {\n\t\t\tms0.MapSetValue(k1, protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v1)})\n\t\t}\n\t\tms0.End()\n\n\t}\n\tif s.ResponseTemplates != nil {\n\t\tv := s.ResponseTemplates\n\n\t\tmetadata := protocol.Metadata{}\n\t\tms0 := e.Map(protocol.BodyTarget, \"responseTemplates\", metadata)\n\t\tms0.Start()\n\t\tfor k1, v1 := range v {\n\t\t\tms0.MapSetValue(k1, protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v1)})\n\t\t}\n\t\tms0.End()\n\n\t}\n\tif s.SelectionPattern != nil {\n\t\tv := *s.SelectionPattern\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"selectionPattern\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\tif s.StatusCode != nil {\n\t\tv := *s.StatusCode\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"statusCode\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "cfcd94509b2e4f0eee0f3c3d2fead7f4", "score": "0.55797285", "text": "func (s PutBucketVersioningOutput) MarshalFields(e protocol.FieldEncoder) error {\n\treturn nil\n}", "title": "" }, { "docid": "2de44e05c208e15e1916381dd8e24fb6", "score": "0.5579498", "text": "func (s Edge) MarshalFields(e protocol.FieldEncoder) error {\n\tif len(s.Aliases) > 0 {\n\t\tv := s.Aliases\n\n\t\tmetadata := protocol.Metadata{}\n\t\tls0 := e.List(protocol.BodyTarget, \"Aliases\", metadata)\n\t\tls0.Start()\n\t\tfor _, v1 := range v {\n\t\t\tls0.ListAddFields(v1)\n\t\t}\n\t\tls0.End()\n\n\t}\n\tif s.EndTime != nil {\n\t\tv := *s.EndTime\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"EndTime\", protocol.TimeValue{V: v, Format: protocol.UnixTimeFormat}, metadata)\n\t}\n\tif s.ReferenceId != nil {\n\t\tv := *s.ReferenceId\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"ReferenceId\", protocol.Int64Value(v), metadata)\n\t}\n\tif len(s.ResponseTimeHistogram) > 0 {\n\t\tv := s.ResponseTimeHistogram\n\n\t\tmetadata := protocol.Metadata{}\n\t\tls0 := e.List(protocol.BodyTarget, \"ResponseTimeHistogram\", metadata)\n\t\tls0.Start()\n\t\tfor _, v1 := range v {\n\t\t\tls0.ListAddFields(v1)\n\t\t}\n\t\tls0.End()\n\n\t}\n\tif s.StartTime != nil {\n\t\tv := *s.StartTime\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"StartTime\", protocol.TimeValue{V: v, Format: protocol.UnixTimeFormat}, metadata)\n\t}\n\tif s.SummaryStatistics != nil {\n\t\tv := s.SummaryStatistics\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetFields(protocol.BodyTarget, \"SummaryStatistics\", v, metadata)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "6753b38e85dd657314bdf07ee4807aff", "score": "0.557648", "text": "func (s RegisterJobDefinitionInput) MarshalFields(e protocol.FieldEncoder) error {\n\te.SetValue(protocol.HeaderTarget, \"Content-Type\", protocol.StringValue(\"application/json\"), protocol.Metadata{})\n\n\tif s.ContainerProperties != nil {\n\t\tv := s.ContainerProperties\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetFields(protocol.BodyTarget, \"containerProperties\", v, metadata)\n\t}\n\tif s.JobDefinitionName != nil {\n\t\tv := *s.JobDefinitionName\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"jobDefinitionName\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\tif s.NodeProperties != nil {\n\t\tv := s.NodeProperties\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetFields(protocol.BodyTarget, \"nodeProperties\", v, metadata)\n\t}\n\tif s.Parameters != nil {\n\t\tv := s.Parameters\n\n\t\tmetadata := protocol.Metadata{}\n\t\tms0 := e.Map(protocol.BodyTarget, \"parameters\", metadata)\n\t\tms0.Start()\n\t\tfor k1, v1 := range v {\n\t\t\tms0.MapSetValue(k1, protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v1)})\n\t\t}\n\t\tms0.End()\n\n\t}\n\tif s.RetryStrategy != nil {\n\t\tv := s.RetryStrategy\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetFields(protocol.BodyTarget, \"retryStrategy\", v, metadata)\n\t}\n\tif s.Timeout != nil {\n\t\tv := s.Timeout\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetFields(protocol.BodyTarget, \"timeout\", v, metadata)\n\t}\n\tif len(s.Type) > 0 {\n\t\tv := s.Type\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"type\", protocol.QuotedValue{ValueMarshaler: v}, metadata)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "b3be543b1be65ae057a808d47780a636", "score": "0.5566982", "text": "func (s StartPipelineReprocessingInput) MarshalFields(e protocol.FieldEncoder) error {\n\te.SetValue(protocol.HeaderTarget, \"Content-Type\", protocol.StringValue(\"application/json\"), protocol.Metadata{})\n\n\tif s.EndTime != nil {\n\t\tv := *s.EndTime\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"endTime\",\n\t\t\tprotocol.TimeValue{V: v, Format: protocol.UnixTimeFormatName, QuotedFormatTime: true}, metadata)\n\t}\n\tif s.StartTime != nil {\n\t\tv := *s.StartTime\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"startTime\",\n\t\t\tprotocol.TimeValue{V: v, Format: protocol.UnixTimeFormatName, QuotedFormatTime: true}, metadata)\n\t}\n\tif s.PipelineName != nil {\n\t\tv := *s.PipelineName\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.PathTarget, \"pipelineName\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "3122534dfa2c381f305b7e9853f06822", "score": "0.556639", "text": "func (s CreateBucketInput) MarshalFields(e protocol.FieldEncoder) error {\n\n\tif len(s.ACL) > 0 {\n\t\tv := s.ACL\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.HeaderTarget, \"x-amz-acl\", v, metadata)\n\t}\n\tif s.GrantFullControl != nil {\n\t\tv := *s.GrantFullControl\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.HeaderTarget, \"x-amz-grant-full-control\", protocol.StringValue(v), metadata)\n\t}\n\tif s.GrantRead != nil {\n\t\tv := *s.GrantRead\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.HeaderTarget, \"x-amz-grant-read\", protocol.StringValue(v), metadata)\n\t}\n\tif s.GrantReadACP != nil {\n\t\tv := *s.GrantReadACP\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.HeaderTarget, \"x-amz-grant-read-acp\", protocol.StringValue(v), metadata)\n\t}\n\tif s.GrantWrite != nil {\n\t\tv := *s.GrantWrite\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.HeaderTarget, \"x-amz-grant-write\", protocol.StringValue(v), metadata)\n\t}\n\tif s.GrantWriteACP != nil {\n\t\tv := *s.GrantWriteACP\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.HeaderTarget, \"x-amz-grant-write-acp\", protocol.StringValue(v), metadata)\n\t}\n\tif s.Bucket != nil {\n\t\tv := *s.Bucket\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.PathTarget, \"Bucket\", protocol.StringValue(v), metadata)\n\t}\n\tif s.CreateBucketConfiguration != nil {\n\t\tv := s.CreateBucketConfiguration\n\n\t\tmetadata := protocol.Metadata{XMLNamespaceURI: \"http://s3.amazonaws.com/doc/2006-03-01/\"}\n\t\te.SetFields(protocol.PayloadTarget, \"CreateBucketConfiguration\", v, metadata)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "496884d9d820b9e40cd47871db6e2165", "score": "0.55623776", "text": "func (s HeadObjectInput) MarshalFields(e protocol.FieldEncoder) error {\n\n\tif s.IfMatch != nil {\n\t\tv := *s.IfMatch\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.HeaderTarget, \"If-Match\", protocol.StringValue(v), metadata)\n\t}\n\tif s.IfModifiedSince != nil {\n\t\tv := *s.IfModifiedSince\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.HeaderTarget, \"If-Modified-Since\", protocol.TimeValue{V: v, Format: protocol.RFC822TimeFromat}, metadata)\n\t}\n\tif s.IfNoneMatch != nil {\n\t\tv := *s.IfNoneMatch\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.HeaderTarget, \"If-None-Match\", protocol.StringValue(v), metadata)\n\t}\n\tif s.IfUnmodifiedSince != nil {\n\t\tv := *s.IfUnmodifiedSince\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.HeaderTarget, \"If-Unmodified-Since\", protocol.TimeValue{V: v, Format: protocol.RFC822TimeFromat}, metadata)\n\t}\n\tif s.Range != nil {\n\t\tv := *s.Range\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.HeaderTarget, \"Range\", protocol.StringValue(v), metadata)\n\t}\n\tif len(s.RequestPayer) > 0 {\n\t\tv := s.RequestPayer\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.HeaderTarget, \"x-amz-request-payer\", v, metadata)\n\t}\n\tif s.SSECustomerAlgorithm != nil {\n\t\tv := *s.SSECustomerAlgorithm\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.HeaderTarget, \"x-amz-server-side-encryption-customer-algorithm\", protocol.StringValue(v), metadata)\n\t}\n\tif s.SSECustomerKey != nil {\n\t\tv := *s.SSECustomerKey\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.HeaderTarget, \"x-amz-server-side-encryption-customer-key\", protocol.StringValue(v), metadata)\n\t}\n\tif s.SSECustomerKeyMD5 != nil {\n\t\tv := *s.SSECustomerKeyMD5\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.HeaderTarget, \"x-amz-server-side-encryption-customer-key-MD5\", protocol.StringValue(v), metadata)\n\t}\n\tif s.Bucket != nil {\n\t\tv := *s.Bucket\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.PathTarget, \"Bucket\", protocol.StringValue(v), metadata)\n\t}\n\tif s.Key != nil {\n\t\tv := *s.Key\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.PathTarget, \"Key\", protocol.StringValue(v), metadata)\n\t}\n\tif s.PartNumber != nil {\n\t\tv := *s.PartNumber\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.QueryTarget, \"partNumber\", protocol.Int64Value(v), metadata)\n\t}\n\tif s.VersionId != nil {\n\t\tv := *s.VersionId\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.QueryTarget, \"versionId\", protocol.StringValue(v), metadata)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "551c0f2b55d2d75640f9018db29a981b", "score": "0.5562025", "text": "func (s CreateSimulationApplicationVersionOutput) MarshalFields(e protocol.FieldEncoder) error {\n\tif s.Arn != nil {\n\t\tv := *s.Arn\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"arn\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\tif s.LastUpdatedAt != nil {\n\t\tv := *s.LastUpdatedAt\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"lastUpdatedAt\",\n\t\t\tprotocol.TimeValue{V: v, Format: protocol.UnixTimeFormatName, QuotedFormatTime: true}, metadata)\n\t}\n\tif s.Name != nil {\n\t\tv := *s.Name\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"name\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\tif s.RenderingEngine != nil {\n\t\tv := s.RenderingEngine\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetFields(protocol.BodyTarget, \"renderingEngine\", v, metadata)\n\t}\n\tif s.RevisionId != nil {\n\t\tv := *s.RevisionId\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"revisionId\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\tif s.RobotSoftwareSuite != nil {\n\t\tv := s.RobotSoftwareSuite\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetFields(protocol.BodyTarget, \"robotSoftwareSuite\", v, metadata)\n\t}\n\tif s.SimulationSoftwareSuite != nil {\n\t\tv := s.SimulationSoftwareSuite\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetFields(protocol.BodyTarget, \"simulationSoftwareSuite\", v, metadata)\n\t}\n\tif s.Sources != nil {\n\t\tv := s.Sources\n\n\t\tmetadata := protocol.Metadata{}\n\t\tls0 := e.List(protocol.BodyTarget, \"sources\", metadata)\n\t\tls0.Start()\n\t\tfor _, v1 := range v {\n\t\t\tls0.ListAddFields(v1)\n\t\t}\n\t\tls0.End()\n\n\t}\n\tif s.Version != nil {\n\t\tv := *s.Version\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"version\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "3f4f87ff3de71f56ad7df61cf30fd5e7", "score": "0.5558383", "text": "func (s DeprecateThingTypeInput) MarshalFields(e protocol.FieldEncoder) error {\n\te.SetValue(protocol.HeaderTarget, \"Content-Type\", protocol.StringValue(\"application/json\"), protocol.Metadata{})\n\n\tif s.UndoDeprecate != nil {\n\t\tv := *s.UndoDeprecate\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"undoDeprecate\", protocol.BoolValue(v), metadata)\n\t}\n\tif s.ThingTypeName != nil {\n\t\tv := *s.ThingTypeName\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.PathTarget, \"thingTypeName\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "4af3244f479d0e126ebcd66f7ecd7571", "score": "0.5558183", "text": "func (s SSES3) MarshalFields(e protocol.FieldEncoder) error {\n\treturn nil\n}", "title": "" }, { "docid": "c0e1bc56eaf3249b2555dce753b53f6d", "score": "0.55556935", "text": "func (s GetObjectInput) MarshalFields(e protocol.FieldEncoder) error {\n\n\tif s.IfMatch != nil {\n\t\tv := *s.IfMatch\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.HeaderTarget, \"If-Match\", protocol.StringValue(v), metadata)\n\t}\n\tif s.IfModifiedSince != nil {\n\t\tv := *s.IfModifiedSince\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.HeaderTarget, \"If-Modified-Since\",\n\t\t\tprotocol.TimeValue{V: v, Format: protocol.RFC822TimeFormatName, QuotedFormatTime: false}, metadata)\n\t}\n\tif s.IfNoneMatch != nil {\n\t\tv := *s.IfNoneMatch\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.HeaderTarget, \"If-None-Match\", protocol.StringValue(v), metadata)\n\t}\n\tif s.IfUnmodifiedSince != nil {\n\t\tv := *s.IfUnmodifiedSince\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.HeaderTarget, \"If-Unmodified-Since\",\n\t\t\tprotocol.TimeValue{V: v, Format: protocol.RFC822TimeFormatName, QuotedFormatTime: false}, metadata)\n\t}\n\tif s.Range != nil {\n\t\tv := *s.Range\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.HeaderTarget, \"Range\", protocol.StringValue(v), metadata)\n\t}\n\tif len(s.RequestPayer) > 0 {\n\t\tv := s.RequestPayer\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.HeaderTarget, \"x-amz-request-payer\", v, metadata)\n\t}\n\tif s.SSECustomerAlgorithm != nil {\n\t\tv := *s.SSECustomerAlgorithm\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.HeaderTarget, \"x-amz-server-side-encryption-customer-algorithm\", protocol.StringValue(v), metadata)\n\t}\n\tif s.SSECustomerKey != nil {\n\t\tv := *s.SSECustomerKey\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.HeaderTarget, \"x-amz-server-side-encryption-customer-key\", protocol.StringValue(v), metadata)\n\t}\n\tif s.SSECustomerKeyMD5 != nil {\n\t\tv := *s.SSECustomerKeyMD5\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.HeaderTarget, \"x-amz-server-side-encryption-customer-key-MD5\", protocol.StringValue(v), metadata)\n\t}\n\tif s.Bucket != nil {\n\t\tv := *s.Bucket\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.PathTarget, \"Bucket\", protocol.StringValue(v), metadata)\n\t}\n\tif s.Key != nil {\n\t\tv := *s.Key\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.PathTarget, \"Key\", protocol.StringValue(v), metadata)\n\t}\n\tif s.PartNumber != nil {\n\t\tv := *s.PartNumber\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.QueryTarget, \"partNumber\", protocol.Int64Value(v), metadata)\n\t}\n\tif s.ResponseCacheControl != nil {\n\t\tv := *s.ResponseCacheControl\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.QueryTarget, \"response-cache-control\", protocol.StringValue(v), metadata)\n\t}\n\tif s.ResponseContentDisposition != nil {\n\t\tv := *s.ResponseContentDisposition\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.QueryTarget, \"response-content-disposition\", protocol.StringValue(v), metadata)\n\t}\n\tif s.ResponseContentEncoding != nil {\n\t\tv := *s.ResponseContentEncoding\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.QueryTarget, \"response-content-encoding\", protocol.StringValue(v), metadata)\n\t}\n\tif s.ResponseContentLanguage != nil {\n\t\tv := *s.ResponseContentLanguage\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.QueryTarget, \"response-content-language\", protocol.StringValue(v), metadata)\n\t}\n\tif s.ResponseContentType != nil {\n\t\tv := *s.ResponseContentType\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.QueryTarget, \"response-content-type\", protocol.StringValue(v), metadata)\n\t}\n\tif s.ResponseExpires != nil {\n\t\tv := *s.ResponseExpires\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.QueryTarget, \"response-expires\",\n\t\t\tprotocol.TimeValue{V: v, Format: protocol.ISO8601TimeFormatName, QuotedFormatTime: false}, metadata)\n\t}\n\tif s.VersionId != nil {\n\t\tv := *s.VersionId\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.QueryTarget, \"versionId\", protocol.StringValue(v), metadata)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "94f4bae986313d640a4a697844bc29eb", "score": "0.555231", "text": "func (s DisconnectParticipantInput) MarshalFields(e protocol.FieldEncoder) error {\n\te.SetValue(protocol.HeaderTarget, \"Content-Type\", protocol.StringValue(\"application/json\"), protocol.Metadata{})\n\n\tvar ClientToken string\n\tif s.ClientToken != nil {\n\t\tClientToken = *s.ClientToken\n\t} else {\n\t\tClientToken = protocol.GetIdempotencyToken()\n\t}\n\t{\n\t\tv := ClientToken\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"ClientToken\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\tif s.ConnectionToken != nil {\n\t\tv := *s.ConnectionToken\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.HeaderTarget, \"X-Amz-Bearer\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "0fe02ced62c6932ec0c83c418c1e8349", "score": "0.5550365", "text": "func (s Service) MarshalFields(e protocol.FieldEncoder) error {\n\tif s.AccountId != nil {\n\t\tv := *s.AccountId\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"AccountId\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\tif len(s.DurationHistogram) > 0 {\n\t\tv := s.DurationHistogram\n\n\t\tmetadata := protocol.Metadata{}\n\t\tls0 := e.List(protocol.BodyTarget, \"DurationHistogram\", metadata)\n\t\tls0.Start()\n\t\tfor _, v1 := range v {\n\t\t\tls0.ListAddFields(v1)\n\t\t}\n\t\tls0.End()\n\n\t}\n\tif len(s.Edges) > 0 {\n\t\tv := s.Edges\n\n\t\tmetadata := protocol.Metadata{}\n\t\tls0 := e.List(protocol.BodyTarget, \"Edges\", metadata)\n\t\tls0.Start()\n\t\tfor _, v1 := range v {\n\t\t\tls0.ListAddFields(v1)\n\t\t}\n\t\tls0.End()\n\n\t}\n\tif s.EndTime != nil {\n\t\tv := *s.EndTime\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"EndTime\", protocol.TimeValue{V: v, Format: protocol.UnixTimeFormat}, metadata)\n\t}\n\tif s.Name != nil {\n\t\tv := *s.Name\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"Name\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\tif len(s.Names) > 0 {\n\t\tv := s.Names\n\n\t\tmetadata := protocol.Metadata{}\n\t\tls0 := e.List(protocol.BodyTarget, \"Names\", metadata)\n\t\tls0.Start()\n\t\tfor _, v1 := range v {\n\t\t\tls0.ListAddValue(protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v1)})\n\t\t}\n\t\tls0.End()\n\n\t}\n\tif s.ReferenceId != nil {\n\t\tv := *s.ReferenceId\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"ReferenceId\", protocol.Int64Value(v), metadata)\n\t}\n\tif len(s.ResponseTimeHistogram) > 0 {\n\t\tv := s.ResponseTimeHistogram\n\n\t\tmetadata := protocol.Metadata{}\n\t\tls0 := e.List(protocol.BodyTarget, \"ResponseTimeHistogram\", metadata)\n\t\tls0.Start()\n\t\tfor _, v1 := range v {\n\t\t\tls0.ListAddFields(v1)\n\t\t}\n\t\tls0.End()\n\n\t}\n\tif s.Root != nil {\n\t\tv := *s.Root\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"Root\", protocol.BoolValue(v), metadata)\n\t}\n\tif s.StartTime != nil {\n\t\tv := *s.StartTime\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"StartTime\", protocol.TimeValue{V: v, Format: protocol.UnixTimeFormat}, metadata)\n\t}\n\tif s.State != nil {\n\t\tv := *s.State\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"State\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\tif s.SummaryStatistics != nil {\n\t\tv := s.SummaryStatistics\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetFields(protocol.BodyTarget, \"SummaryStatistics\", v, metadata)\n\t}\n\tif s.Type != nil {\n\t\tv := *s.Type\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"Type\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "b2c11796081b4e354de6fbfad8d944ad", "score": "0.5549125", "text": "func (s Stream) MarshalFields(e protocol.FieldEncoder) error {\n\tif s.ChannelArn != nil {\n\t\tv := *s.ChannelArn\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"channelArn\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\tif len(s.Health) > 0 {\n\t\tv := s.Health\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"health\", protocol.QuotedValue{ValueMarshaler: v}, metadata)\n\t}\n\tif s.PlaybackUrl != nil {\n\t\tv := *s.PlaybackUrl\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"playbackUrl\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\tif s.StartTime != nil {\n\t\tv := *s.StartTime\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"startTime\",\n\t\t\tprotocol.TimeValue{V: v, Format: protocol.UnixTimeFormatName, QuotedFormatTime: true}, metadata)\n\t}\n\tif len(s.State) > 0 {\n\t\tv := s.State\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"state\", protocol.QuotedValue{ValueMarshaler: v}, metadata)\n\t}\n\tif s.ViewerCount != nil {\n\t\tv := *s.ViewerCount\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"viewerCount\", protocol.Int64Value(v), metadata)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "31c16617362b32c995d0e2e58d630720", "score": "0.55449986", "text": "func (s InputService22TestShapeInputService22TestCaseOperation6Input) MarshalFields(e protocol.FieldEncoder) error {\n\n\te.SetFields(protocol.BodyTarget, \"OperationRequest\", protocol.FieldMarshalerFunc(func(e protocol.FieldEncoder) error {\n\t\tif s.RecursiveStruct != nil {\n\t\t\tv := s.RecursiveStruct\n\n\t\t\tmetadata := protocol.Metadata{}\n\t\t\te.SetFields(protocol.BodyTarget, \"RecursiveStruct\", v, metadata)\n\t\t}\n\t\treturn nil\n\t}), protocol.Metadata{XMLNamespaceURI: \"https://foo/\"})\n\treturn nil\n}", "title": "" }, { "docid": "2fdaa3e5ea5525bf90038cf13d2655d3", "score": "0.55434954", "text": "func (s InputService7TestShapeInputService7TestCaseOperation1Input) MarshalFields(e protocol.FieldEncoder) error {\n\n\te.SetFields(protocol.BodyTarget, \"OperationRequest\", protocol.FieldMarshalerFunc(func(e protocol.FieldEncoder) error {\n\t\tif len(s.ListParam) > 0 {\n\t\t\tv := s.ListParam\n\n\t\t\tmetadata := protocol.Metadata{Flatten: true}\n\t\t\tls0 := e.List(protocol.BodyTarget, \"ListParam\", metadata)\n\t\t\tls0.Start()\n\t\t\tfor _, v1 := range v {\n\t\t\t\tls0.ListAddValue(protocol.StringValue(v1))\n\t\t\t}\n\t\t\tls0.End()\n\n\t\t}\n\t\treturn nil\n\t}), protocol.Metadata{XMLNamespaceURI: \"https://foo/\"})\n\treturn nil\n}", "title": "" }, { "docid": "01584b6ecc957253aa30698189469a77", "score": "0.5541927", "text": "func (s CreateVirtualRouterInput) MarshalFields(e protocol.FieldEncoder) error {\n\te.SetValue(protocol.HeaderTarget, \"Content-Type\", protocol.StringValue(\"application/x-amz-json-1.1\"), protocol.Metadata{})\n\n\tvar ClientToken string\n\tif s.ClientToken != nil {\n\t\tClientToken = *s.ClientToken\n\t} else {\n\t\tClientToken = protocol.GetIdempotencyToken()\n\t}\n\t{\n\t\tv := ClientToken\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"clientToken\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\tif s.Spec != nil {\n\t\tv := s.Spec\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetFields(protocol.BodyTarget, \"spec\", v, metadata)\n\t}\n\tif len(s.Tags) > 0 {\n\t\tv := s.Tags\n\n\t\tmetadata := protocol.Metadata{}\n\t\tls0 := e.List(protocol.BodyTarget, \"tags\", metadata)\n\t\tls0.Start()\n\t\tfor _, v1 := range v {\n\t\t\tls0.ListAddFields(v1)\n\t\t}\n\t\tls0.End()\n\n\t}\n\tif s.VirtualRouterName != nil {\n\t\tv := *s.VirtualRouterName\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"virtualRouterName\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\tif s.MeshName != nil {\n\t\tv := *s.MeshName\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.PathTarget, \"meshName\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "6dbd09981aabb932c49b2625c2b95542", "score": "0.5539292", "text": "func (s GetObjectInput) MarshalFields(e protocol.FieldEncoder) error {\n\n\tif s.IfMatch != nil {\n\t\tv := *s.IfMatch\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.HeaderTarget, \"If-Match\", protocol.StringValue(v), metadata)\n\t}\n\tif s.IfModifiedSince != nil {\n\t\tv := *s.IfModifiedSince\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.HeaderTarget, \"If-Modified-Since\", protocol.TimeValue{V: v, Format: protocol.RFC822TimeFromat}, metadata)\n\t}\n\tif s.IfNoneMatch != nil {\n\t\tv := *s.IfNoneMatch\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.HeaderTarget, \"If-None-Match\", protocol.StringValue(v), metadata)\n\t}\n\tif s.IfUnmodifiedSince != nil {\n\t\tv := *s.IfUnmodifiedSince\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.HeaderTarget, \"If-Unmodified-Since\", protocol.TimeValue{V: v, Format: protocol.RFC822TimeFromat}, metadata)\n\t}\n\tif s.Range != nil {\n\t\tv := *s.Range\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.HeaderTarget, \"Range\", protocol.StringValue(v), metadata)\n\t}\n\tif len(s.RequestPayer) > 0 {\n\t\tv := s.RequestPayer\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.HeaderTarget, \"x-amz-request-payer\", v, metadata)\n\t}\n\tif s.SSECustomerAlgorithm != nil {\n\t\tv := *s.SSECustomerAlgorithm\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.HeaderTarget, \"x-amz-server-side-encryption-customer-algorithm\", protocol.StringValue(v), metadata)\n\t}\n\tif s.SSECustomerKey != nil {\n\t\tv := *s.SSECustomerKey\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.HeaderTarget, \"x-amz-server-side-encryption-customer-key\", protocol.StringValue(v), metadata)\n\t}\n\tif s.SSECustomerKeyMD5 != nil {\n\t\tv := *s.SSECustomerKeyMD5\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.HeaderTarget, \"x-amz-server-side-encryption-customer-key-MD5\", protocol.StringValue(v), metadata)\n\t}\n\tif s.Bucket != nil {\n\t\tv := *s.Bucket\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.PathTarget, \"Bucket\", protocol.StringValue(v), metadata)\n\t}\n\tif s.Key != nil {\n\t\tv := *s.Key\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.PathTarget, \"Key\", protocol.StringValue(v), metadata)\n\t}\n\tif s.PartNumber != nil {\n\t\tv := *s.PartNumber\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.QueryTarget, \"partNumber\", protocol.Int64Value(v), metadata)\n\t}\n\tif s.ResponseCacheControl != nil {\n\t\tv := *s.ResponseCacheControl\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.QueryTarget, \"response-cache-control\", protocol.StringValue(v), metadata)\n\t}\n\tif s.ResponseContentDisposition != nil {\n\t\tv := *s.ResponseContentDisposition\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.QueryTarget, \"response-content-disposition\", protocol.StringValue(v), metadata)\n\t}\n\tif s.ResponseContentEncoding != nil {\n\t\tv := *s.ResponseContentEncoding\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.QueryTarget, \"response-content-encoding\", protocol.StringValue(v), metadata)\n\t}\n\tif s.ResponseContentLanguage != nil {\n\t\tv := *s.ResponseContentLanguage\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.QueryTarget, \"response-content-language\", protocol.StringValue(v), metadata)\n\t}\n\tif s.ResponseContentType != nil {\n\t\tv := *s.ResponseContentType\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.QueryTarget, \"response-content-type\", protocol.StringValue(v), metadata)\n\t}\n\tif s.ResponseExpires != nil {\n\t\tv := *s.ResponseExpires\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.QueryTarget, \"response-expires\", protocol.TimeValue{V: v, Format: protocol.RFC822TimeFromat}, metadata)\n\t}\n\tif s.VersionId != nil {\n\t\tv := *s.VersionId\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.QueryTarget, \"versionId\", protocol.StringValue(v), metadata)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "666b3d0524f5b61950c4798ab670ed15", "score": "0.5538264", "text": "func (s DeviceDescription) MarshalFields(e protocol.FieldEncoder) error {\n\tif s.Arn != nil {\n\t\tv := *s.Arn\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"arn\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\tif s.Attributes != nil {\n\t\tv := s.Attributes\n\n\t\tmetadata := protocol.Metadata{}\n\t\tms0 := e.Map(protocol.BodyTarget, \"attributes\", metadata)\n\t\tms0.Start()\n\t\tfor k1, v1 := range v {\n\t\t\tms0.MapSetValue(k1, protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v1)})\n\t\t}\n\t\tms0.End()\n\n\t}\n\tif s.DeviceId != nil {\n\t\tv := *s.DeviceId\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"deviceId\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\tif s.Enabled != nil {\n\t\tv := *s.Enabled\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"enabled\", protocol.BoolValue(v), metadata)\n\t}\n\tif s.RemainingLife != nil {\n\t\tv := *s.RemainingLife\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"remainingLife\", protocol.Float64Value(v), metadata)\n\t}\n\tif s.Tags != nil {\n\t\tv := s.Tags\n\n\t\tmetadata := protocol.Metadata{}\n\t\tms0 := e.Map(protocol.BodyTarget, \"tags\", metadata)\n\t\tms0.Start()\n\t\tfor k1, v1 := range v {\n\t\t\tms0.MapSetValue(k1, protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v1)})\n\t\t}\n\t\tms0.End()\n\n\t}\n\tif s.Type != nil {\n\t\tv := *s.Type\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"type\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "4f72021fd05139423095063f256284b4", "score": "0.5532093", "text": "func (s InputService25TestShapeInputService25TestCaseOperation2Input) MarshalFields(e protocol.FieldEncoder) error {\n\n\tif len(s.FooEnum) > 0 {\n\t\tv := s.FooEnum\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"FooEnum\", v, metadata)\n\t}\n\tif len(s.ListEnums) > 0 {\n\t\tv := s.ListEnums\n\n\t\tmetadata := protocol.Metadata{}\n\t\tls0 := e.List(protocol.BodyTarget, \"ListEnums\", metadata)\n\t\tls0.Start()\n\t\tfor _, v1 := range v {\n\t\t\tls0.ListAddValue(protocol.StringValue(v1))\n\t\t}\n\t\tls0.End()\n\n\t}\n\tif len(s.HeaderEnum) > 0 {\n\t\tv := s.HeaderEnum\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.HeaderTarget, \"x-amz-enum\", v, metadata)\n\t}\n\tif len(s.URIFooEnum) > 0 {\n\t\tv := s.URIFooEnum\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.PathTarget, \"URIEnum\", v, metadata)\n\t}\n\tif len(s.URIListEnums) > 0 {\n\t\tv := s.URIListEnums\n\n\t\tmetadata := protocol.Metadata{}\n\t\tls0 := e.List(protocol.QueryTarget, \"ListEnums\", metadata)\n\t\tls0.Start()\n\t\tfor _, v1 := range v {\n\t\t\tls0.ListAddValue(protocol.StringValue(v1))\n\t\t}\n\t\tls0.End()\n\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "12868960fefb49ecd14d45cfbf1d1ee0", "score": "0.553015", "text": "func (s FileSystemDescription) MarshalFields(e protocol.FieldEncoder) error {\n\tif s.CreationTime != nil {\n\t\tv := *s.CreationTime\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"CreationTime\",\n\t\t\tprotocol.TimeValue{V: v, Format: protocol.UnixTimeFormatName, QuotedFormatTime: true}, metadata)\n\t}\n\tif s.CreationToken != nil {\n\t\tv := *s.CreationToken\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"CreationToken\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\tif s.Encrypted != nil {\n\t\tv := *s.Encrypted\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"Encrypted\", protocol.BoolValue(v), metadata)\n\t}\n\tif s.FileSystemId != nil {\n\t\tv := *s.FileSystemId\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"FileSystemId\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\tif s.KmsKeyId != nil {\n\t\tv := *s.KmsKeyId\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"KmsKeyId\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\tif len(s.LifeCycleState) > 0 {\n\t\tv := s.LifeCycleState\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"LifeCycleState\", protocol.QuotedValue{ValueMarshaler: v}, metadata)\n\t}\n\tif s.Name != nil {\n\t\tv := *s.Name\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"Name\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\tif s.NumberOfMountTargets != nil {\n\t\tv := *s.NumberOfMountTargets\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"NumberOfMountTargets\", protocol.Int64Value(v), metadata)\n\t}\n\tif s.OwnerId != nil {\n\t\tv := *s.OwnerId\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"OwnerId\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\tif len(s.PerformanceMode) > 0 {\n\t\tv := s.PerformanceMode\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"PerformanceMode\", protocol.QuotedValue{ValueMarshaler: v}, metadata)\n\t}\n\tif s.ProvisionedThroughputInMibps != nil {\n\t\tv := *s.ProvisionedThroughputInMibps\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"ProvisionedThroughputInMibps\", protocol.Float64Value(v), metadata)\n\t}\n\tif s.SizeInBytes != nil {\n\t\tv := s.SizeInBytes\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetFields(protocol.BodyTarget, \"SizeInBytes\", v, metadata)\n\t}\n\tif s.Tags != nil {\n\t\tv := s.Tags\n\n\t\tmetadata := protocol.Metadata{}\n\t\tls0 := e.List(protocol.BodyTarget, \"Tags\", metadata)\n\t\tls0.Start()\n\t\tfor _, v1 := range v {\n\t\t\tls0.ListAddFields(v1)\n\t\t}\n\t\tls0.End()\n\n\t}\n\tif len(s.ThroughputMode) > 0 {\n\t\tv := s.ThroughputMode\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"ThroughputMode\", protocol.QuotedValue{ValueMarshaler: v}, metadata)\n\t}\n\treturn nil\n}", "title": "" } ]
d6a6b233a4e39cdc108a254e275622ab
AddTaskStats indicates an expected call of AddTaskStats
[ { "docid": "750e9ac7948d73c5998c98329f68b5aa", "score": "0.8071517", "text": "func (mr *MockFirmamentSchedulerClientMockRecorder) AddTaskStats(ctx, in interface{}, opts ...interface{}) *gomock.Call {\n\tvarargs := append([]interface{}{ctx, in}, opts...)\n\treturn mr.mock.ctrl.RecordCallWithMethodType(mr.mock, \"AddTaskStats\", reflect.TypeOf((*MockFirmamentSchedulerClient)(nil).AddTaskStats), varargs...)\n}", "title": "" } ]
[ { "docid": "844ab7abf2d9149a53064f1e2fb7b4ff", "score": "0.79793906", "text": "func (mr *MockFirmamentSchedulerServerMockRecorder) AddTaskStats(arg0, arg1 interface{}) *gomock.Call {\n\treturn mr.mock.ctrl.RecordCallWithMethodType(mr.mock, \"AddTaskStats\", reflect.TypeOf((*MockFirmamentSchedulerServer)(nil).AddTaskStats), arg0, arg1)\n}", "title": "" }, { "docid": "4ae070684c8d10566af439a0a68826b3", "score": "0.732072", "text": "func (m *MockFirmamentSchedulerClient) AddTaskStats(ctx context.Context, in *TaskStats, opts ...grpc.CallOption) (*TaskStatsResponse, 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, \"AddTaskStats\", varargs...)\n\tret0, _ := ret[0].(*TaskStatsResponse)\n\tret1, _ := ret[1].(error)\n\treturn ret0, ret1\n}", "title": "" }, { "docid": "43fcb347c3a9b46f53bd6499512e70ac", "score": "0.69757026", "text": "func (mr *MockFirmamentSchedulerClientMockRecorder) AddNodeStats(ctx, in interface{}, opts ...interface{}) *gomock.Call {\n\tvarargs := append([]interface{}{ctx, in}, opts...)\n\treturn mr.mock.ctrl.RecordCallWithMethodType(mr.mock, \"AddNodeStats\", reflect.TypeOf((*MockFirmamentSchedulerClient)(nil).AddNodeStats), varargs...)\n}", "title": "" }, { "docid": "f5deb33a962a61e231f381f9acd46199", "score": "0.6842358", "text": "func (mr *MockFirmamentSchedulerServerMockRecorder) AddNodeStats(arg0, arg1 interface{}) *gomock.Call {\n\treturn mr.mock.ctrl.RecordCallWithMethodType(mr.mock, \"AddNodeStats\", reflect.TypeOf((*MockFirmamentSchedulerServer)(nil).AddNodeStats), arg0, arg1)\n}", "title": "" }, { "docid": "6742cfaff54b18924c05a31684ba661d", "score": "0.66222954", "text": "func (m *MockFirmamentSchedulerServer) AddTaskStats(arg0 context.Context, arg1 *TaskStats) (*TaskStatsResponse, error) {\n\tret := m.ctrl.Call(m, \"AddTaskStats\", arg0, arg1)\n\tret0, _ := ret[0].(*TaskStatsResponse)\n\tret1, _ := ret[1].(error)\n\treturn ret0, ret1\n}", "title": "" }, { "docid": "f2ca33c33ccdd157ec89fb12c0bf6fbe", "score": "0.6284726", "text": "func (m *MockFirmamentSchedulerClient) AddNodeStats(ctx context.Context, in *ResourceStats, opts ...grpc.CallOption) (*ResourceStatsResponse, 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, \"AddNodeStats\", varargs...)\n\tret0, _ := ret[0].(*ResourceStatsResponse)\n\tret1, _ := ret[1].(error)\n\treturn ret0, ret1\n}", "title": "" }, { "docid": "036f0f5c78cc99bce9c826fe570ec6b1", "score": "0.6276051", "text": "func (mr *MockFirmamentSchedulerClientMockRecorder) AddTaskInfo(ctx, in interface{}, opts ...interface{}) *gomock.Call {\n\tvarargs := append([]interface{}{ctx, in}, opts...)\n\treturn mr.mock.ctrl.RecordCallWithMethodType(mr.mock, \"AddTaskInfo\", reflect.TypeOf((*MockFirmamentSchedulerClient)(nil).AddTaskInfo), varargs...)\n}", "title": "" }, { "docid": "437aef06d9fc706fc977145744445d76", "score": "0.61713713", "text": "func (mr *MockFirmamentSchedulerServerMockRecorder) AddTaskInfo(arg0, arg1 interface{}) *gomock.Call {\n\treturn mr.mock.ctrl.RecordCallWithMethodType(mr.mock, \"AddTaskInfo\", reflect.TypeOf((*MockFirmamentSchedulerServer)(nil).AddTaskInfo), arg0, arg1)\n}", "title": "" }, { "docid": "276fdf7fc4503dfc42bc54853bb5a56d", "score": "0.6011132", "text": "func (mr *MockTaskDaoMockRecorder) AddTask(task interface{}) *gomock.Call {\n\tmr.mock.ctrl.T.Helper()\n\treturn mr.mock.ctrl.RecordCallWithMethodType(mr.mock, \"AddTask\", reflect.TypeOf((*MockTaskDao)(nil).AddTask), task)\n}", "title": "" }, { "docid": "823d43664e12cf59d047b7d23dcc15f5", "score": "0.58724123", "text": "func (mr *MockHealthCheckMockRecorder) RegisterStats() *gomock.Call {\n\tmr.mock.ctrl.T.Helper()\n\treturn mr.mock.ctrl.RecordCallWithMethodType(mr.mock, \"RegisterStats\", reflect.TypeOf((*MockHealthCheck)(nil).RegisterStats))\n}", "title": "" }, { "docid": "e41ae7c78414a291e0806914b3a99fbc", "score": "0.58535206", "text": "func (mr *MockHealthCheckMockRecorder) RegisterStats() *gomock.Call {\n\treturn mr.mock.ctrl.RecordCallWithMethodType(mr.mock, \"RegisterStats\", reflect.TypeOf((*MockHealthCheck)(nil).RegisterStats))\n}", "title": "" }, { "docid": "a433db34f92b5354434c44112172b186", "score": "0.5836012", "text": "func (m *MockFirmamentSchedulerClient) AddTaskInfo(ctx context.Context, in *TaskInfo, opts ...grpc.CallOption) (*TaskInfoResponse, 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, \"AddTaskInfo\", varargs...)\n\tret0, _ := ret[0].(*TaskInfoResponse)\n\tret1, _ := ret[1].(error)\n\treturn ret0, ret1\n}", "title": "" }, { "docid": "f966a296ec51110daf41b57927200af0", "score": "0.5695792", "text": "func (m *MockFirmamentSchedulerServer) AddNodeStats(arg0 context.Context, arg1 *ResourceStats) (*ResourceStatsResponse, error) {\n\tret := m.ctrl.Call(m, \"AddNodeStats\", arg0, arg1)\n\tret0, _ := ret[0].(*ResourceStatsResponse)\n\tret1, _ := ret[1].(error)\n\treturn ret0, ret1\n}", "title": "" }, { "docid": "04837b712af1d1ea5ef1b0fc4cbb8257", "score": "0.56089324", "text": "func (o *Orchestrator) AddTask(taskDefinition interface{}, opts ...TaskOption) {\n\to.mu.Lock()\n\tdefer o.mu.Unlock()\n\n\t// Ensure we don't already have this task\n\tfor _, t := range o.expectedTasks {\n\t\tif taskDefinition == t.Definition {\n\t\t\treturn\n\t\t}\n\t}\n\n\tt := Task{Definition: taskDefinition, Instances: 1}\n\tfor _, opt := range opts {\n\t\topt(&t)\n\t}\n\n\to.expectedTasks = append(o.expectedTasks, t)\n}", "title": "" }, { "docid": "2291be30f43ca547ecc355a7f178c120", "score": "0.5594961", "text": "func (mr *MockWatcherMockRecorder) HasTask() *gomock.Call {\n\tmr.mock.ctrl.T.Helper()\n\treturn mr.mock.ctrl.RecordCallWithMethodType(mr.mock, \"HasTask\", reflect.TypeOf((*MockWatcher)(nil).HasTask))\n}", "title": "" }, { "docid": "677df6c5ed1c2d287f2c17626f926dcd", "score": "0.54396266", "text": "func (mr *MockDBMockRecorder) UpdateTaskResults(task, status, results interface{}) *gomock.Call {\n\tmr.mock.ctrl.T.Helper()\n\treturn mr.mock.ctrl.RecordCallWithMethodType(mr.mock, \"UpdateTaskResults\", reflect.TypeOf((*MockDB)(nil).UpdateTaskResults), task, status, results)\n}", "title": "" }, { "docid": "49527e37c6cdb85d9570d1c38f466bfb", "score": "0.54198724", "text": "func (mr *MockDBStorageMockRecorder) CountTask(arg0 interface{}) *gomock.Call {\n\tmr.mock.ctrl.T.Helper()\n\treturn mr.mock.ctrl.RecordCallWithMethodType(mr.mock, \"CountTask\", reflect.TypeOf((*MockDBStorage)(nil).CountTask), arg0)\n}", "title": "" }, { "docid": "12fef939abc3911e6a86d01cd12957ee", "score": "0.53827137", "text": "func Test_addStatisticEntry(t *testing.T) {\n\t// type of entry to check\n\tcommandType := \"joke\"\n\t// ensure that i entry exits\n\tStatistic(commandType)\n\n\t// count nr of existing entries\n\tjokeStat, err := database.GetStatObject(commandType)\n\tif err != nil {\n\t\tt.Error(\"fail, can not retrieve entry for\", commandType)\n\t}\n\t// convert to int\n\tfirstCount, err2 := strconv.Atoi(jokeStat.Visitors)\n\tif err2 != nil {\n\t\tt.Error(\"fail, unable to convert visitor count to int \", err2)\n\t}\n\n\t// add +1 to entry type\n\tStatistic(commandType)\n\t// count nr of existing entries\n\tjokeStat2, err3 := database.GetStatObject(commandType)\n\tif err3 != nil {\n\t\tt.Error(\"fail, can not retrieve entry for\", commandType, err3)\n\t}\n\t// convert to int\n\tsecondCount, err4 := strconv.Atoi(jokeStat2.Visitors)\n\tif err4 != nil {\n\t\tt.Error(\"fail, unable to convert visitor count to int \", err4)\n\t}\n\t// check if nr of count is correct\n\tif secondCount != (firstCount + 1) {\n\t\tt.Error(\"fail, wrong visitor count \")\n\t}\n\n}", "title": "" }, { "docid": "2a282ebd1a69c875d9b7f909d190eba0", "score": "0.53280437", "text": "func (nsc *NilConsumerStatsCollector) AddCheckpointSent(int) {}", "title": "" }, { "docid": "114f690a1d53924b8262004936ec7052", "score": "0.53200305", "text": "func (nsc *NilConsumerStatsCollector) AddCheckpointDone(int) {}", "title": "" }, { "docid": "f35f0b05d1f4aca13abf7e5de293c644", "score": "0.52972496", "text": "func (mr *MockContextMockRecorder) AddTasks(request interface{}) *gomock.Call {\n\tmr.mock.ctrl.T.Helper()\n\treturn mr.mock.ctrl.RecordCallWithMethodType(mr.mock, \"AddTasks\", reflect.TypeOf((*MockContext)(nil).AddTasks), request)\n}", "title": "" }, { "docid": "11a02fa44bf8df3318ffc7c08f2909aa", "score": "0.52779084", "text": "func (o *Orchestrator) totalTaskCount() int {\n\tvar total int\n\tfor _, t := range o.expectedTasks {\n\t\ttotal += t.Instances\n\t}\n\treturn total\n}", "title": "" }, { "docid": "d82c6c44ef4ece75880908d11c163c0e", "score": "0.52611595", "text": "func Test_Stat(t *testing.T) {\n\tConvey(\"AddIncrStatistics\", t, func() {\n\t\tvar (\n\t\t\tc = context.TODO()\n\t\t\terr error\n\t\t)\n\t\tstat := &model.Statistics{\n\t\t\tTargetMid: 1,\n\t\t\tTargetID: 1,\n\t\t\tEventID: 1,\n\t\t\tState: 0,\n\t\t\tType: 1,\n\t\t\tQuantity: 1,\n\t\t\tCtime: time.Now(),\n\t\t}\n\t\t_, err = d.AddIncrStatistics(c, stat)\n\t\tSo(err, ShouldBeNil)\n\t})\n\tConvey(\"AddStatistics\", t, func() {\n\t\tvar (\n\t\t\tc = context.TODO()\n\t\t\terr error\n\t\t)\n\t\tstat := &model.Statistics{\n\t\t\tTargetMid: 1,\n\t\t\tTargetID: 1,\n\t\t\tEventID: 2,\n\t\t\tState: 0,\n\t\t\tType: 1,\n\t\t\tQuantity: 1,\n\t\t\tCtime: time.Now(),\n\t\t}\n\t\tstat.Quantity = 3\n\t\t_, err = d.AddStatistics(c, stat)\n\t\tSo(err, ShouldBeNil)\n\t})\n}", "title": "" }, { "docid": "331a58c0243064243759e02dda2ccb40", "score": "0.52512133", "text": "func (mr *MockICompilationTaskMockRecorder) UpdateTaskResults(task, status, results interface{}) *gomock.Call {\n\tmr.mock.ctrl.T.Helper()\n\treturn mr.mock.ctrl.RecordCallWithMethodType(mr.mock, \"UpdateTaskResults\", reflect.TypeOf((*MockICompilationTask)(nil).UpdateTaskResults), task, status, results)\n}", "title": "" }, { "docid": "2d082836335aa40fa483b90078a6601c", "score": "0.5201", "text": "func (mr *MockDBMockRecorder) UpdateTaskStatus(taskID, status interface{}) *gomock.Call {\n\tmr.mock.ctrl.T.Helper()\n\treturn mr.mock.ctrl.RecordCallWithMethodType(mr.mock, \"UpdateTaskStatus\", reflect.TypeOf((*MockDB)(nil).UpdateTaskStatus), taskID, status)\n}", "title": "" }, { "docid": "3527b1b285de264abe3035f2f310a4a8", "score": "0.5199898", "text": "func (mr *MockSFNAPIMockRecorder) SendTaskHeartbeat(arg0 interface{}) *gomock.Call {\n\tmr.mock.ctrl.T.Helper()\n\treturn mr.mock.ctrl.RecordCallWithMethodType(mr.mock, \"SendTaskHeartbeat\", reflect.TypeOf((*MockSFNAPI)(nil).SendTaskHeartbeat), arg0)\n}", "title": "" }, { "docid": "0dac9ab32f0d8ea660fd20abdf3a5fdf", "score": "0.5185154", "text": "func (nsc *NilConsumerStatsCollector) AddCheckpointSuccess(int) {}", "title": "" }, { "docid": "ec3a07cba3d0625f78d1c0429b672ab0", "score": "0.5174278", "text": "func (op *AddonOperator) logTaskAdd(logEntry *log.Entry, action string, tasks ...sh_task.Task) {\n\tlogger := logEntry.WithField(\"task.flow\", \"add\")\n\tfor _, tsk := range tasks {\n\t\tlogger.Infof(taskDescriptionForTaskFlowLog(tsk, action, \"\", \"\"))\n\t}\n}", "title": "" }, { "docid": "47dc96852d732f0b3cc9d4f9bbf210c4", "score": "0.514898", "text": "func (mr *MockContractMockRecorder) GetUserStats(arg0, arg1, arg2 interface{}) *gomock.Call {\n\tmr.mock.ctrl.T.Helper()\n\treturn mr.mock.ctrl.RecordCallWithMethodType(mr.mock, \"GetUserStats\", reflect.TypeOf((*MockContract)(nil).GetUserStats), arg0, arg1, arg2)\n}", "title": "" }, { "docid": "1b884894423a3c48cc17e75f1c4d0a3a", "score": "0.5148364", "text": "func (ts *TaskService) Stats(ctx context.Context, req *taskAPI.StatsRequest) (*taskAPI.StatsResponse, error) {\n\tdefer logPanicAndDie(log.G(ctx))\n\n\tlog.G(ctx).WithField(\"id\", req.ID).Debug(\"stats\")\n\ttask, err := ts.taskManager.Task(req.ID)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tctx = namespaces.WithNamespace(ctx, defaultNamespace)\n\tresp, err := task.Stats(ctx, req)\n\tif err != nil {\n\t\tlog.G(ctx).WithError(err).Error(\"stats failed\")\n\t\treturn nil, err\n\t}\n\n\tlog.G(ctx).Debug(\"stats succeeded\")\n\treturn resp, nil\n}", "title": "" }, { "docid": "f505e53a25e0ce97b9d2eec18c74619a", "score": "0.5146584", "text": "func (mr *MockHealthCheckMockRecorder) AddTablet(arg0 interface{}) *gomock.Call {\n\tmr.mock.ctrl.T.Helper()\n\treturn mr.mock.ctrl.RecordCallWithMethodType(mr.mock, \"AddTablet\", reflect.TypeOf((*MockHealthCheck)(nil).AddTablet), arg0)\n}", "title": "" }, { "docid": "8ae6796597e844ba81458af7a8e44159", "score": "0.5141387", "text": "func (m *MockHealthCheck) RegisterStats() {\n\tm.ctrl.Call(m, \"RegisterStats\")\n}", "title": "" }, { "docid": "c90b923f1d7558287720c34a88620ccb", "score": "0.5140023", "text": "func (mr *MockHealthCheckMockRecorder) AddTablet(arg0, arg1 interface{}) *gomock.Call {\n\treturn mr.mock.ctrl.RecordCallWithMethodType(mr.mock, \"AddTablet\", reflect.TypeOf((*MockHealthCheck)(nil).AddTablet), arg0, arg1)\n}", "title": "" }, { "docid": "2b49ccdfae7f6b76161cf472cf210804", "score": "0.5106353", "text": "func (m *MockFirmamentSchedulerServer) AddTaskInfo(arg0 context.Context, arg1 *TaskInfo) (*TaskInfoResponse, error) {\n\tret := m.ctrl.Call(m, \"AddTaskInfo\", arg0, arg1)\n\tret0, _ := ret[0].(*TaskInfoResponse)\n\tret1, _ := ret[1].(error)\n\treturn ret0, ret1\n}", "title": "" }, { "docid": "0fb2204cf0cdcbb00aad52e58420208c", "score": "0.51050454", "text": "func (mr *MockICompilationTaskMockRecorder) UpdateTaskStatus(taskID, status interface{}) *gomock.Call {\n\tmr.mock.ctrl.T.Helper()\n\treturn mr.mock.ctrl.RecordCallWithMethodType(mr.mock, \"UpdateTaskStatus\", reflect.TypeOf((*MockICompilationTask)(nil).UpdateTaskStatus), taskID, status)\n}", "title": "" }, { "docid": "567a9ac0e5f7a9cca9795000a5de011b", "score": "0.5090858", "text": "func (m *MockTaskDao) AddTask(task *task.OwlTask) (int64, error) {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"AddTask\", task)\n\tret0, _ := ret[0].(int64)\n\tret1, _ := ret[1].(error)\n\treturn ret0, ret1\n}", "title": "" }, { "docid": "faac3f9baae8284e570f35c0edc8f197", "score": "0.5087866", "text": "func (mr *MockNuvoVMMockRecorder) GetStats(arg0, arg1, arg2, arg3 interface{}) *gomock.Call {\n\tmr.mock.ctrl.T.Helper()\n\treturn mr.mock.ctrl.RecordCallWithMethodType(mr.mock, \"GetStats\", reflect.TypeOf((*MockNuvoVM)(nil).GetStats), arg0, arg1, arg2, arg3)\n}", "title": "" }, { "docid": "46fa6c32ce3badc862e9e34db54ef982", "score": "0.50857013", "text": "func (sl StagesLatency) HaveRelativeStats() bool {\n\treturn true\n}", "title": "" }, { "docid": "b254faef0d2046f2441a66e9893361c2", "score": "0.50758743", "text": "func (mr *MockResultDBClientMockRecorder) QueryTestResultStatistics(ctx, in interface{}, opts ...interface{}) *gomock.Call {\n\tmr.mock.ctrl.T.Helper()\n\tvarargs := append([]interface{}{ctx, in}, opts...)\n\treturn mr.mock.ctrl.RecordCallWithMethodType(mr.mock, \"QueryTestResultStatistics\", reflect.TypeOf((*MockResultDBClient)(nil).QueryTestResultStatistics), varargs...)\n}", "title": "" }, { "docid": "6eaaa25650af8acf2e4d493c41e33c98", "score": "0.50734675", "text": "func ShouldCollectStats(ctx context.Context, flowCtx *FlowCtx) bool {\n\treturn tracing.SpanFromContext(ctx) != nil && flowCtx.CollectStats\n}", "title": "" }, { "docid": "8ed56607ef7b7c1cfb7c89d348df631d", "score": "0.50667775", "text": "func hourlyTestStatsForOldTasksPipeline(projectId string, requester string, start time.Time, end time.Time, tasks []string, lastUpdate time.Time) []bson.M {\n\t// Using the same pipeline as for the tasks collection as the base.\n\tbasePipeline := getHourlyTestStatsPipeline(projectId, requester, start, end, tasks, lastUpdate, true)\n\t// And the merge the documents with the existing ones.\n\tmergePipeline := []bson.M{\n\t\t{\"$lookup\": bson.M{\n\t\t\t\"from\": hourlyTestStatsCollection,\n\t\t\t\"localField\": \"_id\",\n\t\t\t\"foreignField\": \"_id\",\n\t\t\t\"as\": \"existing\",\n\t\t}},\n\t\t{\"$unwind\": bson.M{\n\t\t\t\"path\": \"$existing\",\n\t\t\t\"preserveNullAndEmptyArrays\": true,\n\t\t}},\n\t\t{\"$project\": bson.M{\n\t\t\t\"_id\": 1,\n\t\t\t\"num_pass\": bson.M{\"$add\": array{\"$num_pass\", \"$existing.num_pass\"}},\n\t\t\t\"num_fail\": bson.M{\"$add\": array{\"$num_fail\", \"$existing.num_fail\"}},\n\t\t\t\"total_duration_pass\": bson.M{\"$add\": array{\n\t\t\t\tbson.M{\"$ifNull\": array{bson.M{\"$multiply\": array{\"$num_pass\", \"$avg_duration_pass\"}}, 0}},\n\t\t\t\tbson.M{\"$ifNull\": array{bson.M{\"$multiply\": array{\"$existing.num_pass\", \"$existing.avg_duration_pass\"}}, 0}},\n\t\t\t}},\n\t\t\t\"last_update\": 1,\n\t\t}},\n\t\t{\"$project\": bson.M{\n\t\t\t\"_id\": 1,\n\t\t\t\"num_pass\": 1,\n\t\t\t\"num_fail\": 1,\n\t\t\t\"avg_duration_pass\": bson.M{\"$cond\": bson.M{\"if\": bson.M{\"$ne\": array{\"$num_pass\", 0}},\n\t\t\t\t\"then\": bson.M{\"$divide\": array{\"$total_duration_pass\", \"$num_pass\"}},\n\t\t\t\t\"else\": nil}},\n\t\t\t\"last_update\": 1,\n\t\t}},\n\t}\n\treturn append(basePipeline, mergePipeline...)\n}", "title": "" }, { "docid": "437465171cc8485a27a623cef803133e", "score": "0.5057269", "text": "func (mr *MockBulkProcessorMockRecorder) Add(arg0 interface{}) *gomock.Call {\n\tmr.mock.ctrl.T.Helper()\n\treturn mr.mock.ctrl.RecordCallWithMethodType(mr.mock, \"Add\", reflect.TypeOf((*MockBulkProcessor)(nil).Add), arg0)\n}", "title": "" }, { "docid": "16f1451fa0674b9c2a9266abd148be5d", "score": "0.50280917", "text": "func (target *TaskStatistics) Add(source TaskStatistics) {\n\tif target.Name == \"\" {\n\t\ttarget.Name = source.Name\n\t}\n\tif target.URI == \"\" {\n\t\ttarget.URI = source.URI\n\t}\n\ttarget.SnapshotsWaiting += source.SnapshotsWaiting\n\ttarget.SnapshotsInProgress += source.SnapshotsInProgress\n\ttarget.SnapshotsSucceeded += source.SnapshotsSucceeded\n\ttarget.SnapshotsFailed += source.SnapshotsFailed\n\n\tfor _, s := range source.Inputs {\n\t\tt := target.InputByName(s.Name)\n\t\tt.Add(*s)\n\t}\n\n\tfor _, s := range source.Outputs {\n\t\tt := target.OutputByName(s.Name)\n\t\tt.Add(*s)\n\t}\n}", "title": "" }, { "docid": "0f47d97039681095b27fb2102373ba6f", "score": "0.5019232", "text": "func (s *DevStat) AddMeasStats(mets int64, mete int64, meass int64, mease int64) {\n\ts.mutex.Lock()\n\tdefer s.mutex.Unlock()\n\ts.Counters[MetricSent] = s.Counters[MetricSent].(int) + int(mets)\n\ts.Counters[MetricSentErrors] = s.Counters[MetricSentErrors].(int) + int(mete)\n\ts.Counters[MeasurementSent] = s.Counters[MeasurementSent].(int) + int(meass)\n\ts.Counters[MeasurementSentErrors] = s.Counters[MeasurementSentErrors].(int) + int(mease)\n}", "title": "" }, { "docid": "dc7d54b19b7aa567de30f144ad2f6bd4", "score": "0.5013254", "text": "func (mr *MockFirmamentSchedulerClientMockRecorder) TaskUpdated(ctx, in interface{}, opts ...interface{}) *gomock.Call {\n\tvarargs := append([]interface{}{ctx, in}, opts...)\n\treturn mr.mock.ctrl.RecordCallWithMethodType(mr.mock, \"TaskUpdated\", reflect.TypeOf((*MockFirmamentSchedulerClient)(nil).TaskUpdated), varargs...)\n}", "title": "" }, { "docid": "cd08605ac33874658586663ee26cef43", "score": "0.5010357", "text": "func (target *TaskOutputStatistics) Add(source TaskOutputStatistics) {\n\tif target.Name == \"\" {\n\t\ttarget.Name = source.Name\n\t}\n\ttarget.AnnotatedValuesPublished += source.AnnotatedValuesPublished\n}", "title": "" }, { "docid": "b3c1d3c888987d23264c87fb966f4ad5", "score": "0.5008909", "text": "func (nsc *NilConsumerStatsCollector) AddGetRecordsCalled(int) {}", "title": "" }, { "docid": "1d013c4e41750f294d1e016b2e2c5e07", "score": "0.5005512", "text": "func (mr *MockWaiterMockRecorder) Add(arg0 interface{}) *gomock.Call {\n\tmr.mock.ctrl.T.Helper()\n\treturn mr.mock.ctrl.RecordCallWithMethodType(mr.mock, \"Add\", reflect.TypeOf((*MockWaiter)(nil).Add), arg0)\n}", "title": "" }, { "docid": "89029a294394ec50c001da74d3d23350", "score": "0.49960482", "text": "func (target *TaskInputStatistics) Add(source TaskInputStatistics) {\n\tif target.Name == \"\" {\n\t\ttarget.Name = source.Name\n\t}\n\ttarget.AnnotatedValuesReceived += source.AnnotatedValuesReceived\n\ttarget.AnnotatedValuesInProgress += source.AnnotatedValuesInProgress\n\ttarget.AnnotatedValuesProcessed += source.AnnotatedValuesProcessed\n\ttarget.AnnotatedValuesSkipped += source.AnnotatedValuesSkipped\n}", "title": "" }, { "docid": "01e63028c0e93540b262165ba6cb8853", "score": "0.49843097", "text": "func TestTaskSort(t *testing.T) {\n\tvar tasks []*api.Task\n\tsize := 5\n\tseconds := int64(size)\n\tfor i := 0; i < size; i++ {\n\t\ttask := &api.Task{\n\t\t\tID: \"id_\" + strconv.Itoa(i),\n\t\t\tStatus: api.TaskStatus{\n\t\t\t\tTimestamp: &google_protobuf.Timestamp{Seconds: seconds},\n\t\t\t},\n\t\t}\n\n\t\tseconds--\n\t\ttasks = append(tasks, task)\n\t}\n\n\tsort.Sort(TasksByTimestamp(tasks))\n\tfor i, task := range tasks {\n\t\texpected := &google_protobuf.Timestamp{Seconds: int64(i + 1)}\n\t\tassert.Equal(t, expected, task.Status.Timestamp)\n\t\tassert.Equal(t, \"id_\"+strconv.Itoa(size-(i+1)), task.ID)\n\t}\n\n\tfor i, task := range tasks {\n\t\ttask.Status.AppliedAt = &google_protobuf.Timestamp{Seconds: int64(size - i)}\n\t}\n\n\tsort.Sort(TasksByTimestamp(tasks))\n\tsort.Sort(TasksByTimestamp(tasks))\n\tfor i, task := range tasks {\n\t\texpected := &google_protobuf.Timestamp{Seconds: int64(i + 1)}\n\t\tassert.Equal(t, expected, task.Status.AppliedAt)\n\t\tassert.Equal(t, \"id_\"+strconv.Itoa(i), task.ID)\n\t}\n}", "title": "" }, { "docid": "51f9f050d009faf675e503433df8e55d", "score": "0.49836838", "text": "func (t TaskTotals) add(taskId int, totals Totals) {\n\tcurrentTotals, ok := t[taskId]\n\tif !ok {\n\t\tt[taskId] = totals\n\t} else {\n\t\tt[taskId] = currentTotals.add(totals)\n\t}\n}", "title": "" }, { "docid": "fec027cbf95ab57076152f6bec8e657e", "score": "0.4976701", "text": "func (mr *MockGeneralRepositoryMockRecorder) GetStats(network interface{}) *gomock.Call {\n\tmr.mock.ctrl.T.Helper()\n\treturn mr.mock.ctrl.RecordCallWithMethodType(mr.mock, \"GetStats\", reflect.TypeOf((*MockGeneralRepository)(nil).GetStats), network)\n}", "title": "" }, { "docid": "677c3f14cb70eb346e21ceabf89a8233", "score": "0.49668777", "text": "func hasUsageStats(resourceQuota *corev1.ResourceQuota, interestingResources []corev1.ResourceName) bool {\n\tinterestingSet := quota.ToSet(interestingResources)\n\tfor resourceName := range resourceQuota.Status.Hard {\n\t\tif !interestingSet.Has(string(resourceName)) {\n\t\t\tcontinue\n\t\t}\n\t\tif _, found := resourceQuota.Status.Used[resourceName]; !found {\n\t\t\treturn false\n\t\t}\n\t}\n\treturn true\n}", "title": "" }, { "docid": "a8b0c03222e88e25f4f8024e3db83b4b", "score": "0.49632946", "text": "func TestRktDriver_Stats(t *testing.T) {\n\tctestutil.RktCompatible(t)\n\tif !testutil.IsCI() {\n\t\tt.Parallel()\n\t}\n\n\trequire := require.New(t)\n\td := NewRktDriver(testlog.HCLogger(t))\n\tharness := dtestutil.NewDriverHarness(t, d)\n\n\ttask := &drivers.TaskConfig{\n\t\tID: uuid.Generate(),\n\t\tAllocID: uuid.Generate(),\n\t\tName: \"etcd\",\n\t\tResources: &drivers.Resources{\n\t\t\tNomadResources: &structs.AllocatedTaskResources{\n\t\t\t\tMemory: structs.AllocatedMemoryResources{\n\t\t\t\t\tMemoryMB: 128,\n\t\t\t\t},\n\t\t\t\tCpu: structs.AllocatedCpuResources{\n\t\t\t\t\tCpuShares: 100,\n\t\t\t\t},\n\t\t\t},\n\t\t\tLinuxResources: &drivers.LinuxResources{\n\t\t\t\tMemoryLimitBytes: 134217728,\n\t\t\t\tCPUShares: 100,\n\t\t\t},\n\t\t},\n\t}\n\n\ttc := &TaskConfig{\n\t\tTrustPrefix: \"coreos.com/etcd\",\n\t\tImageName: \"coreos.com/etcd:v2.0.4\",\n\t\tCommand: \"/etcd\",\n\t\tNet: []string{\"none\"},\n\t}\n\trequire.NoError(task.EncodeConcreteDriverConfig(&tc))\n\ttesttask.SetTaskConfigEnv(task)\n\n\tcleanup := harness.MkAllocDir(task, true)\n\tdefer cleanup()\n\n\thandle, _, err := harness.StartTask(task)\n\trequire.NoError(err)\n\n\t// Wait for task to start\n\t_, err = harness.WaitTask(context.Background(), handle.Config.ID)\n\trequire.NoError(err)\n\n\t// Wait until task started\n\trequire.NoError(harness.WaitUntilStarted(task.ID, 1*time.Second))\n\n\tctx, cancel := context.WithCancel(context.Background())\n\tdefer cancel()\n\tstatsCh, err := d.TaskStats(ctx, task.ID, time.Second*10)\n\trequire.Nil(err)\n\n\tselect {\n\tcase ru := <-statsCh:\n\t\t//TODO(preetha) why are these zero\n\t\tfmt.Printf(\"pid map %v\\n\", ru.Pids)\n\t\tfmt.Printf(\"CPU:%+v Memory:%+v\", ru.ResourceUsage.CpuStats, ru.ResourceUsage.MemoryStats)\n\tcase <-time.After(time.Second):\n\t\trequire.Fail(\"timeout receiving stats from channel\")\n\t}\n\n\trequire.NoError(harness.DestroyTask(task.ID, true))\n\n}", "title": "" }, { "docid": "466607804335a8bbd59e4c03d83e8fbf", "score": "0.495766", "text": "func (mr *MockStreamFlowControllerMockRecorder) AddBytesSent(arg0 interface{}) *gomock.Call {\n\treturn mr.mock.ctrl.RecordCallWithMethodType(mr.mock, \"AddBytesSent\", reflect.TypeOf((*MockStreamFlowController)(nil).AddBytesSent), arg0)\n}", "title": "" }, { "docid": "f747e065fd8101b9a02949b7c5a2e0a9", "score": "0.49571127", "text": "func (mr *MockResultDBServerMockRecorder) QueryTestResultStatistics(arg0, arg1 interface{}) *gomock.Call {\n\tmr.mock.ctrl.T.Helper()\n\treturn mr.mock.ctrl.RecordCallWithMethodType(mr.mock, \"QueryTestResultStatistics\", reflect.TypeOf((*MockResultDBServer)(nil).QueryTestResultStatistics), arg0, arg1)\n}", "title": "" }, { "docid": "35e5d5f0bb8c7fcd7478db52864b3352", "score": "0.4953779", "text": "func (a Availability) SendAvailibiltyStats() error {\r\n\r\n\thostname, err := os.Hostname()\r\n\tif err != nil {\r\n\t\thostname = \"Unknown\"\r\n\t}\r\n\tlocation, err := time.LoadLocation(\"EST\")\r\n\tif err != nil {\r\n\t\tfmt.Println(err)\r\n\t}\r\n\r\n\tavailability := appinsights.NewAvailabilityTelemetry(a.Name, a.Time, a.Success)\r\n\tavailability.RunLocation = \"LSPAKS-\" + hostname\r\n\tavailability.Message = fmt.Sprintf(\"%v. Start - Stop %v : %v\", a.Msg, a.Start.In(location), a.End.In(location))\r\n\tavailability.Id = fmt.Sprintf(\"%v:%v\", a.Name, a.End)\r\n\tavailability.MarkTime(a.Start, a.End)\r\n\r\n\ta.Client.Track(availability)\r\n\r\n\treturn nil\r\n}", "title": "" }, { "docid": "2ee3a9784962b5c287ac23c74099abfa", "score": "0.4946983", "text": "func (mr *MockUsecaseMockRecorder) Add(arg0, arg1 interface{}) *gomock.Call {\n\tmr.mock.ctrl.T.Helper()\n\treturn mr.mock.ctrl.RecordCallWithMethodType(mr.mock, \"Add\", reflect.TypeOf((*MockUsecase)(nil).Add), arg0, arg1)\n}", "title": "" }, { "docid": "7366a6c73b869dafe395756b61fae18b", "score": "0.49467108", "text": "func (mr *MockFirmamentSchedulerServerMockRecorder) TaskFailed(arg0, arg1 interface{}) *gomock.Call {\n\treturn mr.mock.ctrl.RecordCallWithMethodType(mr.mock, \"TaskFailed\", reflect.TypeOf((*MockFirmamentSchedulerServer)(nil).TaskFailed), arg0, arg1)\n}", "title": "" }, { "docid": "12c94e0b777cc67a1f97731be2f0d4dd", "score": "0.4945617", "text": "func (mr *MockFirmamentSchedulerClientMockRecorder) TaskFailed(ctx, in interface{}, opts ...interface{}) *gomock.Call {\n\tvarargs := append([]interface{}{ctx, in}, opts...)\n\treturn mr.mock.ctrl.RecordCallWithMethodType(mr.mock, \"TaskFailed\", reflect.TypeOf((*MockFirmamentSchedulerClient)(nil).TaskFailed), varargs...)\n}", "title": "" }, { "docid": "7b71721cbafc7eeb9665e514fccf2141", "score": "0.49407485", "text": "func (i *TelemetryStorage) RecordImpressionsStats(dataType int, count int64) {\n\tswitch dataType {\n\tcase constants.ImpressionsDropped:\n\t\tatomic.AddInt64(&i.records.impressionsDropped, count)\n\tcase constants.ImpressionsDeduped:\n\t\tatomic.AddInt64(&i.records.impressionsDeduped, count)\n\tcase constants.ImpressionsQueued:\n\t\tatomic.AddInt64(&i.records.impressionsQueued, count)\n\t}\n}", "title": "" }, { "docid": "4c16913c1f6afaebfd44e3ea7c23da5d", "score": "0.49380293", "text": "func (m *MockHealthCheck) RegisterStats() {\n\tm.ctrl.T.Helper()\n\tm.ctrl.Call(m, \"RegisterStats\")\n}", "title": "" }, { "docid": "95a9b24536eed5db5139a01dae9253cd", "score": "0.49271756", "text": "func taskAdd(t Tasker, variables ...interface{}) error {\n\tif t.Priority() < priorityHigh || t.Priority() > priorityLow {\n\t\treturn errors.New(\"Invalid task priority\")\n\t}\n\n\tnext := t.NextRun()\n\t// all tasks must run at least once\n\tif next.IsZero() {\n\t\tnext = time.Now()\n\t}\n\n\ttask := &Task{\n\t\tType: t.Type(),\n\t\tPriority: t.Priority(),\n\t\tNextRun: next,\n\t\tVariables: variables,\n\t\tCreated: time.Now(),\n\t\tRetry: 0,\n\t}\n\n\treturn data.TaskInsert(task)\n}", "title": "" }, { "docid": "c8334cfe4544761c5e435aae863921e1", "score": "0.49266976", "text": "func (i *TelemetryStorage) RecordEventsStats(dataType int, count int64) {\n\tswitch dataType {\n\tcase constants.EventsDropped:\n\t\tatomic.AddInt64(&i.records.eventsDropped, count)\n\tcase constants.EventsQueued:\n\t\tatomic.AddInt64(&i.records.eventsQueued, count)\n\t}\n}", "title": "" }, { "docid": "34980826e8b64d3f5e66d97662dfd906", "score": "0.49190766", "text": "func (nf *NetFlowV5Target) SendStats(stats flow.Stats) {\n}", "title": "" }, { "docid": "40bae724de37f3f0620cd04cfa87b530", "score": "0.49118906", "text": "func collectStats(config *Config, stats chan Stats, done chan bool) {\n\tstartTime := time.Now()\n\n\t// TODO: Hoje só temos um cenário. Mas a rotina deve ser revista para trabalhar com mais de um cenário.\n\tnumberOfScenarios := 0\n\tscenariosWithError := 0\n\tnumberOfRequests := 0\n\tvar minTime time.Duration = 1<<63 - 1\n\tvar maxTime time.Duration\n\tvar totalTime time.Duration\n\tvar scenarioName string\n\n\tfor elem := range stats {\n\t\tfmt.Printf(\"elem.EndpointID: [%v]\\n\", elem.EndpointID)\n\t\tif elem.MustStat == false {\n\t\t\tcontinue\n\t\t}\n\t\tif elem.EndpointID != \"\" {\n\t\t\tnumberOfRequests += 1\n\t\t\tcontinue\n\t\t}\n\t\tnumberOfScenarios++\n\t\tscenarioName = elem.ScenarioID\n\t\tlog.Println(elem)\n\t\tif elem.Status == false {\n\t\t\tscenariosWithError++\n\t\t}\n\t\ttotalTime += elem.Duration\n\t\tif elem.Duration > maxTime {\n\t\t\tmaxTime = elem.Duration\n\t\t}\n\t\tif elem.Duration < minTime {\n\t\t\tminTime = elem.Duration\n\t\t}\n\t}\n\n\tduration := time.Since(startTime)\n\n\t// TODO: Não está sendo separado entre cenários com e sem erros\n\tlog.Printf(\"Report - Geral\")\n\tlog.Printf(\"\\tNúmero de requisições: %v\", numberOfRequests)\n\tlog.Printf(\"\\tTempo total de execução do teste: %v\", duration)\n\tlog.Printf(\"\\tRequisições por segundo: %.2f\", float64(numberOfRequests)/float64(duration.Seconds()))\n\tlog.Printf(\"\\tNúmero de IDs únicos: %v\", config.UniqueIds)\n\tlog.Printf(\"\\tCenários executados sem erros: %v (%.2f%%)\", numberOfScenarios-scenariosWithError, float64(numberOfScenarios-scenariosWithError)/float64(numberOfScenarios)*100.0)\n\tlog.Printf(\"\\tCenários executados com erros: %v (%.2f%%)\", scenariosWithError, float64(scenariosWithError)/float64(numberOfScenarios)*100.0)\n\t// log.Printf(\"\\tNúmero de cenários OK: %v\", 1)\n\t// log.Printf(\"\\tNúmero de cenários com falhas: %v\", 1)\n\tlog.Printf(\"\\tNúmero de vezes que ocorreu timeout: %v\", 0)\n\t// log.Printf(\"\\tTempos de resposta: Mínimo, médio, máximo, percentil 95%%: %v\", 1)\n\n\tlog.Printf(\"Report - Por cenário\")\n\n\t// TODO: tem que fazer o report de todos os cenarios... hoje ta assumindo que so tem 1\n\tlog.Printf(\"\\tCenário: %v\", scenarioName)\n\tlog.Printf(\"\\t\\tTempo total de execução do cenário: %v\", totalTime)\n\t// log.Printf(\"\\t\\tCenários executados: %v\", numberOfScenarios) // ou nro de execuções?\n\tlog.Printf(\"\\t\\tCenários executados sem erros: %v (%.2f%%)\", numberOfScenarios-scenariosWithError, float64(numberOfScenarios-scenariosWithError)/float64(numberOfScenarios)*100.0)\n\tlog.Printf(\"\\t\\tCenários executados com erros: %v (%.2f%%)\", scenariosWithError, float64(scenariosWithError)/float64(numberOfScenarios)*100.0)\n\tlog.Printf(\"\\t\\tNúmero de vezes que ocorreu timeout: %v\", 1)\n\t// TODO: faltou percentil 95%\n\tlog.Printf(\"\\t\\tTempo de execução (min/med/max): (%v/%v/%v)\", minTime, totalTime.Nanoseconds()/int64(numberOfScenarios), maxTime)\n\n\tlog.Printf(\"Report - Por endpoint\")\n\tlog.Printf(\"\\tEndpoint: %v\", \"xxx\")\n\tlog.Printf(\"\\t\\tTempo total de execução do endpoint: %v\", 1)\n\tlog.Printf(\"\\t\\tEndpoints executados sem erros: %v (%.2f%%)\", numberOfScenarios-scenariosWithError, float64(numberOfScenarios-scenariosWithError)/float64(numberOfScenarios)*100.0)\n\tlog.Printf(\"\\t\\tEndpoints executados com erros: %v (%.2f%%)\", scenariosWithError, float64(scenariosWithError)/float64(numberOfScenarios)*100.0)\n\tlog.Printf(\"\\t\\tNúmero de vezes que ocorreu timeout: %v\", 1)\n\t// TODO: faltou percentil 95%\n\tlog.Printf(\"\\t\\tTempo de execução (min/med/max): (%v/%v/%v)\", minTime, totalTime.Nanoseconds()/int64(numberOfScenarios), maxTime)\n\t// * Tamanho das requisições/respostas: Mínimo, médio, máximo, percentil 95% (percentil tb???)\n\n\t// TODO: Report por cenario/endpoint?\n\tdone <- true\n}", "title": "" }, { "docid": "9457088641d8a858cdcc76f84b0d9063", "score": "0.49044275", "text": "func (mr *MockUsecasesMockRecorder) Add(n, u interface{}) *gomock.Call {\n\tmr.mock.ctrl.T.Helper()\n\treturn mr.mock.ctrl.RecordCallWithMethodType(mr.mock, \"Add\", reflect.TypeOf((*MockUsecases)(nil).Add), n, u)\n}", "title": "" }, { "docid": "59062bf69ad2e8f426653f16c7690d2f", "score": "0.49038094", "text": "func hasUsageStats(resourceQuota *corev1.ResourceQuota, interestingResources []corev1.ResourceName) bool {\n\tinterestingSet := quota.ToSet(interestingResources)\n\tfor resourceName := range resourceQuota.Status.Hard {\n\t\tif !interestingSet.Has(string(resourceName)) {\n\t\t\tcontinue\n\t\t}\n\t\tif _, found := resourceQuota.Status.Used[resourceName]; found {\n\t\t\treturn true\n\t\t}\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "1298b413c9c643c5df8737eb2fa00ae7", "score": "0.49009115", "text": "func (s *projService) AddTaskHours(ctx context.Context, req *pb.AddTaskHoursRequest) (*pb.AddTaskHoursResponse, error) {\n\tresp := &pb.AddTaskHoursResponse{}\n\tvar err error\n\n\tsqlstring1 := `SELECT inbProjectId FROM tb_Task WHERE inbTaskId = ? AND inbMserviceId = ? AND bitIsDeleted = 0`\n\tstmt1, err := s.db.Prepare(sqlstring1)\n\tif err != nil {\n\t\tlevel.Error(s.logger).Log(\"what\", \"Prepare\", \"error\", err)\n\t\tresp.ErrorCode = 500\n\t\tresp.ErrorMessage = \"db.Prepare failed\"\n\t\treturn resp, nil\n\t}\n\n\tdefer stmt1.Close()\n\n\tvar existingProjectId int64\n\terr = stmt1.QueryRow(req.GetTaskId(), req.GetMserviceId()).Scan(&existingProjectId)\n\tif err != nil {\n\t\tresp.ErrorCode = 404\n\t\tresp.ErrorMessage = \"referenced task not found\"\n\t\treturn resp, nil\n\t}\n\n\tsqlstring := `UPDATE tb_TaskToMember SET dtmModified = NOW(),\n\tdecTaskHours = decTaskHours + ? WHERE inbProjectId = ? AND inbTaskId = ? AND inbMemberId = ? AND inbMserviceId = ?\n\tAND bitIsDeleted = 0`\n\n\tstmt, err := s.db.Prepare(sqlstring)\n\tif err != nil {\n\t\tlevel.Error(s.logger).Log(\"what\", \"Prepare\", \"error\", err)\n\t\tresp.ErrorCode = 500\n\t\tresp.ErrorMessage = \"db.Prepare failed\"\n\t\treturn resp, nil\n\t}\n\n\tdefer stmt.Close()\n\n\tres, err := stmt.Exec(req.GetTaskHours().StringFromDecimal(), existingProjectId, req.GetTaskId(), req.GetMemberId(), req.GetMserviceId())\n\n\tif err == nil {\n\t\trowsAffected, _ := res.RowsAffected()\n\t\tif rowsAffected != 1 {\n\t\t\tresp.ErrorCode = 404\n\t\t\tresp.ErrorMessage = \"not found\"\n\t\t}\n\t} else {\n\t\tresp.ErrorCode = 501\n\t\tresp.ErrorMessage = err.Error()\n\t\tlevel.Error(s.logger).Log(\"what\", \"Exec\", \"error\", err)\n\t\terr = nil\n\t}\n\n\treturn resp, err\n}", "title": "" }, { "docid": "b9117de7494d9612e6f315e21ceddb18", "score": "0.4900072", "text": "func (o *InlineResponse20075Stats) HasTasks() bool {\n\tif o != nil && o.Tasks != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "e3b1fc63c0e2aec38f724dc4be5d2aeb", "score": "0.4898143", "text": "func (p *statusUpdate) logTaskMetrics(event *statusupdate.Event) {\n\tif event.V0() == nil {\n\t\treturn\n\t}\n\t// Update task state counter for non-reconcilication update.\n\treason := event.MesosTaskStatus().GetReason()\n\tif reason != mesos.TaskStatus_REASON_RECONCILIATION {\n\t\tswitch event.State() {\n\t\tcase pb_task.TaskState_RUNNING:\n\t\t\tp.metrics.TasksRunningTotal.Inc(1)\n\t\tcase pb_task.TaskState_SUCCEEDED:\n\t\t\tp.metrics.TasksSucceededTotal.Inc(1)\n\t\tcase pb_task.TaskState_FAILED:\n\t\t\tp.metrics.TasksFailedTotal.Inc(1)\n\t\t\tp.metrics.TasksFailedReason[int32(reason)].Inc(1)\n\t\t\tlog.WithFields(log.Fields{\n\t\t\t\t\"task_id\": event.TaskID(),\n\t\t\t\t\"failed_reason\": mesos.TaskStatus_Reason_name[int32(reason)],\n\t\t\t}).Debug(\"received failed task\")\n\t\tcase pb_task.TaskState_KILLED:\n\t\t\tp.metrics.TasksKilledTotal.Inc(1)\n\t\tcase pb_task.TaskState_LOST:\n\t\t\tp.metrics.TasksLostTotal.Inc(1)\n\t\tcase pb_task.TaskState_LAUNCHED:\n\t\t\tp.metrics.TasksLaunchedTotal.Inc(1)\n\t\tcase pb_task.TaskState_STARTING:\n\t\t\tp.metrics.TasksStartingTotal.Inc(1)\n\t\t}\n\t} else {\n\t\tp.metrics.TasksReconciledTotal.Inc(1)\n\t}\n}", "title": "" }, { "docid": "e00da63c8bc81ed0b85055e80b46629e", "score": "0.4877394", "text": "func (mr *MockMempoolMockRecorder) Add(tx interface{}) *gomock.Call {\n\tmr.mock.ctrl.T.Helper()\n\treturn mr.mock.ctrl.RecordCallWithMethodType(mr.mock, \"Add\", reflect.TypeOf((*MockMempool)(nil).Add), tx)\n}", "title": "" }, { "docid": "e64453a8dc5102dfff00382053f05ad1", "score": "0.48767415", "text": "func (mr *MockFirmamentSchedulerServerMockRecorder) TaskUpdated(arg0, arg1 interface{}) *gomock.Call {\n\treturn mr.mock.ctrl.RecordCallWithMethodType(mr.mock, \"TaskUpdated\", reflect.TypeOf((*MockFirmamentSchedulerServer)(nil).TaskUpdated), arg0, arg1)\n}", "title": "" }, { "docid": "a0a320219c6eef1271080a800a2cefb7", "score": "0.48664224", "text": "func (p *ProgressUpdateBatcher) Add(ctx context.Context, delta float32) error {\n\tp.Lock()\n\tp.completed += delta\n\tcompleted := p.completed\n\tshouldReport := p.completed-p.reported > progressFractionThreshold\n\tshouldReport = shouldReport && p.lastReported.Add(progressTimeThreshold).Before(timeutil.Now())\n\n\tif shouldReport {\n\t\tp.reported = p.completed\n\t\tp.lastReported = timeutil.Now()\n\t}\n\tp.Unlock()\n\n\tif shouldReport {\n\t\treturn p.Report(ctx, completed)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "c1207721e249445d3da459a914fb6b6e", "score": "0.4863629", "text": "func (tm *Manager) Stats() (Stats, Result) {\n\tstats := Stats{}\n\tresult := Result{}\n\n\tif tm.done {\n\t\tresult.Message = shutdownMsg\n\t\tresult.Code = 500\n\t\treturn stats, result\n\t}\n\n\ttm.mutex.Lock()\n\tdefer tm.mutex.Unlock()\n\n\tstats.Total = tm.completedTasks\n\tavg := float64(tm.taskRuntime*time.Nanosecond) / float64(tm.completedTasks)\n\tstats.Average = uint64(avg)\n\tresult.Code = 200\n\n\treturn stats, result\n}", "title": "" }, { "docid": "c1e7e4e8a204577f0b62965c8d3d2186", "score": "0.4860819", "text": "func testStats(t *testing.T,\n\ts *runtime.ContainerStats,\n\tconfig *runtime.ContainerConfig,\n) {\n\trequire.NotEmpty(t, s.GetAttributes().GetId())\n\trequire.NotEmpty(t, s.GetAttributes().GetMetadata())\n\trequire.NotEmpty(t, s.GetAttributes().GetAnnotations())\n\trequire.Equal(t, s.GetAttributes().GetLabels(), config.Labels)\n\trequire.Equal(t, s.GetAttributes().GetAnnotations(), config.Annotations)\n\trequire.Equal(t, s.GetAttributes().GetMetadata().Name, config.Metadata.Name)\n\trequire.NotEmpty(t, s.GetAttributes().GetLabels())\n\trequire.NotEmpty(t, s.GetCpu().GetTimestamp())\n\trequire.NotEmpty(t, s.GetCpu().GetUsageCoreNanoSeconds().GetValue())\n\trequire.NotEmpty(t, s.GetMemory().GetTimestamp())\n\trequire.NotEmpty(t, s.GetMemory().GetWorkingSetBytes().GetValue())\n\trequire.NotEmpty(t, s.GetWritableLayer().GetTimestamp())\n\trequire.NotEmpty(t, s.GetWritableLayer().GetFsId().GetMountpoint())\n\n\t// UsedBytes of a fresh container can be zero on Linux, depending on the backing filesystem.\n\t// https://github.com/containerd/containerd/issues/7909\n\tif goruntime.GOOS == \"windows\" {\n\t\trequire.NotEmpty(t, s.GetWritableLayer().GetUsedBytes().GetValue())\n\t}\n\n\t// Windows does not collect inodes stats.\n\tif goruntime.GOOS != \"windows\" {\n\t\trequire.NotEmpty(t, s.GetWritableLayer().GetInodesUsed().GetValue())\n\t}\n}", "title": "" }, { "docid": "184642a59224315e8d11074fc74ca661", "score": "0.48605397", "text": "func TestComputeUpdateStats(t *testing.T) {\n\tt.Parallel()\n\n\tevents := []engine.Event{\n\t\tmakeResourcePreEvent(\"res1\", \"pulumi:pulumi:Stack\", deploy.OpCreate, false),\n\t\tmakeResourcePreEvent(\"res2\", \"custom:resource:Type\", deploy.OpCreate, false),\n\t\tmakeResourcePreEvent(\"res3\", \"custom:resource:Type\", deploy.OpDelete, true),\n\t\tmakeResourcePreEvent(\"res4\", \"custom:resource:Type\", deploy.OpReplace, true),\n\t\tmakeResourcePreEvent(\"res5\", \"custom:resource:Type\", deploy.OpSame, false),\n\t}\n\n\tstats := computeUpdateStats(events)\n\n\tassert.Equal(t, 4, stats.numNonStackResources)\n\tassert.Equal(t, 2, len(stats.retainedResources))\n}", "title": "" }, { "docid": "6701f0e197595611cb658fe104c3f9c8", "score": "0.48584124", "text": "func (is *ImageServer) AddStats(width int, height int) {\n\n\tis.Lock()\n\tdefer is.Unlock()\n\n\tis.NumImages++\n\tis.WidthSum += width\n\tis.HeightSum += height\n}", "title": "" }, { "docid": "ef83f5d271aa78d3dc56e3c9fbc0403a", "score": "0.48544127", "text": "func TestAddTask(t *testing.T) {\n\tasserter := assert.New(t)\n\n\tSetBufferSettings(3, 1)\n\tb := GetBuffer()\n\n\ttd := Descriptor(TaskDescriptor{\n\t\tConsumer: \"consumer\",\n\t\tDescriptor: \"descriptor\",\n\t})\n\n\tb.Add(&td)\n\n\tasserter.Equal(b.Size(), 1)\n\n\ttb := b.(*TaskBuffer)\n\tbuffTask := <-tb.Channel\n\tasserter.Equal(\"consumer\", (*buffTask).GetConsumer())\n\tasserter.Equal(\"descriptor\", (*buffTask).GetDescriptor())\n\n\ttd = Descriptor(TaskDescriptor{\n\t\tConsumer: \"consumer\",\n\t\tDescriptor: \"descriptor\",\n\t})\n\n\tb.Add(&td)\n\tb.Add(&td)\n\n\tasserter.Equal(b.Size(), 2)\n\ttb.Close()\n}", "title": "" }, { "docid": "e7b78d8562769c907edd7fd64569f136", "score": "0.4854331", "text": "func (mr *MockFirmamentSchedulerClientMockRecorder) TaskRemoved(ctx, in interface{}, opts ...interface{}) *gomock.Call {\n\tvarargs := append([]interface{}{ctx, in}, opts...)\n\treturn mr.mock.ctrl.RecordCallWithMethodType(mr.mock, \"TaskRemoved\", reflect.TypeOf((*MockFirmamentSchedulerClient)(nil).TaskRemoved), varargs...)\n}", "title": "" }, { "docid": "34770868b8ee3fd189ffa26c8b2aefec", "score": "0.48482153", "text": "func ShowTaskStat(taskJSON []byte, scale float64) error {\n\ttask := Task{}\n\n\terror := json.Unmarshal([]byte(taskJSON), &task)\n\tif error != nil {\n\t\treturn errors.New(\"[ERROR] Couldn't parse task log as JSON:\" + string(taskJSON))\n\t}\n\n\tstartDateTime, _ := time.Parse(DateTimeLayout, task.Start)\n\tendDateTime, _ := time.Parse(DateTimeLayout, task.End)\n\n\t// TODO: もうちょっとフォーマット何とかする\n\tduration := float64(endDateTime.Sub(startDateTime).Seconds()) * scale\n\tminutes := duration / 60.0\n\thours := minutes / 60.0\n\n\t// 小数点丸め\n\tfmt.Fprintf(os.Stdout, \"%s %v\\n\", task.Name, math.Trunc(hours*100)/100.0)\n\treturn nil\n}", "title": "" }, { "docid": "8330f95a4db4ed9b72090bc4f848554f", "score": "0.48363373", "text": "func hasUsageStats(resourceQuota *api.ResourceQuota) bool {\n\tfor resourceName := range resourceQuota.Status.Hard {\n\t\tif _, found := resourceQuota.Status.Used[resourceName]; !found {\n\t\t\treturn false\n\t\t}\n\t}\n\treturn true\n}", "title": "" }, { "docid": "9357001e5294551ca1cd44a4e5f73f09", "score": "0.48289385", "text": "func (m *MockWatcher) HasTask() bool {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"HasTask\")\n\tret0, _ := ret[0].(bool)\n\treturn ret0\n}", "title": "" }, { "docid": "247ebf32a1fb4283b052d701ea7c5ed5", "score": "0.48278582", "text": "func (s *Stats) Add() {\n\ts.mutex.Lock()\n\ts.Unknown += 1\n\ts.mutex.Unlock()\n}", "title": "" }, { "docid": "ee35c9871496d46be6629aefc997fd1e", "score": "0.4826579", "text": "func TestStatsRunsCountsEmpty(t *testing.T) {\n\tctx := context.Background()\n\treq := request.RunsCounts{}\n\n\t_, err := cfgmgmt.GetRunsCounts(ctx, &req)\n\tassert.Error(t, err)\n}", "title": "" }, { "docid": "fa6b974cc88cc35edb0dc0a15b748430", "score": "0.48249638", "text": "func (mr *MockFirmamentSchedulerServerMockRecorder) TaskRemoved(arg0, arg1 interface{}) *gomock.Call {\n\treturn mr.mock.ctrl.RecordCallWithMethodType(mr.mock, \"TaskRemoved\", reflect.TypeOf((*MockFirmamentSchedulerServer)(nil).TaskRemoved), arg0, arg1)\n}", "title": "" }, { "docid": "58cd4d433031d99267e83859864d932e", "score": "0.48198354", "text": "func (mr *MockServicerMockRecorder) CalculateStats() *gomock.Call {\n\tmr.mock.ctrl.T.Helper()\n\treturn mr.mock.ctrl.RecordCallWithMethodType(mr.mock, \"CalculateStats\", reflect.TypeOf((*MockServicer)(nil).CalculateStats))\n}", "title": "" }, { "docid": "14adb671d0eefb2d4ac2b446e3dacb7e", "score": "0.4811697", "text": "func (nsc *NilConsumerStatsCollector) AddDelivered(int) {}", "title": "" }, { "docid": "ab944e196ed23419d42c111d07a9b977", "score": "0.4806373", "text": "func (mr *MockDBStorageMockRecorder) UpdateTask(arg0 interface{}) *gomock.Call {\n\tmr.mock.ctrl.T.Helper()\n\treturn mr.mock.ctrl.RecordCallWithMethodType(mr.mock, \"UpdateTask\", reflect.TypeOf((*MockDBStorage)(nil).UpdateTask), arg0)\n}", "title": "" }, { "docid": "90758f27ab485edfe0530a17991bbf0a", "score": "0.47992218", "text": "func (mr *MockMetaDataMgmtServiceMockRecorder) AddResource() *gomock.Call {\n\tmr.mock.ctrl.T.Helper()\n\treturn mr.mock.ctrl.RecordCallWithMethodType(mr.mock, \"AddResource\", reflect.TypeOf((*MockMetaDataMgmtService)(nil).AddResource))\n}", "title": "" }, { "docid": "25a8a829d5d748bc3c77d1faa0cc7f95", "score": "0.479417", "text": "func (b *Bucket) AddFailure(n int) {\n\tb[BucketFailureIndex].Add(int32(n))\n}", "title": "" }, { "docid": "a4e7e5699f27265aef4c77f59828fe10", "score": "0.47852072", "text": "func (mr *MockStorageMockRecorder) AddService(srv interface{}) *gomock.Call {\n\treturn mr.mock.ctrl.RecordCallWithMethodType(mr.mock, \"AddService\", reflect.TypeOf((*MockStorage)(nil).AddService), srv)\n}", "title": "" }, { "docid": "deb273cb22a02f12a65bc69c33b1450d", "score": "0.47839004", "text": "func (mr *MockHostMockRecorder) Addrs() *gomock.Call {\n\tmr.mock.ctrl.T.Helper()\n\treturn mr.mock.ctrl.RecordCallWithMethodType(mr.mock, \"Addrs\", reflect.TypeOf((*MockHost)(nil).Addrs))\n}", "title": "" }, { "docid": "eb82de291d18f495f6b0b0f1991d3903", "score": "0.4783033", "text": "func (mr *MockServiceMockRecorder) Add(arg0 interface{}) *gomock.Call {\n\treturn mr.mock.ctrl.RecordCallWithMethodType(mr.mock, \"Add\", reflect.TypeOf((*MockService)(nil).Add), arg0)\n}", "title": "" }, { "docid": "80f38d8393893d66a783d3cee7b399d6", "score": "0.47811067", "text": "func (mr *MockSenderMockRecorder) AddMetricsEvent(ctx, clusterID, hostID, severity, msg, eventTime interface{}, props ...interface{}) *gomock.Call {\n\tmr.mock.ctrl.T.Helper()\n\tvarargs := append([]interface{}{ctx, clusterID, hostID, severity, msg, eventTime}, props...)\n\treturn mr.mock.ctrl.RecordCallWithMethodType(mr.mock, \"AddMetricsEvent\", reflect.TypeOf((*MockSender)(nil).AddMetricsEvent), varargs...)\n}", "title": "" }, { "docid": "de09d6f1ca72587f1903e4bd58fd6783", "score": "0.47797233", "text": "func (p *Pool) AddTask(task *Task) {\n\tp.Collector <-task\n}", "title": "" }, { "docid": "49761fce17d7b4bc63e81948c8a563b8", "score": "0.47795892", "text": "func (o *Task) Add(n int) {\n\tif n == 0 {\n\t\treturn\n\t}\n\to.lock.Lock()\n\tif o.size == 0 {\n\t\to.lock.Unlock()\n\t\tpanic(\"can't increase size of empty operation \" + o.label())\n\t}\n\to.started = true\n\to.progress += n\n\tif o.progress >= o.size {\n\t\to.progress = o.size\n\t}\n\tif o.progress < 0 {\n\t\to.progress = 0\n\t}\n\to.lock.Unlock()\n\to.w.redrawProgress()\n}", "title": "" }, { "docid": "f61bd3e689f6564c390fded1dba6c510", "score": "0.47774473", "text": "func (mb *MetricsBuilder) RecordSshcheckSftpStatusDataPoint(ts pcommon.Timestamp, val int64) {\n\tmb.metricSshcheckSftpStatus.recordDataPoint(mb.startTime, ts, val)\n}", "title": "" }, { "docid": "3fed2536d760610847c789ade5bed213", "score": "0.47761604", "text": "func (m *Module) AddServiceCall(projectID string) {\n\tm.lock.RLock()\n\tdefer m.lock.RUnlock()\n\n\t// Return if the metrics module is disabled\n\tif m.isMetricsDisabled {\n\t\treturn\n\t}\n\n\tmetricsTemp, _ := m.projects.LoadOrStore(projectID, newMetrics())\n\tmetrics := metricsTemp.(*metrics)\n\n\tatomic.AddUint64(&metrics.serviceCall, uint64(1))\n}", "title": "" }, { "docid": "2e09c10dae6a85cb8c352d1d6fb15c83", "score": "0.47732997", "text": "func (mr *MockConnectorInfoMockRecorder) ConnectionStats() *gomock.Call {\n\tmr.mock.ctrl.T.Helper()\n\treturn mr.mock.ctrl.RecordCallWithMethodType(mr.mock, \"ConnectionStats\", reflect.TypeOf((*MockConnectorInfo)(nil).ConnectionStats))\n}", "title": "" } ]
92a54ba1cfa1e70a17cb42254428df11
Bool returns a single bool from selector. It is only allowed when selecting one field.
[ { "docid": "02c99d8b72b34ad879ef3839841a2ff8", "score": "0.7213571", "text": "func (ofs *OrderFieldSelect) Bool(ctx context.Context) (_ bool, err error) {\n\tvar v []bool\n\tif v, err = ofs.Bools(ctx); err != nil {\n\t\treturn\n\t}\n\tswitch len(v) {\n\tcase 1:\n\t\treturn v[0], nil\n\tcase 0:\n\t\terr = &NotFoundError{orderfield.Label}\n\tdefault:\n\t\terr = fmt.Errorf(\"ent: OrderFieldSelect.Bools returned %d results when one was expected\", len(v))\n\t}\n\treturn\n}", "title": "" } ]
[ { "docid": "95573babd08e4175544d231c39044dea", "score": "0.7143063", "text": "func (wnfs *WithNilFieldsSelect) Bool(ctx context.Context) (_ bool, err error) {\n\tvar v []bool\n\tif v, err = wnfs.Bools(ctx); err != nil {\n\t\treturn\n\t}\n\tswitch len(v) {\n\tcase 1:\n\t\treturn v[0], nil\n\tcase 0:\n\t\terr = &NotFoundError{withnilfields.Label}\n\tdefault:\n\t\terr = fmt.Errorf(\"ent: WithNilFieldsSelect.Bools returned %d results when one was expected\", len(v))\n\t}\n\treturn\n}", "title": "" }, { "docid": "617e330757ae68ed6a08baee86cd6a8e", "score": "0.7128424", "text": "func (fts *FurnitureTypeSelect) Bool(ctx context.Context) (_ bool, err error) {\n\tvar v []bool\n\tif v, err = fts.Bools(ctx); err != nil {\n\t\treturn\n\t}\n\tswitch len(v) {\n\tcase 1:\n\t\treturn v[0], nil\n\tcase 0:\n\t\terr = &NotFoundError{furnituretype.Label}\n\tdefault:\n\t\terr = fmt.Errorf(\"ent: FurnitureTypeSelect.Bools returned %d results when one was expected\", len(v))\n\t}\n\treturn\n}", "title": "" }, { "docid": "ece568edd70fd8e50def3e1969bae344", "score": "0.7081432", "text": "func SelectBool(ctx context.Context, db Queryer, sql string, args ...interface{}) (bool, error) {\n\tvar v pgtype.Bool\n\targs = append([]interface{}{pgx.QueryResultFormats{pgx.TextFormatCode}}, args...)\n\terr := selectOneValueNotNull(ctx, db, sql, args, func(rows pgx.Rows) error {\n\t\treturn rows.Scan(&v)\n\t})\n\tif err != nil {\n\t\treturn false, err\n\t}\n\n\treturn v.Bool, nil\n}", "title": "" }, { "docid": "b92688db8b8e15e1791f2897f59a21a6", "score": "0.70285106", "text": "func (is *InquirySelect) Bool(ctx context.Context) (_ bool, err error) {\n\tvar v []bool\n\tif v, err = is.Bools(ctx); err != nil {\n\t\treturn\n\t}\n\tswitch len(v) {\n\tcase 1:\n\t\treturn v[0], nil\n\tcase 0:\n\t\terr = &NotFoundError{inquiry.Label}\n\tdefault:\n\t\terr = fmt.Errorf(\"ent: InquirySelect.Bools returned %d results when one was expected\", len(v))\n\t}\n\treturn\n}", "title": "" }, { "docid": "612a03a568843688234f353597ac531e", "score": "0.6941285", "text": "func (as *AdultSelect) Bool(ctx context.Context) (_ bool, err error) {\n\tvar v []bool\n\tif v, err = as.Bools(ctx); err != nil {\n\t\treturn\n\t}\n\tswitch len(v) {\n\tcase 1:\n\t\treturn v[0], nil\n\tcase 0:\n\t\terr = &NotFoundError{adult.Label}\n\tdefault:\n\t\terr = fmt.Errorf(\"ent: AdultSelect.Bools returned %d results when one was expected\", len(v))\n\t}\n\treturn\n}", "title": "" }, { "docid": "0543f0180d87f62f8b0b6cad48fc02a1", "score": "0.6921461", "text": "func (css *CounterStaffSelect) Bool(ctx context.Context) (_ bool, err error) {\n\tvar v []bool\n\tif v, err = css.Bools(ctx); err != nil {\n\t\treturn\n\t}\n\tswitch len(v) {\n\tcase 1:\n\t\treturn v[0], nil\n\tcase 0:\n\t\terr = &NotFoundError{counterstaff.Label}\n\tdefault:\n\t\terr = fmt.Errorf(\"ent: CounterStaffSelect.Bools returned %d results when one was expected\", len(v))\n\t}\n\treturn\n}", "title": "" }, { "docid": "2dc9917bd2550eb7b4c6b7f8a215a84c", "score": "0.6837248", "text": "func (upas *UnsavedPostAttachmentSelect) Bool(ctx context.Context) (_ bool, err error) {\n\tvar v []bool\n\tif v, err = upas.Bools(ctx); err != nil {\n\t\treturn\n\t}\n\tswitch len(v) {\n\tcase 1:\n\t\treturn v[0], nil\n\tcase 0:\n\t\terr = &NotFoundError{unsavedpostattachment.Label}\n\tdefault:\n\t\terr = fmt.Errorf(\"ent: UnsavedPostAttachmentSelect.Bools returned %d results when one was expected\", len(v))\n\t}\n\treturn\n}", "title": "" }, { "docid": "15960ca6c1bc16a242dac796657c6a55", "score": "0.68312943", "text": "func Bool(field string) string {\n\treturn BoolAs(field, field)\n}", "title": "" }, { "docid": "98fa68d1c488524904172c127e3ce5d6", "score": "0.6820595", "text": "func (dts *DrugTypeSelect) Bool(ctx context.Context) (_ bool, err error) {\n\tvar v []bool\n\tif v, err = dts.Bools(ctx); err != nil {\n\t\treturn\n\t}\n\tswitch len(v) {\n\tcase 1:\n\t\treturn v[0], nil\n\tcase 0:\n\t\terr = &NotFoundError{drugtype.Label}\n\tdefault:\n\t\terr = fmt.Errorf(\"ent: DrugTypeSelect.Bools returned %d results when one was expected\", len(v))\n\t}\n\treturn\n}", "title": "" }, { "docid": "72c446239fb094231bfcdcb0b15a9e26", "score": "0.68083626", "text": "func (rs *RoomdetailSelect) Bool(ctx context.Context) (_ bool, err error) {\n\tvar v []bool\n\tif v, err = rs.Bools(ctx); err != nil {\n\t\treturn\n\t}\n\tswitch len(v) {\n\tcase 1:\n\t\treturn v[0], nil\n\tcase 0:\n\t\terr = &NotFoundError{roomdetail.Label}\n\tdefault:\n\t\terr = fmt.Errorf(\"ent: RoomdetailSelect.Bools returned %d results when one was expected\", len(v))\n\t}\n\treturn\n}", "title": "" }, { "docid": "3bc8b5bca39a3cdf7aa62ec46e3ec6de", "score": "0.68032205", "text": "func (kos *K8sObjectSelect) Bool(ctx context.Context) (_ bool, err error) {\n\tvar v []bool\n\tif v, err = kos.Bools(ctx); err != nil {\n\t\treturn\n\t}\n\tswitch len(v) {\n\tcase 1:\n\t\treturn v[0], nil\n\tcase 0:\n\t\terr = &NotFoundError{k8sobject.Label}\n\tdefault:\n\t\terr = fmt.Errorf(\"ent: K8sObjectSelect.Bools returned %d results when one was expected\", len(v))\n\t}\n\treturn\n}", "title": "" }, { "docid": "2b7c811dcaeb19680b782260d0864f0a", "score": "0.6796086", "text": "func (trss *TravelRestrictionSnapshotSelect) Bool(ctx context.Context) (_ bool, err error) {\n\tvar v []bool\n\tif v, err = trss.Bools(ctx); err != nil {\n\t\treturn\n\t}\n\tswitch len(v) {\n\tcase 1:\n\t\treturn v[0], nil\n\tcase 0:\n\t\terr = &NotFoundError{travelrestrictionsnapshot.Label}\n\tdefault:\n\t\terr = fmt.Errorf(\"ent: TravelRestrictionSnapshotSelect.Bools returned %d results when one was expected\", len(v))\n\t}\n\treturn\n}", "title": "" }, { "docid": "46c993d53ab6b06546fec2b61a5098a6", "score": "0.6782542", "text": "func (vs *VocaSelect) Bool(ctx context.Context) (_ bool, err error) {\n\tvar v []bool\n\tif v, err = vs.Bools(ctx); err != nil {\n\t\treturn\n\t}\n\tswitch len(v) {\n\tcase 1:\n\t\treturn v[0], nil\n\tcase 0:\n\t\terr = &NotFoundError{voca.Label}\n\tdefault:\n\t\terr = fmt.Errorf(\"ent: VocaSelect.Bools returned %d results when one was expected\", len(v))\n\t}\n\treturn\n}", "title": "" }, { "docid": "9cf1c224e571619a309a0889dc278dd0", "score": "0.67533296", "text": "func (mts *MetricTypeSelect) Bool(ctx context.Context) (_ bool, err error) {\n\tvar v []bool\n\tif v, err = mts.Bools(ctx); err != nil {\n\t\treturn\n\t}\n\tswitch len(v) {\n\tcase 1:\n\t\treturn v[0], nil\n\tcase 0:\n\t\terr = &NotFoundError{metrictype.Label}\n\tdefault:\n\t\terr = fmt.Errorf(\"ent: MetricTypeSelect.Bools returned %d results when one was expected\", len(v))\n\t}\n\treturn\n}", "title": "" }, { "docid": "fd3ab7e08e01b92cfda612d94ba8e22e", "score": "0.6711086", "text": "func (ps *ParticipationSelect) Bool(ctx context.Context) (_ bool, err error) {\n\tvar v []bool\n\tif v, err = ps.Bools(ctx); err != nil {\n\t\treturn\n\t}\n\tswitch len(v) {\n\tcase 1:\n\t\treturn v[0], nil\n\tcase 0:\n\t\terr = &NotFoundError{participation.Label}\n\tdefault:\n\t\terr = fmt.Errorf(\"ent: ParticipationSelect.Bools returned %d results when one was expected\", len(v))\n\t}\n\treturn\n}", "title": "" }, { "docid": "752ca12789adf53f1324782dddb0b687", "score": "0.66978085", "text": "func (bps *BlogPostSelect) Bool(ctx context.Context) (_ bool, err error) {\n\tvar v []bool\n\tif v, err = bps.Bools(ctx); err != nil {\n\t\treturn\n\t}\n\tswitch len(v) {\n\tcase 1:\n\t\treturn v[0], nil\n\tcase 0:\n\t\terr = &NotFoundError{blogpost.Label}\n\tdefault:\n\t\terr = fmt.Errorf(\"ent: BlogPostSelect.Bools returned %d results when one was expected\", len(v))\n\t}\n\treturn\n}", "title": "" }, { "docid": "255b7aed37b504394a4c87361837aa66", "score": "0.6637016", "text": "func (cfs *CounterFormulaSelect) Bool(ctx context.Context) (_ bool, err error) {\n\tvar v []bool\n\tif v, err = cfs.Bools(ctx); err != nil {\n\t\treturn\n\t}\n\tswitch len(v) {\n\tcase 1:\n\t\treturn v[0], nil\n\tcase 0:\n\t\terr = &NotFoundError{counterformula.Label}\n\tdefault:\n\t\terr = fmt.Errorf(\"ent: CounterFormulaSelect.Bools returned %d results when one was expected\", len(v))\n\t}\n\treturn\n}", "title": "" }, { "docid": "ac03cd7fc6caf0133fc7da892282066d", "score": "0.6619233", "text": "func (ps *ProcesSelect) Bool(ctx context.Context) (_ bool, err error) {\n\tvar v []bool\n\tif v, err = ps.Bools(ctx); err != nil {\n\t\treturn\n\t}\n\tswitch len(v) {\n\tcase 1:\n\t\treturn v[0], nil\n\tcase 0:\n\t\terr = &NotFoundError{proces.Label}\n\tdefault:\n\t\terr = fmt.Errorf(\"ent: ProcesSelect.Bools returned %d results when one was expected\", len(v))\n\t}\n\treturn\n}", "title": "" }, { "docid": "449b407bba19f08fa5b607cfd5b33fe9", "score": "0.6618416", "text": "func (us *UserSelect) Bool(ctx context.Context) (_ bool, err error) {\n\tvar v []bool\n\tif v, err = us.Bools(ctx); err != nil {\n\t\treturn\n\t}\n\tswitch len(v) {\n\tcase 1:\n\t\treturn v[0], nil\n\tcase 0:\n\t\terr = &NotFoundError{user.Label}\n\tdefault:\n\t\terr = fmt.Errorf(\"ent: UserSelect.Bools returned %d results when one was expected\", len(v))\n\t}\n\treturn\n}", "title": "" }, { "docid": "72229a59c7b3977cb8634e70a3a605c7", "score": "0.65748465", "text": "func (ps *PatientofphysicianSelect) Bool(ctx context.Context) (_ bool, err error) {\n\tvar v []bool\n\tif v, err = ps.Bools(ctx); err != nil {\n\t\treturn\n\t}\n\tswitch len(v) {\n\tcase 1:\n\t\treturn v[0], nil\n\tcase 0:\n\t\terr = &NotFoundError{patientofphysician.Label}\n\tdefault:\n\t\terr = fmt.Errorf(\"ent: PatientofphysicianSelect.Bools returned %d results when one was expected\", len(v))\n\t}\n\treturn\n}", "title": "" }, { "docid": "e27479304347a0a3388223b98d20a50c", "score": "0.65719676", "text": "func (dps *DeathPlaceSelect) Bool(ctx context.Context) (_ bool, err error) {\n\tvar v []bool\n\tif v, err = dps.Bools(ctx); err != nil {\n\t\treturn\n\t}\n\tswitch len(v) {\n\tcase 1:\n\t\treturn v[0], nil\n\tcase 0:\n\t\terr = &NotFoundError{deathplace.Label}\n\tdefault:\n\t\terr = fmt.Errorf(\"ent: DeathPlaceSelect.Bools returned %d results when one was expected\", len(v))\n\t}\n\treturn\n}", "title": "" }, { "docid": "f5f0a473ef563a4d16b8152a489b2f0a", "score": "0.65484643", "text": "func (tps *TourProductSelect) Bool(ctx context.Context) (_ bool, err error) {\n\tvar v []bool\n\tif v, err = tps.Bools(ctx); err != nil {\n\t\treturn\n\t}\n\tswitch len(v) {\n\tcase 1:\n\t\treturn v[0], nil\n\tcase 0:\n\t\terr = &NotFoundError{tourproduct.Label}\n\tdefault:\n\t\terr = fmt.Errorf(\"ent: TourProductSelect.Bools returned %d results when one was expected\", len(v))\n\t}\n\treturn\n}", "title": "" }, { "docid": "540a44e640579322f01fef5bdc92ef53", "score": "0.65298355", "text": "func (eps *EntryPointSelect) Bool(ctx context.Context) (_ bool, err error) {\n\tvar v []bool\n\tif v, err = eps.Bools(ctx); err != nil {\n\t\treturn\n\t}\n\tswitch len(v) {\n\tcase 1:\n\t\treturn v[0], nil\n\tcase 0:\n\t\terr = &NotFoundError{entrypoint.Label}\n\tdefault:\n\t\terr = fmt.Errorf(\"ent: EntryPointSelect.Bools returned %d results when one was expected\", len(v))\n\t}\n\treturn\n}", "title": "" }, { "docid": "cc923dd257193fff96f94b86cb17d41c", "score": "0.65112257", "text": "func (pvs *PostVideoSelect) Bool(ctx context.Context) (_ bool, err error) {\n\tvar v []bool\n\tif v, err = pvs.Bools(ctx); err != nil {\n\t\treturn\n\t}\n\tswitch len(v) {\n\tcase 1:\n\t\treturn v[0], nil\n\tcase 0:\n\t\terr = &NotFoundError{postvideo.Label}\n\tdefault:\n\t\terr = fmt.Errorf(\"ent: PostVideoSelect.Bools returned %d results when one was expected\", len(v))\n\t}\n\treturn\n}", "title": "" }, { "docid": "3abea1df0a87463a0346f6dbc33b0160", "score": "0.64668417", "text": "func (ws *WatchlistSelect) Bool(ctx context.Context) (_ bool, err error) {\n\tvar v []bool\n\tif v, err = ws.Bools(ctx); err != nil {\n\t\treturn\n\t}\n\tswitch len(v) {\n\tcase 1:\n\t\treturn v[0], nil\n\tcase 0:\n\t\terr = &NotFoundError{watchlist.Label}\n\tdefault:\n\t\terr = fmt.Errorf(\"ent: WatchlistSelect.Bools returned %d results when one was expected\", len(v))\n\t}\n\treturn\n}", "title": "" }, { "docid": "479e7b9e0dda89ed161db0d877d91341", "score": "0.64653426", "text": "func (upvs *UnsavedPostVideoSelect) Bool(ctx context.Context) (_ bool, err error) {\n\tvar v []bool\n\tif v, err = upvs.Bools(ctx); err != nil {\n\t\treturn\n\t}\n\tswitch len(v) {\n\tcase 1:\n\t\treturn v[0], nil\n\tcase 0:\n\t\terr = &NotFoundError{unsavedpostvideo.Label}\n\tdefault:\n\t\terr = fmt.Errorf(\"ent: UnsavedPostVideoSelect.Bools returned %d results when one was expected\", len(v))\n\t}\n\treturn\n}", "title": "" }, { "docid": "741f8c6515bb64809594856f9a9ac07a", "score": "0.6449811", "text": "func (vs *VehicleSelect) Bool(ctx context.Context) (_ bool, err error) {\n\tvar v []bool\n\tif v, err = vs.Bools(ctx); err != nil {\n\t\treturn\n\t}\n\tswitch len(v) {\n\tcase 1:\n\t\treturn v[0], nil\n\tcase 0:\n\t\terr = &NotFoundError{vehicle.Label}\n\tdefault:\n\t\terr = fmt.Errorf(\"ent: VehicleSelect.Bools returned %d results when one was expected\", len(v))\n\t}\n\treturn\n}", "title": "" }, { "docid": "67a9a15cc2577f22c36bbd0939c494f9", "score": "0.64306474", "text": "func (cs *ConfigoccupationSelect) Bool(ctx context.Context) (_ bool, err error) {\n\tvar v []bool\n\tif v, err = cs.Bools(ctx); err != nil {\n\t\treturn\n\t}\n\tswitch len(v) {\n\tcase 1:\n\t\treturn v[0], nil\n\tcase 0:\n\t\terr = &NotFoundError{configoccupation.Label}\n\tdefault:\n\t\terr = fmt.Errorf(\"ent: ConfigoccupationSelect.Bools returned %d results when one was expected\", len(v))\n\t}\n\treturn\n}", "title": "" }, { "docid": "2a1a46d62ad01897eaaeaa7c31972a52", "score": "0.6425602", "text": "func (ps *ProductSelect) Bool(ctx context.Context) (_ bool, err error) {\n\tvar v []bool\n\tif v, err = ps.Bools(ctx); err != nil {\n\t\treturn\n\t}\n\tswitch len(v) {\n\tcase 1:\n\t\treturn v[0], nil\n\tcase 0:\n\t\terr = &NotFoundError{product.Label}\n\tdefault:\n\t\terr = fmt.Errorf(\"ent: ProductSelect.Bools returned %d results when one was expected\", len(v))\n\t}\n\treturn\n}", "title": "" }, { "docid": "ed2598f75eb24c4d8032307c1e3dd6ec", "score": "0.64097786", "text": "func (oos *OrganizationOwnershipSelect) Bool(ctx context.Context) (_ bool, err error) {\n\tvar v []bool\n\tif v, err = oos.Bools(ctx); err != nil {\n\t\treturn\n\t}\n\tswitch len(v) {\n\tcase 1:\n\t\treturn v[0], nil\n\tcase 0:\n\t\terr = &NotFoundError{organizationownership.Label}\n\tdefault:\n\t\terr = fmt.Errorf(\"ent: OrganizationOwnershipSelect.Bools returned %d results when one was expected\", len(v))\n\t}\n\treturn\n}", "title": "" }, { "docid": "28e74becc6787c426c5d982a598a00bb", "score": "0.63925874", "text": "func (bbs *BookBorrowSelect) Bool(ctx context.Context) (_ bool, err error) {\n\tvar v []bool\n\tif v, err = bbs.Bools(ctx); err != nil {\n\t\treturn\n\t}\n\tswitch len(v) {\n\tcase 1:\n\t\treturn v[0], nil\n\tcase 0:\n\t\terr = &NotFoundError{bookborrow.Label}\n\tdefault:\n\t\terr = fmt.Errorf(\"ent: BookBorrowSelect.Bools returned %d results when one was expected\", len(v))\n\t}\n\treturn\n}", "title": "" }, { "docid": "f88941eef130e4c953626a9b1611f742", "score": "0.6379493", "text": "func (ds *DeviceSelect) Bool(ctx context.Context) (_ bool, err error) {\n\tvar v []bool\n\tif v, err = ds.Bools(ctx); err != nil {\n\t\treturn\n\t}\n\tswitch len(v) {\n\tcase 1:\n\t\treturn v[0], nil\n\tcase 0:\n\t\terr = &NotFoundError{device.Label}\n\tdefault:\n\t\terr = fmt.Errorf(\"ent: DeviceSelect.Bools returned %d results when one was expected\", len(v))\n\t}\n\treturn\n}", "title": "" }, { "docid": "e7a2082715e4f81a0bf4053f262774d0", "score": "0.63771504", "text": "func (m *MONGO) Bool(name string) (bool, error) {\n\tv, err := m.value(name)\n\tif err != nil {\n\t\treturn false, err\n\t}\n\n\tb, ok := v.(bool)\n\tif !ok {\n\t\treturn false, errors.New(\"unable to cast\")\n\t}\n\n\treturn b, nil\n}", "title": "" }, { "docid": "ce1aa7c5b753277c897473e6cc2b3a3c", "score": "0.63746583", "text": "func (ktfs *KqiTemporalFrequencySelect) Bool(ctx context.Context) (_ bool, err error) {\n\tvar v []bool\n\tif v, err = ktfs.Bools(ctx); err != nil {\n\t\treturn\n\t}\n\tswitch len(v) {\n\tcase 1:\n\t\treturn v[0], nil\n\tcase 0:\n\t\terr = &NotFoundError{kqitemporalfrequency.Label}\n\tdefault:\n\t\terr = fmt.Errorf(\"ent: KqiTemporalFrequencySelect.Bools returned %d results when one was expected\", len(v))\n\t}\n\treturn\n}", "title": "" }, { "docid": "9fb2039c71306c49ca1ca841100b1164", "score": "0.63627046", "text": "func (gss *GoodsSpecsSelect) Bool(ctx context.Context) (_ bool, err error) {\n\tvar v []bool\n\tif v, err = gss.Bools(ctx); err != nil {\n\t\treturn\n\t}\n\tswitch len(v) {\n\tcase 1:\n\t\treturn v[0], nil\n\tcase 0:\n\t\terr = &NotFoundError{goodsspecs.Label}\n\tdefault:\n\t\terr = fmt.Errorf(\"ent: GoodsSpecsSelect.Bools returned %d results when one was expected\", len(v))\n\t}\n\treturn\n}", "title": "" }, { "docid": "4f1ac7588d40d0e7d7d164eefa4350fb", "score": "0.6362316", "text": "func (ews *EventsWaitSelect) Bool(ctx context.Context) (_ bool, err error) {\n\tvar v []bool\n\tif v, err = ews.Bools(ctx); err != nil {\n\t\treturn\n\t}\n\tswitch len(v) {\n\tcase 1:\n\t\treturn v[0], nil\n\tcase 0:\n\t\terr = &NotFoundError{eventswait.Label}\n\tdefault:\n\t\terr = fmt.Errorf(\"ent: EventsWaitSelect.Bools returned %d results when one was expected\", len(v))\n\t}\n\treturn\n}", "title": "" }, { "docid": "d7ac8f65d92db3f55fba0dc25e6ddd84", "score": "0.635561", "text": "func (cs *CourseclassSelect) Bool(ctx context.Context) (_ bool, err error) {\n\tvar v []bool\n\tif v, err = cs.Bools(ctx); err != nil {\n\t\treturn\n\t}\n\tswitch len(v) {\n\tcase 1:\n\t\treturn v[0], nil\n\tcase 0:\n\t\terr = &NotFoundError{courseclass.Label}\n\tdefault:\n\t\terr = fmt.Errorf(\"ent: CourseclassSelect.Bools returned %d results when one was expected\", len(v))\n\t}\n\treturn\n}", "title": "" }, { "docid": "5df75dc4cd4344a6cd066adea60d5393", "score": "0.635122", "text": "func (oss *OutboundShippingSelect) Bool(ctx context.Context) (_ bool, err error) {\n\tvar v []bool\n\tif v, err = oss.Bools(ctx); err != nil {\n\t\treturn\n\t}\n\tswitch len(v) {\n\tcase 1:\n\t\treturn v[0], nil\n\tcase 0:\n\t\terr = &NotFoundError{outboundshipping.Label}\n\tdefault:\n\t\terr = fmt.Errorf(\"ent: OutboundShippingSelect.Bools returned %d results when one was expected\", len(v))\n\t}\n\treturn\n}", "title": "" }, { "docid": "881535959258436c8fdabdd96dfcda3d", "score": "0.63433397", "text": "func (ofgb *OrderFieldGroupBy) Bool(ctx context.Context) (_ bool, err error) {\n\tvar v []bool\n\tif v, err = ofgb.Bools(ctx); err != nil {\n\t\treturn\n\t}\n\tswitch len(v) {\n\tcase 1:\n\t\treturn v[0], nil\n\tcase 0:\n\t\terr = &NotFoundError{orderfield.Label}\n\tdefault:\n\t\terr = fmt.Errorf(\"ent: OrderFieldGroupBy.Bools returned %d results when one was expected\", len(v))\n\t}\n\treturn\n}", "title": "" }, { "docid": "d442997737f7bdc61882baf11e79ee38", "score": "0.6338215", "text": "func (ttrs *TemplateTagRelationSelect) Bool(ctx context.Context) (_ bool, err error) {\n\tvar v []bool\n\tif v, err = ttrs.Bools(ctx); err != nil {\n\t\treturn\n\t}\n\tswitch len(v) {\n\tcase 1:\n\t\treturn v[0], nil\n\tcase 0:\n\t\terr = &NotFoundError{templatetagrelation.Label}\n\tdefault:\n\t\terr = fmt.Errorf(\"ent: TemplateTagRelationSelect.Bools returned %d results when one was expected\", len(v))\n\t}\n\treturn\n}", "title": "" }, { "docid": "f69961cdebcb3ec9fcaa9b66ca7687ea", "score": "0.63312435", "text": "func (ds *DecisionSelect) Bool(ctx context.Context) (_ bool, err error) {\n\tvar v []bool\n\tif v, err = ds.Bools(ctx); err != nil {\n\t\treturn\n\t}\n\tswitch len(v) {\n\tcase 1:\n\t\treturn v[0], nil\n\tcase 0:\n\t\terr = &NotFoundError{decision.Label}\n\tdefault:\n\t\terr = fmt.Errorf(\"ent: DecisionSelect.Bools returned %d results when one was expected\", len(v))\n\t}\n\treturn\n}", "title": "" }, { "docid": "c073ad6b9d224f56fd150bb2e28ef03b", "score": "0.63191533", "text": "func (wnfgb *WithNilFieldsGroupBy) Bool(ctx context.Context) (_ bool, err error) {\n\tvar v []bool\n\tif v, err = wnfgb.Bools(ctx); err != nil {\n\t\treturn\n\t}\n\tswitch len(v) {\n\tcase 1:\n\t\treturn v[0], nil\n\tcase 0:\n\t\terr = &NotFoundError{withnilfields.Label}\n\tdefault:\n\t\terr = fmt.Errorf(\"ent: WithNilFieldsGroupBy.Bools returned %d results when one was expected\", len(v))\n\t}\n\treturn\n}", "title": "" }, { "docid": "451ae42a3049bdff6d7359ec03bfa381", "score": "0.6309322", "text": "func (j *JSON) Bool(args ...bool) bool {\n\tvar def bool\n\n\tswitch len(args) {\n\tcase 0:\n\tcase 1:\n\t\tdef = args[0]\n\tdefault:\n\t\tlog.Panicf(\"bool() received too many arguments %d\", len(args))\n\t}\n\n\tb, err := j.MaybeBool()\n\tif err == nil {\n\t\treturn b\n\t}\n\n\treturn def\n}", "title": "" }, { "docid": "8de06ebb96308c2a469bd0560156be7f", "score": "0.63026965", "text": "func (bis *BlockInstanceSelect) Bool(ctx context.Context) (_ bool, err error) {\n\tvar v []bool\n\tif v, err = bis.Bools(ctx); err != nil {\n\t\treturn\n\t}\n\tswitch len(v) {\n\tcase 1:\n\t\treturn v[0], nil\n\tcase 0:\n\t\terr = &NotFoundError{blockinstance.Label}\n\tdefault:\n\t\terr = fmt.Errorf(\"ent: BlockInstanceSelect.Bools returned %d results when one was expected\", len(v))\n\t}\n\treturn\n}", "title": "" }, { "docid": "3d8bc424b27a1d76c8461e4291d12103", "score": "0.62983614", "text": "func (sebs *StatementEndingBalancSelect) Bool(ctx context.Context) (_ bool, err error) {\n\tvar v []bool\n\tif v, err = sebs.Bools(ctx); err != nil {\n\t\treturn\n\t}\n\tswitch len(v) {\n\tcase 1:\n\t\treturn v[0], nil\n\tcase 0:\n\t\terr = &NotFoundError{statementendingbalanc.Label}\n\tdefault:\n\t\terr = fmt.Errorf(\"ent: StatementEndingBalancSelect.Bools returned %d results when one was expected\", len(v))\n\t}\n\treturn\n}", "title": "" }, { "docid": "3fa0a5b3e4554fddcca3cd7e6fa814df", "score": "0.629684", "text": "func (vs *VlanSelect) Bool(ctx context.Context) (_ bool, err error) {\n\tvar v []bool\n\tif v, err = vs.Bools(ctx); err != nil {\n\t\treturn\n\t}\n\tswitch len(v) {\n\tcase 1:\n\t\treturn v[0], nil\n\tcase 0:\n\t\terr = &NotFoundError{vlan.Label}\n\tdefault:\n\t\terr = fmt.Errorf(\"ent: VlanSelect.Bools returned %d results when one was expected\", len(v))\n\t}\n\treturn\n}", "title": "" }, { "docid": "5ab092ab3d40f929e9bbaa1e83429851", "score": "0.6294096", "text": "func (f *Queries) Bool(key string) (bool, error) {\n\ts, err := f.String(key)\n\tif err != nil {\n\t\treturn false, err\n\t}\n\treturn strconv.ParseBool(s)\n}", "title": "" }, { "docid": "b376c598578523f1170cf78e22b2d135", "score": "0.6293934", "text": "func (lbs *LoadBalanceSelect) Bool(ctx context.Context) (_ bool, err error) {\n\tvar v []bool\n\tif v, err = lbs.Bools(ctx); err != nil {\n\t\treturn\n\t}\n\tswitch len(v) {\n\tcase 1:\n\t\treturn v[0], nil\n\tcase 0:\n\t\terr = &NotFoundError{loadbalance.Label}\n\tdefault:\n\t\terr = fmt.Errorf(\"ent: LoadBalanceSelect.Bools returned %d results when one was expected\", len(v))\n\t}\n\treturn\n}", "title": "" }, { "docid": "610bdfea7cb7c00863c79ae64db094c7", "score": "0.6286545", "text": "func (doss *DependsOnSkippedSelect) Bool(ctx context.Context) (_ bool, err error) {\n\tvar v []bool\n\tif v, err = doss.Bools(ctx); err != nil {\n\t\treturn\n\t}\n\tswitch len(v) {\n\tcase 1:\n\t\treturn v[0], nil\n\tcase 0:\n\t\terr = &NotFoundError{dependsonskipped.Label}\n\tdefault:\n\t\terr = fmt.Errorf(\"ent: DependsOnSkippedSelect.Bools returned %d results when one was expected\", len(v))\n\t}\n\treturn\n}", "title": "" }, { "docid": "c1a9f0e2168f061a88755758267459f4", "score": "0.6262527", "text": "func (esms *ExplicitSkippedMessageSelect) Bool(ctx context.Context) (_ bool, err error) {\n\tvar v []bool\n\tif v, err = esms.Bools(ctx); err != nil {\n\t\treturn\n\t}\n\tswitch len(v) {\n\tcase 1:\n\t\treturn v[0], nil\n\tcase 0:\n\t\terr = &NotFoundError{explicitskippedmessage.Label}\n\tdefault:\n\t\terr = fmt.Errorf(\"ent: ExplicitSkippedMessageSelect.Bools returned %d results when one was expected\", len(v))\n\t}\n\treturn\n}", "title": "" }, { "docid": "ad8a35c3fca166fd509a7e66a33eb934", "score": "0.6255699", "text": "func Bool(key string, val bool) Field {\n\treturn zap.Bool(key, val)\n}", "title": "" }, { "docid": "f490010ba23deb6c97aae82a9359fdb3", "score": "0.62477016", "text": "func Bool(val interface{}) bool {\n\tif value, ok := val.(bool); ok {\n\t\treturn value\n\t}\n\treturn false\n}", "title": "" }, { "docid": "78c065c6ed9d8620bb50c1195d6875b9", "score": "0.62421036", "text": "func (v Value) Bool() bool", "title": "" }, { "docid": "ffd5c32c54fb59e8f8cbb86e9e23e68e", "score": "0.6232209", "text": "func (ss *SystemSelect) Bool(ctx context.Context) (_ bool, err error) {\n\tvar v []bool\n\tif v, err = ss.Bools(ctx); err != nil {\n\t\treturn\n\t}\n\tswitch len(v) {\n\tcase 1:\n\t\treturn v[0], nil\n\tcase 0:\n\t\terr = &NotFoundError{system.Label}\n\tdefault:\n\t\terr = fmt.Errorf(\"ent: SystemSelect.Bools returned %d results when one was expected\", len(v))\n\t}\n\treturn\n}", "title": "" }, { "docid": "49a0ae4a8c1c107eace415cbea4ef1d9", "score": "0.6207731", "text": "func (ls *LanguageSelect) Bool(ctx context.Context) (_ bool, err error) {\n\tvar v []bool\n\tif v, err = ls.Bools(ctx); err != nil {\n\t\treturn\n\t}\n\tswitch len(v) {\n\tcase 1:\n\t\treturn v[0], nil\n\tcase 0:\n\t\terr = &NotFoundError{language.Label}\n\tdefault:\n\t\terr = fmt.Errorf(\"ent: LanguageSelect.Bools returned %d results when one was expected\", len(v))\n\t}\n\treturn\n}", "title": "" }, { "docid": "20cd4a4546da5e1a557528d4532f0326", "score": "0.6181759", "text": "func (dev *Object) Bool(name string) (val bool, e error) {\n\te = dev.Get(name, &val)\n\treturn val, e\n}", "title": "" }, { "docid": "99fdfaacfc82f97aa6165c6ad70ef592", "score": "0.61307365", "text": "func Bool(v interface{}) bool {\n\tvar b bool\n\t// we will allow \"1\" as a bool and also a non-empty jobId\n\tif str, ok := v.(string); ok {\n\t\tif len(str) == 0 || str == \"0\" || str == \"false\" { // for \"afh\"\n\t\t\tb = false\n\t\t} else {\n\t\t\tb = true\n\t\t}\n\t} else if val, ok := v.(bool); ok {\n\t\tb = val\n\t}\n\treturn b\n}", "title": "" }, { "docid": "b78b9dd8719a2c12aa444b8572b581d7", "score": "0.6128584", "text": "func (me *Value) Bool() bool {\n\treturn me.value.(bool)\n}", "title": "" }, { "docid": "00ea3370789fea0f84afbcbd913ea821", "score": "0.6125633", "text": "func Bool(f *frm.Field, inp ...string) {\n\tf.Value = len(strings.TrimSpace(inp[0])) >= 1\n\tif f.Required && !f.Checked() {\n\t\tf.Err = \"Please check this field.\"\n\t}\n}", "title": "" }, { "docid": "6491a3456443868c7eaf835b68cf4a72", "score": "0.6116772", "text": "func (rgb *RoomdetailGroupBy) Bool(ctx context.Context) (_ bool, err error) {\n\tvar v []bool\n\tif v, err = rgb.Bools(ctx); err != nil {\n\t\treturn\n\t}\n\tswitch len(v) {\n\tcase 1:\n\t\treturn v[0], nil\n\tcase 0:\n\t\terr = &NotFoundError{roomdetail.Label}\n\tdefault:\n\t\terr = fmt.Errorf(\"ent: RoomdetailGroupBy.Bools returned %d results when one was expected\", len(v))\n\t}\n\treturn\n}", "title": "" }, { "docid": "db683a5c780bc808b3193a5e7c22f553", "score": "0.6108706", "text": "func Bool(reply interface{}, err error) (bool, error) {\n\tif err != nil {\n\t\treturn false, err\n\t}\n\tswitch reply := reply.(type) {\n\tcase int64:\n\t\treturn reply != 0, nil\n\tcase []byte:\n\t\treturn strconv.ParseBool(string(reply))\n\tcase nil:\n\t\treturn false, ErrNil\n\tcase redisError:\n\t\treturn false, reply\n\t}\n\treturn false, fmt.Errorf(\"unexpected type %T for Bool: %v\", reply, reply)\n}", "title": "" }, { "docid": "5f3f848c8cfeb3d18f6c3cd91116e7a4", "score": "0.610814", "text": "func (s *Store) Bool(r interface{}, err error) (bool, error) {\n\tif err != nil {\n\t\treturn false, err\n\t}\n\n\tv, ok := r.(bool)\n\tif !ok {\n\t\terr = simplesessions.ErrAssertType\n\t}\n\n\treturn v, err\n}", "title": "" }, { "docid": "f8261b6b9fca275d99f3ed6935e614cf", "score": "0.61073464", "text": "func (trsgb *TravelRestrictionSnapshotGroupBy) Bool(ctx context.Context) (_ bool, err error) {\n\tvar v []bool\n\tif v, err = trsgb.Bools(ctx); err != nil {\n\t\treturn\n\t}\n\tswitch len(v) {\n\tcase 1:\n\t\treturn v[0], nil\n\tcase 0:\n\t\terr = &NotFoundError{travelrestrictionsnapshot.Label}\n\tdefault:\n\t\terr = fmt.Errorf(\"ent: TravelRestrictionSnapshotGroupBy.Bools returned %d results when one was expected\", len(v))\n\t}\n\treturn\n}", "title": "" }, { "docid": "665bb1818e4c3016463bd8ad37abdd4e", "score": "0.6102463", "text": "func Bool(key string, val bool) Field {\n\tvar ival int64\n\tif val {\n\t\tival = 1\n\t}\n\n\treturn Field{key: key, fieldType: boolType, ival: ival}\n}", "title": "" }, { "docid": "afa7380e483952e0911064fdb3acbb83", "score": "0.60976076", "text": "func (ftgb *FurnitureTypeGroupBy) Bool(ctx context.Context) (_ bool, err error) {\n\tvar v []bool\n\tif v, err = ftgb.Bools(ctx); err != nil {\n\t\treturn\n\t}\n\tswitch len(v) {\n\tcase 1:\n\t\treturn v[0], nil\n\tcase 0:\n\t\terr = &NotFoundError{furnituretype.Label}\n\tdefault:\n\t\terr = fmt.Errorf(\"ent: FurnitureTypeGroupBy.Bools returned %d results when one was expected\", len(v))\n\t}\n\treturn\n}", "title": "" }, { "docid": "7578c042ad221bbeb5e6f5f920fa1e9f", "score": "0.6093252", "text": "func (dtgb *DrugTypeGroupBy) Bool(ctx context.Context) (_ bool, err error) {\n\tvar v []bool\n\tif v, err = dtgb.Bools(ctx); err != nil {\n\t\treturn\n\t}\n\tswitch len(v) {\n\tcase 1:\n\t\treturn v[0], nil\n\tcase 0:\n\t\terr = &NotFoundError{drugtype.Label}\n\tdefault:\n\t\terr = fmt.Errorf(\"ent: DrugTypeGroupBy.Bools returned %d results when one was expected\", len(v))\n\t}\n\treturn\n}", "title": "" }, { "docid": "b6e642a7358a51bdfef67fde27df646d", "score": "0.60877484", "text": "func (pv *ProxyValue) Bool() bool {\n\tif pv.err != nil {\n\t\treturn false\n\t}\n\tv, err := strconv.ParseBool(pv.v.RawValueString())\n\tif err != nil {\n\t\tpv.setErr(fmt.Errorf(\"label:%q failed to parse as bool: %s\", pv.l, err))\n\t\treturn false\n\t}\n\treturn v\n}", "title": "" }, { "docid": "8d92165b6a1f68f6e45b153ab95fa88c", "score": "0.60842127", "text": "func (b *QueryBuilder) Bool() *BoolQueryBuilder {\n\tif b.boolQueryBuilder == nil {\n\t\tb.boolQueryBuilder = NewBoolQueryBuilder()\n\t}\n\treturn b.boolQueryBuilder\n}", "title": "" }, { "docid": "fcd5e6ad5a7b718e1f190de4333df5ab", "score": "0.60570246", "text": "func (o *Option) Bool() bool {\n\treturn o.Value.(bool)\n}", "title": "" }, { "docid": "f46108233eb6f7e8cbef134c80853cc0", "score": "0.6051249", "text": "func Bool(key string, val bool) Field {\n\treturn Field{Key: key, Val: BoolVal(val)}\n}", "title": "" }, { "docid": "295b77e293af8d609fdbe727d98073e8", "score": "0.60457003", "text": "func (igb *InquiryGroupBy) Bool(ctx context.Context) (_ bool, err error) {\n\tvar v []bool\n\tif v, err = igb.Bools(ctx); err != nil {\n\t\treturn\n\t}\n\tswitch len(v) {\n\tcase 1:\n\t\treturn v[0], nil\n\tcase 0:\n\t\terr = &NotFoundError{inquiry.Label}\n\tdefault:\n\t\terr = fmt.Errorf(\"ent: InquiryGroupBy.Bools returned %d results when one was expected\", len(v))\n\t}\n\treturn\n}", "title": "" }, { "docid": "3467b9de9f6daf7099b080365deb9da2", "score": "0.603762", "text": "func (c *Config) Bool(name string, idx int, opts ...Option) (bool, error) {\n\tO := makeOptions(opts)\n\tv, err := c.getField(name, idx, O)\n\tif err != nil {\n\t\treturn false, err\n\t}\n\tb, fail := v.toBool(O)\n\treturn b, convertErr(O, v, fail, \"bool\")\n}", "title": "" }, { "docid": "d05d52a0fd344a8574f920d9fc581204", "score": "0.6032841", "text": "func (is *InquirySelect) BoolX(ctx context.Context) bool {\n\tv, err := is.Bool(ctx)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn v\n}", "title": "" }, { "docid": "73bb13853cf96d865591012a98ced6d2", "score": "0.6023204", "text": "func (fts *FurnitureTypeSelect) BoolX(ctx context.Context) bool {\n\tv, err := fts.Bool(ctx)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn v\n}", "title": "" }, { "docid": "09c443ae31171ca68574808226c248f5", "score": "0.6017168", "text": "func (v Value) Bool() bool {\n\tb, _ := v.ToBool()\n\treturn b\n}", "title": "" }, { "docid": "43361f88409a5a69559aa8f24cbd43a6", "score": "0.6008118", "text": "func (upagb *UnsavedPostAttachmentGroupBy) Bool(ctx context.Context) (_ bool, err error) {\n\tvar v []bool\n\tif v, err = upagb.Bools(ctx); err != nil {\n\t\treturn\n\t}\n\tswitch len(v) {\n\tcase 1:\n\t\treturn v[0], nil\n\tcase 0:\n\t\terr = &NotFoundError{unsavedpostattachment.Label}\n\tdefault:\n\t\terr = fmt.Errorf(\"ent: UnsavedPostAttachmentGroupBy.Bools returned %d results when one was expected\", len(v))\n\t}\n\treturn\n}", "title": "" }, { "docid": "b07918c60e0fef09074f5f8a37c2b730", "score": "0.6006521", "text": "func (tv *TypedBool) Bool() bool {\n\treturn tv.Bytes[0] == 1\n}", "title": "" }, { "docid": "e241670808f7d484c7e53766c7a42096", "score": "0.5999398", "text": "func (t Tag) Bool() (bool, bool) {\n\tif len(t) == 1 {\n\t\treturn t[0] > 0, true\n\t}\n\treturn false, false\n}", "title": "" }, { "docid": "5f0283c5ae1c7234460c32407bf4d543", "score": "0.59760606", "text": "func (p *Property) AsBool() bool {\n\treturn p.Data[0] != 0\n}", "title": "" }, { "docid": "cf48c4466c63b4e1e76dfed4b1e8867a", "score": "0.5971947", "text": "func (agb *AdultGroupBy) Bool(ctx context.Context) (_ bool, err error) {\n\tvar v []bool\n\tif v, err = agb.Bools(ctx); err != nil {\n\t\treturn\n\t}\n\tswitch len(v) {\n\tcase 1:\n\t\treturn v[0], nil\n\tcase 0:\n\t\terr = &NotFoundError{adult.Label}\n\tdefault:\n\t\terr = fmt.Errorf(\"ent: AdultGroupBy.Bools returned %d results when one was expected\", len(v))\n\t}\n\treturn\n}", "title": "" }, { "docid": "1ae81d02b9e5f2ddba22257870e43e37", "score": "0.5964643", "text": "func (e Event) Bool(attributeName string) (bool, error) {\n\tv, ok := e[attributeName].(bool)\n\tif !ok {\n\t\treturn false, errors.New(\"Field was not of expected type\")\n\t}\n\treturn v, nil\n}", "title": "" }, { "docid": "8ac6f8053f9ef55d7a9b287f5120a4f8", "score": "0.5957033", "text": "func (x Object) Bool() bool {\n\treturn clib.XMLXPathObjectBool(x)\n}", "title": "" }, { "docid": "a51aff2e12eeb9607a1ae5ac17ade26c", "score": "0.5954217", "text": "func (rr *Decoder) Bool() (value bool, ok bool) {\n\tdata, ok := rr.take(1)\n\tif !ok {\n\t\treturn\n\t}\n\tif data[0] != 0 {\n\t\tvalue = true\n\t}\n\treturn\n}", "title": "" }, { "docid": "d054466a1f4dc630c421bd90d1ee1585", "score": "0.59408903", "text": "func (upvgb *UnsavedPostVideoGroupBy) Bool(ctx context.Context) (_ bool, err error) {\n\tvar v []bool\n\tif v, err = upvgb.Bools(ctx); err != nil {\n\t\treturn\n\t}\n\tswitch len(v) {\n\tcase 1:\n\t\treturn v[0], nil\n\tcase 0:\n\t\terr = &NotFoundError{unsavedpostvideo.Label}\n\tdefault:\n\t\terr = fmt.Errorf(\"ent: UnsavedPostVideoGroupBy.Bools returned %d results when one was expected\", len(v))\n\t}\n\treturn\n}", "title": "" }, { "docid": "cb80111bb09c5ac48730edec1237105f", "score": "0.59403116", "text": "func Bool(k string, v bool) Field {\n\tf := Field{}\n\tb := zap.Bool(k, v)\n\tf.field = b\n\n\treturn f\n}", "title": "" }, { "docid": "6d7f1aa197c846e0a903e38f50207b23", "score": "0.59341645", "text": "func (vgb *VocaGroupBy) Bool(ctx context.Context) (_ bool, err error) {\n\tvar v []bool\n\tif v, err = vgb.Bools(ctx); err != nil {\n\t\treturn\n\t}\n\tswitch len(v) {\n\tcase 1:\n\t\treturn v[0], nil\n\tcase 0:\n\t\terr = &NotFoundError{voca.Label}\n\tdefault:\n\t\terr = fmt.Errorf(\"ent: VocaGroupBy.Bools returned %d results when one was expected\", len(v))\n\t}\n\treturn\n}", "title": "" }, { "docid": "bff8f150c8d8d9dc39f81b5b50dcbd8f", "score": "0.5928854", "text": "func (self Variant) Bool() bool {\n\tif v, err := utils.ConvertToBool(self.Value); err == nil {\n\t\treturn v\n\t} else {\n\t\t// use a more relaxed set of values for determining \"true\" because\n\t\t// the user has very explicitly asked us to try\n\t\tswitch strings.ToLower(fmt.Sprintf(\"%v\", self.Value)) {\n\t\tcase `on`, `1`, `yes`, `active`, `online`:\n\t\t\treturn true\n\t\t}\n\n\t\treturn false\n\t}\n}", "title": "" }, { "docid": "a446703dfd1a19620ee41446bc678171", "score": "0.59277284", "text": "func Bool(reply interface{}, err error) (bool, error) {\n if err != nil {\n return false, err\n }\n switch reply := reply.(type) {\n case int64:\n return reply != 0, nil\n case []byte:\n r := string(reply)\n b, err := strconv.ParseBool(r)\n if err != nil {\n return r != \"False\", nil\n }\n return b, err\n case nil:\n return false, redis.ErrNil\n case redis.Error:\n return false, reply\n }\n return false, fmt.Errorf(\"redigo: unexpected type for Bool, got type %T\", reply)\n}", "title": "" }, { "docid": "f42b6aecc7e79fa93e6025da358a73e8", "score": "0.5927485", "text": "func (t String) Bool() (ret bool, ok bool) {\n b, err := strconv.ParseBool(string(t))\n if err == nil { ret = b; ok = true; return }\n\n i, err := strconv.ParseInt(string(t), 0, 0)\n if err == nil { ret = (i != 0); ok = true; return }\n\n f, err := strconv.ParseFloat(string(t), 64)\n if err == nil { ret = (f != 0.0); ok = true; return }\n\n return\n}", "title": "" }, { "docid": "587c1b410f86eb603505837dfde0f970", "score": "0.5912483", "text": "func (as *AdultSelect) BoolX(ctx context.Context) bool {\n\tv, err := as.Bool(ctx)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn v\n}", "title": "" }, { "docid": "bfa32c99b63c8bf82591318053bcfbf0", "score": "0.59062123", "text": "func (v *Value) Bool() (bool, error) {\n\treturn strconv.ParseBool(string(*v))\n}", "title": "" }, { "docid": "27d0ea8bcd8f980a52da0f87981a4138", "score": "0.590241", "text": "func (tpgb *TourProductGroupBy) Bool(ctx context.Context) (_ bool, err error) {\n\tvar v []bool\n\tif v, err = tpgb.Bools(ctx); err != nil {\n\t\treturn\n\t}\n\tswitch len(v) {\n\tcase 1:\n\t\treturn v[0], nil\n\tcase 0:\n\t\terr = &NotFoundError{tourproduct.Label}\n\tdefault:\n\t\terr = fmt.Errorf(\"ent: TourProductGroupBy.Bools returned %d results when one was expected\", len(v))\n\t}\n\treturn\n}", "title": "" }, { "docid": "60e32b3b5347b156a8a44e4516621db4", "score": "0.589535", "text": "func (j *Json) Bool() (bool, error) {\n\tif s, ok := (j.data).(bool); ok {\n\t\treturn s, nil\n\t}\n\treturn false, errors.New(\"type assertion to bool failed\")\n}", "title": "" }, { "docid": "b0717e4978084299287bcd45d5980861", "score": "0.58950174", "text": "func Bool(val string) (bool, error) {\n\treturn strconv.ParseBool(val)\n}", "title": "" }, { "docid": "66b77f6564e2887e765d160d0ee33648", "score": "0.58949405", "text": "func Bool(reply interface{}, err error) (bool, error) {\n\treturn redis.Bool(reply, err)\n}", "title": "" }, { "docid": "889a83c0689dae0169d30931053afb3a", "score": "0.5891492", "text": "func (ps Params) Bool(name string) (bool, error) {\n\treturn strconv.ParseBool(ps.Get(name))\n}", "title": "" }, { "docid": "fc1590b290c9d0f0918512c602228db2", "score": "0.58895385", "text": "func (dts *DrugTypeSelect) BoolX(ctx context.Context) bool {\n\tv, err := dts.Bool(ctx)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn v\n}", "title": "" }, { "docid": "a2af7d6d97e5a201e0d4a56741b75f0f", "score": "0.5886743", "text": "func (*UintOpt) Bool() bool {\n\treturn true\n}", "title": "" }, { "docid": "a0bdd2496731305f2f19d2c2c9c2dfa5", "score": "0.5882938", "text": "func (ps Params) Bool(name string) (bool, error) {\n\treturn strconv.ParseBool(ps.String(name))\n}", "title": "" }, { "docid": "a32b3670237ff6665803fcb9afcd2e0a", "score": "0.5882332", "text": "func (pgb *ParticipationGroupBy) Bool(ctx context.Context) (_ bool, err error) {\n\tvar v []bool\n\tif v, err = pgb.Bools(ctx); err != nil {\n\t\treturn\n\t}\n\tswitch len(v) {\n\tcase 1:\n\t\treturn v[0], nil\n\tcase 0:\n\t\terr = &NotFoundError{participation.Label}\n\tdefault:\n\t\terr = fmt.Errorf(\"ent: ParticipationGroupBy.Bools returned %d results when one was expected\", len(v))\n\t}\n\treturn\n}", "title": "" } ]
24437b3c70af329f4eda4ddb659cb1f9
updateCreateRequest creates the Update request.
[ { "docid": "8824b5c6e001d166627ea083ee6a1e50", "score": "0.6885252", "text": "func (client *ServiceClient) updateCreateRequest(ctx context.Context, resourceGroupName string, communicationServiceName string, options *ServiceClientUpdateOptions) (*policy.Request, error) {\n\turlPath := \"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Communication/communicationServices/{communicationServiceName}\"\n\tif client.subscriptionID == \"\" {\n\t\treturn nil, errors.New(\"parameter client.subscriptionID cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{subscriptionId}\", url.PathEscape(client.subscriptionID))\n\tif resourceGroupName == \"\" {\n\t\treturn nil, errors.New(\"parameter resourceGroupName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{resourceGroupName}\", url.PathEscape(resourceGroupName))\n\tif communicationServiceName == \"\" {\n\t\treturn nil, errors.New(\"parameter communicationServiceName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{communicationServiceName}\", url.PathEscape(communicationServiceName))\n\treq, err := runtime.NewRequest(ctx, http.MethodPatch, runtime.JoinPaths(client.host, urlPath))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treqQP := req.Raw().URL.Query()\n\treqQP.Set(\"api-version\", \"2020-08-20\")\n\treq.Raw().URL.RawQuery = reqQP.Encode()\n\treq.Raw().Header[\"Accept\"] = []string{\"application/json\"}\n\tif options != nil && options.Parameters != nil {\n\t\treturn req, runtime.MarshalAsJSON(req, *options.Parameters)\n\t}\n\treturn req, nil\n}", "title": "" } ]
[ { "docid": "1653bf34680ec18f6fa6f5ed879cfa4d", "score": "0.7146386", "text": "func (client *ResourceGroupsClient) updateCreateRequest(ctx context.Context, resourceGroupName string, parameters ResourceGroupPatchable, options *ResourceGroupsUpdateOptions) (*policy.Request, error) {\n\turlPath := \"/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}\"\n\tif resourceGroupName == \"\" {\n\t\treturn nil, errors.New(\"parameter resourceGroupName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{resourceGroupName}\", url.PathEscape(resourceGroupName))\n\tif client.subscriptionID == \"\" {\n\t\treturn nil, errors.New(\"parameter client.subscriptionID cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{subscriptionId}\", url.PathEscape(client.subscriptionID))\n\treq, err := runtime.NewRequest(ctx, http.MethodPatch, runtime.JoinPaths(client.ep, urlPath))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treqQP := req.Raw().URL.Query()\n\treqQP.Set(\"api-version\", \"2021-04-01\")\n\treq.Raw().URL.RawQuery = reqQP.Encode()\n\treq.Raw().Header.Set(\"Accept\", \"application/json\")\n\treturn req, runtime.MarshalAsJSON(req, parameters)\n}", "title": "" }, { "docid": "c82f76f01f872ac04bcccd15ddf6e1c7", "score": "0.71136177", "text": "func (client *ManagersClient) updateCreateRequest(ctx context.Context, resourceGroupName string, managerName string, parameters ManagerPatch, options *ManagersClientUpdateOptions) (*policy.Request, error) {\n\turlPath := \"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorSimple/managers/{managerName}\"\n\tif client.subscriptionID == \"\" {\n\t\treturn nil, errors.New(\"parameter client.subscriptionID cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{subscriptionId}\", url.PathEscape(client.subscriptionID))\n\tif resourceGroupName == \"\" {\n\t\treturn nil, errors.New(\"parameter resourceGroupName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{resourceGroupName}\", url.PathEscape(resourceGroupName))\n\tif managerName == \"\" {\n\t\treturn nil, errors.New(\"parameter managerName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{managerName}\", url.PathEscape(managerName))\n\treq, err := runtime.NewRequest(ctx, http.MethodPatch, runtime.JoinPaths(client.internal.Endpoint(), urlPath))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treqQP := req.Raw().URL.Query()\n\treqQP.Set(\"api-version\", \"2016-10-01\")\n\treq.Raw().URL.RawQuery = reqQP.Encode()\n\treq.Raw().Header[\"Accept\"] = []string{\"application/json\"}\n\treturn req, runtime.MarshalAsJSON(req, parameters)\n}", "title": "" }, { "docid": "3a591be261ff036699651e5d6ba85e45", "score": "0.7110719", "text": "func (client *DevicesClient) updateCreateRequest(ctx context.Context, deviceName string, resourceGroupName string, managerName string, parameters DevicePatch, options *DevicesClientUpdateOptions) (*policy.Request, error) {\n\turlPath := \"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorSimple/managers/{managerName}/devices/{deviceName}\"\n\turlPath = strings.ReplaceAll(urlPath, \"{deviceName}\", deviceName)\n\turlPath = strings.ReplaceAll(urlPath, \"{subscriptionId}\", client.subscriptionID)\n\turlPath = strings.ReplaceAll(urlPath, \"{resourceGroupName}\", resourceGroupName)\n\turlPath = strings.ReplaceAll(urlPath, \"{managerName}\", managerName)\n\treq, err := runtime.NewRequest(ctx, http.MethodPatch, runtime.JoinPaths(client.internal.Endpoint(), urlPath))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treqQP := req.Raw().URL.Query()\n\treqQP.Set(\"api-version\", \"2017-06-01\")\n\treq.Raw().URL.RawQuery = reqQP.Encode()\n\treq.Raw().Header[\"Accept\"] = []string{\"application/json\"}\n\treturn req, runtime.MarshalAsJSON(req, parameters)\n}", "title": "" }, { "docid": "855b405f7a34a1f490a01187b4e21e15", "score": "0.707937", "text": "func (client *CatalogsClient) updateCreateRequest(ctx context.Context, resourceGroupName string, catalogName string, properties CatalogUpdate, options *CatalogsClientUpdateOptions) (*policy.Request, error) {\n\turlPath := \"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureSphere/catalogs/{catalogName}\"\n\tif client.subscriptionID == \"\" {\n\t\treturn nil, errors.New(\"parameter client.subscriptionID cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{subscriptionId}\", url.PathEscape(client.subscriptionID))\n\tif resourceGroupName == \"\" {\n\t\treturn nil, errors.New(\"parameter resourceGroupName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{resourceGroupName}\", url.PathEscape(resourceGroupName))\n\tif catalogName == \"\" {\n\t\treturn nil, errors.New(\"parameter catalogName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{catalogName}\", url.PathEscape(catalogName))\n\treq, err := runtime.NewRequest(ctx, http.MethodPatch, runtime.JoinPaths(client.internal.Endpoint(), urlPath))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treqQP := req.Raw().URL.Query()\n\treqQP.Set(\"api-version\", \"2022-09-01-preview\")\n\treq.Raw().URL.RawQuery = reqQP.Encode()\n\treq.Raw().Header[\"Accept\"] = []string{\"application/json\"}\n\treturn req, runtime.MarshalAsJSON(req, properties)\n}", "title": "" }, { "docid": "3744458693931b6ac2d137cdb5367ec4", "score": "0.70425797", "text": "func (client *PrivateCloudsClient) updateCreateRequest(ctx context.Context, resourceGroupName string, privateCloudName string, privateCloudUpdate PrivateCloudUpdate, options *PrivateCloudsClientBeginUpdateOptions) (*policy.Request, error) {\n\turlPath := \"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}\"\n\tif client.subscriptionID == \"\" {\n\t\treturn nil, errors.New(\"parameter client.subscriptionID cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{subscriptionId}\", url.PathEscape(client.subscriptionID))\n\tif resourceGroupName == \"\" {\n\t\treturn nil, errors.New(\"parameter resourceGroupName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{resourceGroupName}\", url.PathEscape(resourceGroupName))\n\tif privateCloudName == \"\" {\n\t\treturn nil, errors.New(\"parameter privateCloudName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{privateCloudName}\", url.PathEscape(privateCloudName))\n\treq, err := runtime.NewRequest(ctx, http.MethodPatch, runtime.JoinPaths(client.host, urlPath))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treqQP := req.Raw().URL.Query()\n\treqQP.Set(\"api-version\", \"2021-12-01\")\n\treq.Raw().URL.RawQuery = reqQP.Encode()\n\treq.Raw().Header.Set(\"Accept\", \"application/json\")\n\treturn req, runtime.MarshalAsJSON(req, privateCloudUpdate)\n}", "title": "" }, { "docid": "1258b65da05da73f697d2048f7610850", "score": "0.7030637", "text": "func (client *AppsClient) updateCreateRequest(ctx context.Context, resourceGroupName string, resourceName string, appPatch AppPatch, options *AppsClientBeginUpdateOptions) (*policy.Request, error) {\n\turlPath := \"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.IoTCentral/iotApps/{resourceName}\"\n\tif client.subscriptionID == \"\" {\n\t\treturn nil, errors.New(\"parameter client.subscriptionID cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{subscriptionId}\", url.PathEscape(client.subscriptionID))\n\tif resourceGroupName == \"\" {\n\t\treturn nil, errors.New(\"parameter resourceGroupName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{resourceGroupName}\", url.PathEscape(resourceGroupName))\n\tif resourceName == \"\" {\n\t\treturn nil, errors.New(\"parameter resourceName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{resourceName}\", url.PathEscape(resourceName))\n\treq, err := runtime.NewRequest(ctx, http.MethodPatch, runtime.JoinPaths(client.host, urlPath))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treqQP := req.Raw().URL.Query()\n\treqQP.Set(\"api-version\", \"2021-06-01\")\n\treq.Raw().URL.RawQuery = reqQP.Encode()\n\treq.Raw().Header.Set(\"Accept\", \"application/json\")\n\treturn req, runtime.MarshalAsJSON(req, appPatch)\n}", "title": "" }, { "docid": "aee7ee00bf778a156386dc31ac007b0a", "score": "0.69826984", "text": "func CreateUpdatePackageRequest() (request *UpdatePackageRequest) {\n\trequest = &UpdatePackageRequest{\n\t\tRoaRequest: &requests.RoaRequest{},\n\t}\n\trequest.InitWithApiInfo(\"foas\", \"2018-11-11\", \"UpdatePackage\", \"/api/v2/projects/[projectName]/packages/[packageName]\", \"foas\", \"openAPI\")\n\trequest.Method = requests.PUT\n\treturn\n}", "title": "" }, { "docid": "f3534b0b174d8cfd296ac7361b31f662", "score": "0.6982534", "text": "func (client *ServicesClient) updateCreateRequest(ctx context.Context, resourceGroupName string, communicationServiceName string, parameters ServiceResourceUpdate, options *ServicesClientUpdateOptions) (*policy.Request, error) {\n\turlPath := \"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Communication/communicationServices/{communicationServiceName}\"\n\turlPath = strings.ReplaceAll(urlPath, \"{subscriptionId}\", url.PathEscape(client.subscriptionID))\n\tif resourceGroupName == \"\" {\n\t\treturn nil, errors.New(\"parameter resourceGroupName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{resourceGroupName}\", url.PathEscape(resourceGroupName))\n\tif communicationServiceName == \"\" {\n\t\treturn nil, errors.New(\"parameter communicationServiceName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{communicationServiceName}\", url.PathEscape(communicationServiceName))\n\treq, err := runtime.NewRequest(ctx, http.MethodPatch, runtime.JoinPaths(client.internal.Endpoint(), urlPath))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treqQP := req.Raw().URL.Query()\n\treqQP.Set(\"api-version\", \"2023-03-31\")\n\treq.Raw().URL.RawQuery = reqQP.Encode()\n\treq.Raw().Header[\"Accept\"] = []string{\"application/json\"}\n\treturn req, runtime.MarshalAsJSON(req, parameters)\n}", "title": "" }, { "docid": "474695892a9a9684de804a2b0ce51993", "score": "0.6972467", "text": "func (client *ServicesClient) updateCreateRequest(ctx context.Context, groupName string, serviceName string, parameters Service, options *ServicesClientBeginUpdateOptions) (*policy.Request, error) {\n\turlPath := \"/subscriptions/{subscriptionId}/resourceGroups/{groupName}/providers/Microsoft.DataMigration/services/{serviceName}\"\n\tif client.subscriptionID == \"\" {\n\t\treturn nil, errors.New(\"parameter client.subscriptionID cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{subscriptionId}\", url.PathEscape(client.subscriptionID))\n\tif groupName == \"\" {\n\t\treturn nil, errors.New(\"parameter groupName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{groupName}\", url.PathEscape(groupName))\n\tif serviceName == \"\" {\n\t\treturn nil, errors.New(\"parameter serviceName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{serviceName}\", url.PathEscape(serviceName))\n\treq, err := runtime.NewRequest(ctx, http.MethodPatch, runtime.JoinPaths(client.internal.Endpoint(), urlPath))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treqQP := req.Raw().URL.Query()\n\treqQP.Set(\"api-version\", \"2021-06-30\")\n\treq.Raw().URL.RawQuery = reqQP.Encode()\n\treq.Raw().Header[\"Accept\"] = []string{\"application/json\"}\n\treturn req, runtime.MarshalAsJSON(req, parameters)\n}", "title": "" }, { "docid": "533719fc2dc508b138d4ac3df85ce458", "score": "0.69616026", "text": "func (client *PathClient) updateCreateRequest(ctx context.Context, action PathUpdateAction, mode PathSetAccessControlRecursiveMode, body io.ReadSeekCloser, options *PathClientUpdateOptions, pathHTTPHeaders *PathHTTPHeaders, leaseAccessConditions *LeaseAccessConditions, modifiedAccessConditions *ModifiedAccessConditions) (*policy.Request, error) {\n\treq, err := runtime.NewRequest(ctx, http.MethodPatch, client.endpoint)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treqQP := req.Raw().URL.Query()\n\tif options != nil && options.Timeout != nil {\n\t\treqQP.Set(\"timeout\", strconv.FormatInt(int64(*options.Timeout), 10))\n\t}\n\treqQP.Set(\"action\", string(action))\n\tif options != nil && options.MaxRecords != nil {\n\t\treqQP.Set(\"maxRecords\", strconv.FormatInt(int64(*options.MaxRecords), 10))\n\t}\n\tif options != nil && options.Continuation != nil {\n\t\treqQP.Set(\"continuation\", *options.Continuation)\n\t}\n\treqQP.Set(\"mode\", string(mode))\n\tif options != nil && options.ForceFlag != nil {\n\t\treqQP.Set(\"forceFlag\", strconv.FormatBool(*options.ForceFlag))\n\t}\n\tif options != nil && options.Position != nil {\n\t\treqQP.Set(\"position\", strconv.FormatInt(*options.Position, 10))\n\t}\n\tif options != nil && options.RetainUncommittedData != nil {\n\t\treqQP.Set(\"retainUncommittedData\", strconv.FormatBool(*options.RetainUncommittedData))\n\t}\n\tif options != nil && options.Close != nil {\n\t\treqQP.Set(\"close\", strconv.FormatBool(*options.Close))\n\t}\n\treq.Raw().URL.RawQuery = reqQP.Encode()\n\tif options != nil && options.RequestID != nil {\n\t\treq.Raw().Header[\"x-ms-client-request-id\"] = []string{*options.RequestID}\n\t}\n\treq.Raw().Header[\"x-ms-version\"] = []string{\"2020-10-02\"}\n\tif options != nil && options.ContentLength != nil {\n\t\treq.Raw().Header[\"Content-Length\"] = []string{strconv.FormatInt(*options.ContentLength, 10)}\n\t}\n\tif pathHTTPHeaders != nil && pathHTTPHeaders.ContentMD5 != nil {\n\t\treq.Raw().Header[\"x-ms-content-md5\"] = []string{base64.StdEncoding.EncodeToString(pathHTTPHeaders.ContentMD5)}\n\t}\n\tif leaseAccessConditions != nil && leaseAccessConditions.LeaseID != nil {\n\t\treq.Raw().Header[\"x-ms-lease-id\"] = []string{*leaseAccessConditions.LeaseID}\n\t}\n\tif pathHTTPHeaders != nil && pathHTTPHeaders.CacheControl != nil {\n\t\treq.Raw().Header[\"x-ms-cache-control\"] = []string{*pathHTTPHeaders.CacheControl}\n\t}\n\tif pathHTTPHeaders != nil && pathHTTPHeaders.ContentType != nil {\n\t\treq.Raw().Header[\"x-ms-content-type\"] = []string{*pathHTTPHeaders.ContentType}\n\t}\n\tif pathHTTPHeaders != nil && pathHTTPHeaders.ContentDisposition != nil {\n\t\treq.Raw().Header[\"x-ms-content-disposition\"] = []string{*pathHTTPHeaders.ContentDisposition}\n\t}\n\tif pathHTTPHeaders != nil && pathHTTPHeaders.ContentEncoding != nil {\n\t\treq.Raw().Header[\"x-ms-content-encoding\"] = []string{*pathHTTPHeaders.ContentEncoding}\n\t}\n\tif pathHTTPHeaders != nil && pathHTTPHeaders.ContentLanguage != nil {\n\t\treq.Raw().Header[\"x-ms-content-language\"] = []string{*pathHTTPHeaders.ContentLanguage}\n\t}\n\tif options != nil && options.Properties != nil {\n\t\treq.Raw().Header[\"x-ms-properties\"] = []string{*options.Properties}\n\t}\n\tif options != nil && options.Owner != nil {\n\t\treq.Raw().Header[\"x-ms-owner\"] = []string{*options.Owner}\n\t}\n\tif options != nil && options.Group != nil {\n\t\treq.Raw().Header[\"x-ms-group\"] = []string{*options.Group}\n\t}\n\tif options != nil && options.Permissions != nil {\n\t\treq.Raw().Header[\"x-ms-permissions\"] = []string{*options.Permissions}\n\t}\n\tif options != nil && options.ACL != nil {\n\t\treq.Raw().Header[\"x-ms-acl\"] = []string{*options.ACL}\n\t}\n\tif modifiedAccessConditions != nil && modifiedAccessConditions.IfMatch != nil {\n\t\treq.Raw().Header[\"If-Match\"] = []string{string(*modifiedAccessConditions.IfMatch)}\n\t}\n\tif modifiedAccessConditions != nil && modifiedAccessConditions.IfNoneMatch != nil {\n\t\treq.Raw().Header[\"If-None-Match\"] = []string{string(*modifiedAccessConditions.IfNoneMatch)}\n\t}\n\tif modifiedAccessConditions != nil && modifiedAccessConditions.IfModifiedSince != nil {\n\t\treq.Raw().Header[\"If-Modified-Since\"] = []string{modifiedAccessConditions.IfModifiedSince.Format(time.RFC1123)}\n\t}\n\tif modifiedAccessConditions != nil && modifiedAccessConditions.IfUnmodifiedSince != nil {\n\t\treq.Raw().Header[\"If-Unmodified-Since\"] = []string{modifiedAccessConditions.IfUnmodifiedSince.Format(time.RFC1123)}\n\t}\n\treq.Raw().Header[\"Accept\"] = []string{\"application/json\"}\n\tif err := req.SetBody(body, \"application/octet-stream\"); err != nil {\n\t\treturn nil, err\n\t}\n\treturn req, nil\n}", "title": "" }, { "docid": "2c946a42ef5a0b25f4316de6d35a4741", "score": "0.69068", "text": "func (client *PlansClient) updateCreateRequest(ctx context.Context, resourceGroupName string, name string, appServicePlan PlanPatchResource, options *PlansClientUpdateOptions) (*policy.Request, error) {\n\turlPath := \"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/serverfarms/{name}\"\n\tif resourceGroupName == \"\" {\n\t\treturn nil, errors.New(\"parameter resourceGroupName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{resourceGroupName}\", url.PathEscape(resourceGroupName))\n\tif name == \"\" {\n\t\treturn nil, errors.New(\"parameter name cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{name}\", url.PathEscape(name))\n\tif client.subscriptionID == \"\" {\n\t\treturn nil, errors.New(\"parameter client.subscriptionID cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{subscriptionId}\", url.PathEscape(client.subscriptionID))\n\treq, err := runtime.NewRequest(ctx, http.MethodPatch, runtime.JoinPaths(client.internal.Endpoint(), urlPath))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treqQP := req.Raw().URL.Query()\n\treqQP.Set(\"api-version\", \"2018-02-01\")\n\treq.Raw().URL.RawQuery = reqQP.Encode()\n\treq.Raw().Header[\"Accept\"] = []string{\"application/json\"}\n\treturn req, runtime.MarshalAsJSON(req, appServicePlan)\n}", "title": "" }, { "docid": "09539cc4b624dacc759594f12c341450", "score": "0.69011456", "text": "func (client *AlertsSuppressionRulesClient) updateCreateRequest(ctx context.Context, alertsSuppressionRuleName string, alertsSuppressionRule AlertsSuppressionRule, options *AlertsSuppressionRulesUpdateOptions) (*policy.Request, error) {\n\turlPath := \"/subscriptions/{subscriptionId}/providers/Microsoft.Security/alertsSuppressionRules/{alertsSuppressionRuleName}\"\n\tif client.subscriptionID == \"\" {\n\t\treturn nil, errors.New(\"parameter client.subscriptionID cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{subscriptionId}\", url.PathEscape(client.subscriptionID))\n\tif alertsSuppressionRuleName == \"\" {\n\t\treturn nil, errors.New(\"parameter alertsSuppressionRuleName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{alertsSuppressionRuleName}\", url.PathEscape(alertsSuppressionRuleName))\n\treq, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.ep, urlPath))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treqQP := req.Raw().URL.Query()\n\treqQP.Set(\"api-version\", \"2019-01-01-preview\")\n\treq.Raw().URL.RawQuery = reqQP.Encode()\n\treq.Raw().Header.Set(\"Accept\", \"application/json\")\n\treturn req, runtime.MarshalAsJSON(req, alertsSuppressionRule)\n}", "title": "" }, { "docid": "b7b95fd553276c6dc2f6f2f644028d75", "score": "0.6894629", "text": "func (client *PartnerNamespacesClient) updateCreateRequest(ctx context.Context, resourceGroupName string, partnerNamespaceName string, partnerNamespaceUpdateParameters PartnerNamespaceUpdateParameters, options *PartnerNamespacesClientBeginUpdateOptions) (*policy.Request, error) {\n\turlPath := \"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/partnerNamespaces/{partnerNamespaceName}\"\n\tif client.subscriptionID == \"\" {\n\t\treturn nil, errors.New(\"parameter client.subscriptionID cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{subscriptionId}\", url.PathEscape(client.subscriptionID))\n\tif resourceGroupName == \"\" {\n\t\treturn nil, errors.New(\"parameter resourceGroupName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{resourceGroupName}\", url.PathEscape(resourceGroupName))\n\tif partnerNamespaceName == \"\" {\n\t\treturn nil, errors.New(\"parameter partnerNamespaceName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{partnerNamespaceName}\", url.PathEscape(partnerNamespaceName))\n\treq, err := runtime.NewRequest(ctx, http.MethodPatch, runtime.JoinPaths(client.internal.Endpoint(), urlPath))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treqQP := req.Raw().URL.Query()\n\treqQP.Set(\"api-version\", \"2023-06-01-preview\")\n\treq.Raw().URL.RawQuery = reqQP.Encode()\n\treq.Raw().Header[\"Accept\"] = []string{\"application/json\"}\n\treturn req, runtime.MarshalAsJSON(req, partnerNamespaceUpdateParameters)\n}", "title": "" }, { "docid": "c3c1f6115c21cd7069b7bd18373ec898", "score": "0.68561035", "text": "func (client *MembersClient) updateCreateRequest(ctx context.Context, blockchainMemberName string, resourceGroupName string, options *MembersClientUpdateOptions) (*policy.Request, error) {\n\turlPath := \"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Blockchain/blockchainMembers/{blockchainMemberName}\"\n\tif blockchainMemberName == \"\" {\n\t\treturn nil, errors.New(\"parameter blockchainMemberName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{blockchainMemberName}\", url.PathEscape(blockchainMemberName))\n\tif client.subscriptionID == \"\" {\n\t\treturn nil, errors.New(\"parameter client.subscriptionID cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{subscriptionId}\", url.PathEscape(client.subscriptionID))\n\tif resourceGroupName == \"\" {\n\t\treturn nil, errors.New(\"parameter resourceGroupName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{resourceGroupName}\", url.PathEscape(resourceGroupName))\n\treq, err := runtime.NewRequest(ctx, http.MethodPatch, runtime.JoinPaths(client.internal.Endpoint(), urlPath))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treqQP := req.Raw().URL.Query()\n\treqQP.Set(\"api-version\", \"2018-06-01-preview\")\n\treq.Raw().URL.RawQuery = reqQP.Encode()\n\treq.Raw().Header[\"Accept\"] = []string{\"application/json\"}\n\tif options != nil && options.BlockchainMember != nil {\n\t\treturn req, runtime.MarshalAsJSON(req, *options.BlockchainMember)\n\t}\n\treturn req, nil\n}", "title": "" }, { "docid": "ffbe00b2f8821b11fd23cfc2b9fb66b0", "score": "0.68530166", "text": "func (client *SnapshotsClient) updateCreateRequest(ctx context.Context, resourceGroupName string, snapshotName string, snapshot SnapshotUpdate, options *SnapshotsBeginUpdateOptions) (*policy.Request, error) {\n\turlPath := \"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}\"\n\tif client.subscriptionID == \"\" {\n\t\treturn nil, errors.New(\"parameter client.subscriptionID cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{subscriptionId}\", url.PathEscape(client.subscriptionID))\n\tif resourceGroupName == \"\" {\n\t\treturn nil, errors.New(\"parameter resourceGroupName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{resourceGroupName}\", url.PathEscape(resourceGroupName))\n\tif snapshotName == \"\" {\n\t\treturn nil, errors.New(\"parameter snapshotName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{snapshotName}\", url.PathEscape(snapshotName))\n\treq, err := runtime.NewRequest(ctx, http.MethodPatch, runtime.JoinPaths(client.ep, urlPath))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treqQP := req.Raw().URL.Query()\n\treqQP.Set(\"api-version\", \"2021-04-01\")\n\treq.Raw().URL.RawQuery = reqQP.Encode()\n\treq.Raw().Header.Set(\"Accept\", \"application/json\")\n\treturn req, runtime.MarshalAsJSON(req, snapshot)\n}", "title": "" }, { "docid": "37f400366f0970d32a99c8a355537f55", "score": "0.68480426", "text": "func (client *NetworkFabricsClient) updateCreateRequest(ctx context.Context, resourceGroupName string, networkFabricName string, body NetworkFabricPatch, options *NetworkFabricsClientBeginUpdateOptions) (*policy.Request, error) {\n\turlPath := \"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedNetworkFabric/networkFabrics/{networkFabricName}\"\n\turlPath = strings.ReplaceAll(urlPath, \"{subscriptionId}\", url.PathEscape(client.subscriptionID))\n\tif resourceGroupName == \"\" {\n\t\treturn nil, errors.New(\"parameter resourceGroupName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{resourceGroupName}\", url.PathEscape(resourceGroupName))\n\tif networkFabricName == \"\" {\n\t\treturn nil, errors.New(\"parameter networkFabricName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{networkFabricName}\", url.PathEscape(networkFabricName))\n\treq, err := runtime.NewRequest(ctx, http.MethodPatch, runtime.JoinPaths(client.internal.Endpoint(), urlPath))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treqQP := req.Raw().URL.Query()\n\treqQP.Set(\"api-version\", \"2023-06-15\")\n\treq.Raw().URL.RawQuery = reqQP.Encode()\n\treq.Raw().Header[\"Accept\"] = []string{\"application/json\"}\n\treturn req, runtime.MarshalAsJSON(req, body)\n}", "title": "" }, { "docid": "120caeb0ac55d026b363d8035c7bc98e", "score": "0.68264717", "text": "func (client *JitRequestsClient) updateCreateRequest(ctx context.Context, resourceGroupName string, jitRequestName string, parameters JitRequestPatchable, options *JitRequestsClientUpdateOptions) (*policy.Request, error) {\n\turlPath := \"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Solutions/jitRequests/{jitRequestName}\"\n\tif client.subscriptionID == \"\" {\n\t\treturn nil, errors.New(\"parameter client.subscriptionID cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{subscriptionId}\", url.PathEscape(client.subscriptionID))\n\tif resourceGroupName == \"\" {\n\t\treturn nil, errors.New(\"parameter resourceGroupName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{resourceGroupName}\", url.PathEscape(resourceGroupName))\n\tif jitRequestName == \"\" {\n\t\treturn nil, errors.New(\"parameter jitRequestName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{jitRequestName}\", url.PathEscape(jitRequestName))\n\treq, err := runtime.NewRequest(ctx, http.MethodPatch, runtime.JoinPaths(client.internal.Endpoint(), urlPath))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treqQP := req.Raw().URL.Query()\n\treqQP.Set(\"api-version\", \"2021-07-01\")\n\treq.Raw().URL.RawQuery = reqQP.Encode()\n\treq.Raw().Header[\"Accept\"] = []string{\"application/json\"}\n\treturn req, runtime.MarshalAsJSON(req, parameters)\n}", "title": "" }, { "docid": "025dcfa2ffe473eb7b0b3bb8dd863296", "score": "0.6825965", "text": "func (client *MonitorsClient) updateCreateRequest(ctx context.Context, resourceGroupName string, monitorName string, resource MonitorResourceUpdate, options *MonitorsClientUpdateOptions) (*policy.Request, error) {\n\turlPath := \"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Dynatrace.Observability/monitors/{monitorName}\"\n\tif client.subscriptionID == \"\" {\n\t\treturn nil, errors.New(\"parameter client.subscriptionID cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{subscriptionId}\", url.PathEscape(client.subscriptionID))\n\tif resourceGroupName == \"\" {\n\t\treturn nil, errors.New(\"parameter resourceGroupName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{resourceGroupName}\", url.PathEscape(resourceGroupName))\n\tif monitorName == \"\" {\n\t\treturn nil, errors.New(\"parameter monitorName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{monitorName}\", url.PathEscape(monitorName))\n\treq, err := runtime.NewRequest(ctx, http.MethodPatch, runtime.JoinPaths(client.host, urlPath))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treqQP := req.Raw().URL.Query()\n\treqQP.Set(\"api-version\", \"2021-09-01-preview\")\n\treq.Raw().URL.RawQuery = reqQP.Encode()\n\treq.Raw().Header[\"Accept\"] = []string{\"application/json\"}\n\treturn req, runtime.MarshalAsJSON(req, resource)\n}", "title": "" }, { "docid": "2c4b6da130456f51aa04a1478976c6e9", "score": "0.68089736", "text": "func (client *WorkbooksClient) updateCreateRequest(ctx context.Context, resourceGroupName string, resourceName string, workbookProperties Workbook, options *WorkbooksClientUpdateOptions) (*policy.Request, error) {\n\turlPath := \"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.insights/workbooks/{resourceName}\"\n\tif client.subscriptionID == \"\" {\n\t\treturn nil, errors.New(\"parameter client.subscriptionID cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{subscriptionId}\", url.PathEscape(client.subscriptionID))\n\tif resourceGroupName == \"\" {\n\t\treturn nil, errors.New(\"parameter resourceGroupName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{resourceGroupName}\", url.PathEscape(resourceGroupName))\n\tif resourceName == \"\" {\n\t\treturn nil, errors.New(\"parameter resourceName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{resourceName}\", url.PathEscape(resourceName))\n\treq, err := runtime.NewRequest(ctx, http.MethodPatch, runtime.JoinPaths(client.internal.Endpoint(), urlPath))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treqQP := req.Raw().URL.Query()\n\treqQP.Set(\"api-version\", \"2015-05-01\")\n\treq.Raw().URL.RawQuery = reqQP.Encode()\n\treq.Raw().Header[\"Accept\"] = []string{\"application/json\"}\n\treturn req, runtime.MarshalAsJSON(req, workbookProperties)\n}", "title": "" }, { "docid": "436476c0001bb2b2f46d9bc5902ead35", "score": "0.6807941", "text": "func (client *Client) updateCreateRequest(ctx context.Context, groupID string, patchGroupRequest PatchManagementGroupRequest, options *ClientUpdateOptions) (*policy.Request, error) {\n\turlPath := \"/providers/Microsoft.Management/managementGroups/{groupId}\"\n\tif groupID == \"\" {\n\t\treturn nil, errors.New(\"parameter groupID cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{groupId}\", url.PathEscape(groupID))\n\treq, err := runtime.NewRequest(ctx, http.MethodPatch, runtime.JoinPaths(client.internal.Endpoint(), urlPath))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treqQP := req.Raw().URL.Query()\n\treqQP.Set(\"api-version\", \"2021-04-01\")\n\treq.Raw().URL.RawQuery = reqQP.Encode()\n\tif options != nil && options.CacheControl != nil {\n\t\treq.Raw().Header[\"Cache-Control\"] = []string{*options.CacheControl}\n\t}\n\treq.Raw().Header[\"Accept\"] = []string{\"application/json\"}\n\treturn req, runtime.MarshalAsJSON(req, patchGroupRequest)\n}", "title": "" }, { "docid": "528e25241e9c776316bd15075b6c8bf9", "score": "0.6795292", "text": "func (client *ProjectsClient) updateCreateRequest(ctx context.Context, resourceGroupName string, storageMoverName string, projectName string, project ProjectUpdateParameters, options *ProjectsClientUpdateOptions) (*policy.Request, error) {\n\turlPath := \"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageMover/storageMovers/{storageMoverName}/projects/{projectName}\"\n\tif client.subscriptionID == \"\" {\n\t\treturn nil, errors.New(\"parameter client.subscriptionID cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{subscriptionId}\", url.PathEscape(client.subscriptionID))\n\tif resourceGroupName == \"\" {\n\t\treturn nil, errors.New(\"parameter resourceGroupName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{resourceGroupName}\", url.PathEscape(resourceGroupName))\n\tif storageMoverName == \"\" {\n\t\treturn nil, errors.New(\"parameter storageMoverName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{storageMoverName}\", url.PathEscape(storageMoverName))\n\tif projectName == \"\" {\n\t\treturn nil, errors.New(\"parameter projectName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{projectName}\", url.PathEscape(projectName))\n\treq, err := runtime.NewRequest(ctx, http.MethodPatch, runtime.JoinPaths(client.internal.Endpoint(), urlPath))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treqQP := req.Raw().URL.Query()\n\treqQP.Set(\"api-version\", \"2023-07-01-preview\")\n\treq.Raw().URL.RawQuery = reqQP.Encode()\n\treq.Raw().Header[\"Accept\"] = []string{\"application/json\"}\n\treturn req, runtime.MarshalAsJSON(req, project)\n}", "title": "" }, { "docid": "aca7c67d302f97cf66378fbbb825590d", "score": "0.67841375", "text": "func (client *InternetGatewaysClient) updateCreateRequest(ctx context.Context, resourceGroupName string, internetGatewayName string, body InternetGatewayPatch, options *InternetGatewaysClientBeginUpdateOptions) (*policy.Request, error) {\n\turlPath := \"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedNetworkFabric/internetGateways/{internetGatewayName}\"\n\turlPath = strings.ReplaceAll(urlPath, \"{subscriptionId}\", url.PathEscape(client.subscriptionID))\n\tif resourceGroupName == \"\" {\n\t\treturn nil, errors.New(\"parameter resourceGroupName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{resourceGroupName}\", url.PathEscape(resourceGroupName))\n\tif internetGatewayName == \"\" {\n\t\treturn nil, errors.New(\"parameter internetGatewayName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{internetGatewayName}\", url.PathEscape(internetGatewayName))\n\treq, err := runtime.NewRequest(ctx, http.MethodPatch, runtime.JoinPaths(client.internal.Endpoint(), urlPath))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treqQP := req.Raw().URL.Query()\n\treqQP.Set(\"api-version\", \"2023-06-15\")\n\treq.Raw().URL.RawQuery = reqQP.Encode()\n\treq.Raw().Header[\"Accept\"] = []string{\"application/json\"}\n\treturn req, runtime.MarshalAsJSON(req, body)\n}", "title": "" }, { "docid": "f2d4289f94e34b8f06b70acebfc7ea71", "score": "0.67646474", "text": "func (client *VirtualMachinesClient) updateCreateRequest(ctx context.Context, resourceGroupName string, virtualMachineName string, body VirtualMachineUpdate, options *VirtualMachinesClientBeginUpdateOptions) (*policy.Request, error) {\n\turlPath := \"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ScVmm/virtualMachines/{virtualMachineName}\"\n\tif resourceGroupName == \"\" {\n\t\treturn nil, errors.New(\"parameter resourceGroupName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{resourceGroupName}\", url.PathEscape(resourceGroupName))\n\tif client.subscriptionID == \"\" {\n\t\treturn nil, errors.New(\"parameter client.subscriptionID cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{subscriptionId}\", url.PathEscape(client.subscriptionID))\n\tif virtualMachineName == \"\" {\n\t\treturn nil, errors.New(\"parameter virtualMachineName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{virtualMachineName}\", url.PathEscape(virtualMachineName))\n\treq, err := runtime.NewRequest(ctx, http.MethodPatch, runtime.JoinPaths(client.internal.Endpoint(), urlPath))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treqQP := req.Raw().URL.Query()\n\treqQP.Set(\"api-version\", \"2020-06-05-preview\")\n\treq.Raw().URL.RawQuery = reqQP.Encode()\n\treq.Raw().Header[\"Accept\"] = []string{\"application/json\"}\n\treturn req, runtime.MarshalAsJSON(req, body)\n}", "title": "" }, { "docid": "3869ab0d7c3b6cddb50b57ad3a6074be", "score": "0.676227", "text": "func (client *AzureMonitorWorkspacesClient) updateCreateRequest(ctx context.Context, resourceGroupName string, azureMonitorWorkspaceName string, options *AzureMonitorWorkspacesClientUpdateOptions) (*policy.Request, error) {\n\turlPath := \"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Monitor/accounts/{azureMonitorWorkspaceName}\"\n\tif client.subscriptionID == \"\" {\n\t\treturn nil, errors.New(\"parameter client.subscriptionID cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{subscriptionId}\", url.PathEscape(client.subscriptionID))\n\tif resourceGroupName == \"\" {\n\t\treturn nil, errors.New(\"parameter resourceGroupName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{resourceGroupName}\", url.PathEscape(resourceGroupName))\n\tif azureMonitorWorkspaceName == \"\" {\n\t\treturn nil, errors.New(\"parameter azureMonitorWorkspaceName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{azureMonitorWorkspaceName}\", url.PathEscape(azureMonitorWorkspaceName))\n\treq, err := runtime.NewRequest(ctx, http.MethodPatch, runtime.JoinPaths(client.internal.Endpoint(), urlPath))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treqQP := req.Raw().URL.Query()\n\treqQP.Set(\"api-version\", \"2021-06-03-preview\")\n\treq.Raw().URL.RawQuery = reqQP.Encode()\n\treq.Raw().Header[\"Accept\"] = []string{\"application/json\"}\n\tif options != nil && options.AzureMonitorWorkspaceProperties != nil {\n\t\tif err := runtime.MarshalAsJSON(req, *options.AzureMonitorWorkspaceProperties); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn req, nil\n\t}\n\treturn req, nil\n}", "title": "" }, { "docid": "1321b30e433bf11db9aa2996802c4035", "score": "0.6748952", "text": "func (client *SignInSettingsClient) updateCreateRequest(ctx context.Context, resourceGroupName string, serviceName string, ifMatch string, parameters PortalSigninSettings, options *SignInSettingsUpdateOptions) (*policy.Request, error) {\n\turlPath := \"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/portalsettings/signin\"\n\tif resourceGroupName == \"\" {\n\t\treturn nil, errors.New(\"parameter resourceGroupName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{resourceGroupName}\", url.PathEscape(resourceGroupName))\n\tif serviceName == \"\" {\n\t\treturn nil, errors.New(\"parameter serviceName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{serviceName}\", url.PathEscape(serviceName))\n\tif client.subscriptionID == \"\" {\n\t\treturn nil, errors.New(\"parameter client.subscriptionID cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{subscriptionId}\", url.PathEscape(client.subscriptionID))\n\treq, err := runtime.NewRequest(ctx, http.MethodPatch, runtime.JoinPaths(client.ep, urlPath))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treqQP := req.Raw().URL.Query()\n\treqQP.Set(\"api-version\", \"2021-08-01\")\n\treq.Raw().URL.RawQuery = reqQP.Encode()\n\treq.Raw().Header.Set(\"If-Match\", ifMatch)\n\treq.Raw().Header.Set(\"Accept\", \"application/json\")\n\treturn req, runtime.MarshalAsJSON(req, parameters)\n}", "title": "" }, { "docid": "f64d856063753727620854cddf37ff67", "score": "0.67439604", "text": "func (client *ConfigurationStoresClient) updateCreateRequest(ctx context.Context, resourceGroupName string, configStoreName string, configStoreUpdateParameters ConfigurationStoreUpdateParameters, options *ConfigurationStoresClientBeginUpdateOptions) (*policy.Request, error) {\n\turlPath := \"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppConfiguration/configurationStores/{configStoreName}\"\n\tif client.subscriptionID == \"\" {\n\t\treturn nil, errors.New(\"parameter client.subscriptionID cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{subscriptionId}\", url.PathEscape(client.subscriptionID))\n\tif resourceGroupName == \"\" {\n\t\treturn nil, errors.New(\"parameter resourceGroupName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{resourceGroupName}\", url.PathEscape(resourceGroupName))\n\tif configStoreName == \"\" {\n\t\treturn nil, errors.New(\"parameter configStoreName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{configStoreName}\", url.PathEscape(configStoreName))\n\treq, err := runtime.NewRequest(ctx, http.MethodPatch, runtime.JoinPaths(client.internal.Endpoint(), urlPath))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treqQP := req.Raw().URL.Query()\n\treqQP.Set(\"api-version\", \"2023-03-01\")\n\treq.Raw().URL.RawQuery = reqQP.Encode()\n\treq.Raw().Header[\"Accept\"] = []string{\"application/json\"}\n\treturn req, runtime.MarshalAsJSON(req, configStoreUpdateParameters)\n}", "title": "" }, { "docid": "c69125806446a7b7e50ae25375d3316c", "score": "0.67278606", "text": "func (client *LoadTestsClient) updateCreateRequest(ctx context.Context, resourceGroupName string, loadTestName string, loadTestResourcePatchRequestBody LoadTestResourcePatchRequestBody, options *LoadTestsClientBeginUpdateOptions) (*policy.Request, error) {\n\turlPath := \"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.LoadTestService/loadTests/{loadTestName}\"\n\tif client.subscriptionID == \"\" {\n\t\treturn nil, errors.New(\"parameter client.subscriptionID cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{subscriptionId}\", url.PathEscape(client.subscriptionID))\n\tif resourceGroupName == \"\" {\n\t\treturn nil, errors.New(\"parameter resourceGroupName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{resourceGroupName}\", url.PathEscape(resourceGroupName))\n\tif loadTestName == \"\" {\n\t\treturn nil, errors.New(\"parameter loadTestName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{loadTestName}\", url.PathEscape(loadTestName))\n\treq, err := runtime.NewRequest(ctx, http.MethodPatch, runtime.JoinPaths(client.internal.Endpoint(), urlPath))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treqQP := req.Raw().URL.Query()\n\treqQP.Set(\"api-version\", \"2022-12-01\")\n\treq.Raw().URL.RawQuery = reqQP.Encode()\n\treq.Raw().Header[\"Accept\"] = []string{\"application/json\"}\n\treturn req, runtime.MarshalAsJSON(req, loadTestResourcePatchRequestBody)\n}", "title": "" }, { "docid": "0a11b8cdb6555719536bee29183c64a4", "score": "0.67259955", "text": "func (client *TicketsClient) updateCreateRequest(ctx context.Context, supportTicketName string, updateSupportTicket UpdateSupportTicket, options *TicketsClientUpdateOptions) (*policy.Request, error) {\n\turlPath := \"/subscriptions/{subscriptionId}/providers/Microsoft.Support/supportTickets/{supportTicketName}\"\n\tif supportTicketName == \"\" {\n\t\treturn nil, errors.New(\"parameter supportTicketName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{supportTicketName}\", url.PathEscape(supportTicketName))\n\tif client.subscriptionID == \"\" {\n\t\treturn nil, errors.New(\"parameter client.subscriptionID cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{subscriptionId}\", url.PathEscape(client.subscriptionID))\n\treq, err := runtime.NewRequest(ctx, http.MethodPatch, runtime.JoinPaths(client.internal.Endpoint(), urlPath))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treqQP := req.Raw().URL.Query()\n\treqQP.Set(\"api-version\", \"2020-04-01\")\n\treq.Raw().URL.RawQuery = reqQP.Encode()\n\treq.Raw().Header[\"Accept\"] = []string{\"application/json\"}\n\treturn req, runtime.MarshalAsJSON(req, updateSupportTicket)\n}", "title": "" }, { "docid": "f5fa46632037e90844f789db94eb67dc", "score": "0.67256474", "text": "func (client *ManagedInstancesClient) updateCreateRequest(ctx context.Context, resourceGroupName string, managedInstanceName string, parameters ManagedInstanceUpdate, options *ManagedInstancesBeginUpdateOptions) (*policy.Request, error) {\n\turlPath := \"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}\"\n\tif resourceGroupName == \"\" {\n\t\treturn nil, errors.New(\"parameter resourceGroupName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{resourceGroupName}\", url.PathEscape(resourceGroupName))\n\tif managedInstanceName == \"\" {\n\t\treturn nil, errors.New(\"parameter managedInstanceName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{managedInstanceName}\", url.PathEscape(managedInstanceName))\n\tif client.subscriptionID == \"\" {\n\t\treturn nil, errors.New(\"parameter client.subscriptionID cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{subscriptionId}\", url.PathEscape(client.subscriptionID))\n\treq, err := runtime.NewRequest(ctx, http.MethodPatch, runtime.JoinPaths(client.ep, urlPath))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treqQP := req.Raw().URL.Query()\n\treqQP.Set(\"api-version\", \"2020-11-01-preview\")\n\treq.Raw().URL.RawQuery = reqQP.Encode()\n\treq.Raw().Header.Set(\"Accept\", \"application/json\")\n\treturn req, runtime.MarshalAsJSON(req, parameters)\n}", "title": "" }, { "docid": "1ef13074bcde5d8fd5d1be59e5ba34a8", "score": "0.671905", "text": "func (client *MetricsConfigurationsClient) updateCreateRequest(ctx context.Context, resourceGroupName string, clusterName string, metricsConfigurationName string, metricsConfigurationUpdateParameters ClusterMetricsConfigurationPatchParameters, options *MetricsConfigurationsClientBeginUpdateOptions) (*policy.Request, error) {\n\turlPath := \"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetworkCloud/clusters/{clusterName}/metricsConfigurations/{metricsConfigurationName}\"\n\turlPath = strings.ReplaceAll(urlPath, \"{subscriptionId}\", url.PathEscape(client.subscriptionID))\n\tif resourceGroupName == \"\" {\n\t\treturn nil, errors.New(\"parameter resourceGroupName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{resourceGroupName}\", url.PathEscape(resourceGroupName))\n\tif clusterName == \"\" {\n\t\treturn nil, errors.New(\"parameter clusterName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{clusterName}\", url.PathEscape(clusterName))\n\tif metricsConfigurationName == \"\" {\n\t\treturn nil, errors.New(\"parameter metricsConfigurationName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{metricsConfigurationName}\", url.PathEscape(metricsConfigurationName))\n\treq, err := runtime.NewRequest(ctx, http.MethodPatch, runtime.JoinPaths(client.internal.Endpoint(), urlPath))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treqQP := req.Raw().URL.Query()\n\treqQP.Set(\"api-version\", \"2023-07-01\")\n\treq.Raw().URL.RawQuery = reqQP.Encode()\n\treq.Raw().Header[\"Accept\"] = []string{\"application/json\"}\n\tif err := runtime.MarshalAsJSON(req, metricsConfigurationUpdateParameters); err != nil {\n\t\treturn nil, err\n\t}\n\treturn req, nil\n}", "title": "" }, { "docid": "c8ad770b6e7c37afdd4a33a78095fd52", "score": "0.6681945", "text": "func (client *SSHPublicKeysClient) updateCreateRequest(ctx context.Context, resourceGroupName string, sshPublicKeyName string, parameters SSHPublicKeyUpdateResource, options *SSHPublicKeysUpdateOptions) (*azcore.Request, error) {\n\turlPath := \"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/sshPublicKeys/{sshPublicKeyName}\"\n\turlPath = strings.ReplaceAll(urlPath, \"{resourceGroupName}\", url.PathEscape(resourceGroupName))\n\turlPath = strings.ReplaceAll(urlPath, \"{sshPublicKeyName}\", url.PathEscape(sshPublicKeyName))\n\turlPath = strings.ReplaceAll(urlPath, \"{subscriptionId}\", url.PathEscape(client.subscriptionID))\n\treq, err := azcore.NewRequest(ctx, http.MethodPatch, azcore.JoinPaths(client.con.Endpoint(), urlPath))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treq.Telemetry(telemetryInfo)\n\tquery := req.URL.Query()\n\tquery.Set(\"api-version\", \"2020-06-01\")\n\treq.URL.RawQuery = query.Encode()\n\treq.Header.Set(\"Accept\", \"application/json\")\n\treturn req, req.MarshalAsJSON(parameters)\n}", "title": "" }, { "docid": "6088cb9b78889041b27068f80a596bb2", "score": "0.66759604", "text": "func (client *StorageAccountsClient) updateCreateRequest(ctx context.Context, resourceGroupName string, accountName string, parameters StorageAccountUpdateParameters, options *StorageAccountsUpdateOptions) (*azcore.Request, error) {\n\turlPath := \"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}\"\n\turlPath = strings.ReplaceAll(urlPath, \"{resourceGroupName}\", url.PathEscape(resourceGroupName))\n\turlPath = strings.ReplaceAll(urlPath, \"{accountName}\", url.PathEscape(accountName))\n\turlPath = strings.ReplaceAll(urlPath, \"{subscriptionId}\", url.PathEscape(client.subscriptionID))\n\treq, err := azcore.NewRequest(ctx, http.MethodPatch, azcore.JoinPaths(client.con.Endpoint(), urlPath))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treq.Telemetry(telemetryInfo)\n\tquery := req.URL.Query()\n\tquery.Set(\"api-version\", \"2019-06-01\")\n\treq.URL.RawQuery = query.Encode()\n\treq.Header.Set(\"Accept\", \"application/json\")\n\treturn req, req.MarshalAsJSON(parameters)\n}", "title": "" }, { "docid": "e3aadadb1f78bdda4773adbbe4be6b2f", "score": "0.6659814", "text": "func (client *DiskEncryptionSetsClient) updateCreateRequest(ctx context.Context, resourceGroupName string, diskEncryptionSetName string, diskEncryptionSet DiskEncryptionSetUpdate, options *DiskEncryptionSetsBeginUpdateOptions) (*azcore.Request, error) {\n\turlPath := \"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskEncryptionSets/{diskEncryptionSetName}\"\n\turlPath = strings.ReplaceAll(urlPath, \"{subscriptionId}\", url.PathEscape(client.subscriptionID))\n\turlPath = strings.ReplaceAll(urlPath, \"{resourceGroupName}\", url.PathEscape(resourceGroupName))\n\turlPath = strings.ReplaceAll(urlPath, \"{diskEncryptionSetName}\", url.PathEscape(diskEncryptionSetName))\n\treq, err := azcore.NewRequest(ctx, http.MethodPatch, azcore.JoinPaths(client.con.Endpoint(), urlPath))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treq.Telemetry(telemetryInfo)\n\tquery := req.URL.Query()\n\tquery.Set(\"api-version\", \"2020-09-30\")\n\treq.URL.RawQuery = query.Encode()\n\treq.Header.Set(\"Accept\", \"application/json\")\n\treturn req, req.MarshalAsJSON(diskEncryptionSet)\n}", "title": "" }, { "docid": "a3287c0d75d66abf138d04f9cb962410", "score": "0.66522336", "text": "func (client *DeploymentsClient) updateCreateRequest(ctx context.Context, resourceGroupName string, serviceName string, appName string, deploymentName string, deploymentResource DeploymentResource, options *DeploymentsClientBeginUpdateOptions) (*policy.Request, error) {\n\turlPath := \"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}\"\n\tif client.subscriptionID == \"\" {\n\t\treturn nil, errors.New(\"parameter client.subscriptionID cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{subscriptionId}\", url.PathEscape(client.subscriptionID))\n\tif resourceGroupName == \"\" {\n\t\treturn nil, errors.New(\"parameter resourceGroupName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{resourceGroupName}\", url.PathEscape(resourceGroupName))\n\tif serviceName == \"\" {\n\t\treturn nil, errors.New(\"parameter serviceName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{serviceName}\", url.PathEscape(serviceName))\n\tif appName == \"\" {\n\t\treturn nil, errors.New(\"parameter appName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{appName}\", url.PathEscape(appName))\n\tif deploymentName == \"\" {\n\t\treturn nil, errors.New(\"parameter deploymentName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{deploymentName}\", url.PathEscape(deploymentName))\n\treq, err := runtime.NewRequest(ctx, http.MethodPatch, runtime.JoinPaths(client.host, urlPath))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treqQP := req.Raw().URL.Query()\n\treqQP.Set(\"api-version\", \"2022-01-01-preview\")\n\treq.Raw().URL.RawQuery = reqQP.Encode()\n\treq.Raw().Header.Set(\"Accept\", \"application/json\")\n\treturn req, runtime.MarshalAsJSON(req, deploymentResource)\n}", "title": "" }, { "docid": "495b628e0169669d5b89df0dddad51eb", "score": "0.66470295", "text": "func (client *StorageAppliancesClient) updateCreateRequest(ctx context.Context, resourceGroupName string, storageApplianceName string, storageApplianceUpdateParameters StorageAppliancePatchParameters, options *StorageAppliancesClientBeginUpdateOptions) (*policy.Request, error) {\n\turlPath := \"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetworkCloud/storageAppliances/{storageApplianceName}\"\n\turlPath = strings.ReplaceAll(urlPath, \"{subscriptionId}\", url.PathEscape(client.subscriptionID))\n\tif resourceGroupName == \"\" {\n\t\treturn nil, errors.New(\"parameter resourceGroupName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{resourceGroupName}\", url.PathEscape(resourceGroupName))\n\tif storageApplianceName == \"\" {\n\t\treturn nil, errors.New(\"parameter storageApplianceName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{storageApplianceName}\", url.PathEscape(storageApplianceName))\n\treq, err := runtime.NewRequest(ctx, http.MethodPatch, runtime.JoinPaths(client.internal.Endpoint(), urlPath))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treqQP := req.Raw().URL.Query()\n\treqQP.Set(\"api-version\", \"2023-07-01\")\n\treq.Raw().URL.RawQuery = reqQP.Encode()\n\treq.Raw().Header[\"Accept\"] = []string{\"application/json\"}\n\tif err := runtime.MarshalAsJSON(req, storageApplianceUpdateParameters); err != nil {\n\t\treturn nil, err\n\t}\n\treturn req, nil\n}", "title": "" }, { "docid": "b6efbf4b2e0119fb09ff38e0c6143207", "score": "0.6646353", "text": "func (client *Client) updateCreateRequest(ctx context.Context, resourceGroupName string, clusterName string, parameters ClusterUpdate, options *ClientBeginUpdateOptions) (*policy.Request, error) {\n\turlPath := \"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/redisEnterprise/{clusterName}\"\n\tif resourceGroupName == \"\" {\n\t\treturn nil, errors.New(\"parameter resourceGroupName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{resourceGroupName}\", url.PathEscape(resourceGroupName))\n\tif clusterName == \"\" {\n\t\treturn nil, errors.New(\"parameter clusterName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{clusterName}\", url.PathEscape(clusterName))\n\tif client.subscriptionID == \"\" {\n\t\treturn nil, errors.New(\"parameter client.subscriptionID cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{subscriptionId}\", url.PathEscape(client.subscriptionID))\n\treq, err := runtime.NewRequest(ctx, http.MethodPatch, runtime.JoinPaths(client.internal.Endpoint(), urlPath))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treqQP := req.Raw().URL.Query()\n\treqQP.Set(\"api-version\", \"2022-01-01\")\n\treq.Raw().URL.RawQuery = reqQP.Encode()\n\treq.Raw().Header[\"Accept\"] = []string{\"application/json\"}\n\treturn req, runtime.MarshalAsJSON(req, parameters)\n}", "title": "" }, { "docid": "1fa47dff37d1d930a26032a8c5703d80", "score": "0.6645252", "text": "func (client *SchedulesClient) updateCreateRequest(ctx context.Context, resourceGroupName string, labName string, name string, schedule ScheduleFragment, options *SchedulesUpdateOptions) (*policy.Request, error) {\n\turlPath := \"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/schedules/{name}\"\n\tif client.subscriptionID == \"\" {\n\t\treturn nil, errors.New(\"parameter client.subscriptionID cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{subscriptionId}\", url.PathEscape(client.subscriptionID))\n\tif resourceGroupName == \"\" {\n\t\treturn nil, errors.New(\"parameter resourceGroupName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{resourceGroupName}\", url.PathEscape(resourceGroupName))\n\tif labName == \"\" {\n\t\treturn nil, errors.New(\"parameter labName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{labName}\", url.PathEscape(labName))\n\tif name == \"\" {\n\t\treturn nil, errors.New(\"parameter name cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{name}\", url.PathEscape(name))\n\treq, err := runtime.NewRequest(ctx, http.MethodPatch, runtime.JoinPaths(client.ep, urlPath))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treqQP := req.Raw().URL.Query()\n\treqQP.Set(\"api-version\", \"2018-09-15\")\n\treq.Raw().URL.RawQuery = reqQP.Encode()\n\treq.Raw().Header.Set(\"Accept\", \"application/json\")\n\treturn req, runtime.MarshalAsJSON(req, schedule)\n}", "title": "" }, { "docid": "74990d23a69e8cb3027e628145c5b1e4", "score": "0.6635573", "text": "func (client *OpenShiftClustersClient) updateCreateRequest(ctx context.Context, resourceGroupName string, resourceName string, parameters OpenShiftClusterUpdate, options *OpenShiftClustersClientBeginUpdateOptions) (*policy.Request, error) {\n\turlPath := \"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RedHatOpenShift/openShiftClusters/{resourceName}\"\n\tif client.subscriptionID == \"\" {\n\t\treturn nil, errors.New(\"parameter client.subscriptionID cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{subscriptionId}\", url.PathEscape(client.subscriptionID))\n\tif resourceGroupName == \"\" {\n\t\treturn nil, errors.New(\"parameter resourceGroupName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{resourceGroupName}\", url.PathEscape(resourceGroupName))\n\tif resourceName == \"\" {\n\t\treturn nil, errors.New(\"parameter resourceName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{resourceName}\", url.PathEscape(resourceName))\n\treq, err := runtime.NewRequest(ctx, http.MethodPatch, runtime.JoinPaths(client.internal.Endpoint(), urlPath))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treqQP := req.Raw().URL.Query()\n\treqQP.Set(\"api-version\", \"2023-04-01\")\n\treq.Raw().URL.RawQuery = reqQP.Encode()\n\treq.Raw().Header[\"Accept\"] = []string{\"application/json\"}\n\tif err := runtime.MarshalAsJSON(req, parameters); err != nil {\n\t\treturn nil, err\n\t}\n\treturn req, nil\n}", "title": "" }, { "docid": "f7c821cebf6e2bf705ecaf43ec5e6b56", "score": "0.6631986", "text": "func (client *ClustersClient) updateCreateRequest(ctx context.Context, resourceGroupName string, clusterName string, parameters ClusterUpdate, options *ClustersClientBeginUpdateOptions) (*policy.Request, error) {\n\turlPath := \"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Kusto/clusters/{clusterName}\"\n\tif resourceGroupName == \"\" {\n\t\treturn nil, errors.New(\"parameter resourceGroupName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{resourceGroupName}\", url.PathEscape(resourceGroupName))\n\tif clusterName == \"\" {\n\t\treturn nil, errors.New(\"parameter clusterName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{clusterName}\", url.PathEscape(clusterName))\n\tif client.subscriptionID == \"\" {\n\t\treturn nil, errors.New(\"parameter client.subscriptionID cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{subscriptionId}\", url.PathEscape(client.subscriptionID))\n\treq, err := runtime.NewRequest(ctx, http.MethodPatch, runtime.JoinPaths(client.internal.Endpoint(), urlPath))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treqQP := req.Raw().URL.Query()\n\treqQP.Set(\"api-version\", \"2023-05-02\")\n\treq.Raw().URL.RawQuery = reqQP.Encode()\n\tif options != nil && options.IfMatch != nil {\n\t\treq.Raw().Header[\"If-Match\"] = []string{*options.IfMatch}\n\t}\n\treq.Raw().Header[\"Accept\"] = []string{\"application/json\"}\n\treturn req, runtime.MarshalAsJSON(req, parameters)\n}", "title": "" }, { "docid": "b78683279f381f4c5c7428e668727868", "score": "0.6627379", "text": "func (client *ManagersClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, managerName string, manager Manager, options *ManagersClientCreateOrUpdateOptions) (*policy.Request, error) {\n\turlPath := \"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorSimple/managers/{managerName}\"\n\tif client.subscriptionID == \"\" {\n\t\treturn nil, errors.New(\"parameter client.subscriptionID cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{subscriptionId}\", url.PathEscape(client.subscriptionID))\n\tif resourceGroupName == \"\" {\n\t\treturn nil, errors.New(\"parameter resourceGroupName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{resourceGroupName}\", url.PathEscape(resourceGroupName))\n\tif managerName == \"\" {\n\t\treturn nil, errors.New(\"parameter managerName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{managerName}\", url.PathEscape(managerName))\n\treq, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.internal.Endpoint(), urlPath))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treqQP := req.Raw().URL.Query()\n\treqQP.Set(\"api-version\", \"2016-10-01\")\n\treq.Raw().URL.RawQuery = reqQP.Encode()\n\treq.Raw().Header[\"Accept\"] = []string{\"application/json\"}\n\treturn req, runtime.MarshalAsJSON(req, manager)\n}", "title": "" }, { "docid": "ec6b5092ad9c657a917f285be3a2c029", "score": "0.6622832", "text": "func (client *EndpointsClient) updateCreateRequest(ctx context.Context, resourceGroupName string, storageMoverName string, endpointName string, endpoint EndpointBaseUpdateParameters, options *EndpointsClientUpdateOptions) (*policy.Request, error) {\n\turlPath := \"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageMover/storageMovers/{storageMoverName}/endpoints/{endpointName}\"\n\tif client.subscriptionID == \"\" {\n\t\treturn nil, errors.New(\"parameter client.subscriptionID cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{subscriptionId}\", url.PathEscape(client.subscriptionID))\n\tif resourceGroupName == \"\" {\n\t\treturn nil, errors.New(\"parameter resourceGroupName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{resourceGroupName}\", url.PathEscape(resourceGroupName))\n\tif storageMoverName == \"\" {\n\t\treturn nil, errors.New(\"parameter storageMoverName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{storageMoverName}\", url.PathEscape(storageMoverName))\n\tif endpointName == \"\" {\n\t\treturn nil, errors.New(\"parameter endpointName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{endpointName}\", url.PathEscape(endpointName))\n\treq, err := runtime.NewRequest(ctx, http.MethodPatch, runtime.JoinPaths(client.internal.Endpoint(), urlPath))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treqQP := req.Raw().URL.Query()\n\treqQP.Set(\"api-version\", \"2023-07-01-preview\")\n\treq.Raw().URL.RawQuery = reqQP.Encode()\n\treq.Raw().Header[\"Accept\"] = []string{\"application/json\"}\n\treturn req, runtime.MarshalAsJSON(req, endpoint)\n}", "title": "" }, { "docid": "b8c65effdcf32b980a09864eff5ea237", "score": "0.6622704", "text": "func (client *SAPCentralInstancesClient) updateCreateRequest(ctx context.Context, resourceGroupName string, sapVirtualInstanceName string, centralInstanceName string, body UpdateSAPCentralInstanceRequest, options *SAPCentralInstancesClientBeginUpdateOptions) (*policy.Request, error) {\n\turlPath := \"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Workloads/sapVirtualInstances/{sapVirtualInstanceName}/centralInstances/{centralInstanceName}\"\n\tif client.subscriptionID == \"\" {\n\t\treturn nil, errors.New(\"parameter client.subscriptionID cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{subscriptionId}\", url.PathEscape(client.subscriptionID))\n\tif resourceGroupName == \"\" {\n\t\treturn nil, errors.New(\"parameter resourceGroupName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{resourceGroupName}\", url.PathEscape(resourceGroupName))\n\tif sapVirtualInstanceName == \"\" {\n\t\treturn nil, errors.New(\"parameter sapVirtualInstanceName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{sapVirtualInstanceName}\", url.PathEscape(sapVirtualInstanceName))\n\tif centralInstanceName == \"\" {\n\t\treturn nil, errors.New(\"parameter centralInstanceName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{centralInstanceName}\", url.PathEscape(centralInstanceName))\n\treq, err := runtime.NewRequest(ctx, http.MethodPatch, runtime.JoinPaths(client.host, urlPath))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treqQP := req.Raw().URL.Query()\n\treqQP.Set(\"api-version\", \"2021-12-01-preview\")\n\treq.Raw().URL.RawQuery = reqQP.Encode()\n\treq.Raw().Header[\"Accept\"] = []string{\"application/json\"}\n\treturn req, runtime.MarshalAsJSON(req, body)\n}", "title": "" }, { "docid": "15e39dfbdefe2a45d21fe73dbf0da5ac", "score": "0.6610838", "text": "func (client *PlacementPoliciesClient) updateCreateRequest(ctx context.Context, resourceGroupName string, privateCloudName string, clusterName string, placementPolicyName string, placementPolicyUpdate PlacementPolicyUpdate, options *PlacementPoliciesClientBeginUpdateOptions) (*policy.Request, error) {\n\turlPath := \"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/clusters/{clusterName}/placementPolicies/{placementPolicyName}\"\n\tif client.subscriptionID == \"\" {\n\t\treturn nil, errors.New(\"parameter client.subscriptionID cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{subscriptionId}\", url.PathEscape(client.subscriptionID))\n\tif resourceGroupName == \"\" {\n\t\treturn nil, errors.New(\"parameter resourceGroupName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{resourceGroupName}\", url.PathEscape(resourceGroupName))\n\tif privateCloudName == \"\" {\n\t\treturn nil, errors.New(\"parameter privateCloudName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{privateCloudName}\", url.PathEscape(privateCloudName))\n\tif clusterName == \"\" {\n\t\treturn nil, errors.New(\"parameter clusterName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{clusterName}\", url.PathEscape(clusterName))\n\tif placementPolicyName == \"\" {\n\t\treturn nil, errors.New(\"parameter placementPolicyName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{placementPolicyName}\", url.PathEscape(placementPolicyName))\n\treq, err := runtime.NewRequest(ctx, http.MethodPatch, runtime.JoinPaths(client.internal.Endpoint(), urlPath))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treqQP := req.Raw().URL.Query()\n\treqQP.Set(\"api-version\", \"2023-03-01\")\n\treq.Raw().URL.RawQuery = reqQP.Encode()\n\treq.Raw().Header[\"Accept\"] = []string{\"application/json\"}\n\tif err := runtime.MarshalAsJSON(req, placementPolicyUpdate); err != nil {\n\t\treturn nil, err\n\t}\n\treturn req, nil\n}", "title": "" }, { "docid": "de3f5e0cd83400c67db0f75b8cd3dad4", "score": "0.66028154", "text": "func (client *IntegrationServiceEnvironmentsClient) updateCreateRequest(ctx context.Context, resourceGroup string, integrationServiceEnvironmentName string, integrationServiceEnvironment IntegrationServiceEnvironment, options *IntegrationServiceEnvironmentsClientBeginUpdateOptions) (*policy.Request, error) {\n\turlPath := \"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.Logic/integrationServiceEnvironments/{integrationServiceEnvironmentName}\"\n\tif client.subscriptionID == \"\" {\n\t\treturn nil, errors.New(\"parameter client.subscriptionID cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{subscriptionId}\", url.PathEscape(client.subscriptionID))\n\tif resourceGroup == \"\" {\n\t\treturn nil, errors.New(\"parameter resourceGroup cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{resourceGroup}\", url.PathEscape(resourceGroup))\n\tif integrationServiceEnvironmentName == \"\" {\n\t\treturn nil, errors.New(\"parameter integrationServiceEnvironmentName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{integrationServiceEnvironmentName}\", url.PathEscape(integrationServiceEnvironmentName))\n\treq, err := runtime.NewRequest(ctx, http.MethodPatch, runtime.JoinPaths(client.internal.Endpoint(), urlPath))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treqQP := req.Raw().URL.Query()\n\treqQP.Set(\"api-version\", \"2019-05-01\")\n\treq.Raw().URL.RawQuery = reqQP.Encode()\n\treq.Raw().Header[\"Accept\"] = []string{\"application/json\"}\n\treturn req, runtime.MarshalAsJSON(req, integrationServiceEnvironment)\n}", "title": "" }, { "docid": "edc6523d41b43b04883879b1ec9cc1c4", "score": "0.66028005", "text": "func (client *BackendClient) updateCreateRequest(ctx context.Context, resourceGroupName string, serviceName string, backendID string, ifMatch string, parameters BackendUpdateParameters, options *BackendUpdateOptions) (*policy.Request, error) {\n\turlPath := \"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/backends/{backendId}\"\n\tif resourceGroupName == \"\" {\n\t\treturn nil, errors.New(\"parameter resourceGroupName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{resourceGroupName}\", url.PathEscape(resourceGroupName))\n\tif serviceName == \"\" {\n\t\treturn nil, errors.New(\"parameter serviceName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{serviceName}\", url.PathEscape(serviceName))\n\tif backendID == \"\" {\n\t\treturn nil, errors.New(\"parameter backendID cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{backendId}\", url.PathEscape(backendID))\n\tif client.subscriptionID == \"\" {\n\t\treturn nil, errors.New(\"parameter client.subscriptionID cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{subscriptionId}\", url.PathEscape(client.subscriptionID))\n\treq, err := runtime.NewRequest(ctx, http.MethodPatch, runtime.JoinPaths(client.ep, urlPath))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treqQP := req.Raw().URL.Query()\n\treqQP.Set(\"api-version\", \"2021-08-01\")\n\treq.Raw().URL.RawQuery = reqQP.Encode()\n\treq.Raw().Header.Set(\"If-Match\", ifMatch)\n\treq.Raw().Header.Set(\"Accept\", \"application/json\")\n\treturn req, runtime.MarshalAsJSON(req, parameters)\n}", "title": "" }, { "docid": "744d8af17f04295a6db95f2e06390c6c", "score": "0.6598807", "text": "func (client *SyncMembersClient) updateCreateRequest(ctx context.Context, resourceGroupName string, serverName string, databaseName string, syncGroupName string, syncMemberName string, parameters SyncMember, options *SyncMembersClientBeginUpdateOptions) (*policy.Request, error) {\n\turlPath := \"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/syncGroups/{syncGroupName}/syncMembers/{syncMemberName}\"\n\tif resourceGroupName == \"\" {\n\t\treturn nil, errors.New(\"parameter resourceGroupName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{resourceGroupName}\", url.PathEscape(resourceGroupName))\n\tif serverName == \"\" {\n\t\treturn nil, errors.New(\"parameter serverName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{serverName}\", url.PathEscape(serverName))\n\tif databaseName == \"\" {\n\t\treturn nil, errors.New(\"parameter databaseName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{databaseName}\", url.PathEscape(databaseName))\n\tif syncGroupName == \"\" {\n\t\treturn nil, errors.New(\"parameter syncGroupName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{syncGroupName}\", url.PathEscape(syncGroupName))\n\tif syncMemberName == \"\" {\n\t\treturn nil, errors.New(\"parameter syncMemberName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{syncMemberName}\", url.PathEscape(syncMemberName))\n\tif client.subscriptionID == \"\" {\n\t\treturn nil, errors.New(\"parameter client.subscriptionID cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{subscriptionId}\", url.PathEscape(client.subscriptionID))\n\treq, err := runtime.NewRequest(ctx, http.MethodPatch, runtime.JoinPaths(client.internal.Endpoint(), urlPath))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treqQP := req.Raw().URL.Query()\n\treqQP.Set(\"api-version\", \"2020-11-01-preview\")\n\treq.Raw().URL.RawQuery = reqQP.Encode()\n\treq.Raw().Header[\"Accept\"] = []string{\"application/json\"}\n\tif err := runtime.MarshalAsJSON(req, parameters); err != nil {\n\t\treturn nil, err\n\t}\n\treturn req, nil\n}", "title": "" }, { "docid": "abb78df7d9dfc7814d12cb0adfce67cd", "score": "0.65939623", "text": "func (client *ManagedNetworksClient) updateCreateRequest(ctx context.Context, resourceGroupName string, managedNetworkName string, parameters Update, options *ManagedNetworksClientBeginUpdateOptions) (*policy.Request, error) {\n\turlPath := \"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedNetwork/managedNetworks/{managedNetworkName}\"\n\tif client.subscriptionID == \"\" {\n\t\treturn nil, errors.New(\"parameter client.subscriptionID cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{subscriptionId}\", url.PathEscape(client.subscriptionID))\n\tif resourceGroupName == \"\" {\n\t\treturn nil, errors.New(\"parameter resourceGroupName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{resourceGroupName}\", url.PathEscape(resourceGroupName))\n\tif managedNetworkName == \"\" {\n\t\treturn nil, errors.New(\"parameter managedNetworkName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{managedNetworkName}\", url.PathEscape(managedNetworkName))\n\treq, err := runtime.NewRequest(ctx, http.MethodPatch, runtime.JoinPaths(client.internal.Endpoint(), urlPath))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treqQP := req.Raw().URL.Query()\n\treqQP.Set(\"api-version\", \"2019-06-01-preview\")\n\treq.Raw().URL.RawQuery = reqQP.Encode()\n\treq.Raw().Header[\"Accept\"] = []string{\"application/json\"}\n\treturn req, runtime.MarshalAsJSON(req, parameters)\n}", "title": "" }, { "docid": "1ed8a71b28fb658c3fe6b2d2ec824e8d", "score": "0.6588598", "text": "func (client *SQLManagedInstancesClient) updateCreateRequest(ctx context.Context, resourceGroupName string, sqlManagedInstanceName string, parameters SQLManagedInstanceUpdate, options *SQLManagedInstancesClientUpdateOptions) (*policy.Request, error) {\n\turlPath := \"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureArcData/sqlManagedInstances/{sqlManagedInstanceName}\"\n\tif client.subscriptionID == \"\" {\n\t\treturn nil, errors.New(\"parameter client.subscriptionID cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{subscriptionId}\", url.PathEscape(client.subscriptionID))\n\tif resourceGroupName == \"\" {\n\t\treturn nil, errors.New(\"parameter resourceGroupName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{resourceGroupName}\", url.PathEscape(resourceGroupName))\n\tif sqlManagedInstanceName == \"\" {\n\t\treturn nil, errors.New(\"parameter sqlManagedInstanceName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{sqlManagedInstanceName}\", url.PathEscape(sqlManagedInstanceName))\n\treq, err := runtime.NewRequest(ctx, http.MethodPatch, runtime.JoinPaths(client.internal.Endpoint(), urlPath))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treqQP := req.Raw().URL.Query()\n\treqQP.Set(\"api-version\", \"2022-03-01-preview\")\n\treq.Raw().URL.RawQuery = reqQP.Encode()\n\treq.Raw().Header[\"Accept\"] = []string{\"application/json\"}\n\treturn req, runtime.MarshalAsJSON(req, parameters)\n}", "title": "" }, { "docid": "90e13709a066accff3267eb95b1e02ce", "score": "0.658582", "text": "func (client *OriginGroupsClient) updateCreateRequest(ctx context.Context, resourceGroupName string, profileName string, endpointName string, originGroupName string, originGroupUpdateProperties OriginGroupUpdateParameters, options *OriginGroupsBeginUpdateOptions) (*policy.Request, error) {\n\turlPath := \"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/endpoints/{endpointName}/originGroups/{originGroupName}\"\n\tif resourceGroupName == \"\" {\n\t\treturn nil, errors.New(\"parameter resourceGroupName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{resourceGroupName}\", url.PathEscape(resourceGroupName))\n\tif profileName == \"\" {\n\t\treturn nil, errors.New(\"parameter profileName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{profileName}\", url.PathEscape(profileName))\n\tif endpointName == \"\" {\n\t\treturn nil, errors.New(\"parameter endpointName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{endpointName}\", url.PathEscape(endpointName))\n\tif originGroupName == \"\" {\n\t\treturn nil, errors.New(\"parameter originGroupName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{originGroupName}\", url.PathEscape(originGroupName))\n\tif client.subscriptionID == \"\" {\n\t\treturn nil, errors.New(\"parameter client.subscriptionID cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{subscriptionId}\", url.PathEscape(client.subscriptionID))\n\treq, err := runtime.NewRequest(ctx, http.MethodPatch, runtime.JoinPaths(client.ep, urlPath))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treqQP := req.Raw().URL.Query()\n\treqQP.Set(\"api-version\", \"2020-09-01\")\n\treq.Raw().URL.RawQuery = reqQP.Encode()\n\treq.Raw().Header.Set(\"Accept\", \"application/json\")\n\treturn req, runtime.MarshalAsJSON(req, originGroupUpdateProperties)\n}", "title": "" }, { "docid": "bc5e09211dce2db0408aa74830709cf3", "score": "0.6585365", "text": "func (client *TasksClient) updateCreateRequest(ctx context.Context, resourceGroupName string, registryName string, taskName string, taskUpdateParameters TaskUpdateParameters, options *TasksBeginUpdateOptions) (*azcore.Request, error) {\n\turlPath := \"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/tasks/{taskName}\"\n\tif client.subscriptionID == \"\" {\n\t\treturn nil, errors.New(\"parameter client.subscriptionID cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{subscriptionId}\", url.PathEscape(client.subscriptionID))\n\tif resourceGroupName == \"\" {\n\t\treturn nil, errors.New(\"parameter resourceGroupName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{resourceGroupName}\", url.PathEscape(resourceGroupName))\n\tif registryName == \"\" {\n\t\treturn nil, errors.New(\"parameter registryName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{registryName}\", url.PathEscape(registryName))\n\tif taskName == \"\" {\n\t\treturn nil, errors.New(\"parameter taskName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{taskName}\", url.PathEscape(taskName))\n\treq, err := azcore.NewRequest(ctx, http.MethodPatch, azcore.JoinPaths(client.con.Endpoint(), urlPath))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treq.Telemetry(telemetryInfo)\n\treqQP := req.URL.Query()\n\treqQP.Set(\"api-version\", \"2019-06-01-preview\")\n\treq.URL.RawQuery = reqQP.Encode()\n\treq.Header.Set(\"Accept\", \"application/json\")\n\treturn req, req.MarshalAsJSON(taskUpdateParameters)\n}", "title": "" }, { "docid": "a451bf1d2df02580840d15cd09f9f22f", "score": "0.65706366", "text": "func (client *LabsClient) updateCreateRequest(ctx context.Context, resourceGroupName string, name string, lab LabFragment, options *LabsClientUpdateOptions) (*policy.Request, error) {\n\turlPath := \"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{name}\"\n\tif client.subscriptionID == \"\" {\n\t\treturn nil, errors.New(\"parameter client.subscriptionID cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{subscriptionId}\", url.PathEscape(client.subscriptionID))\n\tif resourceGroupName == \"\" {\n\t\treturn nil, errors.New(\"parameter resourceGroupName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{resourceGroupName}\", url.PathEscape(resourceGroupName))\n\tif name == \"\" {\n\t\treturn nil, errors.New(\"parameter name cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{name}\", url.PathEscape(name))\n\treq, err := runtime.NewRequest(ctx, http.MethodPatch, runtime.JoinPaths(client.internal.Endpoint(), urlPath))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treqQP := req.Raw().URL.Query()\n\treqQP.Set(\"api-version\", \"2018-09-15\")\n\treq.Raw().URL.RawQuery = reqQP.Encode()\n\treq.Raw().Header[\"Accept\"] = []string{\"application/json\"}\n\treturn req, runtime.MarshalAsJSON(req, lab)\n}", "title": "" }, { "docid": "4f62d2e17dd9766bfa1dcb51cf61d912", "score": "0.65702033", "text": "func (client *DiskEncryptionSetsClient) updateCreateRequest(ctx context.Context, resourceGroupName string, diskEncryptionSetName string, diskEncryptionSet DiskEncryptionSetUpdate, options *DiskEncryptionSetsClientBeginUpdateOptions) (*policy.Request, error) {\n\turlPath := \"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskEncryptionSets/{diskEncryptionSetName}\"\n\tif client.subscriptionID == \"\" {\n\t\treturn nil, errors.New(\"parameter client.subscriptionID cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{subscriptionId}\", url.PathEscape(client.subscriptionID))\n\tif resourceGroupName == \"\" {\n\t\treturn nil, errors.New(\"parameter resourceGroupName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{resourceGroupName}\", url.PathEscape(resourceGroupName))\n\tif diskEncryptionSetName == \"\" {\n\t\treturn nil, errors.New(\"parameter diskEncryptionSetName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{diskEncryptionSetName}\", url.PathEscape(diskEncryptionSetName))\n\treq, err := runtime.NewRequest(ctx, http.MethodPatch, runtime.JoinPaths(client.host, urlPath))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treqQP := req.Raw().URL.Query()\n\treqQP.Set(\"api-version\", \"2022-07-02\")\n\treq.Raw().URL.RawQuery = reqQP.Encode()\n\treq.Raw().Header[\"Accept\"] = []string{\"application/json\"}\n\treturn req, runtime.MarshalAsJSON(req, diskEncryptionSet)\n}", "title": "" }, { "docid": "a3631d66eb6df66bccd829b9beb08e5d", "score": "0.65519106", "text": "func (client *VirtualClustersClient) updateCreateRequest(ctx context.Context, resourceGroupName string, virtualClusterName string, parameters VirtualClusterUpdate, options *VirtualClustersClientBeginUpdateOptions) (*policy.Request, error) {\n\turlPath := \"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/virtualClusters/{virtualClusterName}\"\n\tif resourceGroupName == \"\" {\n\t\treturn nil, errors.New(\"parameter resourceGroupName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{resourceGroupName}\", url.PathEscape(resourceGroupName))\n\tif virtualClusterName == \"\" {\n\t\treturn nil, errors.New(\"parameter virtualClusterName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{virtualClusterName}\", url.PathEscape(virtualClusterName))\n\tif client.subscriptionID == \"\" {\n\t\treturn nil, errors.New(\"parameter client.subscriptionID cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{subscriptionId}\", url.PathEscape(client.subscriptionID))\n\treq, err := runtime.NewRequest(ctx, http.MethodPatch, runtime.JoinPaths(client.host, urlPath))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treqQP := req.Raw().URL.Query()\n\treqQP.Set(\"api-version\", \"2020-11-01-preview\")\n\treq.Raw().URL.RawQuery = reqQP.Encode()\n\treq.Raw().Header[\"Accept\"] = []string{\"application/json\"}\n\treturn req, runtime.MarshalAsJSON(req, parameters)\n}", "title": "" }, { "docid": "65e6d2549f647a881c92576cab756555", "score": "0.65389645", "text": "func (client *VirtualClustersClient) updateCreateRequest(ctx context.Context, resourceGroupName string, virtualClusterName string, parameters VirtualClusterUpdate, options *VirtualClustersClientBeginUpdateOptions) (*policy.Request, error) {\n\turlPath := \"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/virtualClusters/{virtualClusterName}\"\n\tif resourceGroupName == \"\" {\n\t\treturn nil, errors.New(\"parameter resourceGroupName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{resourceGroupName}\", url.PathEscape(resourceGroupName))\n\tif virtualClusterName == \"\" {\n\t\treturn nil, errors.New(\"parameter virtualClusterName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{virtualClusterName}\", url.PathEscape(virtualClusterName))\n\tif client.subscriptionID == \"\" {\n\t\treturn nil, errors.New(\"parameter client.subscriptionID cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{subscriptionId}\", url.PathEscape(client.subscriptionID))\n\treq, err := runtime.NewRequest(ctx, http.MethodPatch, runtime.JoinPaths(client.internal.Endpoint(), urlPath))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treqQP := req.Raw().URL.Query()\n\treqQP.Set(\"api-version\", \"2022-05-01-preview\")\n\treq.Raw().URL.RawQuery = reqQP.Encode()\n\treq.Raw().Header[\"Accept\"] = []string{\"application/json\"}\n\tif err := runtime.MarshalAsJSON(req, parameters); err != nil {\n\t\treturn nil, err\n\t}\n\treturn req, nil\n}", "title": "" }, { "docid": "9ed225b006e5b8b9495b714628007819", "score": "0.6535364", "text": "func (client *AssociationsInterfaceClient) updateCreateRequest(ctx context.Context, resourceGroupName string, trafficControllerName string, associationName string, properties AssociationUpdate, options *AssociationsInterfaceClientUpdateOptions) (*policy.Request, error) {\n\turlPath := \"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceNetworking/trafficControllers/{trafficControllerName}/associations/{associationName}\"\n\tif client.subscriptionID == \"\" {\n\t\treturn nil, errors.New(\"parameter client.subscriptionID cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{subscriptionId}\", url.PathEscape(client.subscriptionID))\n\tif resourceGroupName == \"\" {\n\t\treturn nil, errors.New(\"parameter resourceGroupName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{resourceGroupName}\", url.PathEscape(resourceGroupName))\n\tif trafficControllerName == \"\" {\n\t\treturn nil, errors.New(\"parameter trafficControllerName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{trafficControllerName}\", url.PathEscape(trafficControllerName))\n\tif associationName == \"\" {\n\t\treturn nil, errors.New(\"parameter associationName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{associationName}\", url.PathEscape(associationName))\n\treq, err := runtime.NewRequest(ctx, http.MethodPatch, runtime.JoinPaths(client.internal.Endpoint(), urlPath))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treqQP := req.Raw().URL.Query()\n\treqQP.Set(\"api-version\", \"2023-05-01-preview\")\n\treq.Raw().URL.RawQuery = reqQP.Encode()\n\treq.Raw().Header[\"Accept\"] = []string{\"application/json\"}\n\treturn req, runtime.MarshalAsJSON(req, properties)\n}", "title": "" }, { "docid": "3fcf3b0dd9a1754cedc777bdb6f5ee70", "score": "0.65339154", "text": "func (client *RacksClient) updateCreateRequest(ctx context.Context, resourceGroupName string, rackName string, rackUpdateParameters RackPatchParameters, options *RacksClientBeginUpdateOptions) (*policy.Request, error) {\n\turlPath := \"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetworkCloud/racks/{rackName}\"\n\turlPath = strings.ReplaceAll(urlPath, \"{subscriptionId}\", url.PathEscape(client.subscriptionID))\n\tif resourceGroupName == \"\" {\n\t\treturn nil, errors.New(\"parameter resourceGroupName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{resourceGroupName}\", url.PathEscape(resourceGroupName))\n\tif rackName == \"\" {\n\t\treturn nil, errors.New(\"parameter rackName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{rackName}\", url.PathEscape(rackName))\n\treq, err := runtime.NewRequest(ctx, http.MethodPatch, runtime.JoinPaths(client.internal.Endpoint(), urlPath))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treqQP := req.Raw().URL.Query()\n\treqQP.Set(\"api-version\", \"2023-07-01\")\n\treq.Raw().URL.RawQuery = reqQP.Encode()\n\treq.Raw().Header[\"Accept\"] = []string{\"application/json\"}\n\tif err := runtime.MarshalAsJSON(req, rackUpdateParameters); err != nil {\n\t\treturn nil, err\n\t}\n\treturn req, nil\n}", "title": "" }, { "docid": "afcb755abd2bdcd35de535982cf7bd7e", "score": "0.6532202", "text": "func (client *SAPApplicationServerInstancesClient) updateCreateRequest(ctx context.Context, resourceGroupName string, sapVirtualInstanceName string, applicationInstanceName string, body UpdateSAPApplicationInstanceRequest, options *SAPApplicationServerInstancesClientBeginUpdateOptions) (*policy.Request, error) {\n\turlPath := \"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Workloads/sapVirtualInstances/{sapVirtualInstanceName}/applicationInstances/{applicationInstanceName}\"\n\tif client.subscriptionID == \"\" {\n\t\treturn nil, errors.New(\"parameter client.subscriptionID cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{subscriptionId}\", url.PathEscape(client.subscriptionID))\n\tif resourceGroupName == \"\" {\n\t\treturn nil, errors.New(\"parameter resourceGroupName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{resourceGroupName}\", url.PathEscape(resourceGroupName))\n\tif sapVirtualInstanceName == \"\" {\n\t\treturn nil, errors.New(\"parameter sapVirtualInstanceName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{sapVirtualInstanceName}\", url.PathEscape(sapVirtualInstanceName))\n\tif applicationInstanceName == \"\" {\n\t\treturn nil, errors.New(\"parameter applicationInstanceName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{applicationInstanceName}\", url.PathEscape(applicationInstanceName))\n\treq, err := runtime.NewRequest(ctx, http.MethodPatch, runtime.JoinPaths(client.internal.Endpoint(), urlPath))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treqQP := req.Raw().URL.Query()\n\treqQP.Set(\"api-version\", \"2023-04-01\")\n\treq.Raw().URL.RawQuery = reqQP.Encode()\n\treq.Raw().Header[\"Accept\"] = []string{\"application/json\"}\n\treturn req, runtime.MarshalAsJSON(req, body)\n}", "title": "" }, { "docid": "c6ede624e54aa7831177001eb582858e", "score": "0.65293753", "text": "func (client *IntegrationRuntimesClient) updateCreateRequest(ctx context.Context, resourceGroupName string, factoryName string, integrationRuntimeName string, updateIntegrationRuntimeRequest UpdateIntegrationRuntimeRequest, options *IntegrationRuntimesClientUpdateOptions) (*policy.Request, error) {\n\turlPath := \"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataFactory/factories/{factoryName}/integrationRuntimes/{integrationRuntimeName}\"\n\tif client.subscriptionID == \"\" {\n\t\treturn nil, errors.New(\"parameter client.subscriptionID cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{subscriptionId}\", url.PathEscape(client.subscriptionID))\n\tif resourceGroupName == \"\" {\n\t\treturn nil, errors.New(\"parameter resourceGroupName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{resourceGroupName}\", url.PathEscape(resourceGroupName))\n\tif factoryName == \"\" {\n\t\treturn nil, errors.New(\"parameter factoryName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{factoryName}\", url.PathEscape(factoryName))\n\tif integrationRuntimeName == \"\" {\n\t\treturn nil, errors.New(\"parameter integrationRuntimeName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{integrationRuntimeName}\", url.PathEscape(integrationRuntimeName))\n\treq, err := runtime.NewRequest(ctx, http.MethodPatch, runtime.JoinPaths(client.internal.Endpoint(), urlPath))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treqQP := req.Raw().URL.Query()\n\treqQP.Set(\"api-version\", \"2018-06-01\")\n\treq.Raw().URL.RawQuery = reqQP.Encode()\n\treq.Raw().Header[\"Accept\"] = []string{\"application/json\"}\n\treturn req, runtime.MarshalAsJSON(req, updateIntegrationRuntimeRequest)\n}", "title": "" }, { "docid": "a1b4ea52683827b781e8fe503d5cc1fc", "score": "0.6513302", "text": "func (client *RoutesClient) updateCreateRequest(ctx context.Context, resourceGroupName string, profileName string, endpointName string, routeName string, routeUpdateProperties RouteUpdateParameters, options *RoutesBeginUpdateOptions) (*policy.Request, error) {\n\turlPath := \"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/afdEndpoints/{endpointName}/routes/{routeName}\"\n\tif resourceGroupName == \"\" {\n\t\treturn nil, errors.New(\"parameter resourceGroupName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{resourceGroupName}\", url.PathEscape(resourceGroupName))\n\tif profileName == \"\" {\n\t\treturn nil, errors.New(\"parameter profileName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{profileName}\", url.PathEscape(profileName))\n\tif endpointName == \"\" {\n\t\treturn nil, errors.New(\"parameter endpointName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{endpointName}\", url.PathEscape(endpointName))\n\tif routeName == \"\" {\n\t\treturn nil, errors.New(\"parameter routeName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{routeName}\", url.PathEscape(routeName))\n\tif client.subscriptionID == \"\" {\n\t\treturn nil, errors.New(\"parameter client.subscriptionID cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{subscriptionId}\", url.PathEscape(client.subscriptionID))\n\treq, err := runtime.NewRequest(ctx, http.MethodPatch, runtime.JoinPaths(client.ep, urlPath))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treqQP := req.Raw().URL.Query()\n\treqQP.Set(\"api-version\", \"2020-09-01\")\n\treq.Raw().URL.RawQuery = reqQP.Encode()\n\treq.Raw().Header.Set(\"Accept\", \"application/json\")\n\treturn req, runtime.MarshalAsJSON(req, routeUpdateProperties)\n}", "title": "" }, { "docid": "58bc2cd7e3eb7c221cb924b061650a83", "score": "0.6510222", "text": "func NewUpdateRequest(payload *users.User) *userspb.UpdateRequest {\n\tmessage := &userspb.UpdateRequest{\n\t\tEmail: payload.Email,\n\t\tFirstname: payload.Firstname,\n\t\tLastname: payload.Lastname,\n\t\tRole: payload.Role,\n\t\tIsactive: payload.Isactive,\n\t}\n\treturn message\n}", "title": "" }, { "docid": "2593c7d4f15a28e480373e261b8f9dc6", "score": "0.65039015", "text": "func (client *VirtualNetworkRulesClient) updateCreateRequest(ctx context.Context, resourceGroupName string, accountName string, virtualNetworkRuleName string, options *VirtualNetworkRulesUpdateOptions) (*policy.Request, error) {\n\turlPath := \"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataLakeStore/accounts/{accountName}/virtualNetworkRules/{virtualNetworkRuleName}\"\n\tif client.subscriptionID == \"\" {\n\t\treturn nil, errors.New(\"parameter client.subscriptionID cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{subscriptionId}\", url.PathEscape(client.subscriptionID))\n\tif resourceGroupName == \"\" {\n\t\treturn nil, errors.New(\"parameter resourceGroupName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{resourceGroupName}\", url.PathEscape(resourceGroupName))\n\tif accountName == \"\" {\n\t\treturn nil, errors.New(\"parameter accountName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{accountName}\", url.PathEscape(accountName))\n\tif virtualNetworkRuleName == \"\" {\n\t\treturn nil, errors.New(\"parameter virtualNetworkRuleName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{virtualNetworkRuleName}\", url.PathEscape(virtualNetworkRuleName))\n\treq, err := runtime.NewRequest(ctx, http.MethodPatch, runtime.JoinPaths(client.ep, urlPath))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treqQP := req.Raw().URL.Query()\n\treqQP.Set(\"api-version\", \"2016-11-01\")\n\treq.Raw().URL.RawQuery = reqQP.Encode()\n\treq.Raw().Header.Set(\"Accept\", \"application/json\")\n\tif options != nil && options.Parameters != nil {\n\t\treturn req, runtime.MarshalAsJSON(req, *options.Parameters)\n\t}\n\treturn req, nil\n}", "title": "" }, { "docid": "1ecf37613512eec6bb97ec6c93d62eb2", "score": "0.648905", "text": "func (client *FluxConfigurationsClient) updateCreateRequest(ctx context.Context, resourceGroupName string, clusterRp string, clusterResourceName string, clusterName string, fluxConfigurationName string, fluxConfigurationPatch FluxConfigurationPatch, options *FluxConfigurationsClientBeginUpdateOptions) (*policy.Request, error) {\n\turlPath := \"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/fluxConfigurations/{fluxConfigurationName}\"\n\tif client.subscriptionID == \"\" {\n\t\treturn nil, errors.New(\"parameter client.subscriptionID cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{subscriptionId}\", url.PathEscape(client.subscriptionID))\n\tif resourceGroupName == \"\" {\n\t\treturn nil, errors.New(\"parameter resourceGroupName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{resourceGroupName}\", url.PathEscape(resourceGroupName))\n\tif clusterRp == \"\" {\n\t\treturn nil, errors.New(\"parameter clusterRp cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{clusterRp}\", url.PathEscape(clusterRp))\n\tif clusterResourceName == \"\" {\n\t\treturn nil, errors.New(\"parameter clusterResourceName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{clusterResourceName}\", url.PathEscape(clusterResourceName))\n\tif clusterName == \"\" {\n\t\treturn nil, errors.New(\"parameter clusterName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{clusterName}\", url.PathEscape(clusterName))\n\tif fluxConfigurationName == \"\" {\n\t\treturn nil, errors.New(\"parameter fluxConfigurationName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{fluxConfigurationName}\", url.PathEscape(fluxConfigurationName))\n\treq, err := runtime.NewRequest(ctx, http.MethodPatch, runtime.JoinPaths(client.internal.Endpoint(), urlPath))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treqQP := req.Raw().URL.Query()\n\treqQP.Set(\"api-version\", \"2022-11-01\")\n\treq.Raw().URL.RawQuery = reqQP.Encode()\n\treq.Raw().Header[\"Accept\"] = []string{\"application/json\"}\n\treturn req, runtime.MarshalAsJSON(req, fluxConfigurationPatch)\n}", "title": "" }, { "docid": "a2941470340690eca40cd40e978d8a05", "score": "0.6486938", "text": "func (client *PrivateZonesClient) updateCreateRequest(ctx context.Context, resourceGroupName string, privateZoneName string, parameters PrivateZone, options *PrivateZonesClientBeginUpdateOptions) (*policy.Request, error) {\n\turlPath := \"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/privateDnsZones/{privateZoneName}\"\n\tif resourceGroupName == \"\" {\n\t\treturn nil, errors.New(\"parameter resourceGroupName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{resourceGroupName}\", url.PathEscape(resourceGroupName))\n\tif privateZoneName == \"\" {\n\t\treturn nil, errors.New(\"parameter privateZoneName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{privateZoneName}\", url.PathEscape(privateZoneName))\n\tif client.subscriptionID == \"\" {\n\t\treturn nil, errors.New(\"parameter client.subscriptionID cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{subscriptionId}\", url.PathEscape(client.subscriptionID))\n\treq, err := runtime.NewRequest(ctx, http.MethodPatch, runtime.JoinPaths(client.internal.Endpoint(), urlPath))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treqQP := req.Raw().URL.Query()\n\treqQP.Set(\"api-version\", \"2020-06-01\")\n\treq.Raw().URL.RawQuery = reqQP.Encode()\n\tif options != nil && options.IfMatch != nil {\n\t\treq.Raw().Header[\"If-Match\"] = []string{*options.IfMatch}\n\t}\n\treq.Raw().Header[\"Accept\"] = []string{\"application/json\"}\n\treturn req, runtime.MarshalAsJSON(req, parameters)\n}", "title": "" }, { "docid": "5ce7ba4021bd1af625a2e25059e52571", "score": "0.6476392", "text": "func (client *TokensClient) updateCreateRequest(ctx context.Context, resourceGroupName string, registryName string, tokenName string, tokenUpdateParameters TokenUpdateParameters, options *TokensBeginUpdateOptions) (*azcore.Request, error) {\n\turlPath := \"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/tokens/{tokenName}\"\n\tif client.subscriptionID == \"\" {\n\t\treturn nil, errors.New(\"parameter client.subscriptionID cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{subscriptionId}\", url.PathEscape(client.subscriptionID))\n\tif resourceGroupName == \"\" {\n\t\treturn nil, errors.New(\"parameter resourceGroupName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{resourceGroupName}\", url.PathEscape(resourceGroupName))\n\tif registryName == \"\" {\n\t\treturn nil, errors.New(\"parameter registryName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{registryName}\", url.PathEscape(registryName))\n\tif tokenName == \"\" {\n\t\treturn nil, errors.New(\"parameter tokenName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{tokenName}\", url.PathEscape(tokenName))\n\treq, err := azcore.NewRequest(ctx, http.MethodPatch, azcore.JoinPaths(client.con.Endpoint(), urlPath))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treq.Telemetry(telemetryInfo)\n\treqQP := req.URL.Query()\n\treqQP.Set(\"api-version\", \"2021-06-01-preview\")\n\treq.URL.RawQuery = reqQP.Encode()\n\treq.Header.Set(\"Accept\", \"application/json\")\n\treturn req, req.MarshalAsJSON(tokenUpdateParameters)\n}", "title": "" }, { "docid": "f998e7fd4396e79afd07f1c3a08655fa", "score": "0.64595985", "text": "func (client *NotificationClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, serviceName string, notificationName NotificationName, options *NotificationClientCreateOrUpdateOptions) (*policy.Request, error) {\n\turlPath := \"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/notifications/{notificationName}\"\n\tif resourceGroupName == \"\" {\n\t\treturn nil, errors.New(\"parameter resourceGroupName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{resourceGroupName}\", url.PathEscape(resourceGroupName))\n\tif serviceName == \"\" {\n\t\treturn nil, errors.New(\"parameter serviceName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{serviceName}\", url.PathEscape(serviceName))\n\tif notificationName == \"\" {\n\t\treturn nil, errors.New(\"parameter notificationName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{notificationName}\", url.PathEscape(string(notificationName)))\n\tif client.subscriptionID == \"\" {\n\t\treturn nil, errors.New(\"parameter client.subscriptionID cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{subscriptionId}\", url.PathEscape(client.subscriptionID))\n\treq, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.internal.Endpoint(), urlPath))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treqQP := req.Raw().URL.Query()\n\treqQP.Set(\"api-version\", \"2022-08-01\")\n\treq.Raw().URL.RawQuery = reqQP.Encode()\n\tif options != nil && options.IfMatch != nil {\n\t\treq.Raw().Header[\"If-Match\"] = []string{*options.IfMatch}\n\t}\n\treq.Raw().Header[\"Accept\"] = []string{\"application/json\"}\n\treturn req, nil\n}", "title": "" }, { "docid": "fe2ddc3b86713f7f5cf6655d11f07f56", "score": "0.6456722", "text": "func (client *SecurityContactsClient) updateCreateRequest(ctx context.Context, securityContactName string, securityContact SecurityContact, options *SecurityContactsUpdateOptions) (*policy.Request, error) {\n\turlPath := \"/subscriptions/{subscriptionId}/providers/Microsoft.Security/securityContacts/{securityContactName}\"\n\tif client.subscriptionID == \"\" {\n\t\treturn nil, errors.New(\"parameter client.subscriptionID cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{subscriptionId}\", url.PathEscape(client.subscriptionID))\n\tif securityContactName == \"\" {\n\t\treturn nil, errors.New(\"parameter securityContactName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{securityContactName}\", url.PathEscape(securityContactName))\n\treq, err := runtime.NewRequest(ctx, http.MethodPatch, runtime.JoinPaths(client.ep, urlPath))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treqQP := req.Raw().URL.Query()\n\treqQP.Set(\"api-version\", \"2017-08-01-preview\")\n\treq.Raw().URL.RawQuery = reqQP.Encode()\n\treq.Raw().Header.Set(\"Accept\", \"application/json\")\n\treturn req, runtime.MarshalAsJSON(req, securityContact)\n}", "title": "" }, { "docid": "fa8d1cdb68dbd46227de7d30788b0b68", "score": "0.64497805", "text": "func (client *SecretsClient) updateCreateRequest(ctx context.Context, resourceGroupName string, profileName string, secretName string, secretProperties SecretProperties, options *SecretsBeginUpdateOptions) (*policy.Request, error) {\n\turlPath := \"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/secrets/{secretName}\"\n\tif resourceGroupName == \"\" {\n\t\treturn nil, errors.New(\"parameter resourceGroupName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{resourceGroupName}\", url.PathEscape(resourceGroupName))\n\tif profileName == \"\" {\n\t\treturn nil, errors.New(\"parameter profileName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{profileName}\", url.PathEscape(profileName))\n\tif secretName == \"\" {\n\t\treturn nil, errors.New(\"parameter secretName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{secretName}\", url.PathEscape(secretName))\n\tif client.subscriptionID == \"\" {\n\t\treturn nil, errors.New(\"parameter client.subscriptionID cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{subscriptionId}\", url.PathEscape(client.subscriptionID))\n\treq, err := runtime.NewRequest(ctx, http.MethodPatch, runtime.JoinPaths(client.ep, urlPath))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treqQP := req.Raw().URL.Query()\n\treqQP.Set(\"api-version\", \"2020-09-01\")\n\treq.Raw().URL.RawQuery = reqQP.Encode()\n\treq.Raw().Header.Set(\"Accept\", \"application/json\")\n\treturn req, runtime.MarshalAsJSON(req, secretProperties)\n}", "title": "" }, { "docid": "b62f279bbb5c3d817724a450990eae2d", "score": "0.64461744", "text": "func (client *EnvironmentsClient) updateCreateRequest(ctx context.Context, resourceGroupName string, labName string, userName string, name string, dtlEnvironment DtlEnvironmentFragment, options *EnvironmentsClientUpdateOptions) (*policy.Request, error) {\n\turlPath := \"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/users/{userName}/environments/{name}\"\n\tif client.subscriptionID == \"\" {\n\t\treturn nil, errors.New(\"parameter client.subscriptionID cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{subscriptionId}\", url.PathEscape(client.subscriptionID))\n\tif resourceGroupName == \"\" {\n\t\treturn nil, errors.New(\"parameter resourceGroupName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{resourceGroupName}\", url.PathEscape(resourceGroupName))\n\tif labName == \"\" {\n\t\treturn nil, errors.New(\"parameter labName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{labName}\", url.PathEscape(labName))\n\tif userName == \"\" {\n\t\treturn nil, errors.New(\"parameter userName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{userName}\", url.PathEscape(userName))\n\tif name == \"\" {\n\t\treturn nil, errors.New(\"parameter name cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{name}\", url.PathEscape(name))\n\treq, err := runtime.NewRequest(ctx, http.MethodPatch, runtime.JoinPaths(client.host, urlPath))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treqQP := req.Raw().URL.Query()\n\treqQP.Set(\"api-version\", \"2018-09-15\")\n\treq.Raw().URL.RawQuery = reqQP.Encode()\n\treq.Raw().Header.Set(\"Accept\", \"application/json\")\n\treturn req, runtime.MarshalAsJSON(req, dtlEnvironment)\n}", "title": "" }, { "docid": "556fa951b996babd30602e704fbf437a", "score": "0.64254105", "text": "func (client *CacheRulesClient) updateCreateRequest(ctx context.Context, resourceGroupName string, registryName string, cacheRuleName string, cacheRuleUpdateParameters CacheRuleUpdateParameters, options *CacheRulesClientBeginUpdateOptions) (*policy.Request, error) {\n\turlPath := \"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/cacheRules/{cacheRuleName}\"\n\turlPath = strings.ReplaceAll(urlPath, \"{subscriptionId}\", url.PathEscape(client.subscriptionID))\n\tif resourceGroupName == \"\" {\n\t\treturn nil, errors.New(\"parameter resourceGroupName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{resourceGroupName}\", url.PathEscape(resourceGroupName))\n\tif registryName == \"\" {\n\t\treturn nil, errors.New(\"parameter registryName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{registryName}\", url.PathEscape(registryName))\n\tif cacheRuleName == \"\" {\n\t\treturn nil, errors.New(\"parameter cacheRuleName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{cacheRuleName}\", url.PathEscape(cacheRuleName))\n\treq, err := runtime.NewRequest(ctx, http.MethodPatch, runtime.JoinPaths(client.internal.Endpoint(), urlPath))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treqQP := req.Raw().URL.Query()\n\treqQP.Set(\"api-version\", \"2023-01-01-preview\")\n\treq.Raw().URL.RawQuery = reqQP.Encode()\n\treq.Raw().Header[\"Accept\"] = []string{\"application/json\"}\n\tif err := runtime.MarshalAsJSON(req, cacheRuleUpdateParameters); err != nil {\n\t\treturn nil, err\n\t}\n\treturn req, nil\n}", "title": "" }, { "docid": "2095673aaac2f5095074a2ed12a95a37", "score": "0.63979113", "text": "func (client *EnvironmentsClient) updateCreateRequest(ctx context.Context, resourceGroupName string, labName string, userName string, name string, dtlEnvironment DtlEnvironmentFragment, options *EnvironmentsUpdateOptions) (*policy.Request, error) {\n\turlPath := \"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/users/{userName}/environments/{name}\"\n\tif client.subscriptionID == \"\" {\n\t\treturn nil, errors.New(\"parameter client.subscriptionID cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{subscriptionId}\", url.PathEscape(client.subscriptionID))\n\tif resourceGroupName == \"\" {\n\t\treturn nil, errors.New(\"parameter resourceGroupName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{resourceGroupName}\", url.PathEscape(resourceGroupName))\n\tif labName == \"\" {\n\t\treturn nil, errors.New(\"parameter labName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{labName}\", url.PathEscape(labName))\n\tif userName == \"\" {\n\t\treturn nil, errors.New(\"parameter userName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{userName}\", url.PathEscape(userName))\n\tif name == \"\" {\n\t\treturn nil, errors.New(\"parameter name cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{name}\", url.PathEscape(name))\n\treq, err := runtime.NewRequest(ctx, http.MethodPatch, runtime.JoinPaths(client.ep, urlPath))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treqQP := req.Raw().URL.Query()\n\treqQP.Set(\"api-version\", \"2018-09-15\")\n\treq.Raw().URL.RawQuery = reqQP.Encode()\n\treq.Raw().Header.Set(\"Accept\", \"application/json\")\n\treturn req, runtime.MarshalAsJSON(req, dtlEnvironment)\n}", "title": "" }, { "docid": "4b93e48453d1c0cee27dcc00199cb045", "score": "0.6384203", "text": "func (client *StorageAccountsClient) updateCreateRequest(ctx context.Context, resourceGroupName string, accountName string, storageAccountName string, options *StorageAccountsClientUpdateOptions) (*policy.Request, error) {\n\turlPath := \"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataLakeAnalytics/accounts/{accountName}/storageAccounts/{storageAccountName}\"\n\tif client.subscriptionID == \"\" {\n\t\treturn nil, errors.New(\"parameter client.subscriptionID cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{subscriptionId}\", url.PathEscape(client.subscriptionID))\n\tif resourceGroupName == \"\" {\n\t\treturn nil, errors.New(\"parameter resourceGroupName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{resourceGroupName}\", url.PathEscape(resourceGroupName))\n\tif accountName == \"\" {\n\t\treturn nil, errors.New(\"parameter accountName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{accountName}\", url.PathEscape(accountName))\n\tif storageAccountName == \"\" {\n\t\treturn nil, errors.New(\"parameter storageAccountName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{storageAccountName}\", url.PathEscape(storageAccountName))\n\treq, err := runtime.NewRequest(ctx, http.MethodPatch, runtime.JoinPaths(client.internal.Endpoint(), urlPath))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treqQP := req.Raw().URL.Query()\n\treqQP.Set(\"api-version\", \"2019-11-01-preview\")\n\treq.Raw().URL.RawQuery = reqQP.Encode()\n\treq.Raw().Header[\"Accept\"] = []string{\"application/json\"}\n\tif options != nil && options.Parameters != nil {\n\t\treturn req, runtime.MarshalAsJSON(req, *options.Parameters)\n\t}\n\treturn req, nil\n}", "title": "" }, { "docid": "9973e59709f97a03d956bd3687950895", "score": "0.6358358", "text": "func (client *AzureBareMetalInstancesClient) updateCreateRequest(ctx context.Context, resourceGroupName string, azureBareMetalInstanceName string, tagsParameter Tags, options *AzureBareMetalInstancesClientUpdateOptions) (*policy.Request, error) {\n\turlPath := \"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.BareMetalInfrastructure/bareMetalInstances/{azureBareMetalInstanceName}\"\n\tif client.subscriptionID == \"\" {\n\t\treturn nil, errors.New(\"parameter client.subscriptionID cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{subscriptionId}\", url.PathEscape(client.subscriptionID))\n\tif resourceGroupName == \"\" {\n\t\treturn nil, errors.New(\"parameter resourceGroupName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{resourceGroupName}\", url.PathEscape(resourceGroupName))\n\tif azureBareMetalInstanceName == \"\" {\n\t\treturn nil, errors.New(\"parameter azureBareMetalInstanceName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{azureBareMetalInstanceName}\", url.PathEscape(azureBareMetalInstanceName))\n\treq, err := runtime.NewRequest(ctx, http.MethodPatch, runtime.JoinPaths(client.internal.Endpoint(), urlPath))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treqQP := req.Raw().URL.Query()\n\treqQP.Set(\"api-version\", \"2021-08-09\")\n\treq.Raw().URL.RawQuery = reqQP.Encode()\n\treq.Raw().Header[\"Accept\"] = []string{\"application/json\"}\n\treturn req, runtime.MarshalAsJSON(req, tagsParameter)\n}", "title": "" }, { "docid": "eb7e31902bf74e280dc5edba07a933a9", "score": "0.63576204", "text": "func CreateUpdateConfigRuleRequest() (request *UpdateConfigRuleRequest) {\n\trequest = &UpdateConfigRuleRequest{\n\t\tRpcRequest: &requests.RpcRequest{},\n\t}\n\trequest.InitWithApiInfo(\"Config\", \"2020-09-07\", \"UpdateConfigRule\", \"\", \"\")\n\trequest.Method = requests.POST\n\treturn\n}", "title": "" }, { "docid": "911038b6abaa8db6fa388d9d384053d4", "score": "0.6340367", "text": "func (client *GalleryApplicationVersionsClient) updateCreateRequest(ctx context.Context, resourceGroupName string, galleryName string, galleryApplicationName string, galleryApplicationVersionName string, galleryApplicationVersion GalleryApplicationVersionUpdate, options *GalleryApplicationVersionsClientBeginUpdateOptions) (*policy.Request, error) {\n\turlPath := \"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/applications/{galleryApplicationName}/versions/{galleryApplicationVersionName}\"\n\tif client.subscriptionID == \"\" {\n\t\treturn nil, errors.New(\"parameter client.subscriptionID cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{subscriptionId}\", url.PathEscape(client.subscriptionID))\n\tif resourceGroupName == \"\" {\n\t\treturn nil, errors.New(\"parameter resourceGroupName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{resourceGroupName}\", url.PathEscape(resourceGroupName))\n\tif galleryName == \"\" {\n\t\treturn nil, errors.New(\"parameter galleryName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{galleryName}\", url.PathEscape(galleryName))\n\tif galleryApplicationName == \"\" {\n\t\treturn nil, errors.New(\"parameter galleryApplicationName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{galleryApplicationName}\", url.PathEscape(galleryApplicationName))\n\tif galleryApplicationVersionName == \"\" {\n\t\treturn nil, errors.New(\"parameter galleryApplicationVersionName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{galleryApplicationVersionName}\", url.PathEscape(galleryApplicationVersionName))\n\treq, err := runtime.NewRequest(ctx, http.MethodPatch, runtime.JoinPaths(client.host, urlPath))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treqQP := req.Raw().URL.Query()\n\treqQP.Set(\"api-version\", \"2022-03-03\")\n\treq.Raw().URL.RawQuery = reqQP.Encode()\n\treq.Raw().Header[\"Accept\"] = []string{\"application/json\"}\n\treturn req, runtime.MarshalAsJSON(req, galleryApplicationVersion)\n}", "title": "" }, { "docid": "73e02b1a03ac5377e4f8a9167d89c5b3", "score": "0.6334717", "text": "func CreateUpdateExtendfilesRequest() (request *UpdateExtendfilesRequest) {\n\trequest = &UpdateExtendfilesRequest{\n\t\tRoaRequest: &requests.RoaRequest{},\n\t}\n\trequest.InitWithApiInfo(\"elasticsearch\", \"2017-06-13\", \"UpdateExtendfiles\", \"/openapi/logstashes/[InstanceId]/extendfiles\", \"elasticsearch\", \"openAPI\")\n\trequest.Method = requests.PUT\n\treturn\n}", "title": "" }, { "docid": "4ea4d1d2552502f82d7eda774d406d52", "score": "0.63083225", "text": "func (client *SecretsClient) updateCreateRequest(ctx context.Context, resourceGroupName string, labName string, userName string, name string, secret SecretFragment, options *SecretsClientUpdateOptions) (*policy.Request, error) {\n\turlPath := \"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/users/{userName}/secrets/{name}\"\n\tif client.subscriptionID == \"\" {\n\t\treturn nil, errors.New(\"parameter client.subscriptionID cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{subscriptionId}\", url.PathEscape(client.subscriptionID))\n\tif resourceGroupName == \"\" {\n\t\treturn nil, errors.New(\"parameter resourceGroupName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{resourceGroupName}\", url.PathEscape(resourceGroupName))\n\tif labName == \"\" {\n\t\treturn nil, errors.New(\"parameter labName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{labName}\", url.PathEscape(labName))\n\tif userName == \"\" {\n\t\treturn nil, errors.New(\"parameter userName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{userName}\", url.PathEscape(userName))\n\tif name == \"\" {\n\t\treturn nil, errors.New(\"parameter name cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{name}\", url.PathEscape(name))\n\treq, err := runtime.NewRequest(ctx, http.MethodPatch, runtime.JoinPaths(client.internal.Endpoint(), urlPath))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treqQP := req.Raw().URL.Query()\n\treqQP.Set(\"api-version\", \"2018-09-15\")\n\treq.Raw().URL.RawQuery = reqQP.Encode()\n\treq.Raw().Header[\"Accept\"] = []string{\"application/json\"}\n\treturn req, runtime.MarshalAsJSON(req, secret)\n}", "title": "" }, { "docid": "cc61580f9702ff04bb5eb8941ca1178a", "score": "0.62929714", "text": "func CreateUpdateOpsItemRequest() (request *UpdateOpsItemRequest) {\n\trequest = &UpdateOpsItemRequest{\n\t\tRpcRequest: &requests.RpcRequest{},\n\t}\n\trequest.InitWithApiInfo(\"oos\", \"2019-06-01\", \"UpdateOpsItem\", \"oos\", \"openAPI\")\n\trequest.Method = requests.POST\n\treturn\n}", "title": "" }, { "docid": "da81d694c9c1a859bab0e684cdf5d9fc", "score": "0.62806726", "text": "func (client *L3NetworksClient) updateCreateRequest(ctx context.Context, resourceGroupName string, l3NetworkName string, l3NetworkUpdateParameters L3NetworkPatchParameters, options *L3NetworksClientUpdateOptions) (*policy.Request, error) {\n\turlPath := \"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetworkCloud/l3Networks/{l3NetworkName}\"\n\turlPath = strings.ReplaceAll(urlPath, \"{subscriptionId}\", url.PathEscape(client.subscriptionID))\n\tif resourceGroupName == \"\" {\n\t\treturn nil, errors.New(\"parameter resourceGroupName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{resourceGroupName}\", url.PathEscape(resourceGroupName))\n\tif l3NetworkName == \"\" {\n\t\treturn nil, errors.New(\"parameter l3NetworkName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{l3NetworkName}\", url.PathEscape(l3NetworkName))\n\treq, err := runtime.NewRequest(ctx, http.MethodPatch, runtime.JoinPaths(client.internal.Endpoint(), urlPath))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treqQP := req.Raw().URL.Query()\n\treqQP.Set(\"api-version\", \"2023-07-01\")\n\treq.Raw().URL.RawQuery = reqQP.Encode()\n\treq.Raw().Header[\"Accept\"] = []string{\"application/json\"}\n\tif err := runtime.MarshalAsJSON(req, l3NetworkUpdateParameters); err != nil {\n\t\treturn nil, err\n\t}\n\treturn req, nil\n}", "title": "" }, { "docid": "096b8bcaacbbbe4db04579b932b06bd6", "score": "0.6268762", "text": "func (client *TagsClient) createOrUpdateCreateRequest(ctx context.Context, tagName string, options *TagsCreateOrUpdateOptions) (*azcore.Request, error) {\n\turlPath := \"/subscriptions/{subscriptionId}/tagNames/{tagName}\"\n\turlPath = strings.ReplaceAll(urlPath, \"{tagName}\", url.PathEscape(tagName))\n\turlPath = strings.ReplaceAll(urlPath, \"{subscriptionId}\", url.PathEscape(client.subscriptionID))\n\treq, err := azcore.NewRequest(ctx, http.MethodPut, azcore.JoinPaths(client.con.Endpoint(), urlPath))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treq.Telemetry(telemetryInfo)\n\tquery := req.URL.Query()\n\tquery.Set(\"api-version\", \"2020-06-01\")\n\treq.URL.RawQuery = query.Encode()\n\treq.Header.Set(\"Accept\", \"application/json\")\n\treturn req, nil\n}", "title": "" }, { "docid": "b96704873e99ba23305d2138ab077882", "score": "0.6260438", "text": "func (client *ResourceGroupsClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, parameters ResourceGroup, options *ResourceGroupsCreateOrUpdateOptions) (*policy.Request, error) {\n\turlPath := \"/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}\"\n\tif resourceGroupName == \"\" {\n\t\treturn nil, errors.New(\"parameter resourceGroupName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{resourceGroupName}\", url.PathEscape(resourceGroupName))\n\tif client.subscriptionID == \"\" {\n\t\treturn nil, errors.New(\"parameter client.subscriptionID cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{subscriptionId}\", url.PathEscape(client.subscriptionID))\n\treq, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.ep, urlPath))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treqQP := req.Raw().URL.Query()\n\treqQP.Set(\"api-version\", \"2021-04-01\")\n\treq.Raw().URL.RawQuery = reqQP.Encode()\n\treq.Raw().Header.Set(\"Accept\", \"application/json\")\n\treturn req, runtime.MarshalAsJSON(req, parameters)\n}", "title": "" }, { "docid": "3f295f94a12a09843b796049d837c7f6", "score": "0.6252983", "text": "func (c *Client) BuildUpdateRequest(ctx context.Context, v interface{}) (*http.Request, error) {\n\tvar (\n\t\tid int64\n\t)\n\t{\n\t\tp, ok := v.(*people.UpdatePayload)\n\t\tif !ok {\n\t\t\treturn nil, goahttp.ErrInvalidType(\"people\", \"update\", \"*people.UpdatePayload\", v)\n\t\t}\n\t\tid = p.ID\n\t}\n\tu := &url.URL{Scheme: c.scheme, Host: c.host, Path: UpdatePeoplePath(id)}\n\treq, err := http.NewRequest(\"PUT\", u.String(), nil)\n\tif err != nil {\n\t\treturn nil, goahttp.ErrInvalidURL(\"people\", \"update\", u.String(), err)\n\t}\n\tif ctx != nil {\n\t\treq = req.WithContext(ctx)\n\t}\n\n\treturn req, nil\n}", "title": "" }, { "docid": "4194034f9608a6c428617bd9e53bae66", "score": "0.6252834", "text": "func (client *VirtualNetworksClient) updateCreateRequest(ctx context.Context, resourceGroupName string, labName string, name string, virtualNetwork VirtualNetworkFragment, options *VirtualNetworksClientUpdateOptions) (*policy.Request, error) {\n\turlPath := \"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/virtualnetworks/{name}\"\n\tif client.subscriptionID == \"\" {\n\t\treturn nil, errors.New(\"parameter client.subscriptionID cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{subscriptionId}\", url.PathEscape(client.subscriptionID))\n\tif resourceGroupName == \"\" {\n\t\treturn nil, errors.New(\"parameter resourceGroupName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{resourceGroupName}\", url.PathEscape(resourceGroupName))\n\tif labName == \"\" {\n\t\treturn nil, errors.New(\"parameter labName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{labName}\", url.PathEscape(labName))\n\tif name == \"\" {\n\t\treturn nil, errors.New(\"parameter name cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{name}\", url.PathEscape(name))\n\treq, err := runtime.NewRequest(ctx, http.MethodPatch, runtime.JoinPaths(client.internal.Endpoint(), urlPath))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treqQP := req.Raw().URL.Query()\n\treqQP.Set(\"api-version\", \"2018-09-15\")\n\treq.Raw().URL.RawQuery = reqQP.Encode()\n\treq.Raw().Header[\"Accept\"] = []string{\"application/json\"}\n\treturn req, runtime.MarshalAsJSON(req, virtualNetwork)\n}", "title": "" }, { "docid": "513e92bb99bdf394638ca94fcf1b5e4a", "score": "0.6251152", "text": "func (client *PlansClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, name string, appServicePlan Plan, options *PlansClientBeginCreateOrUpdateOptions) (*policy.Request, error) {\n\turlPath := \"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/serverfarms/{name}\"\n\tif resourceGroupName == \"\" {\n\t\treturn nil, errors.New(\"parameter resourceGroupName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{resourceGroupName}\", url.PathEscape(resourceGroupName))\n\tif name == \"\" {\n\t\treturn nil, errors.New(\"parameter name cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{name}\", url.PathEscape(name))\n\tif client.subscriptionID == \"\" {\n\t\treturn nil, errors.New(\"parameter client.subscriptionID cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{subscriptionId}\", url.PathEscape(client.subscriptionID))\n\treq, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.internal.Endpoint(), urlPath))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treqQP := req.Raw().URL.Query()\n\treqQP.Set(\"api-version\", \"2018-02-01\")\n\treq.Raw().URL.RawQuery = reqQP.Encode()\n\treq.Raw().Header[\"Accept\"] = []string{\"application/json\"}\n\treturn req, runtime.MarshalAsJSON(req, appServicePlan)\n}", "title": "" }, { "docid": "7b0d8649537e47db70a9982853d6368a", "score": "0.6241913", "text": "func CreateUpdateEnterpriseCustomInfoRequest() (request *UpdateEnterpriseCustomInfoRequest) {\n\trequest = &UpdateEnterpriseCustomInfoRequest{\n\t\tRpcRequest: &requests.RpcRequest{},\n\t}\n\trequest.InitWithApiInfo(\"finmall\", \"2018-07-23\", \"UpdateEnterpriseCustomInfo\", \"finmall\", \"openAPI\")\n\treturn\n}", "title": "" }, { "docid": "7422f876ce4d4e92b98026f2f3b34a20", "score": "0.6230001", "text": "func (client *TagsClient) updateAtScopeCreateRequest(ctx context.Context, scope string, parameters TagsPatchResource, options *TagsUpdateAtScopeOptions) (*azcore.Request, error) {\n\turlPath := \"/{scope}/providers/Microsoft.Resources/tags/default\"\n\turlPath = strings.ReplaceAll(urlPath, \"{scope}\", scope)\n\treq, err := azcore.NewRequest(ctx, http.MethodPatch, azcore.JoinPaths(client.con.Endpoint(), urlPath))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treq.Telemetry(telemetryInfo)\n\tquery := req.URL.Query()\n\tquery.Set(\"api-version\", \"2020-06-01\")\n\treq.URL.RawQuery = query.Encode()\n\treq.Header.Set(\"Accept\", \"application/json\")\n\treturn req, req.MarshalAsJSON(parameters)\n}", "title": "" }, { "docid": "1e5afeca9b4ca2da0ac7d4f3ec382887", "score": "0.6182457", "text": "func (client *SensorsClient) triggerTiPackageUpdateCreateRequest(ctx context.Context, scope string, sensorName string, options *SensorsClientTriggerTiPackageUpdateOptions) (*policy.Request, error) {\n\turlPath := \"/{scope}/providers/Microsoft.IoTSecurity/sensors/{sensorName}/triggerTiPackageUpdate\"\n\turlPath = strings.ReplaceAll(urlPath, \"{scope}\", scope)\n\tif sensorName == \"\" {\n\t\treturn nil, errors.New(\"parameter sensorName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{sensorName}\", url.PathEscape(sensorName))\n\treq, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.internal.Endpoint(), urlPath))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treqQP := req.Raw().URL.Query()\n\treqQP.Set(\"api-version\", \"2021-02-01-preview\")\n\treq.Raw().URL.RawQuery = reqQP.Encode()\n\treq.Raw().Header[\"Accept\"] = []string{\"application/json\"}\n\treturn req, nil\n}", "title": "" }, { "docid": "9edcef29771e27d7ab33bfa338cf1f59", "score": "0.6170293", "text": "func (_BaseLibrary *BaseLibraryTransactor) UpdateRequest(opts *bind.TransactOpts) (*types.Transaction, error) {\n\treturn _BaseLibrary.contract.Transact(opts, \"updateRequest\")\n}", "title": "" }, { "docid": "373e9d048208c9d6baff2b6273c83272", "score": "0.616935", "text": "func (client *CredentialSetsClient) updateCreateRequest(ctx context.Context, resourceGroupName string, registryName string, credentialSetName string, credentialSetUpdateParameters CredentialSetUpdateParameters, options *CredentialSetsClientBeginUpdateOptions) (*policy.Request, error) {\n\turlPath := \"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/credentialSets/{credentialSetName}\"\n\turlPath = strings.ReplaceAll(urlPath, \"{subscriptionId}\", url.PathEscape(client.subscriptionID))\n\tif resourceGroupName == \"\" {\n\t\treturn nil, errors.New(\"parameter resourceGroupName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{resourceGroupName}\", url.PathEscape(resourceGroupName))\n\tif registryName == \"\" {\n\t\treturn nil, errors.New(\"parameter registryName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{registryName}\", url.PathEscape(registryName))\n\tif credentialSetName == \"\" {\n\t\treturn nil, errors.New(\"parameter credentialSetName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{credentialSetName}\", url.PathEscape(credentialSetName))\n\treq, err := runtime.NewRequest(ctx, http.MethodPatch, runtime.JoinPaths(client.internal.Endpoint(), urlPath))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treqQP := req.Raw().URL.Query()\n\treqQP.Set(\"api-version\", \"2023-01-01-preview\")\n\treq.Raw().URL.RawQuery = reqQP.Encode()\n\treq.Raw().Header[\"Accept\"] = []string{\"application/json\"}\n\tif err := runtime.MarshalAsJSON(req, credentialSetUpdateParameters); err != nil {\n\t\treturn nil, err\n\t}\n\treturn req, nil\n}", "title": "" }, { "docid": "799236ad81320f712f52725039d2cae5", "score": "0.6163662", "text": "func (client *TableResourcesClient) createUpdateTableCreateRequest(ctx context.Context, resourceGroupName string, accountName string, tableName string, createUpdateTableParameters TableCreateUpdateParameters, options *TableResourcesBeginCreateUpdateTableOptions) (*policy.Request, error) {\n\turlPath := \"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/tables/{tableName}\"\n\tif client.subscriptionID == \"\" {\n\t\treturn nil, errors.New(\"parameter client.subscriptionID cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{subscriptionId}\", url.PathEscape(client.subscriptionID))\n\tif resourceGroupName == \"\" {\n\t\treturn nil, errors.New(\"parameter resourceGroupName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{resourceGroupName}\", url.PathEscape(resourceGroupName))\n\tif accountName == \"\" {\n\t\treturn nil, errors.New(\"parameter accountName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{accountName}\", url.PathEscape(accountName))\n\tif tableName == \"\" {\n\t\treturn nil, errors.New(\"parameter tableName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{tableName}\", url.PathEscape(tableName))\n\treq, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.ep, urlPath))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treqQP := req.Raw().URL.Query()\n\treqQP.Set(\"api-version\", \"2021-10-15\")\n\treq.Raw().URL.RawQuery = reqQP.Encode()\n\treq.Raw().Header.Set(\"Accept\", \"application/json\")\n\treturn req, runtime.MarshalAsJSON(req, createUpdateTableParameters)\n}", "title": "" }, { "docid": "7946cefd33d420290c85ee3db756d8e4", "score": "0.6141503", "text": "func (client *ServiceClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, communicationServiceName string, options *ServiceClientBeginCreateOrUpdateOptions) (*policy.Request, error) {\n\turlPath := \"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Communication/communicationServices/{communicationServiceName}\"\n\tif client.subscriptionID == \"\" {\n\t\treturn nil, errors.New(\"parameter client.subscriptionID cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{subscriptionId}\", url.PathEscape(client.subscriptionID))\n\tif resourceGroupName == \"\" {\n\t\treturn nil, errors.New(\"parameter resourceGroupName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{resourceGroupName}\", url.PathEscape(resourceGroupName))\n\tif communicationServiceName == \"\" {\n\t\treturn nil, errors.New(\"parameter communicationServiceName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{communicationServiceName}\", url.PathEscape(communicationServiceName))\n\treq, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.host, urlPath))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treqQP := req.Raw().URL.Query()\n\treqQP.Set(\"api-version\", \"2020-08-20\")\n\treq.Raw().URL.RawQuery = reqQP.Encode()\n\treq.Raw().Header[\"Accept\"] = []string{\"application/json\"}\n\tif options != nil && options.Parameters != nil {\n\t\treturn req, runtime.MarshalAsJSON(req, *options.Parameters)\n\t}\n\treturn req, nil\n}", "title": "" }, { "docid": "1441390fb1d4a306597ffd57e2e11064", "score": "0.61408633", "text": "func (client *ReplicationNetworkMappingsClient) updateCreateRequest(ctx context.Context, resourceName string, resourceGroupName string, fabricName string, networkName string, networkMappingName string, input UpdateNetworkMappingInput, options *ReplicationNetworkMappingsClientBeginUpdateOptions) (*policy.Request, error) {\n\turlPath := \"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationNetworks/{networkName}/replicationNetworkMappings/{networkMappingName}\"\n\tif resourceName == \"\" {\n\t\treturn nil, errors.New(\"parameter resourceName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{resourceName}\", url.PathEscape(resourceName))\n\tif resourceGroupName == \"\" {\n\t\treturn nil, errors.New(\"parameter resourceGroupName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{resourceGroupName}\", url.PathEscape(resourceGroupName))\n\tif client.subscriptionID == \"\" {\n\t\treturn nil, errors.New(\"parameter client.subscriptionID cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{subscriptionId}\", url.PathEscape(client.subscriptionID))\n\tif fabricName == \"\" {\n\t\treturn nil, errors.New(\"parameter fabricName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{fabricName}\", url.PathEscape(fabricName))\n\tif networkName == \"\" {\n\t\treturn nil, errors.New(\"parameter networkName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{networkName}\", url.PathEscape(networkName))\n\tif networkMappingName == \"\" {\n\t\treturn nil, errors.New(\"parameter networkMappingName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{networkMappingName}\", url.PathEscape(networkMappingName))\n\treq, err := runtime.NewRequest(ctx, http.MethodPatch, runtime.JoinPaths(client.internal.Endpoint(), urlPath))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treqQP := req.Raw().URL.Query()\n\treqQP.Set(\"api-version\", \"2022-10-01\")\n\treq.Raw().URL.RawQuery = reqQP.Encode()\n\treq.Raw().Header[\"Accept\"] = []string{\"application/json\"}\n\treturn req, runtime.MarshalAsJSON(req, input)\n}", "title": "" }, { "docid": "7c037d553ae1305f9b4f57ca7e21b76b", "score": "0.61408156", "text": "func (client *RolloutsClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, rolloutName string, options *RolloutsClientBeginCreateOrUpdateOptions) (*policy.Request, error) {\n\turlPath := \"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DeploymentManager/rollouts/{rolloutName}\"\n\tif client.subscriptionID == \"\" {\n\t\treturn nil, errors.New(\"parameter client.subscriptionID cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{subscriptionId}\", url.PathEscape(client.subscriptionID))\n\tif resourceGroupName == \"\" {\n\t\treturn nil, errors.New(\"parameter resourceGroupName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{resourceGroupName}\", url.PathEscape(resourceGroupName))\n\tif rolloutName == \"\" {\n\t\treturn nil, errors.New(\"parameter rolloutName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{rolloutName}\", url.PathEscape(rolloutName))\n\treq, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.internal.Endpoint(), urlPath))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treqQP := req.Raw().URL.Query()\n\treqQP.Set(\"api-version\", \"2019-11-01-preview\")\n\treq.Raw().URL.RawQuery = reqQP.Encode()\n\treq.Raw().Header[\"Accept\"] = []string{\"application/json\"}\n\tif options != nil && options.RolloutRequest != nil {\n\t\treturn req, runtime.MarshalAsJSON(req, *options.RolloutRequest)\n\t}\n\treturn req, nil\n}", "title": "" }, { "docid": "10510aaf1945646d71e80db5bd618ac2", "score": "0.6132482", "text": "func (client *PartnerNamespacesClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, partnerNamespaceName string, partnerNamespaceInfo PartnerNamespace, options *PartnerNamespacesClientBeginCreateOrUpdateOptions) (*policy.Request, error) {\n\turlPath := \"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/partnerNamespaces/{partnerNamespaceName}\"\n\tif client.subscriptionID == \"\" {\n\t\treturn nil, errors.New(\"parameter client.subscriptionID cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{subscriptionId}\", url.PathEscape(client.subscriptionID))\n\tif resourceGroupName == \"\" {\n\t\treturn nil, errors.New(\"parameter resourceGroupName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{resourceGroupName}\", url.PathEscape(resourceGroupName))\n\tif partnerNamespaceName == \"\" {\n\t\treturn nil, errors.New(\"parameter partnerNamespaceName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{partnerNamespaceName}\", url.PathEscape(partnerNamespaceName))\n\treq, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.internal.Endpoint(), urlPath))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treqQP := req.Raw().URL.Query()\n\treqQP.Set(\"api-version\", \"2023-06-01-preview\")\n\treq.Raw().URL.RawQuery = reqQP.Encode()\n\treq.Raw().Header[\"Accept\"] = []string{\"application/json\"}\n\treturn req, runtime.MarshalAsJSON(req, partnerNamespaceInfo)\n}", "title": "" }, { "docid": "6a85d7b1c79a5119f80b9d257ccd0f6e", "score": "0.6118431", "text": "func CreateUpdateCircuitBreakerRuleRequest() (request *UpdateCircuitBreakerRuleRequest) {\n\trequest = &UpdateCircuitBreakerRuleRequest{\n\t\tRpcRequest: &requests.RpcRequest{},\n\t}\n\trequest.InitWithApiInfo(\"mse\", \"2019-05-31\", \"UpdateCircuitBreakerRule\", \"mse\", \"openAPI\")\n\trequest.Method = requests.POST\n\treturn\n}", "title": "" }, { "docid": "9b2f2ed2a028f3417c2a91ee30f418c9", "score": "0.61175084", "text": "func (client *SensorsClient) createOrUpdateCreateRequest(ctx context.Context, scope string, sensorName string, sensorModel SensorModel, options *SensorsClientCreateOrUpdateOptions) (*policy.Request, error) {\n\turlPath := \"/{scope}/providers/Microsoft.IoTSecurity/sensors/{sensorName}\"\n\turlPath = strings.ReplaceAll(urlPath, \"{scope}\", scope)\n\tif sensorName == \"\" {\n\t\treturn nil, errors.New(\"parameter sensorName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{sensorName}\", url.PathEscape(sensorName))\n\treq, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.internal.Endpoint(), urlPath))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treqQP := req.Raw().URL.Query()\n\treqQP.Set(\"api-version\", \"2021-02-01-preview\")\n\treq.Raw().URL.RawQuery = reqQP.Encode()\n\treq.Raw().Header[\"Accept\"] = []string{\"application/json\"}\n\treturn req, runtime.MarshalAsJSON(req, sensorModel)\n}", "title": "" }, { "docid": "9e88a011d386627adb33f4312799761e", "score": "0.6109473", "text": "func (client *IPGroupsClient) updateGroupsCreateRequest(ctx context.Context, resourceGroupName string, ipGroupsName string, parameters TagsObject, options *IPGroupsUpdateGroupsOptions) (*policy.Request, error) {\n\turlPath := \"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/ipGroups/{ipGroupsName}\"\n\tif resourceGroupName == \"\" {\n\t\treturn nil, errors.New(\"parameter resourceGroupName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{resourceGroupName}\", url.PathEscape(resourceGroupName))\n\tif ipGroupsName == \"\" {\n\t\treturn nil, errors.New(\"parameter ipGroupsName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{ipGroupsName}\", url.PathEscape(ipGroupsName))\n\tif client.subscriptionID == \"\" {\n\t\treturn nil, errors.New(\"parameter client.subscriptionID cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{subscriptionId}\", url.PathEscape(client.subscriptionID))\n\treq, err := runtime.NewRequest(ctx, http.MethodPatch, runtime.JoinPaths(client.ep, urlPath))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treqQP := req.Raw().URL.Query()\n\treqQP.Set(\"api-version\", \"2021-05-01\")\n\treq.Raw().URL.RawQuery = reqQP.Encode()\n\treq.Raw().Header.Set(\"Accept\", \"application/json\")\n\treturn req, runtime.MarshalAsJSON(req, parameters)\n}", "title": "" }, { "docid": "e7998ed754dea888266930305992f3d1", "score": "0.61038125", "text": "func (client *TableResourcesClient) createUpdateTableCreateRequest(ctx context.Context, resourceGroupName string, accountName string, tableName string, createUpdateTableParameters TableCreateUpdateParameters, options *TableResourcesBeginCreateUpdateTableOptions) (*azcore.Request, error) {\n\turlPath := \"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/tables/{tableName}\"\n\tif client.subscriptionID == \"\" {\n\t\treturn nil, errors.New(\"parameter client.subscriptionID cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{subscriptionId}\", url.PathEscape(client.subscriptionID))\n\tif resourceGroupName == \"\" {\n\t\treturn nil, errors.New(\"parameter resourceGroupName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{resourceGroupName}\", url.PathEscape(resourceGroupName))\n\tif accountName == \"\" {\n\t\treturn nil, errors.New(\"parameter accountName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{accountName}\", url.PathEscape(accountName))\n\tif tableName == \"\" {\n\t\treturn nil, errors.New(\"parameter tableName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{tableName}\", url.PathEscape(tableName))\n\treq, err := azcore.NewRequest(ctx, http.MethodPut, azcore.JoinPaths(client.con.Endpoint(), urlPath))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treq.Telemetry(telemetryInfo)\n\treqQP := req.URL.Query()\n\treqQP.Set(\"api-version\", \"2021-06-15\")\n\treq.URL.RawQuery = reqQP.Encode()\n\treq.Header.Set(\"Accept\", \"application/json\")\n\treturn req, req.MarshalAsJSON(createUpdateTableParameters)\n}", "title": "" }, { "docid": "19cc66bf9fb0ce265c6056857944955e", "score": "0.6094685", "text": "func (client *ManagersClient) updateExtendedInfoCreateRequest(ctx context.Context, resourceGroupName string, managerName string, ifMatch string, managerExtendedInfo ManagerExtendedInfo, options *ManagersClientUpdateExtendedInfoOptions) (*policy.Request, error) {\n\turlPath := \"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorSimple/managers/{managerName}/extendedInformation/vaultExtendedInfo\"\n\tif client.subscriptionID == \"\" {\n\t\treturn nil, errors.New(\"parameter client.subscriptionID cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{subscriptionId}\", url.PathEscape(client.subscriptionID))\n\tif resourceGroupName == \"\" {\n\t\treturn nil, errors.New(\"parameter resourceGroupName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{resourceGroupName}\", url.PathEscape(resourceGroupName))\n\tif managerName == \"\" {\n\t\treturn nil, errors.New(\"parameter managerName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{managerName}\", url.PathEscape(managerName))\n\treq, err := runtime.NewRequest(ctx, http.MethodPatch, runtime.JoinPaths(client.internal.Endpoint(), urlPath))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treqQP := req.Raw().URL.Query()\n\treqQP.Set(\"api-version\", \"2016-10-01\")\n\treq.Raw().URL.RawQuery = reqQP.Encode()\n\treq.Raw().Header[\"If-Match\"] = []string{ifMatch}\n\treq.Raw().Header[\"Accept\"] = []string{\"application/json\"}\n\treturn req, runtime.MarshalAsJSON(req, managerExtendedInfo)\n}", "title": "" }, { "docid": "6328ff40a94a41e92adcd37e5f55a0fd", "score": "0.6092351", "text": "func (client *ServicesClient) createOrUpdateCreateRequest(ctx context.Context, groupName string, serviceName string, parameters Service, options *ServicesClientBeginCreateOrUpdateOptions) (*policy.Request, error) {\n\turlPath := \"/subscriptions/{subscriptionId}/resourceGroups/{groupName}/providers/Microsoft.DataMigration/services/{serviceName}\"\n\tif client.subscriptionID == \"\" {\n\t\treturn nil, errors.New(\"parameter client.subscriptionID cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{subscriptionId}\", url.PathEscape(client.subscriptionID))\n\tif groupName == \"\" {\n\t\treturn nil, errors.New(\"parameter groupName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{groupName}\", url.PathEscape(groupName))\n\tif serviceName == \"\" {\n\t\treturn nil, errors.New(\"parameter serviceName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{serviceName}\", url.PathEscape(serviceName))\n\treq, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.internal.Endpoint(), urlPath))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treqQP := req.Raw().URL.Query()\n\treqQP.Set(\"api-version\", \"2021-06-30\")\n\treq.Raw().URL.RawQuery = reqQP.Encode()\n\treq.Raw().Header[\"Accept\"] = []string{\"application/json\"}\n\treturn req, runtime.MarshalAsJSON(req, parameters)\n}", "title": "" }, { "docid": "60170eea8f4ed7658307bf26b95aad21", "score": "0.60884154", "text": "func (client *DevicesClient) installUpdatesCreateRequest(ctx context.Context, deviceName string, resourceGroupName string, managerName string, options *DevicesClientBeginInstallUpdatesOptions) (*policy.Request, error) {\n\turlPath := \"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorSimple/managers/{managerName}/devices/{deviceName}/installUpdates\"\n\turlPath = strings.ReplaceAll(urlPath, \"{deviceName}\", deviceName)\n\turlPath = strings.ReplaceAll(urlPath, \"{subscriptionId}\", client.subscriptionID)\n\turlPath = strings.ReplaceAll(urlPath, \"{resourceGroupName}\", resourceGroupName)\n\turlPath = strings.ReplaceAll(urlPath, \"{managerName}\", managerName)\n\treq, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.internal.Endpoint(), urlPath))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treqQP := req.Raw().URL.Query()\n\treqQP.Set(\"api-version\", \"2017-06-01\")\n\treq.Raw().URL.RawQuery = reqQP.Encode()\n\treturn req, nil\n}", "title": "" } ]
feae78cfc7428bdbd145f3160970e52a
NewDescribeUPhoneAppRequest will create request of DescribeUPhoneApp action.
[ { "docid": "5363124cbc0c4a41581ac49f51d8f7ef", "score": "0.8689232", "text": "func (c *UPhoneClient) NewDescribeUPhoneAppRequest() *DescribeUPhoneAppRequest {\n\treq := &DescribeUPhoneAppRequest{}\n\n\t// setup request with client config\n\tc.Client.SetupRequest(req)\n\n\t// setup retryable with default retry policy (retry for non-create action and common error)\n\treq.SetRetryable(true)\n\treturn req\n}", "title": "" } ]
[ { "docid": "e9cdd0f56052becf4d927d6cbc89a5d2", "score": "0.76416063", "text": "func (c *UPhoneClient) NewDescribeUPhoneDetailByAppRequest() *DescribeUPhoneDetailByAppRequest {\n\treq := &DescribeUPhoneDetailByAppRequest{}\n\n\t// setup request with client config\n\tc.Client.SetupRequest(req)\n\n\t// setup retryable with default retry policy (retry for non-create action and common error)\n\treq.SetRetryable(true)\n\treturn req\n}", "title": "" }, { "docid": "2f5c3c46506fdba4df5392fc60e92590", "score": "0.7181613", "text": "func (c *UPhoneClient) NewDescribeUPhoneRequest() *DescribeUPhoneRequest {\n\treq := &DescribeUPhoneRequest{}\n\n\t// setup request with client config\n\tc.Client.SetupRequest(req)\n\n\t// setup retryable with default retry policy (retry for non-create action and common error)\n\treq.SetRetryable(true)\n\treturn req\n}", "title": "" }, { "docid": "d0b26f5e7c9c4ecfdfdcd9de2b30a448", "score": "0.6945462", "text": "func (c *UPhoneClient) NewDescribeUPhoneAppVersionRequest() *DescribeUPhoneAppVersionRequest {\n\treq := &DescribeUPhoneAppVersionRequest{}\n\n\t// setup request with client config\n\tc.Client.SetupRequest(req)\n\n\t// setup retryable with default retry policy (retry for non-create action and common error)\n\treq.SetRetryable(true)\n\treturn req\n}", "title": "" }, { "docid": "93694396bdcfb4af1a764c3123717e2b", "score": "0.6918504", "text": "func (c *UPhoneClient) NewCreateUPhoneAppRequest() *CreateUPhoneAppRequest {\n\treq := &CreateUPhoneAppRequest{}\n\n\t// setup request with client config\n\tc.Client.SetupRequest(req)\n\n\t// setup retryable with default retry policy (retry for non-create action and common error)\n\treq.SetRetryable(false)\n\treturn req\n}", "title": "" }, { "docid": "01e17fb63d58f0ddbd129f24a239bf01", "score": "0.67361236", "text": "func (c *UPhoneClient) NewDescribeUPhoneJobRequest() *DescribeUPhoneJobRequest {\n\treq := &DescribeUPhoneJobRequest{}\n\n\t// setup request with client config\n\tc.Client.SetupRequest(req)\n\n\t// setup retryable with default retry policy (retry for non-create action and common error)\n\treq.SetRetryable(true)\n\treturn req\n}", "title": "" }, { "docid": "89470ced515d59ae03f7eb8149e46716", "score": "0.66582847", "text": "func (c *UPhoneClient) NewDescribeUPhoneServerRequest() *DescribeUPhoneServerRequest {\n\treq := &DescribeUPhoneServerRequest{}\n\n\t// setup request with client config\n\tc.Client.SetupRequest(req)\n\n\t// setup retryable with default retry policy (retry for non-create action and common error)\n\treq.SetRetryable(true)\n\treturn req\n}", "title": "" }, { "docid": "c4c7d781bfb9ef09936a758463bb5d71", "score": "0.6498568", "text": "func (c *UPhoneClient) NewDescribeUPhoneImageRequest() *DescribeUPhoneImageRequest {\n\treq := &DescribeUPhoneImageRequest{}\n\n\t// setup request with client config\n\tc.Client.SetupRequest(req)\n\n\t// setup retryable with default retry policy (retry for non-create action and common error)\n\treq.SetRetryable(true)\n\treturn req\n}", "title": "" }, { "docid": "598582a16fe0f18291bf9fc6e5e177cd", "score": "0.63917935", "text": "func (c *UPhoneClient) NewDescribeUPhoneModelRequest() *DescribeUPhoneModelRequest {\n\treq := &DescribeUPhoneModelRequest{}\n\n\t// setup request with client config\n\tc.Client.SetupRequest(req)\n\n\t// setup retryable with default retry policy (retry for non-create action and common error)\n\treq.SetRetryable(true)\n\treturn req\n}", "title": "" }, { "docid": "a9e18f00e7573675c64d392c80705746", "score": "0.6099387", "text": "func NewDescribeDeployAppRequestWithoutParam() *DescribeDeployAppRequest {\n\n return &DescribeDeployAppRequest{\n JDCloudRequest: core.JDCloudRequest{\n URL: \"/regions/{regionId}/instances/{instanceId}/hardwareId/{hardwareId}/os/{osId}/edgeApp:describeDeployApp\",\n Method: \"POST\",\n Header: nil,\n Version: \"v2\",\n },\n }\n}", "title": "" }, { "docid": "dfde82d1d3cdd9771c5c9a132d95611f", "score": "0.60489905", "text": "func (c *UPhoneClient) NewDescribeUPhoneServerModelRequest() *DescribeUPhoneServerModelRequest {\n\treq := &DescribeUPhoneServerModelRequest{}\n\n\t// setup request with client config\n\tc.Client.SetupRequest(req)\n\n\t// setup retryable with default retry policy (retry for non-create action and common error)\n\treq.SetRetryable(true)\n\treturn req\n}", "title": "" }, { "docid": "d7a62af059c84e9e81c0bb464f24991d", "score": "0.59839356", "text": "func (c *UPhoneClient) NewDescribeUPhoneEipListRequest() *DescribeUPhoneEipListRequest {\n\treq := &DescribeUPhoneEipListRequest{}\n\n\t// setup request with client config\n\tc.Client.SetupRequest(req)\n\n\t// setup retryable with default retry policy (retry for non-create action and common error)\n\treq.SetRetryable(true)\n\treturn req\n}", "title": "" }, { "docid": "175b1255b723d0a4399f35f22457f55d", "score": "0.58102864", "text": "func CreateQueryMessageAppRequest() (request *QueryMessageAppRequest) {\n\trequest = &QueryMessageAppRequest{\n\t\tRpcRequest: &requests.RpcRequest{},\n\t}\n\trequest.InitWithApiInfo(\"live\", \"2016-11-01\", \"QueryMessageApp\", \"live\", \"openAPI\")\n\trequest.Method = requests.POST\n\treturn\n}", "title": "" }, { "docid": "9db3638174c88c9967b675f72ae07862", "score": "0.5730055", "text": "func (ac *AppClient) NewAppRequest() *omaha.Request {\n\treq := omaha.NewRequest()\n\treq.Version = ac.clientVersion\n\treq.UserID = ac.userID\n\treq.SessionID = ac.sessionID\n\tif ac.isMachine {\n\t\treq.IsMachine = 1\n\t}\n\n\tapp := req.AddApp(ac.appID, ac.version)\n\tapp.Track = ac.track\n\tapp.OEM = ac.oem\n\n\t// MachineID and BootID are non-standard fields used by CoreOS'\n\t// update_engine and Core Update. Copy their values from the\n\t// standard UserID and SessionID. Eventually the non-standard\n\t// fields should be deprecated.\n\tapp.MachineID = req.UserID\n\tapp.BootID = req.SessionID\n\n\treturn req\n}", "title": "" }, { "docid": "40930723a614e2bf55c1eea25f35caa6", "score": "0.5618195", "text": "func CreateDescribeProjectRequest() (request *DescribeProjectRequest) {\n\trequest = &DescribeProjectRequest{\n\t\tRpcRequest: &requests.RpcRequest{},\n\t}\n\trequest.InitWithApiInfo(\"iqa\", \"2019-08-13\", \"DescribeProject\", \"iqa\", \"openAPI\")\n\treturn\n}", "title": "" }, { "docid": "08560531e7ee2ff7edd68ba33f62048b", "score": "0.5614873", "text": "func (c *UPhoneClient) NewCreateUPhoneAppVersionRequest() *CreateUPhoneAppVersionRequest {\n\treq := &CreateUPhoneAppVersionRequest{}\n\n\t// setup request with client config\n\tc.Client.SetupRequest(req)\n\n\t// setup retryable with default retry policy (retry for non-create action and common error)\n\treq.SetRetryable(false)\n\treturn req\n}", "title": "" }, { "docid": "07907b064dd7d32bbc65fece2b0aaf92", "score": "0.55909723", "text": "func (c *UPhoneClient) NewDescribeUPhoneCitiesRequest() *DescribeUPhoneCitiesRequest {\n\treq := &DescribeUPhoneCitiesRequest{}\n\n\t// setup request with client config\n\tc.Client.SetupRequest(req)\n\n\t// setup retryable with default retry policy (retry for non-create action and common error)\n\treq.SetRetryable(true)\n\treturn req\n}", "title": "" }, { "docid": "637ee9e903d44f48ce9aa92f0c465a90", "score": "0.5526754", "text": "func (c *UHostClient) NewDescribeUHostLiteRequest() *DescribeUHostLiteRequest {\n\treq := &DescribeUHostLiteRequest{}\n\tc.Client.SetupRequest(req)\n\treturn req\n}", "title": "" }, { "docid": "9cec37be2c28ad0217b04db8656794ae", "score": "0.5450847", "text": "func (rm *resourceManager) newDescribeRequestPayload(\n\tr *resource,\n) (*svcsdk.DescribeDataQualityJobDefinitionInput, error) {\n\tres := &svcsdk.DescribeDataQualityJobDefinitionInput{}\n\n\tif r.ko.Spec.JobDefinitionName != nil {\n\t\tres.SetJobDefinitionName(*r.ko.Spec.JobDefinitionName)\n\t}\n\n\treturn res, nil\n}", "title": "" }, { "docid": "fa4d91caa54b42140fc39a103f6d0043", "score": "0.5450169", "text": "func (c *UPhoneClient) NewDescribeUPhoneShareBandwidthRequest() *DescribeUPhoneShareBandwidthRequest {\n\treq := &DescribeUPhoneShareBandwidthRequest{}\n\n\t// setup request with client config\n\tc.Client.SetupRequest(req)\n\n\t// setup retryable with default retry policy (retry for non-create action and common error)\n\treq.SetRetryable(true)\n\treturn req\n}", "title": "" }, { "docid": "df16c587abbd28316cebef526ad0f4bf", "score": "0.5428379", "text": "func (c *UPhoneClient) NewCreateUPhoneRequest() *CreateUPhoneRequest {\n\treq := &CreateUPhoneRequest{}\n\n\t// setup request with client config\n\tc.Client.SetupRequest(req)\n\n\t// setup retryable with default retry policy (retry for non-create action and common error)\n\treq.SetRetryable(false)\n\treturn req\n}", "title": "" }, { "docid": "5bdd6748412a081e1974ea64fefa1311", "score": "0.53400594", "text": "func (rm *resourceManager) newDescribeRequestPayload(\n\tr *resource,\n) (*svcsdk.DescribeModelPackageGroupInput, error) {\n\tres := &svcsdk.DescribeModelPackageGroupInput{}\n\n\tif r.ko.Spec.ModelPackageGroupName != nil {\n\t\tres.SetModelPackageGroupName(*r.ko.Spec.ModelPackageGroupName)\n\t}\n\n\treturn res, nil\n}", "title": "" }, { "docid": "edf1c7ddd4d68cb63b75d3c9097e530a", "score": "0.5305591", "text": "func (c *VPCClient) NewDescribeNATGWRequest() *DescribeNATGWRequest {\n\treq := &DescribeNATGWRequest{}\n\n\t// setup request with client config\n\tc.Client.SetupRequest(req)\n\n\t// setup retryable with default retry policy (retry for non-create action and common error)\n\treq.SetRetryable(true)\n\treturn req\n}", "title": "" }, { "docid": "606fe086293ed6e31093605d696399a3", "score": "0.525195", "text": "func (c *Client) CreateApp(request *CreateAppRequest) (response *CreateAppResponse, err error) {\n if request == nil {\n request = NewCreateAppRequest()\n }\n response = NewCreateAppResponse()\n err = c.Send(request, response)\n return\n}", "title": "" }, { "docid": "ead41ce6adf8f57baa898ef8846cbda9", "score": "0.52210206", "text": "func (c *UCloudStackClient) NewDescribeUserRequest() *DescribeUserRequest {\n\treq := &DescribeUserRequest{}\n\n\t// setup request with client config\n\tc.Client.SetupRequest(req)\n\n\t// setup retryable with default retry policy (retry for non-create action and common error)\n\treq.SetRetryable(true)\n\treturn req\n}", "title": "" }, { "docid": "0ee7bb9be37e2de47c5fe7d2090e42e6", "score": "0.51742536", "text": "func (rm *resourceManager) newDescribeRequestPayload(\n\tr *resource,\n) (*svcsdk.DescribeEndpointConfigInput, error) {\n\tres := &svcsdk.DescribeEndpointConfigInput{}\n\n\tif r.ko.Spec.EndpointConfigName != nil {\n\t\tres.SetEndpointConfigName(*r.ko.Spec.EndpointConfigName)\n\t}\n\n\treturn res, nil\n}", "title": "" }, { "docid": "3b37ee2420d0a060d6723f78529bc6a2", "score": "0.51571", "text": "func New(appName string) *App {\n\t// Extract the description of the app if it was given\n\tvar appDescription = \"\"\n\tif i := strings.Index(appName, \":\"); i > 0 {\n\t\tappDescription = strings.TrimSpace(appName[i+1:])\n\t\tappName = strings.TrimSpace(appName[:i])\n\t}\n\n\tapp := &App{Name: appName, Description: appDescription}\n\n\treturn app\n}", "title": "" }, { "docid": "379b353fdb571fba2f4907e7fbb62184", "score": "0.51320744", "text": "func NewApp() *cli.App {\n\tapp := cli.NewApp()\n\tapp.Name = \"PezDoc\"\n\tapp.Usage = \"Bootstrap Swagger Documentation for Pez\"\n\n\tapp.Commands = append(app.Commands, []cli.Command{\n\t\tinitCli,\n\t\tcreateCli,\n\t}...)\n\n\treturn app\n}", "title": "" }, { "docid": "9defc4879e785c5f90a9c17b3c8eb051", "score": "0.51293695", "text": "func CreateDescribeIntentRequest() (request *DescribeIntentRequest) {\n\trequest = &DescribeIntentRequest{\n\t\tRpcRequest: &requests.RpcRequest{},\n\t}\n\trequest.InitWithApiInfo(\"OutboundBot\", \"2019-12-26\", \"DescribeIntent\", \"\", \"\")\n\trequest.Method = requests.POST\n\treturn\n}", "title": "" }, { "docid": "60a4ae62281cef528a31bf865935b761", "score": "0.5107699", "text": "func CreateDescribeAppMonitorMetricRequest() (request *DescribeAppMonitorMetricRequest) {\n\trequest = &DescribeAppMonitorMetricRequest{\n\t\tRpcRequest: &requests.RpcRequest{},\n\t}\n\trequest.InitWithApiInfo(\"retailcloud\", \"2018-03-13\", \"DescribeAppMonitorMetric\", \"\", \"\")\n\trequest.Method = requests.POST\n\treturn\n}", "title": "" }, { "docid": "35f05e10277cf681c562f3979c8f05a7", "score": "0.5078793", "text": "func NewApp(ctx *pulumi.Context,\n\tname string, args *AppArgs, opts ...pulumi.ResourceOption) (*App, error) {\n\tif args == nil {\n\t\treturn nil, errors.New(\"missing one or more required arguments\")\n\t}\n\n\tif args.AppName == nil {\n\t\treturn nil, errors.New(\"invalid value for required argument 'AppName'\")\n\t}\n\tif args.ProductId == nil {\n\t\treturn nil, errors.New(\"invalid value for required argument 'ProductId'\")\n\t}\n\tif args.Type == nil {\n\t\treturn nil, errors.New(\"invalid value for required argument 'Type'\")\n\t}\n\topts = internal.PkgResourceDefaultOpts(opts)\n\tvar resource App\n\terr := ctx.RegisterResource(\"alicloud:mhub/app:App\", name, args, &resource, opts...)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn &resource, nil\n}", "title": "" }, { "docid": "bc7eee187f5a9054f7715bc6038ee0f7", "score": "0.5053704", "text": "func NewApp(name, desc string) *App {\n\treturn &App{\n\t\tCmd: &Cmd{\n\t\t\tname: name,\n\t\t\tdesc: desc,\n\t\t\toptionsIdx: map[string]*container.Container{},\n\t\t\targsIdx: map[string]*container.Container{},\n\t\t\tErrorHandling: flag.ExitOnError,\n\t\t},\n\t}\n}", "title": "" }, { "docid": "7da6aa90c2ee5a4c733c2d6d891d5bda", "score": "0.50529194", "text": "func NewApp(storage *taxi_request.RequestStorage) *App {\n\treturn &App{storage: storage}\n}", "title": "" }, { "docid": "6b555c17e3ac6c5d562cb7bf1f7bfa4c", "score": "0.5050518", "text": "func (c *UNetClient) NewDescribeEIPRequest() *DescribeEIPRequest {\n\treq := &DescribeEIPRequest{}\n\n\t// setup request with client config\n\tc.Client.SetupRequest(req)\n\n\t// setup retryable with default retry policy (retry for non-create action and common error)\n\treq.SetRetryable(true)\n\treturn req\n}", "title": "" }, { "docid": "7e30d2ff6fb606fd057a435f7472c50a", "score": "0.5047143", "text": "func (c *UPhoneClient) NewDescribeUPhoneIpRegionsRequest() *DescribeUPhoneIpRegionsRequest {\n\treq := &DescribeUPhoneIpRegionsRequest{}\n\n\t// setup request with client config\n\tc.Client.SetupRequest(req)\n\n\t// setup retryable with default retry policy (retry for non-create action and common error)\n\treq.SetRetryable(true)\n\treturn req\n}", "title": "" }, { "docid": "8412eec7e4ec9f0d6c462b67fc2de951", "score": "0.5041235", "text": "func CreateDescribeAnalysisHistogramsRequest() (request *DescribeAnalysisHistogramsRequest) {\n\trequest = &DescribeAnalysisHistogramsRequest{\n\t\tRpcRequest: &requests.RpcRequest{},\n\t}\n\trequest.InitWithApiInfo(\"aegis\", \"2016-11-11\", \"DescribeAnalysisHistograms\", \"vipaegis\", \"openAPI\")\n\treturn\n}", "title": "" }, { "docid": "9365204278640d1636afee113660eda7", "score": "0.5025573", "text": "func NewDescribeRecordRequest() (request *DescribeRecordRequest) {\n\trequest = &DescribeRecordRequest{\n\t\tBaseRequest: &vkhttp.BaseRequest{},\n\t}\n\n\treturn\n}", "title": "" }, { "docid": "8d6f1f1354d8ef8598c7405ef5704200", "score": "0.50134826", "text": "func CreateRemoveAppRequest() (request *RemoveAppRequest) {\n\trequest = &RemoveAppRequest{\n\t\tRoaRequest: &requests.RoaRequest{},\n\t}\n\trequest.InitWithApiInfo(\"OpenSearch\", \"2017-12-25\", \"RemoveApp\", \"/v4/openapi/app-groups/[appGroupIdentity]/apps/[appId]\", \"\", \"\")\n\trequest.Method = requests.DELETE\n\treturn\n}", "title": "" }, { "docid": "6bf956771ac93c38593b9ee59a301c53", "score": "0.50108314", "text": "func CreateDescribeDomainRequest() (request *DescribeDomainRequest) {\n\trequest = &DescribeDomainRequest{\n\t\tRpcRequest: &requests.RpcRequest{},\n\t}\n\trequest.InitWithApiInfo(\"waf-openapi\", \"2019-09-10\", \"DescribeDomain\", \"waf\", \"openAPI\")\n\trequest.Method = requests.POST\n\treturn\n}", "title": "" }, { "docid": "dd22324b3f0860476d9c24d24a3fae95", "score": "0.49974164", "text": "func NewApp(info IAppInfo) *App {\n connectTimeout, _ := time.ParseDuration(agent.DEFAULT_CONNECT_TIMEOUT)\n\n instance := new(App)\n agent.SetupAgent(&instance.Agent, info, 0, connectTimeout, agent.DEFAULT_BUFFER_SIZE, true)\n\n instance.SetOnMessageReceivedHandler(instance.onMessageReceived)\n instance.info = info\n\n return instance\n}", "title": "" }, { "docid": "4b76185579c6c6076f9832696453c9d3", "score": "0.4993987", "text": "func CreateDescribeSpecificationRequest() (request *DescribeSpecificationRequest) {\n\trequest = &DescribeSpecificationRequest{\n\t\tRpcRequest: &requests.RpcRequest{},\n\t}\n\trequest.InitWithApiInfo(\"gpdb\", \"2016-05-03\", \"DescribeSpecification\", \"\", \"\")\n\trequest.Method = requests.POST\n\treturn\n}", "title": "" }, { "docid": "ae28bc06e5108ca4195d197fb2727327", "score": "0.49649897", "text": "func (c *UNetClient) NewDescribeVIPRequest() *DescribeVIPRequest {\n\treq := &DescribeVIPRequest{}\n\n\t// setup request with client config\n\tc.Client.SetupRequest(req)\n\n\t// setup retryable with default retry policy (retry for non-create action and common error)\n\treq.SetRetryable(true)\n\treturn req\n}", "title": "" }, { "docid": "c8c1b64a61f8c9cadebc40e25e3b12eb", "score": "0.4958501", "text": "func CreateDescribeInstanceInfosRequest() (request *DescribeInstanceInfosRequest) {\n\trequest = &DescribeInstanceInfosRequest{\n\t\tRpcRequest: &requests.RpcRequest{},\n\t}\n\trequest.InitWithApiInfo(\"waf-openapi\", \"2019-09-10\", \"DescribeInstanceInfos\", \"waf\", \"openAPI\")\n\trequest.Method = requests.POST\n\treturn\n}", "title": "" }, { "docid": "a0cb62ef8f617e889cb41f0613aedc29", "score": "0.49356684", "text": "func (s *Service) AppCreate(o struct {\n\tName *string `json:\"name,omitempty\"` // unique name of app\n\tRegion *string `json:\"region,omitempty\"` // unique identifier of region\n\tStack *string `json:\"stack,omitempty\"` // unique name of stack\n}) (*App, error) {\n\tvar app App\n\treturn &app, s.Post(&app, fmt.Sprintf(\"/apps\"), o)\n}", "title": "" }, { "docid": "458e4d3dedc793399d7694292195d593", "score": "0.48987377", "text": "func (rm *resourceManager) newDescribeRequestPayload(\n\tr *resource,\n) (*svcsdk.DescribeElasticsearchDomainInput, error) {\n\tres := &svcsdk.DescribeElasticsearchDomainInput{}\n\n\tif r.ko.Spec.DomainName != nil {\n\t\tres.SetDomainName(*r.ko.Spec.DomainName)\n\t}\n\n\treturn res, nil\n}", "title": "" }, { "docid": "19cf3c815598326fcafb8ebf2be727f6", "score": "0.48972905", "text": "func CreateDescribeProcessListRequest() (request *DescribeProcessListRequest) {\n\trequest = &DescribeProcessListRequest{\n\t\tRpcRequest: &requests.RpcRequest{},\n\t}\n\trequest.InitWithApiInfo(\"adb\", \"2019-03-15\", \"DescribeProcessList\", \"ads\", \"openAPI\")\n\trequest.Method = requests.POST\n\treturn\n}", "title": "" }, { "docid": "4f728146fc304312b658d10df5802a86", "score": "0.48933622", "text": "func CreateDescribeUiseNodeStatusRequest() (request *DescribeUiseNodeStatusRequest) {\n\trequest = &DescribeUiseNodeStatusRequest{\n\t\tRpcRequest: &requests.RpcRequest{},\n\t}\n\trequest.InitWithApiInfo(\"Uis\", \"2018-08-21\", \"DescribeUiseNodeStatus\", \"uis\", \"openAPI\")\n\treturn\n}", "title": "" }, { "docid": "77a3fc899413046ea98bf18b1889b44c", "score": "0.4891053", "text": "func (c *UPhoneClient) NewInstallUPhoneAppVersionRequest() *InstallUPhoneAppVersionRequest {\n\treq := &InstallUPhoneAppVersionRequest{}\n\n\t// setup request with client config\n\tc.Client.SetupRequest(req)\n\n\t// setup retryable with default retry policy (retry for non-create action and common error)\n\treq.SetRetryable(true)\n\treturn req\n}", "title": "" }, { "docid": "ab89ffe88db9ed06faed59b0a2d24bdf", "score": "0.48616362", "text": "func CreateDescribeNodeRequest() (request *DescribeNodeRequest) {\n\trequest = &DescribeNodeRequest{\n\t\tRpcRequest: &requests.RpcRequest{},\n\t}\n\trequest.InitWithApiInfo(\"eflo-controller\", \"2022-12-15\", \"DescribeNode\", \"\", \"\")\n\trequest.Method = requests.POST\n\treturn\n}", "title": "" }, { "docid": "c38bf8d3e6071a26ed25ef4454a0c6c7", "score": "0.48470092", "text": "func (c *UPhoneClient) NewPoweronUPhoneRequest() *PoweronUPhoneRequest {\n\treq := &PoweronUPhoneRequest{}\n\n\t// setup request with client config\n\tc.Client.SetupRequest(req)\n\n\t// setup retryable with default retry policy (retry for non-create action and common error)\n\treq.SetRetryable(true)\n\treturn req\n}", "title": "" }, { "docid": "01ca914c8401cde1b21a9674811b0cef", "score": "0.48415953", "text": "func (client *AppsClient) getCreateRequest(ctx context.Context, resourceGroupName string, resourceName string, options *AppsClientGetOptions) (*policy.Request, error) {\n\turlPath := \"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.IoTCentral/iotApps/{resourceName}\"\n\tif client.subscriptionID == \"\" {\n\t\treturn nil, errors.New(\"parameter client.subscriptionID cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{subscriptionId}\", url.PathEscape(client.subscriptionID))\n\tif resourceGroupName == \"\" {\n\t\treturn nil, errors.New(\"parameter resourceGroupName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{resourceGroupName}\", url.PathEscape(resourceGroupName))\n\tif resourceName == \"\" {\n\t\treturn nil, errors.New(\"parameter resourceName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{resourceName}\", url.PathEscape(resourceName))\n\treq, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treqQP := req.Raw().URL.Query()\n\treqQP.Set(\"api-version\", \"2021-06-01\")\n\treq.Raw().URL.RawQuery = reqQP.Encode()\n\treq.Raw().Header.Set(\"Accept\", \"application/json\")\n\treturn req, nil\n}", "title": "" }, { "docid": "9c2042d038cf4b61912972673fdd579f", "score": "0.48348954", "text": "func (v ApplicationsResource) New(c buffalo.Context) error {\n c.Set(\"application\", &models.Application{})\n\n return c.Render(http.StatusOK, r.HTML(\"/applications/new.plush.html\"))\n}", "title": "" }, { "docid": "2e5a2d6cdd35b4ab727f45350060e80f", "score": "0.48329285", "text": "func CreateDescribeEslDevicesRequest() (request *DescribeEslDevicesRequest) {\n\trequest = &DescribeEslDevicesRequest{\n\t\tRpcRequest: &requests.RpcRequest{},\n\t}\n\trequest.InitWithApiInfo(\"cloudesl\", \"2020-02-01\", \"DescribeEslDevices\", \"\", \"\")\n\trequest.Method = requests.POST\n\treturn\n}", "title": "" }, { "docid": "ec17012b3af11afdc6204e20ee2c2ecb", "score": "0.4827177", "text": "func (c *client) CreateApp(param *RequestParam) (*AppData, error) {\n\tif param == nil {\n\t\treturn nil, errors.New(\"param is nil\")\n\t}\n\terr := param.ValidateForCreate()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tdata, err := c.httpAPI.post(\"/apps\", param.ToAppData())\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tvar appData AppData\n\terr = json.Unmarshal(data, &appData)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn &appData, nil\n}", "title": "" }, { "docid": "4d7af3650bc74a395f2a8b19791b8152", "score": "0.4810561", "text": "func (client *AppsClient) listByResourceGroupCreateRequest(ctx context.Context, resourceGroupName string, options *AppsClientListByResourceGroupOptions) (*policy.Request, error) {\n\turlPath := \"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.IoTCentral/iotApps\"\n\tif client.subscriptionID == \"\" {\n\t\treturn nil, errors.New(\"parameter client.subscriptionID cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{subscriptionId}\", url.PathEscape(client.subscriptionID))\n\tif resourceGroupName == \"\" {\n\t\treturn nil, errors.New(\"parameter resourceGroupName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{resourceGroupName}\", url.PathEscape(resourceGroupName))\n\treq, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treqQP := req.Raw().URL.Query()\n\treqQP.Set(\"api-version\", \"2021-06-01\")\n\treq.Raw().URL.RawQuery = reqQP.Encode()\n\treq.Raw().Header.Set(\"Accept\", \"application/json\")\n\treturn req, nil\n}", "title": "" }, { "docid": "368c25810d3798618b96292a51b9c414", "score": "0.4806885", "text": "func CreateDescribeCouponListRequest() (request *DescribeCouponListRequest) {\n\trequest = &DescribeCouponListRequest{\n\t\tRpcRequest: &requests.RpcRequest{},\n\t}\n\trequest.InitWithApiInfo(\"Bss\", \"2014-07-14\", \"DescribeCouponList\", \"\", \"\")\n\treturn\n}", "title": "" }, { "docid": "e0d3de00cde547aa34cd10f3cfd5d50c", "score": "0.48055935", "text": "func NewApp(usage string) *cli.App {\n\tapp := cli.NewApp()\n\tapp.Name = filepath.Base(os.Args[0])\n\tapp.Author = \"\"\n\tapp.Email = \"\"\n\tapp.Usage = usage\n\treturn app\n}", "title": "" }, { "docid": "258205071c41aafd51bb0cb0e672304a", "score": "0.4804488", "text": "func New(b *bootstrap.Bootstrapper) iris.Handler {\n\treturn func(ctx iris.Context) {\n\t\t// response headers\n\t\t//TODO set ACCEPT\n\t\tctx.Header(\"App-Name\", b.AppName)\n\t\tctx.Header(\"App-Owner\", b.AppOwner)\n\t\tctx.Header(\"App-Since\", time.Since(b.AppSpawnDate).String())\n\t\t// TODO set from config contenttype\n\t\tctx.ContentType(\"application/json; charset=UTF-8\")\n\t\tctx.Next()\n\t}\n}", "title": "" }, { "docid": "a8ce030c54c39b95b1ceda6c4d90ff05", "score": "0.4794963", "text": "func CreateDescribeBgpPackByIpRequest() (request *DescribeBgpPackByIpRequest) {\n\trequest = &DescribeBgpPackByIpRequest{\n\t\tRpcRequest: &requests.RpcRequest{},\n\t}\n\trequest.InitWithApiInfo(\"antiddos-public\", \"2017-05-18\", \"DescribeBgpPackByIp\", \"ddosbasic\", \"openAPI\")\n\trequest.Method = requests.POST\n\treturn\n}", "title": "" }, { "docid": "1c89e10df28e9871327a6ffbb05cb8a8", "score": "0.47747454", "text": "func (c *Controller) Create(w http.ResponseWriter, r *http.Request) {\n\tpayload := &appRequest{}\n\terr := render.Bind(r, payload)\n\n\tif err != nil {\n\t\thelpers.BadRequest(w, r, err)\n\t\treturn\n\t}\n\n\tnewApp := payload.App\n\terr = helpers.ConformStruct(newApp)\n\n\tif err != nil {\n\t\thelpers.InternalServerError(w, r, err)\n\t\treturn\n\t}\n\n\tservice := chi.URLParam(r, \"service\")\n\n\tif service == \"\" {\n\t\thelpers.NotFound(w, r, apps.ErrNotFound)\n\t\treturn\n\t}\n\n\tnewApp.Service = service\n\n\terrs := helpers.ValidateStruct(newApp, nil)\n\n\tif errs != nil {\n\t\thelpers.ValidationFailed(w, r, errs)\n\t\treturn\n\t}\n\n\tid, err := c.models.Apps.Create(r.Context(), newApp)\n\n\tif err != nil {\n\t\tif err == apps.ErrExists {\n\t\t\thelpers.Conflict(w, r, err)\n\t\t\treturn\n\t\t}\n\n\t\thelpers.InternalServerError(w, r, err)\n\t\treturn\n\t}\n\n\tapp, err := c.models.Apps.GetByID(r.Context(), id)\n\n\tif err != nil {\n\t\thelpers.InternalServerError(w, r, err)\n\t\treturn\n\t} else if app == nil {\n\t\thelpers.NotFound(w, r, apps.ErrNotFound)\n\t\treturn\n\t}\n\n\tw.WriteHeader(http.StatusCreated)\n\trender.Render(w, r, newAppResponse(app))\n}", "title": "" }, { "docid": "b2130a40d5d1254b30d44dfaddf6dd68", "score": "0.47742274", "text": "func (c *UPhoneClient) NewCreateUPhoneImageRequest() *CreateUPhoneImageRequest {\n\treq := &CreateUPhoneImageRequest{}\n\n\t// setup request with client config\n\tc.Client.SetupRequest(req)\n\n\t// setup retryable with default retry policy (retry for non-create action and common error)\n\treq.SetRetryable(false)\n\treturn req\n}", "title": "" }, { "docid": "a376f09b5bb41937ad2d28892b4e4002", "score": "0.47682118", "text": "func newApp(http *server.HttpServer, grpc *server.GRPCServer, client *ent.Client) *App {\n\treturn &App{HttpServer: http, GRPCServer: grpc, Client: client}\n}", "title": "" }, { "docid": "344d9e7e60c77cb2a4c152eef4d1ca81", "score": "0.47666234", "text": "func NewApp(di *Di) *App {\n\treturn &App{di: di}\n}", "title": "" }, { "docid": "347051b5980e73be8567ff0c1830a6b8", "score": "0.4764249", "text": "func (s *Service) AppSetupCreate(o struct {\n\tApp *struct {\n\t\tLocked *bool `json:\"locked,omitempty\"` // are other organization members forbidden from joining this app.\n\t\tName *string `json:\"name,omitempty\"` // unique name of app\n\t\tOrganization *string `json:\"organization,omitempty\"` // unique name of organization\n\t\tPersonal *bool `json:\"personal,omitempty\"` // force creation of the app in the user account even if a default org\n\t\t// is set.\n\t\tRegion *string `json:\"region,omitempty\"` // unique name of region\n\t\tStack *string `json:\"stack,omitempty\"` // unique name of stack\n\t} `json:\"app,omitempty\"` // optional parameters for created app\n\tOverrides *struct {\n\t\tEnv *map[string]string `json:\"env,omitempty\"` // overrides of the env specified in the app.json manifest file\n\t} `json:\"overrides,omitempty\"` // overrides of keys in the app.json manifest file\n\tSourceBlob struct {\n\t\tURL *string `json:\"url,omitempty\"` // URL of gzipped tarball of source code containing app.json manifest\n\t\t// file\n\t} `json:\"source_blob\"` // gzipped tarball of source code containing app.json manifest file\n}) (*AppSetup, error) {\n\tvar appSetup AppSetup\n\treturn &appSetup, s.Post(&appSetup, fmt.Sprintf(\"/app-setups\"), o)\n}", "title": "" }, { "docid": "c823f3f8d7d36124deeb61aa3d7812bd", "score": "0.47632265", "text": "func CreateDescribeIpReportRequest() (request *DescribeIpReportRequest) {\n\trequest = &DescribeIpReportRequest{\n\t\tRpcRequest: &requests.RpcRequest{},\n\t}\n\trequest.InitWithApiInfo(\"Sasti\", \"2020-05-12\", \"DescribeIpReport\", \"\", \"\")\n\trequest.Method = requests.POST\n\treturn\n}", "title": "" }, { "docid": "7f42519b9786efa71ddc28bd444dd59a", "score": "0.47544876", "text": "func NewDescribeCommand(parent cmd.Registerer, globals *config.Data, data manifest.Data) *DescribeCommand {\n\tvar c DescribeCommand\n\tc.CmdClause = parent.Command(\"describe\", \"Get the current API token\").Alias(\"get\")\n\tc.Globals = globals\n\tc.manifest = data\n\treturn &c\n}", "title": "" }, { "docid": "80755f8c6b055f35e46bfc40aab08e61", "score": "0.47466505", "text": "func CreateDescribeDomainInfoRequest() (request *DescribeDomainInfoRequest) {\n\trequest = &DescribeDomainInfoRequest{\n\t\tRpcRequest: &requests.RpcRequest{},\n\t}\n\trequest.InitWithApiInfo(\"Alidns\", \"2015-01-09\", \"DescribeDomainInfo\", \"alidns\", \"openAPI\")\n\trequest.Method = requests.POST\n\treturn\n}", "title": "" }, { "docid": "49a752bfe8d5ad280cce8a351338ac35", "score": "0.47400162", "text": "func NewApp() App {\n\treturn App{}\n}", "title": "" }, { "docid": "db19d96fc351b6d8cb5dba632b627a57", "score": "0.47273943", "text": "func (client *AppsClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, resourceName string, app App, options *AppsClientBeginCreateOrUpdateOptions) (*policy.Request, error) {\n\turlPath := \"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.IoTCentral/iotApps/{resourceName}\"\n\tif client.subscriptionID == \"\" {\n\t\treturn nil, errors.New(\"parameter client.subscriptionID cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{subscriptionId}\", url.PathEscape(client.subscriptionID))\n\tif resourceGroupName == \"\" {\n\t\treturn nil, errors.New(\"parameter resourceGroupName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{resourceGroupName}\", url.PathEscape(resourceGroupName))\n\tif resourceName == \"\" {\n\t\treturn nil, errors.New(\"parameter resourceName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{resourceName}\", url.PathEscape(resourceName))\n\treq, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.host, urlPath))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treqQP := req.Raw().URL.Query()\n\treqQP.Set(\"api-version\", \"2021-06-01\")\n\treq.Raw().URL.RawQuery = reqQP.Encode()\n\treq.Raw().Header.Set(\"Accept\", \"application/json\")\n\treturn req, runtime.MarshalAsJSON(req, app)\n}", "title": "" }, { "docid": "c086980c8acbb209ca105c41bcdc0fde", "score": "0.47273898", "text": "func (*CreateApplicationRequest) Descriptor() ([]byte, []int) {\n\treturn file_backend_proto_rawDescGZIP(), []int{0}\n}", "title": "" }, { "docid": "0a6632b65eb99cb6be85232a64fd1db3", "score": "0.47225127", "text": "func NewApp(name, version, synopsis string) (*App, error) {\n \n app := &App {\n Name: name,\n Version: version,\n Synopsis: synopsis,\n Commands: map[string]*Command{},\n Options: map[string]*Option{},\n }\n \n if err := app.AddOption(\"-h\", \"Display this message\", 0); err != nil {\n return nil, err\n }\n \n if err := app.AddOption(\"-v\", \"Print version info and exit\", 0); err != nil {\n return nil, err\n }\n \n return app, nil\n \n}", "title": "" }, { "docid": "14bff322dbd1ee93f6ec5b21ab283e2c", "score": "0.4722488", "text": "func NewApp() *App {\n\treturn &App{}\n}", "title": "" }, { "docid": "14bff322dbd1ee93f6ec5b21ab283e2c", "score": "0.4722488", "text": "func NewApp() *App {\n\treturn &App{}\n}", "title": "" }, { "docid": "d741dc2e2ac4f1b20ce6ae02bfe4bcf1", "score": "0.4716819", "text": "func (*CreateAppConnectionRequest) Descriptor() ([]byte, []int) {\n\treturn file_google_cloud_beyondcorp_appconnections_v1_app_connections_service_proto_rawDescGZIP(), []int{3}\n}", "title": "" }, { "docid": "a43762cc42a737748921b61260736172", "score": "0.4708586", "text": "func CreateDescribeLibraryInstallTaskDetailRequest() (request *DescribeLibraryInstallTaskDetailRequest) {\n\trequest = &DescribeLibraryInstallTaskDetailRequest{\n\t\tRpcRequest: &requests.RpcRequest{},\n\t}\n\trequest.InitWithApiInfo(\"Emr\", \"2016-04-08\", \"DescribeLibraryInstallTaskDetail\", \"emr\", \"openAPI\")\n\trequest.Method = requests.POST\n\treturn\n}", "title": "" }, { "docid": "99037cb684c0ff89fd6669d4f74e4d6c", "score": "0.47030148", "text": "func (c *UPhoneClient) NewPoweroffUPhoneRequest() *PoweroffUPhoneRequest {\n\treq := &PoweroffUPhoneRequest{}\n\n\t// setup request with client config\n\tc.Client.SetupRequest(req)\n\n\t// setup retryable with default retry policy (retry for non-create action and common error)\n\treq.SetRetryable(true)\n\treturn req\n}", "title": "" }, { "docid": "5a07c635792db38a9a291cf240ce7600", "score": "0.4702358", "text": "func (api *HopperApi) CreateApp(name string, baseUrl string, imageUrl string, manageUrl string, contactEmail string) (*App, error) {\n\tkey, err := createKey()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tcertStr := encodeKey(&key.PublicKey)\n\n\treqBody := postAppRequest{\n\t\tName: name,\n\t\tBaseUrl: baseUrl,\n\t\tImageUrl: imageUrl,\n\t\tManageUrl: manageUrl,\n\t\tContactEmail: contactEmail,\n\t\tCert: certStr,\n\t}\n\n\tapiResp := &apiIdResponse{}\n\terr = apiJsonRequest(http.MethodPost, api.baseUrl + \"/app\", reqBody, apiResp)\n\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn &App{api: api, Id: apiResp.Id, PrivateKey: key}, nil\n}", "title": "" }, { "docid": "e0f4e9fb66e2ae371e37a1032a01f499", "score": "0.46836746", "text": "func createApp(instanceHost string) app {\n\trequestURL, err := url.Parse(instanceHost + \"/api/v1/apps\")\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\trequestURL.Scheme = \"https\"\n\n\tappParams := map[string]string{\"scopes\": \"write follow read\",\n\t\t\"redirect_uris\": \"urn:ietf:wg:oauth:2.0:oob\", \"client_name\": \"fedapp\"}\n\n\trequestQuery, err := json.Marshal(appParams)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\n\tresp, err := http.Post(requestURL.String(), \"application/json\", bytes.NewBuffer(requestQuery))\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\tdefer resp.Body.Close()\n\n\tdecoder := json.NewDecoder(resp.Body)\n\tdecoder.DisallowUnknownFields()\n\n\tvar newApp app\n\terr = decoder.Decode(&newApp)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\n\treturn newApp\n}", "title": "" }, { "docid": "4a4484fb32431bc1f28b9781b4f4ac94", "score": "0.4675261", "text": "func CreateQueryMessageAppResponse() (response *QueryMessageAppResponse) {\n\tresponse = &QueryMessageAppResponse{\n\t\tBaseResponse: &responses.BaseResponse{},\n\t}\n\treturn\n}", "title": "" }, { "docid": "2cc23d4981f699493edb203b58011a4b", "score": "0.46688738", "text": "func CreateDescribeGlobalBroadcastTypeRequest() (request *DescribeGlobalBroadcastTypeRequest) {\n\trequest = &DescribeGlobalBroadcastTypeRequest{\n\t\tRpcRequest: &requests.RpcRequest{},\n\t}\n\trequest.InitWithApiInfo(\"Drds\", \"2019-01-23\", \"DescribeGlobalBroadcastType\", \"drds\", \"openAPI\")\n\treturn\n}", "title": "" }, { "docid": "0acadb535760ff923e3fb874f20401f0", "score": "0.46652314", "text": "func NewDescribeCommand(parent cmd.Registerer, g *global.Data, m manifest.Data) *DescribeCommand {\n\tc := DescribeCommand{\n\t\tBase: cmd.Base{\n\t\t\tGlobals: g,\n\t\t},\n\t\tmanifest: m,\n\t}\n\tc.CmdClause = parent.Command(\"describe\", \"Show detailed information about an Azure Blob Storage logging endpoint on a Fastly service version\").Alias(\"get\")\n\n\t// Required.\n\tc.CmdClause.Flag(\"name\", \"The name of the Azure Blob Storage logging object\").Short('n').Required().StringVar(&c.Input.Name)\n\tc.RegisterFlag(cmd.StringFlagOpts{\n\t\tName: cmd.FlagVersionName,\n\t\tDescription: cmd.FlagVersionDesc,\n\t\tDst: &c.serviceVersion.Value,\n\t\tRequired: true,\n\t})\n\n\t// Optional.\n\tc.RegisterFlagBool(c.JSONFlag()) // --json\n\tc.RegisterFlag(cmd.StringFlagOpts{\n\t\tName: cmd.FlagServiceIDName,\n\t\tDescription: cmd.FlagServiceIDDesc,\n\t\tDst: &c.manifest.Flag.ServiceID,\n\t\tShort: 's',\n\t})\n\tc.RegisterFlag(cmd.StringFlagOpts{\n\t\tAction: c.serviceName.Set,\n\t\tName: cmd.FlagServiceName,\n\t\tDescription: cmd.FlagServiceDesc,\n\t\tDst: &c.serviceName.Value,\n\t})\n\treturn &c\n}", "title": "" }, { "docid": "08587aead1b102c949e271f2ff1f1218", "score": "0.46639434", "text": "func (e *App) Create(ctx context.Context, req *ucenter.CreateReq, rsp *ucenter.CreateAppResp) error {\n\tlog.Info(\"Received Ucenter.Create request\")\n\treturn nil\n}", "title": "" }, { "docid": "869ce28767051040462fd2af071631a2", "score": "0.46623552", "text": "func (c *UNetClient) NewDescribeFirewallRequest() *DescribeFirewallRequest {\n\treq := &DescribeFirewallRequest{}\n\n\t// setup request with client config\n\tc.Client.SetupRequest(req)\n\n\t// setup retryable with default retry policy (retry for non-create action and common error)\n\treq.SetRetryable(true)\n\treturn req\n}", "title": "" }, { "docid": "43e79bb186ef7b5b402f4e59f347949e", "score": "0.46605128", "text": "func NewApp() *App {\n\treturn &App{\n\t\thello: &Hello{},\n\t}\n}", "title": "" }, { "docid": "4accab4bc29b76bcf0ddf06d65e3b2a5", "score": "0.46560818", "text": "func (c *UPhoneClient) NewModifyUPhoneNameRequest() *ModifyUPhoneNameRequest {\n\treq := &ModifyUPhoneNameRequest{}\n\n\t// setup request with client config\n\tc.Client.SetupRequest(req)\n\n\t// setup retryable with default retry policy (retry for non-create action and common error)\n\treq.SetRetryable(true)\n\treturn req\n}", "title": "" }, { "docid": "83d8e5ec6d20e407051faba8e5adedf8", "score": "0.46499297", "text": "func (c *Client) CreateApp(app *Application) (*Response, error) {\n\t// TODO : VALIDATE DATAS\n\toptions := &RequestOptions{\n\t\tPath: \"apps\",\n\t\tDatas: app,\n\t\tMethod: \"POST\",\n\t}\n\tr, err := c.request(options)\n\tif r != nil {\n\t\tif r.Code == 201 {\n\t\t\treturn r, nil\n\t\t}\n\t}\n\treturn nil, err\n}", "title": "" }, { "docid": "de718e20e3a7f1b6de5fb1e9a38b33b8", "score": "0.46447", "text": "func CreateDescribeTenantUsersRequest() (request *DescribeTenantUsersRequest) {\n\trequest = &DescribeTenantUsersRequest{\n\t\tRpcRequest: &requests.RpcRequest{},\n\t}\n\trequest.InitWithApiInfo(\"OceanBasePro\", \"2019-09-01\", \"DescribeTenantUsers\", \"oceanbase\", \"openAPI\")\n\trequest.Method = requests.POST\n\treturn\n}", "title": "" }, { "docid": "50620be5869c537f1925f9df6aea3694", "score": "0.46363586", "text": "func CreateApp(context *gin.Context) {\n\n\trequest := context.Request\n\twriter := context.Writer\n\n\t// Get AppID and Token\n\ttoken := request.Header.Get(\"Authorization\")\n\n\tif token == \"\" {\n\t\twriter.WriteHeader(http.StatusUnauthorized)\n\t\treturn\n\t}\n\n\t// Check if is admin, and validate token\n\tidentity, isOK := auth.AuthenticateAdmin(token)\n\n\t// If not valid return\n\tif !isOK || !identity.IsSuperAdmin() {\n\t\twriter.WriteHeader(http.StatusUnauthorized)\n\t\treturn\n\t}\n\n\t// Get request body\n\tbody, err := ioutil.ReadAll(request.Body)\n\n\tif err != nil {\n\t\twriter.WriteHeader(http.StatusBadRequest)\n\t\treturn\n\t}\n\n\t// Parse body\n\tvar createAppRequest createAppRequest\n\n\tvar json = jsoniter.ConfigCompatibleWithStandardLibrary\n\terr = json.Unmarshal(body, &createAppRequest)\n\n\tif err != nil {\n\t\twriter.WriteHeader(http.StatusBadRequest)\n\t\treturn\n\t}\n\n\t// Check if app already exists in cache\n\tapp := GetEngine().GetCacheStorage().GetApp(createAppRequest.AppID)\n\n\t// If not found check from database\n\tif app == nil {\n\t\tapp, err := GetEngine().GetAppRepository().GetApp(createAppRequest.AppID)\n\n\t\tif err != nil {\n\t\t\t_, _ = fmt.Fprintf(os.Stderr, \"HTTP Create App: failed to check app existence %v\\n\", err)\n\t\t\twriter.WriteHeader(http.StatusInternalServerError)\n\t\t\treturn\n\t\t}\n\n\t\tif app == nil {\n\t\t\twriter.WriteHeader(http.StatusConflict)\n\t\t\treturn\n\t\t}\n\t}\n\n\t// Store app in the database\n\terr = GetEngine().GetAppRepository().CreateApp(createAppRequest.AppID, createAppRequest.Name)\n\n\t// Store app in cache\n\tGetEngine().GetCacheStorage().StoreApp(createAppRequest.AppID, createAppRequest.Name)\n\n\tif err != nil {\n\t\t_, _ = fmt.Fprintf(os.Stderr, \"HTTP Create App: failed to create app %v\\n\", err)\n\t\twriter.WriteHeader(http.StatusConflict)\n\t\treturn\n\t}\n\n\twriter.WriteHeader(http.StatusOK)\n}", "title": "" }, { "docid": "6adc281c614e7d00abde42da44bb428f", "score": "0.46313363", "text": "func CreateDescribeSQLSamplesRequest() (request *DescribeSQLSamplesRequest) {\n\trequest = &DescribeSQLSamplesRequest{\n\t\tRpcRequest: &requests.RpcRequest{},\n\t}\n\trequest.InitWithApiInfo(\"OceanBasePro\", \"2019-09-01\", \"DescribeSQLSamples\", \"oceanbase\", \"openAPI\")\n\trequest.Method = requests.POST\n\treturn\n}", "title": "" }, { "docid": "794f67a932231d321fd87366c4cd4c5e", "score": "0.46278816", "text": "func NewApp() *App {\n\treturn &App{\n\t\tName: filepath.Base(os.Args[0]),\n\t\tUsage: \"A new cli application\",\n\t\tReader: os.Stdin,\n\t\tWriter: os.Stdout,\n\t}\n}", "title": "" }, { "docid": "4a4c8e133cecbfdc6cc561c83165dc91", "score": "0.4627775", "text": "func NewApp(name, usage, version string) *cli.App {\n\tsort.Sort(commands) // sorted names look better in the help output\n\n\tapp := cli.NewApp()\n\tapp.EnableBashCompletion = true\n\tapp.Name = name\n\tapp.Usage = usage\n\tapp.Version = version\n\tapp.Commands = commands\n\treturn app\n}", "title": "" }, { "docid": "9162318992dbea258a4a51fd4967b384", "score": "0.46267706", "text": "func (api *api) AppCreate(appBody *AppCreate) error {\n\n\turi := \"/v1/objects/pool/create\"\n\t_, err := api.makeRequest(\"POST\", uri, \"app\", appBody)\n\tif err != nil {\n\t\treturn err\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "1b6227e79b6c67a4d2439d49af4c9b11", "score": "0.46256325", "text": "func (c *UPhoneClient) NewCreateUPhoneServerRequest() *CreateUPhoneServerRequest {\n\treq := &CreateUPhoneServerRequest{}\n\n\t// setup request with client config\n\tc.Client.SetupRequest(req)\n\n\t// setup retryable with default retry policy (retry for non-create action and common error)\n\treq.SetRetryable(false)\n\treturn req\n}", "title": "" }, { "docid": "6f7c4ad08c130bd36f8c0fae59512822", "score": "0.4607309", "text": "func CreateDescribeHealthCheckStatusRequest() (request *DescribeHealthCheckStatusRequest) {\n\trequest = &DescribeHealthCheckStatusRequest{\n\t\tRpcRequest: &requests.RpcRequest{},\n\t}\n\trequest.InitWithApiInfo(\"ddoscoo\", \"2020-01-01\", \"DescribeHealthCheckStatus\", \"\", \"\")\n\trequest.Method = requests.POST\n\treturn\n}", "title": "" }, { "docid": "4abe4876421bbc4ee96eabf5449fbd92", "score": "0.4604817", "text": "func NewApp() (app struct {\n\troot string // root directory\n\tport int\n}, err error) {\n\tif app.root, err = xii.AsString(\"DALERI_MEGA_WEBAPP_ROOT\", xii.StringOpts{DefaultValue: \"./public\"}); err != nil {\n\t\treturn app, err\n\t}\n\tlog.Printf(\"[app] %-30s == %q\\n\", \"DALERI_MEGA_WEBAPP_ROOT\", app.root)\n\n\tfor _, key := range []string{\"DALERI_MEGA_PORT\", \"PORT\"} {\n\t\tif app.port, err = xii.AsInt(key, xii.IntOpts{}); err == nil && app.port != 0 {\n\t\t\tlog.Printf(\"[app] %-30s == %d\\n\", key, app.port)\n\t\t\tbreak\n\t\t}\n\t}\n\tif app.port == 0 {\n\t\tapp.port = 8080\n\t\tlog.Printf(\"[app] defaulting port to %d\\n\", app.port)\n\t}\n\n\treturn app, nil\n}", "title": "" }, { "docid": "5657ab4c99ef6ed6a0466e167d288147", "score": "0.46044147", "text": "func newApp() *todoApp {\n\tresult := &todoApp{}\n\t//init the list, setting our own object as the joiner (we meet\n\t//the interface Joiner)\n\tresult.todos = s5.NewList(result)\n\n\t//create initial values of attributes\n\tresult.numNotDone = s5.NewIntegerSimple(0)\n\tresult.plural = s5.NewStringSimple(\"\")\n\tresult.someDone = s5.NewBooleanSimple(false)\n\tresult.numDone = s5.NewIntegerSimple(0)\n\n\t//done create app object\n\treturn result\n}", "title": "" }, { "docid": "d0ea3e86937d9e8060496390362f4086", "score": "0.46027356", "text": "func CreateDescribeSlotRequest() (request *DescribeSlotRequest) {\n\trequest = &DescribeSlotRequest{\n\t\tRoaRequest: &requests.RoaRequest{},\n\t}\n\trequest.InitWithApiInfo(\"PAIElasticDatasetAccelerator\", \"2022-08-01\", \"DescribeSlot\", \"/api/v1/slots/[SlotId]\", \"datasetacc\", \"openAPI\")\n\trequest.Method = requests.GET\n\treturn\n}", "title": "" }, { "docid": "88bde7386c569857c1f1082489610fa0", "score": "0.45993254", "text": "func NewApplicationDescription(appURI, prodURI, appName string, appType uint32, gwURI, profileURI string, discovURIs []string) *ApplicationDescription {\n\treturn &ApplicationDescription{\n\t\tApplicationURI: datatypes.NewString(appURI),\n\t\tProductURI: datatypes.NewString(prodURI),\n\t\tApplicationName: datatypes.NewLocalizedText(\"\", appName),\n\t\tApplicationType: appType,\n\t\tGatewayServerURI: datatypes.NewString(gwURI),\n\t\tDiscoveryProfileURI: datatypes.NewString(profileURI),\n\t\tDiscoveryURIs: datatypes.NewStringArray(discovURIs),\n\t}\n}", "title": "" }, { "docid": "bc91871d039c3c7f1d92989f2759940d", "score": "0.45970172", "text": "func (c *UPhoneClient) NewResetUPhoneRequest() *ResetUPhoneRequest {\n\treq := &ResetUPhoneRequest{}\n\n\t// setup request with client config\n\tc.Client.SetupRequest(req)\n\n\t// setup retryable with default retry policy (retry for non-create action and common error)\n\treq.SetRetryable(true)\n\treturn req\n}", "title": "" }, { "docid": "631168f2c923fc49558c80b3c319777c", "score": "0.45969972", "text": "func NewTrivialApp(address common.Address, backend bind.ContractBackend) (*TrivialApp, error) {\n\tcontract, err := bindTrivialApp(address, backend, backend, backend)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn &TrivialApp{TrivialAppCaller: TrivialAppCaller{contract: contract}, TrivialAppTransactor: TrivialAppTransactor{contract: contract}, TrivialAppFilterer: TrivialAppFilterer{contract: contract}}, nil\n}", "title": "" }, { "docid": "fe91c55cb0e4c935dba9f282a8e0bd09", "score": "0.4596668", "text": "func (client ClientImpl) CreateApp(context context.Context, args *CreateAppArgs, orgName string) (*App, error) {\n\tfmt.Printf(\"%+v\\n\", args)\n\n\tbody, marshalErr := json.Marshal(args)\n\tif marshalErr != nil {\n\t\treturn nil, marshalErr\n\t}\n\tresp, err := client.Client.Send(context, http.MethodPost, bytes.NewReader(body), createOrganizationURL(orgName))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tvar responseValue App\n\terr = client.Client.UnmarshalBody(resp, &responseValue)\n\treturn &responseValue, err\n}", "title": "" } ]
5dc13e4d20f866266985cd9b24961880
Default indicates an expected call of Default.
[ { "docid": "052673b00f761fa5006dba08a589dd94", "score": "0.71657443", "text": "func (mr *MockdefaultSessionProviderMockRecorder) Default() *gomock.Call {\n\tmr.mock.ctrl.T.Helper()\n\treturn mr.mock.ctrl.RecordCallWithMethodType(mr.mock, \"Default\", reflect.TypeOf((*MockdefaultSessionProvider)(nil).Default))\n}", "title": "" } ]
[ { "docid": "35a672f7e25808a4ddb7b321fb9a4f42", "score": "0.74541855", "text": "func (r *MyKind) Default() {\n\tmykindlog.Info(\"default\", \"name\", r.Name)\n\n\t// TODO(user): fill in your defaulting logic.\n\tr.Status.MyStatus = \"DefaultValue\"\n}", "title": "" }, { "docid": "11b4784cb69a850f223c7331af37ae4d", "score": "0.7317893", "text": "func (in *PodNetworkChaos) Default() {\n\tpodnetworkchaoslog.Info(\"default\", \"name\", in.Name)\n\n\t// Do nothing here\n}", "title": "" }, { "docid": "6bab8f96ed54bcce004e22b4be759ac5", "score": "0.7276192", "text": "func (mr *MocksessionProviderMockRecorder) Default() *gomock.Call {\n\tmr.mock.ctrl.T.Helper()\n\treturn mr.mock.ctrl.RecordCallWithMethodType(mr.mock, \"Default\", reflect.TypeOf((*MocksessionProvider)(nil).Default))\n}", "title": "" }, { "docid": "ee10ecaa338481ccb0e436f8e2083169", "score": "0.72229785", "text": "func (in *Chaos) Default() {\n\tchaoslog.Info(\"SetDefaults\",\n\t\t\"name\", in.GetNamespace()+\"/\"+in.GetName(),\n\t)\n}", "title": "" }, { "docid": "d3e070c256c0a95de9d9cf8723d7ba99", "score": "0.715976", "text": "func Default(msg interface{}) {\n\tstd.Default(msg)\n}", "title": "" }, { "docid": "e0dfd767296fa85772bea0df43acfdb5", "score": "0.70193064", "text": "func Default() string {\n\treturn Format(DefaultSpec())\n}", "title": "" }, { "docid": "96d8617effeeab50fb7b0ba8d10ec250", "score": "0.69355565", "text": "func (p *Ping) Default() string {\n\treturn \"pong\"\n}", "title": "" }, { "docid": "2149dccd181f25bbfef62dee3ad2170b", "score": "0.6927586", "text": "func (r *ElasticWeb) Default() {\n\telasticweblog.Info(\"default\", \"name\", r.Name)\n\n\t// TODO(user): fill in your defaulting logic.\n\t// 如果创建的时候没有输入总QPS,就设置个默认值\n\tif r.Spec.TotalQPS == nil {\n\t\tr.Spec.TotalQPS = new(int32)\n\t\t*r.Spec.TotalQPS = 1300\n\t\telasticweblog.Info(\"a. TotalQPS is nil, set default value now\", \"TotalQPS\", *r.Spec.TotalQPS)\n\t} else {\n\t\telasticweblog.Info(\"b. TotalQPS exists\", \"TotalQPS\", *r.Spec.TotalQPS)\n\t}\n}", "title": "" }, { "docid": "47609867b94188bbfa300ed6671d2bc9", "score": "0.689801", "text": "func (c *Cat) Default() {\n\tlog.Info(\"default\", \"name\", c.Name)\n\n\tif c.Spec.Duration == nil {\n\t\tc.Spec.Duration = &DefaultCatDuration\n\t}\n\n\tif c.Spec.Message == nil {\n\t\tc.Spec.Message = &DefaultCatMessage\n\t}\n\n\tif c.Spec.TotalLives == nil {\n\t\tc.Spec.TotalLives = &DefaultCatLives\n\t}\n}", "title": "" }, { "docid": "c3869eafdc4a70b5fbf5adb7a1325bbf", "score": "0.6879262", "text": "func (r *Heat) Default() {\n\theatlog.Info(\"default\", \"name\", r.Name)\n\n\tr.Spec.Default()\n}", "title": "" }, { "docid": "3e9ad609591742d52186dac67d5741f2", "score": "0.68627816", "text": "func (snapshot *Snapshot) Default() {\n\tsnapshot.defaultImpl()\n\tvar temp any = snapshot\n\tif runtimeDefaulter, ok := temp.(genruntime.Defaulter); ok {\n\t\truntimeDefaulter.CustomDefault()\n\t}\n}", "title": "" }, { "docid": "d3dfbe45c550909c52f289bb1a08a127", "score": "0.68554175", "text": "func (r *CanaryConfig) Default() {\n\tcanaryconfiglog.Debug(\"default\", zap.String(\"name\", r.Name))\n}", "title": "" }, { "docid": "3739b3638ae5c52bfb0b4084c340c3db", "score": "0.6852156", "text": "func (user *User) Default() {\n\tuser.defaultImpl()\n\tvar temp interface{} = user\n\tif runtimeDefaulter, ok := temp.(genruntime.Defaulter); ok {\n\t\truntimeDefaulter.CustomDefault()\n\t}\n}", "title": "" }, { "docid": "92129d25f188b50d52ad5b8b5291c6d6", "score": "0.6846566", "text": "func (in *Service) Default() {\n\tservicelog.Info(\"SetDefaults\",\n\t\t\"name\", in.GetNamespace()+\"/\"+in.GetName(),\n\t)\n}", "title": "" }, { "docid": "abf741b0b86e3ecfba1091b1845d99d0", "score": "0.68392694", "text": "func (r *SplunkOtelAgent) Default() {\n\tsplunkotelagentlog.Info(\"default\", \"name\", r.Name)\n\n\tif r.Labels == nil {\n\t\tr.Labels = map[string]string{}\n\t}\n\tif r.Labels[\"app.kubernetes.io/managed-by\"] == \"\" {\n\t\tr.Labels[\"app.kubernetes.io/managed-by\"] = \"splunk-otel-collector-operator\"\n\t}\n\n\tr.defaultAgent()\n\tr.defaultClusterReceiver()\n\tr.defaultGateway()\n}", "title": "" }, { "docid": "3f976386c46af5ed84aa968cddadbdb5", "score": "0.6805146", "text": "func (group *NetworkSecurityGroup) Default() {\n\tgroup.defaultImpl()\n\tvar temp any = group\n\tif runtimeDefaulter, ok := temp.(genruntime.Defaulter); ok {\n\t\truntimeDefaulter.CustomDefault()\n\t}\n}", "title": "" }, { "docid": "0c692d8b2ef12b354893e1b80c41365c", "score": "0.6796428", "text": "func Default() Option {\n\treturn func(datasource *Prometheus) error {\n\t\tdatasource.builder.IsDefault = true\n\n\t\treturn nil\n\t}\n}", "title": "" }, { "docid": "0dfea395bbdcc0a9336ee24e259b5f4c", "score": "0.679536", "text": "func Default() {\n\tbuild.BuildAll()\n}", "title": "" }, { "docid": "4e2db8bd2411b21393d54b09ec222664", "score": "0.6709161", "text": "func (ctx *Ctx) AskDefault(label, what string) (string, error) {\n\tctx.Println(Fmt(`{{iconQ}} {{.Lab}} {{.Def | faint}}`, struct{ Lab, Def string }{label, \"[default = \" + what + \"]\"}))\n\treturn ctx.ask(what)\n}", "title": "" }, { "docid": "5342de9c685412e0d8cdce7517ebe6f0", "score": "0.66968685", "text": "func (endpoint *ProfilesEndpoint) Default() {\n\tendpoint.defaultImpl()\n\tvar temp any = endpoint\n\tif runtimeDefaulter, ok := temp.(genruntime.Defaulter); ok {\n\t\truntimeDefaulter.CustomDefault()\n\t}\n}", "title": "" }, { "docid": "5342de9c685412e0d8cdce7517ebe6f0", "score": "0.66968685", "text": "func (endpoint *ProfilesEndpoint) Default() {\n\tendpoint.defaultImpl()\n\tvar temp any = endpoint\n\tif runtimeDefaulter, ok := temp.(genruntime.Defaulter); ok {\n\t\truntimeDefaulter.CustomDefault()\n\t}\n}", "title": "" }, { "docid": "2ad07331bc2c28033fe59a8dbd01309e", "score": "0.6680062", "text": "func Default(def string, value interface{}) string {\n\tif set, ok := template.IsTrue(value); ok && set {\n\t\treturn fmt.Sprint(value)\n\t}\n\treturn def\n}", "title": "" }, { "docid": "7fa3b0e83719089dc46f3b114d267ef5", "score": "0.6662819", "text": "func (namespace *Namespace) Default() {\n\tnamespace.defaultImpl()\n\tvar temp any = namespace\n\tif runtimeDefaulter, ok := temp.(genruntime.Defaulter); ok {\n\t\truntimeDefaulter.CustomDefault()\n\t}\n}", "title": "" }, { "docid": "23153018bc6b7c015af04b3e1e8afe42", "score": "0.6662098", "text": "func (workspace *Workspace) Default() {\n\tworkspace.defaultImpl()\n\tvar temp any = workspace\n\tif runtimeDefaulter, ok := temp.(genruntime.Defaulter); ok {\n\t\truntimeDefaulter.CustomDefault()\n\t}\n}", "title": "" }, { "docid": "23153018bc6b7c015af04b3e1e8afe42", "score": "0.6662098", "text": "func (workspace *Workspace) Default() {\n\tworkspace.defaultImpl()\n\tvar temp any = workspace\n\tif runtimeDefaulter, ok := temp.(genruntime.Defaulter); ok {\n\t\truntimeDefaulter.CustomDefault()\n\t}\n}", "title": "" }, { "docid": "8d2e0f480485b94e2fc25262d911d0e5", "score": "0.66429466", "text": "func (r *MultiClusterHub) Default() {\n\tmulticlusterhublog.Info(\"default\", \"name\", r.Name)\n\n\t// TODO(user): fill in your defaulting logic.\n}", "title": "" }, { "docid": "4fbc84438744a79f255a9d43f0d8362d", "score": "0.66291326", "text": "func (r *CheckResult) IsDefault() bool {\n\treturn r.Status == \"OK\" && r.ValidDuration == 0 && r.ValidUseCount == 0\n}", "title": "" }, { "docid": "98a5023a1428bfc76a39a3a0e0897012", "score": "0.6593921", "text": "func (r *AdcsIssuer) Default() {\n\tlog.Info(\"default\", \"name\", r.Name)\n\n\tif r.Spec.StatusCheckInterval == \"\" {\n\t\tr.Spec.StatusCheckInterval = \"6h\"\n\t}\n\tif r.Spec.RetryInterval == \"\" {\n\t\tr.Spec.RetryInterval = \"1h\"\n\t}\n}", "title": "" }, { "docid": "c6fd07dd8b304398fc19b2dc1123397f", "score": "0.6583094", "text": "func (rule *LoadBalancersInboundNatRule) Default() {\n\trule.defaultImpl()\n\tvar temp any = rule\n\tif runtimeDefaulter, ok := temp.(genruntime.Defaulter); ok {\n\t\truntimeDefaulter.CustomDefault()\n\t}\n}", "title": "" }, { "docid": "96263e4c1ac5ba61790864f52c283eb1", "score": "0.65659523", "text": "func (setting *ServersAuditingSetting) Default() {\n\tsetting.defaultImpl()\n\tvar temp any = setting\n\tif runtimeDefaulter, ok := temp.(genruntime.Defaulter); ok {\n\t\truntimeDefaulter.CustomDefault()\n\t}\n}", "title": "" }, { "docid": "86c4b7b52b30cfedbe1b79e147c9a399", "score": "0.64913064", "text": "func (c *Subcommand) Default() *Subcommand {\n\tc.cmd.Default()\n\treturn c\n}", "title": "" }, { "docid": "6d9ea43c818f4e52593139d411bb6787", "score": "0.64672923", "text": "func (scaleSet *VirtualMachineScaleSet) Default() {\n\tscaleSet.defaultImpl()\n\tvar temp any = scaleSet\n\tif runtimeDefaulter, ok := temp.(genruntime.Defaulter); ok {\n\t\truntimeDefaulter.CustomDefault()\n\t}\n}", "title": "" }, { "docid": "37bbba9765c4249a105cacab8c8c6e74", "score": "0.64668024", "text": "func (procedure *SqlDatabaseContainerStoredProcedure) Default() {\n\tprocedure.defaultImpl()\n\tvar temp any = procedure\n\tif runtimeDefaulter, ok := temp.(genruntime.Defaulter); ok {\n\t\truntimeDefaulter.CustomDefault()\n\t}\n}", "title": "" }, { "docid": "e5371e2dabd59bd3624e30a06b0a09df", "score": "0.64633894", "text": "func (r *OpenStackCluster) Default() {\n\tif r.Spec.IdentityRef != nil && r.Spec.IdentityRef.Kind == \"\" {\n\t\tr.Spec.IdentityRef.Kind = defaultIdentityRefKind\n\t}\n}", "title": "" }, { "docid": "c3c13b4408dc65157d7ec88c2f35664a", "score": "0.6462316", "text": "func (obj *Response) Default() {\n\tobj.Program = \"Beq\"\n\tobj.Version = \"0.01\"\n}", "title": "" }, { "docid": "443b92c9adc41171a6e799ce39865960", "score": "0.643771", "text": "func Default() Option {\n\treturn func(datasource *Loki) {\n\t\tdatasource.builder.IsDefault = true\n\t}\n}", "title": "" }, { "docid": "d6b43bc71f6d62cb18506fef668fb2f3", "score": "0.6436624", "text": "func (c *CmdClause) Default() *CmdClause {\n\tc.isDefault = true\n\treturn c\n}", "title": "" }, { "docid": "86de10a5b89b9c204a1d56b434af5b72", "score": "0.6417067", "text": "func (configuration *Configuration) Default() {\n\tconfiguration.defaultImpl()\n\tvar temp any = configuration\n\tif runtimeDefaulter, ok := temp.(genruntime.Defaulter); ok {\n\t\truntimeDefaulter.CustomDefault()\n\t}\n}", "title": "" }, { "docid": "ad271037e65a2015c4bbc33d91791428", "score": "0.6406424", "text": "func (pool *ManagedClustersAgentPool) Default() {\n\tpool.defaultImpl()\n\tvar temp any = pool\n\tif runtimeDefaulter, ok := temp.(genruntime.Defaulter); ok {\n\t\truntimeDefaulter.CustomDefault()\n\t}\n}", "title": "" }, { "docid": "c2803c2782f0dc8980fa3c4f9b16413c", "score": "0.64039636", "text": "func Default(value, defaultValue interface{}) interface{} {\n\treturn IIf(value, value, defaultValue)\n}", "title": "" }, { "docid": "4b76bb18b220a6e2346435a03db5bc9e", "score": "0.63744724", "text": "func (o *Option) Default(def string) *Option {\n\tif o.boolean {\n\t\tpanic(\"Cannot set default value for boolean flag.\")\n\t}\n\to.def = def\n\treturn o\n}", "title": "" }, { "docid": "66e8642a98b8d82fb54e2e396eeec7ed", "score": "0.6349358", "text": "func (r *RoleBinding) Default() {\n\trolebindinglog.Info(\"default\", \"name\", r.Name)\n}", "title": "" }, { "docid": "d972db5a0edb1b6f89fec3db448e2eab", "score": "0.6347686", "text": "func (r *OAPServerDynamicConfig) Default() {\n\toapserverdynamicconfiglog.Info(\"default\", \"name\", r.Name)\n\n\t// Default version is \"9.5.0\"\n\tif r.Spec.Version == \"\" {\n\t\tr.Spec.Version = \"9.5.0\"\n\t}\n\n\t// Default labelselector is \"app=collector,release=skywalking\"\n\tif r.Spec.LabelSelector == \"\" {\n\t\tr.Spec.LabelSelector = \"app=collector,release=skywalking\"\n\t}\n}", "title": "" }, { "docid": "32f5d6152776bf1f25242ce0b65ab542", "score": "0.634688", "text": "func (s *UserInterfaceSpec) Default() {\n\tif s.PGAdmin != nil {\n\t\ts.PGAdmin.Default()\n\t}\n}", "title": "" }, { "docid": "80226daab03986636f41822a5d515003", "score": "0.6322024", "text": "func (spec *HeatSpec) Default() {\n\tif spec.HeatAPI.ContainerImage == \"\" {\n\t\tspec.HeatAPI.ContainerImage = heatDefaults.APIContainerImageURL\n\t}\n\tif spec.HeatCfnAPI.ContainerImage == \"\" {\n\t\tspec.HeatCfnAPI.ContainerImage = heatDefaults.CfnAPIContainerImageURL\n\t}\n\tif spec.HeatEngine.ContainerImage == \"\" {\n\t\tspec.HeatEngine.ContainerImage = heatDefaults.EngineContainerImageURL\n\t}\n}", "title": "" }, { "docid": "5dbf7f99e8af800f01435269ff4b9243", "score": "0.63172185", "text": "func (o ServerScopeOutput) Default() pulumi.BoolPtrOutput {\n\treturn o.ApplyT(func(v *ServerScope) pulumi.BoolPtrOutput { return v.Default }).(pulumi.BoolPtrOutput)\n}", "title": "" }, { "docid": "4380b037f47795f0785ebe855cbbe4da", "score": "0.6317063", "text": "func (record *PrivateDnsZonesAAAARecord) Default() {\n\trecord.defaultImpl()\n\tvar temp any = record\n\tif runtimeDefaulter, ok := temp.(genruntime.Defaulter); ok {\n\t\truntimeDefaulter.CustomDefault()\n\t}\n}", "title": "" }, { "docid": "a25965f61b965c13d01edd977c7ef696", "score": "0.6300664", "text": "func (r *Router) Default(w http.ResponseWriter, req *http.Request) {\n\tw.WriteHeader(404)\n}", "title": "" }, { "docid": "d3ce99b5d944026d403ee7473e83fce9", "score": "0.6298709", "text": "func (r *Fetcher) Default() {\n\tfetcherlog.Info(\"default\", \"name\", r.Name)\n\tif r.Spec.ClusterName == \"\" {\n\t\tr.Spec.ClusterName = r.Name\n\t}\n}", "title": "" }, { "docid": "829a58d7e2a042d1cb9497f22dd8511f", "score": "0.62849224", "text": "func (r *QuotaResult) IsDefault() bool {\n\treturn status.IsOK(r.Status) && r.ValidDuration == 0 && r.Amount == 0\n}", "title": "" }, { "docid": "ab5625a877a946aa8c510de9ec367bac", "score": "0.6282284", "text": "func (r *ServiceBinding) Default() {\n\tservicebindinglog.Info(\"default\", \"name\", r.Name)\n\n\tif len(r.Spec.ExternalName) == 0 {\n\t\tservicebindinglog.Info(\"externalName not provided, defaulting to k8s name\", \"name\", r.Name)\n\t\tr.Spec.ExternalName = r.Name\n\t}\n\tif len(r.Spec.SecretName) == 0 {\n\t\tservicebindinglog.Info(\"secretName not provided, defaulting to k8s name\", \"name\", r.Name)\n\t\tr.Spec.SecretName = r.Name\n\t}\n}", "title": "" }, { "docid": "008da9c89c9c6e4cff952f59ee98a7d3", "score": "0.62657636", "text": "func (profile *DefaultProfile) InitDefault() error {\n\treturn profile.Init(DefaultKey[:16])\n}", "title": "" }, { "docid": "178eb0304e28c5a44fbd309e54ed2483", "score": "0.62644744", "text": "func (v *Validator) DefaultSpec() interface{} {\n\treturn &Spec{}\n}", "title": "" }, { "docid": "2c88a057517ca65212cee58fb7b8bdf0", "score": "0.6255412", "text": "func Default(s, def string) string {\n\tif s == \"\" {\n\t\treturn def\n\t}\n\treturn s\n}", "title": "" }, { "docid": "aa1445a05a33f5e183fb34fabcb26721", "score": "0.6241449", "text": "func (s *PostgresProxySpec) Default() {\n\tif s.PGBouncer != nil {\n\t\ts.PGBouncer.Default()\n\t}\n}", "title": "" }, { "docid": "d93d7618b7a03a2d48093aced74ce6e8", "score": "0.6240991", "text": "func AskDefault(title, defValue string, sensitive bool) (string, error) {\n\ttitle = fmt.Sprintf(\"Enter %s [%s]: \", title, defValue)\n\tresp, err := Ask(title, sensitive)\n\tif len(resp) == 0 {\n\t\tresp = defValue\n\t}\n\treturn resp, err\n}", "title": "" }, { "docid": "75adb45a533681bef2dbe4f32ef19215", "score": "0.6214261", "text": "func (o SecretBackendConfigIssuersOutput) Default() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v *SecretBackendConfigIssuers) pulumi.StringPtrOutput { return v.Default }).(pulumi.StringPtrOutput)\n}", "title": "" }, { "docid": "0e832a613e90d18ee4408f04c460f734", "score": "0.61943024", "text": "func (*Default) Name() string {\n\treturn \"default\"\n}", "title": "" }, { "docid": "591164e989911a93be5e727e50801ad5", "score": "0.61936057", "text": "func TestDefault(t *testing.T) {\n\te0 := errorCount\n\n\ttype DD struct {\n\t\tX int\n\t}\n\n\t// send a default value...\n\tdd1 := DD{}\n\n\tw := new(bytes.Buffer)\n\te := NewEncoder(w)\n\te.Encode(dd1)\n\tdata := w.Bytes()\n\n\t// and receive it into memory that already\n\t// holds non-default values.\n\treply := DD{99}\n\n\tr := bytes.NewBuffer(data)\n\td := NewDecoder(r)\n\td.Decode(&reply)\n\n\tif errorCount != e0+1 {\n\t\tt.Fatalf(\"failed to warn about decoding into non-default value\")\n\t}\n}", "title": "" }, { "docid": "6afc061f466fa8c5d5bf7157eb043223", "score": "0.61927027", "text": "func (route *RouteTablesRoute) Default() {\n\troute.defaultImpl()\n\tvar temp any = route\n\tif runtimeDefaulter, ok := temp.(genruntime.Defaulter); ok {\n\t\truntimeDefaulter.CustomDefault()\n\t}\n}", "title": "" }, { "docid": "3c9c1a345103deb7eaeaa77b2120e25c", "score": "0.6191247", "text": "func (r *BlueGreenDeployment) Default() {\n\tbluegreendeploymentlog.Info(\"default\", \"name\", r.Name)\n\tr.Status.ActiveColor = ColorBlue\n\tif r.Spec.Replicas == nil {\n\t\tr.Spec.Replicas = &DefaultReplicas\n\t}\n\tif r.Spec.BackupScaleDownPercent == nil {\n\t\tr.Spec.BackupScaleDownPercent = &DefaultScaleDownPercent\n\t}\n\tif r.Spec.SwapStrategy == \"\" {\n\t\tr.Spec.SwapStrategy = ScaleThenSwap\n\t}\n}", "title": "" }, { "docid": "6174b3249f49e64e2f969767606dd04d", "score": "0.61844313", "text": "func (_Unit *UnitCaller) DefaultPrice(opts *bind.CallOpts) (*big.Int, error) {\n\tvar (\n\t\tret0 = new(*big.Int)\n\t)\n\tout := ret0\n\terr := _Unit.contract.Call(opts, out, \"defaultPrice\")\n\treturn *ret0, err\n}", "title": "" }, { "docid": "6f3e2a7f099389af34246ff6417ec033", "score": "0.6179077", "text": "func (m *Common) SetDefault() {\n\tm.IsDeleted = ptr.Bool(false)\n\tm.IsEnabled = ptr.Bool(true)\n\tm.CreatedAt = nil\n\tm.UpdatedAt = nil\n}", "title": "" }, { "docid": "f5468978d857ebbba8b0e1f121835014", "score": "0.6168141", "text": "func Default() alice.Constructor {\n\treturn New(JSON, XML, YAML, XML)\n}", "title": "" }, { "docid": "a88cd3c6485d839c3ad76952eeb39492", "score": "0.61630535", "text": "func (spec *ClusterLoaderSpec) Default(cfg *Config) {\n}", "title": "" }, { "docid": "38d99c8c2f2549ce014e2460d43844ce", "score": "0.6156853", "text": "func (m *Machine) Default() {\n\tif m.Labels == nil {\n\t\tm.Labels = make(map[string]string)\n\t}\n\tm.Labels[ClusterNameLabel] = m.Spec.ClusterName\n\n\tif m.Spec.Bootstrap.ConfigRef != nil && m.Spec.Bootstrap.ConfigRef.Namespace == \"\" {\n\t\tm.Spec.Bootstrap.ConfigRef.Namespace = m.Namespace\n\t}\n\n\tif m.Spec.InfrastructureRef.Namespace == \"\" {\n\t\tm.Spec.InfrastructureRef.Namespace = m.Namespace\n\t}\n\n\tif m.Spec.Version != nil && !strings.HasPrefix(*m.Spec.Version, \"v\") {\n\t\tnormalizedVersion := \"v\" + *m.Spec.Version\n\t\tm.Spec.Version = &normalizedVersion\n\t}\n\n\tif m.Spec.NodeDeletionTimeout == nil {\n\t\tm.Spec.NodeDeletionTimeout = &metav1.Duration{Duration: defaultNodeDeletionTimeout}\n\t}\n}", "title": "" }, { "docid": "44570ee0b9f37a5701aeefe796fffd7e", "score": "0.61501485", "text": "func (s *jsiiProxy_Succeed) MakeDefault(def State) {\n\t_jsii_.InvokeVoid(\n\t\ts,\n\t\t\"makeDefault\",\n\t\t[]interface{}{def},\n\t)\n}", "title": "" }, { "docid": "b33aa732c62fffdb0f37a6414f7c21cc", "score": "0.6146981", "text": "func (o *PaymentMethodCardResponseAllOf) GetDefaultOk() (*bool, bool) {\n\tif o == nil || IsNil(o.Default) {\n\t\treturn nil, false\n\t}\n\treturn o.Default, true\n}", "title": "" }, { "docid": "7353d71083061d5b3a011dacd133eadf", "score": "0.61388505", "text": "func (config *DeleteConfig) Default() {\n\tconfig.CaseName = \"*\" // default: delete from all cases\n\tconfig.Endpoint = \"\" // default detele single endpoint\n\tconfig.EndpointList = nil // Used if need to delete more than one endpoint\n}", "title": "" }, { "docid": "95eba0f00af589277e6fcf321ba5496a", "score": "0.61339283", "text": "func (o *PaymentMethodCardResponseAllOf) HasDefault() bool {\n\tif o != nil && !IsNil(o.Default) {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "942a7e17ec089092c0b942cf09e4da4a", "score": "0.613226", "text": "func (c *Configuration) Default() {\n\tif c == nil {\n\t\treturn\n\t}\n\tif c.SheetName == \"\" {\n\t\tc.SheetName = DefaultSheetName\n\t}\n\tif c.Columns == \"\" {\n\t\tc.Columns = DefaultColumns\n\t}\n}", "title": "" }, { "docid": "9ba9f6fc9c4397b558cfaeaab284292a", "score": "0.61296815", "text": "func (me TimageFormatHintPrecisionEnum) IsDefault() bool { return me == \"DEFAULT\" }", "title": "" }, { "docid": "f753cb9299ee8d4a34cbcd7eb94c94a5", "score": "0.6129186", "text": "func isDefault(value interface{}, defaultVal interface{}) bool {\n\treturn value == defaultVal\n}", "title": "" }, { "docid": "7c67c73fe21ac93705093336e2337a1e", "score": "0.61198026", "text": "func (r *AlamedaNotificationChannel) Default() {\n\tchannelWhScope.Infof(\"default webhook for channel: %s\", r.Name)\n\n\tif r.Spec.Email.Encryption == \"\" {\n\t\tr.Spec.Email.Encryption = \"tls\"\n\t}\n\n\tk8sClnt := r.mgr.GetClient()\n\toldChannel := &AlamedaNotificationChannel{}\n\tk8sClnt.Get(context.TODO(), client.ObjectKey{\n\t\tNamespace: r.GetNamespace(),\n\t\tName: r.GetName(),\n\t}, oldChannel)\n\n\t// if username or password modified, encode them again\n\tif oldChannel.Spec.Email.Username != r.Spec.Email.Username {\n\t\tr.Spec.Email.Username = b64.StdEncoding.EncodeToString([]byte(r.Spec.Email.Username))\n\t}\n\tif oldChannel.Spec.Email.Password != r.Spec.Email.Password {\n\t\tr.Spec.Email.Password = b64.StdEncoding.EncodeToString([]byte(r.Spec.Email.Password))\n\t}\n\n\tannotations := r.GetAnnotations()\n\ttestVal, ok := annotations[\"notifying.containers.ai/test-channel\"]\n\tif !ok || testVal != \"start\" {\n\t\tannotations[\"notifying.containers.ai/test-channel\"] = \"done\"\n\t\tr.SetAnnotations(annotations)\n\t}\n}", "title": "" }, { "docid": "92b900b563110087bfc19cf00c36c89e", "score": "0.6117579", "text": "func (binding *TrustedAccessRoleBinding) Default() {\n\tbinding.defaultImpl()\n\tvar temp any = binding\n\tif runtimeDefaulter, ok := temp.(genruntime.Defaulter); ok {\n\t\truntimeDefaulter.CustomDefault()\n\t}\n}", "title": "" }, { "docid": "17b2f25cb2c4ece6a624ece0ff078b5c", "score": "0.61073387", "text": "func DefaultParams() Params {\n\treturn NewParams(\n\t\tsdk.NewDecWithPrec(1, 2), // 1%\n\t)\n}", "title": "" }, { "docid": "dc6908acd248717a597db85c4b16b034", "score": "0.610669", "text": "func Default() *Generator {\n\treturn defaultGenerator\n}", "title": "" }, { "docid": "2201d26bd8b10aae32b9049c6cb81f6d", "score": "0.61044323", "text": "func (o *PaymentMethodCardResponseAllOf) SetDefault(v bool) {\n\to.Default = &v\n}", "title": "" }, { "docid": "2184c6b499bb50d553b27cbf9d74ff3a", "score": "0.61003846", "text": "func (r *LogSystem) Default() {\n\tlogsystemlog.Info(\"default\", \"name\", r.Name)\n\n\tswitch r.Spec.Stack {\n\tcase LogSystemStackPLGMonolithic:\n\t\tif r.Spec.PLGConfig == nil {\n\t\t\tr.Spec.PLGConfig = &PLGConfig{}\n\t\t}\n\n\t\tif r.Spec.PLGConfig.Grafana == nil {\n\t\t\tr.Spec.PLGConfig.Grafana = &GrafanaConfig{}\n\t\t}\n\n\t\tif r.Spec.PLGConfig.Promtail == nil {\n\t\t\tr.Spec.PLGConfig.Promtail = &PromtailConfig{}\n\t\t}\n\n\t\tif r.Spec.PLGConfig.Loki == nil {\n\t\t\tr.Spec.PLGConfig.Loki = &LokiConfig{}\n\t\t}\n\n\t\tif r.Spec.PLGConfig.Loki.Image == \"\" {\n\t\t\tr.Spec.PLGConfig.Loki.Image = LokiImage\n\t\t}\n\n\t\tif r.Spec.PLGConfig.Loki.DiskSize == nil {\n\t\t\tquantity := resource.MustParse(DefaultLokiDiskSize)\n\t\t\tr.Spec.PLGConfig.Loki.DiskSize = &quantity\n\t\t}\n\n\t\tif r.Spec.PLGConfig.Loki.DiskSize == nil {\n\t\t\tquantity := resource.MustParse(DefaultLokiDiskSize)\n\t\t\tr.Spec.PLGConfig.Loki.DiskSize = &quantity\n\t\t}\n\n\t\tif r.Spec.PLGConfig.Grafana.Image == \"\" {\n\t\t\tr.Spec.PLGConfig.Grafana.Image = GrafanaImage\n\t\t}\n\n\t\tif r.Spec.PLGConfig.Promtail.Image == \"\" {\n\t\t\tr.Spec.PLGConfig.Promtail.Image = PromtailImage\n\t\t}\n\t}\n}", "title": "" }, { "docid": "78c1911bc0c36d2ae1332367acdb3801", "score": "0.6096761", "text": "func (i *InsertBuilder) Default() *InsertBuilder {\n\ti.defaults = true\n\treturn i\n}", "title": "" }, { "docid": "cd3fa839f5b022782ce53727e78c0595", "score": "0.60941184", "text": "func (c *jsiiProxy_Choice) MakeDefault(def State) {\n\t_jsii_.InvokeVoid(\n\t\tc,\n\t\t\"makeDefault\",\n\t\t[]interface{}{def},\n\t)\n}", "title": "" }, { "docid": "1444a3695aae21e3500dae0d6dd26949", "score": "0.6092762", "text": "func (f *jsiiProxy_Fail) MakeDefault(def State) {\n\t_jsii_.InvokeVoid(\n\t\tf,\n\t\t\"makeDefault\",\n\t\t[]interface{}{def},\n\t)\n}", "title": "" }, { "docid": "0be9d0982ace46e4faa2569373f6c158", "score": "0.60923576", "text": "func (this *Count) Default() value.Value { return value.ZERO_VALUE }", "title": "" }, { "docid": "6bed88759d2a783a4e0610635c5c5608", "score": "0.6092035", "text": "func Usage_Default() api_usage.Usage {\n\treturn api_usage.MakeUsageFromMap(map[string]bool{\n\t\tUSAGE_EXTERNAL_EXEC: true,\n\t})\n}", "title": "" }, { "docid": "5b965d65741c6febb83b1bf9dc91d77b", "score": "0.60896844", "text": "func (mr *MockManifestMockRecorder) DefaultVersion(arg0 interface{}) *gomock.Call {\n\tmr.mock.ctrl.T.Helper()\n\treturn mr.mock.ctrl.RecordCallWithMethodType(mr.mock, \"DefaultVersion\", reflect.TypeOf((*MockManifest)(nil).DefaultVersion), arg0)\n}", "title": "" }, { "docid": "f299a4e0464b2601654df9b57cfe66f7", "score": "0.60807085", "text": "func (zone *DnsZone) Default() {\n\tzone.defaultImpl()\n\tvar temp any = zone\n\tif runtimeDefaulter, ok := temp.(genruntime.Defaulter); ok {\n\t\truntimeDefaulter.CustomDefault()\n\t}\n}", "title": "" }, { "docid": "ba50661ae044b4174208f0523e9f4fc6", "score": "0.6074471", "text": "func Default(handler Handler) Option {\n\treturn func(c *CLI) {\n\t\tc.defaultHandler = handler\n\t}\n}", "title": "" }, { "docid": "81b0f0f3e0c2d14455c2e5c5c1e5733c", "score": "0.60716975", "text": "func (o *PaymentMethodCardResponseAllOf) GetDefault() bool {\n\tif o == nil || IsNil(o.Default) {\n\t\tvar ret bool\n\t\treturn ret\n\t}\n\treturn *o.Default\n}", "title": "" }, { "docid": "99fe3697a7d4fb99cedaf9d7323bab68", "score": "0.60694283", "text": "func (c *ConfHolder) Default() []byte {\n\treturn nil\n}", "title": "" }, { "docid": "3b13d6e1740bdeafeeb3bc6106efc316", "score": "0.6061836", "text": "func (r *AWSMachinePool) Default() {\n\tif int(r.Spec.DefaultCoolDown.Duration.Seconds()) == 0 {\n\t\tlog.Info(\"DefaultCoolDown is zero, setting 300 seconds as default\")\n\t\tr.Spec.DefaultCoolDown.Duration = 300 * time.Second\n\t}\n}", "title": "" }, { "docid": "29b2610260d524669c854e93920199b1", "score": "0.6059875", "text": "func (o *Parameters) Default() {\n\n\t// sizes\n\to.Nova = 1\n\to.Noor = 0\n\to.Nsol = 40\n\to.Ncpu = 4\n\n\t// time\n\to.Tmax = 100\n\to.DtExc = -1\n\to.DtOut = -1\n\n\t// options\n\to.DEC = 0.8\n\to.Pll = true\n\to.Seed = 0\n\to.GenType = \"latin\"\n\to.LatinDup = 2\n\to.EpsH = 0.1\n\to.Verbose = true\n\to.VerbStat = false\n\to.VerbTime = false\n\to.GenAll = false\n\to.Nsamples = 10\n\to.BinInt = 0\n\to.ClearFlt = false\n\to.ExcTour = true\n\to.ExcOne = true\n\to.NormFlt = false\n\to.UseMesh = false\n\to.Nbry = 3\n\n\t// crossover and mutation of integers\n\to.IntPc = 0.8\n\to.IntNcuts = 1\n\to.IntPm = 0.01\n\to.IntNchanges = 1\n}", "title": "" }, { "docid": "9a7abef9b0bea2d1c1800365ec74ab56", "score": "0.6058027", "text": "func Default() *zap.SugaredLogger {\n\treturn _default\n}", "title": "" }, { "docid": "3f35ccc40f1f5e060c50909574192541", "score": "0.6057948", "text": "func (policy *StorageAccountsManagementPolicy) Default() {\n\tpolicy.defaultImpl()\n\tvar temp any = policy\n\tif runtimeDefaulter, ok := temp.(genruntime.Defaulter); ok {\n\t\truntimeDefaulter.CustomDefault()\n\t}\n}", "title": "" }, { "docid": "bece7bde76a30d0e0898b720f8e79591", "score": "0.605499", "text": "func DefaultMessage(status interface{}) string {\n\treturn HTTPStatusCode()[status]\n}", "title": "" }, { "docid": "51bc20131e2d3dca49747b9202600bec", "score": "0.60525656", "text": "func (pn BuildList) Default() []internals.Function {\n\tfor _, fm := range pn.Functions {\n\t\tif res := fm.Default(); len(res) != 0 {\n\t\t\treturn res\n\t\t}\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "6a885872f88cd601a71704e8bdf81de7", "score": "0.6046586", "text": "func (cfg *Config) Default() error {\n\tcfg.MetricTTL = DefaultMetricTTL\n\tcfg.WeightBucketSize = DefaultWeightBucketSize\n\treturn nil\n}", "title": "" }, { "docid": "6295ee35c9143589c08ac66f0e6183ee", "score": "0.60439795", "text": "func TestLevelDefault(t *testing.T) {\n\tl := GetLevel()\n\tif l != Info {\n\t\tt.Errorf(\"expected Info, got %s\", l)\n\t}\n\n\tos.Setenv(\"LOG_LEVEL\", \"Debug\")\n\tl = Default()\n\tif l != Debug {\n\t\tt.Errorf(\"expected Debug, got %s\", l)\n\t}\n\tos.Unsetenv(\"LOG_LEVEL\")\n}", "title": "" }, { "docid": "660e0950b5aebb0ca1fe5bfecc7887d1", "score": "0.6036304", "text": "func (args *DeployerArgs) Default() {\n\tif len(args.Name) == 0 {\n\t\targs.Name = \"generic-deployer-library\"\n\t}\n\tif len(args.Version) == 0 {\n\t\targs.Version = version.Get().String()\n\t}\n\tif len(args.Identity) == 0 {\n\t\targs.Identity = fmt.Sprintf(\"%s-%d\", args.Name, time.Now().UTC().Unix())\n\t}\n}", "title": "" }, { "docid": "0660d0787c635b254d97b2e92cfad69f", "score": "0.60312295", "text": "func (k *KKMachineTemplate) Default() {\n\tkkmachinetemplatelog.Info(\"default\", \"name\", k.Name)\n\n\tdefaultContainerManager(&k.Spec.Template.Spec)\n}", "title": "" }, { "docid": "262f652ad935b9a78aa4395d0885713f", "score": "0.6027494", "text": "func (rs *Registrations) Default(internalcfg *kubeadmapi.ClusterConfiguration) {\n\tfor _, registration := range *rs {\n\t\tregistration.DefaulterFunc(internalcfg)\n\t}\n}", "title": "" } ]
9c04e72761df1cbb58277e57e901c7b3
Pop advances time and returns the next event. If there are no remaining events, false is returned.
[ { "docid": "639b3ccc96374f5a34f5ddd39b666270", "score": "0.81804067", "text": "func (q *Queue) Pop() (Event, bool) {\n\tif q.length == 0 {\n\t\treturn Event{}, false\n\t}\n\n\tevent := Event{}\n\tfor event.ID == 0 && q.length > 0 {\n\t\tevent = q.events[q.start]\n\t\tq.events[q.start] = Event{}\n\t\tq.start = q.index(q.start+1)\n\t\tq.length--\n\t}\n\n\tif event.ID == 0 {\n\t\treturn Event{}, false\n\t}\n\n\tfor i := q.start; i != q.end; i = q.index(i+1) {\n\t\tq.events[i].Time -= event.Time \n\t}\n\n\treturn event, true\n}", "title": "" } ]
[ { "docid": "11bb3bb95a92be58a04cba100dc2285d", "score": "0.69628376", "text": "func (q *Queue) Pop() *Event {\n\tq.mu.Lock()\n\tdefer q.mu.Unlock()\n\n\tif q.count == 0 {\n\t\treturn nil\n\t}\n\n\tev := q.evs[q.head]\n\tq.head = (q.head + 1) % len(q.evs)\n\tq.count--\n\n\treturn ev\n}", "title": "" }, { "docid": "40390891af18094593f66b1180b8e5e4", "score": "0.6752833", "text": "func (q *Queue) Pop() (Candle, bool) {\n\tif q.len <= 0 {\n\t\treturn Candle{}, false\n\t}\n\tresult := q.content[q.readHead]\n\tq.content[q.readHead] = Candle{}\n\tq.readHead = (q.readHead + 1) % maxQueueSize\n\tq.len--\n\treturn result, true\n}", "title": "" }, { "docid": "3b9975b2fea6b0c462a9d74191eb2ae2", "score": "0.65137565", "text": "func (m *Memory) Pop() (e *Events) {\n\te = m.events\n\tm.Reset()\n\treturn\n}", "title": "" }, { "docid": "fd87546ce46106286624e39153aa1bea", "score": "0.64445436", "text": "func (u *Unbound) Pop() terminalapi.Event {\n\tu.mu.Lock()\n\tdefer u.mu.Unlock()\n\n\tif u.empty() {\n\t\treturn nil\n\t}\n\n\tn := u.first\n\tu.first = u.first.next\n\n\tif u.empty() {\n\t\tu.last = nil\n\t}\n\treturn n.event\n}", "title": "" }, { "docid": "f6f257a602d14382bc03b53a657c01a4", "score": "0.6415002", "text": "func (q *Queue) Pop() (v Elem, ok bool) {\n\tif q.Empty() {\n\t\t// Queue is empty, reset to recover space.\n\t\tq.Reset()\n\t\treturn\n\t}\n\n\tv, ok = q.buf[q.off], true\n\tresetSlice(q.buf[q.off : q.off+1]) // avoid memory leaks\n\tq.off++\n\treturn\n}", "title": "" }, { "docid": "b1517ca5719a91db968e3e10a389e87b", "score": "0.62506545", "text": "func (q *updateQueue) Pop() (osdID int, ok bool) {\n\tif q.Len() == 0 {\n\t\treturn -1, false\n\t}\n\n\tosdID = q.q[0]\n\tq.q = q.q[1:]\n\treturn osdID, true\n}", "title": "" }, { "docid": "740f08a8e104bcfe3bb7dd37c49b46ac", "score": "0.6250004", "text": "func (q *Queueimpl6) Pop() (interface{}, bool) {\n\tif q.len == 0 {\n\t\treturn nil, false\n\t}\n\n\tv := q.head.v[q.hp]\n\tq.head.v[q.hp] = nil // Avoid memory leaks\n\tq.len--\n\tq.hp++\n\n\tif q.hp > q.lasthp {\n\t\tn := q.head.n\n\t\tq.head.n = nil // Avoid memory leaks\n\t\tq.head = n\n\t\tq.hp = 0\n\t\tif n != nil {\n\t\t\tq.lasthp = len(n.v) - 1\n\t\t}\n\t}\n\n\treturn v, true\n}", "title": "" }, { "docid": "354851829d73838ae2954086029dd84d", "score": "0.6235329", "text": "func (q *Queue) pop() {\n\t// lock\n\tq.mutex.Lock()\n\tdefer q.mutex.Unlock()\n\n\tif len(q.events) == 0 {\n\t\tpopChan <- baseEvent{\n\t\t\tex: errors.New(\"empty queue\"),\n\t\t}\n\t\treturn\n\t}\n\t// get related event\n\tevent := q.events[len(q.events)-1]\n\tq.events = q.events[:len(q.events)-1]\n\t// get related action\n\taction := q.actions[len(q.actions)-1]\n\tq.actions = q.actions[:len(q.actions)-1]\n\n\tpopChan <- baseEvent{e: event, f: action}\n\treturn\n}", "title": "" }, { "docid": "44037e9b2d5e0562f6b6ea90e43abfd5", "score": "0.6176218", "text": "func (s *DecryptedMessageActionResendArray) Pop() (v DecryptedMessageActionResend, ok bool) {\n\tif s == nil || len(*s) < 1 {\n\t\treturn\n\t}\n\n\ta := *s\n\tv = a[len(a)-1]\n\ta = a[:len(a)-1]\n\t*s = a\n\n\treturn v, true\n}", "title": "" }, { "docid": "893a23cfd885d1a0404fd05fc5292847", "score": "0.61670464", "text": "func (s *InputStickeredMediaDocumentArray) Pop() (v InputStickeredMediaDocument, ok bool) {\n\tif s == nil || len(*s) < 1 {\n\t\treturn\n\t}\n\n\ta := *s\n\tv = a[len(a)-1]\n\ta = a[:len(a)-1]\n\t*s = a\n\n\treturn v, true\n}", "title": "" }, { "docid": "fa009768df3d076bd138797c542e6760", "score": "0.61127764", "text": "func (s *MessageArray) Pop() (v Message, ok bool) {\n\tif s == nil || len(*s) < 1 {\n\t\treturn\n\t}\n\n\ta := *s\n\tv = a[len(a)-1]\n\ta = a[:len(a)-1]\n\t*s = a\n\n\treturn v, true\n}", "title": "" }, { "docid": "389c752eb22231b019eb3dcd1f717540", "score": "0.61049664", "text": "func (s *DecryptedMessageActionSetMessageTTLArray) Pop() (v DecryptedMessageActionSetMessageTTL, ok bool) {\n\tif s == nil || len(*s) < 1 {\n\t\treturn\n\t}\n\n\ta := *s\n\tv = a[len(a)-1]\n\ta = a[:len(a)-1]\n\t*s = a\n\n\treturn v, true\n}", "title": "" }, { "docid": "b07dfbc815940b21abbdf36521093563", "score": "0.60863423", "text": "func (s *InputNotifyPeerArray) Pop() (v InputNotifyPeer, ok bool) {\n\tif s == nil || len(*s) < 1 {\n\t\treturn\n\t}\n\n\ta := *s\n\tv = a[len(a)-1]\n\ta = a[:len(a)-1]\n\t*s = a\n\n\treturn v, true\n}", "title": "" }, { "docid": "7a7222b3646d103bd7a6cf59f47d2264", "score": "0.60545206", "text": "func (s *Queue) pop() (string, bool) {\n\tif s.isEmpty() { // Return false if queue is empty.\n\t\treturn \"Queue is empty\", false\n\t} else {\n\t\telement := (*s)[0] // Index into the slice and obtain the element.\n\t\t*s = (*s)[1:] // Remove it from the queue by slicing it off.\n\t\treturn element, true\n\t}\n}", "title": "" }, { "docid": "7982a562e893c2735884e5c749c0b76c", "score": "0.60387844", "text": "func (s *GeoPointArray) Pop() (v GeoPoint, ok bool) {\n\tif s == nil || len(*s) < 1 {\n\t\treturn\n\t}\n\n\ta := *s\n\tv = a[len(a)-1]\n\ta = a[:len(a)-1]\n\t*s = a\n\n\treturn v, true\n}", "title": "" }, { "docid": "8d56be7be849cd937c9fd0e740918ebe", "score": "0.59842926", "text": "func (s *MessageEmptyArray) Pop() (v MessageEmpty, ok bool) {\n\tif s == nil || len(*s) < 1 {\n\t\treturn\n\t}\n\n\ta := *s\n\tv = a[len(a)-1]\n\ta = a[:len(a)-1]\n\t*s = a\n\n\treturn v, true\n}", "title": "" }, { "docid": "678635479efc26891d08cb4efa927697", "score": "0.5972627", "text": "func (s *DecryptedMessageActionNotifyLayerArray) Pop() (v DecryptedMessageActionNotifyLayer, ok bool) {\n\tif s == nil || len(*s) < 1 {\n\t\treturn\n\t}\n\n\ta := *s\n\tv = a[len(a)-1]\n\ta = a[:len(a)-1]\n\t*s = a\n\n\treturn v, true\n}", "title": "" }, { "docid": "dda60e0d5d9541953192f96762a37fa9", "score": "0.5965033", "text": "func (ep *epochPump) popFront() *readyEpoch {\n\tif len(ep.q) == 0 {\n\t\treturn nil\n\t}\n\tx := ep.q[0]\n\tep.q = ep.q[1:]\n\treturn x\n}", "title": "" }, { "docid": "bcf5ec67c86814efdc044b912c81d312", "score": "0.5958683", "text": "func (synced *SyncedStack) Pop() (interface{}, bool) {\n\tsynced.mutex.Lock()\n\tdefer synced.mutex.Unlock()\n\treturn synced.Stack.Pop()\n}", "title": "" }, { "docid": "ea53f6b56d9036d49e6e3c03cc2baf31", "score": "0.59502953", "text": "func (s *InputBotInlineResultGameArray) Pop() (v InputBotInlineResultGame, ok bool) {\n\tif s == nil || len(*s) < 1 {\n\t\treturn\n\t}\n\n\ta := *s\n\tv = a[len(a)-1]\n\ta = a[:len(a)-1]\n\t*s = a\n\n\treturn v, true\n}", "title": "" }, { "docid": "b6f62e90d490caf89adb3f7e85f0d76c", "score": "0.59490466", "text": "func (s *InputBotInlineMessageGameArray) Pop() (v InputBotInlineMessageGame, ok bool) {\n\tif s == nil || len(*s) < 1 {\n\t\treturn\n\t}\n\n\ta := *s\n\tv = a[len(a)-1]\n\ta = a[:len(a)-1]\n\t*s = a\n\n\treturn v, true\n}", "title": "" }, { "docid": "e20a1b534eef9a5b48eb3595d6a57e4a", "score": "0.59419954", "text": "func (s *InputBotInlineMessageMediaVenueArray) Pop() (v InputBotInlineMessageMediaVenue, ok bool) {\n\tif s == nil || len(*s) < 1 {\n\t\treturn\n\t}\n\n\ta := *s\n\tv = a[len(a)-1]\n\ta = a[:len(a)-1]\n\t*s = a\n\n\treturn v, true\n}", "title": "" }, { "docid": "ed6a461e649b63cd12b0e6db0ab77f62", "score": "0.5936306", "text": "func (d *List) Pop() (interface{}, bool) {\n\tif d.tail == nil {\n\t\treturn nil, false\n\t}\n\tdatum := d.tail.datum\n\td.tail = d.tail.prev\n\tif d.tail == nil {\n\t\td.head = nil\n\t} else {\n\t\td.tail.next = nil\n\t}\n\td.length--\n\treturn datum, true\n}", "title": "" }, { "docid": "b2c8830c0f8ef58edf6a95898f491f03", "score": "0.5932648", "text": "func (s *DecryptedMessageActionReadMessagesArray) Pop() (v DecryptedMessageActionReadMessages, ok bool) {\n\tif s == nil || len(*s) < 1 {\n\t\treturn\n\t}\n\n\ta := *s\n\tv = a[len(a)-1]\n\ta = a[:len(a)-1]\n\t*s = a\n\n\treturn v, true\n}", "title": "" }, { "docid": "6009713d3d730f947a51a70b4c066faf", "score": "0.5929316", "text": "func (s *EventSink) PeekLast() (Event, bool) {\n\tif len(s.events) < 1 {\n\t\treturn nilEvent, false\n\t}\n\treturn s.events[len(s.events)-1], true\n}", "title": "" }, { "docid": "0d325a76f0bcd1a036db6e72cb6db725", "score": "0.59185874", "text": "func (channel MessageQueue) Pop() (*Message, bool) {\n\tmsg, more := <-channel\n\treturn msg, more\n}", "title": "" }, { "docid": "8a800609c4d600f32bf9d3e11a037506", "score": "0.58990455", "text": "func (p *Pool) Pop() Element {\n\tp.wg.Add(1)\n\tcount := atomic.AddUint64(&(p.count), 1)\n\tindex := count % p.length\n\tpointer := (*unsafe.Pointer)(unsafe.Pointer(&(p.list[index])))\n\tfor {\n\t\tselect {\n\t\tcase <-p.ctx.Done():\n\t\t\tp.wg.Done()\n\t\t\treturn nil\n\t\tcase <-*p.pause:\n\t\t\tcontinue\n\t\tcase <-*p.subtract:\n\t\t\tindex = count % p.length\n\t\t\tpointer = (*unsafe.Pointer)(unsafe.Pointer(&(p.list[index])))\n\t\t\tcontinue\n\t\tdefault:\n\t\t\telem := atomic.SwapPointer(pointer, nil)\n\t\t\tif elem == nil {\n\t\t\t\truntime.Gosched()\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tep := (*Element)(elem)\n\t\t\treturn *ep\n\t\t}\n\t}\n}", "title": "" }, { "docid": "731f3dfe9c23d90a39c85303b70b6be8", "score": "0.58841926", "text": "func (s *DecryptedMessageActionTypingArray) Pop() (v DecryptedMessageActionTyping, ok bool) {\n\tif s == nil || len(*s) < 1 {\n\t\treturn\n\t}\n\n\ta := *s\n\tv = a[len(a)-1]\n\ta = a[:len(a)-1]\n\t*s = a\n\n\treturn v, true\n}", "title": "" }, { "docid": "1d162074512a2fee780f19dcebc79a09", "score": "0.58807415", "text": "func (p *Partition) Pop() ([]byte, error) {\n\tif p.count <= 0 {\n\t\treturn nil, fmt.Errorf(\"queue: Remove() called on empty queue\")\n\t}\n\tret := p.events[p.head]\n\tp.events[p.head] = nil\n\t// bitwise modulus\n\tp.head = (p.head + 1) & (len(p.events) - 1)\n\tp.count--\n\t// Resize down if buffer 1/4 full.\n\tif len(p.events) > minQueueLen && (p.count<<2) == len(p.events) {\n\t\tp.resize()\n\t}\n\treturn ret, nil\n}", "title": "" }, { "docid": "71e5b87871db2abda30407273283bf37", "score": "0.58806866", "text": "func (s *TextEmailArray) Pop() (v TextEmail, ok bool) {\n\tif s == nil || len(*s) < 1 {\n\t\treturn\n\t}\n\n\ta := *s\n\tv = a[len(a)-1]\n\ta = a[:len(a)-1]\n\t*s = a\n\n\treturn v, true\n}", "title": "" }, { "docid": "9d0d40cfc7434433275105fbad2c2d83", "score": "0.58665055", "text": "func (q *PQueue) Pop() Item {\n\tdefer q.wg.Done()\n\tq.ready <- nil\n\treturn <-q.out\n}", "title": "" }, { "docid": "686efe54bf40ede790eeccf2c88e27fa", "score": "0.5854578", "text": "func (s *MessageServiceArray) Pop() (v MessageService, ok bool) {\n\tif s == nil || len(*s) < 1 {\n\t\treturn\n\t}\n\n\ta := *s\n\tv = a[len(a)-1]\n\ta = a[:len(a)-1]\n\t*s = a\n\n\treturn v, true\n}", "title": "" }, { "docid": "69204d93e5da4574dc945414f9c859da", "score": "0.58403724", "text": "func (pq *priorityqueue) Pop() interface{} {\n\tn := pq.Len()\n\tstream := pq.streams[n-1]\n\tpq.streams[n-1] = nil // avoid memory leak\n\tpq.streams = pq.streams[:n-1]\n\n\t// put the rest of the stream back into the priorityqueue if more entries exist\n\tif len(stream.Entries) > 1 {\n\t\tremaining := *stream\n\t\tremaining.Entries = remaining.Entries[1:]\n\t\tpq.Push(&remaining)\n\t}\n\n\tstream.Entries = stream.Entries[:1]\n\treturn stream\n}", "title": "" }, { "docid": "592674569c91d1b711a9ae338ffd99be", "score": "0.5836838", "text": "func (ts *TimedSet) Pop(key string) time.Duration {\n\tts.Lock()\n\tdefer ts.Unlock()\n\tidx, ok := ts.items.Contains(key)\n\tif !ok {\n\t\treturn -1\n\t}\n\titem := heap.Remove(ts.items, idx)\n\treturn time.Since(item.(*TimedItem).Time)\n}", "title": "" }, { "docid": "e0b51726a0dd2b806c79fa0141645759", "score": "0.5826314", "text": "func (t *Throttled) Pop() terminalapi.Event {\n\treturn t.queue.Pop()\n}", "title": "" }, { "docid": "862bf8f0484394d9523aa49b1c0dfbb3", "score": "0.582323", "text": "func (s *InputStickeredMediaPhotoArray) Pop() (v InputStickeredMediaPhoto, ok bool) {\n\tif s == nil || len(*s) < 1 {\n\t\treturn\n\t}\n\n\ta := *s\n\tv = a[len(a)-1]\n\ta = a[:len(a)-1]\n\t*s = a\n\n\treturn v, true\n}", "title": "" }, { "docid": "e96626333585fdf97ff5e9bd52fb6cd1", "score": "0.5822162", "text": "func (q *Queue) Push(event Event) {\n\tif q.length == len(q.events) {\n\t\tq.expand()\n\t}\n\n\ti := q.end\n\tfor i != q.start {\n\t\tj := q.index(i - 1)\n\t\tif event.Time < q.events[j].Time {\n\t\t\tq.events[i] = q.events[j]\n\t\t\ti = j\n\t\t} else {\n\t\t\tbreak\n\t\t}\n\t}\n\tq.events[i] = event\n\n\tq.length++\n\tq.end = q.index(q.end + 1)\n}", "title": "" }, { "docid": "5789666b104ec12c4c501fa3150bc054", "score": "0.5817853", "text": "func (s *InputBotInlineResultArray) Pop() (v InputBotInlineResult, ok bool) {\n\tif s == nil || len(*s) < 1 {\n\t\treturn\n\t}\n\n\ta := *s\n\tv = a[len(a)-1]\n\ta = a[:len(a)-1]\n\t*s = a\n\n\treturn v, true\n}", "title": "" }, { "docid": "648a364a9b39acf3aebad96cc1e18861", "score": "0.5810116", "text": "func (s *InputBotInlineResultDocumentArray) Pop() (v InputBotInlineResultDocument, ok bool) {\n\tif s == nil || len(*s) < 1 {\n\t\treturn\n\t}\n\n\ta := *s\n\tv = a[len(a)-1]\n\ta = a[:len(a)-1]\n\t*s = a\n\n\treturn v, true\n}", "title": "" }, { "docid": "a233953b8401e47c8d4b042562cff17b", "score": "0.5800875", "text": "func (s *ChannelParticipantLeftArray) Pop() (v ChannelParticipantLeft, ok bool) {\n\tif s == nil || len(*s) < 1 {\n\t\treturn\n\t}\n\n\ta := *s\n\tv = a[len(a)-1]\n\ta = a[:len(a)-1]\n\t*s = a\n\n\treturn v, true\n}", "title": "" }, { "docid": "72134251991a9c66a06b5780155d7e26", "score": "0.5800058", "text": "func (s *DecryptedMessageActionAcceptKeyArray) Pop() (v DecryptedMessageActionAcceptKey, ok bool) {\n\tif s == nil || len(*s) < 1 {\n\t\treturn\n\t}\n\n\ta := *s\n\tv = a[len(a)-1]\n\ta = a[:len(a)-1]\n\t*s = a\n\n\treturn v, true\n}", "title": "" }, { "docid": "4990eb853abbe1866a09dce19082fe65", "score": "0.57918257", "text": "func (s *MessagesEmojiGroupsArray) Pop() (v MessagesEmojiGroups, ok bool) {\n\tif s == nil || len(*s) < 1 {\n\t\treturn\n\t}\n\n\ta := *s\n\tv = a[len(a)-1]\n\ta = a[:len(a)-1]\n\t*s = a\n\n\treturn v, true\n}", "title": "" }, { "docid": "8043ac4efc7f6669f334dc1f529a8517", "score": "0.57783383", "text": "func (s *InputStickerSetDiceArray) Pop() (v InputStickerSetDice, ok bool) {\n\tif s == nil || len(*s) < 1 {\n\t\treturn\n\t}\n\n\ta := *s\n\tv = a[len(a)-1]\n\ta = a[:len(a)-1]\n\t*s = a\n\n\treturn v, true\n}", "title": "" }, { "docid": "b10d6074e5b9fc4ea96a29807ec23384", "score": "0.5773286", "text": "func (q *SyncQueue) Pop() interface{} {\r\n\tc := q.cond\r\n\tbuffer := q.buffer\r\n\r\n\tq.lock.Lock()\r\n\tfor buffer.Length() == 0 {\r\n\t\tc.Wait()\r\n\t}\r\n\r\n\tv := buffer.Peek()\r\n\tbuffer.Remove()\r\n\r\n\tq.lock.Unlock()\r\n\treturn v\r\n}", "title": "" }, { "docid": "d6ae5a7628921ed3d831c1f24cb555d5", "score": "0.5753495", "text": "func (s *HelpTermsOfServiceUpdateEmptyArray) Pop() (v HelpTermsOfServiceUpdateEmpty, ok bool) {\n\tif s == nil || len(*s) < 1 {\n\t\treturn\n\t}\n\n\ta := *s\n\tv = a[len(a)-1]\n\ta = a[:len(a)-1]\n\t*s = a\n\n\treturn v, true\n}", "title": "" }, { "docid": "89d9edeefc318273934e98ff1c740774", "score": "0.5746181", "text": "func (s *String) Pop() (string, bool) {\n\tif s.Empty() {\n\t\treturn \"\", false\n\t}\n\n\titem := s.items[s.pos]\n\ts.items[s.pos] = \"\"\n\ts.pos++\n\n\ts.compact()\n\ts.recycle()\n\n\treturn item, true\n}", "title": "" }, { "docid": "c5ec7658cc78c3d029eed288d3fbab68", "score": "0.5745024", "text": "func (d *Deque) PopBack() (interface{}, bool) {\n\tif d.len == 0 {\n\t\treturn nil, false\n\t}\n\n\td.len--\n\tv := d.tail.v[d.tp]\n\td.tail.v[d.tp] = nil // Avoid memory leaks\n\td.tp--\n\tif d.tp < 0 {\n\t\tif d.head != d.tail {\n\t\t\tif d.spareLinks >= maxSpareLinks {\n\t\t\t\td.head.p.n = d.head.n // Eliminate this link\n\t\t\t} else {\n\t\t\t\td.spareLinks++\n\t\t\t}\n\t\t}\n\t\td.tail = d.tail.p\n\t\td.tp = len(d.tail.v) - 1\n\t}\n\treturn v, true\n}", "title": "" }, { "docid": "cc37ce8744407972eb37644cc19ad5bf", "score": "0.5740234", "text": "func (s *TextMarkedArray) Pop() (v TextMarked, ok bool) {\n\tif s == nil || len(*s) < 1 {\n\t\treturn\n\t}\n\n\ta := *s\n\tv = a[len(a)-1]\n\ta = a[:len(a)-1]\n\t*s = a\n\n\treturn v, true\n}", "title": "" }, { "docid": "31ba8ec51ac4c7dd7867f51222a7b951", "score": "0.57276607", "text": "func (s *InputBotInlineMessageMediaAutoArray) Pop() (v InputBotInlineMessageMediaAuto, ok bool) {\n\tif s == nil || len(*s) < 1 {\n\t\treturn\n\t}\n\n\ta := *s\n\tv = a[len(a)-1]\n\ta = a[:len(a)-1]\n\t*s = a\n\n\treturn v, true\n}", "title": "" }, { "docid": "450c87fe96023f5e019e8ffd06bcda88", "score": "0.57254905", "text": "func (q *Queue) Pop(timeout time.Duration) (interface{}, error) {\n\tch := make(chan interface{}, 1)\n\tquit := make(chan bool, 1)\n\tgo func() {\n\t\tfor {\n\t\t\tselect {\n\t\t\tcase <-quit:\n\t\t\t\treturn\n\t\t\tdefault:\n\t\t\t\tq.mux.Lock()\n\t\t\t\tif len(q.Items) != 0 {\n\t\t\t\t\tpopped := q.Items[0]\n\t\t\t\t\tq.Items = q.Items[1:]\n\t\t\t\t\tch <- popped\n\t\t\t\t\tq.mux.Unlock()\n\t\t\t\t\treturn\n\t\t\t\t}\n\t\t\t\tq.mux.Unlock()\n\t\t\t}\n\t\t}\n\t}()\n\tselect {\n\tcase res := <-ch:\n\t\treturn res, nil\n\tcase <-time.After(timeout):\n\t\tquit <- true\n\t\treturn nil, errors.New(\"couldn't pop Queue\")\n\t}\n}", "title": "" }, { "docid": "9c7bffb1fe3251fa1a235b4f43307592", "score": "0.5716561", "text": "func (q *fifoTaskQueue) poll() (polled interface{}, ok bool) {\n\tif q.size == 0 {\n\t\tok = false\n\t\treturn\n\t} else {\n\t\tpolled = q.slice[q.head]\n\t\t// clear the entry in the queue so we don't leak references to\n\t\t// things like the callback (and also allow strings in the event\n\t\t// to be promptly GCed)\n\t\tq.slice[q.head] = nil\n\t\tok = true\n\t}\n\tq.head = (q.head + 1) % len(q.slice)\n\tq.size--\n\treturn\n}", "title": "" }, { "docid": "f4f7fc58692a6c18418cc6006674ce58", "score": "0.57135063", "text": "func (s *DecryptedMessageActionScreenshotMessagesArray) Pop() (v DecryptedMessageActionScreenshotMessages, ok bool) {\n\tif s == nil || len(*s) < 1 {\n\t\treturn\n\t}\n\n\ta := *s\n\tv = a[len(a)-1]\n\ta = a[:len(a)-1]\n\t*s = a\n\n\treturn v, true\n}", "title": "" }, { "docid": "b25e8cbdda5a5ecf09bf4df5b3cf12b5", "score": "0.5708279", "text": "func (obj *RedisDb) BlockedPop(stream string) (bool, []string) {\n\tv := obj.R.BLPop(0, stream)\n\tif v.Err() != nil {\n\t\treturn false, v.Val()\n\t}\n\treturn true, v.Val()\n}", "title": "" }, { "docid": "59af39d05d9a918bed9967c3d4211bf0", "score": "0.5703926", "text": "func (s *DecryptedMessageActionAbortKeyArray) Pop() (v DecryptedMessageActionAbortKey, ok bool) {\n\tif s == nil || len(*s) < 1 {\n\t\treturn\n\t}\n\n\ta := *s\n\tv = a[len(a)-1]\n\ta = a[:len(a)-1]\n\t*s = a\n\n\treturn v, true\n}", "title": "" }, { "docid": "9c971edb581eacd36b9189f89f3cdcc9", "score": "0.5698323", "text": "func (h *EventHeap) Pop() interface{} {\n\tnewLen := len(h.Txs) - 1\n\tval := h.Txs[newLen]\n\th.Txs = h.Txs[:newLen]\n\treturn val\n}", "title": "" }, { "docid": "de88b1c391fea01351ec935470af4bd1", "score": "0.569015", "text": "func (s *HelpTermsOfServiceUpdateArray) Pop() (v HelpTermsOfServiceUpdate, ok bool) {\n\tif s == nil || len(*s) < 1 {\n\t\treturn\n\t}\n\n\ta := *s\n\tv = a[len(a)-1]\n\ta = a[:len(a)-1]\n\t*s = a\n\n\treturn v, true\n}", "title": "" }, { "docid": "4e7beb7f75547359f41aa32a0ab1fc40", "score": "0.56874204", "text": "func (s *DecryptedMessageActionRequestKeyArray) Pop() (v DecryptedMessageActionRequestKey, ok bool) {\n\tif s == nil || len(*s) < 1 {\n\t\treturn\n\t}\n\n\ta := *s\n\tv = a[len(a)-1]\n\ta = a[:len(a)-1]\n\t*s = a\n\n\treturn v, true\n}", "title": "" }, { "docid": "51a433cb6aac539c732e4cf8f26da720", "score": "0.5684494", "text": "func (s *TextConcatArray) Pop() (v TextConcat, ok bool) {\n\tif s == nil || len(*s) < 1 {\n\t\treturn\n\t}\n\n\ta := *s\n\tv = a[len(a)-1]\n\ta = a[:len(a)-1]\n\t*s = a\n\n\treturn v, true\n}", "title": "" }, { "docid": "8bad88e9966e656cf2693bbbec274070", "score": "0.56841904", "text": "func (s *AuthSentCodeTypeFlashCallArray) Pop() (v AuthSentCodeTypeFlashCall, ok bool) {\n\tif s == nil || len(*s) < 1 {\n\t\treturn\n\t}\n\n\ta := *s\n\tv = a[len(a)-1]\n\ta = a[:len(a)-1]\n\t*s = a\n\n\treturn v, true\n}", "title": "" }, { "docid": "6ed36a5b70bfcf654289118a15e1b49b", "score": "0.567933", "text": "func (s *TextStrikeArray) Pop() (v TextStrike, ok bool) {\n\tif s == nil || len(*s) < 1 {\n\t\treturn\n\t}\n\n\ta := *s\n\tv = a[len(a)-1]\n\ta = a[:len(a)-1]\n\t*s = a\n\n\treturn v, true\n}", "title": "" }, { "docid": "f41fdb81c68dc5f9294a277e9fceed4f", "score": "0.56790537", "text": "func (s *Stack) Pop() (interface{}, bool) {\n\tif s.len > 0 {\n\t\ts.len--\n\t\tret := s.data[s.len]\n\t\ts.data = s.data[:s.len]\n\t\treturn ret, true\n\t}\n\treturn 0, false\n}", "title": "" }, { "docid": "8c0a8f160d07a470887e76f8b7a3ddd7", "score": "0.5676092", "text": "func (s *InputWallPaperNoFileArray) Pop() (v InputWallPaperNoFile, ok bool) {\n\tif s == nil || len(*s) < 1 {\n\t\treturn\n\t}\n\n\ta := *s\n\tv = a[len(a)-1]\n\ta = a[:len(a)-1]\n\t*s = a\n\n\treturn v, true\n}", "title": "" }, { "docid": "77be7794015cdf29ada4ea91634718ed", "score": "0.5673535", "text": "func (rb *RingBuffer) Pop() (item interface{}, err error) {\n\trb.cond.L.Lock()\n\tdefer rb.cond.L.Unlock()\n\n\tfor {\n\t\titem, ok := rb.noLockPop()\n\n\t\tif ok {\n\t\t\treturn item, nil\n\t\t}\n\n\t\tif rb.closed {\n\t\t\treturn nil, io.EOF\n\t\t}\n\n\t\trb.cond.Wait()\n\t}\n}", "title": "" }, { "docid": "61a4dc7151c919acdc5c5be774b0a675", "score": "0.56680536", "text": "func (s *InputWallPaperArray) Pop() (v InputWallPaper, ok bool) {\n\tif s == nil || len(*s) < 1 {\n\t\treturn\n\t}\n\n\ta := *s\n\tv = a[len(a)-1]\n\ta = a[:len(a)-1]\n\t*s = a\n\n\treturn v, true\n}", "title": "" }, { "docid": "01d383b33a05f80016448d0cddb87f94", "score": "0.5662855", "text": "func (q *Queue) Peek() (interface{}, bool) {\n\treturn q.list.Get(0)\n}", "title": "" }, { "docid": "f4183a31827c9d90245f44bb17c3cea0", "score": "0.566066", "text": "func (s *DecryptedMessageActionCommitKeyArray) Pop() (v DecryptedMessageActionCommitKey, ok bool) {\n\tif s == nil || len(*s) < 1 {\n\t\treturn\n\t}\n\n\ta := *s\n\tv = a[len(a)-1]\n\ta = a[:len(a)-1]\n\t*s = a\n\n\treturn v, true\n}", "title": "" }, { "docid": "18dbf44d8e9d3b997686344d0f930124", "score": "0.56580347", "text": "func (s *ChannelParticipantArray) Pop() (v ChannelParticipant, ok bool) {\n\tif s == nil || len(*s) < 1 {\n\t\treturn\n\t}\n\n\ta := *s\n\tv = a[len(a)-1]\n\ta = a[:len(a)-1]\n\t*s = a\n\n\treturn v, true\n}", "title": "" }, { "docid": "0f0a363fae360b9787e8d9dfba6059e5", "score": "0.5656327", "text": "func (s *TextPlainArray) Pop() (v TextPlain, ok bool) {\n\tif s == nil || len(*s) < 1 {\n\t\treturn\n\t}\n\n\ta := *s\n\tv = a[len(a)-1]\n\ta = a[:len(a)-1]\n\t*s = a\n\n\treturn v, true\n}", "title": "" }, { "docid": "aa8d95063e1c0575985866b117563ba0", "score": "0.56482434", "text": "func (s *TextAnchorArray) Pop() (v TextAnchor, ok bool) {\n\tif s == nil || len(*s) < 1 {\n\t\treturn\n\t}\n\n\ta := *s\n\tv = a[len(a)-1]\n\ta = a[:len(a)-1]\n\t*s = a\n\n\treturn v, true\n}", "title": "" }, { "docid": "0ed2bb8244fa0475396dc4df7f965fd2", "score": "0.56481874", "text": "func (s *TextPhoneArray) Pop() (v TextPhone, ok bool) {\n\tif s == nil || len(*s) < 1 {\n\t\treturn\n\t}\n\n\ta := *s\n\tv = a[len(a)-1]\n\ta = a[:len(a)-1]\n\t*s = a\n\n\treturn v, true\n}", "title": "" }, { "docid": "4e0a29f0ec1d9c3b03253d00aba9a2db", "score": "0.5644381", "text": "func (s *InputBotInlineMessageMediaGeoArray) Pop() (v InputBotInlineMessageMediaGeo, ok bool) {\n\tif s == nil || len(*s) < 1 {\n\t\treturn\n\t}\n\n\ta := *s\n\tv = a[len(a)-1]\n\ta = a[:len(a)-1]\n\t*s = a\n\n\treturn v, true\n}", "title": "" }, { "docid": "c20cd1543a19e79676bdb5c19ea8270b", "score": "0.56406635", "text": "func (b *EventBox) Peek(event EventType) bool {\n\tb.cond.L.Lock()\n\t_, ok := b.events[event]\n\tb.cond.L.Unlock()\n\treturn ok\n}", "title": "" }, { "docid": "c5dda9d5e17a182e757792931b33f2a2", "score": "0.563308", "text": "func (eq *eventQueue) next() []Event {\n\teq.mu.Lock()\n\tdefer eq.mu.Unlock()\n\n\tfor eq.events.Len() < 1 {\n\t\tif eq.closed {\n\t\t\teq.cond.Broadcast()\n\t\t\treturn nil\n\t\t}\n\n\t\teq.cond.Wait()\n\t}\n\n\tfront := eq.events.Front()\n\tblock := front.Value.([]Event)\n\teq.events.Remove(front)\n\n\treturn block\n}", "title": "" }, { "docid": "bf09f90b68073eddc1473c11545834f9", "score": "0.5627153", "text": "func (q *BlockingQueue) Pop() interface{} {\n\tq.popLock.Lock()\n\tdefer q.popLock.Unlock()\n\tif q.Len() == 0 {\n\t\tq.popBlockState = true\n\t\tq.popBlock <- 1\n\t\tq.popBlockState = false\n\t}\n\tret := q.top.value\n\tq.top.next = nil\n\tq.top = q.top.prev\n\tq.size--\n\tif q.pushBlockState {\n\t\t<-q.pushBlock\n\t}\n\treturn ret\n}", "title": "" }, { "docid": "f03268934c7592ad47eb3d705fb342b4", "score": "0.56233436", "text": "func (s *DecryptedMessageActionDeleteMessagesArray) Pop() (v DecryptedMessageActionDeleteMessages, ok bool) {\n\tif s == nil || len(*s) < 1 {\n\t\treturn\n\t}\n\n\ta := *s\n\tv = a[len(a)-1]\n\ta = a[:len(a)-1]\n\t*s = a\n\n\treturn v, true\n}", "title": "" }, { "docid": "9e896963e0371f0ae5673292bed2e6e2", "score": "0.5599172", "text": "func (rb *RingBuffer) noLockPop() (interface{}, bool) {\n\tif rb.tailPos == rb.headPos && rb.tailSlice == rb.headSlice {\n\t\treturn nil, false\n\t}\n\n\titem := rb.items[rb.tailSlice][rb.tailPos]\n\trb.tailPos++\n\n\tif rb.tailPos == rb.allocSize {\n\t\trb.tailPos = 0\n\t\trb.tailSlice = (rb.tailSlice + 1) % len(rb.items)\n\t}\n\n\treturn item, true\n}", "title": "" }, { "docid": "eb9eda4ff3aed2984aa717a7a9133477", "score": "0.55984735", "text": "func (s *InputStickeredMediaClassArray) Pop() (v InputStickeredMediaClass, ok bool) {\n\tif s == nil || len(*s) < 1 {\n\t\treturn\n\t}\n\n\ta := *s\n\tv = a[len(a)-1]\n\ta = a[:len(a)-1]\n\t*s = a\n\n\treturn v, true\n}", "title": "" }, { "docid": "8bd36d32b9d5a94dbdb4479c219b775e", "score": "0.5596165", "text": "func (q *Queue) Pop() interface{} {\n\tx := q.collection[q.Len()-1]\n\tq.collection = q.collection[0 : q.Len()-1]\n\treturn x\n}", "title": "" }, { "docid": "cb57fd1b8d58f18a61023bb15eab5e42", "score": "0.55904305", "text": "func (h *timeHeap) Pop() interface{} {\n\tif h.Len() == 0 {\n\t\treturn nil\n\t}\n\n\tn := h.Len()\n\titem := h.Items[n-1]\n\th.Items[n-1] = nil\n\titem.index = -1\n\n\th.Items = h.Items[:n-1] //reduce slide size\n\treturn item\n}", "title": "" }, { "docid": "a104f4b7f850b66d95a67cf8d8ef68bd", "score": "0.5588909", "text": "func (s *GeoPointClassArray) Pop() (v GeoPointClass, ok bool) {\n\tif s == nil || len(*s) < 1 {\n\t\treturn\n\t}\n\n\ta := *s\n\tv = a[len(a)-1]\n\ta = a[:len(a)-1]\n\t*s = a\n\n\treturn v, true\n}", "title": "" }, { "docid": "e59d5d500dfa83e52a6fc181251564a6", "score": "0.55888605", "text": "func (d *DataStorage) scanPop(n int) {\n\t// When origin data blocked, expired item should be kept to set origin item expired when moving.\n\tif d.isBlock {\n\t\treturn\n\t}\n\tqueue := &d.queue\n\tdata := &d.data\n\t// When moving, origin data is able to check expired again.\n\tif d.isMoving {\n\t\tqueue = &d.oldQueue\n\t\tdata = &d.oldData\n\t}\n\tnow := time.Now().UnixNano()\n\tfor i := 0; i < checkExpireNum; i++ {\n\t\ttop := (*queue).Top()\n\t\tif top == nil {\n\t\t\treturn\n\t\t}\n\t\tif top.Expire > 0 && top.Expire < now {\n\t\t\theap.Pop(*queue)\n\t\t\tdelete(*data, top.key)\n\t\t} else {\n\t\t\treturn\n\t\t}\n\t}\n}", "title": "" }, { "docid": "e40f51aa4c19b1b792c67d94214272dd", "score": "0.55837846", "text": "func (q *SimpleQueue) Pop() interface{} {\n\tremoved := q.queue[0]\n\tq.queue = q.queue[1:len(q.queue)]\n\treturn removed\n}", "title": "" }, { "docid": "5e77d792cdfb09c607dc28da757aa121", "score": "0.55767524", "text": "func (q *Queue) Pop() interface{} {\n\tif q.count == 0 {\n\t\treturn nil\n\t}\n\tval := q.itm[q.head]\n\tq.head = (q.head + 1) % len(q.itm)\n\tq.count--\n\treturn val\n}", "title": "" }, { "docid": "b61b1ab66b994a34cc86d944c66c6e93", "score": "0.5575668", "text": "func (s *AccountSavedRingtonesArray) Pop() (v AccountSavedRingtones, ok bool) {\n\tif s == nil || len(*s) < 1 {\n\t\treturn\n\t}\n\n\ta := *s\n\tv = a[len(a)-1]\n\ta = a[:len(a)-1]\n\t*s = a\n\n\treturn v, true\n}", "title": "" }, { "docid": "abe6e22576b88b6ba4aa531bfd808180", "score": "0.55694014", "text": "func (s *InputStickerSetIDArray) Pop() (v InputStickerSetID, ok bool) {\n\tif s == nil || len(*s) < 1 {\n\t\treturn\n\t}\n\n\ta := *s\n\tv = a[len(a)-1]\n\ta = a[:len(a)-1]\n\t*s = a\n\n\treturn v, true\n}", "title": "" }, { "docid": "d60d2848edc765b71dc9410e3807e27c", "score": "0.55654967", "text": "func (l *Slice) Pop() (a Atom, exists bool) {\n\ti := len(*l) - 1\n\tif exists = i >= 0; exists {\n\t\ta = (*l)[i]\n\t\t*l = (*l)[:i]\n\t}\n\treturn\n}", "title": "" }, { "docid": "8e9b1da06330638f1d1ff6985bf0cbf5", "score": "0.5565486", "text": "func (p *PriorityQ) Pop() (popped interface{}) {\n\tutils.Logger.Debug(\"pop item\")\n\tn := len(p.q)\n\tpopped = p.q[n-1]\n\tp.q[n-1] = nil // avoid memory leak\n\tp.q = p.q[:n-1]\n\treturn popped\n}", "title": "" }, { "docid": "20cfecb39e11fbbd56ba52bfb5257f13", "score": "0.55648935", "text": "func (b *box) pop() (message *boxMessage) {\n\tb.cond.L.Lock()\n\tdefer b.cond.L.Unlock()\n\tfor {\n\t\tif b.first == nil {\n\t\t\tb.cond.Wait()\n\t\t} else {\n\t\t\tmessage = b.first.message\n\t\t\tb.first = b.first.next\n\t\t\tbreak\n\t\t}\n\t}\n\treturn\n}", "title": "" }, { "docid": "205e1ba02630c4b303064c642b7a8fbe", "score": "0.55606896", "text": "func (s *InputNotifyForumTopicArray) Pop() (v InputNotifyForumTopic, ok bool) {\n\tif s == nil || len(*s) < 1 {\n\t\treturn\n\t}\n\n\ta := *s\n\tv = a[len(a)-1]\n\ta = a[:len(a)-1]\n\t*s = a\n\n\treturn v, true\n}", "title": "" }, { "docid": "d2862a687b2df17c395e0538b79681f7", "score": "0.55563176", "text": "func (s *Stack) Pop() (interface{}, bool) {\n\tif s.IsEmpty() {\n\t\treturn nil, false\n\t}\n\n\tidx := len(*s) - 1\n\telem := (*s)[idx]\n\t*s = (*s)[:idx]\n\treturn elem, true\n\n}", "title": "" }, { "docid": "2cb58e06b423b3b520a217cc58139448", "score": "0.5555781", "text": "func (s *Stack) Pop() (int, bool) {\n\tif s.IsEmpty() {\n\t\treturn 0, false\n\t} else {\n\t\tindex := len(*s) - 1\n\t\telement := (*s)[index]\n\t\t*s = (*s)[:index]\n\t\treturn element, true\n\t}\n}", "title": "" }, { "docid": "40bf93d26017cbf823c770acb999b50a", "score": "0.555362", "text": "func (s *InputNotifyPeerClassArray) Pop() (v InputNotifyPeerClass, ok bool) {\n\tif s == nil || len(*s) < 1 {\n\t\treturn\n\t}\n\n\ta := *s\n\tv = a[len(a)-1]\n\ta = a[:len(a)-1]\n\t*s = a\n\n\treturn v, true\n}", "title": "" }, { "docid": "2ee3ae35fe34092aaa7362a23274a92c", "score": "0.55469364", "text": "func (s *InputBotInlineMessageTextArray) Pop() (v InputBotInlineMessageText, ok bool) {\n\tif s == nil || len(*s) < 1 {\n\t\treturn\n\t}\n\n\ta := *s\n\tv = a[len(a)-1]\n\ta = a[:len(a)-1]\n\t*s = a\n\n\treturn v, true\n}", "title": "" }, { "docid": "1115d85afb1445dd4fb9c42629db7337", "score": "0.5545392", "text": "func (s *DecryptedMessageActionClassArray) Pop() (v DecryptedMessageActionClass, ok bool) {\n\tif s == nil || len(*s) < 1 {\n\t\treturn\n\t}\n\n\ta := *s\n\tv = a[len(a)-1]\n\ta = a[:len(a)-1]\n\t*s = a\n\n\treturn v, true\n}", "title": "" }, { "docid": "e02e8a9443681cac25eac96f621948e4", "score": "0.5545261", "text": "func (eq *LimitQueue) next() events.Event {\n\teq.mu.Lock()\n\tdefer eq.mu.Unlock()\n\n\tfor eq.events.Len() < 1 {\n\t\tif eq.closed {\n\t\t\teq.cond.Broadcast()\n\t\t\treturn nil\n\t\t}\n\n\t\teq.cond.Wait()\n\t}\n\n\tfront := eq.events.Front()\n\tblock := front.Value.(events.Event)\n\teq.events.Remove(front)\n\n\treturn block\n}", "title": "" }, { "docid": "051fc34a31a9ba67c2281843ff12f724", "score": "0.55409133", "text": "func (h *BinaryHeap) Pop() (value interface{}, ok bool) {\n\tif h.size == 0 {\n\t\treturn nil, false\n\t}\n\th.size--\n\th.swap(0, h.size)\n\th.down(0)\n\tvalue = h.data[h.size]\n\th.data = h.data[:h.size]\n\treturn value, true\n}", "title": "" }, { "docid": "a9ec2c1416d6c89a36976f96b92fb1c1", "score": "0.5537685", "text": "func (s *stack) Pop() (Any, bool) {\n\te := s.head\n\tif e != nil {\n\t\ts.head = e.next\n\t\treturn e.value, true\n\t}\n\treturn nil, false\n}", "title": "" }, { "docid": "7a122a9a4ad35c4f19f2e2ae7c69f279", "score": "0.55365473", "text": "func (s *InputBotInlineMessageMediaInvoiceArray) Pop() (v InputBotInlineMessageMediaInvoice, ok bool) {\n\tif s == nil || len(*s) < 1 {\n\t\treturn\n\t}\n\n\ta := *s\n\tv = a[len(a)-1]\n\ta = a[:len(a)-1]\n\t*s = a\n\n\treturn v, true\n}", "title": "" }, { "docid": "97cb44d9ac53a495a4076760e30b848a", "score": "0.5528437", "text": "func (q *Queue) Push(e Candle) bool {\n\tif q.len >= maxQueueSize {\n\t\treturn false\n\t}\n\tq.content[q.writeHead] = e\n\tq.writeHead = (q.writeHead + 1) % maxQueueSize\n\tq.len++\n\treturn true\n}", "title": "" }, { "docid": "c5fab7f58b3bc45cc11107dfd3a8d99c", "score": "0.5516172", "text": "func (s *TextURLArray) Pop() (v TextURL, ok bool) {\n\tif s == nil || len(*s) < 1 {\n\t\treturn\n\t}\n\n\ta := *s\n\tv = a[len(a)-1]\n\ta = a[:len(a)-1]\n\t*s = a\n\n\treturn v, true\n}", "title": "" } ]
ebd9f70526ba40ec49184c2c7d3bf44c
FilterByID reads records from a CSV and returns the filtered ones
[ { "docid": "de1a3bfc11176490636261fc2aa980f8", "score": "0.48996434", "text": "func (c CsvServiceImpl) SearchByConditions(conditions map[string]string) ([]model.Doc, error) {\n\tfile, err := os.Open(getConfigService().GetConfig().CSV.FileName)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"failed to open file: %v\", err)\n\t}\n\treader := csv.NewReader(file)\n\trecords, errReader := reader.ReadAll()\n\tif errReader != nil {\n\t\treturn nil, errReader\n\t}\n\n\tvar recordsStruct []model.Doc\n\tfor _, record := range records {\n\n\t\tdocRecord := toDoc(record)\n\t\tfields := structs.Fields(docRecord)\n\n\t\tif ( filterRecord(fields, conditions) ) {\n\t\t\trecordsStruct = append(recordsStruct, toDoc(record))\n\t\t}\n\n\t}\n\n\tif len(records) == 0 {\n\t\tlog.Info(\"The file is empty\")\n\t\treturn nil, errors.New(\"The file is empty\")\n\t}\n\tdefer file.Close()\n\n\treturn recordsStruct, nil\n}", "title": "" } ]
[ { "docid": "96ee431a6a0dae894bac9233321db273", "score": "0.81181115", "text": "func (c CsvServiceImpl) FilterByID(id string) ([]model.Doc, error) {\n\tfile, err := os.Open(getConfigService().GetConfig().CSV.FileName)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"failed to open file: %v\", err)\n\t}\n\treader := csv.NewReader(file)\n\trecords, errReader := reader.ReadAll()\n\tif errReader != nil {\n\t\treturn nil, errReader\n\t}\n\n\tvar recordsStruct []model.Doc\n\tconditions := make(map[string] string)\n\tconditions[\"Key\"] = id\n\n\tfor _, record := range records {\n\n\t\t// if record[0] != id {\n\t\t\t// continue\n\t\t// }\n\t\tdocRecord := toDoc(record)\n\t\tfields := structs.Fields(docRecord)\n\n\t\tif ( filterRecord(fields, conditions) ) {\n\t\t\trecordsStruct = append(recordsStruct, toDoc(record))\n\t\t}\n\n\t}\n\n\tif len(records) == 0 {\n\t\tlog.Info(\"The file is empty\")\n\t\treturn nil, errors.New(\"The file is empty\")\n\t}\n\tdefer file.Close()\n\n\treturn recordsStruct, nil\n}", "title": "" }, { "docid": "e4b6abf60b7d0259e0a30db74ecc7dc6", "score": "0.62759817", "text": "func readFilter(reader io.Reader, filter SirenFilter) error {\n\n\tcsvreader := csv.NewReader(reader)\n\tcsvreader.Comma = ';'\n\n\tsirenIndex := 0\n\n\tfor {\n\t\trow, err := csvreader.Read()\n\t\tif err == io.EOF {\n\t\t\tbreak\n\t\t} else if err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\tsiren := row[sirenIndex]\n\n\t\tif sfregexp.RegexpDict[\"siren\"].MatchString(siren) {\n\t\t\tfilter[siren] = true\n\t\t} else {\n\t\t\treturn errors.New(\"Format de siren incorrect trouvé : \" + siren)\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "252d774c5d8f461dbadb55b68d45b001", "score": "0.60871863", "text": "func IdFilter(regexp string) Filter {\n\treturn Param(\"id\", regexp)\n}", "title": "" }, { "docid": "f381d933c0a13fe55caa77b26898442d", "score": "0.6044284", "text": "func IDFilter(ID interface{}) Filter {\n\treturn Filter{\"id\": ID}\n}", "title": "" }, { "docid": "9a6d0698ff3bf45b92cd627107e2842a", "score": "0.5889696", "text": "func (s *Service) GetByID(param string) (*entity.Pokemon, error) {\n\tr := csv.NewReader(s.csvFile)\n\tdefer s.csvFile.Seek(0, 0)\n\tfor {\n\t\trecord, err := r.Read()\n\t\tif err == io.EOF {\n\t\t\tbreak\n\t\t}\n\t\tif record[0] == param {\n\t\t\tpokemonID, err := strconv.Atoi(record[0])\n\t\t\tif err != nil {\n\t\t\t\tlog.Println(err)\n\t\t\t}\n\t\t\tpokemon := entity.Pokemon{\n\t\t\t\tID: pokemonID,\n\t\t\t\tName: record[1],\n\t\t\t\tBaseExperience: record[2],\n\t\t\t}\n\n\t\t\treturn &pokemon, nil\n\t\t}\n\t}\n\treturn nil, errors.New(\"Pokemon not found\")\n}", "title": "" }, { "docid": "ea1ade20e710285f478594321a0ea34b", "score": "0.5847055", "text": "func filterRowData(d sqlmapper.RowData) sqlmapper.RowData {\n\t_, ok := d[\"id\"]\n\tif ok {\n\t\tdelete(d, \"id\")\n\t}\n\treturn d\n}", "title": "" }, { "docid": "e88ccff540aa5a79cdd905350c850ab1", "score": "0.57770413", "text": "func readCsv(filename string)([]Record){\n\tcsvFile, _ := os.Open(filename)\n reader := csv.NewReader(bufio.NewReader(csvFile))\n\t//skip first line\n\treader.Read()\n\tvar people []Record\n\tfor {\n\t\t\t line, error := reader.Read()\n\t\t\t if error == io.EOF {\n\t\t\t\t\t break\n\t\t\t } else if error != nil {\n\t\t\t\t\t log.Fatal(error)\n\t\t\t }\n\t\t\t id, err := strconv.Atoi(line[0])\n\t\t\t if err == nil {\n\t\t\t\t people = append(people, Record {\n\t\t\t\t\t\t Id: id,\n\t\t\t\t\t\t Firstname: line[1],\n\t\t\t\t\t\t Lastname: line[2],\n\t\t\t\t\t\t Phonenumber: line[3]})\n\t\t\t }else{\n\t\t\t\t log.Fatal(err)\n\t\t\t }\n\n\t }\n\t return people\n}", "title": "" }, { "docid": "13c2aa30a6a8341044bcf0f3b6de55b3", "score": "0.5524965", "text": "func Filter(in []Record, predicate func(Record) bool) []Record {\n\tout := make([]Record, 0, len(in))\n\tfor _, record := range in {\n\t\tif predicate(record) {\n\t\t\tout = append(out, record)\n\t\t}\n\t}\n\n\treturn out\n}", "title": "" }, { "docid": "44ea4fcf7a614fa62251c8480393db77", "score": "0.5476171", "text": "func processCSV(r io.Reader) ([]*Entry, error) {\n\treader := csv.NewReader(r)\n\trecords, err := reader.ReadAll()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tci := &ColumnIndexes{FirstName: -1, LastName: -1, Username: -1, Addr1: -1, Addr2: -1, Code: -1, City: -1, State: -1, CountryISO: -1, Email: -1}\n\n\tcolHeaders := records[0]\n\tfor i, colHeader := range colHeaders {\n\t\t// making comparison more permissive\n\t\tc := strings.ToLower(colHeader)\n\t\tc = strings.Replace(c, \" \", \"\", -1) // remove all spaces\n\n\t\tif c == \"prénom\" || c == \"firstname\" {\n\t\t\tci.FirstName = i\n\t\t} else if c == \"nom\" || c == \"name\" || c == \"lastname\" || c == \"shippingname\" {\n\t\t\tci.LastName = i\n\t\t} else if c == \"adresse\" || c == \"addr1\" || c == \"address1\" || c == \"address\" || c == \"shippingaddress1\" {\n\t\t\tci.Addr1 = i\n\t\t} else if c == \"complémentd'adresse\" || c == \"addr2\" || c == \"address2\" || c == \"shippingaddress2\" {\n\t\t\tci.Addr2 = i\n\t\t} else if c == \"codepostal\" || c == \"zipcode\" || c == \"postalcode\" || c == \"shippingzip\" {\n\t\t\tci.Code = i\n\t\t} else if c == \"city\" || c == \"ville\" || c == \"shippingcity\" {\n\t\t\tci.City = i\n\t\t} else if c == \"pays\" || c == \"country\" || c == \"countrycode\" || c == \"shippingcountry\" {\n\t\t\tci.CountryISO = i\n\t\t} else if c == \"state\" || c == \"shippingprovince\" {\n\t\t\tci.State = i\n\t\t} else if c == \"email\" || c == \"e-mail\" || strings.Contains(c, \"email\") {\n\t\t\tci.Email = i\n\t\t} else if c == \"username\" || c == \"nickname\" {\n\t\t\tci.Username = i\n\t\t}\n\t}\n\n\tentries := make([]*Entry, 0)\n\n\tfor i := 1; i < len(records); i++ {\n\t\trecord := records[i]\n\n\t\tentry := &Entry{}\n\n\t\tif ci.FirstName > -1 {\n\t\t\tentry.FirstName = record[ci.FirstName]\n\t\t}\n\n\t\tif ci.LastName > -1 {\n\t\t\tentry.LastName = record[ci.LastName]\n\t\t}\n\n\t\tif ci.Username > -1 {\n\t\t\tentry.Username = record[ci.Username]\n\t\t}\n\n\t\tif ci.Addr1 > -1 {\n\t\t\tentry.Addr1 = record[ci.Addr1]\n\t\t}\n\n\t\tif ci.Addr2 > -1 {\n\t\t\tentry.Addr2 = record[ci.Addr2]\n\t\t}\n\n\t\tif ci.Code > -1 {\n\t\t\tentry.Code = record[ci.Code]\n\t\t}\n\n\t\tif ci.City > -1 {\n\t\t\tentry.City = record[ci.City]\n\t\t}\n\n\t\tif ci.CountryISO > -1 {\n\t\t\tentry.CountryISO = record[ci.CountryISO]\n\t\t}\n\n\t\tif ci.State > -1 {\n\t\t\tentry.State = record[ci.State]\n\t\t}\n\n\t\tif ci.Email > -1 {\n\t\t\tentry.Email = record[ci.Email]\n\t\t}\n\n\t\tentries = append(entries, entry)\n\t}\n\n\treturn entries, nil\n}", "title": "" }, { "docid": "9810b1569a42824960ec260f6cfff37d", "score": "0.53274745", "text": "func (a FirewallExclusions) FilterByMOID(moid string) *Member {\n\tvar memberFound Member\n\tfor _, member := range a.Members {\n\t\tif member.MOID == moid {\n\t\t\tmemberFound = member\n\t\t\tbreak\n\t\t}\n\t}\n\treturn &memberFound\n}", "title": "" }, { "docid": "b6068037d4b5a371c64cc663c3c75dc1", "score": "0.5322062", "text": "func (f *FactFilter) WhereID(p entql.StringP) {\n\tf.Where(p.Field(fact.FieldID))\n}", "title": "" }, { "docid": "91ef7e14f35670219f2512e6790728b5", "score": "0.52801967", "text": "func (f *APIAuditFilter) WhereID(p entql.StringP) {\n\tf.Where(p.Field(apiaudit.FieldID))\n}", "title": "" }, { "docid": "3b175d920a07803856b5cd4ad9077ec7", "score": "0.52627236", "text": "func (n *Neo4j) StreamCSVRows(ctx context.Context, instanceID, filterID string, filters *observation.DimensionFilters, limit *int) (observation.StreamRowReader, error) {\n\n\theaderRowQuery := fmt.Sprintf(\"MATCH (i:`_%s_Instance`) RETURN i.header as row\", instanceID)\n\n\tunionQuery := headerRowQuery + \" UNION ALL \" + createObservationQuery(ctx, instanceID, filterID, filters)\n\n\tif limit != nil {\n\t\tlimitAsString := strconv.Itoa(*limit)\n\t\tunionQuery += \" LIMIT \" + limitAsString\n\t}\n\n\tlog.Info(ctx, \"neo4j query\", log.Data{\n\t\t\"filterID\": filterID,\n\t\t\"instanceID\": instanceID,\n\t\t\"query\": unionQuery,\n\t})\n\n\treturn n.StreamRows(unionQuery)\n}", "title": "" }, { "docid": "a8e651b81fb96ba49410f9e2cd0528cf", "score": "0.5188026", "text": "func (s Stream) Filter(fn func(r Record) (bool, error)) Stream {\n\treturn s.Pipe(func() func(r Record) (Record, error) {\n\t\treturn func(r Record) (Record, error) {\n\t\t\tok, err := fn(r)\n\t\t\tif err != nil {\n\t\t\t\treturn nil, err\n\t\t\t}\n\n\t\t\tif !ok {\n\t\t\t\treturn nil, nil\n\t\t\t}\n\n\t\t\treturn r, nil\n\t\t}\n\t})\n}", "title": "" }, { "docid": "d2e1c7e20e3079bc4b1828d5b21fafa4", "score": "0.5186898", "text": "func (d *DataSource) GetByID(id int64) (Model, bool) {\n\treturn d.GetBy(func(u Model) bool {\n\t\treturn u.ID == id\n\t})\n}", "title": "" }, { "docid": "ef1cff380b7d921521a3ea0d3625f028", "score": "0.5176071", "text": "func ID(id int) predicate.Medicalfile {\n\treturn predicate.Medicalfile(func(s *sql.Selector) {\n\t\ts.Where(sql.EQ(s.C(FieldID), id))\n\t})\n}", "title": "" }, { "docid": "92a3f6e6e26a6fe5dabfdf6766af4b79", "score": "0.51651263", "text": "func ReadCSV(r io.Reader, f func(record []string) error) error {\n\tstream := readCSVLines(r)\n\tfor {\n\t\tselect {\n\t\tcase <-DieChannel:\n\t\t\treturn nil\n\t\tdefault:\n\t\t}\n\n\t\tselect {\n\t\tcase x, ok := <-stream:\n\t\t\tif !ok {\n\t\t\t\treturn nil\n\t\t\t} else if x.err != nil {\n\t\t\t\treturn x.err\n\t\t\t}\n\t\t\tif err := f(x.record); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\tcase <-DieChannel:\n\t\t\treturn nil\n\t\t}\n\t}\n}", "title": "" }, { "docid": "f1f00b8fd993aa86aa8ab671e6947742", "score": "0.5156115", "text": "func (c *CsvFile) GetRecord(id int) (map[string]interface{}, error) {\n\t// Read Locks\n\tc.mu.RLock()\n\tdefer c.mu.RUnlock()\n\n\t// Open our CSV file\n\tf, err := os.Open(c.file)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"unable to open csv\")\n\t}\n\tdefer f.Close()\n\n\t// increment id by 1 because of header\n\tid = id + 1\n\n\t// Employ our CSV Reader\n\tcsvReader := csv.NewReader(f)\n\trows, err := csvReader.ReadAll()\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"unable to read csv\")\n\t}\n\n\t// Check Length of Row\n\tif len(rows) <= id {\n\t\treturn nil, fmt.Errorf(\"index out of range\")\n\t}\n\n\t// index position for title\n\ttitle := find(rows[0], \"title\")\n\n\t// +1 because header is at 0, but ids start at 0\n\trow := rows[id]\n\n\tdata := map[string]interface{}{\n\t\t\"id\": row[0],\n\t\t\"title\": row[title],\n\t}\n\n\treturn data, nil\n}", "title": "" }, { "docid": "5026e17865e821e099dc887ea2179355", "score": "0.51291066", "text": "func (f *FactTypeFilter) WhereID(p entql.StringP) {\n\tf.Where(p.Field(facttype.FieldID))\n}", "title": "" }, { "docid": "8bea452afc9fe8e3dfaaff1756723fdd", "score": "0.5094374", "text": "func filterByUserId(w http.ResponseWriter, r *http.Request) {\n\tfmt.Println(\"Filter_By_UserId ---------------------------\")\n\tenableCors(&w)\n\tuserid := r.URL.Query().Get(\":userid\")\n\tfmt.Println(\"Category filter : \" + userid)\n\tstmt, err := mainDB.Prepare(\n\t\t`SELECT * FROM testTable where userid = ?`)\n\tcheckErr(err)\n\trows, errQuery := stmt.Query(userid)\n\tcheckErr(errQuery)\n\tvar logs Logs\n\n\tfor rows.Next() {\n\t\tvar log Log\n\t\terr = rows.Scan(&log.ID, &log.Time, &log.Level, &log.Msg, &log.Category, &log.DebugId, &log.Ip, &log.RequestId, &log.Type, &log.Uri, &log.UserId)\n\n\t\tcheckErr(err)\n\t\tlogs = append(logs, log)\n\t}\n\n\tjsonB, errMarshal := json.Marshal(logs)\n\tcheckErr(errMarshal)\n\tfmt.Fprintf(w, \"%s\", string(jsonB))\n}", "title": "" }, { "docid": "691675a796fa30099ff450d739652428", "score": "0.50895834", "text": "func FilteredRecordsPath(recordID int) string {\n\tparam0 := strconv.Itoa(recordID)\n\n\treturn fmt.Sprintf(\"/records/data/%s/filtered\", param0)\n}", "title": "" }, { "docid": "f6c587cd820b4576d036c9824e228f3f", "score": "0.50686365", "text": "func readCSV(csvFileName string) []Record {\n\tvar records []Record\n\n\tcsvFile, err := os.Open(csvFileName)\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\tdefer csvFile.Close()\n\n\tr := csv.NewReader(bufio.NewReader(csvFile))\n\tr.Comma = ';'\n\tfor {\n\t\trecord, err := r.Read()\n\t\tif err == io.EOF {\n\t\t\tbreak\n\t\t}\n\t\tif err != nil {\n\t\t\tlog.Fatal(err)\n\t\t}\n\t\t// fmt.Printf(\"%T: %v\\n\", record, record)\n\t\tcount, err := strconv.Atoi(record[2])\n\t\tif err != nil {\n\t\t\tlog.Fatal(err)\n\t\t}\n\t\trecords = append(records, Record{\n\t\t\tDate: record[0],\n\t\t\tTerm: record[1],\n\t\t\tCount: count,\n\t\t})\n\t}\n\n\treturn records\n}", "title": "" }, { "docid": "dd59926bd83b55671966d561708cc41d", "score": "0.5066851", "text": "func processFile(m Samples, rf io.Reader, a action) {\n csv := csv.NewReader(rf)\n header := true\n var s_header []string\n for {\n s_line, err := csv.Read()\n if err == io.EOF {\n break\n }\n if err != nil {\n log.Fatal(\"Error reading from csv file in ulrness.processFile() \", \" err: \", err)\n }\n if header {\n s_header = s_line\n header = false\n } else {\n err = a(m, s_line, s_header)\n if err != nil {\n log.Fatal(\"Error processing line in urlness.processFile()\", \"error: \", err)\n }\n }\n }\n}", "title": "" }, { "docid": "0820cbacb3bc178f095079d24b1d42b0", "score": "0.50664186", "text": "func (fs *FilterStorage) GetFilterFromID(id string) *Filter {\n\tfs.mutex.RLock()\n\tdefer fs.mutex.RUnlock()\n\treturn fs.subscribers[id]\n}", "title": "" }, { "docid": "cc249c3b136303171b90429bfb956edd", "score": "0.50579864", "text": "func (cf ContainerFilter) ByID(id string) ContainerFilter {\n\treturn func(c *Container) bool {\n\t\treturn strings.Contains(c.ID, id)\n\t}\n}", "title": "" }, { "docid": "887928fc8642efe85520bf4371669dd3", "score": "0.5048052", "text": "func (_LvRecordableStream *LvRecordableStreamFilterer) FilterRecordedProgramId(opts *bind.FilterOpts) (*LvRecordableStreamRecordedProgramIdIterator, error) {\n\n\tlogs, sub, err := _LvRecordableStream.contract.FilterLogs(opts, \"RecordedProgramId\")\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn &LvRecordableStreamRecordedProgramIdIterator{contract: _LvRecordableStream.contract, event: \"RecordedProgramId\", logs: logs, sub: sub}, nil\n}", "title": "" }, { "docid": "24ad595ed032608a300d6559b553ccf2", "score": "0.5013557", "text": "func ID(id int) predicate.Bulk {\n\treturn predicate.Bulk(func(s *sql.Selector) {\n\t\ts.Where(sql.EQ(s.C(FieldID), id))\n\t})\n}", "title": "" }, { "docid": "667f043f86acba1fa1d1cada89294884", "score": "0.50010616", "text": "func (f PidFilterFunc) Filter(pidstat *PerProcessStat) (interested bool) {\n\treturn f(pidstat)\n}", "title": "" }, { "docid": "5531defeda7bb9683f4afb2ee0f9498f", "score": "0.49911797", "text": "func (c *CloudflareAPIClient) FilterTXTRecords(name, filter string) ([]string, error) {\n\trr := cf.DNSRecord{\n\t\tType: \"TXT\",\n\t\tName: name,\n\t}\n\trecords, err := c.Api.DNSRecords(c.ZoneID, rr)\n\tif err != nil {\n\t\treturn []string{}, err\n\t}\n\tresults := []string{}\n\tfor _, record := range records {\n\t\tif strings.Contains(record.Content, filter) {\n\t\t\tresults = append(results, record.ID)\n\t\t}\n\t}\n\treturn results, nil\n}", "title": "" }, { "docid": "f1bdc25229a2cbbe8cdfee0613da5216", "score": "0.49903524", "text": "func parseCSV(s string, tw timeWindow) []csvLine {\n\t// open CSV file\n\tfile, err := os.Open(s)\n\tif err != nil {\n\t\tpanic(fmt.Sprintf(\"There was a problem opening the file! :. %s\", err))\n\t}\n\t// make sure we eventually close the CSV file\n\tdefer func() {\n\t\tif err = file.Close(); err != nil {\n\t\t\tpanic(fmt.Sprintf(\"There was a problem closing the file! :. %s\", err))\n\t\t}\n\t}()\n\t// create a reader for the file\n\treader := csv.NewReader(file)\n\tvar content []csvLine\n\n\t// if the read line is in the specified time window put it into the content slice\n\tfor {\n\t\tEOF := readCSVLine(&content, reader, tw)\n\t\tif EOF {\n\t\t\tbreak\n\t\t}\n\t}\n\treturn content\n}", "title": "" }, { "docid": "e57094f83c53a079a8320e7eb06407d5", "score": "0.49862954", "text": "func (m *importer) ProcessXwf1CSV(w http.ResponseWriter, r *http.Request) {\n\tctx := r.Context()\n\tlog := m.log.For(ctx)\n\tlog.Debug(\"ProcessCoollink1CSV -started\")\n\tif err := r.ParseMultipartForm(maxFormSize); err != nil {\n\t\tlog.Warn(\"parsing multipart form\", zap.Error(err))\n\t\thttp.Error(w, \"cannot parse form\", http.StatusUnprocessableEntity)\n\t\treturn\n\t}\n\tctx, mr := m.CloneContext(ctx), m.r.Mutation()\n\n\tfor fileName := range r.MultipartForm.File {\n\t\t_, reader, err := m.newReader(fileName, r)\n\t\tif err != nil {\n\t\t\tlog.Warn(\"creating csv reader\", zap.Error(err), zap.String(\"filename\", fileName))\n\t\t\thttp.Error(w, fmt.Sprintf(\"cannot handle file %q\", fileName), http.StatusUnprocessableEntity)\n\t\t\treturn\n\t\t}\n\n\t\t//unknownLocationType := m.getOrCreateLocationType(ctx, \"Unknown\", nil)\n\t\tareaLocationType := m.getOrCreateLocationType(ctx, \"Area\", nil)\n\t\taddressLocationType := m.getOrCreateLocationType(ctx, \"Address\", nil)\n\t\tsiteLocationType := m.getOrCreateLocationType(ctx, \"Site\", []*models.PropertyTypeInput{\n\t\t\t{\n\t\t\t\tName: \"Meshes\",\n\t\t\t\tType: \"string\",\n\t\t\t},\n\t\t\t{\n\t\t\t\tName: \"Address\",\n\t\t\t\tType: \"string\",\n\t\t\t},\n\t\t})\n\t\tinverter500EquipmentType := m.getOrCreateEquipmentType(ctx, \"Inverter 500VA\", 0, \"\", 0, nil)\n\t\tinverter900EquipmentType := m.getOrCreateEquipmentType(ctx, \"Inverter 900VA\", 0, \"\", 0, nil)\n\t\tbattery100ahEquipmentType := m.getOrCreateEquipmentType(ctx, \"Battery 100AH\", 0, \"\", 0, nil)\n\t\tbattery200ahEquipmentType := m.getOrCreateEquipmentType(ctx, \"Battery 200AH\", 0, \"\", 0, nil)\n\t\tradioModelCBNEquipmentType := m.getOrCreateEquipmentType(ctx, \"Radio Model for CBN Root(Radwin 5000 Series)\", 0, \"\", 0, nil)\n\t\tradioModelCLLEquipmentType := m.getOrCreateEquipmentType(ctx, \"Radio Model for CLL Root(Cambium Force 200\", 0, \"\", 0, nil)\n\t\tmikrotikRB2011CLLEquipmentType := m.getOrCreateEquipmentType(ctx, \"Mikrotik RB 2011\", 0, \"\", 0, nil)\n\t\tmikrotikRB750GCLLEquipmentType := m.getOrCreateEquipmentType(ctx, \"Mikrotik RB 750G\", 0, \"\", 0, nil)\n\t\tPOEEquipmentType := m.getOrCreateEquipmentType(ctx, \"Cambium E500\", 0, \"\", 0, nil)\n\t\tpoeEquipmentType := m.getOrCreateEquipmentType(ctx, \"POE\", 0, \"\", 0, nil)\n\t\ttelephoneEquipmentType := m.getOrCreateEquipmentType(ctx, \"telephoneTechnoWX3-7.0\", 0, \"\", 0, nil)\n\n\t\trowID := 0\n\t\tfor {\n\t\t\trowID++\n\t\t\tline, err := reader.Read()\n\t\t\tif err != nil {\n\t\t\t\tif err == io.EOF {\n\t\t\t\t\tbreak\n\t\t\t\t}\n\t\t\t\tlog.Warn(\"cannot read row\", zap.Error(err))\n\t\t\t\tpanic(\"cannot read row\")\n\t\t\t}\n\n\t\t\tisNonEmptyRow := false\n\t\t\tfor _, value := range line {\n\t\t\t\tif len(value) != 0 {\n\t\t\t\t\tisNonEmptyRow = true\n\t\t\t\t\tbreak\n\t\t\t\t}\n\t\t\t}\n\t\t\tif !isNonEmptyRow {\n\t\t\t\tcontinue\n\t\t\t}\n\n\t\t\tsnNumberVal := line[0]\n\t\t\tbusinessVal := line[1]\n\t\t\tretailerIdVal := line[2]\n\t\t\tmacIdVal := line[3]\n\t\t\trootVal := line[4]\n\t\t\tmeshesVal := line[5]\n\t\t\tlatVal := line[6]\n\t\t\tlongVal := line[7]\n\t\t\t// totalJanVal := line[8]\n\t\t\t// totalFebVal := line[9]\n\t\t\t// totalMarVal := line[10]\n\t\t\tinverter500val := line[11]\n\t\t\tinverter900val := line[12]\n\t\t\tbattery100AHVal := line[13]\n\t\t\tbattery200AHVal := line[14]\n\t\t\tradioModelCBNVal := line[15]\n\t\t\tradioModelCLLVal := line[16]\n\t\t\tmikrotikVal := line[17]\n\t\t\tcambiumE500Val := line[18]\n\t\t\tpoeVal := line[19]\n\t\t\ttelephoneVal := line[20]\n\t\t\taddressVal := line[21]\n\t\t\tareaVal := line[22]\n\n\t\t\tif len(macIdVal) == 0 {\n\t\t\t\tlog.Warn(\"Empty mac, skipping\", zap.String(\"macIdVal\", macIdVal))\n\t\t\t\tcontinue\n\t\t\t}\n\n\t\t\tprops, err := m.ClientFrom(ctx).EquipmentType.Query().\n\t\t\t\tQueryPropertyTypes().\n\t\t\t\tWhere(propertytype.Name(\"Mac\")).\n\t\t\t\tQueryProperties().\n\t\t\t\tWhere(property.StringVal(macIdVal)).\n\t\t\t\tAll(ctx)\n\n\t\t\tif err != nil {\n\t\t\t\tlog.Warn(\"ERROR! while finding Coollink mac\", zap.Error(err), zap.String(\"macIdVal\", macIdVal))\n\t\t\t\tpanic(\"error\")\n\t\t\t}\n\n\t\t\tif len(props) > 1 {\n\t\t\t\tlog.Warn(\"Found many macs\", zap.String(\"macIdVal\", macIdVal))\n\t\t\t\tpanic(\"error\")\n\t\t\t}\n\n\t\t\tif len(props) < 1 {\n\t\t\t\tlog.Warn(\"cannot find mac\", zap.String(\"macIdVal\", macIdVal))\n\t\t\t\t//panic(\"error\")\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\t//log.Debug(\"Updating hotspot properties\", zap.String(\"macIdVal\", macIdVal))\n\n\t\t\tif len(areaVal) < 1 {\n\t\t\t\tlog.Warn(\"Empty area name\", zap.String(\"areaVal\", areaVal))\n\t\t\t\t//panic(\"error\")\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tareaLoc, _ := m.getOrCreateLocation(ctx, areaVal, 0.0, 0.0, areaLocationType, nil, nil, nil)\n\t\t\taddressLoc, _ := m.getOrCreateLocation(ctx, addressVal, 0.0, 0.0, addressLocationType, &areaLoc.ID, nil, nil)\n\n\t\t\taccessPoint := props[0].QueryEquipment().OnlyX(ctx)\n\t\t\thotspot := accessPoint.QueryLocation().OnlyX(ctx)\n\t\t\tsiteAddress := areaVal + \" \" + addressVal\n\t\t\tsite, _ := m.getOrCreateLocation(ctx, accessPoint.Name, 0.0, 0.0, siteLocationType, &hotspot.ID, []*models.PropertyInput{\n\t\t\t\t{\n\t\t\t\t\tPropertyTypeID: m.getLocPropTypeID(ctx, \"Meshes\", siteLocationType.ID),\n\t\t\t\t\tStringValue: &meshesVal,\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tPropertyTypeID: m.getLocPropTypeID(ctx, \"Address\", siteLocationType.ID),\n\t\t\t\t\tStringValue: &siteAddress,\n\t\t\t\t},\n\t\t\t}, nil)\n\t\t\tif hotspot.QueryChildren().CountX(ctx) <= 1 || len(meshesVal) > 0 {\n\t\t\t\tif hotspot.QueryParent().OnlyXID(ctx) != addressLoc.ID {\n\t\t\t\t\tqh := m.ClientFrom(ctx).Location.UpdateOne(hotspot)\n\t\t\t\t\tqh.ClearParent()\n\t\t\t\t\tqh.SetParent(addressLoc)\n\t\t\t\t\tqh.SaveX(ctx)\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tqa := m.ClientFrom(ctx).Equipment.UpdateOne(accessPoint)\n\t\t\tif accessPoint.QueryLocation().OnlyXID(ctx) != site.ID {\n\t\t\t\tqa.ClearLocation()\n\t\t\t\tqa.SetLocation(site)\n\t\t\t}\n\n\t\t\tif !m.propExistsOnEquipment(ctx, accessPoint, \"snNumber\", snNumberVal) {\n\t\t\t\tptypeID := m.getEquipPropTypeID(ctx, \"snNumber\", accessPoint.QueryType().OnlyX(ctx).ID)\n\t\t\t\tqa = qa.AddProperties(m.ClientFrom(ctx).Property.Create().\n\t\t\t\t\tSetTypeID(ptypeID).\n\t\t\t\t\tSetStringVal(snNumberVal).\n\t\t\t\t\tSaveX(ctx))\n\t\t\t}\n\t\t\tif !m.propExistsOnEquipment(ctx, accessPoint, \"Business\", businessVal) {\n\t\t\t\tptypeID := m.getEquipPropTypeID(ctx, \"Business\", accessPoint.QueryType().OnlyX(ctx).ID)\n\t\t\t\tqa = qa.AddProperties(m.ClientFrom(ctx).Property.Create().\n\t\t\t\t\tSetTypeID(ptypeID).\n\t\t\t\t\tSetStringVal(businessVal).\n\t\t\t\t\tSaveX(ctx))\n\t\t\t}\n\n\t\t\tif !m.propExistsOnEquipment(ctx, accessPoint, \"Retailer Id\", retailerIdVal) {\n\t\t\t\tptypeID := m.getEquipPropTypeID(ctx, \"Retailer Id\", accessPoint.QueryType().OnlyX(ctx).ID)\n\t\t\t\tqa = qa.AddProperties(m.ClientFrom(ctx).Property.Create().\n\t\t\t\t\tSetTypeID(ptypeID).\n\t\t\t\t\tSetStringVal(retailerIdVal).\n\t\t\t\t\tSaveX(ctx))\n\t\t\t}\n\n\t\t\tif !m.propExistsOnEquipment(ctx, accessPoint, \"Lat (coollink)\", latVal) {\n\t\t\t\tptypeID := m.getEquipPropTypeID(ctx, \"Lat (coollink)\", accessPoint.QueryType().OnlyX(ctx).ID)\n\t\t\t\tqa = qa.AddProperties(m.ClientFrom(ctx).Property.Create().\n\t\t\t\t\tSetTypeID(ptypeID).\n\t\t\t\t\tSetStringVal(latVal).\n\t\t\t\t\tSaveX(ctx))\n\t\t\t}\n\n\t\t\tif !m.propExistsOnEquipment(ctx, accessPoint, \"Long (coollink)\", longVal) {\n\t\t\t\tptypeID := m.getEquipPropTypeID(ctx, \"Long (coollink)\", accessPoint.QueryType().OnlyX(ctx).ID)\n\t\t\t\tqa = qa.AddProperties(m.ClientFrom(ctx).Property.Create().\n\t\t\t\t\tSetTypeID(ptypeID).\n\t\t\t\t\tSetStringVal(longVal).\n\t\t\t\t\tSaveX(ctx))\n\t\t\t}\n\n\t\t\tif !m.propExistsOnEquipment(ctx, accessPoint, \"Root\", rootVal) {\n\t\t\t\tptypeID := m.getEquipPropTypeID(ctx, \"Root\", accessPoint.QueryType().OnlyX(ctx).ID)\n\t\t\t\tqa = qa.AddProperties(m.ClientFrom(ctx).Property.Create().\n\t\t\t\t\tSetTypeID(ptypeID).\n\t\t\t\t\tSetStringVal(rootVal).\n\t\t\t\t\tSaveX(ctx))\n\t\t\t}\n\n\t\t\tqa.SaveX(ctx)\n\n\t\t\tif inverter500val == \"1\" {\n\t\t\t\tm.getOrCreateEquipment(ctx, mr, \"inverter500\", inverter500EquipmentType, nil, site, nil, nil)\n\t\t\t}\n\t\t\tif inverter900val == \"1\" {\n\t\t\t\tm.getOrCreateEquipment(ctx, mr, \"inverter900\", inverter900EquipmentType, nil, site, nil, nil)\n\t\t\t}\n\t\t\tif battery100AHVal == \"1\" {\n\t\t\t\tm.getOrCreateEquipment(ctx, mr, \"battery100ah\", battery100ahEquipmentType, nil, site, nil, nil)\n\t\t\t}\n\t\t\tif battery200AHVal == \"1\" {\n\t\t\t\tm.getOrCreateEquipment(ctx, mr, \"battery200ah\", battery200ahEquipmentType, nil, site, nil, nil)\n\t\t\t}\n\t\t\tif radioModelCBNVal == \"Installed\" {\n\t\t\t\tm.getOrCreateEquipment(ctx, mr, \"radioModelCBN\", radioModelCBNEquipmentType, nil, site, nil, nil)\n\t\t\t}\n\t\t\tif radioModelCLLVal == \"Installed\" {\n\t\t\t\tm.getOrCreateEquipment(ctx, mr, \"radioModelCLLN\", radioModelCLLEquipmentType, nil, site, nil, nil)\n\t\t\t}\n\t\t\tif mikrotikVal == \"RB2011\" {\n\t\t\t\tm.getOrCreateEquipment(ctx, mr, \"RB2011\", mikrotikRB2011CLLEquipmentType, nil, site, nil, nil)\n\t\t\t}\n\t\t\tif mikrotikVal == \"RB750G\" {\n\t\t\t\tm.getOrCreateEquipment(ctx, mr, \"RB750G\", mikrotikRB750GCLLEquipmentType, nil, site, nil, nil)\n\t\t\t}\n\t\t\tif cambiumE500Val == \"Installed\" {\n\t\t\t\tm.getOrCreateEquipment(ctx, mr, \"Cambium E500\", POEEquipmentType, nil, site, nil, nil)\n\t\t\t}\n\t\t\tif poeVal == \"Installed\" {\n\t\t\t\tm.getOrCreateEquipment(ctx, mr, \"POE\", poeEquipmentType, nil, site, nil, nil)\n\t\t\t}\n\t\t\tif telephoneVal == \"Allocated\" {\n\t\t\t\tm.getOrCreateEquipment(ctx, mr, \"Telephone\", telephoneEquipmentType, nil, site, nil, nil)\n\t\t\t}\n\n\t\t}\n\t\tlog.Debug(\"Done!!\")\n\t\tw.WriteHeader(http.StatusOK)\n\t}\n}", "title": "" }, { "docid": "ba305cc516659fd02455ccc2c6f9ec15", "score": "0.49838424", "text": "func (f *ScopeFilter) WhereID(p entql.StringP) {\n\tf.Where(p.Field(scope.FieldID))\n}", "title": "" }, { "docid": "d25ffdaf91207089a46187edaaff41ec", "score": "0.49798816", "text": "func (_LvRecording *LvRecordingFilterer) FilterRecordProgramId(opts *bind.FilterOpts) (*LvRecordingRecordProgramIdIterator, error) {\n\n\tlogs, sub, err := _LvRecording.contract.FilterLogs(opts, \"RecordProgramId\")\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn &LvRecordingRecordProgramIdIterator{contract: _LvRecording.contract, event: \"RecordProgramId\", logs: logs, sub: sub}, nil\n}", "title": "" }, { "docid": "02ded924b25ca828a081d3634b6697b0", "score": "0.49747437", "text": "func (c *Client) FilteredRecords(ctx context.Context, path string) (*http.Response, error) {\n\treq, err := c.NewFilteredRecordsRequest(ctx, path)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn c.Client.Do(ctx, req)\n}", "title": "" }, { "docid": "3fcbe7c2b2168e702c229644fd6a7fba", "score": "0.49719626", "text": "func main() {\n\n\tcsvFile, err := os.Open(\"./uids.csv\")\n\tif err != nil {\n\t\tfmt.Println(\"open error...,err=\", err)\n\t\treturn\n\t}\n\tdefer csvFile.Close()\n\tcsvReader := csv.NewReader(csvFile)\n\traws, err := csvReader.ReadAll()\n\tif err != nil {\n\t\tfmt.Println(\"read file error:\", err)\n\t\treturn\n\t}\n\n\tvar count int\n\tfor _, raw := range raws {\n\t\tif ok, _ := regexp.MatchString(reg, raw[0]); !ok {\n\t\t\tcontinue\n\t\t}\n\t\tfmt.Println(raw[0])\n\t\tcount++\n\t}\n\n\tfmt.Println(\"count:\", count)\n\n}", "title": "" }, { "docid": "bba1921ac9c86dde51de726d13235a47", "score": "0.49506953", "text": "func (m MemoryStore) Filter(field string, value interface{}, model gomdi.Model) ([]interface{}, error) {\n\tmodels := make([]interface{}, 0)\n\tfor _, item := range m[model.Table()] {\n\t\tvar found bool\n\t\tv := reflect.ValueOf(item).Elem()\n\t\t// Get the interface value so we can do a type switch\n\t\tfinterface := v.FieldByName(field).Interface()\n\t\tswitch finterface.(type) {\n\t\tdefault:\n\t\t\tfound = false\n\t\tcase string:\n\t\t\tfound = finterface.(string) == value.(string)\n\t\tcase int:\n\t\t\tfound = finterface.(int) == value.(int)\n\t\t}\n\t\tif found {\n\t\t\tmodels = append(models, item)\n\t\t}\n\t}\n\treturn models, nil\n}", "title": "" }, { "docid": "a55d24a9320d1d891020a0ae6c59ef81", "score": "0.49498802", "text": "func FilterJsonFromReaderWithFilterRunner(reader io.Reader, filter string, filterRunner FilterRunner) (value interface{}, err error) {\n if value,err = readJsonFromReader(reader); err == nil {\n err = doFilter(value, filter, filterRunner)\n }\n return\n}", "title": "" }, { "docid": "99b7a0827424a0e96a6fb1ee47ab4c1f", "score": "0.49474788", "text": "func Filter(fn sif.FilterOperation) sif.DataFrameOperation {\n\treturn func(d sif.DataFrame) (sif.Task, sif.TaskType, sif.Schema, error) {\n\t\tnextTask := filterTask{fn: iutil.SafeFilterOperation(fn)}\n\t\treturn &nextTask, sif.FilterTaskType, d.GetSchema().Clone(), nil\n\t}\n}", "title": "" }, { "docid": "03403d0dd76d2ae169be8781ab05e94f", "score": "0.49443772", "text": "func (pr *pokemonRepository) FindById(p *model.Pokemon) (*model.Pokemon, error) {\n\trecords, err := readData(\"db.csv\")\n\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tfor _, record := range records {\n\t\tcsvId, err := strconv.ParseUint(record[0], 10, 32)\n\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\n\t\tif csvId != p.ID {\n\t\t\tcontinue\n\t\t}\n\n\t\tp.Name = record[1]\n\n\t\tbreak\n\t}\n\n\treturn p, nil\n}", "title": "" }, { "docid": "7a83d1e7bbac85e57b3178df9600a428", "score": "0.49060595", "text": "func processFilter(keys []string, filter []string) ([]string, bool) {\n\tvar vpps []string\n\tif len(filter) > 0 {\n\t\t// Ignore all parameters but first\n\t\tvpps = strings.Split(filter[0], \",\")\n\t} else {\n\t\t// Show all if there is no filter\n\t\tvpps = keys\n\t}\n\tvar isData bool\n\t// Find at leas one match\n\tfor _, key := range keys {\n\t\tfor _, vpp := range vpps {\n\t\t\tif key == vpp {\n\t\t\t\tisData = true\n\t\t\t\tbreak\n\t\t\t}\n\t\t}\n\t}\n\treturn vpps, isData\n}", "title": "" }, { "docid": "34af0bdcef41afc36580aa980f6cea74", "score": "0.4904598", "text": "func (mdl *Model) Filter(callback func(std.Value) std.Model) std.Model {\n\treturn mdl\n}", "title": "" }, { "docid": "d79088088302c2e48ba01025c6d98eac", "score": "0.4897511", "text": "func LineFilter(\n\treader io.Reader,\n\twriter io.Writer,\n\ttransform Line,\n) error {\n\tscanner := bufio.NewScanner(reader)\n\n\tfor scanner.Scan() {\n\t\toutput := transform(scanner.Text())\n\n\t\t_, err := fmt.Fprintln(writer, output)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\treturn scanner.Err()\n}", "title": "" }, { "docid": "03d836f5aac798dc0d04c2c5d1fc8375", "score": "0.48887244", "text": "func readCSV(r io.Reader) Roadmap {\n\tvar (\n\t\tcats []Category\n\t\tc Category\n\t\tit Item\n\t\titems []Item\n\t\trm Roadmap\n\t)\n\n\tnc := -1\n\tnr := 0\n\tinput := csv.NewReader(r)\n\tfor {\n\t\tfields, csverr := input.Read()\n\t\tif csverr == io.EOF {\n\t\t\tbreak\n\t\t}\n\t\tif csverr != nil {\n\t\t\tfmt.Fprintf(os.Stderr, \"%v %v\\n\", csverr, fields)\n\t\t\tcontinue\n\t\t}\n\t\tnr++\n\t\tif nr == 1 {\n\t\t\tcontinue\n\t\t}\n\t\tif len(fields) < 5 {\n\t\t\tcontinue\n\t\t}\n\t\tif len(fields[0]) == 0 {\n\t\t\tcontinue\n\t\t}\n\t\tif len(fields[0]) > 0 && len(fields[1]) == 0 && len(fields[2]) == 0 {\n\t\t\tnc++\n\t\t\tc.Name = fields[0]\n\t\t\tc.Vspace = \"45\"\n\t\t\tc.Itemheight = 40\n\t\t\tcats = append(cats, c)\n\t\t\titems = []Item{}\n\t\t\tcontinue\n\t\t}\n\t\tit.Text = fields[0]\n\t\tit.Begin = fields[1]\n\t\tit.Duration = fields[2]\n\t\titems = append(items, it)\n\t\tcats[nc].Item = items\n\t}\n\trp := strings.Split(*csvparam, \",\")\n\tif len(rp) == 3 {\n\t\trm.Title = rp[0]\n\t\trm.Begin, _ = strconv.ParseFloat(rp[1], 64)\n\t\trm.End, _ = strconv.ParseFloat(rp[2], 64)\n\t}\n\trm.Scale = 12\n\trm.Catpercent = 15\n\trm.Vspace = 45\n\trm.Itemheight = 40\n\trm.Shape = \"r\"\n\trm.Fontname = \"Calibri,sans-serif\"\n\trm.Category = cats\n\tdumprm(rm, os.Stderr)\n\treturn rm\n}", "title": "" }, { "docid": "dfbf7f327689026adb192e0de79a25a0", "score": "0.488653", "text": "func GetCSV(fileName string, record addable) {\n\tf, err := os.Open(fileName)\n\tif err != nil {\n\t\tLogging.NormalLogger.Println(\"cannot open \" + fileName)\n\t\tLogging.ErrorLogger.Fatal(err)\n\t}\n\n\treader := csv.NewReader(f)\n\tfor {\n\t\tresult, err := reader.Read()\n\t\tif err == io.EOF {\n\t\t\tbreak\n\t\t}\n\t\tif err != nil {\n\t\t\tLogging.NormalLogger.Println(\"encounter error while reading \" + fileName)\n\t\t\tLogging.ErrorLogger.Fatal(err)\n\t\t}\n\n\t\trecord.Add(result)\n\t}\n}", "title": "" }, { "docid": "dad2b119cfcc21f96c387c429cb1a066", "score": "0.48656815", "text": "func (cmd *FilteredRecordsCommand) Run(c *client.Client, args []string) error {\n\tvar path string\n\tif len(args) > 0 {\n\t\tpath = args[0]\n\t} else {\n\t\tpath = fmt.Sprintf(\"/records/data/%v/filtered\", cmd.RecordID)\n\t}\n\tlogger := goa.NewLogger(log.New(os.Stderr, \"\", log.LstdFlags))\n\tctx := goa.WithLogger(context.Background(), logger)\n\tresp, err := c.FilteredRecords(ctx, path)\n\tif err != nil {\n\t\tgoa.LogError(ctx, \"failed\", \"err\", err)\n\t\treturn err\n\t}\n\n\tgoaclient.HandleResponse(c.Client, resp, cmd.PrettyPrint)\n\treturn nil\n}", "title": "" }, { "docid": "afa516b8b6d03705319cd313679f24a0", "score": "0.4863809", "text": "func ReadingTransactionsFromFile(csvFileName string) []Events {\n\tcsvFile, err := os.Open(csvFileName)\n \tif err != nil {\n \tfmt.Println(\"Error with reading from events_file:\", err)\n \tlog.Fatal(err)\n \t }\n\n \tfmt.Println(\"success open events_file!\")\n\treader := csv.NewReader(bufio.NewReader(csvFile))\n\tvar events []Events\n\tfor {\n\t\tline, error := reader.Read()\n\t\tif error == io.EOF {\n\t\t\tbreak\n\t\t} else if error != nil {\n\t\t\tlog.Fatal(error)\n\t\t}\n\t\t//if line[2] == \"transaction\" {\n\t var event= Events{}\n\t event.Timestamp = line[4]\n\t event.Visitorid = line[0]\n\t event.Event_ = line[1]\n\t event.Itemid = line[2]\n\t event.Transactionid = line[5]\n\n\t events = append(events, event)\n\t\t//}\n\n\t\t/*if line[2] == \"transaction\" {\n\t\tvar event= Events{}\n\t\tevent.Timestamp = line[0]\n\t\tevent.Visitorid = line[1]\n\t\tevent.Event_ = line[2]\n\t\tevent.Itemid = line[3]\n\t\tevent.Transactionid = line[4]\n\n\t\tevents = append(events, event)\n\t\t}*/\n\t}\n\n\treturn events\n}", "title": "" }, { "docid": "2590d3f68c242aa8b09fd0faaf89a636", "score": "0.48291665", "text": "func FilterJsonFromReader(reader io.Reader, filter string) (value interface{}, err error) {\n if value,err = readJsonFromReader(reader); err == nil {\n err = doFilter(value, filter, nil)\n }\n return\n}", "title": "" }, { "docid": "09d2bb6ec1d4849be08568a103f178be", "score": "0.48216718", "text": "func (o _GroupingObjs) FilterId(op string, p int64, ps ...int64) gmq.Filter {\n\tparams := make([]interface{}, 1+len(ps))\n\tparams[0] = p\n\tfor i := range ps {\n\t\tparams[i+1] = ps[i]\n\t}\n\treturn o.newFilter(\"id\", op, params...)\n}", "title": "" }, { "docid": "7bd6c9e33ea895a1f480df1da09d18b6", "score": "0.4820611", "text": "func (rm RowsMap) FilterFunc(equalF func(RowMap) bool) RowsMap {\n\tfrm := RowsMap{}\n\tfor _, v := range rm {\n\t\tif equalF(v) {\n\t\t\tfrm = append(frm, v)\n\t\t}\n\t}\n\treturn frm\n}", "title": "" }, { "docid": "f1c2a01f688cf33190785ba88d2b2682", "score": "0.48198792", "text": "func (r ApiGetBulkExportedItemListRequest) Filter(filter string) ApiGetBulkExportedItemListRequest {\n\tr.filter = &filter\n\treturn r\n}", "title": "" }, { "docid": "5b5270d2cde078b6ed89a3ede898ebc9", "score": "0.48153797", "text": "func (s *shard) Filter(\n\tmetricID uint32,\n\tseriesIDs *roaring.Bitmap,\n\ttimeRange timeutil.TimeRange,\n\tfields field.Metas,\n) (rs []flow.FilterResultSet, err error) {\n\tentries := s.families.Entries()\n\tfor idx := range entries {\n\t\t// check family time if in query time range\n\t\tfamilyStartTime := entries[idx].familyTime\n\t\tfamilyEndTime := s.interval.Calculator().CalcFamilyEndTime(familyStartTime)\n\t\tif !timeRange.Overlap(timeutil.TimeRange{Start: familyStartTime, End: familyEndTime}) {\n\t\t\tcontinue\n\t\t}\n\t\tresultSet, err := entries[idx].memDB.Filter(metricID, seriesIDs, timeRange, fields)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\trs = append(rs, resultSet...)\n\t}\n\treturn\n}", "title": "" }, { "docid": "b4def9ce0a6c370b7df026a38373fa28", "score": "0.48114425", "text": "func CreateFilteredData(inputData [][]string, variables []*model.Variable, returnRaw bool, lineCount int) (*FilteredData, error) {\n\tdata := &FilteredData{}\n\n\tdata.Columns = map[string]*Column{}\n\tfor _, variable := range variables {\n\t\tdata.Columns[variable.Key] = &Column{\n\t\t\tLabel: variable.DisplayName,\n\t\t\tKey: variable.Key,\n\t\t\tType: variable.Type,\n\t\t\tIndex: len(data.Columns),\n\t\t}\n\t}\n\n\tdata.Values = [][]*FilteredDataValue{}\n\n\t// discard header\n\tinputData = inputData[1:]\n\n\tmaxCount := lineCount\n\tif returnRaw {\n\t\tmaxCount = len(inputData)\n\t}\n\n\terrorCount := 0\n\tdiscardCount := 0\n\tfor i := 0; i < maxCount && i < len(inputData); i++ {\n\t\trow := inputData[i]\n\n\t\t// convert row values to schema type\n\t\t// rows that are malformed are discarded\n\t\ttypedRow := make([]*FilteredDataValue, len(row))\n\t\tvar rowError, err error\n\t\tfor j := 0; j < len(row); j++ {\n\t\t\tvarType := variables[j].Type\n\t\t\ttypedRow[j] = &FilteredDataValue{}\n\t\t\tif !returnRaw && model.IsNumerical(varType) && row[j] != \"\" {\n\t\t\t\tif model.IsFloatingPoint(varType) {\n\t\t\t\t\ttypedRow[j].Value, err = strconv.ParseFloat(row[j], 64)\n\t\t\t\t\tif err != nil {\n\t\t\t\t\t\trowError = errors.Wrapf(err, \"failed conversion for row %d\", i)\n\t\t\t\t\t\terrorCount++\n\t\t\t\t\t\tbreak\n\t\t\t\t\t}\n\t\t\t\t} else {\n\t\t\t\t\ttypedRow[j].Value, err = strconv.ParseInt(row[j], 10, 64)\n\t\t\t\t\tif err != nil {\n\t\t\t\t\t\tflt, err := strconv.ParseFloat(row[j], 64)\n\t\t\t\t\t\tif err != nil {\n\t\t\t\t\t\t\trowError = errors.Wrapf(err, \"failed conversion for row %d\", i)\n\t\t\t\t\t\t\terrorCount++\n\t\t\t\t\t\t\tbreak\n\t\t\t\t\t\t}\n\t\t\t\t\t\ttypedRow[j].Value = int64(flt)\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\ttypedRow[j].Value = row[j]\n\t\t\t}\n\t\t}\n\t\tif rowError != nil {\n\t\t\tdiscardCount++\n\t\t\tif errorCount < maxReportedErrors {\n\t\t\t\tlog.Warn(rowError)\n\t\t\t} else if errorCount == maxReportedErrors {\n\t\t\t\tlog.Warn(\"too many errors - logging of remainder surpressed\")\n\t\t\t}\n\t\t\tcontinue\n\t\t}\n\t\tdata.Values = append(data.Values, typedRow)\n\t}\n\n\tif discardCount > 0 {\n\t\tlog.Warnf(\"discarded %d rows due to parsing parsing errors\", discardCount)\n\t}\n\n\tdata.NumRows = len(data.Values)\n\n\treturn data, nil\n}", "title": "" }, { "docid": "f315ef1ff8d4b34fa7c7881675626d81", "score": "0.48062843", "text": "func ID(id int) predicate.CarRepairrecord {\n\treturn predicate.CarRepairrecord(func(s *sql.Selector) {\n\t\ts.Where(sql.EQ(s.C(FieldID), id))\n\t})\n}", "title": "" }, { "docid": "4b66f9907995bb0bf788cefd7dd83a59", "score": "0.4801206", "text": "func processCSV(rc io.Reader) (ch chan []string) {\n\tch = make(chan []string, 10)\n\tgo func() {\n\t\tr := csv.NewReader(rc)\n\t\tif _, err := r.Read(); err != nil { //read header\n\t\t\tlog.Fatal(err)\n\t\t}\n\t\tdefer close(ch)\n\t\tfor {\n\t\t\trec, err := r.Read()\n\t\t\tif err != nil {\n\t\t\t\tif err == io.EOF {\n\t\t\t\t\tbreak\n\t\t\t\t}\n\t\t\t\tlog.Fatal(err)\n\n\t\t\t}\n\t\t\tch <- rec\n\t\t}\n\t}()\n\treturn\n}", "title": "" }, { "docid": "0e062eb9434b529e0f512036474e3010", "score": "0.47829792", "text": "func ReadCSV(b io.Reader) ([]Movie, error) {\n\n\tr := csv.NewReader(b)\n\n\t// These are some optional configuration options\n\tr.Comma = ';'\n\tr.Comment = '-'\n\n\tvar movies []Movie\n\n\t// grab and ignore the header for now\n\t// we may also wanna use this for a dictionary key or some\n\t// other form of lookup\n\t_, err := r.Read()\n\tif err != nil && err != io.EOF {\n\t\treturn nil, err\n\t}\n\n\t// loop until it's all processed\n\tfor {\n\t\trecord, err := r.Read()\n\t\tif err == io.EOF {\n\t\t\tbreak\n\t\t} else if err != nil {\n\t\t\treturn nil, err\n\t\t}\n\n\t\tyear, err := strconv.ParseInt(record[2], 10, 64)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\n\t\tm := Movie{record[0], record[1], int(year)}\n\t\tmovies = append(movies, m)\n\t}\n\treturn movies, nil\n}", "title": "" }, { "docid": "73314e0c189798a52c7a1443c84ed340", "score": "0.47661996", "text": "func (dc *DomainConfig) Filter(f func(r *RecordConfig) bool) {\n\trecs := []*RecordConfig{}\n\tfor _, r := range dc.Records {\n\t\tif f(r) {\n\t\t\trecs = append(recs, r)\n\t\t}\n\t}\n\tdc.Records = recs\n}", "title": "" }, { "docid": "0db25700ea8ff0804e3275f87a788f3b", "score": "0.47599143", "text": "func Filter(r io.Reader, w io.Writer, conf Config) error {\n\ts := bufio.NewScanner(r)\n\tfilters := compile(conf)\n\n\tfor s.Scan() {\n\t\tmetric := s.Bytes()\n\t\tparts := bytes.SplitN(metric, []byte(\"|\"), 2)\n\t\tname := parts[0]\n\n\t\tif len(name) == 0 {\n\t\t\tcontinue\n\t\t}\n\n\t\ttail := parts[1]\n\n\t\tfor regexp, v := range filters {\n\t\t\tmatches := regexp.FindAllSubmatch(name, -1)\n\n\t\t\tif matches == nil {\n\t\t\t\tcontinue\n\t\t\t}\n\n\t\t\tswitch v.(type) {\n\t\t\tcase string:\n\t\t\t\tw.Write(replace([]byte(v.(string)), matches))\n\t\t\t\tw.Write([]byte(\"|\"))\n\t\t\t\tw.Write(tail)\n\t\t\t\tw.Write([]byte(\"\\n\"))\n\t\t\tcase bool:\n\t\t\t\tw.Write(metric)\n\t\t\t\tw.Write([]byte(\"\\n\"))\n\t\t\t}\n\t\t}\n\t}\n\n\treturn s.Err()\n}", "title": "" }, { "docid": "5cd0bfc8f71674134ce964f72eab5c0c", "score": "0.475637", "text": "func (f *GrantFilter) WhereID(p entql.StringP) {\n\tf.Where(p.Field(grant.FieldID))\n}", "title": "" }, { "docid": "2c693b79b1b7ecf9fdd32e0c9bebc6c2", "score": "0.4750308", "text": "func ParseCSV(filename string) (*WhoisResults, error) {\n\tentries, err := dry.FileGetCSV(filename, time.Second*5)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tp := pool.NewLimited(10)\n\tbatch := p.Batch()\n\n\tgo func() {\n\t\tfor pos, entry := range entries {\n\t\t\tbatch.Queue(asyncWhoisRecord(pos, &WhoisRecordRequest{\n\t\t\t\tentry[0],\n\t\t\t\tentry[1],\n\t\t\t}))\n\t\t}\n\t\tbatch.QueueComplete()\n\t}()\n\treturn handleBatchResults(batch)\n}", "title": "" }, { "docid": "93f67cb533aed13df285e5e4ebaddb47", "score": "0.47475907", "text": "func filterRecords(resourceRecordSet []*route53.ResourceRecordSet, domain string) []*route53.ResourceRecordSet {\n\tvar result []*route53.ResourceRecordSet\n\tfor i := 0; i < len(resourceRecordSet); i++ {\n\t\tif *resourceRecordSet[i].Type == \"A\" && isValidRecord(*resourceRecordSet[i].Name, domain) {\n\t\t\tresult = append(result, resourceRecordSet[i])\n\t\t}\n\t}\n\treturn result\n}", "title": "" }, { "docid": "1addbe62b7868b165c75d8278c7907fa", "score": "0.47407678", "text": "func ProcessCSVFieldsWith(csv_file string, processor func([]string) error) error {\n\tin_fp, err := os.Open(csv_file)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"Failed to open file %s: %s.\\n\", csv_file, err)\n\t}\n\tdefer in_fp.Close()\n\n\tcsv_reader := csv.NewReader(in_fp)\n\tfor {\n\t\tfields, err := csv_reader.Read()\n\t\tif err == nil {\n\t\t\terr = processor(fields)\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t} else if err == io.EOF {\n\t\t\tbreak\n\t\t} else {\n\t\t\tlog.Printf(\"Failed to process record: %s.\\n\", err)\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "6a76e576473a640266222626f34342c8", "score": "0.47379678", "text": "func Filter(field string, value interface{}, m Model) ([]interface{}, error) {\n\treturn Store.Filter(field, value, m)\n}", "title": "" }, { "docid": "94c1929892063ca13b1c4ad5dda4bf05", "score": "0.47256958", "text": "func CSVHandler(r *http.Request) (string, int, error) {\n\t// Validate the request was via POST method\n\tcode, err := ValidateMethod(r, \"POST\")\n\tif err != nil {\n\t\tlog.Error(err)\n\t\treturn \"\", code, err\n\t}\n\n\tlog.Infof(\"Handling CSV data request...\")\n\n\t// Attempt to get runId query argument\n\trunId, err := TryGetQueryArg(r, \"runId\")\n\tif err != nil {\n\t\tlog.Error(err)\n\t\treturn \"\", http.StatusBadRequest, err\n\t}\n\n\t// Grab the database\n\tdb := datastore.GetDatabase(\"data/test.sqlite\")\n\n\t// Make sure there is no error when retrieving the database connection\n\tif db == nil {\n\t\terr := fmt.Errorf(\"Unable to connect to database for CSVHandler\")\n\t\tlog.Error(err)\n\t\treturn \"\", http.StatusInternalServerError, err\n\t}\n\n\t// Retrieve data related to specific run number. Should only be one run\n\trows, err := db.Queryx(query, runId)\n\tif err != nil {\n\t\tlog.Error(\"Unable to retrieve sensor data for CSVHandler\")\n\t\tlog.Error(err)\n\t\treturn \"\", http.StatusInternalServerError, fmt.Errorf(internalServerErrMsg)\n\t}\n\n\tvar curRow packets.DBSensorData\n\n\t// Attempt to fill initial record with data\n\tdbRows := make([]packets.DBSensorData, 1)\n\tfor rows.Next() {\n\t\tif err := rows.StructScan(&curRow); err != nil {\n\t\t\tlog.Error(err)\n\t\t\treturn \"\", http.StatusInternalServerError, fmt.Errorf(internalServerErrMsg)\n\t\t}\n\n\t\tdbRows = append(dbRows, curRow)\n\t}\n\n\t// Should only ever have 1 row returned, warn if otherwise\n\tif len(dbRows) > 1 {\n\t\tlog.Warn(\"Multiple records retrieved from table SensorData for run number\", runId)\n\t}\n\n\t// Convert rows into CSV format\n\tbuf := new(bytes.Buffer)\n\tdbWriter := csv.NewWriter(buf)\n\n\t// Write header\n\tdbWriter.Write(headerSlice)\n\n\tfor _, row := range dbRows {\n\t\tdbWriter.Write(row.ToCSVString())\n\t}\n\tdbWriter.Flush()\n\n\treturn buf.String(), http.StatusOK, nil\n}", "title": "" }, { "docid": "606dcb4a606b581e776755d33828c8f4", "score": "0.4721278", "text": "func (m Manager) Filter(clauses ...sol.Clause) Manager {\n\treturn m.FilterDelete(clauses...).FilterUpdate(clauses...).FilterSelect(clauses...)\n}", "title": "" }, { "docid": "0f1beb150d87ceeca8520d2111105943", "score": "0.47145393", "text": "func ingestionFactory(filePath string) []interface{} {\n\n\tcsvFile, _ := os.Open(filePath)\n\treader := csv.NewReader(bufio.NewReader(csvFile))\n\n\tvar result []interface{}\n\tvar i = 0\n\n\tfor {\n\t\tline, error := reader.Read()\n\n\t\tif i == 0 {\n\t\t\t// skip th first csv line, a little byzantine but should work\n\t\t\ti++\n\t\t\tcontinue\n\t\t}\n\n\t\tif error == io.EOF {\n\t\t\tbreak\n\t\t} else if error != nil {\n\t\t\tlog.Fatal(error)\n\t\t}\n\n\t\tswitch filePath {\n\n\t\tcase FACILITIES_PATH:\n\t\t\t// we should handle parse errors on these in case csv is corrupted\n\t\t\tamount, _ := strconv.ParseFloat(line[0], 64)\n\t\t\tinterestRate, _ := strconv.ParseFloat(line[1], 64)\n\t\t\tid, _ := strconv.Atoi(line[2])\n\t\t\tbankId, _ := strconv.Atoi(line[3])\n\n\t\t\t// we need a slice of pointers here because we would need to operate on the amount in the code\n\t\t\t// and we dont want a copy we want to be able to change the value as we grant loans\n\t\t\tresult = append(result, &Facility{\n\t\t\t\tAmount: amount,\n\t\t\t\tInterestRate: interestRate,\n\t\t\t\tId: id,\n\t\t\t\tBankId: bankId,\n\t\t\t})\n\n\t\tcase COVENANTS_PATH:\n\t\t\t// we should handle parse errors on these in case csv is corrupted\n\t\t\tfacilityId, _ := strconv.Atoi(line[0])\n\t\t\tmaxDefaultLikelihood, _ := strconv.ParseFloat(line[1], 64)\n\t\t\tbankId, _ := strconv.Atoi(line[2])\n\t\t\tbannedState := line[3]\n\n\t\t\tresult = append(result, Covenant{\n\t\t\t\tFacilityId: facilityId,\n\t\t\t\tMaxDefaultLikelihood: maxDefaultLikelihood,\n\t\t\t\tBankId: bankId,\n\t\t\t\tBannedState: bannedState,\n\t\t\t})\n\n\t\tcase LOANS_PATH:\n\n\t\t\t// we should handle parse errors on these in case csv is corrupted\n\t\t\tinterestRate, _ := strconv.ParseFloat(line[0], 64)\n\t\t\tamount, _ := strconv.ParseFloat(line[1], 64)\n\t\t\tid, _ := strconv.Atoi(line[2])\n\t\t\tdefaultLikelihood, _ := strconv.ParseFloat(line[3], 64)\n\t\t\tstate := line[4]\n\n\t\t\tresult = append(result, Loan{\n\t\t\t\tInterestRate: interestRate,\n\t\t\t\tAmount: amount,\n\t\t\t\tId: id,\n\t\t\t\tDefaultLikelihood: defaultLikelihood,\n\t\t\t\tState: state,\n\t\t\t})\n\t\t}\n\t}\n\n\treturn result\n}", "title": "" }, { "docid": "6ba4e13af6e68666cd505d1c3eefc106", "score": "0.47066665", "text": "func (crowdin *Crowdin) GetStringIDs(fileName string, filter string, filterType string) (list []int, err error) {\r\n\r\n\tcrowdin.log(fmt.Sprintf(\"GetStringIDs(%s, %s, %s)\\n\", fileName, filter, filterType))\r\n\r\n\t// Lookup fileId in Crowdin\r\n\tfileId, _, err := crowdin.LookupFileId(fileName)\r\n\tif err != nil {\r\n\t\tcrowdin.log(fmt.Sprintf(\" err=%s\\n\", err))\r\n\t\treturn list, err\r\n\t}\r\n\r\n\t// Get the string IDs\r\n\tlimit := 500\r\n\topt := ListStringsOptions{\r\n\t\tFileId: fileId,\r\n\t\tScope: filterType,\r\n\t\tFilter: filter,\r\n\t\tLimit: limit,\r\n\t}\r\n\r\n\t// Pull ListStrings as long as it returns data\r\n\tfor offset := 0; offset < MAX_RESULTS; offset += limit {\r\n\t\topt.Offset = offset\r\n\r\n\t\tres, err := crowdin.ListStrings(&opt)\r\n\t\tif err != nil {\r\n\t\t\tcrowdin.log(fmt.Sprintf(\" err=%s\\n\", err))\r\n\t\t\treturn list, err\r\n\t\t}\r\n\r\n\t\tif len(res.Data) <= 0 {\r\n\t\t\tbreak\r\n\t\t}\r\n\r\n\t\tcrowdin.log(fmt.Sprintf(\" - Page of results #%d\\n\", (offset/limit)+1))\r\n\r\n\t\tfor _, v := range res.Data {\r\n\t\t\tlist = append(list, v.Data.ID) // Add data to slice\r\n\t\t}\r\n\t}\r\n\r\n\treturn list, nil\r\n}", "title": "" }, { "docid": "fd72ef75b6f9d0d39a881b70d3cc5c42", "score": "0.47057638", "text": "func (dbc *DatabaseCfg) GetCustomFilterCfgByID(id string) (CustomFilterCfg, error) {\n\tcfgarray, err := dbc.GetCustomFilterCfgArray(\"id='\" + id + \"'\")\n\tif err != nil {\n\t\treturn CustomFilterCfg{}, err\n\t}\n\tif len(cfgarray) > 1 {\n\t\treturn CustomFilterCfg{}, fmt.Errorf(\"Error %d results on get CustomfilterCfg by id %s\", len(cfgarray), id)\n\t}\n\tif len(cfgarray) == 0 {\n\t\treturn CustomFilterCfg{}, fmt.Errorf(\"Error no values have been returned with this id %s in the filter config table\", id)\n\t}\n\treturn *cfgarray[0], nil\n}", "title": "" }, { "docid": "c28a0313f8c9b0162a3a04ebaa89b6e7", "score": "0.47021762", "text": "func (categories *Categories) ReadCategoryByID(categoryID, language string) (Category, error) {\n\n\tvariables := struct {\n\t\tCategoryID string\n\t\tLanguage string\n\t}{\n\t\tCategoryID: categoryID,\n\t\tLanguage: language}\n\n\tqueryTemplate, err := template.New(\"ReadCategoryByID\").Parse(`{\n\t\t\t\tcategories(func: uid(\"{{.CategoryID}}\")) @filter(has(categoryName)) {\n\t\t\t\t\tuid\n\t\t\t\t\tcategoryName: categoryName@{{.Language}}\n\t\t\t\t\tcategoryIsActive\n\t\t\t\t\tbelongs_to_company @filter(eq(companyIsActive, true)) {\n\t\t\t\t\t\tuid\n\t\t\t\t\t\tcompanyName: companyName@{{.Language}}\n\t\t\t\t\t\tcompanyIsActive\n\t\t\t\t\t\thas_category @filter(eq(categoryIsActive, true)) {\n\t\t\t\t\t\t\tuid\n\t\t\t\t\t\t\tcategoryName: categoryName@{{.Language}}\n\t\t\t\t\t\t\tcategoryIsActive\n\t\t\t\t\t\t\tbelong_to_company @filter(eq(companyIsActive, true)) {\n\t\t\t\t\t\t\t\tuid\n\t\t\t\t\t\t\t\tcompanyName: companyName@{{.Language}}\n\t\t\t\t\t\t\t\tcompanyIsActive\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\thas_product @filter(eq(productIsActive, true)) {\n\t\t\t\t\t\tuid\n\t\t\t\t\t\tproductName: productName@{{.Language}}\n\t\t\t\t\t\tproductIri\n\t\t\t\t\t\tpreviewImageLink\n\t\t\t\t\t\tproductIsActive\n\t\t\t\t\t\tbelongs_to_category @filter(eq(categoryIsActive, true)) {\n\t\t\t\t\t\t\tuid\n\t\t\t\t\t\t\tcategoryName: categoryName@{{.Language}}\n\t\t\t\t\t\t\tcategoryIsActive\n\t\t\t\t\t\t}\n\t\t\t\t\t\tbelongs_to_company @filter(eq(companyIsActive, true)) {\n\t\t\t\t\t\t\tuid\n\t\t\t\t\t\t\tcompanyName: companyName@{{.Language}}\n\t\t\t\t\t\t\tcompanyIsActive\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}`)\n\n\tcategory := Category{ID: categoryID}\n\n\tif err != nil {\n\t\tlog.Println(err)\n\t\treturn category, ErrCategoryByIDCanNotBeFound\n\t}\n\n\tqueryBuf := bytes.Buffer{}\n\terr = queryTemplate.Execute(&queryBuf, variables)\n\tif err != nil {\n\t\tlog.Println(err)\n\t\treturn category, ErrCategoryByIDCanNotBeFound\n\t}\n\n\ttransaction := categories.storage.Client.NewTxn()\n\tresponse, err := transaction.Query(context.Background(), queryBuf.String())\n\tif err != nil {\n\t\tlog.Println(err)\n\t\treturn category, ErrCategoryByIDCanNotBeFound\n\t}\n\n\ttype categoriesInStore struct {\n\t\tCategories []Category `json:\"categories\"`\n\t}\n\n\tvar foundedCategories categoriesInStore\n\n\terr = json.Unmarshal(response.GetJson(), &foundedCategories)\n\tif err != nil {\n\t\tlog.Println(err)\n\t\treturn category, ErrCategoryByIDCanNotBeFound\n\t}\n\n\tif len(foundedCategories.Categories) == 0 {\n\t\treturn category, ErrCategoryDoesNotExist\n\t}\n\n\treturn foundedCategories.Categories[0], nil\n}", "title": "" }, { "docid": "3717b25a996e7713137765dd064849f1", "score": "0.4693532", "text": "func (d *Demo) FilterIn(g *gom.Gom) {\n\ttoolkit.Println(\"===== In =====\")\n\tres := []models.Hero{}\n\n\tvar err error\n\tif d.useParams {\n\t\t_, err = g.Set(&gom.SetParams{\n\t\t\tTableName: \"hero\",\n\t\t\tResult: &res,\n\t\t\tFilter: gom.In(\"Name\", \"Green Arrow\", \"Red Arrow\"),\n\t\t\tTimeout: 10,\n\t\t}).Cmd().Get()\n\t} else {\n\t\t_, err = g.Set(nil).Table(\"hero\").Timeout(10).Result(&res).Filter(gom.In(\"Name\", \"Green Arrow\", \"Red Arrow\")).Cmd().Get()\n\t}\n\n\tif err != nil {\n\t\ttoolkit.Println(err.Error())\n\t\treturn\n\t}\n\n\tfor _, h := range res {\n\t\ttoolkit.Println(h)\n\t}\n}", "title": "" }, { "docid": "1e4eb27f741a94f428f37144ad4d3d17", "score": "0.46930048", "text": "func _filter() {\n\n}", "title": "" }, { "docid": "89a91df30e7dbcfe7706edfb1b911068", "score": "0.46805", "text": "func (q *Query) Filter(fn Filter) error {\n\terr, Answer := fn(q.Answer)\n\tif err == nil {\n\t\tq.Answer = Answer\n\t\treturn nil\n\t}\n\treturn err\n}", "title": "" }, { "docid": "594ce1b05fa1b6ae10b33205a5536a08", "score": "0.46787393", "text": "func (a *adapter) LoadFilteredPolicy(model model.Model, filter interface{}) error {\n\tif filter == nil {\n\t\tfilter = bson.D{}\n\t\ta.filtered = false\n\t} else {\n\t\ta.filtered = true\n\t}\n\n\tctx := context.TODO()\n\n\tcur, err := a.collection.Find(ctx, filter)\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\n\tfor cur.Next(ctx) {\n\t\tvar line = CasbinRule{}\n\t\tif err := cur.Decode(&line); err == nil {\n\t\t\tloadPolicyLine(line, model)\n\t\t}\n\n\t}\n\n\treturn cur.Close(ctx)\n}", "title": "" }, { "docid": "a8b2c5546bde6bc12c1fe07d7271a0ba", "score": "0.4677301", "text": "func ID(id int) predicate.Blob {\n\treturn predicate.Blob(\n\t\tfunc(s *sql.Selector) {\n\t\t\ts.Where(sql.EQ(s.C(FieldID), id))\n\t\t},\n\t)\n}", "title": "" }, { "docid": "39055b8de740b9a6a4fdfa981e721334", "score": "0.46715954", "text": "func makeFromCsvReader(\n\tfileName string, csvFile *os.File, csvHeader string, csvToCell func(row []string) (interface{}, error),\n) (func() (interface{}, error), error) {\n\n\t// create csv reader from utf-8 line\n\tuRd, err := helper.Utf8Reader(csvFile, theCfg.encodingName)\n\tif err != nil {\n\t\treturn nil, errors.New(\"fail to create utf-8 converter: \" + err.Error())\n\t}\n\n\tcsvRd := csv.NewReader(uRd)\n\tcsvRd.TrimLeadingSpace = true\n\tcsvRd.ReuseRecord = true\n\n\t// skip header line\n\tfhs, e := csvRd.Read()\n\tswitch {\n\tcase e == io.EOF:\n\t\treturn nil, errors.New(\"invalid (empty) csv file: \" + fileName)\n\tcase err != nil:\n\t\treturn nil, errors.New(\"csv file read error: \" + fileName + \": \" + err.Error())\n\t}\n\tfh := strings.Join(fhs, \",\")\n\tif strings.HasPrefix(fh, string(helper.Utf8bom)) {\n\t\tfh = fh[len(helper.Utf8bom):]\n\t}\n\tif fh != csvHeader {\n\t\treturn nil, errors.New(\"Invalid csv file header \" + fileName + \": \" + fh + \" expected: \" + csvHeader)\n\t}\n\n\t// convert each csv line into cell (id cell)\n\t// reading from .id.csv files not supported by converters\n\tfrom := func() (interface{}, error) {\n\t\trow, err := csvRd.Read()\n\t\tswitch {\n\t\tcase err == io.EOF:\n\t\t\treturn nil, nil // eof\n\t\tcase err != nil:\n\t\t\treturn nil, errors.New(\"csv file read error: \" + fileName + \": \" + err.Error())\n\t\t}\n\n\t\t// convert csv line to cell and return from reader\n\t\tc, err := csvToCell(row)\n\t\tif err != nil {\n\t\t\treturn nil, errors.New(\"csv file row convert error: \" + fileName + \": \" + err.Error())\n\t\t}\n\t\treturn c, nil\n\t}\n\treturn from, nil\n}", "title": "" }, { "docid": "614c400e3e45b1fa12fa2083e4613351", "score": "0.46627867", "text": "func Filter(query string, result interface{}, input interface{}) error {\n\treturn Do(fmt.Sprintf(\"SELECT * FROM t0 WHERE %s\", query),\n\t\tresult, Obj{\"t0\": input})\n}", "title": "" }, { "docid": "59e1038edc5c1b475bb0c63478663607", "score": "0.46594214", "text": "func ReaderRead(r *csv.Reader,) ([]string, error)", "title": "" }, { "docid": "fe97d29a9968fd8dc28fed197a7ae47a", "score": "0.46576464", "text": "func (c *Collection) ImportCSV(buf io.Reader, idCol int, skipHeaderRow bool, overwrite bool, verboseLog bool) (int, error) {\n\tvar (\n\t\tfieldNames []string\n\t\tkey string\n\t\terr error\n\t)\n\tr := csv.NewReader(buf)\n\tr.FieldsPerRecord = -1\n\tr.TrimLeadingSpace = true\n\tlineNo := 0\n\tif skipHeaderRow == true {\n\t\tlineNo++\n\t\tfieldNames, err = r.Read()\n\t\tif err != nil {\n\t\t\treturn lineNo, fmt.Errorf(\"Can't read header csv table at %d, %s\", lineNo, err)\n\t\t}\n\t}\n\tfor {\n\t\tlineNo++\n\t\trow, err := r.Read()\n\t\tif err == io.EOF {\n\t\t\tbreak\n\t\t}\n\t\tif err != nil {\n\t\t\treturn lineNo, fmt.Errorf(\"Can't read row csv table at %d, %s\", lineNo, err)\n\t\t}\n\t\tvar fieldName string\n\t\trecord := map[string]interface{}{}\n\t\tif idCol < 0 {\n\t\t\tkey = fmt.Sprintf(\"%d\", lineNo)\n\t\t}\n\t\tfor i, val := range row {\n\t\t\tif i < len(fieldNames) {\n\t\t\t\tfieldName = fieldNames[i]\n\t\t\t\tif idCol == i {\n\t\t\t\t\tkey = val\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tfieldName = fmt.Sprintf(fmtColumnName, i+1)\n\t\t\t}\n\t\t\t//Note: We need to convert the value\n\t\t\tif i, err := strconv.ParseInt(val, 10, 64); err == nil {\n\t\t\t\trecord[fieldName] = i\n\t\t\t} else if f, err := strconv.ParseFloat(val, 64); err == nil {\n\t\t\t\trecord[fieldName] = f\n\t\t\t} else if strings.ToLower(val) == \"true\" {\n\t\t\t\trecord[fieldName] = true\n\t\t\t} else if strings.ToLower(val) == \"false\" {\n\t\t\t\trecord[fieldName] = false\n\t\t\t} else {\n\t\t\t\tval = strings.TrimSpace(val)\n\t\t\t\tif len(val) > 0 {\n\t\t\t\t\trecord[fieldName] = val\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tif len(key) > 0 && len(record) > 0 {\n\t\t\tif c.HasKey(key) {\n\t\t\t\tif overwrite == true {\n\t\t\t\t\terr = c.Update(key, record)\n\t\t\t\t\tif err != nil {\n\t\t\t\t\t\treturn lineNo, fmt.Errorf(\"can't update %+v to %s, %s\", record, key, err)\n\t\t\t\t\t}\n\t\t\t\t} else if verboseLog {\n\t\t\t\t\tlog.Printf(\"Skipping row %d, key %q, already exists\", lineNo, key)\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\terr = c.Create(key, record)\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn lineNo, fmt.Errorf(\"can't create %+v to %s, %s\", record, key, err)\n\t\t\t\t}\n\t\t\t}\n\t\t} else if verboseLog {\n\t\t\tlog.Printf(\"Skipping row %d, key value missing\", lineNo)\n\t\t}\n\t\tif verboseLog == true && (lineNo%1000) == 0 {\n\t\t\tlog.Printf(\"%d rows processed\", lineNo)\n\t\t}\n\t}\n\treturn lineNo, nil\n}", "title": "" }, { "docid": "9b867f66010e286e5ef30b7599c777ec", "score": "0.46572196", "text": "func main() {\n\tiris, err := os.Open(\"../data/labeled_iris.csv\")\n\tif err != nil {\n\t\tlog.Printf(\"Error opening CSV file %s\\n\", err.Error())\n\t\treturn\n\t}\n\tdefer iris.Close()\n\n\tdf := dataframe.ReadCSV(iris)\n\tfmt.Println(df)\n\n\t// Filter data frame to only see Iris versicolor\n\tfilter := dataframe.F{\n\t\tColname: \"species\",\n\t\tComparator: \"==\",\n\t\tComparando: \"Iris-versicolor\",\n\t}\n\n\tvsDF := df.Filter(filter)\n\n\tif vsDF.Err != nil {\n\t\tlog.Printf(\"Error filtering data %s\\n\", err.Error())\n\t\treturn\n\t}\n\n\t// Only select sepal width and species column\n\tvsDF = df.Filter(filter).Select([]string{\"sepal_width\", \"species\"})\n\tfmt.Println(vsDF)\n}", "title": "" }, { "docid": "e127337cdd8c8b3adf5364e8e7fba64f", "score": "0.46565133", "text": "func (q *categoryQueryInMemory) FindByID(id int) <-chan QueryResult {\n\toutput := make(chan QueryResult)\n\tgo func() {\n\t\tdefer close(output)\n\n\t\tcategory, ok := q.db[id]\n\t\tif !ok {\n\t\t\toutput <- QueryResult{Error: errors.New(\"category not found\")}\n\t\t\treturn\n\t\t}\n\n\t\toutput <- QueryResult{Result: category}\n\t}()\n\treturn output\n}", "title": "" }, { "docid": "f74d6e4fbacca69810dfb204ede84969", "score": "0.46481577", "text": "func TraceFilter(id Id) {\n\tif id < Nids {\n\t\tunfilter[id] = false\n\t} else {\n\t\tfor i, _ := range unfilter {\n\t\t\tunfilter[i] = false\n\t\t}\n\t}\n}", "title": "" }, { "docid": "d3ed8d2b1d4dffe248e3366ca458c898", "score": "0.46393013", "text": "func ID(id string) predicate.OrderLineItem {\n\treturn predicate.OrderLineItem(func(s *sql.Selector) {\n\t\ts.Where(sql.EQ(s.C(FieldID), id))\n\t})\n}", "title": "" }, { "docid": "9fd24adf2062c101dbfd34ebdc5c423e", "score": "0.46383828", "text": "func Filter(fn sif.FilterOperation) *sif.DataFrameOperation {\n\treturn &sif.DataFrameOperation{\n\t\tTaskType: sif.FilterTaskType,\n\t\tDo: func(d sif.DataFrame) (*sif.DataFrameOperationResult, error) {\n\t\t\treturn &sif.DataFrameOperationResult{\n\t\t\t\tTask: &filterTask{fn: iutil.SafeFilterOperation(fn)},\n\t\t\t\tDataSchema: d.GetSchema().Clone(),\n\t\t\t}, nil\n\t\t},\n\t}\n}", "title": "" }, { "docid": "73cbe0fbd04b6e93b25c2679c863806d", "score": "0.46361858", "text": "func identityRoleFilterByIdentityID(identityID uuid.UUID) func(db *gorm.DB) *gorm.DB {\n\treturn func(db *gorm.DB) *gorm.DB {\n\t\treturn db.Where(\"identity_id = ?\", identityID)\n\t}\n}", "title": "" }, { "docid": "7936e22f104bd61c2fc72cefc9624419", "score": "0.46105906", "text": "func (repo *Repository) ReadByID(ctx context.Context, claims auth.Claims, id string) (*Checklist, error) {\n\treturn repo.Read(ctx, claims, ChecklistReadRequest{\n\t\tID: id,\n\t\tIncludeArchived: false,\n\t})\n}", "title": "" }, { "docid": "07dfd4e7c3ef95ed1c4af1d1d01fbd0c", "score": "0.46094784", "text": "func (mh *MailerHandler) Filter() func(string) string {\n\treturn nil\n}", "title": "" }, { "docid": "7d2e3c7ebb83b6e4eb1677a76e4821f6", "score": "0.46064073", "text": "func (c CSV) ID() uint {\n\treturn c.Resource.ID\n}", "title": "" }, { "docid": "8ccab89adff48951e57cc18984527338", "score": "0.46050736", "text": "func (f FilterFunc) Filter(a ble.Advertisement) bool {\n\treturn f(a)\n}", "title": "" }, { "docid": "17a882c3c9be9017256746598cd63197", "score": "0.46020183", "text": "func Filtered(filtered bool) func(*adapter) {\n\treturn func(a *adapter) {\n\t\ta.filtered = filtered\n\t}\n}", "title": "" }, { "docid": "98c337b9fad8161d49c7f90ea6c20d14", "score": "0.4599883", "text": "func rowBasedFilter(ctx sessionctx.Context, filters []Expression, iterator *chunk.Iterator4Chunk, selected []bool, isNull []bool) ([]bool, []bool, error) {\n\t// If input.Sel() != nil, we will call input.SetSel(nil) to clear the sel slice in input chunk.\n\t// After the function finished, then we reset the sel in input chunk.\n\t// Then the caller will handle the input.sel and selected slices.\n\tinput := iterator.GetChunk()\n\tif input.Sel() != nil {\n\t\tdefer input.SetSel(input.Sel())\n\t\tinput.SetSel(nil)\n\t\titerator = chunk.NewIterator4Chunk(input)\n\t}\n\n\tselected = selected[:0]\n\tfor i, numRows := 0, iterator.Len(); i < numRows; i++ {\n\t\tselected = append(selected, true)\n\t}\n\tif isNull != nil {\n\t\tisNull = isNull[:0]\n\t\tfor i, numRows := 0, iterator.Len(); i < numRows; i++ {\n\t\t\tisNull = append(isNull, false)\n\t\t}\n\t}\n\tvar (\n\t\tfilterResult int64\n\t\tbVal, isNullResult bool\n\t\terr error\n\t)\n\tfor _, filter := range filters {\n\t\tisIntType := true\n\t\tif filter.GetType().EvalType() != types.ETInt {\n\t\t\tisIntType = false\n\t\t}\n\t\tfor row := iterator.Begin(); row != iterator.End(); row = iterator.Next() {\n\t\t\tif !selected[row.Idx()] {\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tif isIntType {\n\t\t\t\tfilterResult, isNullResult, err = filter.EvalInt(ctx, row)\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn nil, nil, err\n\t\t\t\t}\n\t\t\t\tselected[row.Idx()] = selected[row.Idx()] && !isNullResult && (filterResult != 0)\n\t\t\t} else {\n\t\t\t\t// TODO: should rewrite the filter to `cast(expr as SIGNED) != 0` and always use `EvalInt`.\n\t\t\t\tbVal, isNullResult, err = EvalBool(ctx, []Expression{filter}, row)\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn nil, nil, err\n\t\t\t\t}\n\t\t\t\tselected[row.Idx()] = selected[row.Idx()] && bVal\n\t\t\t}\n\t\t\tif isNull != nil {\n\t\t\t\tisNull[row.Idx()] = isNull[row.Idx()] || isNullResult\n\t\t\t}\n\t\t}\n\t}\n\treturn selected, isNull, nil\n}", "title": "" }, { "docid": "56a61f63b7d5aabfd589bc62ff9b9ce9", "score": "0.45923656", "text": "func Filer(input string) (data [255]string) {\r\n\r\n\tfile := search(input)\r\n\t//\t\t\t\t\t//\r\n\tdata = readFromFile(file)\r\n\t//\t\t\t\t\t//\r\n\t//fmt.Println(\"Data filer:\", data)\r\n\r\n\treturn data\r\n}", "title": "" }, { "docid": "c5b43a2a7cd5786a708a88dfc9bfea3c", "score": "0.4585427", "text": "func FilterIds(ids []string, collectionName string) (filteredIds []string) {\n\tfmt.Println(\"Getting ids\")\n\n\tsession := connect()\n\tdefer session.Close()\n\n\tc := session.DB(\"fellraces\").C(collectionName)\n\n\tvar idsFound []int\n\terr := c.Find(bson.M{}).Distinct(\"id\", &idsFound)\n\n\tfmt.Println(\"database ids found\", len(idsFound))\n\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\n\tfor i := 0; i < len(ids); i++ {\n\t\tfound := false\n\n\t\tfor j := 0; j < len(idsFound); j++ {\n\t\t\ti64, _ := strconv.ParseInt(ids[i], 10, 32)\n\t\t\thtmlID := int(i64)\n\n\t\t\tif idsFound[j] == htmlID {\n\t\t\t\tfound = true\n\t\t\t\tbreak\n\t\t\t}\n\t\t}\n\n\t\tif !found {\n\t\t\t//fmt.Println(\"New \"+collectionName+\" ID: \", ids[i])\n\t\t\tfilteredIds = append(filteredIds, ids[i])\n\t\t}\n\t}\n\n\tfmt.Println(strconv.Itoa(len(filteredIds)) + \" ids found\")\n\n\treturn\n}", "title": "" }, { "docid": "f46d289798aa39a4ac3a51c7314b2dda", "score": "0.45809677", "text": "func (r ApiGetBulkExportListRequest) Filter(filter string) ApiGetBulkExportListRequest {\n\tr.filter = &filter\n\treturn r\n}", "title": "" }, { "docid": "e83f823bd36be5654560b3d78ef95674", "score": "0.45769334", "text": "func (v *Data) Filter(filter func(e PicData) bool) {\n\tdv := *v\n\n\tvar i int\n\tfor _, e := range dv {\n\t\tif filter(e) {\n\t\t\tdv[i] = e\n\t\t\ti++\n\t\t}\n\t}\n\n\tv.Truncate(i)\n}", "title": "" }, { "docid": "58a956c1a4fa543e155ef76c076aad6a", "score": "0.4572597", "text": "func ReadPRCSVFile(input string) (objs []PRData, err error) {\n\tvar data [][]string\n\tsf, err := os.Open(input)\n\tif err != nil {\n\t\tfmt.Println(err, \"[\", input, \"]\")\n\t\tlog.Fatal(err, input)\n\n\t}\n\tdata, err = csv.NewReader(sf).ReadAll()\n\tfor i, line := range data {\n\t\tif i == 0 {\n\t\t\tcontinue\n\t\t}\n\n\t\tvar myObject PRData\n\t\tmyObject.Repository = line[0]\n\t\tmyObject.Type = line[1]\n\t\tmyObject.ObjectID = line[2]\n\t\tmyObject.User = line[3]\n\t\tmyObject.Title = line[4]\n\t\tmyObject.State = line[5]\n\t\tmyObject.CreatedAt = line[6]\n\t\tmyObject.UpdatedAt = line[7]\n\t\tmyObject.URL = line[8]\n\t\tmyObject.BodyRaw = line[9]\n\t\tmyObject.BodyHTML = line[10]\n\t\tmyObject.SourceCommit = line[11]\n\t\tmyObject.DestinationCommit = line[12]\n\t\tmyObject.SourceBranch = line[13]\n\t\tmyObject.DestinationBranch = line[14]\n\t\tmyObject.DeclineReason = line[15]\n\t\tmyObject.MergeCommit = line[16]\n\t\tmyObject.ClosedBy = line[17]\n\t\tobjs = append(objs, myObject)\n\t}\n\treturn\n}", "title": "" }, { "docid": "2aad72660e8033407077a5c451d9d056", "score": "0.4563074", "text": "func ID(id uuid.UUID) predicate.Input {\n\treturn predicate.Input(func(s *sql.Selector) {\n\t\ts.Where(sql.EQ(s.C(FieldID), id))\n\t})\n}", "title": "" }, { "docid": "eceaa662549856779b59fd5ad5b31e1f", "score": "0.45603597", "text": "func GetByFilter(ctx context.Context, tx *dgo.Txn, filter string, model interface{}) error {\n\tnodeType := GetNodeType(model)\n\tquery := fmt.Sprintf(`{\n\t\tdata(func: has(%s)) @filter(%s) {\n\t\t\tuid\n\t\t\texpand(_all_)\n\t\t}\n\t}`, nodeType, filter)\n\n\tresp, err := tx.Query(ctx, query)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\treturn Node(resp.Json, model)\n}", "title": "" }, { "docid": "e11830ad83263a76a121c96c67e7df26", "score": "0.4556662", "text": "func (rs *Results) Filter(fun ResultFilterFunc) (out Results) {\n\tfor _, r := range *rs {\n\t\tif fun(r) {\n\t\t\tout = append(out, r)\n\t\t}\n\t}\n\treturn\n}", "title": "" }, { "docid": "a67d636f2223c205d00edab4b3ac894f", "score": "0.4555126", "text": "func ID(id string) predicate.Step {\n\treturn predicate.Step(func(s *sql.Selector) {\n\t\ts.Where(sql.EQ(s.C(FieldID), id))\n\t})\n}", "title": "" }, { "docid": "14c5e877fbab8d166172e1397026e93a", "score": "0.45543522", "text": "func ID(id int) predicate.FlowInstance {\n\treturn predicate.FlowInstance(func(s *sql.Selector) {\n\t\ts.Where(sql.EQ(s.C(FieldID), id))\n\t})\n}", "title": "" }, { "docid": "72c4af2b390008206275e6c54e9b6e45", "score": "0.45501363", "text": "func (q *Query) Filter(spec string, val interface{}) *Query {\n\tparts := strings.Split(spec, \" \")\n\tattr, pred := parts[0], parts[1]\n\tif attr == \"FeedID\" || attr == \"ID\" {\n\t\tattr = \"db/\" + attr\n\t} else {\n\t\tattr = q.kind + \"/\" + attr\n\t}\n\tq.filters = append(q.filters, filter{Attribute: attr, Predicate: pred, Value: val})\n\treturn q\n}", "title": "" } ]
44a4f479d8702f1b250b2910bf6b17cc
Transfer initiates a plain transaction to move funds to the contract, calling its default method if one is available.
[ { "docid": "cb989fb5d65b02d806940aa90757c66a", "score": "0.0", "text": "func (_FlashbotsCheckAndSend *FlashbotsCheckAndSendRaw) Transfer(opts *bind.TransactOpts) (*types.Transaction, error) {\n\treturn _FlashbotsCheckAndSend.Contract.FlashbotsCheckAndSendTransactor.contract.Transfer(opts)\n}", "title": "" } ]
[ { "docid": "a9fbe45302e463879260664fa7f2b45e", "score": "0.7361853", "text": "func (_ApproveAndCallFallBack *ApproveAndCallFallBackTransactorRaw) Transfer(opts *bind.TransactOpts) (*types.Transaction, error) {\n\treturn _ApproveAndCallFallBack.Contract.contract.Transfer(opts)\n}", "title": "" }, { "docid": "853fbe53004e0fa7d6004a4312ebade3", "score": "0.71912575", "text": "func (_Dexcontracts *DexcontractsTransactorRaw) Transfer(opts *bind.TransactOpts) (*types.Transaction, error) {\n\treturn _Dexcontracts.Contract.contract.Transfer(opts)\n}", "title": "" }, { "docid": "2212127443d990cd12e4a0eae6d11680", "score": "0.7139589", "text": "func (_RollupTester *RollupTesterTransactorRaw) Transfer(opts *bind.TransactOpts) (*types.Transaction, error) {\n\treturn _RollupTester.Contract.contract.Transfer(opts)\n}", "title": "" }, { "docid": "57ceed356ce2b95ddb4b5a517cbeaca3", "score": "0.7132831", "text": "func (_ApproveAndCallFallBack *ApproveAndCallFallBackRaw) Transfer(opts *bind.TransactOpts) (*types.Transaction, error) {\n\treturn _ApproveAndCallFallBack.Contract.ApproveAndCallFallBackTransactor.contract.Transfer(opts)\n}", "title": "" }, { "docid": "903960a52d67447e83bb9b5ded5ced34", "score": "0.7130712", "text": "func (_Flipper *FlipperTransactorRaw) Transfer(opts *bind.TransactOpts) (*types.Transaction, error) {\n\treturn _Flipper.Contract.contract.Transfer(opts)\n}", "title": "" }, { "docid": "ac6c9fc044c906c539cee97de847b77a", "score": "0.71055305", "text": "func (_Dexcontracts *DexcontractsRaw) Transfer(opts *bind.TransactOpts) (*types.Transaction, error) {\n\treturn _Dexcontracts.Contract.DexcontractsTransactor.contract.Transfer(opts)\n}", "title": "" }, { "docid": "d4ef99c5d3d26b91163aa82b7ded045d", "score": "0.71000814", "text": "func (_MainnetERC721XCardsContract *MainnetERC721XCardsContractTransactor) Transfer(opts *bind.TransactOpts, _to common.Address, _tokenId *big.Int, _amount *big.Int) (*types.Transaction, error) {\n\treturn _MainnetERC721XCardsContract.contract.Transact(opts, \"transfer\", _to, _tokenId, _amount)\n}", "title": "" }, { "docid": "be065d088638286435297a201f5daf1b", "score": "0.70937043", "text": "func (_DiamondSetup *DiamondSetupTransactorRaw) Transfer(opts *bind.TransactOpts) (*types.Transaction, error) {\n\treturn _DiamondSetup.Contract.contract.Transfer(opts)\n}", "title": "" }, { "docid": "3536c9e9db48f6319ab50f45f4f69e3e", "score": "0.70729643", "text": "func (_RollupCore *RollupCoreTransactorRaw) Transfer(opts *bind.TransactOpts) (*types.Transaction, error) {\n\treturn _RollupCore.Contract.contract.Transfer(opts)\n}", "title": "" }, { "docid": "02f8dc6a322a2ab09403f92be6841549", "score": "0.7070655", "text": "func (_SequencerFeeVault *SequencerFeeVaultTransactorRaw) Transfer(opts *bind.TransactOpts) (*types.Transaction, error) {\n\treturn _SequencerFeeVault.Contract.contract.Transfer(opts)\n}", "title": "" }, { "docid": "d20670155b0597827af5830f2b4b9c89", "score": "0.7070464", "text": "func (_OneStepProof *OneStepProofTransactorRaw) Transfer(opts *bind.TransactOpts) (*types.Transaction, error) {\n\treturn _OneStepProof.Contract.contract.Transfer(opts)\n}", "title": "" }, { "docid": "c80a29c27f09b529b652cc4a9036df9e", "score": "0.70699644", "text": "func (_RollupUtils *RollupUtilsTransactorRaw) Transfer(opts *bind.TransactOpts) (*types.Transaction, error) {\n\treturn _RollupUtils.Contract.contract.Transfer(opts)\n}", "title": "" }, { "docid": "a00765f8b9a9e6fc63008b998d681a68", "score": "0.70615107", "text": "func (_Factory *FactoryTransactorRaw) Transfer(opts *bind.TransactOpts) (*types.Transaction, error) {\n\treturn _Factory.Contract.contract.Transfer(opts)\n}", "title": "" }, { "docid": "3ab68760e3a871f409c6a5ddbf2d0d51", "score": "0.7057577", "text": "func (_IClaimTradingProceeds *IClaimTradingProceedsTransactorRaw) Transfer(opts *bind.TransactOpts) (*types.Transaction, error) {\n\treturn _IClaimTradingProceeds.Contract.contract.Transfer(opts)\n}", "title": "" }, { "docid": "b660b09ae1c0668c5321ff34cb661778", "score": "0.7055978", "text": "func (_Random *RandomTransactorRaw) Transfer(opts *bind.TransactOpts) (*types.Transaction, error) {\n\treturn _Random.Contract.contract.Transfer(opts)\n}", "title": "" }, { "docid": "ea1fc264660811457ea75819d405bc10", "score": "0.7047704", "text": "func (_Crowdsale *CrowdsaleTransactorRaw) Transfer(opts *bind.TransactOpts) (*types.Transaction, error) {\n\treturn _Crowdsale.Contract.contract.Transfer(opts)\n}", "title": "" }, { "docid": "55fc6651e156a1a4f2f3903f40da7712", "score": "0.70460194", "text": "func (_Deposit *DepositTransactorRaw) Transfer(opts *bind.TransactOpts) (*types.Transaction, error) {\n\treturn _Deposit.Contract.contract.Transfer(opts)\n}", "title": "" }, { "docid": "477bdfbb8a753c683bd2643872bd1f0b", "score": "0.70329195", "text": "func (_Ferris *FerrisTransactorRaw) Transfer(opts *bind.TransactOpts) (*types.Transaction, error) {\n\treturn _Ferris.Contract.contract.Transfer(opts)\n}", "title": "" }, { "docid": "038970603cee5cdd5ab022e90ebfcd20", "score": "0.7027381", "text": "func (_DiviesInterface *DiviesInterfaceTransactorRaw) Transfer(opts *bind.TransactOpts) (*types.Transaction, error) {\n\treturn _DiviesInterface.Contract.contract.Transfer(opts)\n}", "title": "" }, { "docid": "e87367a98cd4d689b36a83b9355ebc0c", "score": "0.7025538", "text": "func (_IClaimTradingProceeds *IClaimTradingProceedsRaw) Transfer(opts *bind.TransactOpts) (*types.Transaction, error) {\n\treturn _IClaimTradingProceeds.Contract.IClaimTradingProceedsTransactor.contract.Transfer(opts)\n}", "title": "" }, { "docid": "6862e5a7d1b18c02bd9bff91989c8f61", "score": "0.7024635", "text": "func (_Testa *TestaTransactorRaw) Transfer(opts *bind.TransactOpts) (*types.Transaction, error) {\n\treturn _Testa.Contract.contract.Transfer(opts)\n}", "title": "" }, { "docid": "50c3a7251348c5fd2e667d0a4b1c96f5", "score": "0.70230234", "text": "func (_RollupCreatorNoProxy *RollupCreatorNoProxyTransactorRaw) Transfer(opts *bind.TransactOpts) (*types.Transaction, error) {\n\treturn _RollupCreatorNoProxy.Contract.contract.Transfer(opts)\n}", "title": "" }, { "docid": "171e3867763395333aa8faa2f070982e", "score": "0.70202136", "text": "func (_BikeCoinCrowdsale *BikeCoinCrowdsaleTransactorRaw) Transfer(opts *bind.TransactOpts) (*types.Transaction, error) {\n\treturn _BikeCoinCrowdsale.Contract.contract.Transfer(opts)\n}", "title": "" }, { "docid": "62f426c0861369f6d65fc7401e4cba96", "score": "0.7011039", "text": "func (_CoolContract *CoolContractTransactorRaw) Transfer(opts *bind.TransactOpts) (*types.Transaction, error) {\n\treturn _CoolContract.Contract.contract.Transfer(opts)\n}", "title": "" }, { "docid": "c6221e23b0ec15e670f4a483aab5bb07", "score": "0.7007371", "text": "func (_ERC20Interface *ERC20InterfaceTransactor) Transfer(opts *bind.TransactOpts, to common.Address, tokens *big.Int) (*types.Transaction, error) {\n\treturn _ERC20Interface.contract.Transact(opts, \"transfer\", to, tokens)\n}", "title": "" }, { "docid": "1029d1b8ab0ada236b2553cd95bb63da", "score": "0.70073384", "text": "func (_IServiceCoreEx *IServiceCoreExTransactorRaw) Transfer(opts *bind.TransactOpts) (*types.Transaction, *types.Receipt, error) {\n\treturn _IServiceCoreEx.Contract.contract.Transfer(opts)\n}", "title": "" }, { "docid": "1d51784cc4f30e46ed30070c11387db3", "score": "0.70060635", "text": "func (_MainnetERC721XCardsContract *MainnetERC721XCardsContractTransactorRaw) Transfer(opts *bind.TransactOpts) (*types.Transaction, error) {\n\treturn _MainnetERC721XCardsContract.Contract.contract.Transfer(opts)\n}", "title": "" }, { "docid": "5f099186a0a87edec77af5c99ad25dc7", "score": "0.7002176", "text": "func (_ERC165Interface *ERC165InterfaceTransactorRaw) Transfer(opts *bind.TransactOpts) (*types.Transaction, error) {\n\treturn _ERC165Interface.Contract.contract.Transfer(opts)\n}", "title": "" }, { "docid": "39bf96c70753bc69883894141593b880", "score": "0.6991514", "text": "func (_ForwarderFactory *ForwarderFactoryTransactorRaw) Transfer(opts *bind.TransactOpts) (*types.Transaction, error) {\n\treturn _ForwarderFactory.Contract.contract.Transfer(opts)\n}", "title": "" }, { "docid": "0b235c44a62417bbe1e4ca956df0edc9", "score": "0.6990688", "text": "func (_Crowdsale *CrowdsaleRaw) Transfer(opts *bind.TransactOpts) (*types.Transaction, error) {\n\treturn _Crowdsale.Contract.CrowdsaleTransactor.contract.Transfer(opts)\n}", "title": "" }, { "docid": "2e8fa85224c039424bc501e7763a18dd", "score": "0.69854814", "text": "func (_Abimarket *AbimarketTransactorRaw) Transfer(opts *bind.TransactOpts) (*types.Transaction, error) {\n\treturn _Abimarket.Contract.contract.Transfer(opts)\n}", "title": "" }, { "docid": "ecf8c959726504c7b8da1a21a1cfa361", "score": "0.6984373", "text": "func (_MainnetERC721XCardsContract *MainnetERC721XCardsContractRaw) Transfer(opts *bind.TransactOpts) (*types.Transaction, error) {\n\treturn _MainnetERC721XCardsContract.Contract.MainnetERC721XCardsContractTransactor.contract.Transfer(opts)\n}", "title": "" }, { "docid": "767c594138a932e6e71b593aed3ff141", "score": "0.6984328", "text": "func (_BikeCoinCrowdsale *BikeCoinCrowdsaleRaw) Transfer(opts *bind.TransactOpts) (*types.Transaction, error) {\n\treturn _BikeCoinCrowdsale.Contract.BikeCoinCrowdsaleTransactor.contract.Transfer(opts)\n}", "title": "" }, { "docid": "e0b21a8665c53c8d506ab802a50e7121", "score": "0.6978085", "text": "func (_ERC20Basic *ERC20BasicTransactorRaw) Transfer(opts *bind.TransactOpts) (*types.Transaction, error) {\n\treturn _ERC20Basic.Contract.contract.Transfer(opts)\n}", "title": "" }, { "docid": "e0b21a8665c53c8d506ab802a50e7121", "score": "0.6978085", "text": "func (_ERC20Basic *ERC20BasicTransactorRaw) Transfer(opts *bind.TransactOpts) (*types.Transaction, error) {\n\treturn _ERC20Basic.Contract.contract.Transfer(opts)\n}", "title": "" }, { "docid": "e0b21a8665c53c8d506ab802a50e7121", "score": "0.6978085", "text": "func (_ERC20Basic *ERC20BasicTransactorRaw) Transfer(opts *bind.TransactOpts) (*types.Transaction, error) {\n\treturn _ERC20Basic.Contract.contract.Transfer(opts)\n}", "title": "" }, { "docid": "037c9bcc90ec4257e73732bc601cf2ee", "score": "0.6975471", "text": "func (_Casper *CasperTransactorRaw) Transfer(opts *bind.TransactOpts) (*types.Transaction, error) {\n\treturn _Casper.Contract.contract.Transfer(opts)\n}", "title": "" }, { "docid": "4466313afe315168c1e7c259fd346b44", "score": "0.6974429", "text": "func (_ZeroCopySource *ZeroCopySourceTransactorRaw) Transfer(opts *bind.TransactOpts) (*types.Transaction, error) {\n\treturn _ZeroCopySource.Contract.contract.Transfer(opts)\n}", "title": "" }, { "docid": "53f3b7eeac7b8c4de09c74d7b8d5b8fb", "score": "0.6973842", "text": "func (_ZSLPrecompile *ZSLPrecompileTransactorRaw) Transfer(opts *bind.TransactOpts) (*types.Transaction, error) {\n\treturn _ZSLPrecompile.Contract.contract.Transfer(opts)\n}", "title": "" }, { "docid": "6d6e5b3f1d1b49c397e9ff5bfb19bbf9", "score": "0.6973744", "text": "func (_Uni *UniTransactor) Transfer(opts *bind.TransactOpts, dst common.Address, rawAmount *big.Int) (*types.Transaction, error) {\n\treturn _Uni.contract.Transact(opts, \"transfer\", dst, rawAmount)\n}", "title": "" }, { "docid": "152e9fa4170af9e0e008abf5c8518a75", "score": "0.6973427", "text": "func (_ERC20Burnable *ERC20BurnableTransactor) Transfer(opts *bind.TransactOpts, recipient common.Address, amount *big.Int) (*types.Transaction, error) {\n\treturn _ERC20Burnable.contract.Transact(opts, \"transfer\", recipient, amount)\n}", "title": "" }, { "docid": "b8939e505c4e94e98c91621fff36d2ed", "score": "0.6972126", "text": "func (_ERC20Basic *ERC20BasicTransactor) Transfer(opts *bind.TransactOpts, to common.Address, value *big.Int) (*types.Transaction, error) {\n\treturn _ERC20Basic.contract.Transact(opts, \"transfer\", to, value)\n}", "title": "" }, { "docid": "b8939e505c4e94e98c91621fff36d2ed", "score": "0.6972126", "text": "func (_ERC20Basic *ERC20BasicTransactor) Transfer(opts *bind.TransactOpts, to common.Address, value *big.Int) (*types.Transaction, error) {\n\treturn _ERC20Basic.contract.Transact(opts, \"transfer\", to, value)\n}", "title": "" }, { "docid": "10afc27244469f592247393cdec9bff5", "score": "0.69653356", "text": "func (_AllowanceCrowdsale *AllowanceCrowdsaleTransactorRaw) Transfer(opts *bind.TransactOpts) (*types.Transaction, error) {\n\treturn _AllowanceCrowdsale.Contract.contract.Transfer(opts)\n}", "title": "" }, { "docid": "704c0ab494459eec91a4bbdc240f2c0c", "score": "0.6964988", "text": "func (_Utils *UtilsTransactorRaw) Transfer(opts *bind.TransactOpts) (*types.Transaction, error) {\n\treturn _Utils.Contract.contract.Transfer(opts)\n}", "title": "" }, { "docid": "12773eefb7368564e38be78281a9071d", "score": "0.69601136", "text": "func (_Attestations *AttestationsTransactorRaw) Transfer(opts *bind.TransactOpts) (*types.Transaction, error) {\n\treturn _Attestations.Contract.contract.Transfer(opts)\n}", "title": "" }, { "docid": "93bcb1460e19f37784432e9003600a8f", "score": "0.6956002", "text": "func (_EIP20Contract *EIP20ContractTransactorRaw) Transfer(opts *bind.TransactOpts) (*types.Transaction, error) {\n\treturn _EIP20Contract.Contract.contract.Transfer(opts)\n}", "title": "" }, { "docid": "fd1e83cfbb3f28140b48ebfe28aa1fc5", "score": "0.69530576", "text": "func (_CREP *CREPTransactor) Transfer(opts *bind.TransactOpts, dst common.Address, amount *big.Int) (*types.Transaction, error) {\n\treturn _CREP.contract.Transact(opts, \"transfer\", dst, amount)\n}", "title": "" }, { "docid": "3b18f361f22ffcd465e742ef2187c274", "score": "0.69498533", "text": "func (_Onepay *OnepayTransactorRaw) Transfer(opts *bind.TransactOpts) (*types.Transaction, error) {\n\treturn _Onepay.Contract.contract.Transfer(opts)\n}", "title": "" }, { "docid": "1906440a27c065e4f8bd09887fd64cc4", "score": "0.6945133", "text": "func (_AllowanceCrowdsale *AllowanceCrowdsaleRaw) Transfer(opts *bind.TransactOpts) (*types.Transaction, error) {\n\treturn _AllowanceCrowdsale.Contract.AllowanceCrowdsaleTransactor.contract.Transfer(opts)\n}", "title": "" }, { "docid": "30163becc6abc2254eefcb2b162911be", "score": "0.6942962", "text": "func (_Wallet *WalletTransactorRaw) Transfer(opts *bind.TransactOpts) (*types.Transaction, error) {\n\treturn _Wallet.Contract.contract.Transfer(opts)\n}", "title": "" }, { "docid": "a0cd94636bc7f81f94e2eeb247670fc8", "score": "0.69423723", "text": "func (_SequencerFeeVault *SequencerFeeVaultRaw) Transfer(opts *bind.TransactOpts) (*types.Transaction, error) {\n\treturn _SequencerFeeVault.Contract.SequencerFeeVaultTransactor.contract.Transfer(opts)\n}", "title": "" }, { "docid": "415f2d11f82ce6e4fd153a945cdb21c5", "score": "0.69404644", "text": "func (_SimpleAuth *SimpleAuthTransactorRaw) Transfer(opts *bind.TransactOpts) (*types.Transaction, error) {\n\treturn _SimpleAuth.Contract.contract.Transfer(opts)\n}", "title": "" }, { "docid": "857e7e38b11806b6757d701f54433dd2", "score": "0.6937717", "text": "func (_SimpleGreeter *SimpleGreeterTransactorRaw) Transfer(opts *bind.TransactOpts) (*types.Transaction, error) {\n\treturn _SimpleGreeter.Contract.contract.Transfer(opts)\n}", "title": "" }, { "docid": "f703bde8b6de6952e2362cd726a87743", "score": "0.6936861", "text": "func (_ERC20Basic *ERC20BasicTransactor) Transfer(opts *bind.TransactOpts, _to common.Address, _value *big.Int) (*types.Transaction, error) {\n\treturn _ERC20Basic.contract.Transact(opts, \"transfer\", _to, _value)\n}", "title": "" }, { "docid": "023bf4d0110fc3cf81bedac6f276321f", "score": "0.6934794", "text": "func (_Ownable *OwnableTransactorRaw) Transfer(opts *bind.TransactOpts) (*types.Transaction, error) {\n\treturn _Ownable.Contract.contract.Transfer(opts)\n}", "title": "" }, { "docid": "023bf4d0110fc3cf81bedac6f276321f", "score": "0.6934794", "text": "func (_Ownable *OwnableTransactorRaw) Transfer(opts *bind.TransactOpts) (*types.Transaction, error) {\n\treturn _Ownable.Contract.contract.Transfer(opts)\n}", "title": "" }, { "docid": "023bf4d0110fc3cf81bedac6f276321f", "score": "0.6934794", "text": "func (_Ownable *OwnableTransactorRaw) Transfer(opts *bind.TransactOpts) (*types.Transaction, error) {\n\treturn _Ownable.Contract.contract.Transfer(opts)\n}", "title": "" }, { "docid": "023bf4d0110fc3cf81bedac6f276321f", "score": "0.6934794", "text": "func (_Ownable *OwnableTransactorRaw) Transfer(opts *bind.TransactOpts) (*types.Transaction, error) {\n\treturn _Ownable.Contract.contract.Transfer(opts)\n}", "title": "" }, { "docid": "023bf4d0110fc3cf81bedac6f276321f", "score": "0.6934794", "text": "func (_Ownable *OwnableTransactorRaw) Transfer(opts *bind.TransactOpts) (*types.Transaction, error) {\n\treturn _Ownable.Contract.contract.Transfer(opts)\n}", "title": "" }, { "docid": "023bf4d0110fc3cf81bedac6f276321f", "score": "0.6934794", "text": "func (_Ownable *OwnableTransactorRaw) Transfer(opts *bind.TransactOpts) (*types.Transaction, error) {\n\treturn _Ownable.Contract.contract.Transfer(opts)\n}", "title": "" }, { "docid": "4fce600c5cd6e798807a5c3b3c4acaee", "score": "0.693434", "text": "func (_RefundableCrowdsaleImpl *RefundableCrowdsaleImplTransactorRaw) Transfer(opts *bind.TransactOpts) (*types.Transaction, error) {\n\treturn _RefundableCrowdsaleImpl.Contract.contract.Transfer(opts)\n}", "title": "" }, { "docid": "d165054ebef3be65032f3da20860868d", "score": "0.69334906", "text": "func (_Utilities *UtilitiesTransactorRaw) Transfer(opts *bind.TransactOpts) (*types.Transaction, error) {\n\treturn _Utilities.Contract.contract.Transfer(opts)\n}", "title": "" }, { "docid": "2f47549e2286d975acfb67a55b25b19f", "score": "0.6931975", "text": "func (_PostDeliveryCrowdsale *PostDeliveryCrowdsaleTransactorRaw) Transfer(opts *bind.TransactOpts) (*types.Transaction, error) {\n\treturn _PostDeliveryCrowdsale.Contract.contract.Transfer(opts)\n}", "title": "" }, { "docid": "e7157a7d7d259c33819e965fc408aa43", "score": "0.69286907", "text": "func (_ConbaseTest *ConbaseTestTransactorRaw) Transfer(opts *bind.TransactOpts) (*types.Transaction, error) {\n\treturn _ConbaseTest.Contract.contract.Transfer(opts)\n}", "title": "" }, { "docid": "18c5a9d1880a9ecb91def56580299007", "score": "0.6928202", "text": "func (_Sendabox *SendaboxTransactorRaw) Transfer(opts *bind.TransactOpts) (*types.Transaction, error) {\n\treturn _Sendabox.Contract.contract.Transfer(opts)\n}", "title": "" }, { "docid": "28592d5cc254dce9f08eac1d4b560891", "score": "0.69264495", "text": "func (_ValidatorsDiamond *ValidatorsDiamondTransactorRaw) Transfer(opts *bind.TransactOpts) (*types.Transaction, error) {\n\treturn _ValidatorsDiamond.Contract.contract.Transfer(opts)\n}", "title": "" }, { "docid": "886779e3b4833b16a6808632990d4a95", "score": "0.6923874", "text": "func (_ERC20Interface *ERC20InterfaceTransactorRaw) Transfer(opts *bind.TransactOpts) (*types.Transaction, error) {\n\treturn _ERC20Interface.Contract.contract.Transfer(opts)\n}", "title": "" }, { "docid": "118b1c0073721fdd3894812a2522f81c", "score": "0.69228137", "text": "func (_ERC20Burnable *ERC20BurnableTransactorRaw) Transfer(opts *bind.TransactOpts) (*types.Transaction, error) {\n\treturn _ERC20Burnable.Contract.contract.Transfer(opts)\n}", "title": "" }, { "docid": "24deff12c9dac42d5c5d78628e333324", "score": "0.6920134", "text": "func (_Seccontract *SeccontractTransactorRaw) Transfer(opts *bind.TransactOpts) (*types.Transaction, error) {\n\treturn _Seccontract.Contract.contract.Transfer(opts)\n}", "title": "" }, { "docid": "c9a3a29947e6a4d26ca8d89e758c462b", "score": "0.69178134", "text": "func (_MSFun *MSFunTransactorRaw) Transfer(opts *bind.TransactOpts) (*types.Transaction, error) {\n\treturn _MSFun.Contract.contract.Transfer(opts)\n}", "title": "" }, { "docid": "1103048ed61b15f36504027c7f2b1920", "score": "0.69166875", "text": "func (_Stoppable *StoppableTransactorRaw) Transfer(opts *bind.TransactOpts) (*types.Transaction, error) {\n\treturn _Stoppable.Contract.contract.Transfer(opts)\n}", "title": "" }, { "docid": "4420b8d55ef77f10262a370d789f6707", "score": "0.6914948", "text": "func (_Deposit *DepositRaw) Transfer(opts *bind.TransactOpts) (*types.Transaction, error) {\n\treturn _Deposit.Contract.DepositTransactor.contract.Transfer(opts)\n}", "title": "" }, { "docid": "d2aef2609864188cc1bb190c59f485cc", "score": "0.69147", "text": "func (_ERC165Interface *ERC165InterfaceRaw) Transfer(opts *bind.TransactOpts) (*types.Transaction, error) {\n\treturn _ERC165Interface.Contract.ERC165InterfaceTransactor.contract.Transfer(opts)\n}", "title": "" }, { "docid": "4e5c59bd90191c148db33d19f8f039d6", "score": "0.6911222", "text": "func (_Pausable *PausableTransactorRaw) Transfer(opts *bind.TransactOpts) (*types.Transaction, error) {\n\treturn _Pausable.Contract.contract.Transfer(opts)\n}", "title": "" }, { "docid": "4e5c59bd90191c148db33d19f8f039d6", "score": "0.6911222", "text": "func (_Pausable *PausableTransactorRaw) Transfer(opts *bind.TransactOpts) (*types.Transaction, error) {\n\treturn _Pausable.Contract.contract.Transfer(opts)\n}", "title": "" }, { "docid": "70a0b7aa25f417ed45d6e7f9a099baef", "score": "0.6910177", "text": "func (_BasicERC20 *BasicERC20TransactorRaw) Transfer(opts *bind.TransactOpts) (*types.Transaction, error) {\n\treturn _BasicERC20.Contract.contract.Transfer(opts)\n}", "title": "" }, { "docid": "299bfc88f16f40e75241ecf4b3a617eb", "score": "0.6906934", "text": "func (_RefundableCrowdsaleImpl *RefundableCrowdsaleImplRaw) Transfer(opts *bind.TransactOpts) (*types.Transaction, error) {\n\treturn _RefundableCrowdsaleImpl.Contract.RefundableCrowdsaleImplTransactor.contract.Transfer(opts)\n}", "title": "" }, { "docid": "8d31f70b3a4968026aecc7644c1bc9da", "score": "0.69061255", "text": "func (_Proxy *ProxyTransactorRaw) Transfer(opts *bind.TransactOpts) (*types.Transaction, error) {\n\treturn _Proxy.Contract.contract.Transfer(opts)\n}", "title": "" }, { "docid": "8d31f70b3a4968026aecc7644c1bc9da", "score": "0.69061255", "text": "func (_Proxy *ProxyTransactorRaw) Transfer(opts *bind.TransactOpts) (*types.Transaction, error) {\n\treturn _Proxy.Contract.contract.Transfer(opts)\n}", "title": "" }, { "docid": "cd7cb07046f0806ebcdd6d40deae2002", "score": "0.6904825", "text": "func (_Tellor *TellorTransactor) Transfer(opts *bind.TransactOpts, _to common.Address, _amount *big.Int) (*types.Transaction, error) {\n\treturn _Tellor.contract.Transact(opts, \"transfer\", _to, _amount)\n}", "title": "" }, { "docid": "531fb5e4684829ecb02f98f26cfdcf30", "score": "0.69029355", "text": "func (_RollupCreatorNoProxy *RollupCreatorNoProxyRaw) Transfer(opts *bind.TransactOpts) (*types.Transaction, error) {\n\treturn _RollupCreatorNoProxy.Contract.RollupCreatorNoProxyTransactor.contract.Transfer(opts)\n}", "title": "" }, { "docid": "d2cd7aa7387173de84cebc70a2e52e2b", "score": "0.6902491", "text": "func (_IEthCrossChainManager *IEthCrossChainManagerTransactorRaw) Transfer(opts *bind.TransactOpts) (*types.Transaction, error) {\n\treturn _IEthCrossChainManager.Contract.contract.Transfer(opts)\n}", "title": "" }, { "docid": "a3946cafa191c8a2a74614ac17187a89", "score": "0.68997395", "text": "func (_CoolContract *CoolContractRaw) Transfer(opts *bind.TransactOpts) (*types.Transaction, error) {\n\treturn _CoolContract.Contract.CoolContractTransactor.contract.Transfer(opts)\n}", "title": "" }, { "docid": "fe354dfd9034fcdae5e738c3e3d6415e", "score": "0.6898064", "text": "func (_Client *ClientTransactorRaw) Transfer(opts *bind.TransactOpts) (*types.Transaction, error) {\n\treturn _Client.Contract.contract.Transfer(opts)\n}", "title": "" }, { "docid": "e984cc1ec48aa9551a39e8e26ac2f549", "score": "0.6897838", "text": "func (_SocialMoney *SocialMoneyTransactorRaw) Transfer(opts *bind.TransactOpts) (*types.Transaction, error) {\n\treturn _SocialMoney.Contract.contract.Transfer(opts)\n}", "title": "" }, { "docid": "1bc39a5d0c9947bbc6ee53d6ce0b568a", "score": "0.6894546", "text": "func (_EIP20Contract *EIP20ContractTransactor) Transfer(opts *bind.TransactOpts, _to common.Address, _value *big.Int) (*types.Transaction, error) {\n\treturn _EIP20Contract.contract.Transact(opts, \"transfer\", _to, _value)\n}", "title": "" }, { "docid": "99c75a133c62d8e2cad16eb8d09eb42c", "score": "0.6891946", "text": "func (_Executor *ExecutorTransactorRaw) Transfer(opts *bind.TransactOpts) (*types.Transaction, error) {\n\treturn _Executor.Contract.contract.Transfer(opts)\n}", "title": "" }, { "docid": "630e6ec5b78576aca7100deb5f710af4", "score": "0.689191", "text": "func (_IServiceCoreEx *IServiceCoreExRaw) Transfer(opts *bind.TransactOpts) (*types.Transaction, *types.Receipt, error) {\n\treturn _IServiceCoreEx.Contract.IServiceCoreExTransactor.contract.Transfer(opts)\n}", "title": "" }, { "docid": "b2834b260bbb98e2229804ad57e00c9e", "score": "0.6891521", "text": "func (_MagicPowerDevsInterface *MagicPowerDevsInterfaceTransactorRaw) Transfer(opts *bind.TransactOpts) (*types.Transaction, error) {\n\treturn _MagicPowerDevsInterface.Contract.contract.Transfer(opts)\n}", "title": "" }, { "docid": "0fc7e81621c262b15943d06d536ccf04", "score": "0.68859744", "text": "func (_RollupTester *RollupTesterRaw) Transfer(opts *bind.TransactOpts) (*types.Transaction, error) {\n\treturn _RollupTester.Contract.RollupTesterTransactor.contract.Transfer(opts)\n}", "title": "" }, { "docid": "d60a530f588ffc574ddffa5165010803", "score": "0.68856555", "text": "func (_Bindings *BindingsTransactorRaw) Transfer(opts *bind.TransactOpts) (*types.Transaction, error) {\n\treturn _Bindings.Contract.contract.Transfer(opts)\n}", "title": "" }, { "docid": "63d2ac4eed3f3c6dd64344a40035ea39", "score": "0.6883618", "text": "func (_ERC20 *ERC20Transactor) Transfer(opts *bind.TransactOpts, recipient common.Address, amount *big.Int) (*types.Transaction, error) {\n\treturn _ERC20.contract.Transact(opts, \"transfer\", recipient, amount)\n}", "title": "" }, { "docid": "649af4fe1ccb13252e24373734fcf88f", "score": "0.68821055", "text": "func (_ContractsErc20 *ContractsErc20Transactor) Transfer(opts *bind.TransactOpts, _to common.Address, _value *big.Int) (*types.Transaction, error) {\n\treturn _ContractsErc20.contract.Transact(opts, \"transfer\", _to, _value)\n}", "title": "" }, { "docid": "83b8df6437aa235fdb534efe51178326", "score": "0.68816376", "text": "func (_BasicERC20 *BasicERC20Transactor) Transfer(opts *bind.TransactOpts, dst common.Address, wad *big.Int) (*types.Transaction, error) {\n\treturn _BasicERC20.contract.Transact(opts, \"transfer\", dst, wad)\n}", "title": "" }, { "docid": "3f78146921cf45f6b70562e189306760", "score": "0.68746185", "text": "func (_Contract *ContractTransactorRaw) Transfer(opts *bind.TransactOpts) (*types.Transaction, error) {\n\treturn _Contract.Contract.contract.Transfer(opts)\n}", "title": "" }, { "docid": "dd63d8ea53b922203845d3fbfe0bf9f1", "score": "0.6873573", "text": "func (_State *StateTransactorRaw) Transfer(opts *bind.TransactOpts) (*types.Transaction, error) {\n\treturn _State.Contract.contract.Transfer(opts)\n}", "title": "" }, { "docid": "8250ee5371c25e70b0d0ac111e464396", "score": "0.6873107", "text": "func (_Flipper *FlipperRaw) Transfer(opts *bind.TransactOpts) (*types.Transaction, error) {\n\treturn _Flipper.Contract.FlipperTransactor.contract.Transfer(opts)\n}", "title": "" }, { "docid": "c79ccf53fbc9ea2289e06e4bedaf5ba0", "score": "0.6872443", "text": "func (_Pancake *PancakeTransactorRaw) Transfer(opts *bind.TransactOpts) (*types.Transaction, error) {\n\treturn _Pancake.Contract.contract.Transfer(opts)\n}", "title": "" }, { "docid": "6190891dbe101dc8a4142c2b3ede115f", "score": "0.68674105", "text": "func (_RandomNumber *RandomNumberTransactorRaw) Transfer(opts *bind.TransactOpts) (*types.Transaction, error) {\n\treturn _RandomNumber.Contract.contract.Transfer(opts)\n}", "title": "" }, { "docid": "3b9400eadb8a26137d26e17d1b20ced0", "score": "0.6865857", "text": "func (_Masterchef *MasterchefTransactorRaw) Transfer(opts *bind.TransactOpts) (*types.Transaction, error) {\n\treturn _Masterchef.Contract.contract.Transfer(opts)\n}", "title": "" } ]
8dbfc5d272cf9954911608ff5b9db971
push a new item onto the stack.
[ { "docid": "9813d2d392829e0e533cfd30a4981879", "score": "0.80074626", "text": "func (s *stack) push(v string) {\n\ts.items = append(s.items, v)\n}", "title": "" } ]
[ { "docid": "5de3ed4b5f03595d902bad321a3b9cd9", "score": "0.8280631", "text": "func (s *Stack) Push(item interface{}) {\n\ts.l.Lock()\n\tdefer s.l.Unlock()\n\ts.s = append(s.s, item)\n}", "title": "" }, { "docid": "59c2ac1a3a8143ada61795b7acdbddc4", "score": "0.81824934", "text": "func (s *Stack) Push(item interface{}) {\n\ts.Prepend(item)\n}", "title": "" }, { "docid": "b774b2afe522dcc451bb2c4ae87c8bc8", "score": "0.7916859", "text": "func (s *Stack) Push(item interface{}) {\n\ts.list = append(s.list, item)\n}", "title": "" }, { "docid": "59ebcf5c200b442ba3ae3b02ef1d6c5e", "score": "0.79052705", "text": "func (s *stack) push(item int) {\n\t// LIFO\n\ts.nodes = append(\n\t\t[]*node{\n\t\t\t&node{\n\t\t\t\tval: item,\n\t\t\t},\n\t\t},\n\t\ts.nodes...,\n\t)\n}", "title": "" }, { "docid": "321bd761fb58ef83da2983e2741636f4", "score": "0.78063965", "text": "func (s *Stack) Push(data interface{}) {\n\tif s.IsFull() {\n\t\tpanic(errors.New(\"stack is full\"))\n\t}\n\n\tnewTop := &stackItem{\n\t\tdata: data,\n\t\tnext: s.top,\n\t}\n\n\ts.top = newTop\n\ts.size++\n}", "title": "" }, { "docid": "91db566ca5d4a363d9daa038857e4892", "score": "0.78026253", "text": "func (s *Stack) push(i int) {\n\ts.items = append(s.items, i)\n}", "title": "" }, { "docid": "4a0d8545c6937071b0108e30c9b1c472", "score": "0.77368456", "text": "func (s *Stack) Push(element interface{}) {\n\tvar si = stackItem{\n\t\tnext: s.top,\n\t\titem: &element,\n\t}\n\ts.top = &si\n\ts.size++\n}", "title": "" }, { "docid": "a2da4f23e45b0cd1e4956fc5903870f4", "score": "0.77209455", "text": "func (s *ItemStack) Push(t Item) {\n\ts.lock.Lock()\n\ts.items = append(s.items, t)\n\ts.lock.Unlock()\n}", "title": "" }, { "docid": "9450c6d34c135b01fd6dfc70066fbf46", "score": "0.7706087", "text": "func (s *Stack) Push(value interface{}) {\n\ts.list.PushBack(value)\n}", "title": "" }, { "docid": "4050204343f2977c350b92f11a87df84", "score": "0.76768875", "text": "func (s *Stack) Push(v int) {\n\t// initialize new item\n\t// and add it to top of stack\n\t(*s).top = &item{\n\t\tvalue: v,\n\t\tnext: (*s).top,\n\t}\n\n\t// increase size\n\t(*s).size++\n}", "title": "" }, { "docid": "2427ce91b1bcea1fb5cdf64de05c78ee", "score": "0.76151145", "text": "func (s *stack) Push(v interface{}) error {\n\tif s.top+1 >= s.cap {\n\t\treturn errors.New(\"stack is full\")\n\t}\n\n\ts.top++\n\ts.elements[s.top] = v\n\treturn nil\n}", "title": "" }, { "docid": "6436ee1b2504001e1f07b595a2edc86a", "score": "0.75995666", "text": "func (q *Queue) Push(item interface{}) {\n q.list.PushBack(item)\n}", "title": "" }, { "docid": "6a52c84f4d4453f1f714fe9ce408eba2", "score": "0.7571807", "text": "func (s *sstack) Push(data interface{}) {\n\tif s.size == s.capacity {\n\t\ts.active = make([]*item, blockSize)\n\t\ts.blocks = append(s.blocks, s.active)\n\t\ts.capacity += blockSize\n\t\ts.offset = 0\n\t} else if s.offset == blockSize {\n\t\ts.active = s.blocks[s.size/blockSize]\n\t\ts.offset = 0\n\t}\n\tif s.setIndex != nil {\n\t\ts.setIndex(data.(*item).value, s.size)\n\t}\n\ts.active[s.offset] = data.(*item)\n\ts.offset++\n\ts.size++\n}", "title": "" }, { "docid": "60b1b47f2e3ae8be1ef47816b9b9a7a7", "score": "0.7556586", "text": "func (q *Stack) Push(v interface{}) {\n\t_ = q.elements.PushBack(v)\n}", "title": "" }, { "docid": "fccf59e0bd213e60b4cfc843fb5abebf", "score": "0.75525165", "text": "func (s *FixedStack) Push(data interface{}) (Item, error) {\n\tif s.Full() {\n\t\treturn Item{}, errors.New(\"error: stack is full, can not push onto stack\")\n\t}\n\titem := Item{Data: data}\n\ts.Items[s.len] = item\n\ts.len++\n\treturn item, nil\n}", "title": "" }, { "docid": "70486e1497b207096c9b0484e47e081d", "score": "0.7507261", "text": "func (s *stack) push(item int) {\n\tnewNode := node{\n\t\tdata: item,\n\t\tnext: nil,\n\t}\n\tif s.head == nil {\n\t\ts.head = &newNode\n\t} else {\n\t\ttemp := s.head\n\t\tnewNode.next = temp\n\t\ts.head = &newNode\n\t}\n\tfmt.Printf(\"PUSHED: %d\\n\", newNode.data)\n\tprintStack(s)\n\treturn\n}", "title": "" }, { "docid": "6f81f2503fa12f304b662a8881e115d1", "score": "0.7461118", "text": "func (s *GrowableStack) Push(value interface{}) {\n\ts.top = &StackElement{value, s.top}\n\ts.size++\n}", "title": "" }, { "docid": "d05d1f331a2d90bf9441505108010709", "score": "0.74373853", "text": "func (s *Stack) Push(v interface{}) {\n\ts.mu.Lock()\n\tdefer s.mu.Unlock()\n\n\ts.v = append(s.v, v)\n\ts.count++\n}", "title": "" }, { "docid": "48bc9877464eeb1a231b08ada4d5004f", "score": "0.7420642", "text": "func (s *Stack) Push(item int) {\n\tif len(s.data) == 0 {\n\t\t// s.data = make([]int, 0, 10)\n\t\ts.data[0] = item\n\t} else {\n\t\tfor i := 1; i < len(s.data)-1; i++ {\n\t\t\ts.data[i+1] = s.data[i]\n\t\t}\n\t\ts.data[0] = item\n\t}\n}", "title": "" }, { "docid": "b3b0e7818132de6009eb316226bbe4dd", "score": "0.7418073", "text": "func (q Queue) Push(item interface{}) Queue {\n\tq.items = append(q.items, item)\n\treturn q\n}", "title": "" }, { "docid": "5814eabf463ebac8ac790b74df2fad8a", "score": "0.735333", "text": "func (s *parentStack) Push(node *treapNode) {\n\tif s.index < staticDepth {\n\t\ts.items[s.index] = node\n\t\ts.index++\n\t\treturn\n\t}\n\n\t// This approach is used over append because reslicing the slice to pop\n\t// the item causes the compiler to make unneeded allocations. Also,\n\t// since the max number of items is related to the tree depth which\n\t// requires expontentially more items to increase, only increase the cap\n\t// one item at a time. This is more intelligent than the generic append\n\t// expansion algorithm which often doubles the cap.\n\tindex := s.index - staticDepth\n\tif index+1 > cap(s.overflow) {\n\t\toverflow := make([]*treapNode, index+1)\n\t\tcopy(overflow, s.overflow)\n\t\ts.overflow = overflow\n\t}\n\ts.overflow[index] = node\n\ts.index++\n}", "title": "" }, { "docid": "7c01c4a46a433170788887ba4efb7408", "score": "0.73513925", "text": "func (s *Stack) Push(value interface{}) {\n\ts.top[s.len] = value\n\ts.len++\n}", "title": "" }, { "docid": "c94f4cb3930f1b1697d5d1400a4dae34", "score": "0.73454654", "text": "func (o *Stack) Push(item ...interface{}) *Stack {\n\tfor _, itm := range item {\n\t\to.stack.Append(itm)\n\t}\n\treturn o\n}", "title": "" }, { "docid": "3f2326c48e20eccccef50bcc1b231305", "score": "0.7330964", "text": "func (st *State) StackPush(v interface{}) {\n\tst.stack.Push(v)\n}", "title": "" }, { "docid": "898c2f64a7b67e495b3b34cc2b481d79", "score": "0.7328934", "text": "func (s *Stack) Push(element interface{}) {\n\t*s = append(*s, element) // Simply append the new value to the end of the stack\n}", "title": "" }, { "docid": "bba3c5d30b077caee1f9e0acc3243dfd", "score": "0.7321985", "text": "func (s *Stack) Push(value interface{}) {\n\ts.data = append(s.data, value)\n}", "title": "" }, { "docid": "03e42f1fe157021b7538dc86c33b347e", "score": "0.73112565", "text": "func (s *Stack) Push(v interface{}) {\n\ts.data = append(s.data, v)\n}", "title": "" }, { "docid": "68b2cc5ccbe2f1fc772b0d58cdb165d8", "score": "0.730621", "text": "func (s *ssStruct) Push(el Item) {\n\ts.l.Lock()\n\tdefer s.l.Unlock()\n\tif s.indx < len(s.stackR) {\n\t\ts.stackR[s.indx] = el\n\t\ts.indx++\n\t}\n}", "title": "" }, { "docid": "f4886e32dad6816407a7433d7e9ea4ab", "score": "0.73045534", "text": "func push(element int) {\n\ttop++\n\tstacks[top] = element\n}", "title": "" }, { "docid": "c798282a3c05258dbf88bed53aa275ae", "score": "0.7272319", "text": "func (s *Stack) Push(i interface{}) {\n\ts.el = append(s.el, i)\n\ts.top++\n}", "title": "" }, { "docid": "742c469ebb25099f230b1cd33921d84e", "score": "0.72550815", "text": "func (stack *PSStack) Push(obj PSObject) error {\n\tif len(*stack) > 100 {\n\t\treturn ErrStackOverflow\n\t}\n\n\t*stack = append(*stack, obj)\n\treturn nil\n}", "title": "" }, { "docid": "ddfebc5a0a765ca87ba678d782f1a1a0", "score": "0.7251787", "text": "func (v *VM) push(n int) {\n\tv.stack = append(v.stack, n)\n}", "title": "" }, { "docid": "46c1f8c7cf29b4c8977938895198eb47", "score": "0.7240967", "text": "func (s *LinkedStack) Push(e interface{}) {\n\t// New nodes are added when new items are pushed into the stack,\n\t// hence, the nodes are updated directly.\n\ts.topPtr = &node{\n\t\titem: e,\n\t\tnext: s.topPtr,\n\t}\n\t// increase the count of the items in the stack\n\ts.count++\n}", "title": "" }, { "docid": "8fbe004c734d5b86ea30fbb4b6470697", "score": "0.7237365", "text": "func (l *stack) Push(stockname string, stockshares int, stockprice int) {\n\told := &stock{stockname: stockname, stockshares: stockshares, stockprice: stockprice}\n\tif l.front == nil {\n\t\tl.front = old\n\t} else {\n\t\told.next = l.front\n\t\tl.front = old\n\t}\n\t//incriment count if struct added to stack\n\tl.count++\n}", "title": "" }, { "docid": "ae0f2770ba0de5e1e8a28a8e2fdf0ad2", "score": "0.7237047", "text": "func (s *Stack) Push(value interface{}) {\n\ts.top = &Element{value, s.top}\n\ts.length++\n}", "title": "" }, { "docid": "a7ac483ff5396c1293bd69fc48ae5fc3", "score": "0.72332454", "text": "func (i *TItems) Push(item interface{}) {\n\ti.Items = append(i.Items, item)\n}", "title": "" }, { "docid": "bfb86f49a27be506e99f53bf90e304ae", "score": "0.721839", "text": "func (s *Stack) Push(i interface{}) {\n\ts.p++\n\tif s.p < len(s.data) {\n\t\ts.data[s.p] = i\n\t\treturn\n\t}\n\n\ts.data = append(s.data, i)\n}", "title": "" }, { "docid": "877def13518bdba708bf40bd07c2e8fd", "score": "0.7217984", "text": "func (mq *MyQueue) Push(x int) {\n\tmq.ReadyIn()\n\tmq.stackIn = append(mq.stackIn, x)\n}", "title": "" }, { "docid": "fb9bc72e66464141735f3a802ee3483d", "score": "0.7209289", "text": "func (s *MyStack) Push(x int) {\n\ts.listA.PushBack(x)\n}", "title": "" }, { "docid": "6798c09df9a73464c3dcee3b04da7aad", "score": "0.7205118", "text": "func (s *chainMachine) Push(items ...[]byte) {\n\ts.items = append(s.items, items...)\n}", "title": "" }, { "docid": "922c8e7a251e9bbdb896395111415b3f", "score": "0.7199592", "text": "func (this *MyStack) Push(x int) {\n\tthis.q = append(this.q, x)\n}", "title": "" }, { "docid": "86c4eb918ccfcc85c199a36bfddf085d", "score": "0.7196732", "text": "func Push(s *Stack, elem VMWord) (err error) {\n\tif s.top == s.size {\n\t\treturn errors.New(\"overflow\")\n\t}\n\ts.items[s.top] = elem\n\ts.top = s.top + 1\n\treturn\n}", "title": "" }, { "docid": "9ffcc97b0ea79bf5693c39981cb03dbc", "score": "0.7193342", "text": "func (this *MyStack) Push(x int) {\n\tthis.enqueue = append(this.enqueue, x)\n\n}", "title": "" }, { "docid": "7a9d23e4d9f4a0252226da9ab556f1da", "score": "0.7183649", "text": "func (s *MyStack) Push(x int) {\n\ts.top = x\n\ts.Q.EnQueue(s.top)\n}", "title": "" }, { "docid": "c4c3cf97322c89e8720e34d9ef7e4781", "score": "0.7178859", "text": "func (s *Stack) Push(x interface{}) {\n\ts.data = append(s.data, x)\n}", "title": "" }, { "docid": "035983f80c2693479134b3565ad9119c", "score": "0.71776116", "text": "func (l *List) pushItem(item *Item) {\n\tif l.length == 0 {\n\t\tl.insertAssumingEmpty(item)\n\t} else {\n\t\tl.insertAfter(l.end, item)\n\t}\n}", "title": "" }, { "docid": "95ef72014175d489dbfd68712a6cf42c", "score": "0.71742564", "text": "func (s *Stack) Push(v interface{}) {\n\ts.Data = append(s.Data, v)\n}", "title": "" }, { "docid": "3eadd5dd565e82ecb5f300ebcb4d50ce", "score": "0.7173687", "text": "func (this *MyStack) Push(x int) {\n\tthis.queue = append(this.queue, x)\n}", "title": "" }, { "docid": "3eadd5dd565e82ecb5f300ebcb4d50ce", "score": "0.7173687", "text": "func (this *MyStack) Push(x int) {\n\tthis.queue = append(this.queue, x)\n}", "title": "" }, { "docid": "a7aceba5dfdd27433b1507927e7fbb9d", "score": "0.71656156", "text": "func (s *Stack) Push(d interface{}) {\r\n\tif len(s.data) > s.top+1 {\r\n\t\ts.top++\r\n\t\ts.data[s.top] = d\r\n\t\treturn\r\n\t}\r\n\r\n\ts.data = append(s.data, d)\r\n\ts.top++\r\n}", "title": "" }, { "docid": "a862d00e29eb4dc34a2bbfa577b4e07c", "score": "0.7162506", "text": "func (this *MyQueue) Push(x int) {\n\tthis.stack = append(this.stack, x)\n}", "title": "" }, { "docid": "a862d00e29eb4dc34a2bbfa577b4e07c", "score": "0.7162506", "text": "func (this *MyQueue) Push(x int) {\n\tthis.stack = append(this.stack, x)\n}", "title": "" }, { "docid": "6d3068477a2d300332dc8d87bc0defa9", "score": "0.71517426", "text": "func (s *Stack) Push(value interface{}) *Stack {\n\ts.values.PushBack(value)\n\treturn s\n}", "title": "" }, { "docid": "f7785629b61bed67d03c6039a9fbba61", "score": "0.7149596", "text": "func (q *Buffer) Push(item interface{}) {\n\tq.mu.Lock()\n\tq.data = append(q.data, item)\n\tq.shift()\n\tq.mu.Unlock()\n}", "title": "" }, { "docid": "ac8880e764b5137f761339d13cf459ec", "score": "0.7145304", "text": "func (stack *Stack) Push(v interface{}) {\n\tstack.slice = append(stack.slice, v)\n}", "title": "" }, { "docid": "9afefaa93eb25ac6e7454c9a7e348a01", "score": "0.7144636", "text": "func (s *Stack) Push(value interface{}) {\n\t*s = append(*s, value)\n\tfmt.Println(\"Stack :\", *s, &s)\n}", "title": "" }, { "docid": "295d4c5c4c9fa0b8944aed343596e977", "score": "0.7143829", "text": "func (queue *MyQueue) Push(x int) {\n\tqueue.pushStack = append(queue.pushStack, x)\n}", "title": "" }, { "docid": "f2e5f28360ef7214d829415c7e4805ad", "score": "0.7140881", "text": "func (s *Stack) Push(value interface{}) {\n\t// fmt.Printf(\"#>> inserting %#v\\n\",value)\n\ts.top = &Element{value, s.top}\n\ts.size++\n}", "title": "" }, { "docid": "be26318bcef79eed90d997183e9e8df8", "score": "0.712939", "text": "func (s *Stack) Push(val interface{}) {\r\n\t*s = append(*s, val) // Simply append the new value to the end of the stack\r\n\tlogger.Log.Println(\"Stack elements\", s)\r\n\r\n}", "title": "" }, { "docid": "292320e93e606b53fcdafe5a49a8acd3", "score": "0.71046704", "text": "func (s *stack) push(d string) {\n\ts.data = append(s.data, d)\n}", "title": "" }, { "docid": "e3df63632210001aa3a048c86ec704d2", "score": "0.7098627", "text": "func (sk *Stack) Push(x interface{}) {\n\tif len(sk.buf) == sk.size {\n\t\tsk.buf = append(sk.buf, x)\n\t} else {\n\t\tsk.buf[sk.size] = x\n\t}\n\tsk.size++\n}", "title": "" }, { "docid": "d1d8790ef7e9f3298a339b5c91ddd12d", "score": "0.70978975", "text": "func (this *MyStack) Push(x int) {\n\tthis.l1.PushBack(x)\n}", "title": "" }, { "docid": "3f02479a436713c8cef9df5505ad93dd", "score": "0.7097671", "text": "func (s *Stack) Push(value interface{}) {\n\ts.top = &node{s.top, value}\n\ts.length++\n}", "title": "" }, { "docid": "a94fe97a031eccda34a92cb9f54ed1c2", "score": "0.7095964", "text": "func (this *MyQueue) Push(x int) {\n\tthis.stackin = append(this.stackin, x)\n}", "title": "" }, { "docid": "7f3a4b325d03288f4244136f48030ecb", "score": "0.70896673", "text": "func (stack *Stack) Push(data interface{}) error {\n\tif stack.IsFull() {\n\t\treturn errors.New(\"stack overflow\")\n\t}\n\tstack.top++\n\tstack.stackArray[stack.top] = data\n\treturn nil\n}", "title": "" }, { "docid": "39607bb4371f432b5501ec26e95b2723", "score": "0.7084913", "text": "func (this *MyQueue) Push(x int) {\r\n\tthis.stack.Push(x)\r\n}", "title": "" }, { "docid": "6b81e9dfb5bec1232967921b0d318a98", "score": "0.7075489", "text": "func (this *MyStack) Push(x int) {\n\tthis.Queue = append(this.Queue, x)\n}", "title": "" }, { "docid": "92bdee92ae6dc99697ad419dc4f1711e", "score": "0.70689976", "text": "func (ds *DrawStack) Push(a Stackable) {\n\tds.toPush = append(ds.toPush, a)\n\n}", "title": "" }, { "docid": "6bf357b51d872f00e4449fce29c05ab7", "score": "0.7064978", "text": "func (this *MyQueue) Push(x int) {\n\tthis.pushStack = append(this.pushStack, x)\n}", "title": "" }, { "docid": "66057aeaaff3c8f1c8b12667162e178d", "score": "0.7064718", "text": "func (stack *Stack) Push(v interface{}) {\n\tnewTop := &node{v, stack.top}\n\tstack.top = newTop\n\tstack.length++\n}", "title": "" }, { "docid": "94c97753d0be3a2e6105d3125267ecd1", "score": "0.7054771", "text": "func (s *Stack) Push(value int) {\n\t*s = append(*s, value)\n}", "title": "" }, { "docid": "abd7a675548d1c2a6dea3df167b0e73f", "score": "0.7050954", "text": "func (this *MyQueue) Push(x int) {\n\tthis.stack=append(this.stack,x)\n}", "title": "" }, { "docid": "f3aa7cc477307e8121a8dce184c30a82", "score": "0.70470613", "text": "func (this *MyQueue) Push(x int) {\n\n\tthis.InStack.Push(x)\n}", "title": "" }, { "docid": "7e81c27c26f3cdf81df203bec2c81e41", "score": "0.7044879", "text": "func (stack *Stack) Push(val value.Value) {\n\t*stack = append(*stack, val)\n}", "title": "" }, { "docid": "2ba75e527d8840a46927b28a3e4cb879", "score": "0.7043359", "text": "func (s *Stack)Push(e int) error {\n\tif s.top + 1 >= len(s.data) {\n\t\treturn errors.New(\"stack is full\")\n\t}\n\n\ts.top++\n\ts.data[s.top] = e\n\treturn nil\n}", "title": "" }, { "docid": "d3886a922619efc5d9cd3fcdee0ed345", "score": "0.7037359", "text": "func (s *Stack) Push(a byte) {\n\ts.Data = append(s.Data[:s.Count], a)\n\ts.Count++\n}", "title": "" }, { "docid": "1b5ecc7bd0dbab76be6f327dc3da12a4", "score": "0.70279676", "text": "func (this *QueueWithStacks) Push(x int) {\n\tthis.in_stack.push(x)\n}", "title": "" }, { "docid": "7cb07b71ba5d577c757997a55e8125de", "score": "0.70267916", "text": "func (s *Stack) Push(x int) {\n\ts.data.PushBack(x)\n}", "title": "" }, { "docid": "8bea5ee25fc871f307eb3ecd23815e78", "score": "0.7019895", "text": "func (stk *stack) Push(val value) {\n\tif len(stk.frames) == 0 {\n\t\tluautil.Raise(\"No frames on the stack.\", luautil.ErrTypMajorInternal)\n\t}\n\n\tstk.data = append(stk.data, val)\n}", "title": "" }, { "docid": "18e266c32c4e238d3444255521061f3e", "score": "0.70115787", "text": "func (this *MyStack) Push(x int) {\n\tif len(this.data) == 0 || len(this.data) == this.position + 1{\n\t\tthis.data = append(this.data, x)\n\t} else {\n\t\tthis.data[this.position + 1] = x\n\t}\n\tthis.position ++\n}", "title": "" }, { "docid": "6d89344d5fe2f2caf4b4463d63881242", "score": "0.7009302", "text": "func (q *Queue) Push(v interface{}) {\n\tq.list.PushBack(v)\n}", "title": "" }, { "docid": "2ad7a3274eb1a2cb1228d03ddaf6d858", "score": "0.7008738", "text": "func (s *stack) Push(n int) {\n\ts.data = append(s.data, n)\n\ts.size++\n}", "title": "" }, { "docid": "f4a2ab406b3e23adc9e40ece14e80d0a", "score": "0.7003908", "text": "func (s *Stack) Push(t transaction.Interface) {\n\ts.mutex.Lock()\n\tdefer s.mutex.Unlock()\n\ts.push(t)\n}", "title": "" }, { "docid": "8ebdc2f65cc196c1cb5b77e241158da3", "score": "0.69964844", "text": "func (q *Stack) Push(l chatLine) {\n\t// assign item\n\tq.items[q.next] = l\n\n\t// increase size if still below max size\n\tif !q.full {\n\t\tq.size = q.size + 1\n\t}\n\n\tif q.full {\n\t\t// move read marker ahead\n\t\tif q.oldest < len(q.items)-1 {\n\t\t\tq.oldest = q.oldest + 1\n\t\t} else {\n\t\t\t// or back to start if end is reached\n\t\t\tq.oldest = 0\n\t\t}\n\t}\n\n\t// move write mark\n\tif q.next < len(q.items)-1 {\n\t\tq.next = q.next + 1\n\t} else {\n\t\t// back to start of buffer\n\t\tq.next = 0\n\t\tq.full = true\n\t}\n\n}", "title": "" }, { "docid": "b33e57fb5012dc97ead966f9f3ac0c7e", "score": "0.6983627", "text": "func (s *Stack) Push(n *Arbol) {\r\n s.nodes = append(s.nodes[:s.count], n)\r\n s.count++\r\n}", "title": "" }, { "docid": "5c919ae4b3bdeb9c57cadf70ddd6d494", "score": "0.6975263", "text": "func (this *MyStack) Push(x int) {\n\tn := len(this.q)\n\tthis.q = append(this.q, x)\n\tfor ; n > 0; n-- {\n\t\tthis.q = append(this.q, this.q[0])\n\t\tthis.q = this.q[1:]\n\t}\n}", "title": "" }, { "docid": "948d7c78a42c548a0070bf42e54b508c", "score": "0.6957263", "text": "func (s *tokenStack) push(token *token) {\n\ts.Stack = append(s.Stack, token)\n}", "title": "" }, { "docid": "c535724055b58aaa9149740f41596f4c", "score": "0.69473785", "text": "func (s *Stack) Push(e *Element) {\n\ts.Elements = append(\n\t\ts.Elements[:s.Count],\n\t\te,\n\t)\n\ts.Count = s.Count + 1\n}", "title": "" }, { "docid": "17e79abeac234d16adc9f12ee7b5ad7c", "score": "0.69174117", "text": "func (s *stackI) Push(f interface{}) {\n\t*s = append(*s, f) // Simply append the new value to the end of the stack\n}", "title": "" }, { "docid": "d3346e72509f3bbdc0de3e0d699d1659", "score": "0.6914058", "text": "func (this *MyQueue) Push(x int) {\n this.stack1 = append(this.stack1,x)\n}", "title": "" }, { "docid": "ae9ad7bae002d446cac66ba4757b3325", "score": "0.6909706", "text": "func (t *TransactionalStack) Push(value interface{}) interface{} {\n\tt.locker.Lock()\n\tdefer t.locker.Unlock()\n\n\tcurrentTransaction, ok := t.transactions.Peek().(transaction)\n\tif ok {\n\t\tcurrentTransaction.stack.Push(transactionItem{true, value})\n\t}\n\treturn t.stack.Push(value)\n}", "title": "" }, { "docid": "846da8c641b892d54d3450c40e40716c", "score": "0.68957174", "text": "func (s *scopeStack) push(sc scope) {\n\n\ts.stack = append(s.stack, sc)\n}", "title": "" }, { "docid": "6e3e57996846fc732d9802f348318b5a", "score": "0.6888214", "text": "func (q *Queue) Push(v interface{}) {\n\tq.c.PushBack(v)\n}", "title": "" }, { "docid": "21ffbf4516f63f49786d3b031055d676", "score": "0.6887194", "text": "func (i *Stack) Push(e Elem) {\n\ti.data = append(i.data, e)\n}", "title": "" }, { "docid": "af7be2d1cf6ed6b70fc40fa57bdc2eb7", "score": "0.68860054", "text": "func (s StackExpr) push(v interface{}) StackExpr {\n\treturn append(s, v)\n}", "title": "" }, { "docid": "e93b2cec977235d4183c1679661e53a8", "score": "0.6876519", "text": "func (s *stack) Push(r int) {\n\ts.values = append(s.values, r)\n\ts.size++\n}", "title": "" }, { "docid": "388ed8837d5b01afa7cdef43b7b7ac02", "score": "0.6873471", "text": "func (this *MyQueue) Push(x int) {\n this.Stack = append(this.Stack, x)\n}", "title": "" }, { "docid": "50d055dd0d7313a9f7e2ea8efb5f7720", "score": "0.6871679", "text": "func (this *MyQueue) Push(x int) {\n\tthis.Stack1.Push(x)\n}", "title": "" }, { "docid": "25ac41e8f402ced128c1cb25f756fb46", "score": "0.6871351", "text": "func (this *MyStack) Push(x int) {\n\tthis.queue1 = append(this.queue1,x)\n\n}", "title": "" }, { "docid": "32afd684dca079af23eccbfe6669d3e0", "score": "0.6867195", "text": "func (q *Queue) Push(item T) {\n\tif q.nodes == nil {\n\t\tq.nodes = make([]T, 2)\n\t} else {\n\t\tq.nodes = append(q.nodes, Tzero)\n\t}\n\ti := q.len + 1\n\tj := i / 2\n\tfor i > 1 && Tgt(q.nodes[j], item) {\n\t\tq.nodes[i] = q.nodes[j]\n\t\ti = j\n\t\tj = j / 2\n\t}\n\tq.nodes[i] = item\n\tq.len++\n}", "title": "" } ]
f75ced745717f817c7fe77987391e459
Client get the etcd client
[ { "docid": "89122f307dbc775d9c398ab32eb2832b", "score": "0.78166395", "text": "func (e *Etcd) Client() *clientv3.Client {\n\treturn e.client\n}", "title": "" } ]
[ { "docid": "3ae64f1b0561cc6cfb12605607ffb7de", "score": "0.77444506", "text": "func (c *etcdConfiguration) Client() (cli *Client) {\n\tcli = new(Client)\n\tvar err error\n\ttlsInfo := transport.TLSInfo{\n\t\tCertFile: c.Properties.Cert.CertFile,\n\t\tKeyFile: c.Properties.Cert.KeyFile,\n\t\tTrustedCAFile: c.Properties.Cert.TrustedCAFile,\n\t}\n\ttlsConfig, err := tlsInfo.ClientConfig()\n\tif err != nil {\n\t\tlog.Error(err)\n\t\treturn nil\n\t}\n\tcli.Client, err = clientv3.New(clientv3.Config{\n\t\tEndpoints: c.Properties.Endpoints,\n\t\tDialTimeout: time.Duration(c.Properties.DialTimeout) * time.Second,\n\t\tTLS: tlsConfig,\n\t})\n\tif err != nil {\n\t\tlog.Error(err)\n\t\treturn nil\n\t}\n\treturn\n}", "title": "" }, { "docid": "61087ed9bdc996576efe2af1f1fd453b", "score": "0.73579425", "text": "func GetEtcdClient(\n\tuseEmbedEtcd bool,\n\tuseSSL bool,\n\tendpoints []string,\n\tcertFile string,\n\tkeyFile string,\n\tcaCertFile string,\n\tminVersion string) (*clientv3.Client, error) {\n\tlog.Info(\"create etcd client\",\n\t\tzap.Bool(\"useEmbedEtcd\", useEmbedEtcd),\n\t\tzap.Bool(\"useSSL\", useSSL),\n\t\tzap.Any(\"endpoints\", endpoints),\n\t\tzap.String(\"minVersion\", minVersion))\n\tif useEmbedEtcd {\n\t\treturn GetEmbedEtcdClient()\n\t}\n\tif useSSL {\n\t\treturn GetRemoteEtcdSSLClient(endpoints, certFile, keyFile, caCertFile, minVersion)\n\t}\n\treturn GetRemoteEtcdClient(endpoints)\n}", "title": "" }, { "docid": "d4960a29022a2e02e1afd566b53a30cf", "score": "0.73223794", "text": "func (p *defaultProphet) GetEtcdClient() *clientv3.Client {\n\treturn p.opts.client\n}", "title": "" }, { "docid": "05447446588683a38fbbe076a4c42386", "score": "0.7185963", "text": "func (s *Specification) GetEtcdClient(tlsCfg *tls.Config) (*clientv3.Client, error) {\n\treturn clientv3.New(clientv3.Config{\n\t\tEndpoints: s.GetPDListWithManageHost(),\n\t\tTLS: tlsCfg,\n\t})\n}", "title": "" }, { "docid": "f0703bdbea7a852aec0997d30ea063e1", "score": "0.7185362", "text": "func (dc *DCOSContainers) getClient() (*httpcli.Client, error) {\n\tif dc.client == nil {\n\t\tclient, err := dcosutil.MesosClient(dc.MesosAgentUrl, dc.DCOSConfig)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tdc.client = client\n\t}\n\treturn dc.client, nil\n}", "title": "" }, { "docid": "ac0aef13b93620a1cfb562b0f9169793", "score": "0.71466005", "text": "func (topo *TopologySpecification) GetEtcdClient() (*clientv3.Client, error) {\n\treturn clientv3.New(clientv3.Config{\n\t\tEndpoints: topo.GetPDList(),\n\t})\n}", "title": "" }, { "docid": "9368b4adac070f078e66928e41b2efe6", "score": "0.7095027", "text": "func (p *PdEtcdProvider) GetEtcdClient() *clientv3.Client {\n\treturn p.srv.GetClient()\n}", "title": "" }, { "docid": "c8232d059c019bc4f540a1db1c41447d", "score": "0.7078079", "text": "func Client() kubecli.KubevirtClient {\n\tclient, err := kubecli.GetKubevirtClient()\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn client\n}", "title": "" }, { "docid": "77e05cef804117b8781c4253c2855a74", "score": "0.7004249", "text": "func (s *Store) GetClient() kv.Client { return s.Client }", "title": "" }, { "docid": "a4f8b77fc9f11a50f81b13ba0d9a1f6b", "score": "0.6922231", "text": "func NewClient(cfg Config) (Client, error) {\n\n\tetcdCfg := clientv3.Config{\n\t\tEndpoints: cfg.Endpoints,\n\t\tUsername: cfg.Username,\n\t\tPassword: cfg.Password,\n\t}\n\n\tcli, err := clientv3.New(etcdCfg)\n\n\treturn cli, err\n}", "title": "" }, { "docid": "dcf5f874024f0157a225932ca9611bb1", "score": "0.68740636", "text": "func (s *Specification) GetEtcdProxyClient(tlsCfg *tls.Config, tcpProxy *proxy.TCPProxy) (*clientv3.Client, chan struct{}, error) {\n\tcloseC := tcpProxy.Run(s.GetPDListWithManageHost())\n\tcli, err := clientv3.New(clientv3.Config{\n\t\tEndpoints: tcpProxy.GetEndpoints(),\n\t\tTLS: tlsCfg,\n\t})\n\treturn cli, closeC, err\n}", "title": "" }, { "docid": "1680e3e3d61b7a7a85ea2d94029bb1c9", "score": "0.68608934", "text": "func getClient() *http.Client {\n\ttimeout := 5 * time.Second\n\n\t// Setup transport settings\n\ttr := &http.Transport{\n\t\tTLSClientConfig: &tls.Config{InsecureSkipVerify: true},\n\t\tDisableCompression: true,\n\t\tDial: (&net.Dialer{\n\t\t\tTimeout: timeout,\n\t\t}).Dial,\n\t\tTLSHandshakeTimeout: timeout,\n\t}\n\n\t// Create a client\n\tclient := &http.Client{\n\t\tTimeout: timeout,\n\t\tTransport: tr,\n\t}\n\n\treturn client\n}", "title": "" }, { "docid": "334c335171e7de489122c14817675753", "score": "0.6852689", "text": "func GetClient() (*restapi.RestClient, error) {\n\tlogger.SetLevel(logger.LevelDebug)\n\tlogger.SetLogPath(\"centrifysdk.log\")\n\tlogger.EnableErrorStackTrace()\n\n\t// Initiate vault client\n\tvault := utils.VaultClient{}\n\tvault.AuthType = authenticationtype.OAuth2.String()\n\tvault.URL = \"http://<tenantid>.my.centrify.net\"\n\t//vault.AppID = \"CentrifyCLI\"\n\t//vault.Scope = \"all\"\n\t//vault.User = \"\"\n\t//vault.Password = \"\"\n\tvault.Token = \"\"\n\n\t// Authenticate and returns authenticated REST client\n\tclient, err := vault.GetClient()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn client, err\n}", "title": "" }, { "docid": "fc10e241eee44a698d797cffd5339d13", "score": "0.6847062", "text": "func Get() *Client {\n\treturn InitializeClient()\n}", "title": "" }, { "docid": "721cae4297a4e409cbd3218be75e5e9d", "score": "0.68268466", "text": "func (s *service) Client() Client {\n\treturn s.client\n}", "title": "" }, { "docid": "5cabd285334802c76bee9e378d9e47f0", "score": "0.68036854", "text": "func NewClient(isLocal bool) *clientv3.Client {\n\tendpoints := getEndpoints(isLocal)\n\tcli, err := clientv3.New(clientv3.Config{\n\t\t// Endpoints: []string{\"localhost:2379\", \"localhost:22379\", \"localhost:32379\"},\n\t\tEndpoints: endpoints,\n\t\tDialTimeout: 5 * time.Second,\n\t\tDialOptions: []grpc.DialOption{grpc.WithBlock()},\n\t\t// TODO: do we need these two lines?\n\t\t// DialKeepAliveTime: time.Second,\n\t\t// DialKeepAliveTimeout: 500 * time.Millisecond,\n\n\t\t// DialOptions: []grpc.DialOption{\n\t\t// grpc.WithUnaryInterceptor(grpcprom.UnaryClientInterceptor),\n\t\t// grpc.WithStreamInterceptor(grpcprom.StreamClientInterceptor),\n\t\t// },\n\t\t// MaxCallSendMsgSize =\n\t\t// MaxCallRecvMsgSize =\n\t})\n\tif err != nil {\n\t\t// handle error!\n\t\tlog.Fatalf(\"Failed to connect to etcd cluster of endpoints %v %v\", endpoints, err)\n\t}\n\treturn cli\n}", "title": "" }, { "docid": "47e4afed6c60bd759d7741821ab04b54", "score": "0.68004936", "text": "func getClient() kubernetes.Interface {\n\tconfig, err := rest.InClusterConfig()\n\tif err != nil {\n\t\tlogrus.Errorf(\"error with retrieving cluster config %v\", err)\n\t}\n\n\tclientset, err := kubernetes.NewForConfig(config)\n\tif err != nil {\n\t\tlogrus.Errorf(\"error with configuring kube client %v\", err)\n\t}\n\n\treturn clientset\n}", "title": "" }, { "docid": "36abcbe5d7e161ee199f4c4fe013ffd8", "score": "0.679966", "text": "func GetEtcdClient() *etcdClient.Client {\n\tif client, stored := eClient.Load().(*etcdClient.Client); stored {\n\t\treturn client\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "4597d48b80a6c3b5e05ee64c1bff64fa", "score": "0.6793741", "text": "func GetClient() InfoService {\n\tif config.CURRENT_ENV == config.DEVELOPMENT {\n\t\tswitch config.DISCOVERY_SERVICE {\n\t\tcase config.ETCD:\n\t\t\ts := EtcdClient{Host: config.ETCD_HOST_DEVELOPMENT}\n\t\t\treturn &s\n\t\tcase config.CONSUL:\n\t\t\tlog.Fatal(\"Consul not yet implemented\")\n\t\t\treturn nil\n\t\tcase config.ZOOKEEPER:\n\t\t\tlog.Fatal(\"Zookeeper not yet implemented\")\n\t\t\treturn nil\n\t\tdefault:\n\t\t\ts := EtcdClient{Host: config.ETCD_HOST_DEVELOPMENT}\n\t\t\treturn &s\n\t\t}\n\n\t} else if config.CURRENT_ENV == config.PRODUCTION {\n\t\tswitch config.DISCOVERY_SERVICE {\n\t\tcase config.ETCD:\n\t\t\ts := EtcdClient{Host: config.ETCD_HOST_PRODUCTION}\n\t\t\treturn &s\n\t\tcase config.CONSUL:\n\t\t\tlog.Fatal(\"Not yet implemented\")\n\t\t\treturn nil\n\t\tcase config.ZOOKEEPER:\n\t\t\tlog.Fatal(\"Not yet implemented\")\n\t\t\treturn nil\n\t\tdefault:\n\t\t\ts := EtcdClient{Host: config.ETCD_HOST_PRODUCTION}\n\t\t\treturn &s\n\t\t}\n\n\t} else {\n\t\treturn &MockDiscoveryOk{\"http://a_host\"}\n\t}\n}", "title": "" }, { "docid": "4fbcfbc238450a6ec151937ad73348dc", "score": "0.679049", "text": "func getClient() (*cloudiot.Service, error) {\n\t// Authorize the client using Application Default Credentials.\n\t// See https://g.co/dv/identity/protocols/application-default-credentials\n\tctx := context.Background()\n\thttpClient, err := google.DefaultClient(ctx, cloudiot.CloudPlatformScope)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tclient, err := cloudiot.New(httpClient)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn client, nil\n}", "title": "" }, { "docid": "663cdbb97b436c9dac75139c66384a9f", "score": "0.67860377", "text": "func (c *Cmd) Client() (*vaultapi.Client, error) {\n\tconfig := vaultapi.DefaultConfig()\n\tconfig.ReadEnvironment()\n\tconfigFile := c.GetConfig()\n\n\tvsl := c.vault\n\tvsl.tlsConfig = new(tls.Config)\n\n\t// hierarchy to check for the vault address:\n\t// file, environment variable, flag\n\tconfig.Address = configFile.vaultAddr\n\tif os.Getenv(\"VAULT_ADDR\") != \"\" {\n\t\tfmt.Println(\"Found VAULT_ADDR variable, using it\")\n\t\tconfig.Address = os.Getenv(\"VAULT_ADDR\")\n\t}\n\tif vsl.address != \"\" {\n\t\tconfig.Address = c.vault.address\n\t}\n\n\t// save final value so I can use it for infoResult method\n\tc.vault.address = config.Address\n\n\tclient, err := vaultapi.NewClient(config)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tclientToken := configFile.vaultToken\n\tif os.Getenv(\"VAULT_TOKEN\") != \"\" {\n\t\tfmt.Println(\"Found VAULT_TOKEN variable, using it\")\n\t\tclientToken = os.Getenv(\"VAULT_TOKEN\")\n\t}\n\tif vsl.token != \"\" {\n\t\tclientToken = vsl.token\n\t}\n\tclient.SetToken(clientToken)\n\n\tif configFile.vaultCaCert != \"\" {\n\t\tvaultapi.LoadCACert(configFile.vaultCaCert)\n\t}\n\n\treturn client, nil\n}", "title": "" }, { "docid": "b656d4930856e06ee6ef2a1364589aec", "score": "0.6766393", "text": "func (c *Context) Client() (client kubernetes.Interface) {\n\treturn c.Cluster.Client\n}", "title": "" }, { "docid": "53efddb8d0364315a60cde54b2c3484a", "score": "0.6757213", "text": "func Client(k Keys) *http.Client {\n\treturn DefaultService.Client(k)\n}", "title": "" }, { "docid": "ca2967946170e108547a735b7032a508", "score": "0.67204005", "text": "func getClient() (*kubernetes.Clientset, error) {\n\tconfig, err := clientcmd.BuildConfigFromFlags(\"\", filepath.Join(os.Getenv(\"HOME\"), \".kube\", \"config\"))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn kubernetes.NewForConfig(config)\n}", "title": "" }, { "docid": "dda0e01c0c1bd85dc31dbd979dccf352", "score": "0.6680779", "text": "func Client() (*kubernetes.Clientset, error) {\n\tif config.Kubernetes.External {\n\t\treturn externalClient()\n\t}\n\n\treturn internalClient()\n}", "title": "" }, { "docid": "d975d4ff57adda12fd24f51458ab59e4", "score": "0.6657696", "text": "func getClient() *http.Client {\n\ttr := &http.Transport{\n\t\tTLSClientConfig: &tls.Config{InsecureSkipVerify: true},\n\t\tDisableCompression: true,\n\t\tDisableKeepAlives: true,\n\t}\n\tclient := &http.Client{\n\t\tTransport: tr,\n\t\tTimeout: 30 * time.Second,\n\t}\n\treturn client\n}", "title": "" }, { "docid": "f7750d147d385016843bde611e9db83a", "score": "0.66520023", "text": "func Client() (c *kubernetes.Clientset, err error) {\n\tif commons.GetKubernetesMode() == \"\" {\n\t\tconfig, err := rest.InClusterConfig()\n\t\tif err != nil {\n\t\t\treturn c, err\n\t\t}\n\t\tclientset, err := kubernetes.NewForConfig(config)\n\t\tif err != nil {\n\t\t\treturn c, err\n\t\t}\n\t\treturn clientset, nil\n\t}\n\n\tvar kconfig string\n\tif commons.GetKubernetesKubeConfig() != \"\" {\n\t\tkconfig = commons.GetKubernetesKubeConfig()\n\t} else {\n\t\tif home := homedir.HomeDir(); home != \"\" {\n\t\t\tkconfig = filepath.Join(home, \".kube\", \"config\")\n\t\t}\n\t}\n\n\tkubeconfig := &kconfig\n\tconfig, err := clientcmd.BuildConfigFromFlags(\"\", *kubeconfig)\n\tif err != nil {\n\t\treturn c, err\n\t}\n\n\tclientset, err := kubernetes.NewForConfig(config)\n\tif err != nil {\n\t\treturn c, err\n\t}\n\treturn clientset, nil\n}", "title": "" }, { "docid": "db56c2e52684bd25761d498363103b73", "score": "0.6627377", "text": "func (c *MPDClient) getClient() (*mpd.Client, error) {\n\tclient, err := mpd.Dial(\"tcp\", c.toString())\n\tif err != nil {\n\t\treturn nil, &tbError{Msg: \"Couldn't connect to \" + c.toString(), Err: err}\n\t}\n\n\treturn client, nil\n}", "title": "" }, { "docid": "2b798eeb2be894efc0ab49bd2a2356b0", "score": "0.66195023", "text": "func GetClient() (*kubernetes.Clientset, error) {\n config, err := rest.InClusterConfig()\n if err != nil {\n return nil, err\n }\n\n return kubernetes.NewForConfig(config)\n}", "title": "" }, { "docid": "0dffeae4ebc00de5e51af50558533f1a", "score": "0.65944076", "text": "func getClient(clientConfig clientcmd.ClientConfig, matchServerVersion bool) (*client.Client, error) {\n\tconfig, err := clientConfig.ClientConfig()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tif matchServerVersion {\n\t\terr := client.MatchesServerVersion(config)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\n\tclient, err := client.New(config)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn client, nil\n}", "title": "" }, { "docid": "fd837f65478d224f2ff36ff6aa86985f", "score": "0.65930223", "text": "func getClient(cf *config) *http.Client {\n\tif cf.client != nil {\n\t\treturn cf.client\n\t}\n\ttr := &http.Transport{\n\t\tDialContext: (&net.Dialer{\n\t\t\tTimeout: cf.timeout, //must less then config.timeout\n\t\t\tKeepAlive: cf.keepalive, //zero, keep-alives are enabled\n\t\t\tDualStack: true,\n\t\t}).DialContext,\n\t\tTLSClientConfig: cf.credential,\n\t\tTLSHandshakeTimeout: cf.tlsHandsHakeTimeout,\n\t\tMaxConnsPerHost: cf.maxConnsPerHost,\n\t\tMaxIdleConnsPerHost: cf.maxIdleConnsPerHost,\n\t}\n\tif cf.dialer != nil {\n\t\ttr.DialContext = cf.dialer\n\t}\n\tif len(cf.proxy) > 0 {\n\t\tif u, err := url.Parse(cf.proxy); err == nil {\n\t\t\ttr.Proxy = http.ProxyURL(u)\n\t\t}\n\t}\n\tclient := &http.Client{\n\t\tTransport: tr,\n\t\tTimeout: cf.timeout,\n\t}\n\tif cf.transport != nil {\n\t\tclient.Transport = cf.transport\n\t}\n\treturn client\n}", "title": "" }, { "docid": "f7fb6816e8db2ad493cdadd67683f992", "score": "0.6591733", "text": "func GetClient() *Client {\n\tif persistentClient == nil {\n\t\tpersistentClient = NewDefaultClient()\n\t}\n\treturn persistentClient\n}", "title": "" }, { "docid": "bf567f4be741622751bedbd180d04165", "score": "0.6580667", "text": "func initClient() error {\n\tvar err error\n\tonce.Do(func() {\n\t\tcfg := client.Config{\n\t\t\tEndpoints: []string{etcdEndpoint},\n\t\t\tTransport: client.DefaultTransport,\n\t\t\t// set timeout per request to fail fast when the target endpoint is unavailable\n\t\t\tHeaderTimeoutPerRequest: time.Second,\n\t\t}\n\t\tetcdClient, err = client.New(cfg)\n\t\tif err != nil {\n\t\t\tlogger.Errorf(\"Can't create new client, err: %s\", err.Error())\n\t\t\treturn\n\t\t}\n\t\tkapi = client.NewKeysAPI(etcdClient)\n\t})\n\treturn err\n}", "title": "" }, { "docid": "d1eecc5eed55ed5a2b58525faf67c451", "score": "0.6566079", "text": "func (m *Meta) Client() (*api.Client, error) {\n\tconfig := api.DefaultConfig()\n\n\terr := config.ReadEnvironment()\n\tif err != nil {\n\t\treturn nil, errwrap.Wrapf(\"error reading environment: {{err}}\", err)\n\t}\n\n\tif m.flagAddress != \"\" {\n\t\tconfig.Address = m.flagAddress\n\t}\n\tif m.ForceAddress != \"\" {\n\t\tconfig.Address = m.ForceAddress\n\t}\n\t// If we need custom TLS configuration, then set it\n\tif m.flagCACert != \"\" || m.flagCAPath != \"\" || m.flagClientCert != \"\" || m.flagClientKey != \"\" || m.flagInsecure {\n\t\tt := &api.TLSConfig{\n\t\t\tCACert: m.flagCACert,\n\t\t\tCAPath: m.flagCAPath,\n\t\t\tClientCert: m.flagClientCert,\n\t\t\tClientKey: m.flagClientKey,\n\t\t\tTLSServerName: \"\",\n\t\t\tInsecure: m.flagInsecure,\n\t\t}\n\t\tconfig.ConfigureTLS(t)\n\t}\n\n\t// Build the client\n\tclient, err := api.NewClient(config)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tclient.SetWrappingLookupFunc(m.DefaultWrappingLookupFunc)\n\n\t// If we have a token directly, then set that\n\ttoken := m.ClientToken\n\n\t// Try to set the token to what is already stored\n\tif token == \"\" {\n\t\ttoken = client.Token()\n\t}\n\n\t// If we don't have a token, check the token helper\n\tif token == \"\" {\n\t\tif m.TokenHelper != nil {\n\t\t\t// If we have a token, then set that\n\t\t\ttokenHelper, err := m.TokenHelper()\n\t\t\tif err != nil {\n\t\t\t\treturn nil, err\n\t\t\t}\n\t\t\ttoken, err = tokenHelper.Get()\n\t\t\tif err != nil {\n\t\t\t\treturn nil, err\n\t\t\t}\n\t\t}\n\t}\n\n\t// Set the token\n\tif token != \"\" {\n\t\tclient.SetToken(token)\n\t}\n\n\treturn client, nil\n}", "title": "" }, { "docid": "36185cce2c107fd0e1d98e9e03753364", "score": "0.65486103", "text": "func getClient(service string) (protos.ServiceHealthClient, error) {\n\tconn, err := registry.GetConnection(service)\n\tif err != nil {\n\t\tinitErr := merrors.NewInitError(err, service)\n\t\tglog.Error(initErr)\n\t\treturn nil, initErr\n\t}\n\treturn protos.NewServiceHealthClient(conn), nil\n}", "title": "" }, { "docid": "a042c1a1ad452362631877275e357a3f", "score": "0.6537867", "text": "func NewClient(conf *EtcdConf) (*EtcdClient, error) {\n\tconfig := clientv3.Config{\n\t\tEndpoints: conf.Endpoints,\n\t\tDialTimeout: conf.DialTimeout,\n\t}\n\tclient, err := clientv3.New(config)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn &EtcdClient{Client: client}, nil\n}", "title": "" }, { "docid": "e0b675720b7d7af1acb4131dea4f15d1", "score": "0.65315986", "text": "func getClient(ctx context.Context, config *oauth2.Config) (*http.Client, error) {\n\ttok, err := loadToken()\n\tif err != nil {\n\t\ttok, err = getTokenFromWeb(config)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\terr = saveToken(tok)\n\t}\n\n\treturn config.Client(ctx, tok), err\n}", "title": "" }, { "docid": "28ea02a89cadf24af0ad3d88e217f0f0", "score": "0.65291554", "text": "func Client(ctx context.Context) *http.Client {\n\treturn &http.Client{\n\t\tTransport: &Transport{\n\t\t\tContext: ctx,\n\t\t},\n\t}\n}", "title": "" }, { "docid": "7a460a66597dea06d196d99ac6a584e6", "score": "0.65096414", "text": "func Client(configpath string) (*kubernetes.Clientset, error) {\n\n\tif configpath == \"\" {\n\t\tlogrus.Info(\"Using Incluster configuration\")\n\t\tconfig, err := rest.InClusterConfig()\n\t\tif err != nil {\n\t\t\tlogrus.Fatalf(\"Error occured while reading incluster kubeconfig:%v\", err)\n\t\t\treturn nil, err\n\t\t}\n\t\treturn kubernetes.NewForConfig(config)\n\t}\n\n\tlogrus.Infof(\"Using configuration file:%s\", configpath)\n\tconfig, err := clientcmd.BuildConfigFromFlags(\"\", configpath)\n\tif err != nil {\n\t\tlogrus.Fatalf(\"Error occured while reading kubeconfig:%v\", err)\n\t\treturn nil, err\n\t}\n\treturn kubernetes.NewForConfig(config)\n}", "title": "" }, { "docid": "652a04513d34c62988b988c23ee3c593", "score": "0.6505334", "text": "func New(cfg Config, codec codec.Codec, logger log.Logger) (*Client, error) {\n\ttlsConfig, err := cfg.GetTLS()\n\tif err != nil {\n\t\treturn nil, errors.Wrapf(err, \"unable to initialise TLS configuration for etcd\")\n\t}\n\tcli, err := clientv3.New(clientv3.Config{\n\t\tEndpoints: cfg.Endpoints,\n\t\tDialTimeout: cfg.DialTimeout,\n\t\t// Configure the keepalive to make sure that the client reconnects\n\t\t// to the etcd service endpoint(s) in case the current connection is\n\t\t// dead (ie. the node where etcd is running is dead or a network\n\t\t// partition occurs).\n\t\t//\n\t\t// The settings:\n\t\t// - DialKeepAliveTime: time before the client pings the server to\n\t\t// see if transport is alive (10s hardcoded)\n\t\t// - DialKeepAliveTimeout: time the client waits for a response for\n\t\t// the keep-alive probe (set to 2x dial timeout, in order to avoid\n\t\t// exposing another config option which is likely to be a factor of\n\t\t// the dial timeout anyway)\n\t\t// - PermitWithoutStream: whether the client should send keepalive pings\n\t\t// to server without any active streams (enabled)\n\t\tDialKeepAliveTime: 10 * time.Second,\n\t\tDialKeepAliveTimeout: 2 * cfg.DialTimeout,\n\t\tPermitWithoutStream: true,\n\t\tTLS: tlsConfig,\n\t\tUsername: cfg.UserName,\n\t\tPassword: cfg.Password,\n\t})\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn &Client{\n\t\tcfg: cfg,\n\t\tcodec: codec,\n\t\tcli: cli,\n\t\tlogger: logger,\n\t}, nil\n}", "title": "" }, { "docid": "7671b107e5bf8dec0822b0eb48fd181e", "score": "0.6498182", "text": "func GetClient(ctx context.Context) *redis.Client {\n\treturn ctx.Value(keyClient).(*redis.Client)\n}", "title": "" }, { "docid": "b26359b38c6e0ec8a12ace5f2178efbb", "score": "0.6476771", "text": "func GetClient() *http.Client {\n\treturn &http.Client{Transport: &http.Transport{\n\t\tTLSClientConfig: &tls.Config{InsecureSkipVerify: true},\n\t}}\n}", "title": "" }, { "docid": "187cb6995ab25fced45b0a126de920d2", "score": "0.6467149", "text": "func (t *CookieAuthTransport) Client() *http.Client {\n\treturn &http.Client{Transport: t}\n}", "title": "" }, { "docid": "c9bde2c4b696277966c2bdf633bc421d", "score": "0.64597976", "text": "func GetClient(version string) (*client.Client, error) {\n\treturn client.NewClientWithOpts(client.WithVersion(version))\n}", "title": "" }, { "docid": "c9bde2c4b696277966c2bdf633bc421d", "score": "0.64597976", "text": "func GetClient(version string) (*client.Client, error) {\n\treturn client.NewClientWithOpts(client.WithVersion(version))\n}", "title": "" }, { "docid": "c9bde2c4b696277966c2bdf633bc421d", "score": "0.64597976", "text": "func GetClient(version string) (*client.Client, error) {\n\treturn client.NewClientWithOpts(client.WithVersion(version))\n}", "title": "" }, { "docid": "a042bc4c6cbbbf5d183cf1bb1f848928", "score": "0.64560324", "text": "func GetClient(cfg setting.Config) mqtt.Client {\n\turi := getUri(cfg)\n\n\treturn connect(cfg, uri)\n}", "title": "" }, { "docid": "fc9f049b3bfd387b97aa640fa39c59af", "score": "0.64497685", "text": "func GetClient(sdkConfig *cells_sdk.SdkConfig) *http.Client {\n\treturn &http.Client{Transport: transport.New(\n\t\ttransport.WithSkipVerify(sdkConfig.SkipVerify),\n\t\ttransport.WithCustomHeaders(sdkConfig.CustomHeaders),\n\t)}\n}", "title": "" }, { "docid": "db475019c2a33d1fa59671c3fefa3a10", "score": "0.6444643", "text": "func (t *TokenAuthTransport) Client() *http.Client {\n\treturn &http.Client{Transport: t}\n}", "title": "" }, { "docid": "e5f70c0fa993772f12e8bdbeb82d7780", "score": "0.6439355", "text": "func (m *Client) Client() interface{} {\n\treturn m.client\n}", "title": "" }, { "docid": "08db37b5189fc417cbeae7b0322be3f5", "score": "0.6437428", "text": "func getClient(context string) *kubernetes.Clientset {\n\thome := os.Getenv(\"HOME\")\n\tkubeconfig := filepath.Join(home, \".kube\", \"config\")\n\n\tconfig, _ := clientcmd.NewNonInteractiveDeferredLoadingClientConfig(\n\t\t&clientcmd.ClientConfigLoadingRules{ExplicitPath: kubeconfig},\n\t\t&clientcmd.ConfigOverrides{\n\t\t\tCurrentContext: context,\n\t\t}).ClientConfig()\n\tclientset, _ := kubernetes.NewForConfig(config)\n\treturn clientset\n}", "title": "" }, { "docid": "42bc33cd07bf3078502322eacf2a6e30", "score": "0.6435213", "text": "func getClient(kubeconfig string) (*kubernetes.Clientset, error) {\n\tconfig, err := clientcmd.BuildConfigFromFlags(\"\", kubeconfig)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"failed to create config. Reason: %v.\",err)\n\t}\n\tclientset, err := kubernetes.NewForConfig(config)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"failed to create clientset. Reason: %v.\",err)\n\t}\n\treturn clientset,nil\n}", "title": "" }, { "docid": "11d4712c8c0cc68c3910a77f24167ad0", "score": "0.6430923", "text": "func Client(ctx context.Context) (types.Client, bool) {\n\tv, ok := ctx.Value(ClientKey).(types.Client)\n\treturn v, ok\n}", "title": "" }, { "docid": "b426bb522175453fb33ff8e35da6af82", "score": "0.6428338", "text": "func (b *blbCli) getClient(c *cli.Context) *blb.Client {\n\tcluster := b.getCluster(c)\n\t// If there's already a client object and it's connecting to the same blb\n\t// cluster, return it directly.\n\tif b.clt != nil && b.cltCacheKey == cluster {\n\t\t// Reuse the old client if new client will connect to the same a set of\n\t\t// masters.\n\t\treturn b.clt\n\t}\n\toptions := blb.Options{\n\t\tCluster: cluster,\n\t\tDisableRetry: false,\n\t\tRetryTimeout: 30 * time.Second,\n\t\tDisableCache: false,\n\t\tReconstructBehavior: blb.ReconstructBehavior{Enabled: c.GlobalBoolT(\"reconstruct\")},\n\t}\n\tb.clt = blb.NewClient(options)\n\tb.cltCacheKey = cluster\n\treturn b.clt\n}", "title": "" }, { "docid": "e011ba59ebcf88eb142336b284e197e8", "score": "0.64264184", "text": "func (fs *FileSystem) Client() (Client, error) {\n\tif fs.client == nil {\n\t\tclient, err := NewClient(fs.options)\n\t\tfs.client = client\n\t\treturn fs.client, err\n\t}\n\treturn fs.client, nil\n}", "title": "" }, { "docid": "7a71667317b89c39259d28621d975592", "score": "0.64200497", "text": "func (cfg *Config) Client() (*Client, error) {\n\treturn ClientFromConfig(cfg)\n}", "title": "" }, { "docid": "0c66c86f1eb964f5f0c6671b89448952", "score": "0.64166933", "text": "func ClientGet(kapi client.KeysAPI, url string) *client.Response {\n\tresp, err := kapi.Get(context.Background(), url, &clientGetOpts)\n\tif err != nil {\n\t\tlogr.LogLine(logr.Lfatal, ltagsrc, err.Error())\n os.Exit(2)\n\t}\n\treturn resp\n}", "title": "" }, { "docid": "6661dee2fb729e0767c83830e9df04d9", "score": "0.63969547", "text": "func Client() *redis.Client {\n\treturn client\n}", "title": "" }, { "docid": "97f1423cc76a48c476e89bb8a9ebd39a", "score": "0.6395685", "text": "func (o *KubernetesClientOptions) Client(t Type) (ClientInterface, error) {\n\tif o.inMemory {\n\t\treturn newDummyClient(t), nil\n\t}\n\treturn o.newCRDClient(t)\n}", "title": "" }, { "docid": "a5fc7f0a73ac9b24023d7b727e81cbe1", "score": "0.6388959", "text": "func (c Config) Client() (*client.Client, error) {\n\tcli := client.New()\n\tcli.SetOption(client.Option{\n\t\tDebug: c.Debug,\n\t\tTimeout: c.Timeout,\n\t})\n\tcli.SetAuthData(c.getAuthData())\n\treturn cli, nil\n}", "title": "" }, { "docid": "8fe28dea2d3c76a41f39050a99e4203a", "score": "0.6375855", "text": "func (a *Args) GetClient() (client.Client, error) {\n\tif a.Config == nil {\n\t\tif err := a.SetConfig(); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\tif a.Client != nil {\n\t\treturn a.Client, nil\n\t}\n\tnewClient, err := client.New(a.Config, client.Options{Scheme: a.Schema})\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\ta.Client = newClient\n\treturn a.Client, nil\n}", "title": "" }, { "docid": "8359294c8f92b92879491856799146d1", "score": "0.6366683", "text": "func getClient(output string) (tpc *client.ThirdPartyClient, err error) {\n\tts := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {\n\t\tfmt.Fprintln(w, output)\n\t}))\n\ttpc, err = client.NewThirdParty(k8sApiUnv.GroupVersion{\n\t\tGroup: api.Group,\n\t\tVersion: api.Version,\n\t}, k8sRestCl.Config{\n\t\tHost: ts.URL,\n\t})\n\treturn\n}", "title": "" }, { "docid": "085c7ca3a1b4539004d0e567ce38441e", "score": "0.6365879", "text": "func getClient() *http.Client {\n\tcookieJar, err := cookiejar.New(&cookiejar.Options{\n\t})\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\tclient := &http.Client{\n\t\tTransport: &http.Transport{\n\t\t\tProxy: http.ProxyFromEnvironment,\n\t\t\tDialContext: (&net.Dialer{\n\t\t\t\tTimeout: 1 * time.Second,\n\t\t\t\tKeepAlive: 90 * time.Second,\n\t\t\t}).DialContext,\n\t\t\tMaxConnsPerHost: MaxConnsPerHost,\n\t\t\tMaxIdleConns: MaxIdleConns,\n\t\t\tMaxIdleConnsPerHost: MaxIdleConnsPerHost,\n\t\t},\n\t\tJar: cookieJar,\n\t}\n\treturn client\n}", "title": "" }, { "docid": "9823f04218e80f61328cd0a3a4b48001", "score": "0.6351143", "text": "func (c Config) Client() (*client.Client, error) {\n\tcli := client.New()\n\tcli.SetOption(client.Option{\n\t\tDebug: c.Debug,\n\t\tTimeout: c.Timeout,\n\t})\n\tcli.SetAPIKey(c.getAPIKey())\n\treturn cli, nil\n}", "title": "" }, { "docid": "5b7c3aa94cb86bcfceb0ae8db7032940", "score": "0.6345701", "text": "func getClient(ctx context.Context, config *oauth2.Config) *http.Client {\n\tcacheFile, err := tokenCacheFile()\n\tif err != nil {\n\t\tlog.Fatalf(\"Unable to get path to cached credential file. %v\", err)\n\t}\n\ttok, err := tokenFromFile(cacheFile)\n\tif err != nil {\n\t\ttok = getTokenFromWeb(config)\n\t\tsaveToken(cacheFile, tok)\n\t}\n\treturn config.Client(ctx, tok)\n}", "title": "" }, { "docid": "5b7c3aa94cb86bcfceb0ae8db7032940", "score": "0.6345701", "text": "func getClient(ctx context.Context, config *oauth2.Config) *http.Client {\n\tcacheFile, err := tokenCacheFile()\n\tif err != nil {\n\t\tlog.Fatalf(\"Unable to get path to cached credential file. %v\", err)\n\t}\n\ttok, err := tokenFromFile(cacheFile)\n\tif err != nil {\n\t\ttok = getTokenFromWeb(config)\n\t\tsaveToken(cacheFile, tok)\n\t}\n\treturn config.Client(ctx, tok)\n}", "title": "" }, { "docid": "290f370b078ecfbbd4ab3b17ce0961c9", "score": "0.63367283", "text": "func (m *Manager) Client() remote.Client {\n\treturn m.client\n}", "title": "" }, { "docid": "486af7a078d824a1576f2bbc73e13f86", "score": "0.63363016", "text": "func (k *Keybaser) Client() KeybaseChatAPIClient {\n\treturn k.client\n}", "title": "" }, { "docid": "5dcb2d62bce10bdb5e9d616a5bef156f", "score": "0.63295615", "text": "func (cli *Client) Client() *redis.Client {\n\treturn cli.client\n}", "title": "" }, { "docid": "457aa9e4b1b518a8ea7b6e2cae89a18c", "score": "0.63238776", "text": "func (db *DB) GetClient() (client.Client, error) {\n\tc, err := client.NewHTTPClient(client.HTTPConfig{\n\t\tAddr: db.Address,\n\t})\n\tif err != nil {\n\t\tlog.Fatalln(\"Error on creating Influx DB client: \", err)\n\t\treturn nil, err\n\t}\n\treturn c, nil\n}", "title": "" }, { "docid": "fd5c87996cd37f1f789e84834809dde4", "score": "0.63225144", "text": "func GetClient(cfg *Config) *Client {\n\tif cfg.Logger != nil {\n\t\tLog = cfg.Logger\n\t}\n\ttoken := getToken(cfg.Credentials, cfg.OAuthEndpoint)\n\tid := randHex(4)\n\treturn &Client{cfg.Credentials, token, id, cfg.APIRoot}\n}", "title": "" }, { "docid": "fb612e616202b3508aa123595dd4ac32", "score": "0.63136506", "text": "func client(timeout time.Duration) *http.Client {\n\ttransCfg := &http.Transport{\n\t\tTLSClientConfig: &tls.Config{InsecureSkipVerify: true},\n\t}\n\treturn &http.Client{\n\t\tTimeout: timeout,\n\t\tTransport: transCfg,\n\t}\n}", "title": "" }, { "docid": "613aab692bb0468069a782a63f4e7c8c", "score": "0.6311292", "text": "func (a AuditingImpl) ElkClient(url string, username string, password string) (*elastic.Client, error) {\n\tconfig := buildConfig(url, username, password)\n\treturn a.Elk.NewClient(config)\n}", "title": "" }, { "docid": "580a0ec9da52462a74ad25fd9e02240b", "score": "0.6309659", "text": "func GetClient() *minio.Client {\n\tloadConfig()\n\taccessKey := viper.GetString(\"do.accesskey\")\n\tsecKey := viper.GetString(\"do.seckey\")\n\tendpoint := viper.GetString(\"do.endpoint\")\n\tssl := viper.GetBool(\"do.ssl\")\n\n\t// Initiate a client using DigitalOcean Spaces.\n\tclient, err := minio.New(endpoint, accessKey, secKey, ssl)\n\tif err != nil {\n\t\tlog.Errorln(err)\n\t}\n\n\tlog.Infoln(\"GetClient success\")\n\treturn client\n}", "title": "" }, { "docid": "7aaf4cb26148311dc83f16043f1c67be", "score": "0.6300739", "text": "func (e *EtcdKVS) createEtcdClient() *etcdClient.Client {\n\tmanagers, err := e.dockerOps.GetSwarmManagers()\n\tif err != nil {\n\t\tlog.WithFields(\n\t\t\tlog.Fields{\"error\": err},\n\t\t).Error(\"Failed to get swarm managers \")\n\t\treturn nil\n\t}\n\n\tfor _, manager := range managers {\n\t\tetcd, err := e.addrToEtcdClient(manager.Addr)\n\t\tif err == nil {\n\t\t\treturn etcd\n\t\t}\n\t}\n\n\tlog.WithFields(\n\t\tlog.Fields{\"Swarm ID\": e.nodeID,\n\t\t\t\"IP Addr\": e.nodeAddr},\n\t).Error(\"Failed to create ETCD client according to manager info \")\n\treturn nil\n}", "title": "" }, { "docid": "c388ba206fe5a3a7f91418b9a16a27e2", "score": "0.62982184", "text": "func NewClient(host string, port int, password string, db int) service.Leaderboard {\n\tdatabase := database.NewRedisDatabase(database.RedisOptions{\n\t\tClusterEnabled: false,\n\t\tHost: host,\n\t\tPort: port,\n\t\tPassword: password,\n\t\tDB: db,\n\t})\n\n\tservice := service.NewService(database)\n\treturn service\n}", "title": "" }, { "docid": "33b59f252a3b70a308b62dfe9803443e", "score": "0.6294279", "text": "func (jp *jsonPersister) RawClient() *etcd.Client {\n\treturn jp.cc.client\n}", "title": "" }, { "docid": "2caef78ed3eeb9ac58ee05071db748df", "score": "0.6281567", "text": "func (c *Config) Client(ctx context.Context) *http.Client {\n\treturn c.config.Client(ctx)\n}", "title": "" }, { "docid": "a542bae52fafef6e222704a6541d66ac", "score": "0.6271829", "text": "func Client() *redis.Client {\n\treturn redisClient\n}", "title": "" }, { "docid": "b02c7a243a4047c104084bd55aa29635", "score": "0.62691003", "text": "func GetRemoteEtcdClient(endpoints []string) (*clientv3.Client, error) {\n\treturn clientv3.New(clientv3.Config{\n\t\tEndpoints: endpoints,\n\t\tDialTimeout: 5 * time.Second,\n\t})\n}", "title": "" }, { "docid": "2368af881734d609cea340119a7d4ed5", "score": "0.62641364", "text": "func (c *Chain) Client() *seth.Client {\n\treturn seth.NewClientTransport(c)\n}", "title": "" }, { "docid": "0c7dfad80111ff76987dc7ea4b7203eb", "score": "0.626209", "text": "func getClient(ctx context.Context, config *oauth2.Config, cacheFileName string) (*http.Client, error) {\n\tcacheFile, err := tokenCacheFile(cacheFileName)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"Unable to get path to cached credential file. %v\", err)\n\t}\n\ttok, err := tokenFromFile(cacheFile)\n\tif err == nil {\n\t\treturn config.Client(ctx, tok), nil\n\t}\n\ttok, err = getTokenFromWeb(ctx, config)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tif err := saveToken(cacheFile, tok); err != nil {\n\t\treturn nil, err\n\t}\n\treturn config.Client(ctx, tok), nil\n}", "title": "" }, { "docid": "d7506f75b7fab09c0ef18eba443a69a8", "score": "0.62575054", "text": "func GetClient() Client {\n\treturn NewXClient()\n}", "title": "" }, { "docid": "673c69e9fe22003a38a5c4ec5456d1ca", "score": "0.62572944", "text": "func (h *HatcheryLocal) Client() cdsclient.Interface {\n\treturn h.client\n}", "title": "" }, { "docid": "97c114537c36a53302c7a06107224060", "score": "0.6256915", "text": "func getKubernetesClient() (kubernetes.Interface){\r\n\t// construct the path to resolve to `~/.kube/config`\r\n config, err := rest.InClusterConfig()\r\n if err != nil {\r\n kubeConfigPath := os.Getenv(\"HOME\") + \"/.kube/config\"\r\n\r\n //create the config from the path\r\n config, err = clientcmd.BuildConfigFromFlags(\"\", kubeConfigPath)\r\n if err != nil {\r\n log.Fatalf(\"getInClusterConfig: %v\", err)\r\n panic(\"Failed to load kube config\")\r\n }\r\n }\r\n\r\n // generate the client based off of the config\r\n client, err := kubernetes.NewForConfig(config)\r\n if err != nil {\r\n panic(\"Failed to create kube client\")\r\n }\r\n\r\n\tlog.Info(\"Successfully constructed k8s client\")\r\n\treturn client\r\n}", "title": "" }, { "docid": "0bd56a94855033d13a7ee49fcae65575", "score": "0.62510014", "text": "func (cfg *Config) Client() (*Client, error) {\n\tif cfg.flag != nil && !cfg.flag.Parsed() {\n\t\treturn nil, errors.New(\"must parse flags before calling Client\")\n\t}\n\n\t// Check to see if the configuration if valid. We must have a address\n\tif cfg.BaseURL == \"\" {\n\t\treturn nil, errors.New(\"icinga address is missing\")\n\t}\n\n\t// Check to see if the configuration if valid. We must have a tls or usernames/password\n\tif (cfg.TLSClientCert == \"\" || cfg.TLSClientKey == \"\" || cfg.TLSCACert == \"\") && (cfg.Username == \"\" || cfg.Password == \"\") {\n\t\treturn nil, errors.New(\"icinga TLS or username/password not set\")\n\t}\n\n\ttlsConfig, err := cfg.setupTLSConfig()\n\tif err != nil {\n\t\treturn nil, errors.Wrap(err, \"setupTLSConfig error\")\n\t}\n\n\treturn &Client{\n\t\tcfg: cfg,\n\t\thttpClient: &http.Client{\n\t\t\tTransport: &http.Transport{\n\t\t\t\tTLSClientConfig: tlsConfig,\n\t\t\t},\n\t\t\tTimeout: time.Second * 60,\n\t\t},\n\t}, nil\n}", "title": "" }, { "docid": "e1555000f015421035dbc9019549d394", "score": "0.62415826", "text": "func getClient(ctx context.Context, config *oauth2.Config) *http.Client {\n\tcacheFile, err := tokenCacheFile()\n\tif err != nil {\n\t\tlog.Fatalf(\"Unable to get path to cached credential file. %v\", err)\n\t}\n\n\tvar tok *oauth2.Token\n\tif len(secretsCache) != 0 {\n\t\ttok, err = tokenFromSecretsCache()\n\t\tif err != nil {\n\t\t\tlog.Fatal(err)\n\t\t}\n\t} else {\n\t\ttok, err = tokenFromFile(cacheFile)\n\t\tif err != nil {\n\t\t\ttok = getTokenFromWeb(config)\n\t\t\tsaveToken(cacheFile, tok)\n\t\t}\n\t}\n\n\treturn config.Client(ctx, tok)\n}", "title": "" }, { "docid": "9a045abe8e176a79d46996f58f73a05f", "score": "0.623976", "text": "func (t *Test) GetClient(id string) (osin.Client, error) {\n\treturn t.Clients[id], t.Err\n}", "title": "" }, { "docid": "24928227ffb83f52b252e2edb40ca259", "score": "0.6232164", "text": "func (e *Client) Client() *elastic.Client {\n\treturn e.esclient\n}", "title": "" }, { "docid": "eb142561f6c7e1c0f91e9947ab81d173", "score": "0.62302184", "text": "func GetConfigClient(storageType string, conf map[string]string) ConfigMgr {\n\tvar config config\n\n\tif strings.ToLower(storageType) == \"etcd\" {\n\t\tconfig.certFile = conf[\"certFile\"]\n\t\tconfig.keyFile = conf[\"keyFile\"]\n\t\tconfig.trustFile = conf[\"trustFile\"]\n\t\tetcdclient, err := NewEtcdClient(config)\n\t\tif err != nil {\n\t\t\tglog.Errorf(\"Etcd client initialization failed!! Error: %v\", err)\n\t\t\treturn nil\n\t\t}\n\t\treturn etcdclient\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "03c9ddd4649866f3ec6907f669e13bc1", "score": "0.6225703", "text": "func getClient(config *oauth2.Config) *http.Client {\n\ttokFile := defUserToken\n\ttok, err := tokenFromFile(tokFile)\n\tif err != nil {\n\t\ttok = getTokenFromWeb_UI(config)\n\t\tsaveToken(tokFile, tok)\n\t}\n\treturn config.Client(context.Background(), tok)\n}", "title": "" }, { "docid": "906514164bc187aff3c696cd294541b6", "score": "0.62243587", "text": "func (authenticator *ContainerAuthenticator) client() *http.Client {\n\tauthenticator.clientInit.Do(func() {\n\t\tif authenticator.Client == nil {\n\t\t\tauthenticator.Client = DefaultHTTPClient()\n\t\t\tauthenticator.Client.Timeout = time.Second * 30\n\n\t\t\t// If the user told us to disable SSL verification, then do it now.\n\t\t\tif authenticator.DisableSSLVerification {\n\t\t\t\ttransport := &http.Transport{\n\t\t\t\t\t// #nosec G402\n\t\t\t\t\tTLSClientConfig: &tls.Config{InsecureSkipVerify: true},\n\t\t\t\t}\n\t\t\t\tauthenticator.Client.Transport = transport\n\t\t\t}\n\t\t}\n\t})\n\treturn authenticator.Client\n}", "title": "" }, { "docid": "6c69fe664cf5aa776665cdd96ae70766", "score": "0.6223126", "text": "func getClient(ctx context.Context, config *oauth2.Config) *http.Client {\r\n\ttok, err := tokenFromSSM()\r\n\tif err != nil {\r\n\t\ttok = getTokenFromWeb(config)\r\n\t\tputTokenInSSM(tok)\r\n\t}\r\n\treturn config.Client(ctx, tok)\r\n}", "title": "" }, { "docid": "4e28241d07867123bbe0d2ac946d9ab0", "score": "0.62207013", "text": "func getClient(ctx context.Context, config *oauth2.Config) *http.Client {\n cacheFile, err := tokenCacheFile()\n if err != nil {\n log.Fatalf(\"Unable to get path to cached credential file. %v\", err)\n }\n tok, err := tokenFromFile(cacheFile)\n if err != nil {\n tok = getTokenFromWeb(config)\n saveToken(cacheFile, tok)\n }\n return config.Client(ctx, tok)\n}", "title": "" }, { "docid": "28fbff6e9d8f97913b6090c317e81579", "score": "0.6219775", "text": "func getClient(config *oauth2.Config) *http.Client {\n\ttokenFile := GetTokenSaveLocation()\n\ttok, err := tokenFromFile(tokenFile)\n\n\tif err != nil {\n\t\ttok = getTokenFromWeb(config)\n\t\tsaveToken(tokenFile, tok)\n\t}\n\treturn config.Client(context.Background(), tok)\n}", "title": "" }, { "docid": "69c231fa77a05a7848cf9ff94318d15b", "score": "0.62147135", "text": "func getClient(ctx context.Context, config *oauth2.Config) *http.Client {\r\n\tcacheFile, err := tokenCacheFile()\r\n\tif err != nil {\r\n\t\tlog.Fatalf(\"Unable to get path to cached credential file. %v\", err)\r\n\t}\r\n\ttok, err := tokenFromFile(cacheFile)\r\n\tif err != nil {\r\n\t\ttok = getTokenFromWeb(config)\r\n\t\tsaveToken(cacheFile, tok)\r\n\t}\r\n\treturn config.Client(ctx, tok)\r\n}", "title": "" }, { "docid": "773bcba7e339b9b908ed259a1d0a8080", "score": "0.62136686", "text": "func (p *PhishBox) Client() *http.Client {\n\treturn p.client\n}", "title": "" }, { "docid": "702cb61b7d961afe43247a02d48e617f", "score": "0.62052876", "text": "func NewEtcdClient(machines []string, cert, key, caCert string, basicAuth bool, username string, password string) (*Client, error) {\n\tvar c client.Client\n\tvar kapi client.KeysAPI\n\tvar err error\n\tvar transport = &http.Transport{\n\t\tProxy: http.ProxyFromEnvironment,\n\t\tDial: (&net.Dialer{\n\t\t\tTimeout: 30 * time.Second,\n\t\t\tKeepAlive: 30 * time.Second,\n\t\t}).Dial,\n\t\tTLSHandshakeTimeout: 10 * time.Second,\n\t}\n\n\ttlsConfig := &tls.Config{\n\t\tInsecureSkipVerify: false,\n\t}\n\n\tcfg := client.Config{\n\t\tEndpoints: machines,\n\t\tHeaderTimeoutPerRequest: time.Duration(3) * time.Second,\n\t}\n\n\tif basicAuth {\n\t\tcfg.Username = username\n\t\tcfg.Password = password\n\t}\n\n\tif caCert != \"\" {\n\t\tcertBytes, err := ioutil.ReadFile(caCert)\n\t\tif err != nil {\n\t\t\treturn &Client{kapi}, err\n\t\t}\n\n\t\tcaCertPool := x509.NewCertPool()\n\t\tok := caCertPool.AppendCertsFromPEM(certBytes)\n\n\t\tif ok {\n\t\t\ttlsConfig.RootCAs = caCertPool\n\t\t}\n\t}\n\n\tif cert != \"\" && key != \"\" {\n\t\ttlsCert, err := tls.LoadX509KeyPair(cert, key)\n\t\tif err != nil {\n\t\t\treturn &Client{kapi}, err\n\t\t}\n\t\ttlsConfig.Certificates = []tls.Certificate{tlsCert}\n\t}\n\n\ttransport.TLSClientConfig = tlsConfig\n\tcfg.Transport = transport\n\n\tc, err = client.New(cfg)\n\tif err != nil {\n\t\treturn &Client{kapi}, err\n\t}\n\n\tkapi = client.NewKeysAPI(c)\n\treturn &Client{kapi}, nil\n}", "title": "" }, { "docid": "4fa9d56d4858409cb6460bb1e28781b8", "score": "0.61991376", "text": "func New() (*clientv3.Client, error) {\n\tcli, err := clientv3.New(clientv3.Config{\n\t\tEndpoints: config.Config.EtcdEndpoints,\n\t\tDialTimeout: 5 * time.Second,\n\t})\n\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn cli, nil\n}", "title": "" }, { "docid": "2c227b967aaaf9d63d12cc7724515cf0", "score": "0.61842084", "text": "func Client(name string, opts ...thrift.ClientOption) interface{} {\n\treturn func(d *yarpc.Dispatcher) storeclient.Interface {\n\t\treturn storeclient.New(d.ClientConfig(name), opts...)\n\t}\n}", "title": "" } ]
dbad71174b8e0f639152bb7907782272
MarshalJSON supports json.Marshaler interface
[ { "docid": "9732d5e9c15c15fe16d6b43beac5d933", "score": "0.0", "text": "func (v HilStateQuaternion) MarshalJSON() ([]byte, error) {\n\tw := jwriter.Writer{}\n\teasyjsonFa90ddaeEncodeGithubComAsmyasnikovGoMavlinkMavlinkDialectsPaparazzi93(&w, v)\n\treturn w.Buffer.BuildBytes(), w.Error\n}", "title": "" } ]
[ { "docid": "ede95d8b2a52015c8734420e8f343d19", "score": "0.79136276", "text": "func Marshal(j interface{}) ([]byte, error) {\n\treturn json.Marshal(j)\n}", "title": "" }, { "docid": "ddd512b8b972e516b4663b38a134bdfa", "score": "0.74821985", "text": "func Marshal(v interface{}) ([]byte, error) {\n\treturn json.Marshal(v)\n}", "title": "" }, { "docid": "ddd512b8b972e516b4663b38a134bdfa", "score": "0.74821985", "text": "func Marshal(v interface{}) ([]byte, error) {\n\treturn json.Marshal(v)\n}", "title": "" }, { "docid": "ddd512b8b972e516b4663b38a134bdfa", "score": "0.74821985", "text": "func Marshal(v interface{}) ([]byte, error) {\n\treturn json.Marshal(v)\n}", "title": "" }, { "docid": "34317e50974e80d7f8c13ffdbdf7a8ce", "score": "0.7435322", "text": "func (j *JSON) Marshal(v interface{}) ([]byte, error) {\n\treturn json.Marshal(v)\n}", "title": "" }, { "docid": "1306c5fbabff8e990560db578e92fa2a", "score": "0.73761123", "text": "func Marshal(x interface{}) ([]byte, error) {\n\treturn AppendJSON(nil, x)\n}", "title": "" }, { "docid": "23fbaaf7a01bb7bc0cf2a9b4219eefa6", "score": "0.7347604", "text": "func jsonMarshal(input interface{}) ([]byte, error) {\n\tif env.conf.PrettyJson {\n\t\tbytes, err := json.MarshalIndent(input, \"\", PRETTY_PRINT_INDENT)\n\t\treturn bytes, errors.WithStack(err)\n\t}\n\tbytes, err := json.Marshal(input)\n\treturn bytes, errors.WithStack(err)\n}", "title": "" }, { "docid": "3cd12c560a3508187fbd344c7ce6277c", "score": "0.7331607", "text": "func Marshal(v interface{}) ([]byte, error) {\n\tbytes, err := json.Marshal(v)\n\treturn bytes, err\n}", "title": "" }, { "docid": "45a31c3c6ed2c62787ca40f96ffd93b0", "score": "0.7328471", "text": "func Marshal(input interface{}) ([]byte, error) {\n\toutput, err := json.Marshal(input)\n\tif err != nil {\n\t\treturn nil, errors.New(\"Error marshaling JSON\")\n\t}\n\treturn output, nil\n}", "title": "" }, { "docid": "9d414abf150e6d96f55d571f8b420f06", "score": "0.7215733", "text": "func JSONMarshal(t interface{}) ([]byte, error) {\n\tbuffer := &bytes.Buffer{}\n\tencoder := json.NewEncoder(buffer)\n\tencoder.SetEscapeHTML(false)\n\terr := encoder.Encode(t)\n\treturn buffer.Bytes(), err\n}", "title": "" }, { "docid": "add3128be2b8a6fefa0a7a98a24e8ccc", "score": "0.7197517", "text": "func JSONMarshal(x interface{}) ([]byte, error) {\n\tvar (\n\t\tbuf = &bytes.Buffer{}\n\t\tenc = json.NewEncoder(buf)\n\t)\n\tenc.SetEscapeHTML(false)\n\terr := enc.Encode(x)\n\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tbs := buf.Bytes()\n\n\tif 0 < len(bs) {\n\t\tif bs[len(bs)-1] == 0x0a {\n\t\t\tbs = bs[0 : len(bs)-1]\n\t\t}\n\t}\n\n\treturn bs, nil\n}", "title": "" }, { "docid": "f020631e3b62fcc0469221992f5fde32", "score": "0.71884656", "text": "func Marshal(v AttrGetter) ([]byte, error) {\n\tif v == nil || reflect.ValueOf(v).IsNil() {\n\t\treturn []byte(\"null\"), nil\n\t}\n\ts := jsoniter.NewStream(jsoniter.ConfigCompatibleWithStandardLibrary, nil, 4096)\n\ts.WriteObjectStart()\n\n\tif err := encodeStructFields(v, s); err != nil {\n\t\treturn nil, err\n\t}\n\n\textended := v.GetExtendedAttributes()\n\tif len(extended) > 0 {\n\t\tif err := encodeExtendedFields(extended, s); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\n\ts.WriteObjectEnd()\n\n\treturn s.Buffer(), nil\n}", "title": "" }, { "docid": "6ba14019852b1e325ac5f298fe2db828", "score": "0.71396565", "text": "func Marshal(from interface{}, pretty bool) ([]byte, error) {\n\tif pretty {\n\t\treturn json.MarshalIndent(from, \"\", \" \")\n\t}\n\treturn json.Marshal(from)\n}", "title": "" }, { "docid": "de57d271c6b149370e5fe34be7757ad6", "score": "0.7137312", "text": "func jsonMarshal(v interface{}) []byte {\n\trawJSON, err := json.Marshal(v)\n\n\tif err != nil {\n\t\tlogrus.WithError(err).Fatalf(\"Could not marshal %v: %s\", v, err)\n\t}\n\treturn rawJSON\n}", "title": "" }, { "docid": "ee66bbc5aedaec91095947d108e8ce44", "score": "0.71290284", "text": "func (s *JsonSerializer) Marshal(v interface{}) ([]byte, error) {\n\treturn convert.ToJsonE(v)\n}", "title": "" }, { "docid": "3f9c401cd7f4268e4549a6564ad9fc56", "score": "0.7121357", "text": "func Marshal(obj interface{}) (result string, err error) {\n\tbf := bytes.NewBuffer([]byte{})\n\tjsonEncoder := json.NewEncoder(bf)\n\tjsonEncoder.SetEscapeHTML(false)\n\tjsonEncoder.Encode(obj)\n\tresult = bf.String()\n\t//var resultB []byte\n\t//resultB, err = json.Marshal(obj)\n\t//if err != nil {\n\t//\treturn\n\t//}\n\t//result = string(resultB)\n\treturn\n}", "title": "" }, { "docid": "2c13fac6c0477462fee4a16acfd16353", "score": "0.7113676", "text": "func JsonMarshal(params interface{}) ([]byte, error) {\n\tbuffer := new(bytes.Buffer)\n\tenc := json.NewEncoder(buffer)\n\tenc.SetEscapeHTML(false)\n\terr := enc.Encode(&params)\n\tif err != nil {\n\t\tlog.Println(err)\n\t}\n\treturn buffer.Bytes(), err\n}", "title": "" }, { "docid": "7c2679221fce77d37be94ffea047f3a5", "score": "0.7081693", "text": "func jsonMarshal(v interface{}) (string, error) {\n\tb, err := json.Marshal(v)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\n\treturn string(b), nil\n}", "title": "" }, { "docid": "03f06f0fc34f9d4b6d07ad01fb8d8df7", "score": "0.7071179", "text": "func Marshal(obj interface{}) ([]byte, error) {\n\tbuffer := &bytes.Buffer{}\n\tencoder := json.NewEncoder(buffer)\n\tencoder.SetEscapeHTML(false)\n\terr := encoder.Encode(obj)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tdata := buffer.Bytes()\n\tif l := len(data); l > 0 {\n\t\tdata = data[:l-1]\n\t}\n\treturn data, nil\n}", "title": "" }, { "docid": "99aa44a128b3fb71da6ec2d043b6b803", "score": "0.7066719", "text": "func Marshal(v interface{}) (string, error) {\n\tresByte, err := json.Marshal(v)\n\tif err != nil {\n\t\treturn \"\", err\n\t} else {\n\t\treturn string(resByte), nil\n\t}\n}", "title": "" }, { "docid": "1a5bdeb693a749ed7bfbe69644cdadd1", "score": "0.70233184", "text": "func JSONMarshal(v interface{}) string {\n\tb, err := json.Marshal(v)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn string(b)\n}", "title": "" }, { "docid": "877fa320db8aa5488379ac92ac843863", "score": "0.6989915", "text": "func (j *JSON) Marshal(obj interface{}) error {\n\tres, err := json.Marshal(obj)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t*j = res\n\treturn nil\n}", "title": "" }, { "docid": "7a34bc910cd8163f9bc839196a7f4f8f", "score": "0.6956922", "text": "func Marshal(v interface{}) ([]byte, error) {\n\tvar buf bytes.Buffer\n\twriter := bufio.NewWriter(&buf)\n\tencoder := sysjson.NewEncoder(writer)\n\tencoder.SetEscapeHTML(false)\n\tif err := encoder.Encode(v); err != nil {\n\t\treturn nil, err\n\t}\n\tif err := writer.Flush(); err != nil {\n\t\treturn nil, err\n\t}\n\tdata := buf.Bytes()\n\t// drop extra \\n byte\n\tif size := len(data); size > 0 && data[size-1] == byte(10) {\n\t\tdata = data[:size-1]\n\t}\n\treturn data, nil\n}", "title": "" }, { "docid": "d416ec32c6a86d4ddca23d5cd33eafe1", "score": "0.6882493", "text": "func marshalJSON(i *big.Int) ([]byte, error) {\n\ttext, err := i.MarshalText()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn json.Marshal(string(text))\n}", "title": "" }, { "docid": "d416ec32c6a86d4ddca23d5cd33eafe1", "score": "0.6882493", "text": "func marshalJSON(i *big.Int) ([]byte, error) {\n\ttext, err := i.MarshalText()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn json.Marshal(string(text))\n}", "title": "" }, { "docid": "8689a06788f2ef160f5d78b15d3d21a2", "score": "0.68431294", "text": "func (jz JSONGzipEncoding) Marshal(v interface{}) ([]byte, error) {\n\tbuf, err := json.Marshal(v)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\t// var bufSizeBefore = len(buf)\n\n\tbuf, err = GzipEncode(buf)\n\t// log.Infof(\"gzip_json_compress_ratio=%d/%d=%.2f\", bufSizeBefore, len(buf), float64(bufSizeBefore)/float64(len(buf)))\n\treturn buf, err\n}", "title": "" }, { "docid": "9175f090a9ab3e22f876a41d49665be2", "score": "0.68149567", "text": "func MarshalJOSN(v interface{}) []byte {\n\tdata, _ := json.MarshalIndent(v, \"\", \" \")\n\n\treturn data\n}", "title": "" }, { "docid": "ce065355b9486e29a5fb4e6ddf3a2f14", "score": "0.6781186", "text": "func (m *TTNMarshaler) Marshal(v any) ([]byte, error) {\n\tb, err := marshalAny(v, m.JSONPb)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tif m.JSONPb.Indent == \"\" {\n\t\treturn b, nil\n\t}\n\tvar buf bytes.Buffer\n\tif err = json.Indent(&buf, b, \"\", m.JSONPb.Indent); err != nil {\n\t\treturn nil, err\n\t}\n\treturn buf.Bytes(), nil\n}", "title": "" }, { "docid": "9710af022c31d4ae91fa3bec88a2405c", "score": "0.677266", "text": "func (c *testCodec) Marshal(data interface{}, options map[string]interface{}) ([]byte, error) {\n\treturn c.JsonCodec.Marshal(options, options)\n}", "title": "" }, { "docid": "b42bf3fe78bc0072c781a0a854ee56e0", "score": "0.6756432", "text": "func JsonEncode(v interface{}) []byte {\n\tmarshaled, err := json.Marshal(v)\n\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\n\treturn marshaled\n}", "title": "" }, { "docid": "559f07595c2586f280f0a70b392b74ce", "score": "0.67547286", "text": "func genMarshalJSON(mtyp *marshalerType) Function {\n\tvar (\n\t\tm = newMarshalMethod(mtyp, false)\n\t\trecv = m.receiver()\n\t\tintertyp = m.intermediateType(m.scope.newIdent(m.mtyp.orig.Obj().Name()))\n\t\tenc = Name(m.scope.newIdent(\"enc\"))\n\t\tjson = Name(m.scope.parent.packageName(\"encoding/json\"))\n\t)\n\tfn := Function{\n\t\tReceiver: recv,\n\t\tName: \"MarshalJSON\",\n\t\tReturnTypes: Types{{TypeName: \"[]byte\"}, {TypeName: \"error\"}},\n\t\tBody: []Statement{\n\t\t\tdeclStmt{intertyp},\n\t\t\tDeclare{Name: enc.Name, TypeName: intertyp.Name},\n\t\t},\n\t}\n\tfn.Body = append(fn.Body, m.marshalConversions(Name(recv.Name), enc, \"json\")...)\n\tfn.Body = append(fn.Body, Return{Values: []Expression{\n\t\tCallFunction{\n\t\t\tFunc: Dotted{Receiver: json, Name: \"Marshal\"},\n\t\t\tParams: []Expression{AddressOf{Value: enc}},\n\t\t},\n\t}})\n\treturn fn\n}", "title": "" }, { "docid": "49652385e8024c76ae0e3c3ff98e7f90", "score": "0.6723821", "text": "func Marshal(v interface{}, fields ...string) ([]byte, error) {\n\tif len(fields) == 0 {\n\t\treturn json.Marshal(v)\n\t} else {\n\t\treturn marshalFields(v, fields)\n\t}\n}", "title": "" }, { "docid": "309a1c749e95593b6ce90078a96e5fd3", "score": "0.6698828", "text": "func MarshalToString(v interface{}) (string, error) { return JSON.MarshalToString(v) }", "title": "" }, { "docid": "c399ab0979c1d8761b389887da3edaea", "score": "0.6697857", "text": "func MarshalToJSON(writer io.Writer, err error, additionalErrors ...error) error {\n\tobj := MarshalToObject(err, additionalErrors...)\n\tencoder := json.NewEncoder(writer)\n\treturn encoder.Encode(obj)\n}", "title": "" }, { "docid": "497f780f8575eda9bc3b60145125ebea", "score": "0.6697856", "text": "func jsonMarshal(v interface{}) ([]byte, error) {\n\tb, err := json.Marshal(v)\n\n\tb = bytes.Replace(b, []byte(\"\\\\u0026\"), []byte(\"&\"), -1)\n\tb = bytes.Replace(b, []byte(\"\\\\u003c\"), []byte(\"<\"), -1)\n\tb = bytes.Replace(b, []byte(\"\\\\u003e\"), []byte(\">\"), -1)\n\n\treturn b, err\n}", "title": "" }, { "docid": "1fca7b927cea49fcaeba14a38f244059", "score": "0.6679512", "text": "func JSONMarshal(v interface{}) ([]byte, error) {\n\tbuffer := &bytes.Buffer{}\n\tencoder := json.NewEncoder(buffer)\n\tencoder.SetEscapeHTML(false)\n\terr := encoder.Encode(v)\n\tclean := bytes.TrimSuffix(buffer.Bytes(), []byte(\"\\n\"))\n\treturn clean, err\n}", "title": "" }, { "docid": "d7cc086546da0497d9ad88a2afefa8b8", "score": "0.6677742", "text": "func (v DSTopic) MarshalEasyJSON(w *jwriter.Writer) {\n\teasyjsonEeca4a30EncodeGithubComGoFishGojsonBenchmark24(w, v)\n}", "title": "" }, { "docid": "608e1966193ee7d343b7d04e3c63e0d9", "score": "0.66657114", "text": "func (v CopyToParams) MarshalJSON() ([]byte, error) {\n\tw := jwriter.Writer{}\n\teasyjsonC5a4559bEncodeGithubComKnqChromedpCdpDom78(&w, v)\n\treturn w.Buffer.BuildBytes(), w.Error\n}", "title": "" }, { "docid": "5378d42ff7af66b2989b0fb2f46eb217", "score": "0.66611224", "text": "func (b *PersonJSONBuilder) Marshal(orig *Person) ([]byte, error) {\n\tret, err := b.Convert(orig)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn json.Marshal(ret)\n}", "title": "" }, { "docid": "0a599071876f7ab18110ecaad12cab2d", "score": "0.66596663", "text": "func (v StructWithUnknownsProxyWithOmitempty) MarshalJSON() ([]byte, error) {\n\tw := jwriter.Writer{}\n\teasyjson6834c296EncodeGithubComMailruEasyjsonTests(&w, v)\n\treturn w.Buffer.BuildBytes(), w.Error\n}", "title": "" }, { "docid": "e41d30d0103ee42572a5e32e6906efaf", "score": "0.66513807", "text": "func (js JSONSerializable) MarshalJSON() ([]byte, error) {\n\tswitch x := js.Val.(type) {\n\tcase []byte:\n\t\t// Don't need to HEX encode if it is a valid JSON string\n\t\tif json.Valid(x) {\n\t\t\treturn json.Marshal(string(x))\n\t\t}\n\n\t\t// Don't need to HEX encode if it is already HEX encoded value\n\t\tif utils.IsHexBytes(x) {\n\t\t\treturn json.Marshal(string(x))\n\t\t}\n\n\t\treturn json.Marshal(hex.EncodeToString(x))\n\tdefault:\n\t\treturn json.Marshal(js.Val)\n\t}\n}", "title": "" }, { "docid": "860dd29d4e153f63a2d6fe366631b7ea", "score": "0.66310954", "text": "func (bf bloom32) JSONMarshal() []byte {\n\tbloomImEx := bloomJSONImExport{}\n\tbloomImEx.SetLocs = uint64(bf.setLocs)\n\tbloomImEx.FilterSet = ToBytes(&(bf.boolSet))\n\tdata, err := json.Marshal(bloomImEx)\n\tif err != nil {\n\t\tlog.Fatal(\"json.Marshal failed: \", err)\n\t}\n\treturn data\n}", "title": "" }, { "docid": "23e9a4f4b5eacc2050bfb698b9bde9ad", "score": "0.6629156", "text": "func encodeJSON(v interface{}) ([]byte, error) {\n\treturn json.MarshalIndent(v, \"\", \" \") // Two whitespaces!\n}", "title": "" }, { "docid": "86c3f4e03a31bb1cc956504435b243b2", "score": "0.6627173", "text": "func (s *Assert) JSONMarshaling(t *testing.T, v interface{}) {\n\tt.Helper()\n\n\ts.JSONMarshalingP(t, v, v)\n}", "title": "" }, { "docid": "a55045799bb9bf4b2e45d6c3b46ff88f", "score": "0.6619126", "text": "func (swap *Swap) Marshal() ([]byte, error) {\n\treturn json.Marshal(swap)\n}", "title": "" }, { "docid": "44e0ebf4fb62cc6b9fdbccfc2249c074", "score": "0.6612673", "text": "func MarshalBytes(v interface{}) []byte {\n var useOnError string\n\n // Use reflection to determine whether or not v is a slice or array\n switch reflect.TypeOf(v).Kind() {\n case reflect.Array:\n fallthrough\n case reflect.Slice:\n // Use [] JSON array notation because these 2 cases are array/slice\n useOnError = \"[]\"\n default:\n // Use a singular empty object if not.\n useOnError = \"{}\"\n }\n\n jsonBytes, err := json.Marshal(v)\n\n // If there is an error...apply the useOnError string\n if err != nil {\n jsonBytes = []byte(useOnError)\n }\n\n return jsonBytes\n}", "title": "" }, { "docid": "d24f16f27563c950742ce6f28db8d4ea", "score": "0.6609817", "text": "func JSONEncode(v interface{}) []byte {\n\tb, err := json.MarshalIndent(v, \"\", \" \")\n\tif err != nil {\n\t\tlog.Fatal(\"encode to json failed, %v\", err)\n\t\treturn nil\n\t}\n\treturn b\n}", "title": "" }, { "docid": "eb15fd67fa2d87961c3f024d0fa4f3e1", "score": "0.6609423", "text": "func (pair *IPIdentityPair) Marshal() ([]byte, error) { return json.Marshal(pair) }", "title": "" }, { "docid": "cc8ef36ded55f61678e0f9541d323504", "score": "0.66059774", "text": "func MarshalExtJSON(val interface{}, canonical, escapeHTML bool) ([]byte, error) {\n\treturn MarshalExtJSONWithRegistry(DefaultRegistry, val, canonical, escapeHTML)\n}", "title": "" }, { "docid": "2ae36c2f41a404bb5db69dd4ccbd9dfb", "score": "0.6602756", "text": "func (pc *ProtoCodec) MarshalInterfaceJSON(x proto.Message) ([]byte, error) {\n\tdefer pc.useContext()()\n\tany, err := types.NewAnyWithValue(x)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn pc.MarshalJSON(any)\n}", "title": "" }, { "docid": "ef0f5bb9605498e363ab3e6df2b2109a", "score": "0.6599169", "text": "func (j *JSONCustom) Marshal(v interface{}) ([]byte, error) {\n\tvar w bytes.Buffer\n\n\tp, ok := v.(proto.Message)\n\tif !ok {\n\t\treturn json.Marshal(v)\n\t}\n\n\tif err := (*Marshaler)(j).Marshal(&w, p); err != nil {\n\t\treturn []byte{}, err\n\t}\n\n\treturn w.Bytes(), nil\n}", "title": "" }, { "docid": "a2c6fdc9333fbbb78b7190b912b99ee8", "score": "0.6591822", "text": "func (c CosmosDbMongoDbAPISink) MarshalJSON() ([]byte, error) {\n\tobjectMap := c.CopySink.marshalInternal(\"CosmosDbMongoDbApiSink\")\n\tpopulate(objectMap, \"writeBehavior\", c.WriteBehavior)\n\treturn json.Marshal(objectMap)\n}", "title": "" }, { "docid": "6912cd94675fae52e165bae98553fd4c", "score": "0.6586913", "text": "func (p *JSONLowerParser) Marshal(o map[string]interface{}) ([]byte, error) {\n\treturn json.MarshalIndent(o, p.prefix, p.indent)\n}", "title": "" }, { "docid": "4d57e7e076bc41f3c8275c7df5030483", "score": "0.65810096", "text": "func (t *Client) marshal(v interface{}) ([]byte, error) {\n\te := t.Encoder\n\tif e == nil {\n\t\te = json.Marshal\n\t}\n\tbytes, err := e(v)\n\treturn bytes, err\n}", "title": "" }, { "docid": "844a1d4eab3665ae1500a41eb1127804", "score": "0.6573422", "text": "func (bf bloom64) JSONMarshal() []byte {\n\tbloomImEx := bloomJSONImExport{}\n\tbloomImEx.SetLocs = bf.setLocs\n\tbloomImEx.FilterSet = ToBytes(&(bf.boolSet))\n\tdata, err := json.Marshal(bloomImEx)\n\tif err != nil {\n\t\tlog.Fatal(\"json.Marshal failed: \", err)\n\t}\n\treturn data\n}", "title": "" }, { "docid": "1a3b20233f14bed89e026f8d9b1470bb", "score": "0.65690446", "text": "func (i Interface)MarshalJSON() ([]byte, error){\n objectMap := make(map[string]interface{})\n if(i.ExtendedLocation != nil) {\n objectMap[\"extendedLocation\"] = i.ExtendedLocation\n }\n if(i.InterfacePropertiesFormat != nil) {\n objectMap[\"properties\"] = i.InterfacePropertiesFormat\n }\n if(i.ID != nil) {\n objectMap[\"id\"] = i.ID\n }\n if(i.Location != nil) {\n objectMap[\"location\"] = i.Location\n }\n if(i.Tags != nil) {\n objectMap[\"tags\"] = i.Tags\n }\n return json.Marshal(objectMap)\n }", "title": "" }, { "docid": "5e30d4496f14f555a36b41e083420ae7", "score": "0.6553205", "text": "func (v CBPerson) MarshalEasyJSON(w *jwriter.Writer) {\n\teasyjsonEeca4a30EncodeGithubComGoFishGojsonBenchmark26(w, v)\n}", "title": "" }, { "docid": "af8ac79a8f7e0c5c8a71268e35c78156", "score": "0.65499663", "text": "func (j JSON) MarshalJSON() ([]byte, error) {\n\treturn j, nil\n}", "title": "" }, { "docid": "71ea8d02fb9d241c9c423cb846bee5ff", "score": "0.654953", "text": "func (u JSONableByteSlice) MarshalJSON() ([]byte, error) {\n\tvar result string\n\tif u == nil {\n\t\tresult = \"null\"\n\t} else {\n\t\tresult = strings.Join(strings.Fields(fmt.Sprintf(\"%d\", u)), \",\")\n\t}\n\treturn []byte(result), nil\n}", "title": "" }, { "docid": "f22a9f58d6ad47e52e02fbe3db049681", "score": "0.6545569", "text": "func MarshalJSON(i interface{}) ([]byte, error) {\n\tif i == nil {\n\t\treturn []byte(\"null\"), nil\n\t}\n\n\tbuf := &bytes.Buffer{}\n\tbuf.WriteByte('{')\n\n\txs := reflect.ValueOf(i)\n\tfor i := 0; i < xs.Len(); i++ {\n\t\tb, err := json.Marshal(xs.Index(i).Field(0).String())\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tbuf.Write(b)\n\t\tbuf.WriteByte(':')\n\t\tb, err = json.Marshal(xs.Index(i).Field(1).Interface())\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tbuf.Write(b)\n\t\tif i < xs.Len()-1 {\n\t\t\tbuf.WriteByte(',')\n\t\t}\n\t}\n\n\tbuf.WriteByte('}')\n\treturn buf.Bytes(), nil\n}", "title": "" }, { "docid": "ba576e5e394e6f87dec9eb1d4be3b35e", "score": "0.65426284", "text": "func JsonEncodeForce(data interface{}) []byte {\n\tr, err := json.Marshal(data)\n\tif err != nil {\n\t\treturn nil\n\t}\n\treturn r\n}", "title": "" }, { "docid": "2100f033f18ec0a0a657e3c7c4480c12", "score": "0.65417933", "text": "func (v Valuable) MarshalJSON() ([]byte, error) {\n\tw := jwriter.Writer{}\n\teasyjsonA37a3d7eEncodeMainInternalModels(&w, v)\n\treturn w.Buffer.BuildBytes(), w.Error\n}", "title": "" }, { "docid": "5b4bbee130a40cb62ef96946a5e4353b", "score": "0.6532018", "text": "func (v StructWithUnknownsProxy) MarshalJSON() ([]byte, error) {\n\tw := jwriter.Writer{}\n\teasyjson6834c296EncodeGithubComMailruEasyjsonTests1(&w, v)\n\treturn w.Buffer.BuildBytes(), w.Error\n}", "title": "" }, { "docid": "f481a367b64141f0cafd959f3067c020", "score": "0.6530937", "text": "func (m *Message) JSONMarshal(b *bytes.Buffer) ([]byte, error) {\n\tb.WriteString(\"{\")\n\n\t// encode agent id\n\tm.encodeAgent(b)\n\n\t// encode header\n\tm.encodeHeader(b)\n\n\t// encode data sets\n\tif err := m.encodeDataSet(b); err != nil {\n\t\treturn nil, err\n\t}\n\n\tb.WriteString(\"}\")\n\n\treturn b.Bytes(), nil\n}", "title": "" }, { "docid": "cd7699d753d90610ab9d874012836632", "score": "0.6530778", "text": "func (e *ShipmentRequested) Marshal() ([]byte, error) {\n\treturn json.Marshal(e)\n}", "title": "" }, { "docid": "556281d1253965ed382e8c4a7de4f1c6", "score": "0.65128696", "text": "func (b *PeopleJSONBuilder) Marshal(orig *People) ([]byte, error) {\n\tret, err := b.Convert(orig)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn json.Marshal(ret)\n}", "title": "" }, { "docid": "d8270a3915439cecad9cfded840c5f54", "score": "0.6511432", "text": "func (j JSONSink) MarshalJSON() ([]byte, error) {\n\tobjectMap := j.CopySink.marshalInternal(\"JsonSink\")\n\tpopulate(objectMap, \"formatSettings\", j.FormatSettings)\n\tpopulate(objectMap, \"storeSettings\", j.StoreSettings)\n\treturn json.Marshal(objectMap)\n}", "title": "" }, { "docid": "dfe1aa29b78220e9fdbdaef00745acc7", "score": "0.6508484", "text": "func testJSONMarshal(t *testing.T, v interface{}, want string) {\n\tt.Helper()\n\t// Unmarshal the wanted JSON, to verify its correctness, and marshal it back\n\t// to sort the keys.\n\tu := reflect.New(reflect.TypeOf(v)).Interface()\n\tif err := json.Unmarshal([]byte(want), &u); err != nil {\n\t\tt.Errorf(\"Unable to unmarshal JSON for %v: %v\", want, err)\n\t}\n\tw, err := json.Marshal(u)\n\tif err != nil {\n\t\tt.Errorf(\"Unable to marshal JSON for %#v\", u)\n\t}\n\n\t// Marshal the target value.\n\tj, err := json.Marshal(v)\n\tif err != nil {\n\t\tt.Errorf(\"Unable to marshal JSON for %#v\", v)\n\t}\n\n\tif string(w) != string(j) {\n\t\tt.Errorf(\"json.Marshal(%q) returned %s, want %s\", v, j, w)\n\t}\n}", "title": "" }, { "docid": "9e55a70b2ec2fd5d860e9174dcdfd45d", "score": "0.6496695", "text": "func JSONMarshal(file string, v interface{}) error {\n\tf, err := os.Create(file)\n\tdefer f.Close()\n\tif err != nil {\n\t\treturn errors.WithMessage(err, \"open file fail\")\n\t}\n\tif err = json.NewEncoder(f).Encode(v); err != nil {\n\t\treturn errors.WithMessage(err, \"do encode fail\")\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "4671564402906b7ea9b9d4e5913347cd", "score": "0.64957935", "text": "func (v Source) MarshalEasyJSON(w *jwriter.Writer) {\n\teasyjsonEeca4a30EncodeGithubComGoFishGojsonBenchmark4(w, v)\n}", "title": "" }, { "docid": "7cbf42b073fb9fdc2f2d938d9e853d31", "score": "0.6493561", "text": "func json_pack(json_string string, outgoing_message OutgoingMessage) {\n\n\tencoded_json, err := json.Marshal(json_string)\n}", "title": "" }, { "docid": "bb68dcb24b5b0d045ca52425b6ef9e7d", "score": "0.6487836", "text": "func marshal(msg *Message) ([]byte, error) {\n\tres, err := json.Marshal(msg)\n\treturn res, err\n}", "title": "" }, { "docid": "f0ce74c13ff13f4be549ee3d707aa984", "score": "0.6479798", "text": "func (v MapEntry) MarshalJSON() ([]byte, error) {\n\tw := jwriter.Writer{}\n\teasyjson305a78f8EncodeInmemoryStorageInternalAppStorage(&w, v)\n\treturn w.Buffer.BuildBytes(), w.Error\n}", "title": "" }, { "docid": "dc9eec03d3b5beb773b8df8c82b97ded", "score": "0.64788514", "text": "func (ng NatGateway)MarshalJSON() ([]byte, error){\n objectMap := make(map[string]interface{})\n if(ng.Sku != nil) {\n objectMap[\"sku\"] = ng.Sku\n }\n if(ng.NatGatewayPropertiesFormat != nil) {\n objectMap[\"properties\"] = ng.NatGatewayPropertiesFormat\n }\n if(ng.Zones != nil) {\n objectMap[\"zones\"] = ng.Zones\n }\n if(ng.ID != nil) {\n objectMap[\"id\"] = ng.ID\n }\n if(ng.Location != nil) {\n objectMap[\"location\"] = ng.Location\n }\n if(ng.Tags != nil) {\n objectMap[\"tags\"] = ng.Tags\n }\n return json.Marshal(objectMap)\n }", "title": "" }, { "docid": "bc6471841e8774943381c8fb2217fbea", "score": "0.6477394", "text": "func JsonMarshalIndent(params interface{}, prefix string, indent string) ([]byte, error) {\n\tbuffer := new(bytes.Buffer)\n\tenc := json.NewEncoder(buffer)\n\tenc.SetEscapeHTML(false)\n\tenc.SetIndent(prefix, indent)\n\terr := enc.Encode(&params)\n\tif err != nil {\n\t\tlog.Println(err)\n\t}\n\treturn buffer.Bytes(), err\n}", "title": "" }, { "docid": "ba20c55bb046e91058637af28c5b9cc5", "score": "0.64769685", "text": "func encodeJSON(obj interface{}) string {\n\tdata, err := json.Marshal(obj)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn string(data)\n}", "title": "" }, { "docid": "14837ebb10666ce9479710d35e6cfd6b", "score": "0.6472191", "text": "func (v CopyToReturns) MarshalJSON() ([]byte, error) {\n\tw := jwriter.Writer{}\n\teasyjsonC5a4559bEncodeGithubComKnqChromedpCdpDom77(&w, v)\n\treturn w.Buffer.BuildBytes(), w.Error\n}", "title": "" }, { "docid": "51ef8c4d7812f4bbe0cd6d2c2b2d94ad", "score": "0.6471702", "text": "func JSON(w io.Writer, x interface{}) error {\n\tencoder := json.NewEncoder(w)\n\tencoder.SetIndent(\"\", \" \")\n\treturn encoder.Encode(x)\n}", "title": "" }, { "docid": "286b4a9937f6df8b030d48c30cfcb2ea", "score": "0.6466727", "text": "func (r *Result) Marshal() ([]byte, error) {\n\treturn json.Marshal(r)\n}", "title": "" }, { "docid": "c9fac8f5212785a4df00eb2bee989808", "score": "0.646123", "text": "func (j JSON) MarshalJSON() ([]byte, error) {\n\tif j == nil {\n\t\treturn []byte(\"null\"), nil\n\t}\n\treturn j, nil\n}", "title": "" }, { "docid": "0a9ad1e816eb33f04ba10e3d52d04676", "score": "0.6459853", "text": "func (v Destination) MarshalEasyJSON(w *jwriter.Writer) {\n\teasyjsonEeca4a30EncodeGithubComGoFishGojsonBenchmark21(w, v)\n}", "title": "" }, { "docid": "687e3f7225d87fdfa141c7b96c6f455a", "score": "0.64494133", "text": "func marshalToJSON(value interface{}) ([]byte, error) {\n\tswitch reflect.ValueOf(value).Kind() {\n\tcase reflect.Array, reflect.Slice:\n\t\tvalue = jsonWrapper{Data: value}\n\t}\n\tbody, err := json.MarshalIndent(value, \"\", \" \")\n\tif err != nil {\n\t\treturn nil, errors.Errorf(\"unable to marshal %+v to json: %s\", value, err)\n\t}\n\treturn body, nil\n}", "title": "" }, { "docid": "bfecb71d74fb892c5dc96c2822e41f0d", "score": "0.644056", "text": "func (v Post) MarshalJSON() ([]byte, error) {\n\tw := jwriter.Writer{}\n\teasyjson6601e8cdEncodeGithubComOlegSchwann2chApiTypes11(&w, v)\n\treturn w.Buffer.BuildBytes(), w.Error\n}", "title": "" }, { "docid": "56d82e4d706d8552f2664b730f483334", "score": "0.643893", "text": "func Marshal(v any) ([]byte, error) {\n\tvar b bytes.Buffer\n\t(&encoder{w: &b}).encode(v)\n\treturn b.Bytes(), nil\n}", "title": "" }, { "docid": "d5c5e02a3fecfb19ee6062efb7fed39b", "score": "0.6436651", "text": "func (e *ShipmentSent) Marshal() ([]byte, error) {\n\treturn json.Marshal(e)\n}", "title": "" }, { "docid": "baabb47c6b5f390aebb5c6ff62ce9932", "score": "0.643571", "text": "func (hypervisor Hypervisor) MarshalJSON() ([]byte, error) {\n\treturn json.Marshal(hypervisor.exportData())\n}", "title": "" }, { "docid": "a4b9a7caac92d12024f9a5d1afcbf3f4", "score": "0.6430807", "text": "func (s *CipherText) Marshal() ([]byte, error) {\n\treturn json.Marshal(s)\n}", "title": "" }, { "docid": "996961a21258778a014e25aac70ee5d5", "score": "0.642346", "text": "func (w LenPrefixedWriter) Marshal(data interface{}) error {\n\tx, err := json.Marshal(data)\n\tif err != nil {\n\t\treturn err\n\t}\n\treturn w.WriteRaw(x)\n}", "title": "" }, { "docid": "7b5c97bb6d4c22aa2ad134900743c919", "score": "0.64196396", "text": "func (v Paper) MarshalJSON() ([]byte, error) {\n\tw := jwriter.Writer{}\n\teasyjsonA37a3d7eEncodeMainInternalModels2(&w, v)\n\treturn w.Buffer.BuildBytes(), w.Error\n}", "title": "" }, { "docid": "4d4268879c79cecea1762afc46acb851", "score": "0.641664", "text": "func (x *Gateway) MarshalProtoJSON(s *jsonplugin.MarshalState) {\n\tif x == nil {\n\t\ts.WriteNil()\n\t\treturn\n\t}\n\ts.WriteObjectStart()\n\tvar wroteField bool\n\tif x.Ids != nil || s.HasField(\"ids\") {\n\t\ts.WriteMoreIf(&wroteField)\n\t\ts.WriteObjectField(\"ids\")\n\t\tx.Ids.MarshalProtoJSON(s.WithField(\"ids\"))\n\t}\n\tif x.CreatedAt != nil || s.HasField(\"created_at\") {\n\t\ts.WriteMoreIf(&wroteField)\n\t\ts.WriteObjectField(\"created_at\")\n\t\tif x.CreatedAt == nil {\n\t\t\ts.WriteNil()\n\t\t} else {\n\t\t\tgolang.MarshalTimestamp(s, x.CreatedAt)\n\t\t}\n\t}\n\tif x.UpdatedAt != nil || s.HasField(\"updated_at\") {\n\t\ts.WriteMoreIf(&wroteField)\n\t\ts.WriteObjectField(\"updated_at\")\n\t\tif x.UpdatedAt == nil {\n\t\t\ts.WriteNil()\n\t\t} else {\n\t\t\tgolang.MarshalTimestamp(s, x.UpdatedAt)\n\t\t}\n\t}\n\tif x.DeletedAt != nil || s.HasField(\"deleted_at\") {\n\t\ts.WriteMoreIf(&wroteField)\n\t\ts.WriteObjectField(\"deleted_at\")\n\t\tif x.DeletedAt == nil {\n\t\t\ts.WriteNil()\n\t\t} else {\n\t\t\tgolang.MarshalTimestamp(s, x.DeletedAt)\n\t\t}\n\t}\n\tif x.Name != \"\" || s.HasField(\"name\") {\n\t\ts.WriteMoreIf(&wroteField)\n\t\ts.WriteObjectField(\"name\")\n\t\ts.WriteString(x.Name)\n\t}\n\tif x.Description != \"\" || s.HasField(\"description\") {\n\t\ts.WriteMoreIf(&wroteField)\n\t\ts.WriteObjectField(\"description\")\n\t\ts.WriteString(x.Description)\n\t}\n\tif x.Attributes != nil || s.HasField(\"attributes\") {\n\t\ts.WriteMoreIf(&wroteField)\n\t\ts.WriteObjectField(\"attributes\")\n\t\ts.WriteObjectStart()\n\t\tvar wroteElement bool\n\t\tfor k, v := range x.Attributes {\n\t\t\ts.WriteMoreIf(&wroteElement)\n\t\t\ts.WriteObjectStringField(k)\n\t\t\ts.WriteString(v)\n\t\t}\n\t\ts.WriteObjectEnd()\n\t}\n\tif len(x.ContactInfo) > 0 || s.HasField(\"contact_info\") {\n\t\ts.WriteMoreIf(&wroteField)\n\t\ts.WriteObjectField(\"contact_info\")\n\t\ts.WriteArrayStart()\n\t\tvar wroteElement bool\n\t\tfor _, element := range x.ContactInfo {\n\t\t\ts.WriteMoreIf(&wroteElement)\n\t\t\telement.MarshalProtoJSON(s.WithField(\"contact_info\"))\n\t\t}\n\t\ts.WriteArrayEnd()\n\t}\n\tif x.AdministrativeContact != nil || s.HasField(\"administrative_contact\") {\n\t\ts.WriteMoreIf(&wroteField)\n\t\ts.WriteObjectField(\"administrative_contact\")\n\t\t// NOTE: OrganizationOrUserIdentifiers does not seem to implement MarshalProtoJSON.\n\t\tgolang.MarshalMessage(s, x.AdministrativeContact)\n\t}\n\tif x.TechnicalContact != nil || s.HasField(\"technical_contact\") {\n\t\ts.WriteMoreIf(&wroteField)\n\t\ts.WriteObjectField(\"technical_contact\")\n\t\t// NOTE: OrganizationOrUserIdentifiers does not seem to implement MarshalProtoJSON.\n\t\tgolang.MarshalMessage(s, x.TechnicalContact)\n\t}\n\tif x.VersionIds != nil || s.HasField(\"version_ids\") {\n\t\ts.WriteMoreIf(&wroteField)\n\t\ts.WriteObjectField(\"version_ids\")\n\t\t// NOTE: GatewayVersionIdentifiers does not seem to implement MarshalProtoJSON.\n\t\tgolang.MarshalMessage(s, x.VersionIds)\n\t}\n\tif x.GatewayServerAddress != \"\" || s.HasField(\"gateway_server_address\") {\n\t\ts.WriteMoreIf(&wroteField)\n\t\ts.WriteObjectField(\"gateway_server_address\")\n\t\ts.WriteString(x.GatewayServerAddress)\n\t}\n\tif x.AutoUpdate || s.HasField(\"auto_update\") {\n\t\ts.WriteMoreIf(&wroteField)\n\t\ts.WriteObjectField(\"auto_update\")\n\t\ts.WriteBool(x.AutoUpdate)\n\t}\n\tif x.UpdateChannel != \"\" || s.HasField(\"update_channel\") {\n\t\ts.WriteMoreIf(&wroteField)\n\t\ts.WriteObjectField(\"update_channel\")\n\t\ts.WriteString(x.UpdateChannel)\n\t}\n\tif x.FrequencyPlanId != \"\" || s.HasField(\"frequency_plan_id\") {\n\t\ts.WriteMoreIf(&wroteField)\n\t\ts.WriteObjectField(\"frequency_plan_id\")\n\t\ts.WriteString(x.FrequencyPlanId)\n\t}\n\tif len(x.FrequencyPlanIds) > 0 || s.HasField(\"frequency_plan_ids\") {\n\t\ts.WriteMoreIf(&wroteField)\n\t\ts.WriteObjectField(\"frequency_plan_ids\")\n\t\ts.WriteStringArray(x.FrequencyPlanIds)\n\t}\n\tif len(x.Antennas) > 0 || s.HasField(\"antennas\") {\n\t\ts.WriteMoreIf(&wroteField)\n\t\ts.WriteObjectField(\"antennas\")\n\t\ts.WriteArrayStart()\n\t\tvar wroteElement bool\n\t\tfor _, element := range x.Antennas {\n\t\t\ts.WriteMoreIf(&wroteElement)\n\t\t\telement.MarshalProtoJSON(s.WithField(\"antennas\"))\n\t\t}\n\t\ts.WriteArrayEnd()\n\t}\n\tif x.StatusPublic || s.HasField(\"status_public\") {\n\t\ts.WriteMoreIf(&wroteField)\n\t\ts.WriteObjectField(\"status_public\")\n\t\ts.WriteBool(x.StatusPublic)\n\t}\n\tif x.LocationPublic || s.HasField(\"location_public\") {\n\t\ts.WriteMoreIf(&wroteField)\n\t\ts.WriteObjectField(\"location_public\")\n\t\ts.WriteBool(x.LocationPublic)\n\t}\n\tif x.ScheduleDownlinkLate || s.HasField(\"schedule_downlink_late\") {\n\t\ts.WriteMoreIf(&wroteField)\n\t\ts.WriteObjectField(\"schedule_downlink_late\")\n\t\ts.WriteBool(x.ScheduleDownlinkLate)\n\t}\n\tif x.EnforceDutyCycle || s.HasField(\"enforce_duty_cycle\") {\n\t\ts.WriteMoreIf(&wroteField)\n\t\ts.WriteObjectField(\"enforce_duty_cycle\")\n\t\ts.WriteBool(x.EnforceDutyCycle)\n\t}\n\tif x.DownlinkPathConstraint != 0 || s.HasField(\"downlink_path_constraint\") {\n\t\ts.WriteMoreIf(&wroteField)\n\t\ts.WriteObjectField(\"downlink_path_constraint\")\n\t\tx.DownlinkPathConstraint.MarshalProtoJSON(s)\n\t}\n\tif x.ScheduleAnytimeDelay != nil || s.HasField(\"schedule_anytime_delay\") {\n\t\ts.WriteMoreIf(&wroteField)\n\t\ts.WriteObjectField(\"schedule_anytime_delay\")\n\t\tif x.ScheduleAnytimeDelay == nil {\n\t\t\ts.WriteNil()\n\t\t} else {\n\t\t\tgolang.MarshalDuration(s, x.ScheduleAnytimeDelay)\n\t\t}\n\t}\n\tif x.UpdateLocationFromStatus || s.HasField(\"update_location_from_status\") {\n\t\ts.WriteMoreIf(&wroteField)\n\t\ts.WriteObjectField(\"update_location_from_status\")\n\t\ts.WriteBool(x.UpdateLocationFromStatus)\n\t}\n\tif x.LbsLnsSecret != nil || s.HasField(\"lbs_lns_secret\") {\n\t\ts.WriteMoreIf(&wroteField)\n\t\ts.WriteObjectField(\"lbs_lns_secret\")\n\t\t// NOTE: Secret does not seem to implement MarshalProtoJSON.\n\t\tgolang.MarshalMessage(s, x.LbsLnsSecret)\n\t}\n\tif x.ClaimAuthenticationCode != nil || s.HasField(\"claim_authentication_code\") {\n\t\ts.WriteMoreIf(&wroteField)\n\t\ts.WriteObjectField(\"claim_authentication_code\")\n\t\t// NOTE: GatewayClaimAuthenticationCode does not seem to implement MarshalProtoJSON.\n\t\tgolang.MarshalMessage(s, x.ClaimAuthenticationCode)\n\t}\n\tif x.TargetCupsUri != \"\" || s.HasField(\"target_cups_uri\") {\n\t\ts.WriteMoreIf(&wroteField)\n\t\ts.WriteObjectField(\"target_cups_uri\")\n\t\ts.WriteString(x.TargetCupsUri)\n\t}\n\tif x.TargetCupsKey != nil || s.HasField(\"target_cups_key\") {\n\t\ts.WriteMoreIf(&wroteField)\n\t\ts.WriteObjectField(\"target_cups_key\")\n\t\t// NOTE: Secret does not seem to implement MarshalProtoJSON.\n\t\tgolang.MarshalMessage(s, x.TargetCupsKey)\n\t}\n\tif x.RequireAuthenticatedConnection || s.HasField(\"require_authenticated_connection\") {\n\t\ts.WriteMoreIf(&wroteField)\n\t\ts.WriteObjectField(\"require_authenticated_connection\")\n\t\ts.WriteBool(x.RequireAuthenticatedConnection)\n\t}\n\tif x.Lrfhss != nil || s.HasField(\"lrfhss\") {\n\t\ts.WriteMoreIf(&wroteField)\n\t\ts.WriteObjectField(\"lrfhss\")\n\t\t// NOTE: Gateway_LRFHSS does not seem to implement MarshalProtoJSON.\n\t\tgolang.MarshalMessage(s, x.Lrfhss)\n\t}\n\tif x.DisablePacketBrokerForwarding || s.HasField(\"disable_packet_broker_forwarding\") {\n\t\ts.WriteMoreIf(&wroteField)\n\t\ts.WriteObjectField(\"disable_packet_broker_forwarding\")\n\t\ts.WriteBool(x.DisablePacketBrokerForwarding)\n\t}\n\ts.WriteObjectEnd()\n}", "title": "" }, { "docid": "abf1c2c2208d1ee90f1ad48a99556722", "score": "0.6411543", "text": "func (c Container) MarshalIndentJSON(prefix string, indent string) ([]byte, error) {\n\treturn json.MarshalIndent(c.c.Data(), prefix, indent)\n}", "title": "" }, { "docid": "7f5a659b46b07d8efe703b6b80994ac4", "score": "0.6410845", "text": "func Marshal(m Message) ([]byte, error) {\n\tjMsg := jsonMessage{\n\t\tHeaders: m.Headers(),\n\t\tPayload: m.Payload(),\n\t}\n\treturn json.Marshal(jMsg)\n}", "title": "" }, { "docid": "5c5419c9cd82874a70207a6743c2867d", "score": "0.640377", "text": "func testJSONMarshal(t *testing.T, v interface{}, want string) {\n\tj, err := json.Marshal(v)\n\tif err != nil {\n\t\tt.Errorf(\"Unable to marshal JSON for %v\", v)\n\t}\n\n\tw := new(bytes.Buffer)\n\terr = json.Compact(w, []byte(want))\n\tif err != nil {\n\t\tt.Errorf(\"String is not valid json: %s\", want)\n\t}\n\n\tif w.String() != string(j) {\n\t\tt.Errorf(\"json.Marshal(%q) returned %s, want %s\", v, j, w)\n\t}\n\n\t// now go the other direction and make sure things unmarshal as expected\n\tu := reflect.ValueOf(v).Interface()\n\tif err := json.Unmarshal([]byte(want), u); err != nil {\n\t\tt.Errorf(\"Unable to unmarshal JSON for %v\", want)\n\t}\n\n\tif !cmp.Equal(v, u) {\n\t\tt.Errorf(\"json.Unmarshal(%q) returned %s, want %s\", want, u, v)\n\t}\n}", "title": "" }, { "docid": "09ff81ac729fe425cfcee114a1e9399e", "score": "0.6397855", "text": "func EncodeJson(val interface{}, target *[]byte) Runner {\n return func() error {\n bytes, err := json.Marshal(val)\n if err != nil {\n return err\n }\n *target = bytes\n return nil\n }\n}", "title": "" }, { "docid": "85e14ccca08bfd0e00e610b1e7ee6d41", "score": "0.63977367", "text": "func (v PostFull) MarshalJSON() ([]byte, error) {\n\tw := jwriter.Writer{}\n\teasyjson6601e8cdEncodeGithubComOlegSchwann2chApiTypes4(&w, v)\n\treturn w.Buffer.BuildBytes(), w.Error\n}", "title": "" }, { "docid": "1ac8e680d8b92711ab1b891cd0223d1c", "score": "0.6396711", "text": "func (s Snoopy) JSONFormat() ([]byte, error) { return json.Marshal(s) }", "title": "" }, { "docid": "81ba5791592d94705cf052269d0bdae7", "score": "0.6390807", "text": "func MarshalJSON(obj runtime.Object) (marshaled []byte) {\n\tvar err error\n\tif marshaled, err = json.Marshal(obj); err != nil {\n\t\tpanic(fmt.Sprintf(\"failed to marshal obj to json: %s\", err))\n\t}\n\n\treturn\n}", "title": "" }, { "docid": "e262fa394bf6572074734129f4f1aa8c", "score": "0.6389765", "text": "func jsonEncode(w io.Writer, v interface{}) error {\n\treturn json.NewEncoder(w).Encode(v)\n}", "title": "" }, { "docid": "66404e2ff1ef98e743f694153b9fb5ec", "score": "0.6386074", "text": "func (v Server) MarshalEasyJSON(w *jwriter.Writer) {\n\teasyjsonEeca4a30EncodeGithubComGoFishGojsonBenchmark6(w, v)\n}", "title": "" }, { "docid": "23e776cb0f940655794ce398973f9ef2", "score": "0.63856864", "text": "func (b batchOperationUpsert) MarshalJSON() ([]byte, error) {\n\tbuffer := bytes.NewBufferString(\"{\")\n\tbuffer.WriteString(fmt.Sprintf(\"\\\"operationType\\\":\\\"%s\\\"\", b.operationType))\n\tif b.ifMatch != nil {\n\t\tbuffer.WriteString(\",\\\"ifMatch\\\":\")\n\t\tetag, err := json.Marshal(b.ifMatch)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tbuffer.Write(etag)\n\t}\n\n\tbuffer.WriteString(\",\\\"resourceBody\\\":\")\n\tbuffer.Write(b.resourceBody)\n\tbuffer.WriteString(\"}\")\n\treturn buffer.Bytes(), nil\n}", "title": "" }, { "docid": "05d112e152eb13a13d740681a542e102", "score": "0.6385354", "text": "func (v HTTP) MarshalEasyJSON(w *jwriter.Writer) {\n\teasyjsonEeca4a30EncodeGithubComGoFishGojsonBenchmark18(w, v)\n}", "title": "" } ]
eba5b056ddcc0b7b4f9e53c7653d34b9
NewWithFormat creates a new instance of bar.Bar with the given total and format and returns a reference to it
[ { "docid": "370a52ff59dfb7e0ce792f105ac2356f", "score": "0.8086123", "text": "func NewWithFormat(t int, f string) *Bar {\n\treturn &Bar{\n\t\tprogress: 0,\n\t\ttotal: t,\n\t\twidth: 20,\n\t\tstart: \"(\",\n\t\tcomplete: \"█\",\n\t\thead: \"█\",\n\t\tincomplete: \" \",\n\t\tend: \")\",\n\t\tclosed: false,\n\t\tstartedAt: time.Now(),\n\t\trate: 0,\n\t\tformatString: f,\n\t\tformat: tokenize(f, nil),\n\t\tcallback: noop,\n\t\toutput: initializeStdout(),\n\t}\n}", "title": "" } ]
[ { "docid": "644647676ea0cbeae1327c2878f20808", "score": "0.6541813", "text": "func New(name string, length float64, duration time.Duration) *Bar {\n\tb := &Bar{}\n\tb.name = name\n\tb.length = length\n\tb.duration = duration\n\tb.pressure = b.length / b.duration.Minutes()\n\tb.progress = 0.0\n\tb.elapsed = 0.0\n\treturn b\n}", "title": "" }, { "docid": "02d79bcfcd16fa06349ed4486425466d", "score": "0.6417258", "text": "func New(maxVal int, kwargs ...func(*Bar) error) (*Bar, error) {\n\n\tif maxVal <= 0 {\n\t\treturn nil, errors.New(\"invalid maxVal\")\n\t}\n\n\ttheme := Theme{\n\t\tStartChar: '|',\n\t\tEndChar: '|',\n\t\tProgressChar: '▓',\n\t}\n\n\tbar := &Bar{\n\t\twidth: 50,\n\t\tval: 0,\n\t\tmaxVal: maxVal,\n\t\ttheme: theme,\n\t\tshowPercentage: true,\n\t\tshowTime: true,\n\t\tisFinished: false,\n\t}\n\n\t// Apply optional arguments\n\tfor _, arg := range kwargs {\n\t\terr := arg(bar)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\n\treturn bar, nil\n}", "title": "" }, { "docid": "10809347d6ebd5e2e6ff9fb5c53e941f", "score": "0.60228854", "text": "func NewBar(label string, points []Point) *Bar {\n\treturn &Bar{\n\t\tLabel: label,\n\t\tData: points,\n\t\tDynamicMinWidth: 2,\n\t}\n}", "title": "" }, { "docid": "482e621ad8bd252551b022bc7f4609a5", "score": "0.5925705", "text": "func newBar(name string, removeBar bool, length int64) *mpb.Bar {\n\tvar barEnd mpb.BarOption\n\n\tif removeBar {\n\t\tbarEnd = mpb.BarRemoveOnComplete()\n\t} else {\n\t\tbarEnd = mpb.BarFillerClearOnComplete()\n\t}\n\n\ttempName := shortName(name, maxNameSize)\n\n\treturn p.AddBar(length,\n\t\tmpb.PrependDecorators(\n\t\t\tdecor.OnComplete(\n\t\t\t\tdecor.Name(tempName, decor.WC{W: maxNameSize + 2, C: decor.DidentRight}),\n\t\t\t\tname,\n\t\t\t),\n\t\t\tdecor.OnComplete(\n\t\t\t\tdecor.AverageSpeed(decor.UnitKB, \"%.2f\", decor.WC{W: 11, C: decor.DidentRight}),\n\t\t\t\t\"\",\n\t\t\t),\n\t\t\tdecor.OnComplete(\n\t\t\t\tdecor.CountersKiloByte(\"%.2f/%.2f\", decor.WC{W: 18, C: decor.DidentRight}),\n\t\t\t\t\"\",\n\t\t\t),\n\t\t),\n\t\tmpb.BarStyle(\" ██ █▒\"),\n\t\tmpb.AppendDecorators(\n\t\t\tdecor.OnComplete(\n\t\t\t\tdecor.Percentage(decor.WC{W: 5}), \"\"),\n\t\t),\n\t\tbarEnd,\n\t)\n}", "title": "" }, { "docid": "dfd67c778d1d4249171ba5b487019d21", "score": "0.5923595", "text": "func NewFormat(left, right string) Format {\n\treturn Format{Left: left, Right: right}\n}", "title": "" }, { "docid": "d508885e23000137b81373be73a5f9b9", "score": "0.5862221", "text": "func NewBar(beats, noteValue, tempo uint) *Bar {\n\treturn &Bar{\n\t\tBeats: beats,\n\t\tNoteValue: noteValue,\n\t\tTempo: tempo,\n\t}\n}", "title": "" }, { "docid": "406b3b10dfd1f4ac20ace0d277127cf2", "score": "0.5823574", "text": "func NewFormat(ctx context.Context, client *github.Client, debug bool) *Format {\n\treturn &Format{ctx: ctx, client: client, debug: debug}\n}", "title": "" }, { "docid": "5a1009c16477a367855e2d74524f29e0", "score": "0.58043516", "text": "func NewBar() *Bar {\n\treturn &Bar{}\n}", "title": "" }, { "docid": "7e676ffef5df493c2d8eeb810c80d765", "score": "0.57884693", "text": "func WithFormat(f string) augment {\n\treturn func(o *barOpts) {\n\t\to.formatString = f\n\t}\n}", "title": "" }, { "docid": "3a7935cf49a049405b59d2b44f705590", "score": "0.56575567", "text": "func NewWithOpts(opts ...func(o *barOpts)) *Bar {\n\to := &barOpts{\n\t\tstart: \"(\",\n\t\tcomplete: \"█\",\n\t\thead: \"█\",\n\t\tincomplete: \" \",\n\t\tend: \")\",\n\t\tformatString: defaultFormat,\n\t\tcallback: noop,\n\t\toutput: initializeStdout(),\n\t}\n\n\tfor _, aug := range opts {\n\t\taug(o)\n\t}\n\n\tif o.width <= 0 {\n\t\tpanic(fmt.Sprintf(\"a bar may not have a zero or negative width (received: %d)\", o.width))\n\t}\n\n\treturn &Bar{\n\t\tprogress: 0,\n\t\ttotal: o.total,\n\t\twidth: o.width,\n\t\tstart: o.start,\n\t\tcomplete: o.complete,\n\t\thead: o.head,\n\t\tincomplete: o.incomplete,\n\t\tend: o.end,\n\t\tclosed: false,\n\t\tstartedAt: time.Now(),\n\t\trate: 0,\n\t\tformatString: o.formatString,\n\t\tformat: tokenize(o.formatString, o.context.customVerbs()),\n\t\tcallback: o.callback,\n\t\toutput: o.output,\n\t\tcontext: o.context,\n\t\tdebug: o.debug,\n\t}\n}", "title": "" }, { "docid": "49d7dda39467752ed9ddfa0961e6fdef", "score": "0.562049", "text": "func createBar(limit int) *pb.ProgressBar {\n\ttmpl := `{{ blue \"Progress:\" }} {{ bar . \"[\" \"=\" (cycle . \">\") \".\" \"]\"}} {{speed . | green }} {{percent . | green}}`\n\tbar := pb.ProgressBarTemplate(tmpl).Start64(int64(limit))\n\treturn bar\n}", "title": "" }, { "docid": "fdbc77b5154847e24ba110bcb92a0a4a", "score": "0.5592835", "text": "func NewProgressBar(total int64) *ProgressBar {\n\treturn &ProgressBar{\n\t\ttotal: total,\n\t\tcurrent: 0,\n\t\tmutex: make(chan struct{}, 1),\n\t}\n}", "title": "" }, { "docid": "44dec67c0c68050a49f240dc3a4a2b5f", "score": "0.55287504", "text": "func New() *Fmt {\n\tf := new(Fmt);\n\tf.init();\n\treturn f;\n}", "title": "" }, { "docid": "91c01c48143287a1ae56d23ebd33e2fa", "score": "0.55261904", "text": "func New() *Formatter {\n\treturn &Formatter{\n\t\tformatter: DefaultFmter,\n\t}\n}", "title": "" }, { "docid": "4b67c8afd93a812645fd1fa9318a4227", "score": "0.5493962", "text": "func NewBar() Interface {\n\treturn new(Bar)\n}", "title": "" }, { "docid": "d20cc4ea11415981bf28e5bef1bac5d1", "score": "0.5485458", "text": "func newBarChart(ctx context.Context) (*barchart.BarChart, error) {\n\tbc, err := barchart.New(\n\t\tbarchart.BarColors([]cell.Color{\n\t\t\tcell.ColorNumber(33),\n\t\t\tcell.ColorNumber(39),\n\t\t\tcell.ColorNumber(45),\n\t\t\tcell.ColorNumber(51),\n\t\t\tcell.ColorNumber(81),\n\t\t\tcell.ColorNumber(87),\n\t\t}),\n\t\tbarchart.ValueColors([]cell.Color{\n\t\t\tcell.ColorBlack,\n\t\t\tcell.ColorBlack,\n\t\t\tcell.ColorBlack,\n\t\t\tcell.ColorBlack,\n\t\t\tcell.ColorBlack,\n\t\t\tcell.ColorBlack,\n\t\t}),\n\t\tbarchart.ShowValues(),\n\t)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tconst (\n\t\tbars = 6\n\t\tmax = 100\n\t)\n\tvalues := make([]int, bars)\n\tgo periodic(ctx, 1*time.Second, func() error {\n\t\tfor i := range values {\n\t\t\tvalues[i] = int(rand.Int31n(max + 1))\n\t\t}\n\n\t\treturn bc.Values(values, max)\n\t})\n\treturn bc, nil\n}", "title": "" }, { "docid": "92a2145cf5aa65da52ba6e614337ae95", "score": "0.5416585", "text": "func New() Formatter {\n\treturn NewOptions(DefaultOptions())\n}", "title": "" }, { "docid": "2dacec8ba763f5e2eb60410d425a3859", "score": "0.53610975", "text": "func NewTotaler(p out.Printer, w out.Writable) *Totaler {\n\treturn &Totaler{p: p, w: w}\n}", "title": "" }, { "docid": "1a12109436571cab917cdf2638baa8ef", "score": "0.53440017", "text": "func NewFormat(m, n uint) *Format {\n\twidth := uint(m + n)\n\tfractionalLsb := float64(uint(1 << n))\n\n\treturn &Format{\n\t\tm: m,\n\t\tn: n,\n\t\twidth: width,\n\t\tmask: mask(width),\n\t\tfractionalLsb: fractionalLsb,\n\t\tresolution: 1.0 / fractionalLsb,\n\t}\n}", "title": "" }, { "docid": "03ddf0701f2af88cb74ddeb58adbecc1", "score": "0.5327742", "text": "func newProgressBar(total int64) *barSend {\n\t// Progress bar speific theme customization.\n\tconsole.SetColor(\"Bar\", color.New(color.FgGreen, color.Bold))\n\n\tcmdCh := make(chan barMsg)\n\tfinishCh := make(chan bool)\n\tgo func(total int64, cmdCh <-chan barMsg, finishCh chan<- bool) {\n\t\tvar started bool // has the progress bar started? default is false.\n\t\tvar totalBytesRead int64 // total amounts of bytes read\n\n\t\t// get the new original progress bar.\n\t\tbar := pb.New64(total)\n\t\tbar.SetUnits(pb.U_BYTES)\n\n\t\t// refresh rate for progress bar is set to 125 milliseconds.\n\t\tbar.SetRefreshRate(time.Millisecond * 125)\n\n\t\t// Do not print a newline by default handled, it is handled manually.\n\t\tbar.NotPrint = true\n\n\t\t// Show current speed is true.\n\t\tbar.ShowSpeed = true\n\n\t\t// Custom callback with colorized bar.\n\t\tbar.Callback = func(s string) {\n\t\t\tconsole.Print(console.Colorize(\"Bar\", \"\\r\"+s))\n\t\t}\n\n\t\t// Use different unicodes for Linux, OS X and Windows.\n\t\tswitch runtime.GOOS {\n\t\tcase \"linux\":\n\t\t\tbar.Format(\"┃▓█░┃\")\n\t\t\t// bar.Format(\"█▓▒░█\")\n\t\tcase \"darwin\":\n\t\t\tbar.Format(\" ▓ ░ \")\n\t\tdefault:\n\t\t\tbar.Format(\"[=> ]\")\n\t\t}\n\n\t\t// Look for incoming progress bar messages.\n\t\tfor msg := range cmdCh {\n\t\t\tswitch msg.Op {\n\t\t\tcase pbBarSetCaption:\n\t\t\t\t// Sets a new caption prefixed along with progress bar.\n\t\t\t\tbar.Prefix(fixateBarCaption(msg.Arg.(string), getFixedWidth(bar.GetWidth(), 18)))\n\t\t\tcase pbBarProgress:\n\t\t\t\t// Initializes the progerss bar, if already started bumps up the totalBytes.\n\t\t\t\tif bar.Total > 0 && !started {\n\t\t\t\t\tstarted = true\n\t\t\t\t\tbar.Start()\n\t\t\t\t}\n\t\t\t\tif msg.Arg.(int64) > 0 {\n\t\t\t\t\ttotalBytesRead += msg.Arg.(int64)\n\t\t\t\t\tbar.Add64(msg.Arg.(int64))\n\t\t\t\t}\n\t\t\tcase pbBarPutError:\n\t\t\t\t// Negates any put error of size from totalBytes.\n\t\t\t\tif totalBytesRead > msg.Arg.(int64) {\n\t\t\t\t\tbar.Set64(totalBytesRead - msg.Arg.(int64))\n\t\t\t\t}\n\t\t\tcase pbBarGetError:\n\t\t\t\t// Retains any size transferred but failed.\n\t\t\t\tif msg.Arg.(int64) > 0 {\n\t\t\t\t\tbar.Add64(msg.Arg.(int64))\n\t\t\t\t}\n\t\t\tcase pbBarFinish:\n\t\t\t\t// Progress finishes here.\n\t\t\t\tif started {\n\t\t\t\t\tbar.Finish()\n\t\t\t\t}\n\t\t\t\t// All done send true.\n\t\t\t\tfinishCh <- true\n\t\t\t\treturn\n\t\t\t}\n\t\t}\n\t}(total, cmdCh, finishCh)\n\treturn &barSend{cmdCh, finishCh}\n}", "title": "" }, { "docid": "a55b28b9e4bbf22ab19490218894e9eb", "score": "0.53123933", "text": "func New(logger *log.Logger, format string) *Trash {\n\tt := &Trash{Logger: logger}\n\tswitch strings.ToLower(format) {\n\tcase \"json\":\n\t\tt.Type = \"json\"\n\t\tt.format = t.jsonErr\n\tcase \"xml\":\n\t\tt.Type = \"xml\"\n\t\tt.format = t.xmlErr\n\tdefault:\n\t\tlogger.Printf(\"[!] %s is a invalid format.\\n\", format)\n\t\treturn nil\n\t}\n\treturn t\n}", "title": "" }, { "docid": "6c2fb8279b6dbed46c36f4e9550740d1", "score": "0.52376294", "text": "func New() *Formatter {\n\tdefaultTabwriterOptions := &TabwriterOptions{\n\t\tMinwidth: 0,\n\t\tTabwidth: 8,\n\t\tPadding: 4,\n\t\tPadchar: ' ',\n\t\tDivchar: '-',\n\t}\n\treturn &Formatter{\n\t\tdefaultTabwriterOptions,\n\t}\n}", "title": "" }, { "docid": "d6a5bda8ed16c3d5874f626733198821", "score": "0.52150387", "text": "func Newf(c Code, format string, a ...interface{}) *Status {\n\treturn New(c, fmt.Sprintf(format, a...))\n}", "title": "" }, { "docid": "d30b3c47c2a83d88afd305be187ac2a9", "score": "0.5176954", "text": "func NewBuilder(format string) *Builder {\n\treturn &Builder{\n\t\tformat: format,\n\t}\n}", "title": "" }, { "docid": "b0e6dd77c1b10e0893a9d3ab62698e5e", "score": "0.51633584", "text": "func (ms *MemoryStorage) NewViewWithFormat(nbf string) ChunkStore {\n\tv := &MemoryStoreView{storage: ms, rootHash: ms.rootHash, version: nbf}\n\tv.gcCond = sync.NewCond(&v.mu)\n\treturn v\n}", "title": "" }, { "docid": "9bd96f9ef50fa5670815ccbfb6b08298", "score": "0.50375867", "text": "func newBasicFormatter(lang string) graph.MakeDefFormatter {\n\treturn func(s *graph.Def) graph.DefFormatter {\n\t\tvar si DefData\n\t\tif len(s.Data) > 0 {\n\t\t\tif err := json.Unmarshal(s.Data, &si); err != nil {\n\t\t\t\tpanic(\"unmarshal basic def data: \" + err.Error())\n\t\t\t}\n\t\t}\n\t\treturn basicFormatter{lang, s, &si}\n\t}\n}", "title": "" }, { "docid": "dc6c996d6abfe0b6730c3820da91adf7", "score": "0.501522", "text": "func NewWithFormat(name string, w io.Writer, format string) *Logger {\n\tl := new(Logger)\n\tl.name = name\n\tl.lv = NOTSET\n\tl.handlers = make(map[Handler]bool)\n\tif w != nil {\n\t\tf := NewBaseFormatter(IsTerminal(w))\n\t\terr := f.ParseFormat(format)\n\t\tif err != nil {\n\t\t\tpanic(err)\n\t\t}\n\t\thdr := NewStreamHandler(w, f)\n\t\tl.AddHandler(hdr)\n\t}\n\tl.recordFactory = NewBaseRecordFactory()\n\treturn l\n}", "title": "" }, { "docid": "eff6a84242694195cfc638280df7ab20", "score": "0.49958596", "text": "func Newf(format string, args ...interface{}) error { return errutil.NewWithDepthf(1, format, args...) }", "title": "" }, { "docid": "4b77a42546ed0977031e0f0121f5fed7", "score": "0.49927032", "text": "func New(format string, a ...interface{}) error {\n\treturn newError(format, a...)\n}", "title": "" }, { "docid": "bdc61e677dbc0cefb048df34addb4dcc", "score": "0.49883503", "text": "func Newf(code int, format string, args ...any) error {\n\treturn New(code, fmt.Sprintf(format, args...))\n}", "title": "" }, { "docid": "7204b5dcea20a1ecf20442389f3bc1f5", "score": "0.49855652", "text": "func New(p Position, f Formatter) *Axis {\n\treturn &Axis{\n\t\tposition: p,\n\t\tformat: f,\n\t}\n}", "title": "" }, { "docid": "bbe5b501351c3c924e075eee15557a24", "score": "0.4967963", "text": "func NewFormatting() *Formatting {\n\tfm := &Formatting{\n\t\tPretty: true,\n\t\tmonochrome: false,\n\t\tIndent: \" \",\n\t\tBool: color.New(color.FgYellow),\n\t\tBold: color.New(color.Bold),\n\t\tBytes: color.New(color.Faint),\n\t\tDatetime: color.New(color.FgGreen, color.Faint),\n\t\tError: color.New(color.FgRed, color.Bold),\n\t\tFaint: color.New(color.Faint),\n\t\tHandle: color.New(color.FgBlue),\n\t\tHeader: color.New(color.FgBlue, color.Bold),\n\t\tHilite: color.New(color.FgHiBlue),\n\t\tKey: color.New(color.FgBlue, color.Bold),\n\t\tNull: color.New(color.Faint),\n\t\tNumber: color.New(color.FgCyan),\n\t\tString: color.New(color.FgGreen),\n\t\tSuccess: color.New(color.FgGreen, color.Bold),\n\t\tPunc: color.New(color.Bold),\n\t}\n\n\tfm.EnableColor(true)\n\treturn fm\n}", "title": "" }, { "docid": "59ead268d1f1a457e95d727343c6c3b6", "score": "0.49105167", "text": "func New(\n totalLoan *money.Money,\n downPayment *money.Money,\n amortizationYear int64,\n annualInterestRate float64,\n paymentFrequency int64,\n compoundingPeriod int64,\n firstPaymentDate string,\n currency string) MortgageCalculator {\n mc := MortgageCalculator {\n totalLoan,\n downPayment,\n amortizationYear,\n annualInterestRate,\n paymentFrequency,\n compoundingPeriod,\n firstPaymentDate,\n currency,\n }\n return mc\n}", "title": "" }, { "docid": "e0b556428d2b85d2a863b9cdcd5d9e28", "score": "0.48993817", "text": "func NewBuilder(format token.Format) Builder {\n\treturn Builder{\n\t\tFormat: format,\n\t}\n}", "title": "" }, { "docid": "cd112fb803e0161c90bc2d6c7fa6fbc0", "score": "0.4884777", "text": "func (p *Progress) AddBar(total int64, options ...BarOption) *Bar {\n\tp.wg.Add(1)\n\tresult := make(chan *Bar, 1)\n\tselect {\n\tcase p.operateState <- func(s *pState) {\n\t\toptions = append(options, barWidth(s.width), barFormat(s.format))\n\t\tb := newBar(s.idCounter, total, p.wg, s.cancel, options...)\n\t\theap.Push(s.bHeap, b)\n\t\ts.heapUpdated = true\n\t\ts.idCounter++\n\t\tresult <- b\n\t}:\n\t\treturn <-result\n\tcase <-p.quit:\n\t\treturn new(Bar)\n\t}\n}", "title": "" }, { "docid": "c9def9d3dfd83d0d0c25095a9566cb54", "score": "0.4881179", "text": "func NewBarChart() *BarChart {\n\treturn &BarChart{\n\t\tBlock: *ui.NewBlock(),\n\t\tBarColors: ui.Theme.BarChart.Bars,\n\t\tNumStyles: ui.Theme.BarChart.Nums,\n\t\tLabelStyles: ui.Theme.BarChart.Labels,\n\t\tNumFormatter: func(n float64) string { return fmt.Sprint(n) },\n\t\tBarGap: 1,\n\t\tBarWidth: 3,\n\t}\n}", "title": "" }, { "docid": "f1bb7d2731cd8af4ddd8acfb323f5420", "score": "0.48789284", "text": "func newBB(period, offset int, stdev decimal.Decimal, price string, midMA ma.MA, stdevSMA sma.SMA) *bb {\n\treturn &bb{\n\t\tperiod: period,\n\t\toffset: offset,\n\t\tstdev: stdev,\n\t\tprice: price,\n\t\tmidMA: midMA,\n\t\tstdevSMA: stdevSMA,\n\t}\n}", "title": "" }, { "docid": "aacb508f9cd2bc66622b29c7e18edd0c", "score": "0.48461482", "text": "func Newf(code int, format string, a ...interface{}) *Error {\n\treturn New(code, fmt.Sprintf(format, a...))\n}", "title": "" }, { "docid": "a9c4a1baddce68fd87d4585e336d63b0", "score": "0.48084998", "text": "func (il *Intermediate) Format(name, f string, args ...interface{}) *Intermediate {\n\til.branch = appendFormat(il.branch, name, f, args...)\n\treturn il\n}", "title": "" }, { "docid": "45681ea59060b51d830dca87d5f57e6f", "score": "0.48069534", "text": "func New(period, offset int, stdev decimal.Decimal, maType, price string) (*bb, error) {\n\tif err := exchange.CandlePriceValid(price); err != nil {\n\t\treturn nil, err\n\t}\n\n\tmidMA, err := indicators.NewMA(maType, price, period, offset)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tstdevSMA, err := sma.New(period, offset, price)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn newBB(period, offset, stdev, price, midMA, stdevSMA), nil\n}", "title": "" }, { "docid": "6e1fb4e1ac5f10d9fef02c27ec393df8", "score": "0.4801406", "text": "func New(format string, analyzerConfig config.AnalyzerConfig, chglogConfig config.ChangelogConfig) (*Analyzer, error) {\n\tanalyzer := &Analyzer{\n\t\tAnalyzerConfig: analyzerConfig,\n\t\tChangelogConfig: chglogConfig,\n\t}\n\n\tswitch format {\n\tcase ANGULAR:\n\t\tanalyzer.analyzeCommits = newAngular()\n\t\tlog.Debugf(\"Commit format set to %s\", ANGULAR)\n\tcase CONVENTIONAL:\n\t\tanalyzer.analyzeCommits = newConventional(analyzerConfig)\n\t\tlog.Debugf(\"Commit format set to %s\", CONVENTIONAL)\n\tdefault:\n\t\treturn nil, fmt.Errorf(\"invalid commit format: %s\", format)\n\t}\n\treturn analyzer, nil\n}", "title": "" }, { "docid": "13fce0b1d2ef8feebf3833c04fc26385", "score": "0.47632068", "text": "func NewFormatValue(val Format, p *Format) *Format {\n\t*p = val\n\treturn (*Format)(p)\n}", "title": "" }, { "docid": "f972414c536850d58b639026d9ca6a11", "score": "0.4752269", "text": "func New(v int, cs string) (Amount, error) {\n\tc, e := appcurrency.New(cs)\n\tif e != nil {\n\t\treturn nil, e\n\t}\n\n\treturn &a{v, c}, nil\n}", "title": "" }, { "docid": "7cedf171a73acfe3666ae6678521b36c", "score": "0.4749968", "text": "func New(t StatusType, operation string, message string) StatusReport {\n\treturn []StatusItem{\n\t\t{\n\t\t\tVersion: \"1.0\",\n\t\t\tTimestampUTC: time.Now().UTC().Format(time.RFC3339),\n\t\t\tStatus: Status{\n\t\t\t\tOperation: operation,\n\t\t\t\tStatus: t,\n\t\t\t\tFormattedMessage: FormattedMessage{\n\t\t\t\t\tLang: \"en\",\n\t\t\t\t\tMessage: message},\n\t\t\t},\n\t\t},\n\t}\n}", "title": "" }, { "docid": "2f27078105d639b16e2537dd4dcb3b46", "score": "0.4739898", "text": "func newFoo(bar *barv1alpha1.Bar) *samplev1alpha1.Foo {\n\treturn &samplev1alpha1.Foo{\n\t\tObjectMeta: metav1.ObjectMeta{\n\t\t\tName: bar.Spec.FooName,\n\t\t\tNamespace: bar.Namespace,\n\t\t\tOwnerReferences: []metav1.OwnerReference{\n\t\t\t\t*metav1.NewControllerRef(bar, barv1alpha1.SchemeGroupVersion.WithKind(\"Bar\")),\n\t\t\t},\n\t\t},\n\t\tSpec: samplev1alpha1.FooSpec{\n\t\t\tDeploymentName: bar.Spec.FooName,\n\t\t\tReplicas: bar.Spec.Replicas,\n\t\t},\n\t}\n}", "title": "" }, { "docid": "3136897f54875de3980e523c5b09c3f6", "score": "0.47301644", "text": "func Newf(c codes.Code, tag ErrorTag, format string, a ...interface{}) *Status {\n\treturn New(c, tag, fmt.Sprintf(format, a...))\n}", "title": "" }, { "docid": "609f30f0107dc75893b2e7cf63fb2b84", "score": "0.4725208", "text": "func New(prefix string) Printer {\n\treturn Printer(prefix)\n}", "title": "" }, { "docid": "77359246d523f265d4a728f9f70e69bd", "score": "0.47248948", "text": "func Newf(format string, a ...interface{}) Error {\n\treturn Error{\n\t\tmsg: fmt.Sprintf(format, a...),\n\t}\n}", "title": "" }, { "docid": "e4e920cc88858bb1efc3947a3baa6c64", "score": "0.47210395", "text": "func StartNew(maxVal int, kwargs ...func(*Bar) error) (*Bar, error) {\n\tbar, err := New(maxVal, kwargs...)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tbar.Start()\n\treturn bar, nil\n}", "title": "" }, { "docid": "11ce10bd525f68edefac52be7314e863", "score": "0.47113165", "text": "func Newf(format string, v ...interface{}) *Error {\n\treturn New(fmt.Sprintf(format, v...))\n}", "title": "" }, { "docid": "da1ebfa92e4e6adec19cba79eeafee8a", "score": "0.47113112", "text": "func Newf(format string, args ...interface{}) Error {\n\tstack, context := StackTrace()\n\treturn &baseError{\n\t\tmessage: fmt.Sprintf(format, args...),\n\t\tstack: stack,\n\t\tcontext: context,\n\t\tcode: DefaultCode,\n\t}\n}", "title": "" }, { "docid": "f7eb0f1ea8dbabbf10fc69b7ebce6646", "score": "0.4704287", "text": "func NewFormatter(opts ...FormatOpt) *Formatter {\n\tf := defaultFormatter\n\tf.Config(opts...)\n\treturn &f\n}", "title": "" }, { "docid": "7144ffba2cd3e57f1760c839da496a94", "score": "0.46901134", "text": "func (a *CumulativeSumAggregation) Format(format string) *CumulativeSumAggregation {\n\ta.format = format\n\treturn a\n}", "title": "" }, { "docid": "1764996ba6707db3979ab5eb7bac3d5a", "score": "0.46590942", "text": "func NewDiskUsageFormat(source string, verbose bool) Format {\n\tswitch {\n\tcase verbose && source == RawFormatKey:\n\t\tformat := `{{range .Images}}type: Image\n` + NewImageFormat(source, false, true) + `\n{{end -}}\n{{range .Containers}}type: Container\n` + NewContainerFormat(source, false, true) + `\n{{end -}}\n{{range .Volumes}}type: Volume\n` + NewVolumeFormat(source, false) + `\n{{end -}}\n{{range .BuildCache}}type: Build Cache\n` + NewBuildCacheFormat(source, false) + `\n{{end -}}`\n\t\treturn format\n\tcase !verbose && source == TableFormatKey:\n\t\treturn Format(defaultDiskUsageTableFormat)\n\tcase !verbose && source == RawFormatKey:\n\t\tformat := `type: {{.Type}}\ntotal: {{.TotalCount}}\nactive: {{.Active}}\nsize: {{.Size}}\nreclaimable: {{.Reclaimable}}\n`\n\t\treturn Format(format)\n\tdefault:\n\t\treturn Format(source)\n\t}\n}", "title": "" }, { "docid": "c4ddf8832ce6fc47727569ac8bb9babf", "score": "0.46548903", "text": "func NewPrinter(format *Format) *Printer {\n\treturn &Printer{\n\t\tformat: format,\n\t}\n}", "title": "" }, { "docid": "ab0bdee952454c7f54c87d0900efc41a", "score": "0.4646552", "text": "func ProgressBar(count float64, total float64, suffix ...string) {\n barLen := 60\n filledLen := float64(barLen) * count / total\n\n percents := int((100 * count) / total)\n bar := strings.Repeat(\"#\", int(filledLen)) + strings.Repeat(\"_\", (int(barLen) - int(filledLen)))\n\n if suffix == nil {\n fmt.Printf(\"Building report tree [%s] %d%%\\r\", bar, percents) \n } else {\n fmt.Printf(\"Building report tree [%s] %d%% %s\\r\", bar, percents, suffix)\n }\n \n}", "title": "" }, { "docid": "7da5f6ba399d9a182e803e5e8f104285", "score": "0.46456864", "text": "func NewBudget(budget types.Currency) *RPCBudget {\n\treturn &RPCBudget{\n\t\tbudget: budget,\n\t}\n}", "title": "" }, { "docid": "a92cbd0368da6d34972d497f96afc0d8", "score": "0.4644343", "text": "func (w *Wx) Bar(in float64) {\n\tw.SetFloat(\"baromin\", in)\n}", "title": "" }, { "docid": "5d8f76f77f7f817c2ef2151647caf8b1", "score": "0.46361026", "text": "func NewBank() *Bank {\n\treturn &Bank{rates: make(map[Pair]int)}\n}", "title": "" }, { "docid": "a94a08d97a2c7581325a3522b75525d4", "score": "0.46204", "text": "func newFmtSubChunk() fmtSubChunk {\n\tresult := fmtSubChunk{SubChunkID: 0x20746d66, SubChunkSize: 16, AudioFormat: 1, NumChannels: 2, SampleRate: 48000, BitsPerSample: 16}\n\tresult.ByteRate = result.SampleRate * uint32(result.NumChannels) * uint32(result.BitsPerSample) / 8\n\tresult.BlockAlign = result.NumChannels * (result.BitsPerSample / 8)\n\treturn result\n}", "title": "" }, { "docid": "3e51370c1e81a61cd788916dc53a41e0", "score": "0.46123382", "text": "func newBill(n string) Bill {\n\tb := Bill{\n\t\tname: n,\n\t\titems: map[string]float64{},\n\t\ttip: 0,\n\t}\n\treturn b\n}", "title": "" }, { "docid": "b1c8bf1073606025037cabd3b409d7da", "score": "0.4610066", "text": "func New(previous Block, content fmt.Stringer) (Block, error) {\n\tvar newBlock Block\n\n\tnewBlock.Index = previous.Index + 1\n\tnewBlock.Timestamp = time.Now().String()\n\tnewBlock.Content = content\n\tnewBlock.PrevHash = previous.Hash\n\tnewBlock.Hash = newBlock.calculateHash()\n\n\treturn newBlock, nil\n}", "title": "" }, { "docid": "a6125467d4e0800de91ead035ef511b6", "score": "0.4591937", "text": "func NewProgress(total uint64) *Progress {\n\treturn &Progress{total: total}\n}", "title": "" }, { "docid": "ba15ae46e6964a8ce50d395c52ab2871", "score": "0.45427653", "text": "func New(fillrate float64, capacity float64, delay time.Duration) *Bucket {\n\treturn &Bucket{\n\t\tFillrate: fillrate,\n\t\tCapacity: capacity,\n\t\tAvailable: capacity,\n\t\tLastUpdate: time.Now(),\n\t\tDelay: delay,\n\t}\n}", "title": "" }, { "docid": "9a6b2c48f7a3b56453168a0cf967745a", "score": "0.45412242", "text": "func (v BudgetsResource) New(c buffalo.Context) error {\n\tbudget := &models.Budget{}\n\tif c.Param(\"event_id\") != \"\" {\n\t\tvar err error\n\t\tif budget.EventID, err = uuid.FromString(c.Param(\"event_id\")); err != nil {\n\t\t\treturn errors.WithStack(err)\n\t\t}\n\t}\n\tif c.Param(\"person_id\") != \"\" {\n\t\tvar err error\n\t\tif budget.PersonID, err = uuid.FromString(c.Param(\"person_id\")); err != nil {\n\t\t\treturn errors.WithStack(err)\n\t\t}\n\t}\n\t// Make budget available inside the html template\n\tc.Set(\"budget\", budget)\n\n\treturn c.Render(200, r.HTML(\"budgets/new.html\"))\n}", "title": "" }, { "docid": "5f921b7bb6eade1bfc4c2e5a16b1d266", "score": "0.4537852", "text": "func New(data []byte) *Parser {\n\treturn &Parser{\n\t\tbook: data,\n\t}\n}", "title": "" }, { "docid": "92085b42f16ce06e77dfbf235e03293b", "score": "0.4536866", "text": "func New(desc *export.Descriptor, boundaries []core.Number) *Aggregator {\n\t// Boundaries MUST be ordered otherwise the histogram could not\n\t// be properly computed.\n\tsortedBoundaries := numbers{\n\t\tnumbers: make([]core.Number, len(boundaries)),\n\t\tkind: desc.NumberKind(),\n\t}\n\n\tcopy(sortedBoundaries.numbers, boundaries)\n\tsort.Sort(&sortedBoundaries)\n\tboundaries = sortedBoundaries.numbers\n\n\tagg := Aggregator{\n\t\tkind: desc.NumberKind(),\n\t\tboundaries: boundaries,\n\t\tcurrent: state{\n\t\t\tbuckets: aggregator.Buckets{\n\t\t\t\tBoundaries: boundaries,\n\t\t\t\tCounts: make([]core.Number, len(boundaries)+1),\n\t\t\t},\n\t\t},\n\t\tcheckpoint: state{\n\t\t\tbuckets: aggregator.Buckets{\n\t\t\t\tBoundaries: boundaries,\n\t\t\t\tCounts: make([]core.Number, len(boundaries)+1),\n\t\t\t},\n\t\t},\n\t}\n\treturn &agg\n}", "title": "" }, { "docid": "090123471931226369cc387ddf459cfe", "score": "0.45175976", "text": "func NewStatusBar() *StatusBar {\n\tmode := &views.Text{}\n\tmode.SetStyle(styleStatusBarPods)\n\tpods := &views.Text{}\n\tpods.SetStyle(styleStatusBarPods)\n\tcontext := &views.Text{}\n\tcontext.SetAlignment(views.AlignMiddle)\n\tcontext.SetStyle(styleStatusBarContext)\n\tscroll := &views.Text{}\n\tscroll.SetStyle(styleStatusBarScroll)\n\n\tw := &StatusBar{\n\t\tmode: mode,\n\t\tpods: pods,\n\t\tcontext: context,\n\t\tscroll: scroll,\n\t}\n\tw.AddWidget(mode, 0)\n\tw.AddWidget(pods, 0)\n\tw.AddWidget(context, 1)\n\tw.AddWidget(scroll, 0)\n\treturn w\n}", "title": "" }, { "docid": "bc4945fb27a6232533d7b4ca6e1cea6d", "score": "0.45112145", "text": "func Newf(format string, args ...interface{}) error {\n\treturn fmt.Errorf(format, args...)\n}", "title": "" }, { "docid": "49f038a87b2058ed09378a0253bc255b", "score": "0.44978774", "text": "func NewWorkbookChartAxisFormat()(*WorkbookChartAxisFormat) {\n m := &WorkbookChartAxisFormat{\n Entity: *NewEntity(),\n }\n return m\n}", "title": "" }, { "docid": "149c8bba1402adb3e9f179073586e01c", "score": "0.44931948", "text": "func NewChain(f Formatter) *Chain { return &Chain{formatter: f} }", "title": "" }, { "docid": "b0ec7efbfed649c347b83169f674ef5c", "score": "0.44835338", "text": "func NewFormatter() *Formatter {\n\treturn &Formatter{\n\t\tSpaceColor: DefaultSpaceColor,\n\t\tCommaColor: DefaultCommaColor,\n\t\tColonColor: DefaultColonColor,\n\t\tObjectColor: DefaultObjectColor,\n\t\tArrayColor: DefaultArrayColor,\n\t\tFieldQuoteColor: DefaultFieldQuoteColor,\n\t\tFieldColor: DefaultFieldColor,\n\t\tStringQuoteColor: DefaultStringQuoteColor,\n\t\tStringColor: DefaultStringColor,\n\t\tTrueColor: DefaultTrueColor,\n\t\tFalseColor: DefaultFalseColor,\n\t\tNumberColor: DefaultNumberColor,\n\t\tNullColor: DefaultNullColor,\n\t\tPrefix: DefaultPrefix,\n\t\tIndent: DefaultIndent,\n\t}\n}", "title": "" }, { "docid": "396ee533284608ff8c73200bd1adf653", "score": "0.44814837", "text": "func (p *ProgressbarPrinter) Add(count int) *ProgressbarPrinter {\n\tif p.Total == 0 {\n\t\treturn nil\n\t}\n\n\tp.Current += count\n\tp.updateProgress()\n\n\tif p.Current >= p.Total {\n\t\tp.Total = p.Current\n\t\tp.updateProgress()\n\t\tp.Stop()\n\t}\n\treturn p\n}", "title": "" }, { "docid": "9c28e43f412ae7414ad2b41350447d7d", "score": "0.44740433", "text": "func NewBuilder(c *gin.Context, code int, obj interface{}) IFormatResponse {\n\tnotSupport := &NotSupportFormat{&FormatResponse{c: c, code: code, obj: obj}}\n\tjson := &JSON{&FormatResponse{c: c, code: code, next: notSupport, obj: obj}}\n\txml := &XML{&FormatResponse{c: c, next: json, code: code, obj: obj}}\n\tyml := &YAML{&FormatResponse{c: c, next: xml, code: code, obj: obj}}\n\n\treturn yml\n}", "title": "" }, { "docid": "b7174f906f34a548c70131911f0098d7", "score": "0.44729596", "text": "func NewWorkbookChartPointFormat()(*WorkbookChartPointFormat) {\n m := &WorkbookChartPointFormat{\n Entity: *NewEntity(),\n }\n return m\n}", "title": "" }, { "docid": "0df60da0fe715acfc63f7381aca5fc39", "score": "0.44628236", "text": "func New() Printer {\n\treturn &printer{}\n}", "title": "" }, { "docid": "024a349454b2620d9ac79255f368ccc8", "score": "0.44569546", "text": "func New(val int64, prec int) Amount {\n\tif prec < 0 {\n\t\tprec = 0\n\t}\n\treturn Amount{\n\t\tval: val,\n\t\tprec: prec,\n\t}\n}", "title": "" }, { "docid": "be2a447dbe709bbd61f2d260a332d695", "score": "0.44512317", "text": "func NewFormatter(writer io.Writer, indentSeparator string) *Formatter {\n\treturn &Formatter{w: writer, indentSeparator: indentSeparator}\n}", "title": "" }, { "docid": "2b11c66c73937d17c0880add433fd442", "score": "0.4448078", "text": "func (ab *accessLogBuilder) Format(format string) *accessLogBuilder {\n\tab.format = format\n\treturn ab\n}", "title": "" }, { "docid": "9988cc7bfbdca291285dc514c0e5cae9", "score": "0.444687", "text": "func (b *Bill) Format() string {\n\tfs := b.name + \"'s Bill Breakdown:\\n\"\n\ttotal := 0.0\n\t// Cycle through items on Bill\n\tfor k, v := range b.items {\n\t\tfs += fmt.Sprintf(\"%v: %v\\n\", k, v)\n\t\ttotal += v\n\t}\n\t// Add Tip\n\tif b.tip != 0 {\n\t\tfs += fmt.Sprintf(\"Tip: %0.2f\\n\", b.tip)\n\t\ttotal += b.tip\n\t}\n\tfs += fmt.Sprintf(\"Total: %0.2f\\n\", total)\n\treturn fs\n}", "title": "" }, { "docid": "bb43120ef83d853515f06bca920f77c4", "score": "0.44424453", "text": "func NewProgressBarManager(w io.Writer, waitTime time.Duration) *Manager {\n\treturn &Manager{\n\t\twaitTime: waitTime,\n\t\twriter: w,\n\t\tbarsLock: &sync.Mutex{},\n\t}\n}", "title": "" }, { "docid": "a9242dbe0de5db29ae01d3cd7b573035", "score": "0.4442045", "text": "func New(transport runtime.ClientTransport, formats strfmt.Registry) *Openbanking {\n\t// ensure nullable parameters have default\n\tif formats == nil {\n\t\tformats = strfmt.Default\n\t}\n\n\tcli := new(Openbanking)\n\tcli.Transport = transport\n\tcli.AccountAccess = account_access.New(transport, formats)\n\tcli.Accounts = accounts.New(transport, formats)\n\tcli.Balances = balances.New(transport, formats)\n\tcli.Beneficiaries = beneficiaries.New(transport, formats)\n\tcli.DirectDebits = direct_debits.New(transport, formats)\n\tcli.Offers = offers.New(transport, formats)\n\tcli.Parties = parties.New(transport, formats)\n\tcli.Products = products.New(transport, formats)\n\tcli.ScheduledPayments = scheduled_payments.New(transport, formats)\n\tcli.StandingOrders = standing_orders.New(transport, formats)\n\tcli.Statements = statements.New(transport, formats)\n\tcli.Transactions = transactions.New(transport, formats)\n\treturn cli\n}", "title": "" }, { "docid": "1fdddd6a0b0270d7a965aedb23d0dfd5", "score": "0.44411775", "text": "func Newf(c ErrorCode, err error, format string, args ...interface{}) *Error {\n\treturn New(c, err, 2, fmt.Sprintf(format, args...))\n}", "title": "" }, { "docid": "f0a50400b91fcbbe68a9678db8924f51", "score": "0.4436663", "text": "func New(ctx context.Context, cfg *config.Config) Compressor {\n\tswitch cfg.CompressionConfig.Format {\n\tcase \"tar\":\n\t\treturn NewTarCompressor(ctx, cfg)\n\tdefault:\n\t\treturn NewZipCompressor(ctx, cfg)\n\t}\n}", "title": "" }, { "docid": "87d1808fc423a6f95220c488f66ca210", "score": "0.4436221", "text": "func NewFormatter(formatter string) *Formatter {\n\tif len(formatter) == 0 {\n\t\treturn New()\n\t}\n\n\treturn &Formatter{\n\t\tformatter: formatter,\n\t}\n}", "title": "" }, { "docid": "dbb82e7ad2f3d64fbaa55d64c0f8fac1", "score": "0.44273704", "text": "func NewWithDepthf(depth int, format string, args ...interface{}) error {\n\treturn errutil.NewWithDepthf(depth+1, format, args...)\n}", "title": "" }, { "docid": "8e2881bde4dcee4a2b3390c67fd46953", "score": "0.4426026", "text": "func NewBarService(dao barDao) *BarService {\n\treturn &BarService{dao}\n}", "title": "" }, { "docid": "d50f8eb325e537742c1d526971065b3e", "score": "0.44253522", "text": "func NewProgress() *Progress {\n\treturn (&Progress{template: ProgressBasicTemplate, width: int64(10), interval: time.Second})\n}", "title": "" }, { "docid": "c42b2b8e69e0cf012cc41be80e23aa03", "score": "0.44241583", "text": "func NewHistoryFormat(source string, quiet bool, human bool) formatter.Format {\n\tswitch source {\n\tcase formatter.TableFormatKey:\n\t\tswitch {\n\t\tcase quiet:\n\t\t\treturn formatter.DefaultQuietFormat\n\t\tcase !human:\n\t\t\treturn nonHumanHistoryTableFormat\n\t\tdefault:\n\t\t\treturn defaultHistoryTableFormat\n\t\t}\n\t}\n\n\treturn formatter.Format(source)\n}", "title": "" }, { "docid": "c30cf821d6fce43940504a2ab9257ec7", "score": "0.44220328", "text": "func NewBinnedBars(vals []float64, bins Binning) *BinnedBars {\n\tcpy, err := plotter.CopyValues( (plotter.Values)(vals) )\n\tif err != nil {\n\t\tlog.Fatalf(\"cannot copy values\")\n\t}\n\t\n\treturn &BinnedBars{\n\t\tBinning: bins,\n\t\tValues: cpy,\n\t}\n}", "title": "" }, { "docid": "37e76265b93d6952fe8a85b84a8f65f5", "score": "0.4421386", "text": "func NewItemRetentionLabel()(*ItemRetentionLabel) {\n m := &ItemRetentionLabel{\n Entity: *NewEntity(),\n }\n return m\n}", "title": "" }, { "docid": "02456c7c07b6e99689fdcfc3e59e0cb3", "score": "0.44210258", "text": "func (a Amount) Format(u AmountUnit) string {\n\tunits := \" \" + u.String()\n\treturn strconv.FormatFloat(a.ToUnit(u), 'f', -int(u+8), 64) + units\n}", "title": "" }, { "docid": "f000238f3ab22557492e196bf7e603fb", "score": "0.4401533", "text": "func NewProtobuf(ctx context.Context) Format {\n\treturn &protobuf{\n\t\tLayout: topics.New(ctx),\n\t}\n}", "title": "" }, { "docid": "85e72b3056241b111a1f05157b68de7c", "score": "0.43984166", "text": "func Newf(code int, format string, args ...interface{}) error {\n\treturn httpErr{code: code, msg: fmt.Sprintf(format, args...)}\n}", "title": "" }, { "docid": "8a08b537e6ab8d0c7897e804ad975051", "score": "0.43955162", "text": "func New(testObj testing.TB) TB {\n\treturn &tb{tb: testObj}\n}", "title": "" }, { "docid": "2d2b46c67a5b409186ed4ed103f3ee55", "score": "0.43873897", "text": "func (cp CodePair) Format(vals ...interface{}) CodePair {\n ncp := new(CodePair)\n ncp.Code = cp.Code\n ncp.Msg = fmt.Sprintf(cp.Msg, vals...)\n return *ncp\n}", "title": "" }, { "docid": "4babdefc01e9743d5f1b884e338edbe6", "score": "0.43784747", "text": "func New(repository repository.Repository) *Bus {\n\treturn &Bus{repository: repository}\n}", "title": "" }, { "docid": "094f9404294d015d92ca3bcb95300d8b", "score": "0.43726167", "text": "func NewBarGroupClient(c config) *BarGroupClient {\n\treturn &BarGroupClient{config: c}\n}", "title": "" }, { "docid": "7519a718e1763ccc4788649aa8cad59a", "score": "0.43708777", "text": "func New(btype Type) (Bench, error) {\n\tswitch btype {\n\tcase Limit:\n\t\treturn &LimitBench{\n\t\t\tstate: Created,\n\t\t}, nil\n\tcase Custom:\n\t\treturn &CustomBench{\n\t\t\tstate: Created,\n\t\t}, nil\n\tdefault:\n\t\treturn nil, fmt.Errorf(\"No such benchmark type: %v\", btype)\n\t}\n}", "title": "" }, { "docid": "985cafd850dbc1a507466a3765fe9241", "score": "0.43670332", "text": "func New(Numerator int64, Denominator ...int64) Fraction {\n\tswitch len(Denominator) {\n\tcase 0:\n\t\treturn fraction{Numerator, 1}\n\tcase 1:\n\t\treturn fraction{Numerator, Denominator[0]}\n\tdefault:\n\t\tpanic(\"improper use of NewFraction, can only have one denominator\")\n\t}\n}", "title": "" } ]
303a0f5c2b126aed6c0f2000d9d56d6d
Varbittypmodin calls the stored procedure 'pg_catalog.varbittypmodin(cstring[]) integer' on db.
[ { "docid": "ee3ddd282693a45b3bf7d15b48b562c4", "score": "0.8635772", "text": "func Varbittypmodin(db XODB, v0 []pgtypes.Cstring) (int, error) {\n\tvar err error\n\n\t// sql query\n\tconst sqlstr = `SELECT pg_catalog.varbittypmodin($1)`\n\n\t// run query\n\tvar ret int\n\tXOLog(sqlstr, v0)\n\terr = db.QueryRow(sqlstr, v0).Scan(&ret)\n\tif err != nil {\n\t\treturn 0, err\n\t}\n\n\treturn ret, nil\n}", "title": "" } ]
[ { "docid": "826c36d2abd30bfbb0a8204dc2831d22", "score": "0.75035614", "text": "func Bittypmodin(db XODB, v0 []pgtypes.Cstring) (int, error) {\n\tvar err error\n\n\t// sql query\n\tconst sqlstr = `SELECT pg_catalog.bittypmodin($1)`\n\n\t// run query\n\tvar ret int\n\tXOLog(sqlstr, v0)\n\terr = db.QueryRow(sqlstr, v0).Scan(&ret)\n\tif err != nil {\n\t\treturn 0, err\n\t}\n\n\treturn ret, nil\n}", "title": "" }, { "docid": "617f241f2fc275af6e8685d9a020d503", "score": "0.7055899", "text": "func Varbittypmodout(db XODB, v0 int) (pgtypes.Cstring, error) {\n\tvar err error\n\n\t// sql query\n\tconst sqlstr = `SELECT pg_catalog.varbittypmodout($1)`\n\n\t// run query\n\tvar ret pgtypes.Cstring\n\tXOLog(sqlstr, v0)\n\terr = db.QueryRow(sqlstr, v0).Scan(&ret)\n\tif err != nil {\n\t\treturn pgtypes.Cstring{}, err\n\t}\n\n\treturn ret, nil\n}", "title": "" }, { "docid": "a7b89d620f0468651a563770121fe1f4", "score": "0.68936086", "text": "func VarbitIn(db XODB, v0 pgtypes.Cstring, v1 pgtypes.Oid, v2 int) ([]byte, error) {\n\tvar err error\n\n\t// sql query\n\tconst sqlstr = `SELECT pg_catalog.varbit_in($1, $2, $3)`\n\n\t// run query\n\tvar ret []byte\n\tXOLog(sqlstr, v0, v1, v2)\n\terr = db.QueryRow(sqlstr, v0, v1, v2).Scan(&ret)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn ret, nil\n}", "title": "" }, { "docid": "01b008d6a9f1edcb372b993e44900f4d", "score": "0.6378346", "text": "func Varchartypmodin(db XODB, v0 []pgtypes.Cstring) (int, error) {\n\tvar err error\n\n\t// sql query\n\tconst sqlstr = `SELECT pg_catalog.varchartypmodin($1)`\n\n\t// run query\n\tvar ret int\n\tXOLog(sqlstr, v0)\n\terr = db.QueryRow(sqlstr, v0).Scan(&ret)\n\tif err != nil {\n\t\treturn 0, err\n\t}\n\n\treturn ret, nil\n}", "title": "" }, { "docid": "4de6a07fb8ad8fbab6e195a1252145f8", "score": "0.62252396", "text": "func Timestamptypmodin(db XODB, v0 []pgtypes.Cstring) (int, error) {\n\tvar err error\n\n\t// sql query\n\tconst sqlstr = `SELECT pg_catalog.timestamptypmodin($1)`\n\n\t// run query\n\tvar ret int\n\tXOLog(sqlstr, v0)\n\terr = db.QueryRow(sqlstr, v0).Scan(&ret)\n\tif err != nil {\n\t\treturn 0, err\n\t}\n\n\treturn ret, nil\n}", "title": "" }, { "docid": "05a448a34a189674ca2021034d7b446f", "score": "0.61230063", "text": "func Numerictypmodin(db XODB, v0 []pgtypes.Cstring) (int, error) {\n\tvar err error\n\n\t// sql query\n\tconst sqlstr = `SELECT pg_catalog.numerictypmodin($1)`\n\n\t// run query\n\tvar ret int\n\tXOLog(sqlstr, v0)\n\terr = db.QueryRow(sqlstr, v0).Scan(&ret)\n\tif err != nil {\n\t\treturn 0, err\n\t}\n\n\treturn ret, nil\n}", "title": "" }, { "docid": "5b137dfc390a490b9a067872108d9709", "score": "0.6089251", "text": "func Varbit(db XODB, v0 []byte, v1 int, v2 bool) ([]byte, error) {\n\tvar err error\n\n\t// sql query\n\tconst sqlstr = `SELECT pg_catalog.varbit($1, $2, $3)`\n\n\t// run query\n\tvar ret []byte\n\tXOLog(sqlstr, v0, v1, v2)\n\terr = db.QueryRow(sqlstr, v0, v1, v2).Scan(&ret)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn ret, nil\n}", "title": "" }, { "docid": "470788026b31f87e799007ee109636cc", "score": "0.6008181", "text": "func Intervaltypmodin(db XODB, v0 []pgtypes.Cstring) (int, error) {\n\tvar err error\n\n\t// sql query\n\tconst sqlstr = `SELECT pg_catalog.intervaltypmodin($1)`\n\n\t// run query\n\tvar ret int\n\tXOLog(sqlstr, v0)\n\terr = db.QueryRow(sqlstr, v0).Scan(&ret)\n\tif err != nil {\n\t\treturn 0, err\n\t}\n\n\treturn ret, nil\n}", "title": "" }, { "docid": "02039a29054ec52498d3f7a130bd059f", "score": "0.59377426", "text": "func Timetypmodin(db XODB, v0 []pgtypes.Cstring) (int, error) {\n\tvar err error\n\n\t// sql query\n\tconst sqlstr = `SELECT pg_catalog.timetypmodin($1)`\n\n\t// run query\n\tvar ret int\n\tXOLog(sqlstr, v0)\n\terr = db.QueryRow(sqlstr, v0).Scan(&ret)\n\tif err != nil {\n\t\treturn 0, err\n\t}\n\n\treturn ret, nil\n}", "title": "" }, { "docid": "1dfc5881b6ec60c7780192af40a5a7e0", "score": "0.5671916", "text": "func Timetztypmodin(db XODB, v0 []pgtypes.Cstring) (int, error) {\n\tvar err error\n\n\t// sql query\n\tconst sqlstr = `SELECT pg_catalog.timetztypmodin($1)`\n\n\t// run query\n\tvar ret int\n\tXOLog(sqlstr, v0)\n\terr = db.QueryRow(sqlstr, v0).Scan(&ret)\n\tif err != nil {\n\t\treturn 0, err\n\t}\n\n\treturn ret, nil\n}", "title": "" }, { "docid": "522011d9c4ea43e7bc25a49c71d09cfe", "score": "0.56079906", "text": "func Bittypmodout(db XODB, v0 int) (pgtypes.Cstring, error) {\n\tvar err error\n\n\t// sql query\n\tconst sqlstr = `SELECT pg_catalog.bittypmodout($1)`\n\n\t// run query\n\tvar ret pgtypes.Cstring\n\tXOLog(sqlstr, v0)\n\terr = db.QueryRow(sqlstr, v0).Scan(&ret)\n\tif err != nil {\n\t\treturn pgtypes.Cstring{}, err\n\t}\n\n\treturn ret, nil\n}", "title": "" }, { "docid": "e53892d3c64e9837884e07621e367fe4", "score": "0.5607697", "text": "func Timestamptztypmodin(db XODB, v0 []pgtypes.Cstring) (int, error) {\n\tvar err error\n\n\t// sql query\n\tconst sqlstr = `SELECT pg_catalog.timestamptztypmodin($1)`\n\n\t// run query\n\tvar ret int\n\tXOLog(sqlstr, v0)\n\terr = db.QueryRow(sqlstr, v0).Scan(&ret)\n\tif err != nil {\n\t\treturn 0, err\n\t}\n\n\treturn ret, nil\n}", "title": "" }, { "docid": "6e5fc12eb2e6b811b8961ce3288842b6", "score": "0.56046355", "text": "func Varbitlt(db XODB, v0 []byte, v1 []byte) (bool, error) {\n\tvar err error\n\n\t// sql query\n\tconst sqlstr = `SELECT pg_catalog.varbitlt($1, $2)`\n\n\t// run query\n\tvar ret bool\n\tXOLog(sqlstr, v0, v1)\n\terr = db.QueryRow(sqlstr, v0, v1).Scan(&ret)\n\tif err != nil {\n\t\treturn false, err\n\t}\n\n\treturn ret, nil\n}", "title": "" }, { "docid": "426203f21d46800aeee55f166e3e372e", "score": "0.5439678", "text": "func Varbitcmp(db XODB, v0 []byte, v1 []byte) (int, error) {\n\tvar err error\n\n\t// sql query\n\tconst sqlstr = `SELECT pg_catalog.varbitcmp($1, $2)`\n\n\t// run query\n\tvar ret int\n\tXOLog(sqlstr, v0, v1)\n\terr = db.QueryRow(sqlstr, v0, v1).Scan(&ret)\n\tif err != nil {\n\t\treturn 0, err\n\t}\n\n\treturn ret, nil\n}", "title": "" }, { "docid": "2ca0d8f24debaed67fd2e7b891085f73", "score": "0.5409036", "text": "func Regtypein(db XODB, v0 pgtypes.Cstring) (pgtypes.Regtype, error) {\n\tvar err error\n\n\t// sql query\n\tconst sqlstr = `SELECT pg_catalog.regtypein($1)`\n\n\t// run query\n\tvar ret pgtypes.Regtype\n\tXOLog(sqlstr, v0)\n\terr = db.QueryRow(sqlstr, v0).Scan(&ret)\n\tif err != nil {\n\t\treturn pgtypes.Regtype{}, err\n\t}\n\n\treturn ret, nil\n}", "title": "" }, { "docid": "8ce9f89c117e8488a7aa1b5aa55f6cb8", "score": "0.53501296", "text": "func Bpchartypmodin(db XODB, v0 []pgtypes.Cstring) (int, error) {\n\tvar err error\n\n\t// sql query\n\tconst sqlstr = `SELECT pg_catalog.bpchartypmodin($1)`\n\n\t// run query\n\tvar ret int\n\tXOLog(sqlstr, v0)\n\terr = db.QueryRow(sqlstr, v0).Scan(&ret)\n\tif err != nil {\n\t\treturn 0, err\n\t}\n\n\treturn ret, nil\n}", "title": "" }, { "docid": "9030219f36ad95cd67ae7f69ef70e36d", "score": "0.5222579", "text": "func VarbitTransform(db XODB, v0 pgtypes.Internal) (pgtypes.Internal, error) {\n\tvar err error\n\n\t// sql query\n\tconst sqlstr = `SELECT pg_catalog.varbit_transform($1)`\n\n\t// run query\n\tvar ret pgtypes.Internal\n\tXOLog(sqlstr, v0)\n\terr = db.QueryRow(sqlstr, v0).Scan(&ret)\n\tif err != nil {\n\t\treturn pgtypes.Internal{}, err\n\t}\n\n\treturn ret, nil\n}", "title": "" }, { "docid": "574dc350b8d27910d9654327d61444b9", "score": "0.5212912", "text": "func VarbitOut(db XODB, v0 []byte) (pgtypes.Cstring, error) {\n\tvar err error\n\n\t// sql query\n\tconst sqlstr = `SELECT pg_catalog.varbit_out($1)`\n\n\t// run query\n\tvar ret pgtypes.Cstring\n\tXOLog(sqlstr, v0)\n\terr = db.QueryRow(sqlstr, v0).Scan(&ret)\n\tif err != nil {\n\t\treturn pgtypes.Cstring{}, err\n\t}\n\n\treturn ret, nil\n}", "title": "" }, { "docid": "ae5f206ca51c829dd0485e16801135b3", "score": "0.5156412", "text": "func VarbitSend(db XODB, v0 []byte) ([]byte, error) {\n\tvar err error\n\n\t// sql query\n\tconst sqlstr = `SELECT pg_catalog.varbit_send($1)`\n\n\t// run query\n\tvar ret []byte\n\tXOLog(sqlstr, v0)\n\terr = db.QueryRow(sqlstr, v0).Scan(&ret)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn ret, nil\n}", "title": "" }, { "docid": "47e081fd8f8324c16e38eb0072ee54c3", "score": "0.5146427", "text": "func Int2vectorin(db XODB, v0 pgtypes.Cstring) (pgtypes.Int2vector, error) {\n\tvar err error\n\n\t// sql query\n\tconst sqlstr = `SELECT pg_catalog.int2vectorin($1)`\n\n\t// run query\n\tvar ret pgtypes.Int2vector\n\tXOLog(sqlstr, v0)\n\terr = db.QueryRow(sqlstr, v0).Scan(&ret)\n\tif err != nil {\n\t\treturn pgtypes.Int2vector{}, err\n\t}\n\n\treturn ret, nil\n}", "title": "" }, { "docid": "5952f3a0c9ff50c96b890b94be00c05e", "score": "0.5099586", "text": "func Tsvectorin(db XODB, v0 pgtypes.Cstring) (pgtypes.Tsvector, error) {\n\tvar err error\n\n\t// sql query\n\tconst sqlstr = `SELECT pg_catalog.tsvectorin($1)`\n\n\t// run query\n\tvar ret pgtypes.Tsvector\n\tXOLog(sqlstr, v0)\n\terr = db.QueryRow(sqlstr, v0).Scan(&ret)\n\tif err != nil {\n\t\treturn pgtypes.Tsvector{}, err\n\t}\n\n\treturn ret, nil\n}", "title": "" }, { "docid": "621d643004544d49de7eae931f1f7312", "score": "0.5060093", "text": "func BigIntIn(vs ...schema.BigInt) predicate.FieldType {\n\treturn predicate.FieldType(func(t *dsl.Traversal) {\n\t\tt.Has(Label, FieldBigInt, p.Within(vs...))\n\t})\n}", "title": "" }, { "docid": "3626681a9dbc6b47bd16f14254b1e4cb", "score": "0.50498825", "text": "func Varbitge(db XODB, v0 []byte, v1 []byte) (bool, error) {\n\tvar err error\n\n\t// sql query\n\tconst sqlstr = `SELECT pg_catalog.varbitge($1, $2)`\n\n\t// run query\n\tvar ret bool\n\tXOLog(sqlstr, v0, v1)\n\terr = db.QueryRow(sqlstr, v0, v1).Scan(&ret)\n\tif err != nil {\n\t\treturn false, err\n\t}\n\n\treturn ret, nil\n}", "title": "" }, { "docid": "69998e5652867794df38b308770d3379", "score": "0.5022985", "text": "func VarbitRecv(db XODB, v0 pgtypes.Internal, v1 pgtypes.Oid, v2 int) ([]byte, error) {\n\tvar err error\n\n\t// sql query\n\tconst sqlstr = `SELECT pg_catalog.varbit_recv($1, $2, $3)`\n\n\t// run query\n\tvar ret []byte\n\tXOLog(sqlstr, v0, v1, v2)\n\terr = db.QueryRow(sqlstr, v0, v1, v2).Scan(&ret)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn ret, nil\n}", "title": "" }, { "docid": "af1f7dff0587efd3cc37739d77d2fee7", "score": "0.49564722", "text": "func Regprocin(db XODB, v0 pgtypes.Cstring) (pgtypes.Regproc, error) {\n\tvar err error\n\n\t// sql query\n\tconst sqlstr = `SELECT pg_catalog.regprocin($1)`\n\n\t// run query\n\tvar ret pgtypes.Regproc\n\tXOLog(sqlstr, v0)\n\terr = db.QueryRow(sqlstr, v0).Scan(&ret)\n\tif err != nil {\n\t\treturn pgtypes.Regproc{}, err\n\t}\n\n\treturn ret, nil\n}", "title": "" }, { "docid": "53795800a016dcf752fef40c450cfa2b", "score": "0.49294677", "text": "func Varbitgt(db XODB, v0 []byte, v1 []byte) (bool, error) {\n\tvar err error\n\n\t// sql query\n\tconst sqlstr = `SELECT pg_catalog.varbitgt($1, $2)`\n\n\t// run query\n\tvar ret bool\n\tXOLog(sqlstr, v0, v1)\n\terr = db.QueryRow(sqlstr, v0, v1).Scan(&ret)\n\tif err != nil {\n\t\treturn false, err\n\t}\n\n\treturn ret, nil\n}", "title": "" }, { "docid": "e7825936b834bade73e7b0c43594ad99", "score": "0.49225706", "text": "func Regprocedurein(db XODB, v0 pgtypes.Cstring) (pgtypes.Regprocedure, error) {\n\tvar err error\n\n\t// sql query\n\tconst sqlstr = `SELECT pg_catalog.regprocedurein($1)`\n\n\t// run query\n\tvar ret pgtypes.Regprocedure\n\tXOLog(sqlstr, v0)\n\terr = db.QueryRow(sqlstr, v0).Scan(&ret)\n\tif err != nil {\n\t\treturn pgtypes.Regprocedure{}, err\n\t}\n\n\treturn ret, nil\n}", "title": "" }, { "docid": "6a57e4f0e09bf3fc09a77508e1ea2695", "score": "0.48535737", "text": "func AnynonarrayIn(db XODB, v0 pgtypes.Cstring) (pgtypes.Anynonarray, error) {\n\tvar err error\n\n\t// sql query\n\tconst sqlstr = `SELECT pg_catalog.anynonarray_in($1)`\n\n\t// run query\n\tvar ret pgtypes.Anynonarray\n\tXOLog(sqlstr, v0)\n\terr = db.QueryRow(sqlstr, v0).Scan(&ret)\n\tif err != nil {\n\t\treturn pgtypes.Anynonarray{}, err\n\t}\n\n\treturn ret, nil\n}", "title": "" }, { "docid": "4a81e23271a3887916daa812f9c453ea", "score": "0.48455486", "text": "func EncodeVarNum(in uint64) []byte {\n\tif in <= 0xFC {\n\t\t// This is just here to avoid having to write this condition in every other conditional.\n\t\treturn []byte{byte(in)}\n\t} else if in <= 0xFFFF {\n\t\tbytes := make([]byte, 3)\n\t\tbytes[0] = 0xFD\n\t\tbinary.BigEndian.PutUint16(bytes[1:], uint16(in))\n\t\treturn bytes\n\t} else if in <= 0xFFFFFFFF {\n\t\tbytes := make([]byte, 5)\n\t\tbytes[0] = 0xFE\n\t\tbinary.BigEndian.PutUint32(bytes[1:], uint32(in))\n\t\treturn bytes\n\t} else {\n\t\tbytes := make([]byte, 9)\n\t\tbytes[0] = 0xFF\n\t\tbinary.BigEndian.PutUint64(bytes[1:], in)\n\t\treturn bytes\n\t}\n}", "title": "" }, { "docid": "edd75f7c4029428d0afe5aa43387d727", "score": "0.48237383", "text": "func isGetVarBinaryLiteral(sctx sessionctx.Context, expr expression.Expression) (res bool) {\n\tscalarFunc, ok := expr.(*expression.ScalarFunction)\n\tif ok && scalarFunc.FuncName.L == ast.GetVar {\n\t\tname, isNull, err := scalarFunc.GetArgs()[0].EvalString(sctx, chunk.Row{})\n\t\tif err != nil || isNull {\n\t\t\tres = false\n\t\t} else if dt, ok2 := sctx.GetSessionVars().GetUserVarVal(name); ok2 {\n\t\t\tres = dt.Kind() == types.KindBinaryLiteral\n\t\t}\n\t}\n\treturn res\n}", "title": "" }, { "docid": "87801e94d1cafed3574d390988cdaee9", "score": "0.48110414", "text": "func BinaryUpgradeSetNextArrayPgTypeOid(db XODB, v0 pgtypes.Oid) error {\n\tvar err error\n\n\t// sql query\n\tconst sqlstr = `SELECT pg_catalog.binary_upgrade_set_next_array_pg_type_oid($1)`\n\n\t// run query\n\tXOLog(sqlstr)\n\t_, err = db.Exec(sqlstr)\n\treturn err\n}", "title": "" }, { "docid": "66c2f568198aa4b8d7fc141fc6b08425", "score": "0.48108432", "text": "func TypeIn(vs ...string) predicate.Transaction {\n\tv := make([]interface{}, len(vs))\n\tfor i := range v {\n\t\tv[i] = vs[i]\n\t}\n\treturn predicate.Transaction(func(s *sql.Selector) {\n\t\t// if not arguments were provided, append the FALSE constants,\n\t\t// since we can't apply \"IN ()\". This will make this predicate falsy.\n\t\tif len(v) == 0 {\n\t\t\ts.Where(sql.False())\n\t\t\treturn\n\t\t}\n\t\ts.Where(sql.In(s.C(FieldType), v...))\n\t})\n}", "title": "" }, { "docid": "4bf23716e4e1daed7ba8fc60959e69cd", "score": "0.4793052", "text": "func (f *FlagSet) Int64SliceVar(p *[]int64, name string, value []int64, usage string) {\n\tf.fs.Int64SliceVar(p, name, value, usage)\n}", "title": "" }, { "docid": "531f5f8b6a41266c092facdd2c5226a1", "score": "0.47904998", "text": "func Oidvectorin(db XODB, v0 pgtypes.Cstring) (pgtypes.Oidvector, error) {\n\tvar err error\n\n\t// sql query\n\tconst sqlstr = `SELECT pg_catalog.oidvectorin($1)`\n\n\t// run query\n\tvar ret pgtypes.Oidvector\n\tXOLog(sqlstr, v0)\n\terr = db.QueryRow(sqlstr, v0).Scan(&ret)\n\tif err != nil {\n\t\treturn pgtypes.Oidvector{}, err\n\t}\n\n\treturn ret, nil\n}", "title": "" }, { "docid": "9aff9b4c7020cee589843f71e35deca3", "score": "0.47604364", "text": "func BitIn(db XODB, v0 pgtypes.Cstring, v1 pgtypes.Oid, v2 int) (uint8, error) {\n\tvar err error\n\n\t// sql query\n\tconst sqlstr = `SELECT pg_catalog.bit_in($1, $2, $3)`\n\n\t// run query\n\tvar ret uint8\n\tXOLog(sqlstr, v0, v1, v2)\n\terr = db.QueryRow(sqlstr, v0, v1, v2).Scan(&ret)\n\tif err != nil {\n\t\treturn uint8(0), err\n\t}\n\n\treturn ret, nil\n}", "title": "" }, { "docid": "387bb9ce13d6d25fcc8cfc04603404df", "score": "0.47433186", "text": "func ConvertMysqlTypeToProtoType(fieldSlic []SqlFieldDesc) string {\n\tvar schema string\n\t//处理变量\n\tfor i := 0; i < len(fieldSlic); i++ {\n\t\tschema += \" // \" + fieldSlic[i].COLUMN_COMMENT + \"\\n\"\n\n\t\tnumStr := strconv.Itoa(i + 1)\n\t\tif strings.Index(fieldSlic[i].COLUMN_TYPE, \"bigint\") > -1 {\n\t\t\tif strings.Index(fieldSlic[i].COLUMN_TYPE, \"unsigned\") > -1 {\n\t\t\t\tschema += \" uint64 \"\n\t\t\t} else {\n\t\t\t\tschema += \" int64 \"\n\t\t\t}\n\t\t} else if strings.Index(fieldSlic[i].COLUMN_TYPE, \"int\") > -1 {\n\t\t\tif strings.Index(fieldSlic[i].COLUMN_TYPE, \"unsigned\") > -1 {\n\t\t\t\tschema += \" uint32 \"\n\t\t\t} else {\n\t\t\t\tschema += \" int32 \"\n\t\t\t}\n\t\t} else if strings.Index(fieldSlic[i].COLUMN_TYPE, \"text\") > -1 {\n\t\t\tschema += \" string \"\n\t\t} else if strings.Index(fieldSlic[i].COLUMN_TYPE, \"char\") > -1 {\n\t\t\tschema += \" string \"\n\t\t} else if strings.Index(fieldSlic[i].COLUMN_TYPE, \"enum\") > -1 {\n\t\t\tschema += \" string \"\n\t\t} else if strings.Index(fieldSlic[i].COLUMN_TYPE, \"blob\") > -1 {\n\t\t\tschema += \" string \"\n\t\t} else if strings.Index(fieldSlic[i].COLUMN_TYPE, \"float\") > -1 {\n\t\t\tschema += \" float \"\n\t\t} else if strings.Index(fieldSlic[i].COLUMN_TYPE, \"double\") > -1 {\n\t\t\tschema += \" double \"\n\t\t} else if strings.Index(fieldSlic[i].COLUMN_TYPE, \"date\") > -1 {\n\t\t\tschema += \" string \"\n\t\t} else if strings.Index(fieldSlic[i].COLUMN_TYPE, \"time\") > -1 {\n\t\t\tschema += \" string \"\n\t\t} else {\n\t\t\tschema += \" string \"\n\t\t}\n\t\tschema += generatorCamelName(fieldSlic[i].COLUMN_NAME, 0) + \" = \" + numStr + \";\"\n\t\tif i < len(fieldSlic)-1 {\n\t\t\tschema += \"\\n\"\n\t\t}\n\t}\n\treturn schema\n}", "title": "" }, { "docid": "a41c7b3cd1861359cc474fd5d60029a9", "score": "0.47230428", "text": "func ArrayIn(db XODB, v0 pgtypes.Cstring, v1 pgtypes.Oid, v2 int) (pgtypes.Anyarray, error) {\n\tvar err error\n\n\t// sql query\n\tconst sqlstr = `SELECT pg_catalog.array_in($1, $2, $3)`\n\n\t// run query\n\tvar ret pgtypes.Anyarray\n\tXOLog(sqlstr, v0, v1, v2)\n\terr = db.QueryRow(sqlstr, v0, v1, v2).Scan(&ret)\n\tif err != nil {\n\t\treturn pgtypes.Anyarray{}, err\n\t}\n\n\treturn ret, nil\n}", "title": "" }, { "docid": "6055b41373e5eb1f41dec59cb80cc7fc", "score": "0.4699248", "text": "func TypeIn(vs ...string) predicate.CheckListItem {\n\tv := make([]interface{}, len(vs))\n\tfor i := range v {\n\t\tv[i] = vs[i]\n\t}\n\treturn predicate.CheckListItem(func(s *sql.Selector) {\n\t\t// if not arguments were provided, append the FALSE constants,\n\t\t// since we can't apply \"IN ()\". This will make this predicate falsy.\n\t\tif len(vs) == 0 {\n\t\t\ts.Where(sql.False())\n\t\t\treturn\n\t\t}\n\t\ts.Where(sql.In(s.C(FieldType), v...))\n\t},\n\t)\n}", "title": "" }, { "docid": "613f24ad4386bd4a90ddb53e74d9740b", "score": "0.46773738", "text": "func (dv *decodeVisitor) Varint(n wire.Number, v uint64) {\n\tf, exists := dv.decoder.fields[n]\n\tif !exists {\n\t\treturn\n\t}\n\tvar val interface{}\n\tswitch f.GetType() {\n\tcase descriptor.FieldDescriptorProto_TYPE_BOOL:\n\t\tval = wire.DecodeBool(v)\n\tcase descriptor.FieldDescriptorProto_TYPE_INT32,\n\t\tdescriptor.FieldDescriptorProto_TYPE_INT64,\n\t\tdescriptor.FieldDescriptorProto_TYPE_UINT32,\n\t\tdescriptor.FieldDescriptorProto_TYPE_UINT64:\n\t\tval = int64(v)\n\tcase descriptor.FieldDescriptorProto_TYPE_SINT32,\n\t\tdescriptor.FieldDescriptorProto_TYPE_SINT64:\n\t\tval = int64(wire.DecodeZigZag(v))\n\tcase descriptor.FieldDescriptorProto_TYPE_ENUM:\n\t\tval = int64(v)\n\tdefault:\n\t\tdv.err = multierror.Append(dv.err, fmt.Errorf(\"unexpected field type %q for varint encoding\", f.GetType()))\n\t\treturn\n\t}\n\tdv.setValue(f, val)\n}", "title": "" }, { "docid": "282884e1db34c8a0cec4ea2d429350af", "score": "0.46740025", "text": "func Varbitne(db XODB, v0 []byte, v1 []byte) (bool, error) {\n\tvar err error\n\n\t// sql query\n\tconst sqlstr = `SELECT pg_catalog.varbitne($1, $2)`\n\n\t// run query\n\tvar ret bool\n\tXOLog(sqlstr, v0, v1)\n\terr = db.QueryRow(sqlstr, v0, v1).Scan(&ret)\n\tif err != nil {\n\t\treturn false, err\n\t}\n\n\treturn ret, nil\n}", "title": "" }, { "docid": "cfe6b0a62147b05151ac7e11bd3912c4", "score": "0.46587142", "text": "func PHONENUMBERIn(vs ...string) predicate.Bookborrow {\n\tv := make([]interface{}, len(vs))\n\tfor i := range v {\n\t\tv[i] = vs[i]\n\t}\n\treturn predicate.Bookborrow(func(s *sql.Selector) {\n\t\t// if not arguments were provided, append the FALSE constants,\n\t\t// since we can't apply \"IN ()\". This will make this predicate falsy.\n\t\tif len(v) == 0 {\n\t\t\ts.Where(sql.False())\n\t\t\treturn\n\t\t}\n\t\ts.Where(sql.In(s.C(FieldPHONENUMBER), v...))\n\t})\n}", "title": "" }, { "docid": "1414f1febc9a6811cd35f5c388597b76", "score": "0.46582976", "text": "func Int2in(db XODB, v0 pgtypes.Cstring) (int16, error) {\n\tvar err error\n\n\t// sql query\n\tconst sqlstr = `SELECT pg_catalog.int2in($1)`\n\n\t// run query\n\tvar ret int16\n\tXOLog(sqlstr, v0)\n\terr = db.QueryRow(sqlstr, v0).Scan(&ret)\n\tif err != nil {\n\t\treturn 0, err\n\t}\n\n\treturn ret, nil\n}", "title": "" }, { "docid": "059ce4b3c8645069d454a6109656f293", "score": "0.4656709", "text": "func Int8SliceVar(p *[]int8, name string, value []int8, usage string) {\n\tCommandLine.Int8SliceVar(p, name, value, usage)\n}", "title": "" }, { "docid": "3ce10028dd2f5f07b18c5a98f1e2ecd4", "score": "0.46443656", "text": "func VarList[T any](colName string, itemType sif.GenericColumnAccessor[T]) sif.GenericColumnAccessor[[]T] {\n\treturn sif.CreateColumnAccessor[[]T](&varListType[T]{itemType.TypeT()}, colName)\n}", "title": "" }, { "docid": "f4263c006230c8e0444032574112aad2", "score": "0.4635976", "text": "func Varcharin(db XODB, v0 pgtypes.Cstring, v1 pgtypes.Oid, v2 int) (string, error) {\n\tvar err error\n\n\t// sql query\n\tconst sqlstr = `SELECT pg_catalog.varcharin($1, $2, $3)`\n\n\t// run query\n\tvar ret string\n\tXOLog(sqlstr, v0, v1, v2)\n\terr = db.QueryRow(sqlstr, v0, v1, v2).Scan(&ret)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\n\treturn ret, nil\n}", "title": "" }, { "docid": "3f4b4f0b1c5864e7a2756f69443d7361", "score": "0.4627681", "text": "func Gtsvectorin(db XODB, v0 pgtypes.Cstring) (pgtypes.Gtsvector, error) {\n\tvar err error\n\n\t// sql query\n\tconst sqlstr = `SELECT pg_catalog.gtsvectorin($1)`\n\n\t// run query\n\tvar ret pgtypes.Gtsvector\n\tXOLog(sqlstr, v0)\n\terr = db.QueryRow(sqlstr, v0).Scan(&ret)\n\tif err != nil {\n\t\treturn pgtypes.Gtsvector{}, err\n\t}\n\n\treturn ret, nil\n}", "title": "" }, { "docid": "c779e4cc1d0c4fc7bc36db47cddac68a", "score": "0.46212503", "text": "func (c *Config) Ints(key string) (arr []int) {\n\trawVal, ok := c.GetValue(key)\n\tif !ok {\n\t\treturn\n\t}\n\n\tswitch typeData := rawVal.(type) {\n\tcase []int:\n\t\tarr = typeData\n\tcase []any:\n\t\tfor _, v := range typeData {\n\t\t\tiv, err := mathutil.ToInt(v)\n\t\t\t// iv, err := strconv.Atoi(fmt.Sprintf(\"%v\", v))\n\t\t\tif err != nil {\n\t\t\t\tc.addError(err)\n\t\t\t\tarr = arr[0:0] // reset\n\t\t\t\treturn\n\t\t\t}\n\n\t\t\tarr = append(arr, iv)\n\t\t}\n\tdefault:\n\t\tc.addErrorf(\"value cannot be convert to []int, key is '%s'\", key)\n\t}\n\treturn\n}", "title": "" }, { "docid": "6ee5ef39b94964b4bc9436615bd01927", "score": "0.46027657", "text": "func TypeIn(vs ...string) predicate.Referrer {\n\tv := make([]interface{}, len(vs))\n\tfor i := range v {\n\t\tv[i] = vs[i]\n\t}\n\treturn predicate.Referrer(func(s *sql.Selector) {\n\t\t// if not arguments were provided, append the FALSE constants,\n\t\t// since we can't apply \"IN ()\". This will make this predicate falsy.\n\t\tif len(v) == 0 {\n\t\t\ts.Where(sql.False())\n\t\t\treturn\n\t\t}\n\t\ts.Where(sql.In(s.C(FieldType), v...))\n\t})\n}", "title": "" }, { "docid": "83f67b5c2e49cd364e4b52c5ac437caf", "score": "0.45989597", "text": "func Intervaltypmodout(db XODB, v0 int) (pgtypes.Cstring, error) {\n\tvar err error\n\n\t// sql query\n\tconst sqlstr = `SELECT pg_catalog.intervaltypmodout($1)`\n\n\t// run query\n\tvar ret pgtypes.Cstring\n\tXOLog(sqlstr, v0)\n\terr = db.QueryRow(sqlstr, v0).Scan(&ret)\n\tif err != nil {\n\t\treturn pgtypes.Cstring{}, err\n\t}\n\n\treturn ret, nil\n}", "title": "" }, { "docid": "bb720e26d0a42fd0b753484afbc769d3", "score": "0.45633504", "text": "func VarInt(i uint64) []byte {\r\n\tb := make([]byte, 9)\r\n\tif i < 0xfd {\r\n\t\tb[0] = byte(i)\r\n\t\treturn b[:1]\r\n\t}\r\n\tif i < 0x10000 {\r\n\t\tb[0] = 0xfd\r\n\t\tbinary.LittleEndian.PutUint16(b[1:3], uint16(i))\r\n\t\treturn b[:3]\r\n\t}\r\n\tif i < 0x100000000 {\r\n\t\tb[0] = 0xfe\r\n\t\tbinary.LittleEndian.PutUint32(b[1:5], uint32(i))\r\n\t\treturn b[:5]\r\n\t}\r\n\tb[0] = 0xff\r\n\tbinary.LittleEndian.PutUint64(b[1:9], i)\r\n\treturn b\r\n}", "title": "" }, { "docid": "3fee6bcb402494b636f87263925e0b8d", "score": "0.4560871", "text": "func (cmd *Command) UintVar(p *uint, name string, value uint, usage string) {\n\tcmd.flags.UintVar(p, name, value, usage)\n}", "title": "" }, { "docid": "ecb926a111261705e6abdb017554f2a6", "score": "0.4555349", "text": "func ParseBigIntSlice(arg string) (ret []*big.Int) {\n\tparts := strings.Split(arg, \",\")\n\tret = []*big.Int{}\n\tfor _, part := range parts {\n\t\tret = append(ret, decimal.RequireFromString(part).BigInt())\n\t}\n\treturn ret\n}", "title": "" }, { "docid": "9142313a824c5a927063978533259410", "score": "0.45452464", "text": "func (fs *Flags) UintVar(p *uint, meta *FlagMeta) {\n\tfs.uintOpt(p, meta)\n}", "title": "" }, { "docid": "e1bf60bde407347a3aa3485c3d2fc699", "score": "0.4533469", "text": "func Tsqueryin(db XODB, v0 pgtypes.Cstring) (pgtypes.Tsquery, error) {\n\tvar err error\n\n\t// sql query\n\tconst sqlstr = `SELECT pg_catalog.tsqueryin($1)`\n\n\t// run query\n\tvar ret pgtypes.Tsquery\n\tXOLog(sqlstr, v0)\n\terr = db.QueryRow(sqlstr, v0).Scan(&ret)\n\tif err != nil {\n\t\treturn pgtypes.Tsquery{}, err\n\t}\n\n\treturn ret, nil\n}", "title": "" }, { "docid": "6854286add213eb204b13dde993a4d5d", "score": "0.4533307", "text": "func SchemaInt64In(vs ...schema.Int64) predicate.FieldType {\n\tv := make([]any, len(vs))\n\tfor i := range v {\n\t\tv[i] = int64(vs[i])\n\t}\n\treturn predicate.FieldType(func(t *dsl.Traversal) {\n\t\tt.Has(Label, FieldSchemaInt64, p.Within(v...))\n\t})\n}", "title": "" }, { "docid": "aaa710de248379176f3101103e4e0572", "score": "0.4532466", "text": "func parseParamTypes(sctx sessionctx.Context, isBinProtocol bool, binProtoVars []types.Datum,\n\ttxtProtoVars []expression.Expression) (varsNum int, binVarTypes []byte, txtVarTypes []*types.FieldType) {\n\tif isBinProtocol { // binary protocol\n\t\tvarsNum = len(binProtoVars)\n\t\tfor _, param := range binProtoVars {\n\t\t\tbinVarTypes = append(binVarTypes, param.Kind())\n\t\t}\n\t} else { // txt protocol\n\t\tvarsNum = len(txtProtoVars)\n\t\tfor _, param := range txtProtoVars {\n\t\t\tname := param.(*expression.ScalarFunction).GetArgs()[0].String()\n\t\t\ttp := sctx.GetSessionVars().UserVarTypes[name]\n\t\t\tif tp == nil {\n\t\t\t\ttp = types.NewFieldType(mysql.TypeNull)\n\t\t\t}\n\t\t\ttxtVarTypes = append(txtVarTypes, tp)\n\t\t}\n\t}\n\treturn\n}", "title": "" }, { "docid": "a2006891e79c813ccb1ebc7b3ed94566", "score": "0.45142344", "text": "func (f *FlagSet) Int64SliceVarP(p *[]int64, name, shorthand string, value []int64, usage string) {\n\tf.fs.Int64SliceVarP(p, name, shorthand, value, usage)\n}", "title": "" }, { "docid": "32cc74ff9bf72f8ccad34ffb09ffdac6", "score": "0.45103848", "text": "func opcodeNum2bin(op *ParsedOp, t *thread) error {\r\n\tn, err := t.dstack.PopInt()\r\n\tif err != nil {\r\n\t\treturn err\r\n\t}\r\n\r\n\ta, err := t.dstack.PopByteArray()\r\n\tif err != nil {\r\n\t\treturn err\r\n\t}\r\n\r\n\tsize := int(n.Int32())\r\n\tif size > t.cfg.MaxScriptElementSize() {\r\n\t\treturn scriptError(ErrNumberTooBig, \"n is larger than the max of %d\", defaultScriptNumLen)\r\n\t}\r\n\r\n\t// encode a as a script num so that we we take the bytes it\r\n\t// will be minimally encoded.\r\n\tsn, err := makeScriptNum(a, false, len(a))\r\n\tif err != nil {\r\n\t\treturn err\r\n\t}\r\n\r\n\tb := sn.Bytes()\r\n\tif len(b) > size {\r\n\t\treturn scriptError(ErrNumberTooSmall, \"cannot fit it into n sized array\")\r\n\t}\r\n\tif len(b) == size {\r\n\t\tt.dstack.PushByteArray(b)\r\n\t\treturn nil\r\n\t}\r\n\r\n\tsignbit := byte(0x00)\r\n\tif len(b) > 0 {\r\n\t\tsignbit = b[0] & 0x80\r\n\t\tb[len(b)-1] &= 0x7f\r\n\t}\r\n\r\n\tfor len(b) < size-1 {\r\n\t\tb = append(b, 0x00)\r\n\t}\r\n\r\n\tb = append(b, signbit)\r\n\r\n\tt.dstack.PushByteArray(b)\r\n\treturn nil\r\n}", "title": "" }, { "docid": "22c10965cec98fa5342fb6974f47ee7a", "score": "0.45054978", "text": "func ImportInPbit(sizeInPbit float64) Bits {\n\treturn Bits(sizeInPbit * Pbit)\n}", "title": "" }, { "docid": "bfc7bd4dfa2934dc6d7021be7f8d17d0", "score": "0.45048428", "text": "func (pts *ProcedureTypeSelect) Ints(ctx context.Context) ([]int, error) {\n\tif len(pts.fields) > 1 {\n\t\treturn nil, errors.New(\"ent: ProcedureTypeSelect.Ints is not achievable when selecting more than 1 field\")\n\t}\n\tvar v []int\n\tif err := pts.Scan(ctx, &v); err != nil {\n\t\treturn nil, err\n\t}\n\treturn v, nil\n}", "title": "" }, { "docid": "1ff6ec9f4282e75b9829b203562ff277", "score": "0.44876632", "text": "func Oidvectortypes(db XODB, v0 pgtypes.Oidvector) (string, error) {\n\tvar err error\n\n\t// sql query\n\tconst sqlstr = `SELECT pg_catalog.oidvectortypes($1)`\n\n\t// run query\n\tvar ret string\n\tXOLog(sqlstr, v0)\n\terr = db.QueryRow(sqlstr, v0).Scan(&ret)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\n\treturn ret, nil\n}", "title": "" }, { "docid": "edf37a182616bd8aaa22d7dcb40485fb", "score": "0.44874957", "text": "func AnyarrayIn(db XODB, v0 pgtypes.Cstring) (pgtypes.Anyarray, error) {\n\tvar err error\n\n\t// sql query\n\tconst sqlstr = `SELECT pg_catalog.anyarray_in($1)`\n\n\t// run query\n\tvar ret pgtypes.Anyarray\n\tXOLog(sqlstr, v0)\n\terr = db.QueryRow(sqlstr, v0).Scan(&ret)\n\tif err != nil {\n\t\treturn pgtypes.Anyarray{}, err\n\t}\n\n\treturn ret, nil\n}", "title": "" }, { "docid": "d99b8261a3b54fc2ea3020112f2408b6", "score": "0.4467222", "text": "func Timestamptypmodout(db XODB, v0 int) (pgtypes.Cstring, error) {\n\tvar err error\n\n\t// sql query\n\tconst sqlstr = `SELECT pg_catalog.timestamptypmodout($1)`\n\n\t// run query\n\tvar ret pgtypes.Cstring\n\tXOLog(sqlstr, v0)\n\terr = db.QueryRow(sqlstr, v0).Scan(&ret)\n\tif err != nil {\n\t\treturn pgtypes.Cstring{}, err\n\t}\n\n\treturn ret, nil\n}", "title": "" }, { "docid": "7b931617ffc8b311fe8dad7593a54f5d", "score": "0.4456571", "text": "func varTypes(list []*Var) (res []Type) {\n\tfor _, x := range list {\n\t\tres = append(res, x.typ)\n\t}\n\treturn res\n}", "title": "" }, { "docid": "497fed1c97dd98bfefd0aeddb61f6c81", "score": "0.44512585", "text": "func TypeIn(vs ...Type) predicate.Entity {\n\tv := make([]interface{}, len(vs))\n\tfor i := range v {\n\t\tv[i] = vs[i]\n\t}\n\treturn predicate.Entity(func(s *sql.Selector) {\n\t\t// if not arguments were provided, append the FALSE constants,\n\t\t// since we can't apply \"IN ()\". This will make this predicate falsy.\n\t\tif len(v) == 0 {\n\t\t\ts.Where(sql.False())\n\t\t\treturn\n\t\t}\n\t\ts.Where(sql.In(s.C(FieldType), v...))\n\t})\n}", "title": "" }, { "docid": "94d88b2db3e45f57b09236eabceffa79", "score": "0.4450534", "text": "func PgDdlCommandIn(db XODB, v0 pgtypes.Cstring) (pgtypes.PgDdlCommand, error) {\n\tvar err error\n\n\t// sql query\n\tconst sqlstr = `SELECT pg_catalog.pg_ddl_command_in($1)`\n\n\t// run query\n\tvar ret pgtypes.PgDdlCommand\n\tXOLog(sqlstr, v0)\n\terr = db.QueryRow(sqlstr, v0).Scan(&ret)\n\tif err != nil {\n\t\treturn pgtypes.PgDdlCommand{}, err\n\t}\n\n\treturn ret, nil\n}", "title": "" }, { "docid": "34568bfb47fa78027342da31a744f5d5", "score": "0.44361076", "text": "func (_Oracle *OracleCaller) GetUintVar(opts *bind.CallOpts, _data [32]byte) (*big.Int, error) {\n\tvar out []interface{}\n\terr := _Oracle.contract.Call(opts, &out, \"getUintVar\", _data)\n\n\tif err != nil {\n\t\treturn *new(*big.Int), err\n\t}\n\n\tout0 := *abi.ConvertType(out[0], new(*big.Int)).(**big.Int)\n\n\treturn out0, err\n\n}", "title": "" }, { "docid": "9ac2e393b4d18d49d22da5e1c3e939a9", "score": "0.4435623", "text": "func (o *Options) UintVar(p *uint, name string, value uint, usage string) {\n\tflag.UintVar(p, o.flag(name), o.defaultUint(name, value), usage)\n}", "title": "" }, { "docid": "2387724d8d08639eb60e732acca57cc0", "score": "0.44349355", "text": "func (cmd *Command) Int64Var(p *int64, name string, value int64, usage string) {\n\tcmd.flags.Int64Var(p, name, value, usage)\n}", "title": "" }, { "docid": "59cf35e0bdc44b6eac7a6d02757d3c38", "score": "0.44167694", "text": "func UintVar(register Register, p *uint, name string, options ...FlagOptionApplyer) error {\n\treturn Var(register, newUintValue(p), name, options...)\n}", "title": "" }, { "docid": "d1df25eb0a01cadd460d5db3aea9b332", "score": "0.4408536", "text": "func (_Oracle *OracleSession) GetUintVar(_data [32]byte) (*big.Int, error) {\n\treturn _Oracle.Contract.GetUintVar(&_Oracle.CallOpts, _data)\n}", "title": "" }, { "docid": "e2e458dc822b916bf2ebbddb9df7f5f0", "score": "0.4404615", "text": "func IntVar(p *int, name string, value int, usage string) {\n\tpflag.IntVar(p, name, value, usage)\n\tflagsI[p] = [...]string{name, strconv.Itoa(value)}\n}", "title": "" }, { "docid": "7a64a2dbf861b0a8dbb2a6506b0cc3a5", "score": "0.44041157", "text": "func (pts *ProcedureTypeSelect) IntsX(ctx context.Context) []int {\n\tv, err := pts.Ints(ctx)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn v\n}", "title": "" }, { "docid": "5ea46a13f8d96982c813815204683fac", "score": "0.4401695", "text": "func execIn(arity int, p *gop.Context) {\n\targs := p.GetArgs(arity)\n\tconv := func(args []interface{}) []*unicode.RangeTable {\n\t\tret := make([]*unicode.RangeTable, len(args))\n\t\tfor i, arg := range args {\n\t\t\tret[i] = arg.(*unicode.RangeTable)\n\t\t}\n\t\treturn ret\n\t}\n\tret := unicode.In(args[0].(rune), conv(args[1:])...)\n\tp.Ret(arity, ret)\n}", "title": "" }, { "docid": "3e599467b3b5ed84543f0895e6957b12", "score": "0.43973145", "text": "func TypeCodeIn(vs ...string) predicate.Consumer {\n\tv := make([]interface{}, len(vs))\n\tfor i := range v {\n\t\tv[i] = vs[i]\n\t}\n\treturn predicate.Consumer(func(s *sql.Selector) {\n\t\t// if not arguments were provided, append the FALSE constants,\n\t\t// since we can't apply \"IN ()\". This will make this predicate falsy.\n\t\tif len(v) == 0 {\n\t\t\ts.Where(sql.False())\n\t\t\treturn\n\t\t}\n\t\ts.Where(sql.In(s.C(FieldTypeCode), v...))\n\t})\n}", "title": "" }, { "docid": "41a4fe331b1ab3fb01692b8d71b03153", "score": "0.4397223", "text": "func (*Int64SliceValue) Type() string { return \"int64Slice\" }", "title": "" }, { "docid": "43375928766f23a84bb672934c455f4d", "score": "0.4396939", "text": "func MapTypeIn(vs ...string) predicate.LocationType {\n\tv := make([]interface{}, len(vs))\n\tfor i := range v {\n\t\tv[i] = vs[i]\n\t}\n\treturn predicate.LocationType(func(s *sql.Selector) {\n\t\t// if not arguments were provided, append the FALSE constants,\n\t\t// since we can't apply \"IN ()\". This will make this predicate falsy.\n\t\tif len(vs) == 0 {\n\t\t\ts.Where(sql.False())\n\t\t\treturn\n\t\t}\n\t\ts.Where(sql.In(s.C(FieldMapType), v...))\n\t},\n\t)\n}", "title": "" }, { "docid": "b41b3338aae5291171f174936d4d6d3a", "score": "0.43969122", "text": "func (_Oracle *OracleCallerSession) GetUintVar(_data [32]byte) (*big.Int, error) {\n\treturn _Oracle.Contract.GetUintVar(&_Oracle.CallOpts, _data)\n}", "title": "" }, { "docid": "c597130c8b487ed48ebaf85df4d2e117", "score": "0.43901604", "text": "func SchemaIntIn(vs ...schema.Int) predicate.FieldType {\n\tv := make([]any, len(vs))\n\tfor i := range v {\n\t\tv[i] = int(vs[i])\n\t}\n\treturn predicate.FieldType(func(t *dsl.Traversal) {\n\t\tt.Has(Label, FieldSchemaInt, p.Within(v...))\n\t})\n}", "title": "" }, { "docid": "e764c881e11bfd21b5f0a45cb4b12221", "score": "0.43882534", "text": "func Boolin(db XODB, v0 pgtypes.Cstring) (bool, error) {\n\tvar err error\n\n\t// sql query\n\tconst sqlstr = `SELECT pg_catalog.boolin($1)`\n\n\t// run query\n\tvar ret bool\n\tXOLog(sqlstr, v0)\n\terr = db.QueryRow(sqlstr, v0).Scan(&ret)\n\tif err != nil {\n\t\treturn false, err\n\t}\n\n\treturn ret, nil\n}", "title": "" }, { "docid": "675b5bf16ae31badfea2f2ec3fe1ef42", "score": "0.43875548", "text": "func Numerictypmodout(db XODB, v0 int) (pgtypes.Cstring, error) {\n\tvar err error\n\n\t// sql query\n\tconst sqlstr = `SELECT pg_catalog.numerictypmodout($1)`\n\n\t// run query\n\tvar ret pgtypes.Cstring\n\tXOLog(sqlstr, v0)\n\terr = db.QueryRow(sqlstr, v0).Scan(&ret)\n\tif err != nil {\n\t\treturn pgtypes.Cstring{}, err\n\t}\n\n\treturn ret, nil\n}", "title": "" }, { "docid": "ee1f3aad39a4c901d8169e4f63f83252", "score": "0.43826222", "text": "func TypeIn(vs ...string) predicate.Metric {\n\tv := make([]interface{}, len(vs))\n\tfor i := range v {\n\t\tv[i] = vs[i]\n\t}\n\treturn predicate.Metric(func(s *sql.Selector) {\n\t\t// if not arguments were provided, append the FALSE constants,\n\t\t// since we can't apply \"IN ()\". This will make this predicate falsy.\n\t\tif len(v) == 0 {\n\t\t\ts.Where(sql.False())\n\t\t\treturn\n\t\t}\n\t\ts.Where(sql.In(s.C(FieldType), v...))\n\t})\n}", "title": "" }, { "docid": "ea564a13092802b7b9bb7947673ff25c", "score": "0.43805602", "text": "func (ptgb *ProcedureTypeGroupBy) IntsX(ctx context.Context) []int {\n\tv, err := ptgb.Ints(ctx)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn v\n}", "title": "" }, { "docid": "9ea1cbd22bd52661f9c62dbffd2f1bf9", "score": "0.43776572", "text": "func PHONENUMBERIn(vs ...string) predicate.Payment {\n\tv := make([]interface{}, len(vs))\n\tfor i := range v {\n\t\tv[i] = vs[i]\n\t}\n\treturn predicate.Payment(func(s *sql.Selector) {\n\t\t// if not arguments were provided, append the FALSE constants,\n\t\t// since we can't apply \"IN ()\". This will make this predicate falsy.\n\t\tif len(v) == 0 {\n\t\t\ts.Where(sql.False())\n\t\t\treturn\n\t\t}\n\t\ts.Where(sql.In(s.C(FieldPHONENUMBER), v...))\n\t})\n}", "title": "" }, { "docid": "f99849a7a88ef6d1cdd31b563c99828b", "score": "0.43739772", "text": "func Int8in(db XODB, v0 pgtypes.Cstring) (int64, error) {\n\tvar err error\n\n\t// sql query\n\tconst sqlstr = `SELECT pg_catalog.int8in($1)`\n\n\t// run query\n\tvar ret int64\n\tXOLog(sqlstr, v0)\n\terr = db.QueryRow(sqlstr, v0).Scan(&ret)\n\tif err != nil {\n\t\treturn 0, err\n\t}\n\n\treturn ret, nil\n}", "title": "" }, { "docid": "151cef1c656a2f37f2857cc9487a7eb2", "score": "0.43632373", "text": "func (cmd *Command) Uint64Var(p *uint64, name string, value uint64, usage string) {\n\tcmd.flags.Uint64Var(p, name, value, usage)\n}", "title": "" }, { "docid": "120e939f498458e166781307b8b26405", "score": "0.43606964", "text": "func DecodeVarNum(in []byte) (uint64, int, error) {\n\tif len(in) < 1 {\n\t\treturn 0, 0, util.ErrTooShort\n\t}\n\n\tif in[0] <= 0xFC {\n\t\treturn uint64(in[0]), 1, nil\n\t} else if in[0] == 0xFD {\n\t\tif len(in) < 3 {\n\t\t\treturn 0, 0, util.ErrTooShort\n\t\t}\n\t\treturn uint64(binary.BigEndian.Uint16(in[1:3])), 3, nil\n\t} else if in[0] == 0xFE {\n\t\tif len(in) < 5 {\n\t\t\treturn 0, 0, util.ErrTooShort\n\t\t}\n\t\treturn uint64(binary.BigEndian.Uint32(in[1:5])), 5, nil\n\t} else { // Must be 0xFF\n\t\tif len(in) < 9 {\n\t\t\treturn 0, 0, util.ErrTooShort\n\t\t}\n\t\treturn binary.BigEndian.Uint64(in[1:9]), 9, nil\n\t}\n}", "title": "" }, { "docid": "64a87b9f59a2a5c0828dbf7faf1e3f1a", "score": "0.4356328", "text": "func TestVarBinary(t *testing.T) {\n\tdb, err := newTestDB()\n\tif err != nil {\n\t\tt.Fatal(err)\n\t}\n\tdefer db.close()\n\n\t_, err = db.Exec(`CREATE TABLE binaries\n\t( NAME varchar(64)\n\t, PASSWORDHASH varbinary(255))`)\n\tif err != nil {\n\t\tt.Fatal(err)\n\t}\n\tdefer func() {\n\t\tdb.Exec(\"DROP TABLE binaries\")\n\t}()\n\n\ttest := []NullByte{\n\t\t{Byte: nil, Valid: false}, // nil varbinary\n\t\t{Byte: []byte(\"\"), Valid: true}, // empty varbinary\n\t\t{Byte: []byte(\"myhint\"), Valid: true}, // regular varbinary\n\t\t{Byte: []byte(\"Hello, 世界\"), Valid: true}, // unicode varbinary\n\t}\n\n\tvar pwhash sql.NullString\n\tfor _, hint := range test {\n\t\terr = db.QueryRow(`SELECT HEX(PASSWORDHASH) FROM FINAL TABLE\n\t(INSERT INTO binaries (NAME, PASSWORDHASH) VALUES (?, ?))`, \"ABCD\", hint).Scan(&pwhash)\n\t\tif err != nil {\n\t\t\tt.Error(err)\n\t\t}\n\t\tdecoded, err := hex.DecodeString(pwhash.String)\n\t\tif err != nil {\n\t\t\tt.Fatal(err)\n\t\t}\n\t\tt.Logf(\"%v => %v\\n\", hint.Byte, decoded)\n\t\tif string(hint.Byte) != string(decoded) {\n\t\t\tt.Errorf(\"Expected %s, got %s\\n\", hint.Byte, decoded)\n\t\t}\n\t}\n}", "title": "" }, { "docid": "a7ca337c074a98f3170d3be3a5237524", "score": "0.43553367", "text": "func (ptgb *ProcedureTypeGroupBy) Ints(ctx context.Context) ([]int, error) {\n\tif len(ptgb.fields) > 1 {\n\t\treturn nil, errors.New(\"ent: ProcedureTypeGroupBy.Ints is not achievable when grouping more than 1 field\")\n\t}\n\tvar v []int\n\tif err := ptgb.Scan(ctx, &v); err != nil {\n\t\treturn nil, err\n\t}\n\treturn v, nil\n}", "title": "" }, { "docid": "8330dd4953ea332ab6b0eb5667990189", "score": "0.43445885", "text": "func Int64Var(register Register, p *int64, name string, options ...FlagOptionApplyer) error {\n\treturn Var(register, newInt64Value(p), name, options...)\n}", "title": "" }, { "docid": "b9bc6eddde32f803374c320d65fc9335", "score": "0.431767", "text": "func (b *builtinLikeSig) evalInt(row chunk.Row) (int64, bool, error) {\n\ttrace_util_0.Count(_builtin_like_00000, 4)\n\tvalStr, isNull, err := b.args[0].EvalString(b.ctx, row)\n\tif isNull || err != nil {\n\t\ttrace_util_0.Count(_builtin_like_00000, 8)\n\t\treturn 0, isNull, err\n\t}\n\n\t// TODO: We don't need to compile pattern if it has been compiled or it is static.\n\ttrace_util_0.Count(_builtin_like_00000, 5)\n\tpatternStr, isNull, err := b.args[1].EvalString(b.ctx, row)\n\tif isNull || err != nil {\n\t\ttrace_util_0.Count(_builtin_like_00000, 9)\n\t\treturn 0, isNull, err\n\t}\n\ttrace_util_0.Count(_builtin_like_00000, 6)\n\tval, isNull, err := b.args[2].EvalInt(b.ctx, row)\n\tif isNull || err != nil {\n\t\ttrace_util_0.Count(_builtin_like_00000, 10)\n\t\treturn 0, isNull, err\n\t}\n\ttrace_util_0.Count(_builtin_like_00000, 7)\n\tescape := byte(val)\n\tpatChars, patTypes := stringutil.CompilePattern(patternStr, escape)\n\tmatch := stringutil.DoMatch(valStr, patChars, patTypes)\n\treturn boolToInt64(match), false, nil\n}", "title": "" }, { "docid": "4376dd861cf1d09b1704f12e8bdedb8b", "score": "0.43124712", "text": "func (f *FlagSet) Int32SliceVar(p *[]int32, name string, value []int32, usage string) {\n\tf.fs.Int32SliceVar(p, name, value, usage)\n}", "title": "" }, { "docid": "a549fe2799101547c3e50dd33ea8eb84", "score": "0.4312191", "text": "func (gbs *GuildBankSelect) Ints(ctx context.Context) ([]int, error) {\n\tif len(gbs.fields) > 1 {\n\t\treturn nil, errors.New(\"db: GuildBankSelect.Ints is not achievable when selecting more than 1 field\")\n\t}\n\tvar v []int\n\tif err := gbs.Scan(ctx, &v); err != nil {\n\t\treturn nil, err\n\t}\n\treturn v, nil\n}", "title": "" }, { "docid": "71c2248615b38189cb69cc741d50828d", "score": "0.43103138", "text": "func ImportInMbit(sizeInMbit float64) Bits {\n\treturn Bits(sizeInMbit * Mbit)\n}", "title": "" }, { "docid": "5517111e879a9507f30b6553f10303e6", "score": "0.43044177", "text": "func Int64In(vs ...int64) predicate.FieldType {\n\treturn predicate.FieldType(func(t *dsl.Traversal) {\n\t\tt.Has(Label, FieldInt64, p.Within(vs...))\n\t})\n}", "title": "" }, { "docid": "ce2d776ef16e9751e3974dc57ae0222f", "score": "0.43008006", "text": "func Int8SliceVarP(p *[]int8, name, shorthand string, value []int8, usage string) {\n\tCommandLine.Int8SliceVarP(p, name, shorthand, value, usage)\n}", "title": "" }, { "docid": "f44c0e1dc805181eda143645054e6e1b", "score": "0.42934293", "text": "func (f *FlagSet) Int8SliceVar(p *[]int8, name string, value []int8, usage string) {\n\tf.Int8SliceVarP(p, name, \"\", value, usage)\n}", "title": "" }, { "docid": "2f939f8482dc19b1519092d80f3cec89", "score": "0.4285809", "text": "func Xidin(db XODB, v0 pgtypes.Cstring) (pgtypes.Xid, error) {\n\tvar err error\n\n\t// sql query\n\tconst sqlstr = `SELECT pg_catalog.xidin($1)`\n\n\t// run query\n\tvar ret pgtypes.Xid\n\tXOLog(sqlstr, v0)\n\terr = db.QueryRow(sqlstr, v0).Scan(&ret)\n\tif err != nil {\n\t\treturn pgtypes.Xid{}, err\n\t}\n\n\treturn ret, nil\n}", "title": "" }, { "docid": "661250435c083a9c5b421f454b11846d", "score": "0.42849657", "text": "func IntIn(vs ...int) predicate.FieldType {\n\treturn predicate.FieldType(func(t *dsl.Traversal) {\n\t\tt.Has(Label, FieldInt, p.Within(vs...))\n\t})\n}", "title": "" }, { "docid": "acf39dc8eec4c7d8e3fbc7a0aad9997c", "score": "0.42845747", "text": "func pgParseIntArray(value string) (result ArrayInt64) {\n\tresult = make(ArrayInt64, 0)\n\tmatches := arrayExp.FindAllStringSubmatch(value, -1)\n\tfor _, match := range matches {\n\t\ts := match[valueIndex]\n\t\ts = strings.Trim(s, \"\\\"\")\n\t\tn, _ := strconv.ParseInt(s, 10, 64)\n\t\tresult = append(result, n)\n\t}\n\n\treturn\n}", "title": "" } ]
58d2c892bcd459b44e5b08001f23b3c1
UnsetRefImagem ensures that no value is present for RefImagem, not even an explicit nil
[ { "docid": "e4f019d4866f4e1c00df703613dae7fe", "score": "0.8463655", "text": "func (o *Produto) UnsetRefImagem() {\n\to.RefImagem.Unset()\n}", "title": "" } ]
[ { "docid": "97219cbdc0fb27134ca2ea8ef0145ac0", "score": "0.68979853", "text": "func (o *Produto) SetRefImagemNil() {\n\to.RefImagem.Set(nil)\n}", "title": "" }, { "docid": "e6d4d3fb05cfe317ad63336a2709275d", "score": "0.609012", "text": "func (o *Produto) HasRefImagem() bool {\n\tif o != nil && o.RefImagem.IsSet() {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "342651f52bd8e381d66641422d61f1c9", "score": "0.60601985", "text": "func (img ImageRef) Retain() {\n\tCF.TypeRef(img).Retain()\n}", "title": "" }, { "docid": "419c071380c25a91c066ec7e93028a2a", "score": "0.60416", "text": "func UnmanagedImage(id, ref string, hasAnnotations bool, annotation, value string) imagev1.Image {\n\timage := ImageWithLayers(id, ref, nil)\n\tif !hasAnnotations {\n\t\timage.Annotations = nil\n\t} else {\n\t\tdelete(image.Annotations, managedByOpenShiftAnnotation)\n\t\timage.Annotations[annotation] = value\n\t}\n\treturn image\n}", "title": "" }, { "docid": "cf5d1f4286260b2c94540f4d3c97ece5", "score": "0.60084903", "text": "func (o *Produto) SetRefImagem(v int64) {\n\to.RefImagem.Set(&v)\n}", "title": "" }, { "docid": "930d639e4f49e09cfc140293a80e3cf7", "score": "0.5953064", "text": "func UnmarshalImageReference(m map[string]json.RawMessage, result interface{}) (err error) {\n\tobj := new(ImageReference)\n\terr = core.UnmarshalPrimitive(m, \"crn\", &obj.CRN)\n\tif err != nil {\n\t\treturn\n\t}\n\terr = core.UnmarshalModel(m, \"deleted\", &obj.Deleted, UnmarshalImageReferenceDeleted)\n\tif err != nil {\n\t\treturn\n\t}\n\terr = core.UnmarshalPrimitive(m, \"href\", &obj.Href)\n\tif err != nil {\n\t\treturn\n\t}\n\terr = core.UnmarshalPrimitive(m, \"id\", &obj.ID)\n\tif err != nil {\n\t\treturn\n\t}\n\terr = core.UnmarshalPrimitive(m, \"name\", &obj.Name)\n\tif err != nil {\n\t\treturn\n\t}\n\treflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj))\n\treturn\n}", "title": "" }, { "docid": "1b82b80c973afa3f5a87907c8b0140ec", "score": "0.58289653", "text": "func (o *TeamCreateAttributes) UnsetAvatar() {\n\to.Avatar.Unset()\n}", "title": "" }, { "docid": "e561154730622f40e1e504e5f7b32491", "score": "0.5745674", "text": "func (img ImageRef) Release() {\n\tCF.TypeRef(img).Release()\n}", "title": "" }, { "docid": "498e44712270547b8ef731160e78e7a7", "score": "0.5740066", "text": "func (me *Image) Free() {\n\timages.checkin(&me.key)\n\tme.img = nil\n\tme.key.Label.Str = \"\"\n}", "title": "" }, { "docid": "bf223443c1cc340907211581b5a8d18d", "score": "0.5730676", "text": "func (m *ProductMutation) ResetImageURL() {\n\tm.image_url = nil\n}", "title": "" }, { "docid": "7e531702085e8c35b43d6a9c6094e907", "score": "0.5719277", "text": "func (m *PersonMutation) ResetPicture() {\n\tm.picture = nil\n\tdelete(m.clearedFields, person.FieldPicture)\n}", "title": "" }, { "docid": "f144de3f1db26f832a50af2dd8524dc7", "score": "0.5682954", "text": "func (o *Produto) GetRefImagemOk() (*int64, bool) {\n\tif o == nil {\n\t\treturn nil, false\n\t}\n\treturn o.RefImagem.Get(), o.RefImagem.IsSet()\n}", "title": "" }, { "docid": "6dcd4d7910cb8fe19b215347e919faff", "score": "0.56786186", "text": "func UnmarshalImageReferenceDeleted(m map[string]json.RawMessage, result interface{}) (err error) {\n\tobj := new(ImageReferenceDeleted)\n\terr = core.UnmarshalPrimitive(m, \"more_info\", &obj.MoreInfo)\n\tif err != nil {\n\t\treturn\n\t}\n\treflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj))\n\treturn\n}", "title": "" }, { "docid": "70b6247a94c36c31bdd9911f9ed3ab64", "score": "0.5664662", "text": "func (o *Produto) GetRefImagem() int64 {\n\tif o == nil || o.RefImagem.Get() == nil {\n\t\tvar ret int64\n\t\treturn ret\n\t}\n\treturn *o.RefImagem.Get()\n}", "title": "" }, { "docid": "95f408ce4c13ce531f9ddcc434699a83", "score": "0.5640804", "text": "func (i *CacheImage) Free() {\n\ti.m = nil\n\ti.pm = nil\n\ti.sinfo = nil\n\ti.RangeEntries = nil\n\ti.PatchableExports = nil\n\ti.PatchableGOTs = nil\n\ti.LocalSymbols = nil\n\ti.PublicSymbols = nil\n\ti.ObjC = objcInfo{}\n\ti.Analysis = analysis{}\n}", "title": "" }, { "docid": "b76a2865af881393ef3f89868a80c6d1", "score": "0.55183053", "text": "func (v *Version) Unref() {\n\tif atomic.AddInt32(&v.refs, -1) == 0 {\n\t\tobsolete := v.unrefFiles()\n\t\tl := v.list\n\t\tl.mu.Lock()\n\t\tl.Remove(v)\n\t\tv.Deleted(obsolete)\n\t\tl.mu.Unlock()\n\t}\n}", "title": "" }, { "docid": "90a5355d7da1bd58f703449bbbe04a75", "score": "0.5503675", "text": "func ReferenceUnref(env Env, ref Ref) (uint, Status) {\n\tvar res C.uint\n\tvar status = C.napi_reference_unref(env, ref, &res)\n\treturn uint(res), Status(status)\n}", "title": "" }, { "docid": "286cb03d7b63248c7c603d5e5aa6811b", "score": "0.5494185", "text": "func (f *Frame) Unref() {\n\tcf := (*C.struct_AVFrame)(unsafe.Pointer(f))\n\tC.av_frame_unref(cf)\n}", "title": "" }, { "docid": "f5425e3909d3c78ec37cf8a23e3ef51a", "score": "0.5452763", "text": "func (o *Produto) UnsetRefEntidade() {\n\to.RefEntidade.Unset()\n}", "title": "" }, { "docid": "ece22cc78f08398a34c106d4c327aad7", "score": "0.5406097", "text": "func (o *AberturaOrdemServico) UnsetRefOrdemServico() {\n\to.RefOrdemServico.Unset()\n}", "title": "" }, { "docid": "f0747385203e4f9c017c37f1c8a3ca71", "score": "0.53690094", "text": "func (m *ProfileMutation) ResetAvatar() {\n\tm.avatar = nil\n\tdelete(m.clearedFields, profile.FieldAvatar)\n}", "title": "" }, { "docid": "64c54dfdd86dabd9df602775248e455a", "score": "0.53433824", "text": "func Zero(img *IplImage) {\n\tC.cvSetZero(unsafe.Pointer(img))\n}", "title": "" }, { "docid": "903a2b5d018c82977f91f2f41ec0936e", "score": "0.5311998", "text": "func (m *PersonMutation) ClearPicture() {\n\tm.picture = nil\n\tm.clearedFields[person.FieldPicture] = struct{}{}\n}", "title": "" }, { "docid": "e3d82eac909fbab360ee8562c7c830f0", "score": "0.5300199", "text": "func (o *DAGDetail) UnsetDocMd() {\n\to.DocMd.Unset()\n}", "title": "" }, { "docid": "550279b372d9d0e9f3c2042bfcc3e9f7", "score": "0.5276162", "text": "func (v *NullableLogsAttributeRemapperType) Unset() {\n\tv.value = nil\n\tv.isSet = false\n}", "title": "" }, { "docid": "e2621cd5133ec35ae595438b10c96ea7", "score": "0.5258406", "text": "func RemoveReference(field *[]types.ManagedObjectReference, ref types.ManagedObjectReference) {\n\tfor i, r := range *field {\n\t\tif r == ref {\n\t\t\t*field = append((*field)[:i], (*field)[i+1:]...)\n\t\t\tbreak\n\t\t}\n\t}\n}", "title": "" }, { "docid": "1435516e8107d25de9715a9f24691734", "score": "0.5228464", "text": "func (v *NullableMonitorFormulaAndFunctionQueryDefinition) Unset() {\n\tv.value = nil\n\tv.isSet = false\n}", "title": "" }, { "docid": "6465230e728034483e3f1149520ae999", "score": "0.52104694", "text": "func (m Map) Unset(fp Path) error {\n\treturn unset(m, nil, fp)\n}", "title": "" }, { "docid": "1c889d002e7182f21f274012c3179d75", "score": "0.5189382", "text": "func UnloadImage(imageAlias string) {\n\tmemory.DeleteImage(imageAlias)\n}", "title": "" }, { "docid": "7b8405107a66156b596f5117785c4feb", "score": "0.516403", "text": "func (o *PatchedApplicationClientUpdate) UnsetReferralCode() {\n\to.ReferralCode.Unset()\n}", "title": "" }, { "docid": "f6b16c938d6d741e27d3c89ce2abe0ae", "score": "0.5141838", "text": "func (file *file) decref() error {\n\tif file.fdmu.Decref() {\n\t\treturn file.destroy()\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "7241d62bc5a4d94c66bd154e23124e62", "score": "0.5141221", "text": "func (r fileReady) Unset() error {\n\tif _, err := os.Stat(FileName); os.IsNotExist(err) {\n\t\treturn nil\n\t}\n\treturn os.Remove(FileName)\n}", "title": "" }, { "docid": "32e1717468456919d060871596ea85c9", "score": "0.51403475", "text": "func (fpuo *FloorPlanUpdateOne) ClearImage() *FloorPlanUpdateOne {\n\tfpuo.clearedImage = true\n\treturn fpuo\n}", "title": "" }, { "docid": "b8e8069d32a2bbf9f4943519ed39046f", "score": "0.5129085", "text": "func (i *Imports) RemoveRef(ref PackageRef) {\n\tif ref != nil {\n\t\tdelete(i.refs, ref.String())\n\t}\n}", "title": "" }, { "docid": "0ae9dded1a1189103c477b6f3c8efcea", "score": "0.51267296", "text": "func (e *ImageButton) Reset() {\n\te.ButtonImpl.Reset()\n\te.ImageImpl.Reset()\n}", "title": "" }, { "docid": "dec795be6e0671189d228b780e1d20d3", "score": "0.51125365", "text": "func (o RemoteImageBuildOutput) ForceRemove() pulumi.BoolPtrOutput {\n\treturn o.ApplyT(func(v RemoteImageBuild) *bool { return v.ForceRemove }).(pulumi.BoolPtrOutput)\n}", "title": "" }, { "docid": "0a0b3d1fd42a47f49b8264c92a6af68d", "score": "0.5112471", "text": "func (o RemoteImageBuildPtrOutput) ForceRemove() pulumi.BoolPtrOutput {\n\treturn o.ApplyT(func(v *RemoteImageBuild) *bool {\n\t\tif v == nil {\n\t\t\treturn nil\n\t\t}\n\t\treturn v.ForceRemove\n\t}).(pulumi.BoolPtrOutput)\n}", "title": "" }, { "docid": "b1bc31a452bcdd8f7fd5717e1e49cf39", "score": "0.5082721", "text": "func (mntns *MountNamespace) DecRef() {\n\tif refs := atomic.AddInt64(&mntns.refs, 0); refs == 0 {\n\t\t// TODO: unmount mntns.root\n\t} else if refs < 0 {\n\t\tpanic(\"MountNamespace.DecRef() called without holding a reference\")\n\t}\n}", "title": "" }, { "docid": "e1512c2c185736efcfde94617d2b7b97", "score": "0.5070634", "text": "func (uuo *UserUpdateOne) ClearAvatarURL() *UserUpdateOne {\n\tuuo.mutation.ClearAvatarURL()\n\treturn uuo\n}", "title": "" }, { "docid": "6858cdb39b9c502e39eff29a42c2930f", "score": "0.504958", "text": "func (entry *ObjectCrossReferenceEntry) Reset() {\n\t*entry = ObjectCrossReferenceEntry{}\n}", "title": "" }, { "docid": "0e4220d170d8bef1882265b98af80f3c", "score": "0.5027628", "text": "func (m *ProfileMutation) ClearAvatar() {\n\tm.avatar = nil\n\tm.clearedFields[profile.FieldAvatar] = struct{}{}\n}", "title": "" }, { "docid": "a84104468fb26e56684220c313921f73", "score": "0.50211567", "text": "func (m *PersonMutation) PictureCleared() bool {\n\t_, ok := m.clearedFields[person.FieldPicture]\n\treturn ok\n}", "title": "" }, { "docid": "d1f2dad95b3050d964daccae0ce33dc8", "score": "0.50156295", "text": "func (fpu *FloorPlanUpdate) ClearImage() *FloorPlanUpdate {\n\tfpu.clearedImage = true\n\treturn fpu\n}", "title": "" }, { "docid": "f61c11ef403a49ee96e1ff4ecccffd4f", "score": "0.5013131", "text": "func (i *ImageReference) 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 \"exactVersion\":\n\t\t\terr = unpopulate(val, \"ExactVersion\", &i.ExactVersion)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"offer\":\n\t\t\terr = unpopulate(val, \"Offer\", &i.Offer)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"publisher\":\n\t\t\terr = unpopulate(val, \"Publisher\", &i.Publisher)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"sku\":\n\t\t\terr = unpopulate(val, \"SKU\", &i.SKU)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"version\":\n\t\t\terr = unpopulate(val, \"Version\", &i.Version)\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}", "title": "" }, { "docid": "4112520e10fa02d644fc08b4509c703c", "score": "0.5008282", "text": "func (v *SettingsSchema) Unref() {\n\tC.g_settings_schema_unref(v.native())\n}", "title": "" }, { "docid": "6eab9ed87f5c3cc6f496c7d0b8d5ca7d", "score": "0.50005835", "text": "func (o *Image) ClearMipmaps() {\n\t//log.Println(\"Calling Image.ClearMipmaps()\")\n\n\t// Build out the method's arguments\n\tptrArguments := make([]gdnative.Pointer, 0, 0)\n\n\t// Get the method bind\n\tmethodBind := gdnative.NewMethodBind(\"Image\", \"clear_mipmaps\")\n\n\t// Call the parent method.\n\t// void\n\tretPtr := gdnative.NewEmptyVoid()\n\tgdnative.MethodBindPtrCall(methodBind, o.GetBaseObject(), ptrArguments, retPtr)\n\n}", "title": "" }, { "docid": "717fc0be0618e2446cbe898c39721a38", "score": "0.49997768", "text": "func (fs *Filesystem) DecRef() {\n\tif refs := atomic.AddInt64(&fs.refs, -1); refs == 0 {\n\t\tfs.vfs.filesystemsMu.Lock()\n\t\tdelete(fs.vfs.filesystems, fs)\n\t\tfs.vfs.filesystemsMu.Unlock()\n\t\tfs.impl.Release()\n\t} else if refs < 0 {\n\t\tpanic(\"Filesystem.decRef() called without holding a reference\")\n\t}\n}", "title": "" }, { "docid": "cb54ec22cec67276db74b928371b0382", "score": "0.4999425", "text": "func (i *Image) Free() error {\n\treturn nil\n}", "title": "" }, { "docid": "c4c49cb3cf90fcb7cef171396a07f3fc", "score": "0.49980655", "text": "func (rc *RCBitmap) Clear() {\r\n\t*rc = *NewRC(rc.start, rc.end, int(rc.n))\r\n}", "title": "" }, { "docid": "c596d6e17162f6605ca5a462e70249b9", "score": "0.49972993", "text": "func (session *DBSession) RemoveImageReferencesFromEvents(image *Image) error {\n\t// @todo\n\treturn nil\n}", "title": "" }, { "docid": "22ba58d7d4f5ac15975f29ddbd04a463", "score": "0.49865866", "text": "func (i *Image) Free() {\n\tC.uiFreeImage(i.i)\n}", "title": "" }, { "docid": "6df980ef64f7dbfa11bf78dd99468d60", "score": "0.49416098", "text": "func (e *HTMLImage) Ref(dest *DOMElement) *HTMLImage {\n\te.ref = dest\n\treturn e\n}", "title": "" }, { "docid": "bc292028da6a9a346990c097ffca3a2d", "score": "0.49044028", "text": "func ImageFree(img *Image) {\n\tcimg, _ := img.PassRef()\n\tC.vpx_img_free(cimg)\n}", "title": "" }, { "docid": "7bc25dd21d5300723aeb0bf36dcbb2fd", "score": "0.49008474", "text": "func (t *Texture) Reset() {\n\tt.NativeTexture = nil\n\tt.Loaded = false\n\tt.KeepDataOnLoad = false\n\tt.Dynamic = false\n\tt.Bounds = image.Rectangle{}\n\tt.Source = nil\n\tt.Format = RGBA\n\tt.WrapU = 0\n\tt.WrapV = 0\n\tt.BorderColor = Color{}\n\tt.MinFilter = 0\n\tt.MagFilter = 0\n}", "title": "" }, { "docid": "6cc0b14eec048109c1ab4ac6e6de09c2", "score": "0.48984635", "text": "func (i *imageRefCache) ImageRef(imageRef string) (ImageRef, bool) {\n\ti.mutex.Lock()\n\tdefer i.mutex.Unlock()\n\tref, err := regname.NewDigest(imageRef)\n\tif err != nil {\n\t\tpanic(fmt.Sprintf(\"Internal inconsistency: Image '%s' needs to be a full reference\", imageRef))\n\t}\n\n\tfoundImgRef, found := i.cache[ref.DigestStr()]\n\treturn foundImgRef, found\n}", "title": "" }, { "docid": "7ac874945fb217a853a065303d02233b", "score": "0.4887389", "text": "func (v *SettingsSchemaSource) Unref() {\n\tC.g_settings_schema_source_unref(v.native())\n}", "title": "" }, { "docid": "0ebcff9d44ce8ef1ff7f0ff817ceb14a", "score": "0.48763254", "text": "func cleanUpImage(t *testing.T, name string) {\n\tt.Helper()\n\n\tif keepArtifacts {\n\t\treturn\n\t}\n\tif _, err := runOutput(\"docker\", \"rmi\", \"-f\", name); err != nil {\n\t\tt.Logf(\"Failed to clean up image: %v\", err)\n\t}\n}", "title": "" }, { "docid": "da7e88793a843eba5b2dfe364a825c00", "score": "0.48661277", "text": "func UnmarshalNetworkInterfaceReferenceDeleted(m map[string]json.RawMessage, result interface{}) (err error) {\n\tobj := new(NetworkInterfaceReferenceDeleted)\n\terr = core.UnmarshalPrimitive(m, \"more_info\", &obj.MoreInfo)\n\tif err != nil {\n\t\treturn\n\t}\n\treflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj))\n\treturn\n}", "title": "" }, { "docid": "ecba36fc8aa077dfe755234231a2005d", "score": "0.48554876", "text": "func (uu *UserUpdate) ClearAvatarURL() *UserUpdate {\n\tuu.mutation.ClearAvatarURL()\n\treturn uu\n}", "title": "" }, { "docid": "1d7dd5ce6360e0a6f53094f5f79353e9", "score": "0.48478776", "text": "func (img Image) Release() {\n\timg.tex.Delete()\n}", "title": "" }, { "docid": "279fcbe948726391e8bd2259dce9d2d2", "score": "0.48471576", "text": "func (i *Image) Free() error {\n\tif i == nil {\n\t\treturn nil\n\t}\n\tif i.Display != nil && i == i.Display.ScreenImage {\n\t\tpanic(\"freeimage of ScreenImage\")\n\t}\n\ti.Display.mu.Lock()\n\tdefer i.Display.mu.Unlock()\n\treturn i.free()\n}", "title": "" }, { "docid": "f7910f453e8e8717c44bdc6e9d2fa914", "score": "0.48416892", "text": "func (v *NullableNoteWidgetDefinitionType) Unset() {\n\tv.value = nil\n\tv.isSet = false\n}", "title": "" }, { "docid": "e5849c60edfae1ed0bbb8c8af904ba4c", "score": "0.48315683", "text": "func DecodeReferenced(reader io.Reader, reference *Bitmap) (*Bitmap, error) {\n\treturn nil, errors.New(\"not implemented\")\n}", "title": "" }, { "docid": "9599e21c9a61e78c5ddf7f195e00d99a", "score": "0.48312634", "text": "func (o *Bundle) DigestRef() string { return o.plainImg.DigestRef() }", "title": "" }, { "docid": "4119047d6ce0dba2486bcb154dc09051", "score": "0.48307863", "text": "func (mat *Material) Clean() {\n\tmat.Prog = 0\n}", "title": "" }, { "docid": "3e8f416575cc90be15953ffa2f10ca5d", "score": "0.4829687", "text": "func (m *UserMutation) ResetAttachment() {\n\tm.attachment = nil\n\tm.clearedattachment = false\n}", "title": "" }, { "docid": "9eacc0dfc843ebb94c8a54f6c487f370", "score": "0.48093128", "text": "func (dc *DatadogCollector) GCUntaggedImageRemoved() error {\n\treturn dc.c.Count(\"gc.rm_untagged_image\", 1, nil, 1)\n}", "title": "" }, { "docid": "c87201ee28b90fec4478b50a204ea388", "score": "0.4808262", "text": "func Xsqlite3KeyInfoUnref(tls *libc.TLS, p uintptr) { /* sqlite3.c:132481:21: */\n\tif p != 0 {\n\n\t\t(*KeyInfo)(unsafe.Pointer(p)).FnRef--\n\t\tif (*KeyInfo)(unsafe.Pointer(p)).FnRef == U32(0) {\n\t\t\tXsqlite3DbFreeNN(tls, (*KeyInfo)(unsafe.Pointer(p)).Fdb, p)\n\t\t}\n\t}\n}", "title": "" }, { "docid": "10f2bf285d18955e3cfa09a70e347d44", "score": "0.4804986", "text": "func (this *CRef) UnRef() {\n\tC.pthread_mutex_unlock(&this.mut)\n\tC.pthread_mutex_destroy(&this.mut)\n}", "title": "" }, { "docid": "66bd5dc3d076202ac46cfeb9ed7e6ec7", "score": "0.4804149", "text": "func (s *Session) Unref() error {\n\tif atomic.AddUint32(&s.refs, ^uint32(0)) == 0 {\n\t\treturn s.Close()\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "0ed892b1c049da96d5f963424da8dc97", "score": "0.48029408", "text": "func (c *Client) RemoveImage(ctx context.Context, ref string) error {\n\twrapperCli, err := c.Get(ctx)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"failed to get a containerd grpc client: %v\", err)\n\t}\n\n\tif err := wrapperCli.client.ImageService().Delete(ctx, ref); err != nil {\n\t\treturn errors.Wrap(err, \"failed to remove image\")\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "154560a827bb5c3091b804fd4dec4463", "score": "0.4788237", "text": "func (i *Image) Clear() error {\n\ti.copyCheck()\n\tif i.isDisposed() {\n\t\treturn nil\n\t}\n\ti.fill(0, 0, 0, 0)\n\treturn nil\n}", "title": "" }, { "docid": "136ab136e1919bc0d9cc49c38a6425f0", "score": "0.47803995", "text": "func (v *NullableSyntheticsBasicAuthNTLMType) Unset() {\n\tv.value = nil\n\tv.isSet = false\n}", "title": "" }, { "docid": "fb374d641cbde5d28facc5210a2fecb7", "score": "0.4766639", "text": "func (r *ChildLocRef) decRef(bufManager BufManager) *ChildLocRef {\n\tif r == nil {\n\t\treturn nil\n\t}\n\n\tif r.refs <= 0 {\n\t\tpanic(\"ChildLocRef.refs defRef saw underflow\")\n\t}\n\n\tr.refs--\n\tif r.refs <= 0 {\n\t\tr.next.decRef(bufManager)\n\t\tr.next = nil\n\n\t\tif r.reclaimables != nil {\n\t\t\tr.reclaimables.Reset(bufManager)\n\t\t}\n\n\t\treturn nil\n\t}\n\n\treturn r\n}", "title": "" }, { "docid": "c7264d7dd101ee12ba5dc9fc9ed7da76", "score": "0.47621787", "text": "func (n *NBitmap) Clear() {\r\n\t*n = *New()\r\n}", "title": "" }, { "docid": "49e6711ff718d290285af18dda5c4100", "score": "0.47459522", "text": "func UnmarshalImageFilePrototype(m map[string]json.RawMessage, result interface{}) (err error) {\n\tobj := new(ImageFilePrototype)\n\terr = core.UnmarshalPrimitive(m, \"href\", &obj.Href)\n\tif err != nil {\n\t\treturn\n\t}\n\treflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj))\n\treturn\n}", "title": "" }, { "docid": "aeaba06f1044fa7eaf9c1a896119d145", "score": "0.47439334", "text": "func (b *Bitmap) Unset(pos uint64) bool {\n\tif pos >= b.size {\n\t\treturn false\n\t}\n\tb.data[pos>>3] &= ^(1 << (pos & 0x07))\n\treturn true\n}", "title": "" }, { "docid": "dd15f07f8696391c8d51f5ddb1010d24", "score": "0.47432542", "text": "func ResetBitmapBlender() {\n\tC.al_reset_bitmap_blender()\n}", "title": "" }, { "docid": "288b9904d5ceab13470886a48bf7a494", "score": "0.47427303", "text": "func UnmarshalSnapshotReference(m map[string]json.RawMessage, result interface{}) (err error) {\n\tobj := new(SnapshotReference)\n\terr = core.UnmarshalPrimitive(m, \"crn\", &obj.CRN)\n\tif err != nil {\n\t\treturn\n\t}\n\terr = core.UnmarshalModel(m, \"deleted\", &obj.Deleted, UnmarshalSnapshotReferenceDeleted)\n\tif err != nil {\n\t\treturn\n\t}\n\terr = core.UnmarshalPrimitive(m, \"href\", &obj.Href)\n\tif err != nil {\n\t\treturn\n\t}\n\terr = core.UnmarshalPrimitive(m, \"id\", &obj.ID)\n\tif err != nil {\n\t\treturn\n\t}\n\terr = core.UnmarshalPrimitive(m, \"name\", &obj.Name)\n\tif err != nil {\n\t\treturn\n\t}\n\terr = core.UnmarshalPrimitive(m, \"resource_type\", &obj.ResourceType)\n\tif err != nil {\n\t\treturn\n\t}\n\treflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj))\n\treturn\n}", "title": "" }, { "docid": "ecedfc3d5f39e69f4f65ad42350763de", "score": "0.47375304", "text": "func (wm *webhookCABundleManager) UnmanageWebhookCABundle(obj runtime.Object) error {\n\tkey, err := wm.namespacedNameForWebhook(obj)\n\tif err != nil {\n\t\treturn err\n\t}\n\twm.mu.Lock()\n\tdefer wm.mu.Unlock()\n\tif source, ok := wm.webhooksToBundleSource[key]; ok {\n\t\tdelete(wm.webhooksToBundleSource, key)\n\t\tfor _, objRef := range source.MatchedObjects() {\n\t\t\twebhooks := wm.objectRefsToWebhooks[objRef]\n\t\t\tif len(webhooks) == 1 {\n\t\t\t\tdelete(wm.objectRefsToWebhooks, objRef)\n\t\t\t} else if len(webhooks) > 1 {\n\t\t\t\tdelete(wm.objectRefsToWebhooks[objRef], key)\n\t\t\t}\n\t\t}\n\t} else {\n\t\treturn fmt.Errorf(\"not managing webhook %s\", key)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "a265b2e4bb9d8d74bd7e8cb60f692d39", "score": "0.4733308", "text": "func (o *CloudNetworkInterfaceAttachmentAllOf) UnsetAccessConfig() {\n\to.AccessConfig.Unset()\n}", "title": "" }, { "docid": "85a1024fc6a70f6f02ae0a41667ee26e", "score": "0.47250465", "text": "func MsDefUnarchived(db *bolt.DB, key string) (*MicroserviceDefinition, error) {\n\treturn microserviceDefStateUpdate(db, key, func(c MicroserviceDefinition) *MicroserviceDefinition {\n\t\tc.Archived = false\n\t\treturn &c\n\t})\n}", "title": "" }, { "docid": "599308dab76d0a5942e10d75abedc58c", "score": "0.47226554", "text": "func (t *Texture) ClearData() {\n\tif !t.KeepDataOnLoad {\n\t\tt.Source = nil\n\t}\n}", "title": "" }, { "docid": "378349f5a910856b0633ddf58ac137d1", "score": "0.47064722", "text": "func munmap(db *DB) error {\n\t// Ignore the unmap if we have no mapped data.\n\tif db.dataref == nil {\n\t\treturn nil\n\t}\n\n\t// Unmap using the original byte slice.\n\terr := syscall.Munmap(db.dataref)\n\tdb.dataref = nil\n\tdb.data = nil\n\tdb.datasz = 0\n\treturn err\n}", "title": "" }, { "docid": "be94f303ed40acd9ffbc930aa3d0fc46", "score": "0.470634", "text": "func (o *VirtualizationIweCluster) UnsetMemoryAllocation() {\n\to.MemoryAllocation.Unset()\n}", "title": "" }, { "docid": "6c9ddbe0e90b607c658c21f658c036c1", "score": "0.47047007", "text": "func MaybeRemoveVolumeRefConfig(ctx *zedmanagerContext, appInstID uuid.UUID,\n\tvolumeID uuid.UUID, generationCounter int64) {\n\n\tkey := fmt.Sprintf(\"%s#%d\", volumeID.String(), generationCounter)\n\tlog.Functionf(\"MaybeRemoveVolumeRefConfig for %s\", key)\n\tm := lookupVolumeRefConfig(ctx, key)\n\tif m == nil {\n\t\tlog.Functionf(\"MaybeRemoveVolumeRefConfig: config missing for %s\", key)\n\t\treturn\n\t}\n\tif m.RefCount == 0 {\n\t\tlog.Fatalf(\"MaybeRemoveVolumeRefConfig: Attempting to reduce \"+\n\t\t\t\"0 RefCount for %s\", key)\n\t}\n\tm.RefCount--\n\tif m.RefCount == 0 {\n\t\tlog.Functionf(\"MaybeRemoveVolumeRefConfig deleting %s\", key)\n\t\tunpublishVolumeRefConfig(ctx, key)\n\t} else {\n\t\tlog.Functionf(\"MaybeRemoveVolumeRefConfig remaining RefCount %d for %s\",\n\t\t\tm.RefCount, key)\n\t\tpublishVolumeRefConfig(ctx, m)\n\t}\n\tbase.NewRelationObject(log, base.DeleteRelationType, base.AppInstanceConfigLogType, appInstID.String(),\n\t\tbase.VolumeRefConfigLogType, key).Noticef(\"App instance to volume relation.\")\n\tlog.Functionf(\"MaybeRemoveVolumeRefConfig done for %s\", key)\n}", "title": "" }, { "docid": "5ec5bb25a3b1eab23299d188431fa7eb", "score": "0.4699574", "text": "func (o *optionalBar) Unset() {\n\t*o = optionalBar{}\n}", "title": "" }, { "docid": "7a830b1d493152fd2cdc00ac66370481", "score": "0.46922022", "text": "func deleteRef(ref string, auth authn.Authenticator) error {\n\tname, err := name.ParseReference(ref)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\terr = remote.Delete(name, remote.WithAuth(auth))\n\tif err != nil {\n\t\treturn err\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "f9b57e824317df7cca5dbe5db871f0fd", "score": "0.46911573", "text": "func (o *ExportJob) UnsetExportedFileName() {\n\to.ExportedFileName.Unset()\n}", "title": "" }, { "docid": "742a36b3410149509d4f7b6746b66776", "score": "0.46868527", "text": "func (i *Image) Remove() {\n\tRemove(i)\n}", "title": "" }, { "docid": "b40e6a1b90aa7fb3540c8d180cad9bd0", "score": "0.4686273", "text": "func deleteImage(manifest Manifest, dry bool, auth authn.Authenticator,\n\trepository Repository) error {\n\n\tlogrus.Infof(\"Cleaning image with ref: %s (tags: %s)\", manifest.ref,\n\t\tmanifest.manifestInfo.Tags)\n\n\tif !dry {\n\t\t// Delete all tags\n\t\tfor _, tag := range manifest.manifestInfo.Tags {\n\t\t\tref := fmt.Sprintf(\"%s:%s\", repository.Name, tag)\n\t\t\terr := deleteRef(ref, auth)\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t\t// Delete image\n\t\tref := fmt.Sprintf(\"%s@%s\", repository.Name, manifest.ref)\n\t\terr := deleteRef(ref, auth)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "a88be3478d295783ef2423a1cef1412d", "score": "0.46846834", "text": "func (im *Image) Reset() {\n\tim.Zoom = 0\n\tim.Center.X = (1<<32 - 1) / 2\n\tim.Center.Y = (1<<32 - 1) / 2\n}", "title": "" }, { "docid": "836ea2086adea36176b099666d2e692b", "score": "0.46784842", "text": "func UnmarshalImageIdentityByHref(m map[string]json.RawMessage, result interface{}) (err error) {\n\tobj := new(ImageIdentityByHref)\n\terr = core.UnmarshalPrimitive(m, \"href\", &obj.Href)\n\tif err != nil {\n\t\treturn\n\t}\n\treflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj))\n\treturn\n}", "title": "" }, { "docid": "954b2d84f050fce51b9815c8cb5f7c27", "score": "0.4673465", "text": "func clearManifests(isi *api.ImageStreamImport) {\n\tfor i := range isi.Status.Images {\n\t\tif !isi.Spec.Images[i].IncludeManifest {\n\t\t\tif isi.Status.Images[i].Image != nil {\n\t\t\t\tisi.Status.Images[i].Image.DockerImageManifest = \"\"\n\t\t\t}\n\t\t}\n\t}\n\tif isi.Spec.Repository != nil && !isi.Spec.Repository.IncludeManifest {\n\t\tfor i := range isi.Status.Repository.Images {\n\t\t\tif isi.Status.Repository.Images[i].Image != nil {\n\t\t\t\tisi.Status.Repository.Images[i].Image.DockerImageManifest = \"\"\n\t\t\t}\n\t\t}\n\t}\n}", "title": "" }, { "docid": "614feeca447605e539410dfac0d9e2f3", "score": "0.4666286", "text": "func (sess *session) delRef(ctx context.Context, fid Fid,\n\tremove bool) error {\n\n\tref1, found := sess.refs.LoadAndDelete(fid)\n\tif !found {\n\t\treturn ErrUnknownfid\n\t}\n\tref, _ := ref1.(*SFid)\n\n\tref.Lock()\n\tdefer ref.Unlock()\n\tif ref.Ent == nil {\n\t\treturn nil\n\t}\n\n\treturn delRefAction(ctx, ref, remove)\n}", "title": "" }, { "docid": "445964441b742d7ba3eb4dc504f9923a", "score": "0.46619758", "text": "func (g *GeoM) Reset() {\n\tg.impl = nil\n}", "title": "" }, { "docid": "7a46da6f70c599a9b35cc480583c86c7", "score": "0.46607187", "text": "func (this *parkingLot) unmapRegNoFromColorMap(color string, regNo string) {\n\tdelete(this.colorRegNoMap[color], regNo)\n}", "title": "" }, { "docid": "3e293131aa282c4e2b7fbd5425156314", "score": "0.46539304", "text": "func (sic *StitchedImageCache) Invalidate() {\n\tsic.Lock()\n\tdefer sic.Unlock()\n\tsic.image = nil\n}", "title": "" }, { "docid": "b4fc876a192ec9fe6fbdc958696e5bcb", "score": "0.46521166", "text": "func (img *IplImage) ResetROI() {\n\tC.cvResetImageROI((*C.IplImage)(img))\n}", "title": "" }, { "docid": "c55e059067ddf6326eb8ae978eca0baa", "score": "0.46510994", "text": "func (slocs SegmentLocs) DecRef() {\n\tfor _, sloc := range slocs {\n\t\tif sloc.mref != nil {\n\t\t\tsloc.mref.DecRef()\n\t\t}\n\t}\n}", "title": "" } ]
b7b2af277a73f0247bc9662371aad162
ListArtifactsPagesWithContext same as ListArtifactsPages except it takes a Context and allows setting request options on the pages. The context must be nonnil and will be used for request cancellation. If the context is nil a panic will occur. In the future the SDK may create subcontexts for http.Requests. See for more information on using Contexts.
[ { "docid": "9b397d19102c27d3bd4d42c0072423ff", "score": "0.8573802", "text": "func (c *DeviceFarm) ListArtifactsPagesWithContext(ctx aws.Context, input *ListArtifactsInput, fn func(*ListArtifactsOutput, bool) bool, opts ...request.Option) error {\n\tp := request.Pagination{\n\t\tNewRequest: func() (*request.Request, error) {\n\t\t\tvar inCpy *ListArtifactsInput\n\t\t\tif input != nil {\n\t\t\t\ttmp := *input\n\t\t\t\tinCpy = &tmp\n\t\t\t}\n\t\t\treq, _ := c.ListArtifactsRequest(inCpy)\n\t\t\treq.SetContext(ctx)\n\t\t\treq.ApplyOptions(opts...)\n\t\t\treturn req, nil\n\t\t},\n\t}\n\n\tfor p.Next() {\n\t\tif !fn(p.Page().(*ListArtifactsOutput), !p.HasNextPage()) {\n\t\t\tbreak\n\t\t}\n\t}\n\n\treturn p.Err()\n}", "title": "" } ]
[ { "docid": "049c11482945d4d8bfbf8388faa9d91e", "score": "0.641079", "text": "func (c *DeviceFarm) ListTestGridSessionArtifactsPagesWithContext(ctx aws.Context, input *ListTestGridSessionArtifactsInput, fn func(*ListTestGridSessionArtifactsOutput, bool) bool, opts ...request.Option) error {\n\tp := request.Pagination{\n\t\tNewRequest: func() (*request.Request, error) {\n\t\t\tvar inCpy *ListTestGridSessionArtifactsInput\n\t\t\tif input != nil {\n\t\t\t\ttmp := *input\n\t\t\t\tinCpy = &tmp\n\t\t\t}\n\t\t\treq, _ := c.ListTestGridSessionArtifactsRequest(inCpy)\n\t\t\treq.SetContext(ctx)\n\t\t\treq.ApplyOptions(opts...)\n\t\t\treturn req, nil\n\t\t},\n\t}\n\n\tfor p.Next() {\n\t\tif !fn(p.Page().(*ListTestGridSessionArtifactsOutput), !p.HasNextPage()) {\n\t\t\tbreak\n\t\t}\n\t}\n\n\treturn p.Err()\n}", "title": "" }, { "docid": "5b375e16c7f81126e656e45ecb521fdf", "score": "0.5944665", "text": "func (c *MWAA) ListEnvironmentsPagesWithContext(ctx aws.Context, input *ListEnvironmentsInput, fn func(*ListEnvironmentsOutput, bool) bool, opts ...request.Option) error {\n\tp := request.Pagination{\n\t\tNewRequest: func() (*request.Request, error) {\n\t\t\tvar inCpy *ListEnvironmentsInput\n\t\t\tif input != nil {\n\t\t\t\ttmp := *input\n\t\t\t\tinCpy = &tmp\n\t\t\t}\n\t\t\treq, _ := c.ListEnvironmentsRequest(inCpy)\n\t\t\treq.SetContext(ctx)\n\t\t\treq.ApplyOptions(opts...)\n\t\t\treturn req, nil\n\t\t},\n\t}\n\n\tfor p.Next() {\n\t\tif !fn(p.Page().(*ListEnvironmentsOutput), !p.HasNextPage()) {\n\t\t\tbreak\n\t\t}\n\t}\n\n\treturn p.Err()\n}", "title": "" }, { "docid": "7b52695416e0edcb90d0a8465a54bf87", "score": "0.58898807", "text": "func (db *DynamoDb) ListExportsPagesWithContext(aws.Context, *dynamodb.ListExportsInput, func(*dynamodb.ListExportsOutput, bool) bool, ...request.Option) error {\n\tpanic(\"ListExportsPagesWithContext is not implemented\")\n}", "title": "" }, { "docid": "127da883d22a79271ef27afae714b28e", "score": "0.5847132", "text": "func (c *DeviceFarm) ListArtifactsWithContext(ctx aws.Context, input *ListArtifactsInput, opts ...request.Option) (*ListArtifactsOutput, error) {\n\treq, out := c.ListArtifactsRequest(input)\n\treq.SetContext(ctx)\n\treq.ApplyOptions(opts...)\n\treturn out, req.Send()\n}", "title": "" }, { "docid": "073898d884ce2084f5427def406522ed", "score": "0.5687526", "text": "func (c *NetworkManager) ListAttachmentsPagesWithContext(ctx aws.Context, input *ListAttachmentsInput, fn func(*ListAttachmentsOutput, bool) bool, opts ...request.Option) error {\n\tp := request.Pagination{\n\t\tNewRequest: func() (*request.Request, error) {\n\t\t\tvar inCpy *ListAttachmentsInput\n\t\t\tif input != nil {\n\t\t\t\ttmp := *input\n\t\t\t\tinCpy = &tmp\n\t\t\t}\n\t\t\treq, _ := c.ListAttachmentsRequest(inCpy)\n\t\t\treq.SetContext(ctx)\n\t\t\treq.ApplyOptions(opts...)\n\t\t\treturn req, nil\n\t\t},\n\t}\n\n\tfor p.Next() {\n\t\tif !fn(p.Page().(*ListAttachmentsOutput), !p.HasNextPage()) {\n\t\t\tbreak\n\t\t}\n\t}\n\n\treturn p.Err()\n}", "title": "" }, { "docid": "9cd724b46e3202fc940ab9482e1bd621", "score": "0.5687084", "text": "func (c *ProjectsLocationsMetadataStoresArtifactsListCall) Pages(ctx context.Context, f func(*GoogleCloudAiplatformV1ListArtifactsResponse) error) error {\n\tc.ctx_ = ctx\n\tdefer c.PageToken(c.urlParams_.Get(\"pageToken\")) // reset paging to original point\n\tfor {\n\t\tx, err := c.Do()\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tif err := f(x); err != nil {\n\t\t\treturn err\n\t\t}\n\t\tif x.NextPageToken == \"\" {\n\t\t\treturn nil\n\t\t}\n\t\tc.PageToken(x.NextPageToken)\n\t}\n}", "title": "" }, { "docid": "d9b0f5bf63280dc74b0a60119802e89b", "score": "0.5648469", "text": "func (c *Transfer) ListExecutionsPagesWithContext(ctx aws.Context, input *ListExecutionsInput, fn func(*ListExecutionsOutput, bool) bool, opts ...request.Option) error {\n\tp := request.Pagination{\n\t\tNewRequest: func() (*request.Request, error) {\n\t\t\tvar inCpy *ListExecutionsInput\n\t\t\tif input != nil {\n\t\t\t\ttmp := *input\n\t\t\t\tinCpy = &tmp\n\t\t\t}\n\t\t\treq, _ := c.ListExecutionsRequest(inCpy)\n\t\t\treq.SetContext(ctx)\n\t\t\treq.ApplyOptions(opts...)\n\t\t\treturn req, nil\n\t\t},\n\t}\n\n\tfor p.Next() {\n\t\tif !fn(p.Page().(*ListExecutionsOutput), !p.HasNextPage()) {\n\t\t\tbreak\n\t\t}\n\t}\n\n\treturn p.Err()\n}", "title": "" }, { "docid": "f7b9a71eafa47d85ee4bfe348c2cd7d1", "score": "0.554831", "text": "func (c *DeviceFarm) ListUploadsPagesWithContext(ctx aws.Context, input *ListUploadsInput, fn func(*ListUploadsOutput, bool) bool, opts ...request.Option) error {\n\tp := request.Pagination{\n\t\tNewRequest: func() (*request.Request, error) {\n\t\t\tvar inCpy *ListUploadsInput\n\t\t\tif input != nil {\n\t\t\t\ttmp := *input\n\t\t\t\tinCpy = &tmp\n\t\t\t}\n\t\t\treq, _ := c.ListUploadsRequest(inCpy)\n\t\t\treq.SetContext(ctx)\n\t\t\treq.ApplyOptions(opts...)\n\t\t\treturn req, nil\n\t\t},\n\t}\n\n\tfor p.Next() {\n\t\tif !fn(p.Page().(*ListUploadsOutput), !p.HasNextPage()) {\n\t\t\tbreak\n\t\t}\n\t}\n\n\treturn p.Err()\n}", "title": "" }, { "docid": "ee7dc3999ffe547ac886dc2affb01632", "score": "0.55433947", "text": "func (c *DeviceFarm) ListSuitesPagesWithContext(ctx aws.Context, input *ListSuitesInput, fn func(*ListSuitesOutput, bool) bool, opts ...request.Option) error {\n\tp := request.Pagination{\n\t\tNewRequest: func() (*request.Request, error) {\n\t\t\tvar inCpy *ListSuitesInput\n\t\t\tif input != nil {\n\t\t\t\ttmp := *input\n\t\t\t\tinCpy = &tmp\n\t\t\t}\n\t\t\treq, _ := c.ListSuitesRequest(inCpy)\n\t\t\treq.SetContext(ctx)\n\t\t\treq.ApplyOptions(opts...)\n\t\t\treturn req, nil\n\t\t},\n\t}\n\n\tfor p.Next() {\n\t\tif !fn(p.Page().(*ListSuitesOutput), !p.HasNextPage()) {\n\t\t\tbreak\n\t\t}\n\t}\n\n\treturn p.Err()\n}", "title": "" }, { "docid": "796cdc8e6d1f5c3e9f73d45e07914672", "score": "0.54679805", "text": "func (c *CloudTrail) ListImportFailuresPagesWithContext(ctx aws.Context, input *ListImportFailuresInput, fn func(*ListImportFailuresOutput, bool) bool, opts ...request.Option) error {\n\tp := request.Pagination{\n\t\tNewRequest: func() (*request.Request, error) {\n\t\t\tvar inCpy *ListImportFailuresInput\n\t\t\tif input != nil {\n\t\t\t\ttmp := *input\n\t\t\t\tinCpy = &tmp\n\t\t\t}\n\t\t\treq, _ := c.ListImportFailuresRequest(inCpy)\n\t\t\treq.SetContext(ctx)\n\t\t\treq.ApplyOptions(opts...)\n\t\t\treturn req, nil\n\t\t},\n\t}\n\n\tfor p.Next() {\n\t\tif !fn(p.Page().(*ListImportFailuresOutput), !p.HasNextPage()) {\n\t\t\tbreak\n\t\t}\n\t}\n\n\treturn p.Err()\n}", "title": "" }, { "docid": "1f7c49a55df58c2f660397591c1929a9", "score": "0.5452486", "text": "func (c *Inspector) ListExclusionsPagesWithContext(ctx aws.Context, input *ListExclusionsInput, fn func(*ListExclusionsOutput, bool) bool, opts ...request.Option) error {\n\tp := request.Pagination{\n\t\tNewRequest: func() (*request.Request, error) {\n\t\t\tvar inCpy *ListExclusionsInput\n\t\t\tif input != nil {\n\t\t\t\ttmp := *input\n\t\t\t\tinCpy = &tmp\n\t\t\t}\n\t\t\treq, _ := c.ListExclusionsRequest(inCpy)\n\t\t\treq.SetContext(ctx)\n\t\t\treq.ApplyOptions(opts...)\n\t\t\treturn req, nil\n\t\t},\n\t}\n\n\tfor p.Next() {\n\t\tif !fn(p.Page().(*ListExclusionsOutput), !p.HasNextPage()) {\n\t\t\tbreak\n\t\t}\n\t}\n\n\treturn p.Err()\n}", "title": "" }, { "docid": "6a90334e384444e84ddf0e503f506a91", "score": "0.5307174", "text": "func (_m *MockcloudFormationAPI) ListExportsPagesWithContext(_parameter_0 context.Context, _parameter_1 *cloudformation.ListExportsInput, _parameter_2 func(*cloudformation.ListExportsOutput, bool) bool, _parameter_3 ...request.Option) (_result_0 error) {\n\tvarParams := make([]interface{}, 3+len(_parameter_3))\n\tvarParams[0] = _parameter_0\n\tvarParams[1] = _parameter_1\n\tvarParams[2] = _parameter_2\n\tfor varIndex, varParam := range _parameter_3 {\n\t\tvarParams[3+varIndex] = varParam\n\t}\n\n\tret := _m.Called(varParams...)\n\n\tvar r0 error\n\tif rf, ok := ret.Get(0).(func(context.Context, *cloudformation.ListExportsInput, func(*cloudformation.ListExportsOutput, bool) bool, ...request.Option) error); ok {\n\t\tr0 = rf(_parameter_0, _parameter_1, _parameter_2, _parameter_3...)\n\t} else {\n\t\tr0 = ret.Error(0)\n\t}\n\n\treturn r0\n}", "title": "" }, { "docid": "cca270b638b2a0ed0bd1681c134e5e7c", "score": "0.5284026", "text": "func (c *DeviceFarm) ListOfferingsPagesWithContext(ctx aws.Context, input *ListOfferingsInput, fn func(*ListOfferingsOutput, bool) bool, opts ...request.Option) error {\n\tp := request.Pagination{\n\t\tNewRequest: func() (*request.Request, error) {\n\t\t\tvar inCpy *ListOfferingsInput\n\t\t\tif input != nil {\n\t\t\t\ttmp := *input\n\t\t\t\tinCpy = &tmp\n\t\t\t}\n\t\t\treq, _ := c.ListOfferingsRequest(inCpy)\n\t\t\treq.SetContext(ctx)\n\t\t\treq.ApplyOptions(opts...)\n\t\t\treturn req, nil\n\t\t},\n\t}\n\n\tfor p.Next() {\n\t\tif !fn(p.Page().(*ListOfferingsOutput), !p.HasNextPage()) {\n\t\t\tbreak\n\t\t}\n\t}\n\n\treturn p.Err()\n}", "title": "" }, { "docid": "1b0867cecc492b65ea83fc80a0a99345", "score": "0.5273038", "text": "func (c *OAM) ListAttachedLinksPagesWithContext(ctx aws.Context, input *ListAttachedLinksInput, fn func(*ListAttachedLinksOutput, bool) bool, opts ...request.Option) error {\n\tp := request.Pagination{\n\t\tNewRequest: func() (*request.Request, error) {\n\t\t\tvar inCpy *ListAttachedLinksInput\n\t\t\tif input != nil {\n\t\t\t\ttmp := *input\n\t\t\t\tinCpy = &tmp\n\t\t\t}\n\t\t\treq, _ := c.ListAttachedLinksRequest(inCpy)\n\t\t\treq.SetContext(ctx)\n\t\t\treq.ApplyOptions(opts...)\n\t\t\treturn req, nil\n\t\t},\n\t}\n\n\tfor p.Next() {\n\t\tif !fn(p.Page().(*ListAttachedLinksOutput), !p.HasNextPage()) {\n\t\t\tbreak\n\t\t}\n\t}\n\n\treturn p.Err()\n}", "title": "" }, { "docid": "9df44730e701cffe397ffbdb3588728a", "score": "0.52443075", "text": "func (c *RAM) ListPermissionVersionsPagesWithContext(ctx aws.Context, input *ListPermissionVersionsInput, fn func(*ListPermissionVersionsOutput, bool) bool, opts ...request.Option) error {\n\tp := request.Pagination{\n\t\tNewRequest: func() (*request.Request, error) {\n\t\t\tvar inCpy *ListPermissionVersionsInput\n\t\t\tif input != nil {\n\t\t\t\ttmp := *input\n\t\t\t\tinCpy = &tmp\n\t\t\t}\n\t\t\treq, _ := c.ListPermissionVersionsRequest(inCpy)\n\t\t\treq.SetContext(ctx)\n\t\t\treq.ApplyOptions(opts...)\n\t\t\treturn req, nil\n\t\t},\n\t}\n\n\tfor p.Next() {\n\t\tif !fn(p.Page().(*ListPermissionVersionsOutput), !p.HasNextPage()) {\n\t\t\tbreak\n\t\t}\n\t}\n\n\treturn p.Err()\n}", "title": "" }, { "docid": "95b57818f59da25f09d48a2a7f2166d4", "score": "0.5237261", "text": "func ExampleArtifactsClient_NewListPager() {\n\tcred, err := azidentity.NewDefaultAzureCredential(nil)\n\tif err != nil {\n\t\tlog.Fatalf(\"failed to obtain a credential: %v\", err)\n\t}\n\tctx := context.Background()\n\tclientFactory, err := armdevtestlabs.NewClientFactory(\"<subscription-id>\", cred, nil)\n\tif err != nil {\n\t\tlog.Fatalf(\"failed to create client: %v\", err)\n\t}\n\tpager := clientFactory.NewArtifactsClient().NewListPager(\"resourceGroupName\", \"{labName}\", \"{artifactSourceName}\", &armdevtestlabs.ArtifactsClientListOptions{Expand: nil,\n\t\tFilter: nil,\n\t\tTop: nil,\n\t\tOrderby: nil,\n\t})\n\tfor pager.More() {\n\t\tpage, err := pager.NextPage(ctx)\n\t\tif err != nil {\n\t\t\tlog.Fatalf(\"failed to advance page: %v\", err)\n\t\t}\n\t\tfor _, v := range page.Value {\n\t\t\t// You could use page here. We use blank identifier for just demo purposes.\n\t\t\t_ = v\n\t\t}\n\t\t// If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes.\n\t\t// page.ArtifactList = armdevtestlabs.ArtifactList{\n\t\t// \tValue: []*armdevtestlabs.Artifact{\n\t\t// \t\t{\n\t\t// \t\t\tName: to.Ptr(\"{artifactName}\"),\n\t\t// \t\t\tType: to.Ptr(\"Microsoft.DevTestLab/labs/artifactSources/artifacts\"),\n\t\t// \t\t\tID: to.Ptr(\"/subscriptions/{subscriptionId}/resourceGroups/resourceGroupName/providers/Microsoft.DevTestLab/labs/{labName}/artifactSources/{artifactSourceName}/artifacts/{artifactName}\"),\n\t\t// \t\t\tLocation: to.Ptr(\"{location}\"),\n\t\t// \t\t\tTags: map[string]*string{\n\t\t// \t\t\t\t\"MyTag\": to.Ptr(\"MyValue\"),\n\t\t// \t\t\t},\n\t\t// \t\t\tProperties: &armdevtestlabs.ArtifactProperties{\n\t\t// \t\t\t\tDescription: to.Ptr(\"Sample artifact description.\"),\n\t\t// \t\t\t\tFilePath: to.Ptr(\"{artifactsPath}/{artifactName}\"),\n\t\t// \t\t\t\tParameters: map[string]any{\n\t\t// \t\t\t\t\t\"uri\":map[string]any{\n\t\t// \t\t\t\t\t\t\"type\": \"string\",\n\t\t// \t\t\t\t\t\t\"description\": \"Sample parameter 1 description.\",\n\t\t// \t\t\t\t\t\t\"defaultValue\": \"https://{labStorageAccount}.blob.core.windows.net/{artifactName}/...\",\n\t\t// \t\t\t\t\t\t\"displayName\": \"Sample Parameter 1\",\n\t\t// \t\t\t\t\t},\n\t\t// \t\t\t\t},\n\t\t// \t\t\t\tPublisher: to.Ptr(\"Microsoft\"),\n\t\t// \t\t\t\tTargetOsType: to.Ptr(\"Windows\"),\n\t\t// \t\t\t\tTitle: to.Ptr(\"Sample Artifact Title\"),\n\t\t// \t\t\t},\n\t\t// \t}},\n\t\t// }\n\t}\n}", "title": "" }, { "docid": "549e81e5ee80607153cbbc7ddf307f98", "score": "0.5236255", "text": "func (c *Transfer) ListAccessesPagesWithContext(ctx aws.Context, input *ListAccessesInput, fn func(*ListAccessesOutput, bool) bool, opts ...request.Option) error {\n\tp := request.Pagination{\n\t\tNewRequest: func() (*request.Request, error) {\n\t\t\tvar inCpy *ListAccessesInput\n\t\t\tif input != nil {\n\t\t\t\ttmp := *input\n\t\t\t\tinCpy = &tmp\n\t\t\t}\n\t\t\treq, _ := c.ListAccessesRequest(inCpy)\n\t\t\treq.SetContext(ctx)\n\t\t\treq.ApplyOptions(opts...)\n\t\t\treturn req, nil\n\t\t},\n\t}\n\n\tfor p.Next() {\n\t\tif !fn(p.Page().(*ListAccessesOutput), !p.HasNextPage()) {\n\t\t\tbreak\n\t\t}\n\t}\n\n\treturn p.Err()\n}", "title": "" }, { "docid": "359196edcbedee5ad8c50d852b6905d0", "score": "0.5233023", "text": "func (c *OAM) ListSinksPagesWithContext(ctx aws.Context, input *ListSinksInput, fn func(*ListSinksOutput, bool) bool, opts ...request.Option) error {\n\tp := request.Pagination{\n\t\tNewRequest: func() (*request.Request, error) {\n\t\t\tvar inCpy *ListSinksInput\n\t\t\tif input != nil {\n\t\t\t\ttmp := *input\n\t\t\t\tinCpy = &tmp\n\t\t\t}\n\t\t\treq, _ := c.ListSinksRequest(inCpy)\n\t\t\treq.SetContext(ctx)\n\t\t\treq.ApplyOptions(opts...)\n\t\t\treturn req, nil\n\t\t},\n\t}\n\n\tfor p.Next() {\n\t\tif !fn(p.Page().(*ListSinksOutput), !p.HasNextPage()) {\n\t\t\tbreak\n\t\t}\n\t}\n\n\treturn p.Err()\n}", "title": "" }, { "docid": "e5ff6d8e4e35347ccce0b23cc6430b07", "score": "0.5216667", "text": "func NewListArtifactsPaginator(client ListArtifactsAPIClient, params *ListArtifactsInput, optFns ...func(*ListArtifactsPaginatorOptions)) *ListArtifactsPaginator {\n\tif params == nil {\n\t\tparams = &ListArtifactsInput{}\n\t}\n\n\toptions := ListArtifactsPaginatorOptions{}\n\n\tfor _, fn := range optFns {\n\t\tfn(&options)\n\t}\n\n\treturn &ListArtifactsPaginator{\n\t\toptions: options,\n\t\tclient: client,\n\t\tparams: params,\n\t\tfirstPage: true,\n\t}\n}", "title": "" }, { "docid": "02844381d97b34da620221f44ac12e15", "score": "0.5200268", "text": "func (c *CloudTrail) ListTagsPagesWithContext(ctx aws.Context, input *ListTagsInput, fn func(*ListTagsOutput, bool) bool, opts ...request.Option) error {\n\tp := request.Pagination{\n\t\tNewRequest: func() (*request.Request, error) {\n\t\t\tvar inCpy *ListTagsInput\n\t\t\tif input != nil {\n\t\t\t\ttmp := *input\n\t\t\t\tinCpy = &tmp\n\t\t\t}\n\t\t\treq, _ := c.ListTagsRequest(inCpy)\n\t\t\treq.SetContext(ctx)\n\t\t\treq.ApplyOptions(opts...)\n\t\t\treturn req, nil\n\t\t},\n\t}\n\n\tfor p.Next() {\n\t\tif !fn(p.Page().(*ListTagsOutput), !p.HasNextPage()) {\n\t\t\tbreak\n\t\t}\n\t}\n\n\treturn p.Err()\n}", "title": "" }, { "docid": "bb92d5944c5a151bc6738608fb02b2d4", "score": "0.51950705", "text": "func (c *CloudTrail) ListEventDataStoresPagesWithContext(ctx aws.Context, input *ListEventDataStoresInput, fn func(*ListEventDataStoresOutput, bool) bool, opts ...request.Option) error {\n\tp := request.Pagination{\n\t\tNewRequest: func() (*request.Request, error) {\n\t\t\tvar inCpy *ListEventDataStoresInput\n\t\t\tif input != nil {\n\t\t\t\ttmp := *input\n\t\t\t\tinCpy = &tmp\n\t\t\t}\n\t\t\treq, _ := c.ListEventDataStoresRequest(inCpy)\n\t\t\treq.SetContext(ctx)\n\t\t\treq.ApplyOptions(opts...)\n\t\t\treturn req, nil\n\t\t},\n\t}\n\n\tfor p.Next() {\n\t\tif !fn(p.Page().(*ListEventDataStoresOutput), !p.HasNextPage()) {\n\t\t\tbreak\n\t\t}\n\t}\n\n\treturn p.Err()\n}", "title": "" }, { "docid": "15a45918c46cde3c92fd314f7e92bdbd", "score": "0.5186359", "text": "func (c *Mgn) DescribeJobLogItemsPagesWithContext(ctx aws.Context, input *DescribeJobLogItemsInput, fn func(*DescribeJobLogItemsOutput, bool) bool, opts ...request.Option) error {\n\tp := request.Pagination{\n\t\tNewRequest: func() (*request.Request, error) {\n\t\t\tvar inCpy *DescribeJobLogItemsInput\n\t\t\tif input != nil {\n\t\t\t\ttmp := *input\n\t\t\t\tinCpy = &tmp\n\t\t\t}\n\t\t\treq, _ := c.DescribeJobLogItemsRequest(inCpy)\n\t\t\treq.SetContext(ctx)\n\t\t\treq.ApplyOptions(opts...)\n\t\t\treturn req, nil\n\t\t},\n\t}\n\n\tfor p.Next() {\n\t\tif !fn(p.Page().(*DescribeJobLogItemsOutput), !p.HasNextPage()) {\n\t\t\tbreak\n\t\t}\n\t}\n\n\treturn p.Err()\n}", "title": "" }, { "docid": "f42db1431d1149ba104d74c3eb80611c", "score": "0.5171334", "text": "func (c *Inspector) ListAssessmentTargetsPagesWithContext(ctx aws.Context, input *ListAssessmentTargetsInput, fn func(*ListAssessmentTargetsOutput, bool) bool, opts ...request.Option) error {\n\tp := request.Pagination{\n\t\tNewRequest: func() (*request.Request, error) {\n\t\t\tvar inCpy *ListAssessmentTargetsInput\n\t\t\tif input != nil {\n\t\t\t\ttmp := *input\n\t\t\t\tinCpy = &tmp\n\t\t\t}\n\t\t\treq, _ := c.ListAssessmentTargetsRequest(inCpy)\n\t\t\treq.SetContext(ctx)\n\t\t\treq.ApplyOptions(opts...)\n\t\t\treturn req, nil\n\t\t},\n\t}\n\n\tfor p.Next() {\n\t\tif !fn(p.Page().(*ListAssessmentTargetsOutput), !p.HasNextPage()) {\n\t\t\tbreak\n\t\t}\n\t}\n\n\treturn p.Err()\n}", "title": "" }, { "docid": "08949f5b38b47f7401a0316c5d2b5fe3", "score": "0.5163539", "text": "func (c *DeviceFarm) ListJobsPagesWithContext(ctx aws.Context, input *ListJobsInput, fn func(*ListJobsOutput, bool) bool, opts ...request.Option) error {\n\tp := request.Pagination{\n\t\tNewRequest: func() (*request.Request, error) {\n\t\t\tvar inCpy *ListJobsInput\n\t\t\tif input != nil {\n\t\t\t\ttmp := *input\n\t\t\t\tinCpy = &tmp\n\t\t\t}\n\t\t\treq, _ := c.ListJobsRequest(inCpy)\n\t\t\treq.SetContext(ctx)\n\t\t\treq.ApplyOptions(opts...)\n\t\t\treturn req, nil\n\t\t},\n\t}\n\n\tfor p.Next() {\n\t\tif !fn(p.Page().(*ListJobsOutput), !p.HasNextPage()) {\n\t\t\tbreak\n\t\t}\n\t}\n\n\treturn p.Err()\n}", "title": "" }, { "docid": "23c6d7788f37f0c4df629e8e4825a691", "score": "0.51440996", "text": "func (b *Bucket) ListObjectVersionsPagesWithContext(\n\tctx aws.Context,\n\tprefix string,\n\tpageFunc func(*s3.ListObjectVersionsOutput, bool) bool,\n\topts ...option.ListObjectVersionsInput,\n) error {\n\treq := &s3.ListObjectVersionsInput{\n\t\tBucket: b.Name,\n\t\tPrefix: aws.String(prefix),\n\t}\n\n\tfor _, f := range opts {\n\t\tf(req)\n\t}\n\n\treturn b.S3.ListObjectVersionsPagesWithContext(ctx, req, pageFunc)\n}", "title": "" }, { "docid": "08ae141bb097165eaee0714a5c5fb727", "score": "0.50975084", "text": "func (c *Glacier) ListJobsPagesWithContext(ctx aws.Context, input *ListJobsInput, fn func(*ListJobsOutput, bool) bool, opts ...request.Option) error {\n\tp := request.Pagination{\n\t\tNewRequest: func() (*request.Request, error) {\n\t\t\tvar inCpy *ListJobsInput\n\t\t\tif input != nil {\n\t\t\t\ttmp := *input\n\t\t\t\tinCpy = &tmp\n\t\t\t}\n\t\t\treq, _ := c.ListJobsRequest(inCpy)\n\t\t\treq.SetContext(ctx)\n\t\t\treq.ApplyOptions(opts...)\n\t\t\treturn req, nil\n\t\t},\n\t}\n\n\tfor p.Next() {\n\t\tif !fn(p.Page().(*ListJobsOutput), !p.HasNextPage()) {\n\t\t\tbreak\n\t\t}\n\t}\n\n\treturn p.Err()\n}", "title": "" }, { "docid": "8900974792384b8f417e79b78d1ca9d2", "score": "0.50162977", "text": "func (m *MockCloudWatchLogsAPI) GetLogEventsPagesWithContext(arg0 aws.Context, arg1 *cloudwatchlogs.GetLogEventsInput, arg2 func(*cloudwatchlogs.GetLogEventsOutput, bool) bool, arg3 ...request.Option) error {\n\tvarargs := []interface{}{arg0, arg1, arg2}\n\tfor _, a := range arg3 {\n\t\tvarargs = append(varargs, a)\n\t}\n\tret := m.ctrl.Call(m, \"GetLogEventsPagesWithContext\", varargs...)\n\tret0, _ := ret[0].(error)\n\treturn ret0\n}", "title": "" }, { "docid": "b590be3733b5892354a93f7c93a59aac", "score": "0.50161666", "text": "func (c *Chime) ListAppInstancesPagesWithContext(ctx aws.Context, input *ListAppInstancesInput, fn func(*ListAppInstancesOutput, bool) bool, opts ...request.Option) error {\n\tp := request.Pagination{\n\t\tNewRequest: func() (*request.Request, error) {\n\t\t\tvar inCpy *ListAppInstancesInput\n\t\t\tif input != nil {\n\t\t\t\ttmp := *input\n\t\t\t\tinCpy = &tmp\n\t\t\t}\n\t\t\treq, _ := c.ListAppInstancesRequest(inCpy)\n\t\t\treq.SetContext(ctx)\n\t\t\treq.ApplyOptions(opts...)\n\t\t\treturn req, nil\n\t\t},\n\t}\n\n\tfor p.Next() {\n\t\tif !fn(p.Page().(*ListAppInstancesOutput), !p.HasNextPage()) {\n\t\t\tbreak\n\t\t}\n\t}\n\n\treturn p.Err()\n}", "title": "" }, { "docid": "de49434a20834942d4dd70f084157e2f", "score": "0.5007894", "text": "func (c *DeviceFarm) ListOfferingTransactionsPagesWithContext(ctx aws.Context, input *ListOfferingTransactionsInput, fn func(*ListOfferingTransactionsOutput, bool) bool, opts ...request.Option) error {\n\tp := request.Pagination{\n\t\tNewRequest: func() (*request.Request, error) {\n\t\t\tvar inCpy *ListOfferingTransactionsInput\n\t\t\tif input != nil {\n\t\t\t\ttmp := *input\n\t\t\t\tinCpy = &tmp\n\t\t\t}\n\t\t\treq, _ := c.ListOfferingTransactionsRequest(inCpy)\n\t\t\treq.SetContext(ctx)\n\t\t\treq.ApplyOptions(opts...)\n\t\t\treturn req, nil\n\t\t},\n\t}\n\n\tfor p.Next() {\n\t\tif !fn(p.Page().(*ListOfferingTransactionsOutput), !p.HasNextPage()) {\n\t\t\tbreak\n\t\t}\n\t}\n\n\treturn p.Err()\n}", "title": "" }, { "docid": "f536119289d1a78e524fc0f6837f4a14", "score": "0.49894863", "text": "func (c *Chime) ListMeetingsPagesWithContext(ctx aws.Context, input *ListMeetingsInput, fn func(*ListMeetingsOutput, bool) bool, opts ...request.Option) error {\n\tp := request.Pagination{\n\t\tNewRequest: func() (*request.Request, error) {\n\t\t\tvar inCpy *ListMeetingsInput\n\t\t\tif input != nil {\n\t\t\t\ttmp := *input\n\t\t\t\tinCpy = &tmp\n\t\t\t}\n\t\t\treq, _ := c.ListMeetingsRequest(inCpy)\n\t\t\treq.SetContext(ctx)\n\t\t\treq.ApplyOptions(opts...)\n\t\t\treturn req, nil\n\t\t},\n\t}\n\n\tfor p.Next() {\n\t\tif !fn(p.Page().(*ListMeetingsOutput), !p.HasNextPage()) {\n\t\t\tbreak\n\t\t}\n\t}\n\n\treturn p.Err()\n}", "title": "" }, { "docid": "9354d498dff501800c5193a2cd4917d0", "score": "0.4977933", "text": "func (c *IoT1ClickProjects) ListPlacementsPagesWithContext(ctx aws.Context, input *ListPlacementsInput, fn func(*ListPlacementsOutput, bool) bool, opts ...request.Option) error {\n\tp := request.Pagination{\n\t\tNewRequest: func() (*request.Request, error) {\n\t\t\tvar inCpy *ListPlacementsInput\n\t\t\tif input != nil {\n\t\t\t\ttmp := *input\n\t\t\t\tinCpy = &tmp\n\t\t\t}\n\t\t\treq, _ := c.ListPlacementsRequest(inCpy)\n\t\t\treq.SetContext(ctx)\n\t\t\treq.ApplyOptions(opts...)\n\t\t\treturn req, nil\n\t\t},\n\t}\n\n\tfor p.Next() {\n\t\tif !fn(p.Page().(*ListPlacementsOutput), !p.HasNextPage()) {\n\t\t\tbreak\n\t\t}\n\t}\n\n\treturn p.Err()\n}", "title": "" }, { "docid": "46029f459ecdd526027d2d91603fba65", "score": "0.4963161", "text": "func (c *ProjectsLocationsTensorboardsExperimentsListCall) Pages(ctx context.Context, f func(*GoogleCloudAiplatformV1ListTensorboardExperimentsResponse) error) error {\n\tc.ctx_ = ctx\n\tdefer c.PageToken(c.urlParams_.Get(\"pageToken\")) // reset paging to original point\n\tfor {\n\t\tx, err := c.Do()\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tif err := f(x); err != nil {\n\t\t\treturn err\n\t\t}\n\t\tif x.NextPageToken == \"\" {\n\t\t\treturn nil\n\t\t}\n\t\tc.PageToken(x.NextPageToken)\n\t}\n}", "title": "" }, { "docid": "0aba25e93da9f870cc1d9e825455ed03", "score": "0.49561068", "text": "func (c *RAM) ListPermissionsPagesWithContext(ctx aws.Context, input *ListPermissionsInput, fn func(*ListPermissionsOutput, bool) bool, opts ...request.Option) error {\n\tp := request.Pagination{\n\t\tNewRequest: func() (*request.Request, error) {\n\t\t\tvar inCpy *ListPermissionsInput\n\t\t\tif input != nil {\n\t\t\t\ttmp := *input\n\t\t\t\tinCpy = &tmp\n\t\t\t}\n\t\t\treq, _ := c.ListPermissionsRequest(inCpy)\n\t\t\treq.SetContext(ctx)\n\t\t\treq.ApplyOptions(opts...)\n\t\t\treturn req, nil\n\t\t},\n\t}\n\n\tfor p.Next() {\n\t\tif !fn(p.Page().(*ListPermissionsOutput), !p.HasNextPage()) {\n\t\t\tbreak\n\t\t}\n\t}\n\n\treturn p.Err()\n}", "title": "" }, { "docid": "7888ae1c8226dc684f01eb08ee2158c2", "score": "0.49318516", "text": "func (db *DynamoDb) ListTablesPagesWithContext(aws.Context, *dynamodb.ListTablesInput, func(*dynamodb.ListTablesOutput, bool) bool, ...request.Option) error {\n\tpanic(\"ListTablesPagesWithContext is not implemented\")\n}", "title": "" }, { "docid": "348dea3b74fec3f4f83556bed99ac31d", "score": "0.49123004", "text": "func (c *Glacier) ListVaultsPagesWithContext(ctx aws.Context, input *ListVaultsInput, fn func(*ListVaultsOutput, bool) bool, opts ...request.Option) error {\n\tp := request.Pagination{\n\t\tNewRequest: func() (*request.Request, error) {\n\t\t\tvar inCpy *ListVaultsInput\n\t\t\tif input != nil {\n\t\t\t\ttmp := *input\n\t\t\t\tinCpy = &tmp\n\t\t\t}\n\t\t\treq, _ := c.ListVaultsRequest(inCpy)\n\t\t\treq.SetContext(ctx)\n\t\t\treq.ApplyOptions(opts...)\n\t\t\treturn req, nil\n\t\t},\n\t}\n\n\tfor p.Next() {\n\t\tif !fn(p.Page().(*ListVaultsOutput), !p.HasNextPage()) {\n\t\t\tbreak\n\t\t}\n\t}\n\n\treturn p.Err()\n}", "title": "" }, { "docid": "8ada61e85953438ddd2a1d86f3bba17d", "score": "0.4910973", "text": "func (c *Client) ListArtifacts(ctx context.Context, params *ListArtifactsInput, optFns ...func(*Options)) (*ListArtifactsOutput, error) {\n\tif params == nil {\n\t\tparams = &ListArtifactsInput{}\n\t}\n\n\tresult, metadata, err := c.invokeOperation(ctx, \"ListArtifacts\", params, optFns, addOperationListArtifactsMiddlewares)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tout := result.(*ListArtifactsOutput)\n\tout.ResultMetadata = metadata\n\treturn out, nil\n}", "title": "" }, { "docid": "a830f31c93e062b3520a21e9ba116efe", "score": "0.49035585", "text": "func (m *MockCloudWatchLogsAPI) FilterLogEventsPagesWithContext(arg0 aws.Context, arg1 *cloudwatchlogs.FilterLogEventsInput, arg2 func(*cloudwatchlogs.FilterLogEventsOutput, bool) bool, arg3 ...request.Option) error {\n\tvarargs := []interface{}{arg0, arg1, arg2}\n\tfor _, a := range arg3 {\n\t\tvarargs = append(varargs, a)\n\t}\n\tret := m.ctrl.Call(m, \"FilterLogEventsPagesWithContext\", varargs...)\n\tret0, _ := ret[0].(error)\n\treturn ret0\n}", "title": "" }, { "docid": "75276dee7abfa01fddee2ed4cb2afe6d", "score": "0.49017712", "text": "func (m *MockAppMeshAPI) ListTagsForResourcePagesWithContext(arg0 context.Context, arg1 *appmesh.ListTagsForResourceInput, arg2 func(*appmesh.ListTagsForResourceOutput, bool) bool, arg3 ...request.Option) error {\n\tm.ctrl.T.Helper()\n\tvarargs := []interface{}{arg0, arg1, arg2}\n\tfor _, a := range arg3 {\n\t\tvarargs = append(varargs, a)\n\t}\n\tret := m.ctrl.Call(m, \"ListTagsForResourcePagesWithContext\", varargs...)\n\tret0, _ := ret[0].(error)\n\treturn ret0\n}", "title": "" }, { "docid": "dbf46bd37c04eb9a373d08fcae77ac39", "score": "0.4898573", "text": "func (c *DeviceFarm) ListTestsPagesWithContext(ctx aws.Context, input *ListTestsInput, fn func(*ListTestsOutput, bool) bool, opts ...request.Option) error {\n\tp := request.Pagination{\n\t\tNewRequest: func() (*request.Request, error) {\n\t\t\tvar inCpy *ListTestsInput\n\t\t\tif input != nil {\n\t\t\t\ttmp := *input\n\t\t\t\tinCpy = &tmp\n\t\t\t}\n\t\t\treq, _ := c.ListTestsRequest(inCpy)\n\t\t\treq.SetContext(ctx)\n\t\t\treq.ApplyOptions(opts...)\n\t\t\treturn req, nil\n\t\t},\n\t}\n\n\tfor p.Next() {\n\t\tif !fn(p.Page().(*ListTestsOutput), !p.HasNextPage()) {\n\t\t\tbreak\n\t\t}\n\t}\n\n\treturn p.Err()\n}", "title": "" }, { "docid": "5c28005d1a41e3c16b71f5d1d7231ad4", "score": "0.48977843", "text": "func (c *Inspector) ListAssessmentRunsPagesWithContext(ctx aws.Context, input *ListAssessmentRunsInput, fn func(*ListAssessmentRunsOutput, bool) bool, opts ...request.Option) error {\n\tp := request.Pagination{\n\t\tNewRequest: func() (*request.Request, error) {\n\t\t\tvar inCpy *ListAssessmentRunsInput\n\t\t\tif input != nil {\n\t\t\t\ttmp := *input\n\t\t\t\tinCpy = &tmp\n\t\t\t}\n\t\t\treq, _ := c.ListAssessmentRunsRequest(inCpy)\n\t\t\treq.SetContext(ctx)\n\t\t\treq.ApplyOptions(opts...)\n\t\t\treturn req, nil\n\t\t},\n\t}\n\n\tfor p.Next() {\n\t\tif !fn(p.Page().(*ListAssessmentRunsOutput), !p.HasNextPage()) {\n\t\t\tbreak\n\t\t}\n\t}\n\n\treturn p.Err()\n}", "title": "" }, { "docid": "bd6973acd5a16bb7da880c0b7784536c", "score": "0.48952395", "text": "func (m *MockEC2Svc) DescribeInstancesPagesWithContext(ctx aws.Context, in *ec2.DescribeInstancesInput, fn func(*ec2.DescribeInstancesOutput, bool) bool, ro ...request.Option) error {\n\targs := m.Called(in)\n\tout := args.Get(0).(*ec2.DescribeInstancesOutput)\n\terr := args.Error(1)\n\tif err != nil {\n\t\treturn err\n\t}\n\tfn(out, true)\n\treturn nil\n}", "title": "" }, { "docid": "dd8dad3c6e1c2a3e5d078231fe779dab", "score": "0.48939162", "text": "func (c *RAM) ListPrincipalsPagesWithContext(ctx aws.Context, input *ListPrincipalsInput, fn func(*ListPrincipalsOutput, bool) bool, opts ...request.Option) error {\n\tp := request.Pagination{\n\t\tNewRequest: func() (*request.Request, error) {\n\t\t\tvar inCpy *ListPrincipalsInput\n\t\t\tif input != nil {\n\t\t\t\ttmp := *input\n\t\t\t\tinCpy = &tmp\n\t\t\t}\n\t\t\treq, _ := c.ListPrincipalsRequest(inCpy)\n\t\t\treq.SetContext(ctx)\n\t\t\treq.ApplyOptions(opts...)\n\t\t\treturn req, nil\n\t\t},\n\t}\n\n\tfor p.Next() {\n\t\tif !fn(p.Page().(*ListPrincipalsOutput), !p.HasNextPage()) {\n\t\t\tbreak\n\t\t}\n\t}\n\n\treturn p.Err()\n}", "title": "" }, { "docid": "0a16586e01e17c6764e4a645eced697d", "score": "0.48891756", "text": "func (b *Bucket) ListObjectsV2PagesWithContext(\n\tctx aws.Context,\n\tprefix string,\n\tpageFunc func(*s3.ListObjectsV2Output, bool) bool,\n\topts ...option.ListObjectsV2Input,\n) error {\n\treq := &s3.ListObjectsV2Input{\n\t\tBucket: b.Name,\n\t\tPrefix: aws.String(prefix),\n\t}\n\n\tfor _, f := range opts {\n\t\tf(req)\n\t}\n\n\treturn b.S3.ListObjectsV2PagesWithContext(ctx, req, pageFunc)\n}", "title": "" }, { "docid": "a7ae558ed47ec85dafb7bb4b8e7764a0", "score": "0.48486444", "text": "func (c *Chime) ListAccountsPagesWithContext(ctx aws.Context, input *ListAccountsInput, fn func(*ListAccountsOutput, bool) bool, opts ...request.Option) error {\n\tp := request.Pagination{\n\t\tNewRequest: func() (*request.Request, error) {\n\t\t\tvar inCpy *ListAccountsInput\n\t\t\tif input != nil {\n\t\t\t\ttmp := *input\n\t\t\t\tinCpy = &tmp\n\t\t\t}\n\t\t\treq, _ := c.ListAccountsRequest(inCpy)\n\t\t\treq.SetContext(ctx)\n\t\t\treq.ApplyOptions(opts...)\n\t\t\treturn req, nil\n\t\t},\n\t}\n\n\tfor p.Next() {\n\t\tif !fn(p.Page().(*ListAccountsOutput), !p.HasNextPage()) {\n\t\t\tbreak\n\t\t}\n\t}\n\n\treturn p.Err()\n}", "title": "" }, { "docid": "349c7df84deabdf4d327a1f877bc59f6", "score": "0.48483893", "text": "func (c *MediaConvert) ListJobsPagesWithContext(ctx aws.Context, input *ListJobsInput, fn func(*ListJobsOutput, bool) bool, opts ...request.Option) error {\n\tp := request.Pagination{\n\t\tNewRequest: func() (*request.Request, error) {\n\t\t\tvar inCpy *ListJobsInput\n\t\t\tif input != nil {\n\t\t\t\ttmp := *input\n\t\t\t\tinCpy = &tmp\n\t\t\t}\n\t\t\treq, _ := c.ListJobsRequest(inCpy)\n\t\t\treq.SetContext(ctx)\n\t\t\treq.ApplyOptions(opts...)\n\t\t\treturn req, nil\n\t\t},\n\t}\n\n\tfor p.Next() {\n\t\tif !fn(p.Page().(*ListJobsOutput), !p.HasNextPage()) {\n\t\t\tbreak\n\t\t}\n\t}\n\n\treturn p.Err()\n}", "title": "" }, { "docid": "c3b4e1b058b379b0c2ab38f43e732c4e", "score": "0.48435354", "text": "func (m *MockCloudWatchLogsAPI) DescribeMetricFiltersPagesWithContext(arg0 aws.Context, arg1 *cloudwatchlogs.DescribeMetricFiltersInput, arg2 func(*cloudwatchlogs.DescribeMetricFiltersOutput, bool) bool, arg3 ...request.Option) error {\n\tvarargs := []interface{}{arg0, arg1, arg2}\n\tfor _, a := range arg3 {\n\t\tvarargs = append(varargs, a)\n\t}\n\tret := m.ctrl.Call(m, \"DescribeMetricFiltersPagesWithContext\", varargs...)\n\tret0, _ := ret[0].(error)\n\treturn ret0\n}", "title": "" }, { "docid": "927f3ed57ddaa8d279261a103c91a424", "score": "0.48334345", "text": "func (c *Glacier) ListPartsPagesWithContext(ctx aws.Context, input *ListPartsInput, fn func(*ListPartsOutput, bool) bool, opts ...request.Option) error {\n\tp := request.Pagination{\n\t\tNewRequest: func() (*request.Request, error) {\n\t\t\tvar inCpy *ListPartsInput\n\t\t\tif input != nil {\n\t\t\t\ttmp := *input\n\t\t\t\tinCpy = &tmp\n\t\t\t}\n\t\t\treq, _ := c.ListPartsRequest(inCpy)\n\t\t\treq.SetContext(ctx)\n\t\t\treq.ApplyOptions(opts...)\n\t\t\treturn req, nil\n\t\t},\n\t}\n\n\tfor p.Next() {\n\t\tif !fn(p.Page().(*ListPartsOutput), !p.HasNextPage()) {\n\t\t\tbreak\n\t\t}\n\t}\n\n\treturn p.Err()\n}", "title": "" }, { "docid": "d8a0728f525612be17be85514b86dd6c", "score": "0.48315763", "text": "func (_m *GlacierAPI) ListJobsPagesWithContext(_a0 aws.Context, _a1 *glacier.ListJobsInput, _a2 func(*glacier.ListJobsOutput, bool) bool, _a3 ...request.Option) error {\n\t_va := make([]interface{}, len(_a3))\n\tfor _i := range _a3 {\n\t\t_va[_i] = _a3[_i]\n\t}\n\tvar _ca []interface{}\n\t_ca = append(_ca, _a0, _a1, _a2)\n\t_ca = append(_ca, _va...)\n\tret := _m.Called(_ca...)\n\n\tvar r0 error\n\tif rf, ok := ret.Get(0).(func(aws.Context, *glacier.ListJobsInput, func(*glacier.ListJobsOutput, bool) bool, ...request.Option) error); ok {\n\t\tr0 = rf(_a0, _a1, _a2, _a3...)\n\t} else {\n\t\tr0 = ret.Error(0)\n\t}\n\n\treturn r0\n}", "title": "" }, { "docid": "72a948c2924ecd1ac5192d8975d719c0", "score": "0.48173326", "text": "func (p *ListArtifactsPaginator) NextPage(ctx context.Context, optFns ...func(*Options)) (*ListArtifactsOutput, error) {\n\tif !p.HasMorePages() {\n\t\treturn nil, fmt.Errorf(\"no more pages available\")\n\t}\n\n\tparams := *p.params\n\tparams.NextToken = p.nextToken\n\n\tresult, err := p.client.ListArtifacts(ctx, &params, optFns...)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tp.firstPage = false\n\n\tprevToken := p.nextToken\n\tp.nextToken = result.NextToken\n\n\tif p.options.StopOnDuplicateToken && prevToken != nil && p.nextToken != nil && *prevToken == *p.nextToken {\n\t\tp.nextToken = nil\n\t}\n\n\treturn result, nil\n}", "title": "" }, { "docid": "b08ab97d554fd94265ea371eade39646", "score": "0.48172805", "text": "func (c *CloudTrail) ListImportsPagesWithContext(ctx aws.Context, input *ListImportsInput, fn func(*ListImportsOutput, bool) bool, opts ...request.Option) error {\n\tp := request.Pagination{\n\t\tNewRequest: func() (*request.Request, error) {\n\t\t\tvar inCpy *ListImportsInput\n\t\t\tif input != nil {\n\t\t\t\ttmp := *input\n\t\t\t\tinCpy = &tmp\n\t\t\t}\n\t\t\treq, _ := c.ListImportsRequest(inCpy)\n\t\t\treq.SetContext(ctx)\n\t\t\treq.ApplyOptions(opts...)\n\t\t\treturn req, nil\n\t\t},\n\t}\n\n\tfor p.Next() {\n\t\tif !fn(p.Page().(*ListImportsOutput), !p.HasNextPage()) {\n\t\t\tbreak\n\t\t}\n\t}\n\n\treturn p.Err()\n}", "title": "" }, { "docid": "805ce98d3a8b405cd1b10c901b170672", "score": "0.4816183", "text": "func (c *CloudTrail) ListQueriesPagesWithContext(ctx aws.Context, input *ListQueriesInput, fn func(*ListQueriesOutput, bool) bool, opts ...request.Option) error {\n\tp := request.Pagination{\n\t\tNewRequest: func() (*request.Request, error) {\n\t\t\tvar inCpy *ListQueriesInput\n\t\t\tif input != nil {\n\t\t\t\ttmp := *input\n\t\t\t\tinCpy = &tmp\n\t\t\t}\n\t\t\treq, _ := c.ListQueriesRequest(inCpy)\n\t\t\treq.SetContext(ctx)\n\t\t\treq.ApplyOptions(opts...)\n\t\t\treturn req, nil\n\t\t},\n\t}\n\n\tfor p.Next() {\n\t\tif !fn(p.Page().(*ListQueriesOutput), !p.HasNextPage()) {\n\t\t\tbreak\n\t\t}\n\t}\n\n\treturn p.Err()\n}", "title": "" }, { "docid": "17bf53dae4d1834035c32267671a6b5b", "score": "0.48048487", "text": "func (mr *MockCloudWatchLogsAPIMockRecorder) GetLogEventsPagesWithContext(arg0, arg1, arg2 interface{}, arg3 ...interface{}) *gomock.Call {\n\tvarargs := append([]interface{}{arg0, arg1, arg2}, arg3...)\n\treturn mr.mock.ctrl.RecordCallWithMethodType(mr.mock, \"GetLogEventsPagesWithContext\", reflect.TypeOf((*MockCloudWatchLogsAPI)(nil).GetLogEventsPagesWithContext), varargs...)\n}", "title": "" }, { "docid": "8617dcbbe249ad51fc5014b677b2bc91", "score": "0.47846976", "text": "func (c *ProjectsLocationsMetadataStoresArtifactsListCall) Context(ctx context.Context) *ProjectsLocationsMetadataStoresArtifactsListCall {\n\tc.ctx_ = ctx\n\treturn c\n}", "title": "" }, { "docid": "1bb574d2211d359bcc6951b33c5cbb3c", "score": "0.47783536", "text": "func (c *RAM) ListResourcesPagesWithContext(ctx aws.Context, input *ListResourcesInput, fn func(*ListResourcesOutput, bool) bool, opts ...request.Option) error {\n\tp := request.Pagination{\n\t\tNewRequest: func() (*request.Request, error) {\n\t\t\tvar inCpy *ListResourcesInput\n\t\t\tif input != nil {\n\t\t\t\ttmp := *input\n\t\t\t\tinCpy = &tmp\n\t\t\t}\n\t\t\treq, _ := c.ListResourcesRequest(inCpy)\n\t\t\treq.SetContext(ctx)\n\t\t\treq.ApplyOptions(opts...)\n\t\t\treturn req, nil\n\t\t},\n\t}\n\n\tfor p.Next() {\n\t\tif !fn(p.Page().(*ListResourcesOutput), !p.HasNextPage()) {\n\t\t\tbreak\n\t\t}\n\t}\n\n\treturn p.Err()\n}", "title": "" }, { "docid": "0d4d32d5d389b7515f1d3dfd9213b0c6", "score": "0.47728458", "text": "func (c *DeviceFarm) ListSamplesPagesWithContext(ctx aws.Context, input *ListSamplesInput, fn func(*ListSamplesOutput, bool) bool, opts ...request.Option) error {\n\tp := request.Pagination{\n\t\tNewRequest: func() (*request.Request, error) {\n\t\t\tvar inCpy *ListSamplesInput\n\t\t\tif input != nil {\n\t\t\t\ttmp := *input\n\t\t\t\tinCpy = &tmp\n\t\t\t}\n\t\t\treq, _ := c.ListSamplesRequest(inCpy)\n\t\t\treq.SetContext(ctx)\n\t\t\treq.ApplyOptions(opts...)\n\t\t\treturn req, nil\n\t\t},\n\t}\n\n\tfor p.Next() {\n\t\tif !fn(p.Page().(*ListSamplesOutput), !p.HasNextPage()) {\n\t\t\tbreak\n\t\t}\n\t}\n\n\treturn p.Err()\n}", "title": "" }, { "docid": "a9ff2cc7918ce1469f159fc29e7814de", "score": "0.47705057", "text": "func (c *Health) DescribeEventsPagesWithContext(ctx aws.Context, input *DescribeEventsInput, fn func(*DescribeEventsOutput, bool) bool, opts ...request.Option) error {\n\tp := request.Pagination{\n\t\tNewRequest: func() (*request.Request, error) {\n\t\t\tvar inCpy *DescribeEventsInput\n\t\t\tif input != nil {\n\t\t\t\ttmp := *input\n\t\t\t\tinCpy = &tmp\n\t\t\t}\n\t\t\treq, _ := c.DescribeEventsRequest(inCpy)\n\t\t\treq.SetContext(ctx)\n\t\t\treq.ApplyOptions(opts...)\n\t\t\treturn req, nil\n\t\t},\n\t}\n\n\tfor p.Next() {\n\t\tif !fn(p.Page().(*DescribeEventsOutput), !p.HasNextPage()) {\n\t\t\tbreak\n\t\t}\n\t}\n\n\treturn p.Err()\n}", "title": "" }, { "docid": "e1fa2881a6b59f69064a18b45bc1a01e", "score": "0.47701603", "text": "func (c *DeviceFarm) ListDevicesPagesWithContext(ctx aws.Context, input *ListDevicesInput, fn func(*ListDevicesOutput, bool) bool, opts ...request.Option) error {\n\tp := request.Pagination{\n\t\tNewRequest: func() (*request.Request, error) {\n\t\t\tvar inCpy *ListDevicesInput\n\t\t\tif input != nil {\n\t\t\t\ttmp := *input\n\t\t\t\tinCpy = &tmp\n\t\t\t}\n\t\t\treq, _ := c.ListDevicesRequest(inCpy)\n\t\t\treq.SetContext(ctx)\n\t\t\treq.ApplyOptions(opts...)\n\t\t\treturn req, nil\n\t\t},\n\t}\n\n\tfor p.Next() {\n\t\tif !fn(p.Page().(*ListDevicesOutput), !p.HasNextPage()) {\n\t\t\tbreak\n\t\t}\n\t}\n\n\treturn p.Err()\n}", "title": "" }, { "docid": "27359fd56a0b58af8c7331ae79159996", "score": "0.47622186", "text": "func (c *ChimeSDKMediaPipelines) ListMediaPipelinesPagesWithContext(ctx aws.Context, input *ListMediaPipelinesInput, fn func(*ListMediaPipelinesOutput, bool) bool, opts ...request.Option) error {\n\tp := request.Pagination{\n\t\tNewRequest: func() (*request.Request, error) {\n\t\t\tvar inCpy *ListMediaPipelinesInput\n\t\t\tif input != nil {\n\t\t\t\ttmp := *input\n\t\t\t\tinCpy = &tmp\n\t\t\t}\n\t\t\treq, _ := c.ListMediaPipelinesRequest(inCpy)\n\t\t\treq.SetContext(ctx)\n\t\t\treq.ApplyOptions(opts...)\n\t\t\treturn req, nil\n\t\t},\n\t}\n\n\tfor p.Next() {\n\t\tif !fn(p.Page().(*ListMediaPipelinesOutput), !p.HasNextPage()) {\n\t\t\tbreak\n\t\t}\n\t}\n\n\treturn p.Err()\n}", "title": "" }, { "docid": "1f708a3fdfa493c567b0e26207f3c680", "score": "0.47575304", "text": "func (c *Glacier) ListMultipartUploadsPagesWithContext(ctx aws.Context, input *ListMultipartUploadsInput, fn func(*ListMultipartUploadsOutput, bool) bool, opts ...request.Option) error {\n\tp := request.Pagination{\n\t\tNewRequest: func() (*request.Request, error) {\n\t\t\tvar inCpy *ListMultipartUploadsInput\n\t\t\tif input != nil {\n\t\t\t\ttmp := *input\n\t\t\t\tinCpy = &tmp\n\t\t\t}\n\t\t\treq, _ := c.ListMultipartUploadsRequest(inCpy)\n\t\t\treq.SetContext(ctx)\n\t\t\treq.ApplyOptions(opts...)\n\t\t\treturn req, nil\n\t\t},\n\t}\n\n\tfor p.Next() {\n\t\tif !fn(p.Page().(*ListMultipartUploadsOutput), !p.HasNextPage()) {\n\t\t\tbreak\n\t\t}\n\t}\n\n\treturn p.Err()\n}", "title": "" }, { "docid": "e47698dde688fe98b4936467203b7bd0", "score": "0.47544748", "text": "func (c *SecurityHub) ListInvitationsPagesWithContext(ctx aws.Context, input *ListInvitationsInput, fn func(*ListInvitationsOutput, bool) bool, opts ...request.Option) error {\n\tp := request.Pagination{\n\t\tNewRequest: func() (*request.Request, error) {\n\t\t\tvar inCpy *ListInvitationsInput\n\t\t\tif input != nil {\n\t\t\t\ttmp := *input\n\t\t\t\tinCpy = &tmp\n\t\t\t}\n\t\t\treq, _ := c.ListInvitationsRequest(inCpy)\n\t\t\treq.SetContext(ctx)\n\t\t\treq.ApplyOptions(opts...)\n\t\t\treturn req, nil\n\t\t},\n\t}\n\n\tfor p.Next() {\n\t\tif !fn(p.Page().(*ListInvitationsOutput), !p.HasNextPage()) {\n\t\t\tbreak\n\t\t}\n\t}\n\n\treturn p.Err()\n}", "title": "" }, { "docid": "ea034c8131c2bb791269edf41f2b5c0b", "score": "0.47531447", "text": "func (c *Inspector) ListAssessmentRunAgentsPagesWithContext(ctx aws.Context, input *ListAssessmentRunAgentsInput, fn func(*ListAssessmentRunAgentsOutput, bool) bool, opts ...request.Option) error {\n\tp := request.Pagination{\n\t\tNewRequest: func() (*request.Request, error) {\n\t\t\tvar inCpy *ListAssessmentRunAgentsInput\n\t\t\tif input != nil {\n\t\t\t\ttmp := *input\n\t\t\t\tinCpy = &tmp\n\t\t\t}\n\t\t\treq, _ := c.ListAssessmentRunAgentsRequest(inCpy)\n\t\t\treq.SetContext(ctx)\n\t\t\treq.ApplyOptions(opts...)\n\t\t\treturn req, nil\n\t\t},\n\t}\n\n\tfor p.Next() {\n\t\tif !fn(p.Page().(*ListAssessmentRunAgentsOutput), !p.HasNextPage()) {\n\t\t\tbreak\n\t\t}\n\t}\n\n\treturn p.Err()\n}", "title": "" }, { "docid": "485ee022e050be09f3c490dcbafb5b4c", "score": "0.47513953", "text": "func (m *MockELBV2) DescribeListenersPagesWithContext(arg0 context.Context, arg1 *elbv2.DescribeListenersInput, arg2 func(*elbv2.DescribeListenersOutput, bool) bool, arg3 ...request.Option) error {\n\tm.ctrl.T.Helper()\n\tvarargs := []interface{}{arg0, arg1, arg2}\n\tfor _, a := range arg3 {\n\t\tvarargs = append(varargs, a)\n\t}\n\tret := m.ctrl.Call(m, \"DescribeListenersPagesWithContext\", varargs...)\n\tret0, _ := ret[0].(error)\n\treturn ret0\n}", "title": "" }, { "docid": "1387c00fbdd35d06553edd626777281c", "score": "0.47458175", "text": "func (c *CloudTrail) LookupEventsPagesWithContext(ctx aws.Context, input *LookupEventsInput, fn func(*LookupEventsOutput, bool) bool, opts ...request.Option) error {\n\tp := request.Pagination{\n\t\tNewRequest: func() (*request.Request, error) {\n\t\t\tvar inCpy *LookupEventsInput\n\t\t\tif input != nil {\n\t\t\t\ttmp := *input\n\t\t\t\tinCpy = &tmp\n\t\t\t}\n\t\t\treq, _ := c.LookupEventsRequest(inCpy)\n\t\t\treq.SetContext(ctx)\n\t\t\treq.ApplyOptions(opts...)\n\t\t\treturn req, nil\n\t\t},\n\t}\n\n\tfor p.Next() {\n\t\tif !fn(p.Page().(*LookupEventsOutput), !p.HasNextPage()) {\n\t\t\tbreak\n\t\t}\n\t}\n\n\treturn p.Err()\n}", "title": "" }, { "docid": "bdc0fe2358135b444f067a90edcc69f0", "score": "0.47396728", "text": "func (c *ProjectsLocationsInstancesInventoriesListCall) Pages(ctx context.Context, f func(*ListInventoriesResponse) error) error {\n\tc.ctx_ = ctx\n\tdefer c.PageToken(c.urlParams_.Get(\"pageToken\")) // reset paging to original point\n\tfor {\n\t\tx, err := c.Do()\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tif err := f(x); err != nil {\n\t\t\treturn err\n\t\t}\n\t\tif x.NextPageToken == \"\" {\n\t\t\treturn nil\n\t\t}\n\t\tc.PageToken(x.NextPageToken)\n\t}\n}", "title": "" }, { "docid": "7e4b10f1911a2295730480bc8fd7ec20", "score": "0.47305143", "text": "func (c *Inspector) ListFindingsPagesWithContext(ctx aws.Context, input *ListFindingsInput, fn func(*ListFindingsOutput, bool) bool, opts ...request.Option) error {\n\tp := request.Pagination{\n\t\tNewRequest: func() (*request.Request, error) {\n\t\t\tvar inCpy *ListFindingsInput\n\t\t\tif input != nil {\n\t\t\t\ttmp := *input\n\t\t\t\tinCpy = &tmp\n\t\t\t}\n\t\t\treq, _ := c.ListFindingsRequest(inCpy)\n\t\t\treq.SetContext(ctx)\n\t\t\treq.ApplyOptions(opts...)\n\t\t\treturn req, nil\n\t\t},\n\t}\n\n\tfor p.Next() {\n\t\tif !fn(p.Page().(*ListFindingsOutput), !p.HasNextPage()) {\n\t\t\tbreak\n\t\t}\n\t}\n\n\treturn p.Err()\n}", "title": "" }, { "docid": "6a5d7bb256ad3015663d9fbae9fba125", "score": "0.47284696", "text": "func (mr *MockCloudWatchLogsAPIMockRecorder) FilterLogEventsPagesWithContext(arg0, arg1, arg2 interface{}, arg3 ...interface{}) *gomock.Call {\n\tvarargs := append([]interface{}{arg0, arg1, arg2}, arg3...)\n\treturn mr.mock.ctrl.RecordCallWithMethodType(mr.mock, \"FilterLogEventsPagesWithContext\", reflect.TypeOf((*MockCloudWatchLogsAPI)(nil).FilterLogEventsPagesWithContext), varargs...)\n}", "title": "" }, { "docid": "b503d5b864f6a4669ae47dc3614a2952", "score": "0.47252092", "text": "func (a *ArtifactsApiService) ListArtifactsInGroup(ctx _context.Context, groupId string) ApiListArtifactsInGroupRequest {\n\treturn ApiListArtifactsInGroupRequest{\n\t\tApiService: a,\n\t\tctx: ctx,\n\t\tgroupId: groupId,\n\t}\n}", "title": "" }, { "docid": "caf25c579489b0380158e50b8ecd07fd", "score": "0.47220233", "text": "func (c *CodeStarNotifications) ListTargetsPagesWithContext(ctx aws.Context, input *ListTargetsInput, fn func(*ListTargetsOutput, bool) bool, opts ...request.Option) error {\n\tp := request.Pagination{\n\t\tNewRequest: func() (*request.Request, error) {\n\t\t\tvar inCpy *ListTargetsInput\n\t\t\tif input != nil {\n\t\t\t\ttmp := *input\n\t\t\t\tinCpy = &tmp\n\t\t\t}\n\t\t\treq, _ := c.ListTargetsRequest(inCpy)\n\t\t\treq.SetContext(ctx)\n\t\t\treq.ApplyOptions(opts...)\n\t\t\treturn req, nil\n\t\t},\n\t}\n\n\tfor p.Next() {\n\t\tif !fn(p.Page().(*ListTargetsOutput), !p.HasNextPage()) {\n\t\t\tbreak\n\t\t}\n\t}\n\n\treturn p.Err()\n}", "title": "" }, { "docid": "1070f143ae0b46614bd47e7672e7ea92", "score": "0.46999732", "text": "func (c *Route53RecoveryReadiness) ListResourceSetsPagesWithContext(ctx aws.Context, input *ListResourceSetsInput, fn func(*ListResourceSetsOutput, bool) bool, opts ...request.Option) error {\n\tp := request.Pagination{\n\t\tNewRequest: func() (*request.Request, error) {\n\t\t\tvar inCpy *ListResourceSetsInput\n\t\t\tif input != nil {\n\t\t\t\ttmp := *input\n\t\t\t\tinCpy = &tmp\n\t\t\t}\n\t\t\treq, _ := c.ListResourceSetsRequest(inCpy)\n\t\t\treq.SetContext(ctx)\n\t\t\treq.ApplyOptions(opts...)\n\t\t\treturn req, nil\n\t\t},\n\t}\n\n\tfor p.Next() {\n\t\tif !fn(p.Page().(*ListResourceSetsOutput), !p.HasNextPage()) {\n\t\t\tbreak\n\t\t}\n\t}\n\n\treturn p.Err()\n}", "title": "" }, { "docid": "47a4cfe984cacc892ff22ea0fe396b05", "score": "0.46955922", "text": "func (m *MockAppMeshAPI) ListMeshesPagesWithContext(arg0 context.Context, arg1 *appmesh.ListMeshesInput, arg2 func(*appmesh.ListMeshesOutput, bool) bool, arg3 ...request.Option) error {\n\tm.ctrl.T.Helper()\n\tvarargs := []interface{}{arg0, arg1, arg2}\n\tfor _, a := range arg3 {\n\t\tvarargs = append(varargs, a)\n\t}\n\tret := m.ctrl.Call(m, \"ListMeshesPagesWithContext\", varargs...)\n\tret0, _ := ret[0].(error)\n\treturn ret0\n}", "title": "" }, { "docid": "7274a1f7ca92d522170fbc1b299aac98", "score": "0.46932197", "text": "func (_m *MockcloudFormationAPI) ListChangeSetsPagesWithContext(_parameter_0 context.Context, _parameter_1 *cloudformation.ListChangeSetsInput, _parameter_2 func(*cloudformation.ListChangeSetsOutput, bool) bool, _parameter_3 ...request.Option) (_result_0 error) {\n\tvarParams := make([]interface{}, 3+len(_parameter_3))\n\tvarParams[0] = _parameter_0\n\tvarParams[1] = _parameter_1\n\tvarParams[2] = _parameter_2\n\tfor varIndex, varParam := range _parameter_3 {\n\t\tvarParams[3+varIndex] = varParam\n\t}\n\n\tret := _m.Called(varParams...)\n\n\tvar r0 error\n\tif rf, ok := ret.Get(0).(func(context.Context, *cloudformation.ListChangeSetsInput, func(*cloudformation.ListChangeSetsOutput, bool) bool, ...request.Option) error); ok {\n\t\tr0 = rf(_parameter_0, _parameter_1, _parameter_2, _parameter_3...)\n\t} else {\n\t\tr0 = ret.Error(0)\n\t}\n\n\treturn r0\n}", "title": "" }, { "docid": "2f009399c23b9349fc6317dcb65c8223", "score": "0.4684241", "text": "func (c *SecurityHub) GetFindingHistoryPagesWithContext(ctx aws.Context, input *GetFindingHistoryInput, fn func(*GetFindingHistoryOutput, bool) bool, opts ...request.Option) error {\n\tp := request.Pagination{\n\t\tNewRequest: func() (*request.Request, error) {\n\t\t\tvar inCpy *GetFindingHistoryInput\n\t\t\tif input != nil {\n\t\t\t\ttmp := *input\n\t\t\t\tinCpy = &tmp\n\t\t\t}\n\t\t\treq, _ := c.GetFindingHistoryRequest(inCpy)\n\t\t\treq.SetContext(ctx)\n\t\t\treq.ApplyOptions(opts...)\n\t\t\treturn req, nil\n\t\t},\n\t}\n\n\tfor p.Next() {\n\t\tif !fn(p.Page().(*GetFindingHistoryOutput), !p.HasNextPage()) {\n\t\t\tbreak\n\t\t}\n\t}\n\n\treturn p.Err()\n}", "title": "" }, { "docid": "b6514a3a8f6b93a4510bcd5a7d4a3888", "score": "0.46759015", "text": "func (mr *MockAppMeshAPIMockRecorder) ListTagsForResourcePagesWithContext(arg0, arg1, arg2 interface{}, arg3 ...interface{}) *gomock.Call {\n\tmr.mock.ctrl.T.Helper()\n\tvarargs := append([]interface{}{arg0, arg1, arg2}, arg3...)\n\treturn mr.mock.ctrl.RecordCallWithMethodType(mr.mock, \"ListTagsForResourcePagesWithContext\", reflect.TypeOf((*MockAppMeshAPI)(nil).ListTagsForResourcePagesWithContext), varargs...)\n}", "title": "" }, { "docid": "5bc5f387338e772b07cade2c6c7915ea", "score": "0.46708506", "text": "func (c *Transfer) ListServersPagesWithContext(ctx aws.Context, input *ListServersInput, fn func(*ListServersOutput, bool) bool, opts ...request.Option) error {\n\tp := request.Pagination{\n\t\tNewRequest: func() (*request.Request, error) {\n\t\t\tvar inCpy *ListServersInput\n\t\t\tif input != nil {\n\t\t\t\ttmp := *input\n\t\t\t\tinCpy = &tmp\n\t\t\t}\n\t\t\treq, _ := c.ListServersRequest(inCpy)\n\t\t\treq.SetContext(ctx)\n\t\t\treq.ApplyOptions(opts...)\n\t\t\treturn req, nil\n\t\t},\n\t}\n\n\tfor p.Next() {\n\t\tif !fn(p.Page().(*ListServersOutput), !p.HasNextPage()) {\n\t\t\tbreak\n\t\t}\n\t}\n\n\treturn p.Err()\n}", "title": "" }, { "docid": "14a469282e6af1e25ec48db5f2479e9c", "score": "0.46665588", "text": "func (o *ListExperimentsParams) WithContext(ctx context.Context) *ListExperimentsParams {\n\to.SetContext(ctx)\n\treturn o\n}", "title": "" }, { "docid": "7ed1555a22b581e32339859041c926e5", "score": "0.46595424", "text": "func (c *Transfer) ListCertificatesPagesWithContext(ctx aws.Context, input *ListCertificatesInput, fn func(*ListCertificatesOutput, bool) bool, opts ...request.Option) error {\n\tp := request.Pagination{\n\t\tNewRequest: func() (*request.Request, error) {\n\t\t\tvar inCpy *ListCertificatesInput\n\t\t\tif input != nil {\n\t\t\t\ttmp := *input\n\t\t\t\tinCpy = &tmp\n\t\t\t}\n\t\t\treq, _ := c.ListCertificatesRequest(inCpy)\n\t\t\treq.SetContext(ctx)\n\t\t\treq.ApplyOptions(opts...)\n\t\t\treturn req, nil\n\t\t},\n\t}\n\n\tfor p.Next() {\n\t\tif !fn(p.Page().(*ListCertificatesOutput), !p.HasNextPage()) {\n\t\t\tbreak\n\t\t}\n\t}\n\n\treturn p.Err()\n}", "title": "" }, { "docid": "cbfbba86fa17af3ae6e0720e5eec0ba0", "score": "0.46567115", "text": "func (_m *MockcloudFormationAPI) DescribeAccountLimitsPagesWithContext(_parameter_0 context.Context, _parameter_1 *cloudformation.DescribeAccountLimitsInput, _parameter_2 func(*cloudformation.DescribeAccountLimitsOutput, bool) bool, _parameter_3 ...request.Option) (_result_0 error) {\n\tvarParams := make([]interface{}, 3+len(_parameter_3))\n\tvarParams[0] = _parameter_0\n\tvarParams[1] = _parameter_1\n\tvarParams[2] = _parameter_2\n\tfor varIndex, varParam := range _parameter_3 {\n\t\tvarParams[3+varIndex] = varParam\n\t}\n\n\tret := _m.Called(varParams...)\n\n\tvar r0 error\n\tif rf, ok := ret.Get(0).(func(context.Context, *cloudformation.DescribeAccountLimitsInput, func(*cloudformation.DescribeAccountLimitsOutput, bool) bool, ...request.Option) error); ok {\n\t\tr0 = rf(_parameter_0, _parameter_1, _parameter_2, _parameter_3...)\n\t} else {\n\t\tr0 = ret.Error(0)\n\t}\n\n\treturn r0\n}", "title": "" }, { "docid": "72e5d88fbbd7b0b693a06c267a1ecd75", "score": "0.46523267", "text": "func (mr *MockELBV2MockRecorder) DescribeListenersPagesWithContext(arg0, arg1, arg2 interface{}, arg3 ...interface{}) *gomock.Call {\n\tmr.mock.ctrl.T.Helper()\n\tvarargs := append([]interface{}{arg0, arg1, arg2}, arg3...)\n\treturn mr.mock.ctrl.RecordCallWithMethodType(mr.mock, \"DescribeListenersPagesWithContext\", reflect.TypeOf((*MockELBV2)(nil).DescribeListenersPagesWithContext), varargs...)\n}", "title": "" }, { "docid": "876db59e335fb1e0783a3d6f17580c99", "score": "0.46520028", "text": "func (_m *MockcloudFormationAPI) ListImportsPagesWithContext(_parameter_0 context.Context, _parameter_1 *cloudformation.ListImportsInput, _parameter_2 func(*cloudformation.ListImportsOutput, bool) bool, _parameter_3 ...request.Option) (_result_0 error) {\n\tvarParams := make([]interface{}, 3+len(_parameter_3))\n\tvarParams[0] = _parameter_0\n\tvarParams[1] = _parameter_1\n\tvarParams[2] = _parameter_2\n\tfor varIndex, varParam := range _parameter_3 {\n\t\tvarParams[3+varIndex] = varParam\n\t}\n\n\tret := _m.Called(varParams...)\n\n\tvar r0 error\n\tif rf, ok := ret.Get(0).(func(context.Context, *cloudformation.ListImportsInput, func(*cloudformation.ListImportsOutput, bool) bool, ...request.Option) error); ok {\n\t\tr0 = rf(_parameter_0, _parameter_1, _parameter_2, _parameter_3...)\n\t} else {\n\t\tr0 = ret.Error(0)\n\t}\n\n\treturn r0\n}", "title": "" }, { "docid": "885460998e6884016d5a735275431c76", "score": "0.46271586", "text": "func (c *Transfer) ListAgreementsPagesWithContext(ctx aws.Context, input *ListAgreementsInput, fn func(*ListAgreementsOutput, bool) bool, opts ...request.Option) error {\n\tp := request.Pagination{\n\t\tNewRequest: func() (*request.Request, error) {\n\t\t\tvar inCpy *ListAgreementsInput\n\t\t\tif input != nil {\n\t\t\t\ttmp := *input\n\t\t\t\tinCpy = &tmp\n\t\t\t}\n\t\t\treq, _ := c.ListAgreementsRequest(inCpy)\n\t\t\treq.SetContext(ctx)\n\t\t\treq.ApplyOptions(opts...)\n\t\t\treturn req, nil\n\t\t},\n\t}\n\n\tfor p.Next() {\n\t\tif !fn(p.Page().(*ListAgreementsOutput), !p.HasNextPage()) {\n\t\t\tbreak\n\t\t}\n\t}\n\n\treturn p.Err()\n}", "title": "" }, { "docid": "0a11b40d760aa9cffc61fefb8bb5aeeb", "score": "0.46204823", "text": "func (c *SecurityHub) ListMembersPagesWithContext(ctx aws.Context, input *ListMembersInput, fn func(*ListMembersOutput, bool) bool, opts ...request.Option) error {\n\tp := request.Pagination{\n\t\tNewRequest: func() (*request.Request, error) {\n\t\t\tvar inCpy *ListMembersInput\n\t\t\tif input != nil {\n\t\t\t\ttmp := *input\n\t\t\t\tinCpy = &tmp\n\t\t\t}\n\t\t\treq, _ := c.ListMembersRequest(inCpy)\n\t\t\treq.SetContext(ctx)\n\t\t\treq.ApplyOptions(opts...)\n\t\t\treturn req, nil\n\t\t},\n\t}\n\n\tfor p.Next() {\n\t\tif !fn(p.Page().(*ListMembersOutput), !p.HasNextPage()) {\n\t\t\tbreak\n\t\t}\n\t}\n\n\treturn p.Err()\n}", "title": "" }, { "docid": "40f6be0ea0f0851fe2b917bee8188d96", "score": "0.46172464", "text": "func (_m *MockcloudFormationAPI) ListStackInstancesPagesWithContext(_parameter_0 context.Context, _parameter_1 *cloudformation.ListStackInstancesInput, _parameter_2 func(*cloudformation.ListStackInstancesOutput, bool) bool, _parameter_3 ...request.Option) (_result_0 error) {\n\tvarParams := make([]interface{}, 3+len(_parameter_3))\n\tvarParams[0] = _parameter_0\n\tvarParams[1] = _parameter_1\n\tvarParams[2] = _parameter_2\n\tfor varIndex, varParam := range _parameter_3 {\n\t\tvarParams[3+varIndex] = varParam\n\t}\n\n\tret := _m.Called(varParams...)\n\n\tvar r0 error\n\tif rf, ok := ret.Get(0).(func(context.Context, *cloudformation.ListStackInstancesInput, func(*cloudformation.ListStackInstancesOutput, bool) bool, ...request.Option) error); ok {\n\t\tr0 = rf(_parameter_0, _parameter_1, _parameter_2, _parameter_3...)\n\t} else {\n\t\tr0 = ret.Error(0)\n\t}\n\n\treturn r0\n}", "title": "" }, { "docid": "955ea151a84b7326ede629e482eed552", "score": "0.4614312", "text": "func (m *MockCloudWatchLogsAPI) DescribeDestinationsPagesWithContext(arg0 aws.Context, arg1 *cloudwatchlogs.DescribeDestinationsInput, arg2 func(*cloudwatchlogs.DescribeDestinationsOutput, bool) bool, arg3 ...request.Option) error {\n\tvarargs := []interface{}{arg0, arg1, arg2}\n\tfor _, a := range arg3 {\n\t\tvarargs = append(varargs, a)\n\t}\n\tret := m.ctrl.Call(m, \"DescribeDestinationsPagesWithContext\", varargs...)\n\tret0, _ := ret[0].(error)\n\treturn ret0\n}", "title": "" }, { "docid": "cf19e520546b179ae2a8af1c3d0e3057", "score": "0.46141723", "text": "func (c *Route53Resolver) ListResolverEndpointsPagesWithContext(ctx aws.Context, input *ListResolverEndpointsInput, fn func(*ListResolverEndpointsOutput, bool) bool, opts ...request.Option) error {\n\tp := request.Pagination{\n\t\tNewRequest: func() (*request.Request, error) {\n\t\t\tvar inCpy *ListResolverEndpointsInput\n\t\t\tif input != nil {\n\t\t\t\ttmp := *input\n\t\t\t\tinCpy = &tmp\n\t\t\t}\n\t\t\treq, _ := c.ListResolverEndpointsRequest(inCpy)\n\t\t\treq.SetContext(ctx)\n\t\t\treq.ApplyOptions(opts...)\n\t\t\treturn req, nil\n\t\t},\n\t}\n\n\tfor p.Next() {\n\t\tif !fn(p.Page().(*ListResolverEndpointsOutput), !p.HasNextPage()) {\n\t\t\tbreak\n\t\t}\n\t}\n\n\treturn p.Err()\n}", "title": "" }, { "docid": "e2fea0fc5a6979c1a016e4d724a1191a", "score": "0.4614153", "text": "func (c *OAM) ListLinksPagesWithContext(ctx aws.Context, input *ListLinksInput, fn func(*ListLinksOutput, bool) bool, opts ...request.Option) error {\n\tp := request.Pagination{\n\t\tNewRequest: func() (*request.Request, error) {\n\t\t\tvar inCpy *ListLinksInput\n\t\t\tif input != nil {\n\t\t\t\ttmp := *input\n\t\t\t\tinCpy = &tmp\n\t\t\t}\n\t\t\treq, _ := c.ListLinksRequest(inCpy)\n\t\t\treq.SetContext(ctx)\n\t\t\treq.ApplyOptions(opts...)\n\t\t\treturn req, nil\n\t\t},\n\t}\n\n\tfor p.Next() {\n\t\tif !fn(p.Page().(*ListLinksOutput), !p.HasNextPage()) {\n\t\t\tbreak\n\t\t}\n\t}\n\n\treturn p.Err()\n}", "title": "" }, { "docid": "2ded3f929eb361b7bf44cc64b1c72c74", "score": "0.4611599", "text": "func (m *MockCloudWatchLogsAPI) DescribeLogStreamsPagesWithContext(arg0 aws.Context, arg1 *cloudwatchlogs.DescribeLogStreamsInput, arg2 func(*cloudwatchlogs.DescribeLogStreamsOutput, bool) bool, arg3 ...request.Option) error {\n\tvarargs := []interface{}{arg0, arg1, arg2}\n\tfor _, a := range arg3 {\n\t\tvarargs = append(varargs, a)\n\t}\n\tret := m.ctrl.Call(m, \"DescribeLogStreamsPagesWithContext\", varargs...)\n\tret0, _ := ret[0].(error)\n\treturn ret0\n}", "title": "" }, { "docid": "5feb48218ad422beaea41ead1173a07a", "score": "0.46100575", "text": "func (c *ProjectsLocationsTensorboardsExperimentsOperationsListCall) Pages(ctx context.Context, f func(*GoogleLongrunningListOperationsResponse) error) error {\n\tc.ctx_ = ctx\n\tdefer c.PageToken(c.urlParams_.Get(\"pageToken\")) // reset paging to original point\n\tfor {\n\t\tx, err := c.Do()\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tif err := f(x); err != nil {\n\t\t\treturn err\n\t\t}\n\t\tif x.NextPageToken == \"\" {\n\t\t\treturn nil\n\t\t}\n\t\tc.PageToken(x.NextPageToken)\n\t}\n}", "title": "" }, { "docid": "8956ccc5cbc8e51418af4c3b870a444d", "score": "0.4609807", "text": "func (c *Mgn) DescribeJobsPagesWithContext(ctx aws.Context, input *DescribeJobsInput, fn func(*DescribeJobsOutput, bool) bool, opts ...request.Option) error {\n\tp := request.Pagination{\n\t\tNewRequest: func() (*request.Request, error) {\n\t\t\tvar inCpy *DescribeJobsInput\n\t\t\tif input != nil {\n\t\t\t\ttmp := *input\n\t\t\t\tinCpy = &tmp\n\t\t\t}\n\t\t\treq, _ := c.DescribeJobsRequest(inCpy)\n\t\t\treq.SetContext(ctx)\n\t\t\treq.ApplyOptions(opts...)\n\t\t\treturn req, nil\n\t\t},\n\t}\n\n\tfor p.Next() {\n\t\tif !fn(p.Page().(*DescribeJobsOutput), !p.HasNextPage()) {\n\t\t\tbreak\n\t\t}\n\t}\n\n\treturn p.Err()\n}", "title": "" }, { "docid": "7961734550e413e1476f81952af5a2e0", "score": "0.4600629", "text": "func (_m *GlacierAPI) ListVaultsPagesWithContext(_a0 aws.Context, _a1 *glacier.ListVaultsInput, _a2 func(*glacier.ListVaultsOutput, bool) bool, _a3 ...request.Option) error {\n\t_va := make([]interface{}, len(_a3))\n\tfor _i := range _a3 {\n\t\t_va[_i] = _a3[_i]\n\t}\n\tvar _ca []interface{}\n\t_ca = append(_ca, _a0, _a1, _a2)\n\t_ca = append(_ca, _va...)\n\tret := _m.Called(_ca...)\n\n\tvar r0 error\n\tif rf, ok := ret.Get(0).(func(aws.Context, *glacier.ListVaultsInput, func(*glacier.ListVaultsOutput, bool) bool, ...request.Option) error); ok {\n\t\tr0 = rf(_a0, _a1, _a2, _a3...)\n\t} else {\n\t\tr0 = ret.Error(0)\n\t}\n\n\treturn r0\n}", "title": "" }, { "docid": "b832fbe4a72a68b1317291eed288b583", "score": "0.4597873", "text": "func (mr *MockCloudWatchLogsAPIMockRecorder) DescribeMetricFiltersPagesWithContext(arg0, arg1, arg2 interface{}, arg3 ...interface{}) *gomock.Call {\n\tvarargs := append([]interface{}{arg0, arg1, arg2}, arg3...)\n\treturn mr.mock.ctrl.RecordCallWithMethodType(mr.mock, \"DescribeMetricFiltersPagesWithContext\", reflect.TypeOf((*MockCloudWatchLogsAPI)(nil).DescribeMetricFiltersPagesWithContext), varargs...)\n}", "title": "" }, { "docid": "4c0edca0ff6901964d04e91b550989b0", "score": "0.45921385", "text": "func (c *Chime) ListAttendeesPagesWithContext(ctx aws.Context, input *ListAttendeesInput, fn func(*ListAttendeesOutput, bool) bool, opts ...request.Option) error {\n\tp := request.Pagination{\n\t\tNewRequest: func() (*request.Request, error) {\n\t\t\tvar inCpy *ListAttendeesInput\n\t\t\tif input != nil {\n\t\t\t\ttmp := *input\n\t\t\t\tinCpy = &tmp\n\t\t\t}\n\t\t\treq, _ := c.ListAttendeesRequest(inCpy)\n\t\t\treq.SetContext(ctx)\n\t\t\treq.ApplyOptions(opts...)\n\t\t\treturn req, nil\n\t\t},\n\t}\n\n\tfor p.Next() {\n\t\tif !fn(p.Page().(*ListAttendeesOutput), !p.HasNextPage()) {\n\t\t\tbreak\n\t\t}\n\t}\n\n\treturn p.Err()\n}", "title": "" }, { "docid": "8ca09453257645f7255efff4a9fef03a", "score": "0.45858744", "text": "func (mr *MockCloudWatchLogsAPIMockRecorder) DescribeLogStreamsPagesWithContext(arg0, arg1, arg2 interface{}, arg3 ...interface{}) *gomock.Call {\n\tvarargs := append([]interface{}{arg0, arg1, arg2}, arg3...)\n\treturn mr.mock.ctrl.RecordCallWithMethodType(mr.mock, \"DescribeLogStreamsPagesWithContext\", reflect.TypeOf((*MockCloudWatchLogsAPI)(nil).DescribeLogStreamsPagesWithContext), varargs...)\n}", "title": "" }, { "docid": "fb6bd69beb232b7c3d116f3a10db8cf4", "score": "0.4581766", "text": "func (mr *MockCloudWatchLogsAPIMockRecorder) DescribeLogGroupsPagesWithContext(arg0, arg1, arg2 interface{}, arg3 ...interface{}) *gomock.Call {\n\tvarargs := append([]interface{}{arg0, arg1, arg2}, arg3...)\n\treturn mr.mock.ctrl.RecordCallWithMethodType(mr.mock, \"DescribeLogGroupsPagesWithContext\", reflect.TypeOf((*MockCloudWatchLogsAPI)(nil).DescribeLogGroupsPagesWithContext), varargs...)\n}", "title": "" }, { "docid": "eb9333f5d210ef2b838601512e195ee2", "score": "0.45808366", "text": "func (c *DeviceFarm) ListProjectsPagesWithContext(ctx aws.Context, input *ListProjectsInput, fn func(*ListProjectsOutput, bool) bool, opts ...request.Option) error {\n\tp := request.Pagination{\n\t\tNewRequest: func() (*request.Request, error) {\n\t\t\tvar inCpy *ListProjectsInput\n\t\t\tif input != nil {\n\t\t\t\ttmp := *input\n\t\t\t\tinCpy = &tmp\n\t\t\t}\n\t\t\treq, _ := c.ListProjectsRequest(inCpy)\n\t\t\treq.SetContext(ctx)\n\t\t\treq.ApplyOptions(opts...)\n\t\t\treturn req, nil\n\t\t},\n\t}\n\n\tfor p.Next() {\n\t\tif !fn(p.Page().(*ListProjectsOutput), !p.HasNextPage()) {\n\t\t\tbreak\n\t\t}\n\t}\n\n\treturn p.Err()\n}", "title": "" }, { "docid": "6788804ee235a320d71bc0de5c04304f", "score": "0.45758197", "text": "func (c *ConfigService) DescribeRetentionConfigurationsPagesWithContext(ctx aws.Context, input *DescribeRetentionConfigurationsInput, fn func(*DescribeRetentionConfigurationsOutput, bool) bool, opts ...request.Option) error {\n\tp := request.Pagination{\n\t\tNewRequest: func() (*request.Request, error) {\n\t\t\tvar inCpy *DescribeRetentionConfigurationsInput\n\t\t\tif input != nil {\n\t\t\t\ttmp := *input\n\t\t\t\tinCpy = &tmp\n\t\t\t}\n\t\t\treq, _ := c.DescribeRetentionConfigurationsRequest(inCpy)\n\t\t\treq.SetContext(ctx)\n\t\t\treq.ApplyOptions(opts...)\n\t\t\treturn req, nil\n\t\t},\n\t}\n\n\tfor p.Next() {\n\t\tif !fn(p.Page().(*DescribeRetentionConfigurationsOutput), !p.HasNextPage()) {\n\t\t\tbreak\n\t\t}\n\t}\n\n\treturn p.Err()\n}", "title": "" }, { "docid": "f1eb247e06e2d529514fe0923c204d37", "score": "0.4574304", "text": "func (c *CustomerProfiles) ListEventStreamsPagesWithContext(ctx aws.Context, input *ListEventStreamsInput, fn func(*ListEventStreamsOutput, bool) bool, opts ...request.Option) error {\n\tp := request.Pagination{\n\t\tNewRequest: func() (*request.Request, error) {\n\t\t\tvar inCpy *ListEventStreamsInput\n\t\t\tif input != nil {\n\t\t\t\ttmp := *input\n\t\t\t\tinCpy = &tmp\n\t\t\t}\n\t\t\treq, _ := c.ListEventStreamsRequest(inCpy)\n\t\t\treq.SetContext(ctx)\n\t\t\treq.ApplyOptions(opts...)\n\t\t\treturn req, nil\n\t\t},\n\t}\n\n\tfor p.Next() {\n\t\tif !fn(p.Page().(*ListEventStreamsOutput), !p.HasNextPage()) {\n\t\t\tbreak\n\t\t}\n\t}\n\n\treturn p.Err()\n}", "title": "" }, { "docid": "2fd82dd3b6ee27cb2242aa9944bcda1c", "score": "0.45716107", "text": "func (c *ConfigService) ListStoredQueriesPagesWithContext(ctx aws.Context, input *ListStoredQueriesInput, fn func(*ListStoredQueriesOutput, bool) bool, opts ...request.Option) error {\n\tp := request.Pagination{\n\t\tNewRequest: func() (*request.Request, error) {\n\t\t\tvar inCpy *ListStoredQueriesInput\n\t\t\tif input != nil {\n\t\t\t\ttmp := *input\n\t\t\t\tinCpy = &tmp\n\t\t\t}\n\t\t\treq, _ := c.ListStoredQueriesRequest(inCpy)\n\t\t\treq.SetContext(ctx)\n\t\t\treq.ApplyOptions(opts...)\n\t\t\treturn req, nil\n\t\t},\n\t}\n\n\tfor p.Next() {\n\t\tif !fn(p.Page().(*ListStoredQueriesOutput), !p.HasNextPage()) {\n\t\t\tbreak\n\t\t}\n\t}\n\n\treturn p.Err()\n}", "title": "" }, { "docid": "8f7c8420642cf1cfb2b98fb4afd708cb", "score": "0.45644024", "text": "func (_m *MockeksAPI) ListClustersPagesWithContext(_parameter_0 context.Context, _parameter_1 *eks.ListClustersInput, _parameter_2 func(*eks.ListClustersOutput, bool) bool, _parameter_3 ...request.Option) (_result_0 error) {\n\tvarParams := make([]interface{}, 3+len(_parameter_3))\n\tvarParams[0] = _parameter_0\n\tvarParams[1] = _parameter_1\n\tvarParams[2] = _parameter_2\n\tfor varIndex, varParam := range _parameter_3 {\n\t\tvarParams[3+varIndex] = varParam\n\t}\n\n\tret := _m.Called(varParams...)\n\n\tvar r0 error\n\tif rf, ok := ret.Get(0).(func(context.Context, *eks.ListClustersInput, func(*eks.ListClustersOutput, bool) bool, ...request.Option) error); ok {\n\t\tr0 = rf(_parameter_0, _parameter_1, _parameter_2, _parameter_3...)\n\t} else {\n\t\tr0 = ret.Error(0)\n\t}\n\n\treturn r0\n}", "title": "" }, { "docid": "7ba747f2baaf5f1c4907deea3222c4fb", "score": "0.45596498", "text": "func (c *CloudTrail) ListChannelsPagesWithContext(ctx aws.Context, input *ListChannelsInput, fn func(*ListChannelsOutput, bool) bool, opts ...request.Option) error {\n\tp := request.Pagination{\n\t\tNewRequest: func() (*request.Request, error) {\n\t\t\tvar inCpy *ListChannelsInput\n\t\t\tif input != nil {\n\t\t\t\ttmp := *input\n\t\t\t\tinCpy = &tmp\n\t\t\t}\n\t\t\treq, _ := c.ListChannelsRequest(inCpy)\n\t\t\treq.SetContext(ctx)\n\t\t\treq.ApplyOptions(opts...)\n\t\t\treturn req, nil\n\t\t},\n\t}\n\n\tfor p.Next() {\n\t\tif !fn(p.Page().(*ListChannelsOutput), !p.HasNextPage()) {\n\t\t\tbreak\n\t\t}\n\t}\n\n\treturn p.Err()\n}", "title": "" }, { "docid": "cafb574fa97a5fc2c930fac34f89f3cd", "score": "0.45544443", "text": "func (_m *MockcloudFormationAPI) ListStackResourcesPagesWithContext(_parameter_0 context.Context, _parameter_1 *cloudformation.ListStackResourcesInput, _parameter_2 func(*cloudformation.ListStackResourcesOutput, bool) bool, _parameter_3 ...request.Option) (_result_0 error) {\n\tvarParams := make([]interface{}, 3+len(_parameter_3))\n\tvarParams[0] = _parameter_0\n\tvarParams[1] = _parameter_1\n\tvarParams[2] = _parameter_2\n\tfor varIndex, varParam := range _parameter_3 {\n\t\tvarParams[3+varIndex] = varParam\n\t}\n\n\tret := _m.Called(varParams...)\n\n\tvar r0 error\n\tif rf, ok := ret.Get(0).(func(context.Context, *cloudformation.ListStackResourcesInput, func(*cloudformation.ListStackResourcesOutput, bool) bool, ...request.Option) error); ok {\n\t\tr0 = rf(_parameter_0, _parameter_1, _parameter_2, _parameter_3...)\n\t} else {\n\t\tr0 = ret.Error(0)\n\t}\n\n\treturn r0\n}", "title": "" } ]
89670c5235ea29fb0da064b0863b13b7
LastName ... Search by user's last name
[ { "docid": "4dd40bc55962b58e9990323791879c5b", "score": "0.75336856", "text": "func LastName(request string) ([]tables.Person, error) {\n\trows, err := mysqlBus.DB.Query(\"SELECT * FROM Person WHERE last_name COLLATE UTF8_GENERAL_CI LIKE '%?'\", request)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tdefer rows.Close()\n\n\tallUsers := []tables.Person{}\n\n\tfor rows.Next() {\n\t\tvar p1 tables.Person\n\t\tif err := rows.Scan(&p1.Username, &p1.HashedPassword, &p1.Salt, &p1.Fname, &p1.Lname); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\n\t\tallUsers = append(allUsers, p1)\n\t}\n\treturn allUsers, nil\n}", "title": "" } ]
[ { "docid": "1a6b1bc28b4486fb969316b9138c1cc6", "score": "0.7915977", "text": "func LastName(v string) predicate.User {\n\treturn predicate.User(func(s *sql.Selector) {\n\t\ts.Where(sql.EQ(s.C(FieldLastName), v))\n\t})\n}", "title": "" }, { "docid": "fcb936f92919978c46683114f748630e", "score": "0.737367", "text": "func LastNameContains(v string) predicate.User {\n\treturn predicate.User(func(s *sql.Selector) {\n\t\ts.Where(sql.Contains(s.C(FieldLastName), v))\n\t})\n}", "title": "" }, { "docid": "0436652a0ad2063fe3aafa21ac665346", "score": "0.7245519", "text": "func (o GetUsersUserOutput) LastName() pulumi.StringOutput {\n\treturn o.ApplyT(func(v GetUsersUser) string { return v.LastName }).(pulumi.StringOutput)\n}", "title": "" }, { "docid": "0436652a0ad2063fe3aafa21ac665346", "score": "0.7245519", "text": "func (o GetUsersUserOutput) LastName() pulumi.StringOutput {\n\treturn o.ApplyT(func(v GetUsersUser) string { return v.LastName }).(pulumi.StringOutput)\n}", "title": "" }, { "docid": "e32afffeb2800bdd67f7e666b7e9b87b", "score": "0.7167892", "text": "func (o MonitorUserOutput) LastName() pulumi.StringOutput {\n\treturn o.ApplyT(func(v MonitorUser) string { return v.LastName }).(pulumi.StringOutput)\n}", "title": "" }, { "docid": "c15136a8a62e6c80b6734a67343034d4", "score": "0.6993067", "text": "func (ui *UserIdentity) LastName() string {\n\treturn firstValue(ui.ServiceMemberLastName, ui.OfficeUserLastName, ui.TspUserLastName)\n}", "title": "" }, { "docid": "2f4913eda4c8343d8e3e1e24f9b1fba0", "score": "0.69924444", "text": "func LastNameEQ(v string) predicate.User {\n\treturn predicate.User(func(s *sql.Selector) {\n\t\ts.Where(sql.EQ(s.C(FieldLastName), v))\n\t})\n}", "title": "" }, { "docid": "2235a8336843de00e1ff5918158a6802", "score": "0.69820255", "text": "func LastNameHasSuffix(v string) predicate.User {\n\treturn predicate.User(func(s *sql.Selector) {\n\t\ts.Where(sql.HasSuffix(s.C(FieldLastName), v))\n\t})\n}", "title": "" }, { "docid": "9e1035ff0920def6bea5a854f1deb723", "score": "0.69400865", "text": "func (u User) HasLastName() bool { return u.LastName != \"\" }", "title": "" }, { "docid": "a00db757c28858ae67e592f5c038fa04", "score": "0.6925857", "text": "func (u User) LastName() (string, bool) {\n\treturn u.raw.GetLastName()\n}", "title": "" }, { "docid": "dc0a451ddd61ea8d98773ee5be9b7524", "score": "0.6873489", "text": "func LastNameContainsFold(v string) predicate.User {\n\treturn predicate.User(func(s *sql.Selector) {\n\t\ts.Where(sql.ContainsFold(s.C(FieldLastName), v))\n\t})\n}", "title": "" }, { "docid": "f16c7ad42470b232ae763549d0e6bbf2", "score": "0.67520183", "text": "func (o *personBase) LastName() string {\n\tif o._restored && !o.lastNameIsValid {\n\t\tpanic(\"lastName was not selected in the last query and has not been set, and so is not valid\")\n\t}\n\treturn o.lastName\n}", "title": "" }, { "docid": "3a9822374896d0096886455765deecec", "score": "0.6749609", "text": "func (u *__User_Selector) LastName_Like(val string) *__User_Selector {\n\tw := whereClause{}\n\tvar insWhere []interface{}\n\tinsWhere = append(insWhere, val)\n\tw.args = insWhere\n\tw.condition = \" LastName LIKE \" + u.nextDollar()\n\tu.wheres = append(u.wheres, w)\n\n\treturn u\n}", "title": "" }, { "docid": "5146d5e8cc656fa71a278229a3ea5314", "score": "0.67404884", "text": "func LastNameLTE(v string) predicate.User {\n\treturn predicate.User(func(s *sql.Selector) {\n\t\ts.Where(sql.LTE(s.C(FieldLastName), v))\n\t})\n}", "title": "" }, { "docid": "fb970ae44c9c99a60c5b4b8b729abe0f", "score": "0.6728459", "text": "func (o UserIdentityInfoOutput) LastName() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v UserIdentityInfo) *string { return v.LastName }).(pulumi.StringPtrOutput)\n}", "title": "" }, { "docid": "88920df2bc77d56aebbd316ca15ea501", "score": "0.67032045", "text": "func (u *__User_Updater) LastName_Like(val string) *__User_Updater {\n\tw := whereClause{}\n\tvar insWhere []interface{}\n\tinsWhere = append(insWhere, val)\n\tw.args = insWhere\n\tw.condition = \" LastName LIKE \" + u.nextDollar()\n\tu.wheres = append(u.wheres, w)\n\n\treturn u\n}", "title": "" }, { "docid": "fcd96afeeae7644644834800a0a98274", "score": "0.6657517", "text": "func (u User) GetLastName() string{// Acts like getter in PHP or Java\n\treturn u.lastName\n}", "title": "" }, { "docid": "e142d2f9fcec5cef7fb3a1d47f708efc", "score": "0.66371936", "text": "func LastNameGTE(v string) predicate.User {\n\treturn predicate.User(func(s *sql.Selector) {\n\t\ts.Where(sql.GTE(s.C(FieldLastName), v))\n\t})\n}", "title": "" }, { "docid": "a93c8c8883cb4dc784b157fd6a36dcb8", "score": "0.66155684", "text": "func (u *__User_Deleter) LastName_Like(val string) *__User_Deleter {\n\tw := whereClause{}\n\tvar insWhere []interface{}\n\tinsWhere = append(insWhere, val)\n\tw.args = insWhere\n\tw.condition = \" LastName LIKE \" + u.nextDollar()\n\tu.wheres = append(u.wheres, w)\n\n\treturn u\n}", "title": "" }, { "docid": "75313f26a4de17ea51b6cbcda9ac1162", "score": "0.6578577", "text": "func (m *UserMutation) LastName() (r string, exists bool) {\n\tv := m.last_name\n\tif v == nil {\n\t\treturn\n\t}\n\treturn *v, true\n}", "title": "" }, { "docid": "a6ecab50090ec8301bcf5a6ec10efbec", "score": "0.65498775", "text": "func LastNameIn(vs ...string) predicate.User {\n\tv := make([]interface{}, len(vs))\n\tfor i := range v {\n\t\tv[i] = vs[i]\n\t}\n\treturn predicate.User(func(s *sql.Selector) {\n\t\t// if not arguments were provided, append the FALSE constants,\n\t\t// since we can't apply \"IN ()\". This will make this predicate falsy.\n\t\tif len(v) == 0 {\n\t\t\ts.Where(sql.False())\n\t\t\treturn\n\t\t}\n\t\ts.Where(sql.In(s.C(FieldLastName), v...))\n\t})\n}", "title": "" }, { "docid": "1e6b587206cd97a9d1084f3a2e9eae42", "score": "0.6535743", "text": "func (o MonitorUserPtrOutput) LastName() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v *MonitorUser) *string {\n\t\tif v == nil {\n\t\t\treturn nil\n\t\t}\n\t\treturn &v.LastName\n\t}).(pulumi.StringPtrOutput)\n}", "title": "" }, { "docid": "9b3d20750410e395ae57ca7fe38dcfd0", "score": "0.65261006", "text": "func (u Update) LastName() string {\n\tif u.Message != nil {\n\t\treturn u.Message.Chat.LastName\n\t} else if u.CallbackQuery != nil {\n\t\treturn u.CallbackQuery.From.LastName\n\t} else if u.ShippingQuery != nil {\n\t\treturn u.ShippingQuery.From.LastName\n\t} else if u.PreCheckoutQuery != nil {\n\t\treturn u.PreCheckoutQuery.From.LastName\n\t}\n\treturn \"\"\n}", "title": "" }, { "docid": "0920ee99d95438ac44f8dc921977fe28", "score": "0.6521006", "text": "func (o *ViewUser) SetLastName(v string) {\n\to.LastName = &v\n}", "title": "" }, { "docid": "d6773b4479658477fe8fd2c930c245af", "score": "0.648327", "text": "func (o DeveloperOutput) LastName() pulumi.StringOutput {\n\treturn o.ApplyT(func(v *Developer) pulumi.StringOutput { return v.LastName }).(pulumi.StringOutput)\n}", "title": "" }, { "docid": "edd0c64f47bfad5f8de47520240ade75", "score": "0.64762115", "text": "func LastNameGT(v string) predicate.User {\n\treturn predicate.User(func(s *sql.Selector) {\n\t\ts.Where(sql.GT(s.C(FieldLastName), v))\n\t})\n}", "title": "" }, { "docid": "e9b877c4489e475d16e949e8779b3f7a", "score": "0.64759886", "text": "func ValidateLastName(value string) error {\n\tif len(value) == 0 {\n\t\treturn fmt.Errorf(\"LAST_NAME is required\")\n\t}\n\n\tif len(value) > 15 {\n\t\treturn fmt.Errorf(\"LAST_NAME must be fewer than 15 characters\")\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "c0556df1eba46f53a3fd414c53868c81", "score": "0.6460624", "text": "func PersonalNameHasSuffix(v string) predicate.User {\n\treturn predicate.User(func(s *sql.Selector) {\n\t\ts.Where(sql.HasSuffix(s.C(FieldPersonalName), v))\n\t})\n}", "title": "" }, { "docid": "05e1ffc0a396b734269339d2ff1490e6", "score": "0.6406964", "text": "func GetMyLastName() string {\n\t// Return a string of your last name.\n\treturn \"\"\n}", "title": "" }, { "docid": "cd58a50ea53fb83ef51b7f753eefa975", "score": "0.63964325", "text": "func (m *subaccount) LastName() *string {\n\treturn m.lastNameField\n}", "title": "" }, { "docid": "a6d8c490cd509dcfa15a00cc750c61ad", "score": "0.6354607", "text": "func (o UserIdentityInfoPtrOutput) LastName() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v *UserIdentityInfo) *string {\n\t\tif v == nil {\n\t\t\treturn nil\n\t\t}\n\t\treturn v.LastName\n\t}).(pulumi.StringPtrOutput)\n}", "title": "" }, { "docid": "27835e6f9f0c262fd7a188951bf9979e", "score": "0.6332952", "text": "func (o CertificateIssuerAdminOutput) LastName() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v CertificateIssuerAdmin) *string { return v.LastName }).(pulumi.StringPtrOutput)\n}", "title": "" }, { "docid": "e93f0fe8e86779dcb630a15cfb6959f9", "score": "0.6328489", "text": "func LastNameEqualFold(v string) predicate.User {\n\treturn predicate.User(func(s *sql.Selector) {\n\t\ts.Where(sql.EqualFold(s.C(FieldLastName), v))\n\t})\n}", "title": "" }, { "docid": "55d55f44ffba8be588d6f99d05903de9", "score": "0.63167405", "text": "func (o GetCertificateIssuerAdminOutput) LastName() pulumi.StringOutput {\n\treturn o.ApplyT(func(v GetCertificateIssuerAdmin) string { return v.LastName }).(pulumi.StringOutput)\n}", "title": "" }, { "docid": "87f6b6b28b213115c76707df868b8094", "score": "0.6268183", "text": "func (o *ViewUser) GetLastName() string {\n\tif o == nil || o.LastName == nil {\n\t\tvar ret string\n\t\treturn ret\n\t}\n\treturn *o.LastName\n}", "title": "" }, { "docid": "f1de38e32a5cd0289ca58f3e8bab92cb", "score": "0.6262679", "text": "func (s *SuperuserParameters) SetLastName(v string) *SuperuserParameters {\n\ts.LastName = &v\n\treturn s\n}", "title": "" }, { "docid": "b0d0d567fba0b7733e01bb450f696a12", "score": "0.62226063", "text": "func (s *EntityDisplayData) SetLastName(v string) *EntityDisplayData {\n\ts.LastName = &v\n\treturn s\n}", "title": "" }, { "docid": "a05b874c45955e00fcb54eca399cd76b", "score": "0.6173006", "text": "func LastNameNotIn(vs ...string) predicate.User {\n\tv := make([]interface{}, len(vs))\n\tfor i := range v {\n\t\tv[i] = vs[i]\n\t}\n\treturn predicate.User(func(s *sql.Selector) {\n\t\t// if not arguments were provided, append the FALSE constants,\n\t\t// since we can't apply \"IN ()\". This will make this predicate falsy.\n\t\tif len(v) == 0 {\n\t\t\ts.Where(sql.False())\n\t\t\treturn\n\t\t}\n\t\ts.Where(sql.NotIn(s.C(FieldLastName), v...))\n\t})\n}", "title": "" }, { "docid": "5524d6579dd68fa6bfb9eb41cc67df19", "score": "0.61458474", "text": "func (o *UpdateAccountRequest) SetLastName(v string) {\n\to.LastName = &v\n}", "title": "" }, { "docid": "88782f81475e1e50e7bbd49cca26a66e", "score": "0.6144605", "text": "func (o *ViewUser) GetLastNameOk() (*string, bool) {\n\tif o == nil || o.LastName == nil {\n\t\treturn nil, false\n\t}\n\treturn o.LastName, true\n}", "title": "" }, { "docid": "40a429986d09d878f86782dec09f6ee5", "score": "0.6143671", "text": "func (cuu *CompanyUserUpdate) SetLastName(s string) *CompanyUserUpdate {\n\tcuu.mutation.SetLastName(s)\n\treturn cuu\n}", "title": "" }, { "docid": "838bb33fb297a0c6b34eaa8cfb7d2e2d", "score": "0.6138325", "text": "func (o *User) GetLastNameOk() (string, bool) {\n\tif o == nil || o.LastName == nil {\n\t\tvar ret string\n\t\treturn ret, false\n\t}\n\treturn *o.LastName, true\n}", "title": "" }, { "docid": "6519cb885b819cb4c71eb2988f3fd1a2", "score": "0.6121631", "text": "func LastNameLT(v string) predicate.User {\n\treturn predicate.User(func(s *sql.Selector) {\n\t\ts.Where(sql.LT(s.C(FieldLastName), v))\n\t})\n}", "title": "" }, { "docid": "a666fc9a71c8ec9a507243ac06d7e09e", "score": "0.609668", "text": "func (uu *UserUpdate) SetLastName(s string) *UserUpdate {\n\tuu.mutation.SetLastName(s)\n\treturn uu\n}", "title": "" }, { "docid": "a666fc9a71c8ec9a507243ac06d7e09e", "score": "0.609668", "text": "func (uu *UserUpdate) SetLastName(s string) *UserUpdate {\n\tuu.mutation.SetLastName(s)\n\treturn uu\n}", "title": "" }, { "docid": "d6a1282eeb11b2f6ff020b2adc05e0d1", "score": "0.6091584", "text": "func (uuo *UserUpdateOne) SetLastName(s string) *UserUpdateOne {\n\tuuo.mutation.SetLastName(s)\n\treturn uuo\n}", "title": "" }, { "docid": "d6a1282eeb11b2f6ff020b2adc05e0d1", "score": "0.6091584", "text": "func (uuo *UserUpdateOne) SetLastName(s string) *UserUpdateOne {\n\tuuo.mutation.SetLastName(s)\n\treturn uuo\n}", "title": "" }, { "docid": "066a17a0f30004e586c09cc5d5d84c8a", "score": "0.6090179", "text": "func (o *Account) SetLastName(v string) {\n\to.LastName = &v\n}", "title": "" }, { "docid": "9ff8580996dfed47501bca50e9b6710d", "score": "0.60740185", "text": "func (cuuo *CompanyUserUpdateOne) SetLastName(s string) *CompanyUserUpdateOne {\n\tcuuo.mutation.SetLastName(s)\n\treturn cuuo\n}", "title": "" }, { "docid": "551155173c5a4e60bf473abe6b6676e7", "score": "0.60672337", "text": "func (suu *SysUserUpdate) SetLastName(s string) *SysUserUpdate {\n\tsuu.mutation.SetLastName(s)\n\treturn suu\n}", "title": "" }, { "docid": "930327552c85dd94ccbee63d19e41da1", "score": "0.6063608", "text": "func (o *User) GetLastName() string {\n\tif o == nil || o.LastName == nil {\n\t\tvar ret string\n\t\treturn ret\n\t}\n\treturn *o.LastName\n}", "title": "" }, { "docid": "4361fef88aa0f12e5c0df9c5219b1890", "score": "0.6050715", "text": "func (o *InlineResponse20045CardOwner) SetLastName(v string) {\n\to.LastName = &v\n}", "title": "" }, { "docid": "b556b35f7bff4938d5b1e5c8daff38c7", "score": "0.6047078", "text": "func FirstNameHasSuffix(v string) predicate.User {\n\treturn predicate.User(func(s *sql.Selector) {\n\t\ts.Where(sql.HasSuffix(s.C(FieldFirstName), v))\n\t})\n}", "title": "" }, { "docid": "47c32194b268f0cf6820077d56c190ed", "score": "0.6046897", "text": "func LastNameHasPrefix(v string) predicate.User {\n\treturn predicate.User(func(s *sql.Selector) {\n\t\ts.Where(sql.HasPrefix(s.C(FieldLastName), v))\n\t})\n}", "title": "" }, { "docid": "be536e416287f841b645596601bf3814", "score": "0.6045585", "text": "func (suuo *SysUserUpdateOne) SetLastName(s string) *SysUserUpdateOne {\n\tsuuo.mutation.SetLastName(s)\n\treturn suuo\n}", "title": "" }, { "docid": "4e9caf478d06702be1aa0e1adb805a62", "score": "0.6041435", "text": "func (r Repository) ChangeLastName(ctx context.Context, userID string, lastname string) error {\n\tif !bson.IsObjectIdHex(userID) {\n\t\treturn errors.New(\"wrong_id\")\n\t}\n\n\terr := r.collections[usersCollection].Update(\n\t\tbson.M{\n\t\t\t\"_id\": bson.ObjectIdHex(userID),\n\t\t},\n\t\tbson.M{\n\t\t\t\"$set\": bson.M{\n\t\t\t\t\"last_name\": lastname,\n\t\t\t},\n\t\t},\n\t)\n\n\treturn err\n}", "title": "" }, { "docid": "e9b6500a624c84d4312ede7cebd52ee0", "score": "0.60266346", "text": "func (o *User) GetLastName() string {\n\tif o == nil || IsNil(o.LastName) {\n\t\tvar ret string\n\t\treturn ret\n\t}\n\treturn *o.LastName\n}", "title": "" }, { "docid": "ea442e45655a7d43b477dcae575b8403", "score": "0.60264885", "text": "func (m *subaccount) SetLastName(val *string) {\n\tm.lastNameField = val\n}", "title": "" }, { "docid": "2d886c34a5f32dc086d85e3a98efb3f8", "score": "0.6017747", "text": "func (fa FakeAdapter) LastName() string {\n\treturn fake.LastName()\n}", "title": "" }, { "docid": "2d886c34a5f32dc086d85e3a98efb3f8", "score": "0.6017747", "text": "func (fa FakeAdapter) LastName() string {\n\treturn fake.LastName()\n}", "title": "" }, { "docid": "3a67f63dcb0fbe556ec72b3aef9f29a2", "score": "0.6017019", "text": "func (a *UserDetails) GetLastName() string {\n\tif a.decAttribLastName == \"\" {\n\t\ta.populateDecAttributes()\n\t}\n\treturn a.decAttribLastName\n}", "title": "" }, { "docid": "9d47d9e124a0cf1c862b967afea3b6ba", "score": "0.6014729", "text": "func (o *UserConfig) SetLastName(v string) {\n\to.LastName = v\n}", "title": "" }, { "docid": "34f41abeb7695bad63f6086f943084f2", "score": "0.6007414", "text": "func (o *User) GetLastNameOk() (*string, bool) {\n\tif o == nil || IsNil(o.LastName) {\n\t\treturn nil, false\n\t}\n\treturn o.LastName, true\n}", "title": "" }, { "docid": "512c087cb6dc050c9b0e13502028a763", "score": "0.60018116", "text": "func (o *User) SetLastName(v string) {\n\to.LastName = &v\n}", "title": "" }, { "docid": "512c087cb6dc050c9b0e13502028a763", "score": "0.60018116", "text": "func (o *User) SetLastName(v string) {\n\to.LastName = &v\n}", "title": "" }, { "docid": "d8da5bf7c5eebfa9e27477532378dc8f", "score": "0.5997053", "text": "func (m *UserMutation) SetLastName(s string) {\n\tm.last_name = &s\n}", "title": "" }, { "docid": "e8396ba1d514fdabcd76eb7b0f519229", "score": "0.5988663", "text": "func LastNameNotNil() predicate.User {\n\treturn predicate.User(func(s *sql.Selector) {\n\t\ts.Where(sql.NotNull(s.C(FieldLastName)))\n\t})\n}", "title": "" }, { "docid": "b190df9a03d6acd3f1954b44b447b037", "score": "0.5947914", "text": "func LastNameNEQ(v string) predicate.User {\n\treturn predicate.User(func(s *sql.Selector) {\n\t\ts.Where(sql.NEQ(s.C(FieldLastName), v))\n\t})\n}", "title": "" }, { "docid": "bf99ffca3e2018a6a65e639aa5b54e27", "score": "0.5946673", "text": "func (o *CrossAccountRequestByAccountAllOf) SetLastName(v string) {\n\to.LastName = &v\n}", "title": "" }, { "docid": "032f3737b54018ef9253de5c1fcc75f4", "score": "0.59432375", "text": "func (o *Account) GetLastName() string {\n\tif o == nil || o.LastName == nil {\n\t\tvar ret string\n\t\treturn ret\n\t}\n\treturn *o.LastName\n}", "title": "" }, { "docid": "6087c1fbd5507218f6bfb0082f1b0f45", "score": "0.59379697", "text": "func (o *ViewUser) HasLastName() bool {\n\tif o != nil && o.LastName != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "7a4840a25e6b153fe93171e28b25fe75", "score": "0.5932262", "text": "func (o *Account) GetLastNameOk() (*string, bool) {\n\tif o == nil || o.LastName == nil {\n\t\treturn nil, false\n\t}\n\treturn o.LastName, true\n}", "title": "" }, { "docid": "d6aa3ede61468d8404402828089d614b", "score": "0.5912908", "text": "func PersonalName(v string) predicate.User {\n\treturn predicate.User(func(s *sql.Selector) {\n\t\ts.Where(sql.EQ(s.C(FieldPersonalName), v))\n\t})\n}", "title": "" }, { "docid": "b975ccf722f70a875132b16af2d7993f", "score": "0.588881", "text": "func (o *PeoplePersonOfPeople) SetLastName(v string) {\n\to.LastName = &v\n}", "title": "" }, { "docid": "cc0dea943bf5c47f460f5e3ab63a3881", "score": "0.5878825", "text": "func (o *User) HasLastName() bool {\n\tif o != nil && o.LastName != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "a2a7c71687c12915c6841821b91545d4", "score": "0.587264", "text": "func (o *CrossAccountRequestByAccountAllOf) GetLastName() string {\n\tif o == nil || o.LastName == nil {\n\t\tvar ret string\n\t\treturn ret\n\t}\n\treturn *o.LastName\n}", "title": "" }, { "docid": "45f5a675ad9db0908b71e723058ff860", "score": "0.58296967", "text": "func (o *GetJokeByIDParams) bindLastName(rawData []string, hasKey bool, formats strfmt.Registry) error {\n\tvar raw string\n\tif len(rawData) > 0 {\n\t\traw = rawData[len(rawData)-1]\n\t}\n\n\t// Required: false\n\t// AllowEmptyValue: false\n\tif raw == \"\" { // empty values pass all other validations\n\t\treturn nil\n\t}\n\n\to.LastName = &raw\n\n\treturn nil\n}", "title": "" }, { "docid": "305333b1cf7224f341c4ad842b5433cf", "score": "0.5812245", "text": "func (o *UpdateAccountRequest) GetLastName() string {\n\tif o == nil || o.LastName == nil {\n\t\tvar ret string\n\t\treturn ret\n\t}\n\treturn *o.LastName\n}", "title": "" }, { "docid": "6dda045186829f2b7e3712bed31c289d", "score": "0.5795749", "text": "func (o *CrossAccountRequestByAccountAllOf) GetLastNameOk() (*string, bool) {\n\tif o == nil || o.LastName == nil {\n\t\treturn nil, false\n\t}\n\treturn o.LastName, true\n}", "title": "" }, { "docid": "607f8177024f4055ae9ab141586ca55e", "score": "0.5789748", "text": "func (o *UserConfig) GetLastName() string {\n\tif o == nil {\n\t\tvar ret string\n\t\treturn ret\n\t}\n\n\treturn o.LastName\n}", "title": "" }, { "docid": "768fe2dffe5cc50b5d93628f7cbe69f7", "score": "0.5787919", "text": "func (o *GetUserInfoParams) bindXUserLastName(rawData []string, hasKey bool, formats strfmt.Registry) error {\n\tif !hasKey {\n\t\treturn errors.Required(\"X-User-Last-Name\", \"header\")\n\t}\n\tvar raw string\n\tif len(rawData) > 0 {\n\t\traw = rawData[len(rawData)-1]\n\t}\n\n\t// Required: true\n\n\tif err := validate.RequiredString(\"X-User-Last-Name\", \"header\", raw); err != nil {\n\t\treturn err\n\t}\n\n\to.XUserLastName = raw\n\n\treturn nil\n}", "title": "" }, { "docid": "f48630fc91df89075de2648e41d26780", "score": "0.5755498", "text": "func (o *User) HasLastName() bool {\n\tif o != nil && !IsNil(o.LastName) {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "4536f6d165417e47f78ac4710dffb2cc", "score": "0.5749819", "text": "func PersonalNameContains(v string) predicate.User {\n\treturn predicate.User(func(s *sql.Selector) {\n\t\ts.Where(sql.Contains(s.C(FieldPersonalName), v))\n\t})\n}", "title": "" }, { "docid": "53f78a446518fa1c169172e29bfe4b72", "score": "0.57428116", "text": "func (f *SignupForm) ValidateLastName() (r http_utils.FieldReport) {\n\tf.LastName.String = strings.TrimSpace(f.LastName.String)\n\treturn CheckLengthOptional(&f.LastName, 1, 32)\n}", "title": "" }, { "docid": "0b1bd2c443a6eca28292021062712e3d", "score": "0.57164687", "text": "func (o *UpdateAccountRequest) GetLastNameOk() (*string, bool) {\n\tif o == nil || o.LastName == nil {\n\t\treturn nil, false\n\t}\n\treturn o.LastName, true\n}", "title": "" }, { "docid": "c32118fa2b7dc5c66bc11c2b863df9c0", "score": "0.57157344", "text": "func (o *PeoplePersonOfPeople) GetLastNameOk() (*string, bool) {\n\tif o == nil || o.LastName == nil {\n\t\treturn nil, false\n\t}\n\treturn o.LastName, true\n}", "title": "" }, { "docid": "a0af48d83876da25ed4dd201bec75dfa", "score": "0.5706408", "text": "func (o *UserConfig) GetLastNameOk() (*string, bool) {\n\tif o == nil {\n\t\treturn nil, false\n\t}\n\treturn &o.LastName, true\n}", "title": "" }, { "docid": "9520c578a8b3f9e98c206d7ff9f6610f", "score": "0.5705311", "text": "func GetLastNameSubstitute(cache interface{}, subname string, format string, option string) (value string, data interface{}) {\r\n\tc := getConsumer(cache)\r\n\treturn c.Name.Last, c\r\n}", "title": "" }, { "docid": "4605d29de10651aea26be4e8d68a49ea", "score": "0.569446", "text": "func (o *ClientDetail) GetLastName() string {\n\tif o == nil || o.LastName.Get() == nil {\n\t\tvar ret string\n\t\treturn ret\n\t}\n\treturn *o.LastName.Get()\n}", "title": "" }, { "docid": "3d18e05c104bb424ea553287efea6d59", "score": "0.56923276", "text": "func (o *Account) HasLastName() bool {\n\tif o != nil && o.LastName != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "bab6d9d216c8ca3b06bcb3fbf2a885e7", "score": "0.5687843", "text": "func PersonalNameLTE(v string) predicate.User {\n\treturn predicate.User(func(s *sql.Selector) {\n\t\ts.Where(sql.LTE(s.C(FieldPersonalName), v))\n\t})\n}", "title": "" }, { "docid": "45a842221d1d9e9aaa31ce420ec0d2e1", "score": "0.5686184", "text": "func (o *PeoplePersonOfPeople) GetLastName() string {\n\tif o == nil || o.LastName == nil {\n\t\tvar ret string\n\t\treturn ret\n\t}\n\treturn *o.LastName\n}", "title": "" }, { "docid": "33b823a2083d005a9a5d71ce3f0cfd7d", "score": "0.567834", "text": "func LastNameIsNil() predicate.User {\n\treturn predicate.User(func(s *sql.Selector) {\n\t\ts.Where(sql.IsNull(s.C(FieldLastName)))\n\t})\n}", "title": "" }, { "docid": "88ad74309fb4905d4323a828e1d2573d", "score": "0.56533355", "text": "func (m *UserMutation) OldLastName(ctx context.Context) (v string, err error) {\n\tif !m.op.Is(OpUpdateOne) {\n\t\treturn v, fmt.Errorf(\"OldLastName is allowed only on UpdateOne operations\")\n\t}\n\tif m.id == nil || m.oldValue == nil {\n\t\treturn v, fmt.Errorf(\"OldLastName requires an ID field in the mutation\")\n\t}\n\toldValue, err := m.oldValue(ctx)\n\tif err != nil {\n\t\treturn v, fmt.Errorf(\"querying old value for OldLastName: %w\", err)\n\t}\n\treturn oldValue.LastName, nil\n}", "title": "" }, { "docid": "59ecc9f53d37f46c1facccb962c920ed", "score": "0.56524646", "text": "func PersonalNameGT(v string) predicate.User {\n\treturn predicate.User(func(s *sql.Selector) {\n\t\ts.Where(sql.GT(s.C(FieldPersonalName), v))\n\t})\n}", "title": "" }, { "docid": "d02440563269d9e1c97236e8e65e7078", "score": "0.5644633", "text": "func (o *InlineResponse20045CardOwner) GetLastName() string {\n\tif o == nil || o.LastName == nil {\n\t\tvar ret string\n\t\treturn ret\n\t}\n\treturn *o.LastName\n}", "title": "" }, { "docid": "ac9b216a3f6f17598f9bd2608449cf1f", "score": "0.56406164", "text": "func UserHasSuffix(v string) predicate.Emp {\n\treturn predicate.Emp(func(s *sql.Selector) {\n\t\ts.Where(sql.HasSuffix(s.C(FieldUser), v))\n\t})\n}", "title": "" }, { "docid": "8c28f68937de692efa89a9c9097340d1", "score": "0.56272334", "text": "func (o *PeoplePersonOfPeople) HasLastName() bool {\n\tif o != nil && o.LastName != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "99a1de130e39ba289b7705efe34ea256", "score": "0.5618301", "text": "func (f *UserFilter) WhereDisplayName(p entql.StringP) {\n\tf.Where(p.Field(user.FieldDisplayName))\n}", "title": "" }, { "docid": "8bbf8031623a1f1465fb2251d8210f98", "score": "0.55962574", "text": "func (user User) GetName() string {\n\tif user.FullName() != \"\" {\n\t\treturn user.FullName()\n\t}\n\treturn strings.Split(user.Email, \"@\")[0]\n}", "title": "" } ]
32ea2bcca7b8d938509ea337f0d395bf
NewGetIPAMsubnetsParamsWithContext creates a new GetIPAMsubnetsParams object with the default values initialized, and the ability to set a context for a request
[ { "docid": "7cb6c0b097035cb1040c0e66be3acaff", "score": "0.88316345", "text": "func NewGetIPAMsubnetsParamsWithContext(ctx context.Context) *GetIPAMsubnetsParams {\n\tvar ()\n\treturn &GetIPAMsubnetsParams{\n\n\t\tContext: ctx,\n\t}\n}", "title": "" } ]
[ { "docid": "88950636a47783d61b19dcc60f2756c7", "score": "0.83037806", "text": "func NewGetIPAMsubnetsParams() *GetIPAMsubnetsParams {\n\tvar ()\n\treturn &GetIPAMsubnetsParams{\n\n\t\ttimeout: cr.DefaultTimeout,\n\t}\n}", "title": "" }, { "docid": "fd42fd5dd7d4873b374157ebd73dc277", "score": "0.7984575", "text": "func (o *GetIPAMsubnetsParams) WithContext(ctx context.Context) *GetIPAMsubnetsParams {\n\to.SetContext(ctx)\n\treturn o\n}", "title": "" }, { "docid": "c516c069a27a2b615ced02d0c5533cea", "score": "0.7716246", "text": "func NewGetIPAMsubnetsParamsWithHTTPClient(client *http.Client) *GetIPAMsubnetsParams {\n\tvar ()\n\treturn &GetIPAMsubnetsParams{\n\t\tHTTPClient: client,\n\t}\n}", "title": "" }, { "docid": "d4781eb868a0bf0d32deef9e584dfac8", "score": "0.74750507", "text": "func NewGetIPAMsubnetsParamsWithTimeout(timeout time.Duration) *GetIPAMsubnetsParams {\n\tvar ()\n\treturn &GetIPAMsubnetsParams{\n\n\t\ttimeout: timeout,\n\t}\n}", "title": "" }, { "docid": "17033b72356b837c0522972cd9b18f99", "score": "0.72783804", "text": "func (o *GetIPAMsubnetsParams) WithTags(tags *string) *GetIPAMsubnetsParams {\n\to.SetTags(tags)\n\treturn o\n}", "title": "" }, { "docid": "b00689fed121be5c80d5c4fd97146c9b", "score": "0.69061214", "text": "func (o *GetIPAMsubnetsParams) WithTimeout(timeout time.Duration) *GetIPAMsubnetsParams {\n\to.SetTimeout(timeout)\n\treturn o\n}", "title": "" }, { "docid": "1acd42dfdad2f2e297aabbaf3e08aa3a", "score": "0.66976213", "text": "func (o *GetIPAMsubnetsParams) WithHTTPClient(client *http.Client) *GetIPAMsubnetsParams {\n\to.SetHTTPClient(client)\n\treturn o\n}", "title": "" }, { "docid": "da65bb0d0573856b7f1371a1fd9e14b7", "score": "0.6513223", "text": "func (o *GetIPAMsubnetsParams) WithName(name *string) *GetIPAMsubnetsParams {\n\to.SetName(name)\n\treturn o\n}", "title": "" }, { "docid": "7bddb36c7348af061d59f1cd2dfe8f12", "score": "0.647937", "text": "func (o *GetIPAMsubnetsParams) WithDescription(description *string) *GetIPAMsubnetsParams {\n\to.SetDescription(description)\n\treturn o\n}", "title": "" }, { "docid": "4969a571d460548840f4ef9f54a43568", "score": "0.6394756", "text": "func (o *GetIPAMsubnetsParams) WithSubnetID(subnetID *string) *GetIPAMsubnetsParams {\n\to.SetSubnetID(subnetID)\n\treturn o\n}", "title": "" }, { "docid": "a4c1a2138379ad1983e5ebfc44fdb208", "score": "0.6212851", "text": "func (o *GetIPAMsubnetsParams) WithCustomerID(customerID *string) *GetIPAMsubnetsParams {\n\to.SetCustomerID(customerID)\n\treturn o\n}", "title": "" }, { "docid": "789f0704400db27a46bd4c766a0c2a9f", "score": "0.6193502", "text": "func (o *GetIPAMsubnetsParams) WithServiceLevel(serviceLevel *string) *GetIPAMsubnetsParams {\n\to.SetServiceLevel(serviceLevel)\n\treturn o\n}", "title": "" }, { "docid": "06c54fc92957c1ce71355733749b6401", "score": "0.6168443", "text": "func (o *GetIPAMsubnetsParams) WithCategory(category *string) *GetIPAMsubnetsParams {\n\to.SetCategory(category)\n\treturn o\n}", "title": "" }, { "docid": "2ed6b7d56d413407c22fced290307e6b", "score": "0.6163896", "text": "func (o *GetIPAMsubnetsParams) WithMaskBits(maskBits *string) *GetIPAMsubnetsParams {\n\to.SetMaskBits(maskBits)\n\treturn o\n}", "title": "" }, { "docid": "7eb076d24f35731fa301cc3053eabc21", "score": "0.61359817", "text": "func (o *GetIPAMsubnetsParams) WithVlanID(vlanID *string) *GetIPAMsubnetsParams {\n\to.SetVlanID(vlanID)\n\treturn o\n}", "title": "" }, { "docid": "eb4d75803dc9a86e0ccfc7884ae59be6", "score": "0.58870053", "text": "func (o *GetIPAMsubnetsParams) WithRangeBegin(rangeBegin *string) *GetIPAMsubnetsParams {\n\to.SetRangeBegin(rangeBegin)\n\treturn o\n}", "title": "" }, { "docid": "ace54ac3193fa02cb052efad201ad5f8", "score": "0.5850046", "text": "func (o *GetIPAMsubnetsParams) WithCustomer(customer *string) *GetIPAMsubnetsParams {\n\to.SetCustomer(customer)\n\treturn o\n}", "title": "" }, { "docid": "b619c0c63f7fd1aa2daccbe564a052ef", "score": "0.58232504", "text": "func (o *GetIPAMsubnetsParams) WithVrfGroupID(vrfGroupID *string) *GetIPAMsubnetsParams {\n\to.SetVrfGroupID(vrfGroupID)\n\treturn o\n}", "title": "" }, { "docid": "34bcdc790423b1963313025dc1927e53", "score": "0.57012635", "text": "func (o *GetIPAMsubnetsParams) WithParentSubnetID(parentSubnetID *string) *GetIPAMsubnetsParams {\n\to.SetParentSubnetID(parentSubnetID)\n\treturn o\n}", "title": "" }, { "docid": "51c1f67dc86590eeb72bd3999e3f2693", "score": "0.5689226", "text": "func (o *GetIPAMsubnetsParams) WithVrfGroup(vrfGroup *string) *GetIPAMsubnetsParams {\n\to.SetVrfGroup(vrfGroup)\n\treturn o\n}", "title": "" }, { "docid": "c8edf16050b3ad01a31b8a7cea84d2c7", "score": "0.56499964", "text": "func (o *GetIPAMsubnetsParams) WithRangeEnd(rangeEnd *string) *GetIPAMsubnetsParams {\n\to.SetRangeEnd(rangeEnd)\n\treturn o\n}", "title": "" }, { "docid": "ff8e9950382df77797908c209fb45de4", "score": "0.5637932", "text": "func (o *GetIPAMsubnetsParams) WithNetwork(network *string) *GetIPAMsubnetsParams {\n\to.SetNetwork(network)\n\treturn o\n}", "title": "" }, { "docid": "b7d580ae4c1e38c4b3308dab91fd3f74", "score": "0.5635817", "text": "func (o *GetIPAMsubnetsParams) WithMaskBitsGt(maskBitsGt *string) *GetIPAMsubnetsParams {\n\to.SetMaskBitsGt(maskBitsGt)\n\treturn o\n}", "title": "" }, { "docid": "b731a48e42a25ed2146eed4a4aefbd86", "score": "0.556657", "text": "func (o *GetIPAMsubnetsParams) WithCategoryID(categoryID *string) *GetIPAMsubnetsParams {\n\to.SetCategoryID(categoryID)\n\treturn o\n}", "title": "" }, { "docid": "4ea1134f8e0184ff9553cff3e5a03855", "score": "0.5503782", "text": "func (o *GetIPAMsubnetsParams) WithMaskBitsLt(maskBitsLt *string) *GetIPAMsubnetsParams {\n\to.SetMaskBitsLt(maskBitsLt)\n\treturn o\n}", "title": "" }, { "docid": "f5d84dde0d5511724dff18b07afeee15", "score": "0.54352564", "text": "func (o *GetIPAMsubnetsParams) WithTagsAnd(tagsAnd *string) *GetIPAMsubnetsParams {\n\to.SetTagsAnd(tagsAnd)\n\treturn o\n}", "title": "" }, { "docid": "da25d6d98929b1dc83cbe59bb02fda7c", "score": "0.5320357", "text": "func (o *GetIPAMsubnetsParams) WithParentSubnet(parentSubnet *string) *GetIPAMsubnetsParams {\n\to.SetParentSubnet(parentSubnet)\n\treturn o\n}", "title": "" }, { "docid": "640586637c98dbe3aa04988397c84219", "score": "0.53007513", "text": "func (o *GetIPAMsubnetsParams) WithCustomFieldsAnd(customFieldsAnd *string) *GetIPAMsubnetsParams {\n\to.SetCustomFieldsAnd(customFieldsAnd)\n\treturn o\n}", "title": "" }, { "docid": "4259d197f68be6ee8f39d26afde6c3d9", "score": "0.5210219", "text": "func NewGetRolesParamsWithContext(ctx context.Context) *GetRolesParams {\n\tvar ()\n\treturn &GetRolesParams{\n\n\t\tContext: ctx,\n\t}\n}", "title": "" }, { "docid": "599db21d0c920107946b22d9c053c598", "score": "0.5176343", "text": "func NewGetSMSitemsParamsWithContext(ctx context.Context) *GetSMSitemsParams {\n\tvar ()\n\treturn &GetSMSitemsParams{\n\n\t\tContext: ctx,\n\t}\n}", "title": "" }, { "docid": "e23e066c41df7fa5a9d70aa74c40e52a", "score": "0.51179457", "text": "func NewGetRolesParams() *GetRolesParams {\n\tvar ()\n\treturn &GetRolesParams{\n\n\t\ttimeout: cr.DefaultTimeout,\n\t}\n}", "title": "" }, { "docid": "292f4c4217d99e2242942a4746d3f209", "score": "0.5029808", "text": "func NewGetRacksParamsWithContext(ctx context.Context) *GetRacksParams {\n\tvar ()\n\treturn &GetRacksParams{\n\n\t\tContext: ctx,\n\t}\n}", "title": "" }, { "docid": "6f4f6611b1de974878305f8159a46f1b", "score": "0.4945359", "text": "func (o *GetIPAMsubnetsParams) WithGateway(gateway *string) *GetIPAMsubnetsParams {\n\to.SetGateway(gateway)\n\treturn o\n}", "title": "" }, { "docid": "035b59efcd1fefbd6c4941d8e0595dec", "score": "0.49285346", "text": "func (ipam *Ipam) GetSubnets(id string) ([]models.Subnet, error) {\n\tsession := ipam.session.Copy()\n\tdefer session.Close()\n\n\tvar subnets []models.Subnet\n\n\tsession.DB(IpamDatabase).C(IpamCollectionSubnets).Find(bson.M{\"pool\": bson.ObjectIdHex(id)}).All(&subnets)\n\n\treturn subnets, nil\n}", "title": "" }, { "docid": "d7db97ab1a9ae7280544eca7b83b78a7", "score": "0.48119247", "text": "func NewGetOutagesParamsWithContext(ctx context.Context) *GetOutagesParams {\n\treturn &GetOutagesParams{\n\t\tContext: ctx,\n\t}\n}", "title": "" }, { "docid": "7380b66cd65f52fc5ff93d6d73c58a12", "score": "0.47180584", "text": "func (o *GetIPAMsubnetsParams) WithCustomFieldsOr(customFieldsOr *string) *GetIPAMsubnetsParams {\n\to.SetCustomFieldsOr(customFieldsOr)\n\treturn o\n}", "title": "" }, { "docid": "922a623352ba03e8550ced54d1557285", "score": "0.45891362", "text": "func NewQueryRolesParamsWithContext(ctx context.Context) *QueryRolesParams {\n\treturn &QueryRolesParams{\n\t\tContext: ctx,\n\t}\n}", "title": "" }, { "docid": "a5d63461c29b924e2d034f84ac78a69c", "score": "0.45497257", "text": "func NewUpdateSubnetParamsWithContext(ctx context.Context) *UpdateSubnetParams {\n\tvar ()\n\treturn &UpdateSubnetParams{\n\n\t\tContext: ctx,\n\t}\n}", "title": "" }, { "docid": "a178df4ee1138e8646bd774b2bbc4676", "score": "0.45437124", "text": "func NewIPAMServicesReadParamsWithContext(ctx context.Context) *IPAMServicesReadParams {\n\tvar ()\n\treturn &IPAMServicesReadParams{\n\n\t\tContext: ctx,\n\t}\n}", "title": "" }, { "docid": "1f1015cb844e8442a997a6779cd616bf", "score": "0.44964597", "text": "func NewIpamIPAddressesListParamsWithContext(ctx context.Context) *IpamIPAddressesListParams {\n\treturn &IpamIPAddressesListParams{\n\t\tContext: ctx,\n\t}\n}", "title": "" }, { "docid": "530d3da0aef685301a2f7a685d55118e", "score": "0.4478799", "text": "func NewGetRoomsParamsWithContext(ctx context.Context) *GetRoomsParams {\n\tvar ()\n\treturn &GetRoomsParams{\n\n\t\tContext: ctx,\n\t}\n}", "title": "" }, { "docid": "baac1f82e434cf249ef5a3c34548a00d", "score": "0.44322595", "text": "func (u *User) GetSubnets(queryParams ...string) (map[string]interface{}, error) {\n\tlog.info(\"========== GET USER SUBNETS ==========\")\n\turl := buildURL(path[\"users\"], u.UserID, path[\"subnets\"])\n\n\treturn u.do(\"GET\", url, \"\", queryParams)\n}", "title": "" }, { "docid": "8ed85eee7586c74442aecf32e6b6eecc", "score": "0.4426751", "text": "func NewGetRolesParamsWithTimeout(timeout time.Duration) *GetRolesParams {\n\tvar ()\n\treturn &GetRolesParams{\n\n\t\ttimeout: timeout,\n\t}\n}", "title": "" }, { "docid": "2eaaae52c781eb293e700c96755f2649", "score": "0.44182366", "text": "func NewGetRolesParamsWithHTTPClient(client *http.Client) *GetRolesParams {\n\tvar ()\n\treturn &GetRolesParams{\n\t\tHTTPClient: client,\n\t}\n}", "title": "" }, { "docid": "be0d2ce3709dcc2ae32815b708ef457e", "score": "0.4340812", "text": "func NewGetRuntimeServersParamsWithContext(ctx context.Context) *GetRuntimeServersParams {\n\tvar ()\n\treturn &GetRuntimeServersParams{\n\n\t\tContext: ctx,\n\t}\n}", "title": "" }, { "docid": "4661a06b71f0cd97cf93a4504334e32f", "score": "0.4327499", "text": "func NewCacheServiceMetricsKeySizeGetParamsWithContext(ctx context.Context) *CacheServiceMetricsKeySizeGetParams {\n\n\treturn &CacheServiceMetricsKeySizeGetParams{\n\n\t\tContext: ctx,\n\t}\n}", "title": "" }, { "docid": "183c3c9be225ec523e71d1ed100d436e", "score": "0.42911047", "text": "func NewGetIconParamsWithContext(ctx context.Context) *GetIconParams {\n\treturn &GetIconParams{\n\t\tContext: ctx,\n\t}\n}", "title": "" }, { "docid": "23ee4a8ab291606977ca99b05b0c79c3", "score": "0.4277907", "text": "func (o *GetRolesParams) WithContext(ctx context.Context) *GetRolesParams {\n\to.SetContext(ctx)\n\treturn o\n}", "title": "" }, { "docid": "fe37d8015898a6adb330297b2c63620d", "score": "0.42740655", "text": "func GetSubnets(accessKeyID, secretAccessKey, region, vpcID string) ([]*ec2.Subnet, error) {\n\tclient, err := GetClientSet(accessKeyID, secretAccessKey, region)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tfilters := []*ec2.Filter{\n\t\t{Name: aws.String(\"vpc-id\"), Values: []*string{aws.String(vpcID)}},\n\t}\n\tsubnetsInput := &ec2.DescribeSubnetsInput{Filters: filters}\n\tout, err := client.EC2.DescribeSubnets(subnetsInput)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"failed to list subnets: %v\", err)\n\t}\n\n\treturn out.Subnets, nil\n}", "title": "" }, { "docid": "36e4951eed891cba1d926c61a7035453", "score": "0.42486224", "text": "func NewGetSMSitemsParams() *GetSMSitemsParams {\n\tvar ()\n\treturn &GetSMSitemsParams{\n\n\t\ttimeout: cr.DefaultTimeout,\n\t}\n}", "title": "" }, { "docid": "4b6bdc8d7bde8c4f1f963929ad142f93", "score": "0.42409936", "text": "func (o *GetIPAMsubnetsParams) SetSubnetID(subnetID *string) {\n\to.SubnetID = subnetID\n}", "title": "" }, { "docid": "c40c600bcfb7f8816acf572910450647", "score": "0.4232973", "text": "func NewMessagesParamsWithContext(ctx context.Context) *MessagesParams {\n\tvar (\n\t\tlevelDefault = string(\"ALL\")\n\t\tlimitDefault = int64(500)\n\t)\n\treturn &MessagesParams{\n\t\tLevel: &levelDefault,\n\t\tLimit: &limitDefault,\n\n\t\tContext: ctx,\n\t}\n}", "title": "" }, { "docid": "c3c3310afac732d776ee844391308e95", "score": "0.42011392", "text": "func (o *FiltersVmGroup) GetSubnetIds() []string {\n\tif o == nil || o.SubnetIds == nil {\n\t\tvar ret []string\n\t\treturn ret\n\t}\n\treturn *o.SubnetIds\n}", "title": "" }, { "docid": "0e0b039a48016f46d0aeecb8e288a48a", "score": "0.42000532", "text": "func NewListLoadBalancerVirtualServersParamsWithContext(ctx context.Context) *ListLoadBalancerVirtualServersParams {\n\tvar (\n\t\tpageSizeDefault = int64(1000)\n\t)\n\treturn &ListLoadBalancerVirtualServersParams{\n\t\tPageSize: &pageSizeDefault,\n\n\t\tContext: ctx,\n\t}\n}", "title": "" }, { "docid": "1eb46ec60a031a913db11217c2d31560", "score": "0.41871214", "text": "func NewSMSHistoryExportGetParamsWithContext(ctx context.Context) *SMSHistoryExportGetParams {\n\tvar ()\n\treturn &SMSHistoryExportGetParams{\n\n\t\tContext: ctx,\n\t}\n}", "title": "" }, { "docid": "43099b7bb4ddcd5de1773f944d5c85dd", "score": "0.41840893", "text": "func (o *GetIPAMsubnetsParams) 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.Category != nil {\n\n\t\t// query param category\n\t\tvar qrCategory string\n\t\tif o.Category != nil {\n\t\t\tqrCategory = *o.Category\n\t\t}\n\t\tqCategory := qrCategory\n\t\tif qCategory != \"\" {\n\t\t\tif err := r.SetQueryParam(\"category\", qCategory); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t}\n\n\tif o.CategoryID != nil {\n\n\t\t// query param category_id\n\t\tvar qrCategoryID string\n\t\tif o.CategoryID != nil {\n\t\t\tqrCategoryID = *o.CategoryID\n\t\t}\n\t\tqCategoryID := qrCategoryID\n\t\tif qCategoryID != \"\" {\n\t\t\tif err := r.SetQueryParam(\"category_id\", qCategoryID); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t}\n\n\tif o.CustomFieldsAnd != nil {\n\n\t\t// query param custom_fields_and\n\t\tvar qrCustomFieldsAnd string\n\t\tif o.CustomFieldsAnd != nil {\n\t\t\tqrCustomFieldsAnd = *o.CustomFieldsAnd\n\t\t}\n\t\tqCustomFieldsAnd := qrCustomFieldsAnd\n\t\tif qCustomFieldsAnd != \"\" {\n\t\t\tif err := r.SetQueryParam(\"custom_fields_and\", qCustomFieldsAnd); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t}\n\n\tif o.CustomFieldsOr != nil {\n\n\t\t// query param custom_fields_or\n\t\tvar qrCustomFieldsOr string\n\t\tif o.CustomFieldsOr != nil {\n\t\t\tqrCustomFieldsOr = *o.CustomFieldsOr\n\t\t}\n\t\tqCustomFieldsOr := qrCustomFieldsOr\n\t\tif qCustomFieldsOr != \"\" {\n\t\t\tif err := r.SetQueryParam(\"custom_fields_or\", qCustomFieldsOr); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t}\n\n\tif o.Customer != nil {\n\n\t\t// query param customer\n\t\tvar qrCustomer string\n\t\tif o.Customer != nil {\n\t\t\tqrCustomer = *o.Customer\n\t\t}\n\t\tqCustomer := qrCustomer\n\t\tif qCustomer != \"\" {\n\t\t\tif err := r.SetQueryParam(\"customer\", qCustomer); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t}\n\n\tif o.CustomerID != nil {\n\n\t\t// query param customer_id\n\t\tvar qrCustomerID string\n\t\tif o.CustomerID != nil {\n\t\t\tqrCustomerID = *o.CustomerID\n\t\t}\n\t\tqCustomerID := qrCustomerID\n\t\tif qCustomerID != \"\" {\n\t\t\tif err := r.SetQueryParam(\"customer_id\", qCustomerID); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t}\n\n\tif o.Description != nil {\n\n\t\t// query param description\n\t\tvar qrDescription string\n\t\tif o.Description != nil {\n\t\t\tqrDescription = *o.Description\n\t\t}\n\t\tqDescription := qrDescription\n\t\tif qDescription != \"\" {\n\t\t\tif err := r.SetQueryParam(\"description\", qDescription); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t}\n\n\tif o.Gateway != nil {\n\n\t\t// query param gateway\n\t\tvar qrGateway string\n\t\tif o.Gateway != nil {\n\t\t\tqrGateway = *o.Gateway\n\t\t}\n\t\tqGateway := qrGateway\n\t\tif qGateway != \"\" {\n\t\t\tif err := r.SetQueryParam(\"gateway\", qGateway); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t}\n\n\tif o.MaskBits != nil {\n\n\t\t// query param mask_bits\n\t\tvar qrMaskBits string\n\t\tif o.MaskBits != nil {\n\t\t\tqrMaskBits = *o.MaskBits\n\t\t}\n\t\tqMaskBits := qrMaskBits\n\t\tif qMaskBits != \"\" {\n\t\t\tif err := r.SetQueryParam(\"mask_bits\", qMaskBits); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t}\n\n\tif o.MaskBitsGt != nil {\n\n\t\t// query param mask_bits_gt\n\t\tvar qrMaskBitsGt string\n\t\tif o.MaskBitsGt != nil {\n\t\t\tqrMaskBitsGt = *o.MaskBitsGt\n\t\t}\n\t\tqMaskBitsGt := qrMaskBitsGt\n\t\tif qMaskBitsGt != \"\" {\n\t\t\tif err := r.SetQueryParam(\"mask_bits_gt\", qMaskBitsGt); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t}\n\n\tif o.MaskBitsLt != nil {\n\n\t\t// query param mask_bits_lt\n\t\tvar qrMaskBitsLt string\n\t\tif o.MaskBitsLt != nil {\n\t\t\tqrMaskBitsLt = *o.MaskBitsLt\n\t\t}\n\t\tqMaskBitsLt := qrMaskBitsLt\n\t\tif qMaskBitsLt != \"\" {\n\t\t\tif err := r.SetQueryParam(\"mask_bits_lt\", qMaskBitsLt); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t}\n\n\tif o.Name != nil {\n\n\t\t// query param name\n\t\tvar qrName string\n\t\tif o.Name != nil {\n\t\t\tqrName = *o.Name\n\t\t}\n\t\tqName := qrName\n\t\tif qName != \"\" {\n\t\t\tif err := r.SetQueryParam(\"name\", qName); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t}\n\n\tif o.Network != nil {\n\n\t\t// query param network\n\t\tvar qrNetwork string\n\t\tif o.Network != nil {\n\t\t\tqrNetwork = *o.Network\n\t\t}\n\t\tqNetwork := qrNetwork\n\t\tif qNetwork != \"\" {\n\t\t\tif err := r.SetQueryParam(\"network\", qNetwork); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t}\n\n\tif o.ParentSubnet != nil {\n\n\t\t// query param parent_subnet\n\t\tvar qrParentSubnet string\n\t\tif o.ParentSubnet != nil {\n\t\t\tqrParentSubnet = *o.ParentSubnet\n\t\t}\n\t\tqParentSubnet := qrParentSubnet\n\t\tif qParentSubnet != \"\" {\n\t\t\tif err := r.SetQueryParam(\"parent_subnet\", qParentSubnet); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t}\n\n\tif o.ParentSubnetID != nil {\n\n\t\t// query param parent_subnet_id\n\t\tvar qrParentSubnetID string\n\t\tif o.ParentSubnetID != nil {\n\t\t\tqrParentSubnetID = *o.ParentSubnetID\n\t\t}\n\t\tqParentSubnetID := qrParentSubnetID\n\t\tif qParentSubnetID != \"\" {\n\t\t\tif err := r.SetQueryParam(\"parent_subnet_id\", qParentSubnetID); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t}\n\n\tif o.RangeBegin != nil {\n\n\t\t// query param range_begin\n\t\tvar qrRangeBegin string\n\t\tif o.RangeBegin != nil {\n\t\t\tqrRangeBegin = *o.RangeBegin\n\t\t}\n\t\tqRangeBegin := qrRangeBegin\n\t\tif qRangeBegin != \"\" {\n\t\t\tif err := r.SetQueryParam(\"range_begin\", qRangeBegin); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t}\n\n\tif o.RangeEnd != nil {\n\n\t\t// query param range_end\n\t\tvar qrRangeEnd string\n\t\tif o.RangeEnd != nil {\n\t\t\tqrRangeEnd = *o.RangeEnd\n\t\t}\n\t\tqRangeEnd := qrRangeEnd\n\t\tif qRangeEnd != \"\" {\n\t\t\tif err := r.SetQueryParam(\"range_end\", qRangeEnd); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t}\n\n\tif o.ServiceLevel != nil {\n\n\t\t// query param service_level\n\t\tvar qrServiceLevel string\n\t\tif o.ServiceLevel != nil {\n\t\t\tqrServiceLevel = *o.ServiceLevel\n\t\t}\n\t\tqServiceLevel := qrServiceLevel\n\t\tif qServiceLevel != \"\" {\n\t\t\tif err := r.SetQueryParam(\"service_level\", qServiceLevel); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t}\n\n\tif o.SubnetID != nil {\n\n\t\t// query param subnet_id\n\t\tvar qrSubnetID string\n\t\tif o.SubnetID != nil {\n\t\t\tqrSubnetID = *o.SubnetID\n\t\t}\n\t\tqSubnetID := qrSubnetID\n\t\tif qSubnetID != \"\" {\n\t\t\tif err := r.SetQueryParam(\"subnet_id\", qSubnetID); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t}\n\n\tif o.Tags != nil {\n\n\t\t// query param tags\n\t\tvar qrTags string\n\t\tif o.Tags != nil {\n\t\t\tqrTags = *o.Tags\n\t\t}\n\t\tqTags := qrTags\n\t\tif qTags != \"\" {\n\t\t\tif err := r.SetQueryParam(\"tags\", qTags); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t}\n\n\tif o.TagsAnd != nil {\n\n\t\t// query param tags_and\n\t\tvar qrTagsAnd string\n\t\tif o.TagsAnd != nil {\n\t\t\tqrTagsAnd = *o.TagsAnd\n\t\t}\n\t\tqTagsAnd := qrTagsAnd\n\t\tif qTagsAnd != \"\" {\n\t\t\tif err := r.SetQueryParam(\"tags_and\", qTagsAnd); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t}\n\n\tif o.VlanID != nil {\n\n\t\t// query param vlan_id\n\t\tvar qrVlanID string\n\t\tif o.VlanID != nil {\n\t\t\tqrVlanID = *o.VlanID\n\t\t}\n\t\tqVlanID := qrVlanID\n\t\tif qVlanID != \"\" {\n\t\t\tif err := r.SetQueryParam(\"vlan_id\", qVlanID); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t}\n\n\tif o.VrfGroup != nil {\n\n\t\t// query param vrf_group\n\t\tvar qrVrfGroup string\n\t\tif o.VrfGroup != nil {\n\t\t\tqrVrfGroup = *o.VrfGroup\n\t\t}\n\t\tqVrfGroup := qrVrfGroup\n\t\tif qVrfGroup != \"\" {\n\t\t\tif err := r.SetQueryParam(\"vrf_group\", qVrfGroup); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t}\n\n\tif o.VrfGroupID != nil {\n\n\t\t// query param vrf_group_id\n\t\tvar qrVrfGroupID string\n\t\tif o.VrfGroupID != nil {\n\t\t\tqrVrfGroupID = *o.VrfGroupID\n\t\t}\n\t\tqVrfGroupID := qrVrfGroupID\n\t\tif qVrfGroupID != \"\" {\n\t\t\tif err := r.SetQueryParam(\"vrf_group_id\", qVrfGroupID); 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}", "title": "" }, { "docid": "3e3850442b70bedb48a0d90a12c592a8", "score": "0.41794977", "text": "func (client Client) Subnets() network.SubnetsClient {\n\tif client.subnets == nil {\n\t\tclnt := network.NewSubnetsClientWithBaseURI(client.baseURI, client.subscriptionID)\n\t\tclnt.Authorizer = client.Authorizer\n\t\tclnt.RequestInspector = client.RequestInspector\n\t\tclnt.ResponseInspector = client.ResponseInspector\n\t\tclient.subnets = &clnt\t\t\n\t}\t\n\treturn *client.subnets\n}", "title": "" }, { "docid": "46675cd57d62b23c7059ab4ebc6c6194", "score": "0.4161299", "text": "func (ipam *Ipam) GetSubnet(id string) (models.Subnet, error) {\n\tsession := ipam.session.Copy()\n\tdefer session.Close()\n\n\tvar subnet models.Subnet\n\n\treturn subnet, session.DB(IpamDatabase).C(IpamCollectionSubnets).Find(bson.M{\"_id\": bson.ObjectIdHex(id)}).One(&subnet)\n}", "title": "" }, { "docid": "722f6accb608419bb12c074ef748e19f", "score": "0.41177967", "text": "func NewGetLogsParamsWithContext(ctx context.Context) *GetLogsParams {\n\tvar ()\n\treturn &GetLogsParams{\n\n\t\tContext: ctx,\n\t}\n}", "title": "" }, { "docid": "bec7ef0876937806531a8e64b59472fc", "score": "0.40791646", "text": "func (o *CreateLoadBalancerRequest) GetSubnets() []string {\n\tif o == nil || o.Subnets == nil {\n\t\tvar ret []string\n\t\treturn ret\n\t}\n\treturn *o.Subnets\n}", "title": "" }, { "docid": "51758799edd7f8a7894147e20b834e99", "score": "0.40569484", "text": "func (m *IpamSubnetType) Validate() error {\n\t_, err := uuid.Parse(m.SubnetUUID)\n\tif err != nil {\n\t\treturn common.ErrorBadRequest(\"invalid subnet uuid\")\n\t}\n\n\treturn m.CheckIfSubnetParamsAreValid()\n}", "title": "" }, { "docid": "c404ba33c228d1df876a3798cac0f0a4", "score": "0.40550232", "text": "func NewGetRoomsParams() *GetRoomsParams {\n\tvar ()\n\treturn &GetRoomsParams{\n\n\t\ttimeout: cr.DefaultTimeout,\n\t}\n}", "title": "" }, { "docid": "22ea51765f78ad41718ab824a13f48df", "score": "0.40545154", "text": "func NewGetMetricsParamsWithContext(ctx context.Context) *GetMetricsParams {\n\tvar (\n\t\tgranularityDefault = string(\"AUTO\")\n\t\tgroupByDefault = string(\"NONE\")\n\t\tsiteTypeFilterDefault = string(\"ALL\")\n\t)\n\treturn &GetMetricsParams{\n\t\tGranularity: &granularityDefault,\n\t\tGroupBy: &groupByDefault,\n\t\tSiteTypeFilter: &siteTypeFilterDefault,\n\n\t\tContext: ctx,\n\t}\n}", "title": "" }, { "docid": "77d2a91e1bb8daffb27ff6fcf53c73d9", "score": "0.40510973", "text": "func NewGetMachineRolesListAllSpacesParamsWithContext(ctx context.Context) *GetMachineRolesListAllSpacesParams {\n\tvar ()\n\treturn &GetMachineRolesListAllSpacesParams{\n\n\t\tContext: ctx,\n\t}\n}", "title": "" }, { "docid": "2ebb6b690075af2ddacd888efb03121b", "score": "0.40335855", "text": "func NewGETSumForOrganizationParamsWithContext(ctx context.Context) *GETSumForOrganizationParams {\n\tvar ()\n\treturn &GETSumForOrganizationParams{\n\n\t\tContext: ctx,\n\t}\n}", "title": "" }, { "docid": "65238d90bada5bcade3b4622f0d3b921", "score": "0.40273988", "text": "func NewGetLogsParamsWithContext(ctx context.Context) *GetLogsParams {\n\tvar (\n\t\tpageDefault = int64(1)\n\t\tpageSizeDefault = int64(10)\n\t)\n\treturn &GetLogsParams{\n\t\tPage: &pageDefault,\n\t\tPageSize: &pageSizeDefault,\n\n\t\tContext: ctx,\n\t}\n}", "title": "" }, { "docid": "3bbc0f54e4893b83543fbb35a141895c", "score": "0.4024051", "text": "func (o *GetIPAMsubnetsParams) SetContext(ctx context.Context) {\n\to.Context = ctx\n}", "title": "" }, { "docid": "6948808fa2be06da131cd4a93f0d4f15", "score": "0.40162864", "text": "func NewVirtualizationChoicesReadParamsWithContext(ctx context.Context) *VirtualizationChoicesReadParams {\n\tvar ()\n\treturn &VirtualizationChoicesReadParams{\n\n\t\tContext: ctx,\n\t}\n}", "title": "" }, { "docid": "880803027323d7e65dd14a296507cd32", "score": "0.40109518", "text": "func NewPcloudPvminstancesNetworksGetParamsWithContext(ctx context.Context) *PcloudPvminstancesNetworksGetParams {\n\tvar ()\n\treturn &PcloudPvminstancesNetworksGetParams{\n\n\t\tContext: ctx,\n\t}\n}", "title": "" }, { "docid": "5f599b5c2717e7ed197950c6ba9f30fe", "score": "0.39986837", "text": "func NewGetBannedIpitemsRequest(server string, params *GetBannedIpitemsParams) (*http.Request, error) {\n\tvar err error\n\n\tqueryUrl, err := url.Parse(server)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tbasePath := fmt.Sprintf(\"/bannedips\")\n\tif basePath[0] == '/' {\n\t\tbasePath = basePath[1:]\n\t}\n\n\tqueryUrl, err = queryUrl.Parse(basePath)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tqueryValues := queryUrl.Query()\n\n\tif queryFrag, err := runtime.StyleParam(\"form\", true, \"page\", params.Page); err != nil {\n\t\treturn nil, err\n\t} else if parsed, err := url.ParseQuery(queryFrag); err != nil {\n\t\treturn nil, err\n\t} else {\n\t\tfor k, v := range parsed {\n\t\t\tfor _, v2 := range v {\n\t\t\t\tqueryValues.Add(k, v2)\n\t\t\t}\n\t\t}\n\t}\n\n\tif queryFrag, err := runtime.StyleParam(\"form\", true, \"rows\", params.Rows); err != nil {\n\t\treturn nil, err\n\t} else if parsed, err := url.ParseQuery(queryFrag); err != nil {\n\t\treturn nil, err\n\t} else {\n\t\tfor k, v := range parsed {\n\t\t\tfor _, v2 := range v {\n\t\t\t\tqueryValues.Add(k, v2)\n\t\t\t}\n\t\t}\n\t}\n\n\tqueryUrl.RawQuery = queryValues.Encode()\n\n\treq, err := http.NewRequest(\"GET\", queryUrl.String(), nil)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn req, nil\n}", "title": "" }, { "docid": "f5b2fc203a48b166ef236f1ebf451b33", "score": "0.3998069", "text": "func NewGetPortInfoUsingGET2ParamsWithContext(ctx context.Context) *GetPortInfoUsingGET2Params {\n\tvar ()\n\treturn &GetPortInfoUsingGET2Params{\n\n\t\tContext: ctx,\n\t}\n}", "title": "" }, { "docid": "6955392164497b8d1ad2bcf36910c2c0", "score": "0.3994123", "text": "func NewGetIPAMCustomerIDParamsWithContext(ctx context.Context) *GetIPAMCustomerIDParams {\n\tvar ()\n\treturn &GetIPAMCustomerIDParams{\n\n\t\tContext: ctx,\n\t}\n}", "title": "" }, { "docid": "49e910a24a6a412fbf3265fda9cef923", "score": "0.39936495", "text": "func NewPcloudCloudinstancesVolumesGetallParamsWithContext(ctx context.Context) *PcloudCloudinstancesVolumesGetallParams {\n\treturn &PcloudCloudinstancesVolumesGetallParams{\n\t\tContext: ctx,\n\t}\n}", "title": "" }, { "docid": "aa188707f411e2778d4a4a832a61b3e5", "score": "0.39920262", "text": "func (o *GetRolesParams) WithTimeout(timeout time.Duration) *GetRolesParams {\n\to.SetTimeout(timeout)\n\treturn o\n}", "title": "" }, { "docid": "57bc6ea3ea600f678f1ec06f7ed8fef5", "score": "0.39901653", "text": "func NewIPAMRirsReadParamsWithContext(ctx context.Context) *IPAMRirsReadParams {\n\tvar ()\n\treturn &IPAMRirsReadParams{\n\n\t\tContext: ctx,\n\t}\n}", "title": "" }, { "docid": "9d7849033a64751e665d0ff033367792", "score": "0.39860517", "text": "func NewGetLimitsBadRequest() *GetLimitsBadRequest {\n\treturn &GetLimitsBadRequest{}\n}", "title": "" }, { "docid": "dabf78f17be7d3ef31df07e302befce9", "score": "0.39690706", "text": "func NewGETUserRolesNotAcceptable() *GETUserRolesNotAcceptable {\n\treturn &GETUserRolesNotAcceptable{}\n}", "title": "" }, { "docid": "63d6c2596b8639be6e13c4d9143c4ed9", "score": "0.39672613", "text": "func (m *MockRDSAPI) DescribeDBSubnetGroupsWithContext(arg0 aws.Context, arg1 *rds.DescribeDBSubnetGroupsInput, arg2 ...request.Option) (*rds.DescribeDBSubnetGroupsOutput, error) {\n\tvarargs := []interface{}{arg0, arg1}\n\tfor _, a := range arg2 {\n\t\tvarargs = append(varargs, a)\n\t}\n\tret := m.ctrl.Call(m, \"DescribeDBSubnetGroupsWithContext\", varargs...)\n\tret0, _ := ret[0].(*rds.DescribeDBSubnetGroupsOutput)\n\tret1, _ := ret[1].(error)\n\treturn ret0, ret1\n}", "title": "" }, { "docid": "609f0f897474a5b5f4cfc25172b7d626", "score": "0.3957741", "text": "func NewDcimSitesReadParamsWithContext(ctx context.Context) *DcimSitesReadParams {\n\tvar ()\n\treturn &DcimSitesReadParams{\n\n\t\tContext: ctx,\n\t}\n}", "title": "" }, { "docid": "25bc36a6cbd0a973ad92a6c0adbb396d", "score": "0.39524823", "text": "func NewGetBootstrapParamsWithContext(ctx context.Context) *GetBootstrapParams {\n\tvar ()\n\treturn &GetBootstrapParams{\n\n\t\tContext: ctx,\n\t}\n}", "title": "" }, { "docid": "23801ae67ff9b877d1218a4a752ad75d", "score": "0.3940727", "text": "func NewCapacityPoolGetParamsWithContext(ctx context.Context) *CapacityPoolGetParams {\n\treturn &CapacityPoolGetParams{\n\t\tContext: ctx,\n\t}\n}", "title": "" }, { "docid": "7b9002a61e849f727dbaa5d4131dca1c", "score": "0.39334446", "text": "func NewListOpenstackSubnetsNoCredentialsV2ParamsWithContext(ctx context.Context) *ListOpenstackSubnetsNoCredentialsV2Params {\n\treturn &ListOpenstackSubnetsNoCredentialsV2Params{\n\t\tContext: ctx,\n\t}\n}", "title": "" }, { "docid": "0d8b02fa03d978fe4bd2ee1d5d20ca32", "score": "0.39330363", "text": "func GetSubnet(ctx *pulumi.Context,\n\tname string, id pulumi.IDInput, state *SubnetState, opts ...pulumi.ResourceOption) (*Subnet, error) {\n\tvar resource Subnet\n\terr := ctx.ReadResource(\"aws:ec2/subnet:Subnet\", name, id, state, &resource, opts...)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn &resource, nil\n}", "title": "" }, { "docid": "5e971c64b72a140b12ab05c05bb60b89", "score": "0.39249206", "text": "func (s *DescribeNotebookInstanceOutput) SetSubnetId(v string) *DescribeNotebookInstanceOutput {\n\ts.SubnetId = &v\n\treturn s\n}", "title": "" }, { "docid": "335f893de9b9f477dac4154340e1e381", "score": "0.39146495", "text": "func (c *APIClient) GetUserRoles(ctx _context.Context, id int32) apiGetUserRolesRequest {\n\treturn apiGetUserRolesRequest{\n\t\tclient: c,\n\t\tctx: ctx,\n\t\tid: id,\n\t}\n}", "title": "" }, { "docid": "96e1fbe48d6b5c84e608edcb0d0b912d", "score": "0.39034557", "text": "func NewPayRatesGetParamsWithContext(ctx context.Context) *PayRatesGetParams {\n\tvar ()\n\treturn &PayRatesGetParams{\n\n\t\tContext: ctx,\n\t}\n}", "title": "" }, { "docid": "7392d112abd72c8d3d5159a3dacc51d9", "score": "0.3901844", "text": "func (r Virtual_Guest_Network_Component) GetSubnets() (resp []datatypes.Network_Subnet, err error) {\n\terr = r.Session.DoRequest(\"SoftLayer_Virtual_Guest_Network_Component\", \"getSubnets\", nil, &r.Options, &resp)\n\treturn\n}", "title": "" }, { "docid": "4c23cbcc25ba7e3b27b0a840f3cfb1c4", "score": "0.38993505", "text": "func NewGetLogicalPortParamsWithContext(ctx context.Context) *GetLogicalPortParams {\n\tvar ()\n\treturn &GetLogicalPortParams{\n\n\t\tContext: ctx,\n\t}\n}", "title": "" }, { "docid": "6812cddcd79745f928df5043a589f669", "score": "0.38991696", "text": "func NewIpamIPAddressesListParams() *IpamIPAddressesListParams {\n\treturn &IpamIPAddressesListParams{\n\t\ttimeout: cr.DefaultTimeout,\n\t}\n}", "title": "" }, { "docid": "11b3bb44e6384cbc2f439f09daab0155", "score": "0.38911787", "text": "func NewVpcIpamScope(ctx *pulumi.Context,\n\tname string, args *VpcIpamScopeArgs, opts ...pulumi.ResourceOption) (*VpcIpamScope, error) {\n\tif args == nil {\n\t\treturn nil, errors.New(\"missing one or more required arguments\")\n\t}\n\n\tif args.IpamId == nil {\n\t\treturn nil, errors.New(\"invalid value for required argument 'IpamId'\")\n\t}\n\tvar resource VpcIpamScope\n\terr := ctx.RegisterResource(\"aws:ec2/vpcIpamScope:VpcIpamScope\", name, args, &resource, opts...)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn &resource, nil\n}", "title": "" }, { "docid": "e00b47f3b3590b57e10b76aab14bc767", "score": "0.3878725", "text": "func GetVirtualNetworkSubnet(ctx context.Context, vnetName string, subnetName string) (network.Subnet, error) {\n\tsubnetsClient := getSubnetsClient()\n\treturn subnetsClient.Get(ctx, config.GroupName(), vnetName, subnetName, \"\")\n}", "title": "" }, { "docid": "e00b47f3b3590b57e10b76aab14bc767", "score": "0.3878725", "text": "func GetVirtualNetworkSubnet(ctx context.Context, vnetName string, subnetName string) (network.Subnet, error) {\n\tsubnetsClient := getSubnetsClient()\n\treturn subnetsClient.Get(ctx, config.GroupName(), vnetName, subnetName, \"\")\n}", "title": "" }, { "docid": "61494c85031f70dbe4ae83ad9d0b7001", "score": "0.3871942", "text": "func NewGetOutagesParams() *GetOutagesParams {\n\treturn &GetOutagesParams{\n\t\ttimeout: cr.DefaultTimeout,\n\t}\n}", "title": "" }, { "docid": "6a004ecb7a5f4025e8b88ae77d7fdd4e", "score": "0.38651988", "text": "func (sqlStore *SQLStore) GetSubnets(filter *model.SubnetFilter) ([]*model.Subnet, error) {\n\treturn sqlStore.getSubnets(sqlStore.db, filter)\n}", "title": "" }, { "docid": "c50eadff220ece786b51f3414e4de274", "score": "0.3858562", "text": "func NewGetLogsParams() GetLogsParams {\n\n\tvar (\n\t\t// initialize parameters with default values\n\n\t\tpageSizeDefault = int64(20)\n\t)\n\n\treturn GetLogsParams{\n\t\tPageSize: &pageSizeDefault,\n\t}\n}", "title": "" }, { "docid": "8665ba325a967fe386c196bfd2cceacb", "score": "0.38578776", "text": "func NewServiceInstanceGetParamsWithContext(ctx context.Context) *ServiceInstanceGetParams {\n\treturn &ServiceInstanceGetParams{\n\t\tContext: ctx,\n\t}\n}", "title": "" }, { "docid": "09e904a59e12c0da4b0bcf1b2f649239", "score": "0.38564417", "text": "func (o *IPAMServicesReadParams) WithContext(ctx context.Context) *IPAMServicesReadParams {\n\to.SetContext(ctx)\n\treturn o\n}", "title": "" }, { "docid": "f3f23ee079599a617eb8a3bf7fd79f52", "score": "0.3852932", "text": "func NewGetNetworkAppliancePortParamsWithContext(ctx context.Context) *GetNetworkAppliancePortParams {\n\tvar ()\n\treturn &GetNetworkAppliancePortParams{\n\n\t\tContext: ctx,\n\t}\n}", "title": "" }, { "docid": "9c95bc6a0d6711bacbb59027bf6a49f6", "score": "0.38504392", "text": "func NewGetAuditEventsParamsWithContext(ctx context.Context) *GetAuditEventsParams {\n\tvar (\n\t\tpageDefault = int32(0)\n\t\tsizeDefault = int32(100)\n\t)\n\treturn &GetAuditEventsParams{\n\t\tPage: &pageDefault,\n\t\tSize: &sizeDefault,\n\n\t\tContext: ctx,\n\t}\n}", "title": "" }, { "docid": "a7c1c99d8dd46d1b7b3bdde83be0bff2", "score": "0.38439015", "text": "func NewGetRepositoriesParamsWithContext(ctx context.Context) *GetRepositoriesParams {\n\tvar ()\n\treturn &GetRepositoriesParams{\n\n\t\tContext: ctx,\n\t}\n}", "title": "" } ]
496bc2989876447af80ee76a5fcd3a97
Mutable returns a mutable reference to a composite type. If the field is unpopulated, it may allocate a composite value. For a field belonging to a oneof, it implicitly clears any other field that may be currently set within the same oneof. For extension fields, it implicitly stores the provided ExtensionType if not already stored. It panics if the field does not contain a composite type. Mutable is a mutating operation and unsafe for concurrent use.
[ { "docid": "7ba4eb0c54eb50f4f3e9f04fb5e72771", "score": "0.0", "text": "func (x *fastReflection_MsgExecResponse) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value {\n\tswitch fd.FullName() {\n\tdefault:\n\t\tif fd.IsExtension() {\n\t\t\tpanic(fmt.Errorf(\"proto3 declared messages do not support extensions: cosmos.group.v1beta1.MsgExecResponse\"))\n\t\t}\n\t\tpanic(fmt.Errorf(\"message cosmos.group.v1beta1.MsgExecResponse does not contain field %s\", fd.FullName()))\n\t}\n}", "title": "" } ]
[ { "docid": "373e8229874803a77f3124e8a8d6b42b", "score": "0.55811787", "text": "func (x *fastReflection_EventAddCreditType) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value {\n\tswitch fd.FullName() {\n\tcase \"regen.ecocredit.v1.EventAddCreditType.abbreviation\":\n\t\tpanic(fmt.Errorf(\"field abbreviation of message regen.ecocredit.v1.EventAddCreditType is not mutable\"))\n\tdefault:\n\t\tif fd.IsExtension() {\n\t\t\tpanic(fmt.Errorf(\"proto3 declared messages do not support extensions: regen.ecocredit.v1.EventAddCreditType\"))\n\t\t}\n\t\tpanic(fmt.Errorf(\"message regen.ecocredit.v1.EventAddCreditType does not contain field %s\", fd.FullName()))\n\t}\n}", "title": "" }, { "docid": "0cae78a9d850284eb125cea83f00335a", "score": "0.52745146", "text": "func (x *fastReflection_AnyWithExtra) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value {\n\tswitch fd.FullName() {\n\tcase \"testpb.AnyWithExtra.a\":\n\t\tif x.A == nil {\n\t\t\tx.A = new(anypb.Any)\n\t\t}\n\t\treturn protoreflect.ValueOfMessage(x.A.ProtoReflect())\n\tcase \"testpb.AnyWithExtra.b\":\n\t\tpanic(fmt.Errorf(\"field b of message testpb.AnyWithExtra is not mutable\"))\n\tcase \"testpb.AnyWithExtra.c\":\n\t\tpanic(fmt.Errorf(\"field c of message testpb.AnyWithExtra is not mutable\"))\n\tdefault:\n\t\tif fd.IsExtension() {\n\t\t\tpanic(fmt.Errorf(\"proto3 declared messages do not support extensions: testpb.AnyWithExtra\"))\n\t\t}\n\t\tpanic(fmt.Errorf(\"message testpb.AnyWithExtra does not contain field %s\", fd.FullName()))\n\t}\n}", "title": "" }, { "docid": "923b95b2ec24b4654d7c9ae4d40f3dac", "score": "0.5265818", "text": "func (x *fastReflection_Customer2) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value {\n\tswitch fd.FullName() {\n\tcase \"testpb.Customer2.miscellaneous\":\n\t\tif x.Miscellaneous == nil {\n\t\t\tx.Miscellaneous = new(anypb.Any)\n\t\t}\n\t\treturn protoreflect.ValueOfMessage(x.Miscellaneous.ProtoReflect())\n\tcase \"testpb.Customer2.id\":\n\t\tpanic(fmt.Errorf(\"field id of message testpb.Customer2 is not mutable\"))\n\tcase \"testpb.Customer2.industry\":\n\t\tpanic(fmt.Errorf(\"field industry of message testpb.Customer2 is not mutable\"))\n\tcase \"testpb.Customer2.name\":\n\t\tpanic(fmt.Errorf(\"field name of message testpb.Customer2 is not mutable\"))\n\tcase \"testpb.Customer2.fewer\":\n\t\tpanic(fmt.Errorf(\"field fewer of message testpb.Customer2 is not mutable\"))\n\tcase \"testpb.Customer2.reserved\":\n\t\tpanic(fmt.Errorf(\"field reserved of message testpb.Customer2 is not mutable\"))\n\tcase \"testpb.Customer2.city\":\n\t\tpanic(fmt.Errorf(\"field city of message testpb.Customer2 is not mutable\"))\n\tdefault:\n\t\tif fd.IsExtension() {\n\t\t\tpanic(fmt.Errorf(\"proto3 declared messages do not support extensions: testpb.Customer2\"))\n\t\t}\n\t\tpanic(fmt.Errorf(\"message testpb.Customer2 does not contain field %s\", fd.FullName()))\n\t}\n}", "title": "" }, { "docid": "a73f395adc0956f7cdc011769117a7a2", "score": "0.5227675", "text": "func NewMutable[OuterModelType any, OuterModelPtrType PtrType[OuterModelType, InnerModelType], InnerModelType any](model *InnerModelType, cacheBytes ...bool) (newInstance *OuterModelType) {\n\tnewInstance = new(OuterModelType)\n\t(OuterModelPtrType)(newInstance).New(model, cacheBytes...)\n\n\treturn newInstance\n}", "title": "" }, { "docid": "15948f8255d028f69e96361d699579b4", "score": "0.5195364", "text": "func (x *fastReflection_TestVersion3LoneOneOfValue) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value {\n\tswitch fd.FullName() {\n\tcase \"testpb.TestVersion3LoneOneOfValue.a\":\n\t\tif x.A == nil {\n\t\t\tx.A = new(TestVersion3)\n\t\t}\n\t\treturn protoreflect.ValueOfMessage(x.A.ProtoReflect())\n\tcase \"testpb.TestVersion3LoneOneOfValue.b\":\n\t\tif x.B == nil {\n\t\t\tx.B = new(TestVersion3)\n\t\t}\n\t\treturn protoreflect.ValueOfMessage(x.B.ProtoReflect())\n\tcase \"testpb.TestVersion3LoneOneOfValue.c\":\n\t\tif x.C == nil {\n\t\t\tx.C = []*TestVersion3{}\n\t\t}\n\t\tvalue := &_TestVersion3LoneOneOfValue_4_list{list: &x.C}\n\t\treturn protoreflect.ValueOfList(value)\n\tcase \"testpb.TestVersion3LoneOneOfValue.d\":\n\t\tif x.D == nil {\n\t\t\tx.D = []*TestVersion3{}\n\t\t}\n\t\tvalue := &_TestVersion3LoneOneOfValue_5_list{list: &x.D}\n\t\treturn protoreflect.ValueOfList(value)\n\tcase \"testpb.TestVersion3LoneOneOfValue.g\":\n\t\tif x.G == nil {\n\t\t\tx.G = new(anypb.Any)\n\t\t}\n\t\treturn protoreflect.ValueOfMessage(x.G.ProtoReflect())\n\tcase \"testpb.TestVersion3LoneOneOfValue.h\":\n\t\tif x.H == nil {\n\t\t\tx.H = []*TestVersion1{}\n\t\t}\n\t\tvalue := &_TestVersion3LoneOneOfValue_9_list{list: &x.H}\n\t\treturn protoreflect.ValueOfList(value)\n\tcase \"testpb.TestVersion3LoneOneOfValue.k\":\n\t\tif x.K == nil {\n\t\t\tx.K = new(Customer1)\n\t\t}\n\t\treturn protoreflect.ValueOfMessage(x.K.ProtoReflect())\n\tcase \"testpb.TestVersion3LoneOneOfValue.x\":\n\t\tpanic(fmt.Errorf(\"field x of message testpb.TestVersion3LoneOneOfValue is not mutable\"))\n\tcase \"testpb.TestVersion3LoneOneOfValue.e\":\n\t\tpanic(fmt.Errorf(\"field e of message testpb.TestVersion3LoneOneOfValue is not mutable\"))\n\tcase \"testpb.TestVersion3LoneOneOfValue.non_critical_field\":\n\t\tpanic(fmt.Errorf(\"field non_critical_field of message testpb.TestVersion3LoneOneOfValue is not mutable\"))\n\tdefault:\n\t\tif fd.IsExtension() {\n\t\t\tpanic(fmt.Errorf(\"proto3 declared messages do not support extensions: testpb.TestVersion3LoneOneOfValue\"))\n\t\t}\n\t\tpanic(fmt.Errorf(\"message testpb.TestVersion3LoneOneOfValue does not contain field %s\", fd.FullName()))\n\t}\n}", "title": "" }, { "docid": "ec080a26a384959344067c5726efee2b", "score": "0.5170077", "text": "func (x *fastReflection_Customer1) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value {\n\tswitch fd.FullName() {\n\tcase \"testpb.Customer1.id\":\n\t\tpanic(fmt.Errorf(\"field id of message testpb.Customer1 is not mutable\"))\n\tcase \"testpb.Customer1.name\":\n\t\tpanic(fmt.Errorf(\"field name of message testpb.Customer1 is not mutable\"))\n\tcase \"testpb.Customer1.subscription_fee\":\n\t\tpanic(fmt.Errorf(\"field subscription_fee of message testpb.Customer1 is not mutable\"))\n\tcase \"testpb.Customer1.payment\":\n\t\tpanic(fmt.Errorf(\"field payment of message testpb.Customer1 is not mutable\"))\n\tdefault:\n\t\tif fd.IsExtension() {\n\t\t\tpanic(fmt.Errorf(\"proto3 declared messages do not support extensions: testpb.Customer1\"))\n\t\t}\n\t\tpanic(fmt.Errorf(\"message testpb.Customer1 does not contain field %s\", fd.FullName()))\n\t}\n}", "title": "" }, { "docid": "21841651b4579f05fdd5f2c91b86655f", "score": "0.5151526", "text": "func (x *fastReflection_Nested1A) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value {\n\tswitch fd.FullName() {\n\tcase \"testpb.Nested1A.nested\":\n\t\tif x.Nested == nil {\n\t\t\tx.Nested = new(Nested2A)\n\t\t}\n\t\treturn protoreflect.ValueOfMessage(x.Nested.ProtoReflect())\n\tcase \"testpb.Nested1A.id\":\n\t\tpanic(fmt.Errorf(\"field id of message testpb.Nested1A is not mutable\"))\n\tdefault:\n\t\tif fd.IsExtension() {\n\t\t\tpanic(fmt.Errorf(\"proto3 declared messages do not support extensions: testpb.Nested1A\"))\n\t\t}\n\t\tpanic(fmt.Errorf(\"message testpb.Nested1A does not contain field %s\", fd.FullName()))\n\t}\n}", "title": "" }, { "docid": "f74116261c3dd4f11c0c43917a2f0320", "score": "0.5131507", "text": "func (x *fastReflection_Nested1B) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value {\n\tswitch fd.FullName() {\n\tcase \"testpb.Nested1B.nested\":\n\t\tif x.Nested == nil {\n\t\t\tx.Nested = new(Nested2B)\n\t\t}\n\t\treturn protoreflect.ValueOfMessage(x.Nested.ProtoReflect())\n\tcase \"testpb.Nested1B.id\":\n\t\tpanic(fmt.Errorf(\"field id of message testpb.Nested1B is not mutable\"))\n\tcase \"testpb.Nested1B.age\":\n\t\tpanic(fmt.Errorf(\"field age of message testpb.Nested1B is not mutable\"))\n\tdefault:\n\t\tif fd.IsExtension() {\n\t\t\tpanic(fmt.Errorf(\"proto3 declared messages do not support extensions: testpb.Nested1B\"))\n\t\t}\n\t\tpanic(fmt.Errorf(\"message testpb.Nested1B does not contain field %s\", fd.FullName()))\n\t}\n}", "title": "" }, { "docid": "55de51a9c8894e3a2b40bda6868bfaa2", "score": "0.5121128", "text": "func (x *fastReflection_TestVersionFD1WithExtraAny) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value {\n\tswitch fd.FullName() {\n\tcase \"testpb.TestVersionFD1WithExtraAny.a\":\n\t\tif x.A == nil {\n\t\t\tx.A = new(TestVersion1)\n\t\t}\n\t\treturn protoreflect.ValueOfMessage(x.A.ProtoReflect())\n\tcase \"testpb.TestVersionFD1WithExtraAny.f\":\n\t\tif x.Sum == nil {\n\t\t\tvalue := &TestVersion1{}\n\t\t\toneofValue := &TestVersionFD1WithExtraAny_F{F: value}\n\t\t\tx.Sum = oneofValue\n\t\t\treturn protoreflect.ValueOfMessage(value.ProtoReflect())\n\t\t}\n\t\tswitch m := x.Sum.(type) {\n\t\tcase *TestVersionFD1WithExtraAny_F:\n\t\t\treturn protoreflect.ValueOfMessage(m.F.ProtoReflect())\n\t\tdefault:\n\t\t\tvalue := &TestVersion1{}\n\t\t\toneofValue := &TestVersionFD1WithExtraAny_F{F: value}\n\t\t\tx.Sum = oneofValue\n\t\t\treturn protoreflect.ValueOfMessage(value.ProtoReflect())\n\t\t}\n\tcase \"testpb.TestVersionFD1WithExtraAny.g\":\n\t\tif x.G == nil {\n\t\t\tx.G = new(AnyWithExtra)\n\t\t}\n\t\treturn protoreflect.ValueOfMessage(x.G.ProtoReflect())\n\tcase \"testpb.TestVersionFD1WithExtraAny.h\":\n\t\tif x.H == nil {\n\t\t\tx.H = []*TestVersion1{}\n\t\t}\n\t\tvalue := &_TestVersionFD1WithExtraAny_9_list{list: &x.H}\n\t\treturn protoreflect.ValueOfList(value)\n\tcase \"testpb.TestVersionFD1WithExtraAny.x\":\n\t\tpanic(fmt.Errorf(\"field x of message testpb.TestVersionFD1WithExtraAny is not mutable\"))\n\tcase \"testpb.TestVersionFD1WithExtraAny.e\":\n\t\tpanic(fmt.Errorf(\"field e of message testpb.TestVersionFD1WithExtraAny is not mutable\"))\n\tdefault:\n\t\tif fd.IsExtension() {\n\t\t\tpanic(fmt.Errorf(\"proto3 declared messages do not support extensions: testpb.TestVersionFD1WithExtraAny\"))\n\t\t}\n\t\tpanic(fmt.Errorf(\"message testpb.TestVersionFD1WithExtraAny does not contain field %s\", fd.FullName()))\n\t}\n}", "title": "" }, { "docid": "ddb1617265ff05aeb5b390e7c70d6663", "score": "0.511097", "text": "func (x *fastReflection_Customer3) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value {\n\tswitch fd.FullName() {\n\tcase \"testpb.Customer3.original\":\n\t\tif x.Original == nil {\n\t\t\tx.Original = new(Customer1)\n\t\t}\n\t\treturn protoreflect.ValueOfMessage(x.Original.ProtoReflect())\n\tcase \"testpb.Customer3.id\":\n\t\tpanic(fmt.Errorf(\"field id of message testpb.Customer3 is not mutable\"))\n\tcase \"testpb.Customer3.name\":\n\t\tpanic(fmt.Errorf(\"field name of message testpb.Customer3 is not mutable\"))\n\tcase \"testpb.Customer3.sf\":\n\t\tpanic(fmt.Errorf(\"field sf of message testpb.Customer3 is not mutable\"))\n\tcase \"testpb.Customer3.surcharge\":\n\t\tpanic(fmt.Errorf(\"field surcharge of message testpb.Customer3 is not mutable\"))\n\tcase \"testpb.Customer3.destination\":\n\t\tpanic(fmt.Errorf(\"field destination of message testpb.Customer3 is not mutable\"))\n\tcase \"testpb.Customer3.credit_card_no\":\n\t\tpanic(fmt.Errorf(\"field credit_card_no of message testpb.Customer3 is not mutable\"))\n\tcase \"testpb.Customer3.cheque_no\":\n\t\tpanic(fmt.Errorf(\"field cheque_no of message testpb.Customer3 is not mutable\"))\n\tdefault:\n\t\tif fd.IsExtension() {\n\t\t\tpanic(fmt.Errorf(\"proto3 declared messages do not support extensions: testpb.Customer3\"))\n\t\t}\n\t\tpanic(fmt.Errorf(\"message testpb.Customer3 does not contain field %s\", fd.FullName()))\n\t}\n}", "title": "" }, { "docid": "2157ccb3d040ec829cd01915dcc47368", "score": "0.50995517", "text": "func (x *fastReflection_Nested3A) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value {\n\tswitch fd.FullName() {\n\tcase \"testpb.Nested3A.a4\":\n\t\tif x.A4 == nil {\n\t\t\tx.A4 = []*Nested4A{}\n\t\t}\n\t\tvalue := &_Nested3A_4_list{list: &x.A4}\n\t\treturn protoreflect.ValueOfList(value)\n\tcase \"testpb.Nested3A.index\":\n\t\tif x.Index == nil {\n\t\t\tx.Index = make(map[int64]*Nested4A)\n\t\t}\n\t\tvalue := &_Nested3A_5_map{m: &x.Index}\n\t\treturn protoreflect.ValueOfMap(value)\n\tcase \"testpb.Nested3A.id\":\n\t\tpanic(fmt.Errorf(\"field id of message testpb.Nested3A is not mutable\"))\n\tcase \"testpb.Nested3A.name\":\n\t\tpanic(fmt.Errorf(\"field name of message testpb.Nested3A is not mutable\"))\n\tdefault:\n\t\tif fd.IsExtension() {\n\t\t\tpanic(fmt.Errorf(\"proto3 declared messages do not support extensions: testpb.Nested3A\"))\n\t\t}\n\t\tpanic(fmt.Errorf(\"message testpb.Nested3A does not contain field %s\", fd.FullName()))\n\t}\n}", "title": "" }, { "docid": "243ed12fc97e5c100c8a23f2e8c6e83c", "score": "0.5073985", "text": "func (x *fastReflection_EventCreateBatch) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value {\n\tswitch fd.FullName() {\n\tcase \"regen.ecocredit.v1.EventCreateBatch.origin_tx\":\n\t\tif x.OriginTx == nil {\n\t\t\tx.OriginTx = new(OriginTx)\n\t\t}\n\t\treturn protoreflect.ValueOfMessage(x.OriginTx.ProtoReflect())\n\tcase \"regen.ecocredit.v1.EventCreateBatch.batch_denom\":\n\t\tpanic(fmt.Errorf(\"field batch_denom of message regen.ecocredit.v1.EventCreateBatch is not mutable\"))\n\tdefault:\n\t\tif fd.IsExtension() {\n\t\t\tpanic(fmt.Errorf(\"proto3 declared messages do not support extensions: regen.ecocredit.v1.EventCreateBatch\"))\n\t\t}\n\t\tpanic(fmt.Errorf(\"message regen.ecocredit.v1.EventCreateBatch does not contain field %s\", fd.FullName()))\n\t}\n}", "title": "" }, { "docid": "32f349f56446804d65438cd0246a62b0", "score": "0.50116426", "text": "func (x *fastReflection_EventSealBatch) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value {\n\tswitch fd.FullName() {\n\tcase \"regen.ecocredit.v1.EventSealBatch.batch_denom\":\n\t\tpanic(fmt.Errorf(\"field batch_denom of message regen.ecocredit.v1.EventSealBatch is not mutable\"))\n\tdefault:\n\t\tif fd.IsExtension() {\n\t\t\tpanic(fmt.Errorf(\"proto3 declared messages do not support extensions: regen.ecocredit.v1.EventSealBatch\"))\n\t\t}\n\t\tpanic(fmt.Errorf(\"message regen.ecocredit.v1.EventSealBatch does not contain field %s\", fd.FullName()))\n\t}\n}", "title": "" }, { "docid": "ed95f50d7dcfb964647432b96244176f", "score": "0.4979041", "text": "func (x *fastReflection_TestVersion3LoneNesting_Inner1) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value {\n\tswitch fd.FullName() {\n\tcase \"testpb.TestVersion3LoneNesting.Inner1.inner\":\n\t\tif x.Inner == nil {\n\t\t\tx.Inner = new(TestVersion3LoneNesting_Inner1_InnerInner)\n\t\t}\n\t\treturn protoreflect.ValueOfMessage(x.Inner.ProtoReflect())\n\tcase \"testpb.TestVersion3LoneNesting.Inner1.id\":\n\t\tpanic(fmt.Errorf(\"field id of message testpb.TestVersion3LoneNesting.Inner1 is not mutable\"))\n\tcase \"testpb.TestVersion3LoneNesting.Inner1.name\":\n\t\tpanic(fmt.Errorf(\"field name of message testpb.TestVersion3LoneNesting.Inner1 is not mutable\"))\n\tdefault:\n\t\tif fd.IsExtension() {\n\t\t\tpanic(fmt.Errorf(\"proto3 declared messages do not support extensions: testpb.TestVersion3LoneNesting.Inner1\"))\n\t\t}\n\t\tpanic(fmt.Errorf(\"message testpb.TestVersion3LoneNesting.Inner1 does not contain field %s\", fd.FullName()))\n\t}\n}", "title": "" }, { "docid": "d7cb54151f2defc0348a57399f322cd6", "score": "0.49713084", "text": "func (x *fastReflection_Nested3B) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value {\n\tswitch fd.FullName() {\n\tcase \"testpb.Nested3B.b4\":\n\t\tif x.B4 == nil {\n\t\t\tx.B4 = []*Nested4B{}\n\t\t}\n\t\tvalue := &_Nested3B_4_list{list: &x.B4}\n\t\treturn protoreflect.ValueOfList(value)\n\tcase \"testpb.Nested3B.id\":\n\t\tpanic(fmt.Errorf(\"field id of message testpb.Nested3B is not mutable\"))\n\tcase \"testpb.Nested3B.age\":\n\t\tpanic(fmt.Errorf(\"field age of message testpb.Nested3B is not mutable\"))\n\tcase \"testpb.Nested3B.name\":\n\t\tpanic(fmt.Errorf(\"field name of message testpb.Nested3B is not mutable\"))\n\tdefault:\n\t\tif fd.IsExtension() {\n\t\t\tpanic(fmt.Errorf(\"proto3 declared messages do not support extensions: testpb.Nested3B\"))\n\t\t}\n\t\tpanic(fmt.Errorf(\"message testpb.Nested3B does not contain field %s\", fd.FullName()))\n\t}\n}", "title": "" }, { "docid": "f9716add5f6d25505ad6892332cd3292", "score": "0.4959597", "text": "func (x *fastReflection_Nested2A) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value {\n\tswitch fd.FullName() {\n\tcase \"testpb.Nested2A.nested\":\n\t\tif x.Nested == nil {\n\t\t\tx.Nested = new(Nested3A)\n\t\t}\n\t\treturn protoreflect.ValueOfMessage(x.Nested.ProtoReflect())\n\tcase \"testpb.Nested2A.id\":\n\t\tpanic(fmt.Errorf(\"field id of message testpb.Nested2A is not mutable\"))\n\tcase \"testpb.Nested2A.name\":\n\t\tpanic(fmt.Errorf(\"field name of message testpb.Nested2A is not mutable\"))\n\tdefault:\n\t\tif fd.IsExtension() {\n\t\t\tpanic(fmt.Errorf(\"proto3 declared messages do not support extensions: testpb.Nested2A\"))\n\t\t}\n\t\tpanic(fmt.Errorf(\"message testpb.Nested2A does not contain field %s\", fd.FullName()))\n\t}\n}", "title": "" }, { "docid": "d36ae35c02e9dba364b10723dabae695", "score": "0.4952413", "text": "func (x *fastReflection_MsgCreateGroup) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value {\n\tswitch fd.FullName() {\n\tcase \"cosmos.group.v1beta1.MsgCreateGroup.members\":\n\t\tif x.Members == nil {\n\t\t\tx.Members = []*Member{}\n\t\t}\n\t\tvalue := &_MsgCreateGroup_2_list{list: &x.Members}\n\t\treturn protoreflect.ValueOfList(value)\n\tcase \"cosmos.group.v1beta1.MsgCreateGroup.admin\":\n\t\tpanic(fmt.Errorf(\"field admin of message cosmos.group.v1beta1.MsgCreateGroup is not mutable\"))\n\tcase \"cosmos.group.v1beta1.MsgCreateGroup.metadata\":\n\t\tpanic(fmt.Errorf(\"field metadata of message cosmos.group.v1beta1.MsgCreateGroup is not mutable\"))\n\tdefault:\n\t\tif fd.IsExtension() {\n\t\t\tpanic(fmt.Errorf(\"proto3 declared messages do not support extensions: cosmos.group.v1beta1.MsgCreateGroup\"))\n\t\t}\n\t\tpanic(fmt.Errorf(\"message cosmos.group.v1beta1.MsgCreateGroup does not contain field %s\", fd.FullName()))\n\t}\n}", "title": "" }, { "docid": "c90f9e8d2de84048a73cba6588fbd8cc", "score": "0.4938322", "text": "func (x *fastReflection_TestVersion4LoneNesting_Inner1) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value {\n\tswitch fd.FullName() {\n\tcase \"testpb.TestVersion4LoneNesting.Inner1.inner\":\n\t\tif x.Inner == nil {\n\t\t\tx.Inner = new(TestVersion4LoneNesting_Inner1_InnerInner)\n\t\t}\n\t\treturn protoreflect.ValueOfMessage(x.Inner.ProtoReflect())\n\tcase \"testpb.TestVersion4LoneNesting.Inner1.id\":\n\t\tpanic(fmt.Errorf(\"field id of message testpb.TestVersion4LoneNesting.Inner1 is not mutable\"))\n\tcase \"testpb.TestVersion4LoneNesting.Inner1.name\":\n\t\tpanic(fmt.Errorf(\"field name of message testpb.TestVersion4LoneNesting.Inner1 is not mutable\"))\n\tdefault:\n\t\tif fd.IsExtension() {\n\t\t\tpanic(fmt.Errorf(\"proto3 declared messages do not support extensions: testpb.TestVersion4LoneNesting.Inner1\"))\n\t\t}\n\t\tpanic(fmt.Errorf(\"message testpb.TestVersion4LoneNesting.Inner1 does not contain field %s\", fd.FullName()))\n\t}\n}", "title": "" }, { "docid": "0107061886df22f9daa7ff363dff37b1", "score": "0.49175867", "text": "func (x *fastReflection_Nested2B) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value {\n\tswitch fd.FullName() {\n\tcase \"testpb.Nested2B.nested\":\n\t\tif x.Nested == nil {\n\t\t\tx.Nested = new(Nested3B)\n\t\t}\n\t\treturn protoreflect.ValueOfMessage(x.Nested.ProtoReflect())\n\tcase \"testpb.Nested2B.id\":\n\t\tpanic(fmt.Errorf(\"field id of message testpb.Nested2B is not mutable\"))\n\tcase \"testpb.Nested2B.fee\":\n\t\tpanic(fmt.Errorf(\"field fee of message testpb.Nested2B is not mutable\"))\n\tcase \"testpb.Nested2B.route\":\n\t\tpanic(fmt.Errorf(\"field route of message testpb.Nested2B is not mutable\"))\n\tdefault:\n\t\tif fd.IsExtension() {\n\t\t\tpanic(fmt.Errorf(\"proto3 declared messages do not support extensions: testpb.Nested2B\"))\n\t\t}\n\t\tpanic(fmt.Errorf(\"message testpb.Nested2B does not contain field %s\", fd.FullName()))\n\t}\n}", "title": "" }, { "docid": "cf68ca7ccb05c050d5b4b1321614d52b", "score": "0.4910833", "text": "func (x *fastReflection_TestVersionFD1) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value {\n\tswitch fd.FullName() {\n\tcase \"testpb.TestVersionFD1.a\":\n\t\tif x.A == nil {\n\t\t\tx.A = new(TestVersion1)\n\t\t}\n\t\treturn protoreflect.ValueOfMessage(x.A.ProtoReflect())\n\tcase \"testpb.TestVersionFD1.f\":\n\t\tif x.Sum == nil {\n\t\t\tvalue := &TestVersion1{}\n\t\t\toneofValue := &TestVersionFD1_F{F: value}\n\t\t\tx.Sum = oneofValue\n\t\t\treturn protoreflect.ValueOfMessage(value.ProtoReflect())\n\t\t}\n\t\tswitch m := x.Sum.(type) {\n\t\tcase *TestVersionFD1_F:\n\t\t\treturn protoreflect.ValueOfMessage(m.F.ProtoReflect())\n\t\tdefault:\n\t\t\tvalue := &TestVersion1{}\n\t\t\toneofValue := &TestVersionFD1_F{F: value}\n\t\t\tx.Sum = oneofValue\n\t\t\treturn protoreflect.ValueOfMessage(value.ProtoReflect())\n\t\t}\n\tcase \"testpb.TestVersionFD1.g\":\n\t\tif x.G == nil {\n\t\t\tx.G = new(anypb.Any)\n\t\t}\n\t\treturn protoreflect.ValueOfMessage(x.G.ProtoReflect())\n\tcase \"testpb.TestVersionFD1.h\":\n\t\tif x.H == nil {\n\t\t\tx.H = []*TestVersion1{}\n\t\t}\n\t\tvalue := &_TestVersionFD1_9_list{list: &x.H}\n\t\treturn protoreflect.ValueOfList(value)\n\tcase \"testpb.TestVersionFD1.x\":\n\t\tpanic(fmt.Errorf(\"field x of message testpb.TestVersionFD1 is not mutable\"))\n\tcase \"testpb.TestVersionFD1.e\":\n\t\tpanic(fmt.Errorf(\"field e of message testpb.TestVersionFD1 is not mutable\"))\n\tdefault:\n\t\tif fd.IsExtension() {\n\t\t\tpanic(fmt.Errorf(\"proto3 declared messages do not support extensions: testpb.TestVersionFD1\"))\n\t\t}\n\t\tpanic(fmt.Errorf(\"message testpb.TestVersionFD1 does not contain field %s\", fd.FullName()))\n\t}\n}", "title": "" }, { "docid": "6c9feee890b5c428bf712a0f6f0e5f0b", "score": "0.4890918", "text": "func (x *fastReflection_EventMintBatchCredits) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value {\n\tswitch fd.FullName() {\n\tcase \"regen.ecocredit.v1.EventMintBatchCredits.origin_tx\":\n\t\tif x.OriginTx == nil {\n\t\t\tx.OriginTx = new(OriginTx)\n\t\t}\n\t\treturn protoreflect.ValueOfMessage(x.OriginTx.ProtoReflect())\n\tcase \"regen.ecocredit.v1.EventMintBatchCredits.batch_denom\":\n\t\tpanic(fmt.Errorf(\"field batch_denom of message regen.ecocredit.v1.EventMintBatchCredits is not mutable\"))\n\tdefault:\n\t\tif fd.IsExtension() {\n\t\t\tpanic(fmt.Errorf(\"proto3 declared messages do not support extensions: regen.ecocredit.v1.EventMintBatchCredits\"))\n\t\t}\n\t\tpanic(fmt.Errorf(\"message regen.ecocredit.v1.EventMintBatchCredits does not contain field %s\", fd.FullName()))\n\t}\n}", "title": "" }, { "docid": "a19c6d3d677176431e1da24bcb441606", "score": "0.48902732", "text": "func (x *fastReflection_TestVersion3) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value {\n\tswitch fd.FullName() {\n\tcase \"testpb.TestVersion3.a\":\n\t\tif x.A == nil {\n\t\t\tx.A = new(TestVersion3)\n\t\t}\n\t\treturn protoreflect.ValueOfMessage(x.A.ProtoReflect())\n\tcase \"testpb.TestVersion3.b\":\n\t\tif x.B == nil {\n\t\t\tx.B = new(TestVersion3)\n\t\t}\n\t\treturn protoreflect.ValueOfMessage(x.B.ProtoReflect())\n\tcase \"testpb.TestVersion3.c\":\n\t\tif x.C == nil {\n\t\t\tx.C = []*TestVersion3{}\n\t\t}\n\t\tvalue := &_TestVersion3_4_list{list: &x.C}\n\t\treturn protoreflect.ValueOfList(value)\n\tcase \"testpb.TestVersion3.d\":\n\t\tif x.D == nil {\n\t\t\tx.D = []*TestVersion3{}\n\t\t}\n\t\tvalue := &_TestVersion3_5_list{list: &x.D}\n\t\treturn protoreflect.ValueOfList(value)\n\tcase \"testpb.TestVersion3.f\":\n\t\tif x.Sum == nil {\n\t\t\tvalue := &TestVersion3{}\n\t\t\toneofValue := &TestVersion3_F{F: value}\n\t\t\tx.Sum = oneofValue\n\t\t\treturn protoreflect.ValueOfMessage(value.ProtoReflect())\n\t\t}\n\t\tswitch m := x.Sum.(type) {\n\t\tcase *TestVersion3_F:\n\t\t\treturn protoreflect.ValueOfMessage(m.F.ProtoReflect())\n\t\tdefault:\n\t\t\tvalue := &TestVersion3{}\n\t\t\toneofValue := &TestVersion3_F{F: value}\n\t\t\tx.Sum = oneofValue\n\t\t\treturn protoreflect.ValueOfMessage(value.ProtoReflect())\n\t\t}\n\tcase \"testpb.TestVersion3.g\":\n\t\tif x.G == nil {\n\t\t\tx.G = new(anypb.Any)\n\t\t}\n\t\treturn protoreflect.ValueOfMessage(x.G.ProtoReflect())\n\tcase \"testpb.TestVersion3.h\":\n\t\tif x.H == nil {\n\t\t\tx.H = []*TestVersion1{}\n\t\t}\n\t\tvalue := &_TestVersion3_9_list{list: &x.H}\n\t\treturn protoreflect.ValueOfList(value)\n\tcase \"testpb.TestVersion3.k\":\n\t\tif x.K == nil {\n\t\t\tx.K = new(Customer1)\n\t\t}\n\t\treturn protoreflect.ValueOfMessage(x.K.ProtoReflect())\n\tcase \"testpb.TestVersion3.x\":\n\t\tpanic(fmt.Errorf(\"field x of message testpb.TestVersion3 is not mutable\"))\n\tcase \"testpb.TestVersion3.e\":\n\t\tpanic(fmt.Errorf(\"field e of message testpb.TestVersion3 is not mutable\"))\n\tcase \"testpb.TestVersion3.non_critical_field\":\n\t\tpanic(fmt.Errorf(\"field non_critical_field of message testpb.TestVersion3 is not mutable\"))\n\tdefault:\n\t\tif fd.IsExtension() {\n\t\t\tpanic(fmt.Errorf(\"proto3 declared messages do not support extensions: testpb.TestVersion3\"))\n\t\t}\n\t\tpanic(fmt.Errorf(\"message testpb.TestVersion3 does not contain field %s\", fd.FullName()))\n\t}\n}", "title": "" }, { "docid": "d02d26f3a001416b9c724f6873729991", "score": "0.48817348", "text": "func (x *fastReflection_TestVersion1) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value {\n\tswitch fd.FullName() {\n\tcase \"testpb.TestVersion1.a\":\n\t\tif x.A == nil {\n\t\t\tx.A = new(TestVersion1)\n\t\t}\n\t\treturn protoreflect.ValueOfMessage(x.A.ProtoReflect())\n\tcase \"testpb.TestVersion1.b\":\n\t\tif x.B == nil {\n\t\t\tx.B = new(TestVersion1)\n\t\t}\n\t\treturn protoreflect.ValueOfMessage(x.B.ProtoReflect())\n\tcase \"testpb.TestVersion1.c\":\n\t\tif x.C == nil {\n\t\t\tx.C = []*TestVersion1{}\n\t\t}\n\t\tvalue := &_TestVersion1_4_list{list: &x.C}\n\t\treturn protoreflect.ValueOfList(value)\n\tcase \"testpb.TestVersion1.d\":\n\t\tif x.D == nil {\n\t\t\tx.D = []*TestVersion1{}\n\t\t}\n\t\tvalue := &_TestVersion1_5_list{list: &x.D}\n\t\treturn protoreflect.ValueOfList(value)\n\tcase \"testpb.TestVersion1.f\":\n\t\tif x.Sum == nil {\n\t\t\tvalue := &TestVersion1{}\n\t\t\toneofValue := &TestVersion1_F{F: value}\n\t\t\tx.Sum = oneofValue\n\t\t\treturn protoreflect.ValueOfMessage(value.ProtoReflect())\n\t\t}\n\t\tswitch m := x.Sum.(type) {\n\t\tcase *TestVersion1_F:\n\t\t\treturn protoreflect.ValueOfMessage(m.F.ProtoReflect())\n\t\tdefault:\n\t\t\tvalue := &TestVersion1{}\n\t\t\toneofValue := &TestVersion1_F{F: value}\n\t\t\tx.Sum = oneofValue\n\t\t\treturn protoreflect.ValueOfMessage(value.ProtoReflect())\n\t\t}\n\tcase \"testpb.TestVersion1.g\":\n\t\tif x.G == nil {\n\t\t\tx.G = new(anypb.Any)\n\t\t}\n\t\treturn protoreflect.ValueOfMessage(x.G.ProtoReflect())\n\tcase \"testpb.TestVersion1.h\":\n\t\tif x.H == nil {\n\t\t\tx.H = []*TestVersion1{}\n\t\t}\n\t\tvalue := &_TestVersion1_9_list{list: &x.H}\n\t\treturn protoreflect.ValueOfList(value)\n\tcase \"testpb.TestVersion1.k\":\n\t\tif x.K == nil {\n\t\t\tx.K = new(Customer1)\n\t\t}\n\t\treturn protoreflect.ValueOfMessage(x.K.ProtoReflect())\n\tcase \"testpb.TestVersion1.x\":\n\t\tpanic(fmt.Errorf(\"field x of message testpb.TestVersion1 is not mutable\"))\n\tcase \"testpb.TestVersion1.e\":\n\t\tpanic(fmt.Errorf(\"field e of message testpb.TestVersion1 is not mutable\"))\n\tdefault:\n\t\tif fd.IsExtension() {\n\t\t\tpanic(fmt.Errorf(\"proto3 declared messages do not support extensions: testpb.TestVersion1\"))\n\t\t}\n\t\tpanic(fmt.Errorf(\"message testpb.TestVersion1 does not contain field %s\", fd.FullName()))\n\t}\n}", "title": "" }, { "docid": "3721ba7c4f0923ebd7b9af6849fce268", "score": "0.48725352", "text": "func (x *fastReflection_LastValidatorPower) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value {\n\tswitch fd.FullName() {\n\tcase \"cosmos.staking.v1beta1.LastValidatorPower.address\":\n\t\tpanic(fmt.Errorf(\"field address of message cosmos.staking.v1beta1.LastValidatorPower is not mutable\"))\n\tcase \"cosmos.staking.v1beta1.LastValidatorPower.power\":\n\t\tpanic(fmt.Errorf(\"field power of message cosmos.staking.v1beta1.LastValidatorPower is not mutable\"))\n\tdefault:\n\t\tif fd.IsExtension() {\n\t\t\tpanic(fmt.Errorf(\"proto3 declared messages do not support extensions: cosmos.staking.v1beta1.LastValidatorPower\"))\n\t\t}\n\t\tpanic(fmt.Errorf(\"message cosmos.staking.v1beta1.LastValidatorPower does not contain field %s\", fd.FullName()))\n\t}\n}", "title": "" }, { "docid": "f7ee001d2db31aac47a2dda9f37fbea9", "score": "0.48370442", "text": "func (x *fastReflection_TestRepeatedUints) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value {\n\tswitch fd.FullName() {\n\tcase \"testpb.TestRepeatedUints.nums\":\n\t\tif x.Nums == nil {\n\t\t\tx.Nums = []uint64{}\n\t\t}\n\t\tvalue := &_TestRepeatedUints_1_list{list: &x.Nums}\n\t\treturn protoreflect.ValueOfList(value)\n\tdefault:\n\t\tif fd.IsExtension() {\n\t\t\tpanic(fmt.Errorf(\"proto3 declared messages do not support extensions: testpb.TestRepeatedUints\"))\n\t\t}\n\t\tpanic(fmt.Errorf(\"message testpb.TestRepeatedUints does not contain field %s\", fd.FullName()))\n\t}\n}", "title": "" }, { "docid": "b173877cc2c243f6f22dc2cee15d8cbd", "score": "0.48181552", "text": "func (x *fastReflection_TestVersion2) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value {\n\tswitch fd.FullName() {\n\tcase \"testpb.TestVersion2.a\":\n\t\tif x.A == nil {\n\t\t\tx.A = new(TestVersion2)\n\t\t}\n\t\treturn protoreflect.ValueOfMessage(x.A.ProtoReflect())\n\tcase \"testpb.TestVersion2.b\":\n\t\tif x.B == nil {\n\t\t\tx.B = new(TestVersion2)\n\t\t}\n\t\treturn protoreflect.ValueOfMessage(x.B.ProtoReflect())\n\tcase \"testpb.TestVersion2.c\":\n\t\tif x.C == nil {\n\t\t\tx.C = []*TestVersion2{}\n\t\t}\n\t\tvalue := &_TestVersion2_4_list{list: &x.C}\n\t\treturn protoreflect.ValueOfList(value)\n\tcase \"testpb.TestVersion2.d\":\n\t\tif x.D == nil {\n\t\t\tx.D = []*TestVersion2{}\n\t\t}\n\t\tvalue := &_TestVersion2_5_list{list: &x.D}\n\t\treturn protoreflect.ValueOfList(value)\n\tcase \"testpb.TestVersion2.f\":\n\t\tif x.Sum == nil {\n\t\t\tvalue := &TestVersion2{}\n\t\t\toneofValue := &TestVersion2_F{F: value}\n\t\t\tx.Sum = oneofValue\n\t\t\treturn protoreflect.ValueOfMessage(value.ProtoReflect())\n\t\t}\n\t\tswitch m := x.Sum.(type) {\n\t\tcase *TestVersion2_F:\n\t\t\treturn protoreflect.ValueOfMessage(m.F.ProtoReflect())\n\t\tdefault:\n\t\t\tvalue := &TestVersion2{}\n\t\t\toneofValue := &TestVersion2_F{F: value}\n\t\t\tx.Sum = oneofValue\n\t\t\treturn protoreflect.ValueOfMessage(value.ProtoReflect())\n\t\t}\n\tcase \"testpb.TestVersion2.g\":\n\t\tif x.G == nil {\n\t\t\tx.G = new(anypb.Any)\n\t\t}\n\t\treturn protoreflect.ValueOfMessage(x.G.ProtoReflect())\n\tcase \"testpb.TestVersion2.h\":\n\t\tif x.H == nil {\n\t\t\tx.H = []*TestVersion1{}\n\t\t}\n\t\tvalue := &_TestVersion2_9_list{list: &x.H}\n\t\treturn protoreflect.ValueOfList(value)\n\tcase \"testpb.TestVersion2.k\":\n\t\tif x.K == nil {\n\t\t\tx.K = new(Customer1)\n\t\t}\n\t\treturn protoreflect.ValueOfMessage(x.K.ProtoReflect())\n\tcase \"testpb.TestVersion2.x\":\n\t\tpanic(fmt.Errorf(\"field x of message testpb.TestVersion2 is not mutable\"))\n\tcase \"testpb.TestVersion2.e\":\n\t\tpanic(fmt.Errorf(\"field e of message testpb.TestVersion2 is not mutable\"))\n\tcase \"testpb.TestVersion2.new_field\":\n\t\tpanic(fmt.Errorf(\"field new_field of message testpb.TestVersion2 is not mutable\"))\n\tdefault:\n\t\tif fd.IsExtension() {\n\t\t\tpanic(fmt.Errorf(\"proto3 declared messages do not support extensions: testpb.TestVersion2\"))\n\t\t}\n\t\tpanic(fmt.Errorf(\"message testpb.TestVersion2 does not contain field %s\", fd.FullName()))\n\t}\n}", "title": "" }, { "docid": "cddfd5ff520ac30475870cb92284f5cc", "score": "0.48125523", "text": "func (x *fastReflection_MsgSubmitTx) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value {\n\tswitch fd.FullName() {\n\tcase \"regen.intertx.v1.MsgSubmitTx.msg\":\n\t\tif x.Msg == nil {\n\t\t\tx.Msg = new(anypb.Any)\n\t\t}\n\t\treturn protoreflect.ValueOfMessage(x.Msg.ProtoReflect())\n\tcase \"regen.intertx.v1.MsgSubmitTx.owner\":\n\t\tpanic(fmt.Errorf(\"field owner of message regen.intertx.v1.MsgSubmitTx is not mutable\"))\n\tcase \"regen.intertx.v1.MsgSubmitTx.connection_id\":\n\t\tpanic(fmt.Errorf(\"field connection_id of message regen.intertx.v1.MsgSubmitTx is not mutable\"))\n\tdefault:\n\t\tif fd.IsExtension() {\n\t\t\tpanic(fmt.Errorf(\"proto3 declared messages do not support extensions: regen.intertx.v1.MsgSubmitTx\"))\n\t\t}\n\t\tpanic(fmt.Errorf(\"message regen.intertx.v1.MsgSubmitTx does not contain field %s\", fd.FullName()))\n\t}\n}", "title": "" }, { "docid": "d1740e6036c193aed12ef5dbcf0ecdf4", "score": "0.4799259", "text": "func (x *fastReflection_TestVersion3LoneNesting) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value {\n\tswitch fd.FullName() {\n\tcase \"testpb.TestVersion3LoneNesting.a\":\n\t\tif x.A == nil {\n\t\t\tx.A = new(TestVersion3)\n\t\t}\n\t\treturn protoreflect.ValueOfMessage(x.A.ProtoReflect())\n\tcase \"testpb.TestVersion3LoneNesting.b\":\n\t\tif x.B == nil {\n\t\t\tx.B = new(TestVersion3)\n\t\t}\n\t\treturn protoreflect.ValueOfMessage(x.B.ProtoReflect())\n\tcase \"testpb.TestVersion3LoneNesting.c\":\n\t\tif x.C == nil {\n\t\t\tx.C = []*TestVersion3{}\n\t\t}\n\t\tvalue := &_TestVersion3LoneNesting_4_list{list: &x.C}\n\t\treturn protoreflect.ValueOfList(value)\n\tcase \"testpb.TestVersion3LoneNesting.d\":\n\t\tif x.D == nil {\n\t\t\tx.D = []*TestVersion3{}\n\t\t}\n\t\tvalue := &_TestVersion3LoneNesting_5_list{list: &x.D}\n\t\treturn protoreflect.ValueOfList(value)\n\tcase \"testpb.TestVersion3LoneNesting.f\":\n\t\tif x.Sum == nil {\n\t\t\tvalue := &TestVersion3LoneNesting{}\n\t\t\toneofValue := &TestVersion3LoneNesting_F{F: value}\n\t\t\tx.Sum = oneofValue\n\t\t\treturn protoreflect.ValueOfMessage(value.ProtoReflect())\n\t\t}\n\t\tswitch m := x.Sum.(type) {\n\t\tcase *TestVersion3LoneNesting_F:\n\t\t\treturn protoreflect.ValueOfMessage(m.F.ProtoReflect())\n\t\tdefault:\n\t\t\tvalue := &TestVersion3LoneNesting{}\n\t\t\toneofValue := &TestVersion3LoneNesting_F{F: value}\n\t\t\tx.Sum = oneofValue\n\t\t\treturn protoreflect.ValueOfMessage(value.ProtoReflect())\n\t\t}\n\tcase \"testpb.TestVersion3LoneNesting.g\":\n\t\tif x.G == nil {\n\t\t\tx.G = new(anypb.Any)\n\t\t}\n\t\treturn protoreflect.ValueOfMessage(x.G.ProtoReflect())\n\tcase \"testpb.TestVersion3LoneNesting.h\":\n\t\tif x.H == nil {\n\t\t\tx.H = []*TestVersion1{}\n\t\t}\n\t\tvalue := &_TestVersion3LoneNesting_9_list{list: &x.H}\n\t\treturn protoreflect.ValueOfList(value)\n\tcase \"testpb.TestVersion3LoneNesting.k\":\n\t\tif x.K == nil {\n\t\t\tx.K = new(Customer1)\n\t\t}\n\t\treturn protoreflect.ValueOfMessage(x.K.ProtoReflect())\n\tcase \"testpb.TestVersion3LoneNesting.inner1\":\n\t\tif x.Inner1 == nil {\n\t\t\tx.Inner1 = new(TestVersion3LoneNesting_Inner1)\n\t\t}\n\t\treturn protoreflect.ValueOfMessage(x.Inner1.ProtoReflect())\n\tcase \"testpb.TestVersion3LoneNesting.inner2\":\n\t\tif x.Inner2 == nil {\n\t\t\tx.Inner2 = new(TestVersion3LoneNesting_Inner2)\n\t\t}\n\t\treturn protoreflect.ValueOfMessage(x.Inner2.ProtoReflect())\n\tcase \"testpb.TestVersion3LoneNesting.x\":\n\t\tpanic(fmt.Errorf(\"field x of message testpb.TestVersion3LoneNesting is not mutable\"))\n\tcase \"testpb.TestVersion3LoneNesting.non_critical_field\":\n\t\tpanic(fmt.Errorf(\"field non_critical_field of message testpb.TestVersion3LoneNesting is not mutable\"))\n\tdefault:\n\t\tif fd.IsExtension() {\n\t\t\tpanic(fmt.Errorf(\"proto3 declared messages do not support extensions: testpb.TestVersion3LoneNesting\"))\n\t\t}\n\t\tpanic(fmt.Errorf(\"message testpb.TestVersion3LoneNesting does not contain field %s\", fd.FullName()))\n\t}\n}", "title": "" }, { "docid": "1eb8806e1772cd56af6148f853a067d9", "score": "0.47920182", "text": "func (x *fastReflection_TestVersion3LoneNesting_Inner1_InnerInner) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value {\n\tswitch fd.FullName() {\n\tcase \"testpb.TestVersion3LoneNesting.Inner1.InnerInner.id\":\n\t\tpanic(fmt.Errorf(\"field id of message testpb.TestVersion3LoneNesting.Inner1.InnerInner is not mutable\"))\n\tcase \"testpb.TestVersion3LoneNesting.Inner1.InnerInner.city\":\n\t\tpanic(fmt.Errorf(\"field city of message testpb.TestVersion3LoneNesting.Inner1.InnerInner is not mutable\"))\n\tdefault:\n\t\tif fd.IsExtension() {\n\t\t\tpanic(fmt.Errorf(\"proto3 declared messages do not support extensions: testpb.TestVersion3LoneNesting.Inner1.InnerInner\"))\n\t\t}\n\t\tpanic(fmt.Errorf(\"message testpb.TestVersion3LoneNesting.Inner1.InnerInner does not contain field %s\", fd.FullName()))\n\t}\n}", "title": "" }, { "docid": "3bf3458e4abcd812e6716a3b4d10e2bb", "score": "0.47883034", "text": "func (x *fastReflection_Nested4A) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value {\n\tswitch fd.FullName() {\n\tcase \"testpb.Nested4A.id\":\n\t\tpanic(fmt.Errorf(\"field id of message testpb.Nested4A is not mutable\"))\n\tcase \"testpb.Nested4A.name\":\n\t\tpanic(fmt.Errorf(\"field name of message testpb.Nested4A is not mutable\"))\n\tdefault:\n\t\tif fd.IsExtension() {\n\t\t\tpanic(fmt.Errorf(\"proto3 declared messages do not support extensions: testpb.Nested4A\"))\n\t\t}\n\t\tpanic(fmt.Errorf(\"message testpb.Nested4A does not contain field %s\", fd.FullName()))\n\t}\n}", "title": "" }, { "docid": "71e295886159cc1451a25076750403fa", "score": "0.47643697", "text": "func (x *fastReflection_EventCancel) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value {\n\tswitch fd.FullName() {\n\tcase \"regen.ecocredit.v1.EventCancel.owner\":\n\t\tpanic(fmt.Errorf(\"field owner of message regen.ecocredit.v1.EventCancel is not mutable\"))\n\tcase \"regen.ecocredit.v1.EventCancel.batch_denom\":\n\t\tpanic(fmt.Errorf(\"field batch_denom of message regen.ecocredit.v1.EventCancel is not mutable\"))\n\tcase \"regen.ecocredit.v1.EventCancel.amount\":\n\t\tpanic(fmt.Errorf(\"field amount of message regen.ecocredit.v1.EventCancel is not mutable\"))\n\tcase \"regen.ecocredit.v1.EventCancel.reason\":\n\t\tpanic(fmt.Errorf(\"field reason of message regen.ecocredit.v1.EventCancel is not mutable\"))\n\tdefault:\n\t\tif fd.IsExtension() {\n\t\t\tpanic(fmt.Errorf(\"proto3 declared messages do not support extensions: regen.ecocredit.v1.EventCancel\"))\n\t\t}\n\t\tpanic(fmt.Errorf(\"message regen.ecocredit.v1.EventCancel does not contain field %s\", fd.FullName()))\n\t}\n}", "title": "" }, { "docid": "47f24295a273fc8ef3a6436e44497f9e", "score": "0.47616822", "text": "func (x *fastReflection_EventCreateClass) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value {\n\tswitch fd.FullName() {\n\tcase \"regen.ecocredit.v1.EventCreateClass.class_id\":\n\t\tpanic(fmt.Errorf(\"field class_id of message regen.ecocredit.v1.EventCreateClass is not mutable\"))\n\tdefault:\n\t\tif fd.IsExtension() {\n\t\t\tpanic(fmt.Errorf(\"proto3 declared messages do not support extensions: regen.ecocredit.v1.EventCreateClass\"))\n\t\t}\n\t\tpanic(fmt.Errorf(\"message regen.ecocredit.v1.EventCreateClass does not contain field %s\", fd.FullName()))\n\t}\n}", "title": "" }, { "docid": "4fb700a21c910d33897375df49664caa", "score": "0.47515205", "text": "func (x *fastReflection_MsgExecLegacyContent) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value {\n\tswitch fd.FullName() {\n\tcase \"cosmos.gov.v1.MsgExecLegacyContent.content\":\n\t\tif x.Content == nil {\n\t\t\tx.Content = new(anypb.Any)\n\t\t}\n\t\treturn protoreflect.ValueOfMessage(x.Content.ProtoReflect())\n\tcase \"cosmos.gov.v1.MsgExecLegacyContent.authority\":\n\t\tpanic(fmt.Errorf(\"field authority of message cosmos.gov.v1.MsgExecLegacyContent is not mutable\"))\n\tdefault:\n\t\tif fd.IsExtension() {\n\t\t\tpanic(fmt.Errorf(\"proto3 declared messages do not support extensions: cosmos.gov.v1.MsgExecLegacyContent\"))\n\t\t}\n\t\tpanic(fmt.Errorf(\"message cosmos.gov.v1.MsgExecLegacyContent does not contain field %s\", fd.FullName()))\n\t}\n}", "title": "" }, { "docid": "5235dfd76889a7107fe06f5e1e18833e", "score": "0.47500992", "text": "func (x *fastReflection_TestVersion4LoneNesting_Inner1_InnerInner) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value {\n\tswitch fd.FullName() {\n\tcase \"testpb.TestVersion4LoneNesting.Inner1.InnerInner.id\":\n\t\tpanic(fmt.Errorf(\"field id of message testpb.TestVersion4LoneNesting.Inner1.InnerInner is not mutable\"))\n\tcase \"testpb.TestVersion4LoneNesting.Inner1.InnerInner.city\":\n\t\tpanic(fmt.Errorf(\"field city of message testpb.TestVersion4LoneNesting.Inner1.InnerInner is not mutable\"))\n\tdefault:\n\t\tif fd.IsExtension() {\n\t\t\tpanic(fmt.Errorf(\"proto3 declared messages do not support extensions: testpb.TestVersion4LoneNesting.Inner1.InnerInner\"))\n\t\t}\n\t\tpanic(fmt.Errorf(\"message testpb.TestVersion4LoneNesting.Inner1.InnerInner does not contain field %s\", fd.FullName()))\n\t}\n}", "title": "" }, { "docid": "6fa70f01a2940cab0f827dd21787adc2", "score": "0.47485584", "text": "func (x *fastReflection_Nested4B) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value {\n\tswitch fd.FullName() {\n\tcase \"testpb.Nested4B.id\":\n\t\tpanic(fmt.Errorf(\"field id of message testpb.Nested4B is not mutable\"))\n\tcase \"testpb.Nested4B.age\":\n\t\tpanic(fmt.Errorf(\"field age of message testpb.Nested4B is not mutable\"))\n\tcase \"testpb.Nested4B.name\":\n\t\tpanic(fmt.Errorf(\"field name of message testpb.Nested4B is not mutable\"))\n\tdefault:\n\t\tif fd.IsExtension() {\n\t\t\tpanic(fmt.Errorf(\"proto3 declared messages do not support extensions: testpb.Nested4B\"))\n\t\t}\n\t\tpanic(fmt.Errorf(\"message testpb.Nested4B does not contain field %s\", fd.FullName()))\n\t}\n}", "title": "" }, { "docid": "dc2f657aa0380687c3c84f25a0077111", "score": "0.47408038", "text": "func (x *fastReflection_MsgRegisterAccount) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value {\n\tswitch fd.FullName() {\n\tcase \"regen.intertx.v1.MsgRegisterAccount.owner\":\n\t\tpanic(fmt.Errorf(\"field owner of message regen.intertx.v1.MsgRegisterAccount is not mutable\"))\n\tcase \"regen.intertx.v1.MsgRegisterAccount.connection_id\":\n\t\tpanic(fmt.Errorf(\"field connection_id of message regen.intertx.v1.MsgRegisterAccount is not mutable\"))\n\tcase \"regen.intertx.v1.MsgRegisterAccount.version\":\n\t\tpanic(fmt.Errorf(\"field version of message regen.intertx.v1.MsgRegisterAccount is not mutable\"))\n\tdefault:\n\t\tif fd.IsExtension() {\n\t\t\tpanic(fmt.Errorf(\"proto3 declared messages do not support extensions: regen.intertx.v1.MsgRegisterAccount\"))\n\t\t}\n\t\tpanic(fmt.Errorf(\"message regen.intertx.v1.MsgRegisterAccount does not contain field %s\", fd.FullName()))\n\t}\n}", "title": "" }, { "docid": "21ce3e9d61434855ef4e53acdcf10b31", "score": "0.473659", "text": "func (x *fastReflection_EventUpdateBatchMetadata) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value {\n\tswitch fd.FullName() {\n\tcase \"regen.ecocredit.v1.EventUpdateBatchMetadata.batch_denom\":\n\t\tpanic(fmt.Errorf(\"field batch_denom of message regen.ecocredit.v1.EventUpdateBatchMetadata is not mutable\"))\n\tdefault:\n\t\tif fd.IsExtension() {\n\t\t\tpanic(fmt.Errorf(\"proto3 declared messages do not support extensions: regen.ecocredit.v1.EventUpdateBatchMetadata\"))\n\t\t}\n\t\tpanic(fmt.Errorf(\"message regen.ecocredit.v1.EventUpdateBatchMetadata does not contain field %s\", fd.FullName()))\n\t}\n}", "title": "" }, { "docid": "54bf213588c8abd91a890efe02260f5c", "score": "0.47328672", "text": "func (x *fastReflection_TestVersion3LoneNesting_Inner2) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value {\n\tswitch fd.FullName() {\n\tcase \"testpb.TestVersion3LoneNesting.Inner2.inner\":\n\t\tif x.Inner == nil {\n\t\t\tx.Inner = new(TestVersion3LoneNesting_Inner2_InnerInner)\n\t\t}\n\t\treturn protoreflect.ValueOfMessage(x.Inner.ProtoReflect())\n\tcase \"testpb.TestVersion3LoneNesting.Inner2.id\":\n\t\tpanic(fmt.Errorf(\"field id of message testpb.TestVersion3LoneNesting.Inner2 is not mutable\"))\n\tcase \"testpb.TestVersion3LoneNesting.Inner2.country\":\n\t\tpanic(fmt.Errorf(\"field country of message testpb.TestVersion3LoneNesting.Inner2 is not mutable\"))\n\tdefault:\n\t\tif fd.IsExtension() {\n\t\t\tpanic(fmt.Errorf(\"proto3 declared messages do not support extensions: testpb.TestVersion3LoneNesting.Inner2\"))\n\t\t}\n\t\tpanic(fmt.Errorf(\"message testpb.TestVersion3LoneNesting.Inner2 does not contain field %s\", fd.FullName()))\n\t}\n}", "title": "" }, { "docid": "325b69f37764c4d872ed70ef4cb567e4", "score": "0.4712066", "text": "func MakeMutable(v reflect.Value) reflect.Value {\n\tif v.CanInterface() {\n\t\treturn v\n\t}\n\n\tif flagsErr != nil {\n\t\t// CODE COVERAGE: This branch is never executed unless the internals of\n\t\t// the reflect package have changed in some incompatible way.\n\t\tpanic(fmt.Errorf(\"cannot make value %v mutable: %w\", v, flagsErr))\n\t}\n\n\tf := flags(&v)\n\t*f &^= flagRO // clear the read-only flag\n\n\treturn v\n}", "title": "" }, { "docid": "940cedbebcf76e8e4445a74f8f7c15a6", "score": "0.47094816", "text": "func (x *fastReflection_TestVersion4LoneNesting_Inner2) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value {\n\tswitch fd.FullName() {\n\tcase \"testpb.TestVersion4LoneNesting.Inner2.inner\":\n\t\tif x.Inner == nil {\n\t\t\tx.Inner = new(TestVersion4LoneNesting_Inner2_InnerInner)\n\t\t}\n\t\treturn protoreflect.ValueOfMessage(x.Inner.ProtoReflect())\n\tcase \"testpb.TestVersion4LoneNesting.Inner2.id\":\n\t\tpanic(fmt.Errorf(\"field id of message testpb.TestVersion4LoneNesting.Inner2 is not mutable\"))\n\tcase \"testpb.TestVersion4LoneNesting.Inner2.country\":\n\t\tpanic(fmt.Errorf(\"field country of message testpb.TestVersion4LoneNesting.Inner2 is not mutable\"))\n\tdefault:\n\t\tif fd.IsExtension() {\n\t\t\tpanic(fmt.Errorf(\"proto3 declared messages do not support extensions: testpb.TestVersion4LoneNesting.Inner2\"))\n\t\t}\n\t\tpanic(fmt.Errorf(\"message testpb.TestVersion4LoneNesting.Inner2 does not contain field %s\", fd.FullName()))\n\t}\n}", "title": "" }, { "docid": "ae7644f6993ca0033401e0b683a2fcdf", "score": "0.4700656", "text": "func (x *fastReflection_MsgSubmitProposal) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value {\n\tswitch fd.FullName() {\n\tcase \"cosmos.gov.v1.MsgSubmitProposal.messages\":\n\t\tif x.Messages == nil {\n\t\t\tx.Messages = []*anypb.Any{}\n\t\t}\n\t\tvalue := &_MsgSubmitProposal_1_list{list: &x.Messages}\n\t\treturn protoreflect.ValueOfList(value)\n\tcase \"cosmos.gov.v1.MsgSubmitProposal.initial_deposit\":\n\t\tif x.InitialDeposit == nil {\n\t\t\tx.InitialDeposit = []*v1beta1.Coin{}\n\t\t}\n\t\tvalue := &_MsgSubmitProposal_2_list{list: &x.InitialDeposit}\n\t\treturn protoreflect.ValueOfList(value)\n\tcase \"cosmos.gov.v1.MsgSubmitProposal.proposer\":\n\t\tpanic(fmt.Errorf(\"field proposer of message cosmos.gov.v1.MsgSubmitProposal is not mutable\"))\n\tcase \"cosmos.gov.v1.MsgSubmitProposal.metadata\":\n\t\tpanic(fmt.Errorf(\"field metadata of message cosmos.gov.v1.MsgSubmitProposal is not mutable\"))\n\tcase \"cosmos.gov.v1.MsgSubmitProposal.title\":\n\t\tpanic(fmt.Errorf(\"field title of message cosmos.gov.v1.MsgSubmitProposal is not mutable\"))\n\tcase \"cosmos.gov.v1.MsgSubmitProposal.summary\":\n\t\tpanic(fmt.Errorf(\"field summary of message cosmos.gov.v1.MsgSubmitProposal is not mutable\"))\n\tcase \"cosmos.gov.v1.MsgSubmitProposal.expedited\":\n\t\tpanic(fmt.Errorf(\"field expedited of message cosmos.gov.v1.MsgSubmitProposal is not mutable\"))\n\tdefault:\n\t\tif fd.IsExtension() {\n\t\t\tpanic(fmt.Errorf(\"proto3 declared messages do not support extensions: cosmos.gov.v1.MsgSubmitProposal\"))\n\t\t}\n\t\tpanic(fmt.Errorf(\"message cosmos.gov.v1.MsgSubmitProposal does not contain field %s\", fd.FullName()))\n\t}\n}", "title": "" }, { "docid": "8f8b41952bcea242da6883467872a597", "score": "0.46938547", "text": "func (x *fastReflection_ConvertHashToIRIRequest) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value {\n\tswitch fd.FullName() {\n\tcase \"regen.data.v1.ConvertHashToIRIRequest.content_hash\":\n\t\tif x.ContentHash == nil {\n\t\t\tx.ContentHash = new(ContentHash)\n\t\t}\n\t\treturn protoreflect.ValueOfMessage(x.ContentHash.ProtoReflect())\n\tdefault:\n\t\tif fd.IsExtension() {\n\t\t\tpanic(fmt.Errorf(\"proto3 declared messages do not support extensions: regen.data.v1.ConvertHashToIRIRequest\"))\n\t\t}\n\t\tpanic(fmt.Errorf(\"message regen.data.v1.ConvertHashToIRIRequest does not contain field %s\", fd.FullName()))\n\t}\n}", "title": "" }, { "docid": "e95855cd6d19d09d44cf65ee874a9249", "score": "0.46878338", "text": "func (*SmallStruct) MojomType() mojom_types.UserDefinedType {\n\treturn SmallStructMojomType()\n}", "title": "" }, { "docid": "4e2913d1cb6fbab64043a9afbedc18dd", "score": "0.46723968", "text": "func (x *fastReflection_AnchorInfo) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value {\n\tswitch fd.FullName() {\n\tcase \"regen.data.v1.AnchorInfo.content_hash\":\n\t\tif x.ContentHash == nil {\n\t\t\tx.ContentHash = new(ContentHash)\n\t\t}\n\t\treturn protoreflect.ValueOfMessage(x.ContentHash.ProtoReflect())\n\tcase \"regen.data.v1.AnchorInfo.timestamp\":\n\t\tif x.Timestamp == nil {\n\t\t\tx.Timestamp = new(timestamppb.Timestamp)\n\t\t}\n\t\treturn protoreflect.ValueOfMessage(x.Timestamp.ProtoReflect())\n\tcase \"regen.data.v1.AnchorInfo.iri\":\n\t\tpanic(fmt.Errorf(\"field iri of message regen.data.v1.AnchorInfo is not mutable\"))\n\tdefault:\n\t\tif fd.IsExtension() {\n\t\t\tpanic(fmt.Errorf(\"proto3 declared messages do not support extensions: regen.data.v1.AnchorInfo\"))\n\t\t}\n\t\tpanic(fmt.Errorf(\"message regen.data.v1.AnchorInfo does not contain field %s\", fd.FullName()))\n\t}\n}", "title": "" }, { "docid": "530c1345ccb527bf0bcd0f097e2f6102", "score": "0.46700597", "text": "func (x *fastReflection_MsgCreateGroupResponse) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value {\n\tswitch fd.FullName() {\n\tcase \"cosmos.group.v1beta1.MsgCreateGroupResponse.group_id\":\n\t\tpanic(fmt.Errorf(\"field group_id of message cosmos.group.v1beta1.MsgCreateGroupResponse is not mutable\"))\n\tdefault:\n\t\tif fd.IsExtension() {\n\t\t\tpanic(fmt.Errorf(\"proto3 declared messages do not support extensions: cosmos.group.v1beta1.MsgCreateGroupResponse\"))\n\t\t}\n\t\tpanic(fmt.Errorf(\"message cosmos.group.v1beta1.MsgCreateGroupResponse does not contain field %s\", fd.FullName()))\n\t}\n}", "title": "" }, { "docid": "35b3c418c713e072ebeb579c1f4662bc", "score": "0.46629578", "text": "func (x *fastReflection_MsgDeposit) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value {\n\tswitch fd.FullName() {\n\tcase \"cosmos.gov.v1.MsgDeposit.amount\":\n\t\tif x.Amount == nil {\n\t\t\tx.Amount = []*v1beta1.Coin{}\n\t\t}\n\t\tvalue := &_MsgDeposit_3_list{list: &x.Amount}\n\t\treturn protoreflect.ValueOfList(value)\n\tcase \"cosmos.gov.v1.MsgDeposit.proposal_id\":\n\t\tpanic(fmt.Errorf(\"field proposal_id of message cosmos.gov.v1.MsgDeposit is not mutable\"))\n\tcase \"cosmos.gov.v1.MsgDeposit.depositor\":\n\t\tpanic(fmt.Errorf(\"field depositor of message cosmos.gov.v1.MsgDeposit is not mutable\"))\n\tdefault:\n\t\tif fd.IsExtension() {\n\t\t\tpanic(fmt.Errorf(\"proto3 declared messages do not support extensions: cosmos.gov.v1.MsgDeposit\"))\n\t\t}\n\t\tpanic(fmt.Errorf(\"message cosmos.gov.v1.MsgDeposit does not contain field %s\", fd.FullName()))\n\t}\n}", "title": "" }, { "docid": "fef7f338030766d71abeac4b1d140ef9", "score": "0.4636142", "text": "func (x *fastReflection_TestVersion3LoneOneOfValue) Clear(fd protoreflect.FieldDescriptor) {\n\tswitch fd.FullName() {\n\tcase \"testpb.TestVersion3LoneOneOfValue.x\":\n\t\tx.X = int64(0)\n\tcase \"testpb.TestVersion3LoneOneOfValue.a\":\n\t\tx.A = nil\n\tcase \"testpb.TestVersion3LoneOneOfValue.b\":\n\t\tx.B = nil\n\tcase \"testpb.TestVersion3LoneOneOfValue.c\":\n\t\tx.C = nil\n\tcase \"testpb.TestVersion3LoneOneOfValue.d\":\n\t\tx.D = nil\n\tcase \"testpb.TestVersion3LoneOneOfValue.e\":\n\t\tx.Sum = nil\n\tcase \"testpb.TestVersion3LoneOneOfValue.g\":\n\t\tx.G = nil\n\tcase \"testpb.TestVersion3LoneOneOfValue.h\":\n\t\tx.H = nil\n\tcase \"testpb.TestVersion3LoneOneOfValue.k\":\n\t\tx.K = nil\n\tcase \"testpb.TestVersion3LoneOneOfValue.non_critical_field\":\n\t\tx.NonCriticalField = \"\"\n\tdefault:\n\t\tif fd.IsExtension() {\n\t\t\tpanic(fmt.Errorf(\"proto3 declared messages do not support extensions: testpb.TestVersion3LoneOneOfValue\"))\n\t\t}\n\t\tpanic(fmt.Errorf(\"message testpb.TestVersion3LoneOneOfValue does not contain field %s\", fd.FullName()))\n\t}\n}", "title": "" }, { "docid": "d642aaba147418fb48885b44517ab56f", "score": "0.4631355", "text": "func (x *fastReflection_EventCreateProject) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value {\n\tswitch fd.FullName() {\n\tcase \"regen.ecocredit.v1.EventCreateProject.project_id\":\n\t\tpanic(fmt.Errorf(\"field project_id of message regen.ecocredit.v1.EventCreateProject is not mutable\"))\n\tdefault:\n\t\tif fd.IsExtension() {\n\t\t\tpanic(fmt.Errorf(\"proto3 declared messages do not support extensions: regen.ecocredit.v1.EventCreateProject\"))\n\t\t}\n\t\tpanic(fmt.Errorf(\"message regen.ecocredit.v1.EventCreateProject does not contain field %s\", fd.FullName()))\n\t}\n}", "title": "" }, { "docid": "1e01bc96aab447ec268297853354e151", "score": "0.46269584", "text": "func (x *fastReflection_TestVersion4LoneNesting) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value {\n\tswitch fd.FullName() {\n\tcase \"testpb.TestVersion4LoneNesting.a\":\n\t\tif x.A == nil {\n\t\t\tx.A = new(TestVersion3)\n\t\t}\n\t\treturn protoreflect.ValueOfMessage(x.A.ProtoReflect())\n\tcase \"testpb.TestVersion4LoneNesting.b\":\n\t\tif x.B == nil {\n\t\t\tx.B = new(TestVersion3)\n\t\t}\n\t\treturn protoreflect.ValueOfMessage(x.B.ProtoReflect())\n\tcase \"testpb.TestVersion4LoneNesting.c\":\n\t\tif x.C == nil {\n\t\t\tx.C = []*TestVersion3{}\n\t\t}\n\t\tvalue := &_TestVersion4LoneNesting_4_list{list: &x.C}\n\t\treturn protoreflect.ValueOfList(value)\n\tcase \"testpb.TestVersion4LoneNesting.d\":\n\t\tif x.D == nil {\n\t\t\tx.D = []*TestVersion3{}\n\t\t}\n\t\tvalue := &_TestVersion4LoneNesting_5_list{list: &x.D}\n\t\treturn protoreflect.ValueOfList(value)\n\tcase \"testpb.TestVersion4LoneNesting.f\":\n\t\tif x.Sum == nil {\n\t\t\tvalue := &TestVersion3LoneNesting{}\n\t\t\toneofValue := &TestVersion4LoneNesting_F{F: value}\n\t\t\tx.Sum = oneofValue\n\t\t\treturn protoreflect.ValueOfMessage(value.ProtoReflect())\n\t\t}\n\t\tswitch m := x.Sum.(type) {\n\t\tcase *TestVersion4LoneNesting_F:\n\t\t\treturn protoreflect.ValueOfMessage(m.F.ProtoReflect())\n\t\tdefault:\n\t\t\tvalue := &TestVersion3LoneNesting{}\n\t\t\toneofValue := &TestVersion4LoneNesting_F{F: value}\n\t\t\tx.Sum = oneofValue\n\t\t\treturn protoreflect.ValueOfMessage(value.ProtoReflect())\n\t\t}\n\tcase \"testpb.TestVersion4LoneNesting.g\":\n\t\tif x.G == nil {\n\t\t\tx.G = new(anypb.Any)\n\t\t}\n\t\treturn protoreflect.ValueOfMessage(x.G.ProtoReflect())\n\tcase \"testpb.TestVersion4LoneNesting.h\":\n\t\tif x.H == nil {\n\t\t\tx.H = []*TestVersion1{}\n\t\t}\n\t\tvalue := &_TestVersion4LoneNesting_9_list{list: &x.H}\n\t\treturn protoreflect.ValueOfList(value)\n\tcase \"testpb.TestVersion4LoneNesting.k\":\n\t\tif x.K == nil {\n\t\t\tx.K = new(Customer1)\n\t\t}\n\t\treturn protoreflect.ValueOfMessage(x.K.ProtoReflect())\n\tcase \"testpb.TestVersion4LoneNesting.inner1\":\n\t\tif x.Inner1 == nil {\n\t\t\tx.Inner1 = new(TestVersion4LoneNesting_Inner1)\n\t\t}\n\t\treturn protoreflect.ValueOfMessage(x.Inner1.ProtoReflect())\n\tcase \"testpb.TestVersion4LoneNesting.inner2\":\n\t\tif x.Inner2 == nil {\n\t\t\tx.Inner2 = new(TestVersion4LoneNesting_Inner2)\n\t\t}\n\t\treturn protoreflect.ValueOfMessage(x.Inner2.ProtoReflect())\n\tcase \"testpb.TestVersion4LoneNesting.x\":\n\t\tpanic(fmt.Errorf(\"field x of message testpb.TestVersion4LoneNesting is not mutable\"))\n\tcase \"testpb.TestVersion4LoneNesting.non_critical_field\":\n\t\tpanic(fmt.Errorf(\"field non_critical_field of message testpb.TestVersion4LoneNesting is not mutable\"))\n\tdefault:\n\t\tif fd.IsExtension() {\n\t\t\tpanic(fmt.Errorf(\"proto3 declared messages do not support extensions: testpb.TestVersion4LoneNesting\"))\n\t\t}\n\t\tpanic(fmt.Errorf(\"message testpb.TestVersion4LoneNesting does not contain field %s\", fd.FullName()))\n\t}\n}", "title": "" }, { "docid": "3769e9be1e79ccba3e5c41165f09483e", "score": "0.4619259", "text": "func isMutableRefType(typ types.Type) bool {\n\tfor {\n\t\tswitch t := typ.(type) {\n\t\tcase *types.Array, *types.Slice, *types.Map, *types.Pointer, *types.Struct:\n\t\t\treturn true\n\n\t\tcase *types.Named:\n\t\t\ttyp = t.Underlying()\n\n\t\tdefault:\n\t\t\treturn false\n\n\t\t}\n\t}\n\treturn false\n}", "title": "" }, { "docid": "21f20cf5ca689f5d5758cfb40057bfb9", "score": "0.4598327", "text": "func (x *fastReflection_MsgCreateProposal) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value {\n\tswitch fd.FullName() {\n\tcase \"cosmos.group.v1beta1.MsgCreateProposal.proposers\":\n\t\tif x.Proposers == nil {\n\t\t\tx.Proposers = []string{}\n\t\t}\n\t\tvalue := &_MsgCreateProposal_2_list{list: &x.Proposers}\n\t\treturn protoreflect.ValueOfList(value)\n\tcase \"cosmos.group.v1beta1.MsgCreateProposal.msgs\":\n\t\tif x.Msgs == nil {\n\t\t\tx.Msgs = []*anypb.Any{}\n\t\t}\n\t\tvalue := &_MsgCreateProposal_4_list{list: &x.Msgs}\n\t\treturn protoreflect.ValueOfList(value)\n\tcase \"cosmos.group.v1beta1.MsgCreateProposal.address\":\n\t\tpanic(fmt.Errorf(\"field address of message cosmos.group.v1beta1.MsgCreateProposal is not mutable\"))\n\tcase \"cosmos.group.v1beta1.MsgCreateProposal.metadata\":\n\t\tpanic(fmt.Errorf(\"field metadata of message cosmos.group.v1beta1.MsgCreateProposal is not mutable\"))\n\tcase \"cosmos.group.v1beta1.MsgCreateProposal.exec\":\n\t\tpanic(fmt.Errorf(\"field exec of message cosmos.group.v1beta1.MsgCreateProposal is not mutable\"))\n\tdefault:\n\t\tif fd.IsExtension() {\n\t\t\tpanic(fmt.Errorf(\"proto3 declared messages do not support extensions: cosmos.group.v1beta1.MsgCreateProposal\"))\n\t\t}\n\t\tpanic(fmt.Errorf(\"message cosmos.group.v1beta1.MsgCreateProposal does not contain field %s\", fd.FullName()))\n\t}\n}", "title": "" }, { "docid": "f351aa41ebdc33fd5bc8ed7835610379", "score": "0.4596572", "text": "func (x *fastReflection_MsgSubmitProposalResponse) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value {\n\tswitch fd.FullName() {\n\tcase \"cosmos.gov.v1.MsgSubmitProposalResponse.proposal_id\":\n\t\tpanic(fmt.Errorf(\"field proposal_id of message cosmos.gov.v1.MsgSubmitProposalResponse is not mutable\"))\n\tdefault:\n\t\tif fd.IsExtension() {\n\t\t\tpanic(fmt.Errorf(\"proto3 declared messages do not support extensions: cosmos.gov.v1.MsgSubmitProposalResponse\"))\n\t\t}\n\t\tpanic(fmt.Errorf(\"message cosmos.gov.v1.MsgSubmitProposalResponse does not contain field %s\", fd.FullName()))\n\t}\n}", "title": "" }, { "docid": "19e56eeede6bcc66afe9b5da9c2e3d7a", "score": "0.4587016", "text": "func (x *fastReflection_MsgCreateGroupPolicy) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value {\n\tswitch fd.FullName() {\n\tcase \"cosmos.group.v1beta1.MsgCreateGroupPolicy.decision_policy\":\n\t\tif x.DecisionPolicy == nil {\n\t\t\tx.DecisionPolicy = new(anypb.Any)\n\t\t}\n\t\treturn protoreflect.ValueOfMessage(x.DecisionPolicy.ProtoReflect())\n\tcase \"cosmos.group.v1beta1.MsgCreateGroupPolicy.admin\":\n\t\tpanic(fmt.Errorf(\"field admin of message cosmos.group.v1beta1.MsgCreateGroupPolicy is not mutable\"))\n\tcase \"cosmos.group.v1beta1.MsgCreateGroupPolicy.group_id\":\n\t\tpanic(fmt.Errorf(\"field group_id of message cosmos.group.v1beta1.MsgCreateGroupPolicy is not mutable\"))\n\tcase \"cosmos.group.v1beta1.MsgCreateGroupPolicy.metadata\":\n\t\tpanic(fmt.Errorf(\"field metadata of message cosmos.group.v1beta1.MsgCreateGroupPolicy is not mutable\"))\n\tdefault:\n\t\tif fd.IsExtension() {\n\t\t\tpanic(fmt.Errorf(\"proto3 declared messages do not support extensions: cosmos.group.v1beta1.MsgCreateGroupPolicy\"))\n\t\t}\n\t\tpanic(fmt.Errorf(\"message cosmos.group.v1beta1.MsgCreateGroupPolicy does not contain field %s\", fd.FullName()))\n\t}\n}", "title": "" }, { "docid": "b90a849ce0ff73a21f679e5410490333", "score": "0.45466754", "text": "func (x *fastReflection_QueryInterchainAccountResponse) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value {\n\tswitch fd.FullName() {\n\tcase \"regen.intertx.v1.QueryInterchainAccountResponse.interchain_account_address\":\n\t\tpanic(fmt.Errorf(\"field interchain_account_address of message regen.intertx.v1.QueryInterchainAccountResponse is not mutable\"))\n\tdefault:\n\t\tif fd.IsExtension() {\n\t\t\tpanic(fmt.Errorf(\"proto3 declared messages do not support extensions: regen.intertx.v1.QueryInterchainAccountResponse\"))\n\t\t}\n\t\tpanic(fmt.Errorf(\"message regen.intertx.v1.QueryInterchainAccountResponse does not contain field %s\", fd.FullName()))\n\t}\n}", "title": "" }, { "docid": "62ad79c72f2f67873bd7f6c4b89cfa31", "score": "0.4544118", "text": "func (x *fastReflection_EventBridge) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value {\n\tswitch fd.FullName() {\n\tcase \"regen.ecocredit.v1.EventBridge.target\":\n\t\tpanic(fmt.Errorf(\"field target of message regen.ecocredit.v1.EventBridge is not mutable\"))\n\tcase \"regen.ecocredit.v1.EventBridge.recipient\":\n\t\tpanic(fmt.Errorf(\"field recipient of message regen.ecocredit.v1.EventBridge is not mutable\"))\n\tcase \"regen.ecocredit.v1.EventBridge.contract\":\n\t\tpanic(fmt.Errorf(\"field contract of message regen.ecocredit.v1.EventBridge is not mutable\"))\n\tcase \"regen.ecocredit.v1.EventBridge.amount\":\n\t\tpanic(fmt.Errorf(\"field amount of message regen.ecocredit.v1.EventBridge is not mutable\"))\n\tcase \"regen.ecocredit.v1.EventBridge.owner\":\n\t\tpanic(fmt.Errorf(\"field owner of message regen.ecocredit.v1.EventBridge is not mutable\"))\n\tcase \"regen.ecocredit.v1.EventBridge.batch_denom\":\n\t\tpanic(fmt.Errorf(\"field batch_denom of message regen.ecocredit.v1.EventBridge is not mutable\"))\n\tdefault:\n\t\tif fd.IsExtension() {\n\t\t\tpanic(fmt.Errorf(\"proto3 declared messages do not support extensions: regen.ecocredit.v1.EventBridge\"))\n\t\t}\n\t\tpanic(fmt.Errorf(\"message regen.ecocredit.v1.EventBridge does not contain field %s\", fd.FullName()))\n\t}\n}", "title": "" }, { "docid": "6ee2f3fbafdbcd539cfb1f6fc17ca7c0", "score": "0.4538412", "text": "func makeField(parentStruct reflect.Value, f reflect.StructField) {\n\tswitch f.Type.Kind() {\n\tcase reflect.Map:\n\t\tparentStruct.FieldByName(f.Name).Set(reflect.MakeMap(f.Type))\n\tcase reflect.Slice:\n\t\tparentStruct.FieldByName(f.Name).Set(reflect.MakeSlice(f.Type, 0, 0))\n\tcase reflect.Interface:\n\t\t// This is a union field type, which can only be created once its type\n\t\t// is known.\n\tdefault:\n\t\tparentStruct.FieldByName(f.Name).Set(reflect.New(f.Type.Elem()))\n\t}\n}", "title": "" }, { "docid": "c6865c623f5d7652e28eb616e896eb00", "score": "0.45349464", "text": "func (x *fastReflection_EventBridgeReceive) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value {\n\tswitch fd.FullName() {\n\tcase \"regen.ecocredit.v1.EventBridgeReceive.origin_tx\":\n\t\tif x.OriginTx == nil {\n\t\t\tx.OriginTx = new(OriginTx)\n\t\t}\n\t\treturn protoreflect.ValueOfMessage(x.OriginTx.ProtoReflect())\n\tcase \"regen.ecocredit.v1.EventBridgeReceive.project_id\":\n\t\tpanic(fmt.Errorf(\"field project_id of message regen.ecocredit.v1.EventBridgeReceive is not mutable\"))\n\tcase \"regen.ecocredit.v1.EventBridgeReceive.batch_denom\":\n\t\tpanic(fmt.Errorf(\"field batch_denom of message regen.ecocredit.v1.EventBridgeReceive is not mutable\"))\n\tcase \"regen.ecocredit.v1.EventBridgeReceive.amount\":\n\t\tpanic(fmt.Errorf(\"field amount of message regen.ecocredit.v1.EventBridgeReceive is not mutable\"))\n\tdefault:\n\t\tif fd.IsExtension() {\n\t\t\tpanic(fmt.Errorf(\"proto3 declared messages do not support extensions: regen.ecocredit.v1.EventBridgeReceive\"))\n\t\t}\n\t\tpanic(fmt.Errorf(\"message regen.ecocredit.v1.EventBridgeReceive does not contain field %s\", fd.FullName()))\n\t}\n}", "title": "" }, { "docid": "18a7efd4f4adbf55d0a34fb82cd650c3", "score": "0.4534668", "text": "func (desc *Mutable) ImmutableCopy() catalog.Descriptor {\n\timm := NewBuilder(desc.TypeDesc()).BuildImmutableType()\n\timm.(*immutable).isUncommittedVersion = desc.IsUncommittedVersion()\n\treturn imm\n}", "title": "" }, { "docid": "162bb57eb4fbfaa5f46b2c74c41c5c45", "score": "0.45136303", "text": "func (x *fastReflection_MsgCancelProposal) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value {\n\tswitch fd.FullName() {\n\tcase \"cosmos.gov.v1.MsgCancelProposal.proposal_id\":\n\t\tpanic(fmt.Errorf(\"field proposal_id of message cosmos.gov.v1.MsgCancelProposal is not mutable\"))\n\tcase \"cosmos.gov.v1.MsgCancelProposal.proposer\":\n\t\tpanic(fmt.Errorf(\"field proposer of message cosmos.gov.v1.MsgCancelProposal is not mutable\"))\n\tdefault:\n\t\tif fd.IsExtension() {\n\t\t\tpanic(fmt.Errorf(\"proto3 declared messages do not support extensions: cosmos.gov.v1.MsgCancelProposal\"))\n\t\t}\n\t\tpanic(fmt.Errorf(\"message cosmos.gov.v1.MsgCancelProposal does not contain field %s\", fd.FullName()))\n\t}\n}", "title": "" }, { "docid": "5ab73b645d70c1c3180392b88903d334", "score": "0.45096937", "text": "func (*SmallObjStruct) MojomType() mojom_types.UserDefinedType {\n\treturn SmallObjStructMojomType()\n}", "title": "" }, { "docid": "00141962108ce33fe55b29b106f6644f", "score": "0.45076576", "text": "func (x *fastReflection_MsgCreateProposalResponse) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value {\n\tswitch fd.FullName() {\n\tcase \"cosmos.group.v1beta1.MsgCreateProposalResponse.proposal_id\":\n\t\tpanic(fmt.Errorf(\"field proposal_id of message cosmos.group.v1beta1.MsgCreateProposalResponse is not mutable\"))\n\tdefault:\n\t\tif fd.IsExtension() {\n\t\t\tpanic(fmt.Errorf(\"proto3 declared messages do not support extensions: cosmos.group.v1beta1.MsgCreateProposalResponse\"))\n\t\t}\n\t\tpanic(fmt.Errorf(\"message cosmos.group.v1beta1.MsgCreateProposalResponse does not contain field %s\", fd.FullName()))\n\t}\n}", "title": "" }, { "docid": "257db73b1e6adf52697c76226eed1a64", "score": "0.4503107", "text": "func (x *fastReflection_ConvertHashToIRIResponse) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value {\n\tswitch fd.FullName() {\n\tcase \"regen.data.v1.ConvertHashToIRIResponse.iri\":\n\t\tpanic(fmt.Errorf(\"field iri of message regen.data.v1.ConvertHashToIRIResponse is not mutable\"))\n\tdefault:\n\t\tif fd.IsExtension() {\n\t\t\tpanic(fmt.Errorf(\"proto3 declared messages do not support extensions: regen.data.v1.ConvertHashToIRIResponse\"))\n\t\t}\n\t\tpanic(fmt.Errorf(\"message regen.data.v1.ConvertHashToIRIResponse does not contain field %s\", fd.FullName()))\n\t}\n}", "title": "" }, { "docid": "6261295186851fd7661aa5a0abac8fcc", "score": "0.44926292", "text": "func (x *fastReflection_EventMint) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value {\n\tswitch fd.FullName() {\n\tcase \"regen.ecocredit.v1.EventMint.batch_denom\":\n\t\tpanic(fmt.Errorf(\"field batch_denom of message regen.ecocredit.v1.EventMint is not mutable\"))\n\tcase \"regen.ecocredit.v1.EventMint.tradable_amount\":\n\t\tpanic(fmt.Errorf(\"field tradable_amount of message regen.ecocredit.v1.EventMint is not mutable\"))\n\tcase \"regen.ecocredit.v1.EventMint.retired_amount\":\n\t\tpanic(fmt.Errorf(\"field retired_amount of message regen.ecocredit.v1.EventMint is not mutable\"))\n\tdefault:\n\t\tif fd.IsExtension() {\n\t\t\tpanic(fmt.Errorf(\"proto3 declared messages do not support extensions: regen.ecocredit.v1.EventMint\"))\n\t\t}\n\t\tpanic(fmt.Errorf(\"message regen.ecocredit.v1.EventMint does not contain field %s\", fd.FullName()))\n\t}\n}", "title": "" }, { "docid": "5a0301a1bcf573fdce42f78667d1672f", "score": "0.44847673", "text": "func (x *fastReflection_QueryInterchainAccountRequest) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value {\n\tswitch fd.FullName() {\n\tcase \"regen.intertx.v1.QueryInterchainAccountRequest.owner\":\n\t\tpanic(fmt.Errorf(\"field owner of message regen.intertx.v1.QueryInterchainAccountRequest is not mutable\"))\n\tcase \"regen.intertx.v1.QueryInterchainAccountRequest.connection_id\":\n\t\tpanic(fmt.Errorf(\"field connection_id of message regen.intertx.v1.QueryInterchainAccountRequest is not mutable\"))\n\tdefault:\n\t\tif fd.IsExtension() {\n\t\t\tpanic(fmt.Errorf(\"proto3 declared messages do not support extensions: regen.intertx.v1.QueryInterchainAccountRequest\"))\n\t\t}\n\t\tpanic(fmt.Errorf(\"message regen.intertx.v1.QueryInterchainAccountRequest does not contain field %s\", fd.FullName()))\n\t}\n}", "title": "" }, { "docid": "6e1c34977271375053d843e3a7fec42b", "score": "0.44749567", "text": "func (x *fastReflection_MsgSubmitTxResponse) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value {\n\tswitch fd.FullName() {\n\tdefault:\n\t\tif fd.IsExtension() {\n\t\t\tpanic(fmt.Errorf(\"proto3 declared messages do not support extensions: regen.intertx.v1.MsgSubmitTxResponse\"))\n\t\t}\n\t\tpanic(fmt.Errorf(\"message regen.intertx.v1.MsgSubmitTxResponse does not contain field %s\", fd.FullName()))\n\t}\n}", "title": "" }, { "docid": "f3974fbe536d31708050b6be23b779fd", "score": "0.44744155", "text": "func (x *fastReflection_TestVersion3LoneNesting_Inner2_InnerInner) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value {\n\tswitch fd.FullName() {\n\tcase \"testpb.TestVersion3LoneNesting.Inner2.InnerInner.id\":\n\t\tpanic(fmt.Errorf(\"field id of message testpb.TestVersion3LoneNesting.Inner2.InnerInner is not mutable\"))\n\tcase \"testpb.TestVersion3LoneNesting.Inner2.InnerInner.city\":\n\t\tpanic(fmt.Errorf(\"field city of message testpb.TestVersion3LoneNesting.Inner2.InnerInner is not mutable\"))\n\tdefault:\n\t\tif fd.IsExtension() {\n\t\t\tpanic(fmt.Errorf(\"proto3 declared messages do not support extensions: testpb.TestVersion3LoneNesting.Inner2.InnerInner\"))\n\t\t}\n\t\tpanic(fmt.Errorf(\"message testpb.TestVersion3LoneNesting.Inner2.InnerInner does not contain field %s\", fd.FullName()))\n\t}\n}", "title": "" }, { "docid": "1c098600c20a36b25ddf9a39d9e9b9b0", "score": "0.4474348", "text": "func (x *fastReflection_MsgRegisterAccountResponse) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value {\n\tswitch fd.FullName() {\n\tdefault:\n\t\tif fd.IsExtension() {\n\t\t\tpanic(fmt.Errorf(\"proto3 declared messages do not support extensions: regen.intertx.v1.MsgRegisterAccountResponse\"))\n\t\t}\n\t\tpanic(fmt.Errorf(\"message regen.intertx.v1.MsgRegisterAccountResponse does not contain field %s\", fd.FullName()))\n\t}\n}", "title": "" }, { "docid": "e8d626f2ae8c186fb3caac415976bf53", "score": "0.44696012", "text": "func (x *fastReflection_MissedBlock) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value {\n\tswitch fd.FullName() {\n\tcase \"cosmos.slashing.v1beta1.MissedBlock.index\":\n\t\tpanic(fmt.Errorf(\"field index of message cosmos.slashing.v1beta1.MissedBlock is not mutable\"))\n\tcase \"cosmos.slashing.v1beta1.MissedBlock.missed\":\n\t\tpanic(fmt.Errorf(\"field missed of message cosmos.slashing.v1beta1.MissedBlock is not mutable\"))\n\tdefault:\n\t\tif fd.IsExtension() {\n\t\t\tpanic(fmt.Errorf(\"proto3 declared messages do not support extensions: cosmos.slashing.v1beta1.MissedBlock\"))\n\t\t}\n\t\tpanic(fmt.Errorf(\"message cosmos.slashing.v1beta1.MissedBlock does not contain field %s\", fd.FullName()))\n\t}\n}", "title": "" }, { "docid": "1b4c0aa4d5bc9328e38cde152c148be2", "score": "0.44648135", "text": "func (x *fastReflection_MsgCreateGroupPolicyResponse) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value {\n\tswitch fd.FullName() {\n\tcase \"cosmos.group.v1beta1.MsgCreateGroupPolicyResponse.address\":\n\t\tpanic(fmt.Errorf(\"field address of message cosmos.group.v1beta1.MsgCreateGroupPolicyResponse is not mutable\"))\n\tdefault:\n\t\tif fd.IsExtension() {\n\t\t\tpanic(fmt.Errorf(\"proto3 declared messages do not support extensions: cosmos.group.v1beta1.MsgCreateGroupPolicyResponse\"))\n\t\t}\n\t\tpanic(fmt.Errorf(\"message cosmos.group.v1beta1.MsgCreateGroupPolicyResponse does not contain field %s\", fd.FullName()))\n\t}\n}", "title": "" }, { "docid": "ff85c6c476acd4e073387207ad8e8a39", "score": "0.44633773", "text": "func (x *fastReflection_MsgCancelProposalResponse) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value {\n\tswitch fd.FullName() {\n\tcase \"cosmos.gov.v1.MsgCancelProposalResponse.canceled_time\":\n\t\tif x.CanceledTime == nil {\n\t\t\tx.CanceledTime = new(timestamppb.Timestamp)\n\t\t}\n\t\treturn protoreflect.ValueOfMessage(x.CanceledTime.ProtoReflect())\n\tcase \"cosmos.gov.v1.MsgCancelProposalResponse.proposal_id\":\n\t\tpanic(fmt.Errorf(\"field proposal_id of message cosmos.gov.v1.MsgCancelProposalResponse is not mutable\"))\n\tcase \"cosmos.gov.v1.MsgCancelProposalResponse.canceled_height\":\n\t\tpanic(fmt.Errorf(\"field canceled_height of message cosmos.gov.v1.MsgCancelProposalResponse is not mutable\"))\n\tdefault:\n\t\tif fd.IsExtension() {\n\t\t\tpanic(fmt.Errorf(\"proto3 declared messages do not support extensions: cosmos.gov.v1.MsgCancelProposalResponse\"))\n\t\t}\n\t\tpanic(fmt.Errorf(\"message cosmos.gov.v1.MsgCancelProposalResponse does not contain field %s\", fd.FullName()))\n\t}\n}", "title": "" }, { "docid": "87e44ce072b9201e72677f100b8c4878", "score": "0.4463342", "text": "func (x *fastReflection_TestVersion4LoneNesting_Inner2_InnerInner) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value {\n\tswitch fd.FullName() {\n\tcase \"testpb.TestVersion4LoneNesting.Inner2.InnerInner.id\":\n\t\tpanic(fmt.Errorf(\"field id of message testpb.TestVersion4LoneNesting.Inner2.InnerInner is not mutable\"))\n\tcase \"testpb.TestVersion4LoneNesting.Inner2.InnerInner.value\":\n\t\tpanic(fmt.Errorf(\"field value of message testpb.TestVersion4LoneNesting.Inner2.InnerInner is not mutable\"))\n\tdefault:\n\t\tif fd.IsExtension() {\n\t\t\tpanic(fmt.Errorf(\"proto3 declared messages do not support extensions: testpb.TestVersion4LoneNesting.Inner2.InnerInner\"))\n\t\t}\n\t\tpanic(fmt.Errorf(\"message testpb.TestVersion4LoneNesting.Inner2.InnerInner does not contain field %s\", fd.FullName()))\n\t}\n}", "title": "" }, { "docid": "df398c149010a12b7b2fe7fd2e625333", "score": "0.44589317", "text": "func EmbeddedMutableSet(obj MutableSet) MutableSet {\n return &mutableSetTrait{obj,\n obj,\n EmbeddedSet(obj),\n EmbeddedMutableSetFactory(obj)}\n}", "title": "" }, { "docid": "23f8513d6d724c66cdbd21b6385823f3", "score": "0.445701", "text": "func (x *fastReflection_QueryAnchorByHashRequest) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value {\n\tswitch fd.FullName() {\n\tcase \"regen.data.v1.QueryAnchorByHashRequest.content_hash\":\n\t\tif x.ContentHash == nil {\n\t\t\tx.ContentHash = new(ContentHash)\n\t\t}\n\t\treturn protoreflect.ValueOfMessage(x.ContentHash.ProtoReflect())\n\tdefault:\n\t\tif fd.IsExtension() {\n\t\t\tpanic(fmt.Errorf(\"proto3 declared messages do not support extensions: regen.data.v1.QueryAnchorByHashRequest\"))\n\t\t}\n\t\tpanic(fmt.Errorf(\"message regen.data.v1.QueryAnchorByHashRequest does not contain field %s\", fd.FullName()))\n\t}\n}", "title": "" }, { "docid": "6d0a6d0721dd7d293f711fce71cd308d", "score": "0.44530028", "text": "func (*TryNonNullStruct) MojomType() mojom_types.UserDefinedType {\n\treturn TryNonNullStructMojomType()\n}", "title": "" }, { "docid": "e1578a7198cb43f87d0e5db72b97cefd", "score": "0.44463253", "text": "func (x *fastReflection_EventRetire) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value {\n\tswitch fd.FullName() {\n\tcase \"regen.ecocredit.v1.EventRetire.owner\":\n\t\tpanic(fmt.Errorf(\"field owner of message regen.ecocredit.v1.EventRetire is not mutable\"))\n\tcase \"regen.ecocredit.v1.EventRetire.batch_denom\":\n\t\tpanic(fmt.Errorf(\"field batch_denom of message regen.ecocredit.v1.EventRetire is not mutable\"))\n\tcase \"regen.ecocredit.v1.EventRetire.amount\":\n\t\tpanic(fmt.Errorf(\"field amount of message regen.ecocredit.v1.EventRetire is not mutable\"))\n\tcase \"regen.ecocredit.v1.EventRetire.jurisdiction\":\n\t\tpanic(fmt.Errorf(\"field jurisdiction of message regen.ecocredit.v1.EventRetire is not mutable\"))\n\tcase \"regen.ecocredit.v1.EventRetire.reason\":\n\t\tpanic(fmt.Errorf(\"field reason of message regen.ecocredit.v1.EventRetire is not mutable\"))\n\tdefault:\n\t\tif fd.IsExtension() {\n\t\t\tpanic(fmt.Errorf(\"proto3 declared messages do not support extensions: regen.ecocredit.v1.EventRetire\"))\n\t\t}\n\t\tpanic(fmt.Errorf(\"message regen.ecocredit.v1.EventRetire does not contain field %s\", fd.FullName()))\n\t}\n}", "title": "" }, { "docid": "239fb940b6b238deebf975065306fac7", "score": "0.44366962", "text": "func (x *fastReflection_TestUpdatedTxBody) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value {\n\tswitch fd.FullName() {\n\tcase \"testpb.TestUpdatedTxBody.messages\":\n\t\tif x.Messages == nil {\n\t\t\tx.Messages = []*anypb.Any{}\n\t\t}\n\t\tvalue := &_TestUpdatedTxBody_1_list{list: &x.Messages}\n\t\treturn protoreflect.ValueOfList(value)\n\tcase \"testpb.TestUpdatedTxBody.extension_options\":\n\t\tif x.ExtensionOptions == nil {\n\t\t\tx.ExtensionOptions = []*anypb.Any{}\n\t\t}\n\t\tvalue := &_TestUpdatedTxBody_1023_list{list: &x.ExtensionOptions}\n\t\treturn protoreflect.ValueOfList(value)\n\tcase \"testpb.TestUpdatedTxBody.non_critical_extension_options\":\n\t\tif x.NonCriticalExtensionOptions == nil {\n\t\t\tx.NonCriticalExtensionOptions = []*anypb.Any{}\n\t\t}\n\t\tvalue := &_TestUpdatedTxBody_2047_list{list: &x.NonCriticalExtensionOptions}\n\t\treturn protoreflect.ValueOfList(value)\n\tcase \"testpb.TestUpdatedTxBody.memo\":\n\t\tpanic(fmt.Errorf(\"field memo of message testpb.TestUpdatedTxBody is not mutable\"))\n\tcase \"testpb.TestUpdatedTxBody.timeout_height\":\n\t\tpanic(fmt.Errorf(\"field timeout_height of message testpb.TestUpdatedTxBody is not mutable\"))\n\tcase \"testpb.TestUpdatedTxBody.some_new_field\":\n\t\tpanic(fmt.Errorf(\"field some_new_field of message testpb.TestUpdatedTxBody is not mutable\"))\n\tcase \"testpb.TestUpdatedTxBody.some_new_field_non_critical_field\":\n\t\tpanic(fmt.Errorf(\"field some_new_field_non_critical_field of message testpb.TestUpdatedTxBody is not mutable\"))\n\tdefault:\n\t\tif fd.IsExtension() {\n\t\t\tpanic(fmt.Errorf(\"proto3 declared messages do not support extensions: testpb.TestUpdatedTxBody\"))\n\t\t}\n\t\tpanic(fmt.Errorf(\"message testpb.TestUpdatedTxBody does not contain field %s\", fd.FullName()))\n\t}\n}", "title": "" }, { "docid": "95bdde6e71cf946cfefa87e34dc25ab5", "score": "0.44340506", "text": "func (x *fastReflection_QueryResolverRequest) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value {\n\tswitch fd.FullName() {\n\tcase \"regen.data.v1.QueryResolverRequest.id\":\n\t\tpanic(fmt.Errorf(\"field id of message regen.data.v1.QueryResolverRequest is not mutable\"))\n\tdefault:\n\t\tif fd.IsExtension() {\n\t\t\tpanic(fmt.Errorf(\"proto3 declared messages do not support extensions: regen.data.v1.QueryResolverRequest\"))\n\t\t}\n\t\tpanic(fmt.Errorf(\"message regen.data.v1.QueryResolverRequest does not contain field %s\", fd.FullName()))\n\t}\n}", "title": "" }, { "docid": "6f331d31fee9fa8e5f158c236d7c11a3", "score": "0.4428947", "text": "func (x *fastReflection_EventUpdateProjectAdmin) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value {\n\tswitch fd.FullName() {\n\tcase \"regen.ecocredit.v1.EventUpdateProjectAdmin.project_id\":\n\t\tpanic(fmt.Errorf(\"field project_id of message regen.ecocredit.v1.EventUpdateProjectAdmin is not mutable\"))\n\tdefault:\n\t\tif fd.IsExtension() {\n\t\t\tpanic(fmt.Errorf(\"proto3 declared messages do not support extensions: regen.ecocredit.v1.EventUpdateProjectAdmin\"))\n\t\t}\n\t\tpanic(fmt.Errorf(\"message regen.ecocredit.v1.EventUpdateProjectAdmin does not contain field %s\", fd.FullName()))\n\t}\n}", "title": "" }, { "docid": "4e40cdab9ecf90d55f2e65658acf6e9d", "score": "0.44278923", "text": "func (x *fastReflection_ResolverInfo) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value {\n\tswitch fd.FullName() {\n\tcase \"regen.data.v1.ResolverInfo.id\":\n\t\tpanic(fmt.Errorf(\"field id of message regen.data.v1.ResolverInfo is not mutable\"))\n\tcase \"regen.data.v1.ResolverInfo.url\":\n\t\tpanic(fmt.Errorf(\"field url of message regen.data.v1.ResolverInfo is not mutable\"))\n\tcase \"regen.data.v1.ResolverInfo.manager\":\n\t\tpanic(fmt.Errorf(\"field manager of message regen.data.v1.ResolverInfo is not mutable\"))\n\tdefault:\n\t\tif fd.IsExtension() {\n\t\t\tpanic(fmt.Errorf(\"proto3 declared messages do not support extensions: regen.data.v1.ResolverInfo\"))\n\t\t}\n\t\tpanic(fmt.Errorf(\"message regen.data.v1.ResolverInfo does not contain field %s\", fd.FullName()))\n\t}\n}", "title": "" }, { "docid": "0815374f96f0249d6916c88700fed746", "score": "0.4426707", "text": "func (x *fastReflection_MsgExecLegacyContentResponse) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value {\n\tswitch fd.FullName() {\n\tdefault:\n\t\tif fd.IsExtension() {\n\t\t\tpanic(fmt.Errorf(\"proto3 declared messages do not support extensions: cosmos.gov.v1.MsgExecLegacyContentResponse\"))\n\t\t}\n\t\tpanic(fmt.Errorf(\"message cosmos.gov.v1.MsgExecLegacyContentResponse does not contain field %s\", fd.FullName()))\n\t}\n}", "title": "" }, { "docid": "8311d47ac5efb4d5196d0c738f2a2836", "score": "0.44129646", "text": "func (x *fastReflection_EventTransfer) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value {\n\tswitch fd.FullName() {\n\tcase \"regen.ecocredit.v1.EventTransfer.sender\":\n\t\tpanic(fmt.Errorf(\"field sender of message regen.ecocredit.v1.EventTransfer is not mutable\"))\n\tcase \"regen.ecocredit.v1.EventTransfer.recipient\":\n\t\tpanic(fmt.Errorf(\"field recipient of message regen.ecocredit.v1.EventTransfer is not mutable\"))\n\tcase \"regen.ecocredit.v1.EventTransfer.batch_denom\":\n\t\tpanic(fmt.Errorf(\"field batch_denom of message regen.ecocredit.v1.EventTransfer is not mutable\"))\n\tcase \"regen.ecocredit.v1.EventTransfer.tradable_amount\":\n\t\tpanic(fmt.Errorf(\"field tradable_amount of message regen.ecocredit.v1.EventTransfer is not mutable\"))\n\tcase \"regen.ecocredit.v1.EventTransfer.retired_amount\":\n\t\tpanic(fmt.Errorf(\"field retired_amount of message regen.ecocredit.v1.EventTransfer is not mutable\"))\n\tdefault:\n\t\tif fd.IsExtension() {\n\t\t\tpanic(fmt.Errorf(\"proto3 declared messages do not support extensions: regen.ecocredit.v1.EventTransfer\"))\n\t\t}\n\t\tpanic(fmt.Errorf(\"message regen.ecocredit.v1.EventTransfer does not contain field %s\", fd.FullName()))\n\t}\n}", "title": "" }, { "docid": "359376bfa76a21ec3b3107b6de51e2a4", "score": "0.4411397", "text": "func (x *fastReflection_MsgUpdateGroupMetadata) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value {\n\tswitch fd.FullName() {\n\tcase \"cosmos.group.v1beta1.MsgUpdateGroupMetadata.admin\":\n\t\tpanic(fmt.Errorf(\"field admin of message cosmos.group.v1beta1.MsgUpdateGroupMetadata is not mutable\"))\n\tcase \"cosmos.group.v1beta1.MsgUpdateGroupMetadata.group_id\":\n\t\tpanic(fmt.Errorf(\"field group_id of message cosmos.group.v1beta1.MsgUpdateGroupMetadata is not mutable\"))\n\tcase \"cosmos.group.v1beta1.MsgUpdateGroupMetadata.metadata\":\n\t\tpanic(fmt.Errorf(\"field metadata of message cosmos.group.v1beta1.MsgUpdateGroupMetadata is not mutable\"))\n\tdefault:\n\t\tif fd.IsExtension() {\n\t\t\tpanic(fmt.Errorf(\"proto3 declared messages do not support extensions: cosmos.group.v1beta1.MsgUpdateGroupMetadata\"))\n\t\t}\n\t\tpanic(fmt.Errorf(\"message cosmos.group.v1beta1.MsgUpdateGroupMetadata does not contain field %s\", fd.FullName()))\n\t}\n}", "title": "" }, { "docid": "53d180ebfff8b716bce5b80eed2d7ec0", "score": "0.44060835", "text": "func (ty *Type) Clone() *Type {\n\t// note: not copying Inited\n\tnty := &Type{Name: ty.Name, Kind: ty.Kind, Desc: ty.Desc, Filename: ty.Filename, Region: ty.Region, Ast: ty.Ast}\n\tnty.Els.CopyFrom(ty.Els)\n\tnty.Meths = ty.Meths.Clone()\n\tnty.Size = sliceclone.Int(ty.Size)\n\tnty.Scopes = ty.Scopes.Clone()\n\tnty.Props.CopyFrom(ty.Props, true)\n\treturn nty\n}", "title": "" }, { "docid": "4bc1f09baa910152d4ebbd684bf7204f", "score": "0.4399849", "text": "func (*WrapperStruct) MojomType() mojom_types.UserDefinedType {\n\treturn WrapperStructMojomType()\n}", "title": "" }, { "docid": "443c03022d4217e61612535acfb1c8b3", "score": "0.43955886", "text": "func (x *fastReflection_MsgUpdateGroupAdminResponse) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value {\n\tswitch fd.FullName() {\n\tdefault:\n\t\tif fd.IsExtension() {\n\t\t\tpanic(fmt.Errorf(\"proto3 declared messages do not support extensions: cosmos.group.v1beta1.MsgUpdateGroupAdminResponse\"))\n\t\t}\n\t\tpanic(fmt.Errorf(\"message cosmos.group.v1beta1.MsgUpdateGroupAdminResponse does not contain field %s\", fd.FullName()))\n\t}\n}", "title": "" }, { "docid": "0c34324cb12224a722c3b49dc29172ba", "score": "0.43941355", "text": "func (x *fastReflection_EventUpdateClassMetadata) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value {\n\tswitch fd.FullName() {\n\tcase \"regen.ecocredit.v1.EventUpdateClassMetadata.class_id\":\n\t\tpanic(fmt.Errorf(\"field class_id of message regen.ecocredit.v1.EventUpdateClassMetadata is not mutable\"))\n\tdefault:\n\t\tif fd.IsExtension() {\n\t\t\tpanic(fmt.Errorf(\"proto3 declared messages do not support extensions: regen.ecocredit.v1.EventUpdateClassMetadata\"))\n\t\t}\n\t\tpanic(fmt.Errorf(\"message regen.ecocredit.v1.EventUpdateClassMetadata does not contain field %s\", fd.FullName()))\n\t}\n}", "title": "" }, { "docid": "2f0ef1439df3186b8e5d6f9d83972746", "score": "0.43940112", "text": "func (x *fastReflection_EventUpdateProjectMetadata) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value {\n\tswitch fd.FullName() {\n\tcase \"regen.ecocredit.v1.EventUpdateProjectMetadata.project_id\":\n\t\tpanic(fmt.Errorf(\"field project_id of message regen.ecocredit.v1.EventUpdateProjectMetadata is not mutable\"))\n\tdefault:\n\t\tif fd.IsExtension() {\n\t\t\tpanic(fmt.Errorf(\"proto3 declared messages do not support extensions: regen.ecocredit.v1.EventUpdateProjectMetadata\"))\n\t\t}\n\t\tpanic(fmt.Errorf(\"message regen.ecocredit.v1.EventUpdateProjectMetadata does not contain field %s\", fd.FullName()))\n\t}\n}", "title": "" }, { "docid": "64fecda7d4efbbfbe9adf4be9fd8f9ba", "score": "0.43932658", "text": "func (x *fastReflection_MsgExec) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value {\n\tswitch fd.FullName() {\n\tcase \"cosmos.group.v1beta1.MsgExec.proposal_id\":\n\t\tpanic(fmt.Errorf(\"field proposal_id of message cosmos.group.v1beta1.MsgExec is not mutable\"))\n\tcase \"cosmos.group.v1beta1.MsgExec.signer\":\n\t\tpanic(fmt.Errorf(\"field signer of message cosmos.group.v1beta1.MsgExec is not mutable\"))\n\tdefault:\n\t\tif fd.IsExtension() {\n\t\t\tpanic(fmt.Errorf(\"proto3 declared messages do not support extensions: cosmos.group.v1beta1.MsgExec\"))\n\t\t}\n\t\tpanic(fmt.Errorf(\"message cosmos.group.v1beta1.MsgExec does not contain field %s\", fd.FullName()))\n\t}\n}", "title": "" }, { "docid": "f0e54bd7397925d49fd9b17f2e778736", "score": "0.43781728", "text": "func (x *fastReflection_ValidatorMissedBlocks) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value {\n\tswitch fd.FullName() {\n\tcase \"cosmos.slashing.v1beta1.ValidatorMissedBlocks.missed_blocks\":\n\t\tif x.MissedBlocks == nil {\n\t\t\tx.MissedBlocks = []*MissedBlock{}\n\t\t}\n\t\tvalue := &_ValidatorMissedBlocks_2_list{list: &x.MissedBlocks}\n\t\treturn protoreflect.ValueOfList(value)\n\tcase \"cosmos.slashing.v1beta1.ValidatorMissedBlocks.address\":\n\t\tpanic(fmt.Errorf(\"field address of message cosmos.slashing.v1beta1.ValidatorMissedBlocks is not mutable\"))\n\tdefault:\n\t\tif fd.IsExtension() {\n\t\t\tpanic(fmt.Errorf(\"proto3 declared messages do not support extensions: cosmos.slashing.v1beta1.ValidatorMissedBlocks\"))\n\t\t}\n\t\tpanic(fmt.Errorf(\"message cosmos.slashing.v1beta1.ValidatorMissedBlocks does not contain field %s\", fd.FullName()))\n\t}\n}", "title": "" }, { "docid": "eaca4263e5e5b653535348a6111ce86e", "score": "0.43732744", "text": "func (x *fastReflection_AnyWithExtra) Clear(fd protoreflect.FieldDescriptor) {\n\tswitch fd.FullName() {\n\tcase \"testpb.AnyWithExtra.a\":\n\t\tx.A = nil\n\tcase \"testpb.AnyWithExtra.b\":\n\t\tx.B = int64(0)\n\tcase \"testpb.AnyWithExtra.c\":\n\t\tx.C = int64(0)\n\tdefault:\n\t\tif fd.IsExtension() {\n\t\t\tpanic(fmt.Errorf(\"proto3 declared messages do not support extensions: testpb.AnyWithExtra\"))\n\t\t}\n\t\tpanic(fmt.Errorf(\"message testpb.AnyWithExtra does not contain field %s\", fd.FullName()))\n\t}\n}", "title": "" }, { "docid": "c1af1e6dab4a35b2574eea88821fdb0e", "score": "0.43705142", "text": "func (x *fastReflection_MsgDepositResponse) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value {\n\tswitch fd.FullName() {\n\tdefault:\n\t\tif fd.IsExtension() {\n\t\t\tpanic(fmt.Errorf(\"proto3 declared messages do not support extensions: cosmos.gov.v1.MsgDepositResponse\"))\n\t\t}\n\t\tpanic(fmt.Errorf(\"message cosmos.gov.v1.MsgDepositResponse does not contain field %s\", fd.FullName()))\n\t}\n}", "title": "" }, { "docid": "0d4bc4c6f93b6911390590648956e510", "score": "0.43703505", "text": "func (x *fastReflection_MsgUpdateGroupAdmin) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value {\n\tswitch fd.FullName() {\n\tcase \"cosmos.group.v1beta1.MsgUpdateGroupAdmin.admin\":\n\t\tpanic(fmt.Errorf(\"field admin of message cosmos.group.v1beta1.MsgUpdateGroupAdmin is not mutable\"))\n\tcase \"cosmos.group.v1beta1.MsgUpdateGroupAdmin.group_id\":\n\t\tpanic(fmt.Errorf(\"field group_id of message cosmos.group.v1beta1.MsgUpdateGroupAdmin is not mutable\"))\n\tcase \"cosmos.group.v1beta1.MsgUpdateGroupAdmin.new_admin\":\n\t\tpanic(fmt.Errorf(\"field new_admin of message cosmos.group.v1beta1.MsgUpdateGroupAdmin is not mutable\"))\n\tdefault:\n\t\tif fd.IsExtension() {\n\t\t\tpanic(fmt.Errorf(\"proto3 declared messages do not support extensions: cosmos.group.v1beta1.MsgUpdateGroupAdmin\"))\n\t\t}\n\t\tpanic(fmt.Errorf(\"message cosmos.group.v1beta1.MsgUpdateGroupAdmin does not contain field %s\", fd.FullName()))\n\t}\n}", "title": "" }, { "docid": "0408e038fd9d921e53e424ebfd0cd3bc", "score": "0.43675086", "text": "func (x *fastReflection_MsgUpdateGroupMetadataResponse) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value {\n\tswitch fd.FullName() {\n\tdefault:\n\t\tif fd.IsExtension() {\n\t\t\tpanic(fmt.Errorf(\"proto3 declared messages do not support extensions: cosmos.group.v1beta1.MsgUpdateGroupMetadataResponse\"))\n\t\t}\n\t\tpanic(fmt.Errorf(\"message cosmos.group.v1beta1.MsgUpdateGroupMetadataResponse does not contain field %s\", fd.FullName()))\n\t}\n}", "title": "" }, { "docid": "48aa07e4d95fcf5ff319e502a4488ec2", "score": "0.4365699", "text": "func (x *fastReflection_QueryAnchorByIRIRequest) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value {\n\tswitch fd.FullName() {\n\tcase \"regen.data.v1.QueryAnchorByIRIRequest.iri\":\n\t\tpanic(fmt.Errorf(\"field iri of message regen.data.v1.QueryAnchorByIRIRequest is not mutable\"))\n\tdefault:\n\t\tif fd.IsExtension() {\n\t\t\tpanic(fmt.Errorf(\"proto3 declared messages do not support extensions: regen.data.v1.QueryAnchorByIRIRequest\"))\n\t\t}\n\t\tpanic(fmt.Errorf(\"message regen.data.v1.QueryAnchorByIRIRequest does not contain field %s\", fd.FullName()))\n\t}\n}", "title": "" }, { "docid": "f7fc590383caab6f4ebc71aa229f7834", "score": "0.43656248", "text": "func (x *fastReflection_EventUpdateClassAdmin) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value {\n\tswitch fd.FullName() {\n\tcase \"regen.ecocredit.v1.EventUpdateClassAdmin.class_id\":\n\t\tpanic(fmt.Errorf(\"field class_id of message regen.ecocredit.v1.EventUpdateClassAdmin is not mutable\"))\n\tdefault:\n\t\tif fd.IsExtension() {\n\t\t\tpanic(fmt.Errorf(\"proto3 declared messages do not support extensions: regen.ecocredit.v1.EventUpdateClassAdmin\"))\n\t\t}\n\t\tpanic(fmt.Errorf(\"message regen.ecocredit.v1.EventUpdateClassAdmin does not contain field %s\", fd.FullName()))\n\t}\n}", "title": "" }, { "docid": "b24be47d54e7f52231ddf5f4ed4d2d54", "score": "0.4357437", "text": "func (*DummyStruct) MojomType() mojom_types.UserDefinedType {\n\treturn DummyStructMojomType()\n}", "title": "" }, { "docid": "2440dddc19c6a38dc0a79a9be8c048a0", "score": "0.43512133", "text": "func (x *fastReflection_EventBurn) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value {\n\tswitch fd.FullName() {\n\tcase \"cosmos.nft.v1beta1.EventBurn.class_id\":\n\t\tpanic(fmt.Errorf(\"field class_id of message cosmos.nft.v1beta1.EventBurn is not mutable\"))\n\tcase \"cosmos.nft.v1beta1.EventBurn.id\":\n\t\tpanic(fmt.Errorf(\"field id of message cosmos.nft.v1beta1.EventBurn is not mutable\"))\n\tcase \"cosmos.nft.v1beta1.EventBurn.owner\":\n\t\tpanic(fmt.Errorf(\"field owner of message cosmos.nft.v1beta1.EventBurn is not mutable\"))\n\tdefault:\n\t\tif fd.IsExtension() {\n\t\t\tpanic(fmt.Errorf(\"proto3 declared messages do not support extensions: cosmos.nft.v1beta1.EventBurn\"))\n\t\t}\n\t\tpanic(fmt.Errorf(\"message cosmos.nft.v1beta1.EventBurn does not contain field %s\", fd.FullName()))\n\t}\n}", "title": "" }, { "docid": "58e71653bc432f116d02bb43d39fb76e", "score": "0.43432254", "text": "func (x *fastReflection_AttestationInfo) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value {\n\tswitch fd.FullName() {\n\tcase \"regen.data.v1.AttestationInfo.timestamp\":\n\t\tif x.Timestamp == nil {\n\t\t\tx.Timestamp = new(timestamppb.Timestamp)\n\t\t}\n\t\treturn protoreflect.ValueOfMessage(x.Timestamp.ProtoReflect())\n\tcase \"regen.data.v1.AttestationInfo.iri\":\n\t\tpanic(fmt.Errorf(\"field iri of message regen.data.v1.AttestationInfo is not mutable\"))\n\tcase \"regen.data.v1.AttestationInfo.attestor\":\n\t\tpanic(fmt.Errorf(\"field attestor of message regen.data.v1.AttestationInfo is not mutable\"))\n\tdefault:\n\t\tif fd.IsExtension() {\n\t\t\tpanic(fmt.Errorf(\"proto3 declared messages do not support extensions: regen.data.v1.AttestationInfo\"))\n\t\t}\n\t\tpanic(fmt.Errorf(\"message regen.data.v1.AttestationInfo does not contain field %s\", fd.FullName()))\n\t}\n}", "title": "" }, { "docid": "359309d581874b4418b8c4e26a0cc354", "score": "0.43371305", "text": "func (p primitive) Combine(o *primitive) *primitive {\n\tif p.Equal(o) {\n\t\treturn &p\n\t}\n\t// our definition of \"combinable\" is: all of the fields that are set in one are either\n\t// set to the same value in the other, or Unset\n\tc := primitive{}\n\tswitch {\n\tcase p.kind == o.kind || o.kind == filterKindUnset:\n\t\tc.kind = p.kind\n\tcase p.kind == filterKindUnset:\n\t\tc.kind = o.kind\n\tdefault:\n\t\treturn nil\n\t}\n\n\tswitch {\n\tcase p.direction == o.direction || o.direction == filterDirectionUnset:\n\t\tc.direction = p.direction\n\tcase p.direction == filterDirectionUnset:\n\t\tc.direction = o.direction\n\tdefault:\n\t\treturn nil\n\t}\n\n\tswitch {\n\tcase p.protocol == o.protocol || o.protocol == filterProtocolUnset:\n\t\tc.protocol = p.protocol\n\tcase p.protocol == filterProtocolUnset:\n\t\tc.protocol = o.protocol\n\tdefault:\n\t\treturn nil\n\t}\n\n\tswitch {\n\tcase p.subProtocol == o.subProtocol || o.subProtocol == filterSubProtocolUnset:\n\t\tc.subProtocol = p.subProtocol\n\tcase p.subProtocol == filterSubProtocolUnset:\n\t\tc.subProtocol = o.subProtocol\n\tdefault:\n\t\treturn nil\n\t}\n\n\tswitch {\n\tcase p.id == o.id || o.id == \"\":\n\t\tc.id = p.id\n\tcase p.id == \"\":\n\t\tc.id = o.id\n\tdefault:\n\t\treturn nil\n\t}\n\n\tswitch {\n\tcase p.negator == o.negator:\n\t\tc.negator = p.negator\n\tdefault:\n\t\treturn nil\n\t}\n\n\treturn &c\n}", "title": "" }, { "docid": "e1405c4a2458517db57ff310ddf57ace", "score": "0.43300438", "text": "func (x *fastReflection_MsgWithdrawProposal) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value {\n\tswitch fd.FullName() {\n\tcase \"cosmos.group.v1beta1.MsgWithdrawProposal.proposal_id\":\n\t\tpanic(fmt.Errorf(\"field proposal_id of message cosmos.group.v1beta1.MsgWithdrawProposal is not mutable\"))\n\tcase \"cosmos.group.v1beta1.MsgWithdrawProposal.address\":\n\t\tpanic(fmt.Errorf(\"field address of message cosmos.group.v1beta1.MsgWithdrawProposal is not mutable\"))\n\tdefault:\n\t\tif fd.IsExtension() {\n\t\t\tpanic(fmt.Errorf(\"proto3 declared messages do not support extensions: cosmos.group.v1beta1.MsgWithdrawProposal\"))\n\t\t}\n\t\tpanic(fmt.Errorf(\"message cosmos.group.v1beta1.MsgWithdrawProposal does not contain field %s\", fd.FullName()))\n\t}\n}", "title": "" }, { "docid": "f129108afe7eef235c0033a59e93b49d", "score": "0.43272352", "text": "func (x *fastReflection_ConvertIRIToHashRequest) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value {\n\tswitch fd.FullName() {\n\tcase \"regen.data.v1.ConvertIRIToHashRequest.iri\":\n\t\tpanic(fmt.Errorf(\"field iri of message regen.data.v1.ConvertIRIToHashRequest is not mutable\"))\n\tdefault:\n\t\tif fd.IsExtension() {\n\t\t\tpanic(fmt.Errorf(\"proto3 declared messages do not support extensions: regen.data.v1.ConvertIRIToHashRequest\"))\n\t\t}\n\t\tpanic(fmt.Errorf(\"message regen.data.v1.ConvertIRIToHashRequest does not contain field %s\", fd.FullName()))\n\t}\n}", "title": "" } ]
ad8c16c94b8740ef71a8e9451c5faaf4
writeNetworkdUnit creates the specified unit and any dropins for that unit. If the contents of the unit or are empty, the unit is not created. The same applies to the unit's dropins.
[ { "docid": "ee27f47edf767bbf54702e0df061fe65", "score": "0.78942573", "text": "func (s *stage) writeNetworkdUnit(unit types.Networkdunit) error {\n\treturn s.Logger.LogOp(func() error {\n\t\tfor _, dropin := range unit.Dropins {\n\t\t\tif dropin.Contents == \"\" {\n\t\t\t\tcontinue\n\t\t\t}\n\n\t\t\tf, err := util.FileFromNetworkdUnitDropin(unit, dropin)\n\t\t\tif err != nil {\n\t\t\t\ts.Logger.Crit(\"error converting networkd dropin: %v\", err)\n\t\t\t\treturn err\n\t\t\t}\n\t\t\tif err := s.Logger.LogOp(\n\t\t\t\tfunc() error { return s.PerformFetch(f) },\n\t\t\t\t\"writing networkd drop-in %q at %q\", dropin.Name, f.Path,\n\t\t\t); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t\ts.relabel(\"/\" + f.Path)\n\t\t}\n\t\tif unit.Contents == \"\" {\n\t\t\treturn nil\n\t\t}\n\n\t\tf, err := util.FileFromNetworkdUnit(unit)\n\t\tif err != nil {\n\t\t\ts.Logger.Crit(\"error converting unit: %v\", err)\n\t\t\treturn err\n\t\t}\n\t\tif err := s.Logger.LogOp(\n\t\t\tfunc() error { return s.PerformFetch(f) },\n\t\t\t\"writing unit %q at %q\", unit.Name, f.Path,\n\t\t); err != nil {\n\t\t\treturn err\n\t\t}\n\t\ts.relabel(\"/\" + f.Path)\n\n\t\treturn nil\n\t}, \"processing unit %q\", unit.Name)\n}", "title": "" } ]
[ { "docid": "3fdffd47a8ce0ed3bd9e5040a2ede280", "score": "0.64066166", "text": "func CreateNetworkUnit(t *testing.T) string {\n\tvar ret string\n\tif _, err := os.Stat(\"/run/systemd/network\"); os.IsNotExist(err) {\n\t\terr = os.MkdirAll(\"/run/systemd/network\", 0777)\n\t\tif err != nil {\n\t\t\tt.Fatalf(\"creating /run/systemd/network: %v\", err)\n\t\t}\n\t\tret = \"/run/systemd/network\"\n\t} else {\n\t\tfiles, err := ioutil.ReadDir(\"/run/systemd/network\")\n\t\tif err == nil && len(files) > 0 {\n\t\t\t// a network unit already exists\n\t\t\treturn \"\"\n\t\t}\n\t}\n\n\t// no existing network files exist, write a valid .network file\n\t// which performs a no-op\n\tfile, err := os.Create(\"/run/systemd/network/coreos-install-test.network\")\n\tif err != nil {\n\t\tt.Fatalf(\"creating network unit: %v\", err)\n\t}\n\tdefer file.Close()\n\n\t_, err = file.WriteString(`# Created by coreos-install tests\n[Match]\nArchitecture=coreos-install`)\n\tif err != nil {\n\t\tt.Fatalf(\"writing data to network unit: %v\", err)\n\t}\n\tif ret == \"\" {\n\t\tret = file.Name()\n\t}\n\n\treturn ret\n}", "title": "" }, { "docid": "13e8f23d2c477374fe143715c1e03d05", "score": "0.57508963", "text": "func writeUnit(u ign3types.Unit, systemdRoot string, isCoreOSVariant bool) error {\n\tif err := writeDropins(u, systemdRoot, isCoreOSVariant); err != nil {\n\t\treturn err\n\t}\n\n\t// write (or cleanup) path in /etc/systemd/system\n\tfpath := filepath.Join(systemdRoot, u.Name)\n\tif u.Mask != nil && *u.Mask {\n\t\t// if the unit is masked, symlink fpath to /dev/null and return early.\n\n\t\tklog.V(2).Info(\"Systemd unit masked\")\n\t\tif err := os.RemoveAll(fpath); err != nil {\n\t\t\treturn fmt.Errorf(\"failed to remove unit %q: %w\", u.Name, err)\n\t\t}\n\t\tklog.V(2).Infof(\"Removed unit %q\", u.Name)\n\n\t\tif err := renameio.Symlink(pathDevNull, fpath); err != nil {\n\t\t\treturn fmt.Errorf(\"failed to symlink unit %q to %s: %w\", u.Name, pathDevNull, err)\n\t\t}\n\t\tklog.V(2).Infof(\"Created symlink unit %q to %s\", u.Name, pathDevNull)\n\n\t\t// Return early since we don't need to write the file contents in this case.\n\t\treturn nil\n\t}\n\n\tif u.Contents != nil && *u.Contents != \"\" {\n\t\tklog.Infof(\"Writing systemd unit %q\", u.Name)\n\t\tif _, err := os.Stat(withUsrPath(fpath)); err == nil &&\n\t\t\tisCoreOSVariant {\n\t\t\tif err := createOrigFile(withUsrPath(fpath), fpath); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t\tif err := writeFileAtomicallyWithDefaults(fpath, []byte(*u.Contents)); err != nil {\n\t\t\treturn fmt.Errorf(\"failed to write systemd unit %q: %w\", u.Name, err)\n\t\t}\n\n\t\tklog.V(2).Infof(\"Successfully wrote systemd unit %q: \", u.Name)\n\t} else if u.Mask != nil && !*u.Mask {\n\t\t// if mask is explicitly set to false, make sure to remove a previous mask\n\t\t// see https://bugzilla.redhat.com/show_bug.cgi?id=1966445\n\t\t// Note that this does not catch all cleanup cases; for example, if the previous machine config specified\n\t\t// Contents, and the current one does not, the previous content will not get cleaned up. For now we're ignoring some\n\t\t// of those edge cases rather than introducing more complexity.\n\t\tklog.V(2).Infof(\"Ensuring systemd unit %q has no mask at %q\", u.Name, fpath)\n\t\tif err := os.RemoveAll(fpath); err != nil {\n\t\t\treturn fmt.Errorf(\"failed to cleanup %s: %w\", fpath, err)\n\t\t}\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "ced80cc55b4019468dec1165d62a1890", "score": "0.5750654", "text": "func (s *stage) writeSystemdUnit(unit types.Unit) error {\n\treturn s.Logger.LogOp(func() error {\n\t\trelabeledDropinDir := false\n\t\tfor _, dropin := range unit.Dropins {\n\t\t\tif dropin.Contents == nil {\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tf, err := s.FileFromSystemdUnitDropin(unit, dropin)\n\t\t\tif err != nil {\n\t\t\t\ts.Logger.Crit(\"error converting systemd dropin: %v\", err)\n\t\t\t\treturn err\n\t\t\t}\n\t\t\t// trim off prefix since this needs to be relative to the sysroot\n\t\t\tif !strings.HasPrefix(f.Node.Path, s.DestDir) {\n\t\t\t\tpanic(fmt.Sprintf(\"Dropin path %s isn't under prefix %s\", f.Node.Path, s.DestDir))\n\t\t\t}\n\t\t\trelabelPath := f.Node.Path[len(s.DestDir):]\n\t\t\tif err := s.Logger.LogOp(\n\t\t\t\tfunc() error { return s.PerformFetch(f) },\n\t\t\t\t\"writing systemd drop-in %q at %q\", dropin.Name, f.Node.Path,\n\t\t\t); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t\tif !relabeledDropinDir {\n\t\t\t\ts.relabel(filepath.Dir(relabelPath))\n\t\t\t\trelabeledDropinDir = true\n\t\t\t}\n\t\t}\n\n\t\tif cutil.NilOrEmpty(unit.Contents) {\n\t\t\treturn nil\n\t\t}\n\n\t\tf, err := s.FileFromSystemdUnit(unit)\n\t\tif err != nil {\n\t\t\ts.Logger.Crit(\"error converting unit: %v\", err)\n\t\t\treturn err\n\t\t}\n\t\t// trim off prefix since this needs to be relative to the sysroot\n\t\tif !strings.HasPrefix(f.Node.Path, s.DestDir) {\n\t\t\tpanic(fmt.Sprintf(\"Unit path %s isn't under prefix %s\", f.Node.Path, s.DestDir))\n\t\t}\n\t\trelabelPath := f.Node.Path[len(s.DestDir):]\n\t\tif err := s.Logger.LogOp(\n\t\t\tfunc() error { return s.PerformFetch(f) },\n\t\t\t\"writing unit %q at %q\", unit.Name, f.Node.Path,\n\t\t); err != nil {\n\t\t\treturn err\n\t\t}\n\t\ts.relabel(relabelPath)\n\n\t\treturn nil\n\t}, \"processing unit %q\", unit.Name)\n}", "title": "" }, { "docid": "a6f4b6d19973c680449b8be5f3a2c454", "score": "0.56772965", "text": "func WriteUnit(unit gomel.Unit, w io.Writer) error {\n\treturn newEncoder(w).encodeUnit(unit)\n}", "title": "" }, { "docid": "937e87dbaad8f65c62720e5177c21b95", "score": "0.56539065", "text": "func (s *stage) writeSystemdUnit(unit types.Unit, runtime bool) error {\n\t// use a different DestDir if it's runtime so it affects our /run (but not\n\t// if we're running locally through blackbox tests)\n\tu := s.Util\n\tif runtime && !distro.BlackboxTesting() {\n\t\tu.DestDir = \"/\"\n\t}\n\n\treturn s.Logger.LogOp(func() error {\n\t\trelabeledDropinDir := false\n\t\tfor _, dropin := range unit.Dropins {\n\t\t\tif dropin.Contents == \"\" {\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tf, err := util.FileFromSystemdUnitDropin(unit, dropin, runtime)\n\t\t\tif err != nil {\n\t\t\t\ts.Logger.Crit(\"error converting systemd dropin: %v\", err)\n\t\t\t\treturn err\n\t\t\t}\n\t\t\tif err := s.Logger.LogOp(\n\t\t\t\tfunc() error { return u.PerformFetch(f) },\n\t\t\t\t\"writing systemd drop-in %q at %q\", dropin.Name, f.Path,\n\t\t\t); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t\tif !relabeledDropinDir {\n\t\t\t\ts.relabel(filepath.Dir(\"/\" + f.Path))\n\t\t\t\trelabeledDropinDir = true\n\t\t\t}\n\t\t}\n\n\t\tif unit.Contents == \"\" {\n\t\t\treturn nil\n\t\t}\n\n\t\tf, err := util.FileFromSystemdUnit(unit, runtime)\n\t\tif err != nil {\n\t\t\ts.Logger.Crit(\"error converting unit: %v\", err)\n\t\t\treturn err\n\t\t}\n\t\tif err := s.Logger.LogOp(\n\t\t\tfunc() error { return u.PerformFetch(f) },\n\t\t\t\"writing unit %q at %q\", unit.Name, f.Path,\n\t\t); err != nil {\n\t\t\treturn err\n\t\t}\n\t\ts.relabel(\"/\" + f.Path)\n\n\t\treturn nil\n\t}, \"processing unit %q\", unit.Name)\n}", "title": "" }, { "docid": "2c333c790b7f2753cb3e3ceda78b20d4", "score": "0.5549368", "text": "func writeDropins(u ign3types.Unit, systemdRoot string, isCoreOSVariant bool) error {\n\tfor i := range u.Dropins {\n\t\tdpath := filepath.Join(systemdRoot, u.Name+\".d\", u.Dropins[i].Name)\n\t\tif u.Dropins[i].Contents == nil || *u.Dropins[i].Contents == \"\" {\n\t\t\tklog.Infof(\"Dropin for %s has no content, skipping write\", u.Dropins[i].Name)\n\t\t\tif _, err := os.Stat(dpath); err != nil {\n\t\t\t\tif os.IsNotExist(err) {\n\t\t\t\t\tcontinue\n\t\t\t\t}\n\t\t\t\treturn err\n\t\t\t}\n\t\t\tklog.Infof(\"Removing %q, updated file has zero length\", dpath)\n\t\t\tif err := os.Remove(dpath); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t\tcontinue\n\t\t}\n\n\t\tklog.Infof(\"Writing systemd unit dropin %q\", u.Dropins[i].Name)\n\t\tif _, err := os.Stat(withUsrPath(dpath)); err == nil &&\n\t\t\tisCoreOSVariant {\n\t\t\tif err := createOrigFile(withUsrPath(dpath), dpath); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t\tif err := writeFileAtomicallyWithDefaults(dpath, []byte(*u.Dropins[i].Contents)); err != nil {\n\t\t\treturn fmt.Errorf(\"failed to write systemd unit dropin %q: %w\", u.Dropins[i].Name, err)\n\t\t}\n\n\t\tklog.V(2).Infof(\"Wrote systemd unit dropin at %s\", dpath)\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "e1624e39bfd32ab923a446f2734a4ebc", "score": "0.5420511", "text": "func (db *DB) WriteUnit(ctx context.Context, revision, corpus, formatKey string, unit kcd.Unit) (string, error) {\n\tif revision == \"\" {\n\t\treturn \"\", errors.New(\"empty revision marker\")\n\t}\n\tunit.Canonicalize()\n\tname, err := db.Archive.WriteUnit(ctx, formatKey, unit)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\treturn trimExt(name), nil\n}", "title": "" }, { "docid": "e4b6f0972868d7cf460fc7a5f1a7d61e", "score": "0.5361643", "text": "func (m *Network) Write() error {\n\tif m.item == nil {\n\t\tpanic(\"m.item is nil!\")\n\t}\n\terr := m.item.WriteInto(ByIDFolderName, *m.id)\n\tif err != nil {\n\t\treturn err\n\t}\n\treturn m.item.WriteInto(ByNameFolderName, *m.name)\n}", "title": "" }, { "docid": "2d9dec70c9d27ed5180533c0d14f4213", "score": "0.530549", "text": "func writeUnits(units []ign3types.Unit, systemdRoot string, isCoreOSVariant bool) error {\n\tfor _, u := range units {\n\t\tif err := writeUnit(u, systemdRoot, isCoreOSVariant); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "2dd0157e0bfcca115e0736fe56e033bb", "score": "0.51251423", "text": "func (e Network) ToSystemdUnit() ([]*unit.UnitOption, error) {\n\tvar result []*unit.UnitOption\n\t// network interface\n\ti := &unit.UnitOption{\n\t\tSection: \"Match\",\n\t\tName: \"Name\",\n\t\tValue: \"eth0\",\n\t}\n\tif e.Interface != \"\" {\n\t\ti.Value = e.Interface\n\t}\n\tresult = append(result, i)\n\tif e.Static != nil {\n\t\t// add the IP\n\t\tresult = append(result, &unit.UnitOption{\n\t\t\tSection: \"Network\",\n\t\t\tName: \"Address\",\n\t\t\tValue: e.Static.IP,\n\t\t})\n\n\t\tif !e.DHCP {\n\t\t\t// Gateway\n\t\t\tresult = append(result, &unit.UnitOption{\n\t\t\t\tSection: \"Network\",\n\t\t\t\tName: \"Gateway\",\n\t\t\t\tValue: e.Static.Gateway,\n\t\t\t})\n\t\t} else {\n\t\t\tresult = append(result, &unit.UnitOption{\n\t\t\t\tSection: \"Network\",\n\t\t\t\tName: \"DHCP\",\n\t\t\t\tValue: \"ipv4\",\n\t\t\t})\n\t\t}\n\t\t// DNS\n\t\tfor _, v := range e.DNS {\n\t\t\tresult = append(result, &unit.UnitOption{\n\t\t\t\tSection: \"Network\",\n\t\t\t\tName: \"DNS\",\n\t\t\t\tValue: v,\n\t\t\t})\n\t\t}\n\t\treturn result, nil\n\t}\n\n\tif e.DHCP {\n\t\tresult = append(result, &unit.UnitOption{\n\t\t\tSection: \"Network\",\n\t\t\tName: \"DHCP\",\n\t\t\tValue: \"ipv4\",\n\t\t})\n\t\tif e.DNS != nil {\n\t\t\tfor _, v := range e.DNS {\n\t\t\t\tresult = append(result, &unit.UnitOption{\n\t\t\t\t\tSection: \"Network\",\n\t\t\t\t\tName: \"DNS\",\n\t\t\t\t\tValue: v,\n\t\t\t\t})\n\t\t\t}\n\t\t}\n\t\treturn result, nil\n\t}\n\n\treturn nil, errors.New(\"at least either static should specifid or dhcp\")\n}", "title": "" }, { "docid": "2dca7b3815a4def263ba942fddd25e81", "score": "0.50952274", "text": "func WriteUnitFile(cfg *apis.EtcdAdmConfig) error {\n\tt := template.Must(template.New(\"unit\").Parse(constants.UnitFileTemplate))\n\n\tunitFileDir := filepath.Dir(cfg.UnitFile)\n\tif err := os.MkdirAll(unitFileDir, 0755); err != nil {\n\t\treturn fmt.Errorf(\"unable to create unit file directory %q: %s\", unitFileDir, err)\n\t}\n\n\tf, err := os.OpenFile(cfg.UnitFile, os.O_RDWR|os.O_CREATE|os.O_TRUNC, 0755)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"unable to open the etcd service unit file %s: %s\", cfg.UnitFile, err)\n\t}\n\tdefer f.Close()\n\n\tif err := t.Execute(f, cfg); err != nil {\n\t\treturn fmt.Errorf(\"unable to apply etcd environment: %s\", err)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "c4ad9020756847107ef8d8a35e8292db", "score": "0.5003313", "text": "func (s *stage) createUnits(config types.Config) error {\n\tenabledOneUnit := false\n\tfor _, unit := range config.Systemd.Units {\n\t\tif err := s.writeSystemdUnit(unit, false); err != nil {\n\t\t\treturn err\n\t\t}\n\t\tif unit.Enable {\n\t\t\ts.Logger.Warning(\"the enable field has been deprecated in favor of enabled\")\n\t\t\tif err := s.Logger.LogOp(\n\t\t\t\tfunc() error { return s.EnableUnit(unit) },\n\t\t\t\t\"enabling unit %q\", unit.Name,\n\t\t\t); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t\tenabledOneUnit = true\n\t\t}\n\t\tif unit.Enabled != nil {\n\t\t\tif *unit.Enabled {\n\t\t\t\tif err := s.Logger.LogOp(\n\t\t\t\t\tfunc() error { return s.EnableUnit(unit) },\n\t\t\t\t\t\"enabling unit %q\", unit.Name,\n\t\t\t\t); err != nil {\n\t\t\t\t\treturn err\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tif err := s.Logger.LogOp(\n\t\t\t\t\tfunc() error { return s.DisableUnit(unit) },\n\t\t\t\t\t\"disabling unit %q\", unit.Name,\n\t\t\t\t); err != nil {\n\t\t\t\t\treturn err\n\t\t\t\t}\n\t\t\t}\n\t\t\tenabledOneUnit = true\n\t\t}\n\t\tif unit.Mask {\n\t\t\tif err := s.Logger.LogOp(\n\t\t\t\tfunc() error { return s.MaskUnit(unit) },\n\t\t\t\t\"masking unit %q\", unit.Name,\n\t\t\t); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\t// and relabel the preset file itself if we enabled/disabled something\n\tif enabledOneUnit {\n\t\ts.relabel(util.PresetPath)\n\t}\n\tfor _, unit := range config.Networkd.Units {\n\t\tif err := s.writeNetworkdUnit(unit); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "3a42d8a4d6f3d8b2ddde36b3534f33de", "score": "0.49111524", "text": "func NewOutputNALUnit(nalUnitType TLibCommon.NalUnitType, temporalID, reserved_zero_6bits uint) *OutputNALUnit {\n out := &OutputNALUnit{}\n\n out.NALUnit.SetNalUnitType(nalUnitType)\n out.NALUnit.SetTemporalId(temporalID)\n out.NALUnit.SetReservedZero6Bits(reserved_zero_6bits)\n out.m_Bitstream = TLibCommon.NewTComOutputBitstream();//nil\n\n return out\n}", "title": "" }, { "docid": "df1d438ba8250423c4d31230e46a2063", "score": "0.48975298", "text": "func MountUnit(u *unit.Unit) func(*Graph) (interface{}, error) {\n\treturn func(g *Graph) (interface{}, error) {\n\t\treturn nil, g.Mount(u)\n\t}\n}", "title": "" }, { "docid": "05c58d679aae58e9d6039eef3dd9e7d8", "score": "0.4816154", "text": "func PostUnit(res http.ResponseWriter, req *http.Request) {\n\ttranslation.FieldsRequestLanguageCode = req.Header.Get(\"Content-Language\")\n\tunit := &tree.Unit{}\n\tresp := response.New()\n\n\tif err := resp.Parse(req, unit); err != nil {\n\t\tresp.NewError(\"PostUnit response load\", err)\n\t\tresp.Render(res, req)\n\t\treturn\n\t}\n\n\tunit.TreeCode = chi.URLParam(req, \"tree_code\")\n\n\ttrs, err := db.NewTransaction()\n\tif err != nil {\n\t\tresp.NewError(\"PostUnit user new transaction\", err)\n\t\tresp.Render(res, req)\n\t\treturn\n\t}\n\n\ttranslation.FieldsRequestLanguageCode = \"all\"\n\tif err := unit.Create(trs); err != nil {\n\t\ttrs.Rollback()\n\t\tresp.NewError(\"PostUnit\", err)\n\t\tresp.Render(res, req)\n\t\treturn\n\t}\n\ttrs.Commit()\n\n\tresp.Data = unit\n\tresp.Render(res, req)\n}", "title": "" }, { "docid": "163e82a825aa0a2050e3623f14eef35d", "score": "0.4774182", "text": "func WriteNetString(w io.Writer, data []byte) (written int, err error) {\n\tsize := make([]byte, 4)\n\tbinary.BigEndian.PutUint32(size, uint32(len(data)))\n\tif written, err = w.Write(size); err != nil {\n\t\treturn\n\t}\n\treturn w.Write(data)\n}", "title": "" }, { "docid": "4ae5bcda0e04a321eb67e713b90dc1d8", "score": "0.47147927", "text": "func RunDropletCreate(ns string, out io.Writer) error {\n\tclient := doit.DoitConfig.GetGodoClient()\n\n\tsshKeys := []godo.DropletCreateSSHKey{}\n\tfor _, rawKey := range doit.DoitConfig.GetStringSlice(ns, doit.ArgSSHKeys) {\n\t\trawKey = strings.TrimPrefix(rawKey, \"[\")\n\t\trawKey = strings.TrimSuffix(rawKey, \"]\")\n\t\tif i, err := strconv.Atoi(rawKey); err == nil {\n\t\t\tsshKeys = append(sshKeys, godo.DropletCreateSSHKey{ID: i})\n\t\t\tcontinue\n\t\t}\n\n\t\tsshKeys = append(sshKeys, godo.DropletCreateSSHKey{Fingerprint: rawKey})\n\t}\n\n\tuserData := doit.DoitConfig.GetString(ns, doit.ArgUserData)\n\tif userData == \"\" && doit.DoitConfig.GetString(ns, doit.ArgUserDataFile) != \"\" {\n\t\tdata, err := ioutil.ReadFile(doit.DoitConfig.GetString(ns, doit.ArgUserDataFile))\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tuserData = string(data)\n\t}\n\n\twait := doit.DoitConfig.GetBool(ns, doit.ArgDropletWait)\n\n\tdcr := &godo.DropletCreateRequest{\n\t\tName: doit.DoitConfig.GetString(ns, doit.ArgDropletName),\n\t\tRegion: doit.DoitConfig.GetString(ns, doit.ArgRegionSlug),\n\t\tSize: doit.DoitConfig.GetString(ns, doit.ArgSizeSlug),\n\t\tBackups: doit.DoitConfig.GetBool(ns, doit.ArgBackups),\n\t\tIPv6: doit.DoitConfig.GetBool(ns, doit.ArgIPv6),\n\t\tPrivateNetworking: doit.DoitConfig.GetBool(ns, doit.ArgPrivateNetworking),\n\t\tSSHKeys: sshKeys,\n\t\tUserData: userData,\n\t}\n\n\timageStr := doit.DoitConfig.GetString(ns, doit.ArgImage)\n\tif i, err := strconv.Atoi(imageStr); err == nil {\n\t\tdcr.Image = godo.DropletCreateImage{ID: i}\n\t} else {\n\t\tdcr.Image = godo.DropletCreateImage{Slug: imageStr}\n\t}\n\n\tr, resp, err := client.Droplets.Create(dcr)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tvar action *godo.LinkAction\n\n\tif wait {\n\t\tfor _, a := range resp.Links.Actions {\n\t\t\tif a.Rel == \"create\" {\n\t\t\t\taction = &a\n\t\t\t}\n\t\t}\n\t}\n\n\tif action != nil {\n\t\terr = util.WaitForActive(client, action.HREF)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\tr, err = getDropletByID(client, r.ID)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\treturn doit.DisplayOutput(r, out)\n}", "title": "" }, { "docid": "40e8b873f8846bc37cd5f8ee41958a24", "score": "0.47084984", "text": "func WriteAndExecuteUnitTest(file string) error {\n\t// walk filepath\n\terr := filepath.Walk(file, func(path string, info os.FileInfo, err error) error {\n\t\t// check if open file failed\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\t// check if path is empty\n\t\tif path == \"\" {\n\t\t\treturn nil\n\t\t}\n\t\t// check if is dir\n\t\tif !info.IsDir() {\n\t\t\treturn nil\n\t\t}\n\t\t// get interface map\n\t\tinterfacesMap, busObjects, err := GetInterfaces(path)\n\t\tif err != nil {\n\t\t\tlog.Println(\"get interface map failed, err: \", err)\n\t\t\treturn err\n\t\t}\n\n\t\t// check if interface map dont has instance implement interface method\n\t\tif len(interfacesMap) == 0 {\n\t\t\tlog.Println(path, \" interface is empty\")\n\t\t\treturn nil\n\t\t}\n\n\t\t// unique slice\n\t\tfor key, value := range interfacesMap {\n\t\t\tinterfacesMap[key] = UniqueSlice(value)\n\t\t}\n\n\t\tif writeGo {\n\t\t\tfor pkg, busObject := range busObjects {\n\t\t\t\tsf := gofile.NewSourceFile(pkg)\n\n\t\t\t\tsf.AddGoImport(\"errors\")\n\t\t\t\tsf.AddGoImport(\"fmt\")\n\t\t\t\tsf.AddGoImport(\"unsafe\")\n\t\t\t\tsf.AddGoImport(\"github.com/godbus/dbus\")\n\t\t\t\tsf.AddGoImport(\"pkg.deepin.io/lib/dbusutil\")\n\t\t\t\tsf.AddGoImport(\"pkg.deepin.io/lib/dbusutil/proxy\")\n\n\t\t\t\tsf.GoBody.Pn(\"/* prevent compile error */\")\n\t\t\t\tsf.GoBody.Pn(\"var _ = errors.New\")\n\t\t\t\tsf.GoBody.Pn(\"var _ dbusutil.SignalHandlerId\")\n\t\t\t\tsf.GoBody.Pn(\"var _ = fmt.Sprintf\")\n\t\t\t\tsf.GoBody.Pn(\"var _ unsafe.Pointer\")\n\t\t\t\tsf.GoBody.Pn(\"\")\n\n\t\t\t\tsf.GoBody.WriteDBusObjects(busObject)\n\t\t\t\t_ = sf.Print()\n\t\t\t}\n\t\t}\n\n\t\tif writeXml {\n\t\t\t// create xml file\n\t\t\tfor pkg, interfaces := range interfacesMap {\n\t\t\t\t// check if package is empty or instances is nil\n\t\t\t\tif pkg == \"\" || len(interfaces) == 0 {\n\t\t\t\t\tcontinue\n\t\t\t\t}\n\t\t\t\t// get replace text\n\t\t\t\treplaceText := FormatImplementers(interfaces)\n\t\t\t\t// target file path\n\t\t\t\t// replace instance in module\n\t\t\t\tresultText := ReplaceText(ModuleStr, replaceInterface, replaceText)\n\t\t\t\ttargetPath := fmt.Sprintf(path+\"/\"+writeTestFileName, pkg)\n\t\t\t\t// replace package in target path\n\t\t\t\tresultText = ReplaceText(resultText, replacePackage, \"package \"+pkg)\n\t\t\t\tfObj, err := os.Create(targetPath)\n\t\t\t\tif err != nil {\n\t\t\t\t\tlog.Println(\"open or create target file failed, err: \", err)\n\t\t\t\t\tcontinue\n\t\t\t\t}\n\t\t\t\t// write string to file\n\t\t\t\t_, err = fObj.WriteString(resultText)\n\t\t\t\tif err != nil {\n\t\t\t\t\tlog.Println(\"write string to file failed, err: \", err)\n\t\t\t\t\tcontinue\n\t\t\t\t}\n\t\t\t\t// check if need update file, if not, dont need to create unit test file\n\t\t\t\terr = ExecuteUnitTest(path)\n\t\t\t\tif err != nil {\n\t\t\t\t\tlog.Println(\"execute unit test failed, err: \", err)\n\t\t\t\t\tcontinue\n\t\t\t\t}\n\t\t\t\tif err := os.Remove(targetPath); err != nil {\n\t\t\t\t\tlog.Println(\"remove file failed, err: \", err)\n\t\t\t\t\treturn err\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\treturn nil\n\t})\n\treturn err\n}", "title": "" }, { "docid": "72ad73c52a2562f73bf334b9ecd7eca6", "score": "0.46719065", "text": "func EncodeUnit(unit gomel.Preunit) ([]byte, error) {\n\tvar buf bytes.Buffer\n\tencoder := newEncoder(&buf)\n\terr := encoder.encodeUnit(unit)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn buf.Bytes(), nil\n}", "title": "" }, { "docid": "bce854deee208942c46347fc6332c58a", "score": "0.4510634", "text": "func createDropin(appUnitName string, p Process) *UnitFile {\n\tdepFile := &UnitFile{}\n\n\t// Create top level dependency\n\tif len(appUnitName) != 0 {\n\t\tdepFile.Options = append(depFile.Options, unit.NewUnitOption(\"Install\", \"WantedBy\", appUnitName))\n\t\tdepFile.Options = append(depFile.Options, unit.NewUnitOption(\"Unit\", \"PartOf\", appUnitName))\n\t}\n\n\t// Create the correct order/require string\n\tdepString := appUnitName\n\tdepString = depString + \" \" + strings.Join(p.Dependencies, \".service \") + \".service\"\n\n\t// Add all requirements to the unit file (if exists)\n\tif len(depString) != 0 {\n\t\tdepFile.Options = append(depFile.Options, unit.NewUnitOption(\"Unit\", \"Wants\", depString))\n\t\tdepFile.Options = append(depFile.Options, unit.NewUnitOption(\"Unit\", \"After\", depString))\n\t}\n\n\treturn depFile\n}", "title": "" }, { "docid": "b0cd595e21b28a8bfcfc6fc501a69f2b", "score": "0.45097643", "text": "func (e *Correction) writeOutputUnitDetach(g Game) {\n\tg.Writer().Write(OutputUnitDetach{\n\t\tUnitID: e.Object().ID(),\n\t\tAttachmentName: e.name,\n\t})\n}", "title": "" }, { "docid": "d9a6fecdd0943a3ba46a6ca00c123f75", "score": "0.45069045", "text": "func (ou *ObservationUnit) tellSimulationUnitDead() {\n\turl := fmt.Sprintf(\"http://localhost:%s/removeReachableOu\", SimPort)\n\t//fmt.Printf(\"(%s): Sending 'I'm dead..' to url: %s \\n\", ou.Addr, url)\n\n\tb, err := json.Marshal(ou)\n\tif err != nil {\n\t\tfmt.Println(err)\n\t\treturn\n\t}\n\n\taddressBody := strings.NewReader(string(b))\n\tou.Sends++\n\t_, err = http.Post(url, \"string\", addressBody)\n\tErrorMsg(\"Post request dead OU: \", err)\n}", "title": "" }, { "docid": "6b3b6fda43d79adb04ac53a1b1238d93", "score": "0.44896594", "text": "func (c *Crossing) AddUnit(i string) {\n\tc.Unit = i\n}", "title": "" }, { "docid": "51cfbd8e2d8cc7ac835b5add82014b7d", "score": "0.44812536", "text": "func CreateNetworkSpec(spec NetworkSpec) error {\n\tfuncMap := template.FuncMap{\n\t\t\"ToLower\": strings.ToLower,\n\t\t\"PortInc\": func(port, index int) string {\n\t\t\tp := port + index*10\n\t\t\treturn strconv.Itoa(p)\n\t\t},\n\t}\n\n\ttpl := template.Must(template.New(\"Main\").Funcs(funcMap).Parse(networkSpec))\n\tnetworkSpecYML := filepath.Join(spec.NetworkPath, \"network-config.yaml\")\n\tf, err := os.Create(networkSpecYML)\n\tif err != nil {\n\t\treturn err\n\t}\n\terr = tpl.Execute(f, spec)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "52065fbfa17cd1f7608a3b988a1944eb", "score": "0.44333655", "text": "func CreateUnit(class *Class, level int, loc Point) *Unit {\n\treturn &Unit{\n\t\tClassName: class.Name,\n\t\tTotalCost: class.InitialCost + class.LevelCost*level,\n\t\tUUID: uuid.NewV4().String(),\n\t\tHP: rollStat(class.BaseHP, class.HPGrowth, class.HPCap, level),\n\t\tAttack: rollStat(class.BaseAttack, class.AttackGrowth, class.AttackCap, level),\n\t\tDefense: rollStat(class.BaseDefense, class.DefenseGrowth, class.DefenseCap, level),\n\t\tHit: rollStat(class.BaseHit, class.HitGrowth, class.HitCap, level),\n\t\tDodge: rollStat(class.BaseDodge, class.DodgeGrowth, class.DodgeCap, level),\n\t\tCrit: rollStat(class.BaseCrit, class.CritGrowth, class.CritCap, level),\n\t\tMinAttackRange: class.MinAttackRange,\n\t\tMaxAttackRange: class.MaxAttackRange,\n\t\tMove: class.Move,\n\t\tCoordinate: loc,\n\t}\n}", "title": "" }, { "docid": "4b65ac133dbb3d8ebb934362f0a9a6fd", "score": "0.4388271", "text": "func GenerateNetworkNodeUsage(filename, header string, p *packages.Package) error {\n\treceiver := \"p\"\n\n\tmethods := method.Set{\n\t\t\"SetNetworkNodeReference\": method.NewSetRootNetworkNodeReference(receiver, RuntimeImport),\n\t\t\"GetNetworkNodeReference\": method.NewGetRootNetworkNodeReference(receiver, RuntimeImport),\n\t\t\"SetResourceReference\": method.NewSetRootResourceReference(receiver, RuntimeImport),\n\t\t\"GetResourceReference\": method.NewGetRootResourceReference(receiver, RuntimeImport),\n\t}\n\n\terr := generate.WriteMethods(p, methods, filepath.Join(filepath.Dir(p.GoFiles[0]), filename),\n\t\tgenerate.WithHeaders(header),\n\t\tgenerate.WithImportAliases(map[string]string{RuntimeImport: RuntimeAlias}),\n\t\tgenerate.WithMatcher(match.AllOf(\n\t\t\tmatch.NetworkNodeUsage(),\n\t\t\tmatch.DoesNotHaveMarker(comments.In(p), DisableMarker, \"false\")),\n\t\t),\n\t)\n\n\treturn errors.Wrap(err, errWriteNetworkNodeUsageMethod)\n}", "title": "" }, { "docid": "a28c31eac7da34d99ef3185f057e40e9", "score": "0.43773064", "text": "func buildNetworks(networks []string) []byte {\n\tn := `networks:\n proxy:\n`\n\n\tfor _, v := range networks {\n\t\tif v == \"proxy\" {\n\t\t\tcontinue\n\t\t}\n\n\t\t// Verify that this network still exists in Docker\n\t\tok, err := validateNetwork(v)\n\t\tif err != nil {\n\t\t\tlog.Fatal(err)\n\t\t}\n\t\tif !ok {\n\t\t\t// That network no longer exists, don't add it\n\t\t\tutils.DebugString(\"network [\" + v + \"] no longer exists, not adding it to proxy service\")\n\t\t\tcontinue\n\t\t}\n\n\t\tn = n + ` ` + strings.Replace(v, \".\", \"\", -1) + `:\n external: true\n`\n\t}\n\n\treturn []byte(n)\n}", "title": "" }, { "docid": "8ca150c5c24eaeb624c27283058ca272", "score": "0.4371516", "text": "func (d *Distance) AddUnit(s string) {\n\td.Unit = s\n}", "title": "" }, { "docid": "a98e4e07670229ab53a543be552307ed", "score": "0.4369489", "text": "func CreateNetworkWithMTU(t *testing.T, client *gophercloud.ServiceClient, networkMTU *int) (*NetworkMTU, error) {\n\tnetworkName := tools.RandomString(\"TESTACC-\", 8)\n\tnetworkDescription := tools.RandomString(\"TESTACC-DESC-\", 8)\n\n\tt.Logf(\"Attempting to create a network with custom MTU: %s\", networkName)\n\n\tadminStateUp := true\n\n\tvar createOpts networks.CreateOptsBuilder\n\tcreateOpts = networks.CreateOpts{\n\t\tName: networkName,\n\t\tDescription: networkDescription,\n\t\tAdminStateUp: &adminStateUp,\n\t}\n\n\tif *networkMTU > 0 {\n\t\tcreateOpts = mtu.CreateOptsExt{\n\t\t\tCreateOptsBuilder: createOpts,\n\t\t\tMTU: *networkMTU,\n\t\t}\n\t}\n\n\tvar network NetworkMTU\n\n\terr := networks.Create(client, createOpts).ExtractInto(&network)\n\tif err != nil {\n\t\treturn &network, err\n\t}\n\n\tt.Logf(\"Created a network with custom MTU: %s\", networkName)\n\n\tth.AssertEquals(t, network.Name, networkName)\n\tth.AssertEquals(t, network.Description, networkDescription)\n\tth.AssertEquals(t, network.AdminStateUp, adminStateUp)\n\tif *networkMTU > 0 {\n\t\tth.AssertEquals(t, network.MTU, *networkMTU)\n\t} else {\n\t\t*networkMTU = network.MTU\n\t}\n\n\treturn &network, nil\n}", "title": "" }, { "docid": "01c61223e2870608af5b73298cd6e670", "score": "0.43584323", "text": "func (e *ensurer) EnsureAdditionalUnits(ctx context.Context, gctx gcontext.GardenContext, new, _ *[]extensionsv1alpha1.Unit) error {\n\tvar (\n\t\tcommand = \"start\"\n\t\ttrueVar = true\n\t\tcustomMTUUnitContent = `[Unit]\nDescription=Apply a custom MTU to network interfaces\nAfter=network.target\nWants=network.target\n\n[Install]\nWantedBy=kubelet.service\n\n[Service]\nType=oneshot\nRemainAfterExit=yes\nExecStart=/opt/bin/mtu-customizer.sh\n`\n\t)\n\n\textensionswebhook.AppendUniqueUnit(new, extensionsv1alpha1.Unit{\n\t\tName: \"custom-mtu.service\",\n\t\tEnable: &trueVar,\n\t\tCommand: &command,\n\t\tContent: &customMTUUnitContent,\n\t})\n\treturn nil\n}", "title": "" }, { "docid": "2d353a99cf91433504ed3b9df74bd739", "score": "0.43563133", "text": "func (e *Correction) writeOutputUnitAttach(g Game) {\n\tg.Writer().Write(OutputUnitAttach{\n\t\tUnitID: e.Object().ID(),\n\t\tAttachmentName: e.name,\n\t\tStack: e.stack,\n\t\tExpirationTime: e.expirationTime,\n\t})\n}", "title": "" }, { "docid": "4d55999d5e327b6f3c32ec704ff2ca70", "score": "0.43537465", "text": "func GenerateNetworkNode(filename, header string, p *packages.Package) error {\n\treceiver := \"p\"\n\n\tmethods := method.Set{\n\t\t\"SetUsers\": method.NewSetUsers(receiver),\n\t\t\"GetUsers\": method.NewGetUsers(receiver),\n\t\t\"SetConditions\": method.NewSetConditions(receiver, RuntimeImport),\n\t\t\"GetCondition\": method.NewGetCondition(receiver, RuntimeImport),\n\t}\n\n\terr := generate.WriteMethods(p, methods, filepath.Join(filepath.Dir(p.GoFiles[0]), filename),\n\t\tgenerate.WithHeaders(header),\n\t\tgenerate.WithImportAliases(map[string]string{RuntimeImport: RuntimeAlias}),\n\t\tgenerate.WithMatcher(match.AllOf(\n\t\t\tmatch.NetworkNode(),\n\t\t\tmatch.DoesNotHaveMarker(comments.In(p), DisableMarker, \"false\")),\n\t\t),\n\t)\n\n\treturn errors.Wrap(err, errWriteNetworkNodeMethod)\n}", "title": "" }, { "docid": "cb57c62d66f95c46997663f64229b921", "score": "0.4347833", "text": "func NewUnit(u string) Unit {\n\treturn &u\n}", "title": "" }, { "docid": "4e6ee9af73e0bf1d7f4212533fe1f1f1", "score": "0.4332052", "text": "func (d Dimless) Unit() *Unit {\n\treturn New(float64(d), Dimensions{})\n}", "title": "" }, { "docid": "f852d4cb5ecebad4eb8b228d3a639a2a", "score": "0.4319918", "text": "func (a *Altitude) AddUnit(s string) {\n\ta.Unit = s\n}", "title": "" }, { "docid": "33eaf4d63b877962ff360b3fc607360c", "score": "0.4312691", "text": "func (ou *ObservationUnit) tellSimulationUnit() {\n\turl := fmt.Sprintf(\"http://localhost:%s/notifySimulation\", SimPort)\n\t//fmt.Printf(\"(%s): Sending to url: %s.\\n\", ou.Addr, url)\n\n\tb, err := json.Marshal(ou)\n\tif err != nil {\n\t\tfmt.Println(err)\n\t\treturn\n\t}\n\n\taddressBody := strings.NewReader(string(b))\n\tou.Sends++\n\tres, err := http.Post(url, \"bytes\", addressBody)\n\tErrorMsg(\"POST request to Simulation failed: \", err)\n\tio.Copy(os.Stdout, res.Body)\n}", "title": "" }, { "docid": "8e96b6a279a8e27637140cced6ecf528", "score": "0.43090877", "text": "func create_network(ip, subnet, gateway, networkName string) error {\n\tcommand := \"docker\"\n\targs := fmt.Sprint(\"network create \",\n\t\t\"--opt=com.docker.network.bridge.enable_icc=true \",\n\t\t\"--opt=com.docker.network.bridge.enable_ip_masquerade=false \",\n\t\t\"--opt=com.docker.network.bridge.host_binding_ipv4=0.0.0.0 \",\n\t\t\"--opt=com.docker.network.bridge.name=br0 \",\n\t\t\"--opt=com.docker.network.driver.mtu=1500 \",\n\t\t\"--ipam-driver=jdjr \",\n\t\t\"--subnet=%s \",\n\t\t\"--gateway=%s \",\n\t\t\"--aux-address=DefaultGatewayIPv4=%s \",\n\t\t\"%s\")\n\n\targs = fmt.Sprintf(args, subnet, ip, gateway, networkName)\n\n\tvar out []byte\n\tout, err := exec.Command(command, strings.Split(args, \" \")...).CombinedOutput()\n\tif err != nil {\n\t\tlog.Fatal(err, string(out))\n\t\treturn err\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "40a15971cdf5b42ee456c237daf6c086", "score": "0.43079835", "text": "func (sc *SnowthClient) WriteNNT(node *SnowthNode, data ...NNTData) (err error) {\n\tbuf := new(bytes.Buffer)\n\tenc := json.NewEncoder(buf)\n\tif err := enc.Encode(data); err != nil {\n\t\treturn errors.Wrap(err, \"failed to encode NNTData for write\")\n\t}\n\terr = sc.do(node, \"POST\", \"/write/nnt\", buf, nil, nil)\n\treturn\n}", "title": "" }, { "docid": "1b2c8bda36963b0cc47de22a0e161d45", "score": "0.43070182", "text": "func TestNodeSetUnitTestSuite(t *testing.T) {\n\tsuite.Run(t, new(nodeSetSuite))\n}", "title": "" }, { "docid": "55979b57864658e9b517d904ed355884", "score": "0.42940557", "text": "func newUDSWriter(_ string, _ time.Duration) (io.WriteCloser, error) {\n\treturn nil, fmt.Errorf(\"Unix socket is not available on Windows\")\n}", "title": "" }, { "docid": "f68f4e335c137705e02f9c20e47ec43d", "score": "0.42894453", "text": "func (a *Client) PostPrivateNetwork(params *PostPrivateNetworkParams) (*PostPrivateNetworkOK, error) {\n\t// TODO: Validate the params before sending\n\tif params == nil {\n\t\tparams = NewPostPrivateNetworkParams()\n\t}\n\n\tresult, err := a.transport.Submit(&runtime.ClientOperation{\n\t\tID: \"postPrivateNetwork\",\n\t\tMethod: \"POST\",\n\t\tPathPattern: \"/v1/networks/user\",\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: &PostPrivateNetworkReader{formats: a.formats},\n\t\tContext: params.Context,\n\t\tClient: params.HTTPClient,\n\t})\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn result.(*PostPrivateNetworkOK), nil\n\n}", "title": "" }, { "docid": "88668e798f1e9b631722b9b1014e7b59", "score": "0.42875126", "text": "func HasUnit() predicate.Drug {\n\treturn predicate.Drug(func(s *sql.Selector) {\n\t\tstep := sqlgraph.NewStep(\n\t\t\tsqlgraph.From(Table, FieldID),\n\t\t\tsqlgraph.To(UnitTable, FieldID),\n\t\t\tsqlgraph.Edge(sqlgraph.M2O, true, UnitTable, UnitColumn),\n\t\t)\n\t\tsqlgraph.HasNeighbors(s, step)\n\t})\n}", "title": "" }, { "docid": "29064c96403406dbf208d610b26f00fd", "score": "0.42738396", "text": "func (p *parser) addUnitNode(node *regexNode) {\n\tp.unit = node\n}", "title": "" }, { "docid": "3fbe9daa34f00a1d6c78b5910f91eab6", "score": "0.42696342", "text": "func (in *Unit) DeepCopy() *Unit {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(Unit)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "d9268f4b15c7ae86ce4b9e6a54205ebd", "score": "0.42609614", "text": "func (t *TunInterfaceNetworkLayer) Write(buf []byte) error {\n\tpkt := NewPacket()\n\tpkt.FillPayload(buf)\n\n\t// Sanity check Packet payload and write out\n\t_, err := t.fd.Write(pkt.Bytes())\n\tif err != nil {\n\t\treturn err\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "28c65ac5e6df3adef15059b1d0d8336b", "score": "0.42521957", "text": "func (f *FakeNetworkStore) InternalAddNetwork(id string, network *dockerTypes.NetworkResource) {\n\tf.networks[id] = network\n\tf.networksByName[network.Name] = id\n}", "title": "" }, { "docid": "33dcb5bf5d1c0dbaa0479a96798ec99f", "score": "0.42478842", "text": "func (s *stage) createUnits(config types.Config) error {\n\tpresets := make(map[string]*Preset)\n\tfor _, unit := range config.Systemd.Units {\n\t\tif err := s.writeSystemdUnit(unit); err != nil {\n\t\t\treturn err\n\t\t}\n\t\tif unit.Enabled != nil {\n\t\t\t// identifier keyword is used to distinguish systemd units\n\t\t\t// which are either enabled or disabled. Appending\n\t\t\t// it to a unitName will avoid overwriting the existing\n\t\t\t// unitName's instance if the state of the unit is different.\n\t\t\tidentifier := \"disabled\"\n\t\t\tif *unit.Enabled {\n\t\t\t\tidentifier = \"enabled\"\n\t\t\t}\n\t\t\tif strings.Contains(unit.Name, \"@\") {\n\t\t\t\tunitName, instance, err := parseInstanceUnit(unit)\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn err\n\t\t\t\t}\n\t\t\t\tkey := fmt.Sprintf(\"%s-%s\", unitName, identifier)\n\t\t\t\tif _, ok := presets[key]; ok {\n\t\t\t\t\tpresets[key].instances = append(presets[key].instances, instance)\n\t\t\t\t} else {\n\t\t\t\t\tpresets[key] = &Preset{unitName, *unit.Enabled, true, []string{instance}}\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tkey := fmt.Sprintf(\"%s-%s\", unit.Name, identifier)\n\t\t\t\tif _, ok := presets[unit.Name]; !ok {\n\t\t\t\t\tpresets[key] = &Preset{unit.Name, *unit.Enabled, false, []string{}}\n\t\t\t\t} else {\n\t\t\t\t\treturn fmt.Errorf(\"%q key is already present in the presets map\", key)\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tif unit.Mask != nil {\n\t\t\tif *unit.Mask { // mask: true\n\t\t\t\trelabelpath := \"\"\n\t\t\t\tif err := s.Logger.LogOp(\n\t\t\t\t\tfunc() error {\n\t\t\t\t\t\tvar err error\n\t\t\t\t\t\trelabelpath, err = s.MaskUnit(unit)\n\t\t\t\t\t\treturn err\n\t\t\t\t\t},\n\t\t\t\t\t\"masking unit %q\", unit.Name,\n\t\t\t\t); err != nil {\n\t\t\t\t\treturn err\n\t\t\t\t}\n\t\t\t\ts.relabel(relabelpath)\n\t\t\t} else { // mask: false\n\t\t\t\tmasked, err := s.IsUnitMasked(unit)\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn err\n\t\t\t\t}\n\t\t\t\tif masked {\n\t\t\t\t\tif err := s.Logger.LogOp(\n\t\t\t\t\t\tfunc() error {\n\t\t\t\t\t\t\treturn s.UnmaskUnit(unit)\n\t\t\t\t\t\t},\n\t\t\t\t\t\t\"unmasking unit %q\", unit.Name,\n\t\t\t\t\t); err != nil {\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\t}\n\t}\n\t// if we have presets then create the systemd preset file.\n\tif len(presets) != 0 {\n\t\tif err := s.createSystemdPresetFile(presets); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "ff4eb4f87bf93d2abf204267f86bea29", "score": "0.42395046", "text": "func (m *TeamworkNetworkConfiguration) Serialize(writer i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.SerializationWriter)(error) {\n {\n err := writer.WriteStringValue(\"defaultGateway\", m.GetDefaultGateway())\n if err != nil {\n return err\n }\n }\n {\n err := writer.WriteStringValue(\"domainName\", m.GetDomainName())\n if err != nil {\n return err\n }\n }\n {\n err := writer.WriteStringValue(\"hostName\", m.GetHostName())\n if err != nil {\n return err\n }\n }\n {\n err := writer.WriteStringValue(\"ipAddress\", m.GetIpAddress())\n if err != nil {\n return err\n }\n }\n {\n err := writer.WriteBoolValue(\"isDhcpEnabled\", m.GetIsDhcpEnabled())\n if err != nil {\n return err\n }\n }\n {\n err := writer.WriteBoolValue(\"isPCPortEnabled\", m.GetIsPCPortEnabled())\n if err != nil {\n return err\n }\n }\n {\n err := writer.WriteStringValue(\"@odata.type\", m.GetOdataType())\n if err != nil {\n return err\n }\n }\n {\n err := writer.WriteStringValue(\"primaryDns\", m.GetPrimaryDns())\n if err != nil {\n return err\n }\n }\n {\n err := writer.WriteStringValue(\"secondaryDns\", m.GetSecondaryDns())\n if err != nil {\n return err\n }\n }\n {\n err := writer.WriteStringValue(\"subnetMask\", m.GetSubnetMask())\n if err != nil {\n return err\n }\n }\n {\n err := writer.WriteAdditionalData(m.GetAdditionalData())\n if err != nil {\n return err\n }\n }\n return nil\n}", "title": "" }, { "docid": "af0f58e26a5ad2aa9670b14ce355f727", "score": "0.42370015", "text": "func (d DataCenter) WriteTree(output string) {\n\tif output == \"json\" {\n\t\tjsonBytes, _ := json.MarshalIndent(d, \"\", \" \")\n\t\tfmt.Println(string(jsonBytes))\n\t} else {\n\t\tfmt.Println(d.Name)\n\t\tfor _, floor := range *d.Floors {\n\t\t\tfmt.Printf(\" %-v\\n\", floor.Name)\n\t\t\tfor _, hall := range floor.Halls {\n\t\t\t\tfmt.Printf(\" %-v\\n\", hall.Name)\n\t\t\t\tfor _, row := range hall.RackRows {\n\t\t\t\t\tfmt.Printf(\" %-v:\", row.Name)\n\t\t\t\t\tfor _, rack := range row.Racks {\n\t\t\t\t\t\tfmt.Printf(\" %v\", rack.Name)\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}", "title": "" }, { "docid": "54acb8bc0f7acefe3a6c791607e8bdc8", "score": "0.4229578", "text": "func WriteChunk(units []gomel.Unit, w io.Writer) error {\n\treturn newEncoder(w).encodeChunk(units)\n}", "title": "" }, { "docid": "7e4f31d28286d6840abb53c678eacb50", "score": "0.4225972", "text": "func (c *Client) CreateMeasuredUnit(body *MeasuredUnitCreate) (*MeasuredUnit, error) {\n\tpath := c.InterpolatePath(\"/measured_units\")\n\tresult := &MeasuredUnit{}\n\terr := c.Call(http.MethodPost, path, body, result)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn result, err\n}", "title": "" }, { "docid": "1effd4f508a2420f253bfa81ba86b3fe", "score": "0.4203431", "text": "func (f *fakeDatapath) WriteNetdevConfig(io.Writer, datapath.DeviceConfiguration) error {\n\treturn nil\n}", "title": "" }, { "docid": "206790a5b4a7257c16633cfb50764105", "score": "0.42015836", "text": "func (u *UnitType) String() string { return \"unit\" }", "title": "" }, { "docid": "3776a968b2c73c9f39f5eec8f1e895f7", "score": "0.41923162", "text": "func (h *Heading) AddUnit(i string) {\n\th.Unit = i\n}", "title": "" }, { "docid": "58b6b2e28e0e9850c9b62552c95902ba", "score": "0.41903716", "text": "func (ws *WorkloadState) createNetwork(netName string, extVlan uint32) error {\n\tws.stateMgr.networkKindLock.Lock()\n\tdefer ws.stateMgr.networkKindLock.Unlock()\n\n\tnwt := network.Network{\n\t\tTypeMeta: api.TypeMeta{Kind: \"Network\"},\n\t\tObjectMeta: api.ObjectMeta{\n\t\t\tName: netName,\n\t\t\tNamespace: ws.Workload.Namespace,\n\t\t\tTenant: ws.Workload.Tenant,\n\t\t\tLabels: map[string]string{},\n\t\t},\n\t\tSpec: network.NetworkSpec{\n\t\t\tType: network.NetworkType_Bridged.String(),\n\t\t\tIPv4Subnet: \"\",\n\t\t\tIPv4Gateway: \"\",\n\t\t\tVlanID: extVlan,\n\t\t},\n\t\tStatus: network.NetworkStatus{\n\t\t\t// set operState to active as internal(as opposed to user) create runs checks on status as well\n\t\t\t// this will be changed by npm correctly when processing the watch event\n\t\t\t// OperState: network.OperState_Active.String(),\n\t\t},\n\t}\n\tpnwt := &nwt\n\tif !isOrchHubKeyPresent(ws.Workload.Labels) {\n\t\tAddNpmSystemLabel(pnwt.Labels)\n\t}\n\n\t// create it in apiserver\n\treturn ws.stateMgr.ctrler.Network().Create(&nwt)\n}", "title": "" }, { "docid": "1f0b8a0e2e9d3a27ebf2a742751f16a4", "score": "0.41612083", "text": "func appendUniqueUnit(units *[]extensionsv1alpha1.Unit, unit extensionsv1alpha1.Unit) {\n\tresFiles := make([]extensionsv1alpha1.Unit, 0, len(*units))\n\n\tfor _, f := range *units {\n\t\tif f.Name != unit.Name {\n\t\t\tresFiles = append(resFiles, f)\n\t\t}\n\t}\n\n\t*units = append(resFiles, unit)\n}", "title": "" }, { "docid": "24de896e88379fa7459f4b00dc2af27b", "score": "0.41607392", "text": "func (s *Suite) TestTrivialWorkUnitFlow(c *check.C) {\n\tvar (\n\t\tcount int\n\t\terr error\n\t\tspec coordinate.WorkSpec\n\t\tunit coordinate.WorkUnit\n\t\tunits map[string]coordinate.WorkUnit\n\t)\n\n\tspec, err = s.Namespace.SetWorkSpec(map[string]interface{}{\n\t\t\"name\": \"spec\",\n\t\t\"min_gb\": 1,\n\t})\n\tc.Assert(err, check.IsNil)\n\n\tunit, err = spec.AddWorkUnit(\"unit\", map[string]interface{}{}, 0)\n\tc.Assert(err, check.IsNil)\n\tc.Check(unit.Name(), check.Equals, \"unit\")\n\tc.Check(unit.WorkSpec().Name(), check.Equals, \"spec\")\n\n\tunit, err = spec.WorkUnit(\"unit\")\n\tc.Assert(err, check.IsNil)\n\tc.Check(unit.Name(), check.Equals, \"unit\")\n\tc.Check(unit.WorkSpec().Name(), check.Equals, \"spec\")\n\n\tunits, err = spec.WorkUnits(coordinate.WorkUnitQuery{})\n\tc.Assert(err, check.IsNil)\n\tc.Check(units, check.HasLen, 1)\n\tc.Check(units[\"unit\"], check.NotNil)\n\tc.Check(units[\"unit\"].Name(), check.Equals, \"unit\")\n\tc.Check(units[\"unit\"].WorkSpec().Name(), check.Equals, \"spec\")\n\n\tcount, err = spec.DeleteWorkUnits(coordinate.WorkUnitQuery{})\n\tc.Assert(err, check.IsNil)\n\tc.Check(count, check.Equals, 1)\n\n\tunit, err = spec.WorkUnit(\"unit\")\n\tc.Assert(err, check.IsNil)\n\tc.Check(unit, check.IsNil)\n\n\tunits, err = spec.WorkUnits(coordinate.WorkUnitQuery{})\n\tc.Assert(err, check.IsNil)\n\tc.Check(units, check.HasLen, 0)\n}", "title": "" }, { "docid": "2b0b0c2e3dc11f2c9c5a846809de3cb8", "score": "0.41554517", "text": "func TestDockerDriver_MountsSerialization(t *testing.T) {\n\tci.Parallel(t)\n\ttestutil.DockerCompatible(t)\n\n\tallocDir := \"/tmp/nomad/alloc-dir\"\n\n\tcases := []struct {\n\t\tname string\n\t\trequiresVolumes bool\n\t\tpassedMounts []DockerMount\n\t\texpectedMounts []docker.HostMount\n\t}{\n\t\t{\n\t\t\tname: \"basic volume\",\n\t\t\trequiresVolumes: true,\n\t\t\tpassedMounts: []DockerMount{\n\t\t\t\t{\n\t\t\t\t\tTarget: \"/nomad\",\n\t\t\t\t\tReadOnly: true,\n\t\t\t\t\tSource: \"test\",\n\t\t\t\t},\n\t\t\t},\n\t\t\texpectedMounts: []docker.HostMount{\n\t\t\t\t{\n\t\t\t\t\tType: \"volume\",\n\t\t\t\t\tTarget: \"/nomad\",\n\t\t\t\t\tSource: \"test\",\n\t\t\t\t\tReadOnly: true,\n\t\t\t\t\tVolumeOptions: &docker.VolumeOptions{},\n\t\t\t\t},\n\t\t\t},\n\t\t},\n\t\t{\n\t\t\tname: \"basic bind\",\n\t\t\tpassedMounts: []DockerMount{\n\t\t\t\t{\n\t\t\t\t\tType: \"bind\",\n\t\t\t\t\tTarget: \"/nomad\",\n\t\t\t\t\tSource: \"test\",\n\t\t\t\t},\n\t\t\t},\n\t\t\texpectedMounts: []docker.HostMount{\n\t\t\t\t{\n\t\t\t\t\tType: \"bind\",\n\t\t\t\t\tTarget: \"/nomad\",\n\t\t\t\t\tSource: \"/tmp/nomad/alloc-dir/demo/test\",\n\t\t\t\t\tBindOptions: &docker.BindOptions{},\n\t\t\t\t},\n\t\t\t},\n\t\t},\n\t\t{\n\t\t\tname: \"basic absolute bind\",\n\t\t\trequiresVolumes: true,\n\t\t\tpassedMounts: []DockerMount{\n\t\t\t\t{\n\t\t\t\t\tType: \"bind\",\n\t\t\t\t\tTarget: \"/nomad\",\n\t\t\t\t\tSource: \"/tmp/test\",\n\t\t\t\t},\n\t\t\t},\n\t\t\texpectedMounts: []docker.HostMount{\n\t\t\t\t{\n\t\t\t\t\tType: \"bind\",\n\t\t\t\t\tTarget: \"/nomad\",\n\t\t\t\t\tSource: \"/tmp/test\",\n\t\t\t\t\tBindOptions: &docker.BindOptions{},\n\t\t\t\t},\n\t\t\t},\n\t\t},\n\t\t{\n\t\t\tname: \"bind relative outside\",\n\t\t\trequiresVolumes: true,\n\t\t\tpassedMounts: []DockerMount{\n\t\t\t\t{\n\t\t\t\t\tType: \"bind\",\n\t\t\t\t\tTarget: \"/nomad\",\n\t\t\t\t\tSource: \"../../test\",\n\t\t\t\t},\n\t\t\t},\n\t\t\texpectedMounts: []docker.HostMount{\n\t\t\t\t{\n\t\t\t\t\tType: \"bind\",\n\t\t\t\t\tTarget: \"/nomad\",\n\t\t\t\t\tSource: \"/tmp/nomad/test\",\n\t\t\t\t\tBindOptions: &docker.BindOptions{},\n\t\t\t\t},\n\t\t\t},\n\t\t},\n\t\t{\n\t\t\tname: \"basic tmpfs\",\n\t\t\trequiresVolumes: false,\n\t\t\tpassedMounts: []DockerMount{\n\t\t\t\t{\n\t\t\t\t\tType: \"tmpfs\",\n\t\t\t\t\tTarget: \"/nomad\",\n\t\t\t\t\tTmpfsOptions: DockerTmpfsOptions{\n\t\t\t\t\t\tSizeBytes: 321,\n\t\t\t\t\t\tMode: 0666,\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t},\n\t\t\texpectedMounts: []docker.HostMount{\n\t\t\t\t{\n\t\t\t\t\tType: \"tmpfs\",\n\t\t\t\t\tTarget: \"/nomad\",\n\t\t\t\t\tTempfsOptions: &docker.TempfsOptions{\n\t\t\t\t\t\tSizeBytes: 321,\n\t\t\t\t\t\tMode: 0666,\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t},\n\t\t},\n\t}\n\n\tt.Run(\"with volumes enabled\", func(t *testing.T) {\n\t\tdh := dockerDriverHarness(t, nil)\n\t\tdriver := dh.Impl().(*Driver)\n\t\tdriver.config.Volumes.Enabled = true\n\n\t\tfor _, c := range cases {\n\t\t\tt.Run(c.name, func(t *testing.T) {\n\t\t\t\ttask, cfg, ports := dockerTask(t)\n\t\t\t\tdefer freeport.Return(ports)\n\t\t\t\tcfg.Mounts = c.passedMounts\n\n\t\t\t\ttask.AllocDir = allocDir\n\t\t\t\ttask.Name = \"demo\"\n\n\t\t\t\trequire.NoError(t, task.EncodeConcreteDriverConfig(cfg))\n\n\t\t\t\tcc, err := driver.createContainerConfig(task, cfg, \"org/repo:0.1\")\n\t\t\t\trequire.NoError(t, err)\n\t\t\t\trequire.EqualValues(t, c.expectedMounts, cc.HostConfig.Mounts)\n\t\t\t})\n\t\t}\n\t})\n\n\tt.Run(\"with volumes disabled\", func(t *testing.T) {\n\t\tdh := dockerDriverHarness(t, nil)\n\t\tdriver := dh.Impl().(*Driver)\n\t\tdriver.config.Volumes.Enabled = false\n\n\t\tfor _, c := range cases {\n\t\t\tt.Run(c.name, func(t *testing.T) {\n\t\t\t\ttask, cfg, ports := dockerTask(t)\n\t\t\t\tdefer freeport.Return(ports)\n\t\t\t\tcfg.Mounts = c.passedMounts\n\n\t\t\t\ttask.AllocDir = allocDir\n\t\t\t\ttask.Name = \"demo\"\n\n\t\t\t\trequire.NoError(t, task.EncodeConcreteDriverConfig(cfg))\n\n\t\t\t\tcc, err := driver.createContainerConfig(task, cfg, \"org/repo:0.1\")\n\t\t\t\tif c.requiresVolumes {\n\t\t\t\t\trequire.Error(t, err, \"volumes are not enabled\")\n\t\t\t\t} else {\n\t\t\t\t\trequire.NoError(t, err)\n\t\t\t\t\trequire.EqualValues(t, c.expectedMounts, cc.HostConfig.Mounts)\n\t\t\t\t}\n\t\t\t})\n\t\t}\n\t})\n}", "title": "" }, { "docid": "806dcdedc40b67ff2d1161e5945715ae", "score": "0.41550517", "text": "func BenchmarkUDPWrite(b *testing.B) {\n\n\tsize := 140\n\n\tudpLocalAddr, err := net.ResolveUDPAddr(\"udp\", \"127.0.0.1:12345\")\n\tif err != nil {\n\t\tb.Fatal(\"ResolveUDPAddr failed:\", err)\n\t}\n\n\tm, err := net.ListenUDP(\"udp\", udpLocalAddr)\n\tif err != nil {\n\t\tb.Fatal(\"ListenUDP failed:\", err)\n\t}\n\tdefer m.Close()\n\n\tsender, err := net.DialUDP(\"udp\", nil, udpLocalAddr)\n\tif err != nil {\n\t\tb.Fatal(\"DialUDP failed:\", err)\n\t}\n\n\tmsg := make([]byte, size)\n\n\tb.SetBytes(int64(size))\n\tb.ResetTimer()\n\n\tfor i := 0; i < b.N; i++ {\n\t\tn, err := sender.Write(msg)\n\t\tif err != nil {\n\t\t\tb.Fatal(\"Write failed\", err)\n\t\t}\n\t\tif n != len(msg) {\n\t\t\tb.Fatalf(\"Write failed: n=%v (want=%v)\", n, len(msg))\n\t\t}\n\n\t}\n}", "title": "" }, { "docid": "19fcc7ec63399114492664b8bba7def8", "score": "0.41465476", "text": "func (d *delocation) writeNode(node *node32) {\n\tif _, err := d.output.WriteString(d.contents(node)); err != nil {\n\t\tpanic(err)\n\t}\n}", "title": "" }, { "docid": "c0a4af934b5050b77532a1cdfb28e42c", "score": "0.41408488", "text": "func (p *parser) addUnitNotone(ch rune) {\n\tif p.useOptionI() {\n\t\tch = unicode.ToLower(ch)\n\t}\n\n\tp.unit = newRegexNodeCh(ntNotone, p.options, ch)\n}", "title": "" }, { "docid": "3f58eed231e9022ea4651e2f764c22bf", "score": "0.41386494", "text": "func unitPrintf(s string, nu unit.UnitNameInfo) (out string) {\n\tout = strings.Replace(s, \"%n\", nu.FullName, -1)\n\tout = strings.Replace(out, \"%N\", nu.Name, -1)\n\tout = strings.Replace(out, \"%p\", nu.Prefix, -1)\n\tout = strings.Replace(out, \"%i\", nu.Instance, -1)\n\treturn\n}", "title": "" }, { "docid": "32526675e75f0cc1fd55765a50c45923", "score": "0.41246128", "text": "func CreateNetwork(nIn, nOut int) Network {\n\tnn := Network{\n\t\tnIn: nIn,\n\t\tnOut: nOut,\n\t\tlayer0: createNetworkLayer(nIn, nOut),\n\t}\n\treturn nn\n}", "title": "" }, { "docid": "6490e91d2cc83419ed01d27aa9bf0de5", "score": "0.4119621", "text": "func NewNetwork(svc *providers.Service) *Network {\n\treturn &Network{\n\t\titem: metadata.NewItem(svc, networksFolderName),\n\t}\n}", "title": "" }, { "docid": "60508e5a9a575850730123907c1033e6", "score": "0.41154516", "text": "func (s *Server) createInternalNetwork(ctx context.Context, request *api.CreateNetworkRequest) (*api.CreateNetworkResponse, error) {\n\tif err := validateNetworkSpec(request.Spec, nil); err != nil {\n\t\treturn nil, err\n\t}\n\n\t// TODO(mrjana): Consider using `Name` as a primary key to handle\n\t// duplicate creations. See #65\n\tn := &api.Network{\n\t\tID: identity.NewID(),\n\t\tSpec: *request.Spec,\n\t}\n\n\terr := s.store.Update(func(tx store.Tx) error {\n\t\treturn store.CreateNetwork(tx, n)\n\t})\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn &api.CreateNetworkResponse{\n\t\tNetwork: n,\n\t}, nil\n}", "title": "" }, { "docid": "81fa04bf7534248c333cd697e6d5fa0f", "score": "0.4111874", "text": "func UpdateUnit(res http.ResponseWriter, req *http.Request) {\n\ttranslation.FieldsRequestLanguageCode = req.Header.Get(\"Content-Language\")\n\tunit := &tree.Unit{}\n\tresp := response.New()\n\n\tif err := resp.Parse(req, unit); err != nil {\n\t\tresp.NewError(\"UpdateUnit unit new transaction\", err)\n\t\tresp.Render(res, req)\n\t\treturn\n\t}\n\n\tunit.TreeCode = chi.URLParam(req, \"tree_code\")\n\tunit.Code = chi.URLParam(req, \"unit_code\")\n\n\tbody, err := util.GetBodyMap(req)\n\tif err != nil {\n\t\tresp.NewError(\"UpdateUnit unit get body\", err)\n\t\tresp.Render(res, req)\n\t\treturn\n\t}\n\n\tcolumns, translations := util.GetColumnsFromBody(body, unit)\n\n\ttrs, err := db.NewTransaction()\n\tif err != nil {\n\t\tresp.NewError(\"UpdateUnit unit new transaction\", err)\n\t\tresp.Render(res, req)\n\t\treturn\n\t}\n\n\tif err := unit.Update(trs, columns, translations); err != nil {\n\t\ttrs.Rollback()\n\t\tresp.NewError(\"UpdateUnit\", err)\n\t\tresp.Render(res, req)\n\t\treturn\n\t}\n\ttrs.Commit()\n\tresp.Data = unit\n\tresp.Render(res, req)\n}", "title": "" }, { "docid": "d7fd783ab2d158b60736eec7a22c9e18", "score": "0.41042033", "text": "func (data *WeatherData) PrintWeatherDataUnits(wu *WeatherUnits) {\n\n\t// Many of the unit strings are HTML-escaped\n\tfmt.Printf(\"%s (%s) %.2f%s %s\\n\", data.Station[1], data.Station[0], data.StationDist, wu.StationDist, data.Station[2])\n\tfmt.Printf(\" T: %-.1f%s DP: %-.1f%s H: %.1f%s\\n\", data.Temperature[0], html.UnescapeString(wu.Temperature[0]), data.Temperature[1], html.UnescapeString(wu.Temperature[1]), data.Humidity, \"%\")\n\tfmt.Printf(\"WB: %-.1f%s %s WC: %-.1f%s HI: %-.1f%s\\n\", data.Temperature[2], html.UnescapeString(wu.Temperature[2]), WBGTFlag(data.Temperature[2]),data.Temperature[3], html.UnescapeString(wu.Temperature[3]), data.Temperature[4], html.UnescapeString(wu.Temperature[4]))\n\tfmt.Printf(\" P: %.3f%s [%.2fmbar] %v\\n\", data.Pressure, wu.Pressure, data.Pressure*33.86386, data.PressureTrend) // Major assumption here!\n\tfmt.Printf(\" W: %.1f%s %.1f%s gust, %v%v %s\\n\", data.Windspeed[0], wu.Windspeed[0], data.Windspeed[1], html.UnescapeString(wu.Windspeed[1]), data.Windspeed[2], html.UnescapeString(wu.Windspeed[2]), data.Wind[1])\n\tfmt.Printf(\" R: %.2f%s %.2f%s\\n\", data.Rain[0], wu.Rain[0], data.Rain[1], wu.Rain[1])\n}", "title": "" }, { "docid": "2c5a7e3468277e395cfc66b18dd9feb9", "score": "0.40944615", "text": "func TestDust(t *testing.T) {\n\tpkScript := []byte{0x76, 0xa9, 0x21, 0x03, 0x2f, 0x7e, 0x43,\n\t\t0x0a, 0xa4, 0xc9, 0xd1, 0x59, 0x43, 0x7e, 0x84, 0xb9,\n\t\t0x75, 0xdc, 0x76, 0xd9, 0x00, 0x3b, 0xf0, 0x92, 0x2c,\n\t\t0xf3, 0xaa, 0x45, 0x28, 0x46, 0x4b, 0xab, 0x78, 0x0d,\n\t\t0xba, 0x5e, 0x88, 0xac}\n\n\ttests := []struct {\n\t\tname string // test description\n\t\ttxOut wire.TxOut\n\t\trelayFee btcutil.Amount // minimum relay transaction fee.\n\t\tisDust bool\n\t}{\n\t\t{\n\t\t\t// Any value is allowed with a zero relay fee.\n\t\t\t\"zero value with zero relay fee\",\n\t\t\twire.TxOut{Value: 0, PkScript: pkScript},\n\t\t\t0,\n\t\t\tfalse,\n\t\t},\n\t\t{\n\t\t\t// Zero value is dust with any relay fee\"\n\t\t\t\"zero value with very small tx fee\",\n\t\t\twire.TxOut{Value: 0, PkScript: pkScript},\n\t\t\t1,\n\t\t\ttrue,\n\t\t},\n\t\t{\n\t\t\t\"38 byte public key script with value 584\",\n\t\t\twire.TxOut{Value: 584, PkScript: pkScript},\n\t\t\t1000,\n\t\t\ttrue,\n\t\t},\n\t\t{\n\t\t\t\"38 byte public key script with value 585\",\n\t\t\twire.TxOut{Value: 585, PkScript: pkScript},\n\t\t\t1000,\n\t\t\tfalse,\n\t\t},\n\t\t{\n\t\t\t// Maximum allowed value is never dust.\n\t\t\t\"max satoshi amount is never dust\",\n\t\t\twire.TxOut{Value: btcutil.MaxSatoshi, PkScript: pkScript},\n\t\t\tbtcutil.MaxSatoshi,\n\t\t\tfalse,\n\t\t},\n\t\t{\n\t\t\t// Maximum int64 value causes overflow.\n\t\t\t\"maximum int64 value\",\n\t\t\twire.TxOut{Value: 1<<63 - 1, PkScript: pkScript},\n\t\t\t1<<63 - 1,\n\t\t\ttrue,\n\t\t},\n\t\t{\n\t\t\t// Unspendable pkScript due to an invalid public key\n\t\t\t// script.\n\t\t\t\"unspendable pkScript\",\n\t\t\twire.TxOut{Value: 5000, PkScript: []byte{0x01}},\n\t\t\t0, // no relay fee\n\t\t\ttrue,\n\t\t},\n\t}\n\tfor _, test := range tests {\n\t\tres := IsDust(&test.txOut, test.relayFee)\n\t\tif res != test.isDust {\n\t\t\tt.Fatalf(\"Dust test '%s' failed: want %v got %v\",\n\t\t\t\ttest.name, test.isDust, res)\n\t\t\tcontinue\n\t\t}\n\t}\n}", "title": "" }, { "docid": "6957ee295f02cc092e27f5fd298fde31", "score": "0.40932328", "text": "func (client *Client) writeGateway(netID string, vmID string) error {\n\terr := client.PutObject(api.NetworkContainerName, api.Object{\n\t\tName: netID,\n\t\tContent: strings.NewReader(vmID),\n\t})\n\treturn err\n}", "title": "" }, { "docid": "788fe74524a73d7ef274a2bf0ab19234", "score": "0.40910327", "text": "func SaveNetwork(svc *providers.Service, net *model.Network) error {\n\treturn NewNetwork(svc).Carry(net).Write()\n}", "title": "" }, { "docid": "6b7aae14ae4b76e19cc516c4b9867af0", "score": "0.40780637", "text": "func (us *UnitSpawner) newUnit(posx float32, posy float32, unitID int) Unit {\n\t// Create empty unit entity\n\tunit := BasicUnit{BasicEntity: ecs.NewBasic()}\n\tunit.position = engo.Point{X: posx, Y: posy}\n\t// Assign the correct unit parameters according to requested ID\n\tu := us.giveUnitParameters(&unit, unitID)\n\treturn u\n}", "title": "" }, { "docid": "59c92136f24a98165ac696747f83e701", "score": "0.40745255", "text": "func newNetwork(opts ...Option) Network {\n\toptions := DefaultOptions()\n\n\tfor _, o := range opts {\n\t\to(&options)\n\t}\n\n\t// init tunnel address to the network bind address\n\toptions.Tunnel.Init(\n\t\ttunnel.Address(options.Address),\n\t\ttunnel.Nodes(options.Nodes...),\n\t)\n\n\t// init router Id to the network id\n\toptions.Router.Init(\n\t\trouter.Id(options.Id),\n\t)\n\n\t// create tunnel client with tunnel transport\n\ttunTransport := tun.NewTransport(\n\t\ttun.WithTunnel(options.Tunnel),\n\t)\n\n\t// server is network server\n\tserver := server.NewServer(\n\t\tserver.Id(options.Id),\n\t\tserver.Address(options.Address),\n\t\tserver.Name(options.Name),\n\t\tserver.Transport(tunTransport),\n\t)\n\n\t// client is network client\n\tclient := client.NewClient(\n\t\tclient.Transport(tunTransport),\n\t\tclient.Selector(\n\t\t\trtr.NewSelector(\n\t\t\t\trtr.WithRouter(options.Router),\n\t\t\t),\n\t\t),\n\t)\n\n\tnetwork := &network{\n\t\tnode: &node{\n\t\t\tid: options.Id,\n\t\t\taddress: options.Address,\n\t\t\tneighbours: make(map[string]*node),\n\t\t},\n\t\toptions: options,\n\t\tRouter: options.Router,\n\t\tProxy: options.Proxy,\n\t\tTunnel: options.Tunnel,\n\t\tserver: server,\n\t\tclient: client,\n\t\ttunClient: make(map[string]transport.Client),\n\t}\n\n\tnetwork.node.network = network\n\n\treturn network\n}", "title": "" }, { "docid": "50ebb314a1d2b48657f48ba55e6bb292", "score": "0.40734926", "text": "func RunDestroyUnit(args []string, cAPI *client.API) (exit int) {\n\tif len(args) == 0 {\n\t\tfmt.Println(\"No units given\")\n\t\treturn 0\n\t}\n\n\tunits, err := findUnits(args, cAPI)\n\tif err != nil {\n\t\tfmt.Printf(\"%v\", err)\n\t\tfmt.Println()\n\t\treturn 1\n\t}\n\n\tif len(units) == 0 {\n\t\tfmt.Println(\"Units not found in registry\")\n\t\treturn 0\n\t}\n\n\tfor _, v := range units {\n\t\terr := (*cAPI).DestroyUnit(v.Name)\n\t\tif err != nil {\n\t\t\t// Ignore 'Unit does not exist' error\n\t\t\tif client.IsErrorUnitNotFound(err) {\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tfmt.Printf(\"Error destroying units: %v\", err)\n\t\t\tfmt.Println()\n\t\t\texit = 1\n\t\t\tcontinue\n\t\t}\n\n\t\tif sharedFlags.NoBlock {\n\t\t\tattempts := sharedFlags.BlockAttempts\n\t\t\tretry := func() bool {\n\t\t\t\tif sharedFlags.BlockAttempts < 1 {\n\t\t\t\t\treturn true\n\t\t\t\t}\n\t\t\t\tattempts--\n\t\t\t\tif attempts == 0 {\n\t\t\t\t\treturn false\n\t\t\t\t}\n\t\t\t\treturn true\n\t\t\t}\n\n\t\t\tfor retry() {\n\t\t\t\tu, err := (*cAPI).Unit(v.Name)\n\t\t\t\tif err != nil {\n\t\t\t\t\tfmt.Printf(\"Error destroying units: %v\", err)\n\t\t\t\t\tfmt.Println()\n\t\t\t\t\texit = 1\n\t\t\t\t\tbreak\n\t\t\t\t}\n\n\t\t\t\tif u == nil {\n\t\t\t\t\tbreak\n\t\t\t\t}\n\t\t\t\ttime.Sleep(defaultSleepTime)\n\t\t\t}\n\t\t}\n\n\t\tfmt.Printf(\"Destroyed %s\", v.Name)\n\t\tfmt.Println()\n\t}\n\treturn\n}", "title": "" }, { "docid": "4e0204829248faa79d39827815880c9a", "score": "0.4072634", "text": "func (o *ReservationAssignedUnitModel) SetUnit(v EmbeddedUnitModel) {\n\to.Unit = v\n}", "title": "" }, { "docid": "1f5adc65d4ba7a6f9eba0de8282f6e12", "score": "0.4072555", "text": "func (d DataCenters) WriteTree(output string) {\n\tif output == \"json\" {\n\t\tjsonBytes, _ := json.MarshalIndent(d, \"\", \" \")\n\t\tfmt.Println(string(jsonBytes))\n\t} else {\n\t\tfor _, dc := range d {\n\t\t\tfmt.Println(dc.Name)\n\t\t\tfor _, floor := range *dc.Floors {\n\t\t\t\tfmt.Printf(\" %-v\\n\", floor.Name)\n\t\t\t\tfor _, hall := range floor.Halls {\n\t\t\t\t\tfmt.Printf(\" %-v\\n\", hall.Name)\n\t\t\t\t\tfor _, row := range hall.RackRows {\n\t\t\t\t\t\tfmt.Printf(\" %-v:\", row.Name)\n\t\t\t\t\t\tfor _, rack := range row.Racks {\n\t\t\t\t\t\t\tfmt.Printf(\" %v\", rack.Name)\n\t\t\t\t\t\t}\n\t\t\t\t\t\tfmt.Println()\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\tfmt.Println()\n\t\t}\n\t}\n}", "title": "" }, { "docid": "7168844bba907e240a9099b8057604c0", "score": "0.4064827", "text": "func (t *Union) Write(w io.Writer, desc bool) (err error) {\n\tif err = writeDesc(w, t.Desc, 0, desc); err == nil {\n\t\tif _, err = w.Write([]byte(\"union \")); err == nil {\n\t\t\tif _, err = w.Write([]byte(t.N)); err == nil {\n\t\t\t\terr = writeDirectiveUses(w, t.Dirs)\n\t\t\t\tif err == nil {\n\t\t\t\t\t_, err = w.Write([]byte{' ', '=', ' '})\n\t\t\t\t\tfor i, m := range t.Members {\n\t\t\t\t\t\tname := m.Name()\n\t\t\t\t\t\tif 0 < i {\n\t\t\t\t\t\t\tname = \" | \" + name\n\t\t\t\t\t\t}\n\t\t\t\t\t\tif _, err = w.Write([]byte(name)); err != nil {\n\t\t\t\t\t\t\tbreak\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\tif err == nil {\n\t\t_, err = w.Write([]byte{'\\n'})\n\t}\n\treturn\n}", "title": "" }, { "docid": "2c47a5539c6acea4b10e2268dd0639f1", "score": "0.40639138", "text": "func networkDir(dataDir string, chainParams *chaincfg.Params) string {\n\tnetname := chainParams.Name\n\n\t// For now, we must always name the testnet data directory as \"testnet\"\n\t// and not \"testnet3\" or any other version, as the chaincfg testnet3\n\t// paramaters will likely be switched to being named \"testnet3\" in the\n\t// future. This is done to future proof that change, and an upgrade\n\t// plan to move the testnet3 data directory can be worked out later.\n\tif chainParams.Net == wire.TestNet3 {\n\t\tnetname = \"testnet\"\n\t}\n\n\treturn filepath.Join(dataDir, netname)\n}", "title": "" }, { "docid": "1d05b19ac7259e1648c6603bed619665", "score": "0.40598062", "text": "func TestWriteOneDevice(t *testing.T) {\n\tmockport := NewMockPort()\n\tdata := []byte{0xff, 0x00, 0x00, 0xff, 0x00, 0x00}\n\tmockport.ReadLength = len(data)\n\tfor i := 0; i < len(data); i++ {\n\t\tmockport.ReadBuffer[i] = data[i]\n\t}\n\tsimplenetcore := NewSimpleNetCore()\n\tdevice := &simplenetcore.Devices[1]\n\tdevice.Write([]byte{'H', 'e', 'l', 'l', 'o', ' ', 'W', 'o', 'r', 'l', 'd', 0x00})\n\n\texpectedData := []byte{0xff, 0, 0, 0, 0xff, 1, 12, 'H', 'e', 'l', 'l', 'o', ' ', 'W', 'o', 'r', 'l', 'd', 0x00, 0x00}\n\t//go\n\tsimplenetcore.SimpleNetInnerLoop(mockport)\n\texpectedlen := 4*15 + 12\n\tif mockport.WritePosition != expectedlen {\n\t\tt.Errorf(\"Recieved %d bytes expected %d\", mockport.WritePosition, expectedlen)\n\t}\n\tfor i := 0; i < len(expectedData); i++ {\n\t\tif mockport.WriteBuffer[i] != expectedData[i] {\n\t\t\tt.Errorf(\"Bad write data\")\n\t\t\tbreak\n\t\t}\n\t}\n}", "title": "" }, { "docid": "d2f8ea0c849b357a0012261689fc88b7", "score": "0.40406463", "text": "func (c *CLab) CreateDockerNet(ctx context.Context) (err error) {\n\tnctx, cancel := context.WithTimeout(ctx, c.timeout)\n\tdefer cancel()\n\n\t// linux bridge name that is used by docker network\n\tvar bridgeName string\n\n\tlog.Debugf(\"Checking if docker network '%s' exists\", c.Config.Mgmt.Network)\n\tnetResource, err := c.DockerClient.NetworkInspect(nctx, c.Config.Mgmt.Network)\n\tswitch {\n\tcase client.IsErrNetworkNotFound(err):\n\t\tlog.Debugf(\"Network '%s' does not exist\", c.Config.Mgmt.Network)\n\t\tlog.Infof(\"Creating docker network: Name='%s', IPv4Subnet='%s', IPv6Subnet='%s', MTU='%s'\",\n\t\t\tc.Config.Mgmt.Network, c.Config.Mgmt.IPv4Subnet, c.Config.Mgmt.IPv6Subnet, c.Config.Mgmt.MTU)\n\n\t\tenableIPv6 := false\n\t\tvar ipamConfig []network.IPAMConfig\n\t\tif c.Config.Mgmt.IPv4Subnet != \"\" {\n\t\t\tipamConfig = append(ipamConfig, network.IPAMConfig{\n\t\t\t\tSubnet: c.Config.Mgmt.IPv4Subnet,\n\t\t\t})\n\t\t}\n\t\tif c.Config.Mgmt.IPv6Subnet != \"\" {\n\t\t\tipamConfig = append(ipamConfig, network.IPAMConfig{\n\t\t\t\tSubnet: c.Config.Mgmt.IPv6Subnet,\n\t\t\t})\n\t\t\tenableIPv6 = true\n\t\t}\n\n\t\tipam := &network.IPAM{\n\t\t\tDriver: \"default\",\n\t\t\tConfig: ipamConfig,\n\t\t}\n\n\t\tnetworkOptions := types.NetworkCreate{\n\t\t\tCheckDuplicate: true,\n\t\t\tDriver: \"bridge\",\n\t\t\tEnableIPv6: enableIPv6,\n\t\t\tIPAM: ipam,\n\t\t\tInternal: false,\n\t\t\tAttachable: false,\n\t\t\tLabels: map[string]string{\n\t\t\t\t\"containerlab\": \"\",\n\t\t\t},\n\t\t\tOptions: map[string]string{\n\t\t\t\t\"com.docker.network.driver.mtu\": c.Config.Mgmt.MTU,\n\t\t\t},\n\t\t}\n\n\t\tnetCreateResponse, err := c.DockerClient.NetworkCreate(nctx, c.Config.Mgmt.Network, networkOptions)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\tif len(netCreateResponse.ID) < 12 {\n\t\t\treturn fmt.Errorf(\"could not get bridge ID\")\n\t\t}\n\t\tbridgeName = \"br-\" + netCreateResponse.ID[:12]\n\n\tcase err == nil:\n\t\tlog.Debugf(\"network '%s' was found. Reusing it...\", c.Config.Mgmt.Network)\n\t\tif len(netResource.ID) < 12 {\n\t\t\treturn fmt.Errorf(\"could not get bridge ID\")\n\t\t}\n\t\tswitch c.Config.Mgmt.Network {\n\t\tcase \"bridge\":\n\t\t\tbridgeName = \"docker0\"\n\t\tdefault:\n\t\t\tbridgeName = \"br-\" + netResource.ID[:12]\n\t\t}\n\n\tdefault:\n\t\treturn err\n\t}\n\tc.Config.Mgmt.Bridge = bridgeName\n\n\tlog.Debugf(\"Docker network '%s', bridge name '%s'\", c.Config.Mgmt.Network, bridgeName)\n\n\tlog.Debug(\"Disable RPF check on the docker host\")\n\terr = setSysctl(\"net/ipv4/conf/all/rp_filter\", 0)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"failed to disable RP filter on docker host for the 'all' scope: %v\", err)\n\t}\n\terr = setSysctl(\"net/ipv4/conf/default/rp_filter\", 0)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"failed to disable RP filter on docker host for the 'default' scope: %v\", err)\n\t}\n\n\tlog.Debugf(\"Enable LLDP on the linux bridge %s\", bridgeName)\n\tfile := \"/sys/class/net/\" + bridgeName + \"/bridge/group_fwd_mask\"\n\n\terr = ioutil.WriteFile(file, []byte(strconv.Itoa(16384)), 0640)\n\tif err != nil {\n\t\tlog.Warnf(\"failed to enable LLDP on docker bridge: %v\", err)\n\t}\n\n\tlog.Debugf(\"Disabling TX checksum offloading for the %s bridge interface...\", bridgeName)\n\terr = EthtoolTXOff(bridgeName)\n\tif err != nil {\n\t\tlog.Warnf(\"failed to disable TX checksum offloading for the %s bridge interface: %v\", bridgeName, err)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "156fc6bb29051de622c71545c716eae1", "score": "0.4037506", "text": "func WithUnit(u string) Option { return unitOpt(u) }", "title": "" }, { "docid": "beea4ce639f69fc67a5de3036356ae54", "score": "0.403326", "text": "func SkipUnit(ur UnitReader, ut UnitType, data interface{}) error {\n\treturn skipUnit(ur, ut, data, maxSkipDepth)\n}", "title": "" }, { "docid": "c223ff9435a604f8f9b5737194347472", "score": "0.4030436", "text": "func NewMockPacketNetwork(addrs []net.Addr) []net.PacketConn {\n\tsinks := make([]chan<- PacketRead, len(addrs))\n\tconns := make([]*MockPacketConn, len(addrs))\n\tret := make([]net.PacketConn, len(addrs))\n\n\t// Create connections and link them all together.\n\tfor i := range addrs {\n\t\treadChan := make(chan PacketRead)\n\t\tconn := NewMockPacketConn(addrs[i], readChan)\n\t\tsinks[i] = readChan\n\t\tconns[i] = conn\n\t\tret[i] = conn\n\n\t\tgo func(i int) {\n\t\t\tfor write := range conns[i].Writes() {\n\t\t\t\t// Writes in a mock network succeed.\n\t\t\t\twrite.Result <- nil\n\n\t\t\t\t// Direct the write to the appropriate node.\n\t\t\t\tdst := indexOfAddr(addrs, write.Addr)\n\t\t\t\tif dst < 0 {\n\t\t\t\t\t// Don't allow this.\n\t\t\t\t\tpanic(write)\n\t\t\t\t}\n\t\t\t\tpkt := make([]byte, len(write.Packet))\n\t\t\t\tcopy(pkt, write.Packet)\n\t\t\t\tsinks[dst] <- PacketRead{write.Packet, addrs[i], nil}\n\t\t\t}\n\t\t}(i)\n\t}\n\n\treturn ret\n}", "title": "" }, { "docid": "07dd7a0bc8dc1eca41773e79b54bf507", "score": "0.40201434", "text": "func testUnitize(t *testing.T, stub *shim.MockStub, popcodes *popcodes, users *users, owners []*keyInfo) {\n\tsourceBalance := getBalance(t, stub, popcodes.popcode1)\n\t//unitize owned output into two outputs in a different popcode\n\tfmt.Printf(\"\\n\\n\\nbefore unitize: balance on source popcode (%v)\\ncounter: (%v)\\noutputs: (%v)\\n\\n\\n\",\n\t\tsourceBalance.Address, sourceBalance.Counter, sourceBalance.Outputs)\n\t// prevNumberOfOutputs := len(balance[\"Outputs\"].([]interface{}))\n\tsourcePrevCounter := sourceBalance.Counter\n\tdestBalance := getBalance(t, stub, popcodes.popcode2)\n\tfmt.Printf(\"\\n\\n\\nbefore unitize: balance on destination popcode (%v)\\ncounter: (%v)\\noutputs: (%v)\\n\\n\\n\",\n\t\tdestBalance.Address, destBalance.Counter, destBalance.Outputs)\n\n\tdestPrevCounter := destBalance.Counter\n\tdestAmounts := []int32{50, 50}\n\tdata := \"data\"\n\toutput := 0\n\taltUnitize(t, stub, popcodes.popcode1, popcodes.popcode2, owners, data, destAmounts, int32(output))\n\tsourceBalance = getBalance(t, stub, popcodes.popcode1)\n\tif sourcePrevCounter != sourceBalance.Counter {\n\t\tHandleError(t, fmt.Errorf(\"counter of source popcode (address: %s) changed after call to unitize. Counter: (%s)\",\n\t\t\tsourceBalance.Address, sourceBalance.Counter))\n\t}\n\tdestBalance = getBalance(t, stub, popcodes.popcode2)\n\tif destPrevCounter == destBalance.Counter {\n\t\tHandleError(t, fmt.Errorf(\"counter of destination popcode (address: %s) \"+\n\t\t\t\"did not change after call to unitize. Counter: (%s)\", destBalance.Address, destBalance.Counter))\n\t}\n\n\tfmt.Printf(\"\\n\\n\\nafter unitize: balance on source popcode (%v)\\ncounter: (%v)\\noutputs: (%v)\\n\\n\",\n\t\tsourceBalance.Address, sourceBalance.Counter, sourceBalance.Outputs)\n\tfmt.Printf(\"\\n\\n\\nafter unitize: balance on destination popcode (%v)\\ncounter: (%v)\\noutputs: (%v)\\n\\n\",\n\t\tdestBalance.Address, destBalance.Counter, destBalance.Outputs)\n\n}", "title": "" }, { "docid": "922d62b72aa6dc659393e2e08b311434", "score": "0.40048742", "text": "func (c *Controller) NewNetwork(networkType, name string, id string, options ...NetworkOption) (_ *Network, retErr error) {\n\tif id != \"\" {\n\t\tc.networkLocker.Lock(id)\n\t\tdefer c.networkLocker.Unlock(id) //nolint:errcheck\n\n\t\tif _, err := c.NetworkByID(id); err == nil {\n\t\t\treturn nil, NetworkNameError(id)\n\t\t}\n\t}\n\n\tif strings.TrimSpace(name) == \"\" {\n\t\treturn nil, ErrInvalidName(name)\n\t}\n\n\tif id == \"\" {\n\t\tid = stringid.GenerateRandomID()\n\t}\n\n\tdefaultIpam := defaultIpamForNetworkType(networkType)\n\t// Construct the network object\n\tnw := &Network{\n\t\tname: name,\n\t\tnetworkType: networkType,\n\t\tgeneric: map[string]interface{}{netlabel.GenericData: make(map[string]string)},\n\t\tipamType: defaultIpam,\n\t\tid: id,\n\t\tcreated: time.Now(),\n\t\tctrlr: c,\n\t\tpersist: true,\n\t\tdrvOnce: &sync.Once{},\n\t\tloadBalancerMode: loadBalancerModeDefault,\n\t}\n\n\tnw.processOptions(options...)\n\tif err := nw.validateConfiguration(); err != nil {\n\t\treturn nil, err\n\t}\n\n\t// These variables must be defined here, as declaration would otherwise\n\t// be skipped by the \"goto addToStore\"\n\tvar (\n\t\tcaps driverapi.Capability\n\t\terr error\n\n\t\tskipCfgEpCount bool\n\t)\n\n\t// Reset network types, force local scope and skip allocation and\n\t// plumbing for configuration networks. Reset of the config-only\n\t// network drivers is needed so that this special network is not\n\t// usable by old engine versions.\n\tif nw.configOnly {\n\t\tnw.scope = scope.Local\n\t\tnw.networkType = \"null\"\n\t\tgoto addToStore\n\t}\n\n\t_, caps, err = nw.resolveDriver(nw.networkType, true)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tif nw.scope == scope.Local && caps.DataScope == scope.Global {\n\t\treturn nil, types.ForbiddenErrorf(\"cannot downgrade network scope for %s networks\", networkType)\n\t}\n\tif nw.ingress && caps.DataScope != scope.Global {\n\t\treturn nil, types.ForbiddenErrorf(\"Ingress network can only be global scope network\")\n\t}\n\n\t// At this point the network scope is still unknown if not set by user\n\tif (caps.DataScope == scope.Global || nw.scope == scope.Swarm) &&\n\t\t!c.isDistributedControl() && !nw.dynamic {\n\t\tif c.isManager() {\n\t\t\t// For non-distributed controlled environment, globalscoped non-dynamic networks are redirected to Manager\n\t\t\treturn nil, ManagerRedirectError(name)\n\t\t}\n\t\treturn nil, types.ForbiddenErrorf(\"Cannot create a multi-host network from a worker node. Please create the network from a manager node.\")\n\t}\n\n\tif nw.scope == scope.Swarm && c.isDistributedControl() {\n\t\treturn nil, types.ForbiddenErrorf(\"cannot create a swarm scoped network when swarm is not active\")\n\t}\n\n\t// Make sure we have a driver available for this network type\n\t// before we allocate anything.\n\tif _, err := nw.driver(true); err != nil {\n\t\treturn nil, err\n\t}\n\n\t// From this point on, we need the network specific configuration,\n\t// which may come from a configuration-only network\n\tif nw.configFrom != \"\" {\n\t\tconfigNetwork, err := c.getConfigNetwork(nw.configFrom)\n\t\tif err != nil {\n\t\t\treturn nil, types.NotFoundErrorf(\"configuration network %q does not exist\", nw.configFrom)\n\t\t}\n\t\tif err := configNetwork.applyConfigurationTo(nw); err != nil {\n\t\t\treturn nil, types.InternalErrorf(\"Failed to apply configuration: %v\", err)\n\t\t}\n\t\tnw.generic[netlabel.Internal] = nw.internal\n\t\tdefer func() {\n\t\t\tif retErr == nil && !skipCfgEpCount {\n\t\t\t\tif err := configNetwork.getEpCnt().IncEndpointCnt(); err != nil {\n\t\t\t\t\tlog.G(context.TODO()).Warnf(\"Failed to update reference count for configuration network %q on creation of network %q: %v\", configNetwork.Name(), nw.name, err)\n\t\t\t\t}\n\t\t\t}\n\t\t}()\n\t}\n\n\tif err := nw.ipamAllocate(); err != nil {\n\t\treturn nil, err\n\t}\n\tdefer func() {\n\t\tif retErr != nil {\n\t\t\tnw.ipamRelease()\n\t\t}\n\t}()\n\n\t// Note from thaJeztah to future code visitors, or \"future self\".\n\t//\n\t// This code was previously assigning the error to the global \"err\"\n\t// variable (before it was renamed to \"retErr\"), but in case of a\n\t// \"MaskableError\" did not *return* the error:\n\t// https://github.com/moby/moby/blob/b325dcbff60a04cedbe40eb627465fc7379d05bf/libnetwork/controller.go#L566-L573\n\t//\n\t// Depending on code paths further down, that meant that this error\n\t// was either overwritten by other errors (and thus not handled in\n\t// defer statements) or handled (if no other code was overwriting it.\n\t//\n\t// I suspect this was a bug (but possible without effect), but it could\n\t// have been intentional. This logic is confusing at least, and even\n\t// more so combined with the handling in defer statements that check for\n\t// both the \"err\" return AND \"skipCfgEpCount\":\n\t// https://github.com/moby/moby/blob/b325dcbff60a04cedbe40eb627465fc7379d05bf/libnetwork/controller.go#L586-L602\n\t//\n\t// To save future visitors some time to dig up history:\n\t//\n\t// - config-only networks were added in 25082206df465d1c11dd1276a65b4a1dc701bd43\n\t// - the special error-handling and \"skipCfgEpcoung\" was added in ddd22a819867faa0cd7d12b0c3fad1099ac3eb26\n\t// - and updated in 87b082f3659f9ec245ab15d781e6bfffced0af83 to don't use string-matching\n\t//\n\t// To cut a long story short: if this broke anything, you know who to blame :)\n\tif err := c.addNetwork(nw); err != nil {\n\t\tif _, ok := err.(types.MaskableError); ok { //nolint:gosimple\n\t\t\t// This error can be ignored and set this boolean\n\t\t\t// value to skip a refcount increment for configOnly networks\n\t\t\tskipCfgEpCount = true\n\t\t} else {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\tdefer func() {\n\t\tif retErr != nil {\n\t\t\tif err := nw.deleteNetwork(); err != nil {\n\t\t\t\tlog.G(context.TODO()).Warnf(\"couldn't roll back driver network on network %s creation failure: %v\", nw.name, retErr)\n\t\t\t}\n\t\t}\n\t}()\n\n\t// XXX If the driver type is \"overlay\" check the options for DSR\n\t// being set. If so, set the network's load balancing mode to DSR.\n\t// This should really be done in a network option, but due to\n\t// time pressure to get this in without adding changes to moby,\n\t// swarm and CLI, it is being implemented as a driver-specific\n\t// option. Unfortunately, drivers can't influence the core\n\t// \"libnetwork.Network\" data type. Hence we need this hack code\n\t// to implement in this manner.\n\tif gval, ok := nw.generic[netlabel.GenericData]; ok && nw.networkType == \"overlay\" {\n\t\toptMap := gval.(map[string]string)\n\t\tif _, ok := optMap[overlayDSROptionString]; ok {\n\t\t\tnw.loadBalancerMode = loadBalancerModeDSR\n\t\t}\n\t}\n\naddToStore:\n\t// First store the endpoint count, then the network. To avoid to\n\t// end up with a datastore containing a network and not an epCnt,\n\t// in case of an ungraceful shutdown during this function call.\n\tepCnt := &endpointCnt{n: nw}\n\tif err := c.updateToStore(epCnt); err != nil {\n\t\treturn nil, err\n\t}\n\tdefer func() {\n\t\tif retErr != nil {\n\t\t\tif err := c.deleteFromStore(epCnt); err != nil {\n\t\t\t\tlog.G(context.TODO()).Warnf(\"could not rollback from store, epCnt %v on failure (%v): %v\", epCnt, retErr, err)\n\t\t\t}\n\t\t}\n\t}()\n\n\tnw.epCnt = epCnt\n\tif err := c.updateToStore(nw); err != nil {\n\t\treturn nil, err\n\t}\n\tdefer func() {\n\t\tif retErr != nil {\n\t\t\tif err := c.deleteFromStore(nw); err != nil {\n\t\t\t\tlog.G(context.TODO()).Warnf(\"could not rollback from store, network %v on failure (%v): %v\", nw, retErr, err)\n\t\t\t}\n\t\t}\n\t}()\n\n\tif nw.configOnly {\n\t\treturn nw, nil\n\t}\n\n\tjoinCluster(nw)\n\tdefer func() {\n\t\tif retErr != nil {\n\t\t\tnw.cancelDriverWatches()\n\t\t\tif err := nw.leaveCluster(); err != nil {\n\t\t\t\tlog.G(context.TODO()).Warnf(\"Failed to leave agent cluster on network %s on failure (%v): %v\", nw.name, retErr, err)\n\t\t\t}\n\t\t}\n\t}()\n\n\tif nw.hasLoadBalancerEndpoint() {\n\t\tif err := nw.createLoadBalancerSandbox(); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\n\tif !c.isDistributedControl() {\n\t\tc.mu.Lock()\n\t\tarrangeIngressFilterRule()\n\t\tc.mu.Unlock()\n\t}\n\n\t// Sets up the DOCKER-USER chain for each iptables version (IPv4, IPv6)\n\t// that's enabled in the controller's configuration.\n\tfor _, ipVersion := range c.enabledIptablesVersions() {\n\t\tif err := setupUserChain(ipVersion); err != nil {\n\t\t\tlog.G(context.TODO()).WithError(err).Warnf(\"Controller.NewNetwork %s:\", name)\n\t\t}\n\t}\n\n\treturn nw, nil\n}", "title": "" }, { "docid": "62ecb7a2cac078d02ce57eb43794c803", "score": "0.40022904", "text": "func (unit DesiredSystemdUnit) UnitName() string {\n\treturn path.Base(unit.Path)\n}", "title": "" }, { "docid": "1942dfaf7151b968dc10be7b46b3a0e6", "score": "0.3999319", "text": "func SetupNetwork(ctx context.Context, cli *dockerapi.Client, netName, cidr string) (*types.NetworkResource, error) {\n\tnetResources, err := cli.NetworkList(ctx, types.NetworkListOptions{})\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tfor _, netRes := range netResources {\n\t\tif netRes.Name == netName {\n\t\t\tif len(netRes.IPAM.Config) > 0 {\n\t\t\t\treturn &netRes, nil\n\t\t\t}\n\t\t\terr = cli.NetworkRemove(ctx, netRes.ID)\n\t\t\tif err != nil {\n\t\t\t\treturn nil, err\n\t\t\t}\n\t\t}\n\t}\n\n\tid, err := createNetwork(ctx, cli, netName, cidr)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"couldn't create network %s on %s: %w\", netName, cidr, err)\n\t}\n\tnetRes, err := cli.NetworkInspect(ctx, id, types.NetworkInspectOptions{})\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn &netRes, nil\n}", "title": "" }, { "docid": "b7f92b99c0978cbf4da06d831aa1b537", "score": "0.39985096", "text": "func (p *Packet) WriteUInt64(i uint64) *Packet {\n\tbinary.LittleEndian.PutUint64(p.Data[p.Offset:], i)\n\tp.Offset += (64 / 8)\n\treturn p\n}", "title": "" }, { "docid": "4a5f2643b8c14180230f884f28b051fd", "score": "0.39814413", "text": "func SocketUnitName(imageID types.Hash) string {\n\treturn imageID.String() + \".socket\"\n}", "title": "" }, { "docid": "10ffe5702ade696dc4b8d87f1595db43", "score": "0.39767435", "text": "func (c *Container) newNetworkEvent(status events.Status, netName string) {\n\te := events.NewEvent(status)\n\te.ID = c.ID()\n\te.Name = c.Name()\n\te.Type = events.Network\n\te.Network = netName\n\tif err := c.runtime.eventer.Write(e); err != nil {\n\t\tlogrus.Errorf(\"Unable to write pod event: %q\", err)\n\t}\n}", "title": "" }, { "docid": "60e58c60afd6a10cd12383501db4cdfb", "score": "0.39758095", "text": "func (this *OutputNALUnit) CopyNaluData(naluSrc *OutputNALUnit) {\n this.SetNalUnitType(naluSrc.GetNalUnitType())\n this.SetReservedZero6Bits(naluSrc.GetReservedZero6Bits())\n this.SetTemporalId(naluSrc.GetTemporalId())\n this.m_Bitstream = naluSrc.m_Bitstream\n}", "title": "" }, { "docid": "b7cdbd4cfeac3e09dc2b95ced79d835d", "score": "0.39733595", "text": "func (net *Network2) Save(path string) error {\n\tvar wList [][]float64\n\tfor _, weights := range net.weights {\n\t\tvar wL []float64\n\t\tr, c := weights.Dims()\n\t\tfor i := 0; i < r; i++ {\n\t\t\tfor j := 0; j < c; j++ {\n\t\t\t\twL = append(wL, weights.At(i, j))\n\t\t\t}\n\t\t}\n\t\twList = append(wList, wL)\n\t}\n\tvar bList [][]float64\n\tfor _, biases := range net.biases {\n\t\tvar bL []float64\n\t\tr, c := biases.Dims()\n\t\tfor i := 0; i < r; i++ {\n\t\t\tfor j := 0; j < c; j++ {\n\t\t\t\tbL = append(bL, biases.At(i, j))\n\t\t\t}\n\t\t}\n\t\tbList = append(bList, bL)\n\t}\n\tdata := Network{\n\t\tSizes: net.Sizes,\n\t\tCost: net.Cost.GetName(),\n\t\tWeights: wList,\n\t\tBiases: bList,\n\t}\n\tjsonNetwork, err := json.Marshal(data)\n\tif err != nil {\n\t\treturn err\n\t}\n\terr = ioutil.WriteFile(path, jsonNetwork, 0644)\n\tif err != nil {\n\t\treturn err\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "4554ce53af000f9d9c1fe0c25eb968dd", "score": "0.3972595", "text": "func DeleteUnit(res http.ResponseWriter, req *http.Request) {\n\tresp := response.New()\n\n\ttrs, err := db.NewTransaction()\n\tif err != nil {\n\t\tresp.NewError(\"DeleteUnit unit new transaction\", err)\n\t\tresp.Render(res, req)\n\t\treturn\n\t}\n\n\tunit := &tree.Unit{\n\t\tTreeCode: chi.URLParam(req, \"tree_code\"),\n\t\tCode: chi.URLParam(req, \"unit_code\"),\n\t}\n\tif err := unit.Delete(trs); err != nil {\n\t\ttrs.Rollback()\n\t\tresp.NewError(\"DeleteUnit\", err)\n\t\tresp.Render(res, req)\n\t\treturn\n\t}\n\ttrs.Commit()\n\tresp.Render(res, req)\n}", "title": "" }, { "docid": "394df3fcbac012142b25273efcbe2033", "score": "0.39725658", "text": "func WriteRunner(tpl *pongo2.Template, localFolder string, Solver entity.Solver) {\n\tfilename := \"runner_\" + Solver.Name + \".py\"\n\tfileFullPath := filepath.Join(localFolder, filename)\n\ttplContext := strings.Split(Solver.Class, \"/\")\n\tout, err := tpl.Execute(pongo2.Context{\"Package\": tplContext[0], \"Filename\": tplContext[1], \"Classname\": tplContext[2]})\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\terr = ioutil.WriteFile(fileFullPath, []byte(out), 0644)\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n}", "title": "" }, { "docid": "cbd49279c00a54686c2479ee40e65f29", "score": "0.39687186", "text": "func (c *Client) CreateNetwork(node string, params map[string]interface{}) (exitStatus string, err error) {\n\turl := fmt.Sprintf(\"/nodes/%s/network\", node)\n\treturn c.CreateItemReturnStatus(params, url)\n}", "title": "" }, { "docid": "825041efc7d0beae813d1372d1e5f03a", "score": "0.39601004", "text": "func (ts *SynchTestSystem) RunNetwork() {\n\t// Network initially on\n\tlspnet.SetWriteDropPercent(0)\n\tfor ts.RunFlag {\n\t\tlsplog.Vlogf(4, \"Network running. Waiting for master\\n\")\n\t\t<-ts.M2NChan\n\t\tlsplog.Vlogf(4, \"Turning off network\\n\")\n\t\tlspnet.SetWriteDropPercent(100)\n\t\tts.N2MChan <- true\n\n\t\tlsplog.Vlogf(4, \"Network off. Waiting for master\\n\")\n\t\t<-ts.M2NChan\n\t\tlsplog.Vlogf(4, \"Turning network on and delaying\\n\")\n\t\tlspnet.SetWriteDropPercent(0)\n\t\tts.N2MChan <- true\n\t\tts.synchdelay(2.0)\n\t}\n\tlsplog.Vlogf(4, \"Network handler exiting\\n\")\n}", "title": "" }, { "docid": "ce70953ff12529e6cae2af48fe651dd8", "score": "0.39525813", "text": "func (d *Driver) CreateNetwork(r *gphnet.CreateNetworkRequest) error {\n\td.log.WithField(\"r\", r).Debug(\"CreateNetwork()\")\n\n\thasGW := false\n\tfor _, v4 := range append(r.IPv4Data, r.IPv6Data...) {\n\t\tif v4.Gateway != \"\" {\n\t\t\thasGW = true\n\t\t\tbreak\n\t\t}\n\t}\n\n\tif !hasGW {\n\t\terr := fmt.Errorf(\"gateway not found in IPAMData\")\n\t\td.log.WithError(err).Error()\n\t\treturn err\n\t}\n\n\topts, ok := r.Options[\"com.docker.network.generic\"].(map[string]interface{})\n\tif !ok {\n\t\terr := fmt.Errorf(\"did not retrieve the options array for the network\")\n\t\td.log.WithError(err).Error()\n\t\treturn err\n\t}\n\n\tvxlID, ok := opts[\"vxlanid\"]\n\tif !ok {\n\t\terr := fmt.Errorf(\"cannot create a network without a vxlanid (-o vxlanid=<0-16777215>)\")\n\t\td.log.WithError(err).Error()\n\t\treturn err\n\t}\n\n\t_, err := vxlan.ParseVxlanID(vxlID.(string))\n\treturn err\n}", "title": "" }, { "docid": "152eddb55e485da94b310775a1fcd831", "score": "0.394975", "text": "func (s *UserDefined) SetUnit(v string) *UserDefined {\n\ts.Unit = &v\n\treturn s\n}", "title": "" }, { "docid": "f0f8b842bfeec018a17004fc5bf48709", "score": "0.394931", "text": "func (s *Speed) AddUnit(i string) {\n\ts.Unit = i\n}", "title": "" }, { "docid": "3dbb3b796eaadfd2bca593c905a8c5ae", "score": "0.3937126", "text": "func TestPPDWrite(t *testing.T) {\n\ttestPPDWrite(t)\n}", "title": "" }, { "docid": "8ea0a77bed92ccd30e5f5a9f20579496", "score": "0.39285272", "text": "func NetworkTesterCreate() *NetworkTester {\n\t// open PCIExpress BAR\n\tpcieBAR, err := gopcie.PCIeBAROpen(\n\t\tPCIE_BAR_FUNCTION_ID,\n\t\tPCIE_BAR_VENDOR_ID,\n\t\tPCIE_BAR_DEVICE_ID,\n\t\tPCIE_BAR_ID)\n\tif err != nil {\n\t\tLog(LOG_ERR, err.Error())\n\t}\n\n\t// open PCIExpress DMA for writing\n\tpcieDMAWrite := make([]*gopcie.PCIeDMA, len(PCIE_XDMA_DEV_H2C))\n\tfor i := 0; i < len(PCIE_XDMA_DEV_H2C); i++ {\n\t\tpcieDMAWrite[i], err = gopcie.PCIeDMAOpen(PCIE_XDMA_DEV_H2C[i],\n\t\t\tgopcie.PCIE_ACCESS_WRITE)\n\t\tif err != nil {\n\t\t\tLog(LOG_ERR, err.Error())\n\t\t}\n\t}\n\n\t// open PCIExpress DMA for reading\n\tpcieDMARead := make([]*gopcie.PCIeDMA, len(PCIE_XDMA_DEV_C2H))\n\tfor i := 0; i < len(PCIE_XDMA_DEV_C2H); i++ {\n\t\tpcieDMARead[i], err = gopcie.PCIeDMAOpen(PCIE_XDMA_DEV_C2H[i],\n\t\t\tgopcie.PCIE_ACCESS_READ)\n\t\tif err != nil {\n\t\t\tLog(LOG_ERR, err.Error())\n\t\t}\n\t}\n\n\t// create instance of NetworkTester struct\n\tnt := NetworkTester{\n\t\tpcieBAR: pcieBAR,\n\t\tpcieDMAWrite: pcieDMAWrite,\n\t\tpcieDMARead: pcieDMARead,\n\t\t// always enable error checking, can be disabled by the user later\n\t\tcheckErrors: true,\n\t}\n\n\t// make sure hardware version matches software version\n\tnt.checkVersion()\n\n\t// create generator, receiver, interface and control instances. one per\n\t// network interface\n\tnt.gens = make(Generators, N_INTERFACES)\n\tnt.recvs = make(Receivers, N_INTERFACES)\n\tnt.ifaces = make(Interfaces, N_INTERFACES)\n\n\tfor i := 0; i < N_INTERFACES; i++ {\n\t\tnt.gens[i] = &Generator{\n\t\t\tnt: &nt,\n\t\t\tid: i,\n\t\t}\n\t\tnt.recvs[i] = &Receiver{\n\t\t\tnt: &nt,\n\t\t\tid: i,\n\t\t}\n\t\tnt.ifaces[i] = &Interface{\n\t\t\tnt: &nt,\n\t\t\tid: i,\n\t\t}\n\t}\n\n\t// create timestamp core instance\n\tnt.timestamp = &timestamp{\n\t\tnt: &nt,\n\t\tcyclesPerTick: TIMESTAMP_CNTR_CYCLES_PER_TICK_DEFAULT,\n\t\tmode: TimestampModeDisabled,\n\t}\n\n\t// return the created instance\n\treturn &nt\n}", "title": "" } ]
9647b873210526979d097a3177472b54
DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be nonnil.
[ { "docid": "58f52b18737990c68fb60c8f4f7da65f", "score": "0.0", "text": "func (in *Gateway) DeepCopyInto(out *Gateway) {\n\t*out = *in\n\tout.TypeMeta = in.TypeMeta\n\tin.ObjectMeta.DeepCopyInto(&out.ObjectMeta)\n\tin.Status.DeepCopyInto(&out.Status)\n\tin.Spec.DeepCopyInto(&out.Spec)\n\treturn\n}", "title": "" } ]
[ { "docid": "fd68cc5c404d65fa5c03c64949665da7", "score": "0.8089925", "text": "func (in *Size) DeepCopyInto(out *Size) {\n\t*out = *in\n\treturn\n}", "title": "" }, { "docid": "5d6e92034d401db11b2b4eda0e0eefd6", "score": "0.80699086", "text": "func (in *RunnerInfo) DeepCopyInto(out *RunnerInfo) {\n\t*out = *in\n\tif in.Args != nil {\n\t\tin, out := &in.Args, &out.Args\n\t\t*out = make([]string, len(*in))\n\t\tcopy(*out, *in)\n\t}\n\tif in.Command != nil {\n\t\tin, out := &in.Command, &out.Command\n\t\t*out = make([]string, len(*in))\n\t\tcopy(*out, *in)\n\t}\n\tif in.RunnerAnnotation != nil {\n\t\tin, out := &in.RunnerAnnotation, &out.RunnerAnnotation\n\t\t*out = make(map[string]string, len(*in))\n\t\tfor key, val := range *in {\n\t\t\t(*out)[key] = val\n\t\t}\n\t}\n\treturn\n}", "title": "" }, { "docid": "d982116a7c640b8d4621f78e6466b9a1", "score": "0.8059959", "text": "func (in *StoredinfotypeOutputPath) DeepCopyInto(out *StoredinfotypeOutputPath) {\n\t*out = *in\n\treturn\n}", "title": "" }, { "docid": "f8afb71c2d59991b1cbdec6b51f10ad2", "score": "0.805617", "text": "func (in *ConsoleInfo) DeepCopyInto(out *ConsoleInfo) {\n\t*out = *in\n\treturn\n}", "title": "" }, { "docid": "ed9b5634248e3b7802ed71d4cc82b2de", "score": "0.80442554", "text": "func (in *Build) DeepCopyInto(out *Build) {\n\t*out = *in\n\treturn\n}", "title": "" }, { "docid": "30d5a6805fd4fa1a057ce4497fc7b0ff", "score": "0.80342996", "text": "func (in *Build) DeepCopyInto(out *Build) {\n\t*out = *in\n}", "title": "" }, { "docid": "c57a7585eb4b85fbf8808d7ab3ba88f0", "score": "0.8022069", "text": "func (in *All) DeepCopyInto(out *All) {\n\t*out = *in\n\treturn\n}", "title": "" }, { "docid": "e9cb500ebbcbb1ec1b2276e4a6ad7c35", "score": "0.8016534", "text": "func (in *FileSystemInfo) DeepCopyInto(out *FileSystemInfo) {\n\t*out = *in\n\treturn\n}", "title": "" }, { "docid": "5284c00a2adccb70e1714da995a5c3d2", "score": "0.8014533", "text": "func (in *Container) DeepCopyInto(out *Container) {\n\t*out = *in\n\tout.Args = in.Args\n}", "title": "" }, { "docid": "20c3698346fd243d8c96d1b906bf7cd4", "score": "0.80127084", "text": "func (in *MongoDBBackup) DeepCopyInto(out *MongoDBBackup) {\n\t*out = *in\n\treturn\n}", "title": "" }, { "docid": "64f7c5b12b50180e8fc16b78724a33b3", "score": "0.7995357", "text": "func (in *DebugInfo) DeepCopyInto(out *DebugInfo) {\n\t*out = *in\n}", "title": "" }, { "docid": "594e2c3bdd34c995d30cff3b3e04a3b4", "score": "0.7981285", "text": "func (in *Backup) DeepCopyInto(out *Backup) {\n\t*out = *in\n}", "title": "" }, { "docid": "169ad04de6c05bd0b231ad19df0d40da", "score": "0.79728377", "text": "func (in *Selection) DeepCopyInto(out *Selection) {\n\t*out = *in\n\tif in.UseAllDevices != nil {\n\t\tin, out := &in.UseAllDevices, &out.UseAllDevices\n\t\t*out = new(bool)\n\t\t**out = **in\n\t}\n\tif in.Directories != nil {\n\t\tin, out := &in.Directories, &out.Directories\n\t\t*out = make([]Directory, len(*in))\n\t\tcopy(*out, *in)\n\t}\n\treturn\n}", "title": "" }, { "docid": "4c8e7738691e5fc814aa9f04e5a0beb0", "score": "0.7971172", "text": "func (in *DependentObjectReference) DeepCopyInto(out *DependentObjectReference) {\n\t*out = *in\n\treturn\n}", "title": "" }, { "docid": "dc25f670b9ab6635efd1a7f707841646", "score": "0.79705614", "text": "func (in *ObjectReference) DeepCopyInto(out *ObjectReference) {\n\t*out = *in\n}", "title": "" }, { "docid": "dc25f670b9ab6635efd1a7f707841646", "score": "0.79705614", "text": "func (in *ObjectReference) DeepCopyInto(out *ObjectReference) {\n\t*out = *in\n}", "title": "" }, { "docid": "dc25f670b9ab6635efd1a7f707841646", "score": "0.79705614", "text": "func (in *ObjectReference) DeepCopyInto(out *ObjectReference) {\n\t*out = *in\n}", "title": "" }, { "docid": "c6b0eba8d2656b9cbfb96b38ddc4e4ca", "score": "0.7959416", "text": "func (in *MongoDBRestore) DeepCopyInto(out *MongoDBRestore) {\n\t*out = *in\n\treturn\n}", "title": "" }, { "docid": "fcd61e82f34db96b76efba6276644908", "score": "0.79572314", "text": "func (in *ObjectSelector) DeepCopyInto(out *ObjectSelector) {\n\t*out = *in\n\treturn\n}", "title": "" }, { "docid": "1d7086a38f14633785818609a374af11", "score": "0.7956491", "text": "func (in *HostAndPath) DeepCopyInto(out *HostAndPath) {\n\t*out = *in\n}", "title": "" }, { "docid": "d71a08ebbf7d7d2bc0c2ca3727a341a9", "score": "0.79551536", "text": "func (in *OCIContentID) DeepCopyInto(out *OCIContentID) {\n\t*out = *in\n\treturn\n}", "title": "" }, { "docid": "5a741ba8543bcaf0b5e12409151d4a6b", "score": "0.7950183", "text": "func (in *Konnect) DeepCopyInto(out *Konnect) {\n\t*out = *in\n\treturn\n}", "title": "" }, { "docid": "9c50266b4bf090dac9b6eddc2dd56fe1", "score": "0.7947804", "text": "func (in *S2i) DeepCopyInto(out *S2i) {\n\t*out = *in\n\treturn\n}", "title": "" }, { "docid": "3c51337658fc0e9d2966273bd3459022", "score": "0.7946799", "text": "func (in *ObjectReference) DeepCopyInto(out *ObjectReference) {\n\t*out = *in\n\treturn\n}", "title": "" }, { "docid": "3c51337658fc0e9d2966273bd3459022", "score": "0.7946799", "text": "func (in *ObjectReference) DeepCopyInto(out *ObjectReference) {\n\t*out = *in\n\treturn\n}", "title": "" }, { "docid": "3c51337658fc0e9d2966273bd3459022", "score": "0.7946799", "text": "func (in *ObjectReference) DeepCopyInto(out *ObjectReference) {\n\t*out = *in\n\treturn\n}", "title": "" }, { "docid": "33fc96978d0776f1e447efa87c0eae3f", "score": "0.7943054", "text": "func (in *Args) DeepCopyInto(out *Args) {\n\t*out = *in\n}", "title": "" }, { "docid": "a62d2491925276d66a89576351b7bdb4", "score": "0.7940893", "text": "func (in *Replicas) DeepCopyInto(out *Replicas) {\n\t*out = *in\n\treturn\n}", "title": "" }, { "docid": "5a06ad0ad03bce466da4cc53b9ab069a", "score": "0.79321116", "text": "func (in *PvcInfo) DeepCopyInto(out *PvcInfo) {\n\t*out = *in\n\treturn\n}", "title": "" }, { "docid": "04bd8ff77eb66f0d7482e20409a29ad4", "score": "0.79303926", "text": "func (in *Nexus) DeepCopyInto(out *Nexus) {\n\t*out = *in\n\treturn\n}", "title": "" }, { "docid": "9a15d89300bd7975c23b970cd7e97f3d", "score": "0.7928719", "text": "func (in *File) DeepCopyInto(out *File) {\n\t*out = *in\n\treturn\n}", "title": "" }, { "docid": "28b00a91c908578687857cdc8c46f4ee", "score": "0.79254997", "text": "func (in *TestflowStep) DeepCopyInto(out *TestflowStep) {\n\t*out = *in\n\tif in.Config != nil {\n\t\tin, out := &in.Config, &out.Config\n\t\t*out = make([]ConfigElement, len(*in))\n\t\tfor i := range *in {\n\t\t\t(*in)[i].DeepCopyInto(&(*out)[i])\n\t\t}\n\t}\n\treturn\n}", "title": "" }, { "docid": "64d18093ce59b818a52f1604bd3d0643", "score": "0.7924155", "text": "func (in *Copy) DeepCopyInto(out *Copy) {\n\t*out = *in\n\treturn\n}", "title": "" }, { "docid": "fa638bb1ac9efb6a5f0ef2e594d2d3c2", "score": "0.79226726", "text": "func (in *Check) DeepCopyInto(out *Check) {\n\t*out = *in\n}", "title": "" }, { "docid": "b757333658adc8c28495b373c70cdd61", "score": "0.7921565", "text": "func (in *CPUAndMem) DeepCopyInto(out *CPUAndMem) {\n\t*out = *in\n}", "title": "" }, { "docid": "aaeed9dbebc681d54de1c8c2058fad47", "score": "0.79185015", "text": "func (in *PropertyValue) DeepCopyInto(out *PropertyValue) {\n\t*out = *in\n}", "title": "" }, { "docid": "92a781c52ce2acbaf732790f97243de0", "score": "0.7916412", "text": "func (in *AddonObject) DeepCopyInto(out *AddonObject) {\n\t*out = *in\n\treturn\n}", "title": "" }, { "docid": "79e328959883a47a6974d28ff0091ef3", "score": "0.7915221", "text": "func (in *NetcatResult) DeepCopyInto(out *NetcatResult) {\n\t*out = *in\n\treturn\n}", "title": "" }, { "docid": "1fb65e67bcc01531c8fbbd94912d7379", "score": "0.7913744", "text": "func (in *DotConfig) DeepCopyInto(out *DotConfig) {\n\t*out = *in\n}", "title": "" }, { "docid": "c33d03bd1dd1387c878363147f87efb5", "score": "0.791224", "text": "func (in *NetworkVshpereOpts) DeepCopyInto(out *NetworkVshpereOpts) {\n\t*out = *in\n\treturn\n}", "title": "" }, { "docid": "ebde97abbe9aa8149c7ca6159e15bd33", "score": "0.7901901", "text": "func (in *CPUAndMem) DeepCopyInto(out *CPUAndMem) {\n\t*out = *in\n\treturn\n}", "title": "" }, { "docid": "33f5df736c2936ad4e31771a61e88775", "score": "0.7900013", "text": "func (in *MysqlVersion) DeepCopyInto(out *MysqlVersion) {\n\t*out = *in\n}", "title": "" }, { "docid": "619b2a77ef3bb1471e6a23e586917386", "score": "0.78994066", "text": "func (in *CABundleDestination) DeepCopyInto(out *CABundleDestination) {\n\t*out = *in\n\treturn\n}", "title": "" }, { "docid": "f10759a9e3b4b70095a75a8f29f6d525", "score": "0.7895866", "text": "func (in *DeidentifytemplateUnwrapped) DeepCopyInto(out *DeidentifytemplateUnwrapped) {\n\t*out = *in\n\treturn\n}", "title": "" }, { "docid": "dddf435977ebcd6bfaf0b4c062ea8042", "score": "0.78907233", "text": "func (in *Image) DeepCopyInto(out *Image) {\n\t*out = *in\n}", "title": "" }, { "docid": "dddf435977ebcd6bfaf0b4c062ea8042", "score": "0.78907233", "text": "func (in *Image) DeepCopyInto(out *Image) {\n\t*out = *in\n}", "title": "" }, { "docid": "dddf435977ebcd6bfaf0b4c062ea8042", "score": "0.78907233", "text": "func (in *Image) DeepCopyInto(out *Image) {\n\t*out = *in\n}", "title": "" }, { "docid": "dfbb452b64d186c585249239d1b0a5c2", "score": "0.78885376", "text": "func (in *PublishTask) DeepCopyInto(out *PublishTask) {\n\t*out = *in\n\tout.Registry = in.Registry\n}", "title": "" }, { "docid": "23db226639df1ec5bfce6ed220d55ed3", "score": "0.7885397", "text": "func (in *Port) DeepCopyInto(out *Port) {\n\t*out = *in\n}", "title": "" }, { "docid": "23db226639df1ec5bfce6ed220d55ed3", "score": "0.7885397", "text": "func (in *Port) DeepCopyInto(out *Port) {\n\t*out = *in\n}", "title": "" }, { "docid": "d5ca2454336c8c33ddb7dcd75d173870", "score": "0.7884784", "text": "func (in *NodePoolInfo) DeepCopyInto(out *NodePoolInfo) {\n\t*out = *in\n\treturn\n}", "title": "" }, { "docid": "84d6746ddc264a1fefeb930f6dc9a54d", "score": "0.78824633", "text": "func (in *IngestMatch) DeepCopyInto(out *IngestMatch) {\n\t*out = *in\n\treturn\n}", "title": "" }, { "docid": "ae169a241fc750d6d99542ca8b2b06d1", "score": "0.78807515", "text": "func (in *BaseTask) DeepCopyInto(out *BaseTask) {\n\t*out = *in\n}", "title": "" }, { "docid": "7e6f9d20adbbec72ed85dde045cc014d", "score": "0.7876705", "text": "func (in *Partition) DeepCopyInto(out *Partition) {\n\t*out = *in\n\tout.FileSystem = in.FileSystem\n\treturn\n}", "title": "" }, { "docid": "f62c6fe6c0b72d76d8dcc28816c39d82", "score": "0.7874487", "text": "func (in *AquaEnforcerDetailes) DeepCopyInto(out *AquaEnforcerDetailes) {\n\t*out = *in\n}", "title": "" }, { "docid": "fa756ae28922fed925a87b236587b156", "score": "0.7873718", "text": "func (in *Git) DeepCopyInto(out *Git) {\n\t*out = *in\n}", "title": "" }, { "docid": "5c083f2a30b5b88fd1b331509f358f56", "score": "0.7872631", "text": "func (in *Directory) DeepCopyInto(out *Directory) {\n\t*out = *in\n\treturn\n}", "title": "" }, { "docid": "fbac25d82e819c2fbf45aff98d19462c", "score": "0.78667694", "text": "func (in *PingResult) DeepCopyInto(out *PingResult) {\n\t*out = *in\n\treturn\n}", "title": "" }, { "docid": "5186b8d1bfd3abf2fb983694f27e4aed", "score": "0.7864238", "text": "func (in *Image) DeepCopyInto(out *Image) {\n\t*out = *in\n\treturn\n}", "title": "" }, { "docid": "5186b8d1bfd3abf2fb983694f27e4aed", "score": "0.7864238", "text": "func (in *Image) DeepCopyInto(out *Image) {\n\t*out = *in\n\treturn\n}", "title": "" }, { "docid": "1e1088954cae99b323e1b34730ad0490", "score": "0.7864017", "text": "func (in *Proxy) DeepCopyInto(out *Proxy) {\n\t*out = *in\n}", "title": "" }, { "docid": "3131169e9b81994ea411b95e66f60963", "score": "0.7857086", "text": "func (in *MysqldImage) DeepCopyInto(out *MysqldImage) {\n\t*out = *in\n}", "title": "" }, { "docid": "b8c57c3a0f2dfa74226b698b7b8ad2e4", "score": "0.7850463", "text": "func (in *Snapshot) DeepCopyInto(out *Snapshot) {\n\t*out = *in\n\treturn\n}", "title": "" }, { "docid": "170ddf2575c007ccb3fc0068b04801fb", "score": "0.7847258", "text": "func (in *MemoryGibPerVcpuObservation) DeepCopyInto(out *MemoryGibPerVcpuObservation) {\n\t*out = *in\n}", "title": "" }, { "docid": "8f77db9449d807b50cf35ec73f5fcbce", "score": "0.7845812", "text": "func (in *Pool) DeepCopyInto(out *Pool) {\n\t*out = *in\n\treturn\n}", "title": "" }, { "docid": "36a32ca70ca4f4d6247817020e0c08f1", "score": "0.7844324", "text": "func (o *Root) DeepCopyInto(out *Root) {\n\n\ttarget, err := copystructure.Copy(o)\n\tif err != nil {\n\t\tpanic(fmt.Sprintf(\"Unable to deepcopy Root: %s\", err))\n\t}\n\n\t*out = *target.(*Root)\n}", "title": "" }, { "docid": "768111c725e3f5f5235079124e0a96f5", "score": "0.7844181", "text": "func (in *Workspace) DeepCopyInto(out *Workspace) {\n\t*out = *in\n\treturn\n}", "title": "" }, { "docid": "8a90fa08f4b62c55c837bba9860098d3", "score": "0.78368646", "text": "func (in *Flow) DeepCopyInto(out *Flow) {\n\t*out = *in\n\treturn\n}", "title": "" }, { "docid": "f4587e0baa95f420bd0dba802ecd256c", "score": "0.78363496", "text": "func (in *Proxy) DeepCopyInto(out *Proxy) {\n\t*out = *in\n\treturn\n}", "title": "" }, { "docid": "60bb9d5b70e5ef6b1701bd732fca2874", "score": "0.78362787", "text": "func (in *DebugOptions) DeepCopyInto(out *DebugOptions) {\n\t*out = *in\n\treturn\n}", "title": "" }, { "docid": "6af44f744e22e8c655f8c2045f82edd7", "score": "0.78357565", "text": "func (in *ImageBase) DeepCopyInto(out *ImageBase) {\n\t*out = *in\n}", "title": "" }, { "docid": "311404ea3ee92f40e4221355ddad6dfd", "score": "0.7833125", "text": "func (in *PortCheck) DeepCopyInto(out *PortCheck) {\n\t*out = *in\n\treturn\n}", "title": "" }, { "docid": "09e260a9495f25232a2f6fb9adfde18d", "score": "0.7832569", "text": "func (in *BundleObjectReference) DeepCopyInto(out *BundleObjectReference) {\n\t*out = *in\n\treturn\n}", "title": "" }, { "docid": "ac7d637e82c210b8470a3e45007e7831", "score": "0.78313917", "text": "func (in *ContainerRuntime) DeepCopyInto(out *ContainerRuntime) {\n\t*out = *in\n\treturn\n}", "title": "" }, { "docid": "3727ea7357660f79348fd63217d4649b", "score": "0.78286684", "text": "func (in *Version) DeepCopyInto(out *Version) {\n\t*out = *in\n\tif in.Created != nil {\n\t\tin, out := &in.Created, &out.Created\n\t\t*out = new(intstr.IntOrString)\n\t\t**out = **in\n\t}\n\treturn\n}", "title": "" }, { "docid": "83ff2746330e827c5ffb7cb92d668e4f", "score": "0.78254664", "text": "func (in *StepOutput) DeepCopyInto(out *StepOutput) {\n\t*out = *in\n\tif in.Labels != nil {\n\t\tin, out := &in.Labels, &out.Labels\n\t\t*out = make(map[string]string, len(*in))\n\t\tfor key, val := range *in {\n\t\t\t(*out)[key] = val\n\t\t}\n\t}\n\tif in.parsedUrl != nil {\n\t\tout.parsedUrl = DeepCopyUrl(in.parsedUrl)\n\t}\n\treturn\n}", "title": "" }, { "docid": "b97dabd2033a257ea967ae09454b7ca3", "score": "0.78225046", "text": "func (in *ChaosResultSpec) DeepCopyInto(out *ChaosResultSpec) {\n\t*out = *in\n\treturn\n}", "title": "" }, { "docid": "6c5428e893310edb09bf8bfeb46297b4", "score": "0.7821473", "text": "func (in *Info) DeepCopyInto(out *Info) {\n\t*out = *in\n\tif in.AvailableClusterVersions != nil {\n\t\tin, out := &in.AvailableClusterVersions, &out.AvailableClusterVersions\n\t\t*out = make([]string, len(*in))\n\t\tcopy(*out, *in)\n\t}\n\tif in.SupportedClusterVersions != nil {\n\t\tin, out := &in.SupportedClusterVersions, &out.SupportedClusterVersions\n\t\t*out = make([]string, len(*in))\n\t\tcopy(*out, *in)\n\t}\n\treturn\n}", "title": "" }, { "docid": "2abf1d56e28a21e208ed94abae3e2540", "score": "0.7821284", "text": "func (in *NodeParams) DeepCopyInto(out *NodeParams) {\n\t*out = *in\n\treturn\n}", "title": "" }, { "docid": "9d83cc4f04161818cdf7da63378fa24b", "score": "0.78164774", "text": "func (in *FDocument) DeepCopyInto(out *FDocument) {\n\t*out = *in\n\tif in.ID != nil {\n\t\tin, out := &in.ID, &out.ID\n\t\t*out = new(string)\n\t\t**out = **in\n\t}\n\tif in.Path != nil {\n\t\tin, out := &in.Path, &out.Path\n\t\t*out = new(string)\n\t\t**out = **in\n\t}\n\tif in.Published != nil {\n\t\tin, out := &in.Published, &out.Published\n\t\t*out = new(bool)\n\t\t**out = **in\n\t}\n\tif in.Content != nil {\n\t\tin, out := &in.Content, &out.Content\n\t\t*out = new(string)\n\t\t**out = **in\n\t}\n\treturn\n}", "title": "" }, { "docid": "b16819350d4dbfa0a5a19961dffe66e9", "score": "0.7808747", "text": "func (in *ArangoBackupProgress) DeepCopyInto(out *ArangoBackupProgress) {\n\t*out = *in\n\treturn\n}", "title": "" }, { "docid": "1ab7dccf8a6a22edbbc3cbaf437ba91c", "score": "0.7808463", "text": "func (in *OneAgentProxy) DeepCopyInto(out *OneAgentProxy) {\n\t*out = *in\n\treturn\n}", "title": "" }, { "docid": "46827d00f1b80e33018751dea427d715", "score": "0.78078085", "text": "func (in *DataSourceObject) DeepCopyInto(out *DataSourceObject) {\n\t*out = *in\n\tif in.Properties != nil {\n\t\tin, out := &in.Properties, &out.Properties\n\t\t*out = make([]v1.EnvVar, len(*in))\n\t\tfor i := range *in {\n\t\t\t(*in)[i].DeepCopyInto(&(*out)[i])\n\t\t}\n\t}\n\treturn\n}", "title": "" }, { "docid": "3500f1895e195cb0ab50f3e97e4f91e4", "score": "0.7807523", "text": "func (in *AutoDelete) DeepCopyInto(out *AutoDelete) {\n\t*out = *in\n}", "title": "" }, { "docid": "768a732f575798df884d6452e16c6b7f", "score": "0.78041804", "text": "func (in *DeepOne) DeepCopyInto(out *DeepOne) {\n\t*out = *in\n\tout.TypeMeta = in.TypeMeta\n\tin.ObjectMeta.DeepCopyInto(&out.ObjectMeta)\n\tin.Spec.DeepCopyInto(&out.Spec)\n\tout.Status = in.Status\n\treturn\n}", "title": "" }, { "docid": "06564a8f4dc1e0b6ccdd0a451e6ce4c9", "score": "0.78024685", "text": "func (in *APIProperty) DeepCopyInto(out *APIProperty) {\n\t*out = *in\n\treturn\n}", "title": "" }, { "docid": "01b508f74eb653d3628e69f3ddedcd2a", "score": "0.7801203", "text": "func (in *Destination) DeepCopyInto(out *Destination) {\n\t*out = *in\n\treturn\n}", "title": "" }, { "docid": "01b508f74eb653d3628e69f3ddedcd2a", "score": "0.7801203", "text": "func (in *Destination) DeepCopyInto(out *Destination) {\n\t*out = *in\n\treturn\n}", "title": "" }, { "docid": "1f4d6f97d1ffe46d909d150e1cc77749", "score": "0.7801029", "text": "func (in *External) DeepCopyInto(out *External) {\n\t*out = *in\n\treturn\n}", "title": "" }, { "docid": "b7e7523fde1137751076e56a8a3a711e", "score": "0.7798054", "text": "func (in *RbacConfigTarget) DeepCopyInto(out *RbacConfigTarget) {\n\t*out = *in\n\tif in.Services != nil {\n\t\tin, out := &in.Services, &out.Services\n\t\t*out = make([]string, len(*in))\n\t\tcopy(*out, *in)\n\t}\n\tif in.Namespaces != nil {\n\t\tin, out := &in.Namespaces, &out.Namespaces\n\t\t*out = make([]string, len(*in))\n\t\tcopy(*out, *in)\n\t}\n\treturn\n}", "title": "" }, { "docid": "88999343056500ee781727902f489eca", "score": "0.7795242", "text": "func (in *Global) DeepCopyInto(out *Global) {\n\t*out = *in\n\tout.IdentityContext = in.IdentityContext\n}", "title": "" }, { "docid": "db315275db75fe989c440fd49d503f25", "score": "0.77941597", "text": "func (in *Addon) DeepCopyInto(out *Addon) {\n\t*out = *in\n\tif in.Params != nil {\n\t\tin, out := &in.Params, &out.Params\n\t\t*out = make(map[string]string, len(*in))\n\t\tfor key, val := range *in {\n\t\t\t(*out)[key] = val\n\t\t}\n\t}\n\tif in.Deps != nil {\n\t\tin, out := &in.Deps, &out.Deps\n\t\t*out = make([]string, len(*in))\n\t\tcopy(*out, *in)\n\t}\n\treturn\n}", "title": "" }, { "docid": "3fd37fa0a6e40b0c2c4b4779ff65d42b", "score": "0.77927345", "text": "func (in *Selector) DeepCopyInto(out *Selector) {\n\t*out = *in\n}", "title": "" }, { "docid": "c7e1d612f3613418287025d9beb75ebd", "score": "0.7792247", "text": "func (in *NamespacedName) DeepCopyInto(out *NamespacedName) {\n\t*out = *in\n}", "title": "" }, { "docid": "89c71347df6fe684a106ecc7aafaec49", "score": "0.7790981", "text": "func (in *UpdateStrategyDelayedRollingUpdate) DeepCopyInto(out *UpdateStrategyDelayedRollingUpdate) {\n\t*out = *in\n}", "title": "" }, { "docid": "34c8aebd15f9b68121362b956de82e91", "score": "0.7783746", "text": "func (in *LocalReferenceByKindAndName) DeepCopyInto(out *LocalReferenceByKindAndName) {\n\t*out = *in\n\treturn\n}", "title": "" }, { "docid": "fabdc2e250a855e2774e0355dc7af71e", "score": "0.77827454", "text": "func (in *Depth) DeepCopyInto(out *Depth) {\n\t*out = *in\n\tif in.Limit != nil {\n\t\tin, out := &in.Limit, &out.Limit\n\t\t*out = new(intstr.IntOrString)\n\t\t**out = **in\n\t}\n\treturn\n}", "title": "" }, { "docid": "30dacc7875f9f591955fc2c63075047c", "score": "0.7781448", "text": "func (in *DiskVsphereOpts) DeepCopyInto(out *DiskVsphereOpts) {\n\t*out = *in\n\treturn\n}", "title": "" }, { "docid": "7f23713ad64a40a5dcef1f163fd06673", "score": "0.7781078", "text": "func (in *VMSpec) DeepCopyInto(out *VMSpec) {\n\t*out = *in\n\tif in.Zone != nil {\n\t\tin, out := &in.Zone, &out.Zone\n\t\t*out = new(string)\n\t\t**out = **in\n\t}\n\tif in.CustomData != nil {\n\t\tin, out := &in.CustomData, &out.CustomData\n\t\t*out = new(string)\n\t\t**out = **in\n\t}\n\tif in.SecondaryNICs != nil {\n\t\tin, out := &in.SecondaryNICs, &out.SecondaryNICs\n\t\t*out = new([]string)\n\t\tif **in != nil {\n\t\t\tin, out := *in, *out\n\t\t\t*out = make([]string, len(*in))\n\t\t\tcopy(*out, *in)\n\t\t}\n\t}\n}", "title": "" }, { "docid": "42fa4c83c011b43eb1801b15f7a029c9", "score": "0.7780746", "text": "func (in *SamplePointerSubElem) DeepCopyInto(out *SamplePointerSubElem) {\n\t*out = *in\n\treturn\n}", "title": "" }, { "docid": "2c491c9c7a7bfdaf851a1ae13fa61785", "score": "0.7779957", "text": "func (in *Addon) DeepCopyInto(out *Addon) {\n\t*out = *in\n\tif in.AddonObjects != nil {\n\t\tin, out := &in.AddonObjects, &out.AddonObjects\n\t\t*out = make([]AddonObject, len(*in))\n\t\tcopy(*out, *in)\n\t}\n\treturn\n}", "title": "" } ]
f0d2b330e3d7d667895dde51c7bf427d
UpdateOneID returns an update builder for the given id.
[ { "docid": "fb50656831b67cd410c3840ba81859df", "score": "0.64275914", "text": "func (c *UserClient) UpdateOneID(id int) *UserUpdateOne {\n\tmutation := newUserMutation(c.config, OpUpdateOne, withUserID(id))\n\treturn &UserUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "title": "" } ]
[ { "docid": "859b0c0f1a61c166b0a2b7a5eb101c46", "score": "0.71615124", "text": "func (c *BuildingClient) UpdateOneID(id int) *BuildingUpdateOne {\n\tmutation := newBuildingMutation(c.config, OpUpdateOne, withBuildingID(id))\n\treturn &BuildingUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "title": "" }, { "docid": "ead9cb2affc87d8ad025d6973815dc12", "score": "0.70216423", "text": "func (c *BedtypeClient) UpdateOneID(id int) *BedtypeUpdateOne {\n\tmutation := newBedtypeMutation(c.config, OpUpdateOne, withBedtypeID(id))\n\treturn &BedtypeUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "title": "" }, { "docid": "13cca5ad71369b6e0c39dd7fe09c73c6", "score": "0.7010951", "text": "func (c *ModuleClient) UpdateOneID(id int) *ModuleUpdateOne {\n\treturn &ModuleUpdateOne{config: c.config, id: id}\n}", "title": "" }, { "docid": "aeeffd322a5e997fb090b6b87b82e190", "score": "0.6987627", "text": "func (c *ModuleVersionClient) UpdateOneID(id int) *ModuleVersionUpdateOne {\n\treturn &ModuleVersionUpdateOne{config: c.config, id: id}\n}", "title": "" }, { "docid": "eeaecd6ebaa5145874503f3e8e89923e", "score": "0.69720626", "text": "func (c *BillClient) UpdateOneID(id int) *BillUpdateOne {\n\tmutation := newBillMutation(c.config, OpUpdateOne, withBillID(id))\n\treturn &BillUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "title": "" }, { "docid": "eeaecd6ebaa5145874503f3e8e89923e", "score": "0.69720626", "text": "func (c *BillClient) UpdateOneID(id int) *BillUpdateOne {\n\tmutation := newBillMutation(c.config, OpUpdateOne, withBillID(id))\n\treturn &BillUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "title": "" }, { "docid": "eeaecd6ebaa5145874503f3e8e89923e", "score": "0.69720626", "text": "func (c *BillClient) UpdateOneID(id int) *BillUpdateOne {\n\tmutation := newBillMutation(c.config, OpUpdateOne, withBillID(id))\n\treturn &BillUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "title": "" }, { "docid": "887b6ef817fd066b12ba92bfc46d9ae7", "score": "0.6954614", "text": "func (c *MealplanClient) UpdateOneID(id int) *MealplanUpdateOne {\n\tmutation := newMealplanMutation(c.config, OpUpdateOne, withMealplanID(id))\n\treturn &MealplanUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "title": "" }, { "docid": "8ce168dcfe38c0118d0aac90c4b9d150", "score": "0.689346", "text": "func (c *BeerClient) UpdateOneID(id int) *BeerUpdateOne {\n\tmutation := newBeerMutation(c.config, OpUpdateOne, withBeerID(id))\n\treturn &BeerUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "title": "" }, { "docid": "c4d2ed10c44ef550e7556c114f1ca30a", "score": "0.68728864", "text": "func (c *RoomuseClient) UpdateOneID(id int) *RoomuseUpdateOne {\n\tmutation := newRoomuseMutation(c.config, OpUpdateOne, withRoomuseID(id))\n\treturn &RoomuseUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "title": "" }, { "docid": "41f7db5ffa64637eec52d61d009791e7", "score": "0.6870293", "text": "func (c *BookingClient) UpdateOneID(id int) *BookingUpdateOne {\n\tmutation := newBookingMutation(c.config, OpUpdateOne, withBookingID(id))\n\treturn &BookingUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "title": "" }, { "docid": "67d89c9ce3358fa913e781394dc74291", "score": "0.6866837", "text": "func (c *CleaningroomClient) UpdateOneID(id int) *CleaningroomUpdateOne {\n\tmutation := newCleaningroomMutation(c.config, OpUpdateOne, withCleaningroomID(id))\n\treturn &CleaningroomUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "title": "" }, { "docid": "cd374e439e4be7df42210d3a7419b625", "score": "0.6832452", "text": "func (c *LengthtimeClient) UpdateOneID(id int) *LengthtimeUpdateOne {\n\tmutation := newLengthtimeMutation(c.config, OpUpdateOne, withLengthtimeID(id))\n\treturn &LengthtimeUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "title": "" }, { "docid": "4d541b9b1b6fc11d92b163c51be52fd6", "score": "0.6766731", "text": "func (c *ToolClient) UpdateOneID(id int) *ToolUpdateOne {\n\tmutation := newToolMutation(c.config, OpUpdateOne, withToolID(id))\n\treturn &ToolUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "title": "" }, { "docid": "ae268c84ce03cc4192e077fc49d334c1", "score": "0.6758887", "text": "func (c *StatustClient) UpdateOneID(id int) *StatustUpdateOne {\n\tmutation := newStatustMutation(c.config, OpUpdateOne, withStatustID(id))\n\treturn &StatustUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "title": "" }, { "docid": "5b1710bc4e49aebdffd1b86cecd226d6", "score": "0.6757431", "text": "func (c *DrugAllergyClient) UpdateOneID(id int) *DrugAllergyUpdateOne {\n\tmutation := newDrugAllergyMutation(c.config, OpUpdateOne, withDrugAllergyID(id))\n\treturn &DrugAllergyUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "title": "" }, { "docid": "70d16442be46fb8f4838abcf0b7e813e", "score": "0.6731577", "text": "func (c *ClubapplicationClient) UpdateOneID(id int) *ClubapplicationUpdateOne {\n\tmutation := newClubapplicationMutation(c.config, OpUpdateOne, withClubapplicationID(id))\n\treturn &ClubapplicationUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "title": "" }, { "docid": "8281b53ef37c0558d108a3c0daa1da08", "score": "0.67303044", "text": "func (c *AppointmentClient) UpdateOneID(id uuid.UUID) *AppointmentUpdateOne {\n\tmutation := newAppointmentMutation(c.config, OpUpdateOne, withAppointmentID(id))\n\treturn &AppointmentUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "title": "" }, { "docid": "162e69799b1d18e7b1c577a8516c904d", "score": "0.6728446", "text": "func (c *EmptyClient) UpdateOneID(id int) *EmptyUpdateOne {\n\tmutation := newEmptyMutation(c.config, OpUpdateOne, withEmptyID(id))\n\treturn &EmptyUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "title": "" }, { "docid": "ce76b6678831b71541070c77465099ea", "score": "0.6724985", "text": "func (c *AdminClient) UpdateOneID(id int) *AdminUpdateOne {\n\tmutation := newAdminMutation(c.config, OpUpdateOne, withAdminID(id))\n\treturn &AdminUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "title": "" }, { "docid": "0bbe4f18cf53ddd25ecd5891157984b6", "score": "0.67239785", "text": "func (c *OperationroomClient) UpdateOneID(id int) *OperationroomUpdateOne {\n\tmutation := newOperationroomMutation(c.config, OpUpdateOne, withOperationroomID(id))\n\treturn &OperationroomUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "title": "" }, { "docid": "a3f91e635c92f2a73863fc3424d77843", "score": "0.67209023", "text": "func (c *BinaryFileClient) UpdateOneID(id int) *BinaryFileUpdateOne {\n\tmutation := newBinaryFileMutation(c.config, OpUpdateOne, withBinaryFileID(id))\n\treturn &BinaryFileUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "title": "" }, { "docid": "5c8e847a21d5eea234ebba0491c8171b", "score": "0.6718119", "text": "func (c *PhysicianClient) UpdateOneID(id int) *PhysicianUpdateOne {\n\tmutation := newPhysicianMutation(c.config, OpUpdateOne, withPhysicianID(id))\n\treturn &PhysicianUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "title": "" }, { "docid": "5c8e847a21d5eea234ebba0491c8171b", "score": "0.6718119", "text": "func (c *PhysicianClient) UpdateOneID(id int) *PhysicianUpdateOne {\n\tmutation := newPhysicianMutation(c.config, OpUpdateOne, withPhysicianID(id))\n\treturn &PhysicianUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "title": "" }, { "docid": "b27d7f69ec38318d1dca0fc0a50c7d60", "score": "0.67104286", "text": "func (c *RoomdetailClient) UpdateOneID(id int) *RoomdetailUpdateOne {\n\tmutation := newRoomdetailMutation(c.config, OpUpdateOne, withRoomdetailID(id))\n\treturn &RoomdetailUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "title": "" }, { "docid": "c87378dd971298c534f8a1cc67f73555", "score": "0.67062783", "text": "func (c *OperativeClient) UpdateOneID(id int) *OperativeUpdateOne {\n\tmutation := newOperativeMutation(c.config, OpUpdateOne, withOperativeID(id))\n\treturn &OperativeUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "title": "" }, { "docid": "037c0888f85abeead4120bb453760b92", "score": "0.6697794", "text": "func (c *DoctorClient) UpdateOneID(id int) *DoctorUpdateOne {\n\tmutation := newDoctorMutation(c.config, OpUpdateOne, withDoctorID(id))\n\treturn &DoctorUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "title": "" }, { "docid": "1d550d474eb7e9dac01b1520b577212e", "score": "0.66902477", "text": "func (c *DentistClient) UpdateOneID(id int) *DentistUpdateOne {\n\tmutation := newDentistMutation(c.config, OpUpdateOne, withDentistID(id))\n\treturn &DentistUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "title": "" }, { "docid": "2b19b858896e7f3cb22e3b13d560eb5a", "score": "0.6682167", "text": "func (c *UnitOfMedicineClient) UpdateOneID(id int) *UnitOfMedicineUpdateOne {\n\tmutation := newUnitOfMedicineMutation(c.config, OpUpdateOne, withUnitOfMedicineID(id))\n\treturn &UnitOfMedicineUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "title": "" }, { "docid": "f208dbde2de186f6c9ae67ecebf24bd7", "score": "0.66768026", "text": "func (c *LeaseClient) UpdateOneID(id int) *LeaseUpdateOne {\n\tmutation := newLeaseMutation(c.config, OpUpdateOne, withLeaseID(id))\n\treturn &LeaseUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "title": "" }, { "docid": "9a130e23275f62cc0e80d48970b5eb4b", "score": "0.6674605", "text": "func (c *RoomClient) UpdateOneID(id int) *RoomUpdateOne {\n\tmutation := newRoomMutation(c.config, OpUpdateOne, withRoomID(id))\n\treturn &RoomUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "title": "" }, { "docid": "9a130e23275f62cc0e80d48970b5eb4b", "score": "0.6674605", "text": "func (c *RoomClient) UpdateOneID(id int) *RoomUpdateOne {\n\tmutation := newRoomMutation(c.config, OpUpdateOne, withRoomID(id))\n\treturn &RoomUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "title": "" }, { "docid": "45625bad7985127059015f3da8827e1b", "score": "0.66745573", "text": "func (c *PatientroomClient) UpdateOneID(id int) *PatientroomUpdateOne {\n\tmutation := newPatientroomMutation(c.config, OpUpdateOne, withPatientroomID(id))\n\treturn &PatientroomUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "title": "" }, { "docid": "d78748a291dd0bae1902a1df60842c27", "score": "0.66642433", "text": "func (c *JobClient) UpdateOneID(id int) *JobUpdateOne {\n\tmutation := newJobMutation(c.config, OpUpdateOne, withJobID(id))\n\treturn &JobUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "title": "" }, { "docid": "0b8a11901bf002c693682e637605d447", "score": "0.66625804", "text": "func (c *StatusdClient) UpdateOneID(id int) *StatusdUpdateOne {\n\tmutation := newStatusdMutation(c.config, OpUpdateOne, withStatusdID(id))\n\treturn &StatusdUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "title": "" }, { "docid": "15ed95bb0fcd46d291999482fe3493c2", "score": "0.6657183", "text": "func (c *MedicineClient) UpdateOneID(id int) *MedicineUpdateOne {\n\tmutation := newMedicineMutation(c.config, OpUpdateOne, withMedicineID(id))\n\treturn &MedicineUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "title": "" }, { "docid": "6723b2799df6e9b3ad3cef3c58be7702", "score": "0.6656204", "text": "func (c *BuildingClient) UpdateOne(b *Building) *BuildingUpdateOne {\n\tmutation := newBuildingMutation(c.config, OpUpdateOne, withBuilding(b))\n\treturn &BuildingUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "title": "" }, { "docid": "83bc8abc7d7dc76e198ee73224a783c0", "score": "0.66550183", "text": "func (c *CleanernameClient) UpdateOneID(id int) *CleanernameUpdateOne {\n\tmutation := newCleanernameMutation(c.config, OpUpdateOne, withCleanernameID(id))\n\treturn &CleanernameUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "title": "" }, { "docid": "4ff900bea8c01bddf1a9c93874074724", "score": "0.66548914", "text": "func (c *DeviceClient) UpdateOneID(id int) *DeviceUpdateOne {\n\tmutation := newDeviceMutation(c.config, OpUpdateOne, withDeviceID(id))\n\treturn &DeviceUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "title": "" }, { "docid": "43200767c4e4adb49be7c39851a30090", "score": "0.66531366", "text": "func (c *BillingstatusClient) UpdateOneID(id int) *BillingstatusUpdateOne {\n\tmutation := newBillingstatusMutation(c.config, OpUpdateOne, withBillingstatusID(id))\n\treturn &BillingstatusUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "title": "" }, { "docid": "f8fe46a25d174f28ee577e2e266ec3e7", "score": "0.66450125", "text": "func (c *PaymentClient) UpdateOneID(id int) *PaymentUpdateOne {\n\tmutation := newPaymentMutation(c.config, OpUpdateOne, withPaymentID(id))\n\treturn &PaymentUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "title": "" }, { "docid": "f8fe46a25d174f28ee577e2e266ec3e7", "score": "0.66450125", "text": "func (c *PaymentClient) UpdateOneID(id int) *PaymentUpdateOne {\n\tmutation := newPaymentMutation(c.config, OpUpdateOne, withPaymentID(id))\n\treturn &PaymentUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "title": "" }, { "docid": "05dba22aed74e806e954941956001ef0", "score": "0.6636786", "text": "func (c *LevelOfDangerousClient) UpdateOneID(id int) *LevelOfDangerousUpdateOne {\n\tmutation := newLevelOfDangerousMutation(c.config, OpUpdateOne, withLevelOfDangerousID(id))\n\treturn &LevelOfDangerousUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "title": "" }, { "docid": "80c29ebbf12a9d35da7992783d6379eb", "score": "0.66309714", "text": "func (c *FoodmenuClient) UpdateOneID(id int) *FoodmenuUpdateOne {\n\tmutation := newFoodmenuMutation(c.config, OpUpdateOne, withFoodmenuID(id))\n\treturn &FoodmenuUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "title": "" }, { "docid": "b86641a8163be5e9dca3a42cd7643c6b", "score": "0.66269386", "text": "func (c *PostClient) UpdateOneID(id int) *PostUpdateOne {\n\tmutation := newPostMutation(c.config, OpUpdateOne, withPostID(id))\n\treturn &PostUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "title": "" }, { "docid": "34d2d6c2c01c5ebbd0cac9771723cfb3", "score": "0.6623951", "text": "func (c *PharmacistClient) UpdateOneID(id int) *PharmacistUpdateOne {\n\tmutation := newPharmacistMutation(c.config, OpUpdateOne, withPharmacistID(id))\n\treturn &PharmacistUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "title": "" }, { "docid": "bd2990deb14801d46648da28480eca82", "score": "0.66233176", "text": "func (c *ExaminationroomClient) UpdateOneID(id int) *ExaminationroomUpdateOne {\n\tmutation := newExaminationroomMutation(c.config, OpUpdateOne, withExaminationroomID(id))\n\treturn &ExaminationroomUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "title": "" }, { "docid": "3c3967e20697ed042db43964f1a9b8a7", "score": "0.66004527", "text": "func (c *KeyStoreClient) UpdateOneID(id int32) *KeyStoreUpdateOne {\n\tmutation := newKeyStoreMutation(c.config, OpUpdateOne, withKeyStoreID(id))\n\treturn &KeyStoreUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "title": "" }, { "docid": "b30822123691b0748db7c689724558ac", "score": "0.6579094", "text": "func (c *ActivitiesClient) UpdateOneID(id int) *ActivitiesUpdateOne {\n\tmutation := newActivitiesMutation(c.config, OpUpdateOne, withActivitiesID(id))\n\treturn &ActivitiesUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "title": "" }, { "docid": "ea2088bb33e950c661a374ec102fed0a", "score": "0.6575504", "text": "func (c *PatientofphysicianClient) UpdateOneID(id int) *PatientofphysicianUpdateOne {\n\tmutation := newPatientofphysicianMutation(c.config, OpUpdateOne, withPatientofphysicianID(id))\n\treturn &PatientofphysicianUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "title": "" }, { "docid": "120317c6d2ceda7d231fbca3d93ab965", "score": "0.65677005", "text": "func (c *PostAttachmentClient) UpdateOneID(id int) *PostAttachmentUpdateOne {\n\tmutation := newPostAttachmentMutation(c.config, OpUpdateOne, withPostAttachmentID(id))\n\treturn &PostAttachmentUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "title": "" }, { "docid": "8bc9a5179b746c8675f3e85064d1e027", "score": "0.65592045", "text": "func (c *SkillClient) UpdateOneID(id int) *SkillUpdateOne {\n\tmutation := newSkillMutation(c.config, OpUpdateOne, withSkillID(id))\n\treturn &SkillUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "title": "" }, { "docid": "0ea8f70ff2c0883ae11a67a95dac8a20", "score": "0.65578675", "text": "func (c *QueueClient) UpdateOneID(id int) *QueueUpdateOne {\n\tmutation := newQueueMutation(c.config, OpUpdateOne, withQueueID(id))\n\treturn &QueueUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "title": "" }, { "docid": "1ec14bb98d02928c6e98e976ca28e9bd", "score": "0.65515816", "text": "func (c *EventClient) UpdateOneID(id int) *EventUpdateOne {\n\tmutation := newEventMutation(c.config, OpUpdateOne, withEventID(id))\n\treturn &EventUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "title": "" }, { "docid": "417d107d6faecf357dad48e4f8f87aff", "score": "0.65495205", "text": "func (c *DNSBLQueryClient) UpdateOneID(id uuid.UUID) *DNSBLQueryUpdateOne {\n\tmutation := newDNSBLQueryMutation(c.config, OpUpdateOne, withDNSBLQueryID(id))\n\treturn &DNSBLQueryUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "title": "" }, { "docid": "c8415e27874e1dafea70035bc89179fc", "score": "0.6520618", "text": "func (c *SymptomClient) UpdateOneID(id int) *SymptomUpdateOne {\n\tmutation := newSymptomMutation(c.config, OpUpdateOne, withSymptomID(id))\n\treturn &SymptomUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "title": "" }, { "docid": "25c1ea8dc394bff1817e061593aa8c57", "score": "0.65140945", "text": "func (c *PatientClient) UpdateOneID(id int) *PatientUpdateOne {\n\tmutation := newPatientMutation(c.config, OpUpdateOne, withPatientID(id))\n\treturn &PatientUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "title": "" }, { "docid": "25c1ea8dc394bff1817e061593aa8c57", "score": "0.65140945", "text": "func (c *PatientClient) UpdateOneID(id int) *PatientUpdateOne {\n\tmutation := newPatientMutation(c.config, OpUpdateOne, withPatientID(id))\n\treturn &PatientUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "title": "" }, { "docid": "25c1ea8dc394bff1817e061593aa8c57", "score": "0.65140945", "text": "func (c *PatientClient) UpdateOneID(id int) *PatientUpdateOne {\n\tmutation := newPatientMutation(c.config, OpUpdateOne, withPatientID(id))\n\treturn &PatientUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "title": "" }, { "docid": "f66ed4057bb1cf775e8663dc20515d97", "score": "0.65092254", "text": "func (c *NurseClient) UpdateOneID(id int) *NurseUpdateOne {\n\tmutation := newNurseMutation(c.config, OpUpdateOne, withNurseID(id))\n\treturn &NurseUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "title": "" }, { "docid": "586920ff4bffb3e89193a3c1b243d3ee", "score": "0.65040284", "text": "func (c *PurposeClient) UpdateOneID(id int) *PurposeUpdateOne {\n\tmutation := newPurposeMutation(c.config, OpUpdateOne, withPurposeID(id))\n\treturn &PurposeUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "title": "" }, { "docid": "fae0ba1fa306adc46852c96986687e43", "score": "0.64891744", "text": "func (c *OrderClient) UpdateOneID(id int) *OrderUpdateOne {\n\tmutation := newOrderMutation(c.config, OpUpdateOne, withOrderID(id))\n\treturn &OrderUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "title": "" }, { "docid": "3e240de4ee31e2759a309af5af55ca16", "score": "0.6477931", "text": "func (c *DepositClient) UpdateOneID(id int) *DepositUpdateOne {\n\tmutation := newDepositMutation(c.config, OpUpdateOne, withDepositID(id))\n\treturn &DepositUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "title": "" }, { "docid": "d4d7b5116337adce85f3eac07f9bf7da", "score": "0.64730316", "text": "func (c *DispenseMedicineClient) UpdateOneID(id int) *DispenseMedicineUpdateOne {\n\tmutation := newDispenseMedicineMutation(c.config, OpUpdateOne, withDispenseMedicineID(id))\n\treturn &DispenseMedicineUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "title": "" }, { "docid": "6da26212e141c12f7775aae9065f5a0f", "score": "0.64712715", "text": "func (c *PartorderClient) UpdateOneID(id int) *PartorderUpdateOne {\n\tmutation := newPartorderMutation(c.config, OpUpdateOne, withPartorderID(id))\n\treturn &PartorderUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "title": "" }, { "docid": "52c904951c7250d421108b6b5b7f9dec", "score": "0.6469642", "text": "func (c *PlanetClient) UpdateOneID(id int) *PlanetUpdateOne {\n\tmutation := newPlanetMutation(c.config, OpUpdateOne)\n\tmutation.id = &id\n\treturn &PlanetUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "title": "" }, { "docid": "20314a41165eb32d51002cb1dfed2a79", "score": "0.646921", "text": "func (c *StaytypeClient) UpdateOneID(id int) *StaytypeUpdateOne {\n\tmutation := newStaytypeMutation(c.config, OpUpdateOne, withStaytypeID(id))\n\treturn &StaytypeUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "title": "" }, { "docid": "e174909be5604141e3bc4062dd0220ed", "score": "0.6461148", "text": "func (c *UsertypeClient) UpdateOneID(id int) *UsertypeUpdateOne {\n\tmutation := newUsertypeMutation(c.config, OpUpdateOne, withUsertypeID(id))\n\treturn &UsertypeUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "title": "" }, { "docid": "b24b65414e728b6f82b62be36d4f3b2d", "score": "0.645715", "text": "func (c *RentalstatusClient) UpdateOneID(id int) *RentalstatusUpdateOne {\n\tmutation := newRentalstatusMutation(c.config, OpUpdateOne, withRentalstatusID(id))\n\treturn &RentalstatusUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "title": "" }, { "docid": "bab9378fccc47f4ab2f9377569cb2d5e", "score": "0.64520925", "text": "func (c *PetruleClient) UpdateOneID(id int) *PetruleUpdateOne {\n\tmutation := newPetruleMutation(c.config, OpUpdateOne, withPetruleID(id))\n\treturn &PetruleUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "title": "" }, { "docid": "2d0939eaa4256fa3d65149934d377405", "score": "0.64469784", "text": "func (c *ActivityTypeClient) UpdateOneID(id int) *ActivityTypeUpdateOne {\n\tmutation := newActivityTypeMutation(c.config, OpUpdateOne, withActivityTypeID(id))\n\treturn &ActivityTypeUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "title": "" }, { "docid": "163b92032c5349020e72902a63ae1821", "score": "0.6446611", "text": "func (c *WorkExperienceClient) UpdateOneID(id int) *WorkExperienceUpdateOne {\n\tmutation := newWorkExperienceMutation(c.config, OpUpdateOne, withWorkExperienceID(id))\n\treturn &WorkExperienceUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "title": "" }, { "docid": "3bb966cbb10ea1ee110852169eb763a8", "score": "0.6440331", "text": "func (c *TasteClient) UpdateOneID(id int) *TasteUpdateOne {\n\tmutation := newTasteMutation(c.config, OpUpdateOne, withTasteID(id))\n\treturn &TasteUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "title": "" }, { "docid": "31e1e91d9dfdf44b5cbce5f2c2d29c61", "score": "0.64351696", "text": "func (c *OperativerecordClient) UpdateOneID(id int) *OperativerecordUpdateOne {\n\tmutation := newOperativerecordMutation(c.config, OpUpdateOne, withOperativerecordID(id))\n\treturn &OperativerecordUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "title": "" }, { "docid": "41db60388af7e6d9a0ed82f5bc22a9f5", "score": "0.642902", "text": "func (c *OperationClient) UpdateOneID(id uuid.UUID) *OperationUpdateOne {\n\tmutation := newOperationMutation(c.config, OpUpdateOne, withOperationID(id))\n\treturn &OperationUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "title": "" }, { "docid": "de237fbd3708bdc9bf5a43b8fc105a23", "score": "0.6426236", "text": "func (c *FacultyClient) UpdateOneID(id int) *FacultyUpdateOne {\n\tmutation := newFacultyMutation(c.config, OpUpdateOne, withFacultyID(id))\n\treturn &FacultyUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "title": "" }, { "docid": "6efbafeec54053e27b5cdd07fdbcc925", "score": "0.642493", "text": "func (c *MedicineTypeClient) UpdateOneID(id int) *MedicineTypeUpdateOne {\n\tmutation := newMedicineTypeMutation(c.config, OpUpdateOne, withMedicineTypeID(id))\n\treturn &MedicineTypeUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "title": "" }, { "docid": "d2f3178845112fc4417dc148c621d24c", "score": "0.6423679", "text": "func (c *AdminSessionClient) UpdateOneID(id int) *AdminSessionUpdateOne {\n\tmutation := newAdminSessionMutation(c.config, OpUpdateOne, withAdminSessionID(id))\n\treturn &AdminSessionUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "title": "" }, { "docid": "98c4d21b37d8dbc8da48c6991536d6df", "score": "0.6423476", "text": "func (c *TransactionClient) UpdateOneID(id int32) *TransactionUpdateOne {\n\tmutation := newTransactionMutation(c.config, OpUpdateOne, withTransactionID(id))\n\treturn &TransactionUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "title": "" }, { "docid": "0974b03e0ff268c8ccc9c6593f431d94", "score": "0.6420463", "text": "func (c *UnsavedPostAttachmentClient) UpdateOneID(id int) *UnsavedPostAttachmentUpdateOne {\n\tmutation := newUnsavedPostAttachmentMutation(c.config, OpUpdateOne, withUnsavedPostAttachmentID(id))\n\treturn &UnsavedPostAttachmentUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "title": "" }, { "docid": "0df2d5f47d0b1aca38ea93d4cd282e1f", "score": "0.6419567", "text": "func (c *EatinghistoryClient) UpdateOneID(id int) *EatinghistoryUpdateOne {\n\tmutation := newEatinghistoryMutation(c.config, OpUpdateOne, withEatinghistoryID(id))\n\treturn &EatinghistoryUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "title": "" }, { "docid": "38dbeba4c7f7488eb824e840c47a3ad4", "score": "0.6415439", "text": "func (c *UnsavedPostClient) UpdateOneID(id int) *UnsavedPostUpdateOne {\n\tmutation := newUnsavedPostMutation(c.config, OpUpdateOne, withUnsavedPostID(id))\n\treturn &UnsavedPostUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "title": "" }, { "docid": "c05fac6c96121501a12b48c79d9df2b3", "score": "0.64131147", "text": "func (c *UserWalletClient) UpdateOneID(id int64) *UserWalletUpdateOne {\n\tmutation := newUserWalletMutation(c.config, OpUpdateOne, withUserWalletID(id))\n\treturn &UserWalletUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "title": "" }, { "docid": "0ceed9f5612d06bdeb17ec227ffe9599", "score": "0.6409662", "text": "func (c *RepairinvoiceClient) UpdateOneID(id int) *RepairinvoiceUpdateOne {\n\tmutation := newRepairinvoiceMutation(c.config, OpUpdateOne, withRepairinvoiceID(id))\n\treturn &RepairinvoiceUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "title": "" }, { "docid": "c59f1a5981f3d22b51a89db9a20e2745", "score": "0.6407158", "text": "func (c *ClubappStatusClient) UpdateOneID(id int) *ClubappStatusUpdateOne {\n\tmutation := newClubappStatusMutation(c.config, OpUpdateOne, withClubappStatusID(id))\n\treturn &ClubappStatusUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "title": "" }, { "docid": "e009eeafa2afec87fa83190ad6262276", "score": "0.64018244", "text": "func (c *UserClient) UpdateOneID(id int64) *UserUpdateOne {\n\tmutation := newUserMutation(c.config, OpUpdateOne, withUserID(id))\n\treturn &UserUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "title": "" }, { "docid": "7e1faebee99eb543c298933329abfd14", "score": "0.63964146", "text": "func (c *PledgeClient) UpdateOneID(id int) *PledgeUpdateOne {\n\tmutation := newPledgeMutation(c.config, OpUpdateOne, withPledgeID(id))\n\treturn &PledgeUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "title": "" }, { "docid": "64c4af721b33fe94aae5e1a73fc5362b", "score": "0.63946825", "text": "func (c *AnnotationClient) UpdateOneID(id int) *AnnotationUpdateOne {\n\tmutation := newAnnotationMutation(c.config, OpUpdateOne, withAnnotationID(id))\n\treturn &AnnotationUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "title": "" }, { "docid": "14653e4f55c1ac24e5a729b2b48bfed5", "score": "0.6385547", "text": "func (c *ComplaintClient) UpdateOneID(id int) *ComplaintUpdateOne {\n\tmutation := newComplaintMutation(c.config, OpUpdateOne, withComplaintID(id))\n\treturn &ComplaintUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "title": "" }, { "docid": "02ff60b4bd8a4e873af185633ccdda25", "score": "0.63830286", "text": "func (c *PatientInfoClient) UpdateOneID(id int) *PatientInfoUpdateOne {\n\tmutation := newPatientInfoMutation(c.config, OpUpdateOne, withPatientInfoID(id))\n\treturn &PatientInfoUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "title": "" }, { "docid": "253617b8727b60119625f0b47793c542", "score": "0.6376113", "text": "func (c *BillClient) UpdateOne(b *Bill) *BillUpdateOne {\n\tmutation := newBillMutation(c.config, OpUpdateOne, withBill(b))\n\treturn &BillUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "title": "" }, { "docid": "253617b8727b60119625f0b47793c542", "score": "0.6376113", "text": "func (c *BillClient) UpdateOne(b *Bill) *BillUpdateOne {\n\tmutation := newBillMutation(c.config, OpUpdateOne, withBill(b))\n\treturn &BillUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "title": "" }, { "docid": "253617b8727b60119625f0b47793c542", "score": "0.6376113", "text": "func (c *BillClient) UpdateOne(b *Bill) *BillUpdateOne {\n\tmutation := newBillMutation(c.config, OpUpdateOne, withBill(b))\n\treturn &BillUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "title": "" }, { "docid": "44673360a36ac74eba2072bf77407848", "score": "0.6372358", "text": "func (c *BranchClient) UpdateOneID(id int) *BranchUpdateOne {\n\tmutation := newBranchMutation(c.config, OpUpdateOne, withBranchID(id))\n\treturn &BranchUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "title": "" } ]
c6aac8c49a98342da728c2ff9c923aec
SetStatusMessage gets a reference to the given string and assigns it to the StatusMessage field.
[ { "docid": "2355160fe4ca55af0b86a18e42aaf704", "score": "0.5344203", "text": "func (o *BulkResult) SetStatusMessage(v string) {\n\to.StatusMessage = &v\n}", "title": "" } ]
[ { "docid": "cf935e7b0eea89204eb2a952d9e8bd0e", "score": "0.66474676", "text": "func (o ReplicationSetRegionOutput) StatusMessage() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v ReplicationSetRegion) *string { return v.StatusMessage }).(pulumi.StringPtrOutput)\n}", "title": "" }, { "docid": "3260a264da1d76a73fb24d96f26b849f", "score": "0.6604554", "text": "func (o LookupRegionCommitmentResultOutput) StatusMessage() pulumi.StringOutput {\n\treturn o.ApplyT(func(v LookupRegionCommitmentResult) string { return v.StatusMessage }).(pulumi.StringOutput)\n}", "title": "" }, { "docid": "53107f32a0c993193760bb69c0877c03", "score": "0.6591767", "text": "func (o PartnerOutput) StatusMessage() pulumi.StringOutput {\n\treturn o.ApplyT(func(v *Partner) pulumi.StringOutput { return v.StatusMessage }).(pulumi.StringOutput)\n}", "title": "" }, { "docid": "ace0556d84aa6574875905096b464543", "score": "0.6572316", "text": "func (o NetworkInsightsAnalysisOutput) StatusMessage() pulumi.StringOutput {\n\treturn o.ApplyT(func(v *NetworkInsightsAnalysis) pulumi.StringOutput { return v.StatusMessage }).(pulumi.StringOutput)\n}", "title": "" }, { "docid": "920602690ef2eaec4661841e5ea6ee93", "score": "0.6566108", "text": "func (o *InlineResponse200115) SetMessageStatus(v string) {\n\to.MessageStatus = &v\n}", "title": "" }, { "docid": "40de0ade31c81f5ed990714d673e952b", "score": "0.65545523", "text": "func (r *Response) SetStatusMessage(message string) *Response {\n\tmsg, err := r.getDefaultStatusMessage(r.statusCode)\n\tif nil == err {\n\t\tmessage = msg + \" - \" + message\n\t}\n\tr.statusMessage = message\n\treturn r\n}", "title": "" }, { "docid": "38e83c243ae70a6d6d9bec2b32684080", "score": "0.64466375", "text": "func (o LookupInstanceResultOutput) StatusMessage() pulumi.StringOutput {\n\treturn o.ApplyT(func(v LookupInstanceResult) string { return v.StatusMessage }).(pulumi.StringOutput)\n}", "title": "" }, { "docid": "42dce34a5ff8d54eaac00205890fef3e", "score": "0.6430898", "text": "func (o StreamProcessorOutput) StatusMessage() pulumi.StringOutput {\n\treturn o.ApplyT(func(v *StreamProcessor) pulumi.StringOutput { return v.StatusMessage }).(pulumi.StringOutput)\n}", "title": "" }, { "docid": "d9399fea0143c378a9137f11579925a8", "score": "0.63968116", "text": "func (o *InlineResponse20049Post) SetMessageStatus(v string) {\n\to.MessageStatus = &v\n}", "title": "" }, { "docid": "95b36fbb8c5311856cd7dd474b8b35c3", "score": "0.63880265", "text": "func (audit *Audit) SetStatusMessage(message string) {\n\taudit.statusMessage = message\n}", "title": "" }, { "docid": "4a5f184a6fecea2bdc13a829799116b8", "score": "0.6385597", "text": "func (r *Response) StatusMessage() string {\n\treturn r.statusMessage\n}", "title": "" }, { "docid": "65d0b7de40ea9ec26258c77a2d3cc5d4", "score": "0.6354695", "text": "func (o GetReplicationSetRegionOutput) StatusMessage() pulumi.StringOutput {\n\treturn o.ApplyT(func(v GetReplicationSetRegion) string { return v.StatusMessage }).(pulumi.StringOutput)\n}", "title": "" }, { "docid": "ef8cb2f7f1f6cbeab5489159cb8ef734", "score": "0.62870234", "text": "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}", "title": "" }, { "docid": "d3e75e6fe9510568c2806d6318f2c498", "score": "0.62869126", "text": "func (o LookupProvisioningConfigResultOutput) StatusMessage() pulumi.StringOutput {\n\treturn o.ApplyT(func(v LookupProvisioningConfigResult) string { return v.StatusMessage }).(pulumi.StringOutput)\n}", "title": "" }, { "docid": "313a445ce5406c07ef50c8933d4b9031", "score": "0.6186106", "text": "func (o *InlineResponse200115) GetMessageStatus() string {\n\tif o == nil || o.MessageStatus == nil {\n\t\tvar ret string\n\t\treturn ret\n\t}\n\treturn *o.MessageStatus\n}", "title": "" }, { "docid": "8f2e02320c776c314b369d356b3ce2b1", "score": "0.6147205", "text": "func (h *ResponseHeader) SetStatusMessage(statusMessage []byte) {\n\th.statusMessage = append(h.statusMessage[:0], statusMessage...)\n}", "title": "" }, { "docid": "058bee98c30559f9d635d082d845a1c0", "score": "0.60473377", "text": "func (o *InlineResponse20049Post) GetMessageStatus() string {\n\tif o == nil || o.MessageStatus == nil {\n\t\tvar ret string\n\t\treturn ret\n\t}\n\treturn *o.MessageStatus\n}", "title": "" }, { "docid": "7e83f35185ae1fc17efaaa61b78fe4cc", "score": "0.6010226", "text": "func (m *PresenceStatusMessage) SetMessage(value ItemBodyable)() {\n err := m.GetBackingStore().Set(\"message\", value)\n if err != nil {\n panic(err)\n }\n}", "title": "" }, { "docid": "a1911d37a3d284b4aa5455ac6adb1900", "score": "0.598863", "text": "func (m *Message) GetStatus() string {\n\tif m.Status == \"\" {\n\t\tm.Status = StatusInfo\n\t}\n\treturn m.Status\n}", "title": "" }, { "docid": "16be63983ce381615e38ed9b0b1fae8a", "score": "0.5957988", "text": "func (bar *StatusBar) Set(inString string, pos int) {\n\tif pos > len(bar.Messages)-1 || pos < 0 {\n\t\tinString = \"Statusbar error: Invalid range to setting this message -> \" + inString\n\t\tpos = len(bar.Messages) - 1\n\t}\n\tbar.Messages[pos] = inString\n\tbar.Disp()\n}", "title": "" }, { "docid": "ce9a43f6fdc657f13b4e711a333b66b1", "score": "0.5917494", "text": "func (b *Bot) SetStatusMessage(newStatusMessage string) {\n\tv := url.Values{\"role\": {b.BotId}, \"type\": {\"profile\"}, \"dataType\": {\"hitokoto\"}, \"hitokoto\": {newStatusMessage}}\n\trequest, _ := http.NewRequest(\"POST\", fmt.Sprintf(\"https://admin-official.line.me/%v/account/profile/hitokoto\", b.BotId), strings.NewReader(v.Encode()))\n\trequest.Header.Set(\"Content-Type\", \"application/x-www-form-urlencoded; charset=UTF-8\")\n\trequest.Header.Set(\"X-CSRF-Token\", b.xrt)\n\tresponse, _ := b.client.Do(request)\n\tdefer response.Body.Close()\n}", "title": "" }, { "docid": "765363164a5257ee445eac1040bf95cb", "score": "0.59083575", "text": "func (s *Status) Message() string {\n\tif s.s.Message == \"\" {\n\t\treturn strconv.Itoa(int(s.s.Code))\n\t}\n\treturn s.s.Message\n}", "title": "" }, { "docid": "b1433cf77520ac13825c8463cacbf8d3", "score": "0.5883211", "text": "func (h *Header) SetMessageStatusType(mt MessageStatusType) {\n\th[2] = h[2] | (byte(mt) & 0x03)\n}", "title": "" }, { "docid": "dcecb71abc07eff48773bc894bfc9d9d", "score": "0.58737576", "text": "func (s *Status) Message() string {\n\tif s.s.Message == \"\" {\n\t\treturn strconv.Itoa(int(s.s.Code))\n\t}\n\n\t//\n\treturn s.s.Message\n}", "title": "" }, { "docid": "e93c0060b4f42d4d9b476a9ef98b6228", "score": "0.58559144", "text": "func statusMsg(c cmd, t StatusType, msg string) string {\n\ts := c.name\n\tswitch t {\n\tcase StatusSuccess:\n\t\ts += \" succeeded\"\n\tcase StatusTransitioning:\n\t\ts += \" in progress\"\n\tcase StatusError:\n\t\ts += \" failed\"\n\t}\n\n\tif msg != \"\" {\n\t\t// append the original\n\t\ts += \": \" + msg\n\t}\n\treturn s\n}", "title": "" }, { "docid": "b5a02c06d248f483197b0d692c29ede4", "score": "0.58362526", "text": "func (m *ThreatAssessmentResult) SetMessage(value *string)() {\n m.message = value\n}", "title": "" }, { "docid": "207e9245f36c3f55c974297e0aaff934", "score": "0.5830564", "text": "func (s *Status) Message() string {\n\tif s == nil || s.s == nil {\n\t\treturn \"\"\n\t}\n\n\treturn s.s.Message\n}", "title": "" }, { "docid": "a0f51e28143a7156cdd1b25fd1ae2f57", "score": "0.5798503", "text": "func ConvertStatusString(color string) int {\n\tswitch strings.ToLower(color) {\n\tcase \"green\":\n\t\treturn StatusGreen\n\tcase \"yellow\":\n\t\treturn StatusYellow\n\tcase \"red\":\n\t\treturn StatusRed\n\tdefault:\n\t\treturn StatusUnknown\n\t}\n}", "title": "" }, { "docid": "a6f623a530efcf16a31b311abbf5a059", "score": "0.5783027", "text": "func (audit Audit) GetStatusMessage() string {\n\treturn audit.statusMessage\n}", "title": "" }, { "docid": "7645215065fc2b8238805789ca023874", "score": "0.5779688", "text": "func (h *ResponseHeader) StatusMessage() []byte {\n\treturn h.statusMessage\n}", "title": "" }, { "docid": "72734c946c46362a2fc7dfbc16f3d0ae", "score": "0.5776777", "text": "func (m *VMStatus) GetMessage() (x string) {\n\tif m == nil {\n\t\treturn x\n\t}\n\treturn m.Message\n}", "title": "" }, { "docid": "c84f8bad055c890984884ee83d6f063c", "score": "0.5723165", "text": "func StatusText(status int) string {\n\ts, found := statusText[status]\n\tif !found {\n\t\ts = \"Status \" + strconv.Itoa(status)\n\t}\n\treturn s\n}", "title": "" }, { "docid": "773df68462e9e890ba9c384cdb62e3c3", "score": "0.56796217", "text": "func (o JobStatusErrorOutput) Message() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v JobStatusError) *string { return v.Message }).(pulumi.StringPtrOutput)\n}", "title": "" }, { "docid": "6e5dc96d8bd282d95d434b7777a14304", "score": "0.56793547", "text": "func DispatcherStatusString(s string) (DispatcherStatus, error) {\n\tif val, ok := _DispatcherStatusNameToValueMap[s]; ok {\n\t\treturn val, nil\n\t}\n\treturn 0, fmt.Errorf(\"%s does not belong to DispatcherStatus values\", s)\n}", "title": "" }, { "docid": "c2c7db561d16dfee78c1c5fc111eaaf9", "score": "0.567504", "text": "func (c *Context) SetMessage(b string) {\n\tc.ensureResponse()\n\tc.response.Text = b\n}", "title": "" }, { "docid": "254b196974c1eb84feee8d4784bcf3cb", "score": "0.56133276", "text": "func BindStatusString(s string) (BindStatus, error) {\n\tif val, ok := _BindStatusNameToValueMap[s]; ok {\n\t\treturn val, nil\n\t}\n\treturn 0, fmt.Errorf(\"%s does not belong to BindStatus values\", s)\n}", "title": "" }, { "docid": "784ce34e9992919cf515ab24b26c391e", "score": "0.56078917", "text": "func (m *StatusMessage) String() string {\n\treturn \"<Status: \" + m.Status + \". Message: \" + m.Message + \">\"\n}", "title": "" }, { "docid": "b143a059123f4329387464cb1e4e9d81", "score": "0.5576995", "text": "func CartridgeStatusString(s string) (CartridgeStatus, error) {\n\tif val, ok := _CartridgeStatusNameToValueMap[s]; ok {\n\t\treturn val, nil\n\t}\n\treturn 0, fmt.Errorf(\"%s does not belong to CartridgeStatus values\", s)\n}", "title": "" }, { "docid": "b7336a98cc2388e15b7b8f0660922f2d", "score": "0.55731475", "text": "func (aerc *Aerc) SetStatus(status string) *StatusMessage {\n\treturn aerc.statusline.Set(status)\n}", "title": "" }, { "docid": "d4724227d539fabb1787faf95e3909f7", "score": "0.5570432", "text": "func (o *RequestStatusMetadata) SetMessage(v string) {\n\to.Message = &v\n}", "title": "" }, { "docid": "b4f7945fd60e9000056b4fb5da048ec6", "score": "0.55613536", "text": "func (o *DataPlaneClusterUpdateStatusRequestConditions) GetMessage() string {\n\tif o == nil || o.Message == nil {\n\t\tvar ret string\n\t\treturn ret\n\t}\n\treturn *o.Message\n}", "title": "" }, { "docid": "4f0220a4f4c122a4a7c6a95a9fc50a9f", "score": "0.5558333", "text": "func StatusText(code int) string {\n\treturn statusText[code]\n}", "title": "" }, { "docid": "4f0220a4f4c122a4a7c6a95a9fc50a9f", "score": "0.5558333", "text": "func StatusText(code int) string {\n\treturn statusText[code]\n}", "title": "" }, { "docid": "4f0220a4f4c122a4a7c6a95a9fc50a9f", "score": "0.5558333", "text": "func StatusText(code int) string {\n\treturn statusText[code]\n}", "title": "" }, { "docid": "04524663d2f57aa7e2cfc9da94f8280c", "score": "0.55540085", "text": "func (o *DataPlaneClusterUpdateStatusRequestConditions) SetMessage(v string) {\n\to.Message = &v\n}", "title": "" }, { "docid": "f9f73691831e7d4ef2596e6d640a06b1", "score": "0.55436337", "text": "func Message(status bool, message string) map[string]interface{} {\n\treturn map[string]interface{}{\n\t\t\"status\": status,\n\t\t\"message\": message}\n}", "title": "" }, { "docid": "c6fccdd8a33a349a444345351e632cc5", "score": "0.55326986", "text": "func (m *Manager) Status(ctx context.Context, id, providerMsgID string) (*MessageStatus, error) {\n\tparts := strings.SplitN(providerMsgID, \":\", 2)\n\tif len(parts) != 2 {\n\t\treturn nil, errors.Errorf(\"invalid provider message ID '%s'\", providerMsgID)\n\t}\n\n\tprovider := m.providers[parts[0]]\n\tif provider == nil {\n\t\treturn nil, errors.Errorf(\"unknown provider ID '%s'\", parts[0])\n\t}\n\n\tctx, sp := trace.StartSpan(ctx, \"NotificationManager.Status\")\n\tsp.AddAttributes(\n\t\ttrace.StringAttribute(\"provider.id\", parts[0]),\n\t\ttrace.StringAttribute(\"provider.message.id\", parts[1]),\n\t)\n\tdefer sp.End()\n\tstat, err := provider.Status(ctx, id, parts[1])\n\tif stat != nil {\n\t\tstat = stat.wrap(ctx, provider)\n\t}\n\treturn stat, err\n}", "title": "" }, { "docid": "18b62d52a9cf9e59ebc5d987472e96c0", "score": "0.5523774", "text": "func (a *App) UpdateStatusPutMessage(input *InputCash) error {\n\tvar err error\n\terr = a.CheckAndRetryConnection()\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tstmt, err := a.DB.Prepare(\"UPDATE `topup` SET flag_queue=? WHERE id=?\")\n\tif err != nil {\n\t\treturn err\n\t}\n\tdefer stmt.Close()\n\n\tupdateTime := time.Now()\n\tinput.UpdatedAt = &updateTime\n\n\tres, err := a.Exec(stmt, 1, input.ID)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\trowCnt, err := res.RowsAffected()\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tif rowCnt < 1 {\n\t\treturn fmt.Errorf(\"0 row effect\")\n\t}\n\n\treturn err\n}", "title": "" }, { "docid": "e8f48287f7db40deb72dfe34ff1b4a81", "score": "0.55189455", "text": "func Message(status bool, message string) map[string]interface{} {\n\treturn map[string]interface{}{\n\t\t\"status\": status, \"message\": message,\n\t}\n}", "title": "" }, { "docid": "75822c4c0156eec447445138c4f12a75", "score": "0.549813", "text": "func GetStatusText(code int) string {\n\treturn MsgFlags[code]\n}", "title": "" }, { "docid": "7201d0efde9feb56ec42e1de99c92df5", "score": "0.54842967", "text": "func (o *RequestStatusMetadata) GetMessage() *string {\n\tif o == nil {\n\t\treturn nil\n\t}\n\n\treturn o.Message\n}", "title": "" }, { "docid": "29faed1a27ddf3b5eba0767adb082723", "score": "0.5451146", "text": "func MessageSetLabel(vm *VM, target, locals Interface, msg *Message) Interface {\n\tm := target.(*Message)\n\ts, stop := msg.StringArgAt(vm, locals, 0)\n\tif stop != nil {\n\t\treturn stop\n\t}\n\tm.Label = s.String()\n\treturn target\n}", "title": "" }, { "docid": "e6c083347deb3cd7ccecbe5ebe037372", "score": "0.54404074", "text": "func (m *AccessPackageAssignment) SetStatus(value *string)() {\n m.status = value\n}", "title": "" }, { "docid": "56008964b850c8af28db39948d95376d", "score": "0.5434358", "text": "func (_m *Notifier) Status(message string) {\n\t_m.Called(message)\n}", "title": "" }, { "docid": "46baa3eb411b821a896646bf0d793e97", "score": "0.54300916", "text": "func (o ApplicationStatusConditionsOutput) Message() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v ApplicationStatusConditions) *string { return v.Message }).(pulumi.StringPtrOutput)\n}", "title": "" }, { "docid": "bc212e45298febca0cdee9125a4872c1", "score": "0.5386188", "text": "func (a *abaImpl) StatusString() string {\n\treturn fmt.Sprintf(\n\t\t\"{ABA:Mostefaoui, R=%v, %v, %v, %v, %v, out=%+v}\",\n\t\ta.round,\n\t\ta.varBinVals.statusString(),\n\t\ta.varAuxVals.statusString(),\n\t\ta.uponDecisionInputs.statusString(),\n\t\ta.varDone.statusString(),\n\t\ta.output,\n\t)\n}", "title": "" }, { "docid": "b8ce5f07d14b35b34502398bfb356526", "score": "0.5382997", "text": "func NewStatus(s int, m string) StatusObject {\n\treturn StatusObject{Status: s, Message: m}\n}", "title": "" }, { "docid": "6163e7f93b5121278133d36693c8517e", "score": "0.5381097", "text": "func (i Internet) StatusCodeWithMessage() string {\n\tindex := i.Faker.IntBetween(0, len(statusCodes)-1)\n\treturn statusCodes[index] + \" \" + statusCodeMessages[index]\n}", "title": "" }, { "docid": "e4cd445c5160a725e072f133896c5867", "score": "0.5374819", "text": "func (s *Service) SetStatusMessage(v string) *Service {\n\ts.StatusMessage = &v\n\treturn s\n}", "title": "" }, { "docid": "d14613650a8ef9b7feb9dc51d98ef997", "score": "0.5373941", "text": "func (o *ApplianceImageBundleAllOf) SetStatusMessage(v string) {\n\to.StatusMessage = &v\n}", "title": "" }, { "docid": "01c6b5d0f0ae695af4cb2fc8df602a1d", "score": "0.5369963", "text": "func (s *ResourceShareAssociation) SetStatusMessage(v string) *ResourceShareAssociation {\n\ts.StatusMessage = &v\n\treturn s\n}", "title": "" }, { "docid": "aaa7b8a43996012cb176d9f1b2b53cc0", "score": "0.5363522", "text": "func (o ApplicationStatusOperationStatePtrOutput) Message() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v *ApplicationStatusOperationState) *string {\n\t\tif v == nil {\n\t\t\treturn nil\n\t\t}\n\t\treturn v.Message\n\t}).(pulumi.StringPtrOutput)\n}", "title": "" }, { "docid": "9185f8412eb3ff047fb29dd642733c7a", "score": "0.53358006", "text": "func strStatefulSetStatus(status *apps.StatefulSetStatus) string {\n\treturn fmt.Sprintf(\n\t\t\"ObservedGeneration:%d Replicas:%d ReadyReplicas:%d CurrentReplicas:%d UpdatedReplicas:%d CurrentRevision:%s UpdateRevision:%s\",\n\t\tstatus.ObservedGeneration,\n\t\tstatus.Replicas,\n\t\tstatus.ReadyReplicas,\n\t\tstatus.CurrentReplicas,\n\t\tstatus.UpdatedReplicas,\n\t\tstatus.CurrentRevision,\n\t\tstatus.UpdateRevision,\n\t)\n}", "title": "" }, { "docid": "f3b3027aff0135140bbd75721786b4f1", "score": "0.5320734", "text": "func (o KubernetesClusterStatusConditionsOutput) Message() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v KubernetesClusterStatusConditions) *string { return v.Message }).(pulumi.StringPtrOutput)\n}", "title": "" }, { "docid": "94494b379b023999acd246f8d53e7780", "score": "0.53186697", "text": "func MessageString(m events.Message) string {\n\ta := \"\"\n\tfor k, v := range m.Actor.Attributes {\n\t\ta += fmt.Sprintf(\" %s: %s\\n\", k, v)\n\t}\n\treturn fmt.Sprintf(\"ID: %s\\n Status: %s\\n From: %s\\n Type: %s\\n Action: %s\\n Actor ID: %s\\n Actor Attributes: \\n%s\\n Scope: %s\\n Time: %d\\n TimeNano: %d\\n\\n\",\n\t\tm.ID, m.Status, m.From, m.Type, m.Action, m.Actor.ID, a, m.Scope, m.Time, m.TimeNano)\n}", "title": "" }, { "docid": "5f49bb6757cc42f78bfd245bbaa2a832", "score": "0.53170455", "text": "func (i Internet) StatusCodeMessage() string {\n\treturn i.Faker.RandomStringElement(statusCodeMessages)\n}", "title": "" }, { "docid": "824c3448285630475f758e29cf49cbea", "score": "0.53169835", "text": "func (s *VariantStoreItem) SetStatusMessage(v string) *VariantStoreItem {\n\ts.StatusMessage = &v\n\treturn s\n}", "title": "" }, { "docid": "6c00777d8926b1c9fcb402d4ed28a1f1", "score": "0.52972716", "text": "func (s *GetReadSetImportJobOutput) SetStatusMessage(v string) *GetReadSetImportJobOutput {\n\ts.StatusMessage = &v\n\treturn s\n}", "title": "" }, { "docid": "e334a6af6ae989d5c04e6fd4abbecca7", "score": "0.52941173", "text": "func (t *Table) SetStatusText(text string) {\r\n\r\n\tt.statusLabel.SetText(text)\r\n}", "title": "" }, { "docid": "f45011590fcf44cabbb2029fe16ffc6e", "score": "0.5292353", "text": "func (s *ShareDetails) SetStatusMessage(v string) *ShareDetails {\n\ts.StatusMessage = &v\n\treturn s\n}", "title": "" }, { "docid": "518f914f612e51bf49e6cfb4633b5b26", "score": "0.5291853", "text": "func (o GoogleRpcStatusResponseOutput) Message() pulumi.StringOutput {\n\treturn o.ApplyT(func(v GoogleRpcStatusResponse) string { return v.Message }).(pulumi.StringOutput)\n}", "title": "" }, { "docid": "65f98898dc608166fd9e3d6e773792ee", "score": "0.5288839", "text": "func StatusTextFunc(code int) string {\n\treturn statusText[code]\n}", "title": "" }, { "docid": "8fb2e04bbd68495d86e04a2e2383205e", "score": "0.52883023", "text": "func (s *ResolverRuleAssociation) SetStatusMessage(v string) *ResolverRuleAssociation {\n\ts.StatusMessage = &v\n\treturn s\n}", "title": "" }, { "docid": "8fb2e04bbd68495d86e04a2e2383205e", "score": "0.52883023", "text": "func (s *ResolverRuleAssociation) SetStatusMessage(v string) *ResolverRuleAssociation {\n\ts.StatusMessage = &v\n\treturn s\n}", "title": "" }, { "docid": "3b2eff94fdc56af8818e0b80e8bd83cb", "score": "0.5288118", "text": "func (i *Import) GetStatusText() string {\n\tif i == nil || i.StatusText == nil {\n\t\treturn \"\"\n\t}\n\treturn *i.StatusText\n}", "title": "" }, { "docid": "836abc775196a7975746abe924bf8db4", "score": "0.5282872", "text": "func (s *ImportReferenceSourceItem) SetStatusMessage(v string) *ImportReferenceSourceItem {\n\ts.StatusMessage = &v\n\treturn s\n}", "title": "" }, { "docid": "f26facad9d3e91cf1f886aedeef2aaf3", "score": "0.52792317", "text": "func (o ApplicationStatusOperationStateOutput) Message() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v ApplicationStatusOperationState) *string { return v.Message }).(pulumi.StringPtrOutput)\n}", "title": "" }, { "docid": "21c26221512ba7221797853e31e4fe0a", "score": "0.5272795", "text": "func (c *CryptohomeBinary) GetStatusString(ctx context.Context) (string, error) {\n\tout, err := c.call(ctx, \"--action=status\")\n\treturn string(out), err\n}", "title": "" }, { "docid": "cd9db023b131108c380310da9eccb981", "score": "0.5270314", "text": "func (s *ResourceShare) SetStatusMessage(v string) *ResourceShare {\n\ts.StatusMessage = &v\n\treturn s\n}", "title": "" }, { "docid": "b62ce0e811a1e87789931c6c639f2f08", "score": "0.52694", "text": "func (o StatusResponseOutput) Message() pulumi.StringOutput {\n\treturn o.ApplyT(func(v StatusResponse) string { return v.Message }).(pulumi.StringOutput)\n}", "title": "" }, { "docid": "a5ee3c5095efc60ec76a7923eba27782", "score": "0.5269245", "text": "func (s *Resource) SetStatusMessage(v string) *Resource {\n\ts.StatusMessage = &v\n\treturn s\n}", "title": "" }, { "docid": "73a730cf139dce4fa29e5fbd694c0a3c", "score": "0.52686834", "text": "func MessageSetName(vm *VM, target, locals Interface, msg *Message) Interface {\n\tm := target.(*Message)\n\ts, stop := msg.StringArgAt(vm, locals, 0)\n\tif stop != nil {\n\t\treturn stop\n\t}\n\tm.Text = s.String()\n\treturn m\n}", "title": "" }, { "docid": "8ae65bb4d4c3cc2d42ab374846ed7741", "score": "0.52669275", "text": "func (o MachineInstanceStatusConditionsOutput) Message() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v MachineInstanceStatusConditions) *string { return v.Message }).(pulumi.StringPtrOutput)\n}", "title": "" }, { "docid": "c280a0c44f8ff04af6d4490c02a7e878", "score": "0.5262553", "text": "func TaskStatusString(s string) (TaskStatus, error) {\n\tif val, ok := _TaskStatusNameToValueMap[s]; ok {\n\t\treturn val, nil\n\t}\n\treturn 0, fmt.Errorf(\"%s does not belong to TaskStatus values\", s)\n}", "title": "" }, { "docid": "e58c69163e83f9703f7f3dfdc18e1dc2", "score": "0.52557576", "text": "func (s *VariantImportItemDetail) SetStatusMessage(v string) *VariantImportItemDetail {\n\ts.StatusMessage = &v\n\treturn s\n}", "title": "" }, { "docid": "75ce483ce60cc31e989d30a19bfd76ab", "score": "0.5254244", "text": "func (s *GetAnnotationStoreVersionOutput) SetStatusMessage(v string) *GetAnnotationStoreVersionOutput {\n\ts.StatusMessage = &v\n\treturn s\n}", "title": "" }, { "docid": "680ee2c8a1ea5769d6ec2eb617f95f9c", "score": "0.52540445", "text": "func (s *GetReferenceImportJobOutput) SetStatusMessage(v string) *GetReferenceImportJobOutput {\n\ts.StatusMessage = &v\n\treturn s\n}", "title": "" }, { "docid": "1742a9278da58db1968717dd6b32f997", "score": "0.52463675", "text": "func (s *ServiceSummary) SetStatusMessage(v string) *ServiceSummary {\n\ts.StatusMessage = &v\n\treturn s\n}", "title": "" }, { "docid": "e1a5b42748175fe0e272029d36081b0d", "score": "0.5244066", "text": "func (s *GetAnnotationStoreOutput) SetStatusMessage(v string) *GetAnnotationStoreOutput {\n\ts.StatusMessage = &v\n\treturn s\n}", "title": "" }, { "docid": "02b63a0f27e4ed5310789ebc6c065a4c", "score": "0.5238158", "text": "func StatusText(c int) string {\n\treturn fmt.Sprintf(\"%d %s\", c, http.StatusText(c))\n}", "title": "" }, { "docid": "2d41c0e630c20b90db4bca5748f72564", "score": "0.5230577", "text": "func (s *GetReadSetActivationJobOutput) SetStatusMessage(v string) *GetReadSetActivationJobOutput {\n\ts.StatusMessage = &v\n\treturn s\n}", "title": "" }, { "docid": "9f552686f2f6c0c12378b8c6c1294208", "score": "0.52275443", "text": "func (s *OutpostResolver) SetStatusMessage(v string) *OutpostResolver {\n\ts.StatusMessage = &v\n\treturn s\n}", "title": "" }, { "docid": "002635236f1f4e0840075f2cd8093d68", "score": "0.5227454", "text": "func (s *AnnotationStoreItem) SetStatusMessage(v string) *AnnotationStoreItem {\n\ts.StatusMessage = &v\n\treturn s\n}", "title": "" }, { "docid": "3fe406fc9a3496d624fbd9bca706da43", "score": "0.52244836", "text": "func (vm *VM) StringMessage(s string) *Message {\n\treturn &Message{\n\t\tObject: *vm.CoreInstance(\"Message\"),\n\t\tText: strconv.Quote(s),\n\t\tMemo: vm.NewString(s),\n\t}\n}", "title": "" }, { "docid": "8f82b9f82cfd5b68f234218457b5367d", "score": "0.5220004", "text": "func (r *Runner) SendVoteStatusMessage(channel model.Snowflake) {\n\tr.T.Helper()\n\n\tsendMessage(r.DiscordSession, r.Handler, channel, \"?votestatus\")\n\tr.DiscordMessagesCount++\n\n\tactiveVote := r.ActiveVoteDataMap[channel]\n\n\tif activeVote == nil {\n\t\tassertNewMessages(r.T, r.DiscordSession, []*Message{NewMessage(channel.Format(), vote.MsgNoActiveVote)})\n\t} else {\n\t\t// Calculate the expected status messages.\n\t\tforMessage := vote.MsgOneVoteFor\n\t\tif len(activeVote.VotesFor) != 1 {\n\t\t\tforMessage = fmt.Sprintf(vote.MsgVotesFor, len(activeVote.VotesFor))\n\t\t}\n\t\tagainstMessage := vote.MsgOneVoteAgainst\n\t\tif len(activeVote.VotesAgainst) != 1 {\n\t\t\tagainstMessage = fmt.Sprintf(vote.MsgVotesAgainst, len(r.ActiveVoteDataMap[channel].VotesAgainst))\n\t\t}\n\t\tstatusMessage := vote.MsgStatusVotesNeeded\n\t\tif len(activeVote.VotesAgainst)+len(activeVote.VotesFor) >= 5 {\n\t\t\tif len(activeVote.VotesFor) > len(activeVote.VotesAgainst) {\n\t\t\t\tstatusMessage = vote.MsgStatusVotePassing\n\t\t\t} else {\n\t\t\t\tstatusMessage = vote.MsgStatusVoteFailing\n\t\t\t}\n\t\t}\n\n\t\t// The time remaining is independently tested, so just assert its presence.\n\t\ttimeMessage := vote.TimeString(r.UTCClock, activeVote.TimestampEnd)\n\n\t\t// Build the expected string and assert that it's in the message buffer.\n\t\tvar buffer bytes.Buffer\n\t\tbuffer.WriteString(fmt.Sprintf(vote.MsgVoteOwner, activeVote.Author.Username))\n\t\tbuffer.WriteString(activeVote.Message)\n\t\tbuffer.WriteString(\"\\n\")\n\t\tbuffer.WriteString(vote.MsgSpacer)\n\t\tbuffer.WriteString(\"\\n\")\n\t\tbuffer.WriteString(statusMessage)\n\t\tbuffer.WriteString(\". \")\n\t\tbuffer.WriteString(forMessage)\n\t\tbuffer.WriteString(\", \")\n\t\tbuffer.WriteString(againstMessage)\n\t\tbuffer.WriteString(\". \")\n\t\tbuffer.WriteString(timeMessage)\n\t\tassertNewMessages(r.T, r.DiscordSession, []*Message{NewMessage(channel.Format(), buffer.String())})\n\t}\n\n\tr.AssertState()\n}", "title": "" }, { "docid": "717a3fb9fb88f87a6644a88bc840ff69", "score": "0.52171654", "text": "func (s *GetReadSetExportJobOutput) SetStatusMessage(v string) *GetReadSetExportJobOutput {\n\ts.StatusMessage = &v\n\treturn s\n}", "title": "" }, { "docid": "76e0780173548bb5f730fee346c838aa", "score": "0.52158797", "text": "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}", "title": "" }, { "docid": "3ca288325d9929c38e73f1dd32fc1074", "score": "0.52067137", "text": "func (s *GetVariantStoreOutput) SetStatusMessage(v string) *GetVariantStoreOutput {\n\ts.StatusMessage = &v\n\treturn s\n}", "title": "" }, { "docid": "40a04eb408eda8b5a4912333b7df12b1", "score": "0.5206184", "text": "func (s *ReplicationJob) SetStatusMessage(v string) *ReplicationJob {\n\ts.StatusMessage = &v\n\treturn s\n}", "title": "" }, { "docid": "f294bc44ccdd52502011576dac8a2160", "score": "0.5191794", "text": "func (s *ImportReadSetSourceItem) SetStatusMessage(v string) *ImportReadSetSourceItem {\n\ts.StatusMessage = &v\n\treturn s\n}", "title": "" } ]
b7aa5dd691d58278eeb02ce9ef826090
syncData populates a struct with information needed for Resource templates.
[ { "docid": "caf470a1defd50a853fe921ca9ca469c", "score": "0.5849462", "text": "func (f *ConfigFunction) syncData(in []*yaml.RNode) error {\n\tif err := f.SyncMetadata(DefaultAppNameAnnotationValue); err != nil {\n\t\treturn err\n\t}\n\n\tfnMeta, err := f.RW.FunctionConfig.GetMeta()\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tf.InitialCluster, err = f.getInitialCluster(in)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tf.Hostnames, err = cfunc.GetStatefulSetHostnames(in, fnMeta.Name+\"-server\", fnMeta.Namespace)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// Set defaults.\n\tf.Data = Options{\n\t\tTLSServerSecretName: fnMeta.Name + \"-\" + fnMeta.Namespace + \"-tls-server\",\n\t\tTLSCASecretName: fnMeta.Name + \"-\" + fnMeta.Namespace + \"-tls-ca\",\n\t\tTLSRootClientSecretName: fnMeta.Name + \"-\" + fnMeta.Namespace + \"-tls-client-root\",\n\t}\n\n\t// Populate function data from config.\n\tif err := yaml.Unmarshal([]byte(f.RW.FunctionConfig.MustString()), f); err != nil {\n\t\treturn err\n\t}\n\n\treturn nil\n}", "title": "" } ]
[ { "docid": "78751980bc810d4c542be293b4ce2f70", "score": "0.58357394", "text": "func syncAuthRbacData(rbacData *AuthRbacData) error {\n\n\tif rbacData.ResourceType == resourceTypeCluster {\n\t\treturn extractClusterLevelData(rbacData)\n\t} else if rbacData.ResourceType == resourceTypeNamespace {\n\t\treturn extractNamespaceLevelData(rbacData)\n\t}\n\treturn fmt.Errorf(\"invalid resource type: %s\", rbacData.ResourceType)\n}", "title": "" }, { "docid": "63ebc4c8fb7b93c2ec48d9b0cb746733", "score": "0.54491633", "text": "func (this *base) syncData() {\n\tf, err := os.OpenFile(filePath, os.O_RDONLY, 0600)\n\tdefer f.Close()\n\n\tcheckErr(err)\n\n\tcontentByte, err := ioutil.ReadAll(f)\n\n\tcheckErr(err)\n\n\tif len(contentByte) != 0 {\n\t\terr = json.Unmarshal(contentByte, &this.table)\n\n\t\tcheckErr(err)\n\t} else {\n\t\tthis.table = make(map[string]interface{})\n\t}\n}", "title": "" }, { "docid": "3c45c1c57427c9bf25b9a0fa98974107", "score": "0.54262996", "text": "func (engine *Engine) SyncData(\n\tvbno uint16, vbuuid, seqno uint64) interface{} {\n\n\treturn engine.evaluator.SyncData(vbno, vbuuid, seqno)\n}", "title": "" }, { "docid": "19b4d009970736158e028ec9dfeb1a6f", "score": "0.54202545", "text": "func InitData() (err error) {\n\tscenarios, err := PgClient.GetAllScenarios()\n\tif err != nil {\n\t\treturn err\n\t}\n\tl := len(*scenarios)\n\tGetResponseAllData.Scenarios = make([]scenario.Scenario, 0, l)\n\tfor i := 0; i < l; i++ {\n\t\tvar tgp []scenario.ThreadGroup\n\t\terr := json.Unmarshal([]byte((*scenarios)[i].TreadGroups), &tgp)\n\t\tif err != nil {\n\t\t\treturn (err)\n\t\t}\n\t\tGetResponseAllData.Scenarios = append(GetResponseAllData.Scenarios, scenario.Scenario{\n\t\t\tID: (*scenarios)[i].ID,\n\t\t\tName: (*scenarios)[i].Name,\n\t\t\tType: (*scenarios)[i].Type,\n\t\t\tLastModified: (*scenarios)[i].LastModified,\n\t\t\tGun: (*scenarios)[i].Gun,\n\t\t\tProjects: (*scenarios)[i].Projects,\n\t\t\tThreadGroups: tgp,\n\t\t})\n\t}\n\tgen, err := PgClient.GetAllGenerators()\n\tif err != nil {\n\t\treturn err\n\t}\n\tl = len(gen)\n\tGetResponseAllData.Generators = make([]hosts.Host, 0, l)\n\tfor i := 0; i < l; i++ {\n\t\t_, ok := RunsGenerators.Load(gen[i].Host)\n\t\tif ok {\n\t\t\tgen[i].State = \"IsBusy\"\n\t\t} else {\n\t\t\tgen[i].State = \"Free\"\n\t\t}\n\t\tGetResponseAllData.Generators = append(GetResponseAllData.Generators, hosts.Host{\n\t\t\tID: gen[i].ID,\n\t\t\tHost: gen[i].Host,\n\t\t\tType: gen[i].Type,\n\t\t\tProjects: gen[i].Projects,\n\t\t\tState: gen[i].State,\n\t\t})\n\t}\n\thostsAndUsers, err := PgClient.GetUsersAndHosts()\n\tfor k, v := range hostsAndUsers {\n\t\tHostsAndUsers.Store(k, v)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "ecd17886bec3f182336289ff79f724c1", "score": "0.53869545", "text": "func (c *Config) fillData() {\n\tif an, ok := c.Data[\"app_name\"].(string); ok {\n\t\tc.AppName = an\n\t}\n\tif dm, ok := c.Data[\"debug_mode\"].(bool); ok {\n\t\tc.DebugMode = dm\n\t}\n\tif le, ok := c.Data[\"logger_enabled\"].(bool); ok {\n\t\tc.LoggerEnabled = le\n\t}\n\tif lf, ok := c.Data[\"log_format\"].(string); ok {\n\t\tc.LogFormat = lf\n\t}\n\tif a, ok := c.Data[\"address\"].(string); ok {\n\t\tc.Address = a\n\t}\n\tif rt, ok := c.Data[\"read_timeout\"].(int64); ok {\n\t\tc.ReadTimeout = time.Duration(rt) * time.Millisecond\n\t}\n\tif wt, ok := c.Data[\"write_timeout\"].(int64); ok {\n\t\tc.WriteTimeout = time.Duration(wt) * time.Millisecond\n\t}\n\tif mhb, ok := c.Data[\"max_header_bytes\"].(int64); ok {\n\t\tc.MaxHeaderBytes = int(mhb)\n\t}\n\tif tcf, ok := c.Data[\"tls_cert_file\"].(string); ok {\n\t\tc.TLSCertFile = tcf\n\t}\n\tif tkf, ok := c.Data[\"tls_key_file\"].(string); ok {\n\t\tc.TLSKeyFile = tkf\n\t}\n\tif tr, ok := c.Data[\"template_root\"].(string); ok {\n\t\tc.TemplateRoot = tr\n\t}\n\tif tes, ok := c.Data[\"template_exts\"].([]interface{}); ok {\n\t\tc.TemplateExts = []string{}\n\t\tfor _, te := range tes {\n\t\t\tc.TemplateExts = append(c.TemplateExts, te.(string))\n\t\t}\n\t}\n\tif tld, ok := c.Data[\"template_left_delim\"].(string); ok {\n\t\tc.TemplateLeftDelim = tld\n\t}\n\tif trd, ok := c.Data[\"template_right_delim\"].(string); ok {\n\t\tc.TemplateRightDelim = trd\n\t}\n\tif tm, ok := c.Data[\"template_minified\"].(bool); ok {\n\t\tc.TemplateMinified = tm\n\t}\n\tif ce, ok := c.Data[\"coffer_enabled\"].(bool); ok {\n\t\tc.CofferEnabled = ce\n\t}\n\tif ar, ok := c.Data[\"asset_root\"].(string); ok {\n\t\tc.AssetRoot = ar\n\t}\n\tif aes, ok := c.Data[\"asset_exts\"].([]interface{}); ok {\n\t\tc.AssetExts = []string{}\n\t\tfor _, ae := range aes {\n\t\t\tc.AssetExts = append(c.AssetExts, ae.(string))\n\t\t}\n\t}\n\tif am, ok := c.Data[\"asset_minified\"].(bool); ok {\n\t\tc.AssetMinified = am\n\t}\n}", "title": "" }, { "docid": "55971a847fd27014b563bc1b44faf2bd", "score": "0.5241718", "text": "func (p *rtCleaner) sync(key string, obj *v3.RoleTemplate) (runtime.Object, error) {\n\tif key == \"\" || obj == nil {\n\t\treturn nil, nil\n\t}\n\tif obj.Annotations[roletemplate.RTVersion] == \"true\" {\n\t\treturn obj, nil\n\t}\n\n\tobj.SetFinalizers(cleanFinalizers(obj.GetFinalizers(), \"clusterscoped.controller.cattle.io/cluster-roletemplate-sync_\"))\n\tcleanAnnotations := cleanAnnotations(obj.GetAnnotations(), \"lifecycle.cattle.io/create.cluster-roletemplate-sync_\")\n\n\tif cleanAnnotations == nil {\n\t\tcleanAnnotations = make(map[string]string)\n\t}\n\tdelete(cleanAnnotations, roletemplate.OldRTVersion)\n\tcleanAnnotations[roletemplate.RTVersion] = \"true\"\n\tobj.SetAnnotations(cleanAnnotations)\n\treturn p.mgmt.Management.RoleTemplates(\"\").Update(obj)\n}", "title": "" }, { "docid": "d98fe924b7c2b4fa63bf33004e45b23b", "score": "0.5188305", "text": "func (r *Resource) Sync(ds datastore.Datastore) error {\n\treturn r.SaveDoc(ds)\n}", "title": "" }, { "docid": "915c4de76c9395e0ddbb97eef60f6304", "score": "0.5063197", "text": "func (rm *ResourceManager) SyncResources() error {\n\tif err := rm.syncApplications(); err != nil {\n\t\tlog.Fatal(err)\n\t}\n\tif err := rm.syncPipelines(); err != nil {\n\t\tlog.Fatal(err)\n\t}\n\tif err := rm.syncPipelineTemplates(); err != nil {\n\t\tlog.Fatal(err)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "344cf9db1fdf17267770cc11b3763856", "score": "0.50376123", "text": "func (opts *BackendOperatorOptions) InitData() error {\n\terr := opts.RefreshStatics()\n\n\tif err != nil {\n\t\treturn err\n\t}\n\terr = opts.RefreshTemplate()\n\tif err != nil {\n\t\treturn err\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "ffd9c284bb03384e65f8294041e65c2d", "score": "0.4997779", "text": "func Sync(t time.Time, log *zap.Logger) {\n\tabsPath, _ := filepath.Abs(Config.directory)\n\n\tfiles, err := ioutil.ReadDir(absPath)\n\tif err != nil {\n\t\tlog.Error(\"Error reading directory\",\n\t\t\tzap.Error(err),\n\t\t\tzap.String(\"directory\", absPath),\n\t\t)\n\n\t\treturn\n\t}\n\n\tfor _, f := range files {\n\t\tproperties := make(map[string]interface{})\n\t\tfn := f.Name()\n\n\t\t// Removes .json extension.\n\t\tshortPath := fn[0 : len(fn)-5]\n\t\tfullPath := absPath + \"/\" + fn\n\t\tpath := Config.account + \"/\" + Config.region + \"/\" + shortPath\n\n\t\tj, _ := ioutil.ReadFile(fullPath)\n\t\tjsonparser.ObjectEach(j, func(key []byte, value []byte, dataType jsonparser.ValueType, offset int) error {\n\t\t\tswitch dataTypeString := dataType.String(); dataTypeString {\n\t\t\tcase \"string\":\n\t\t\t\tproperties[string(key)] = string(value)\n\t\t\tcase \"number\":\n\t\t\t\tvar v interface{}\n\t\t\t\tif strings.Contains(string(value), \".\") {\n\t\t\t\t\tv, _ = strconv.ParseFloat(string(value), 64)\n\t\t\t\t} else {\n\t\t\t\t\tv, _ = strconv.Atoi(string(value))\n\t\t\t\t}\n\t\t\t\tproperties[string(key)] = v\n\t\t\tcase \"boolean\":\n\t\t\t\tv, _ := strconv.ParseBool(string(value))\n\t\t\t\tproperties[string(key)] = v\n\t\t\tcase \"null\":\n\t\t\t\tproperties[string(key)] = \"\"\n\t\t\tcase \"object\":\n\t\t\t\ts, err := secret.GetSSMSecret(string(key), value)\n\t\t\t\tif err != nil {\n\t\t\t\t\tlog.Error(\"Failed to get SSM secret\",\n\t\t\t\t\t\tzap.Error(err),\n\t\t\t\t\t)\n\n\t\t\t\t\treturn err\n\t\t\t\t}\n\t\t\t\tproperties[string(key)] = s\n\t\t\tdefault:\n\t\t\t\tlog.Error(\"Unsupported type!\",\n\t\t\t\t\tzap.String(\"service\", shortPath),\n\t\t\t\t\tzap.String(\"key\", string(key)),\n\t\t\t\t\tzap.String(\"value\", string(value)),\n\t\t\t\t\tzap.String(\"type\", dataTypeString),\n\t\t\t\t)\n\t\t\t}\n\n\t\t\treturn nil\n\t\t}, \"properties\")\n\n\t\tkv.WriteProperty(path, properties)\n\t}\n}", "title": "" }, { "docid": "8e8122a9f831cc6d49a68851853e6e2d", "score": "0.49934262", "text": "func Sync(o Context) ([]common.MapStr, Context) {\n\to.Sync = true\n\treturn nil, o\n}", "title": "" }, { "docid": "efb77e779e52b275c1a6569d12de633e", "score": "0.4942786", "text": "func (c *Controller) syncHandler(key string) error {\n\tvar isDeleted bool\n\n\tif isDeleted = strings.HasSuffix(key, \":deleted\"); isDeleted {\n\t\tkey = strings.TrimSuffix(key, \":deleted\")\n\t}\n\n\t// Convert the namespace/name string into a distinct namespace and name\n\tnamespace, name, err := cache.SplitMetaNamespaceKey(key)\n\tif err != nil {\n\t\tutilruntime.HandleError(fmt.Errorf(\"invalid resource key: %s\", key))\n\t\treturn nil\n\t}\n\n\t// Get the Generic resource with this namespace/name\n\tgeneric, err := c.genericsLister.Generics(namespace).Get(name)\n\tif err != nil && errors.IsNotFound(err) {\n\t\t//Checking internal cache\n\t\tok := false\n\t\tgeneric, ok = c.intlCache[key]\n\t\tif !ok {\n\t\t\t// The Generic resource may no longer exist, in which case we stop\n\t\t\t// processing.\n\t\t\tutilruntime.HandleError(fmt.Errorf(\"generic object '%s' no longer exists in work queue and internal cache \", key))\n\t\t\treturn nil\n\t\t}\n\t}else if err != nil {\n\t\treturn err\n\t}\n\n\n\t//Here we got generic object.\n\t//In case of deletion: we got the latest version from cache\n\tif need, reason := c.needToSync(key, generic); !need && !isDeleted {\n\t\tklog.Infof(\"Skipping object %s, reason: %s\", key, reason)\n\t\treturn nil\n\t}\n\n\tklog.Infof(\"Processing object %s (generation: %d), is deleted ?: %t\", key,generic.Generation, isDeleted)\n\n\t//Perform runtime configuration injection\n\terr = c.injectConfig(generic, isDeleted)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// Finally, we update the status block of the Generic resource to reflect the\n\t// current state of the world\n\t//err = c.updateGenericStatus(generic)\n\t//if err != nil {\n\t//\treturn err\n\t//}\n\n\t//Update internal cache with the version of object that is just processed:\n\tif !isDeleted {\n\t\tc.intlCache[key] = generic.DeepCopy()\n\t\tc.recorder.Event(generic, corev1.EventTypeNormal, SuccessSynced, MessageResourceSynced)\n\t} else { //Remove deleted object from cache\n\t\tdelete(c.intlCache,key)\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "eb505af20ada142835acc17900fb45a4", "score": "0.49085954", "text": "func (h *Handler) Sync() error {\n\tif err := h.updateStatus(); err != nil {\n\t\treturn err\n\t}\n\n\tif err := h.syncCertSecret(); err != nil {\n\t\treturn err\n\t}\n\n\tif err := h.syncRouterConfigmap(); err != nil {\n\t\treturn err\n\t}\n\tif err := h.syncCollectd(); err != nil {\n\t\treturn err\n\t}\n\tif err := h.syncNodeExporter(); err != nil {\n\t\treturn err\n\t}\n\tif err := h.syncKubeStateMetrics(); err != nil {\n\t\treturn err\n\t}\n\treturn nil\n\n}", "title": "" }, { "docid": "f550cd270100ff3717b07da6f0d04f72", "score": "0.48950687", "text": "func (m *SysUserTemplate) InitSysData(s *xorm.Session) {\n\tif ct, err := s.Where(\"id=?\", DefaultUserTemplate.ID.String).Count(new(SysUserTemplate)); ct == 0 || err != nil {\n\t\tif err != nil {\n\t\t\ts.Rollback()\n\t\t\tpanic(err)\n\t\t}\n\t\tif _, err := s.InsertOne(&DefaultUserTemplate); err != nil {\n\t\t\ts.Rollback()\n\t\t\tpanic(err)\n\t\t}\n\t}\n\tif err := s.Commit(); err != nil {\n\t\tpanic(err)\n\t}\n}", "title": "" }, { "docid": "9fcae6d9e2320b9f59efb0ba4e165ad7", "score": "0.4886309", "text": "func SyncResource(ds datastore.Datastore, r *Resource) {\n\n\t// Fetch the current Doc (if there) and compare updatedAt\n\tr2, err := DocResourcesOne(ds, bson.M{\"id\": r.ID})\n\tif err != nil {\n\t\tlog.Println(\"Target document error: \", err, \"- so do an upsert\")\n\t}\n\n\tmsg := fmt.Sprintf(\"Resource id %v - MySQL updated %v, MongoDB updated %v\", r.ID, r.UpdatedAt, r2.UpdatedAt)\n\tif r.UpdatedAt.Equal(r2.UpdatedAt) {\n\t\tmsg += \" - NO need to sync\"\n\t\tlog.Println(msg)\n\t\treturn\n\t}\n\tmsg += \" - syncing...\"\n\tlog.Println(msg)\n\n\t// Update the document in the Members collection\n\tvar w sync.WaitGroup\n\tw.Add(1)\n\tgo updateResourceDoc(ds, r, &w)\n\tw.Wait()\n}", "title": "" }, { "docid": "260764a555d54589cd4bce024b393f79", "score": "0.48698455", "text": "func (part *PartialInstances) makeData(choices []S.ChoiceStatement, kvs []S.KeyValueStatement,\n) (instances M.InstanceMap, tables TableRelations, err error) {\n\tif e := part._addChoices(choices); e != nil {\n\t\terr = e\n\t} else if e := part._addKeyValues(kvs); e != nil {\n\t\terr = e\n\t}\n\ttables = part.tables\n\tinstances = make(M.InstanceMap)\n\tfor id, p := range part.partials {\n\t\tinstance := &M.InstanceInfo{p.id, p.class, p.name, p.values}\n\t\tinstances[id] = instance\n\t}\n\n\treturn instances, tables, err\n}", "title": "" }, { "docid": "3f92beaaefbdac541880f9a7f7170ca3", "score": "0.48179683", "text": "func syncClusterLevelData(username, action, operation, clusterId, bindingType string) error {\n\tkubeClient, err := rbacUtils.GetKubeClient(clusterId)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"failed to build kubeclient for cluster %s: %s\", clusterId, err.Error())\n\t}\n\n\tif operation == \"add\" {\n\t\treturn addClusterLevelRbac(username, action, clusterId, bindingType, kubeClient)\n\t} else if operation == \"delete\" {\n\t\treturn deleteClusterLevelRbac(username, action, clusterId, bindingType, kubeClient)\n\t}\n\treturn fmt.Errorf(\"invalid operabion: %s\", operation)\n}", "title": "" }, { "docid": "96cc4ac1189cab246c36f03a3df98442", "score": "0.48009887", "text": "func (m *helm3manager) Sync(ctx context.Context) error {\n\treturn nil\n}", "title": "" }, { "docid": "c18f34aaa4439a14de71c9faec45b628", "score": "0.47528604", "text": "func (tm *TemplatedMarshal) MarshalInit(data interface{}) ([]byte, error) {\n\tif len(tm.initName) == 0 {\n\t\treturn nil, fmt.Errorf(\"streaming is unsupported by the data format; no init template defined\")\n\t}\n\tvar buf bytes.Buffer\n\tif err := tm.tmpl.ExecuteTemplate(&buf, tm.initName, data); err != nil {\n\t\treturn nil, err\n\t}\n\treturn buf.Bytes(), nil\n}", "title": "" }, { "docid": "da0eeb3850e09fd5195150b824580b50", "score": "0.47514305", "text": "func (r *ResourcesController) syncResources() error {\n\tklog.V(2).Info(\"syncing droplet resources.\")\n\terr := r.resources.SyncDroplets(context.Background())\n\tif err != nil {\n\t\tklog.Errorf(\"failed to sync droplet resources: %s.\", err)\n\t} else {\n\t\tklog.V(2).Info(\"synced droplet resources.\")\n\t}\n\n\tklog.V(2).Info(\"syncing load-balancer resources.\")\n\terr = r.resources.SyncLoadBalancers()\n\tif err != nil {\n\t\tklog.Errorf(\"failed to sync load-balancer resources: %s.\", err)\n\t} else {\n\t\tklog.V(2).Info(\"synced load-balancer resources.\")\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "c522331a051887f0193e1578d154e684", "score": "0.4743943", "text": "func syncHash(h *bmt.Hasher, data []byte) ([]byte, error) {\n\th.Reset()\n\th.SetHeaderInt64(int64(len(data)))\n\t_, err := h.Write(data)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn h.Hash(nil)\n}", "title": "" }, { "docid": "40b5abe0a5324086a286f73429667fcf", "score": "0.47309005", "text": "func (s *Subscription) populateResources(r *rpc.Resources) {\n\t// Quick exit if resource is already sent\n\tif s.state == stateSent || s.state == stateToSend {\n\t\treturn\n\t}\n\n\t// Check for errors\n\terr := s.Error()\n\tif err != nil {\n\t\t// Create Errors map if needed\n\t\tif r.Errors == nil {\n\t\t\tr.Errors = make(map[string]*reserr.Error)\n\t\t}\n\t\tr.Errors[s.rid] = reserr.RESError(err)\n\t\treturn\n\t}\n\n\tswitch s.typ {\n\tcase rescache.TypeCollection:\n\t\t// Create Collections map if needed\n\t\tif r.Collections == nil {\n\t\t\tr.Collections = make(map[string]interface{})\n\t\t}\n\t\tr.Collections[s.rid] = s.collection\n\n\tcase rescache.TypeModel:\n\t\t// Create Models map if needed\n\t\tif r.Models == nil {\n\t\t\tr.Models = make(map[string]interface{})\n\t\t}\n\t\tr.Models[s.rid] = s.model\n\t}\n\n\ts.state = stateToSend\n\n\tfor _, sc := range s.refs {\n\t\tsc.sub.populateResources(r)\n\t}\n}", "title": "" }, { "docid": "adb1dc734ed00734d07b501c555d7518", "score": "0.47263446", "text": "func (r *Resources) AddData(name, value string) {\n\t// key := lookupKey(name)\n\tr.data[name] = value\n}", "title": "" }, { "docid": "4077cfba09344aba0610bb1bfecf43a0", "score": "0.47180283", "text": "func (app *application) addDefaultData(data *templateData, r *http.Request) *templateData {\n\t// used to avoid nill pointer dereference\n\tif data == nil {\n\t\tdata = &templateData{}\n\t}\n\n\tdata.CurrentYear = time.Now().Year()\n\n\treturn data\n}", "title": "" }, { "docid": "a7304b77e48d54d51400ec251c06534c", "score": "0.47157362", "text": "func (dbt *DbtCloud) SyncStore(overriddenDataSchema *schema.BatchHeader, objects []map[string]interface{}, timeIntervalValue string, cacheTable bool) error {\n\treturn nil\n}", "title": "" }, { "docid": "eb5b6092fad8f3e2d8b321304df4c8be", "score": "0.47119865", "text": "func (S *Store_node) Sync(args node.Node_sync_args, reply *node.Node_sync_reply) error {\n if args.Ltime > 0 {\n\tif S.ltime > args.Ltime {\n\t panic(fmt.Sprintf(\"attempt to decrease store ltime from %v to %v\", S.ltime, args.Ltime))\n\t}\n\tif S.ltime == args.Ltime {\n\t fmt.Printf(\"unexpected ltime sync to current ltime %v\\n\", S.ltime)\n\t}\n\tS.ltime = args.Ltime\n\tS.Pa.ltime_set(S.ltime)\n\treturn nil\n }\n\n // Fetch the current metadata\n md, err := S.Pa.get(args.Slotnum)\n if err != nil {\n\tEwarn(err, \"could not get current metadata for store %v block %v\\n\", S, args.Slotnum)\n }\n\n xmd := md\n\n // Update the sync in the persistent array\n md.Sync = uint16(args.Sync)\n md.Flags &^= uint16(args.Flag_bits_to_clr)\n md.Flags |= uint16(args.Flag_bits_to_set)\n\n if !SKIP_WAIT {\n\terr = S.Pa.set_wait(args.Slotnum, md)\n } else {\n\terr = S.Pa.set(args.Slotnum, md, nil)\n }\n\n if err != nil {\n\tEwarn(err, \"could not set persistent array for S.Meta_sync_update Slotnum=%v to md={%v}\", args.Slotnum, md)\n }\n\n Verbose(\"STORE %v block %v updated md from %#v to %#v\\n\", S, args.Slotnum, xmd, md)\n\n return err\n}", "title": "" }, { "docid": "a521c878c7270823d334a63420e3bf68", "score": "0.4709177", "text": "func initData(dev *globals.OPCUADev) {\n\tfor i := 0; i < len(dev.Instance.Datas.Properties); i++ {\n\t\tvar visitorConfig configmap.VisitorConfigOPCUA\n\t\tif err := json.Unmarshal([]byte(dev.Instance.Twins[i].PVisitor.VisitorConfig), &visitorConfig); err != nil {\n\t\t\tklog.Error(err)\n\t\t\tcontinue\n\t\t}\n\n\t\ttwinData := TwinData{Client: dev.OPCUAClient,\n\t\t\tName: dev.Instance.Datas.Properties[i].PropertyName,\n\t\t\tType: dev.Instance.Datas.Properties[i].Metadatas.Type,\n\t\t\tNodeID: visitorConfig.NodeID,\n\t\t\tTopic: fmt.Sprintf(mappercommon.TopicDataUpdate, dev.Instance.ID)}\n\t\tcollectCycle := time.Duration(dev.Instance.Datas.Properties[i].PVisitor.CollectCycle)\n\t\t// If the collect cycle is not set, set it to 1 second.\n\t\tif collectCycle == 0 {\n\t\t\tcollectCycle = 1 * time.Second\n\t\t}\n\t\ttimer := mappercommon.Timer{Function: twinData.Run, Duration: collectCycle, Times: 0}\n\t\twg.Add(1)\n\t\tgo func() {\n\t\t\tdefer wg.Done()\n\t\t\ttimer.Start()\n\t\t}()\n\t}\n}", "title": "" }, { "docid": "cee524789aa9a9ff5a99eca38a7923d2", "score": "0.46998596", "text": "func (e *Server) preparingData(\n\tprime map[string]interface{},\n\taction string,\n\tcontentAvlb *pb.ContentAvaliable,\n\tmedia *pb.Media,\n\tcontent *pb.Content,\n\tmetadata *pb.Metadata,\n\toptimus *pb.Optimus,\n\tref_id *string,\n\tstream pb.ContentGeneratorService_FetchHungamaPlayServer,\n) {\n\n\t// lets first check if the resp is 200 but the data fetch is succeful or not\n\tif prime[\"status_msg\"] != \"success\" {\n\t\t// if the response is not sucessful then skip\n\t\treturn\n\t}\n\n\t// getting response obj\n\tresponse := prime[\"response\"].(map[string]interface{})\n\n\t// checking the data type of the variable\n\tswitch response[\"data\"].(type) {\n\tcase string:\n\t\treturn\n\t}\n\n\tdata := response[\"data\"].([]interface{})\n\t// looping from tile array\n\tfor _, tile := range data {\n\t\tcontentAvlb.Reset()\n\t\tmedia.Reset()\n\t\tcontent.Reset()\n\t\tmetadata.Reset()\n\t\te.makingTileObj(tile.(map[string]interface{}), action, contentAvlb, media, content, metadata, optimus,ref_id, stream) // type casting it to map[string]interface{}\n\t}\n}", "title": "" }, { "docid": "afccff69deea48149eae150b0ae63a67", "score": "0.4664409", "text": "func (t *Template) Data(recv string, groupLabels model.LabelSet, alerts ...*types.Alert) *Data {\n\tdata := &Data{\n\t\tReceiver: regexp.QuoteMeta(recv),\n\t\tStatus: string(types.Alerts(alerts...).Status()),\n\t\tAlerts: make(Alerts, 0, len(alerts)),\n\t\tGroupLabels: KV{},\n\t\tCommonLabels: KV{},\n\t\tCommonAnnotations: KV{},\n\t\tExternalURL: t.ExternalURL.String(),\n\t}\n\n\t// The call to types.Alert is necessary to correctly resolve the internal\n\t// representation to the user representation.\n\tfor _, a := range types.Alerts(alerts...) {\n\t\talert := Alert{\n\t\t\tStatus: string(a.Status()),\n\t\t\tLabels: make(KV, len(a.Labels)),\n\t\t\tAnnotations: make(KV, len(a.Annotations)),\n\t\t\tStartsAt: a.StartsAt,\n\t\t\tEndsAt: a.EndsAt,\n\t\t\tGeneratorURL: a.GeneratorURL,\n\t\t\tFingerprint: a.Fingerprint().String(),\n\t\t}\n\t\tfor k, v := range a.Labels {\n\t\t\talert.Labels[string(k)] = string(v)\n\t\t}\n\t\tfor k, v := range a.Annotations {\n\t\t\talert.Annotations[string(k)] = string(v)\n\t\t}\n\t\tdata.Alerts = append(data.Alerts, alert)\n\t}\n\n\tfor k, v := range groupLabels {\n\t\tdata.GroupLabels[string(k)] = string(v)\n\t}\n\n\tif len(alerts) >= 1 {\n\t\tvar (\n\t\t\tcommonLabels = alerts[0].Labels.Clone()\n\t\t\tcommonAnnotations = alerts[0].Annotations.Clone()\n\t\t)\n\t\tfor _, a := range alerts[1:] {\n\t\t\tif len(commonLabels) == 0 && len(commonAnnotations) == 0 {\n\t\t\t\tbreak\n\t\t\t}\n\t\t\tfor ln, lv := range commonLabels {\n\t\t\t\tif a.Labels[ln] != lv {\n\t\t\t\t\tdelete(commonLabels, ln)\n\t\t\t\t}\n\t\t\t}\n\t\t\tfor an, av := range commonAnnotations {\n\t\t\t\tif a.Annotations[an] != av {\n\t\t\t\t\tdelete(commonAnnotations, an)\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tfor k, v := range commonLabels {\n\t\t\tdata.CommonLabels[string(k)] = string(v)\n\t\t}\n\t\tfor k, v := range commonAnnotations {\n\t\t\tdata.CommonAnnotations[string(k)] = string(v)\n\t\t}\n\t}\n\n\treturn data\n}", "title": "" }, { "docid": "770d22215171607dfac5adf58d795b80", "score": "0.46632093", "text": "func (p *dispatcher) PushData(ctx context.Context, kvPairs []KeyVal, keyLabels map[string]Labels) (results []Result, err error) {\n\ttrace.Logf(ctx, \"pushData\", \"%d KV pairs\", len(kvPairs))\n\n\t// check key-value pairs for uniqness and validate key\n\tuniq := make(map[string]proto.Message)\n\tfor _, kv := range kvPairs {\n\t\tif kv.Val != nil {\n\t\t\t// check if given key matches the key generated from value\n\t\t\tif k := models.Key(kv.Val); k != kv.Key {\n\t\t\t\treturn nil, errors.Errorf(\"given key %q does not match with key generated from value: %q (value: %#v)\", kv.Key, k, kv.Val)\n\t\t\t}\n\t\t}\n\t\t// check if key is unique\n\t\tif oldVal, ok := uniq[kv.Key]; ok {\n\t\t\treturn nil, errors.Errorf(\"found multiple key-value pairs with same key: %q (value 1: %#v, value 2: %#v)\", kv.Key, kv.Val, oldVal)\n\t\t}\n\t\tuniq[kv.Key] = kv.Val\n\t}\n\n\tp.mu.Lock()\n\tdefer p.mu.Unlock()\n\n\tpr := trace.StartRegion(ctx, \"prepare kv data\")\n\n\tdataSrc, ok := contextdecorator.DataSrcFromContext(ctx)\n\tif !ok {\n\t\tdataSrc = \"global\"\n\t}\n\n\tp.log.Debugf(\"Push data with %d KV pairs (source: %s)\", len(kvPairs), dataSrc)\n\n\ttxn := p.kvs.StartNBTransaction()\n\n\tif typ, _ := kvs.IsResync(ctx); typ == kvs.FullResync {\n\t\ttrace.Log(ctx, \"resyncType\", typ.String())\n\t\tp.db.Reset(dataSrc)\n\t\tfor _, kv := range kvPairs {\n\t\t\tif kv.Val == nil {\n\t\t\t\tp.log.Debugf(\" - PUT: %q (skipped nil value for resync)\", kv.Key)\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tp.log.Debugf(\" - PUT: %q \", kv.Key)\n\t\t\tp.db.Update(dataSrc, kv.Key, kv.Val)\n\t\t\tp.db.ResetLabels(kv.Key)\n\t\t\tfor lkey, lval := range keyLabels[kv.Key] {\n\t\t\t\tp.db.AddLabel(kv.Key, lkey, lval)\n\t\t\t}\n\t\t}\n\t\tallPairs := p.db.ListAll()\n\t\tp.log.Debugf(\"will resync %d pairs\", len(allPairs))\n\t\tfor k, v := range allPairs {\n\t\t\ttxn.SetValue(k, v)\n\t\t}\n\t} else {\n\t\tfor _, kv := range kvPairs {\n\t\t\tif kv.Val == nil {\n\t\t\t\tp.log.Debugf(\" - DELETE: %q\", kv.Key)\n\t\t\t\ttxn.SetValue(kv.Key, nil)\n\t\t\t\tp.db.Delete(dataSrc, kv.Key)\n\t\t\t\tfor lkey := range keyLabels[kv.Key] {\n\t\t\t\t\tp.db.DeleteLabel(kv.Key, lkey)\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tp.log.Debugf(\" - UPDATE: %q \", kv.Key)\n\t\t\t\ttxn.SetValue(kv.Key, kv.Val)\n\t\t\t\tp.db.Update(dataSrc, kv.Key, kv.Val)\n\t\t\t\tp.db.ResetLabels(kv.Key)\n\t\t\t\tfor lkey, lval := range keyLabels[kv.Key] {\n\t\t\t\t\tp.db.AddLabel(kv.Key, lkey, lval)\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\tpr.End()\n\n\tt := time.Now()\n\n\tseqID, err := txn.Commit(ctx)\n\tp.kvs.TransactionBarrier()\n\tresults = append(results, Result{\n\t\tKey: \"seqnum\",\n\t\tStatus: &Status{\n\t\t\tDetails: []string{fmt.Sprint(seqID)},\n\t\t},\n\t})\n\tfor key := range uniq {\n\t\ts := p.kvs.GetValueStatus(key)\n\t\tresults = append(results, Result{\n\t\t\tKey: key,\n\t\t\tStatus: s.GetValue(),\n\t\t})\n\t}\n\tif err != nil {\n\t\tif txErr, ok := err.(*kvs.TransactionError); ok && len(txErr.GetKVErrors()) > 0 {\n\t\t\tkvErrs := txErr.GetKVErrors()\n\t\t\tvar errInfo = \"\"\n\t\t\tfor i, kvErr := range kvErrs {\n\t\t\t\terrInfo += fmt.Sprintf(\" - %3d. error (%s) %s - %v\\n\", i+1, kvErr.TxnOperation, kvErr.Key, kvErr.Error)\n\t\t\t}\n\t\t\tp.log.Errorf(\"Transaction #%d finished with %d errors\\n%s\", seqID, len(kvErrs), errInfo)\n\t\t} else {\n\t\t\tp.log.Errorf(\"Transaction failed: %v\", err)\n\t\t\treturn nil, err\n\t\t}\n\t\treturn results, err\n\t} else {\n\t\ttook := time.Since(t)\n\t\tp.log.Infof(\"Transaction #%d successful! (took %v)\", seqID, took.Round(time.Microsecond*100))\n\t}\n\n\treturn results, nil\n}", "title": "" }, { "docid": "68decca69279b4f759cdb2f158bab436", "score": "0.46557325", "text": "func (pg *OverviewPage) syncDetail(name, status, headersFetched, progress string) walletSyncDetails {\n\treturn walletSyncDetails{\n\t\tname: pg.Theme.Body1(name),\n\t\tstatus: pg.Theme.Body2(status),\n\t\tblockHeaderFetched: pg.Theme.Body1(headersFetched),\n\t\tsyncingProgress: pg.Theme.Body1(progress),\n\t}\n}", "title": "" }, { "docid": "b9f23f6c2203f428728f868557e164aa", "score": "0.46454272", "text": "func (c *SSM) CreateResourceDataSyncRequest(input *CreateResourceDataSyncInput) (req *request.Request, output *CreateResourceDataSyncOutput) {\n\top := &request.Operation{\n\t\tName: opCreateResourceDataSync,\n\t\tHTTPMethod: \"POST\",\n\t\tHTTPPath: \"/\",\n\t}\n\n\tif input == nil {\n\t\tinput = &CreateResourceDataSyncInput{}\n\t}\n\n\treq = c.newRequest(op, input, output)\n\toutput = &CreateResourceDataSyncOutput{}\n\treq.Data = output\n\treturn\n}", "title": "" }, { "docid": "0988fca3e6d9872edf575f08e9f170a6", "score": "0.46438637", "text": "func (c *SSM) ListResourceDataSyncRequest(input *ListResourceDataSyncInput) (req *request.Request, output *ListResourceDataSyncOutput) {\n\top := &request.Operation{\n\t\tName: opListResourceDataSync,\n\t\tHTTPMethod: \"POST\",\n\t\tHTTPPath: \"/\",\n\t}\n\n\tif input == nil {\n\t\tinput = &ListResourceDataSyncInput{}\n\t}\n\n\treq = c.newRequest(op, input, output)\n\toutput = &ListResourceDataSyncOutput{}\n\treq.Data = output\n\treturn\n}", "title": "" }, { "docid": "cac5a1a6fe79db8469e39dc09019bccf", "score": "0.46365163", "text": "func (s *RegistrationStorage) Sync() {\n\t// either 16, 24, or 32 bytes\n\tblock, err := aes.NewCipher([]byte(s.EncryptionKey))\n\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\n\tvar buf = &bytes.Buffer{}\n\tjson.NewEncoder(buf).Encode(*storage.ActiveRegistration)\n\n\tencrypted := make([]byte, aes.BlockSize+buf.Len())\n\tiv := encrypted[:aes.BlockSize]\n\n\tencrypter := cipher.NewCFBEncrypter(block, iv)\n\tencrypter.XORKeyStream(encrypted[aes.BlockSize:], buf.Bytes())\n\n\tf, err := os.OpenFile(s.ConfigPath, os.O_CREATE|os.O_WRONLY|os.O_TRUNC, 0644)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\tf.Write(encrypted)\n\tf.Close()\n}", "title": "" }, { "docid": "3993e5b70e15f05c5bebe6d0554c560f", "score": "0.46184638", "text": "func (c *Component) updateStorageTypeData(ctx context.Context) error {\n\tvar err error\n\t// prepare an upsert statement using a versioned stored procedure\n\tvar stmt *sql.Stmt\n\tver := c.TableVersion(\"StorageTypeData\")\n\tswitch ver {\n\tcase 1:\n\t\tstmt, err = c.SafePrepare(ctx, \"SELECT StorageTypeDataUpsert1($1, $2, $3, $4, $5)\")\n\tdefault:\n\t\terr = fmt.Errorf(\"unsupported StorageTypeData version %d\", ver)\n\t}\n\tif err != nil {\n\t\treturn err\n\t}\n\tdefer stmt.Close()\n\t// convert response time values to microseconds (max in db ~ 30min)\n\tsscResponseTimeUSec := func(st *models.CSPStorageType, sn string) int32 {\n\t\tif ssc, ok := st.SscList.SscListMutable[sn]; ok {\n\t\t\tif d, err := time.ParseDuration(ssc.Value); err == nil {\n\t\t\t\treturn int32(d / time.Microsecond)\n\t\t\t}\n\t\t}\n\t\treturn 0\n\t}\n\t// upsert storage type data\n\tfor _, st := range c.App.AppCSP.SupportedCspStorageTypes() {\n\t\trtMean := sscResponseTimeUSec(st, SscResponseTimeAverage)\n\t\trtMax := sscResponseTimeUSec(st, SscResponseTimeMaximum)\n\t\tiopsPerGiB := int32(swag.Int64Value(st.ProvisioningUnit.IOPS))\n\t\tbpsPerGiB := swag.Int64Value(st.ProvisioningUnit.Throughput)\n\t\tif ver == 1 {\n\t\t\t_, err := stmt.ExecContext(ctx, string(st.Name), rtMean, rtMax, iopsPerGiB, bpsPerGiB)\n\t\t\tif err != nil {\n\t\t\t\terr = fmt.Errorf(\"%s (%s)\", err.Error(), c.pgDB.SQLCode(err))\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t\tstd := &StorageTypeData{\n\t\t\tResponseTimeMeanUsec: rtMean,\n\t\t\tResponseTimeMaxUsec: rtMax,\n\t\t\tIOPsPerGiB: iopsPerGiB,\n\t\t\tBytesPerSecPerGiB: bpsPerGiB,\n\t\t}\n\t\tc.cacheStorageType(string(st.Name), std)\n\t}\n\tc.storageTypeDataUpdated = true\n\treturn nil\n}", "title": "" }, { "docid": "dd7c1e95e02e153877e9aa5ec3e466b6", "score": "0.45917773", "text": "func (cluster *Cluster) InitDataPath(templatesPath string, dataPath string, removeExisting bool) error {\n\texists, err := fileExists(dataPath)\n\tif err != nil {\n\t\treturn err\n\t}\n\tif exists {\n\t\tif !removeExisting {\n\t\t\treturn fmt.Errorf(\"%s directory exists\", dataPath)\n\t\t}\n\t\terr = os.RemoveAll(dataPath)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\tif !cluster.Config.Goshimmer.Provided {\n\t\terr = initNodeConfig(\n\t\t\tgoshimmerDataPath(dataPath),\n\t\t\tpath.Join(templatesPath, \"goshimmer-config-template.json\"),\n\t\t\ttemplates.GoshimmerConfig,\n\t\t\tcluster.Config.GoshimmerConfigTemplateParams(),\n\t\t)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\terr = cluster.copySnapshotBin(\n\t\t\tpath.Join(templatesPath, \"snapshot.bin\"),\n\t\t\tpath.Join(goshimmerDataPath(dataPath), \"snapshot.bin\"),\n\t\t)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\tfor i := 0; i < cluster.Config.Wasp.NumNodes; i++ {\n\t\terr = initNodeConfig(\n\t\t\twaspNodeDataPath(dataPath, i),\n\t\t\tpath.Join(templatesPath, \"wasp-config-template.json\"),\n\t\t\ttemplates.WaspConfig,\n\t\t\tcluster.Config.WaspConfigTemplateParams(i),\n\t\t)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\treturn cluster.Config.Save(dataPath)\n}", "title": "" }, { "docid": "26804b6104990bbd9cf62f8fb084c2df", "score": "0.4583144", "text": "func (r *Reconsiler) Sync() error {\n\tr.updateStatus()\n\tif err := r.syncStorageClass(); err != nil {\n\t\treturn err\n\t}\n\tif err := r.syncClusterHostInfo(); err != nil {\n\t\treturn err\n\t}\n\tif err := r.syncProOperatorDeployment(); err != nil {\n\t\treturn err\n\t}\n\tif err := r.syncSecrets(); err != nil {\n\t\treturn err\n\t}\n\tif err := r.syncRouterCms(); err != nil {\n\t\treturn err\n\t}\n\tif err := r.syncPrometheus(); err != nil {\n\t\treturn err\n\t}\n\tif err := r.syncAlertmanager(); err != nil {\n\t\treturn err\n\t}\n\tif err := r.syncMCMCtl(); err != nil {\n\t\treturn err\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "e7af4b78819b6b6ce049635f4bac25f9", "score": "0.45805758", "text": "func (t *Table) AddData(initData map[string]interface{}) {\n //iterate through all keys, partitioning initData\n savedIsMaster := t.isMaster\n defer func(){t.isMaster = savedIsMaster}()\n t.isMaster = true\n for key, val := range initData {\n t.Put(key, val)\n }\n}", "title": "" }, { "docid": "4b83fac9fca167272e09618b1285833f", "score": "0.4554276", "text": "func Data(w http.ResponseWriter, r *http.Request) {\n\ttmpl.ExecuteTemplate(w, \"Data\", getDataGrouped())\n}", "title": "" }, { "docid": "23c889d22c94b6dfc566e95b76563687", "score": "0.45474243", "text": "func (s *Service) Sync() {\n\ts.db.SetSync(nil, nil)\n}", "title": "" }, { "docid": "f4e6678debd3c73716a46dc8ded14596", "score": "0.45276293", "text": "func syncRoutingMeta(ctx context.Context, r *v1.Route, cacc *configurationAccessor, racc *revisionAccessor) error {\n\trevisions := sets.NewString()\n\tconfigs := sets.NewString()\n\n\t// Walk the Route's .status.traffic and .spec.traffic and build a list\n\t// of revisions and configurations to label\n\tfor _, tt := range append(r.Status.Traffic, r.Spec.Traffic...) {\n\t\trevName := tt.RevisionName\n\t\tconfigName := tt.ConfigurationName\n\n\t\tif revName != \"\" {\n\t\t\tif err := racc.tracker.TrackReference(ref(r.Namespace, revName, \"Revision\"), r); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\n\t\t\trev, err := racc.lister.Revisions(r.Namespace).Get(revName)\n\t\t\tif err != nil {\n\t\t\t\t// The revision might not exist (yet). The informers will notify if it gets created.\n\t\t\t\tcontinue\n\t\t\t}\n\n\t\t\trevisions.Insert(revName)\n\n\t\t\t// If the owner reference is a configuration, treat it like a configuration target\n\t\t\tif owner := metav1.GetControllerOf(rev); owner != nil && owner.Kind == \"Configuration\" {\n\t\t\t\tconfigName = owner.Name\n\t\t\t}\n\t\t}\n\n\t\tif configName != \"\" {\n\t\t\tif err := cacc.tracker.TrackReference(ref(r.Namespace, configName, \"Configuration\"), r); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\n\t\t\tconfig, err := cacc.lister.Configurations(r.Namespace).Get(configName)\n\t\t\tif err != nil {\n\t\t\t\t// The config might not exist (yet). The informers will notify if it gets created.\n\t\t\t\tcontinue\n\t\t\t}\n\n\t\t\tconfigs.Insert(configName)\n\n\t\t\t// If the target is for the latest revision, add the latest created revision to the list\n\t\t\t// so that there is a smooth transition when the new revision becomes ready.\n\t\t\tif config.Status.LatestCreatedRevisionName != \"\" && tt.LatestRevision != nil && *tt.LatestRevision {\n\t\t\t\trevisions.Insert(config.Status.LatestCreatedRevisionName)\n\t\t\t}\n\t\t}\n\t}\n\n\t// Clear old meta only after the route is fully resolved\n\tif r.IsReady() || r.IsFailed() {\n\t\tif err := clearMetaForNotListed(ctx, r, racc, revisions); err != nil {\n\t\t\treturn err\n\t\t}\n\t\tif err := clearMetaForNotListed(ctx, r, cacc, configs); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\tif err := setMetaForListed(ctx, r, racc, revisions); err != nil {\n\t\treturn err\n\t}\n\treturn setMetaForListed(ctx, r, cacc, configs)\n}", "title": "" }, { "docid": "797a6cc6d89bf0e17730802e126a589e", "score": "0.4517031", "text": "func resourceVSphereComputeClusterFlattenData(\n\td *schema.ResourceData,\n\tmeta interface{},\n\tcluster *object.ClusterComputeResource,\n) error {\n\tlog.Printf(\"[DEBUG] %s: Saving cluster attributes\", resourceVSphereComputeClusterIDString(d))\n\tclient, err := resourceVSphereComputeClusterClient(meta)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// Get the version of the vSphere connection to help determine what\n\t// attributes we need to set\n\tversion := viapi.ParseVersionFromClient(client)\n\n\tprops, err := clustercomputeresource.Properties(cluster)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// Save the root resource pool ID so that it can be passed on to other\n\t// resources without having to resort to the data source.\n\tif err := d.Set(\"resource_pool_id\", props.ResourcePool.Value); err != nil {\n\t\treturn err\n\t}\n\n\tif !d.Get(\"host_managed\").(bool) {\n\t\thostList := []string{}\n\t\tfor _, host := range props.Host {\n\t\t\thostList = append(hostList, host.Value)\n\t\t}\n\t\t_ = d.Set(\"host_system_ids\", hostList)\n\t}\n\n\t// VSAN\n\terr = flattenVsanDisks(d, cluster)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tvsanConfig, err := vsanclient.GetVsanConfig(meta.(*Client).vsanClient, cluster.Reference())\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tif vsanConfig == nil {\n\t\treturn fmt.Errorf(\"error getting vsan information for cluster %s, response object was unexpectedly nil\", d.Get(\"name\").(string))\n\t}\n\n\td.Set(\"vsan_enabled\", structure.BoolNilFalse(vsanConfig.Enabled))\n\n\tif vsanConfig.DataEfficiencyConfig != nil {\n\t\td.Set(\"vsan_dedup_enabled\", vsanConfig.DataEfficiencyConfig.DedupEnabled)\n\t\td.Set(\"vsan_compression_enabled\", structure.BoolNilFalse(vsanConfig.DataEfficiencyConfig.CompressionEnabled))\n\t} else {\n\t\td.Set(\"vsan_dedup_enabled\", false)\n\t\td.Set(\"vsan_compression_enabled\", false)\n\t}\n\n\tif vsanConfig.PerfsvcConfig != nil {\n\t\td.Set(\"vsan_performance_enabled\", vsanConfig.PerfsvcConfig.Enabled)\n\t\td.Set(\"vsan_verbose_mode_enabled\", structure.BoolNilFalse(vsanConfig.PerfsvcConfig.VerboseMode))\n\t\td.Set(\"vsan_network_diagnostic_mode_enabled\", structure.BoolNilFalse(vsanConfig.PerfsvcConfig.DiagnosticMode))\n\t} else {\n\t\td.Set(\"vsan_performance_enabled\", false)\n\t\td.Set(\"vsan_verbose_mode_enabled\", false)\n\t\td.Set(\"vsan_network_diagnostic_mode_enabled\", false)\n\t}\n\n\tif vsanConfig.UnmapConfig != nil {\n\t\td.Set(\"vsan_unmap_enabled\", vsanConfig.UnmapConfig.Enable)\n\t} else {\n\t\td.Set(\"vsan_unmap_enabled\", false)\n\t}\n\n\tif vsanConfig.DataInTransitEncryptionConfig != nil {\n\t\td.Set(\"vsan_dit_encryption_enabled\", structure.BoolNilFalse(vsanConfig.DataInTransitEncryptionConfig.Enabled))\n\t\td.Set(\"vsan_dit_rekey_interval\", int(vsanConfig.DataInTransitEncryptionConfig.RekeyInterval))\n\t} else {\n\t\td.Set(\"vsan_dit_encryption_enabled\", false)\n\t\td.Set(\"vsan_dit_rekey_interval\", 0)\n\t}\n\n\tif version.AtLeast(viapi.VSphereVersion{Product: version.Product, Major: 7, Minor: 0, Patch: 1}) {\n\t\tvar dsIDs []string\n\t\tif vsanConfig.DatastoreConfig != nil {\n\t\t\tfor _, ds := range vsanConfig.DatastoreConfig.(*vsantypes.VsanAdvancedDatastoreConfig).RemoteDatastores {\n\t\t\t\tdsIDs = append(dsIDs, ds.Value)\n\t\t\t}\n\t\t}\n\t\tif err := d.Set(\"vsan_remote_datastore_ids\", schema.NewSet(schema.HashString, structure.SliceStringsToInterfaces(dsIDs))); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\treturn flattenClusterConfigSpecEx(d, props.ConfigurationEx.(*types.ClusterConfigInfoEx), version)\n}", "title": "" }, { "docid": "713d0529def7eff9ca7c1a975a60f8de", "score": "0.4515988", "text": "func InitialSync(ctx context.Context, client DataBrokerServiceClient, in *SyncRequest) (*SyncResponse, error) {\n\tdup := new(SyncRequest)\n\tproto.Merge(dup, in)\n\tdup.NoWait = true\n\n\tstream, err := client.Sync(ctx, dup)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tfinalRes := &SyncResponse{}\n\nloop:\n\tfor {\n\t\tres, err := stream.Recv()\n\t\tswitch {\n\t\tcase err == io.EOF:\n\t\t\tbreak loop\n\t\tcase err != nil:\n\t\t\treturn nil, err\n\t\t}\n\n\t\tfinalRes.ServerVersion = res.GetServerVersion()\n\t\tfinalRes.Records = append(finalRes.Records, res.GetRecords()...)\n\t}\n\n\treturn finalRes, nil\n}", "title": "" }, { "docid": "b437868632fb477d61447338f590ce34", "score": "0.45143908", "text": "func FillTemplate(template string, data map[string]string) string {\n\tcode := template\n\n\t// Replace all the placeholders with data\n\tfor key, val := range data {\n\t\tplaceholder := fmt.Sprintf(\"<!-- Data:%s -->\", key)\n\t\tcode = strings.Replace(code, placeholder, val, -1)\n\t}\n\n\treturn code\n}", "title": "" }, { "docid": "8d32fe5b1d1734c86c74313a27d6cc9a", "score": "0.44916216", "text": "func GetTemplateData() *[]types.Template {\n\tconf0 := json.RawMessage(`{\"fakeConf01\":\"x\",\"fakeConf02\":\"y\"}`)\n\tconf1 := json.RawMessage(`{\"fakeConf11\":\"x\",\"fakeConf12\":\"y\"}`)\n\ttestTemplates := []types.Template{\n\t\t{\n\t\t\tID: \"fakeID0\",\n\t\t\tName: \"fakeName0\",\n\t\t\tGenericImageID: \"fakeGenericImageID0\",\n\t\t\tServiceList: []string{\"fakeServiceList01\", \"fakeServiceList02\"},\n\t\t\tConfigurationAttributes: &conf0,\n\t\t},\n\t\t{\n\t\t\tID: \"fakeID1\",\n\t\t\tName: \"fakeName1\",\n\t\t\tGenericImageID: \"fakeGenericImageID1\",\n\t\t\tServiceList: []string{\"fakeServiceList11\", \"fakeServiceList12\", \"fakeServiceList13\"},\n\t\t\tConfigurationAttributes: &conf1,\n\t\t},\n\t\t{\n\t\t\tID: \"fakeID2\",\n\t\t\tName: \"fakeName2\",\n\t\t\tGenericImageID: \"fakeGenericImageID2\",\n\t\t\tServiceList: []string{\"fakeServiceList21\", \"fakeServiceList22\", \"fakeServiceList23\"},\n\t\t\tConfigurationAttributes: nil,\n\t\t},\n\t}\n\n\treturn &testTemplates\n}", "title": "" }, { "docid": "251aabca18eceab73a28e55136ef21b1", "score": "0.44891766", "text": "func (r Resource)MarshalJSON() ([]byte, error){\n objectMap := make(map[string]interface{})\n if(r.SystemData != nil) {\n objectMap[\"systemData\"] = r.SystemData\n }\n return json.Marshal(objectMap)\n }", "title": "" }, { "docid": "8ceb0d21a9376d2796d1983d5aecb8a3", "score": "0.44788048", "text": "func (op *SmtCreateOperation) Data() interface{} {\n\treturn op\n}", "title": "" }, { "docid": "cef79f9aefaa6fb36e4d8616af5a87bb", "score": "0.44757572", "text": "func (*DataResyncReplies_DataResyncsReplies) Descriptor() ([]byte, []int) {\n\treturn file_datamsg_proto_rawDescGZIP(), []int{2, 0}\n}", "title": "" }, { "docid": "1b944d3d362bf323211ae7bcd2e12670", "score": "0.44694668", "text": "func syncNamespaceLevelData(username, action, operation, clusterId, namespace string) error {\n\tkubeClient, err := rbacUtils.GetKubeClient(clusterId)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"failed to build kubeclient for cluster %s: %s\", clusterId, err.Error())\n\t}\n\n\tif operation == \"add\" {\n\t\treturn addNamespaceLevelRbac(username, action, clusterId, namespace, kubeClient)\n\t} else if operation == \"delete\" {\n\t\treturn deleteNamespaceLevelRbac(username, action, clusterId, namespace, kubeClient)\n\t}\n\treturn fmt.Errorf(\"invalid operabion: %s\", operation)\n}", "title": "" }, { "docid": "d47869f71b13acca15351398b5a4c4cc", "score": "0.44684014", "text": "func (c *SSM) ListResourceDataSync(input *ListResourceDataSyncInput) (*ListResourceDataSyncOutput, error) {\n\treq, out := c.ListResourceDataSyncRequest(input)\n\terr := req.Send()\n\treturn out, err\n}", "title": "" }, { "docid": "d77d4103bb7e2d6c5bb7946d46f7551d", "score": "0.4455111", "text": "func (c *SSM) CreateResourceDataSync(input *CreateResourceDataSyncInput) (*CreateResourceDataSyncOutput, error) {\n\treq, out := c.CreateResourceDataSyncRequest(input)\n\terr := req.Send()\n\treturn out, err\n}", "title": "" }, { "docid": "d7ad91c1d2860e3c0c1294a24033ea76", "score": "0.44419202", "text": "func (r *TestResource) ResourceData() objx.Map {\n\treturn r.Data\n}", "title": "" }, { "docid": "7f3bfa48c0b8c2f9b1b3f18adc1927e6", "score": "0.44409993", "text": "func (f *FileInode) Sync(ctx context.Context) (err error) {\n\t// If we have not been dirtied, there is nothing to do.\n\tif f.content == nil {\n\t\treturn\n\t}\n\n\t// When listObjects call is made, we fetch data with projection set as noAcl\n\t// which means acls and owner properties are not returned. So the f.src object\n\t// here will not have acl information even though there are acls present on\n\t// the gcsObject.\n\t// Hence, we are making an explicit gcs stat call to fetch the latest\n\t// properties and using that when object is synced below. StatObject by\n\t// default sets the projection to full, which fetches all the object\n\t// properties.\n\tlatestGcsObj, isClobbered, err := f.clobbered(ctx, true)\n\n\t// Clobbered is treated as being unlinked. There's no reason to return an\n\t// error in that case. We simply return without syncing the object.\n\tif err != nil || isClobbered {\n\t\treturn\n\t}\n\n\t// Write out the contents if they are dirty.\n\t// Object properties are also synced as part of content sync. Hence, passing\n\t// the latest object fetched from gcs which has all the properties populated.\n\tnewObj, err := f.bucket.SyncObject(ctx, latestGcsObj, f.content)\n\n\t// Special case: a precondition error means we were clobbered, which we treat\n\t// as being unlinked. There's no reason to return an error in that case.\n\tvar preconditionErr *gcs.PreconditionError\n\tif errors.As(err, &preconditionErr) {\n\t\terr = nil\n\t\treturn\n\t}\n\n\t// Propagate other errors.\n\tif err != nil {\n\t\terr = fmt.Errorf(\"SyncObject: %w\", err)\n\t\treturn\n\t}\n\n\t// If we wrote out a new object, we need to update our state.\n\tif newObj != nil && !f.localFileCache {\n\t\tf.src = convertObjToMinObject(newObj)\n\t\tf.content.Destroy()\n\t\tf.content = nil\n\t}\n\n\treturn\n}", "title": "" }, { "docid": "1a9f02ee5443c7bd433b1a9beabf170f", "score": "0.4438844", "text": "func (r *HTML) Render(w http.ResponseWriter, code int, data *Data) {\n\tdata.m.RLock()\n\tdefer data.m.RUnlock()\n\n\tif r.config.Debug {\n\t\trqctx.GetLogger(data.r.Context()).Warn(\"HTML renderer is in the debug mode, reloading all templates\")\n\t\tif err := r.initTemplates(); err != nil {\n\t\t\trqctx.GetLogger(data.r.Context()).Error(\n\t\t\t\t\"Problems with reloading HTML templates\",\n\t\t\t\tzap.Error(err),\n\t\t\t)\n\t\t\treturn\n\t\t}\n\t}\n\n\ttemplateData := data.data\n\n\ttemplateData[\"lang\"] = r.config.UICfg.Language\n\ttemplateData[\"title\"] = r.config.UICfg.Title\n\ttemplateData[\"heading\"] = r.config.UICfg.Heading\n\ttemplateData[\"intro\"] = r.config.UICfg.Intro\n\ttemplateData[\"theme\"] = r.config.UICfg.Theme\n\ttemplateData[\"author\"] = r.config.UICfg.Author\n\ttemplateData[\"description\"] = r.config.UICfg.Description\n\ttemplateData[\"date_format\"] = r.config.UICfg.DateFormat\n\n\ttemplateData[\"instance_id\"] = r.instanceID\n\ttemplateData[\"plugins\"] = r.enabledPluginsMap\n\ttemplateData[\"plugin\"] = r.pluginsSettings\n\n\ttemplateData[\"url_path\"] = data.r.URL.Path\n\ttemplateData[\"root_url\"] = r.config.RootURLCfg.URL(data.r).String()\n\n\tcurrentURL := &url.URL{}\n\t*currentURL = *r.config.RootURLCfg.URL(data.r)\n\tcurrentURL.Path = data.r.URL.Path\n\ttemplateData[\"current_url\"] = currentURL.String()\n\n\tlogger := rqctx.GetLogger(data.r.Context())\n\n\ttmpl, found := r.templates[data.template]\n\tif !found {\n\t\tlogger.Error(\"Template is not found in the templates registry\", zap.String(\"template\", data.template))\n\t\tpanic(fmt.Errorf(\"template is not found in the templates registry %q\", data.template))\n\t}\n\n\tw.WriteHeader(code)\n\n\terr := tmpl.Execute(w, templateData)\n\tif nil != err {\n\t\tlogger.Error(\n\t\t\t\"Problems with rendering HTML template\",\n\t\t\tzap.Error(err),\n\t\t\tzap.String(\"template\", data.template),\n\t\t)\n\t}\n}", "title": "" }, { "docid": "c3b1b5cc8a0675d54255b621c57d02ca", "score": "0.44364324", "text": "func (r *Resources) AppendData(data map[string]string) {\n\tfor k, v := range data {\n\t\t// key := lookupKey(k)\n\t\tr.data[k] = v\n\t}\n}", "title": "" }, { "docid": "0967fbb47685a9676d4cfc9be3ee6d8e", "score": "0.44345194", "text": "func resourceDataToGroup(d *schema.ResourceData) keycloak.Group {\n\tu := keycloak.Group{\n\t\tName: d.Get(\"name\").(string),\n\t\tAttributes: getOptionalStringMap(d, \"attributes\"),\n\t\tRealmRoles: getOptionalStringList(d, \"realmroles\"),\n\t\tClientRoles: getOptionalStringMap(d, \"clientroles\"),\n\t}\n\n\tif !d.IsNewResource() {\n\t\tu.Id = d.Id()\n\t}\n\n\treturn u\n}", "title": "" }, { "docid": "f485bc371fe7d7ccf6f1bca219ef8b47", "score": "0.44280496", "text": "func (kv *kvDataStorage) trySync() error {\n\tn := atomic.AddUint64(&kv.writeCount, 1)\n\tif n%kv.opts.sampleSync != 0 {\n\t\treturn nil\n\t}\n\tif err := kv.base.Sync(); err != nil {\n\t\treturn err\n\t}\n\n\tkv.updatePersistentAppliedIndexes()\n\treturn nil\n}", "title": "" }, { "docid": "e7a585c102f2531cbd55be0e2a10c78e", "score": "0.44136032", "text": "func (dc *DownstreamController) syncDataset(eventType watch.EventType, dataset *neptunev1.Dataset) error {\n\t// Here only propagate to the nodes with non empty name\n\tnodeName := dataset.Spec.NodeName\n\tif len(nodeName) == 0 {\n\t\treturn fmt.Errorf(\"empty node name\")\n\t}\n\n\treturn dc.messageLayer.SendResourceObject(nodeName, eventType, dataset)\n}", "title": "" }, { "docid": "1227f7371d6f7568e668a2a3f6d96863", "score": "0.44128054", "text": "func getMergeData(template, empty interface{}) (*mergeData, error) {\n\t// We need JSON bytes to generate a patch to merge the object\n\t// onto the template, so marshal the template.\n\ttemplateJSON, err := json.Marshal(template)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\t// We need to do a three-way merge to actually merge the template and\n\t// object, so we need an empty object as the \"original\"\n\temptyJSON, err := json.Marshal(empty)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\t// Get the patch meta, which is needed for generating and applying the merge patch.\n\tpatchSchema, err := strategicpatch.NewPatchMetaFromStruct(template)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn &mergeData{templateJSON: templateJSON, emptyJSON: emptyJSON, patchSchema: patchSchema}, nil\n}", "title": "" }, { "docid": "ec6475deb3cdb7cdcd6d8ee0ef8d1182", "score": "0.4402037", "text": "func parseDataAndTemplate(data, subjectFile, bodyFile string) (map[string]interface{}, map[string]*template.Template) {\n\tvar templates = make(map[string]*template.Template)\n\n\t// Parse data\n\tvar dataJSON = make(map[string]interface{})\n\terr := json.Unmarshal([]byte(data), &dataJSON)\n\n\tif err != nil {\n\t\tlog.Printf(\"Error parsing JSON: %v\", err)\n\t}\n\n\t// Read subject template file\n\tcontent, err := ioutil.ReadFile(subjectFile)\n\n\tif err != nil {\n\t\tlog.Printf(\"Error parsing file %v: %v\", subjectFile, err)\n\t}\n\n\ttemplates[\"subject\"] = makeTemplate(string(content[:len(content)]))\n\n\t// Read subject template file\n\tcontent, err = ioutil.ReadFile(bodyFile)\n\n\tif err != nil {\n\t\tlog.Printf(\"Error parsing file %v: %v\", bodyFile, err)\n\t}\n\n\ttemplates[\"body\"] = makeTemplate(string(content[:len(content)]))\n\n\treturn dataJSON, templates\n}", "title": "" }, { "docid": "7453a2a245ddf2a955f76d8728cc9815", "score": "0.44001472", "text": "func (cs *State) Start() {\n\tlog.Info(\"Starting K8s API resource sync\")\n\n\tvar ctx context.Context\n\tctx, cs.cancel = context.WithCancel(context.Background())\n\n\tcoreClient := cs.clientset.CoreV1().RESTClient()\n\textV1beta1Client := cs.clientset.ExtensionsV1beta1().RESTClient()\n\n\tcs.beginSyncForType(ctx, &v1.Pod{}, \"pods\", cs.namespace, coreClient)\n\tcs.beginSyncForType(ctx, &v1beta1.DaemonSet{}, \"daemonsets\", cs.namespace, extV1beta1Client)\n\tcs.beginSyncForType(ctx, &v1beta1.Deployment{}, \"deployments\", cs.namespace, extV1beta1Client)\n\tcs.beginSyncForType(ctx, &v1.ReplicationController{}, \"replicationcontrollers\", cs.namespace, coreClient)\n\tcs.beginSyncForType(ctx, &v1beta1.ReplicaSet{}, \"replicasets\", cs.namespace, extV1beta1Client)\n\tcs.beginSyncForType(ctx, &v1.ResourceQuota{}, \"resourcequotas\", cs.namespace, coreClient)\n\tcs.beginSyncForType(ctx, &v1.Service{}, \"services\", cs.namespace, coreClient)\n\t// Node and Namespace are NOT namespaced resources, so we don't need to\n\t// fetch them if we are scoped to a specific namespace\n\tif cs.namespace == \"\" {\n\t\tcs.beginSyncForType(ctx, &v1.Node{}, \"nodes\", \"\", coreClient)\n\t\tcs.beginSyncForType(ctx, &v1.Namespace{}, \"namespaces\", \"\", coreClient)\n\t}\n}", "title": "" }, { "docid": "be55c18b82534a4dcf6d6dd804631416", "score": "0.43971512", "text": "func (*SyncActionData) Descriptor() ([]byte, []int) {\n\treturn file_binary_proto_def_proto_rawDescGZIP(), []int{148}\n}", "title": "" }, { "docid": "91394f161c9c7bfa44b79231dac1693d", "score": "0.4397053", "text": "func init() {\n\tResourceTemplates = map[string]string{\n\t\t\"data-sources\": dataSourcesTpl,\n\t\t\"output\": outputTpl,\n\t\t\"provider\": providerTpl,\n\t\t\"resources\": resourcesTpl,\n\t\t\"variables\": variablesTpl,\n\t}\n}", "title": "" }, { "docid": "9ef9f2488ecfc3ce5d255eb55f9dfc3c", "score": "0.43949658", "text": "func reportData(cfg configIntf, m modelIntf, connectionsService connectionsIntf, version int, preview bool) map[string]interface{} {\n\topts := cfg.Options()\n\tres := make(map[string]interface{})\n\tres[\"urVersion\"] = version\n\tres[\"uniqueID\"] = opts.URUniqueID\n\tres[\"version\"] = Version\n\tres[\"longVersion\"] = LongVersion\n\tres[\"platform\"] = runtime.GOOS + \"-\" + runtime.GOARCH\n\tres[\"numFolders\"] = len(cfg.Folders())\n\tres[\"numDevices\"] = len(cfg.Devices())\n\n\tvar totFiles, maxFiles int\n\tvar totBytes, maxBytes int64\n\tfor folderID := range cfg.Folders() {\n\t\tglobal := m.GlobalSize(folderID)\n\t\ttotFiles += int(global.Files)\n\t\ttotBytes += global.Bytes\n\t\tif int(global.Files) > maxFiles {\n\t\t\tmaxFiles = int(global.Files)\n\t\t}\n\t\tif global.Bytes > maxBytes {\n\t\t\tmaxBytes = global.Bytes\n\t\t}\n\t}\n\n\tres[\"totFiles\"] = totFiles\n\tres[\"folderMaxFiles\"] = maxFiles\n\tres[\"totMiB\"] = totBytes / 1024 / 1024\n\tres[\"folderMaxMiB\"] = maxBytes / 1024 / 1024\n\n\tvar mem runtime.MemStats\n\truntime.ReadMemStats(&mem)\n\tres[\"memoryUsageMiB\"] = (mem.Sys - mem.HeapReleased) / 1024 / 1024\n\tres[\"sha256Perf\"] = cpuBench(5, 125*time.Millisecond, false)\n\tres[\"hashPerf\"] = cpuBench(5, 125*time.Millisecond, true)\n\n\tbytes, err := memorySize()\n\tif err == nil {\n\t\tres[\"memorySize\"] = bytes / 1024 / 1024\n\t}\n\tres[\"numCPU\"] = runtime.NumCPU()\n\n\tvar rescanIntvs []int\n\tfolderUses := map[string]int{\n\t\t\"sendonly\": 0,\n\t\t\"sendreceive\": 0,\n\t\t\"receiveonly\": 0,\n\t\t\"ignorePerms\": 0,\n\t\t\"ignoreDelete\": 0,\n\t\t\"autoNormalize\": 0,\n\t\t\"simpleVersioning\": 0,\n\t\t\"externalVersioning\": 0,\n\t\t\"staggeredVersioning\": 0,\n\t\t\"trashcanVersioning\": 0,\n\t}\n\tfor _, cfg := range cfg.Folders() {\n\t\trescanIntvs = append(rescanIntvs, cfg.RescanIntervalS)\n\n\t\tswitch cfg.Type {\n\t\tcase config.FolderTypeSendOnly:\n\t\t\tfolderUses[\"sendonly\"]++\n\t\tcase config.FolderTypeSendReceive:\n\t\t\tfolderUses[\"sendreceive\"]++\n\t\tcase config.FolderTypeReceiveOnly:\n\t\t\tfolderUses[\"receiveonly\"]++\n\t\t}\n\t\tif cfg.IgnorePerms {\n\t\t\tfolderUses[\"ignorePerms\"]++\n\t\t}\n\t\tif cfg.IgnoreDelete {\n\t\t\tfolderUses[\"ignoreDelete\"]++\n\t\t}\n\t\tif cfg.AutoNormalize {\n\t\t\tfolderUses[\"autoNormalize\"]++\n\t\t}\n\t\tif cfg.Versioning.Type != \"\" {\n\t\t\tfolderUses[cfg.Versioning.Type+\"Versioning\"]++\n\t\t}\n\t}\n\tsort.Ints(rescanIntvs)\n\tres[\"rescanIntvs\"] = rescanIntvs\n\tres[\"folderUses\"] = folderUses\n\n\tdeviceUses := map[string]int{\n\t\t\"introducer\": 0,\n\t\t\"customCertName\": 0,\n\t\t\"compressAlways\": 0,\n\t\t\"compressMetadata\": 0,\n\t\t\"compressNever\": 0,\n\t\t\"dynamicAddr\": 0,\n\t\t\"staticAddr\": 0,\n\t}\n\tfor _, cfg := range cfg.Devices() {\n\t\tif cfg.Introducer {\n\t\t\tdeviceUses[\"introducer\"]++\n\t\t}\n\t\tif cfg.CertName != \"\" && cfg.CertName != \"syncthing\" {\n\t\t\tdeviceUses[\"customCertName\"]++\n\t\t}\n\t\tif cfg.Compression == protocol.CompressAlways {\n\t\t\tdeviceUses[\"compressAlways\"]++\n\t\t} else if cfg.Compression == protocol.CompressMetadata {\n\t\t\tdeviceUses[\"compressMetadata\"]++\n\t\t} else if cfg.Compression == protocol.CompressNever {\n\t\t\tdeviceUses[\"compressNever\"]++\n\t\t}\n\t\tfor _, addr := range cfg.Addresses {\n\t\t\tif addr == \"dynamic\" {\n\t\t\t\tdeviceUses[\"dynamicAddr\"]++\n\t\t\t} else {\n\t\t\t\tdeviceUses[\"staticAddr\"]++\n\t\t\t}\n\t\t}\n\t}\n\tres[\"deviceUses\"] = deviceUses\n\n\tdefaultAnnounceServersDNS, defaultAnnounceServersIP, otherAnnounceServers := 0, 0, 0\n\tfor _, addr := range opts.GlobalAnnServers {\n\t\tif addr == \"default\" || addr == \"default-v4\" || addr == \"default-v6\" {\n\t\t\tdefaultAnnounceServersDNS++\n\t\t} else {\n\t\t\totherAnnounceServers++\n\t\t}\n\t}\n\tres[\"announce\"] = map[string]interface{}{\n\t\t\"globalEnabled\": opts.GlobalAnnEnabled,\n\t\t\"localEnabled\": opts.LocalAnnEnabled,\n\t\t\"defaultServersDNS\": defaultAnnounceServersDNS,\n\t\t\"defaultServersIP\": defaultAnnounceServersIP,\n\t\t\"otherServers\": otherAnnounceServers,\n\t}\n\n\tdefaultRelayServers, otherRelayServers := 0, 0\n\tfor _, addr := range cfg.ListenAddresses() {\n\t\tswitch {\n\t\tcase addr == \"dynamic+https://relays.syncthing.net/endpoint\":\n\t\t\tdefaultRelayServers++\n\t\tcase strings.HasPrefix(addr, \"relay://\") || strings.HasPrefix(addr, \"dynamic+http\"):\n\t\t\totherRelayServers++\n\t\t}\n\t}\n\tres[\"relays\"] = map[string]interface{}{\n\t\t\"enabled\": defaultRelayServers+otherAnnounceServers > 0,\n\t\t\"defaultServers\": defaultRelayServers,\n\t\t\"otherServers\": otherRelayServers,\n\t}\n\n\tres[\"usesRateLimit\"] = opts.MaxRecvKbps > 0 || opts.MaxSendKbps > 0\n\n\tres[\"upgradeAllowedManual\"] = !(upgrade.DisabledByCompilation || noUpgradeFromEnv)\n\tres[\"upgradeAllowedAuto\"] = !(upgrade.DisabledByCompilation || noUpgradeFromEnv) && opts.AutoUpgradeIntervalH > 0\n\tres[\"upgradeAllowedPre\"] = !(upgrade.DisabledByCompilation || noUpgradeFromEnv) && opts.AutoUpgradeIntervalH > 0 && opts.UpgradeToPreReleases\n\n\tif version >= 3 {\n\t\tres[\"uptime\"] = int(time.Now().Sub(startTime).Seconds())\n\t\tres[\"natType\"] = connectionsService.NATType()\n\t\tres[\"alwaysLocalNets\"] = len(opts.AlwaysLocalNets) > 0\n\t\tres[\"cacheIgnoredFiles\"] = opts.CacheIgnoredFiles\n\t\tres[\"overwriteRemoteDeviceNames\"] = opts.OverwriteRemoteDevNames\n\t\tres[\"progressEmitterEnabled\"] = opts.ProgressUpdateIntervalS > -1\n\t\tres[\"customDefaultFolderPath\"] = opts.DefaultFolderPath != \"~\"\n\t\tres[\"customTrafficClass\"] = opts.TrafficClass != 0\n\t\tres[\"customTempIndexMinBlocks\"] = opts.TempIndexMinBlocks != 10\n\t\tres[\"temporariesDisabled\"] = opts.KeepTemporariesH == 0\n\t\tres[\"temporariesCustom\"] = opts.KeepTemporariesH != 24\n\t\tres[\"limitBandwidthInLan\"] = opts.LimitBandwidthInLan\n\t\tres[\"customReleaseURL\"] = opts.ReleasesURL != \"https://upgrades.syncthing.net/meta.json\"\n\t\tres[\"restartOnWakeup\"] = opts.RestartOnWakeup\n\n\t\tfolderUsesV3 := map[string]int{\n\t\t\t\"scanProgressDisabled\": 0,\n\t\t\t\"conflictsDisabled\": 0,\n\t\t\t\"conflictsUnlimited\": 0,\n\t\t\t\"conflictsOther\": 0,\n\t\t\t\"disableSparseFiles\": 0,\n\t\t\t\"disableTempIndexes\": 0,\n\t\t\t\"alwaysWeakHash\": 0,\n\t\t\t\"customWeakHashThreshold\": 0,\n\t\t\t\"fsWatcherEnabled\": 0,\n\t\t}\n\t\tpullOrder := make(map[string]int)\n\t\tfilesystemType := make(map[string]int)\n\t\tvar fsWatcherDelays []int\n\t\tfor _, cfg := range cfg.Folders() {\n\t\t\tif cfg.ScanProgressIntervalS < 0 {\n\t\t\t\tfolderUsesV3[\"scanProgressDisabled\"]++\n\t\t\t}\n\t\t\tif cfg.MaxConflicts == 0 {\n\t\t\t\tfolderUsesV3[\"conflictsDisabled\"]++\n\t\t\t} else if cfg.MaxConflicts < 0 {\n\t\t\t\tfolderUsesV3[\"conflictsUnlimited\"]++\n\t\t\t} else {\n\t\t\t\tfolderUsesV3[\"conflictsOther\"]++\n\t\t\t}\n\t\t\tif cfg.DisableSparseFiles {\n\t\t\t\tfolderUsesV3[\"disableSparseFiles\"]++\n\t\t\t}\n\t\t\tif cfg.DisableTempIndexes {\n\t\t\t\tfolderUsesV3[\"disableTempIndexes\"]++\n\t\t\t}\n\t\t\tif cfg.WeakHashThresholdPct < 0 {\n\t\t\t\tfolderUsesV3[\"alwaysWeakHash\"]++\n\t\t\t} else if cfg.WeakHashThresholdPct != 25 {\n\t\t\t\tfolderUsesV3[\"customWeakHashThreshold\"]++\n\t\t\t}\n\t\t\tif cfg.FSWatcherEnabled {\n\t\t\t\tfolderUsesV3[\"fsWatcherEnabled\"]++\n\t\t\t}\n\t\t\tpullOrder[cfg.Order.String()]++\n\t\t\tfilesystemType[cfg.FilesystemType.String()]++\n\t\t\tfsWatcherDelays = append(fsWatcherDelays, cfg.FSWatcherDelayS)\n\t\t}\n\t\tsort.Ints(fsWatcherDelays)\n\t\tfolderUsesV3Interface := map[string]interface{}{\n\t\t\t\"pullOrder\": pullOrder,\n\t\t\t\"filesystemType\": filesystemType,\n\t\t\t\"fsWatcherDelays\": fsWatcherDelays,\n\t\t}\n\t\tfor key, value := range folderUsesV3 {\n\t\t\tfolderUsesV3Interface[key] = value\n\t\t}\n\t\tres[\"folderUsesV3\"] = folderUsesV3Interface\n\n\t\tguiCfg := cfg.GUI()\n\t\t// Anticipate multiple GUI configs in the future, hence store counts.\n\t\tguiStats := map[string]int{\n\t\t\t\"enabled\": 0,\n\t\t\t\"useTLS\": 0,\n\t\t\t\"useAuth\": 0,\n\t\t\t\"insecureAdminAccess\": 0,\n\t\t\t\"debugging\": 0,\n\t\t\t\"insecureSkipHostCheck\": 0,\n\t\t\t\"insecureAllowFrameLoading\": 0,\n\t\t\t\"listenLocal\": 0,\n\t\t\t\"listenUnspecified\": 0,\n\t\t}\n\t\ttheme := make(map[string]int)\n\t\tif guiCfg.Enabled {\n\t\t\tguiStats[\"enabled\"]++\n\t\t\tif guiCfg.UseTLS() {\n\t\t\t\tguiStats[\"useTLS\"]++\n\t\t\t}\n\t\t\tif len(guiCfg.User) > 0 && len(guiCfg.Password) > 0 {\n\t\t\t\tguiStats[\"useAuth\"]++\n\t\t\t}\n\t\t\tif guiCfg.InsecureAdminAccess {\n\t\t\t\tguiStats[\"insecureAdminAccess\"]++\n\t\t\t}\n\t\t\tif guiCfg.Debugging {\n\t\t\t\tguiStats[\"debugging\"]++\n\t\t\t}\n\t\t\tif guiCfg.InsecureSkipHostCheck {\n\t\t\t\tguiStats[\"insecureSkipHostCheck\"]++\n\t\t\t}\n\t\t\tif guiCfg.InsecureAllowFrameLoading {\n\t\t\t\tguiStats[\"insecureAllowFrameLoading\"]++\n\t\t\t}\n\n\t\t\taddr, err := net.ResolveTCPAddr(\"tcp\", guiCfg.Address())\n\t\t\tif err == nil {\n\t\t\t\tif addr.IP.IsLoopback() {\n\t\t\t\t\tguiStats[\"listenLocal\"]++\n\t\t\t\t} else if addr.IP.IsUnspecified() {\n\t\t\t\t\tguiStats[\"listenUnspecified\"]++\n\t\t\t\t}\n\t\t\t}\n\n\t\t\ttheme[guiCfg.Theme]++\n\t\t}\n\t\tguiStatsInterface := map[string]interface{}{\n\t\t\t\"theme\": theme,\n\t\t}\n\t\tfor key, value := range guiStats {\n\t\t\tguiStatsInterface[key] = value\n\t\t}\n\t\tres[\"guiStats\"] = guiStatsInterface\n\t}\n\n\tfor key, value := range m.UsageReportingStats(version, preview) {\n\t\tres[key] = value\n\t}\n\n\treturn res\n}", "title": "" }, { "docid": "7a0db2eca99459ff7aa73e6f20c31deb", "score": "0.43877715", "text": "func Sync() error {\n\tconfig := readConfig()\n\tif config.Username == \"\" || config.UID == \"\" {\n\t\tfmt.Errorf(\"Cannot sync because you did not login yet.\")\n\t\treturn errors.New(\"Cannot sync because you did not login yet.\")\n\t}\n\tlogs := readLog()\n\tconfigJsonString, err := json.Marshal(config)\n\tlogsJsonString, err := json.Marshal(logs)\n\tif err != nil {\n\t\tfmt.Errorf(\"Failed to parse Config or Log file\")\n\t\tfmt.Printf(err.Error())\n\t}\n\tvar params = make(map[string]string)\n\tparams[\"config\"] = string(configJsonString)\n\tparams[\"log\"] = string(logsJsonString)\n\tparams[\"username\"] = config.Username\n\tparams[\"uid\"] = config.UID\n\tlcAdd(params)\n\treturn nil\n}", "title": "" }, { "docid": "65c2c3640a9b0bbe11a76659a28723d9", "score": "0.43688032", "text": "func (m *Monocular) InitSync() {\n\tgo m.processSyncRequests()\n}", "title": "" }, { "docid": "a766527bf8d1495d08aa0fce9e50616a", "score": "0.43686664", "text": "func NewReqData() *ReqData { return &ReqData{start: time.Now()} }", "title": "" }, { "docid": "c7326ad3846a7e347773bdc4c0d274dd", "score": "0.43608645", "text": "func createTemplateData(cr *x509.CertificateRequest, maxPathLen int) x509util.TemplateData {\n\tvar sans []string\n\tsans = append(sans, cr.DNSNames...)\n\tsans = append(sans, cr.EmailAddresses...)\n\tfor _, v := range cr.IPAddresses {\n\t\tsans = append(sans, v.String())\n\t}\n\tfor _, v := range cr.URIs {\n\t\tsans = append(sans, v.String())\n\t}\n\n\tdata := x509util.NewTemplateData()\n\tdata.SetCertificateRequest(cr)\n\tdata.Set(\"MaxPathLen\", maxPathLen)\n\tdata.SetSubject(x509util.Subject{\n\t\tCountry: cr.Subject.Country,\n\t\tOrganization: cr.Subject.Organization,\n\t\tOrganizationalUnit: cr.Subject.OrganizationalUnit,\n\t\tLocality: cr.Subject.Locality,\n\t\tProvince: cr.Subject.Province,\n\t\tStreetAddress: cr.Subject.StreetAddress,\n\t\tPostalCode: cr.Subject.PostalCode,\n\t\tSerialNumber: cr.Subject.SerialNumber,\n\t\tCommonName: cr.Subject.CommonName,\n\t})\n\tdata.SetSANs(sans)\n\treturn data\n}", "title": "" }, { "docid": "33ddc59c12591a357fda3618f1aaef59", "score": "0.43606383", "text": "func Sync(request *generic.SyncHookRequest, response *generic.SyncHookResponse) error {\n\tif request == nil {\n\t\treturn errors.Errorf(\"Failed to reconcile CStorClusterConfig: Nil request found\")\n\t}\n\tif response == nil {\n\t\treturn errors.Errorf(\"Failed to reconcile CStorClusterConfig: Nil response found\")\n\t}\n\t// Nothing needs to be done if there are no attachments in request\n\t//\n\t// NOTE:\n\t// \tIt is expected to have CStorClusterConfig as an attachment\n\t// resource as well as the resource under watch.\n\tif request.Attachments == nil || request.Attachments.IsEmpty() {\n\t\tglog.V(3).Infof(\n\t\t\t\"Will skip reconciliation: Nil attachments: CStorClusterConfig %q / %q\",\n\t\t\trequest.Watch.GetNamespace(), request.Watch.GetName(),\n\t\t)\n\t\tresponse.SkipReconcile = true\n\t\treturn nil\n\t}\n\n\tglog.V(3).Infof(\n\t\t\"Will reconcile CStorClusterConfig %q / %q:\",\n\t\trequest.Watch.GetNamespace(), request.Watch.GetName(),\n\t)\n\n\t// construct the error handler\n\terrHandler := &reconcileErrHandler{\n\t\tclusterConfig: request.Watch,\n\t\thookResponse: response,\n\t}\n\n\tvar cstorClusterConfigObj *unstructured.Unstructured\n\tvar cstorClusterPlanObj *unstructured.Unstructured\n\tfor _, attachment := range request.Attachments.List() {\n\t\t// this watch resource must be present in the list of attachments\n\t\tif request.Watch.GetUID() == attachment.GetUID() &&\n\t\t\tattachment.GetKind() == string(types.KindCStorClusterConfig) {\n\t\t\t// this is the required CStorClusterConfig\n\t\t\tcstorClusterConfigObj = attachment\n\t\t\t// add this to the response later after completion of its\n\t\t\t// reconcile logic\n\t\t\tcontinue\n\t\t}\n\t\tif attachment.GetKind() == string(types.KindCStorClusterPlan) {\n\t\t\t// verify further if CStorClusterPlan is what we are looking\n\t\t\tuid, _ := unstruct.GetValueForKey(\n\t\t\t\tattachment.GetAnnotations(), types.AnnKeyCStorClusterConfigUID,\n\t\t\t)\n\t\t\tif string(request.Watch.GetUID()) == uid {\n\t\t\t\t// this is the desired CStorClusterPlan\n\t\t\t\tcstorClusterPlanObj = attachment\n\t\t\t\tcontinue\n\t\t\t}\n\t\t}\n\t\tresponse.Attachments = append(response.Attachments, attachment)\n\t}\n\n\tif cstorClusterConfigObj == nil {\n\t\terrHandler.handle(\n\t\t\terrors.Errorf(\"Can't reconcile: CStorClusterConfig not found in attachments\"),\n\t\t)\n\t\treturn nil\n\t}\n\n\t// reconciler is the one that will perform reconciliation of\n\t// CStorClusterConfig resource\n\treconciler, err :=\n\t\tNewReconciler(\n\t\t\tcstorClusterConfigObj,\n\t\t\tcstorClusterPlanObj,\n\t\t\trequest.Attachments.List(),\n\t\t)\n\tif err != nil {\n\t\terrHandler.handle(err)\n\t\treturn nil\n\t}\n\top, err := reconciler.Reconcile()\n\tif err != nil {\n\t\terrHandler.handle(err)\n\t\treturn nil\n\t}\n\tif op.SkipReconcile {\n\t\t// skip reconciliation at metac\n\t\tresponse.SkipReconcile = true\n\t\tglog.V(3).Infof(\n\t\t\t\"Will skip reconciliation: %s: CStorClusterConfig %q / %q\",\n\t\t\top.SkipReason, request.Watch.GetNamespace(), request.Watch.GetName(),\n\t\t)\n\t\treturn nil\n\t}\n\n\t// add updated CStorClusterConfig & CStorClusterConfigPlan to response\n\tresponse.Attachments = append(response.Attachments, op.CStorClusterConfig)\n\tresponse.Attachments = append(response.Attachments, op.CStorClusterPlan)\n\n\tglog.V(2).Infof(\n\t\t\"CStorClusterConfig %s %s reconciled successfully: %s\",\n\t\trequest.Watch.GetNamespace(), request.Watch.GetName(),\n\t\tmetac.GetDetailsFromResponse(response),\n\t)\n\treturn nil\n}", "title": "" }, { "docid": "f4a0864a27b65d94fe0c2abc41a24340", "score": "0.4351705", "text": "func (s LocalVolumeResourceData) MarshalFields(e protocol.FieldEncoder) error {\n\tif s.DestinationPath != nil {\n\t\tv := *s.DestinationPath\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"DestinationPath\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\tif s.GroupOwnerSetting != nil {\n\t\tv := s.GroupOwnerSetting\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetFields(protocol.BodyTarget, \"GroupOwnerSetting\", v, metadata)\n\t}\n\tif s.SourcePath != nil {\n\t\tv := *s.SourcePath\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"SourcePath\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "6217dd17b2e99c47f8f961c159b15ea0", "score": "0.4349574", "text": "func (h *StorageHost) syncConfig() error {\n\t// extract the persistence from host\n\tpersist := h.extractPersistence()\n\n\t// use the json package save the extracted persistence data\n\treturn common.SaveDxJSON(storageHostMeta,\n\t\tfilepath.Join(h.persistDir, HostSettingFile), persist)\n}", "title": "" }, { "docid": "e64e905ba6b1bb43304e6aec0bf7b98b", "score": "0.43474543", "text": "func makeTemplate(data templateData, tmpl string) ([]byte, error) {\n\tbuf := new(bytes.Buffer)\n\tif err := tmpls.Lookup(tmpl).Execute(buf, data); err != nil {\n\t\treturn []byte{}, fmt.Errorf(\"failed to populate docs template with the kind metadata\")\n\t}\n\treturn buf.Bytes(), nil\n}", "title": "" }, { "docid": "cf1c7bec1323a31607836919138a12ec", "score": "0.4345161", "text": "func (s *AndSelector) DefaultTemplateData(data interface{}) {\n\tif s.TemplateData == nil {\n\t\ts.TemplateData = data\n\t}\n}", "title": "" }, { "docid": "ea640a5d6f05312d69fab08ba72afe5f", "score": "0.4337489", "text": "func UpdateData(ctx *gin.Context) {\n\tif reqBody, err := ctx.GetRawData(); err == nil {\n\t\tpostStructure := AutoGenerated{}\n\t\tjson.Unmarshal(reqBody, &postStructure)\n\n\t\tfor _, j := range postStructure.Data {\n\t\t\tif err = model.UpdateData(j.ID, j.Title, j.Description, j.Category); err != nil {\n\t\t\t\tbreak\n\t\t\t}\n\t\t}\n\t\tstatusCode, msg := returnMsg(err)\n\t\tctx.JSON(statusCode, gin.H{\n\t\t\t\"status\": msg,\n\t\t})\n\t}\n\n\treturn\n}", "title": "" }, { "docid": "dcefa4893285141ceb39ea2a61d7d816", "score": "0.43331", "text": "func (s *LoadBalancerStrategy) Sync() error {\n\ts.todo = map[string]bool{}\n\treturn nil\n}", "title": "" }, { "docid": "1905c30db728970e19b8227a243e9e52", "score": "0.4332193", "text": "func newData(services *[]Service, files *[]FileInfo) (*data, error) {\n\tcmData := &data{*services, *files}\n\tif err := cmData.validate(); err != nil {\n\t\treturn nil, errors.Wrap(err, \"unable to create services ConfigMap data object\")\n\t}\n\treturn cmData, nil\n}", "title": "" }, { "docid": "eb7da3f05502421497822e3505e61512", "score": "0.43320215", "text": "func (api *moduleAPI) SyncCreate(obj *diagnostics.Module) error {\n\tnewObj := obj\n\tevtType := kvstore.Created\n\tvar writeErr 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\tnewObj, writeErr = apicl.DiagnosticsV1().Module().Create(context.Background(), obj)\n\t\tif writeErr != nil && strings.Contains(writeErr.Error(), \"AlreadyExists\") {\n\t\t\tnewObj, writeErr = apicl.DiagnosticsV1().Module().Update(context.Background(), obj)\n\t\t\tevtType = kvstore.Updated\n\t\t}\n\t}\n\n\tif writeErr == nil {\n\t\tapi.ct.handleModuleEvent(&kvstore.WatchEvent{Object: newObj, Type: evtType})\n\t}\n\treturn writeErr\n}", "title": "" }, { "docid": "808da9c9121060b8382a215e4a68efd8", "score": "0.43319097", "text": "func (r *Repo) Sync(ctx context.Context) error {\n\tu, err := r.CurrentUser()\n\tif err != nil {\n\t\treturn err\n\t}\n\tudbName := \"user-\" + u\n\trdb := r.remoteDSN(udbName)\n\n\tvar docsWritten, docsRead int32\n\n\t// local to remote\n\tif err := replicate(ctx, r.local, rdb, udbName, &docsWritten); err != nil {\n\t\treturn errors.Wrap(err, \"sync local to remote\")\n\t}\n\n\t// remote to local\n\tif err := replicate(ctx, r.local, udbName, rdb, &docsRead); err != nil {\n\t\treturn errors.Wrap(err, \"sync remote to local\")\n\t}\n\n\tif err := r.syncBundles(ctx, &docsRead, &docsWritten); err != nil {\n\t\treturn errors.Wrap(err, \"bundle sync\")\n\t}\n\n\tlog.Debugf(\"Synced %d docs from server, %d to server\\n\", docsRead, docsWritten)\n\treturn nil\n}", "title": "" }, { "docid": "2bbe81311c252c2bcd3f9dda688a6407", "score": "0.43283603", "text": "func (f *fs) Sync() error { return nil }", "title": "" }, { "docid": "ffaffcf7170c143d88c0661afc6c0768", "score": "0.43281212", "text": "func (s *Syncer) Sync() error {\n\terr = s.validate()\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tsess, err := session.NewSession(&aws.Config{\n\t\tRegion: aws.String(s.Region),\n\t\t// Credentials: credentials.NewSharedCredentials(\"\", s.Profile),\n\t})\n\n\tif err != nil {\n\t\treturn err\n\t}\n\n\ts.S3 = s3.New(sess)\n\ts.Uploader = s3manager.NewUploaderWithClient(s.S3)\n\ts.Downloader = s3manager.NewDownloaderWithClient(s.S3)\n\n\tinput = &s3.ListBucketsInput{}\n\n\t// Make sure we can connect with the provided credentials\n\t_, err = s.S3.ListBuckets(input)\n\tif err != nil {\n\t\t// https://docs.aws.amazon.com/sdk-for-go/api/service/s3/#S3.ListBuckets\n\t\treturn fmt.Errorf(\"aws was not able to validate the provided access credentials\")\n\t}\n\n\ts.init()\n\t// prettyPrint(s.Differ.SyncList, true)\n\ts.syncFiles()\n\n\treturn nil\n}", "title": "" }, { "docid": "a9b44377479b16d43bf4fad46d08b38c", "score": "0.43274269", "text": "func (i *appRegistrationInfo) RegistrationData() []provider.KV {\n\treturn []provider.KV{\n\t\tprovider.KV{\n\t\t\tNamespace: provider.NamespaceAdmin,\n\t\t\tService: i.service,\n\t\t\tValue: i.admin.value(),\n\t\t},\n\t\tprovider.KV{\n\t\t\tNamespace: provider.NamespaceMetrics,\n\t\t\tService: i.service,\n\t\t\tValue: i.monitoring.value(),\n\t\t},\n\t}\n}", "title": "" }, { "docid": "c4a5c4c4fb4653e6f625c7dae237c26d", "score": "0.4324386", "text": "func (s *Subscription) populateResourcesLegacy(r *rpc.Resources) {\n\t// Quick exit if resource is already sent\n\tif s.state == stateSent || s.state == stateToSend {\n\t\treturn\n\t}\n\n\t// Check for errors\n\terr := s.Error()\n\tif err != nil {\n\t\t// Create Errors map if needed\n\t\tif r.Errors == nil {\n\t\t\tr.Errors = make(map[string]*reserr.Error)\n\t\t}\n\t\tr.Errors[s.rid] = reserr.RESError(err)\n\t\treturn\n\t}\n\n\tswitch s.typ {\n\tcase rescache.TypeCollection:\n\t\t// Create Collections map if needed\n\t\tif r.Collections == nil {\n\t\t\tr.Collections = make(map[string]interface{})\n\t\t}\n\t\tr.Collections[s.rid] = (*rescache.Legacy120Collection)(s.collection)\n\n\tcase rescache.TypeModel:\n\t\t// Create Models map if needed\n\t\tif r.Models == nil {\n\t\t\tr.Models = make(map[string]interface{})\n\t\t}\n\t\tr.Models[s.rid] = (*rescache.Legacy120Model)(s.model)\n\t}\n\n\ts.state = stateToSend\n\n\tfor _, sc := range s.refs {\n\t\tsc.sub.populateResourcesLegacy(r)\n\t}\n}", "title": "" }, { "docid": "39c22e4f04ef0ec035b91909cb12b9e0", "score": "0.43234834", "text": "func NewDataTracker(backend store.SimpleStore,\n\tfileRoot, addr string,\n\tstaticPort, apiPort int,\n\tlogger *log.Logger,\n\tdefaultPrefs map[string]string) *DataTracker {\n\tres := &DataTracker{\n\t\tFileRoot: fileRoot,\n\t\tStaticPort: staticPort,\n\t\tApiPort: apiPort,\n\t\tOurAddress: addr,\n\t\tLogger: logger,\n\t\tbackends: map[string]store.SimpleStore{},\n\t\tdefaultPrefs: defaultPrefs,\n\t\tFS: NewFS(fileRoot, logger),\n\t\ttokenManager: NewJwtManager([]byte(randString(32)), JwtConfig{Method: jwt.SigningMethodHS256}),\n\t\ttmplMux: &sync.Mutex{},\n\t\tglobalProfileName: \"global\",\n\t\tthunks: make([]func(), 0),\n\t\tthunkMux: &sync.Mutex{},\n\t}\n\tobjs := []store.KeySaver{\n\t\t&Machine{p: res},\n\t\t&Profile{p: res},\n\t\t&User{p: res},\n\t\t&Template{p: res},\n\t\t&BootEnv{p: res},\n\t\t&Subnet{p: res},\n\t\t&Reservation{p: res},\n\t\t&Lease{p: res},\n\t\t&Pref{p: res},\n\t}\n\tres.makeBackends(backend, objs)\n\tres.objs = map[string]*dtobjs{}\n\tfor _, obj := range objs {\n\t\tres.loadData(obj)\n\t\tif obj.Prefix() == \"templates\" {\n\t\t\tbuf := &bytes.Buffer{}\n\t\t\tfor _, thing := range res.objs[\"templates\"].d {\n\t\t\t\ttmpl := AsTemplate(thing)\n\t\t\t\tfmt.Fprintf(buf, `{{define \"%s\"}}%s{{end}}`, tmpl.ID, tmpl.Contents)\n\t\t\t}\n\t\t\troot, err := template.New(\"\").Parse(buf.String())\n\t\t\tif err != nil {\n\t\t\t\tlogger.Fatalf(\"Unable to load root templates: %v\", err)\n\t\t\t}\n\t\t\tres.rootTemplate = root\n\t\t\tres.rootTemplate.Option(\"missingkey=error\")\n\t\t}\n\t}\n\tif _, ok := res.fetchOne(ignoreBoot, ignoreBoot.Name); !ok {\n\t\tres.Save(ignoreBoot)\n\t}\n\tif _, ok := res.fetchOne(res.NewProfile(), res.globalProfileName); !ok {\n\t\tgp := AsProfile(res.NewProfile())\n\t\tgp.Name = \"global\"\n\t\tres.Save(gp)\n\t}\n\tusers := res.objs[\"users\"]\n\tif len(users.d) == 0 {\n\t\tres.Infof(\"debugBootEnv\", \"Creating rocketskates user\")\n\t\tuser := &User{p: res, Name: \"rocketskates\"}\n\t\tif err := user.ChangePassword(\"r0cketsk8ts\"); err != nil {\n\t\t\tlogger.Fatalf(\"Failed to create rocketskates user: %v\", err)\n\t\t}\n\t\tusers.add(user)\n\t}\n\tres.defaultBootEnv = defaultPrefs[\"defaultBootEnv\"]\n\tmachines := res.lockFor(\"machines\")\n\tfor i := range machines.d {\n\t\tmachine := AsMachine(machines.d[i])\n\t\tbe, found := res.fetchOne(res.NewBootEnv(), machine.BootEnv)\n\t\tif !found {\n\t\t\tcontinue\n\t\t}\n\t\terr := &Error{o: machine}\n\t\tAsBootEnv(be).Render(machine, err).register(res.FS)\n\t\tif err.containsError {\n\t\t\tlogger.Printf(\"Error rendering machine %s at startup:\", machine.UUID())\n\t\t\tlogger.Println(err.Error())\n\t\t}\n\t}\n\tmachines.Unlock()\n\treturn res\n}", "title": "" }, { "docid": "803f0c4108ccd41845b701e8d9f8f093", "score": "0.43113986", "text": "func (c *Context) Data() map[string]any { return c.data }", "title": "" }, { "docid": "0a3ecde9778fef026420c7943f3acb9c", "score": "0.43021536", "text": "func UpdateSharedGroupData(settings *playfab.Settings, postData *UpdateSharedGroupDataRequestModel, clientSessionTicket string) (*UpdateSharedGroupDataResultModel, error) {\r\n if clientSessionTicket == \"\" {\n return nil, playfab.NewCustomError(\"clientSessionTicket should not be an empty string\", playfab.ErrorGeneric)\n }\r\n b, errMarshal := json.Marshal(postData)\r\n if errMarshal != nil {\r\n return nil, playfab.NewCustomError(errMarshal.Error(), playfab.ErrorMarshal)\r\n }\r\n\r\n sourceMap, err := playfab.Request(settings, b, \"/Client/UpdateSharedGroupData\", \"X-Authentication\", clientSessionTicket)\r\n if err != nil {\r\n return nil, err\r\n }\r\n \r\n result := &UpdateSharedGroupDataResultModel{}\r\n\r\n config := mapstructure.DecoderConfig{\r\n DecodeHook: playfab.StringToDateTimeHook,\r\n Result: result,\r\n }\r\n \r\n decoder, errDecoding := mapstructure.NewDecoder(&config)\r\n if errDecoding != nil {\r\n return nil, playfab.NewCustomError(errDecoding.Error(), playfab.ErrorDecoding)\r\n }\r\n \r\n errDecoding = decoder.Decode(sourceMap)\r\n if errDecoding != nil {\r\n return nil, playfab.NewCustomError(errDecoding.Error(), playfab.ErrorDecoding)\r\n }\r\n\r\n return result, nil\r\n}", "title": "" }, { "docid": "f372e2a3aa7a669535fc014aaf8fcfb7", "score": "0.42840806", "text": "func (c *Cors) FillResourceData(d *schema.ResourceData) error {\n\tmethod := []interface{}{}\n\tfor _, m := range c.Method {\n\t\tmethod = append(method, m)\n\t}\n\treturn firstError([]func() error{\n\t\tsetOrError(d, \"path\", c.Path),\n\t\tsetOrError(d, \"origin\", c.Origin),\n\t\tsetOrError(d, \"header\", c.Header),\n\t\tsetOrError(d, \"method\", method),\n\t\tsetOrError(d, \"max_age\", c.MaxAge),\n\t\tsetOrError(d, \"enabled\", c.Enabled),\n\t})\n}", "title": "" }, { "docid": "4c7fe829e300df1638bbdcb13cacf148", "score": "0.42800805", "text": "func collectData(ctx context.Context, wg *sync.WaitGroup) {\n\tticker := time.NewTicker(time.Second * 1)\n\tfor {\n\t\tselect {\n\t\tcase <-ctx.Done():\n\t\t\tticker.Stop()\n\t\t\twg.Done()\n\t\t\treturn\n\t\tcase <-ticker.C:\n\t\t\tm, _ := mem.VirtualMemory()\n\t\t\tdb.Create(&SystemData{CPULoad: 10000, MEMFree: m.Free})\n\t\t}\n\t}\n}", "title": "" }, { "docid": "25af6af8e1bd0cc292190de44448a56a", "score": "0.42725295", "text": "func (c *OpenShiftAPIServerWorkload) Sync(ctx context.Context, syncContext factory.SyncContext) (*appsv1.Deployment, bool, []error) {\n\terrors := []error{}\n\n\toriginalOperatorConfig, err := c.operatorConfigClient.OpenShiftAPIServers().Get(ctx, \"cluster\", metav1.GetOptions{})\n\tif err != nil {\n\t\terrors = append(errors, err)\n\t\treturn nil, false, errors\n\t}\n\toperatorConfig := originalOperatorConfig.DeepCopy()\n\n\t_, _, err = manageOpenShiftAPIServerConfigMap_v311_00_to_latest(ctx, c.kubeClient.CoreV1(), c.clusterVersionLister, syncContext.Recorder(), operatorConfig)\n\tif err != nil {\n\t\terrors = append(errors, fmt.Errorf(\"%q: %v\", \"configmap\", err))\n\t}\n\n\t_, _, err = manageOpenShiftAPIServerImageImportCA_v311_00_to_latest(ctx, c.openshiftConfigClient, c.kubeClient.CoreV1(), syncContext.Recorder())\n\tif err != nil {\n\t\terrors = append(errors, fmt.Errorf(\"%q: %v\", \"image-import-ca\", err))\n\t}\n\n\t// our configmaps and secrets are in order, now it is time to create the deployment\n\t// TODO check basic preconditions here\n\tactualDeployment, _, err := manageOpenShiftAPIServerDeployment_v311_00_to_latest(\n\t\tctx,\n\t\tc.kubeClient,\n\t\tc.kubeClient.AppsV1(),\n\t\tc.countNodes,\n\t\tsyncContext.Recorder(),\n\t\tc.targetImagePullSpec,\n\t\tc.operatorImagePullSpec,\n\t\toperatorConfig,\n\t\toperatorConfig.Status.Generations,\n\t\tc.ensureAtMostOnePodPerNode)\n\tif err != nil {\n\t\terrors = append(errors, fmt.Errorf(\"%q: %v\", \"deployments\", err))\n\t}\n\n\tif operatorConfig.ObjectMeta.Generation != operatorConfig.Status.ObservedGeneration {\n\t\thandleErrorForOperatorStatus(v1helpers.UpdateStatus(ctx, c.operatorClient, v1helpers.UpdateConditionFn(operatorv1.OperatorCondition{\n\t\t\tType: \"OperatorConfigProgressing\",\n\t\t\tStatus: operatorv1.ConditionTrue,\n\t\t\tReason: \"NewGeneration\",\n\t\t\tMessage: fmt.Sprintf(\"openshiftapiserveroperatorconfigs/instance: observed generation is %d, desired generation is %d.\", operatorConfig.Status.ObservedGeneration, operatorConfig.ObjectMeta.Generation),\n\t\t})),\n\t\t)\n\t} else {\n\t\thandleErrorForOperatorStatus(v1helpers.UpdateStatus(ctx, c.operatorClient, v1helpers.UpdateConditionFn(operatorv1.OperatorCondition{\n\t\t\tType: \"OperatorConfigProgressing\",\n\t\t\tStatus: operatorv1.ConditionFalse,\n\t\t\tReason: \"AsExpected\",\n\t\t})),\n\t\t)\n\t}\n\n\t// TODO this is changing too early and it was before too.\n\thandleErrorForOperatorStatus(v1helpers.UpdateStatus(ctx, c.operatorClient, func(status *operatorv1.OperatorStatus) error {\n\t\tstatus.ObservedGeneration = operatorConfig.ObjectMeta.Generation\n\t\treturn nil\n\t}),\n\t)\n\thandleErrorForOperatorStatus(v1helpers.UpdateStatus(ctx, c.operatorClient, func(status *operatorv1.OperatorStatus) error {\n\t\tresourcemerge.SetDeploymentGeneration(&status.Generations, actualDeployment)\n\t\treturn nil\n\t}),\n\t)\n\n\treturn actualDeployment, operatorConfig.Status.ObservedGeneration == operatorConfig.ObjectMeta.Generation, errors\n}", "title": "" }, { "docid": "2077996584bfe3c9d0e40218e72469c9", "score": "0.42723438", "text": "func (r *RecentList) Sync() {\n\tr.mutex.Lock()\n\tfor _, recs := range r.infos {\n\t\tfor i, rec := range recs {\n\t\t\tif defaultUpdateRange > 0 && rec.Stamp+int64(defaultUpdateRange) < time.Now().Unix() {\n\t\t\t\trecs, recs[len(recs)-1] = append(recs[:i], recs[i+1:]...), nil\n\t\t\t}\n\t\t}\n\t}\n\tr.mutex.Unlock()\n\trecstrSlice := r.getRecstrSlice()\n\tr.Fmutex.Lock()\n\terr := util.WriteSlice(r.Recent, recstrSlice)\n\tr.Fmutex.Unlock()\n\tif err != nil {\n\t\tlog.Println(err)\n\t}\n}", "title": "" }, { "docid": "f85a2d8ccbace552e5dba6e374826195", "score": "0.4271769", "text": "func (imglt *WkImageLayout) setMainData(buff map[string]interface{}) {\n\twzdBin, ex := buff[\"wzd-bin\"]\n\tif !ex || wzdBin.(string) == \"\" {\n\t\twzdBin = \"/usr/bin/wzd\"\n\t}\n\timglt.conf.WzdBinPath = wzdBin.(string)\n\n\tansibleVersion, ex := buff[\"ansible-version\"]\n\tif !ex || wzdBin.(string) == \"\" {\n\t\tansibleVersion = \"2.9\" // Max supported\n\t}\n\timglt.conf.AnsibleVersion = ansibleVersion.(string)\n\n\tname, ex := buff[\"name\"]\n\tif !ex || name.(string) == \"\" {\n\t\tname = \"untitled\"\n\t}\n\timglt.conf.Name = name.(string)\n\n\tversion, ex := buff[\"version\"]\n\tif !ex {\n\t\tfmt.Fprintln(os.Stderr, \"Error: Version is not specified.\")\n\t\tos.Exit(wzlib_utils.EX_GENERIC)\n\t}\n\timglt.conf.Version = version.(string)\n\n\tosdata, ex := buff[\"os\"]\n\tif !ex {\n\t\tfmt.Fprintln(os.Stderr, \"Error: OS is not defined in the configuration\")\n\t\tos.Exit(wzlib_utils.EX_GENERIC)\n\t}\n\timglt.conf.Os = strings.ToLower(osdata.(string))\n\n\timgSize, ex := buff[\"size\"]\n\tif !ex {\n\t\tfmt.Fprintln(os.Stderr, \"Error: Image size is not defined\")\n\t\tos.Exit(wzlib_utils.EX_GENERIC)\n\t}\n\timglt.conf.Size = int64(imgSize.(int))\n}", "title": "" }, { "docid": "9b4304aee78c33ee7d6c73236f9f4c66", "score": "0.42714545", "text": "func InitData(k string, s string) {\n\tkey = k\n\tsecret = s\n}", "title": "" }, { "docid": "eeda262fc32e5e3e6bb1e85508df1a65", "score": "0.42696056", "text": "func (s *OrSelector) DefaultTemplateData(data interface{}) {\n\tif s.TemplateData == nil {\n\t\ts.TemplateData = data\n\t}\n}", "title": "" }, { "docid": "b637b4ab9ad6cb5afd7496ed83b550a7", "score": "0.42686376", "text": "func (*DataResyncReplies) Descriptor() ([]byte, []int) {\n\treturn file_datamsg_proto_rawDescGZIP(), []int{2}\n}", "title": "" }, { "docid": "57aabec3606420147faf40bceafb91be", "score": "0.42679104", "text": "func (c *CaptionsInsertCall) Sync(sync bool) *CaptionsInsertCall {\n\tc.urlParams_.Set(\"sync\", fmt.Sprint(sync))\n\treturn c\n}", "title": "" }, { "docid": "9a5274ff9fbdfc5f7db67a16e1f52863", "score": "0.42657146", "text": "func (r *rssController) syncObjects(rss *unifflev1alpha1.RemoteShuffleService) error {\n\tif err := r.syncConfigMap(rss); err != nil {\n\t\tklog.Errorf(\"sync configMap for rss (%v) failed: %v\", utils.UniqueName(rss), err)\n\t\treturn err\n\t}\n\tif err := r.syncCoordinator(rss); err != nil {\n\t\tklog.Errorf(\"sync coordinators for rss (%v) failed: %v\", utils.UniqueName(rss), err)\n\t\treturn err\n\t}\n\tif err := r.syncShuffleServer(rss); err != nil {\n\t\tklog.Errorf(\"sync shuffle servers for rss (%v) failed: %v\", utils.UniqueName(rss), err)\n\t\treturn err\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "f2a41abf34674ef7c21e2e2ee149d5fe", "score": "0.42650455", "text": "func (s SystemData) MarshalJSON() ([]byte, error) {\n\tobjectMap := make(map[string]interface{})\n\tpopulateTimeRFC3339(objectMap, \"createdAt\", s.CreatedAt)\n\tpopulate(objectMap, \"createdBy\", s.CreatedBy)\n\tpopulate(objectMap, \"createdByType\", s.CreatedByType)\n\tpopulateTimeRFC3339(objectMap, \"lastModifiedAt\", s.LastModifiedAt)\n\tpopulate(objectMap, \"lastModifiedBy\", s.LastModifiedBy)\n\tpopulate(objectMap, \"lastModifiedByType\", s.LastModifiedByType)\n\treturn json.Marshal(objectMap)\n}", "title": "" }, { "docid": "f2a41abf34674ef7c21e2e2ee149d5fe", "score": "0.42650455", "text": "func (s SystemData) MarshalJSON() ([]byte, error) {\n\tobjectMap := make(map[string]interface{})\n\tpopulateTimeRFC3339(objectMap, \"createdAt\", s.CreatedAt)\n\tpopulate(objectMap, \"createdBy\", s.CreatedBy)\n\tpopulate(objectMap, \"createdByType\", s.CreatedByType)\n\tpopulateTimeRFC3339(objectMap, \"lastModifiedAt\", s.LastModifiedAt)\n\tpopulate(objectMap, \"lastModifiedBy\", s.LastModifiedBy)\n\tpopulate(objectMap, \"lastModifiedByType\", s.LastModifiedByType)\n\treturn json.Marshal(objectMap)\n}", "title": "" }, { "docid": "f2a41abf34674ef7c21e2e2ee149d5fe", "score": "0.42650455", "text": "func (s SystemData) MarshalJSON() ([]byte, error) {\n\tobjectMap := make(map[string]interface{})\n\tpopulateTimeRFC3339(objectMap, \"createdAt\", s.CreatedAt)\n\tpopulate(objectMap, \"createdBy\", s.CreatedBy)\n\tpopulate(objectMap, \"createdByType\", s.CreatedByType)\n\tpopulateTimeRFC3339(objectMap, \"lastModifiedAt\", s.LastModifiedAt)\n\tpopulate(objectMap, \"lastModifiedBy\", s.LastModifiedBy)\n\tpopulate(objectMap, \"lastModifiedByType\", s.LastModifiedByType)\n\treturn json.Marshal(objectMap)\n}", "title": "" }, { "docid": "f2a41abf34674ef7c21e2e2ee149d5fe", "score": "0.42650455", "text": "func (s SystemData) MarshalJSON() ([]byte, error) {\n\tobjectMap := make(map[string]interface{})\n\tpopulateTimeRFC3339(objectMap, \"createdAt\", s.CreatedAt)\n\tpopulate(objectMap, \"createdBy\", s.CreatedBy)\n\tpopulate(objectMap, \"createdByType\", s.CreatedByType)\n\tpopulateTimeRFC3339(objectMap, \"lastModifiedAt\", s.LastModifiedAt)\n\tpopulate(objectMap, \"lastModifiedBy\", s.LastModifiedBy)\n\tpopulate(objectMap, \"lastModifiedByType\", s.LastModifiedByType)\n\treturn json.Marshal(objectMap)\n}", "title": "" }, { "docid": "f2a41abf34674ef7c21e2e2ee149d5fe", "score": "0.42650455", "text": "func (s SystemData) MarshalJSON() ([]byte, error) {\n\tobjectMap := make(map[string]interface{})\n\tpopulateTimeRFC3339(objectMap, \"createdAt\", s.CreatedAt)\n\tpopulate(objectMap, \"createdBy\", s.CreatedBy)\n\tpopulate(objectMap, \"createdByType\", s.CreatedByType)\n\tpopulateTimeRFC3339(objectMap, \"lastModifiedAt\", s.LastModifiedAt)\n\tpopulate(objectMap, \"lastModifiedBy\", s.LastModifiedBy)\n\tpopulate(objectMap, \"lastModifiedByType\", s.LastModifiedByType)\n\treturn json.Marshal(objectMap)\n}", "title": "" } ]
9e794e7c17637218aac75803e56c9bc3
ConsumeAttributeValue expects a quoted string and returns it
[ { "docid": "a0745e770832aba40e3366e553d5338c", "score": "0.7437829", "text": "func (p *HTMLParser) ConsumeAttributeValue() string {\n\topenQuote := p.Parser.ConsumeChar()\n\tp.assertStringParsed(openQuote, \"'\", `\"`)\n\tvalue := p.Parser.ConsumeWhile(func(s string) bool {\n\t\treturn s != openQuote\n\t})\n\tp.assertStringParsed(p.Parser.ConsumeChar(), openQuote)\n\treturn value\n}", "title": "" } ]
[ { "docid": "b3a7cc8266734aa388450f8b85aa6fcb", "score": "0.656587", "text": "func readEsiAttributeValue(tokens []TokenData, index *int, runes *[]rune) []TokenData {\r\n\tvar buffer string\r\n\t*index++\r\n\t*index++\r\n\tfor ; *index < len(*runes); *index++ {\r\n\t\truneString := string((*runes)[*index])\r\n\t\tif runeString == \"\\\"\" {\r\n\t\t\ttokens = append(tokens, TokenData{TokenType: EsiAttrVal, Data: buffer})\r\n\t\t\t*index++\r\n\t\t\ttokens = readEsiAttributeName(tokens, index, runes)\r\n\t\t\tbreak\r\n\t\t} else {\r\n\t\t\tbuffer += string((*runes)[*index])\r\n\t\t}\r\n\t}\r\n\treturn tokens\r\n}", "title": "" }, { "docid": "91ff7ec7fc996ed8fe737e54a91462b0", "score": "0.5943936", "text": "func unquoteAttribute(s string) (string, error) {\n\tif !strings.Contains(s, \"'\") {\n\t\treturn s, nil\n\t}\n\tif len(s) < 2 || s[0] != quote || s[len(s)-1] != quote {\n\t\treturn s, ErrQuote\n\t}\n\ts = s[1 : len(s)-1]\n\tb := make([]byte, 0, len(s))\n\tfor i := 0; i < len(s); i++ {\n\t\tc := s[i]\n\t\tif c == quote { // Must be doubled.\n\t\t\tif i == len(s)-1 || s[i+1] != quote {\n\t\t\t\treturn s, ErrQuote\n\t\t\t}\n\t\t\ti++\n\t\t}\n\t\tb = append(b, c)\n\t}\n\treturn string(b), nil\n}", "title": "" }, { "docid": "f10ad54d99b509000e1155db3e01ec16", "score": "0.5811367", "text": "func getAttributeValue(attr *hclwrite.Attribute) (cty.Value, error) {\n\t// build low-level byte sequences\n\tsrc := attr.Expr().BuildTokens(nil).Bytes()\n\n\t// parse an expression as a hclsyntax.Expression\n\texpr, diags := hclsyntax.ParseExpression(src, \"generated_by_attributeToValue\", hcl.Pos{Line: 1, Column: 1})\n\tif diags.HasErrors() {\n\t\treturn cty.NilVal, fmt.Errorf(\"failed to parse expression: %s\", diags)\n\t}\n\n\t// Get value from expression.\n\t// We don't need interpolation for any variables and functions here,\n\t// so we just pass an empty context.\n\tv, diags := expr.Value(&hcl.EvalContext{})\n\tif diags.HasErrors() {\n\t\treturn cty.NilVal, fmt.Errorf(\"failed to get cty.Value: %s\", diags)\n\t}\n\n\treturn v, nil\n}", "title": "" }, { "docid": "9bb92ce2855a8a50415634c1f1a7ede0", "score": "0.5698674", "text": "func tagAttribute(data []byte, offset int) (string, string, int) {\n\ti := offset\n\tvar key string\n\tif data[i] == '\"' {\n\t\ti++\n\t\tfor i < len(data) && data[i] != '\"' {\n\t\t\ti++\n\t\t}\n\t\tkey = string(data[offset+1 : i])\n\t\ti++\n\t} else if !isalnum(data[i]) {\n\t\treturn \"\", \"\", i + 1\n\t} else {\n\t\tfor i < len(data) && isalnum(data[i]) {\n\t\t\ti++\n\t\t}\n\t\tkey = string(data[offset:i])\n\t}\n\n\tbgn := i\n\tif bgn+1 >= len(data) {\n\t\treturn key, \"\", i\n\t}\n\tif data[bgn] == '=' && data[bgn+1] == '\"' {\n\t\ti += 2\n\t\tfor i < len(data) && data[i] != '\"' {\n\t\t\ti++\n\t\t}\n\t\treturn key, string(data[bgn+2 : i]), i + 1\n\t} else if data[bgn] == '=' {\n\t\ti += 1\n\t\tfor i < len(data) && isalnum(data[i]) {\n\t\t\ti++\n\t\t}\n\t\treturn key, string(data[bgn+1 : i]), i\n\t}\n\n\treturn key, \"\", i\n}", "title": "" }, { "docid": "77fbc24a32130465e24020dcb62e1819", "score": "0.5686711", "text": "func (o *Sandbox) ValueForAttribute(name string) interface{} {\n\n\tswitch name {\n\tcase \"URL\":\n\t\treturn o.URL\n\tcase \"credentials\":\n\t\treturn o.Credentials\n\tcase \"lifetime\":\n\t\treturn o.Lifetime\n\tcase \"namespace\":\n\t\treturn o.Namespace\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "4742fd03fe3893bf1a6a12689ef639e1", "score": "0.565182", "text": "func (m *UserAttributeValuesItem) GetValue()(*string) {\n return m.value\n}", "title": "" }, { "docid": "5d55ffaec5d430d7aa21e040357408d3", "score": "0.5509924", "text": "func fetchValueForAttribute(attr string, db *dynamodb.DynamoDB) (string, error) {\n\tinput := &dynamodb.GetItemInput{\n\t\tTableName: aws.String(\"DaltonSite\"),\n\t\tKey: map[string]*dynamodb.AttributeValue{\n\t\t\t\"Attribute\": {S: aws.String(attr)},\n\t\t},\n\t}\n\tres, err := db.GetItem(input)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\n\tvalue := res.Item[\"Value\"]\n\tif value == nil {\n\t\treturn \"\", notFound\n\t}\n\n\treturn *value.S, nil\n}", "title": "" }, { "docid": "d68b170229eb39ff61b773370c40bbba", "score": "0.5506571", "text": "func quoteAttribute(s string) string {\n\tif !strings.ContainsAny(s, \" '=\\t\") {\n\t\treturn s\n\t}\n\tb := make([]byte, 0, 10+len(s)) // Room for a couple of quotes and a few backslashes.\n\tb = append(b, quote)\n\tfor i := 0; i < len(s); i++ {\n\t\tc := s[i]\n\t\tif c == quote {\n\t\t\tb = append(b, quote)\n\t\t}\n\t\tb = append(b, c)\n\t}\n\tb = append(b, quote)\n\treturn string(b)\n}", "title": "" }, { "docid": "935c698c6519dd00167f2755e6eec775", "score": "0.54815215", "text": "func (o *TagInject) ValueForAttribute(name string) interface{} {\n\n\tswitch name {\n\tcase \"addedTags\":\n\t\treturn o.AddedTags\n\tcase \"removedTags\":\n\t\treturn o.RemovedTags\n\tcase \"targetNamespace\":\n\t\treturn o.TargetNamespace\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "6f8b7657c6559792656fbac16fc2f4da", "score": "0.5468356", "text": "func (o *AutomationTemplate) ValueForAttribute(name string) interface{} {\n\n\tswitch name {\n\tcase \"description\":\n\t\treturn o.Description\n\tcase \"entitlements\":\n\t\treturn o.Entitlements\n\tcase \"function\":\n\t\treturn o.Function\n\tcase \"key\":\n\t\treturn o.Key\n\tcase \"kind\":\n\t\treturn o.Kind\n\tcase \"name\":\n\t\treturn o.Name\n\tcase \"parameters\":\n\t\treturn o.Parameters\n\tcase \"steps\":\n\t\treturn o.Steps\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "ae7405b6d11a05db7b673a102d59bae7", "score": "0.54682195", "text": "func ReadQuoted(s1 string) (Value, string, error) {\n\t// skip over the \"'\"\n\ts2 := s1[1:]\n\tv, rem, err := Read(s2)\n\tif err != nil {\n\t\treturn nil, s1, err\n\t}\n\treturn EmptyList.Append(Symbol(\"quote\")).Append(v), rem, nil\n}", "title": "" }, { "docid": "8f95620640a37822416b7e9b5855a3c3", "score": "0.5415118", "text": "func (o *PolicyRule) ValueForAttribute(name string) interface{} {\n\n\tswitch name {\n\tcase \"ID\":\n\t\treturn o.ID\n\tcase \"action\":\n\t\treturn o.Action\n\tcase \"auditProfiles\":\n\t\treturn o.AuditProfiles\n\tcase \"enforcerProfiles\":\n\t\treturn o.EnforcerProfiles\n\tcase \"externalNetworks\":\n\t\treturn o.ExternalNetworks\n\tcase \"filePaths\":\n\t\treturn o.FilePaths\n\tcase \"hostServices\":\n\t\treturn o.HostServices\n\tcase \"isolationProfiles\":\n\t\treturn o.IsolationProfiles\n\tcase \"name\":\n\t\treturn o.Name\n\tcase \"namespaces\":\n\t\treturn o.Namespaces\n\tcase \"policyNamespace\":\n\t\treturn o.PolicyNamespace\n\tcase \"policyUpdateTime\":\n\t\treturn o.PolicyUpdateTime\n\tcase \"propagated\":\n\t\treturn o.Propagated\n\tcase \"relation\":\n\t\treturn o.Relation\n\tcase \"services\":\n\t\treturn o.Services\n\tcase \"tagClauses\":\n\t\treturn o.TagClauses\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "4cb6c37ab72506a1426967326b871e21", "score": "0.53935987", "text": "func (o *AppCredential) ValueForAttribute(name string) interface{} {\n\n\tswitch name {\n\tcase \"CSR\":\n\t\treturn o.CSR\n\tcase \"ID\":\n\t\treturn o.ID\n\tcase \"annotations\":\n\t\treturn o.Annotations\n\tcase \"associatedTags\":\n\t\treturn o.AssociatedTags\n\tcase \"authorizedSubnets\":\n\t\treturn o.AuthorizedSubnets\n\tcase \"certificate\":\n\t\treturn o.Certificate\n\tcase \"certificateSN\":\n\t\treturn o.CertificateSN\n\tcase \"createIdempotencyKey\":\n\t\treturn o.CreateIdempotencyKey\n\tcase \"createTime\":\n\t\treturn o.CreateTime\n\tcase \"credentials\":\n\t\treturn o.Credentials\n\tcase \"description\":\n\t\treturn o.Description\n\tcase \"disabled\":\n\t\treturn o.Disabled\n\tcase \"email\":\n\t\treturn o.Email\n\tcase \"maxIssuedTokenValidity\":\n\t\treturn o.MaxIssuedTokenValidity\n\tcase \"metadata\":\n\t\treturn o.Metadata\n\tcase \"migrationsLog\":\n\t\treturn o.MigrationsLog\n\tcase \"name\":\n\t\treturn o.Name\n\tcase \"namespace\":\n\t\treturn o.Namespace\n\tcase \"normalizedTags\":\n\t\treturn o.NormalizedTags\n\tcase \"parentIDs\":\n\t\treturn o.ParentIDs\n\tcase \"protected\":\n\t\treturn o.Protected\n\tcase \"roles\":\n\t\treturn o.Roles\n\tcase \"updateIdempotencyKey\":\n\t\treturn o.UpdateIdempotencyKey\n\tcase \"updateTime\":\n\t\treturn o.UpdateTime\n\tcase \"zHash\":\n\t\treturn o.ZHash\n\tcase \"zone\":\n\t\treturn o.Zone\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "9539f868818efb989d80999850528788", "score": "0.5393082", "text": "func (o *Authz) ValueForAttribute(name string) interface{} {\n\n\tswitch name {\n\tcase \"APIAuthorizationPolicies\":\n\t\treturn o.APIAuthorizationPolicies\n\tcase \"claims\":\n\t\treturn o.Claims\n\tcase \"clientIP\":\n\t\treturn o.ClientIP\n\tcase \"error\":\n\t\treturn o.Error\n\tcase \"permissions\":\n\t\treturn o.Permissions\n\tcase \"restrictedNamespace\":\n\t\treturn o.RestrictedNamespace\n\tcase \"restrictedNetworks\":\n\t\treturn o.RestrictedNetworks\n\tcase \"restrictedPermissions\":\n\t\treturn o.RestrictedPermissions\n\tcase \"targetID\":\n\t\treturn o.TargetID\n\tcase \"targetNamespace\":\n\t\treturn o.TargetNamespace\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "3cff1e22c9e47d9a7d1e528a0d5d5416", "score": "0.5378123", "text": "func (s *SensorState) GetValueAttr(name string, defaultvalue string) string {\r\n\tif s.StringAttrs != nil {\r\n\t\tfor _, fs := range s.StringAttrs {\r\n\t\t\tif fs.Name == name {\r\n\t\t\t\treturn fs.Value\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n\treturn defaultvalue\r\n}", "title": "" }, { "docid": "b69583df0b8562769dbf910e9ee1c99b", "score": "0.53672564", "text": "func (o *Role) ValueForAttribute(name string) interface{} {\n\n\tswitch name {\n\tcase \"authorizations\":\n\t\treturn o.Authorizations\n\tcase \"description\":\n\t\treturn o.Description\n\tcase \"key\":\n\t\treturn o.Key\n\tcase \"name\":\n\t\treturn o.Name\n\tcase \"private\":\n\t\treturn o.Private\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "e72cca4393b37822193501ce2d5cb310", "score": "0.5335872", "text": "func (o *PolicyRenderer) ValueForAttribute(name string) interface{} {\n\n\tswitch name {\n\tcase \"policies\":\n\t\treturn o.Policies\n\tcase \"processMode\":\n\t\treturn o.ProcessMode\n\tcase \"tags\":\n\t\treturn o.Tags\n\tcase \"type\":\n\t\treturn o.Type\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "4064b1bc5cc49bfc73d627fd2f66248f", "score": "0.53170025", "text": "func (o *OAUTHInfo) ValueForAttribute(name string) interface{} {\n\n\tswitch name {\n\tcase \"IDTokenSigningAlgValuesSupported\":\n\t\treturn o.IDTokenSigningAlgValuesSupported\n\tcase \"JWKSURI\":\n\t\treturn o.JWKSURI\n\tcase \"auhorizationEndpoint\":\n\t\treturn o.AuhorizationEndpoint\n\tcase \"claimsSupported\":\n\t\treturn o.ClaimsSupported\n\tcase \"issuer\":\n\t\treturn o.Issuer\n\tcase \"responseTypesSupported\":\n\t\treturn o.ResponseTypesSupported\n\tcase \"scopesSupported\":\n\t\treturn o.ScopesSupported\n\tcase \"subjectTypesSupported\":\n\t\treturn o.SubjectTypesSupported\n\tcase \"tokenEndpointAuthMethodsSupported\":\n\t\treturn o.TokenEndpointAuthMethodsSupported\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "eddb15303a4885948de5b414b5c6464b", "score": "0.52795285", "text": "func consumeParam(s string) (consumed, rest string) {\n\ti := strings.IndexByte(s, '=')\n\tif i < 0 {\n\t\treturn \"\", s\n\t}\n\n\tparam := strings.Builder{}\n\tparam.WriteString(s[:i+1])\n\n\tif strings.HasPrefix(strings.TrimLeftFunc(s, unicode.IsSpace), \"name=\") {\n\t\tname := strings.Split(s, \"=\")\n\t\tif len(name) > 1 {\n\t\t\tname := strings.Split(name[1], \";\")\n\t\t\tvar builder strings.Builder\n\t\t\tbuilder.WriteString(s[0 : i+1])\n\t\t\tif len(name[0]) > 0 && name[0][0] == '\"' {\n\t\t\t\tbuilder.WriteString(name[0])\n\t\t\t} else {\n\t\t\t\tbuilder.WriteString(strconv.Quote(name[0]))\n\t\t\t}\n\t\t\ts = builder.String()\n\t\t}\n\t}\n\n\ts = s[i+1:]\n\n\tvalue := strings.Builder{}\n\tvalueQuotedOriginally := false\n\tvalueQuoteAdded := false\n\tvalueQuoteNeeded := false\n\n\tvar r rune\nfindValueStart:\n\tfor i, r = range s {\n\t\tswitch r {\n\t\tcase ' ', '\\t':\n\t\t\tparam.WriteRune(r)\n\n\t\tcase '\"':\n\t\t\tvalueQuotedOriginally = true\n\t\t\tvalueQuoteAdded = true\n\t\t\tvalue.WriteRune(r)\n\n\t\t\tbreak findValueStart\n\n\t\tcase ';':\n\t\t\tif value.Len() == 0 {\n\t\t\t\tvalue.WriteString(`\"\";`)\n\t\t\t}\n\n\t\t\tbreak findValueStart\n\n\t\tdefault:\n\t\t\tvalueQuotedOriginally = false\n\t\t\tvalueQuoteAdded = false\n\t\t\tvalue.WriteRune(r)\n\n\t\t\tbreak findValueStart\n\t\t}\n\t}\n\n\tif len(s)-i < 1 {\n\t\t// parameter value starts at the end of the string, make empty\n\t\t// quoted string to play nice with mime.ParseMediaType\n\t\tparam.WriteString(`\"\"`)\n\n\t} else {\n\t\t// The beginning of the value is not at the end of the string\n\n\t\tquoteIfUnquoted := func() {\n\t\t\tif !valueQuoteNeeded {\n\t\t\t\tif !valueQuoteAdded {\n\t\t\t\t\tparam.WriteByte('\"')\n\n\t\t\t\t\tvalueQuoteAdded = true\n\t\t\t\t}\n\n\t\t\t\tvalueQuoteNeeded = true\n\t\t\t}\n\t\t}\n\n\t\tfor _, v := range []byte{'(', ')', '<', '>', '@', ',', ':', '/', '[', ']', '?', '='} {\n\t\t\tif s[0] == v {\n\t\t\t\tquoteIfUnquoted()\n\t\t\t}\n\t\t}\n\n\t\ts = s[i+1:]\n\n\tfindValueEnd:\n\t\tfor len(s) > 0 {\n\t\t\tswitch s[0] {\n\t\t\tcase ';', ' ', '\\t':\n\t\t\t\tif valueQuotedOriginally {\n\t\t\t\t\t// We're in a quoted string, so whitespace is allowed.\n\t\t\t\t\tvalue.WriteByte(s[0])\n\t\t\t\t\ts = s[1:]\n\t\t\t\t\tbreak\n\t\t\t\t}\n\n\t\t\t\t// Otherwise, we've reached the end of an unquoted value.\n\n\t\t\t\tparam.WriteString(value.String())\n\t\t\t\tvalue.Reset()\n\n\t\t\t\tif valueQuoteNeeded {\n\t\t\t\t\tparam.WriteByte('\"')\n\t\t\t\t}\n\n\t\t\t\tparam.WriteByte(s[0])\n\t\t\t\ts = s[1:]\n\n\t\t\t\tbreak findValueEnd\n\n\t\t\tcase '\"':\n\t\t\t\tif valueQuotedOriginally {\n\t\t\t\t\t// We're in a quoted value. This is the end of that value.\n\t\t\t\t\tparam.WriteString(value.String())\n\t\t\t\t\tvalue.Reset()\n\n\t\t\t\t\tparam.WriteByte(s[0])\n\t\t\t\t\ts = s[1:]\n\n\t\t\t\t\tbreak findValueEnd\n\t\t\t\t}\n\n\t\t\t\tquoteIfUnquoted()\n\n\t\t\t\tvalue.WriteByte('\\\\')\n\t\t\t\tvalue.WriteByte(s[0])\n\t\t\t\ts = s[1:]\n\n\t\t\tcase '\\\\':\n\t\t\t\tif len(s) > 1 {\n\t\t\t\t\tvalue.WriteByte(s[0])\n\t\t\t\t\ts = s[1:]\n\n\t\t\t\t\t// Backslash escapes the next char. Consume that next char.\n\t\t\t\t\tvalue.WriteByte(s[0])\n\n\t\t\t\t\tquoteIfUnquoted()\n\t\t\t\t}\n\t\t\t\t// Else there is no next char to consume.\n\t\t\t\ts = s[1:]\n\n\t\t\tcase '(', ')', '<', '>', '@', ',', ':', '/', '[', ']', '?', '=':\n\t\t\t\tquoteIfUnquoted()\n\n\t\t\t\tfallthrough\n\n\t\t\tdefault:\n\t\t\t\tvalue.WriteByte(s[0])\n\t\t\t\ts = s[1:]\n\t\t\t}\n\t\t}\n\t}\n\n\tif value.Len() > 0 {\n\t\t// There is a value that ends with the string. Capture it.\n\t\tparam.WriteString(value.String())\n\n\t\tif valueQuotedOriginally || valueQuoteNeeded {\n\t\t\t// If valueQuotedOriginally is true and we got here,\n\t\t\t// that means there was no closing quote. So we'll add one.\n\t\t\t// Otherwise, we're here because it was an unquoted value\n\t\t\t// with a special char in it, and we had to quote it.\n\t\t\tparam.WriteByte('\"')\n\t\t}\n\t}\n\n\treturn param.String(), s\n}", "title": "" }, { "docid": "404f8b9f358b8f133e552dcc4bb57d7c", "score": "0.5237286", "text": "func lexOneAttr(l *lexer.Lexer) stateFn {\n\tvar ch int\n\tdefer l.Begin()()\n\n\tl.Next() // skip whitespace\n\tl.Ignore()\n\tfor {\n\t\tch = l.Next()\n\t\tl.Printf(\"got %c\\n\", ch)\n\n\t\tif ch == '/' || ch == '>' || ch == eof {\n\t\t\t// Then we hit /> or a grammar error\n\t\t\tl.Backup()\n\t\t\tif len(l.Current()) > 0 {\n\t\t\t\tl.Emit(token.VALUE, l.Current())\n\t\t\t\tl.Emit(token.END, l.Pop())\n\t\t\t}\n\t\t\treturn nil\n\t\t}\n\n\t\tif unicode.IsSpace(rune(ch)) {\n\t\t\t// end of the attribute\n\t\t\tl.Backup()\n\t\t\tif len(l.Current()) > 0 {\n\t\t\t\tl.Emit(token.VALUE, l.Current())\n\t\t\t\tl.Emit(token.END, l.Pop())\n\t\t\t}\n\t\t\treturn lexOneAttr\n\t\t}\n\n\t\tif ch == '=' {\n\t\t\t// we have the name, save it and start the value\n\t\t\tl.Backup()\n\t\t\tl.Push(l.Current())\n\t\t\tl.Emit(token.BEGIN, l.Current())\n\t\t\tl.Next()\n\t\t\tl.Ignore()\n\t\t}\n\n\t\tif ch == '\"' {\n\t\t\tl.Backup()\n\t\t\ts := l.AcceptQstring()\n\t\t\tl.Emit(token.VALUE, s)\n\t\t\tl.Emit(token.END, l.Pop())\n\t\t}\n\n\t}\n}", "title": "" }, { "docid": "75e09739a8e684c076259e59ddf2f85c", "score": "0.52160394", "text": "func getAttributeValue(attrName string, n *html.Node) (val string, exists bool) {\n\tif n == nil {\n\t\treturn\n\t}\n\n\tfor _, a := range n.Attr {\n\t\tif a.Key == attrName {\n\t\t\tval = a.Val\n\t\t\texists = true\n\t\t\treturn\n\t\t}\n\t}\n\treturn\n}", "title": "" }, { "docid": "33f05845333b26fc79cc486bb115e99b", "score": "0.5213245", "text": "func (o *RenderedPolicy) ValueForAttribute(name string) interface{} {\n\n\tswitch name {\n\tcase \"certificate\":\n\t\treturn o.Certificate\n\tcase \"datapathType\":\n\t\treturn o.DatapathType\n\tcase \"defaultPUIncomingTrafficAction\":\n\t\treturn o.DefaultPUIncomingTrafficAction\n\tcase \"defaultPUOutgoingTrafficAction\":\n\t\treturn o.DefaultPUOutgoingTrafficAction\n\tcase \"dependendServices\":\n\t\treturn o.DependendServices\n\tcase \"egressPolicies\":\n\t\treturn o.EgressPolicies\n\tcase \"exposedServices\":\n\t\treturn o.ExposedServices\n\tcase \"hashedTags\":\n\t\treturn o.HashedTags\n\tcase \"ingressPolicies\":\n\t\treturn o.IngressPolicies\n\tcase \"matchingTags\":\n\t\treturn o.MatchingTags\n\tcase \"processingUnit\":\n\t\treturn o.ProcessingUnit\n\tcase \"processingUnitID\":\n\t\treturn o.ProcessingUnitID\n\tcase \"processingUnitTags\":\n\t\treturn o.ProcessingUnitTags\n\tcase \"rendererVersion\":\n\t\treturn o.RendererVersion\n\tcase \"ruleSetPolicies\":\n\t\treturn o.RuleSetPolicies\n\tcase \"scopes\":\n\t\treturn o.Scopes\n\tcase \"wireTags\":\n\t\treturn o.WireTags\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "47ffd56967efba8314da01a2ee6325f7", "score": "0.5211807", "text": "func parseAttr(it map[string]*dynamodb.AttributeValue, k taskdb.Kind, f func(s string) (interface{}, error), errs *errors.Multi) interface{} {\n\tkey, ok := colmap[k]\n\tif !ok {\n\t\tpanic(fmt.Sprintf(\"invalid kind %v\", k))\n\t}\n\tav, ok := it[key]\n\tswitch {\n\tcase !ok && f == nil:\n\t\treturn \"\"\n\tcase !ok:\n\t\treturn nil\n\tcase f == nil:\n\t\treturn *av.S\n\t}\n\tv, err := f(*av.S)\n\tif err != nil {\n\t\terrs.Add(fmt.Errorf(\"parse %s %v: %v\", key, *av.S, err))\n\t}\n\treturn v\n}", "title": "" }, { "docid": "3f51b62685e0d6c30eca8833ad327955", "score": "0.5175792", "text": "func FromAttributeValue(ctx context.Context, typ attr.Type, val attr.Value, path path.Path) (attr.Value, diag.Diagnostics) {\n\tvar diags diag.Diagnostics\n\n\t// Since the reflection logic is a generic Go type implementation with\n\t// user input, it is possible to get into awkward situations where\n\t// the logic is expecting a certain type while a value may not be\n\t// compatible. This check will ensure the framework raises its own\n\t// error is there is a mismatch, rather than a terraform-plugin-go\n\t// error or worse a panic.\n\t//\n\t// If this validation causes major issues, another option is to\n\t// validate via tftypes.Type for both the type and value type.\n\tif !typ.Equal(val.Type(ctx)) {\n\t\tdiags.AddAttributeError(\n\t\t\tpath,\n\t\t\t\"Value Conversion Error\",\n\t\t\t\"An unexpected error was encountered while verifying an attribute value matched its expected type to prevent unexpected behavior or panics. \"+\n\t\t\t\t\"This is always an error in the provider. Please report the following to the provider developer:\\n\\n\"+\n\t\t\t\tfmt.Sprintf(\"Expected type: %s\\n\", typ)+\n\t\t\t\tfmt.Sprintf(\"Value type: %s\\n\", val.Type(ctx))+\n\t\t\t\tfmt.Sprintf(\"Path: %s\", path),\n\t\t)\n\n\t\treturn nil, diags\n\t}\n\n\tif typeWithValidate, ok := typ.(xattr.TypeWithValidate); ok {\n\t\ttfVal, err := val.ToTerraformValue(ctx)\n\t\tif err != nil {\n\t\t\treturn val, append(diags, toTerraformValueErrorDiag(err, path))\n\t\t}\n\n\t\tdiags.Append(typeWithValidate.Validate(ctx, tfVal, path)...)\n\n\t\tif diags.HasError() {\n\t\t\treturn val, diags\n\t\t}\n\t}\n\n\treturn val, diags\n}", "title": "" }, { "docid": "c64e34022a4f5a73ea1d7012df0a0431", "score": "0.51621604", "text": "func getAttributeValues(r reader.InputReader, attribute compose.Attribute, possibleEntries map[string][]string) interface{} {\n\tLoop:\n\t\tfor {\n\t\t\tif attribute.IsList {\n\t\t\t\tvar entry string\n\t\t\t\tvar value []string\n\n\t\t\t\tattributeName := attribute.Name\n\n\t\t\t\tif possibleEntries[attribute.Name] != nil {\n\t\t\t\t\tfmt.Printf(\"%s:\\n\", attributeName)\n\t\t\t\t\tfor _, possibleEntry := range possibleEntries[attribute.Name] {\n\t\t\t\t\t\tentry = reader.ReadLine(r, fmt.Sprintf(\" - %s\", possibleEntry), []string{}, true, attribute.GetDescription())\n\t\t\t\t\t\tif entry != \"\" {\n\t\t\t\t\t\t\tvalue = append(value, fmt.Sprintf(\"%s=%s\", possibleEntry, entry))\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\n\t\t\t\t\tattributeName = fmt.Sprintf(\"%s (other)\", attributeName)\n\t\t\t\t}\n\n\t\t\t\tfmt.Println(fmt.Sprintf(\"%s:\", attributeName))\n\t\t\t\tfor ok := true; ok; ok = entry != \"\" {\n\t\t\t\t\tentry = reader.ReadLine(r, \"-\", []string{}, true, attribute.GetDescription())\n\t\t\t\t\tif entry == \"-h\" {\n\t\t\t\t\t\t// HELP Message\n\t\t\t\t\t\tlogger.INFO(attribute.DisplayHelp())\n\n\t\t\t\t\t} else if entry != \"\" {\n\t\t\t\t\t\tvalue = append(value, entry)\n\n\t\t\t\t\t} else {\n\t\t\t\t\t\tbreak\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tif len(value) > 0 {\n\t\t\t\t\treturn value\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tvalue := reader.ReadLine(r, fmt.Sprintf(\"%s\", attribute.Name), []string{}, true, attribute.GetDescription())\n\t\t\t\tif value == \"-h\" {\n\t\t\t\t\t// HELP Message\n\t\t\t\t\tlogger.INFO(attribute.DisplayHelp())\n\t\t\t\t\tcontinue Loop\n\t\t\t\t} else if value != \"\" {\n\t\t\t\t\treturn value\n\t\t\t\t}\n\t\t\t}\n\t\t\tbreak\n\t\t}\n\treturn nil\n}", "title": "" }, { "docid": "5c06d6bbd7fafe9d226e23b77fcd750c", "score": "0.50966907", "text": "func (o *TagPrefix) ValueForAttribute(name string) interface{} {\n\n\tswitch name {\n\tcase \"prefixes\":\n\t\treturn o.Prefixes\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "1feef9d4fd706be9c74f2f63b3574532", "score": "0.5093873", "text": "func NewAttributeValue(ctx context.Context, typ attr.Type, val tftypes.Value, target reflect.Value, opts Options, path path.Path) (reflect.Value, diag.Diagnostics) {\n\tvar diags diag.Diagnostics\n\n\tif typeWithValidate, ok := typ.(xattr.TypeWithValidate); ok {\n\t\tdiags.Append(typeWithValidate.Validate(ctx, val, path)...)\n\n\t\tif diags.HasError() {\n\t\t\treturn target, diags\n\t\t}\n\t}\n\n\tres, err := typ.ValueFromTerraform(ctx, val)\n\tif err != nil {\n\t\treturn target, append(diags, valueFromTerraformErrorDiag(err, path))\n\t}\n\tif reflect.TypeOf(res) != target.Type() {\n\t\tdiags.Append(diag.WithPath(path, DiagNewAttributeValueIntoWrongType{\n\t\t\tValType: reflect.TypeOf(res),\n\t\t\tTargetType: target.Type(),\n\t\t\tSchemaType: typ,\n\t\t}))\n\t\treturn target, diags\n\t}\n\treturn reflect.ValueOf(res), diags\n}", "title": "" }, { "docid": "9e958a54141ec2bfb379a99268ce7700", "score": "0.5071519", "text": "func createSqsMessageAttributeValue(value string) types.MessageAttributeValue {\n\treturn types.MessageAttributeValue{\n\t\tDataType: aws.String(\"String\"),\n\t\tStringValue: aws.String(value),\n\t}\n}", "title": "" }, { "docid": "3b294c49549c61d2cf122a8fb6853acf", "score": "0.5052463", "text": "func (o *HookPolicy) ValueForAttribute(name string) interface{} {\n\n\tswitch name {\n\tcase \"ID\":\n\t\treturn o.ID\n\tcase \"annotations\":\n\t\treturn o.Annotations\n\tcase \"associatedTags\":\n\t\treturn o.AssociatedTags\n\tcase \"certificateAuthority\":\n\t\treturn o.CertificateAuthority\n\tcase \"clientCertificate\":\n\t\treturn o.ClientCertificate\n\tcase \"clientCertificateKey\":\n\t\treturn o.ClientCertificateKey\n\tcase \"continueOnError\":\n\t\treturn o.ContinueOnError\n\tcase \"createIdempotencyKey\":\n\t\treturn o.CreateIdempotencyKey\n\tcase \"createTime\":\n\t\treturn o.CreateTime\n\tcase \"description\":\n\t\treturn o.Description\n\tcase \"disabled\":\n\t\treturn o.Disabled\n\tcase \"endpoint\":\n\t\treturn o.Endpoint\n\tcase \"endpointType\":\n\t\treturn o.EndpointType\n\tcase \"expirationTime\":\n\t\treturn o.ExpirationTime\n\tcase \"fallback\":\n\t\treturn o.Fallback\n\tcase \"metadata\":\n\t\treturn o.Metadata\n\tcase \"mode\":\n\t\treturn o.Mode\n\tcase \"name\":\n\t\treturn o.Name\n\tcase \"namespace\":\n\t\treturn o.Namespace\n\tcase \"normalizedTags\":\n\t\treturn o.NormalizedTags\n\tcase \"propagate\":\n\t\treturn o.Propagate\n\tcase \"propagationHidden\":\n\t\treturn o.PropagationHidden\n\tcase \"protected\":\n\t\treturn o.Protected\n\tcase \"selectors\":\n\t\treturn o.Selectors\n\tcase \"subject\":\n\t\treturn o.Subject\n\tcase \"triggerOperations\":\n\t\treturn o.TriggerOperations\n\tcase \"updateIdempotencyKey\":\n\t\treturn o.UpdateIdempotencyKey\n\tcase \"updateTime\":\n\t\treturn o.UpdateTime\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "c92d46ec21413719d13b8014301c7d3b", "score": "0.5022638", "text": "func (c *Puppet) AttributeValue(sel string, name string) (value string, ok bool, err error) {\n\treturn value, ok, c.cdp.Run(c.ctx,\n\t\tchromedp.AttributeValue(sel, name, &value, &ok))\n}", "title": "" }, { "docid": "6835bfd4efe7205d83a8040ce2ab4918", "score": "0.50165385", "text": "func (o *NamespaceType) ValueForAttribute(name string) interface{} {\n\n\tswitch name {\n\tcase \"type\":\n\t\treturn o.Type\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "94ff25ede61f6635155b199e2abd6017", "score": "0.49904704", "text": "func (o *Trigger) ValueForAttribute(name string) interface{} {\n\n\tswitch name {\n\tcase \"payload\":\n\t\treturn o.Payload\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "3023beec839fcf266b8f64d5ee046484", "score": "0.4980509", "text": "func (o *Customer) ValueForAttribute(name string) interface{} {\n\n\tswitch name {\n\tcase \"ID\":\n\t\treturn o.ID\n\tcase \"committedUseLimit\":\n\t\treturn o.CommittedUseLimit\n\tcase \"createTime\":\n\t\treturn o.CreateTime\n\tcase \"lastReportTime\":\n\t\treturn o.LastReportTime\n\tcase \"provider\":\n\t\treturn o.Provider\n\tcase \"providerCustomerID\":\n\t\treturn o.ProviderCustomerID\n\tcase \"providerProductID\":\n\t\treturn o.ProviderProductID\n\tcase \"state\":\n\t\treturn o.State\n\tcase \"updateTime\":\n\t\treturn o.UpdateTime\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "f56ae9dea9491a5e67b7726329865bc9", "score": "0.4979807", "text": "func (o *Log) ValueForAttribute(name string) interface{} {\n\n\tswitch name {\n\tcase \"data\":\n\t\treturn o.Data\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "1225bc2f41331e3773602d85be3db8ea", "score": "0.49684805", "text": "func (o *Export) ValueForAttribute(name string) interface{} {\n\n\tswitch name {\n\tcase \"APIVersion\":\n\t\treturn o.APIVersion\n\tcase \"data\":\n\t\treturn o.Data\n\tcase \"identities\":\n\t\treturn o.Identities\n\tcase \"label\":\n\t\treturn o.Label\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "9eab0be8a2cbacbbb6fea71b96d3bfe0", "score": "0.49540105", "text": "func eatAttrName(s []byte, i int) (int, *Error) {\n\tfor j := i; j < len(s); j++ {\n\t\tswitch s[j] {\n\t\tcase ' ', '\\t', '\\n', '\\f', '\\r', '=', '>':\n\t\t\treturn j, nil\n\t\tcase '\\'', '\"', '<':\n\t\t\t// These result in a parse warning in HTML5 and are\n\t\t\t// indicative of serious problems if seen in an attr\n\t\t\t// name in a template.\n\t\t\treturn -1, errorf(ErrBadHTML, nil, 0, \"%q in attribute name: %.32q\", s[j:j+1], s)\n\t\tdefault:\n\t\t\t// No-op.\n\t\t}\n\t}\n\treturn len(s), nil\n}", "title": "" }, { "docid": "9eab0be8a2cbacbbb6fea71b96d3bfe0", "score": "0.49540105", "text": "func eatAttrName(s []byte, i int) (int, *Error) {\n\tfor j := i; j < len(s); j++ {\n\t\tswitch s[j] {\n\t\tcase ' ', '\\t', '\\n', '\\f', '\\r', '=', '>':\n\t\t\treturn j, nil\n\t\tcase '\\'', '\"', '<':\n\t\t\t// These result in a parse warning in HTML5 and are\n\t\t\t// indicative of serious problems if seen in an attr\n\t\t\t// name in a template.\n\t\t\treturn -1, errorf(ErrBadHTML, nil, 0, \"%q in attribute name: %.32q\", s[j:j+1], s)\n\t\tdefault:\n\t\t\t// No-op.\n\t\t}\n\t}\n\treturn len(s), nil\n}", "title": "" }, { "docid": "6726ce31462be0e29d5954c32c1f5e3e", "score": "0.49363837", "text": "func (o *AuthNMappingAttributes) GetAttributeValueOk() (*string, bool) {\n\tif o == nil || o.AttributeValue == nil {\n\t\treturn nil, false\n\t}\n\treturn o.AttributeValue, true\n}", "title": "" }, { "docid": "a778d58165a0f9e49c9038ac6381a20d", "score": "0.49295047", "text": "func (e Element) SelectAttrValue(key, dflt string) string {\n\tspace, key := decompose(key)\n\tfor _, a := range e.Attr {\n\t\tif space == a.Space && key == a.Key {\n\t\t\treturn a.Value\n\t\t}\n\t}\n\n\treturn dflt\n}", "title": "" }, { "docid": "7349f8f97141a90e9e1a45b22070915d", "score": "0.4926321", "text": "func validAttr(val string) {\n\tif invalidTagOrAttr(val) {\n\t\tpanic(fmt.Errorf(`[gax] invalid attribute name %q`, val))\n\t}\n}", "title": "" }, { "docid": "ba91a91896b58d2f4e0ef563582db7a4", "score": "0.49198118", "text": "func (c *ControlBase) ProcessAttributeString(s string) ControlI {\n\tif s != \"\" {\n\t\tc.attributes.MergeString(s)\n\t}\n\treturn c.this()\n}", "title": "" }, { "docid": "6f790a7554a84cf6bbe5f79d1148f5ce", "score": "0.49034733", "text": "func (p *Parser) attribute(data []byte) []byte {\n\tif len(data) < 3 {\n\t\treturn data\n\t}\n\ti := 0\n\tif data[i] != '{' {\n\t\treturn data\n\t}\n\ti++\n\n\t// last character must be a } otherwise it's not an attribute\n\tend := skipUntilChar(data, i, '\\n')\n\tif data[end-1] != '}' {\n\t\treturn data\n\t}\n\n\ti = skipSpace(data, i)\n\tb := &ast.Attribute{Attrs: make(map[string][]byte)}\n\n\tesc := false\n\tquote := false\n\ttrail := 0\nLoop:\n\tfor ; i < len(data); i++ {\n\t\tswitch data[i] {\n\t\tcase ' ', '\\t', '\\f', '\\v':\n\t\t\tif quote {\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tchunk := data[trail+1 : i]\n\t\t\tif len(chunk) == 0 {\n\t\t\t\ttrail = i\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tswitch {\n\t\t\tcase chunk[0] == '.':\n\t\t\t\tb.Classes = append(b.Classes, chunk[1:])\n\t\t\tcase chunk[0] == '#':\n\t\t\t\tb.ID = chunk[1:]\n\t\t\tdefault:\n\t\t\t\tk, v := keyValue(chunk)\n\t\t\t\tif k != nil && v != nil {\n\t\t\t\t\tb.Attrs[string(k)] = v\n\t\t\t\t} else {\n\t\t\t\t\t// this is illegal in an attribute\n\t\t\t\t\treturn data\n\t\t\t\t}\n\t\t\t}\n\t\t\ttrail = i\n\t\tcase '\"':\n\t\t\tif esc {\n\t\t\t\tesc = !esc\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tquote = !quote\n\t\tcase '\\\\':\n\t\t\tesc = !esc\n\t\tcase '}':\n\t\t\tif esc {\n\t\t\t\tesc = !esc\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tchunk := data[trail+1 : i]\n\t\t\tif len(chunk) == 0 {\n\t\t\t\treturn data\n\t\t\t}\n\t\t\tswitch {\n\t\t\tcase chunk[0] == '.':\n\t\t\t\tb.Classes = append(b.Classes, chunk[1:])\n\t\t\tcase chunk[0] == '#':\n\t\t\t\tb.ID = chunk[1:]\n\t\t\tdefault:\n\t\t\t\tk, v := keyValue(chunk)\n\t\t\t\tif k != nil && v != nil {\n\t\t\t\t\tb.Attrs[string(k)] = v\n\t\t\t\t} else {\n\t\t\t\t\treturn data\n\t\t\t\t}\n\t\t\t}\n\t\t\ti++\n\t\t\tbreak Loop\n\t\tdefault:\n\t\t\tesc = false\n\t\t}\n\t}\n\n\tp.attr = b\n\treturn data[i:]\n}", "title": "" }, { "docid": "6cc2361848e66ad185f02dfcb256365f", "score": "0.49020517", "text": "func (kv *KVPair) StringValue() string {\n\tvar str string\n\n\terr := dynamodbattribute.Unmarshal(kv.value, &str)\n\tif err != nil {\n\t\treturn str\n\t}\n\n\treturn str\n}", "title": "" }, { "docid": "f16b3fa7af8eea9b1c569eb29372f6da", "score": "0.48756388", "text": "func UnmarshalAttributeValue(item map[string]*SDK.AttributeValue) map[string]interface{} {\n\tdata := make(map[string]interface{})\n\tif item == nil {\n\t\treturn data\n\t}\n\tfor key, val := range item {\n\t\tdata[key] = getItemValue(val)\n\t}\n\treturn data\n}", "title": "" }, { "docid": "8b06075406fbdb66046630e02cfeddce", "score": "0.48718333", "text": "func (obj *AbstractAttribute) ReadValue(is types.TGInputStream) types.TGError {\n\treturn nil\n}", "title": "" }, { "docid": "be754a2eec30eb885cb61ab8b11a7ed7", "score": "0.48646897", "text": "func (o *DataPathCertificate) ValueForAttribute(name string) interface{} {\n\n\tswitch name {\n\tcase \"CSR\":\n\t\treturn o.CSR\n\tcase \"certificate\":\n\t\treturn o.Certificate\n\tcase \"objectID\":\n\t\treturn o.ObjectID\n\tcase \"sessionID\":\n\t\treturn o.SessionID\n\tcase \"signer\":\n\t\treturn o.Signer\n\tcase \"token\":\n\t\treturn o.Token\n\tcase \"type\":\n\t\treturn o.Type\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "2ccef518a9f94bf821a268daee6d92e9", "score": "0.48446453", "text": "func (o *AuthNMappingAttributes) GetAttributeValue() string {\n\tif o == nil || o.AttributeValue == nil {\n\t\tvar ret string\n\t\treturn ret\n\t}\n\treturn *o.AttributeValue\n}", "title": "" }, { "docid": "d6d4acfb2c0a8bf0a40cbc82fd6b4959", "score": "0.48236707", "text": "func (a *Auth) Get(attribute string) (string, error) {\n\tv, ok := a.Secret[attribute]\n\tif !ok {\n\t\treturn \"\", fmt.Errorf(\"attribute not found: %s\", attribute)\n\t}\n\n\treturn string(v), nil\n}", "title": "" }, { "docid": "4a021f0674f8f69b1a1408723eaf5f04", "score": "0.48192003", "text": "func tagValue(tag string) string {\n\tremovedNewline := strings.Replace(tag, \"\\n\", \"\", -1)\n\tremovedSemicolon := strings.Replace(removedNewline, \";\", \"\", -1)\n\ttrimmedWhitespace := strings.TrimSpace(removedSemicolon)\n\tsmValue := strings.Split(trimmedWhitespace, \":\")[1]\n\treturn smValue\n}", "title": "" }, { "docid": "38ef17688157e9444e00eeacd40763dc", "score": "0.48167685", "text": "func generateAttr(field, value string) *cogIdp.AttributeType {\n\treturn &cogIdp.AttributeType{\n\t\tName: aws.String(field),\n\t\tValue: aws.String(value),\n\t}\n}", "title": "" }, { "docid": "9b092b2e9880a607d55322f2f71477e7", "score": "0.4813867", "text": "func GetAttribute(token html.Token, attrName string) string {\n\tfor _, a := range token.Attr {\n\t\tif a.Key == attrName {\n\t\t\treturn a.Val\n\t\t}\n\t}\n\n\treturn \"\"\n}", "title": "" }, { "docid": "680cd172a509ec89a0cf223e04c47f98", "score": "0.4811059", "text": "func GetNameValPair(tag, name string) string {\r\n\tvar s, UpperName string\r\n\tvar i, idx int\r\n\tvar C string // char\r\n\r\n\tif tag == \"\" || name == \"\" {\r\n\t\treturn \"\"\r\n\t}\r\n\t// must be space before case insensitive NAME, i.e. <a HREF= STYLE=\r\n\tUpperName = \" \" + strings.ToUpper(name)\r\n\ts = strings.ToUpper(tag)\r\n\r\n\tidx = strings.Index(s, UpperName)\r\n\t// no name value pair found\r\n\tif idx == -1 {\r\n\t\treturn \"\" // todo: could return error since name was not found in tag\r\n\t}\r\n\r\n\tidx++ // skip space\r\n\ti = idx\r\n\r\n\t// Skip until hopefully equal sign\r\n\tfor !isChar(s[i], \"=\", \" \", \">\") {\r\n\t\tif i == len(s)-1 { break }\r\n\t\ti++\r\n\t}\r\n\r\n\tif string(s[i]) == \"=\" { i++ }\r\n\r\n\tfor !isChar(s[i], \" \", \">\") {\r\n\t\tif i == len(s)-1 { break }\r\n\t\tif isChar(s[i], \"\\\"\", \"'\") {\r\n\t\t\tC = string(s[i])\r\n\t\t\ti++ // Skip quote\r\n\t\t} else {\r\n\t\t\tC = \" \"\r\n\t\t}\r\n\r\n\t\tfor !isChar(s[i], C, \">\") {\r\n\t\t\tif i == len(s)-1 { break }\r\n\t\t\ti++\r\n\t\t}\r\n\r\n\t\tif string(s[i]) != \">\" { i++ } // Skip current character, except '>'\r\n\t\tbreak\r\n\t}\r\n\r\n // extract the string slice where the name value pair is, return it\r\n return tag[idx:i]\r\n}", "title": "" }, { "docid": "36274ec937ef453bb3e5849c4dc604a4", "score": "0.48102129", "text": "func ExtractValue(body string, key string) string {\r\n keystr := \"\\\"\" + key + \"\\\":[^,;\\\\]}]*\"\r\n r, _ := regexp.Compile(keystr)\r\n match := r.FindString(body)\r\n keyValMatch := strings.Split(match, \":\")\r\n return strings.ReplaceAll(keyValMatch[1], \"\\\"\", \"\")\r\n}", "title": "" }, { "docid": "d03ed2e7898cb76205aac981150afc1a", "score": "0.4808006", "text": "func lexQuotedKey(lx *lexer) stateFn {\n\tr := lx.peek()\n\tif r == sqStringEnd {\n\t\tlx.emit(itemKey)\n\t\tlx.next()\n\t\treturn lexSkip(lx, lexKeyEnd)\n\t} else if r == eof {\n\t\tif lx.pos > lx.start {\n\t\t\treturn lx.errorf(\"Unexpected EOF.\")\n\t\t}\n\t\tlx.emit(itemEOF)\n\t\treturn nil\n\t}\n\tlx.next()\n\treturn lexQuotedKey\n}", "title": "" }, { "docid": "995d6b1735c41c4303636af1e4b87b57", "score": "0.47893515", "text": "func getItemValue(val *SDK.AttributeValue) interface{} {\n\tswitch {\n\tcase val.N != nil:\n\t\tdata, _ := strconv.Atoi(*val.N)\n\t\treturn data\n\tcase val.S != nil:\n\t\treturn *val.S\n\tcase val.BOOL != nil:\n\t\treturn *val.BOOL\n\tcase len(val.B) > 0:\n\t\treturn val.B\n\tcase len(val.M) > 0:\n\t\treturn UnmarshalAttributeValue(val.M)\n\tcase len(val.NS) > 0:\n\t\tvar data []*int\n\t\tfor _, vString := range val.NS {\n\t\t\tvInt, _ := strconv.Atoi(*vString)\n\t\t\tdata = append(data, &vInt)\n\t\t}\n\t\treturn data\n\tcase len(val.SS) > 0:\n\t\treturn val.SS\n\tcase len(val.BS) > 0:\n\t\treturn val.BS\n\tcase len(val.L) > 0:\n\t\tvar data []interface{}\n\t\tfor _, v := range val.L {\n\t\t\tdata = append(data, getItemValue(v))\n\t\t}\n\t\treturn data\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "37ce11af0479e2136ccabcf315b960e0", "score": "0.4788191", "text": "func CheckBucketAttribsE(t *testing.T, bucketName string, attributeName string, attributeValue string) (string, error) {\n\tlogger.Logf(t, \"Reading object attrib %s for bucket %s with value %s\", attributeName,bucketName,attributeValue)\n\n\tctx := context.Background()\n\n\tclient, err := storage.NewClient(ctx)\n\tif err != nil {\n\t\treturn \"error\", err\n\t}\n\n\tattrs, err := client.Bucket(bucketName).Attrs(ctx)\n\tif (attrs.Name == bucketName) {\n\t\tswitch strings.ToLower(attributeName) {\n\t\tcase \"location\":\n\t\t\tlogger.Logf(t,\"LOCATION \")\n\t\t\tif (strings.HasPrefix(strings.ToLower(attrs.Location),strings.ToLower(attributeValue))) {\n\t\t\t\treturn \"success\",nil\n\t\t\t}else{\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn \"error\", err\n\t\t\t\t}\n\t\t\t\treturn join(\"Bucket Location and Region must start with \",attributeValue),nil\n\t\t\t}\t\t\n\t\tcase \"storageclass\":\n\t\t\tlogger.Logf(t,\"StorageClass\")\n\t\t\tif (strings.Compare(strings.ToUpper(attrs.StorageClass),strings.ToUpper(attributeValue))==0) {\n\t\t\t\treturn \"success\",nil\n\t\t\t}else{\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn \"error\", err\n\t\t\t\t}\n\t\t\t\treturn join(\"Storage Class is \", strings.ToUpper(attrs.StorageClass), \" does not match to what is expected - \",attributeValue),nil\n\t\t\t}\t\t\n\t\tcase \"version\":\n\t\t\tlogger.Logf(t,\"version\")\n\t\t\tlogger.Logf(t,\"versioning enabled? %t\", attrs.VersioningEnabled) \n\t\t\tif (strings.ToLower(attributeValue) == \"true\") {\n\t\t\t\tif attrs.VersioningEnabled {\n\t\t\t\t\treturn \"success\",nil\n\t\t\t\t}else{\n\t\t\t\t\treturn join(\"Bucket Versioning should be enabled but is not enabled \"),nil\n\t\t\t\t}\t\n\t\t\t}else {\n\t\t\t\tif attrs.VersioningEnabled {\n\t\t\t\t\treturn join(\"Bucket Versioning should not be enabled but is enabled \"),nil\n\t\t\t\t} else{\n\t\t\t\t\treturn \"success\",nil\n\t\t\t\t}\n\t\t\t}\n\t\tcase \"labels\":\n\t\t\tlogger.Logf(t,\"Labels %s\", attrs.Labels)\n\t\t}\n\t}\n\treturn \"success\", nil\n}", "title": "" }, { "docid": "4d64f16d1f2def2dbc4b84c7ec22a64d", "score": "0.4786256", "text": "func lexQuotedString(lx *lexer) stateFn {\n\tr := lx.next()\n\tswitch {\n\tcase r == sqStringEnd:\n\t\tlx.backup()\n\t\tlx.emit(itemString)\n\t\tlx.next()\n\t\tlx.ignore()\n\t\treturn lx.pop()\n\tcase r == eof:\n\t\tif lx.pos > lx.start {\n\t\t\treturn lx.errorf(\"Unexpected EOF.\")\n\t\t}\n\t\tlx.emit(itemEOF)\n\t\treturn nil\n\t}\n\treturn lexQuotedString\n}", "title": "" }, { "docid": "cbf88060276a1da53ffd6b9e16567d94", "score": "0.47763187", "text": "func attributeContainsValue(attr html.Attribute, attribute, value string) bool {\n\tif attr.Key == attribute {\n\t\tfor _, attrVal := range strings.Fields(attr.Val) {\n\t\t\tif attrVal == value {\n\t\t\t\treturn true\n\t\t\t}\n\t\t}\n\t}\n\treturn false\n}", "title": "" }, { "docid": "89f1d5dfc532e032b6f683053d052cfb", "score": "0.47565737", "text": "func ParseAttributes(attrb string) []string {\n\n\tif attrb == \"\" {\n\t\treturn nil\n\t}\n\n\tattlen := len(attrb)\n\n\t// count equal signs\n\tnum := 0\n\tfor i := 0; i < attlen; i++ {\n\t\tif attrb[i] == '=' {\n\t\t\tnum += 2\n\t\t}\n\t}\n\tif num < 1 {\n\t\treturn nil\n\t}\n\n\t// allocate array of proper size\n\tarry := make([]string, num)\n\tif arry == nil {\n\t\treturn nil\n\t}\n\n\tstart := 0\n\tidx := 0\n\titm := 0\n\n\t// place tag and value in successive array slots\n\tfor idx < attlen && itm < num {\n\t\tch := attrb[idx]\n\t\tif ch == '=' {\n\t\t\t// skip past possible leading blanks\n\t\t\tfor start < attlen {\n\t\t\t\tch = attrb[start]\n\t\t\t\tif ch == ' ' || ch == '\\n' || ch == '\\t' || ch == '\\r' || ch == '\\f' {\n\t\t\t\t\tstart++\n\t\t\t\t} else {\n\t\t\t\t\tbreak\n\t\t\t\t}\n\t\t\t}\n\t\t\t// =\n\t\t\tarry[itm] = attrb[start:idx]\n\t\t\titm++\n\t\t\t// skip past equal sign and leading double quote\n\t\t\tidx += 2\n\t\t\tstart = idx\n\t\t} else if ch == '\"' {\n\t\t\t// \"\n\t\t\tarry[itm] = attrb[start:idx]\n\t\t\titm++\n\t\t\t// skip past trailing double quote and (possible) space\n\t\t\tidx += 2\n\t\t\tstart = idx\n\t\t} else {\n\t\t\tidx++\n\t\t}\n\t}\n\n\treturn arry\n}", "title": "" }, { "docid": "130fe4fe41c7fecb35befe498f0d6c59", "score": "0.47467196", "text": "func (o *CloudNetworkRuleSet) ValueForAttribute(name string) interface{} {\n\n\tswitch name {\n\tcase \"APIID\":\n\t\treturn o.APIID\n\tcase \"ID\":\n\t\treturn o.ID\n\tcase \"VPCID\":\n\t\treturn o.VPCID\n\tcase \"accountID\":\n\t\treturn o.AccountID\n\tcase \"annotations\":\n\t\treturn o.Annotations\n\tcase \"associatedTags\":\n\t\treturn o.AssociatedTags\n\tcase \"cloudTags\":\n\t\treturn o.CloudTags\n\tcase \"cloudType\":\n\t\treturn o.CloudType\n\tcase \"createIdempotencyKey\":\n\t\treturn o.CreateIdempotencyKey\n\tcase \"createTime\":\n\t\treturn o.CreateTime\n\tcase \"customerID\":\n\t\treturn o.CustomerID\n\tcase \"ingestionTime\":\n\t\treturn o.IngestionTime\n\tcase \"key\":\n\t\treturn o.Key\n\tcase \"migrationsLog\":\n\t\treturn o.MigrationsLog\n\tcase \"name\":\n\t\treturn o.Name\n\tcase \"namespace\":\n\t\treturn o.Namespace\n\tcase \"nativeID\":\n\t\treturn o.NativeID\n\tcase \"normalizedTags\":\n\t\treturn o.NormalizedTags\n\tcase \"parameters\":\n\t\treturn o.Parameters\n\tcase \"policyReferences\":\n\t\treturn o.PolicyReferences\n\tcase \"protected\":\n\t\treturn o.Protected\n\tcase \"regionName\":\n\t\treturn o.RegionName\n\tcase \"resourceID\":\n\t\treturn o.ResourceID\n\tcase \"updateIdempotencyKey\":\n\t\treturn o.UpdateIdempotencyKey\n\tcase \"updateTime\":\n\t\treturn o.UpdateTime\n\tcase \"zHash\":\n\t\treturn o.ZHash\n\tcase \"zone\":\n\t\treturn o.Zone\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "590083d2f13651cde892f68e706a37ce", "score": "0.47284514", "text": "func (r *Reader) GetValue(groupName, itemName string) string {\n\tkey := groupName + r.Delimiter + itemName\n\tvalue, canFound := r.Value[key]\n\tif !canFound {\n\t\treturn \"\"\n\t}\n\treturn value\n}", "title": "" }, { "docid": "b072c3adbc084d6ddb164ceebc9b4794", "score": "0.47175977", "text": "func (e element) GetAttr(name string) string {\n if e.HasAttr(name) {\n return e.attrs[name].GetVal()\n } else {\n return \"\"\n }\n}", "title": "" }, { "docid": "df6b03f067297426e7a2fbc38cd4ff13", "score": "0.4717132", "text": "func StringAttribute(key string, value string) Attribute {\n\treturn Attribute{key: key, value: value}\n}", "title": "" }, { "docid": "e1ee7aa84987c92caf96f94be1a4879d", "score": "0.4711164", "text": "func (jbobject *ServicesEc2ModelInstanceAttributeName) ValueOf(a string) *ServicesEc2ModelInstanceAttributeName {\n\tconv_a := javabind.NewGoToJavaString()\n\tif err := conv_a.Convert(a); err != nil {\n\t\tpanic(err)\n\t}\n\tjret, err := javabind.GetEnv().CallStaticMethod(\"com/amazonaws/services/ec2/model/InstanceAttributeName\", \"valueOf\", \"com/amazonaws/services/ec2/model/InstanceAttributeName\", conv_a.Value().Cast(\"java/lang/String\"))\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\tconv_a.CleanUp()\n\tretconv := javabind.NewJavaToGoCallable()\n\tdst := &javabind.Callable{}\n\tretconv.Dest(dst)\n\tif err := retconv.Convert(javabind.ObjectRef(jret)); err != nil {\n\t\tpanic(err)\n\t}\n\tretconv.CleanUp()\n\tunique_x := &ServicesEc2ModelInstanceAttributeName{}\n\tunique_x.Callable = dst\n\treturn unique_x\n}", "title": "" }, { "docid": "d87355f5546cb04e7c6b54ccbd809aa2", "score": "0.47060117", "text": "func lookupTag(tag string, key string) (value string, ok bool) {\n\tfor tag != \"\" {\n\t\t// Skip leading space.\n\t\ti := 0\n\t\tfor i < len(tag) && tag[i] == ' ' {\n\t\t\ti++\n\t\t}\n\t\ttag = tag[i:]\n\t\tif tag == \"\" {\n\t\t\tbreak\n\t\t}\n\n\t\t// Scan to colon. A space, a quote or a control character is a syntax error.\n\t\t// Strictly speaking, control chars include the range [0x7f, 0x9f], not just\n\t\t// [0x00, 0x1f], but in practice, we ignore the multi-byte control characters\n\t\t// as it is simpler to inspect the tag's bytes than the tag's runes.\n\t\ti = 0\n\t\tfor i < len(tag) && tag[i] > ' ' && tag[i] != ':' && tag[i] != '\"' && tag[i] != 0x7f {\n\t\t\ti++\n\t\t}\n\t\tif i == 0 || i+1 >= len(tag) || tag[i] != ':' || tag[i+1] != '\"' {\n\t\t\tbreak\n\t\t}\n\t\tname := string(tag[:i])\n\t\ttag = tag[i+1:]\n\n\t\t// Scan quoted string to find value.\n\t\ti = 1\n\t\tfor i < len(tag) && tag[i] != '\"' {\n\t\t\tif tag[i] == '\\\\' {\n\t\t\t\ti++\n\t\t\t}\n\t\t\ti++\n\t\t}\n\t\tif i >= len(tag) {\n\t\t\tbreak\n\t\t}\n\t\tqvalue := string(tag[:i+1])\n\t\ttag = tag[i+1:]\n\t\tif key == name {\n\t\t\tvalue, err := strconv.Unquote(qvalue)\n\t\t\tif err != nil {\n\t\t\t\tbreak\n\t\t\t}\n\t\t\treturn value, true\n\t\t}\n\t}\n\treturn \"\", false\n}", "title": "" }, { "docid": "d7f1635f4c905eeed1c8e63ec3c25501", "score": "0.47036454", "text": "func (s Attribute) Parse() (*ElementType, error) {\n\tattribute := s.Describe\n\tfor _, indicate := range digitIndicates {\n\t\tif strings.Contains(attribute, indicate) {\n\t\t\tvar format string\n\t\t\tif strings.Contains(attribute, formatIndicate) {\n\t\t\t\tsplits := strings.Split(attribute, formatIndicate)\n\t\t\t\tattribute = splits[0]\n\t\t\t\tif len(splits) > 1 {\n\t\t\t\t\tformat = strings.TrimSpace(splits[len(splits)-1])\n\t\t\t\t}\n\t\t\t}\n\t\t\tsplits := strings.Split(attribute, indicate)\n\t\t\tif len(splits) > 1 {\n\t\t\t\tisFixed := !strings.Contains(indicate, variableIndicate)\n\t\t\t\t_size, err := strconv.Atoi(strings.TrimSpace(splits[len(splits)-1]))\n\t\t\t\tif err != nil || (!isFixed && _size > int(math.Pow(10, float64(len(indicate))))) {\n\t\t\t\t\treturn nil, errors.New(ErrInvalidElementLength)\n\t\t\t\t}\n\t\t\t\treturn &ElementType{\n\t\t\t\t\tType: strings.TrimSpace(splits[0]),\n\t\t\t\t\tLength: _size,\n\t\t\t\t\tFixed: isFixed,\n\t\t\t\t\tFormat: format,\n\t\t\t\t}, nil\n\t\t\t}\n\t\t}\n\t}\n\n\treturn nil, errors.New(ErrInvalidElementType)\n}", "title": "" }, { "docid": "7ecd6a956c8650fddd8ff504b1e0ecfd", "score": "0.46860787", "text": "func DDBAttributeValueToString(key string, attr events.DynamoDBAttributeValue) (string, error) {\n\tswitch attr.DataType() {\n\tcase events.DataTypeBinary:\n\t\treturn string(attr.Binary()), nil\n\tcase events.DataTypeNull:\n\t\treturn \"\", nil\n\tcase events.DataTypeBoolean:\n\t\tif attr.Boolean() {\n\t\t\treturn \"Si\", nil\n\t\t}\n\t\treturn \"No\", nil\n\tcase events.DataTypeNumber:\n\t\tif key == \"arancel_adicional\" {\n\t\t\tf, err := attr.Float()\n\t\t\tif err != nil {\n\t\t\t\treturn \"\", err\n\t\t\t}\n\t\t\treturn strconv.FormatFloat(f, 'f', -1, 64), nil\n\t\t}\n\t\tf, err := attr.Integer()\n\t\tif err != nil {\n\t\t\treturn \"\", err\n\t\t}\n\t\treturn strconv.Itoa(int(f)), nil\n\tcase events.DataTypeString:\n\t\treturn attr.String(), nil\n\t}\n\n\treturn \"\", errors.New(\"Unknown type to parse\")\n}", "title": "" }, { "docid": "2ac79057411e47e0053acaea179c783f", "score": "0.4681077", "text": "func parse_quotedstring(src string, offset int) (string, int, bool) {\n svalue := make([]byte, 256)\n state := Start\n validx := 0\n for idx := offset; idx < len(src); idx, validx = idx + 1, validx + 1 {\n if src[idx] == '\\\\' {\n if src[idx + 1] == 'n' {\n svalue[validx] = '\\n'\n } else if src[idx + 1] == 'r' {\n svalue[validx] = '\\r'\n } else if src[idx + 1] == 't' {\n svalue[validx] = '\\t'\n } else if src[idx + 1] == '\\\\' {\n svalue[validx] = '\"'\n }\n idx++\n } else if src[idx] == '\"' {\n state = End\n } else {\n svalue[validx] = src[idx]\n }\n\n if state == End {\n offset = idx\n break\n }\n }\n return string(svalue[0:validx]), offset, !(state == End)\n}", "title": "" }, { "docid": "1bb061593400b91e604050e6dd95a85c", "score": "0.46741697", "text": "func (r *StringReader) ReadUnquotedString() string {\n\tstart := r.Cursor\n\tfor r.CanRead() && IsAllowedInUnquotedString(r.Peek()) {\n\t\tr.Skip()\n\t}\n\treturn r.String[start:r.Cursor]\n}", "title": "" }, { "docid": "4242fac30a7ab5675def591d6abe0544", "score": "0.46486938", "text": "func (el *Element) Attribute(name string) (*string, error) {\n\tattr, err := el.Eval(\"(n) => this.getAttribute(n)\", name)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tif attr.Value.Nil() {\n\t\treturn nil, nil\n\t}\n\n\ts := attr.Value.Str()\n\treturn &s, nil\n}", "title": "" }, { "docid": "1924ded2a9a3027c47c2b083ab25bad4", "score": "0.46398538", "text": "func (a *Attributes) Str(key string) (string, error) {\n\ts, err := a.Get(key, \"str\")\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\n\treturn s.(string), nil\n}", "title": "" }, { "docid": "d2e1e7dad31690fe8b44499ad0345725", "score": "0.46392468", "text": "func ResourceAttribute(ctx context.Context, name string) string {\n\tattrs, ok := ctx.Value(attributesCtxKey).(map[string]string)\n\tif !ok {\n\t\treturn \"\"\n\t}\n\n\tval, ok := attrs[name]\n\tif !ok {\n\t\treturn \"\"\n\t}\n\treturn val\n}", "title": "" }, { "docid": "97b03b6d95957fc421e6917c0f771aa1", "score": "0.46357608", "text": "func createAttributeValue(v interface{}) *SDK.AttributeValue {\n\tswitch t := v.(type) {\n\tcase string:\n\t\treturn &SDK.AttributeValue{\n\t\t\tS: pointers.String(t),\n\t\t}\n\tcase int, int32, int64, uint, uint32, uint64, float32, float64:\n\t\treturn &SDK.AttributeValue{\n\t\t\tN: pointers.String(fmt.Sprint(t)),\n\t\t}\n\tcase []byte:\n\t\treturn &SDK.AttributeValue{\n\t\t\tB: t,\n\t\t}\n\tcase bool:\n\t\treturn &SDK.AttributeValue{\n\t\t\tBOOL: pointers.Bool(t),\n\t\t}\n\tcase []string:\n\t\treturn &SDK.AttributeValue{\n\t\t\tSS: createPointerSliceString(t),\n\t\t}\n\tcase [][]byte:\n\t\treturn &SDK.AttributeValue{\n\t\t\tBS: t,\n\t\t}\n\tcase []int, []int32, []int64, []uint, []uint32, []uint64, []float32, []float64:\n\t\treturn &SDK.AttributeValue{\n\t\t\tNS: MarshalStringSlice(t),\n\t\t}\n\tcase []map[string]interface{}:\n\t\treturn &SDK.AttributeValue{\n\t\t\tL: createPointerMap(v.([]map[string]interface{})),\n\t\t}\n\t}\n\n\tk := reflect.ValueOf(v)\n\tswitch {\n\tcase k.Kind() == reflect.Map:\n\t\treturn &SDK.AttributeValue{\n\t\t\tM: Marshal(v.(map[string]interface{})),\n\t\t}\n\t}\n\treturn &SDK.AttributeValue{}\n}", "title": "" }, { "docid": "5f9504b25f4a44617712f209a0d2dc05", "score": "0.4630478", "text": "func (a *Attribute) Value() interface{} {\n\treturn a.value\n}", "title": "" }, { "docid": "d31299edec30c0e2dce9c7a6a71db136", "score": "0.46141985", "text": "func (s *Sensor) ReadAttr(attr string) (string, error) {\n\ta, err := ioutil.ReadFile(filepath.Join(basePath, iioBasePath, s.Path, attr))\n\tif err != nil {\n\t\treturn \"\", errors.Wrapf(err, \"error reading attribute %q of %v\", attr, s.Path)\n\t}\n\treturn strings.TrimSpace(string(a)), nil\n}", "title": "" }, { "docid": "760d70839278210e2c3339be41242227", "score": "0.4608353", "text": "func loadAttr(val reflect.Value, str string) error {\n\tswitch val.Interface().(type) {\n\tcase string:\n\t\tval.SetString(str)\n\n\tcase int:\n\t\tnum, err := strconv.ParseInt(str, 10, 64)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tval.SetInt(num)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "43afc10c9047cfcd5824207f3ee996c5", "score": "0.46050972", "text": "func (a *Attributes) Get(key, typ string) (interface{}, error) {\n\ta.ensureMap()\n\n\tswitch strings.ToLower(typ) {\n\tcase \"int\":\n\t\ti64, err := strconv.ParseInt(a.values[key], 10, 0)\n\t\tif err != nil {\n\t\t\treturn nil, fmt.Errorf(\"key %q is not an integer: %w\", key, err)\n\t\t}\n\t\treturn int(i64), nil\n\tcase \"str\", \"string\":\n\t\treturn a.values[key], nil\n\tcase \"bool\", \"boolean\":\n\t\tb, err := strconv.ParseBool(a.values[key])\n\t\tif err != nil {\n\t\t\treturn nil, fmt.Errorf(\"key %q is not a boolean: %w\", key, err)\n\t\t}\n\t\treturn b, nil\n\tcase \"strarray\":\n\t\tdata := strings.Split(a.values[key], \"|\")\n\t\treturn data, nil\n\tdefault:\n\t\treturn nil, fmt.Errorf(\"invalid type %q\", key)\n\t}\n}", "title": "" }, { "docid": "60c9dec183319adf444155dc85e070e9", "score": "0.46049404", "text": "func TestAttributeValueMarshal(t *testing.T) {\n\ts := []string{\n\t\t`{\"S\":\"a string\"}`,\n\t\t`{\"B\":\"aGkgdGhlcmUK\"}`,\n\t\t`{\"N\":\"5\"}`,\n\t\t`{\"BOOL\":true}`,\n\t\t`{\"NULL\":false}`,\n\t\t`{\"SS\":[\"a\",\"b\",\"c\",\"c\",\"c\"]}`,\n\t\t`{\"BS\":[\"aGkgdGhlcmUK\",\"aG93ZHk=\",\"d2VsbCBoZWxsbyB0aGVyZQ==\"]}`,\n\t\t`{\"NS\":[\"42\",\"1\",\"0\",\"0\",\"1\",\"1\",\"1\",\"42\"]}`,\n\t\t`{\"L\":[{\"S\":\"a string\"},{\"L\":[{\"S\":\"another string\"}]}]}`,\n\t\t`{\"M\":{\"key1\":{\"S\":\"a string\"},\"key2\":{\"L\":[{\"NS\":[\"42\",\"42\",\"1\"]},{\"S\":\"a string\"},{\"L\":[{\"S\":\"another string\"}]}]}}}`,\n\t}\n\tfor _, v := range s {\n\t\t_ = fmt.Sprintf(\"--------\\n\")\n\t\t_ = fmt.Sprintf(\"IN:%v\\n\", v)\n\t\tvar a AttributeValue\n\t\tum_err := json.Unmarshal([]byte(v), &a)\n\t\tif um_err != nil {\n\t\t\t_ = fmt.Sprintf(\"%v\\n\", um_err)\n\t\t\tt.Errorf(\"cannot unmarshal\\n\")\n\t\t}\n\n\t\tjson, jerr := json.Marshal(a)\n\t\tif jerr != nil {\n\t\t\t_ = fmt.Sprintf(\"%v\\n\", jerr)\n\t\t\tt.Errorf(\"cannot marshal\\n\")\n\t\t\treturn\n\t\t}\n\t\t_ = fmt.Sprintf(\"OUT:%v\\n\", string(json))\n\t}\n}", "title": "" }, { "docid": "7c07f06a6baffa796d19564f9b0977e7", "score": "0.46025443", "text": "func AttributeValueToString(attr pdata.AttributeValue, jsonLike bool) string {\n\tswitch attr.Type() {\n\tcase pdata.AttributeValueNULL:\n\t\tif jsonLike {\n\t\t\treturn \"null\"\n\t\t}\n\t\treturn \"\"\n\tcase pdata.AttributeValueSTRING:\n\t\tif jsonLike {\n\t\t\treturn fmt.Sprintf(\"%q\", attr.StringVal())\n\t\t}\n\t\treturn attr.StringVal()\n\n\tcase pdata.AttributeValueBOOL:\n\t\treturn strconv.FormatBool(attr.BoolVal())\n\n\tcase pdata.AttributeValueDOUBLE:\n\t\treturn strconv.FormatFloat(attr.DoubleVal(), 'f', -1, 64)\n\n\tcase pdata.AttributeValueINT:\n\t\treturn strconv.FormatInt(attr.IntVal(), 10)\n\n\tcase pdata.AttributeValueMAP:\n\t\t// OpenCensus attributes cannot represent maps natively. Convert the\n\t\t// map to a JSON-like string.\n\t\tvar sb strings.Builder\n\t\tsb.WriteString(\"{\")\n\t\tm := attr.MapVal()\n\t\tfirst := true\n\t\tm.ForEach(func(k string, v pdata.AttributeValue) {\n\t\t\tif !first {\n\t\t\t\tsb.WriteString(\",\")\n\t\t\t}\n\t\t\tfirst = false\n\t\t\tsb.WriteString(fmt.Sprintf(\"%q:%s\", k, AttributeValueToString(v, true)))\n\t\t})\n\t\tsb.WriteString(\"}\")\n\t\treturn sb.String()\n\n\tdefault:\n\t\treturn fmt.Sprintf(\"<Unknown OpenTelemetry attribute value type %q>\", attr.Type())\n\t}\n\n\t// TODO: Add support for ARRAY type.\n}", "title": "" }, { "docid": "f9844711bbe6ece03cb162077674d4be", "score": "0.46000966", "text": "func (xp *XPath) ForEachAttrValue(exp string, attributes ...string) (values []string, errorlist []error) {\n\n\tinames, errlist := xp.ForEachEx(exp, func(result types.XPathResult) []interface{} {\n\t\tvar ir []interface{}\n\t\tfor iter := result.NodeIter(); iter.Next(); {\n\t\t\tele := iter.Node().(types.Element)\n\t\t\tfor _, attr := range attributes {\n\t\t\t\tattribute, err := ele.GetAttribute(attr)\n\t\t\t\tif err != nil {\n\t\t\t\t\tlog.Println(err)\n\t\t\t\t}\n\t\t\t\tir = append(ir, attribute.Value())\n\t\t\t}\n\t\t}\n\t\treturn ir\n\t})\n\n\tfor _, i := range inames {\n\t\tvalues = append(values, i.(string))\n\t}\n\n\treturn values, errlist\n}", "title": "" }, { "docid": "23b7efb2d591573dfc8ba05b337f840a", "score": "0.4596648", "text": "func (m *UserAttributeValuesItem) GetName()(*string) {\n return m.name\n}", "title": "" }, { "docid": "1005cdc7019b3a092cc6e4c191df2f51", "score": "0.4593583", "text": "func (obj *AbstractAttribute) GetValue() interface{} {\n\treturn obj.getValue()\n}", "title": "" }, { "docid": "8f074ae4fee67a0165e9ae23771087d7", "score": "0.45908543", "text": "func (j *JSONBlockStreamFmtReader) readStringQuotedCheck(builder *strings.Builder, quote byte) (string, error) {\n\tbuf, err := j.zReader.ReadNextBuffer()\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\n\tif buf[0] == quote {\n\t\tbuilder.WriteByte(buf[0])\n\t\tj.zReader.UnreadCurrentBuffer(len(buf) - 1)\n\t\treturn j.readStringUntilQuoteCont(builder, quote)\n\t}\n\n\tj.zReader.UnreadCurrentBuffer(len(buf))\n\treturn builder.String(), nil\n}", "title": "" }, { "docid": "c095c30b83a690403b13e400dbb59b36", "score": "0.45817932", "text": "func (p *HTMLParser) ParseAttribute() (string, string) {\n\tname := p.Parser.ConsumeName()\n\tp.assertStringParsed(p.Parser.ConsumeChar(), \"=\")\n\tvalue := p.ConsumeAttributeValue()\n\treturn name, value\n}", "title": "" }, { "docid": "4c3b891038dcc65df6b8f509ce3ea361", "score": "0.45745438", "text": "func (s AccessControlAttributeValue) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "c17f0492f630fce3bfae6f01dd52b595", "score": "0.45653975", "text": "func Value(ctx context.Context, tfType tftypes.Value, attrType attr.Type) (attr.Value, error) {\n\tif attrType == nil {\n\t\treturn nil, fmt.Errorf(\"unable to convert tftypes.Value (%s) to attr.Value: missing attr.Type\", tfType.String())\n\t}\n\n\tattrValue, err := attrType.ValueFromTerraform(ctx, tfType)\n\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"unable to convert tftypes.Value (%s) to attr.Value: %w\", tfType.String(), err)\n\t}\n\n\treturn attrValue, nil\n}", "title": "" }, { "docid": "9ce997c43d89f593274bba5cab5e5a30", "score": "0.45589253", "text": "func GetValFromNameVal(namevalpair string) string {\r\n\tvar i int\r\n\tvar idx int\r\n\tvar C string // char\r\n\tvar result string\r\n\tvar nv string // shortform for namevaluepair\r\n\r\n\tresult = \"\";\r\n\tif namevalpair == \"\" { return result }\r\n\tnv = namevalpair\r\n\tidx = strings.Index(nv, \"=\")\r\n\r\n\tif idx == -1 {\r\n\t\treturn \"\" // note: could return error\r\n\t}\r\n\r\n\tidx++ // skip equal\r\n\ti = idx // set to a character after =\r\n\r\n\tif isChar(nv[i], `\"`, `'`) {\r\n\t\tC = string(nv[i])\r\n\t\ti++ // Skip current character\r\n\t} else {\r\n\t\tC = \" \"\r\n\t}\r\n\r\n\tidx = i\r\n\tfor string(nv[i])!=C {\r\n\t\ti++\r\n\t\tif i == len(nv) { break }\r\n\t}\r\n\r\n\tif i != idx {\r\n\t\tresult = nv[idx:i]\r\n\t} else {\r\n\t\tresult = \"\"\r\n\t}\r\n\r\n\treturn result\r\n}", "title": "" }, { "docid": "28ad40294a6974b790fb7d112fcb3ccd", "score": "0.45557114", "text": "func (o *Logout) ValueForAttribute(name string) interface{} {\n\n\tswitch name {\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "2584bc66d9b2281b88ca4c234f5f4177", "score": "0.45505875", "text": "func getAttrValue(n *html.Node, tag string, attr string, values *[]string) {\n\tif n.Type == html.ElementNode && n.Data == tag {\n\t\tfor _, a := range n.Attr {\n\t\t\tif a.Key == attr {\n\t\t\t\t*values = append(*values, a.Val)\n\t\t\t\tbreak\n\t\t\t}\n\t\t}\n\t}\n\tfor c := n.FirstChild; c != nil; c = c.NextSibling {\n\t\tgetAttrValue(c, tag, attr, values)\n\t}\n}", "title": "" }, { "docid": "84ae17317b48b8cc4eacff445672b5e7", "score": "0.45500407", "text": "func parseMetricValue(metricsEndpoint string, metricName string) string {\n\tr := strings.NewReader(metricsEndpoint)\n\tscan := bufio.NewScanner(r)\n\tfor scan.Scan() {\n\t\tmetricLine := scan.Text()\n\t\tif strings.HasPrefix(metricLine, metricName) {\n\t\t\tsplit := strings.Split(metricLine, \" \")\n\t\t\treturn split[1]\n\t\t}\n\t}\n\treturn \"\"\n}", "title": "" }, { "docid": "e71565ece1e4f97f880d462ced3f8fbb", "score": "0.454884", "text": "func DDBAttributeFromKey(input string) (DDBAttribute, error) {\n\tattrs := regexpMatchAttribute.FindStringSubmatch(input)\n\tif len(attrs) == 0 {\n\t\treturn DDBAttribute{}, fmt.Errorf(\"parse attribute from key: %s\", input)\n\t}\n\tupperString := strings.ToUpper(attrs[2])\n\treturn DDBAttribute{\n\t\tName: &attrs[1],\n\t\tDataType: &upperString,\n\t}, nil\n}", "title": "" }, { "docid": "a971f7e08668883aa11b06a49452d367", "score": "0.4547457", "text": "func Escaped(key, val string) PropertyXML {\n\treturn PropertyXML{\n\t\tXMLName: xml.Name{Space: \"\", Local: key},\n\t\tLang: \"\",\n\t\tInnerXML: xmlEscaped(val),\n\t}\n}", "title": "" }, { "docid": "348d8b330acbdb9e73ff63ef2aefdf7a", "score": "0.4545383", "text": "func getXMLAttribute(atts []xml.Attr, name string) *string {\n\tfor _, a := range atts {\n\t\tif a.Name.Local == name {\n\t\t\treturn &a.Value\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "c4681250b7c0dc7af4a29582b3675a31", "score": "0.45424223", "text": "func (o *GraphEdge) ValueForAttribute(name string) interface{} {\n\n\tswitch name {\n\tcase \"ID\":\n\t\treturn o.ID\n\tcase \"acceptedFlows\":\n\t\treturn o.AcceptedFlows\n\tcase \"bucketDay\":\n\t\treturn o.BucketDay\n\tcase \"bucketHour\":\n\t\treturn o.BucketHour\n\tcase \"bucketMinute\":\n\t\treturn o.BucketMinute\n\tcase \"bucketMonth\":\n\t\treturn o.BucketMonth\n\tcase \"destinationController\":\n\t\treturn o.DestinationController\n\tcase \"destinationID\":\n\t\treturn o.DestinationID\n\tcase \"destinationType\":\n\t\treturn o.DestinationType\n\tcase \"encrypted\":\n\t\treturn o.Encrypted\n\tcase \"firstSeen\":\n\t\treturn o.FirstSeen\n\tcase \"flowID\":\n\t\treturn o.FlowID\n\tcase \"lastSeen\":\n\t\treturn o.LastSeen\n\tcase \"namespace\":\n\t\treturn o.Namespace\n\tcase \"observedAcceptedFlows\":\n\t\treturn o.ObservedAcceptedFlows\n\tcase \"observedEncrypted\":\n\t\treturn o.ObservedEncrypted\n\tcase \"observedRejectedFlows\":\n\t\treturn o.ObservedRejectedFlows\n\tcase \"rejectedFlows\":\n\t\treturn o.RejectedFlows\n\tcase \"remoteNamespace\":\n\t\treturn o.RemoteNamespace\n\tcase \"sourceController\":\n\t\treturn o.SourceController\n\tcase \"sourceID\":\n\t\treturn o.SourceID\n\tcase \"sourceType\":\n\t\treturn o.SourceType\n\tcase \"zHash\":\n\t\treturn o.ZHash\n\tcase \"zone\":\n\t\treturn o.Zone\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "201d7d06ef876c3eaad2590d931a0cfa", "score": "0.45331636", "text": "func (c *Context) GetAttribute(key Any) Any{\n return c.attributes[key]\n}", "title": "" }, { "docid": "6af2f11ed0600b6feee0d79cb7c6d4b3", "score": "0.45123643", "text": "func getAttr(n *html.Node, name, val, attr string) string {\n\tisDesired := false\n\tfor _, a := range n.Attr {\n\t\tif a.Key == name && a.Val == val {\n\t\t\tisDesired = true\n\t\t\tbreak\n\t\t}\n\t}\n\tif isDesired == true {\n\t\tfor _, a := range n.Attr {\n\t\t\tif a.Key == attr {\n\t\t\t\treturn a.Val\n\t\t\t}\n\t\t}\n\t}\n\n\treturn \"\"\n}", "title": "" }, { "docid": "320e5de3b47719e682bd080c171686b6", "score": "0.45112208", "text": "func (s AssetService) GetAttributeWithDim(tag, attribute string, dimension int) (string, error) {\n\tasset, _, err := s.Get(tag)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\n\tdim := fmt.Sprintf(\"%d\", dimension)\n\tvalue, ok := asset.Attributes[dim][attribute]\n\tif !ok {\n\t\treturn \"\", fmt.Errorf(\"Asset does not have attribute %s.\", attribute)\n\t}\n\treturn value, nil\n}", "title": "" }, { "docid": "49771b48630f6e03c5fb8232c0ec0bd1", "score": "0.45096153", "text": "func (c *ControlBase) Attribute(name string) string {\n\treturn c.attributes.Get(name)\n}", "title": "" }, { "docid": "f1652b438ce80a58bd4eac487e7a3b6d", "score": "0.45095566", "text": "func lexDubQuotedKey(lx *lexer) stateFn {\n\tr := lx.peek()\n\tif r == dqStringEnd {\n\t\tlx.emit(itemKey)\n\t\tlx.next()\n\t\treturn lexSkip(lx, lexKeyEnd)\n\t} else if r == eof {\n\t\tif lx.pos > lx.start {\n\t\t\treturn lx.errorf(\"Unexpected EOF.\")\n\t\t}\n\t\tlx.emit(itemEOF)\n\t\treturn nil\n\t}\n\tlx.next()\n\treturn lexDubQuotedKey\n}", "title": "" }, { "docid": "37895f699c170f734512602242e3872d", "score": "0.45089114", "text": "func (m *MockPKCS11Ctx) GetAttributeValue(arg0 pkcs11.SessionHandle, arg1 pkcs11.ObjectHandle, arg2 []*pkcs11.Attribute) ([]*pkcs11.Attribute, error) {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"GetAttributeValue\", arg0, arg1, arg2)\n\tret0, _ := ret[0].([]*pkcs11.Attribute)\n\tret1, _ := ret[1].(error)\n\treturn ret0, ret1\n}", "title": "" } ]
f86e9380242dc09ade3cb879b95378d0
Equal indicates whether the contents of the two sources are the same.
[ { "docid": "5d827439b0aecd68ec8efa6160033613", "score": "0.6715947", "text": "func (s X509SignSrc) Equal(o X509SignSrc) bool {\n\treturn s.IA.Equal(o.IA) &&\n\t\ts.Base == o.Base &&\n\t\ts.Serial == o.Serial &&\n\t\tbytes.Equal(s.SubjectKeyID, o.SubjectKeyID)\n}", "title": "" } ]
[ { "docid": "f63c7a6312c559e9d63d1f30d1eb3ff5", "score": "0.65382814", "text": "func (m Metadata) Equal(other Metadata) bool {\n\treturn m.Pipelines.Equal(other.Pipelines)\n}", "title": "" }, { "docid": "14b43b6b06acee3b4b3d91ec1672d09f", "score": "0.6527145", "text": "func (sms StagedMetadatas) Equal(other StagedMetadatas) bool {\n\tif len(sms) != len(other) {\n\t\treturn false\n\t}\n\tfor i := range sms {\n\t\tif !sms[i].Equal(other[i]) {\n\t\t\treturn false\n\t\t}\n\t}\n\treturn true\n}", "title": "" }, { "docid": "4364187b468d4f3cec3f8e538fd75220", "score": "0.6526034", "text": "func (source *ApplicationSource) Equals(other ApplicationSource) bool {\n\treturn reflect.DeepEqual(*source, other)\n}", "title": "" }, { "docid": "2256c4a171492010520f01f305da1a4b", "score": "0.6450463", "text": "func Equal(lhs, rhs io.Reader) bool {\n\t// Default buffer length, as used in io.Copy implementation.\n\treturn equal(lhs, rhs, 32*1024)\n}", "title": "" }, { "docid": "24f75fb7bab9551a9e8fdd3409e8aa46", "score": "0.6386063", "text": "func (sm StagedMetadata) Equal(other StagedMetadata) bool {\n\treturn sm.Metadata.Equal(other.Metadata) &&\n\t\tsm.CutoverNanos == other.CutoverNanos &&\n\t\tsm.Tombstoned == other.Tombstoned\n}", "title": "" }, { "docid": "7731bebc0d49a0170c0793a67534a7f5", "score": "0.63748264", "text": "func Equal(a []byte, b []byte) 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}", "title": "" }, { "docid": "1e4f4923f2af571051a68595acfd0ece", "score": "0.63629776", "text": "func (o1 *DecodeOutput) Equal(o2 *DecodeOutput) bool {\n\tif o1.Result != nil && o2.Result != nil {\n\t\treturn reflect.DeepEqual(o1.Result, o2.Result)\n\t}\n\treturn o1.Error != \"\" && o2.Error != \"\"\n}", "title": "" }, { "docid": "5632b6c4ca338f4bea4efcf74dad65ed", "score": "0.6353138", "text": "func Equal(x, y []byte) bool {\n\treturn subtle.ConstantTimeCompare(x, y) == 1\n}", "title": "" }, { "docid": "daeeffa936fac0e509ad30698e952060", "score": "0.6341999", "text": "func CollectorsEqual(mc1, mc2 netproto.MirrorCollector) bool {\n\tif mc1.ExportCfg.Destination != mc2.ExportCfg.Destination {\n\t\treturn false\n\t}\n\tif mc1.ExportCfg.Gateway != mc2.ExportCfg.Gateway {\n\t\treturn false\n\t}\n\tif mc1.Type != mc2.Type {\n\t\treturn false\n\t}\n\tif mc1.StripVlanHdr != mc2.StripVlanHdr {\n\t\treturn false\n\t}\n\treturn true\n}", "title": "" }, { "docid": "ace1eff88601a94c0fbff0aa8302f6aa", "score": "0.63113046", "text": "func Equal(x, y []byte) bool {\n\treturn csubtle.ConstantTimeCompare(x, y) == 1\n}", "title": "" }, { "docid": "e5a9821b51d41856fb3ab291d827d9f6", "score": "0.6299911", "text": "func (fs FileStruct) Equal(ca FileStruct) bool {\n\tif fs.Checksum == \"\" || ca.Checksum == \"\" {\n\t\treturn false\n\t}\n\treturn (fs.Size == ca.Size) && (fs.Checksum == ca.Checksum)\n}", "title": "" }, { "docid": "9548b672eb43c3d1b221db0735f1c65a", "score": "0.6288651", "text": "func (s LuaLoad) Equal(t LuaLoad, opts ...Options) bool {\n\tif !equalPointers(s.File, t.File) {\n\t\treturn false\n\t}\n\n\treturn true\n}", "title": "" }, { "docid": "70a6af2cdef2a6d6db2fae76ac197e4d", "score": "0.62124807", "text": "func (o1 *EncodeOutput) Equal(o2 *EncodeOutput) bool {\n\tif o1.Result != nil && o2.Result != nil {\n\t\treturn reflect.DeepEqual(o1.Result, o2.Result)\n\t}\n\treturn o1.Error != \"\" && o2.Error != \"\"\n}", "title": "" }, { "docid": "db80b323ebc62fb8fef2bf9d3245441b", "score": "0.6191063", "text": "func (source ApplicationSource) Equals(other ApplicationSource) bool {\n\treturn source.TargetRevision == other.TargetRevision &&\n\t\tsource.RepoURL == other.RepoURL &&\n\t\tsource.Path == other.Path &&\n\t\tsource.Environment == other.Environment\n}", "title": "" }, { "docid": "72bf78a3f9b52092c31e27f766b977aa", "score": "0.61667407", "text": "func Equal(ls, o Labels) bool {\n\treturn ls.data == o.data\n}", "title": "" }, { "docid": "dcb519de40d5757303779b04306a3b30", "score": "0.61565727", "text": "func Equal(r Record, s Record) bool {\n\tif r.Info != s.Info {\n\t\treturn false\n\t}\n\treturn uio.ReaderAtEqual(r.ReaderAt, s.ReaderAt)\n}", "title": "" }, { "docid": "33bc1f5f82871b7c5d701ffb454be454", "score": "0.61372375", "text": "func Equal(a, b []byte) bool {\n\tif len(a) != len(b) {\n\t\treturn false\n\t}\n\n\tfor i, v := range a {\n\t\tif v != b[i] {\n\t\t\treturn false\n\t\t}\n\t}\n\n\treturn true\n}", "title": "" }, { "docid": "ca7fc916dd298178a2e19f2f77d8c050", "score": "0.6130166", "text": "func (f *Frame) Equal(o *Frame) bool { return f.r == o.r && bytes.Equal(f.b, o.b) }", "title": "" }, { "docid": "5cff4af2aeb0a526c0530c0a7e3559ab", "score": "0.61053586", "text": "func (dd diffData) Equal(i, j int) bool {\n\tif (*dd.a)[i].letter != (*dd.b)[j].letter {\n\t\treturn false\n\t}\n\tif !posEqual((*dd.a)[i].pos, (*dd.b)[j].pos) {\n\t\treturn false\n\t}\n\treturn nodeBranchesEqual((*dd.a)[i].leaf, (*dd.b)[j].leaf)\n}", "title": "" }, { "docid": "0f246f4490161ba5f8f9fabcb0d3d21e", "score": "0.61047524", "text": "func (m Lvl1Meta) Equal(other Lvl1Meta) bool {\n\treturn m.Epoch.Equal(other.Epoch) && m.SrcIA.Equal(other.SrcIA) && m.DstIA.Equal(other.DstIA)\n}", "title": "" }, { "docid": "63f0081ebe8a45f0e7be2e0956723b24", "score": "0.6098382", "text": "func Equal(x, y interface{}) bool {\n\tseen := make(map[comparison]bool)\n\treturn equal(reflect.ValueOf(x), reflect.ValueOf(y), seen)\n}", "title": "" }, { "docid": "4cd01ec7fde6b27f86844c8715800b4d", "score": "0.6084899", "text": "func (t *TransactionPayload) Equal(other *TransactionPayload) bool {\n\tif !bytes.Equal(t.Anchor, other.Anchor) {\n\t\treturn false\n\t}\n\n\tif len(t.Nullifiers) != len(other.Nullifiers) {\n\t\treturn false\n\t}\n\n\tfor i := range t.Nullifiers {\n\t\tif !bytes.Equal(t.Nullifiers[i], other.Nullifiers[i]) {\n\t\t\treturn false\n\t\t}\n\t}\n\n\tif !t.Crossover.Equal(other.Crossover) {\n\t\treturn false\n\t}\n\n\tif len(t.Notes) != len(other.Notes) {\n\t\treturn false\n\t}\n\n\tfor i := range t.Notes {\n\t\tif !t.Notes[i].Equal(other.Notes[i]) {\n\t\t\treturn false\n\t\t}\n\t}\n\n\tif !bytes.Equal(t.SpendingProof, other.SpendingProof) {\n\t\treturn false\n\t}\n\n\treturn bytes.Equal(t.CallData, other.CallData)\n}", "title": "" }, { "docid": "c4fe7b538fc27dab2cfaf39c41124647", "score": "0.60830104", "text": "func (ref RecordRef) Equal(other RecordRef) bool {\n\treturn ref == other\n}", "title": "" }, { "docid": "c4fe7b538fc27dab2cfaf39c41124647", "score": "0.60830104", "text": "func (ref RecordRef) Equal(other RecordRef) bool {\n\treturn ref == other\n}", "title": "" }, { "docid": "d85952bf8ae70c59baee6a2563c24d54", "score": "0.60688704", "text": "func equal(source string, got []Item, expect []typeText) bool {\n\tif len(got) != len(expect) {\n\t\treturn false\n\t}\n\tsourceb := []byte(source)\n\tfor k := range got {\n\t\tg := got[k]\n\t\te := expect[k]\n\t\tif g.Type != e.typ {\n\t\t\treturn false\n\t\t}\n\n\t\tvar s string\n\t\tif g.Err != nil {\n\t\t\ts = g.Err.Error()\n\t\t} else {\n\t\t\ts = string(g.Val(sourceb))\n\t\t}\n\n\t\tif s != e.text {\n\t\t\treturn false\n\t\t}\n\n\t}\n\treturn true\n}", "title": "" }, { "docid": "d23aa48c1042a43c569ee1f511929678", "score": "0.6060711", "text": "func (c GeneralDataCoding) Equal(b DataCoding) bool {\n\ta, ok := b.(GeneralDataCoding)\n\tif !ok {\n\t\treturn false\n\t}\n\tif a.AutoDelete != c.AutoDelete {\n\t\treturn false\n\t}\n\tif a.Compressed != c.Compressed {\n\t\treturn false\n\t}\n\tif a.MsgClass != c.MsgClass {\n\t\treturn false\n\t}\n\tif a.MsgCharset != c.MsgCharset {\n\t\treturn false\n\t}\n\treturn true\n}", "title": "" }, { "docid": "cb065ebea18a35672e2bc34cd74cfac8", "score": "0.6058226", "text": "func (fAccess *FileAccessControl) Equal(fA2 *FileAccessControl) bool {\n\n if fAccess.isInitialized != fA2.isInitialized {\n return false\n }\n\n if !fAccess.fileOpenCodes.Equal(&fA2.fileOpenCodes) {\n return false\n }\n\n if !fAccess.permissions.Equal(&fA2.permissions) {\n return false\n }\n\n return true\n}", "title": "" }, { "docid": "b99b7928c79455106061e8ed83a313a1", "score": "0.60497075", "text": "func (o *ObjectInfo) Equal(that *ObjectInfo) bool {\n\treturn o == that ||\n\t\to.Identification == that.Identification ||\n\t\to.Content == that.Content\n}", "title": "" }, { "docid": "d9be42a6e78d3733dc1f1e1f1cc69f81", "score": "0.6027096", "text": "func Equal(a, b string) bool {\n\treturn a == b\n}", "title": "" }, { "docid": "5850d784f2ca94952af61ed24656e233", "score": "0.60006034", "text": "func (o Object) Equal(other Object) bool {\n\treturn o.equals(other, true)\n}", "title": "" }, { "docid": "302c406b93f03438cf4a2b5555e20ff3", "score": "0.5990524", "text": "func equal(a, b interface{}) bool {\n\treturn reflect.DeepEqual(a, b)\n}", "title": "" }, { "docid": "6e0ec90029aa2a734d7e9710d775544d", "score": "0.5984001", "text": "func Equal(a, b []byte) bool {\n\treturn subtle.ConstantTimeCompare(a, b) == 1\n}", "title": "" }, { "docid": "754f2bc504379eada05d576232feee33", "score": "0.5976218", "text": "func Equal(s1 []interface{}, s2 []interface{}) bool {\n\treturn EqualWith(s1, s2, func(i, j interface{}) bool {\n\t\treturn i == j\n\t})\n}", "title": "" }, { "docid": "e2e5877e8e2406fb9135ec71b5c3f663", "score": "0.5922845", "text": "func (git1 *Git) Equal(git2 *Git) bool {\n\tif git1.URL != git2.URL ||\n\t\tgit1.AccessToken != git2.AccessToken ||\n\t\tgit1.Config != git2.Config {\n\t\treturn false\n\t}\n\treturn true\n}", "title": "" }, { "docid": "b75809e08e7b70abe8f14d7083695f4c", "score": "0.59035856", "text": "func Equal(lhs, rhs []string) bool {\n\tif len(lhs) != len(rhs) {\n\t\treturn false\n\t}\n\tfor i := range lhs {\n\t\tif lhs[i] != rhs[i] {\n\t\t\treturn false\n\t\t}\n\t}\n\treturn true\n}", "title": "" }, { "docid": "0219d5d0bcdc9ec75829d17d063243b0", "score": "0.5894015", "text": "func (s H1CaseAdjust) Equal(t H1CaseAdjust, opts ...Options) bool {\n\tif !equalPointers(s.From, t.From) {\n\t\treturn false\n\t}\n\n\tif !equalPointers(s.To, t.To) {\n\t\treturn false\n\t}\n\n\treturn true\n}", "title": "" }, { "docid": "6aba1c84d7f9c3710f1eb256e7f3e404", "score": "0.5886706", "text": "func (s Template) Equal(a, b int64) bool {\n\treturn a == b\n}", "title": "" }, { "docid": "e44ff026643e85f987d92829cd4dd904", "score": "0.58825725", "text": "func (e *entry) equal(ne *entry) bool {\n\tif e.decoder != nil && e.decoder != ne.decoder {\n\t\treturn false\n\t}\n\treturn bytes.Equal(e.content, ne.content)\n}", "title": "" }, { "docid": "350ba40115d02c5541ed74d67200e07b", "score": "0.5878996", "text": "func Equal(t *testing.T, a, b interface{}, msgAndArgs ...interface{}) bool {\n\tt.Helper()\n\tif a != b {\n\t\tmsg := failureOutput(fmt.Sprintf(\"Not equal. Expected: %v Actual: %v\", a, b), msgAndArgs...)\n\t\tt.Error(msg)\n\t\treturn false\n\t}\n\treturn true\n}", "title": "" }, { "docid": "41da84beb115fde45222d031f6dc95da", "score": "0.58522224", "text": "func (sk *Skykey) equals(otherKey Skykey) bool {\n\treturn sk.Name == otherKey.Name && sk.equalData(otherKey)\n}", "title": "" }, { "docid": "0927bccaca87624d2be235eaee2e4a4e", "score": "0.5850736", "text": "func (f FromEq[T]) Equal(a, b T) bool { return f(a, b) }", "title": "" }, { "docid": "fcfe8ee3ccc21e1fcba4061558745391", "score": "0.58467424", "text": "func (u1 feedUpdate) Equal(u2 feedUpdate) bool {\n\tif u1.GUID != \"\" && u2.GUID != \"\" {\n\t\t// If GUIDs are available\n\t\tif u1.GUID == u2.GUID {\n\t\t\t// GUID same but link different is suspicious\n\t\t\treturn u1.Link == u2.Link\n\t\t}\n\t\t// Handle RSS Feeds regenerating GUIDs each call\n\t\tif u1.Link == u2.Link && u1.Title == u2.Title {\n\t\t\t// Suspicious, believe they are indeed the same\n\t\t\treturn true\n\t\t}\n\n\t\treturn false\n\t} else if u1.Link != \"\" && u2.Link != \"\" {\n\t\t// If Links are available\n\t\tif u1.Link == u2.Link && u1.Title == u2.Title {\n\t\t\t// Assume the Link+Title to be authorative\n\t\t\treturn true\n\t\t}\n\n\t\treturn false\n\t} else {\n\t\treturn u1.Title == u2.Title\n\t}\n}", "title": "" }, { "docid": "f1dbcd9d2d73ef82516813732d7976e1", "score": "0.5837552", "text": "func (a Link) Equal(b Link) bool {\n\treturn a.From.Equal(b.From) && a.To.Equal(b.To)\n}", "title": "" }, { "docid": "26c71b4e148080247b0231d9a6f9b57c", "score": "0.5836716", "text": "func (p1 *Promise) Equal(p2 *Promise) bool {\n\tif p1.RecipientKeyIndex != p2.RecipientKeyIndex {\n\t\treturn false\n\t}\n\tif p1.SenderKeyIndex != p2.SenderKeyIndex {\n\t\treturn false\n\t}\n\tif p1.SequenceIndex != p2.SequenceIndex {\n\t\treturn false\n\t}\n\treturn true\n}", "title": "" }, { "docid": "341410b04ed9f64c073ff9a9a21c4c5e", "score": "0.5831585", "text": "func (rt1 *Config) Equal(rt2 *Config) bool {\n\tif rt1 == rt2 {\n\t\treturn true\n\t}\n\tif rt1 == nil || rt2 == nil {\n\t\treturn false\n\t}\n\tif !(&rt1.Connections).Equal(&rt2.Connections) {\n\t\treturn false\n\t}\n\tif !(&rt1.RPM).Equal(&rt2.RPM) {\n\t\treturn false\n\t}\n\tif !(&rt1.RPS).Equal(&rt2.RPS) {\n\t\treturn false\n\t}\n\tif rt1.LimitRate != rt2.LimitRate {\n\t\treturn false\n\t}\n\tif rt1.LimitRateAfter != rt2.LimitRateAfter {\n\t\treturn false\n\t}\n\tif rt1.ID != rt2.ID {\n\t\treturn false\n\t}\n\tif rt1.Name != rt2.Name {\n\t\treturn false\n\t}\n\tif len(rt1.Whitelist) != len(rt2.Whitelist) {\n\t\treturn false\n\t}\n\n\treturn sets.StringElementsMatch(rt1.Whitelist, rt2.Whitelist)\n}", "title": "" }, { "docid": "7babea15d660596c95f7ec15bcc2a159", "score": "0.58275276", "text": "func (metadatas PipelineMetadatas) Equal(other PipelineMetadatas) bool {\n\tif len(metadatas) != len(other) {\n\t\treturn false\n\t}\n\tfor i := 0; i < len(metadatas); i++ {\n\t\tif !metadatas[i].Equal(other[i]) {\n\t\t\treturn false\n\t\t}\n\t}\n\treturn true\n}", "title": "" }, { "docid": "15d84f4a95e75472958efe48b0724492", "score": "0.5823218", "text": "func equalFiles(sf, sf2 *SiaFile) error {\n\t// Backup the metadata structs for both files.\n\tmd := sf.staticMetadata\n\tmd2 := sf2.staticMetadata\n\t// Compare the timestamps first since they can't be compared with\n\t// DeepEqual.\n\tif sf.staticMetadata.AccessTime.Unix() != sf2.staticMetadata.AccessTime.Unix() {\n\t\treturn errors.New(\"AccessTime's don't match\")\n\t}\n\tif sf.staticMetadata.ChangeTime.Unix() != sf2.staticMetadata.ChangeTime.Unix() {\n\t\treturn errors.New(\"ChangeTime's don't match\")\n\t}\n\tif sf.staticMetadata.CreateTime.Unix() != sf2.staticMetadata.CreateTime.Unix() {\n\t\treturn errors.New(\"CreateTime's don't match\")\n\t}\n\tif sf.staticMetadata.ModTime.Unix() != sf2.staticMetadata.ModTime.Unix() {\n\t\treturn errors.New(\"ModTime's don't match\")\n\t}\n\t// Set the timestamps to zero for DeepEqual.\n\tsf.staticMetadata.AccessTime = time.Time{}\n\tsf.staticMetadata.ChangeTime = time.Time{}\n\tsf.staticMetadata.CreateTime = time.Time{}\n\tsf.staticMetadata.ModTime = time.Time{}\n\tsf2.staticMetadata.AccessTime = time.Time{}\n\tsf2.staticMetadata.ChangeTime = time.Time{}\n\tsf2.staticMetadata.CreateTime = time.Time{}\n\tsf2.staticMetadata.ModTime = time.Time{}\n\t// Compare the rest of sf and sf2.\n\tif !reflect.DeepEqual(sf.staticMetadata, sf2.staticMetadata) {\n\t\tfmt.Println(sf.staticMetadata)\n\t\tfmt.Println(sf2.staticMetadata)\n\t\treturn errors.New(\"sf metadata doesn't equal sf2 metadata\")\n\t}\n\tif !reflect.DeepEqual(sf.pubKeyTable, sf2.pubKeyTable) {\n\t\tfmt.Println(sf.pubKeyTable)\n\t\tfmt.Println(sf2.pubKeyTable)\n\t\treturn errors.New(\"sf pubKeyTable doesn't equal sf2 pubKeyTable\")\n\t}\n\tif !reflect.DeepEqual(sf.staticChunks, sf2.staticChunks) {\n\t\tfmt.Println(len(sf.staticChunks), len(sf2.staticChunks))\n\t\tfmt.Println(\"sf1\", sf.staticChunks)\n\t\tfmt.Println(\"sf2\", sf2.staticChunks)\n\t\treturn errors.New(\"sf chunks don't equal sf2 chunks\")\n\t}\n\tif sf.siaFilePath != sf2.siaFilePath {\n\t\treturn fmt.Errorf(\"sf2 filepath was %v but should be %v\",\n\t\t\tsf2.siaFilePath, sf.siaFilePath)\n\t}\n\t// Restore the original metadata.\n\tsf.staticMetadata = md\n\tsf2.staticMetadata = md2\n\treturn nil\n}", "title": "" }, { "docid": "8db9302e5b23f16fc66f59ff5bb868ef", "score": "0.58163965", "text": "func (l *Series) Equal(b *Series) bool {\n\treturn l.str == b.str\n}", "title": "" }, { "docid": "1b9c1c17faa064051cf282fd8fd2be8c", "score": "0.58117574", "text": "func (modsec1 *Config) Equal(modsec2 *Config) bool {\n\tif modsec1 == modsec2 {\n\t\treturn true\n\t}\n\tif modsec1 == nil || modsec2 == nil {\n\t\treturn false\n\t}\n\tif modsec1.Enable != modsec2.Enable {\n\t\treturn false\n\t}\n\tif modsec1.EnableSet != modsec2.EnableSet {\n\t\treturn false\n\t}\n\tif modsec1.OWASPRules != modsec2.OWASPRules {\n\t\treturn false\n\t}\n\tif modsec1.TransactionID != modsec2.TransactionID {\n\t\treturn false\n\t}\n\tif modsec1.Snippet != modsec2.Snippet {\n\t\treturn false\n\t}\n\n\treturn true\n}", "title": "" }, { "docid": "1b9c1c17faa064051cf282fd8fd2be8c", "score": "0.58117574", "text": "func (modsec1 *Config) Equal(modsec2 *Config) bool {\n\tif modsec1 == modsec2 {\n\t\treturn true\n\t}\n\tif modsec1 == nil || modsec2 == nil {\n\t\treturn false\n\t}\n\tif modsec1.Enable != modsec2.Enable {\n\t\treturn false\n\t}\n\tif modsec1.EnableSet != modsec2.EnableSet {\n\t\treturn false\n\t}\n\tif modsec1.OWASPRules != modsec2.OWASPRules {\n\t\treturn false\n\t}\n\tif modsec1.TransactionID != modsec2.TransactionID {\n\t\treturn false\n\t}\n\tif modsec1.Snippet != modsec2.Snippet {\n\t\treturn false\n\t}\n\n\treturn true\n}", "title": "" }, { "docid": "1e866ad0bb225afc574c93d21e41c4b0", "score": "0.5809974", "text": "func (ws WithdrawInfos) Equal(other WithdrawInfos) bool {\n\tif len(ws) != len(other) {\n\t\treturn false\n\t}\n\n\tfor i := 0; i < len(ws); i++ {\n\t\tif !ws[i].Equal(other[i]) {\n\t\t\treturn false\n\t\t}\n\t}\n\treturn true\n}", "title": "" }, { "docid": "edbf4cfb4f2a3c63bd07bd7d7f2af20a", "score": "0.580943", "text": "func (m PipelineMetadata) Equal(other PipelineMetadata) bool {\n\treturn m.AggregationID.Equal(other.AggregationID) &&\n\t\tm.StoragePolicies.Equal(other.StoragePolicies) &&\n\t\tm.Pipeline.Equal(other.Pipeline) &&\n\t\tm.DropPolicy == other.DropPolicy &&\n\t\tm.ResendEnabled == other.ResendEnabled\n}", "title": "" }, { "docid": "1305042d58e9169fc10013a3cf2ebf76", "score": "0.58090556", "text": "func (fim FileIntegrityMeta) Equal(fimTarget FileIntegrityMeta) bool {\n\tif fim.Length != fimTarget.Length {\n\t\treturn false\n\t}\n\tif len(fim.Hashes) != len(fimTarget.Hashes) {\n\t\treturn false\n\t}\n\tfor algo, hash := range fim.Hashes {\n\t\th, ok := fimTarget.Hashes[algo]\n\t\tif !ok {\n\t\t\treturn false\n\t\t}\n\t\tif h != hash {\n\t\t\treturn false\n\t\t}\n\t}\n\treturn true\n}", "title": "" }, { "docid": "6614d61de0bc1421b663f554c4bb33a2", "score": "0.5796807", "text": "func (set *Set) Equal(other *Set) (ok bool) {\n\tif set == nil || other == nil {\n\t\treturn set == other\n\t} else if set.Len() != other.Len() {\n\t\treturn false\n\t}\n\n\tfor s := range set.m {\n\t\tif _, ok = other.m[s]; !ok {\n\t\t\treturn false\n\t\t}\n\t}\n\n\treturn true\n}", "title": "" }, { "docid": "3eba0ee1a2db3230bf6bb378eb6e8bb8", "score": "0.57952905", "text": "func (fr *FileRec) Equal(or *FileRec) bool {\n\tif fr.Size == or.Size && fr.Mtime == or.Mtime && fr.Sha1 == or.Sha1 && fr.Path == or.Path {\n\t\treturn true\n\t}\n\treturn false\n}", "title": "" }, { "docid": "78a090843aacfd3efa0dbda7fc1832d4", "score": "0.5792675", "text": "func (a *Vector2D) Equal(b *Vector2D) bool {\n\treturn *a == *b\n}", "title": "" }, { "docid": "e9ab33a6802f862f218989bdcae692f9", "score": "0.5776168", "text": "func (pssl1 *Config) Equal(pssl2 *Config) bool {\n\tif pssl1 == pssl2 {\n\t\treturn true\n\t}\n\tif pssl1 == nil || pssl2 == nil {\n\t\treturn false\n\t}\n\tif !(&pssl1.AuthSSLCert).Equal(&pssl2.AuthSSLCert) {\n\t\treturn false\n\t}\n\tif pssl1.Ciphers != pssl2.Ciphers {\n\t\treturn false\n\t}\n\tif pssl1.Protocols != pssl2.Protocols {\n\t\treturn false\n\t}\n\tif pssl1.Verify != pssl2.Verify {\n\t\treturn false\n\t}\n\tif pssl1.VerifyDepth != pssl2.VerifyDepth {\n\t\treturn false\n\t}\n\tif pssl1.ProxySSLServerName != pssl2.ProxySSLServerName {\n\t\treturn false\n\t}\n\treturn true\n}", "title": "" }, { "docid": "d6fd39c2e6f067c4fe5f2fd1d3665175", "score": "0.5775955", "text": "func Equal(a, b Value) bool {\n\tif a.Type() != b.Type() {\n\t\treturn false\n\t}\n\tswitch a.Type() {\n\tcase TypeObject, TypeArray:\n\t\treturn reflect.DeepEqual(a, b)\n\tcase TypeNumber:\n\t\treturn a.Number() == b.Number()\n\tcase TypeInteger:\n\t\treturn a.Integer() == b.Integer()\n\tcase TypeBoolean:\n\t\treturn a.Boolean() == b.Boolean()\n\tcase TypeNull:\n\t\treturn a.IsNull() == b.IsNull()\n\tcase TypeString:\n\t\treturn a.String() == b.String()\n\t}\n\treturn false\n}", "title": "" }, { "docid": "8f0e677c4d939fe92de2a5c754e3f98d", "score": "0.577409", "text": "func (dest ApplicationDestination) Equals(other ApplicationDestination) bool {\n\treturn reflect.DeepEqual(dest, other)\n}", "title": "" }, { "docid": "c142fc2be6e23d1b8bfedb78d0b7786e", "score": "0.5773774", "text": "func (c *ResourceConfig) Equal(c2 *ResourceConfig) bool {\n\t// If either are nil, then they're only equal if they're both nil\n\tif c == nil || c2 == nil {\n\t\treturn c == c2\n\t}\n\n\t// Sort the computed keys so they're deterministic\n\tsort.Strings(c.ComputedKeys)\n\tsort.Strings(c2.ComputedKeys)\n\n\t// Two resource configs if their exported properties are equal.\n\t// We don't compare \"raw\" because it is never used again after\n\t// initialization and for all intents and purposes they are equal\n\t// if the exported properties are equal.\n\tcheck := [][2]interface{}{\n\t\t{c.ComputedKeys, c2.ComputedKeys},\n\t\t{c.Raw, c2.Raw},\n\t\t{c.Config, c2.Config},\n\t}\n\tfor _, pair := range check {\n\t\tif !reflect.DeepEqual(pair[0], pair[1]) {\n\t\t\treturn false\n\t\t}\n\t}\n\n\treturn true\n}", "title": "" }, { "docid": "03c5b9f8a52895b79770dee3890252cf", "score": "0.5771852", "text": "func (cs *configsets) equals(other *configsets) bool {\n\treturn cs.cloud.IsEqual(other.cloud) &&\n\t\tcs.add.IsEqual(other.add) &&\n\t\tcs.del.IsEqual(other.del)\n}", "title": "" }, { "docid": "4519679a607ee4cde71617f582e9353f", "score": "0.577094", "text": "func (s SetBitRun) Equal(rhs SetBitRun) bool {\n\treturn s.Pos == rhs.Pos && s.Length == rhs.Length\n}", "title": "" }, { "docid": "93ccb3213aa0be76ba029c1c1fa93e60", "score": "0.5768119", "text": "func LinesEqual(t TestingT, expected, actual string, msgAndArgs ...interface{}) bool {\n\tif expected == actual {\n\t\treturn true\n\t}\n\treturn FailDiff(t, \"Strings differ\", diff(expected, actual), msgAndArgs...)\n}", "title": "" }, { "docid": "579511f09c18da314ff9d1c48f9ac3c1", "score": "0.5767657", "text": "func Equal(t *testing.T, obtained, expected interface{}, message ...interface{}) {\n\tif obtained != expected {\n\t\tt.Error(append(message, []interface{}{\n\t\t\t\"\\r\\t\",\n\t\t\tlineAndFile(2),\n\t\t\t\"obtained:\", obtained, \"\\n\",\n\t\t\t\"expected:\", expected, \"\\n\"}...)...)\n\t}\n}", "title": "" }, { "docid": "0a239976b25005dcf71d5d28694dc1e0", "score": "0.5760885", "text": "func Equal(a, b interface{}) bool {\n\treturn keyEqual(a, b)\n}", "title": "" }, { "docid": "99252163c267eff40b776dac662ee1a2", "score": "0.5760166", "text": "func (t TaskData) Equals(other TaskData) bool {\n\treturn reflect.DeepEqual(t, other)\n}", "title": "" }, { "docid": "3ba45aec6bdce2a4062d422cd0d39df8", "score": "0.575675", "text": "func (a *Action) Equal(b *Action) (e bool) {\n\te = false\n\n\tif a == nil && a == b {\n\t\te = true\n\t} else if a != nil && b != nil {\n\t\top := a.Operator() == b.Operator()\n\n\t\tsignature := false\n\t\taSign := a.Signature()\n\t\tbSign := b.Signature()\n\t\tif op {\n\t\t\tsignature = aSign.Oper == bSign.Oper && aSign.Func == bSign.Func\n\t\t}\n\n\t\tfun := false\n\t\tif signature {\n\t\t\tfun = reflect.ValueOf(a.Function()).Pointer() == reflect.ValueOf(b.Function()).Pointer()\n\t\t}\n\n\t\tparams := len(a.Parameters()) == len(b.Parameters())\n\t\tif fun && params {\n\t\t\tif aSign.Params != bSign.Params {\n\t\t\t\tta := container.NewTemplate(a.Parameters()...)\n\t\t\t\ttb := container.NewTemplate(b.Parameters()...)\n\t\t\t\tparams = params && (&ta).Equal(&tb)\n\t\t\t}\n\t\t}\n\n\t\te = op && signature && fun && params\n\t}\n\n\treturn e\n}", "title": "" }, { "docid": "779e12dc0c4dfd5f8888b8401f7646d0", "score": "0.5754758", "text": "func (v *Vector2) Equals(src *Vector2) bool {\n\treturn v.p.Call(\"equals\", src.p).Bool()\n}", "title": "" }, { "docid": "8d4b4cd311815abdb42a3bf169061b9b", "score": "0.5751707", "text": "func Equal(a, b Nodes) bool {\n\tif same(a, b) {\n\t\treturn true\n\t}\n\n\tif len(a) != len(b) {\n\t\treturn false\n\t}\n\n\tfor e := range a {\n\t\tif _, ok := b[e]; !ok {\n\t\t\treturn false\n\t\t}\n\t}\n\n\treturn true\n}", "title": "" }, { "docid": "57582a0825e9bca26ce7970e3ee5ff0a", "score": "0.5748278", "text": "func (sc *SmartContract) Equal(s *SmartContract) bool {\n\treturn reflect.DeepEqual(sc, s)\n}", "title": "" }, { "docid": "fc16d709b0fe677d06cd23815418c8ef", "score": "0.57457376", "text": "func (asm *ASM) Eq(dst, a, b Operand) {\n\tasm.addInstruction(&AxBxCx{OP_EQ, dst, a, b})\n}", "title": "" }, { "docid": "c750aee64cadcb876338e152b70c6a7b", "score": "0.5744337", "text": "func (f File) Equal(g File) bool {\n\tif f.IsRef() != g.IsRef() {\n\t\tpanic(fmt.Sprintf(\"cannot compare unresolved and resolved file: f(%v), g(%v)\", f, g))\n\t}\n\tif f.IsRef() || g.IsRef() {\n\t\t// When we compare references, we require nonempty etags.\n\t\tequal := f.Size == g.Size && f.Source == g.Source && f.ETag != \"\" && f.ETag == g.ETag\n\t\t// We require equal ContentHash if present in both\n\t\tif !f.ContentHash.IsZero() && !g.ContentHash.IsZero() && f.ContentHash.Name() == g.ContentHash.Name() {\n\t\t\treturn equal && f.ContentHash == g.ContentHash\n\t\t}\n\t\treturn equal\n\t}\n\treturn f.ID == g.ID\n}", "title": "" }, { "docid": "2b882d51cb3e1c7b8e9bd8478bb88d6c", "score": "0.5732982", "text": "func (s1 VertexSet) equals(s2 VertexSet) bool {\n\tif len(s1.set) != len(s2.set) {\n\t\treturn false\n\t}\n\tfor i, in := range s1.set {\n\t\tif in.a != s2.set[i].a || in.b != s2.set[i].b {\n\t\t\treturn false\n\t\t}\n\t}\n\treturn true\n}", "title": "" }, { "docid": "7ad27e57ad79644b534dd111a6471890", "score": "0.57299274", "text": "func (s *SliceFloat64) Equal(s2 *SliceFloat64) bool {\n\tif s == s2 {\n\t\treturn true\n\t}\n\n\tif s == nil || s2 == nil {\n\t\treturn false // has to be false because s == s2 tested earlier\n\t}\n\n\tif len(s.data) != len(s2.data) {\n\t\treturn false\n\t}\n\n\tfor i, elem := range s.data {\n\t\tif elem != s2.data[i] {\n\t\t\treturn false\n\t\t}\n\t}\n\n\treturn true\n}", "title": "" }, { "docid": "1c7093cb35d41ed1528f259266cab113", "score": "0.5728076", "text": "func (p Person) Equal(p2 Person) bool {\n\tresult := true\n\n\tif p.FirstName != p2.FirstName {\n\t\tresult = false\n\t} else if p.LastName != p2.LastName {\n\t\tresult = false\n\t} else if p.Birthday != p2.Birthday {\n\t\tresult = false\n\t} else if p.Gender != p2.Gender {\n\t\tresult = false\n\t} else if len(p.Likes) != len(p2.Likes) {\n\t\tresult = false\n\t} else if len(p.Dislikes) != len(p2.Dislikes) {\n\t\tresult = false\n\t}\n\n\tif result == true {\n\t\tif compareSlice(p.Likes, p2.Likes) == false {\n\t\t\tresult = false\n\t\t} else if compareSlice(p.Dislikes, p2.Dislikes) == false {\n\t\t\tresult = false\n\t\t}\n\t}\n\n\treturn result\n}", "title": "" }, { "docid": "98a65839c61df1acbb58eca71c19ee27", "score": "0.5724314", "text": "func (g *E) Equal(g2 *E) bool {\n\treturn g.equal(g2)\n}", "title": "" }, { "docid": "a8820cb19c26ab1deb95e5df9b713d8f", "score": "0.57239074", "text": "func Equal(s1, s2 []int) bool {\n\tif len(s1) != len(s2) {\n\t\treturn false\n\t}\n\tfor i, val := range s1 {\n\t\tif s2[i] != val {\n\t\t\treturn false\n\t\t}\n\t}\n\treturn true\n}", "title": "" }, { "docid": "20fd58b1f5a39699809893f0088418d9", "score": "0.5717965", "text": "func (o *Track) IsEqual(other *Track) bool {\n\treturn o.GetID() == other.GetID()\n}", "title": "" }, { "docid": "0dfe4d8d253d1f63f12e5db20a8eb3c6", "score": "0.570847", "text": "func (r *Record) Equals(r2 *Record) bool {\n\tif (r == nil && r2 != nil) || (r != nil && r2 == nil) {\n\t\treturn false\n\t}\n\tif r.BaseName != r2.BaseName {\n\t\treturn false\n\t}\n\tif r.BaseTime != r2.BaseTime {\n\t\treturn false\n\t}\n\tif r.BaseUnit != r2.BaseUnit {\n\t\treturn false\n\t}\n\tif r.Version != r2.Version {\n\t\treturn false\n\t}\n\tif r.Name != r2.Name {\n\t\treturn false\n\t}\n\tif r.Unit != r2.Unit {\n\t\treturn false\n\t}\n\tif r.Time != r2.Time {\n\t\treturn false\n\t}\n\tif r.UpdateTime != r2.UpdateTime {\n\t\treturn false\n\t}\n\n\tif r.Value != nil && r2.Value != nil && *r.Value == *r2.Value {\n\t\treturn true\n\t}\n\tif r.StringValue != \"\" && r.StringValue == r2.StringValue {\n\t\treturn true\n\t}\n\tif r.BoolValue != nil && r2.BoolValue != nil && *r.BoolValue == *r2.BoolValue {\n\t\treturn true\n\t}\n\tif r.Sum != nil && r2.Sum != nil && *r.Sum == *r2.Sum {\n\t\treturn true\n\t}\n\tif r.DataValue != nil && r2.DataValue != nil && len(r.DataValue) == len(r2.DataValue) {\n\t\tfor i := range r.DataValue {\n\t\t\tif r.DataValue[i] != r2.DataValue[i] {\n\t\t\t\treturn false\n\t\t\t}\n\t\t}\n\t\treturn true\n\t}\n\treturn false\n}", "title": "" }, { "docid": "1adcce6510cce2c5742203e6f91ef0fd", "score": "0.570454", "text": "func (n Nullable) Equal(n2 Nullable) bool {\n\tif n.IsNull || n2.IsNull {\n\t\treturn false\n\t}\n\tbsA, ok := n.Value.([]byte)\n\tif ok {\n\t\tbsB, ok := n2.Value.([]byte)\n\t\tif ok {\n\t\t\treturn bytes.Equal(bsA, bsB)\n\t\t}\n\t\tpanic(fmt.Sprintf(\"type not the same: %T %T\", n.Value, n2.Value))\n\t}\n\treturn n.Value == n2.Value\n}", "title": "" }, { "docid": "1bbea9ada2b6391390e9445138c6591a", "score": "0.5702041", "text": "func (set Thing2Set) Equal(other Thing2Set) bool {\n\tif set.Cardinality() != other.Cardinality() {\n\t\treturn false\n\t}\n\tfor elem := range set {\n\t\tif !other.Contains(elem) {\n\t\t\treturn false\n\t\t}\n\t}\n\treturn true\n}", "title": "" }, { "docid": "af59fc9b7f3d8a8622e06ca91446840e", "score": "0.57003075", "text": "func Equal(u1, u2 string) bool {\n\tf1, err := Fix(u1)\n\tif err != nil {\n\t\treturn false\n\t}\n\tf2, err := Fix(u2)\n\tif err != nil {\n\t\treturn false\n\t}\n\treturn f1 == f2\n}", "title": "" }, { "docid": "b660fbb57e2ee3a9a59bc7a1105e99db", "score": "0.56981575", "text": "func (a Adapter) Equal(other depgraph.Item) bool {\n\ta2 := other.(Adapter)\n\treturn a.L2Type == a2.L2Type\n}", "title": "" }, { "docid": "ace60da7f0f90a6567ab1306a1e6f61e", "score": "0.569585", "text": "func (c1 *Config) Equal(c2 *Config) bool {\n\tif c1.MaxConnServer != c2.MaxConnServer {\n\t\treturn false\n\t}\n\tif c1.MaxQueueServer != c2.MaxQueueServer {\n\t\treturn false\n\t}\n\tif c1.TimeoutQueue != c2.TimeoutQueue {\n\t\treturn false\n\t}\n\treturn true\n}", "title": "" }, { "docid": "fad16f717bb9ca82f955d3847a5c9e21", "score": "0.56937206", "text": "func Equal(a, b interface{}) bool {\n if DeepEqual(a, b) {\n return true\n }\n\n if reflect.ValueOf(a) == reflect.ValueOf(b) {\n return true\n }\n\n if fmt.Sprintf(\"%#v\", a) == fmt.Sprintf(\"%#v\", b) {\n return true\n }\n\n return false\n}", "title": "" }, { "docid": "34f6d140dd52a348baf37fcc7eadc820", "score": "0.56921065", "text": "func Equal(s1, s2 Set) bool {\n\treturn Subset(s1, s2) && Subset(s2, s1)\n}", "title": "" }, { "docid": "72145f1648662c4b26fdca159d89aaaf", "score": "0.56895167", "text": "func (s *EntryState) Equal(other *EntryState) bool {\n\tif s.Type != other.Type {\n\t\treturn false\n\t}\n\tif runtime.GOOS != \"windows\" && s.Mode.Perm() != other.Mode.Perm() {\n\t\treturn false\n\t}\n\treturn bytes.Equal(s.ContentsSHA256, other.ContentsSHA256)\n}", "title": "" }, { "docid": "f3c5ac5a8e654334199ba2d29f6a8d5c", "score": "0.5683734", "text": "func Equal(r1, r2 *onet.Roster) bool {\n\tif len(r1.List) != len(r2.List) {\n\t\treturn false\n\t}\n\tfor _, p := range r2.List {\n\t\tfound := false\n\t\tfor _, d := range r1.List {\n\t\t\tif p.Equal(d) {\n\t\t\t\tfound = true\n\t\t\t}\n\t\t}\n\t\tif !found {\n\t\t\treturn false\n\t\t}\n\t}\n\treturn true\n}", "title": "" }, { "docid": "a112f14b95f73bb8ed1a9c96ccf69683", "score": "0.56820583", "text": "func Equal(a, b Json) bool {\n\tswitch {\n\tcase a == nil && b == nil:\n\t\treturn true\n\tcase a == nil || b == nil:\n\t\treturn false\n\tcase a.Kind() != b.Kind():\n\t\treturn false\n\t}\n\n\tswitch a.Kind() {\n\tcase NullKind:\n\t\treturn true\n\tcase StringKind:\n\t\treturn a.String() == b.String()\n\tcase NumberKind:\n\t\treturn a.Number() == b.Number()\n\tcase BoolKind:\n\t\treturn a.Bool() == b.Bool()\n\tcase ArrayKind:\n\t\tif a.Len() != b.Len() {\n\t\t\treturn false\n\t\t}\n\t\tfor i := 0; i < a.Len(); i++ {\n\t\t\tif !Equal(a.Elem(i), b.Elem(i)) {\n\t\t\t\treturn false\n\t\t\t}\n\t\t}\n\t\treturn true;\n\tcase MapKind:\n\t\tm := a.(*_Map).m;\n\t\tif len(m) != len(b.(*_Map).m) {\n\t\t\treturn false\n\t\t}\n\t\tfor k, v := range m {\n\t\t\tif !Equal(v, b.Get(k)) {\n\t\t\t\treturn false\n\t\t\t}\n\t\t}\n\t\treturn true;\n\t}\n\n\t// invalid kind\n\treturn false;\n}", "title": "" }, { "docid": "c155d5088e31019435abec2f0cf5cfc5", "score": "0.5671773", "text": "func (array sparseDiagF64Matrix) Equal(other NDArray) bool {\n\treturn Equal(&array, other)\n}", "title": "" }, { "docid": "0faac551ab71884bebb4edbf56519cca", "score": "0.566193", "text": "func (node Node) Equal(other Node) bool {\n\treturn node.Host == other.Host && node.IP == other.IP && node.InternalIP == other.InternalIP\n}", "title": "" }, { "docid": "954b78167ead854c2221a1f411a119a0", "score": "0.5660035", "text": "func readersEqual(r1, r2 io.Reader) bool {\n\tbts, err := ioutil.ReadAll(r1)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\tbts2, err := ioutil.ReadAll(r2)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\tlog.Printf(\"1: %s\", bts)\n\tlog.Printf(\"2: %s\", bts2)\n\tif !reflect.DeepEqual(bts, bts2) {\n\t\treturn false\n\t}\n\treturn true\n}", "title": "" }, { "docid": "52c00b5d88301870ee722bd64d486cef", "score": "0.56560034", "text": "func (n ContentIDAdapter) Equals(other merkletree.Content) (bool, error) {\n\treturn n.ToString() == other.(*ContentIDAdapter).ToString(), nil\n}", "title": "" }, { "docid": "b6e0b5073b0d77b31463a7bc52ec3397", "score": "0.56559604", "text": "func (z1 *Zone) Equal(z2 *Zone) bool {\n\tif z1 == z2 {\n\t\treturn true\n\t}\n\tif z1 == nil || z2 == nil {\n\t\treturn false\n\t}\n\tif z1.Name != z2.Name {\n\t\treturn false\n\t}\n\tif z1.Limit != z2.Limit {\n\t\treturn false\n\t}\n\tif z1.Burst != z2.Burst {\n\t\treturn false\n\t}\n\tif z1.SharedSize != z2.SharedSize {\n\t\treturn false\n\t}\n\n\treturn true\n}", "title": "" }, { "docid": "74d061175875f12e8db51a4dda768b71", "score": "0.5652752", "text": "func (s State) Equal(other State) bool {\n\tif s.Size != other.Size {\n\t\treturn false\n\t}\n\tif !s.Snakes[0].Equal(other.Snakes[0]) {\n\t\treturn false\n\t}\n\tif s.GameIsOver != other.GameIsOver {\n\t\treturn false\n\t}\n\tif s.PointItem != other.PointItem {\n\t\treturn false\n\t}\n\treturn true\n}", "title": "" }, { "docid": "4fd3208ea01dbbb0bdbde8124b7a3637", "score": "0.5652559", "text": "func (d Descriptor) Equal(t Descriptor) bool {\n\treturn d.MediaType == t.MediaType && d.Digest == t.Digest && d.Size == t.Size\n}", "title": "" }, { "docid": "48b62c7f08fe5509ba065ef7695ebc46", "score": "0.564218", "text": "func (b *binding) Equal(other *binding) bool {\n\tif b == nil {\n\t\treturn other == nil\n\t}\n\n\tif other == nil {\n\t\treturn false\n\t}\n\n\t// if b.String() != other.String() {\n\t// \treturn false\n\t// }\n\n\tif expected, got := b.Dependency != nil, other.Dependency != nil; expected != got {\n\t\treturn false\n\t}\n\n\tif expected, got := fmt.Sprintf(\"%v\", b.Dependency.OriginalValue), fmt.Sprintf(\"%v\", other.Dependency.OriginalValue); expected != got {\n\t\treturn false\n\t}\n\n\tif expected, got := b.Dependency.DestType != nil, other.Dependency.DestType != nil; expected != got {\n\t\treturn false\n\t}\n\n\tif b.Dependency.DestType != nil {\n\t\tif expected, got := b.Dependency.DestType.String(), other.Dependency.DestType.String(); expected != got {\n\t\t\treturn false\n\t\t}\n\t}\n\n\tif expected, got := b.Input != nil, other.Input != nil; expected != got {\n\t\treturn false\n\t}\n\n\tif b.Input != nil {\n\t\tif expected, got := b.Input.Index, other.Input.Index; expected != got {\n\t\t\treturn false\n\t\t}\n\n\t\tif expected, got := b.Input.Type.String(), other.Input.Type.String(); expected != got {\n\t\t\treturn false\n\t\t}\n\n\t\tif expected, got := b.Input.StructFieldIndex, other.Input.StructFieldIndex; !reflect.DeepEqual(expected, got) {\n\t\t\treturn false\n\t\t}\n\t}\n\n\treturn true\n}", "title": "" }, { "docid": "2cdbc0437a133f2fc32471c6d1a34a17", "score": "0.5640049", "text": "func (p *Persister) AssertEqual(s persistence.Source) {\n\tch, ok := p.chans[s.ID()]\n\tif !ok {\n\t\tp.t.Errorf(\"channel doesn't exist: %x\", s.ID())\n\t\treturn\n\t}\n\n\tassert := assert.New(p.t)\n\tassert.Equal(s.Idx(), ch.Idx, \"Idx mismatch\")\n\tassert.Equal(s.Params(), ch.Params, \"Params mismatch\")\n\tassert.Equal(s.StagingTX(), ch.StagingTX, \"StagingTX mismatch\")\n\tassert.Equal(s.CurrentTX(), ch.CurrentTX, \"CurrentTX mismatch\")\n\tassert.Equal(s.Phase(), ch.Phase, \"Phase mismatch\")\n}", "title": "" }, { "docid": "f0d282f9f7ae768ca77d3b9adae358cf", "score": "0.5632272", "text": "func (co *Code) M__eq__(other Object) (Object, error) {\n\tif otherCo, ok := other.(*Code); ok && co == otherCo {\n\t\treturn True, nil\n\t}\n\treturn False, nil\n}", "title": "" }, { "docid": "90a5bc399ba866f02bb97ea6b6cd0320", "score": "0.56315225", "text": "func TestEquals(t *testing.T) {\n\tt.Run(\"different port\", func(t *testing.T) {\n\t\trequire.False(t, conf.Equals(&otherConf))\n\t})\n\n\tt.Run(\"different peers\", func(t *testing.T) {\n\t\totherConf.ListenPort = conf.ListenPort\n\t\totherConf.Peers[0].Endpoint = \"wg.example.com:51820\"\n\t\trequire.False(t, conf.Equals(&otherConf))\n\t})\n\n\tt.Run(\"different allowed IPs\", func(t *testing.T) {\n\t\tconf.Peers[0].Endpoint = otherConf.Peers[0].Endpoint\n\t\tconf.Peers[0].AllowedIPs = append(conf.Peers[0].AllowedIPs, \"10.11.0.76/32\", \"10.11.0.76/32\", \"244.12.13.1/32\")\n\t\totherConf.Peers[0].AllowedIPs = append(otherConf.Peers[0].AllowedIPs, \"10.11.0.76/32\", \"10.11.0.76/32\")\n\t\trequire.False(t, conf.Equals(&otherConf))\n\t})\n\n\tt.Run(\"equal\", func(t *testing.T) {\n\t\totherConf.Peers[0].AllowedIPs = append(otherConf.Peers[0].AllowedIPs, \"244.12.13.1/32\")\n\t\trequire.True(t, conf.Equals(&otherConf))\n\t})\n}", "title": "" } ]
49bc8f5c6de632d88e80d47cf42bb447
DeleteNote indicates an expected call of DeleteNote.
[ { "docid": "e5cdda05451f2767b4dc1ca0ec679eb8", "score": "0.7454327", "text": "func (mr *MockNoteServiceMockRecorder) DeleteNote(noteID interface{}) *gomock.Call {\n\tmr.mock.ctrl.T.Helper()\n\treturn mr.mock.ctrl.RecordCallWithMethodType(mr.mock, \"DeleteNote\", reflect.TypeOf((*MockNoteService)(nil).DeleteNote), noteID)\n}", "title": "" } ]
[ { "docid": "43d63e4c593a525e2092ed2efeeb0f88", "score": "0.7171383", "text": "func (p *NoteStoreClient) DeleteNote(authenticationToken string, guid Types.Guid) (r int32, userException *Errors.EDAMUserException, systemException *Errors.EDAMSystemException, notFoundException *Errors.EDAMNotFoundException, err error) {\n\tif err = p.sendDeleteNote(authenticationToken, guid); err != nil {\n\t\treturn\n\t}\n\treturn p.recvDeleteNote()\n}", "title": "" }, { "docid": "02c4cdef5509829da5e59c461bb872b7", "score": "0.69872457", "text": "func deleteNote(w http.ResponseWriter, r *http.Request, ps httprouter.Params) {\n\toutcome := app.APIResponse{}\n\terr := db.deleteByUID(ps.ByName(\"uid\"))\n\tif err != nil {\n\t\toutcome.Success = false\n\t\toutcome.Message = err.Error()\n\t\tlog.Error(err)\n\t}\n\toutcome.Success = true\n\toutcomeJSON, _ := json.Marshal(outcome)\n\tfmt.Fprintf(w, string(outcomeJSON))\n}", "title": "" }, { "docid": "6f8885ddc10d93682362cc5832b82bd5", "score": "0.6839544", "text": "func (client BaseClient) DeleteNote(ctx context.Context, drawer int32, ID int32) (result SetObject, err error) {\n req, err := client.DeleteNotePreparer(ctx, drawer, ID)\n if err != nil {\n err = autorest.NewErrorWithError(err, \"softheonenterpriseapiclient.BaseClient\", \"DeleteNote\", nil , \"Failure preparing request\")\n return\n }\n\n resp, err := client.DeleteNoteSender(req)\n if err != nil {\n result.Response = autorest.Response{Response: resp}\n err = autorest.NewErrorWithError(err, \"softheonenterpriseapiclient.BaseClient\", \"DeleteNote\", resp, \"Failure sending request\")\n return\n }\n\n result, err = client.DeleteNoteResponder(resp)\n if err != nil {\n err = autorest.NewErrorWithError(err, \"softheonenterpriseapiclient.BaseClient\", \"DeleteNote\", resp, \"Failure responding to request\")\n }\n\n return\n }", "title": "" }, { "docid": "5e953373d54d057ccabc38e8813d5f97", "score": "0.6834989", "text": "func DeleteNote(c *gin.Context) {\r\n\terr := arvindb.DeleteNoteByID(c.Param(\"id\"))\r\n\tif err != nil {\r\n\t\tc.JSON(http.StatusOK, gin.H{\r\n\t\t\t\"status\": http.StatusOK,\r\n\t\t\t\"success\": false,\r\n\t\t\t\"message\": err.Error(),\r\n\t\t})\r\n\t\treturn\r\n\t}\r\n\r\n\tc.JSON(http.StatusOK, gin.H{\r\n\t\t\"status\": http.StatusOK,\r\n\t\t\"success\": true,\r\n\t\t\"message\": \"Note successfully deleted!\",\r\n\t})\r\n}", "title": "" }, { "docid": "ad7c09b18a149159886fed158166ce0b", "score": "0.6668901", "text": "func (vk *VK) NotesDelete(params Params) (response int, err error) {\n\terr = vk.RequestUnmarshal(\"notes.delete\", &response, params)\n\treturn\n}", "title": "" }, { "docid": "dbe2a78a5e645880f90ce2be91a91e39", "score": "0.6659998", "text": "func (nt *NoteModel) DeleteNote() {\n\terr := Queries.DeleteNote(nt)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n}", "title": "" }, { "docid": "50a4ab375dd1577706df50f327676406", "score": "0.6653734", "text": "func DeleteNote(db *pg.DB, pk int64) error {\n\n\tnt := models.Note{ID: pk}\n\n\tfmt.Println(\"Deleting note...\")\n\n\terr := db.Delete(&nt)\n\n\treturn err\n}", "title": "" }, { "docid": "346fd250bd2268a251de54d1a46c33a7", "score": "0.65010214", "text": "func (o *PatientNote) Delete(ctx context.Context, exec boil.ContextExecutor) (int64, error) {\n\tif o == nil {\n\t\treturn 0, errors.New(\"models: no PatientNote provided for delete\")\n\t}\n\n\tif err := o.doBeforeDeleteHooks(ctx, exec); err != nil {\n\t\treturn 0, err\n\t}\n\n\targs := queries.ValuesFromMapping(reflect.Indirect(reflect.ValueOf(o)), patientNotePrimaryKeyMapping)\n\tsql := \"DELETE FROM \\\"patient_note\\\" WHERE \\\"noteid\\\"=$1\"\n\n\tif boil.IsDebug(ctx) {\n\t\twriter := boil.DebugWriterFrom(ctx)\n\t\tfmt.Fprintln(writer, sql)\n\t\tfmt.Fprintln(writer, args...)\n\t}\n\tresult, err := exec.ExecContext(ctx, sql, args...)\n\tif err != nil {\n\t\treturn 0, errors.Wrap(err, \"models: unable to delete from patient_note\")\n\t}\n\n\trowsAff, err := result.RowsAffected()\n\tif err != nil {\n\t\treturn 0, errors.Wrap(err, \"models: failed to get rows affected by delete for patient_note\")\n\t}\n\n\tif err := o.doAfterDeleteHooks(ctx, exec); err != nil {\n\t\treturn 0, err\n\t}\n\n\treturn rowsAff, nil\n}", "title": "" }, { "docid": "09d262f952415b1b6397c4be91deef81", "score": "0.64992136", "text": "func DeleteNote(idStr string) (status int) {\n\tid, err := strconv.Atoi(idStr)\n\tif err != nil {\n\t\tlog.Println(\"Id incorrecto\", err)\n\t\tstatus = http.StatusBadRequest\n\t\treturn\n\t}\n\n\tq := `DELETE FROM notes WHERE id=$1`\n\tdb := configuration.GetConnection()\n\tdefer db.Close()\n\tstmt, err := db.Prepare(q)\n\tdefer stmt.Close()\n\tif err != nil {\n\t\tlog.Println(\"Error al preparar consulta\", err)\n\t\tstatus = http.StatusInternalServerError\n\t\treturn\n\t}\n\n\tr, err := stmt.Exec(id)\n\tif err != nil {\n\t\tlog.Println(\"Error al borrar nota\", err)\n\t\tstatus = http.StatusNotFound\n\t\treturn\n\t}\n\n\ti, err := r.RowsAffected()\n\tif err != nil || i != 1 {\n\t\tlog.Println(\"Se esperaba una fila afectada\")\n\t\tstatus = http.StatusInternalServerError\n\t\treturn\n\t}\n\tstatus = http.StatusNoContent\n\treturn\n}", "title": "" }, { "docid": "f254daf26c33da82c974ac993a686bc5", "score": "0.64850575", "text": "func (c *Client) DeleteNote(ctx context.Context, req *containeranalysispb.DeleteNoteRequest, opts ...gax.CallOption) error {\n\tctx = insertMetadata(ctx, c.xGoogMetadata)\n\topts = append(c.CallOptions.DeleteNote[0:len(c.CallOptions.DeleteNote):len(c.CallOptions.DeleteNote)], opts...)\n\terr := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {\n\t\tvar err error\n\t\t_, err = c.client.DeleteNote(ctx, req, settings.GRPC...)\n\t\treturn err\n\t}, opts...)\n\treturn err\n}", "title": "" }, { "docid": "cbacfb85d7df84bc19e923f3cfd57d53", "score": "0.6473779", "text": "func DeleteNote(context *cli.Context) {\n\tnotePath := viper.GetString(\"notePath\")\n\n\t_, err := os.Stat(notePath)\n\n\tif err != nil {\n\t\tfmt.Println(err)\n\t\tos.Exit(1)\n\t}\n\n\tcaseSensitive := context.Bool(\"case-sensitive\")\n\n\tnoteFound, err := notes.FindNoteName(notePath, context.Args(), caseSensitive)\n\n\tif err != nil {\n\t\tfmt.Println(err)\n\t\tos.Exit(1)\n\t}\n\n\tred := color.New(color.FgRed).Add(color.Bold).SprintFunc()\n\tconfirmMessage := fmt.Sprintf(\"note: delete note '%s'?\", red(noteFound))\n\tif !context.Bool(\"yes\") && !libCli.Confirm(confirmMessage) {\n\t\treturn\n\t}\n\n\terr = os.Remove(filepath.Join(notePath, noteFound))\n\n\tif err != nil {\n\t\tfmt.Println(err)\n\t\tos.Exit(1)\n\t}\n}", "title": "" }, { "docid": "bac39fe00f63df059d8a1ed8fc5b62b2", "score": "0.6371514", "text": "func (es *ElasticsearchStorage) DeleteNote(ctx context.Context, projectId, noteId string) error {\n\tnoteName := fmt.Sprintf(\"projects/%s/notes/%s\", projectId, noteId)\n\tlog := es.logger.Named(\"DeleteNote\").With(zap.String(\"note\", noteName))\n\n\tlog.Debug(\"deleting note\")\n\n\tsearch := &esSearch{\n\t\tQuery: &filtering.Query{\n\t\t\tTerm: &filtering.Term{\n\t\t\t\t\"name\": noteName,\n\t\t\t},\n\t\t},\n\t}\n\n\treturn es.genericDelete(ctx, log, search, notesIndex(projectId))\n}", "title": "" }, { "docid": "28d36b55634072f9d8d4946ebb1b5342", "score": "0.63603103", "text": "func (ns *NoteService) DeleteNote(id int, classID int, meetingID int, t int, key string, session *Session) error {\n\tif ns.cache == nil {\n\t\treturn common.ERR_NO_SERVICE\n\t}\n\n\tsID := strconv.Itoa(id)\n\n\tif err := ns.cache.DelField(ns.getUserClassNoteKeyForCache(session.UserID, classID), sID); err != nil {\n\t\t// TODO:\n\t}\n\n\tif err := ns.cache.DelField(ns.getTypedNoteKeyForCache(t, key), sID); err != nil {\n\t\t// TODO:\n\t}\n\n\t// Update database, respectively.\n\tif ns.db != nil {\n\t\tif n := ns.newNote(id, classID, meetingID, t, key, 0, \"\", session); n != nil {\n\t\t\t// Put it into the task queue.\n\t\t\tns.tasks <- &NoteTask{false, n}\n\t\t}\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "453cd9e00ab146eb0e2251372e856a18", "score": "0.63095665", "text": "func (t *NoteTracer) Delete(ctx context.Context, id types.ID) error {\n\tvar span trace.Span\n\toptions := append(t.config.SpanStartOptions, trace.WithAttributes(\n\t\tattribute.String(\"libsacloud.api.arguments.id\", forceString(id)),\n\t))\n\tctx, span = t.config.Tracer.Start(ctx, \"NoteAPI.Delete\", options...)\n\tdefer func() {\n\t\tspan.End()\n\t}()\n\n\t// for http trace\n\tctx = httptrace.WithClientTrace(ctx, otelhttptrace.NewClientTrace(ctx))\n\terr := t.Internal.Delete(ctx, id)\n\n\tif err != nil {\n\t\tspan.SetStatus(codes.Error, err.Error())\n\t} else {\n\t\tspan.SetStatus(codes.Ok, \"\")\n\n\t}\n\treturn err\n}", "title": "" }, { "docid": "f91a4d6dab9b22e9cc0b0957df908e5d", "score": "0.6287133", "text": "func (server Server) DeleteNote(w http.ResponseWriter, r *http.Request) {\n\tvars := mux.Vars(r) //mux params\n\tid, err := strconv.Atoi(vars[\"id\"]) // convert the id in string to int\n\tvar res models.APIResponse\n\n\tif err != nil { //error checking\n\t\tlog.Printf(\"Unable to convert the string into int. %v\", err)\n\t\tres = models.BuildAPIResponseFail(\"Invalid id, note doesn't exist\", nil)\n\t} else {\n\t\tdeletedRows := deleteNote(id, server.db) // call the deleteUser\n\t\tres = models.BuildAPIResponseSuccess(\"User deleted successfully\", deletedRows)\n\t}\n\tjson.NewEncoder(w).Encode(res) // send the response\n\n}", "title": "" }, { "docid": "30a596572f8e20a442c413ca4e53e41f", "score": "0.62741214", "text": "func (client BaseClient) DeleteNoteSender(req *http.Request) (*http.Response, error) {\n return autorest.SendWithSender(client, req,\n autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))\n }", "title": "" }, { "docid": "56092b247bfa88428e0958e4f6f21847", "score": "0.616977", "text": "func (N *NoteController) Delete(k *knot.WebContext) {\n\tk.Request.Header.Set(\"Content-Type\", \"application/json\")\n\tif core.GetMethod(k) == \"POST\" {\n\t\tpayload := models.NewNoteModel()\n\n\t\terr := k.GetPayload(&payload)\n\t\tif err != nil {\n\t\t\tk.WriteJSON(core.ResponseJSONError(err.Error()), http.StatusInternalServerError)\n\t\t}\n\n\t\tfind, _, _ := services.NewNoteService().Find(dbflex.Eq(\"_id\", payload.ID))\n\t\tif !find {\n\t\t\tk.WriteJSON(core.ResponseJSONError(\"Error: Data not found!\"), http.StatusOK)\n\t\t}\n\n\t\terr = services.NewNoteService().Delete(dbflex.Eq(\"_id\", payload.ID))\n\t\tif err != nil {\n\t\t\tk.WriteJSON(core.ResponseJSONError(err.Error()), http.StatusInternalServerError)\n\t\t}\n\n\t\tk.WriteJSON(core.ResponseJSONOK(nil), http.StatusOK)\n\t} else {\n\t\tk.WriteJSON(core.ResponseJSONError(\"Unknown Method\"), http.StatusInternalServerError)\n\t}\n}", "title": "" }, { "docid": "3e3bb2f0619b917a84b1a1d80722e0db", "score": "0.6122666", "text": "func (mr *MockEndpointClientMockRecorder) Delete(arg0, arg1, arg2 interface{}) *gomock.Call {\n\tmr.mock.ctrl.T.Helper()\n\treturn mr.mock.ctrl.RecordCallWithMethodType(mr.mock, \"Delete\", reflect.TypeOf((*MockEndpointClient)(nil).Delete), arg0, arg1, arg2)\n}", "title": "" }, { "docid": "188c6064f57c37c46d3f79c4fa61cea9", "score": "0.6108493", "text": "func (client BaseClient) DeleteNoteResponder(resp *http.Response) (result SetObject, err error) {\n err = autorest.Respond(\n resp,\n client.ByInspecting(),\n azure.WithErrorUnlessStatusCode(http.StatusOK,http.StatusNoContent,http.StatusForbidden,http.StatusNotFound),\n autorest.ByUnmarshallingJSON(&result.Value),\n autorest.ByClosing())\n result.Response = autorest.Response{Response: resp}\n return\n }", "title": "" }, { "docid": "3894c240aa90e8ebdaf254b4c708819f", "score": "0.6045464", "text": "func NoteDelete(db *sql.DB, year int, month int) error {\n\ttableName := strconv.Itoa(year) + \"_\" + strconv.Itoa(month) + \"_rireki\"\n\n\t_, err := db.Exec(fmt.Sprintf(\"DROP TABLE `%s`\", tableName))\n\n\tif err != nil {\n\t\treturn err\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "829c2de1016926d61fc3c86ea6376eca", "score": "0.600919", "text": "func (mr *MockFloatingIPClientMockRecorder) Delete(arg0, arg1 interface{}) *gomock.Call {\n\tmr.mock.ctrl.T.Helper()\n\treturn mr.mock.ctrl.RecordCallWithMethodType(mr.mock, \"Delete\", reflect.TypeOf((*MockFloatingIPClient)(nil).Delete), arg0, arg1)\n}", "title": "" }, { "docid": "427194f22ec844e7927a6952ef13b634", "score": "0.5953548", "text": "func (m *MockNoteService) DeleteNote(noteID uint) error {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"DeleteNote\", noteID)\n\tret0, _ := ret[0].(error)\n\treturn ret0\n}", "title": "" }, { "docid": "925e51d9623c02690182a1e87cc2803c", "score": "0.59517676", "text": "func TestNoter_AddNote(t *testing.T) {\n\tDoTestNoterAddNote(t, &mock.Storage{}, &mock.Calculator{})\n}", "title": "" }, { "docid": "365cd2de43ade1098f4a8671fb1e97a3", "score": "0.5938567", "text": "func Delete(DB *sql.DB, id string) (string, int, error) {\n\t_, result, code, err := ByID(DB, id)\n\tif code != status.OK {\n\t\treturn result, code, err\n\t}\n\tquery := \"DELETE FROM Note WHERE NOTE_ID = ?\"\n\t_, err = DB.Exec(query, id)\n\tif err != nil {\n\t\treturn deletionErr, status.ServerError, oops.T(err)\n\t}\n\treturn success, status.DeletedSuccess, err\n}", "title": "" }, { "docid": "a1898af5e52e8800e3f59d49dff978bc", "score": "0.5928792", "text": "func (vk *VK) NotesDeleteComment(params Params) (response int, err error) {\n\terr = vk.RequestUnmarshal(\"notes.deleteComment\", &response, params)\n\treturn\n}", "title": "" }, { "docid": "0cc6408baaa4bcbf07faa00004c33682", "score": "0.59197295", "text": "func (mr *MockClientMockRecorder) Delete(arg0 interface{}) *gomock.Call {\n\tmr.mock.ctrl.T.Helper()\n\treturn mr.mock.ctrl.RecordCallWithMethodType(mr.mock, \"Delete\", reflect.TypeOf((*MockClient)(nil).Delete), arg0)\n}", "title": "" }, { "docid": "4e1a39a9ec694b7e2001e15ccc0c8ded", "score": "0.59077305", "text": "func (mr *MockTodosImplMockRecorder) Delete(todo interface{}) *gomock.Call {\n\tmr.mock.ctrl.T.Helper()\n\treturn mr.mock.ctrl.RecordCallWithMethodType(mr.mock, \"Delete\", reflect.TypeOf((*MockTodosImpl)(nil).Delete), todo)\n}", "title": "" }, { "docid": "344d10d5cca7919a4a4f47ed8b30c97b", "score": "0.5900274", "text": "func (mr *MockHttpCommunicationsMockRecorder) Delete(arg0 interface{}) *gomock.Call {\n\tmr.mock.ctrl.T.Helper()\n\treturn mr.mock.ctrl.RecordCallWithMethodType(mr.mock, \"Delete\", reflect.TypeOf((*MockHttpCommunications)(nil).Delete), arg0)\n}", "title": "" }, { "docid": "09234baa095f142e956167dc8509fd09", "score": "0.5894446", "text": "func (mr *MockVolumeClientMockRecorder) Delete(arg0, arg1 interface{}) *gomock.Call {\n\tmr.mock.ctrl.T.Helper()\n\treturn mr.mock.ctrl.RecordCallWithMethodType(mr.mock, \"Delete\", reflect.TypeOf((*MockVolumeClient)(nil).Delete), arg0, arg1)\n}", "title": "" }, { "docid": "97254d0a01000c5178c6699d1186f652", "score": "0.58906734", "text": "func (mr *MockReconcilerMockRecorder) Delete(arg0 interface{}) *gomock.Call {\n\tmr.mock.ctrl.T.Helper()\n\treturn mr.mock.ctrl.RecordCallWithMethodType(mr.mock, \"Delete\", reflect.TypeOf((*MockReconciler)(nil).Delete), arg0)\n}", "title": "" }, { "docid": "cdbe50d23e8da1aa0f151eaf078d2b0c", "score": "0.5880765", "text": "func (mr *MockAlertManagerSilencerMockRecorder) Delete(arg0 interface{}) *gomock.Call {\n\tmr.mock.ctrl.T.Helper()\n\treturn mr.mock.ctrl.RecordCallWithMethodType(mr.mock, \"Delete\", reflect.TypeOf((*MockAlertManagerSilencer)(nil).Delete), arg0)\n}", "title": "" }, { "docid": "ec2458933aaa44be8e0fa745aa019beb", "score": "0.587356", "text": "func (_mr *MockClientMockRecorder) Delete(arg0 interface{}) *gomock.Call {\r\n\treturn _mr.mock.ctrl.RecordCallWithMethodType(_mr.mock, \"Delete\", reflect.TypeOf((*MockClient)(nil).Delete), arg0)\r\n}", "title": "" }, { "docid": "e0214761fa0f08b87f41c34890962080", "score": "0.5841395", "text": "func (mr *MockClientMockRecorder) Delete(arg0, arg1 interface{}) *gomock.Call {\n\treturn mr.mock.ctrl.RecordCallWithMethodType(mr.mock, \"Delete\", reflect.TypeOf((*MockClient)(nil).Delete), arg0, arg1)\n}", "title": "" }, { "docid": "9bf121ee17c00b9998a6c85e08337669", "score": "0.5839096", "text": "func (mr *MockShortURLMockRecorder) Delete(ctx, shortCode interface{}) *gomock.Call {\n\tmr.mock.ctrl.T.Helper()\n\treturn mr.mock.ctrl.RecordCallWithMethodType(mr.mock, \"Delete\", reflect.TypeOf((*MockShortURL)(nil).Delete), ctx, shortCode)\n}", "title": "" }, { "docid": "c68d3075cad730ea2cdb46c26541cbb9", "score": "0.5836635", "text": "func (mr *MockIUsecaseMockRecorder) Delete(pinId, userId interface{}) *gomock.Call {\n\tmr.mock.ctrl.T.Helper()\n\treturn mr.mock.ctrl.RecordCallWithMethodType(mr.mock, \"Delete\", reflect.TypeOf((*MockIUsecase)(nil).Delete), pinId, userId)\n}", "title": "" }, { "docid": "c6d5313c434e8fa1276a7efda258cb97", "score": "0.58169585", "text": "func (mr *MockArticlesUsecaseMockRecorder) Delete(arg0, arg1 interface{}) *gomock.Call {\n\tmr.mock.ctrl.T.Helper()\n\treturn mr.mock.ctrl.RecordCallWithMethodType(mr.mock, \"Delete\", reflect.TypeOf((*MockArticlesUsecase)(nil).Delete), arg0, arg1)\n}", "title": "" }, { "docid": "0727c596a5160b72923263fc1559b0b1", "score": "0.5794176", "text": "func (s *NotesService) Delete(ctx context.Context, id int) (*Response, error) {\n\turi := fmt.Sprintf(\"/notes/%v\", id)\n\treq, err := s.client.NewRequest(http.MethodDelete, uri, nil, nil)\n\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn s.client.Do(ctx, req, nil)\n}", "title": "" }, { "docid": "1f1cb672d26257126a2ba7151e9baf99", "score": "0.5786939", "text": "func (mr *MockCLIClientMockRecorder) Delete(ctx, indexName, docID, version interface{}) *gomock.Call {\n\tmr.mock.ctrl.T.Helper()\n\treturn mr.mock.ctrl.RecordCallWithMethodType(mr.mock, \"Delete\", reflect.TypeOf((*MockCLIClient)(nil).Delete), ctx, indexName, docID, version)\n}", "title": "" }, { "docid": "57adb14956fba074486b593f2300c8ef", "score": "0.57858586", "text": "func (mr *MockTodoItemMockRecorder) Delete(userId, itemId interface{}) *gomock.Call {\n\tmr.mock.ctrl.T.Helper()\n\treturn mr.mock.ctrl.RecordCallWithMethodType(mr.mock, \"Delete\", reflect.TypeOf((*MockTodoItem)(nil).Delete), userId, itemId)\n}", "title": "" }, { "docid": "aac19d2f6463b22a8fe9f3cf0779d94a", "score": "0.5784959", "text": "func (mr *MockMongoDBMockRecorder) Delete(arg0, arg1 interface{}) *gomock.Call {\n\tmr.mock.ctrl.T.Helper()\n\treturn mr.mock.ctrl.RecordCallWithMethodType(mr.mock, \"Delete\", reflect.TypeOf((*MockMongoDB)(nil).Delete), arg0, arg1)\n}", "title": "" }, { "docid": "965c4682b43b634f6800d8548f83290d", "score": "0.5782731", "text": "func (mr *MockTodoAPIMockRecorder) Delete(w, r interface{}) *gomock.Call {\n\tmr.mock.ctrl.T.Helper()\n\treturn mr.mock.ctrl.RecordCallWithMethodType(mr.mock, \"Delete\", reflect.TypeOf((*MockTodoAPI)(nil).Delete), w, r)\n}", "title": "" }, { "docid": "18deec65a2d1132c52b170f543d43602", "score": "0.57667387", "text": "func (mr *MockRouteTableClientMockRecorder) Delete(arg0, arg1, arg2 interface{}) *gomock.Call {\n\tmr.mock.ctrl.T.Helper()\n\treturn mr.mock.ctrl.RecordCallWithMethodType(mr.mock, \"Delete\", reflect.TypeOf((*MockRouteTableClient)(nil).Delete), arg0, arg1, arg2)\n}", "title": "" }, { "docid": "caacb19f0ab3fe049d1ebad0731e6755", "score": "0.5759953", "text": "func (mr *MockPermissionClientMockRecorder) Delete(arg0, arg1 interface{}) *gomock.Call {\n\tmr.mock.ctrl.T.Helper()\n\treturn mr.mock.ctrl.RecordCallWithMethodType(mr.mock, \"Delete\", reflect.TypeOf((*MockPermissionClient)(nil).Delete), arg0, arg1)\n}", "title": "" }, { "docid": "912489e6acafe65c3ce6d95f089491e3", "score": "0.5746204", "text": "func deleteNote(w http.ResponseWriter, r *http.Request, p httprouter.Params) {\n if r.Method != \"GET\" {\n w.Header().Set(\"Allow\", \"GET\")\n http.Error(w, http.StatusText(405), 405)\n return\n }\n \n id := p.ByName(\"id\")\n if id == \"\" {\n http.Error(w, http.StatusText(400), 400)\n return\n }\n \n if _, err := strconv.Atoi(id); err != nil {\n http.Error(w, http.StatusText(400), 400)\n return\n }\n \n err := models.DeleteNote(id)\n if err == models.ErrNoNote {\n http.NotFound(w, r)\n fmt.Fprintf(w, \"Pas de note avec cet ID \\n\")\n return\n } else if err != nil {\n http.Error(w, http.StatusText(500), 500)\n return\n }\n \n fmt.Fprintf(w, \"Note n°\"+id+\" supprimée \\n\", )\n}", "title": "" }, { "docid": "287ae7fa7110df73c88ed2a680cec322", "score": "0.5745694", "text": "func (mr *MockCommentsRepoMockRecorder) Delete(arg0, arg1 interface{}) *gomock.Call {\n\tmr.mock.ctrl.T.Helper()\n\treturn mr.mock.ctrl.RecordCallWithMethodType(mr.mock, \"Delete\", reflect.TypeOf((*MockCommentsRepo)(nil).Delete), arg0, arg1)\n}", "title": "" }, { "docid": "7b875d3d26dfbdaa216124d30fc46ecc", "score": "0.5739058", "text": "func (mr *MockBranchMockRecorder) IsNote() *gomock.Call {\n\tmr.mock.ctrl.T.Helper()\n\treturn mr.mock.ctrl.RecordCallWithMethodType(mr.mock, \"IsNote\", reflect.TypeOf((*MockBranch)(nil).IsNote))\n}", "title": "" }, { "docid": "8e4e4e8395143f75bf44a153b1a835fc", "score": "0.57379323", "text": "func (client BaseClient) DeleteNotePreparer(ctx context.Context, drawer int32, ID int32) (*http.Request, error) {\n pathParameters := map[string]interface{} {\n \"drawer\": autorest.Encode(\"path\",drawer),\n \"id\": autorest.Encode(\"path\",ID),\n }\n\n preparer := autorest.CreatePreparer(\n autorest.AsDelete(),\n autorest.WithBaseURL(client.BaseURI),\n autorest.WithPathParameters(\"/v1/content/notes/{drawer}/{id}\",pathParameters))\n return preparer.Prepare((&http.Request{}).WithContext(ctx))\n }", "title": "" }, { "docid": "7d83d069c343593955cc4b004cd679f1", "score": "0.57378906", "text": "func (mr *MockIngredienteServiceMockRecorder) Delete(arg0 interface{}) *gomock.Call {\n\tmr.mock.ctrl.T.Helper()\n\treturn mr.mock.ctrl.RecordCallWithMethodType(mr.mock, \"Delete\", reflect.TypeOf((*MockIngredienteService)(nil).Delete), arg0)\n}", "title": "" }, { "docid": "671e8f9c9e56cfa7acf5aa2abc954111", "score": "0.5735261", "text": "func (mr *MockFlowOperationsMockRecorder) Delete(arg0 interface{}) *gomock.Call {\n\tmr.mock.ctrl.T.Helper()\n\treturn mr.mock.ctrl.RecordCallWithMethodType(mr.mock, \"Delete\", reflect.TypeOf((*MockFlowOperations)(nil).Delete), arg0)\n}", "title": "" }, { "docid": "4dbf14c00d6a232decb16368c6b6b9c6", "score": "0.5733833", "text": "func (mr *MockPostRepositoryMockRecorder) Delete(arg0 interface{}) *gomock.Call {\n\tmr.mock.ctrl.T.Helper()\n\treturn mr.mock.ctrl.RecordCallWithMethodType(mr.mock, \"Delete\", reflect.TypeOf((*MockPostRepository)(nil).Delete), arg0)\n}", "title": "" }, { "docid": "ffd402e63b3bc052163a707f8bebb1f8", "score": "0.57332665", "text": "func (mr *MockPodServiceMockRecorder) Delete(arg0, arg1 interface{}) *gomock.Call {\n\tmr.mock.ctrl.T.Helper()\n\treturn mr.mock.ctrl.RecordCallWithMethodType(mr.mock, \"Delete\", reflect.TypeOf((*MockPodService)(nil).Delete), arg0, arg1)\n}", "title": "" }, { "docid": "029e00066cd6f9056fc69a592358eed0", "score": "0.5730587", "text": "func DeleteNoteHandler(w http.ResponseWriter, r *http.Request) {\n\tvars := mux.Vars(r) // Nos devuelve un map con las variables de la peticion en nuestro caso el \"id\" --> /api/notes/{id}\n\tidLeido := vars[\"id\"] // Si hubiera mas nos quedamos solo con el \"id\"\n\n\tif _, ok := noteStore[idLeido]; ok { // Si existe el ID\n\t\tdelete(noteStore, idLeido) // Borramos la nota\n\t} else {\n\t\tlog.Println(\"No se ha encontrado el ID: %s\", idLeido)\n\t}\n\n\tw.WriteHeader(http.StatusNoContent) // 204\n}", "title": "" }, { "docid": "e3c2765de16c9271574a9f54dc3b462e", "score": "0.5691721", "text": "func TestDeleteNoRecord(t *testing.T) {\n\tclearTable()\n\tConvey(\"Attempt to delete a non-existing payment\", t, func() {\n\t\treq, _ := http.NewRequest(\"DELETE\", \"/payment/12\", nil)\n\t\tresponse := executeRequest(req)\n\t\tSo(compareResponseCode(t, http.StatusNotFound, response.Code),\n\t\t\tShouldEqual, true)\n\t\tConvey(\"And a payment does not exist error is delivered\", func() {\n\t\t\tvar m map[string]string\n\n\t\t\tjson.Unmarshal(response.Body.Bytes(), &m)\n\t\t\tSo(m[\"error\"], ShouldEqual, \"A payment with this Payment ID doesn't exists\")\n\t\t})\n\t})\n}", "title": "" }, { "docid": "0083b55895b901caba55320192750a78", "score": "0.5658031", "text": "func (mr *MockInstanceMockRecorder) Delete(arg0, arg1, arg2, arg3 interface{}) *gomock.Call {\n\treturn mr.mock.ctrl.RecordCallWithMethodType(mr.mock, \"Delete\", reflect.TypeOf((*MockInstance)(nil).Delete), arg0, arg1, arg2, arg3)\n}", "title": "" }, { "docid": "66933b7e1a42236af1ddda0dd5d30f3d", "score": "0.5645031", "text": "func DoTestNoterAddNote(t *testing.T, storage note.Storage, calculator note.Calculator) {\n\t// You could also create a constructor for Noter\n\tnoter := note.Noter{\n\t\tStorage: storage,\n\t\tCalculator: calculator,\n\t}\n\n\ttitle := \"good title\"\n\ttext := \"bad content\"\n\n\tn, err := noter.AddNote(title, text)\n\tassert.NoError(t, err)\n\tassert.Equal(t, title, n.Title)\n\tassert.Equal(t, text, n.Text)\n}", "title": "" }, { "docid": "fff1cdd334b4933b28f0d78b88b1df16", "score": "0.564084", "text": "func (c *TestClient) Delete(l *Locator) error {\n\tif e := c.Expectation(\"Delete\"); e != nil {\n\t\treturn e.(func(*Locator) error)(l)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "bd1258cad3c355d79151dd98726a98d6", "score": "0.5617724", "text": "func (mr *MockTaskManagerMockRecorder) Delete(arg0 interface{}) *gomock.Call {\n\tmr.mock.ctrl.T.Helper()\n\treturn mr.mock.ctrl.RecordCallWithMethodType(mr.mock, \"Delete\", reflect.TypeOf((*MockTaskManager)(nil).Delete), arg0)\n}", "title": "" }, { "docid": "09f18779479d6e043114acf1bd1c17da", "score": "0.5608463", "text": "func (mr *MockGitModuleMockRecorder) RefDelete(arg0 interface{}) *gomock.Call {\n\tmr.mock.ctrl.T.Helper()\n\treturn mr.mock.ctrl.RecordCallWithMethodType(mr.mock, \"RefDelete\", reflect.TypeOf((*MockGitModule)(nil).RefDelete), arg0)\n}", "title": "" }, { "docid": "3546bd4f69f5cff9321c2de49d17d331", "score": "0.56031215", "text": "func (mr *MockLocalRepoMockRecorder) RefDelete(arg0 interface{}) *gomock.Call {\n\tmr.mock.ctrl.T.Helper()\n\treturn mr.mock.ctrl.RecordCallWithMethodType(mr.mock, \"RefDelete\", reflect.TypeOf((*MockLocalRepo)(nil).RefDelete), arg0)\n}", "title": "" }, { "docid": "705a6eff983083e21d8d5cde3de3856c", "score": "0.56030715", "text": "func (mr *MockDbConnectorMockRecorder) Delete(arg0 interface{}, arg1 ...interface{}) *gomock.Call {\n\tvarargs := append([]interface{}{arg0}, arg1...)\n\treturn mr.mock.ctrl.RecordCallWithMethodType(mr.mock, \"Delete\", reflect.TypeOf((*MockDbConnector)(nil).Delete), varargs...)\n}", "title": "" }, { "docid": "688f1d59a5465bfc8446c11924ae29fe", "score": "0.5600462", "text": "func (mr *MockResourceGroupsClientMockRecorder) Delete(arg0, arg1 interface{}) *gomock.Call {\n\tmr.mock.ctrl.T.Helper()\n\treturn mr.mock.ctrl.RecordCallWithMethodType(mr.mock, \"Delete\", reflect.TypeOf((*MockResourceGroupsClient)(nil).Delete), arg0, arg1)\n}", "title": "" }, { "docid": "9ffe18c4e335860620d8802bd11f3d65", "score": "0.5576009", "text": "func (mr *MockInterfaceMockRecorder) Delete(arg0, arg1 interface{}) *gomock.Call {\n\tmr.mock.ctrl.T.Helper()\n\treturn mr.mock.ctrl.RecordCallWithMethodType(mr.mock, \"Delete\", reflect.TypeOf((*MockInterface)(nil).Delete), arg0, arg1)\n}", "title": "" }, { "docid": "3ab35d234a54d686b5a3406cc58bcd79", "score": "0.5562733", "text": "func (mr *MockFavouriteRepositoryMockRecorder) Delete(arg0, arg1 interface{}) *gomock.Call {\n\tmr.mock.ctrl.T.Helper()\n\treturn mr.mock.ctrl.RecordCallWithMethodType(mr.mock, \"Delete\", reflect.TypeOf((*MockFavouriteRepository)(nil).Delete), arg0, arg1)\n}", "title": "" }, { "docid": "a1091a59a16c6c5969138b1cd05e0fe7", "score": "0.55540806", "text": "func (mr *MockServiceMockRecorder) Delete(arg0, arg1 interface{}) *gomock.Call {\n\tmr.mock.ctrl.T.Helper()\n\treturn mr.mock.ctrl.RecordCallWithMethodType(mr.mock, \"Delete\", reflect.TypeOf((*MockService)(nil).Delete), arg0, arg1)\n}", "title": "" }, { "docid": "950b567799af2e53edc0773adf0c5953", "score": "0.55468327", "text": "func (mr *MockMessageRepositoryMockRecorder) Delete(arg0 interface{}) *gomock.Call {\n\tmr.mock.ctrl.T.Helper()\n\treturn mr.mock.ctrl.RecordCallWithMethodType(mr.mock, \"Delete\", reflect.TypeOf((*MockMessageRepository)(nil).Delete), arg0)\n}", "title": "" }, { "docid": "902bb0ed28fe552c6cf65218c8ac32d3", "score": "0.5526931", "text": "func (mr *MockClusterManagerMockRecorder) Delete(arg0, arg1 interface{}) *gomock.Call {\n\tmr.mock.ctrl.T.Helper()\n\treturn mr.mock.ctrl.RecordCallWithMethodType(mr.mock, \"Delete\", reflect.TypeOf((*MockClusterManager)(nil).Delete), arg0, arg1)\n}", "title": "" }, { "docid": "aef0dc13c9e347ad7612c3716997d0f6", "score": "0.5523957", "text": "func (mr *MockVirtualNetworksClientAPIMockRecorder) Delete(arg0, arg1, arg2 interface{}) *gomock.Call {\n\tmr.mock.ctrl.T.Helper()\n\treturn mr.mock.ctrl.RecordCallWithMethodType(mr.mock, \"Delete\", reflect.TypeOf((*MockVirtualNetworksClientAPI)(nil).Delete), arg0, arg1, arg2)\n}", "title": "" }, { "docid": "2c3f5dd4256047040aca7b353140720a", "score": "0.5522882", "text": "func (mr *MockBookRepoMockRecorder) Delete(arg0, arg1 interface{}) *gomock.Call {\n\tmr.mock.ctrl.T.Helper()\n\treturn mr.mock.ctrl.RecordCallWithMethodType(mr.mock, \"Delete\", reflect.TypeOf((*MockBookRepo)(nil).Delete), arg0, arg1)\n}", "title": "" }, { "docid": "90a5d7005b427f67d744e667ee3aa5b7", "score": "0.5520441", "text": "func (mr *MockCoursesMockRecorder) Delete(ctx, schoolId, courseId interface{}) *gomock.Call {\n\tmr.mock.ctrl.T.Helper()\n\treturn mr.mock.ctrl.RecordCallWithMethodType(mr.mock, \"Delete\", reflect.TypeOf((*MockCourses)(nil).Delete), ctx, schoolId, courseId)\n}", "title": "" }, { "docid": "7e97e0bde2a4301ba1321d82d1368973", "score": "0.55153364", "text": "func (mr *MockWorkitemtrackingClientMockRecorder) DeleteCommentReaction(arg0, arg1 interface{}) *gomock.Call {\n\tmr.mock.ctrl.T.Helper()\n\treturn mr.mock.ctrl.RecordCallWithMethodType(mr.mock, \"DeleteCommentReaction\", reflect.TypeOf((*MockWorkitemtrackingClient)(nil).DeleteCommentReaction), arg0, arg1)\n}", "title": "" }, { "docid": "7e97e0bde2a4301ba1321d82d1368973", "score": "0.55153364", "text": "func (mr *MockWorkitemtrackingClientMockRecorder) DeleteCommentReaction(arg0, arg1 interface{}) *gomock.Call {\n\tmr.mock.ctrl.T.Helper()\n\treturn mr.mock.ctrl.RecordCallWithMethodType(mr.mock, \"DeleteCommentReaction\", reflect.TypeOf((*MockWorkitemtrackingClient)(nil).DeleteCommentReaction), arg0, arg1)\n}", "title": "" }, { "docid": "1873927a768afc629c7cd0de83507c0c", "score": "0.5496941", "text": "func (mr *MockHorizontalPodAutoscalerInterfaceMockRecorder) Delete(arg0, arg1 interface{}) *gomock.Call {\n\tmr.mock.ctrl.T.Helper()\n\treturn mr.mock.ctrl.RecordCallWithMethodType(mr.mock, \"Delete\", reflect.TypeOf((*MockHorizontalPodAutoscalerInterface)(nil).Delete), arg0, arg1)\n}", "title": "" }, { "docid": "a73231c88d0a733716b0db8edb141503", "score": "0.5492661", "text": "func TestDeleteDocument(t *testing.T) {\n\n\tdocument := &v1.Document{Id: \"1\", LocalId: \"1\", Data: \"data file\", Uid: \"1\", CreatedAt: createdTimeStamp, LastUpdate: createdTimeStamp}\n\n\tresp, err := dTest.Delete(context.Background(), document)\n\n\tif err != nil {\n\t\tt.Error(err)\n\t} else {\n\t\tif resp.GetConflict() != v1.ConflictStatus_SYNC {\n\t\t\tt.Errorf(\"Error conflict should be %v but got %v\", resp.GetConflict(), v1.ConflictStatus_SYNC)\n\t\t}\n\t}\n}", "title": "" }, { "docid": "2230b3b60232954a7fc98fc859782d68", "score": "0.5487482", "text": "func (c *MedicalNoteClient) Delete() *MedicalNoteDelete {\n\treturn &MedicalNoteDelete{config: c.config}\n}", "title": "" }, { "docid": "320c4c2d2a722305e56fdea8f08a5628", "score": "0.54869246", "text": "func (mr *MockOVSBridgeClientMockRecorder) Delete() *gomock.Call {\n\tmr.mock.ctrl.T.Helper()\n\treturn mr.mock.ctrl.RecordCallWithMethodType(mr.mock, \"Delete\", reflect.TypeOf((*MockOVSBridgeClient)(nil).Delete))\n}", "title": "" }, { "docid": "5f7ff61f4f16ed931c0fa6161758c6be", "score": "0.54828316", "text": "func (mr *MockDBMockRecorder) Delete(arg0 interface{}) *gomock.Call {\n\tmr.mock.ctrl.T.Helper()\n\treturn mr.mock.ctrl.RecordCallWithMethodType(mr.mock, \"Delete\", reflect.TypeOf((*MockDB)(nil).Delete), arg0)\n}", "title": "" }, { "docid": "b3a0cfd887f2efcd6ea030053b7896d5", "score": "0.54753137", "text": "func (mr *MockTodoListMockRecorder) Delete(listId, userId interface{}) *gomock.Call {\n\tmr.mock.ctrl.T.Helper()\n\treturn mr.mock.ctrl.RecordCallWithMethodType(mr.mock, \"Delete\", reflect.TypeOf((*MockTodoList)(nil).Delete), listId, userId)\n}", "title": "" }, { "docid": "dda882b6a55e5ef806fff0d38dee1279", "score": "0.54687417", "text": "func (mr *MockStoreMockRecorder) Delete(arg0, arg1 interface{}) *gomock.Call {\n\tmr.mock.ctrl.T.Helper()\n\treturn mr.mock.ctrl.RecordCallWithMethodType(mr.mock, \"Delete\", reflect.TypeOf((*MockStore)(nil).Delete), arg0, arg1)\n}", "title": "" }, { "docid": "8da28630523e1c3f5b87f4220ba4520e", "score": "0.54540557", "text": "func TestDeleteItem(t *testing.T) {\n\n\trepo.DeleteTodoItemByID(1)\n\tvar item = repo.FindItemByID(1)\n\n\tif item != nil {\n\n\t\tt.Error(\"tst150: item was not deleted\")\n\t}\n}", "title": "" }, { "docid": "846d4e40a6ef780aa6bc11f975adc401", "score": "0.5443692", "text": "func (mr *MockRepositoryMockRecorder) Delete(arg0, arg1 interface{}) *gomock.Call {\n\tmr.mock.ctrl.T.Helper()\n\treturn mr.mock.ctrl.RecordCallWithMethodType(mr.mock, \"Delete\", reflect.TypeOf((*MockRepository)(nil).Delete), arg0, arg1)\n}", "title": "" }, { "docid": "825fbddba0c3469921b5a114ffda7644", "score": "0.54311574", "text": "func TestDeleteComment(t *testing.T) {\n\n}", "title": "" }, { "docid": "28a5e8bd2e2ae6b6bda5fff9c6ccf888", "score": "0.54268515", "text": "func (mr *MockWorkitemtrackingClientMockRecorder) DeleteComment(arg0, arg1 interface{}) *gomock.Call {\n\tmr.mock.ctrl.T.Helper()\n\treturn mr.mock.ctrl.RecordCallWithMethodType(mr.mock, \"DeleteComment\", reflect.TypeOf((*MockWorkitemtrackingClient)(nil).DeleteComment), arg0, arg1)\n}", "title": "" }, { "docid": "28a5e8bd2e2ae6b6bda5fff9c6ccf888", "score": "0.54268515", "text": "func (mr *MockWorkitemtrackingClientMockRecorder) DeleteComment(arg0, arg1 interface{}) *gomock.Call {\n\tmr.mock.ctrl.T.Helper()\n\treturn mr.mock.ctrl.RecordCallWithMethodType(mr.mock, \"DeleteComment\", reflect.TypeOf((*MockWorkitemtrackingClient)(nil).DeleteComment), arg0, arg1)\n}", "title": "" }, { "docid": "7531a25581fc16bd00f96fe3903e6c54", "score": "0.54207027", "text": "func TestDelete_OneReplica_FailDelete(t *testing.T) {\n\tGenericTestDelete(t, true, false, []bool{false}, true, 0)\n}", "title": "" }, { "docid": "437923461ad4c887fa0a2e33f04d31cc", "score": "0.5416123", "text": "func (mr *MockRepositoryMockRecorder) DeleteFood(roomID, foodIDs interface{}) *gomock.Call {\n\tmr.mock.ctrl.T.Helper()\n\treturn mr.mock.ctrl.RecordCallWithMethodType(mr.mock, \"DeleteFood\", reflect.TypeOf((*MockRepository)(nil).DeleteFood), roomID, foodIDs)\n}", "title": "" }, { "docid": "be6901ad6399aaed97eca732c13e2af0", "score": "0.5415254", "text": "func (mr *MockRepositoryMockRecorder) Delete(arg0 interface{}) *gomock.Call {\n\tmr.mock.ctrl.T.Helper()\n\treturn mr.mock.ctrl.RecordCallWithMethodType(mr.mock, \"Delete\", reflect.TypeOf((*MockRepository)(nil).Delete), arg0)\n}", "title": "" }, { "docid": "f003e57f0766b9881ce03ff9bcb808c2", "score": "0.5413863", "text": "func (mr *MockWorkitemtrackingClientMockRecorder) DeleteTemplate(arg0, arg1 interface{}) *gomock.Call {\n\tmr.mock.ctrl.T.Helper()\n\treturn mr.mock.ctrl.RecordCallWithMethodType(mr.mock, \"DeleteTemplate\", reflect.TypeOf((*MockWorkitemtrackingClient)(nil).DeleteTemplate), arg0, arg1)\n}", "title": "" }, { "docid": "f003e57f0766b9881ce03ff9bcb808c2", "score": "0.5413863", "text": "func (mr *MockWorkitemtrackingClientMockRecorder) DeleteTemplate(arg0, arg1 interface{}) *gomock.Call {\n\tmr.mock.ctrl.T.Helper()\n\treturn mr.mock.ctrl.RecordCallWithMethodType(mr.mock, \"DeleteTemplate\", reflect.TypeOf((*MockWorkitemtrackingClient)(nil).DeleteTemplate), arg0, arg1)\n}", "title": "" }, { "docid": "41aeb3b99d02db4486a0813059cd6bef", "score": "0.5411772", "text": "func (mr *MockAbillityMockRecorder) CanDelete(userID, post interface{}) *gomock.Call {\n\tmr.mock.ctrl.T.Helper()\n\treturn mr.mock.ctrl.RecordCallWithMethodType(mr.mock, \"CanDelete\", reflect.TypeOf((*MockAbillity)(nil).CanDelete), userID, post)\n}", "title": "" }, { "docid": "bed3d94a4ecfa7c75f9780518fc31783", "score": "0.5411343", "text": "func (mr *MockUseCaseMockRecorder) Delete(ctx, userID interface{}) *gomock.Call {\n\tmr.mock.ctrl.T.Helper()\n\treturn mr.mock.ctrl.RecordCallWithMethodType(mr.mock, \"Delete\", reflect.TypeOf((*MockUseCase)(nil).Delete), ctx, userID)\n}", "title": "" }, { "docid": "8b0bef282c3a64e7b7ec1d4ee1617a9d", "score": "0.54067826", "text": "func (mr *MockNoteServiceMockRecorder) CreateNote(req interface{}) *gomock.Call {\n\tmr.mock.ctrl.T.Helper()\n\treturn mr.mock.ctrl.RecordCallWithMethodType(mr.mock, \"CreateNote\", reflect.TypeOf((*MockNoteService)(nil).CreateNote), req)\n}", "title": "" }, { "docid": "b70e400a2641cec2df2f3bc8431d226e", "score": "0.5405683", "text": "func (mr *MockUserStoreMockRecorder) Delete(arg0, arg1 interface{}) *gomock.Call {\n\tmr.mock.ctrl.T.Helper()\n\treturn mr.mock.ctrl.RecordCallWithMethodType(mr.mock, \"Delete\", reflect.TypeOf((*MockUserStore)(nil).Delete), arg0, arg1)\n}", "title": "" }, { "docid": "995cb35b301a3ac32063c8ec505f01a4", "score": "0.54022133", "text": "func Delete(s *Store, _ io.Reader, w io.Writer, args string) {\n\terr := ValidateBytes(args, validArgBytes)\n\tif err != nil {\n\t\tWriteError(w, InvalidChars{err, \"in delete arguments\"})\n\t\treturn\n\t}\n\ts.SetStat(StatCmdDelete, Increment)\n\tif s.Delete(args) {\n\t\ts.SetStat(StatCmdDeleteHit, Increment)\n\t\tw.Write([]byte(deleteSucessful + commandDelim))\n\t} else {\n\t\ts.SetStat(StatCmdDeleteMisses, Increment)\n\t\tw.Write([]byte(deleteUnsucessful + commandDelim))\n\t}\n}", "title": "" }, { "docid": "2c8f6291f9ee041b4c513f1bcf2de8e6", "score": "0.53959066", "text": "func TestNotesList(t *testing.T) {\n\tnotes, err := NotesList()\n\tif err != nil {\n\t\tt.Error(err)\n\t}\n\n\texpected := 2\n\tgot := len(notes)\n\n\tif got != expected {\n\t\tt.Errorf(\"error: got %v, expected %v notes\", got, expected)\n\t}\n}", "title": "" }, { "docid": "c27e370c95c3fa021b1b66985e29f8c7", "score": "0.5387496", "text": "func TestLineDeletion(t *testing.T) {\n\tstate := resetState([]string{\"1\", \"2\", \"3\", \"4\", \"5\"})\n\t_addMark(t, state, \"2\", \"a\")\n\t_addMark(t, state, \"4\", \"b\")\n\n\t// delete line 1 : a->1, b->3\n\t_delete(t, state, \"1\")\n\tassertInt(t, \"mark 'a' not pointing at correct line.\", state.marks[\"a\"], 1)\n\tassertInt(t, \"mark 'b' not pointing at correct line.\", state.marks[\"b\"], 3)\n\n\t// delete line 3 : a->1\n\t_delete(t, state, \"3\")\n\tassertInt(t, \"mark 'a' not pointing at correct line.\", state.marks[\"a\"], 1)\n\tif elem, ok := state.marks[\"b\"]; ok != false {\n\t\tt.Fatalf(\"mark 'b' should not exist, but got: %v\", elem)\n\t}\n}", "title": "" }, { "docid": "f2b310ddccacd485913e36e1ceba6737", "score": "0.53764075", "text": "func (mr *MockStoreMockRecorder) Delete(arg0 interface{}) *gomock.Call {\n\treturn mr.mock.ctrl.RecordCallWithMethodType(mr.mock, \"Delete\", reflect.TypeOf((*MockStore)(nil).Delete), arg0)\n}", "title": "" }, { "docid": "c5027038472856433e6ebce1243caa15", "score": "0.5367981", "text": "func DeleteNoteDecode(_ context.Context, r *http.Request) (interface{}, error) {\n\tvar req note.DeleteNoteRequest\n\terr := json.NewDecoder(r.Body).Decode(&req)\n\treturn req, err\n}", "title": "" }, { "docid": "093b2eb5d7b0acc6fad4ca7633da86b8", "score": "0.53652316", "text": "func TestServiceDeleteTip(t *testing.T) {\n\tConvey(\"TestServiceDeleteTip\", t, func() {\n\t\tvar (\n\t\t\tid int64 = 2\n\t\t)\n\t\terr := s.DeleteTip(c, id, \"baihai\")\n\t\tSo(err, ShouldBeNil)\n\t})\n}", "title": "" }, { "docid": "96bb1e8786e6ffdcfaaa2042de9f0369", "score": "0.53562677", "text": "func (e *ErrorClient) Delete(ctx context.Context, obj client.Object, opts ...client.DeleteOption) error {\n\treturn errors.New(\"for test\")\n}", "title": "" }, { "docid": "83abe2729dc4fa918b2325b8fb4aa3d5", "score": "0.5353566", "text": "func (o *NoteRating) Delete(ctx context.Context, exec boil.ContextExecutor) (int64, error) {\n\tif o == nil {\n\t\treturn 0, errors.New(\"models: no NoteRating provided for delete\")\n\t}\n\n\targs := queries.ValuesFromMapping(reflect.Indirect(reflect.ValueOf(o)), noteRatingPrimaryKeyMapping)\n\tsql := \"DELETE FROM \\\"NoteRatings\\\" WHERE \\\"Id\\\"=$1\"\n\n\tif boil.IsDebug(ctx) {\n\t\twriter := boil.DebugWriterFrom(ctx)\n\t\tfmt.Fprintln(writer, sql)\n\t\tfmt.Fprintln(writer, args...)\n\t}\n\tresult, err := exec.ExecContext(ctx, sql, args...)\n\tif err != nil {\n\t\treturn 0, errors.Wrap(err, \"models: unable to delete from NoteRatings\")\n\t}\n\n\trowsAff, err := result.RowsAffected()\n\tif err != nil {\n\t\treturn 0, errors.Wrap(err, \"models: failed to get rows affected by delete for NoteRatings\")\n\t}\n\n\treturn rowsAff, nil\n}", "title": "" } ]
bc271723fe8a729053db7042ab665135
EXPECT returns an object that allows the caller to indicate expected use
[ { "docid": "c94680bb4e24a61a72bc581bfb61198b", "score": "0.0", "text": "func (m *MockRBACApplicationsClient) EXPECT() *MockRBACApplicationsClientMockRecorder {\n\treturn m.recorder\n}", "title": "" } ]
[ { "docid": "4fdc0eb8e7bb8f27df254ec4fa1a7e8c", "score": "0.62303054", "text": "func (m Mock) Arrange(start Container) {}", "title": "" }, { "docid": "4f902965ba7d8739ef78c7a798fd82e0", "score": "0.59872603", "text": "func Expect(actual, expected interface{}) error {\n\tif !reflect.DeepEqual(actual, expected) {\n\t\treturn fmt.Errorf(\"expected: %v, Actual: %v\", expected, actual)\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "a635f7a7f5d8580d552be9fa27bb24ed", "score": "0.5842445", "text": "func (mmGetObject *mManagerMockGetObject) Expect(ctx context.Context, head insolar.Reference) *mManagerMockGetObject {\n\tif mmGetObject.mock.funcGetObject != nil {\n\t\tmmGetObject.mock.t.Fatalf(\"ManagerMock.GetObject mock is already set by Set\")\n\t}\n\n\tif mmGetObject.defaultExpectation == nil {\n\t\tmmGetObject.defaultExpectation = &ManagerMockGetObjectExpectation{}\n\t}\n\n\tmmGetObject.defaultExpectation.params = &ManagerMockGetObjectParams{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}", "title": "" }, { "docid": "5b484732b88cadd28193d77010a96161", "score": "0.5710829", "text": "func (m Mock) ArrangeRoot() {}", "title": "" }, { "docid": "46e3062cad321714d3fb05af58594848", "score": "0.5672776", "text": "func (r *Request) Expect(t *testing.T) *Response {\n\tr.apiTest.t = t\n\treturn r.apiTest.response\n}", "title": "" }, { "docid": "d834639b10e05c8ea520dd587654c330", "score": "0.55817044", "text": "func NewRequesterArgSameAsImport(t interface {\n\tmock.TestingT\n\tCleanup(func())\n}) *RequesterArgSameAsImport {\n\tmock := &RequesterArgSameAsImport{}\n\tmock.Mock.Test(t)\n\n\tt.Cleanup(func() { mock.AssertExpectations(t) })\n\n\treturn mock\n}", "title": "" }, { "docid": "e6417e4a292a5bda95b4a600cdbe51e7", "score": "0.5575547", "text": "func Expect(t *testing.T, a interface{}, b interface{}) {\n\tif a != b {\n\t\tt.Errorf(\"Expected %v (type %v) - Got %v (type %v)\", b, reflect.TypeOf(b), a, reflect.TypeOf(a))\n\t}\n}", "title": "" }, { "docid": "a07a8687dfccefff4b09ff68e33fd32a", "score": "0.55257505", "text": "func BeCausedBy(err error) types.GomegaMatcher { return &causedByMatcher{expected: err} }", "title": "" }, { "docid": "5db5624a749376398aa047ad973666de", "score": "0.5497303", "text": "func (mmGetTags *mStorageMockGetTags) Expect() *mStorageMockGetTags {\n\tif mmGetTags.mock.funcGetTags != nil {\n\t\tmmGetTags.mock.t.Fatalf(\"StorageMock.GetTags mock is already set by Set\")\n\t}\n\n\tif mmGetTags.defaultExpectation == nil {\n\t\tmmGetTags.defaultExpectation = &StorageMockGetTagsExpectation{}\n\t}\n\n\treturn mmGetTags\n}", "title": "" }, { "docid": "aec992f2355b602077ce165cdbb1352e", "score": "0.54935986", "text": "func (mmActivateObject *mManagerMockActivateObject) Expect(ctx context.Context, domain insolar.Reference, obj insolar.Reference, parent insolar.Reference, prototype insolar.Reference, memory []byte) *mManagerMockActivateObject {\n\tif mmActivateObject.mock.funcActivateObject != nil {\n\t\tmmActivateObject.mock.t.Fatalf(\"ManagerMock.ActivateObject mock is already set by Set\")\n\t}\n\n\tif mmActivateObject.defaultExpectation == nil {\n\t\tmmActivateObject.defaultExpectation = &ManagerMockActivateObjectExpectation{}\n\t}\n\n\tmmActivateObject.defaultExpectation.params = &ManagerMockActivateObjectParams{ctx, domain, obj, parent, prototype, memory}\n\tfor _, e := range mmActivateObject.expectations {\n\t\tif minimock.Equal(e.params, mmActivateObject.defaultExpectation.params) {\n\t\t\tmmActivateObject.mock.t.Fatalf(\"Expectation set by When has same params: %#v\", *mmActivateObject.defaultExpectation.params)\n\t\t}\n\t}\n\n\treturn mmActivateObject\n}", "title": "" }, { "docid": "b4d03399095575b8218151dd79945e88", "score": "0.5465311", "text": "func (mmLoad *mLoaderMockLoad) Expect() *mLoaderMockLoad {\n\tif mmLoad.mock.funcLoad != nil {\n\t\tmmLoad.mock.t.Fatalf(\"LoaderMock.Load mock is already set by Set\")\n\t}\n\n\tif mmLoad.defaultExpectation == nil {\n\t\tmmLoad.defaultExpectation = &LoaderMockLoadExpectation{}\n\t}\n\n\treturn mmLoad\n}", "title": "" }, { "docid": "e86685981e295c763ea686dc63c299e6", "score": "0.5449992", "text": "func (r Request) Expect(response interface{}, statusCode int) RequestExpectant {\n\treturn RequestExpectant{\n\t\tRequest: r,\n\t\tresponse: response,\n\t\tresponseStatusCode: statusCode,\n\t}\n}", "title": "" }, { "docid": "4aee6c6357fe42b9484e2ed999e263dd", "score": "0.5439479", "text": "func (mmGetObject *mManagerMockGetObject) Return(o1 ObjectDescriptor, err error) *ManagerMock {\n\tif mmGetObject.mock.funcGetObject != nil {\n\t\tmmGetObject.mock.t.Fatalf(\"ManagerMock.GetObject mock is already set by Set\")\n\t}\n\n\tif mmGetObject.defaultExpectation == nil {\n\t\tmmGetObject.defaultExpectation = &ManagerMockGetObjectExpectation{mock: mmGetObject.mock}\n\t}\n\tmmGetObject.defaultExpectation.results = &ManagerMockGetObjectResults{o1, err}\n\treturn mmGetObject.mock\n}", "title": "" }, { "docid": "3a2b14f8adbebdc8c9f1996bbe00ca3a", "score": "0.5430829", "text": "func TestTypeAssertion(t *testing.T) {\n\tvar r Retriever\n\tr = &retriever{\n\t\tUserAgent: \"mock\",\n\t\tTimeOut: time.Minute,\n\t}\n\n\t// wrong way!\n\t//t.Log(r.TimeOut)\n\tif rt, ok := r.(*retriever); ok {\n\t\tt.Log(rt.TimeOut)\n\t} else {\n\t\tt.Log(\"Not a *retriever\")\n\t}\n}", "title": "" }, { "docid": "6d514b9c555200df7371bd6d0edc942d", "score": "0.5420425", "text": "func (i *It) Expects(obj interface{}, test interface{}, args ...interface{}) {\n\tvar argValues []reflect.Value\n\n\targValues = AppendValueFor(argValues, obj)\n\tfor _, v := range args {\n\t\targValues = AppendValueFor(argValues, v)\n\t}\n\n\ttestfn := reflect.ValueOf(test)\n\tif testfn.Kind() != reflect.Func {\n\t\tstacktrace := Tabulate(\"Stacktrace: \", GetStackTrace(i.stackOffset), \"\\n\")\n\t\ti.r.Logf(\"%s\\n got: %#v\\n\\n%s\", i.missingMatcherError, test, stacktrace)\n\t\ti.r.FailNow()\n\t\treturn\n\t}\n\n\treturnValues := testfn.Call(argValues)\n\tstr, ok := returnValues[0].String(), returnValues[1].Bool()\n\tif !ok {\n\t\tstacktrace := Tabulate(\" stacktrace: \", GetStackTrace(i.stackOffset), \"\\n\")\n\t\ti.r.Logf(\"expected %s %s\\n%s\", ValueAsString(obj), str, stacktrace)\n\t\ti.r.FailNow()\n\t}\n}", "title": "" }, { "docid": "36436401f8088fae9a39b6c14e8535f8", "score": "0.54139924", "text": "func (m *MockTokener) EXPECT() *MockTokenerMockRecorder {\n\treturn m.recorder\n}", "title": "" }, { "docid": "d6c8c828c13381fffdf085b9f0edadcd", "score": "0.5408328", "text": "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\tFatalFailed(t, \"Value %+v and %+v are not a match\", v, m)\n\t\treturn\n\t}\n\tLogPassed(t, \"Value %+v and %+v are a match\", v, m)\n}", "title": "" }, { "docid": "d4872bc7ebf5f46b769e5cc358ed6efc", "score": "0.5384631", "text": "func (m *MockLookuper) EXPECT() *MockLookuperMockRecorder {\n\treturn m.recorder\n}", "title": "" }, { "docid": "6bfd13a35eb7e1a9bb22d7badd701a73", "score": "0.53831995", "text": "func (m *MockParser) EXPECT() *MockParserMockRecorder {\n\treturn m.recorder\n}", "title": "" }, { "docid": "6bfd13a35eb7e1a9bb22d7badd701a73", "score": "0.53831995", "text": "func (m *MockParser) EXPECT() *MockParserMockRecorder {\n\treturn m.recorder\n}", "title": "" }, { "docid": "ac69ad365a27a13644b7df974cc46b9c", "score": "0.5381905", "text": "func TestUnsucessfulAccessors(t *testing.T) {\n\tctx := context.TODO()\n\n\tuid, uidOK := UserID(ctx)\n\tcid, cidOK := ClientID(ctx)\n\tbt, btOK := BearerToken(ctx)\n\tscopes := Scopes(ctx)\n\thasScope := HasScope(ctx, \"scope2\")\n\n\tif uid != \"\" || uidOK {\n\t\tt.Fatalf(\"Expected no %v, got: %v\", \"UserID\", uid)\n\t}\n\n\tif cid != \"\" || cidOK {\n\t\tt.Fatalf(\"Expected no %v, got: %v\", \"ClientID\", cid)\n\t}\n\n\tif bt != \"\" || btOK {\n\t\tt.Fatalf(\"Expected no %v, got: %v\", \"BearerToken\", bt)\n\t}\n\n\tif len(scopes) > 0 {\n\t\tt.Fatalf(\"Expected no scopes, got: %v\", scopes)\n\t}\n\n\tif hasScope {\n\t\tt.Fatalf(\"Expected hasScope to return false, got: %v\", hasScope)\n\t}\n}", "title": "" }, { "docid": "9af0f61b2a091acf2687e69f37710494", "score": "0.5378451", "text": "func testBeAvailable(t *testing.T, context spec.G, it spec.S) {\n\tvar (\n\t\tExpect = NewWithT(t).Expect\n\n\t\tmatcher types.GomegaMatcher\n\t)\n\n\tit.Before(func() {\n\t\tmatcher = matchers.BeAvailable()\n\t})\n\n\tcontext(\"Match\", func() {\n\t\tvar (\n\t\t\tactual interface{}\n\t\t\tserver *httptest.Server\n\t\t)\n\n\t\tit.Before(func() {\n\t\t\tserver = httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, req *http.Request) {}))\n\t\t\tserverURL, err := url.Parse(server.URL)\n\t\t\tExpect(err).NotTo(HaveOccurred())\n\n\t\t\tactual = occam.Container{\n\t\t\t\tPorts: map[string]string{\n\t\t\t\t\t\"8080\": serverURL.Port(),\n\t\t\t\t\t\"3000\": \"1234\",\n\t\t\t\t\t\"4000\": \"4321\",\n\t\t\t\t\t\"5000\": \"5678\",\n\t\t\t\t},\n\t\t\t\tEnv: map[string]string{\n\t\t\t\t\t\"PORT\": \"8080\",\n\t\t\t\t},\n\t\t\t}\n\t\t})\n\n\t\tit.After(func() {\n\t\t\tserver.Close()\n\t\t})\n\n\t\tcontext(\"when the http request succeeds\", func() {\n\t\t\tit(\"returns true\", func() {\n\t\t\t\tresult, err := matcher.Match(actual)\n\t\t\t\tExpect(err).NotTo(HaveOccurred())\n\t\t\t\tExpect(result).To(BeTrue())\n\t\t\t})\n\t\t})\n\n\t\tcontext(\"when the http request fails\", func() {\n\t\t\tit.Before(func() {\n\t\t\t\tserver.Close()\n\t\t\t})\n\n\t\t\tit(\"returns false\", func() {\n\t\t\t\tresult, err := matcher.Match(actual)\n\t\t\t\tExpect(err).NotTo(HaveOccurred())\n\t\t\t\tExpect(result).To(BeFalse())\n\t\t\t})\n\t\t})\n\n\t\tcontext(\"failure cases\", func() {\n\t\t\tcontext(\"when the actual is not a container\", func() {\n\t\t\t\tit(\"returns an error\", func() {\n\t\t\t\t\t_, err := matcher.Match(\"not a container\")\n\t\t\t\t\tExpect(err).To(MatchError(\"BeAvailableMatcher expects an occam.Container, received string\"))\n\t\t\t\t})\n\t\t\t})\n\t\t})\n\t})\n\n\tcontext(\"FailureMessage\", func() {\n\t\tvar actual interface{}\n\n\t\tit.Before(func() {\n\t\t\texecutable := &fakes.Executable{}\n\t\t\texecutable.ExecuteCall.Stub = func(execution pexec.Execution) error {\n\t\t\t\tfmt.Fprintln(execution.Stdout, \"some logs\")\n\t\t\t\treturn nil\n\t\t\t}\n\n\t\t\tmatcher = &matchers.BeAvailableMatcher{\n\t\t\t\tDocker: occam.NewDocker().WithExecutable(executable),\n\t\t\t}\n\n\t\t\tactual = occam.Container{\n\t\t\t\tID: \"some-container-id\",\n\t\t\t}\n\t\t})\n\n\t\tit(\"returns a useful error message\", func() {\n\t\t\tmessage := matcher.FailureMessage(actual)\n\t\t\tExpect(message).To(ContainSubstring(strings.TrimSpace(`\nExpected\n\tdocker container id: some-container-id\nto be available.\n\nContainer logs:\n\nsome logs\n`)))\n\t\t})\n\t})\n\n\tcontext(\"NegatedFailureMessage\", func() {\n\t\tvar actual interface{}\n\n\t\tit.Before(func() {\n\t\t\texecutable := &fakes.Executable{}\n\t\t\texecutable.ExecuteCall.Stub = func(execution pexec.Execution) error {\n\t\t\t\tfmt.Fprintln(execution.Stdout, \"some logs\")\n\t\t\t\treturn nil\n\t\t\t}\n\n\t\t\tmatcher = &matchers.BeAvailableMatcher{\n\t\t\t\tDocker: occam.NewDocker().WithExecutable(executable),\n\t\t\t}\n\n\t\t\tactual = occam.Container{\n\t\t\t\tID: \"some-container-id\",\n\t\t\t}\n\t\t})\n\n\t\tit(\"returns a useful error message\", func() {\n\t\t\tmessage := matcher.NegatedFailureMessage(actual)\n\t\t\tExpect(message).To(ContainSubstring(strings.TrimSpace(`\nExpected\n\tdocker container id: some-container-id\nnot to be available.\n\nContainer logs:\n\nsome logs\n`)))\n\t\t})\n\t})\n}", "title": "" }, { "docid": "1ffdd01c0507a7cac821a4784fdd5cd4", "score": "0.53749806", "text": "func (mmUseProxy *mResolverMockUseProxy) Expect(m1 coordinates.Module) *mResolverMockUseProxy {\n\tif mmUseProxy.mock.funcUseProxy != nil {\n\t\tmmUseProxy.mock.t.Fatalf(\"ResolverMock.UseProxy mock is already set by Set\")\n\t}\n\n\tif mmUseProxy.defaultExpectation == nil {\n\t\tmmUseProxy.defaultExpectation = &ResolverMockUseProxyExpectation{}\n\t}\n\n\tmmUseProxy.defaultExpectation.params = &ResolverMockUseProxyParams{m1}\n\tfor _, e := range mmUseProxy.expectations {\n\t\tif minimock.Equal(e.params, mmUseProxy.defaultExpectation.params) {\n\t\t\tmmUseProxy.mock.t.Fatalf(\"Expectation set by When has same params: %#v\", *mmUseProxy.defaultExpectation.params)\n\t\t}\n\t}\n\n\treturn mmUseProxy\n}", "title": "" }, { "docid": "e865cc73330230fdd0dfed621982152f", "score": "0.53647375", "text": "func (m *mObjectStorageMockGetRecord) Expect(p context.Context, p1 insolar.ID, p2 *insolar.ID) *mObjectStorageMockGetRecord {\n\tm.mock.GetRecordFunc = nil\n\tm.expectationSeries = nil\n\n\tif m.mainExpectation == nil {\n\t\tm.mainExpectation = &ObjectStorageMockGetRecordExpectation{}\n\t}\n\tm.mainExpectation.input = &ObjectStorageMockGetRecordInput{p, p1, p2}\n\treturn m\n}", "title": "" }, { "docid": "57e56621be1256f2b25158826e5498f7", "score": "0.53646356", "text": "func (m *MockbucketFactory) EXPECT() *MockbucketFactoryMockRecorder {\n\treturn m.recorder\n}", "title": "" }, { "docid": "5ba2cfc495b6bd9dad79f2aaf3296c36", "score": "0.53556764", "text": "func (mmAnnotatef *mSpanInterfaceMockAnnotatef) Expect(attributes []mm_trace.Attribute, format string, a ...interface{}) *mSpanInterfaceMockAnnotatef {\n\tif mmAnnotatef.mock.funcAnnotatef != nil {\n\t\tmmAnnotatef.mock.t.Fatalf(\"SpanInterfaceMock.Annotatef mock is already set by Set\")\n\t}\n\n\tif mmAnnotatef.defaultExpectation == nil {\n\t\tmmAnnotatef.defaultExpectation = &SpanInterfaceMockAnnotatefExpectation{}\n\t}\n\n\tmmAnnotatef.defaultExpectation.params = &SpanInterfaceMockAnnotatefParams{attributes, format, a}\n\tfor _, e := range mmAnnotatef.expectations {\n\t\tif minimock.Equal(e.params, mmAnnotatef.defaultExpectation.params) {\n\t\t\tmmAnnotatef.mock.t.Fatalf(\"Expectation set by When has same params: %#v\", *mmAnnotatef.defaultExpectation.params)\n\t\t}\n\t}\n\n\treturn mmAnnotatef\n}", "title": "" }, { "docid": "1cb8466257781cb8e5ca77a2a91dcadc", "score": "0.53434545", "text": "func (*mockManager) RequireOwner(context.Context) error {\n\treturn nil\n}", "title": "" }, { "docid": "80550d660d2fb1f0eec57384bba26513", "score": "0.53426415", "text": "func (o *GivenEvent) Expect(outputs ...interface{}) *WrappedFunction {\n\ts := o._w.scenarios[o.subtestName]\n\tfor _, out := range outputs {\n\t\ts.outputs = append(s.outputs, reflect.ValueOf(out))\n\t}\n\to._w.scenarios[o.subtestName] = s\n\treturn o._w\n}", "title": "" }, { "docid": "7f76b44691172a01ea717fa712cf269f", "score": "0.53426236", "text": "func TestMyFunction(t *testing.T) {\n\tmockedUserStore := MockUserStore{}\n\n\tmockedUserStore.On(\"GetUser\", \"Cube\").Return(&User{Name: \"Jakub\", Surname: \"Martin\", Age: 18}, nil)\n\tmockedUserStore.On(\"GetUser\", \"Cube2\").Return(nil, errors.Errorf(\"User not found.\"))\n\tmockedUserStore.On(\"SetUser\", \"Cube\", mock.AnythingOfType(\"*mocking.User\")).Return(errors.Errorf(\"User already exists.\"))\n\tmockedUserStore.On(\"SetUser\", \"Cube2\", mock.AnythingOfType(\"*mocking.User\")).Return(nil)\n\n\tuser, err := mockedUserStore.GetUser(\"Cube\")\n\tif err != nil {\n\t\tt.Log(err)\n\t} else {\n\t\tt.Logf(\"%v\", user)\n\t}\n\tuser, err = mockedUserStore.GetUser(\"Cube2\")\n\tif err != nil {\n\t\tt.Log(err)\n\t} else {\n\t\tt.Logf(\"%v\", user)\n\t}\n\terr = mockedUserStore.SetUser(\"Cube\", &User{Name: \"Jakub\", Surname: \"Martin\", Age:18})\n\tif err != nil {\n\t\tt.Log(err)\n\t}\n\terr = mockedUserStore.SetUser(\"Cube2\", &User{Name: \"Jakub\", Surname: \"Martin2\", Age:18})\n\tif err != nil {\n\t\tt.Log(err)\n\t}\n}", "title": "" }, { "docid": "0aa7a45c9646271a5f7804b79c2f4d41", "score": "0.53415775", "text": "func (mmAnnotate *mSpanInterfaceMockAnnotate) Expect(attributes []mm_trace.Attribute, str string) *mSpanInterfaceMockAnnotate {\n\tif mmAnnotate.mock.funcAnnotate != nil {\n\t\tmmAnnotate.mock.t.Fatalf(\"SpanInterfaceMock.Annotate mock is already set by Set\")\n\t}\n\n\tif mmAnnotate.defaultExpectation == nil {\n\t\tmmAnnotate.defaultExpectation = &SpanInterfaceMockAnnotateExpectation{}\n\t}\n\n\tmmAnnotate.defaultExpectation.params = &SpanInterfaceMockAnnotateParams{attributes, str}\n\tfor _, e := range mmAnnotate.expectations {\n\t\tif minimock.Equal(e.params, mmAnnotate.defaultExpectation.params) {\n\t\t\tmmAnnotate.mock.t.Fatalf(\"Expectation set by When has same params: %#v\", *mmAnnotate.defaultExpectation.params)\n\t\t}\n\t}\n\n\treturn mmAnnotate\n}", "title": "" }, { "docid": "e087be0d28ef44ba534c9160877fd9c5", "score": "0.5338828", "text": "func (mmUpdateObject *mManagerMockUpdateObject) Expect(ctx context.Context, domain insolar.Reference, request insolar.Reference, obj ObjectDescriptor, memory []byte) *mManagerMockUpdateObject {\n\tif mmUpdateObject.mock.funcUpdateObject != nil {\n\t\tmmUpdateObject.mock.t.Fatalf(\"ManagerMock.UpdateObject mock is already set by Set\")\n\t}\n\n\tif mmUpdateObject.defaultExpectation == nil {\n\t\tmmUpdateObject.defaultExpectation = &ManagerMockUpdateObjectExpectation{}\n\t}\n\n\tmmUpdateObject.defaultExpectation.params = &ManagerMockUpdateObjectParams{ctx, domain, request, obj, memory}\n\tfor _, e := range mmUpdateObject.expectations {\n\t\tif minimock.Equal(e.params, mmUpdateObject.defaultExpectation.params) {\n\t\t\tmmUpdateObject.mock.t.Fatalf(\"Expectation set by When has same params: %#v\", *mmUpdateObject.defaultExpectation.params)\n\t\t}\n\t}\n\n\treturn mmUpdateObject\n}", "title": "" }, { "docid": "54f32e9ee8e84dade4cfef3b3a5960c2", "score": "0.5332318", "text": "func TestTheTester(t *testing.T) {\n\tensureFailed(t, func(ft *testing.T) {\n\t\trequire.Assignable(ft, typ.String, typ.Integer)\n\t})\n\tensureFailed(t, func(ft *testing.T) {\n\t\trequire.NotAssignable(ft, typ.String, typ.String)\n\t})\n\tensureFailed(t, func(ft *testing.T) {\n\t\trequire.Instance(ft, typ.String, 2)\n\t})\n\tensureFailed(t, func(ft *testing.T) {\n\t\trequire.NotInstance(ft, typ.String, `a`)\n\t})\n\tensureFailed(t, func(ft *testing.T) {\n\t\trequire.Equal(ft, `a`, `b`)\n\t})\n\tensureFailed(t, func(ft *testing.T) {\n\t\trequire.NotEqual(ft, `a`, `a`)\n\t})\n\tensureFailed(t, func(ft *testing.T) {\n\t\trequire.Match(ft, regexp.MustCompile(`foo`), `bar`)\n\t})\n\tensureFailed(t, func(ft *testing.T) {\n\t\trequire.Match(ft, 23, `bar`)\n\t})\n\tensureFailed(t, func(ft *testing.T) {\n\t\trequire.Match(ft, `bar`, 23)\n\t})\n\trequire.Match(t, `xyz`, `has xyz in it`)\n\trequire.Match(t, vf.String(`xyz`), `has xyz in it`)\n\tensureFailed(t, func(ft *testing.T) {\n\t\trequire.NoMatch(ft, `bar`, `bar`)\n\t})\n\trequire.NoMatch(t, `abc`, `has xyz in it`)\n\tensureFailed(t, func(ft *testing.T) {\n\t\trequire.Ok(ft, errors.New(`nope`))\n\t})\n\tensureFailed(t, func(ft *testing.T) {\n\t\trequire.NotOk(ft, `yep`, nil)\n\t})\n\tensureFailed(t, func(ft *testing.T) {\n\t\trequire.NotOk(ft, `yep`, errors.New(`nope`))\n\t})\n\tensureFailed(t, func(ft *testing.T) {\n\t\trequire.Same(ft, `a`, `b`)\n\t})\n\tensureFailed(t, func(ft *testing.T) {\n\t\trequire.NotSame(ft, `a`, `a`)\n\t})\n\tensureFailed(t, func(ft *testing.T) {\n\t\trequire.False(ft, true)\n\t})\n\tensureFailed(t, func(ft *testing.T) {\n\t\trequire.True(ft, false, `not`, `true`)\n\t})\n\tensureFailed(t, func(ft *testing.T) {\n\t\trequire.Nil(ft, true)\n\t})\n\tensureFailed(t, func(ft *testing.T) {\n\t\trequire.NotNil(ft, nil)\n\t})\n\tensureFailed(t, func(ft *testing.T) {\n\t\trequire.Panic(ft, func() {}, `this`)\n\t})\n\tensureFailed(t, func(ft *testing.T) {\n\t\trequire.Panic(ft, func() { panic(`this`) }, `that`)\n\t})\n\tensureFailed(t, func(ft *testing.T) {\n\t\trequire.Panic(ft, func() { panic(errors.New(`this`)) }, `that`)\n\t})\n}", "title": "" }, { "docid": "46480f23e2219b95d1f24bfe770c072b", "score": "0.53227866", "text": "func (mmRegister *mRegistererMockRegister) Expect(c1 mm_prometheus.Collector) *mRegistererMockRegister {\n\tif mmRegister.mock.funcRegister != nil {\n\t\tmmRegister.mock.t.Fatalf(\"RegistererMock.Register mock is already set by Set\")\n\t}\n\n\tif mmRegister.defaultExpectation == nil {\n\t\tmmRegister.defaultExpectation = &RegistererMockRegisterExpectation{}\n\t}\n\n\tmmRegister.defaultExpectation.params = &RegistererMockRegisterParams{c1}\n\tfor _, e := range mmRegister.expectations {\n\t\tif minimock.Equal(e.params, mmRegister.defaultExpectation.params) {\n\t\t\tmmRegister.mock.t.Fatalf(\"Expectation set by When has same params: %#v\", *mmRegister.defaultExpectation.params)\n\t\t}\n\t}\n\n\treturn mmRegister\n}", "title": "" }, { "docid": "b6a04fff27407c28532d70940b7158cb", "score": "0.5320622", "text": "func TestMockerExpectIsSimilarQuestion(t *testing.T) {\n\tclient, mocker, _ := New()\n\tmocker.ExpectIsSimilarQuestion(\"csbot\", \"subjectA\").WillReturn(true)\n\tisSimQ, err := client.IsSimilarQuestion(\"csbot\", \"subjectA\")\n\tif err != nil {\n\t\tt.Fatal(\"expect no error but got, \", err)\n\t}\n\tif isSimQ != true {\n\t\tt.Fatal(\"expect value to be true, but got false\")\n\t}\n\tmocker.ExpectIsSimilarQuestion(\"csbot\", \"subjectA\").WillReturn(false)\n\tisSimQ, err = client.IsSimilarQuestion(\"csbot\", \"subjectA\")\n\tif err != nil {\n\t\tt.Fatal(\"expect no error but got \", err)\n\t}\n\tif isSimQ {\n\t\tt.Fatal(\"expect value to be false, but got true\")\n\t}\n\tmocker.ExpectIsSimilarQuestion(\"csbot\", \"subjectA\").WillFail()\n\t_, err = client.IsSimilarQuestion(\"csbot\", \"subjectA\")\n\tif err == nil {\n\t\tt.Fatal(\"expect to failed but got err == nil\")\n\t}\n}", "title": "" }, { "docid": "c73a7ef1a055e1ffc10564f4f639312a", "score": "0.5314804", "text": "func (m *MockVariable) Usage() string {\n\tret := m.ctrl.Call(m, \"Usage\")\n\tret0, _ := ret[0].(string)\n\treturn ret0\n}", "title": "" }, { "docid": "789978f68430496ebd41ef75c2e15710", "score": "0.5311656", "text": "func (_m *MockUserUsecase) EXPECT() *MockUserUsecaseMockRecorder {\n\treturn _m.recorder\n}", "title": "" }, { "docid": "2b0797e5d69d4f51216d1346a85d90dd", "score": "0.5308869", "text": "func (mmRegisterResult *mManagerMockRegisterResult) Expect(ctx context.Context, obj insolar.Reference, request insolar.Reference, payload []byte) *mManagerMockRegisterResult {\n\tif mmRegisterResult.mock.funcRegisterResult != nil {\n\t\tmmRegisterResult.mock.t.Fatalf(\"ManagerMock.RegisterResult mock is already set by Set\")\n\t}\n\n\tif mmRegisterResult.defaultExpectation == nil {\n\t\tmmRegisterResult.defaultExpectation = &ManagerMockRegisterResultExpectation{}\n\t}\n\n\tmmRegisterResult.defaultExpectation.params = &ManagerMockRegisterResultParams{ctx, obj, request, payload}\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}", "title": "" }, { "docid": "5d695a2909565d104acc0790ce0ccf1e", "score": "0.5306891", "text": "func (m *MockUsecase) EXPECT() *MockUsecaseMockRecorder {\n\treturn m.recorder\n}", "title": "" }, { "docid": "5d695a2909565d104acc0790ce0ccf1e", "score": "0.5306891", "text": "func (m *MockUsecase) EXPECT() *MockUsecaseMockRecorder {\n\treturn m.recorder\n}", "title": "" }, { "docid": "16c717fa3bc0864260da17236e614620", "score": "0.5295391", "text": "func (m *MockCreator) EXPECT() *MockCreatorMockRecorder {\n\treturn m.recorder\n}", "title": "" }, { "docid": "16c717fa3bc0864260da17236e614620", "score": "0.5295391", "text": "func (m *MockCreator) EXPECT() *MockCreatorMockRecorder {\n\treturn m.recorder\n}", "title": "" }, { "docid": "c1cdb39e069fbdd79d47fac5f17736a3", "score": "0.5293633", "text": "func (at *Assertions) Expect(expect string, actual interface{}, args ...interface{}) bool {\n\tinfo, call, cinfo := argsFn(args...)\n\treturn Expect(at.t, expect, actual, info, call, cinfo)\n}", "title": "" }, { "docid": "7c9de874ba7977c4b6499dbc60a18d74", "score": "0.52900714", "text": "func NewExpectation(action string, result string, params common.Params) Expected {\n\treturn Expected{\n\t\tAction: action,\n\t\tResult: result,\n\t\tParams: params,\n\t}\n}", "title": "" }, { "docid": "2b7f3cdea4b4da67ab37961fd2cfe90e", "score": "0.52884996", "text": "func (pk MockPrivKeyLedgerEd25519) AssertIsPrivKeyInner() {}", "title": "" }, { "docid": "3129bc1d06f3327e5a658f1f9769a660", "score": "0.528677", "text": "func (m *Mockresourcemanager) EXPECT() *MockresourcemanagerMockRecorder {\n\treturn m.recorder\n}", "title": "" }, { "docid": "3f42001e406c49bce04a9346f5612324", "score": "0.5280259", "text": "func (mmSetStatus *mSpanInterfaceMockSetStatus) Expect(status mm_trace.Status) *mSpanInterfaceMockSetStatus {\n\tif mmSetStatus.mock.funcSetStatus != nil {\n\t\tmmSetStatus.mock.t.Fatalf(\"SpanInterfaceMock.SetStatus mock is already set by Set\")\n\t}\n\n\tif mmSetStatus.defaultExpectation == nil {\n\t\tmmSetStatus.defaultExpectation = &SpanInterfaceMockSetStatusExpectation{}\n\t}\n\n\tmmSetStatus.defaultExpectation.params = &SpanInterfaceMockSetStatusParams{status}\n\tfor _, e := range mmSetStatus.expectations {\n\t\tif minimock.Equal(e.params, mmSetStatus.defaultExpectation.params) {\n\t\t\tmmSetStatus.mock.t.Fatalf(\"Expectation set by When has same params: %#v\", *mmSetStatus.defaultExpectation.params)\n\t\t}\n\t}\n\n\treturn mmSetStatus\n}", "title": "" }, { "docid": "0f6983369edd5ab30e5118b25943be40", "score": "0.52660066", "text": "func (c JSONResponse) Expect(t *testing.T, eval func(c JSONResponse) error) JSONResponse {\n\tif c.Error != nil {\n\t\treturn c\n\t}\n\n\terr := eval(c)\n\n\tmsg := \"\"\n\tif err != nil {\n\t\tmsg = err.Error()\n\t}\n\tassert.Nil(t, err, msg)\n\n\treturn c\n}", "title": "" }, { "docid": "fd4cf9984685e636b20e0d54712b08d1", "score": "0.52607465", "text": "func (mmString *mSpanInterfaceMockString) Expect() *mSpanInterfaceMockString {\n\tif mmString.mock.funcString != nil {\n\t\tmmString.mock.t.Fatalf(\"SpanInterfaceMock.String mock is already set by Set\")\n\t}\n\n\tif mmString.defaultExpectation == nil {\n\t\tmmString.defaultExpectation = &SpanInterfaceMockStringExpectation{}\n\t}\n\n\treturn mmString\n}", "title": "" }, { "docid": "fe62763bf6dd6cdfff5e7e5ffbb47620", "score": "0.5258378", "text": "func (mmOpen *mManagerMockOpen) Return(err error) *ManagerMock {\n\tif mmOpen.mock.funcOpen != nil {\n\t\tmmOpen.mock.t.Fatalf(\"ManagerMock.Open mock is already set by Set\")\n\t}\n\n\tif mmOpen.defaultExpectation == nil {\n\t\tmmOpen.defaultExpectation = &ManagerMockOpenExpectation{mock: mmOpen.mock}\n\t}\n\tmmOpen.defaultExpectation.results = &ManagerMockOpenResults{err}\n\treturn mmOpen.mock\n}", "title": "" }, { "docid": "4276e5a212a4cee696d419a935e214c7", "score": "0.52545565", "text": "func (m *MockS3API) EXPECT() *MockS3APIMockRecorder {\n\treturn m.recorder\n}", "title": "" }, { "docid": "df20d47f7a1e740eff3f93ed682b3ca3", "score": "0.5249454", "text": "func mockedGranter(kubeutil *kube.Kube, app *v1.RadixRegistration, namespace string, serviceAccount *corev1.ServiceAccount) error {\n\treturn nil\n}", "title": "" }, { "docid": "abb9505980add193ad2fb7de91db8401", "score": "0.5248428", "text": "func (m *mObjectStorageMockGetBlob) Expect(p context.Context, p1 insolar.ID, p2 *insolar.ID) *mObjectStorageMockGetBlob {\n\tm.mock.GetBlobFunc = nil\n\tm.expectationSeries = nil\n\n\tif m.mainExpectation == nil {\n\t\tm.mainExpectation = &ObjectStorageMockGetBlobExpectation{}\n\t}\n\tm.mainExpectation.input = &ObjectStorageMockGetBlobInput{p, p1, p2}\n\treturn m\n}", "title": "" }, { "docid": "a48d44cd14fc094bcbc070180085952f", "score": "0.52476346", "text": "func (m *MockstackSerializer) EXPECT() *MockstackSerializerMockRecorder {\n\treturn m.recorder\n}", "title": "" }, { "docid": "3f56af0f2cae39bc9d6700f2911f8ebe", "score": "0.5247415", "text": "func (m *MockArticle) EXPECT() *MockArticleMockRecorder {\n\treturn m.recorder\n}", "title": "" }, { "docid": "45cf39b6a69940c8e4fcf57215e9b8e0", "score": "0.5247193", "text": "func (mmInsertPet *mPetStoreMockInsertPet) Expect(age int, name string, kind string) *mPetStoreMockInsertPet {\n\tif mmInsertPet.mock.funcInsertPet != nil {\n\t\tmmInsertPet.mock.t.Fatalf(\"PetStoreMock.InsertPet mock is already set by Set\")\n\t}\n\n\tif mmInsertPet.defaultExpectation == nil {\n\t\tmmInsertPet.defaultExpectation = &PetStoreMockInsertPetExpectation{}\n\t}\n\n\tmmInsertPet.defaultExpectation.params = &PetStoreMockInsertPetParams{age, name, kind}\n\tfor _, e := range mmInsertPet.expectations {\n\t\tif minimock.Equal(e.params, mmInsertPet.defaultExpectation.params) {\n\t\t\tmmInsertPet.mock.t.Fatalf(\"Expectation set by When has same params: %#v\", *mmInsertPet.defaultExpectation.params)\n\t\t}\n\t}\n\n\treturn mmInsertPet\n}", "title": "" }, { "docid": "3f814ae9f3d4243db149b574a94bd256", "score": "0.52429163", "text": "func (mmEnd *mSpanInterfaceMockEnd) Expect() *mSpanInterfaceMockEnd {\n\tif mmEnd.mock.funcEnd != nil {\n\t\tmmEnd.mock.t.Fatalf(\"SpanInterfaceMock.End mock is already set by Set\")\n\t}\n\n\tif mmEnd.defaultExpectation == nil {\n\t\tmmEnd.defaultExpectation = &SpanInterfaceMockEndExpectation{}\n\t}\n\n\treturn mmEnd\n}", "title": "" }, { "docid": "3ab5ca44aae2eedebb5e7b06f2628484", "score": "0.5233109", "text": "func (m *MockCatalog) EXPECT() *MockCatalogMockRecorder {\n\treturn m.recorder\n}", "title": "" }, { "docid": "4143f2be0b35b4cd2cbdeb4302e945e0", "score": "0.523251", "text": "func (c ClientResponse) Expect(t *testing.T, eval func(c ClientResponse) error) ClientResponse {\n\tif c.Error != nil {\n\t\treturn c\n\t}\n\n\terr := eval(c)\n\n\tmsg := \"\"\n\tif err != nil {\n\t\tmsg = err.Error()\n\t}\n\tassert.Nil(t, err, msg)\n\n\treturn c\n}", "title": "" }, { "docid": "42b7df76ce679ac41dd3930da5c6026c", "score": "0.52292424", "text": "func (mmSpanContext *mSpanInterfaceMockSpanContext) Expect() *mSpanInterfaceMockSpanContext {\n\tif mmSpanContext.mock.funcSpanContext != nil {\n\t\tmmSpanContext.mock.t.Fatalf(\"SpanInterfaceMock.SpanContext mock is already set by Set\")\n\t}\n\n\tif mmSpanContext.defaultExpectation == nil {\n\t\tmmSpanContext.defaultExpectation = &SpanInterfaceMockSpanContextExpectation{}\n\t}\n\n\treturn mmSpanContext\n}", "title": "" }, { "docid": "db233e59c28bb11b57d88f1c4afa584e", "score": "0.52267176", "text": "func Test_Controller(t *testing.T) {\n\tl := &logrus.Logger{}\n\tr := render.New()\n\n\ttests := []struct {\n\t\tname string\n\t\texpectedParams string\n\t\texpectedUsecaseResponse string\n\t\texpectUsecaseCall bool\n\t\texpectedError error\n\t\twantError bool\n\t}{\n\t\t{\n\t\t\tname: \"OK, get square\",\n\t\t\texpectedParams: \"square\",\n\t\t\texpectedUsecaseResponse: \"hi\",\n\t\t\texpectUsecaseCall: true,\n\t\t\twantError: false,\n\t\t\texpectedError: nil,\n\t\t},\n\t\t//Create scenario for 404\n\t\t{\n\t\t\tname: \"404 - Not Found\",\n\t\t\texpectedParams: \"squares\",\n\t\t\texpectedUsecaseResponse: \"Not Found\",\n\t\t\texpectUsecaseCall: true,\n\t\t\twantError: true,\n\t\t\texpectedError: errors.New(\"Not found\"),\n\t\t},\n\t}\n\tfor _, tt := range tests {\n\t\tt.Run(tt.name, func(t *testing.T) {\n\t\t\tmockCtrl := gomock.NewController(t)\n\t\t\tdefer mockCtrl.Finish()\n\n\t\t\tu := mocks.NewMockUseCase(mockCtrl)\n\n\t\t\tif tt.expectUsecaseCall {\n\t\t\t\tu.EXPECT().GetShapeByName(tt.expectedParams).Return(tt.expectedUsecaseResponse, tt.expectedError)\n\t\t\t}\n\n\t\t\tc := New(u, l, r)\n\n\t\t\tresponse, err := c.useCase.GetShapeByName(tt.expectedParams)\n\t\t\tassert.Equal(t, response, tt.expectedUsecaseResponse)\n\n\t\t\t// Pro gamer tip: Use wantError to check if the error should be nil\n\t\t\tif tt.wantError {\n\t\t\t\tassert.NotNil(t, err)\n\t\t\t\tassert.Equal(t, err, tt.expectedError)\n\t\t\t} else {\n\t\t\t\tassert.Nil(t, err)\n\t\t\t}\n\t\t})\n\t}\n}", "title": "" }, { "docid": "60c187fa546096053c4c226d3df115a8", "score": "0.5224775", "text": "func Expect(msg string) error {\n\tif msg != \"\" {\n\t\treturn errors.New(msg)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "552b61d14346efc78ea9402e9c625d95", "score": "0.52160054", "text": "func TestMockEClassifierIsInstance(t *testing.T) {\n\to := &MockEClassifier{}\n\tobject := interface{}(nil)\n\tr := bool(true)\n\to.On(\"IsInstance\", object).Return(r).Once()\n\to.On(\"IsInstance\", object).Return(func() bool {\n\t\treturn r\n\t}).Once()\n\tassert.Equal(t, r, o.IsInstance(object))\n\tassert.Equal(t, r, o.IsInstance(object))\n\to.AssertExpectations(t)\n}", "title": "" }, { "docid": "bc5a539fc82a9afbd566ac636ce91eb0", "score": "0.5214075", "text": "func (mmRead *mReadCloserMockRead) Expect(p []byte) *mReadCloserMockRead {\n\tif mmRead.mock.funcRead != nil {\n\t\tmmRead.mock.t.Fatalf(\"ReadCloserMock.Read mock is already set by Set\")\n\t}\n\n\tif mmRead.defaultExpectation == nil {\n\t\tmmRead.defaultExpectation = &ReadCloserMockReadExpectation{}\n\t}\n\n\tmmRead.defaultExpectation.params = &ReadCloserMockReadParams{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}", "title": "" }, { "docid": "0826e6556484034a000ecb3e2cdec2c3", "score": "0.5208649", "text": "func (mmSend *mAlerterMockSend) Expect(e1 error) *mAlerterMockSend {\n\tif mmSend.mock.funcSend != nil {\n\t\tmmSend.mock.t.Fatalf(\"AlerterMock.Send mock is already set by Set\")\n\t}\n\n\tif mmSend.defaultExpectation == nil {\n\t\tmmSend.defaultExpectation = &AlerterMockSendExpectation{}\n\t}\n\n\tmmSend.defaultExpectation.params = &AlerterMockSendParams{e1}\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}", "title": "" }, { "docid": "3e2157508c714be4487adda8a0513c9c", "score": "0.52053934", "text": "func Expect(t *testing.T, request *ExpectRequest) bool {\n\treturn tester.Expect(t, request)\n}", "title": "" }, { "docid": "6a7ac63a5a4dff49514a329aaa87d213", "score": "0.5205139", "text": "func assertInFlutterProject() {\n\tgetPubSpec()\n}", "title": "" }, { "docid": "fa7881f7e10a01ffae403c8b48b94e67", "score": "0.5204276", "text": "func (mmReply *mSenderMockReply) Expect(ctx context.Context, origin payload.Meta, reply *message.Message) *mSenderMockReply {\n\tif mmReply.mock.funcReply != nil {\n\t\tmmReply.mock.t.Fatalf(\"SenderMock.Reply mock is already set by Set\")\n\t}\n\n\tif mmReply.defaultExpectation == nil {\n\t\tmmReply.defaultExpectation = &SenderMockReplyExpectation{}\n\t}\n\n\tmmReply.defaultExpectation.params = &SenderMockReplyParams{ctx, origin, reply}\n\tfor _, e := range mmReply.expectations {\n\t\tif minimock.Equal(e.params, mmReply.defaultExpectation.params) {\n\t\t\tmmReply.mock.t.Fatalf(\"Expectation set by When has same params: %#v\", *mmReply.defaultExpectation.params)\n\t\t}\n\t}\n\n\treturn mmReply\n}", "title": "" }, { "docid": "60ff8bbf0dd75116054c85958c1acdc3", "score": "0.5198487", "text": "func mockOriginator() *Originator {\n\to := NewOriginator()\n\to.Personal.IdentificationCode = PassportNumber\n\to.Personal.Identifier = \"1234\"\n\to.Personal.Name = \"Name\"\n\to.Personal.Address.AddressLineOne = \"Address One\"\n\to.Personal.Address.AddressLineTwo = \"Address Two\"\n\to.Personal.Address.AddressLineThree = \"Address Three\"\n\treturn o\n}", "title": "" }, { "docid": "9705ee7160aeab377611f873b51170fc", "score": "0.519428", "text": "func (m *MockInputMaker) EXPECT() *MockInputMakerMockRecorder {\r\n\treturn m.recorder\r\n}", "title": "" }, { "docid": "d5c526695f8e50e9edc5c71ad74b7ba7", "score": "0.5192851", "text": "func (_m *MockConsumerFactory) EXPECT() *MockConsumerFactoryMockRecorder {\n\treturn _m.recorder\n}", "title": "" }, { "docid": "79b25f08728b43bd3921f39b9a45ea97", "score": "0.5191284", "text": "func (m *MockCliInterface) EXPECT() *MockCliInterfaceMockRecorder {\n\treturn m.recorder\n}", "title": "" }, { "docid": "f5a4cbc9ed5b3dde2f5a3df4d721f897", "score": "0.51879096", "text": "func (mmResolve *mResolverMockResolve) Expect(m1 coordinates.Module) *mResolverMockResolve {\n\tif mmResolve.mock.funcResolve != nil {\n\t\tmmResolve.mock.t.Fatalf(\"ResolverMock.Resolve mock is already set by Set\")\n\t}\n\n\tif mmResolve.defaultExpectation == nil {\n\t\tmmResolve.defaultExpectation = &ResolverMockResolveExpectation{}\n\t}\n\n\tmmResolve.defaultExpectation.params = &ResolverMockResolveParams{m1}\n\tfor _, e := range mmResolve.expectations {\n\t\tif minimock.Equal(e.params, mmResolve.defaultExpectation.params) {\n\t\t\tmmResolve.mock.t.Fatalf(\"Expectation set by When has same params: %#v\", *mmResolve.defaultExpectation.params)\n\t\t}\n\t}\n\n\treturn mmResolve\n}", "title": "" }, { "docid": "528eb98a033175c062330c8b22b952df", "score": "0.51870424", "text": "func (mock *ServiceMock) Run() {\n}", "title": "" }, { "docid": "71a48302eae0f8f6625d9fc4052eea6e", "score": "0.5185696", "text": "func (mmAddAttributes *mSpanInterfaceMockAddAttributes) Expect(attributes ...mm_trace.Attribute) *mSpanInterfaceMockAddAttributes {\n\tif mmAddAttributes.mock.funcAddAttributes != nil {\n\t\tmmAddAttributes.mock.t.Fatalf(\"SpanInterfaceMock.AddAttributes mock is already set by Set\")\n\t}\n\n\tif mmAddAttributes.defaultExpectation == nil {\n\t\tmmAddAttributes.defaultExpectation = &SpanInterfaceMockAddAttributesExpectation{}\n\t}\n\n\tmmAddAttributes.defaultExpectation.params = &SpanInterfaceMockAddAttributesParams{attributes}\n\tfor _, e := range mmAddAttributes.expectations {\n\t\tif minimock.Equal(e.params, mmAddAttributes.defaultExpectation.params) {\n\t\t\tmmAddAttributes.mock.t.Fatalf(\"Expectation set by When has same params: %#v\", *mmAddAttributes.defaultExpectation.params)\n\t\t}\n\t}\n\n\treturn mmAddAttributes\n}", "title": "" }, { "docid": "3cac14e9a67d3f03c716f6047acb05e9", "score": "0.51810193", "text": "func (mmOpen *mManagerMockOpen) Expect(ctx context.Context, p1 insolar.PulseNumber) *mManagerMockOpen {\n\tif mmOpen.mock.funcOpen != nil {\n\t\tmmOpen.mock.t.Fatalf(\"ManagerMock.Open mock is already set by Set\")\n\t}\n\n\tif mmOpen.defaultExpectation == nil {\n\t\tmmOpen.defaultExpectation = &ManagerMockOpenExpectation{}\n\t}\n\n\tmmOpen.defaultExpectation.params = &ManagerMockOpenParams{ctx, p1}\n\tfor _, e := range mmOpen.expectations {\n\t\tif minimock.Equal(e.params, mmOpen.defaultExpectation.params) {\n\t\t\tmmOpen.mock.t.Fatalf(\"Expectation set by When has same params: %#v\", *mmOpen.defaultExpectation.params)\n\t\t}\n\t}\n\n\treturn mmOpen\n}", "title": "" }, { "docid": "e934478bffbb468d5a85e6b5ca3054c6", "score": "0.51810086", "text": "func (m *MockSlot) EXPECT() *MockSlotMockRecorder {\n\treturn m.recorder\n}", "title": "" }, { "docid": "e0bbb4eb44f39ce2358098bda9961450", "score": "0.5178648", "text": "func (c *restCtx) Expect(cf CheckFunc) *restCtx {\n\tc.expect = cf\n\treturn c\n}", "title": "" }, { "docid": "e36866b373868647589cda37902c8517", "score": "0.51772517", "text": "func (m *MockProviders) EXPECT() *MockProvidersMockRecorder {\r\n\treturn m.recorder\r\n}", "title": "" }, { "docid": "e36866b373868647589cda37902c8517", "score": "0.51772517", "text": "func (m *MockProviders) EXPECT() *MockProvidersMockRecorder {\r\n\treturn m.recorder\r\n}", "title": "" }, { "docid": "81cdc2db1e63cd0a7f21222516a378c6", "score": "0.5176454", "text": "func (m *MockTestingSimpleEmitter) EXPECT() *MockTestingSimpleEmitterMockRecorder {\n\treturn m.recorder\n}", "title": "" }, { "docid": "0cf24c634593f2aa77095a0e49746237", "score": "0.5170081", "text": "func (m *MockArchiver) EXPECT() *MockArchiverMockRecorder {\n\treturn m.recorder\n}", "title": "" }, { "docid": "14937e328edfab9b29a0f915b0f0e8ab", "score": "0.51680607", "text": "func TestDoAndReturnBody(t *testing.T) {\n\tts := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {\n\t\tfmt.Fprintln(w, testDoAndReturnBodyResponse)\n\t}))\n\tdefer ts.Close()\n\tQ := New(\"login\", \"secret\")\n\tQ.endpoint = ts.URL\n\treq, _ := http.NewRequest(\"GET\", ts.URL, nil)\n\tbody, _ := Q.doAndReturnBody(req)\n\tassert.Equal(t, testDoAndReturnBodyResponse+\"\\n\", string(body))\n}", "title": "" }, { "docid": "10ec5c70a190f60a0ae3d09ddc30ccd4", "score": "0.5163557", "text": "func (m *mStateStorageMockGetValidationState) Expect(p insolar.Reference) *mStateStorageMockGetValidationState {\n\tm.mock.GetValidationStateFunc = nil\n\tm.expectationSeries = nil\n\n\tif m.mainExpectation == nil {\n\t\tm.mainExpectation = &StateStorageMockGetValidationStateExpectation{}\n\t}\n\tm.mainExpectation.input = &StateStorageMockGetValidationStateInput{p}\n\treturn m\n}", "title": "" }, { "docid": "5817c8dd32d932477606cde1c8689db1", "score": "0.5159219", "text": "func (mmRegisterRequest *mManagerMockRegisterRequest) Expect(ctx context.Context, req record.IncomingRequest) *mManagerMockRegisterRequest {\n\tif mmRegisterRequest.mock.funcRegisterRequest != nil {\n\t\tmmRegisterRequest.mock.t.Fatalf(\"ManagerMock.RegisterRequest mock is already set by Set\")\n\t}\n\n\tif mmRegisterRequest.defaultExpectation == nil {\n\t\tmmRegisterRequest.defaultExpectation = &ManagerMockRegisterRequestExpectation{}\n\t}\n\n\tmmRegisterRequest.defaultExpectation.params = &ManagerMockRegisterRequestParams{ctx, req}\n\tfor _, e := range mmRegisterRequest.expectations {\n\t\tif minimock.Equal(e.params, mmRegisterRequest.defaultExpectation.params) {\n\t\t\tmmRegisterRequest.mock.t.Fatalf(\"Expectation set by When has same params: %#v\", *mmRegisterRequest.defaultExpectation.params)\n\t\t}\n\t}\n\n\treturn mmRegisterRequest\n}", "title": "" }, { "docid": "45d75786ea9617a0c606961a27b5c02b", "score": "0.5158872", "text": "func (t *tree) expect(expected itemType, context string) item {\n\ttoken := t.next()\n\tif token.typ != expected {\n\t\tt.unexpected(token, context)\n\t}\n\treturn token\n}", "title": "" }, { "docid": "70c511598a4293d02b910b66e585fb94", "score": "0.5156401", "text": "func (mmSetTags *mStorageMockSetTags) Expect(sa1 []string) *mStorageMockSetTags {\n\tif mmSetTags.mock.funcSetTags != nil {\n\t\tmmSetTags.mock.t.Fatalf(\"StorageMock.SetTags mock is already set by Set\")\n\t}\n\n\tif mmSetTags.defaultExpectation == nil {\n\t\tmmSetTags.defaultExpectation = &StorageMockSetTagsExpectation{}\n\t}\n\n\tmmSetTags.defaultExpectation.params = &StorageMockSetTagsParams{sa1}\n\tfor _, e := range mmSetTags.expectations {\n\t\tif minimock.Equal(e.params, mmSetTags.defaultExpectation.params) {\n\t\t\tmmSetTags.mock.t.Fatalf(\"Expectation set by When has same params: %#v\", *mmSetTags.defaultExpectation.params)\n\t\t}\n\t}\n\n\treturn mmSetTags\n}", "title": "" }, { "docid": "0c3a530d3d4b64ddb4cbdcd9bb58a8bf", "score": "0.5156125", "text": "func (mmSetStatus *mSpanInterfaceMockSetStatus) Return() *SpanInterfaceMock {\n\tif mmSetStatus.mock.funcSetStatus != nil {\n\t\tmmSetStatus.mock.t.Fatalf(\"SpanInterfaceMock.SetStatus mock is already set by Set\")\n\t}\n\n\tif mmSetStatus.defaultExpectation == nil {\n\t\tmmSetStatus.defaultExpectation = &SpanInterfaceMockSetStatusExpectation{mock: mmSetStatus.mock}\n\t}\n\n\treturn mmSetStatus.mock\n}", "title": "" }, { "docid": "19adc64b59c4241fe457b93214197b78", "score": "0.5153534", "text": "func (_m *MockManager) EXPECT() *MockManagerMockRecorder {\n\treturn _m.recorder\n}", "title": "" }, { "docid": "a1515e5a3cdd0770f44a0c8330f9c0f6", "score": "0.515243", "text": "func (m *MockCloudFormationAPI) EXPECT() *MockCloudFormationAPIMockRecorder {\n\treturn m.recorder\n}", "title": "" }, { "docid": "a1515e5a3cdd0770f44a0c8330f9c0f6", "score": "0.515243", "text": "func (m *MockCloudFormationAPI) EXPECT() *MockCloudFormationAPIMockRecorder {\n\treturn m.recorder\n}", "title": "" }, { "docid": "3fd2edc3456740b9cbe729c2d2d7eddf", "score": "0.5148417", "text": "func (m *mObjectStorageMockGetObjectIndex) Expect(p context.Context, p1 insolar.ID, p2 *insolar.ID) *mObjectStorageMockGetObjectIndex {\n\tm.mock.GetObjectIndexFunc = nil\n\tm.expectationSeries = nil\n\n\tif m.mainExpectation == nil {\n\t\tm.mainExpectation = &ObjectStorageMockGetObjectIndexExpectation{}\n\t}\n\tm.mainExpectation.input = &ObjectStorageMockGetObjectIndexInput{p, p1, p2}\n\treturn m\n}", "title": "" }, { "docid": "5b496e616f8a42be11788dea23f9a8c2", "score": "0.51480544", "text": "func TestMocks(t *testing.T) {\n\ts := CreateEndpoint(\"serviceName\", \"ipv4\", \"ipv6\", 1)\n\tassert.Equal(t, `{\"serviceName\": \"serviceName\", \"ipv4\": \"ipv4\", \"ipv6\": \"ipv6\", \"port\": 1}`, s)\n\n\ts = CreateAnno(\"val\", 100, `{\"endpoint\": \"x\"}`)\n\tassert.Equal(t, `{\"value\": \"val\", \"timestamp\": 100, \"endpoint\": {\"endpoint\": \"x\"}}`, s)\n\n\ts = CreateBinAnno(\"key\", \"val\", `{\"endpoint\": \"x\"}`)\n\tassert.Equal(t, `{\"key\": \"key\", \"value\": \"val\", \"endpoint\": {\"endpoint\": \"x\"}}`, s)\n\n\ts = CreateSpan(\"name\", \"id\", \"pid\", \"tid\", 100, 100, false, \"anno\", \"binAnno\")\n\tassert.Equal(t, `[{\"name\": \"name\", \"id\": \"id\", \"parentId\": \"pid\", \"traceId\": \"tid\", \"timestamp\": 100, \"duration\": 100, \"debug\": false, \"annotations\": [anno], \"binaryAnnotations\": [binAnno]}]`, s)\n}", "title": "" }, { "docid": "bfa3d8c3520eaa90ee6b8c96d89cfd7a", "score": "0.51442164", "text": "func (m *MockFactory) EXPECT() *MockFactoryMockRecorder {\n\treturn m.recorder\n}", "title": "" }, { "docid": "bfa3d8c3520eaa90ee6b8c96d89cfd7a", "score": "0.51442164", "text": "func (m *MockFactory) EXPECT() *MockFactoryMockRecorder {\n\treturn m.recorder\n}", "title": "" }, { "docid": "bfa3d8c3520eaa90ee6b8c96d89cfd7a", "score": "0.51442164", "text": "func (m *MockFactory) EXPECT() *MockFactoryMockRecorder {\n\treturn m.recorder\n}", "title": "" }, { "docid": "bfa3d8c3520eaa90ee6b8c96d89cfd7a", "score": "0.51442164", "text": "func (m *MockFactory) EXPECT() *MockFactoryMockRecorder {\n\treturn m.recorder\n}", "title": "" }, { "docid": "1a869cf8f74910ba073b79924d1d7e34", "score": "0.5142006", "text": "func (m *MockDemand) EXPECT() *MockDemandMockRecorder {\n\treturn m.recorder\n}", "title": "" }, { "docid": "b92e2f9a9fe6f33b7a99abacc88717d2", "score": "0.51398176", "text": "func (m *MockstackResource) EXPECT() *MockstackResourceMockRecorder {\n\treturn m.recorder\n}", "title": "" }, { "docid": "afdc2c00221997f16fdad8449a97ece7", "score": "0.5136271", "text": "func (_m *MockIAPIRequestFactory) EXPECT() *MockIAPIRequestFactoryMockRecorder {\n\treturn _m.recorder\n}", "title": "" }, { "docid": "c68df6a6f3d9aa55ce8bf3d4684ff9eb", "score": "0.5131344", "text": "func (m *MockEquipment) EXPECT() *MockEquipmentMockRecorder {\n\treturn m.recorder\n}", "title": "" }, { "docid": "17be70a87fa908e192ca2677e63b4246", "score": "0.5129523", "text": "func (m *MockStream) EXPECT() *MockStreamMockRecorder {\n\treturn m.recorder\n}", "title": "" } ]
13a661d8938aac3e40022da83137ad21
RegisterServer registers the Checker with the external authorization GRPC server.
[ { "docid": "0e58ed4c7dd08137334eee1ca7ae2dcf", "score": "0.7928839", "text": "func RegisterServer(srv *grpc.Server, c Checker) {\n\tv2 := &authV2{Checker: c}\n\tv3 := &authV3{Checker: c}\n\n\tenvoy_service_auth_v2.RegisterAuthorizationServer(srv, v2)\n\tenvoy_service_auth_v3.RegisterAuthorizationServer(srv, v3)\n}", "title": "" } ]
[ { "docid": "30f7ae9921751255d5e8e4c78b1c793a", "score": "0.666491", "text": "func RegisterServer(s *http.Server, srv *rest.Server) {\n\tregister(s, newHealthServer(srv))\n}", "title": "" }, { "docid": "449df33bc7992458652c64732c9363fa", "score": "0.65905213", "text": "func RegisterServer(s *grpc.Server) { // todo move to main.go\n\tproto.RegisterTestServiceServer(s, &TestService{})\n\tproto.RegisterMinionsServiceServer(s, &MinionsService{})\n}", "title": "" }, { "docid": "72f9437fa44b9e5463199685423dd859", "score": "0.650894", "text": "func RegisterServer(s *http.Server, srv *rest.Server) {\n\tregister(s, newConfirmServer(srv))\n}", "title": "" }, { "docid": "72f9437fa44b9e5463199685423dd859", "score": "0.650894", "text": "func RegisterServer(s *http.Server, srv *rest.Server) {\n\tregister(s, newConfirmServer(srv))\n}", "title": "" }, { "docid": "284ad9b8abb9870da35be26d15ceb45d", "score": "0.637271", "text": "func RegisterServer(s *grpc.Server) {\n\tfmt.Println(\"1\")\n\tproto.RegisterHelloServer(s, &Hello{})\n\tfmt.Println(\"2\")\n\tproto.RegisterWorldServer(s, &World{})\n\tfmt.Println(\"3\")\n}", "title": "" }, { "docid": "46554908555a34dbf81d4775b14c55bb", "score": "0.63261974", "text": "func (s *Service) Register(server *grpc.Server) {\n\tpb.RegisterJudgeServer(server, s)\n}", "title": "" }, { "docid": "645b910b0a187cd8721d1c659d57494a", "score": "0.6290973", "text": "func RegisterServer(s *http.Server, srv *rest.Server) {\n\tregister(s, newUserServer(srv))\n}", "title": "" }, { "docid": "1174a5543c9d2a37246cde6436068033", "score": "0.627279", "text": "func (s *Server) Register(svr *rpc.Server) {\n\tpb.RegisterUserServicesServer(svr.GRPC, s)\n}", "title": "" }, { "docid": "4aa2867687a63238cdd6946bd7deabb7", "score": "0.6222171", "text": "func (n *networkServer) RegisterManager(s *grpc.Server) {\n\tserver := &networkServerManager{networkServer: n}\n\n\tserver.clientRate = ratelimit.NewRegistry(5000, time.Hour)\n\n\tpb.RegisterNetworkServerManagerServer(s, server)\n\tpb_lorawan.RegisterDeviceManagerServer(s, server)\n\tpb_lorawan.RegisterDevAddrManagerServer(s, server)\n}", "title": "" }, { "docid": "6f872175f9783bf9878449476b706fe9", "score": "0.6212174", "text": "func RegisterWebhooksServer(s *grpc.Server, srv WebhooksServer) { src.RegisterWebhooksServer(s, srv) }", "title": "" }, { "docid": "817f4247f61dd1a0b9374a9554dc88a3", "score": "0.6081548", "text": "func (s *Server) Register(g *grpc.Server) {\n\tpb.RegisterOSServer(g, s)\n}", "title": "" }, { "docid": "1ec735e8a457e37832e16f27266f4f95", "score": "0.60803723", "text": "func RegisterAssuredWorkloadsServiceServer(s *grpc.Server, srv AssuredWorkloadsServiceServer) {\n\tsrc.RegisterAssuredWorkloadsServiceServer(s, srv)\n}", "title": "" }, { "docid": "c0fcf67fdc40eb99d9bd5655bc9f5cb3", "score": "0.59758496", "text": "func RegisterAuthServer(name string, authServer AuthServer) {\n\tmu.Lock()\n\tdefer mu.Unlock()\n\tif _, ok := authServers[name]; ok {\n\t\tlog.Fatalf(\"AuthServer named %v already exists\", name)\n\t}\n\tauthServers[name] = authServer\n}", "title": "" }, { "docid": "57ce183a6a862ce233aafb65fe1727ee", "score": "0.5852416", "text": "func (s Service) Register(r *grpc.Server) {\n\tserver := Server{\n\t\ttransactionsStore: s.transactionsStore,\n\t\tconfigurationsStore: s.configurationsStore,\n\t\tpluginRegistry: s.pluginRegistry}\n\tadmin.RegisterConfigAdminServiceServer(r, server)\n\tadmin.RegisterConfigurationServiceServer(r, server)\n\tadmin.RegisterTransactionServiceServer(r, server)\n}", "title": "" }, { "docid": "896d8e74250cf61515448c2644a405b1", "score": "0.5852308", "text": "func (a *TokenAuthenticatorPlugin) Server(broker *plugin.MuxBroker,\n) (interface{}, error) {\n\tt := &TokenAuthenticatorServer{\n\t\tBroker: broker,\n\t\tTokenAuthenticator: a.TokenAuthenticator(),\n\t}\n\treturn t, nil\n}", "title": "" }, { "docid": "d1876f9f04145ffaf6b89c1b32466645", "score": "0.583019", "text": "func (ss *storageServer) RegisterServer(args *storagerpc.RegisterArgs, reply *storagerpc.RegisterReply) error {\n\treply.Status = storagerpc.OK\n\treply.Servers = ss.serverList\n\t//ss.initDoneRequest <- 1\n\t//isDone := <- ss.initDoneChanel\n\t//if isDone != 1{\n\tfmt.Printf(\"[storageSerer] Storage slave connect to master:%s\\n\",args.ServerInfo)\n\t// If still wait for new node\n\tif !ss.initDone {\n\t\tss.newNodesChanel <- args.ServerInfo\n\t\t*reply = <-ss.newNodesResult\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "779dda10427c3c5e6350cbf70b68860a", "score": "0.57932806", "text": "func RegisterVersionsServer(s *grpc.Server, srv VersionsServer) { src.RegisterVersionsServer(s, srv) }", "title": "" }, { "docid": "7e1c94b4f50ea6f80b3bd3b620f611fc", "score": "0.5771323", "text": "func (_m *Server) RegisterNotifier(n pubsub.Notifier) {\n\t_m.Called(n)\n}", "title": "" }, { "docid": "5279d857fca306121764f4a52456eb4d", "score": "0.57712084", "text": "func (s *ApiServer) Register(server *grpc.Server) error {\n\tlog.Info(\"registering chat api\")\n\n\tpb.RegisterUsersAPIServer(server, s)\n\treturn nil\n}", "title": "" }, { "docid": "b6d179dfdb0f59cd2af987e84f4cee95", "score": "0.5742499", "text": "func RegisterLoadBalancerServer(s grpc.ServiceRegistrar, srv LoadBalancerServer) {\n\tstr := &LoadBalancerService{\n\t\tBalanceLoad: srv.BalanceLoad,\n\t}\n\tRegisterLoadBalancerService(s, str)\n}", "title": "" }, { "docid": "45de0dce72ee25da3dc44a32f53748b6", "score": "0.5731588", "text": "func RegisterCallerTestAPIServer(s *qrpc.Server, srv CallerTestAPIServer) {\n\ts.RegisterService(&_CallerTestAPI_serviceDesc, srv)\n}", "title": "" }, { "docid": "01d2cbff7a6725eccfa62a7efbb64226", "score": "0.5681175", "text": "func ServerStartup(def ServerDef) error {\n\tc := make(chan os.Signal, 2)\n\tsignal.Notify(c, os.Interrupt, syscall.SIGTERM)\n\tgo func() {\n\t\t<-c\n\t\tstopping()\n\t\tos.Exit(0)\n\t}()\n\tstopped = false\n\tdefer stopping()\n\tdef.init()\n\tlistenAddr := fmt.Sprintf(\":%d\", def.Port)\n\tfmt.Println(\"Starting server on \", listenAddr)\n\n\tBackendCert := Certificate\n\tBackendKey := Privatekey\n\tImCert := Ca\n\tcert, err := tls.X509KeyPair(BackendCert, BackendKey)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"failed to parse certificate: %v\\n\", err)\n\t}\n\troots := x509.NewCertPool()\n\tFrontendCert := Certificate\n\troots.AppendCertsFromPEM(FrontendCert)\n\troots.AppendCertsFromPEM(ImCert)\n\n\tcreds := credentials.NewServerTLSFromCert(&cert)\n\tvar grpcServer *grpc.Server\n\tif def.NoAuth {\n\t\tgrpcServer = grpc.NewServer(grpc.Creds(creds))\n\t} else {\n\t\t// Create the gRPC server with the credentials\n\t\tgrpcServer = grpc.NewServer(grpc.Creds(creds),\n\t\t\tgrpc.UnaryInterceptor(UnaryAuthInterceptor),\n\t\t\tgrpc.StreamInterceptor(StreamAuthInterceptor),\n\t\t)\n\n\t\t// set up a connection to our authentication service\n\t\tauthconn, err = client.DialWrapper(\"auth.AuthenticationService\")\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"Failed to connect to authserver\")\n\t\t}\n\t}\n\n\tgrpc.EnableTracing = true\n\tdef.Register(grpcServer)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"grpc register error: %s\", err)\n\t}\n\tfor name, _ := range grpcServer.GetServiceInfo() {\n\t\tdef.names = append(def.names, name)\n\t}\n\n\t// start period re-registration\n\tregisterMe(def)\n\tticker := time.NewTicker(time.Duration(*register_refresh) * time.Second)\n\tgo func() {\n\t\tfor _ = range ticker.C {\n\t\t\tregisterMe(def)\n\t\t}\n\t}()\n\t// something odd?\n\treflection.Register(grpcServer)\n\t// Serve and Listen\n\terr = startHttpServe(def, grpcServer)\n\n\t// Create the channel to listen on\n\n\tlis, err := net.Listen(\"tcp\", listenAddr)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"could not listen on %s: %s\", listenAddr, err)\n\t}\n\terr = grpcServer.Serve(lis)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"grpc serve error: %s\", err)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "bedeef3c4656ba47f63f694ee18761cb", "score": "0.5632449", "text": "func (s *healthService) Register(ctx context.Context, registrar grpc.ServiceRegistrar, handler *runtime.ServeMux) error {\n\tproto.RegisterHealthServer(registrar, s)\n\tproto.RegisterHealthHandlerServer(ctx, handler, s)\n\treturn nil\n}", "title": "" }, { "docid": "1fdac70f2901b3c0742179615ae3612a", "score": "0.56216824", "text": "func RegisterFlowsServer(s *grpc.Server, srv FlowsServer) { src.RegisterFlowsServer(s, srv) }", "title": "" }, { "docid": "eac0cb4641e06872c3e66e5f08e93db3", "score": "0.56177646", "text": "func (srv *Server) RegisterOnAccept(callback OnAccept) {\n\tsrv.checkStatus()\n\tsrv.onAccept = callback\n}", "title": "" }, { "docid": "9e9cc12ae795f9558a96a0cb0de39332", "score": "0.56137466", "text": "func New(\n\tconfig Config,\n\tdialCertManager DialCertManager,\n\tlistenCertManager ListenCertManager,\n\tauthInterceptor kitNetHttp.Interceptor,\n\tresourceEventStore cqrsEventStore.EventStore,\n\tresourceSubscriber eventbus.Subscriber,\n\tsubscriptionStore store.Store,\n\tgoroutinePoolGo GoroutinePoolGoFunc,\n) *Server {\n\tdialTLSConfig := dialCertManager.GetClientTLSConfig()\n\tlistenTLSConfig := listenCertManager.GetServerTLSConfig()\n\tlistenTLSConfig.ClientAuth = tls.NoClientCert\n\n\tln, err := tls.Listen(\"tcp\", config.Addr, listenTLSConfig)\n\tif err != nil {\n\t\tlog.Fatalf(\"cannot listen and serve: %v\", err)\n\t}\n\n\traConn, err := grpc.Dial(config.ResourceAggregateAddr, grpc.WithTransportCredentials(credentials.NewTLS(dialTLSConfig)))\n\tif err != nil {\n\t\tlog.Fatalf(\"cannot create server: %v\", err)\n\t}\n\traClient := pbRA.NewResourceAggregateClient(raConn)\n\n\trdConn, err := grpc.Dial(config.ResourceDirectoryAddr, grpc.WithTransportCredentials(credentials.NewTLS(dialTLSConfig)))\n\tif err != nil {\n\t\tlog.Fatalf(\"cannot create server: %v\", err)\n\t}\n\trsClient := pbRS.NewResourceShadowClient(rdConn)\n\trdClient := pbRD.NewResourceDirectoryClient(rdConn)\n\tddClient := pbDD.NewDeviceDirectoryClient(rdConn)\n\n\tasConn, err := grpc.Dial(config.AuthServerAddr, grpc.WithTransportCredentials(credentials.NewTLS(dialTLSConfig)))\n\tif err != nil {\n\t\tlog.Fatalf(\"cannot create server: %v\", err)\n\t}\n\tasClient := pbAS.NewAuthorizationServiceClient(asConn)\n\n\tif config.DevicesCheckInterval < time.Millisecond*200 {\n\t\tlog.Fatalf(\"cannot create server: invalid config.DevicesCheckInterval %v\", config.DevicesCheckInterval)\n\t}\n\n\tctx := context.Background()\n\n\tsyncPoolHandler := NewGoroutinePoolHandler(goroutinePoolGo, newEventHandler(subscriptionStore, goroutinePoolGo), func(err error) { log.Errorf(\"%v\", err) })\n\tupdateNotificationContainer := raCqrs.NewUpdateNotificationContainer()\n\n\tresourceProjection, err := projectionRA.NewProjection(ctx, config.FQDN, resourceEventStore, resourceSubscriber, newResourceCtx(syncPoolHandler, updateNotificationContainer))\n\tif err != nil {\n\t\tlog.Fatalf(\"cannot create server: %v\", err)\n\t}\n\n\t// load subscriptions to projection\n\terr = subscriptionStore.LoadSubscriptions(ctx, store.SubscriptionQuery{Type: oapiStore.Type_Resource}, newResourceSubscriptionLoader(resourceProjection))\n\tif err != nil {\n\t\tlog.Fatalf(\"cannot create server: %v\", err)\n\t}\n\terr = subscriptionStore.LoadSubscriptions(ctx, store.SubscriptionQuery{Type: oapiStore.Type_Device}, newDeviceSubscriptionLoader(resourceProjection))\n\tif err != nil {\n\t\tlog.Fatalf(\"cannot create server: %v\", err)\n\t}\n\n\trequestHandler := NewRequestHandler(asClient, raClient, rsClient, rdClient, ddClient, resourceProjection, subscriptionStore, updateNotificationContainer, config.TimeoutForRequests)\n\n\tdevicesSubscription := newDevicesSubscription(requestHandler, goroutinePoolGo)\n\n\tserver := Server{\n\t\tserver: NewHTTP(requestHandler, authInterceptor),\n\t\tcfg: config,\n\t\thandler: requestHandler,\n\t\tln: ln,\n\t\tdevicesSubscription: devicesSubscription,\n\t}\n\n\treturn &server\n}", "title": "" }, { "docid": "bc92c993023d7a40943dea18738573ed", "score": "0.5612493", "text": "func (c *DataBroker) Register(grpcServer *grpc.Server) {\n\tdatabroker.RegisterDataBrokerServiceServer(grpcServer, c.dataBrokerServer)\n\tregistry.RegisterRegistryServer(grpcServer, c.dataBrokerServer)\n}", "title": "" }, { "docid": "dca357c79c8a003d1dc0fd693f99b5c1", "score": "0.55952716", "text": "func NewServer(decoder TokenDecoder, authHeaderKey, tokenValidatedHeaderKey string) *Server {\n\treturn &Server{decoder: decoder, authHeaderKey: authHeaderKey, tokenValidatedHeaderKey: tokenValidatedHeaderKey}\n}", "title": "" }, { "docid": "605df43001e0468d2483b5340cef5f70", "score": "0.55890334", "text": "func RegisterAuthenticatorServiceHandlerServer(ctx context.Context, mux *runtime.ServeMux, server AuthenticatorServiceServer) error {\n\n\tmux.Handle(\"POST\", pattern_AuthenticatorService_Authenticate_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {\n\t\tctx, cancel := context.WithCancel(req.Context())\n\t\tdefer cancel()\n\t\tvar stream runtime.ServerTransportStream\n\t\tctx = grpc.NewContextWithServerTransportStream(ctx, &stream)\n\t\tinboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)\n\t\trctx, err := runtime.AnnotateIncomingContext(ctx, mux, req, \"/educode.authenticator.api.AuthenticatorService/Authenticate\")\n\t\tif err != nil {\n\t\t\truntime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)\n\t\t\treturn\n\t\t}\n\t\tresp, md, err := local_request_AuthenticatorService_Authenticate_0(rctx, inboundMarshaler, server, req, pathParams)\n\t\tmd.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer())\n\t\tctx = runtime.NewServerMetadataContext(ctx, md)\n\t\tif err != nil {\n\t\t\truntime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)\n\t\t\treturn\n\t\t}\n\n\t\tforward_AuthenticatorService_Authenticate_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)\n\n\t})\n\n\tmux.Handle(\"POST\", pattern_AuthenticatorService_Register_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {\n\t\tctx, cancel := context.WithCancel(req.Context())\n\t\tdefer cancel()\n\t\tvar stream runtime.ServerTransportStream\n\t\tctx = grpc.NewContextWithServerTransportStream(ctx, &stream)\n\t\tinboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)\n\t\trctx, err := runtime.AnnotateIncomingContext(ctx, mux, req, \"/educode.authenticator.api.AuthenticatorService/Register\")\n\t\tif err != nil {\n\t\t\truntime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)\n\t\t\treturn\n\t\t}\n\t\tresp, md, err := local_request_AuthenticatorService_Register_0(rctx, inboundMarshaler, server, req, pathParams)\n\t\tmd.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer())\n\t\tctx = runtime.NewServerMetadataContext(ctx, md)\n\t\tif err != nil {\n\t\t\truntime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)\n\t\t\treturn\n\t\t}\n\n\t\tforward_AuthenticatorService_Register_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)\n\n\t})\n\n\tmux.Handle(\"PUT\", pattern_AuthenticatorService_SyncWhitelist_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {\n\t\tctx, cancel := context.WithCancel(req.Context())\n\t\tdefer cancel()\n\t\tvar stream runtime.ServerTransportStream\n\t\tctx = grpc.NewContextWithServerTransportStream(ctx, &stream)\n\t\tinboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)\n\t\trctx, err := runtime.AnnotateIncomingContext(ctx, mux, req, \"/educode.authenticator.api.AuthenticatorService/SyncWhitelist\")\n\t\tif err != nil {\n\t\t\truntime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)\n\t\t\treturn\n\t\t}\n\t\tresp, md, err := local_request_AuthenticatorService_SyncWhitelist_0(rctx, inboundMarshaler, server, req, pathParams)\n\t\tmd.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer())\n\t\tctx = runtime.NewServerMetadataContext(ctx, md)\n\t\tif err != nil {\n\t\t\truntime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)\n\t\t\treturn\n\t\t}\n\n\t\tforward_AuthenticatorService_SyncWhitelist_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)\n\n\t})\n\n\tmux.Handle(\"POST\", pattern_AuthenticatorService_ResolveUser_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {\n\t\terr := status.Error(codes.Unimplemented, \"streaming calls are not yet supported in the in-process transport\")\n\t\t_, outboundMarshaler := runtime.MarshalerForRequest(mux, req)\n\t\truntime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)\n\t\treturn\n\t})\n\n\tmux.Handle(\"GET\", pattern_AuthenticatorService_GetCertificates_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {\n\t\tctx, cancel := context.WithCancel(req.Context())\n\t\tdefer cancel()\n\t\tvar stream runtime.ServerTransportStream\n\t\tctx = grpc.NewContextWithServerTransportStream(ctx, &stream)\n\t\tinboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)\n\t\trctx, err := runtime.AnnotateIncomingContext(ctx, mux, req, \"/educode.authenticator.api.AuthenticatorService/GetCertificates\")\n\t\tif err != nil {\n\t\t\truntime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)\n\t\t\treturn\n\t\t}\n\t\tresp, md, err := local_request_AuthenticatorService_GetCertificates_0(rctx, inboundMarshaler, server, req, pathParams)\n\t\tmd.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer())\n\t\tctx = runtime.NewServerMetadataContext(ctx, md)\n\t\tif err != nil {\n\t\t\truntime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)\n\t\t\treturn\n\t\t}\n\n\t\tforward_AuthenticatorService_GetCertificates_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)\n\n\t})\n\n\tmux.Handle(\"GET\", pattern_AuthenticatorService_ListUsers_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {\n\t\terr := status.Error(codes.Unimplemented, \"streaming calls are not yet supported in the in-process transport\")\n\t\t_, outboundMarshaler := runtime.MarshalerForRequest(mux, req)\n\t\truntime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)\n\t\treturn\n\t})\n\n\tmux.Handle(\"PUT\", pattern_AuthenticatorService_UpdateUserRole_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {\n\t\tctx, cancel := context.WithCancel(req.Context())\n\t\tdefer cancel()\n\t\tvar stream runtime.ServerTransportStream\n\t\tctx = grpc.NewContextWithServerTransportStream(ctx, &stream)\n\t\tinboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)\n\t\trctx, err := runtime.AnnotateIncomingContext(ctx, mux, req, \"/educode.authenticator.api.AuthenticatorService/UpdateUserRole\")\n\t\tif err != nil {\n\t\t\truntime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)\n\t\t\treturn\n\t\t}\n\t\tresp, md, err := local_request_AuthenticatorService_UpdateUserRole_0(rctx, inboundMarshaler, server, req, pathParams)\n\t\tmd.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer())\n\t\tctx = runtime.NewServerMetadataContext(ctx, md)\n\t\tif err != nil {\n\t\t\truntime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)\n\t\t\treturn\n\t\t}\n\n\t\tforward_AuthenticatorService_UpdateUserRole_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)\n\n\t})\n\n\treturn nil\n}", "title": "" }, { "docid": "0dd149d21b96709bdb561658f70eb7c3", "score": "0.55735725", "text": "func RegisterAgentsServer(s *grpc.Server, srv AgentsServer) { src.RegisterAgentsServer(s, srv) }", "title": "" }, { "docid": "eae0b062d8f31a745d844c6a5d115f95", "score": "0.55607325", "text": "func (s *service) RegisterAdditionalServers(server *grpc.Server) {\n\t_, log := setRunIDContext(context.Background(), \"RegisterAdditionalServers\")\n\tlog.Info(\"Registering additional GRPC servers\")\n\tpodmon.RegisterPodmonServer(server, s)\n}", "title": "" }, { "docid": "11678dc15787a35d96491120cfbdc1c6", "score": "0.55526775", "text": "func RegisterAllServer(s *grpc.Server) {\n\tRegisterDetailsServer(s)\n}", "title": "" }, { "docid": "d0ff1a35677e58d02c06ee65d25acb28", "score": "0.5540077", "text": "func Register(server interface{}) {\n\trpc.Register(server)\n}", "title": "" }, { "docid": "189bad840af81c86c4c5e348bad439b0", "score": "0.5539925", "text": "func RegisterServer(source *data.LinuxDataSource) {\n\tpair := TrackerPair{Source: source, Gauge: ui.NewGauge()}\n\tpairs := append(tracker.Pairs, pair)\n\ttracker.Pairs = pairs\n\ttracker.rows = append(tracker.rows, ui.NewRow(\n\t\tui.NewCol(12, 0, pair.Gauge),\n\t))\n}", "title": "" }, { "docid": "752d4394269591d70c4be4ed1cb4463c", "score": "0.5535849", "text": "func (s *service) RegisterAdditionalServers(server *grpc.Server) {\n\t_, log := GetLogger(context.Background())\n\tlog.Info(\"Registering additional GRPC servers\")\n\tcsiext.RegisterReplicationServer(server, s)\n\tvgsext.RegisterVolumeGroupSnapshotServer(server, s)\n\tpodmon.RegisterPodmonServer(server, s)\n}", "title": "" }, { "docid": "001432c23373b5cecbff681d1e530cea", "score": "0.5517608", "text": "func RegisterIntentsServer(s *grpc.Server, srv IntentsServer) { src.RegisterIntentsServer(s, srv) }", "title": "" }, { "docid": "d621ab5bddd9ad4c5f376ceb7556300e", "score": "0.55106986", "text": "func (c *Registrar) Register() error {\n\tc.ServeMux.HandleFunc(\"/check\", c.updateStatusHandleFunc)\n\tgo func() {\n\t\tif c.checkServer.Addr != \"\" {\n\t\t\tlog.Printf(\"Starting %s consul check server on %s\\n\", c.serverType, c.checkServer.Addr)\n\t\t\tif err := c.checkServer.ListenAndServe(); err != nil {\n\t\t\t\tlog.Fatalf(\"Starting %s registry Starting error: %v\", c.serverType, err)\n\t\t\t}\n\t\t}\n\t}()\n\n\tregistration := new(consulAPI.AgentServiceRegistration)\n\tregistration.ID = getConsulID(c.pod)\n\tregistration.Name = string(c.serverType)\n\tregistration.Port = c.serverPort\n\tif c.tag != \"\" {\n\t\tregistration.Tags = []string{c.tag}\n\t}\n\tregistration.Address = c.pod.IP\n\tregistration.Check = &consulAPI.AgentServiceCheck{\n\t\tHTTP: fmt.Sprintf(\"http://%s:%d%s\", registration.Address, c.listenPort, \"/check\"),\n\t\tTimeout: \"3s\",\n\t\tInterval: \"5s\",\n\t\tDeregisterCriticalServiceAfter: \"15s\", //check失败后15秒删除本服务\n\t}\n\n\treturn c.consulClient.Agent().ServiceRegister(registration)\n}", "title": "" }, { "docid": "02212689053af49bee2b32321cd70caa", "score": "0.55079114", "text": "func RegisterGroupBMServer(e *bm.Engine, server GroupBMServer, midMap map[string]bm.HandlerFunc) {\n\tauth := midMap[\"auth\"]\n\tGroupSvc = server\n\te.POST(\"/group/create\", auth, groupCreateGroup)\n\te.GET(\"/group/info\", groupGetGroupInfo)\n\te.GET(\"/group/all\", groupGetAllGroups)\n\te.GET(\"/group/all/user\", auth, groupGetAllGroupsByUid)\n\te.POST(\"/group/addMember\", auth, groupAddMember)\n}", "title": "" }, { "docid": "98afe3ccb6570fbf1b7b9b631dc8b622", "score": "0.550353", "text": "func (m *Manager) Register(ctx context.Context, req *pb.RegisterRequest) (*pb.CommonResponse, error) {\n\tvar conn, err = grpc.Dial(req.ClientEndpoint, grpc.WithInsecure(), grpc.WithBlock())\n\tif err != nil {\n\t\tm.logger.Error(\"failed to connect to the client: \", req.ClientId, \" -> \", req.ClientEndpoint)\n\t} else {\n\t\tm.logger.Info(\"inited connection with client: \", req.ClientId, \" -> \", req.ClientEndpoint)\n\t}\n\tm.workers[req.ClientId] = pb.NewClient_ServiceClient(conn)\n\treturn &pb.CommonResponse{\n\t\tOk: true,\n\t\tMsg: \"Successfully registered\",\n\t}, nil\n}", "title": "" }, { "docid": "d07d69309714bef1ea90e7adda97f9b9", "score": "0.54951406", "text": "func (s Service) Register(r *grpc.Server) {\n\tserver := &Server{\n\t\tobjectStore: s.store,\n\t}\n\ttopoapi.RegisterTopoServer(r, server)\n}", "title": "" }, { "docid": "a810f1c8f2bc5afd055cf3fee61d902e", "score": "0.5493538", "text": "func RegisterResourceBMServer(e *bm.Engine, server ResourceBMServer) {\n\tv1ResourceSvc = server\n\te.POST(\"/live.liveadmin.v1.Resource/add\", resourceAdd)\n\te.POST(\"/live.liveadmin.v1.Resource/addEx\", resourceAddEx)\n\te.POST(\"/live.liveadmin.v1.Resource/edit\", resourceEdit)\n\te.POST(\"/live.liveadmin.v1.Resource/offline\", resourceOffline)\n\te.GET(\"/live.liveadmin.v1.Resource/getList\", resourceGetList)\n\te.GET(\"/live.liveadmin.v1.Resource/getPlatformList\", resourceGetPlatformList)\n\te.GET(\"/live.liveadmin.v1.Resource/getListEx\", resourceGetListEx)\n}", "title": "" }, { "docid": "a0d002f556a193c50375690a101c63a9", "score": "0.54709464", "text": "func (s *sdsservice) register(rpcs *grpc.Server) {\n\tsds.RegisterSecretDiscoveryServiceServer(rpcs, s)\n}", "title": "" }, { "docid": "66659e241becf4372a3296b9be7bd993", "score": "0.5463366", "text": "func RegisterDatastoreAdminServer(s *grpc.Server, srv DatastoreAdminServer) {\n\tsrc.RegisterDatastoreAdminServer(s, srv)\n}", "title": "" }, { "docid": "fb6704e4918437dce44ee6625b4bf28e", "score": "0.54621017", "text": "func RegisterSessionsServer(s *grpc.Server, srv SessionsServer) { src.RegisterSessionsServer(s, srv) }", "title": "" }, { "docid": "fa92afea4e0e29d279f558e23b764536", "score": "0.54545164", "text": "func RegisterClientRegistryHandlerServer(ctx context.Context, mux *runtime.ServeMux, server ClientRegistryServer) error {\n\n\tmux.Handle(\"POST\", pattern_ClientRegistry_Create_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {\n\t\tctx, cancel := context.WithCancel(req.Context())\n\t\tdefer cancel()\n\t\tvar stream runtime.ServerTransportStream\n\t\tctx = grpc.NewContextWithServerTransportStream(ctx, &stream)\n\t\tinboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)\n\t\tvar err error\n\t\tvar annotatedContext context.Context\n\t\tannotatedContext, err = runtime.AnnotateIncomingContext(ctx, mux, req, \"/ttn.lorawan.v3.ClientRegistry/Create\", runtime.WithHTTPPathPattern(\"/users/{collaborator.user_ids.user_id}/clients\"))\n\t\tif err != nil {\n\t\t\truntime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)\n\t\t\treturn\n\t\t}\n\t\tresp, md, err := local_request_ClientRegistry_Create_0(annotatedContext, inboundMarshaler, server, req, pathParams)\n\t\tmd.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer())\n\t\tannotatedContext = runtime.NewServerMetadataContext(annotatedContext, md)\n\t\tif err != nil {\n\t\t\truntime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err)\n\t\t\treturn\n\t\t}\n\n\t\tforward_ClientRegistry_Create_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)\n\n\t})\n\n\tmux.Handle(\"POST\", pattern_ClientRegistry_Create_1, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {\n\t\tctx, cancel := context.WithCancel(req.Context())\n\t\tdefer cancel()\n\t\tvar stream runtime.ServerTransportStream\n\t\tctx = grpc.NewContextWithServerTransportStream(ctx, &stream)\n\t\tinboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)\n\t\tvar err error\n\t\tvar annotatedContext context.Context\n\t\tannotatedContext, err = runtime.AnnotateIncomingContext(ctx, mux, req, \"/ttn.lorawan.v3.ClientRegistry/Create\", runtime.WithHTTPPathPattern(\"/organizations/{collaborator.organization_ids.organization_id}/clients\"))\n\t\tif err != nil {\n\t\t\truntime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)\n\t\t\treturn\n\t\t}\n\t\tresp, md, err := local_request_ClientRegistry_Create_1(annotatedContext, inboundMarshaler, server, req, pathParams)\n\t\tmd.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer())\n\t\tannotatedContext = runtime.NewServerMetadataContext(annotatedContext, md)\n\t\tif err != nil {\n\t\t\truntime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err)\n\t\t\treturn\n\t\t}\n\n\t\tforward_ClientRegistry_Create_1(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)\n\n\t})\n\n\tmux.Handle(\"GET\", pattern_ClientRegistry_Get_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {\n\t\tctx, cancel := context.WithCancel(req.Context())\n\t\tdefer cancel()\n\t\tvar stream runtime.ServerTransportStream\n\t\tctx = grpc.NewContextWithServerTransportStream(ctx, &stream)\n\t\tinboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)\n\t\tvar err error\n\t\tvar annotatedContext context.Context\n\t\tannotatedContext, err = runtime.AnnotateIncomingContext(ctx, mux, req, \"/ttn.lorawan.v3.ClientRegistry/Get\", runtime.WithHTTPPathPattern(\"/clients/{client_ids.client_id}\"))\n\t\tif err != nil {\n\t\t\truntime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)\n\t\t\treturn\n\t\t}\n\t\tresp, md, err := local_request_ClientRegistry_Get_0(annotatedContext, inboundMarshaler, server, req, pathParams)\n\t\tmd.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer())\n\t\tannotatedContext = runtime.NewServerMetadataContext(annotatedContext, md)\n\t\tif err != nil {\n\t\t\truntime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err)\n\t\t\treturn\n\t\t}\n\n\t\tforward_ClientRegistry_Get_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)\n\n\t})\n\n\tmux.Handle(\"GET\", pattern_ClientRegistry_List_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {\n\t\tctx, cancel := context.WithCancel(req.Context())\n\t\tdefer cancel()\n\t\tvar stream runtime.ServerTransportStream\n\t\tctx = grpc.NewContextWithServerTransportStream(ctx, &stream)\n\t\tinboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)\n\t\tvar err error\n\t\tvar annotatedContext context.Context\n\t\tannotatedContext, err = runtime.AnnotateIncomingContext(ctx, mux, req, \"/ttn.lorawan.v3.ClientRegistry/List\", runtime.WithHTTPPathPattern(\"/clients\"))\n\t\tif err != nil {\n\t\t\truntime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)\n\t\t\treturn\n\t\t}\n\t\tresp, md, err := local_request_ClientRegistry_List_0(annotatedContext, inboundMarshaler, server, req, pathParams)\n\t\tmd.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer())\n\t\tannotatedContext = runtime.NewServerMetadataContext(annotatedContext, md)\n\t\tif err != nil {\n\t\t\truntime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err)\n\t\t\treturn\n\t\t}\n\n\t\tforward_ClientRegistry_List_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)\n\n\t})\n\n\tmux.Handle(\"GET\", pattern_ClientRegistry_List_1, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {\n\t\tctx, cancel := context.WithCancel(req.Context())\n\t\tdefer cancel()\n\t\tvar stream runtime.ServerTransportStream\n\t\tctx = grpc.NewContextWithServerTransportStream(ctx, &stream)\n\t\tinboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)\n\t\tvar err error\n\t\tvar annotatedContext context.Context\n\t\tannotatedContext, err = runtime.AnnotateIncomingContext(ctx, mux, req, \"/ttn.lorawan.v3.ClientRegistry/List\", runtime.WithHTTPPathPattern(\"/users/{collaborator.user_ids.user_id}/clients\"))\n\t\tif err != nil {\n\t\t\truntime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)\n\t\t\treturn\n\t\t}\n\t\tresp, md, err := local_request_ClientRegistry_List_1(annotatedContext, inboundMarshaler, server, req, pathParams)\n\t\tmd.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer())\n\t\tannotatedContext = runtime.NewServerMetadataContext(annotatedContext, md)\n\t\tif err != nil {\n\t\t\truntime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err)\n\t\t\treturn\n\t\t}\n\n\t\tforward_ClientRegistry_List_1(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)\n\n\t})\n\n\tmux.Handle(\"GET\", pattern_ClientRegistry_List_2, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {\n\t\tctx, cancel := context.WithCancel(req.Context())\n\t\tdefer cancel()\n\t\tvar stream runtime.ServerTransportStream\n\t\tctx = grpc.NewContextWithServerTransportStream(ctx, &stream)\n\t\tinboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)\n\t\tvar err error\n\t\tvar annotatedContext context.Context\n\t\tannotatedContext, err = runtime.AnnotateIncomingContext(ctx, mux, req, \"/ttn.lorawan.v3.ClientRegistry/List\", runtime.WithHTTPPathPattern(\"/organizations/{collaborator.organization_ids.organization_id}/clients\"))\n\t\tif err != nil {\n\t\t\truntime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)\n\t\t\treturn\n\t\t}\n\t\tresp, md, err := local_request_ClientRegistry_List_2(annotatedContext, inboundMarshaler, server, req, pathParams)\n\t\tmd.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer())\n\t\tannotatedContext = runtime.NewServerMetadataContext(annotatedContext, md)\n\t\tif err != nil {\n\t\t\truntime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err)\n\t\t\treturn\n\t\t}\n\n\t\tforward_ClientRegistry_List_2(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)\n\n\t})\n\n\tmux.Handle(\"PUT\", pattern_ClientRegistry_Update_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {\n\t\tctx, cancel := context.WithCancel(req.Context())\n\t\tdefer cancel()\n\t\tvar stream runtime.ServerTransportStream\n\t\tctx = grpc.NewContextWithServerTransportStream(ctx, &stream)\n\t\tinboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)\n\t\tvar err error\n\t\tvar annotatedContext context.Context\n\t\tannotatedContext, err = runtime.AnnotateIncomingContext(ctx, mux, req, \"/ttn.lorawan.v3.ClientRegistry/Update\", runtime.WithHTTPPathPattern(\"/clients/{client.ids.client_id}\"))\n\t\tif err != nil {\n\t\t\truntime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)\n\t\t\treturn\n\t\t}\n\t\tresp, md, err := local_request_ClientRegistry_Update_0(annotatedContext, inboundMarshaler, server, req, pathParams)\n\t\tmd.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer())\n\t\tannotatedContext = runtime.NewServerMetadataContext(annotatedContext, md)\n\t\tif err != nil {\n\t\t\truntime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err)\n\t\t\treturn\n\t\t}\n\n\t\tforward_ClientRegistry_Update_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)\n\n\t})\n\n\tmux.Handle(\"DELETE\", pattern_ClientRegistry_Delete_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {\n\t\tctx, cancel := context.WithCancel(req.Context())\n\t\tdefer cancel()\n\t\tvar stream runtime.ServerTransportStream\n\t\tctx = grpc.NewContextWithServerTransportStream(ctx, &stream)\n\t\tinboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)\n\t\tvar err error\n\t\tvar annotatedContext context.Context\n\t\tannotatedContext, err = runtime.AnnotateIncomingContext(ctx, mux, req, \"/ttn.lorawan.v3.ClientRegistry/Delete\", runtime.WithHTTPPathPattern(\"/clients/{client_id}\"))\n\t\tif err != nil {\n\t\t\truntime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)\n\t\t\treturn\n\t\t}\n\t\tresp, md, err := local_request_ClientRegistry_Delete_0(annotatedContext, inboundMarshaler, server, req, pathParams)\n\t\tmd.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer())\n\t\tannotatedContext = runtime.NewServerMetadataContext(annotatedContext, md)\n\t\tif err != nil {\n\t\t\truntime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err)\n\t\t\treturn\n\t\t}\n\n\t\tforward_ClientRegistry_Delete_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)\n\n\t})\n\n\tmux.Handle(\"POST\", pattern_ClientRegistry_Restore_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {\n\t\tctx, cancel := context.WithCancel(req.Context())\n\t\tdefer cancel()\n\t\tvar stream runtime.ServerTransportStream\n\t\tctx = grpc.NewContextWithServerTransportStream(ctx, &stream)\n\t\tinboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)\n\t\tvar err error\n\t\tvar annotatedContext context.Context\n\t\tannotatedContext, err = runtime.AnnotateIncomingContext(ctx, mux, req, \"/ttn.lorawan.v3.ClientRegistry/Restore\", runtime.WithHTTPPathPattern(\"/clients/{client_id}/restore\"))\n\t\tif err != nil {\n\t\t\truntime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)\n\t\t\treturn\n\t\t}\n\t\tresp, md, err := local_request_ClientRegistry_Restore_0(annotatedContext, inboundMarshaler, server, req, pathParams)\n\t\tmd.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer())\n\t\tannotatedContext = runtime.NewServerMetadataContext(annotatedContext, md)\n\t\tif err != nil {\n\t\t\truntime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err)\n\t\t\treturn\n\t\t}\n\n\t\tforward_ClientRegistry_Restore_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)\n\n\t})\n\n\tmux.Handle(\"DELETE\", pattern_ClientRegistry_Purge_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {\n\t\tctx, cancel := context.WithCancel(req.Context())\n\t\tdefer cancel()\n\t\tvar stream runtime.ServerTransportStream\n\t\tctx = grpc.NewContextWithServerTransportStream(ctx, &stream)\n\t\tinboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)\n\t\tvar err error\n\t\tvar annotatedContext context.Context\n\t\tannotatedContext, err = runtime.AnnotateIncomingContext(ctx, mux, req, \"/ttn.lorawan.v3.ClientRegistry/Purge\", runtime.WithHTTPPathPattern(\"/clients/{client_id}/purge\"))\n\t\tif err != nil {\n\t\t\truntime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)\n\t\t\treturn\n\t\t}\n\t\tresp, md, err := local_request_ClientRegistry_Purge_0(annotatedContext, inboundMarshaler, server, req, pathParams)\n\t\tmd.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer())\n\t\tannotatedContext = runtime.NewServerMetadataContext(annotatedContext, md)\n\t\tif err != nil {\n\t\t\truntime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err)\n\t\t\treturn\n\t\t}\n\n\t\tforward_ClientRegistry_Purge_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)\n\n\t})\n\n\treturn nil\n}", "title": "" }, { "docid": "96ed0c68fa1b8a73f700e31a1299050b", "score": "0.54446745", "text": "func RegisterWebRiskServiceServer(s *grpc.Server, srv WebRiskServiceServer) {\n\tsrc.RegisterWebRiskServiceServer(s, srv)\n}", "title": "" }, { "docid": "1806ba8580f43289ca11824a177832e8", "score": "0.54387116", "text": "func (c *criServiceManager) Register(s *grpc.Server) error {\n\treturn c.register(s)\n}", "title": "" }, { "docid": "5497aa1156a80961180ab5b9084c2ea6", "score": "0.5403527", "text": "func (p *AWSPlugin) GRPCServer(broker *plugin.GRPCBroker, s *grpc.Server) error {\n\tctx := context.Background()\n\n\tserver, err := newServer(ctx, \"\")\n\tif err != nil {\n\t\treturn fmt.Errorf(\"failed to initialize server: %w\", err)\n\t}\n\tpb.RegisterShoesServer(s, *server)\n\n\treturn nil\n}", "title": "" }, { "docid": "519ac68c799d75381d85395d74c21307", "score": "0.5389443", "text": "func Run() error {\n\tlisten, err := net.Listen(\"tcp\", \"0.0.0.0:50051\")\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tinstance := &Server{Secret: os.Getenv(\"SECRET\")}\n\tif instance.Secret == \"\" {\n\t\treturn errors.New(\"missing secret\")\n\t}\n\n\t// Authorized returns an response object with status OK and a header\n\t// that should be sent to the upstream service.\n\tokHDRs := make([]*core.HeaderValueOption, 1)\n\tokHDRs[0] = &core.HeaderValueOption{\n\t\tHeader: &core.HeaderValue{\n\t\t\tKey: \"x-ok-example\",\n\t\t\tValue: \"this will be sent to the upstream service..\",\n\t\t},\n\t\tAppend: &gogo_type.BoolValue{Value: true},\n\t}\n\tinstance.Authorized = &pb.CheckResponse{\n\t\tStatus: &rpc.Status{Code: int32(0)},\n\t\tHttpResponse: &pb.CheckResponse_OkResponse{\n\t\t\tOkResponse: &pb.OkHttpResponse{\n\t\t\t\tHeaders: okHDRs,\n\t\t\t},\n\t\t},\n\t}\n\n\t// Unauthorized will return header, status code and a body to the\n\t// downstream client.\n\tdeniedHDRs := make([]*core.HeaderValueOption, 1)\n\tdeniedHDRs[0] = &core.HeaderValueOption{\n\t\tHeader: &core.HeaderValue{\n\t\t\tKey: \"x-failed-example\",\n\t\t\tValue: \"this will be sent to the client..\",\n\t\t},\n\t\tAppend: &gogo_type.BoolValue{Value: false},\n\t}\n\tinstance.Unauthorized = &pb.CheckResponse{\n\t\tStatus: &rpc.Status{Code: int32(16)},\n\t\tHttpResponse: &pb.CheckResponse_DeniedResponse{\n\t\t\tDeniedResponse: &pb.DeniedHttpResponse{\n\t\t\t\tStatus: &envoy_type.HttpStatus{\n\t\t\t\t\tCode: envoy_type.StatusCode_Unauthorized,\n\t\t\t\t},\n\t\t\t\tHeaders: deniedHDRs,\n\t\t\t\tBody: \"invalid hmac\",\n\t\t\t},\n\t\t},\n\t}\n\n\t// Initialize the service.\n\tserver := grpc.NewServer()\n\tpb.RegisterAuthorizationServer(server, instance)\n\tlog.Printf(\"serving on port 50051\")\n\tserver.Serve(listen)\n\n\treturn nil\n}", "title": "" }, { "docid": "effb94434431e44a3a749e665d279831", "score": "0.5372558", "text": "func Add(mgr manager.Manager) error {\n\t// Create a webhook server.\n\t//hookServer := mgr.GetWebhookServer()\n\thookServer := &webhook.Server{\n\t\tHost: webhookHost,\n\t\tPort: webhookPort,\n\t\tCertDir: \"/tmp/k8s-webhook-server/serving-certs\",\n\t}\n\tif err := mgr.Add(hookServer); err != nil {\n\t\treturn err\n\t}\n\n\tvalidator := &ValidateNamespace{\n\t\tclient: mgr.GetClient(),\n\n\t\tcodecs: serializer.NewCodecFactory(mgr.GetScheme()),\n\t}\n\n\tvalidatingHook := &webhook.Admission{\n\t\tHandler: admission.HandlerFunc(func(ctx context.Context, req webhook.AdmissionRequest) webhook.AdmissionResponse {\n\t\t\treturn validator.Handle(ctx, req)\n\t\t}),\n\t}\n\n\t// Register the webhooks in the server.\n\thookServer.Register(webhookPath, validatingHook)\n\n\treturn nil\n}", "title": "" }, { "docid": "b8e1743f383243ab1bca87ce3d43d536", "score": "0.5370584", "text": "func InitServer(manager oauth2.Manager) *server.Server {\n\tgServer = server.NewDefaultServer(manager)\n\treturn gServer\n}", "title": "" }, { "docid": "9cc87d43e34f6dacb7208df57e7f0250", "score": "0.5359145", "text": "func Serve(ctx xctx.Context, grpcServer *grpc.Server, manager Manager) error {\n\tRegisterServiceServer(grpcServer, &server{manager: manager})\n\treturn nil\n}", "title": "" }, { "docid": "75b52a7f6bd4e44157babc10556c219a", "score": "0.5354522", "text": "func createServer() {\n\tlistener, err := net.Listen(\"tcp\", \"localhost:8080\")\n\tif err != nil {\n\t\tlog.Fatalf(\"unable to listen on 8080 port: %v\", err)\n\t}\n\tlog.Println(\"listening on port 8080\")\n\tsrv := grpc.NewServer()\n\tRegisterServerRequestsServer(srv, &server{})\n\treflection.Register(srv)\n\terr = srv.Serve(listener)\n\tif err != nil {\n\t\tlog.Fatalf(\"failed to serve: %v\", err)\n\t}\n\n}", "title": "" }, { "docid": "e7863991a1007a34135c88c079ddb011", "score": "0.53524894", "text": "func RegisterSecuritySettingsServiceServer(s *grpc.Server, srv SecuritySettingsServiceServer) {\n\tsrc.RegisterSecuritySettingsServiceServer(s, srv)\n}", "title": "" }, { "docid": "7060e1cb66806732b7ac554c34ffdeb7", "score": "0.5333027", "text": "func New(config Config, dialCertManager DialCertManager, listenCertManager ListenCertManager, resourceEventStore cqrsEventStore.EventStore, resourceSubscriber eventbus.Subscriber, store connectorStore.Store) *Server {\n\tdialTLSConfig := dialCertManager.GetClientTLSConfig()\n\tlistenTLSConfig := listenCertManager.GetServerTLSConfig()\n\tlistenTLSConfig.ClientAuth = tls.NoClientCert\n\n\tln, err := tls.Listen(\"tcp\", config.Addr, listenTLSConfig)\n\tif err != nil {\n\t\tlog.Fatalf(\"cannot listen and serve: %v\", err)\n\t}\n\n\traConn, err := grpc.Dial(config.ResourceAggregateAddr, grpc.WithTransportCredentials(credentials.NewTLS(dialTLSConfig)))\n\tif err != nil {\n\t\tlog.Fatalf(\"cannot create server: %v\", err)\n\t}\n\traClient := pbRA.NewResourceAggregateClient(raConn)\n\n\tauthConn, err := grpc.Dial(config.AuthServerAddr, grpc.WithTransportCredentials(credentials.NewTLS(dialTLSConfig)))\n\tif err != nil {\n\t\tlog.Fatalf(\"cannot create server: %v\", err)\n\t}\n\tauthClient := pbAS.NewAuthorizationServiceClient(authConn)\n\n\tctx := context.Background()\n\n\tresourceProjection, err := projectionRA.NewProjection(ctx, config.FQDN, resourceEventStore, resourceSubscriber, newResourceCtx(store, raClient))\n\tif err != nil {\n\t\tlog.Fatalf(\"cannot create server: %v\", err)\n\t}\n\n\t// load resource subscriptions\n\th := loadDeviceSubscriptionsHandler{\n\t\tresourceProjection: resourceProjection,\n\t}\n\terr = store.LoadSubscriptions(ctx, []connectorStore.SubscriptionQuery{\n\t\t{\n\t\t\tType: connectorStore.Type_Device,\n\t\t},\n\t}, &h)\n\tif err != nil {\n\t\tlog.Fatalf(\"cannot create server: %v\", err)\n\t}\n\n\t_, err = url.Parse(config.OAuthCallback)\n\tif err != nil {\n\t\tlog.Fatalf(\"cannot create server: %v\", err)\n\t}\n\n\trequestHandler := NewRequestHandler(config.OriginCloud, config.OAuthCallback, NewSubscriptionManager(config.EventsURL, authClient, raClient, store, resourceProjection), authClient, raClient, resourceProjection, store)\n\n\tserver := Server{\n\t\tserver: NewHTTP(requestHandler),\n\t\tcfg: config,\n\t\thandler: requestHandler,\n\t\tln: ln,\n\t}\n\n\treturn &server\n}", "title": "" }, { "docid": "21145aa3ac4d9fe808865bcdb6bcc399", "score": "0.53312594", "text": "func RegisterExperimentsServer(s *grpc.Server, srv ExperimentsServer) {\n\tsrc.RegisterExperimentsServer(s, srv)\n}", "title": "" }, { "docid": "55d48335938a3c72700618e4f7b5f9aa", "score": "0.5322721", "text": "func (s *Service) Register(r *grpc.Server) {\n\tserver := s.server\n\tapi.RegisterGNMIServer(r, server)\n\treflection.Register(r)\n}", "title": "" }, { "docid": "1877ee69dfc9c0a3b59a2d860b59e3d9", "score": "0.5322225", "text": "func RunServer(ctx context.Context, service v1.AuthService, serv *server.Server, httpPort string) error {\n\tctx, cancel := context.WithCancel(ctx)\n\tdefer cancel()\n\n\trouter := httprouter.New()\n\n\thandler := newHandler(service, serv)\n\n\trouter.POST(\"/api/v1/token\", handler.token)\n\n\tsrv := &http.Server{\n\t\tAddr: \":\" + httpPort,\n\t\tHandler: rest_middleware.AddCORS([]string{\"*\"},\n\t\t\trest_middleware.AddLogger(logger.Log, &ochttp.Handler{Handler: router})),\n\t}\n\t// Handler:router,\n\n\t// graceful shutdown\n\tc := make(chan os.Signal, 1)\n\tsignal.Notify(c, os.Interrupt)\n\tgo func() {\n\t\t<-c\n\t\t_, cancel := context.WithTimeout(ctx, 5*time.Second)\n\t\tdefer cancel()\n\n\t\t_ = srv.Shutdown(ctx)\n\t}()\n\n\tlogger.Log.Info(\"starting auth-service - \", zap.String(\"port\", httpPort))\n\treturn srv.ListenAndServe()\n}", "title": "" }, { "docid": "c4d00cd7e4f2c129c923640e86d63246", "score": "0.53158027", "text": "func AddServer(\n\tconfiguration *Configuration,\n\tgetCurrentConfiguration func() (*Configuration, error),\n\tpublicServer *http.ServeMux,\n\tprivateServer *http.ServeMux) error {\n\n\t// Validate that the configuration was given and is decent\n\tif err := ValidateConfiguration(configuration); err != nil {\n\t\tlog.Error(\"AddServer: Unable to use the configuration for server.\")\n\t\treturn common.ErrBadConfiguration\n\t}\n\n\tif publicServer == nil {\n\t\tlog.Error(\"AddServer: parameter publicServer was given null\")\n\t\treturn common.ErrBadConfiguration\n\t}\n\n\tif privateServer == nil {\n\t\tlog.Error(\"AddServer : parameter privateServer was given null\")\n\t\treturn common.ErrBadConfiguration\n\t}\n\n\tlog.Info(\"Creating SSO Engine.\")\n\n\t// Create an Engine\n\tengine, err := newSsoEngine(configuration)\n\tif err != nil {\n\t\tlog.Error(\"Unable to load the SSO engine.\")\n\t\treturn err\n\t}\n\n\t// Build the function that will reload needed details from the configuration\n\treloadConfiguration := func(currentEngine ssoEngine) (ssoEngine, func(request *http.Request) error, error) {\n\n\t\t// Load the new configuration\n\t\tconfiguration, err := getCurrentConfiguration()\n\t\tif err != nil {\n\t\t\tlog.Error(\"Unable to load the new SSO engine configuration.\")\n\t\t\treturn nil, nil, err\n\t\t}\n\n\t\t// Create a new Engine\n\t\tnewEngine, err := newSsoEngineKeepingRefreshToken(configuration, currentEngine)\n\t\tif err != nil {\n\t\t\tlog.Error(\"Unable to load the SSO engine.\")\n\t\t\treturn nil, nil, err\n\t\t}\n\n\t\treturn newEngine, buildEndpointAuthenticationFunction(*configuration), nil\n\t}\n\n\t// Create a server\n\tvar server authServer = authServerImpl{\n\t\tssoEngine: engine,\n\t\tendpointAuthentication: buildEndpointAuthenticationFunction(*configuration),\n\t\treloadConfiguration: reloadConfiguration,\n\t}\n\n\tlog.Info(\"Adding SSO Server Handler.\")\n\n\t// Add the public endpoints\n\tpublicServer.HandleFunc(\"/token\", server.handleTokenRequest)\n\tpublicServer.HandleFunc(\"/refresh\", server.handleRefreshRequest)\n\n\t// Add the private endpoints\n\tprivateServer.HandleFunc(\"/status\", server.handleGetStatus)\n\tprivateServer.HandleFunc(\"/reload-sso-configuration\", server.handleReloadConfiguration)\n\n\treturn nil\n}", "title": "" }, { "docid": "e97ab5cb2b051496779b5ac5cd6fc1f0", "score": "0.53148293", "text": "func Register(svr *server.Server) {\n\n\t// setup server var\n\ts = svr\n\n\t// setup db collections\n\tdb.persons = s.Db.C(\"persons\")\n\tdb.classes = s.Db.C(\"classes\")\n\n\ts.Echo.POST(\"/api/v1/persons\", CreatePerson)\n\ts.Echo.POST(\"/api/v1/persons/login\", LoginPerson)\n\n\ts.Echo.GET(\"/\", func(c echo.Context) error {\n\t\treturn c.JSON(200, server.Success())\n\t})\n\n\t// authorized routes\n\troutes := s.Echo.Group(\"/api/v1\")\n\troutes.Use(middleware.JWT(s.JwtSecret))\n\t{\n\t\troutes.GET(\"/persons/classes\", GetClassList)\n\t\troutes.POST(\"/classes\", CreateClass)\n\t}\n}", "title": "" }, { "docid": "94a4cea52b1cd6e8d681d9ec482be54c", "score": "0.53059906", "text": "func RegisterSpeechServer(s *grpc.Server, srv SpeechServer) { src.RegisterSpeechServer(s, srv) }", "title": "" }, { "docid": "bb255bbccbfd3828f8602f72f9555188", "score": "0.52900296", "text": "func RegisterEnvironmentsServer(s *grpc.Server, srv EnvironmentsServer) {\n\tsrc.RegisterEnvironmentsServer(s, srv)\n}", "title": "" }, { "docid": "9ec8f4f24baf6bc692d3e5f1b41e1ce8", "score": "0.52846366", "text": "func (l *LXDPlugin) GRPCServer(broker *plugin.GRPCBroker, s *grpc.Server) error {\n\thostsConfig, mapping, err := loadConfig()\n\tif err != nil {\n\t\treturn fmt.Errorf(\"failed to load config: %w\", err)\n\t}\n\n\tclient, err := New(hostsConfig, mapping)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"failed to create client: %w\", err)\n\t}\n\n\tpb.RegisterShoesServer(s, client)\n\treturn nil\n}", "title": "" }, { "docid": "5c0bb6373c80d02b50f633e2749a80d0", "score": "0.52743256", "text": "func (s *Server) DoRegister(server *grpc.Server) {\n\t// Pass\n}", "title": "" }, { "docid": "7ca78b61faede161b1e24c8423aa4902", "score": "0.52697253", "text": "func register(self Server) {\n\tregistered := false\n\n\tfor !registered {\n\t\t// Bluebook IP has to be hardcoded... think of it like a DNS server !\n\t\t// Request the IP address of the SLD server for this client\n\t\tresponseBlueBook, err := http.Get(\"http://192.168.1.3:8888/bluebook/\" +\n\t\t\tself.Name)\n\n\t\t// If there was a failure during registration, maybe the Blue Book server\n\t\t// doesn't exist (404) or is unresponsive (5xx), then don't let the MSA\n\t\t// client startup. log and loop again\n\t\tif err != nil {\n\t\t\tlog.Print(err.Error())\n\t\t\ttime.Sleep(2 * time.Second)\n\t\t\tcontinue\n\t\t} else if responseBlueBook.StatusCode > 299 {\n\t\t\tlog.Print(\"The bluebook service is unavailabe, or there was a\" +\n\t\t\t\t\" problem while sending the request : \" + responseBlueBook.Status)\n\t\t\ttime.Sleep(2 * time.Second)\n\t\t\tcontinue\n\t\t}\n\n\t\tbodyBlueBook, err := ioutil.ReadAll(responseBlueBook.Body)\n\n\t\tif err != nil {\n\t\t\t// again, if we couldn't read the response from the bluebook, no point\n\t\t\t// in starting up, so loop again\n\t\t\tlog.Print(err.Error())\n\t\t\ttime.Sleep(2 * time.Second)\n\t\t\tcontinue\n\t\t}\n\n\t\tvar MTAServ Server\n\t\terr = json.Unmarshal(bodyBlueBook, &MTAServ)\n\n\t\tif err != nil {\n\t\t\t// again, if we couldn't read the response from the bluebook, no point\n\t\t\t// in starting up, so loop again\n\t\t\tlog.Print(err.Error())\n\t\t\ttime.Sleep(2 * time.Second)\n\t\t\tcontinue\n\t\t}\n\n\t\tselfJSON, err := json.Marshal(self)\n\n\t\tif err != nil {\n\t\t\t// If we can't create json string to describe this client, loop again\n\t\t\tlog.Print(err.Error())\n\t\t\ttime.Sleep(2 * time.Second)\n\t\t\tcontinue\n\t\t}\n\n\t\tlog.Print(\"Registering with:\", MTAServ.Address+\"email/server/register\")\n\n\t\trespMTA, err := http.Post(MTAServ.Address+\"email/server/register\", \"application/json\",\n\t\t\tbytes.NewReader(selfJSON))\n\n\t\t// If there was a failure during registration, maybe the MTA server\n\t\t// doesn't exist (404) or is unresponsive (5xx), then don't let the MSA\n\t\t// client startup. log and loop again\n\t\tif err != nil {\n\t\t\tlog.Print(err.Error())\n\t\t\ttime.Sleep(2 * time.Second)\n\t\t\tcontinue\n\t\t} else if responseBlueBook.StatusCode > 299 {\n\t\t\tlog.Print(\"The bluebook service is unavailabe, or there was a\" +\n\t\t\t\t\" problem while sending the request : \" + respMTA.Status)\n\t\t\ttime.Sleep(2 * time.Second)\n\t\t\tcontinue\n\t\t}\n\n\t\t// Finally registered ! Log and break out of the loop\n\t\tregistered = true\n\n\t\tlog.Print(\"Registered!\")\n\t}\n}", "title": "" }, { "docid": "c3c55f893f5dbb63ca62ff27090379ed", "score": "0.52675015", "text": "func RegisterImageAnnotatorServer(s *grpc.Server, srv ImageAnnotatorServer) {\n\tsrc.RegisterImageAnnotatorServer(s, srv)\n}", "title": "" }, { "docid": "9d892c139ddf934da4607bd55052f7a5", "score": "0.5264716", "text": "func NewServer() minter.TokenMinterServer {\n\treturn &serverImpl{\n\t\tMintMachineTokenRPC: machinetoken.MintMachineTokenRPC{\n\t\t\tSigner: gaesigner.Signer{},\n\t\t\tCheckCertificate: certchecker.CheckCertificate,\n\t\t\tLogToken: machinetoken.LogToken,\n\t\t},\n\t\tMintDelegationTokenRPC: delegation.MintDelegationTokenRPC{\n\t\t\tSigner: gaesigner.Signer{},\n\t\t\tRules: delegation.GlobalRulesCache.Rules,\n\t\t\tLogToken: delegation.LogToken,\n\t\t},\n\t}\n}", "title": "" }, { "docid": "14ce54c90b9b8a9ff2d7cae65a5cf755", "score": "0.5259514", "text": "func setupServer() *http.Server {\n\ttlsConfig := &tls.Config{\n\t\tMinVersion: tls.VersionTLS12,\n\t\tCurvePreferences: []tls.CurveID{tls.CurveP521, tls.CurveP384, tls.CurveP256},\n\t\tPreferServerCipherSuites: true,\n\t\tCipherSuites: []uint16{\n\t\t\ttls.TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256,\n\t\t\ttls.TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384,\n\t\t\ttls.TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA,\n\t\t\ttls.TLS_RSA_WITH_AES_256_GCM_SHA384,\n\t\t\ttls.TLS_RSA_WITH_AES_256_CBC_SHA,\n\t\t}}\n\troutes := registerRoutes()\n\tauthRoutes := authMiddleware(routes)\n\tserver := &http.Server{\n\t\tAddr: \":443\",\n\t\tTLSConfig: tlsConfig,\n\t\tHandler: authRoutes,\n\t}\n\treturn server\n}", "title": "" }, { "docid": "21f0c213f49a2379bde1950915b0a38d", "score": "0.5257729", "text": "func RegisterPagesServer(s *grpc.Server, srv PagesServer) { src.RegisterPagesServer(s, srv) }", "title": "" }, { "docid": "0b435918fa3acc176e323ac6b3e24d34", "score": "0.5257641", "text": "func NewServer(cfg Config) (*server.Server, func(), error) {\n\twire.Build(\n\t\txserver.ServiceSet,\n\t\twire.FieldsOf(new(Config), \"Logger\", \"Telemetry\", \"HealthChecks\"),\n\t\tnewRouterConfig,\n\t\tnewRouter,\n\t\twire.Bind(new(http.Handler), new(*mux.Router)),\n\t)\n\treturn nil, nil, nil\n}", "title": "" }, { "docid": "ba0f746ddec9f9fe738ef011b3e59d4d", "score": "0.5254316", "text": "func NewServer(\n\taddr string,\n\tcontrollerNS string,\n\tidentityTrustDomain string,\n\tenableH2Upgrade bool,\n\tk8sAPI *k8s.API,\n\tclusterDomain string,\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\tclusterDomain,\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}", "title": "" }, { "docid": "aecf1e70d95992bf43b73764564a851b", "score": "0.5252857", "text": "func setupServer() (net.Addr, error) {\n\t// Initialize server sensor to instrument request handlers\n\tsensor := instana.NewSensor(\"grpc-server\")\n\n\tln, err := net.Listen(\"tcp\", \":0\")\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"failed to start listener: %s\", err)\n\t}\n\n\t// To instrument server calls add instagrpc.UnaryServerInterceptor(sensor) and\n\t// instagrpc.StreamServerInterceptor(sensor) to the list of server options when\n\t// initializing the server\n\tsrv := grpc.NewServer(\n\t\tgrpc.UnaryInterceptor(instagrpc.UnaryServerInterceptor(sensor)),\n\t\tgrpc.StreamInterceptor(instagrpc.StreamServerInterceptor(sensor)),\n\t)\n\n\tgrpc_testing.RegisterTestServiceServer(srv, &TestServiceServer{})\n\tgo func() {\n\t\tif err := srv.Serve(ln); err != nil {\n\t\t\tlog.Fatalf(\"failed to start server: %s\", err)\n\t\t}\n\t}()\n\n\treturn ln.Addr(), nil\n}", "title": "" }, { "docid": "922167727ca58fbd187973e1ff2f6d2b", "score": "0.52524805", "text": "func (m *SignatureManager) GetServer() *grpc.Server {\n\tserver := net.NewServer(m.auth.Cert, m.auth.Key, m.auth.CA)\n\tm.cServerIface = clientServer{}\n\tcAPI.RegisterClientServer(server, &m.cServerIface)\n\treturn server\n}", "title": "" }, { "docid": "7dec27e1db3fb277837e3d0569995bea", "score": "0.5250134", "text": "func RegisterTestCasesServer(s *grpc.Server, srv TestCasesServer) {\n\tsrc.RegisterTestCasesServer(s, srv)\n}", "title": "" }, { "docid": "94c355fd33e6d7cec52b8260a626b9b3", "score": "0.52480555", "text": "func SetupServer(host string) *http.Server {\n\t// read cert binary data from bundled assets\n\tcertData, err := Asset(certPath)\n\tif err != nil {\n\t\tfmt.Printf(\"[-] Error reading cert file: %s\\n\", err)\n\t}\n\t// read key binary data from bundled assets\n\tkeyData, err := Asset(keyPath)\n\tif err != nil {\n\t\tfmt.Printf(\"[-] Error reading cert file: %s\\n\", err)\n\t}\n\n\t// create the server with the custom pair\n\tcert, err := tls.X509KeyPair(certData, keyData)\n\ttlsConfig := &tls.Config{Certificates: []tls.Certificate{cert}}\n\tserver := http.Server{\n\t\tAddr: host,\n\t\tTLSConfig: tlsConfig,\n\t}\n\n\treturn &server\n}", "title": "" }, { "docid": "08a4e3b51c0cbe2b52014d176d53cbfe", "score": "0.52387047", "text": "func NewServer(store *db.Store) *Server {\n\tserver := &Server{store : store}\n\tr := gin.New()\n\n\tp := ginprometheus.NewPrometheus(\"gin\")\n\n\tp.Use(r)\n\n\t// r.Run(\":29090\")\n\n\t\n\tr.POST(\"/users\", token.TokenAuthMiddleware(), server.createUser)\n\tr.DELETE(\"/user/:id\", token.TokenAuthMiddleware(), server.deleteUser)\n\tr.POST(\"/register\", server.register)\n\tr.POST(\"/login\", token.TokenAuthMiddleware(), server.login)\n\tr.POST(\"/logout\", token.TokenAuthMiddleware(), server.logout)\n\tr.POST(\"/refresh\", token.TokenAuthMiddleware(), server.refresh)\n\t\n\tserver.router = r\n\treturn server\n}", "title": "" }, { "docid": "274e593cdbac8991524175f4ef39c512", "score": "0.5230152", "text": "func NewServer(conf *rpc.ServerConfig, regConf *ProviderRegistryConfig) (*Server, error) {\n\tvar (\n\t\terr error\n\t\trpcServer *rpc.Server\n\t\tregistry gxregistry.Registry\n\t)\n\n\tif err = regConf.CheckValidity(); err != nil {\n\t\treturn nil, jerrors.Trace(err)\n\t}\n\n\tif rpcServer, err = rpc.NewServer(conf); err != nil {\n\t\treturn nil, jerrors.Trace(err)\n\t}\n\n\tregAddrList := strings.Split(regConf.RegAddr, \",\")\n\tswitch regConf.Type {\n\tcase \"etcd\":\n\t\tregistry, err = gxetcd.NewRegistry(\n\t\t\tgxregistry.WithAddrs(regAddrList...),\n\t\t\tgxregistry.WithTimeout(time.Duration(1e9*regConf.KeepaliveTimeout)),\n\t\t\tgxregistry.WithRoot(regConf.Root),\n\t\t)\n\tcase \"zookeeper\":\n\t\tregistry, err = gxzookeeper.NewRegistry(\n\t\t\tgxregistry.WithAddrs(regAddrList...),\n\t\t\tgxregistry.WithTimeout(time.Duration(1e9*regConf.KeepaliveTimeout)),\n\t\t\tgxregistry.WithRoot(regConf.Root),\n\t\t)\n\tdefault:\n\t\treturn nil, jerrors.Errorf(ErrIllegalConf+\"registry type %s\", regConf.Type)\n\t}\n\tif err != nil {\n\t\treturn nil, jerrors.Trace(err)\n\t}\n\n\tvar localAddrArr []string\n\tfor _, p := range conf.Ports {\n\t\tport, err := strconv.Atoi(p)\n\t\tif err != nil {\n\t\t\treturn nil, jerrors.Trace(err)\n\t\t}\n\n\t\tif port <= 0 || 65535 < port {\n\t\t\treturn nil, jerrors.Errorf(\"illegal port %s\", p)\n\t\t}\n\n\t\tlocalAddrArr = append(localAddrArr, net.JoinHostPort(conf.Host, p))\n\t}\n\n\tfor _, svr := range regConf.ServiceArray {\n\t\taddr := gxnet.HostAddress(svr.LocalHost, svr.LocalPort)\n\t\tif ok := gxstrings.Contains(gxstrings.Strings2Ifs(localAddrArr), addr); !ok {\n\t\t\treturn nil, jerrors.Errorf(\"can not find ServiceConfig addr %s in conf address array %#v\",\n\t\t\t\taddr, localAddrArr)\n\t\t}\n\t}\n\n\treturn &Server{\n\t\tServer: rpcServer,\n\t\tregConf: *regConf,\n\t\tregistry: registry,\n\t}, nil\n}", "title": "" }, { "docid": "195203759a7aae124b3c86973d8d774c", "score": "0.522873", "text": "func RegisterCapsuleBMServer(e *bm.Engine, server CapsuleBMServer) {\n\tv1CapsuleSvc = server\n\te.GET(\"/live.xlottery.v1.Capsule/get_detail\", capsuleGetDetail)\n\te.GET(\"/live.xlottery.v1.Capsule/open_capsule\", capsuleOpenCapsule)\n\te.GET(\"/live.xlottery.v1.Capsule/get_coin_list\", capsuleGetCoinList)\n\te.GET(\"/live.xlottery.v1.Capsule/update_coin_config\", capsuleUpdateCoinConfig)\n\te.GET(\"/live.xlottery.v1.Capsule/update_coin_status\", capsuleUpdateCoinStatus)\n\te.GET(\"/live.xlottery.v1.Capsule/delete_coin\", capsuleDeleteCoin)\n\te.GET(\"/live.xlottery.v1.Capsule/get_pool_list\", capsuleGetPoolList)\n\te.GET(\"/live.xlottery.v1.Capsule/update_pool\", capsuleUpdatePool)\n\te.GET(\"/live.xlottery.v1.Capsule/delete_pool\", capsuleDeletePool)\n\te.GET(\"/live.xlottery.v1.Capsule/update_pool_status\", capsuleUpdatePoolStatus)\n\te.GET(\"/live.xlottery.v1.Capsule/get_pool_prize\", capsuleGetPoolPrize)\n\te.GET(\"/live.xlottery.v1.Capsule/get_prize_type\", capsuleGetPrizeType)\n\te.GET(\"/live.xlottery.v1.Capsule/get_prize_expire\", capsuleGetPrizeExpire)\n\te.GET(\"/live.xlottery.v1.Capsule/update_pool_prize\", capsuleUpdatePoolPrize)\n\te.GET(\"/live.xlottery.v1.Capsule/delete_pool_prize\", capsuleDeletePoolPrize)\n\te.GET(\"/live.xlottery.v1.Capsule/get_capsule_info\", capsuleGetCapsuleInfo)\n\te.GET(\"/live.xlottery.v1.Capsule/open_capsule_by_type\", capsuleOpenCapsuleByType)\n\te.GET(\"/live.xlottery.v1.Capsule/get_coupon_list\", capsuleGetCouponList)\n}", "title": "" }, { "docid": "92b15241deb52c152e32abb70cda7d2e", "score": "0.52275187", "text": "func NewServer(mgr *settings.SettingsManager, repoClient apiclient.Clientset, authenticator Authenticator, disableAuth, appsInAnyNamespaceEnabled bool) *Server {\n\treturn &Server{mgr: mgr, repoClient: repoClient, authenticator: authenticator, disableAuth: disableAuth, appsInAnyNamespaceEnabled: appsInAnyNamespaceEnabled}\n}", "title": "" }, { "docid": "f0c86b28a52247cc55a8c8fcbb63091d", "score": "0.52124196", "text": "func RegisterCapsuleBMServer(e *bm.Engine, server CapsuleBMServer) {\n\tv1CapsuleSvc = server\n\te.GET(\"/live.liveadmin.v1.Capsule/get_coin_list\", capsuleGetCoinList)\n\te.POST(\"/live.liveadmin.v1.Capsule/update_coin_config\", capsuleUpdateCoinConfig)\n\te.POST(\"/live.liveadmin.v1.Capsule/update_coin_status\", capsuleUpdateCoinStatus)\n\te.POST(\"/live.liveadmin.v1.Capsule/delete_coin\", capsuleDeleteCoin)\n\te.GET(\"/live.liveadmin.v1.Capsule/get_pool_list\", capsuleGetPoolList)\n\te.POST(\"/live.liveadmin.v1.Capsule/update_pool\", capsuleUpdatePool)\n\te.POST(\"/live.liveadmin.v1.Capsule/delete_pool\", capsuleDeletePool)\n\te.POST(\"/live.liveadmin.v1.Capsule/update_pool_status\", capsuleUpdatePoolStatus)\n\te.GET(\"/live.liveadmin.v1.Capsule/get_pool_prize\", capsuleGetPoolPrize)\n\te.GET(\"/live.liveadmin.v1.Capsule/get_prize_type\", capsuleGetPrizeType)\n\te.GET(\"/live.liveadmin.v1.Capsule/get_prize_expire\", capsuleGetPrizeExpire)\n\te.POST(\"/live.liveadmin.v1.Capsule/update_pool_prize\", capsuleUpdatePoolPrize)\n\te.POST(\"/live.liveadmin.v1.Capsule/delete_pool_prize\", capsuleDeletePoolPrize)\n\te.GET(\"/live.liveadmin.v1.Capsule/get_coupon_list\", capsuleGetCouponList)\n}", "title": "" }, { "docid": "4b91488e10dab3d83fbe8d7a090551b5", "score": "0.5211796", "text": "func RegisterPushBMServer(e *bm.Engine, server PushBMServer, midMap map[string]bm.HandlerFunc) {\n\tauth := midMap[\"auth\"]\n\tPushSvc = server\n\te.GET(\"/push.interface.v1.Push/Ping\", pushPing)\n\te.POST(\"/push/user\", auth, pushPushUser)\n}", "title": "" }, { "docid": "e7b634515ff45423bd9509ac2d08c621", "score": "0.5208716", "text": "func (rsc *RedSkyConfig) RegisterClient(ctx context.Context, client *registration.ClientMetadata) (*registration.ClientInformationResponse, error) {\n\t// We can't use the initial token because we don't know if we have a valid token, instead we need to authorize the context client\n\tsrc, err := rsc.tokenSource(ctx)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tif src != nil {\n\t\tctx = context.WithValue(ctx, oauth2.HTTPClient, oauth2.NewClient(ctx, src))\n\t}\n\n\t// Get the current server configuration for the registration endpoint address\n\tsrv, err := CurrentServer(rsc.Reader())\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tc := registration.Config{\n\t\tRegistrationURL: srv.Authorization.RegistrationEndpoint,\n\t}\n\treturn c.Register(ctx, client)\n}", "title": "" }, { "docid": "94bdf308e51e248a353a431aebfd4c03", "score": "0.5198532", "text": "func Register(ctx context.Context, server *grpc.Server) {\n\tDefaultServerMetrics.InitializeMetrics(ctx, server)\n}", "title": "" }, { "docid": "fb992ed6c2e92cc9fc5f9f2608552f3f", "score": "0.51929617", "text": "func Register(srv *grpc.Server, conf Config) error {\n\treflectionServer, err := newReflectionServiceServer(srv, conf)\n\tif err != nil {\n\t\treturn err\n\t}\n\tRegisterReflectionServiceServer(srv, reflectionServer)\n\treturn nil\n}", "title": "" }, { "docid": "7da165cf54213ce30bb6af4767e7fbfa", "score": "0.51918024", "text": "func RunServer(token, addr string, store store.Store, logger *log.Logger) *http.Server {\n\n\th := &handler{\n\t\tauthToken: token,\n\t\tstore: store,\n\t\tlogger: logger,\n\t}\n\n\tserver := &http.Server{\n\t\tAddr: addr,\n\t\tHandler: h,\n\t}\n\n\tgo func() {\n\t\tif err := server.ListenAndServe(); err != nil {\n\t\t\th.logger.Fatalf(\"Server shutdown: %s\", err.Error())\n\t\t}\n\t}()\n\n\treturn server\n}", "title": "" }, { "docid": "423dc0f2c614a8d8fb5d32d5f85df74f", "score": "0.51861644", "text": "func (s *Server) DoRegister(server *grpc.Server) {\n\tpb.RegisterDiscoveryServiceServer(server, s)\n\tpb.RegisterDiscoveryServiceV2Server(server, s)\n}", "title": "" }, { "docid": "2292c7827146a97d6ed0fa614a33fbb2", "score": "0.51834077", "text": "func (srv *Server) RegisterOnSubscribe(callback OnSubscribe) {\n\tsrv.checkStatus()\n\tsrv.onSubscribe = callback\n}", "title": "" }, { "docid": "18466a8bef8da8525070999ce6f8ee90", "score": "0.5171059", "text": "func RegisterChangelogsServer(s *grpc.Server, srv ChangelogsServer) {\n\tsrc.RegisterChangelogsServer(s, srv)\n}", "title": "" }, { "docid": "34ad3b4bc301d4e73fedc8b476ae2271", "score": "0.5168091", "text": "func NewServer(host, route string, headers map[string]string) *Server {\n\ts := &Server{\n\t\tHost: host,\n\t\tRoute: route,\n\t\tMethods: make(map[string]MethodWithContext),\n\t\tHeaders: headers,\n\t}\n\n\ts.Methods[\"jrpc2.register\"] = MethodWithContext{Method: s.RegisterRPC}\n\n\treturn s\n}", "title": "" }, { "docid": "147ccea297d2cc377ba2697592b60758", "score": "0.51677656", "text": "func RunServer(ctx context.Context, grpcPort, httpPort, certFilePath string, keyFilePath string) error {\n\tctx, cancel := context.WithCancel(ctx)\n\tdefer cancel()\n\n\t// mux := runtime.NewServeMux()\n\tmux := runtime.NewServeMux(\n\t\truntime.WithMarshalerOption(runtime.MIMEWildcard, &runtime.JSONPb{}),\n\t\truntime.WithIncomingHeaderMatcher(CustomMatcher),\n\t\truntime.WithErrorHandler(DefaultHTTPProtoErrorHandler),\n\t\t// runtime.WithProtoErrorHandler(DefaultHTTPProtoErrorHandler),\n\t)\n\topts := []grpc.DialOption{}\n\tif certFilePath != \"\" && keyFilePath != \"\" {\n\t\t// creds, err := credentials.NewServerTLSFromFile(certFilePath, keyFilePath)\n\t\t// creds, err := credentials.NewClientTLSFromFile(certFilePath, \"CheeTest\")\n\t\t// if err != nil {\n\t\t// \tlog.Fatalf(\"Failed to generate credentials %v\", err)\n\t\t// }\n\n\t\tb, _ := ioutil.ReadFile(certFilePath)\n\t\tcp := x509.NewCertPool()\n\t\tif !cp.AppendCertsFromPEM(b) {\n\t\t\tlog.Fatalf(\"fail to dial: %v\", errors.New(\"credentials: failed to append certificates\"))\n\t\t}\n\t\tconfig := &tls.Config{\n\t\t\tInsecureSkipVerify: true,\n\t\t\tRootCAs: cp,\n\t\t}\n\t\tcreds := credentials.NewTLS(config)\n\n\t\topts = append(opts, grpc.WithTransportCredentials(creds))\n\t} else {\n\t\topts = append(opts, grpc.WithInsecure())\n\t}\n\tif err := pb.RegisterFileServiceHandlerFromEndpoint(ctx, mux, \"localhost:\"+grpcPort, opts); err != nil {\n\t\t// log.Fatalf(\"failed to start HTTP gateway: %v\", err)\n\t\tlogger.Log.Fatal(\"failed to start HTTP gateway: %v\", zap.String(\"reason\", err.Error()))\n\t}\n\tfmt.Println(\"REST : gRPC client up\")\n\n\t// cert, err := tls.LoadX509KeyPair(certFilePath, keyFilePath)\n\t// if err != nil {\n\t// \tlog.Println(err)\n\t// \treturn err\n\t// }\n\n\t// tlsConfig := &tls.Config{Certificates: []tls.Certificate{cert}}\n\tsrv := &http.Server{\n\t\tAddr: \":\" + httpPort,\n\t\t// Handler: mux,\n\t\tHandler: middleware.AddRequestID(middleware.AddLogger(logger.Log, mux)),\n\t\t// TLSConfig: tlsConfig,\n\t}\n\n\t// graceful shutdown\n\tc := make(chan os.Signal, 1)\n\tsignal.Notify(c, os.Interrupt)\n\tgo func() {\n\t\tfor range c {\n\t\t\t// sig is a ^C, handle it\n\t\t}\n\n\t\t_, cancel := context.WithTimeout(ctx, 5*time.Second)\n\t\tdefer cancel()\n\n\t\t_ = srv.Shutdown(ctx)\n\t}()\n\n\tfmt.Println(\"starting HTTP/REST gateway...\")\n\tlogger.Log.Info(\"starting HTTP/REST gateway...\")\n\treturn srv.ListenAndServe()\n}", "title": "" }, { "docid": "c42bfbeaf39a0e8632a0768ec74273e8", "score": "0.516359", "text": "func GrpcServer(conf models.Config) error {\n\n\t// Handelling Panics\n\tdefer func() {\n\t\tif rec := recover(); rec != nil {\n\t\t\tLogs.Error(\"Grpc Server run into issue \", rec)\n\t\t}\n\t}()\n\n\tLogs = models.NewLogger(&conf)\n\n\tlis, err := net.Listen(\"tcp\", fmt.Sprintf(\"%s:%d\", conf.Harepd.Grpc.BindAddress, conf.Harepd.Grpc.BindPort))\n\tif err != nil {\n\t\tLogs.Error(err)\n\t\treturn err\n\t}\n\n\tvar opts []grpc.ServerOption\n\tif conf.Harepd.Grpc.TLS.Enabled {\n\t\tcertFile := conf.Harepd.Grpc.TLS.Cert\n\t\tkeyFile := conf.Harepd.Grpc.TLS.Key\n\t\tcreds, err := credentials.NewServerTLSFromFile(certFile, keyFile)\n\t\tif err != nil {\n\t\t\tLogs.Error(err)\n\t\t\treturn err\n\t\t}\n\t\topts = []grpc.ServerOption{grpc.Creds(creds)}\n\t}\n\n\tgrpcServer := grpc.NewServer(opts...)\n\tLogs.Info(grpcServer)\n\tmodels.RegisterClusterInfoServer(grpcServer, newServer(&conf))\n\tgrpcServer.Serve(lis)\n\n\treturn nil\n}", "title": "" }, { "docid": "aa38a3952e450de4ae26521990a2bdba", "score": "0.5161025", "text": "func (g *Gate) RegisterProxyServerHandler(handler network.SessionHandler) {\n\tg.serverHandler = handler\n}", "title": "" }, { "docid": "a6faec3ce37e83418e89b81dcdc65124", "score": "0.516086", "text": "func RegisterRoomBMServer(e *bm.Engine, server RoomBMServer) {\n\tRoomSvc = server\n\te.GET(\"/live.xroom.v1.Room/getMultiple\", roomGetMultiple)\n\te.GET(\"/live.xroom.v1.Room/getMultipleByUids\", roomGetMultipleByUids)\n\te.GET(\"/live.xroom.v1.Room/isAnchor\", roomIsAnchor)\n}", "title": "" }, { "docid": "31efc7c435052650ee2c2230f0bb09cc", "score": "0.5157894", "text": "func (a *Agent) setupServer() error {\n\tauthorizer := auth.New(\n\t\ta.Config.ACLModelFile,\n\t\ta.Config.ACLPolicyFile,\n\t)\n\tserverConfig := &server.Config{\n\t\tCommitLog: a.log,\n\t\tAuthorizer: authorizer,\n\t\tGetServerer: a.log,\n\t}\n\tvar opts []grpc.ServerOption\n\tif a.Config.ServerTLSConfig != nil {\n\t\tcreds := credentials.NewTLS(a.Config.ServerTLSConfig)\n\t\topts = append(opts, grpc.Creds(creds))\n\t}\n\tvar err error\n\ta.server, err = server.NewGRPCServer(serverConfig, opts...)\n\tif err != nil {\n\t\treturn err\n\t}\n\tgrpcLn := a.mux.Match(cmux.Any())\n\tgo func() {\n\t\tif err := a.server.Serve(grpcLn); err != nil {\n\t\t\t_ = a.Shutdown()\n\t\t}\n\t}()\n\treturn err\n}", "title": "" }, { "docid": "1f79970eb170f5b45ee1b72aec067b42", "score": "0.5154979", "text": "func (c *GrpcClient) RegisterServerMessageChan(ch chan<- *protocol.Message) {\r\n\t// not supported\r\n}", "title": "" }, { "docid": "23437ad03ec0ca0eef986565068386bf", "score": "0.5153482", "text": "func (s *Server) Run() error {\n\topentracing.SetGlobalTracer(s.Tracer)\n\n\tif s.Port == 0 {\n\t\treturn fmt.Errorf(\"server port must be set\")\n\t}\n\n\ts.uuid = uuid.New().String()\n\n\topts := []grpc.ServerOption{\n\t\tgrpc.KeepaliveParams(keepalive.ServerParameters{\n\t\t\tTimeout: 120 * time.Second,\n\t\t}),\n\t\tgrpc.KeepaliveEnforcementPolicy(keepalive.EnforcementPolicy{\n\t\t\tPermitWithoutStream: true,\n\t\t}),\n\t\tgrpc.UnaryInterceptor(\n\t\t\totgrpc.OpenTracingServerInterceptor(s.Tracer),\n\t\t),\n\t}\n\n\tif tlsopt := tls.GetServerOpt(); tlsopt != nil {\n\t\topts = append(opts, tlsopt)\n\t}\n\n\tsrv := grpc.NewServer(opts...)\n\n\tpb.RegisterRateServer(srv, s)\n\n\tlis, err := net.Listen(\"tcp\", fmt.Sprintf(\":%d\", s.Port))\n\tif err != nil {\n\t\tlog.Fatal().Msgf(\"failed to listen: %v\", err)\n\t}\n\n\t// register the service\n\t// jsonFile, err := os.Open(\"config.json\")\n\t// if err != nil {\n\t// \tfmt.Println(err)\n\t// }\n\n\t// defer jsonFile.Close()\n\n\t// byteValue, _ := ioutil.ReadAll(jsonFile)\n\n\t// var result map[string]string\n\t// json.Unmarshal([]byte(byteValue), &result)\n\n\terr = s.Registry.Register(name, s.uuid, s.IpAddr, s.Port)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"failed register: %v\", err)\n\t}\n\tlog.Info().Msg(\"Successfully registered in consul\")\n\n\treturn srv.Serve(lis)\n}", "title": "" }, { "docid": "a040df7a055968928ca89341184326c4", "score": "0.5150551", "text": "func NewServer(port int, authenticator Authenticator,\n\tregistry Registry) *Server {\n\tmux := http.NewServeMux()\n\tserver := &Server{\n\t\thttp.Server{Addr: fmt.Sprintf(\"localhost:%d\", port), Handler: mux},\n\t\tregistry,\n\t\tauthenticator,\n\t}\n\tmux.HandleFunc(\"/register\", server.handleRegister)\n\tmux.HandleFunc(\"/deregister\", server.handleDeregister)\n\tmux.HandleFunc(\"/discover\", server.handleDiscover)\n\tmux.HandleFunc(\"/list\", server.handleList)\n\tmux.HandleFunc(\"/ping\", server.handlePing)\n\treturn server\n}", "title": "" }, { "docid": "057de84657fd4fbdd2d8e0c6b1c99f7f", "score": "0.5134429", "text": "func RegisterWeChatBMServer(e *bm.Engine, server WeChatBMServer) {\n\tWeChatSvc = server\n\te.POST(\"/weChat/getOpenId\", weChatGetWeChatOpenID)\n\te.POST(\"/weChat/login\", weChatLogin)\n}", "title": "" }, { "docid": "ab0262d993b7aa05bdc8836aa4613a42", "score": "0.5130143", "text": "func RegisterOpenStorageFilesystemCheckHandlerServer(ctx context.Context, mux *runtime.ServeMux, server OpenStorageFilesystemCheckServer) error {\n\n\tmux.Handle(\"POST\", pattern_OpenStorageFilesystemCheck_Start_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {\n\t\tctx, cancel := context.WithCancel(req.Context())\n\t\tdefer cancel()\n\t\tvar stream runtime.ServerTransportStream\n\t\tctx = grpc.NewContextWithServerTransportStream(ctx, &stream)\n\t\tinboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)\n\t\trctx, err := runtime.AnnotateIncomingContext(ctx, mux, req)\n\t\tif err != nil {\n\t\t\truntime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)\n\t\t\treturn\n\t\t}\n\t\tresp, md, err := local_request_OpenStorageFilesystemCheck_Start_0(rctx, inboundMarshaler, server, req, pathParams)\n\t\tmd.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer())\n\t\tctx = runtime.NewServerMetadataContext(ctx, md)\n\t\tif err != nil {\n\t\t\truntime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)\n\t\t\treturn\n\t\t}\n\n\t\tforward_OpenStorageFilesystemCheck_Start_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)\n\n\t})\n\n\tmux.Handle(\"GET\", pattern_OpenStorageFilesystemCheck_Status_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {\n\t\tctx, cancel := context.WithCancel(req.Context())\n\t\tdefer cancel()\n\t\tvar stream runtime.ServerTransportStream\n\t\tctx = grpc.NewContextWithServerTransportStream(ctx, &stream)\n\t\tinboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)\n\t\trctx, err := runtime.AnnotateIncomingContext(ctx, mux, req)\n\t\tif err != nil {\n\t\t\truntime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)\n\t\t\treturn\n\t\t}\n\t\tresp, md, err := local_request_OpenStorageFilesystemCheck_Status_0(rctx, inboundMarshaler, server, req, pathParams)\n\t\tmd.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer())\n\t\tctx = runtime.NewServerMetadataContext(ctx, md)\n\t\tif err != nil {\n\t\t\truntime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)\n\t\t\treturn\n\t\t}\n\n\t\tforward_OpenStorageFilesystemCheck_Status_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)\n\n\t})\n\n\tmux.Handle(\"POST\", pattern_OpenStorageFilesystemCheck_Stop_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {\n\t\tctx, cancel := context.WithCancel(req.Context())\n\t\tdefer cancel()\n\t\tvar stream runtime.ServerTransportStream\n\t\tctx = grpc.NewContextWithServerTransportStream(ctx, &stream)\n\t\tinboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)\n\t\trctx, err := runtime.AnnotateIncomingContext(ctx, mux, req)\n\t\tif err != nil {\n\t\t\truntime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)\n\t\t\treturn\n\t\t}\n\t\tresp, md, err := local_request_OpenStorageFilesystemCheck_Stop_0(rctx, inboundMarshaler, server, req, pathParams)\n\t\tmd.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer())\n\t\tctx = runtime.NewServerMetadataContext(ctx, md)\n\t\tif err != nil {\n\t\t\truntime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)\n\t\t\treturn\n\t\t}\n\n\t\tforward_OpenStorageFilesystemCheck_Stop_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)\n\n\t})\n\n\treturn nil\n}", "title": "" }, { "docid": "0fa5870e81780ecc0841bbe175c659a9", "score": "0.5120363", "text": "func RegisterService(s *grpc.Server, service *Service) {\n\ttrustdomainv1.RegisterTrustDomainServer(s, service)\n}", "title": "" } ]
f82bbcd6a8a2de46543a99256152afc9
GetPrediction indicates an expected call of GetPrediction
[ { "docid": "ff7477dec08db897817ddb77f0beca53", "score": "0.6940521", "text": "func (mr *MockServiceMockRecorder) GetPrediction(arg0, arg1 interface{}) *gomock.Call {\n\tmr.mock.ctrl.T.Helper()\n\treturn mr.mock.ctrl.RecordCallWithMethodType(mr.mock, \"GetPrediction\", reflect.TypeOf((*MockService)(nil).GetPrediction), arg0, arg1)\n}", "title": "" } ]
[ { "docid": "d3d762aff6040e52191da9ad83d30e28", "score": "0.6453697", "text": "func getPrediction(enrichedTxn *enrichedTxn) (modelPrediction string, err error) {\n\t// marshal to the expected struct\n\treqBody, err := json.Marshal(enrichedTxn)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\n\t// prepare request\n\treq, err := http.NewRequest(\"POST\", mlModelServingURL, bytes.NewBuffer(reqBody))\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\treq.Header.Set(\"Content-Type\", \"application/json\")\n\n\t// make request\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\tdefer resp.Body.Close()\n\n\t// read response\n\tbodyBytes, err := ioutil.ReadAll(resp.Body)\n\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\n\t// unmarshal the response\n\tprediction := prediction{}\n\n\terr = json.Unmarshal(bodyBytes, &prediction)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\n\t// check threshold to decide whether fraud\n\tif prediction.Value[0][0] > fraudThreshold {\n\t\tfmt.Print(\"Prediction is FRAUD \")\n\t\tmodelPrediction = \"1\"\n\t\treturn modelPrediction, nil\n\t}\n\tfmt.Print(\"Prediction is NOT FRAUD \")\n\tmodelPrediction = \"0\"\n\treturn modelPrediction, nil\n}", "title": "" }, { "docid": "8bad4bf3c81329e0367fbaf614213786", "score": "0.64034295", "text": "func (f *Predicter) GetPrediction(model *config.Model, evaluations []*stored.Evaluation) (int32, error) {\n\treturn f.GetPredictionReactor(model, evaluations)\n}", "title": "" }, { "docid": "5adcda6de2d53e87418772d30dba6490", "score": "0.6138615", "text": "func GetPrediction(leagueID string, year int, playerID string, matchupID string) data.GetPredictionReply {\n\tvar reply data.GetPredictionReply\n\tleague := getLeague(leagueID)\n\tseason := getSeason(year, league)\n\tplayer := getPlayer(playerID)\n\tmatchup := getMatchup(season, matchupID)\n\tprediction := getPrediction(season, player, matchup)\n\tif prediction == nil {\n\t\treply.Result.Code = data.NOTFOUND\n\t\treply.Prediction = data.Prediction{}\n\t\treturn reply\n\t}\n\treply.Result.Code = data.SUCCESS\n\treply.Prediction = *prediction\n\treturn reply\n}", "title": "" }, { "docid": "28de01194a9effdbc730b686d56f3feb", "score": "0.59262383", "text": "func (m *MockService) GetPrediction(arg0, arg1 string) (*model.Prediction, error) {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"GetPrediction\", arg0, arg1)\n\tret0, _ := ret[0].(*model.Prediction)\n\tret1, _ := ret[1].(error)\n\treturn ret0, ret1\n}", "title": "" }, { "docid": "5530ae4a95fffb3b24f418db47001892", "score": "0.58501273", "text": "func (p *Predict) GetPrediction(model *config.Model, evaluations []*stored.Evaluation) (int32, error) {\n\tif model.Reactive == nil {\n\t\treturn 0, errors.New(\"No Reactive configuration provided for model\")\n\t}\n\n\tparameters, err := json.Marshal(reactiveParameters{\n\t\tLookAhead: model.Reactive.LookAhead,\n\t\tEvaluations: evaluations,\n\t})\n\tif err != nil {\n\t\t// Should not occur, panic\n\t\tpanic(err)\n\t}\n\n\tvalue, err := p.Runner.RunAlgorithmWithValue(algorithmPath, string(parameters))\n\tif err != nil {\n\t\treturn 0, err\n\t}\n\n\tprediction, err := strconv.Atoi(value)\n\tif err != nil {\n\t\treturn 0, err\n\t}\n\n\treturn int32(prediction), nil\n}", "title": "" }, { "docid": "cb777a255b078ea6fc2c33fcb7ed6f96", "score": "0.57331824", "text": "func validatePrediction(txnOutcome, modelPrediction string) {\n\t// compare both predictions\n\tif txnOutcome == modelPrediction {\n\t\tfmt.Println(\"and it DOES match the classification\")\n\t\treturn\n\t}\n\tfmt.Println(\"and it DOES NOT match the classification\")\n\t// advanced: run comparison for all fields in csv\n\treturn\n}", "title": "" }, { "docid": "9100d4c99aa1406dfad9cb822a526b1e", "score": "0.57167006", "text": "func (i *IDOTA2League) GetPredictions() (*geyser.Request, error) {\n\tsm, err := i.Interface.Methods.Get(schema.MethodKey{\n\t\tName: \"GetPredictions\",\n\t\tVersion: 1,\n\t})\n\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treq := geyser.NewRequest(i.Interface, sm)\n\n\treturn req, nil\n}", "title": "" }, { "docid": "5478663c91012d6f61259d5b547f95d4", "score": "0.56523466", "text": "func (p *Predict) GetPrediction(model *config.Model, evaluations []*stored.Evaluation) (int32, error) {\n\tif model.HoltWinters == nil {\n\t\treturn 0, errors.New(\"No HoltWinters configuration provided for model\")\n\t}\n\n\t// If less than a full season of data, return zero without error\n\tif len(evaluations) < model.HoltWinters.SeasonLength {\n\t\treturn 0, nil\n\t}\n\n\talpha := model.HoltWinters.Alpha\n\tbeta := model.HoltWinters.Beta\n\tgamma := model.HoltWinters.Gamma\n\n\tif model.HoltWinters.RuntimeTuningFetch != nil {\n\n\t\t// Convert request into JSON string\n\t\trequest, err := json.Marshal(&RunTimeTuningFetchRequest{\n\t\t\tModel: model,\n\t\t\tEvaluations: evaluations,\n\t\t})\n\t\tif err != nil {\n\t\t\t// Should not occur\n\t\t\tpanic(err)\n\t\t}\n\n\t\t// Request runtime tuning values\n\t\thookResult, err := p.Execute.ExecuteWithValue(model.HoltWinters.RuntimeTuningFetch, string(request))\n\t\tif err != nil {\n\t\t\treturn 0, err\n\t\t}\n\n\t\t// Parse result\n\t\tvar result RunTimeTuningFetchResult\n\t\terr = json.Unmarshal([]byte(hookResult), &result)\n\t\tif err != nil {\n\t\t\treturn 0, err\n\t\t}\n\n\t\tif result.Alpha != nil {\n\t\t\talpha = result.Alpha\n\t\t}\n\t\tif result.Beta != nil {\n\t\t\tbeta = result.Beta\n\t\t}\n\t\tif result.Gamma != nil {\n\t\t\tgamma = result.Gamma\n\t\t}\n\t}\n\n\tif alpha == nil {\n\t\treturn 0, errors.New(\"No alpha tuning value provided for Holt-Winters prediction\")\n\t}\n\tif beta == nil {\n\t\treturn 0, errors.New(\"No beta tuning value provided for Holt-Winters prediction\")\n\t}\n\tif gamma == nil {\n\t\treturn 0, errors.New(\"No gamma tuning value provided for Holt-Winters prediction\")\n\t}\n\n\t// Collect data for historical series\n\tseries := make([]float64, len(evaluations))\n\tfor i, evaluation := range evaluations {\n\t\tseries[i] = float64(evaluation.Evaluation.TargetReplicas)\n\t}\n\n\tvar prediction []float64\n\tvar err error\n\n\tswitch model.HoltWinters.Method {\n\tcase MethodAdditive:\n\t\t// Build prediction 1 ahead\n\t\tprediction, err = holtwinters.PredictAdditive(series, model.HoltWinters.SeasonLength, *alpha, *beta, *gamma, 1)\n\t\tif err != nil {\n\t\t\treturn 0, err\n\t\t}\n\t\tbreak\n\tcase MethodMultiplicative:\n\t\t// Build prediction 1 ahead\n\t\tprediction, err = holtwinters.PredictMultiplicative(series, model.HoltWinters.SeasonLength, *alpha, *beta, *gamma, 1)\n\t\tif err != nil {\n\t\t\treturn 0, err\n\t\t}\n\t\tbreak\n\tdefault:\n\t\treturn 0, fmt.Errorf(\"Unknown HoltWinters method '%s'\", model.HoltWinters.Method)\n\t}\n\n\t// Return last value in prediction\n\treturn int32(math.Ceil(prediction[len(prediction)-1])), nil\n}", "title": "" }, { "docid": "701807186a02453c417d8753b6b352b1", "score": "0.55696976", "text": "func (i *IDOTA2League) GetPredictionResults() (*geyser.Request, error) {\n\tsm, err := i.Interface.Methods.Get(schema.MethodKey{\n\t\tName: \"GetPredictionResults\",\n\t\tVersion: 1,\n\t})\n\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treq := geyser.NewRequest(i.Interface, sm)\n\n\treturn req, nil\n}", "title": "" }, { "docid": "57bb78f82c860c0032959eeeec086b79", "score": "0.5518162", "text": "func (mr *MockServiceMockRecorder) GetPredictorData(arg0 interface{}) *gomock.Call {\n\tmr.mock.ctrl.T.Helper()\n\treturn mr.mock.ctrl.RecordCallWithMethodType(mr.mock, \"GetPredictorData\", reflect.TypeOf((*MockService)(nil).GetPredictorData), arg0)\n}", "title": "" }, { "docid": "8293841709cff7247d24fed54609edcc", "score": "0.54960674", "text": "func (kf *HybridKF) Predict() (est Estimate, err error) {\n\treturn kf.fullUpdate(true, nil, nil)\n}", "title": "" }, { "docid": "fa15cfa57403f50b5988f226f800c2fb", "score": "0.54648304", "text": "func (p *localPredict) Predict() v1.ResourceList {\n\tvar cpu, mem int64\n\n\t// if predict is disabled, just return zero quantity\n\tif p.Disable {\n\t\tvar onlineCpu, onlineMem float64\n\t\tvar err error\n\t\t_ = wait.PollImmediate(time.Second*5, time.Minute*2, func() (bool, error) {\n\t\t\tonlineCpu, onlineMem, err = p.getRecentOnlineResource()\n\t\t\tif err != nil {\n\t\t\t\tklog.Errorf(\"failed get recent resource: %v\", err)\n\t\t\t\treturn false, nil\n\t\t\t}\n\t\t\treturn true, nil\n\t\t})\n\t\treturn v1.ResourceList{\n\t\t\tv1.ResourceCPU: *resource.NewMilliQuantity(int64(onlineCpu), resource.DecimalSI),\n\t\t\tv1.ResourceMemory: *resource.NewQuantity(int64(onlineMem), resource.DecimalSI),\n\t\t}\n\t}\n\n\t// wait for local predictor charging before predicting resource\n\t_ = wait.PollImmediate(time.Second*5, time.Minute*2, func() (bool, error) {\n\t\tif atomic.LoadInt32(p.addSampleTimes) >= p.initSampleTimes {\n\t\t\treturn true, nil\n\t\t}\n\t\tklog.V(2).Infof(\"[%s] waiting for local predictor charging\", p.PredictMetricsType)\n\t\treturn false, nil\n\t})\n\tp.statMapLock.Lock()\n\tdefer p.statMapLock.Unlock()\n\t// print log if v3 or print time\n\tpredictLog := klog.V(4)\n\tnow := time.Now()\n\tif p.lastPrintTime1.Add(p.PrintInterval.TimeDuration()).Before(now) {\n\t\tp.lastPrintTime1 = now\n\t\tpredictLog = true\n\t}\n\t// recommended resource\n\trecommended := p.recommender.GetRecommendedPodResources(p.statMap)\n\tfor name, re := range recommended {\n\t\tcpu += int64(re.Target[model.ResourceCPU])\n\t\tmem += int64(re.Target[model.ResourceMemory])\n\t\tpredictLog.Infof(\"[%s] %s recommend target(%d,%d)\", p.PredictMetricsType, name,\n\t\t\tre.Target[model.ResourceCPU], re.Target[model.ResourceMemory])\n\t}\n\treturn v1.ResourceList{\n\t\tv1.ResourceCPU: *resource.NewMilliQuantity(cpu, resource.DecimalSI),\n\t\tv1.ResourceMemory: *resource.NewQuantity(mem, resource.DecimalSI),\n\t}\n}", "title": "" }, { "docid": "378efde20de90a722b197526b725a9d5", "score": "0.5364583", "text": "func (s *Service) Predict(data string, input *Input) *PredictCall {\n\treturn &PredictCall{\n\t\ts: s,\n\t\tdata: data,\n\t\tinput: input,\n\t\tcaller_: googleapi.JSONCall{},\n\t\tparams_: make(map[string][]string),\n\t\tpathTemplate_: \"training/{data}/predict\",\n\t\tcontext_: googleapi.NoContext,\n\t}\n}", "title": "" }, { "docid": "2551977ce92beb4423a04746b48628bb", "score": "0.5343544", "text": "func ExampleNeuralNetwork_Predict () {\n\tnn.Predict([]float64 {1, 0})\n}", "title": "" }, { "docid": "1de21e4b83c94ec791ff229f2cdef90d", "score": "0.53044647", "text": "func (e PreconditionFailed) IsPreconditionFailed() {}", "title": "" }, { "docid": "5686904523a5423fa9d1af03272eda3c", "score": "0.5296284", "text": "func prediction(xi float64) float64 {\n\treturn b0 + b1*xi\n}", "title": "" }, { "docid": "9a105fda7b1855b8623d7f34b27a6cbe", "score": "0.528062", "text": "func (c *Client) Predict(ctx context.Context, params *PredictInput, optFns ...func(*Options)) (*PredictOutput, error) {\n\tif params == nil {\n\t\tparams = &PredictInput{}\n\t}\n\n\tresult, metadata, err := c.invokeOperation(ctx, \"Predict\", params, optFns, addOperationPredictMiddlewares)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tout := result.(*PredictOutput)\n\tout.ResultMetadata = metadata\n\treturn out, nil\n}", "title": "" }, { "docid": "176ae377564f9dc8cff6aec9970cd8ac", "score": "0.52751714", "text": "func (neuralNet *NeuralNet) getError(predicted, expected []float64) (error []float64) {\n\treturn\n}", "title": "" }, { "docid": "5f1b3031dc612d666b0435df7b87d4bc", "score": "0.5190203", "text": "func (api *PredictionsAPI) GetPredictions(req *ClientRequest) ([]Prediction, error) {\n\tdata, err := api.Client.Get(req)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"error reading predictions request body: %v\", err)\n\t}\n\tpredictions := &PredictionsResult{}\n\terr = json.Unmarshal(data, &predictions)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"error parsing predictions data: %v\", err)\n\t}\n\n\tif len(predictions.Predictions) == 0 {\n\t\terrResp := &ClientErrorResponse{}\n\t\terr = json.Unmarshal(data, &errResp)\n\t\tif err != nil {\n\t\t\treturn nil, fmt.Errorf(\"error parsing water level data: %v\", err)\n\t\t}\n\n\t\tif errResp.Err.Message != \"\" {\n\t\t\treturn nil, fmt.Errorf(\"received error from API: %s\", errResp.Err.Message)\n\t\t}\n\t}\n\n\treturn predictions.Predictions, nil\n}", "title": "" }, { "docid": "e2affb938b41b2f33bbae83054226260", "score": "0.51540786", "text": "func (mr *MockServiceMockRecorder) GetMatchPredictionSummary(arg0 interface{}) *gomock.Call {\n\tmr.mock.ctrl.T.Helper()\n\treturn mr.mock.ctrl.RecordCallWithMethodType(mr.mock, \"GetMatchPredictionSummary\", reflect.TypeOf((*MockService)(nil).GetMatchPredictionSummary), arg0)\n}", "title": "" }, { "docid": "add756decf814696fe47fdd1cf345102", "score": "0.5141504", "text": "func Predict(params *PredictParams) (string, error) {\n\tlog.Infof(\"generating predictions for fitted solution ID %s found at '%s'\", params.FittedSolutionID, params.SchemaPath)\n\tschemaPath := params.SchemaPath\n\tdatasetName := params.Dataset\n\n\t// the dataset id needs to match the original dataset id for TA2 to be able to use the model\n\t// read from source in case any step has updated it along the way\n\tmeta, err := metadata.LoadMetadataFromOriginalSchema(schemaPath, false)\n\tif err != nil {\n\t\treturn \"\", errors.Wrap(err, \"unable to read latest dataset doc\")\n\t}\n\tmeta.ID = params.SourceDatasetID\n\tdatasetStorage := serialization.GetStorage(meta.GetMainDataResource().ResPath)\n\terr = datasetStorage.WriteMetadata(schemaPath, meta, true, false)\n\tif err != nil {\n\t\treturn \"\", errors.Wrap(err, \"unable to update dataset doc\")\n\t}\n\n\t// get the explained solution id\n\tsolution, err := params.SolutionStorage.FetchSolution(params.SolutionID)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\n\t// Ensure the ta2 has fitted solution loaded. If the model wasn't saved, it should be available\n\t// as part of the session.\n\texportedModel, err := params.ModelStorage.FetchModelByID(params.FittedSolutionID)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\tif exportedModel != nil {\n\t\t_, err = LoadFittedSolution(exportedModel.FilePath, params.SolutionStorage, params.MetaStorage)\n\t\tif err != nil {\n\t\t\treturn \"\", err\n\t\t}\n\t}\n\n\t// submit the new dataset for predictions\n\tlog.Infof(\"generating predictions using data found at '%s'\", params.SchemaPath)\n\tpredictionResult, err := comp.GeneratePredictions(params.SchemaPath, solution.SolutionID, params.FittedSolutionID, client)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\tlog.Infof(\"generated predictions stored at %v\", predictionResult.ResultURI)\n\n\t// get the result UUID. NOTE: Doing sha1 for now.\n\tresultID, err := util.Hash(predictionResult.ResultURI)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\n\terr = persistPredictionResults(datasetName, params, meta, resultID, predictionResult)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\n\treturn predictionResult.ProduceRequestID, nil\n}", "title": "" }, { "docid": "f288b76706d66bf3b1659373f34bfbf9", "score": "0.5117643", "text": "func TestGetBonus(t *testing.T) {\n\n\ta := InitApp(\"https://api.bip.dev/api/\")\n\n\ts, b, err := a.GetBonus()\n\tif err != nil {\n\t\tt.Fatal(err)\n\t}\n\n\tif b != 48 {\n\t\tt.Errorf(\"Error price %f, want 1\", b)\n\t}\n\n\tif s != \"302384\" {\n\t\tt.Errorf(\"Error amount %s, want 302384\", s)\n\t}\n}", "title": "" }, { "docid": "26f34d705c2f55759dad9fe1aa536a41", "score": "0.50625056", "text": "func (this *FPAQPredictor) Get() uint {\n\treturn this.prediction\n}", "title": "" }, { "docid": "e23b16d751ce4af6f4a395f4f9b6958c", "score": "0.503958", "text": "func getPrediction(fileURL string, c chan Prediction) error {\n\tvar data Prediction\n\tbaseURL := os.Getenv(\"FLASK_API_BASE_URL\")\n\ttargetURL := baseURL + \"/predict\"\n\n\tpostBody, _ := json.Marshal(map[string]string{\n\t\t\"value\": fileURL,\n\t})\n\n\tresponse, err := http.Post(targetURL, \"application/json\", bytes.NewBuffer(postBody))\n\tif err != nil {\n\t\tclose(c)\n\t\treturn err\n\t}\n\tdefer response.Body.Close()\n\n\terr = json.NewDecoder(response.Body).Decode(&data)\n\n\tc <- data\n\treturn nil\n}", "title": "" }, { "docid": "5a8cad417e8ce71415504a8cb9bec776", "score": "0.5018191", "text": "func comprPredict(data []byte) (bool, []float64) {\n var segNum int\n\n retEntr := make([]float64, numHintsToTry)\n\n hintArr := initHintArr()\n\n succ := 0\n\n for i := 0; i < numHintsToTry; i++ {\n segNum, hintArr = getRandomSeg(hintArr)\n\n histBuf, coreSet := genHist(data, segNum)\n\n entr := getEntropy(histBuf, coreSet)\n\n retEntr[i] = entr\n\n if entr < entrThreshold {\n succ++\n }\n }\n\n if succ > 1 {\n return true, retEntr\n }\n\n return false, retEntr\n}", "title": "" }, { "docid": "5c8a0b238cc3e66b3b81fa86468826a2", "score": "0.4967068", "text": "func Predict(seq string) (PSSM, result string) {\r\n\tPSSM = \"I am PSSM\"\r\n\tresult = \"I am result\"\r\n\treturn\r\n}", "title": "" }, { "docid": "84be148903834f7ef808e6adc18589f7", "score": "0.4940937", "text": "func (app *BreakFaster) Predict(replyToken, lineUID, text string) error {\n\tprediction, err := app.svc.ar.Predict(text)\n\tif err != nil {\n\t\treturn err\n\t}\n\tswitch prediction {\n\tcase \"問題回報\":\n\t\tresp := \"請點擊以下連結回報問題:\\n\\n\" + OrderPageURI + \"/report\"\n\t\tif err := app.replyText(replyToken, resp); err != nil {\n\t\t\treturn err\n\t\t}\n\tcase \"取消訂單\":\n\t\tif err := app.replyCancelConfirmBox(replyToken); err != nil {\n\t\t\treturn err\n\t\t}\n\tcase \"點餐紀錄\":\n\t\tstart, end := app.svc.timer.GetNextWeekInterval()\n\t\tif err := app.replyOrderConfirmCard(replyToken, lineUID, start, end); err != nil {\n\t\t\treturn err\n\t\t}\n\tcase \"規則\":\n\t\tif err := app.replyFlex(replyToken, \"點餐規則\", NewWelcomeCard, false); err != nil {\n\t\t\treturn err\n\t\t}\n\tdefault:\n\t\tresp := \"請點擊以下連結開始點餐!\\n\\n\" + OrderPageURI\n\t\tif err := app.replyText(replyToken, resp); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "0a0db4a9087a6aae94171abafef62c80", "score": "0.4915955", "text": "func (agent *Agent) predict(input []float64) []float64 {\n\treturn agent.model.Calculate(input)\n}", "title": "" }, { "docid": "5bb50cf2d79e7d57e66447a4094a0938", "score": "0.49129567", "text": "func (mr *MockServiceMockRecorder) GetFixturesWithPredictions(arg0 interface{}) *gomock.Call {\n\tmr.mock.ctrl.T.Helper()\n\treturn mr.mock.ctrl.RecordCallWithMethodType(mr.mock, \"GetFixturesWithPredictions\", reflect.TypeOf((*MockService)(nil).GetFixturesWithPredictions), arg0)\n}", "title": "" }, { "docid": "f806ba0de3b2e4370e231106ba76ced0", "score": "0.4903247", "text": "func scratchPredict(tv float64) float64 {\n\treturn 0.55*tv + 0.23\n}", "title": "" }, { "docid": "904d71240105848780bb80b0c869edc1", "score": "0.48801666", "text": "func (device *LaserRangeFinderBricklet) GetResponseExpected(functionID Function) (bool, error) {\n\treturn device.device.GetResponseExpected(uint8(functionID))\n}", "title": "" }, { "docid": "d5696559fa2f638ca0894eca70f568b7", "score": "0.48686716", "text": "func (mr *MockServiceMockRecorder) GetUsersPastPredictions(arg0 interface{}) *gomock.Call {\n\tmr.mock.ctrl.T.Helper()\n\treturn mr.mock.ctrl.RecordCallWithMethodType(mr.mock, \"GetUsersPastPredictions\", reflect.TypeOf((*MockService)(nil).GetUsersPastPredictions), arg0)\n}", "title": "" }, { "docid": "dc2277f353e4148932e8c7a0e3906731", "score": "0.48646063", "text": "func (th *VWClient) Predict(pData ...string) ([]*Prediction, error) {\n\tlines, err := th.ask(true, pData...)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"failed to ask vw: %s\", err)\n\t}\n\n\tresult := make([]*Prediction, len(pData))\n\n\tfor i, line := range lines {\n\t\tr, err := ParsePredictResult(&line)\n\t\tif err != nil {\n\t\t\treturn result, err\n\t\t}\n\n\t\tresult[i] = r\n\t}\n\n\treturn result, nil\n}", "title": "" }, { "docid": "2c358c3ef15159d2512834efd7d9f8ef", "score": "0.48568267", "text": "func (device *SilentStepperBrick) GetResponseExpected(functionID Function) (bool, error) {\n\treturn device.device.GetResponseExpected(uint8(functionID))\n}", "title": "" }, { "docid": "695c890aa4f5fbe3422c8f9909a3996a", "score": "0.48557493", "text": "func (o *InlineObject871) GetProbabilityOk() (AnyOfobject, bool) {\n\tif o == nil || o.Probability == nil {\n\t\tvar ret AnyOfobject\n\t\treturn ret, false\n\t}\n\treturn *o.Probability, true\n}", "title": "" }, { "docid": "ae6f43078800600156ee1d1f6d09d16c", "score": "0.4851388", "text": "func (decTree Tree) Test(allData []*dataTypes.Data) {\n\tmisclassified := 0\n\tfmt.Printf(\"+-----------+----------+\\n\")\n\tfmt.Printf(\"| Predicted | Actual |\\n\")\n\tfmt.Printf(\"+-----------+----------+\\n\")\n\tfor _, datum := range allData {\n\t\tprediction := decTree.GetClass(*datum)\n\t\tif prediction != datum.Class {\n\t\t\tmisclassified++\n\t\t}\n\t\tfmt.Printf(\"| %d | %d |\\n\", prediction, datum.Class)\n\t}\n\tfmt.Printf(\"+-----------+----------+\\n\")\n\n\tfmt.Printf(\"%d out of %d wrongly classified\\n\", misclassified, len(allData))\n\tfmt.Printf(\"Misclassified: %f\\n\", float64(misclassified)/float64(len(allData)))\n}", "title": "" }, { "docid": "bc890b93b2646687d0fdf959c0bb827b", "score": "0.4834863", "text": "func (store *Db2Store) GetPredictionResult(sqlStr string, id int32) (map[string]interface{}, error) {\n\tstmt, err := store.Db.Prepare(sqlStr)\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t\treturn nil, err\n\t}\n\tdefer stmt.Close()\n\trows, err := stmt.Query(id)\n\tif err != nil {\n\t\tlog.Fatal(\"Error while running \", sqlStr, err)\n\t\treturn nil, err\n\t}\n\n\tm, err := getMapFromRows(rows)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tdefer rows.Close()\n\treturn m, nil\n}", "title": "" }, { "docid": "6be9649a1d1d59fc09a24bd4e1847a99", "score": "0.48318723", "text": "func (m *Model) Predictors() []*Attribute { return m.predictors }", "title": "" }, { "docid": "5938fd653a0ba455f66e7db23183134f", "score": "0.48099467", "text": "func (*TextSentimentPredictionResult_Prediction) Descriptor() ([]byte, []int) {\n\treturn file_google_cloud_aiplatform_v1beta1_schema_predict_prediction_text_sentiment_proto_rawDescGZIP(), []int{0, 0}\n}", "title": "" }, { "docid": "740166af20786760cd085f5fb85d1354", "score": "0.48083413", "text": "func predict(m, x, b float64) float64 {\n\treturn m*x + b\n}", "title": "" }, { "docid": "3a1c9cc72300fe7a5d6624525b5cafb4", "score": "0.48010248", "text": "func (device *BarometerBricklet) GetResponseExpected(functionID Function) (bool, error) {\n\treturn device.device.GetResponseExpected(uint8(functionID))\n}", "title": "" }, { "docid": "f5c8915bdec66de043ec5d40f7e71003", "score": "0.4797762", "text": "func (m *MockService) GetPredictorData(arg0 string) (*model0.PredictorData, error) {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"GetPredictorData\", arg0)\n\tret0, _ := ret[0].(*model0.PredictorData)\n\tret1, _ := ret[1].(error)\n\treturn ret0, ret1\n}", "title": "" }, { "docid": "9889949fd3c79a21a5fb13d4b6a1cac5", "score": "0.47950745", "text": "func (device *DualButtonBricklet) GetResponseExpected(functionID Function) (bool, error) {\n\treturn device.device.GetResponseExpected(uint8(functionID))\n}", "title": "" }, { "docid": "295de63b063305fe94a0591eddb67b04", "score": "0.47807539", "text": "func (me TxsdConfidenceRating) IsUnknown() bool { return me.String() == \"unknown\" }", "title": "" }, { "docid": "90e19a2eda97de24b6bad46e3cb683c8", "score": "0.47714686", "text": "func (m *MockService) GetUsersPastPredictions(arg0 string) (*model0.PredictionSummary, error) {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"GetUsersPastPredictions\", arg0)\n\tret0, _ := ret[0].(*model0.PredictionSummary)\n\tret1, _ := ret[1].(error)\n\treturn ret0, ret1\n}", "title": "" }, { "docid": "76c569a9a37e3bcd1b0140ffde5cd35e", "score": "0.47649413", "text": "func (s *studentState) readPrediction(td string) error {\n\tfile, err := os.Open(path.Join(td, \"predict.txt\"))\n\tif err != nil {\n\t\treturn err\n\t}\n\tdefer file.Close()\n\tscanner := bufio.NewScanner(file)\n\n\tfor _, a := range s.answers {\n\t\tif a.question == nil {\n\t\t\tcontinue\n\t\t}\n\t\tif !scanner.Scan() {\n\t\t\treturn errors.New(\"unexpected end of predict.txt\")\n\t\t}\n\t\twords := strings.Split(scanner.Text(), \"\\t\")\n\t\ti := 2\n\t\td, err := strconv.ParseFloat(words[0], 64)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\t// If this column contains 1.0 there is no next column, otherwise\n\t\t// the next column contains 1.0-d.\n\t\tif d == 1.0 {\n\t\t\ti = 1\n\t\t}\n\t\tfor _, c := range a.question.getTrainingConcepts(a.subQuestion) {\n\t\t\td, err := strconv.ParseFloat(words[i], 64)\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t\ts.scores[c] = d\n\t\t}\n\t}\n\n\treturn scanner.Err()\n}", "title": "" }, { "docid": "d941584a6ffbb085d0f0ca5694b4f112", "score": "0.47597572", "text": "func predict(bmi float64) float64 {\n\treturn 149.96 + bmi*916.19\n}", "title": "" }, { "docid": "130093b83abbf2da471bec9de9528b06", "score": "0.47261822", "text": "func (device *DCV2Bricklet) GetResponseExpected(functionID Function) (bool, error) {\n\treturn device.device.GetResponseExpected(uint8(functionID))\n}", "title": "" }, { "docid": "f5bd670d4e3dbd31659cc55501ea9646", "score": "0.47184804", "text": "func TestCreateAPTrue(t *testing.T) {\n\tclient := newPetsClient(t)\n\tresult, err := client.CreateAPTrue(context.Background(), PetAPTrue{\n\t\tID: to.Ptr[int32](1),\n\t\tName: to.Ptr(\"Puppy\"),\n\t\tAdditionalProperties: map[string]interface{}{\n\t\t\t\"birthdate\": \"2017-12-13T02:29:51Z\",\n\t\t\t\"complexProperty\": map[string]interface{}{\n\t\t\t\t\"color\": \"Red\",\n\t\t\t},\n\t\t},\n\t}, nil)\n\trequire.NoError(t, err)\n\tif r := cmp.Diff(result.PetAPTrue, PetAPTrue{\n\t\tID: to.Ptr[int32](1),\n\t\tName: to.Ptr(\"Puppy\"),\n\t\tStatus: to.Ptr(true),\n\t\tAdditionalProperties: map[string]interface{}{\n\t\t\t\"birthdate\": \"2017-12-13T02:29:51Z\",\n\t\t\t\"complexProperty\": map[string]interface{}{\n\t\t\t\t\"color\": \"Red\",\n\t\t\t},\n\t\t},\n\t}); r != \"\" {\n\t\tt.Fatal(r)\n\t}\n}", "title": "" }, { "docid": "95e6c97de308be1b7ce4e8862b0a4466", "score": "0.46938598", "text": "func (m *Model) NumPredictors() int { return len(m.predictors) }", "title": "" }, { "docid": "a8e50a3c3cbd58c8fe34e6026ca38338", "score": "0.4690332", "text": "func TestGetPrice(t *testing.T) {\n\n\ta := InitApp(\"https://api.bip.dev/api/\")\n\n\tp, _, err := a.GetPrice()\n\tif err != nil {\n\t\tt.Fatal(err)\n\t}\n\n\tif p != 1 {\n\t\tt.Errorf(\"Error price %f, want 1\", p)\n\t}\n}", "title": "" }, { "docid": "c349d1df65201105777aa951a914fa2c", "score": "0.46779323", "text": "func (r *HostedmodelsService) Predict(hostedModelName string, input *Input) *HostedmodelsPredictCall {\n\treturn &HostedmodelsPredictCall{\n\t\ts: r.s,\n\t\thostedModelName: hostedModelName,\n\t\tinput: input,\n\t\tcaller_: googleapi.JSONCall{},\n\t\tparams_: make(map[string][]string),\n\t\tpathTemplate_: \"hostedmodels/{hostedModelName}/predict\",\n\t\tcontext_: googleapi.NoContext,\n\t}\n}", "title": "" }, { "docid": "2f0b42b7bf5565f0be9dae24266d8538", "score": "0.46590364", "text": "func (device *IndustrialDigitalIn4V2Bricklet) GetResponseExpected(functionID Function) (bool, error) {\n\treturn device.device.GetResponseExpected(uint8(functionID))\n}", "title": "" }, { "docid": "37f8e3bdb52289e463594969a8ae83e0", "score": "0.46583092", "text": "func (s *Server) Predict(ctx context.Context, pr *pb.PredictRequest) (*pb.PredictReply, error) {\n\tpredictParams := comet.CreatePredictParamsMAL(pr)\n\treturn &pb.PredictReply{\n\t\tLabel: s.cache.Request(predictParams),\n\t}, nil\n}", "title": "" }, { "docid": "361ba319ec76b64f9c3f0b62f9ae19bc", "score": "0.46490085", "text": "func (agent *Agent) predict_t_plus_1(input []float64) []float64 {\n\treturn agent.target_model.Calculate(input)\n}", "title": "" }, { "docid": "57532169c861b7b35d102f103273c913", "score": "0.46464333", "text": "func (t *Evaluator) Predict(example Sequence) int {\n\tg := ag.NewGraph()\n\tdefer g.Clear()\n\txs := make([]ag.Node, len(example))\n\tfor i, x := range example {\n\t\txs[i] = g.NewScalar(x.Input)\n\t}\n\tys := t.model.NewProc(g).Forward(xs...)\n\treturn f64utils.ArgMax(ys[len(example)-1].Value().Data())\n}", "title": "" }, { "docid": "6f2779ef63ac1c002fbab40c88d3e368", "score": "0.4606443", "text": "func (r *Responder) PreconditionRequired() { r.write(http.StatusPreconditionRequired) }", "title": "" }, { "docid": "665e6980568e3ef93351a15884baeb2c", "score": "0.46053717", "text": "func (*CMsgDOTASeasonPredictions_Prediction) Descriptor() ([]byte, []int) {\n\treturn file_dota_gcmessages_common_proto_rawDescGZIP(), []int{34, 0}\n}", "title": "" }, { "docid": "c2e56e14414d21fe03c423c36d02c857", "score": "0.4603657", "text": "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}", "title": "" }, { "docid": "9191d86f8eb5dcffb469fe035a6d3912", "score": "0.4599763", "text": "func (k *kNNBruteForceCls) Predict(testData Table) (Table, error) {\n\tnRows, _ := testData.Caps()\n\tvar prediction MemoryTable = make([][]interface{}, nRows)\n\tfor j := 0; j < nRows; j++ {\n\t\ttestRow, err := testData.Row(j)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tsamples := newKSamples(k.k)\n\t\ttrainDataRows, _ := k.trainData.Caps()\n\t\tfor i := 0; i < trainDataRows; i++ {\n\t\t\ttrainRow, err := k.trainData.Row(i)\n\t\t\td, err := distance(testRow, trainRow, nil)\n\t\t\tif err != nil {\n\t\t\t\treturn nil, err\n\t\t\t}\n\t\t\tsamples.checkUpdate(d, trainRow)\n\t\t}\n\t\tprediction[j] = []interface{}{samples.getNearest()}\n\t}\n\treturn prediction, nil\n}", "title": "" }, { "docid": "4052b7628b30ce2ad7807a4347167841", "score": "0.45847708", "text": "func desiredAssertionStatus0(frame *rtda.Frame) {\n\tframe.OperandStack().PushBoolean(false)\n}", "title": "" }, { "docid": "6e68d548867e7b1e6e9ba28d265f25bd", "score": "0.4571572", "text": "func (o AutoscalingPolicyCpuUtilizationResponseOutput) PredictiveMethod() pulumi.StringOutput {\n\treturn o.ApplyT(func(v AutoscalingPolicyCpuUtilizationResponse) string { return v.PredictiveMethod }).(pulumi.StringOutput)\n}", "title": "" }, { "docid": "15cb2cbe5a85e19b14ef28eefa5500fc", "score": "0.4570324", "text": "func XGBoostGeneratePredict(predStmt *ir.PredictStmt, stepIndex int, session *pb.Session) (string, error) {\n\tdbConnStr, err := GeneratePyDbConnStr(session)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\n\tfiller := &xgbPredFiller{\n\t\tStepIndex: stepIndex,\n\t\tDataSource: dbConnStr,\n\t\tSelect: replaceNewLineRuneAndTrimSpace(predStmt.Select),\n\t\tPredLabelName: predStmt.ResultColumn,\n\t\tResultTable: predStmt.ResultTable,\n\t\tLoad: predStmt.Using,\n\t\tSubmitter: getSubmitter(session),\n\t}\n\n\tvar program bytes.Buffer\n\tpredTmpl := template.Must(template.New(\"Train\").Parse(xgbPredTemplate))\n\terr = predTmpl.Execute(&program, filler)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\treturn program.String(), nil\n}", "title": "" }, { "docid": "07c1ce14091f150ab70ec5f7ef4875c4", "score": "0.45675772", "text": "func notNormalizedPrediction(ownIndex int, n int, topNeighbors []KeyValue, users []User, movies []string) []string {\n\tvar topMovies []KeyValue\n\tfor i := 0; i < len(movies); i++ {\n\t\tvar p1, p2 float64\n\t\tfor j := 0; j < len(topNeighbors); j++ {\n\t\t\tif users[topNeighbors[j].Key].Ratings[i] != 0 {\n\t\t\t\tp1 += (users[topNeighbors[j].Key].Ratings[i] * users[ownIndex].SimToUsers[topNeighbors[j].Key])\n\t\t\t\tp2 += users[ownIndex].SimToUsers[topNeighbors[j].Key]\n\t\t\t}\n\t\t}\n\t\tvar prediction = p1 / p2\n\t\ttopMovies = append(topMovies, KeyValue{i, prediction})\n\t}\n\tsort.Slice(topMovies, func(i, j int) bool {\n\t\treturn topMovies[i].Value > topMovies[j].Value\n\t})\n\tvar topMovieNames []string\n\tfor i := 0; i < n; i++ {\n\t\ttopMovieNames = append(topMovieNames, movies[topMovies[i].Key])\n\t}\n\treturn topMovieNames\n}", "title": "" }, { "docid": "350bf94b954194d819b2d76ccc80950f", "score": "0.455969", "text": "func FixedPrediction(g GreyImage) *GreyImage {\n\n\tp := NewGreyImage(g.GetHeight(), g.GetWidth())\n\n\tfor row := 0; row < g.GetHeight(); row++ {\n\n\t\tfor col := 0; col < g.GetWidth(); col++ {\n\n\t\t\tvar a, b, c int16\n\n\t\t\t/// Initialize values\n\t\t\tif row == 0 {\n\t\t\t\tb = 0\n\t\t\t\tc = 0\n\t\t\t} else {\n\t\t\t\tb = g.GetPixel(row-1, col)\n\t\t\t\tif col == 0 {\n\t\t\t\t\tif row-2 > 0 {\n\t\t\t\t\t\tc = g.GetPixel(row-2, col)\n\t\t\t\t\t} else {\n\t\t\t\t\t\tc = 0\n\t\t\t\t\t}\n\t\t\t\t} else {\n\t\t\t\t\tc = g.GetPixel(row-1, col-1)\n\t\t\t\t}\n\t\t\t}\n\t\t\tif col == 0 {\n\t\t\t\ta = b\n\t\t\t} else {\n\t\t\t\ta = g.GetPixel(row, col-1)\n\t\t\t}\n\t\t\t/// Make predictions\n\t\t\tif c >= a && c >= b {\n\n\t\t\t\tif a > b {\n\t\t\t\t\tp.SetPixel(row, col, b)\n\t\t\t\t} else {\n\t\t\t\t\tp.SetPixel(row, col, a)\n\t\t\t\t}\n\n\t\t\t} else if c <= a && c <= b {\n\n\t\t\t\tif a > b {\n\t\t\t\t\tp.SetPixel(row, col, a)\n\t\t\t\t} else {\n\t\t\t\t\tp.SetPixel(row, col, b)\n\t\t\t\t}\n\n\t\t\t} else {\n\n\t\t\t\tp.SetPixel(row, col, a+b-c)\n\n\t\t\t}\n\t\t}\n\n\t}\n\n\treturn p\n\n}", "title": "" }, { "docid": "6d6f83fd59614f6e5157abcf1caa044f", "score": "0.45391393", "text": "func (mdl *SvmModel) Predict(node *SvmNode) (float64, error) {\n\tif mdl == nil {\n\t\treturn -1, SvmError{Message: \"nil model when attempting to predict using an svm model\"}\n\t}\n\n\tif mdl.object == nil {\n\t\treturn -1, SvmError{Message: \"model object's internal svm_model pointer is nil when attempting to predict using an svm model\"}\n\t}\n\n\tif node == nil {\n\t\treturn -1, SvmError{Message: \"nil node when attempting to predict using an svm model\"}\n\t}\n\n\tif node.object == nil {\n\t\treturn -1, SvmError{Message: \"node object's internal svm_node pointer is nil when attempting to predict using an svm model\"}\n\t}\n\n\treturn float64(C.svm_predict(mdl.object, node.object)), nil\n}", "title": "" }, { "docid": "fd287e31fadc4e2d36c4e4d8b2d87349", "score": "0.45249096", "text": "func Assert(predict bool, v ...interface{}) {\n\tif predict {\n\t\treturn\n\t}\n\tvar s string\n\tif len(v) == 0 {\n\t\ts = \"Assert failure.\"\n\t} else {\n\t\ts = \"Assert failure: \" + fmt.Sprint(v...)\n\t}\n\tlog.Output(2, s)\n\truntime.Breakpoint()\n}", "title": "" }, { "docid": "d6bf22b9845d4e643f82cdf5ae6daa0b", "score": "0.45238116", "text": "func PredictTheWinner(nums []int) bool {\n \n}", "title": "" }, { "docid": "51082460a40eade4988f49ac04d2ee06", "score": "0.45223972", "text": "func (nn *NeuralNetwork) Predict (inputs []float64) []float64{\n nn.Set_inputs(inputs)\n nn.Forward_pass()\n return nn.output_layer.values\n}", "title": "" }, { "docid": "030768f7614df9f1359de2de743fa3ec", "score": "0.45103893", "text": "func predictionHandler(w http.ResponseWriter, req *http.Request) {\n\t// read txn, decode JSON, store in Aerospike\n\tincomingTxn := webTxn{}\n\terr := acceptTxn(req, aeroClient, &incomingTxn)\n\tif err != nil {\n\t\thttp.Error(w, err.Error(), http.StatusBadRequest)\n\t\treturn\n\t}\n\n\t// read txn by userID\n\tenrichedTxn := enrichedTxn{}\n\ttxnOutcome, err := enrichTxn(aeroClient, &incomingTxn, &enrichedTxn)\n\tif err != nil {\n\t\thttp.Error(w, err.Error(), http.StatusBadRequest)\n\t\treturn\n\t}\n\n\t// send enriched txn to model serving web service\n\tmodelPrediction, err := getPrediction(&enrichedTxn)\n\tif err != nil {\n\t\thttp.Error(w, err.Error(), http.StatusBadRequest)\n\t\treturn\n\t}\n\n\t// compare prediction with classification\n\tvalidatePrediction(txnOutcome, modelPrediction)\n}", "title": "" }, { "docid": "47ce90a87fd51ab33ac5848def8c9868", "score": "0.4508944", "text": "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}", "title": "" }, { "docid": "bc3bc29fe4e92cf213b335de8e2a48ba", "score": "0.4507124", "text": "func (self *bestFit) predict(balance Kilometres,start epochDays) (epochDays,error) {\n\n\t// Check for valid state\n\tif self.c < 0 {\n\t\treturn epochDays(math.MaxInt64),ENOTENOUGHDATAPOINTS\n\t}\n\n\t// Calulate integral of start\n\tis := self.integral(float64(start))\n\n\t// Solve quadratic\n\tends,_ := qr(self.m/2,self.c,-(float64(balance)+is))\n\n\t// Choose an answer \n\tchoice := math.MaxFloat64\n\tfor _,candidate := range ends {\n\t\tif candidate > float64(start) && candidate < choice {\n\t\t\tif self.calcY(candidate) > 0.0 {\n\t\t\t\tchoice=candidate\n\t\t\t}\n\t\t}\n\t}\n\n\t// Calculate an estimate based on 0 gradient and last point\n\t// if no valid choice from the formula\n\tif choice == math.MaxFloat64 {\n\t\tl := len(self.ys)\n\t\tif l > 0 {\n\t\t\tchoice = float64(start) + (float64(balance)/self.ys[l-1])\n\t\t}\n\t}\n\t\n\t// Return choice if we have made one or otherwise return\n\t// an answer assuming horizontal line.\n\tif choice == math.MaxFloat64 {\n\t\treturn epochDays(choice), ENOVALIDPREDICTION\n\t} else {\n\t\treturn epochDays(math.Ceil(choice)), nil\n\t}\n}", "title": "" }, { "docid": "7566b69f8f71abfc846b40bbd7b22968", "score": "0.45038122", "text": "func (a *Alec) Predict(inputData [][]float64) *mat64.Dense {\n\tvar input []float64\n\n\tfor _, data := range inputData {\n\t\tinput = append(input, data...)\n\t}\n\n\t// Run the input data through the network\n\tinputMatrix := mat64.NewDense(len(inputData), len(inputData[0]), input)\n\ta.ForwardPropagate(inputMatrix)\n\n\t// Return the results from the output layer\n\treturn a.NeuronOutputResults\n}", "title": "" }, { "docid": "dc037e268f8d6cf4768b8c5cd63bfda1", "score": "0.44991678", "text": "func DeletePrediction(leagueID string, year int, playerID string, matchupID string, request data.DeletePredictionRequest) data.DeletePredictionReply {\n\tvar reply data.DeletePredictionReply\n\tsession := store.GetSessionManager().Get(request.SessionID)\n\tif session == nil {\n\t\treply.Result.Code = data.ACCESSDENIED\n\t\treturn reply\n\t}\n\tleague := getLeague(leagueID)\n\tseason := getSeason(year, league)\n\tplayer := getPlayer(playerID)\n\tmatchup := getMatchup(season, matchupID)\n\tprediction := getPrediction(season, player, matchup)\n\tif prediction == nil {\n\t\treply.Result.Code = data.NOTFOUND\n\t\treturn reply\n\t}\n\tif !session.Player.Admin {\n\t\treply.Result.Code = data.ACCESSDENIED\n\t\treturn reply\n\t}\n\tstore.GetStore().Prediction().DeletePrediction(prediction)\n\treply.Result.Code = data.SUCCESS\n\treturn reply\n}", "title": "" }, { "docid": "3e72f94a56a6b3cd9b6b38bec63941d0", "score": "0.44899344", "text": "func ImportPredictionDataset(params *PredictParams) (string, string, error) {\n\tmeta := params.Meta\n\tschemaPath := \"\"\n\tdatasetName := fmt.Sprintf(\"pred_%s\", params.Dataset)\n\n\tpredictionDatasetCtor := &predictionDataset{\n\t\tparams: params,\n\t}\n\n\t// create the dataset to be used for predictions\n\tdatasetName, datasetPath, err := CreateDataset(datasetName, predictionDatasetCtor, params.OutputPath, params.Config)\n\tif err != nil {\n\t\treturn \"\", \"\", err\n\t}\n\tlog.Infof(\"created dataset for new data with id '%s' found at location '%s'\", datasetName, datasetPath)\n\n\t// read the header of the new dataset to get the field names\n\t// if they dont match the original, then cant use the same pipeline\n\trawDataPath := path.Join(datasetPath, compute.D3MDataFolder, compute.D3MLearningData)\n\trawCSVData, err := util.ReadCSVFile(rawDataPath, false)\n\tif err != nil {\n\t\treturn \"\", \"\", errors.Wrap(err, \"unable to parse header result\")\n\t}\n\trawHeader := rawCSVData[0]\n\tmainDR := meta.GetMainDataResource()\n\tfor i, f := range rawHeader {\n\t\t// TODO: col index not necessarily the same as index and thats what needs checking\n\t\t// We check both name and display name as the pre-ingested datasets are keyed of display name\n\t\t// only the first n fields need to match, with n being the number of fields in the source dataset\n\t\tif i < len(mainDR.Variables) && mainDR.Variables[i].Key != f && mainDR.Variables[i].HeaderName != f {\n\t\t\treturn \"\", \"\", errors.Errorf(\"variables in new prediction file do not match variables in original dataset\")\n\t\t}\n\t}\n\tlog.Infof(\"dataset fields compatible with original dataset fields\")\n\n\t// read the metadata from the created prediction dataset since it needs to be updated\n\tdatasetStorage := serialization.GetStorage(rawDataPath)\n\tschemaPath = path.Join(datasetPath, compute.D3MDataSchema)\n\tmeta, err = datasetStorage.ReadMetadata(schemaPath)\n\tif err != nil {\n\t\treturn \"\", \"\", errors.Wrap(err, \"unable to read metadata\")\n\t}\n\n\t// update the dataset doc to reflect original types\n\tmeta.ID = datasetName\n\tmeta.Name = datasetName\n\tmeta.StorageName = model.NormalizeDatasetID(datasetName)\n\tmeta.DatasetFolder = path.Base(datasetPath)\n\tvariables := updateMetaDataTypes(params.SolutionStorage, params.MetaStorage, params.DataStorage, meta, params.FittedSolutionID, params.Dataset, meta.StorageName)\n\tif err != nil {\n\t\treturn \"\", \"\", errors.Wrap(err, \"unable to update metadata types\")\n\t}\n\terr = datasetStorage.WriteMetadata(schemaPath, meta, true, false)\n\tif err != nil {\n\t\treturn \"\", \"\", errors.Wrap(err, \"unable to update dataset doc\")\n\t}\n\tlog.Infof(\"wrote out schema doc for new dataset with id '%s' at location '%s'\", meta.ID, schemaPath)\n\terr = createClassification(params, datasetPath, variables)\n\tif err != nil {\n\t\treturn \"\", \"\", errors.Wrap(err, \"unable to create classification\")\n\t}\n\tparams.Meta = meta\n\treturn datasetName, schemaPath, nil\n}", "title": "" }, { "docid": "9150b844923ab6b394b5c4a4a1571a9e", "score": "0.4485879", "text": "func (o *PartnerCustomerCreateRequest) GetIsDiligenceAttestedOk() (*bool, bool) {\n\tif o == nil {\n\t\treturn nil, false\n\t}\n\treturn &o.IsDiligenceAttested, true\n}", "title": "" }, { "docid": "2fad0b9b9fdd94f7b72633f5ae04555a", "score": "0.44822904", "text": "func (parser *EarleyParser) predict(grammarRules *mentalese.GrammarRules, chart *chart, state chartState) {\n\n\tconsequentIndex := state.dotPosition - 1\n\tnextConsequent := state.rule.GetConsequent(consequentIndex)\n\tnextConsequentVariables := state.rule.GetConsequentVariables(consequentIndex)\n\tendWordIndex := state.endWordIndex\n\n\tif parser.log.IsActive() {\n\t\tparser.log.AddDebug(\"predict\", state.ToString(chart))\n\t}\n\n\t// go through all rules that have the next consequent as their antecedent\n\tfor _, rule := range grammarRules.FindRules(nextConsequent, len(nextConsequentVariables)) {\n\n\t\tpredictedState := newChartState(rule, 1, endWordIndex, endWordIndex)\n\t\tchart.enqueue(predictedState, endWordIndex)\n\n\t\tif parser.log.IsActive() {\n\t\t\tparser.log.AddDebug(\"> predicted\", predictedState.ToString(chart))\n\t\t}\n\t}\n}", "title": "" }, { "docid": "60e76a8282b30680e589abbe00394106", "score": "0.4479517", "text": "func Predict(shooter, target, targetVelocity mat.Vec, bulletSpeed float64) (pos mat.Vec, ok bool) {\n\t/*\n\t\tEquation is derivated via analytic math so do not search match obvious logic in there.\n\n\t\tIf distance target<>shooter == target<>bullet we assume that we hit the target, all we need is\n\t\tright coefficient by witch we multiply targets velocity to get the final position.\n\n\t\tAt the end wi just decide what is correct direction as shooting back in time is not an\n\t\toption for usual game.\n\t*/\n\n\td := target.Sub(shooter)\n\n\ta := targetVelocity.X*targetVelocity.X + targetVelocity.Y*targetVelocity.Y - bulletSpeed*bulletSpeed\n\tb := 2 * (d.X*targetVelocity.X + d.Y*targetVelocity.Y)\n\tc := d.X*d.X + d.Y*d.Y\n\n\t// polynomial\n\tcof := b*b - 4*a*c\n\n\tif cof < 0 {\n\t\treturn\n\t}\n\n\tcof = math.Sqrt(cof)\n\ta *= 2\n\tt1, t2 := (-b+cof)/a, (-b-cof)/a\n\n\t// deciding witch cof is correct\n\tif t1 <= 0 || t1 > t2 {\n\t\tt1 = t2\n\t}\n\n\treturn target.Add(targetVelocity.Scaled(t1)), true\n}", "title": "" }, { "docid": "8fabb1a0341ea516213dd1e8b9fc1b7d", "score": "0.44754538", "text": "func generateTrainset(trainSet []core.TrainsetData, inputset []Testdata, output []string) ([]core.TrainsetData, int, int) {\n\n\tcorrect := 0\n\n\tparam, problem, err := core.Setup(trainSet)\n\tif err != nil {\n\t\tlog.Fatalf(\"Error while setup the core:\", err)\n\t}\n\tmodel := core.Train(param, problem)\n\tif model.L != len(trainSet) {\n\t\tfor i := 0; i < len(inputset); i++ {\n\t\t\tfeatures := inputset[i].Feature\n\t\t\tris := core.Predict(features, model)\n\t\t\tif output[int(ris)-1] == inputset[i].Name[0] {\n\t\t\t\tcorrect++\n\t\t\t}\n\t\t}\n\t}\n\n\treturn trainSet, correct, model.L\n}", "title": "" }, { "docid": "6ce72365c83be50938a616066a825c12", "score": "0.44753736", "text": "func (o *StoragePhysicalDisk) GetFailurePredicted() bool {\n\tif o == nil || o.FailurePredicted == nil {\n\t\tvar ret bool\n\t\treturn ret\n\t}\n\treturn *o.FailurePredicted\n}", "title": "" }, { "docid": "e179e1782df8f37dd4a129f0b0484635", "score": "0.44753617", "text": "func predict(x_i interface{} , beta interface{} ) interface{} {\n//assumes that the first element of each x_i is 1\n\treturn dot(x_i,beta)\n}", "title": "" }, { "docid": "4b6e66ef18bcb51376f32325d1dc3858", "score": "0.44692072", "text": "func (r *Responder) PreconditionFailed() { r.write(http.StatusPreconditionFailed) }", "title": "" }, { "docid": "9761a20df6bbd9f075054a1c15b86d48", "score": "0.44650313", "text": "func (s *BasePlSqlParserListener) EnterStandard_prediction_function_keyword(ctx *Standard_prediction_function_keywordContext) {\n}", "title": "" }, { "docid": "c7db89fbd7d680ba8c4476b95518b975", "score": "0.4464159", "text": "func (so *SlopeOne) Predict(userId, itemId int) float64 {\n\t// Convert to index\n\tuserIndex := so.UserIndexer.ToIndex(userId)\n\titemIndex := so.ItemIndexer.ToIndex(itemId)\n\tprediction := 0.0\n\tif userIndex != base.NotId {\n\t\tprediction = so.UserMeans[userIndex]\n\t} else {\n\t\t// Use global mean for new user\n\t\tprediction = so.GlobalMean\n\t}\n\tif itemIndex != base.NotId {\n\t\tsum, count := 0.0, 0.0\n\t\tso.UserRatings[userIndex].ForEachIndex(func(i, index int, value float64) {\n\t\t\tsum += so.Dev[itemIndex][index]\n\t\t\tcount++\n\t\t})\n\t\tif count > 0 {\n\t\t\tprediction += sum / count\n\t\t}\n\t}\n\treturn prediction\n}", "title": "" }, { "docid": "533189ab90036943100793ec5d8b5b5e", "score": "0.44599208", "text": "func TestHookedSentimentShouldPass4(t *testing.T) {\n\tts, text, _, err := GetHookResponse(TaskJSON{\n\t\tID: \"1\",\n\t\tHookID: \"temporal\",\n\t})\n\tif err != nil {\n\t\tt.Fatalf(\"ERROR: could not get hooked response!\\n\\t%v\\n\", err)\n\t}\n\n\tstatus, body, err := post(\"task\", `{\n\t\t\"recordingId\": \"1\",\n\t\t\"hookId\": \"temporal\"\n\t}`)\n\tif err != nil {\n\t\tt.Errorf(\"ERROR: error trying to post\\n\\t%v\\n\", err)\n\t}\n\tif status != http.StatusOK {\n\t\tt.Errorf(\"ERROR: status returned should be 200 OK\\n\\t%v\\n\", string(body))\n\t}\n\tif len(body) == 0 {\n\t\tt.Fatalf(\"ERROR: body should not be nil!\\n\")\n\t}\n\n\tanalysis := TimeSeriesResponse{}\n\terr = json.Unmarshal(body, &analysis)\n\tif err != nil {\n\t\tt.Fatalf(\"ERROR: error unmarshalling JSON response\\n\\t%v\\n\", err)\n\t}\n\n\tif ts == nil {\n\t\tt.Errorf(\"ERROR: time series from hook should not be nil!\\n\\t%v\\n\", ts)\n\t}\n\tif analysis.Series == nil {\n\t\tt.Fatalf(\"ERROR: time series from response should not be nil!\\n\\t%v\\n\", analysis.Series)\n\t}\n\tif analysis.Metadata == nil {\n\t\tt.Fatalf(\"ERROR: analysis metadata from response should not be nil!\\n\\t%v\\n\", analysis.Metadata)\n\t}\n\n\tshould := model.SentimentAnalysis(text, sentiment.English)\n\tif should.Score != analysis.Metadata.Score {\n\t\tt.Errorf(\"ERROR: responded text sentiment score should equal the same score from the library!\\n\\tShould be: %v\\n\\tReturned: %v\\n\", should.Score, analysis.Metadata.Score)\n\t}\n\tif len(should.Words) != len(analysis.Metadata.Words) {\n\t\tt.Errorf(\"ERROR: responded individual word sentiment should equal in length the same response from the library!\\n\\tShould be: %v\\n\\tReturned: %v\\n\", should.Words, analysis.Metadata.Words)\n\t}\n\tif len(analysis.Series) != len(ts) {\n\t\tt.Errorf(\"ERROR: responded time series data should equal, in length, the time series data given from the request!\\n\\tShould be %v\\n\\tReturned: %v\\n\", len(ts), len(analysis.Series))\n\t}\n}", "title": "" }, { "docid": "506396f5d9c5d4c2f66535e4d5a43dca", "score": "0.44580707", "text": "func (o *ForecastModelAllOf) GetAccuracyOk() (*float32, bool) {\n\tif o == nil || o.Accuracy == nil {\n\t\treturn nil, false\n\t}\n\treturn o.Accuracy, true\n}", "title": "" }, { "docid": "316b65e8b343216e259f48dadebc534c", "score": "0.4454445", "text": "func (*predictEndpoint) ID() string { return \"MachineLearning:PredictEndpoint\" }", "title": "" }, { "docid": "daa5c7dbc861cb4ab170367602d707d0", "score": "0.4419961", "text": "func (s *Storage) FetchPrediction(requestID string) (*api.Prediction, error) {\n\tsql := fmt.Sprintf(\"SELECT request_id, dataset, target, fitted_solution_id, progress, created_time, last_updated_time FROM %s \"+\n\t\t\"WHERE request_id = $1 ORDER BY created_time desc LIMIT 1;\", postgres.PredictionTableName)\n\n\trows, err := s.client.Query(sql, requestID)\n\tif err != nil {\n\t\treturn nil, errors.Wrap(err, \"Unable to pull request from Postgres\")\n\t}\n\tif rows != nil {\n\t\tdefer rows.Close()\n\t}\n\trows.Next()\n\terr = rows.Err()\n\tif err != nil {\n\t\treturn nil, errors.Wrapf(err, \"error reading data from postgres\")\n\t}\n\n\treturn s.loadPrediction(rows)\n}", "title": "" }, { "docid": "458fbf0ac3403ab736fa651a5b7e5b6a", "score": "0.44193512", "text": "func (rf *RandomForest) Predict(m *mat.Dense) (predictions []float64) {\n\tdR, _ := m.Dims()\n\tpredictions = make([]float64, dR)\n\tfor i := 0; i < dR; i++ {\n\t\tpredictions[i] = rf.PredictRow(m.RowView(i))\n\t}\n\treturn predictions\n}", "title": "" }, { "docid": "8b6b28ba607c8963030041d836449d0b", "score": "0.44181585", "text": "func (o *VirtualizationVmwareVirtualMachineAllOf) GetAnnotationOk() (*string, bool) {\n\tif o == nil || o.Annotation == nil {\n\t\treturn nil, false\n\t}\n\treturn o.Annotation, true\n}", "title": "" }, { "docid": "13030673c9668b9ab8ad8877d85d4033", "score": "0.4417211", "text": "func (self *bestFit) version() predictVersion {\n\treturn self.pv\n}", "title": "" }, { "docid": "047c11536a7430460722109386f3946d", "score": "0.44069138", "text": "func (n *Node) Predict(feature []float64) float64 {\n\tif n.left != nil && n.right != nil {\n\t\tif feature[n.feature] <= n.threshold {\n\t\t\treturn n.left.Predict(feature)\n\t\t} else {\n\t\t\treturn n.right.Predict(feature)\n\t\t}\n\t}\n\n\treturn n.label\n}", "title": "" }, { "docid": "f4258763c1e0bba3bb237e51f54e230f", "score": "0.44068262", "text": "func (o *FilingSentiment) GetUncertaintyOk() (*float32, bool) {\n\tif o == nil || o.Uncertainty == nil {\n\t\treturn nil, false\n\t}\n\treturn o.Uncertainty, true\n}", "title": "" }, { "docid": "71065f977ddb7336a3c1c1b49749f3d3", "score": "0.44057322", "text": "func (p predictor) PredictBatch(RowMatrix, MutableRowMatrix) (MutableRowMatrix, error) {\n\tpanic(\"can't be here\")\n}", "title": "" }, { "docid": "86438d17ba1145fac8028d8e725e26b8", "score": "0.44047648", "text": "func TestGetMarkets(t *testing.T) {\n\tt.Parallel()\n\t_, err := f.GetMarkets()\n\tif err != nil {\n\t\tt.Error(err)\n\t}\n}", "title": "" }, { "docid": "ff5908bcd8183fd8e52012fcc03330e6", "score": "0.44034874", "text": "func (device *ServoBrick) GetResponseExpected(functionID Function) (bool, error) {\n\treturn device.device.GetResponseExpected(uint8(functionID))\n}", "title": "" }, { "docid": "0f8f7cad4a84210aae2d6262af2b3b15", "score": "0.44003206", "text": "func (knn *Knn) Predict(data [][]float64) []int {\n\tvar (\n\t\tresults []int\n\t\tdistances []*Distance\n\t)\n\tfor i := 0; i < len(data); i++ {\n\t\t// tinh khoang cach\n\t\tfor j := 0; j < len(knn.X); j++ {\n\t\t\tdistances = append(distances, &Distance{\n\t\t\t\tIndex: j,\n\t\t\t\tValue: knn.distance(data[i], knn.X[j]),\n\t\t\t})\n\t\t}\n\t\t// sort lai khoang cach tu nho toi to\n\t\tsort.SliceStable(distances, func(i, j int) bool {\n\t\t\treturn distances[i].Value < distances[j].Value\n\t\t})\n\t\t// chon ra k phan tu va dem\n\t\tcounter := make(map[int]int)\n\t\tfor j := 0; j < len(knn.Y); j++ {\n\t\t\tcounter[knn.Y[j]] = 0\n\t\t}\n\t\t// tien hanh dem\n\t\tfor j := 0; j < knn.K; j++ {\n\t\t\tlabelValue := knn.Y[distances[j].Index]\n\t\t\tcounter[labelValue] = counter[labelValue] + 1\n\t\t}\n\t\t// chon ra nhan co so dem cao nhat\n\t\tvar (\n\t\t\tmaxValue = 0\n\t\t\tmaxIndex = 0\n\t\t)\n\t\tfor k, v := range counter {\n\t\t\tprintln(\"weight:\", k, v)\n\t\t}\n\t\tfor j := 0; j < len(knn.Y); j++ {\n\t\t\tlabelValue := knn.Y[j]\n\t\t\tif counter[labelValue] > maxValue {\n\t\t\t\tmaxIndex = j\n\t\t\t\tmaxValue = counter[labelValue]\n\t\t\t}\n\t\t}\n\t\tresults = append(results, knn.Y[maxIndex])\n\t}\n\n\treturn results\n}", "title": "" }, { "docid": "98964f17f0994351438d4c53184a627c", "score": "0.43951514", "text": "func (o *StoragePhysicalDisk) HasFailurePredicted() bool {\n\tif o != nil && o.FailurePredicted != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "01c40ab6cd618f21789fe951fada69cc", "score": "0.43877438", "text": "func (o *StoragePhysicalDisk) GetFailurePredictedOk() (*bool, bool) {\n\tif o == nil || o.FailurePredicted == nil {\n\t\treturn nil, false\n\t}\n\treturn o.FailurePredicted, true\n}", "title": "" }, { "docid": "6220cd2941d3865e1d12b1e3c35b887c", "score": "0.43860942", "text": "func TestHookedSentimentShouldPass3(t *testing.T) {\n\tts, text, _, err := GetHookResponse(TaskJSON{\n\t\tID: \"1\",\n\t\tHookID: \"post\",\n\t})\n\tif err != nil {\n\t\tt.Fatalf(\"ERROR: could not get hooked response!\\n\\t%v\\n\", err)\n\t}\n\n\tstatus, body, err := post(\"task\", `{\n\t\t\"recordingId\": \"1\"\n\t}`)\n\tif err != nil {\n\t\tt.Errorf(\"ERROR: error trying to post\\n\\t%v\\n\", err)\n\t}\n\tif status != http.StatusOK {\n\t\tt.Errorf(\"ERROR: status returned should be 200 OK\\n\\t%v\\n\", string(body))\n\t}\n\tif len(body) == 0 {\n\t\tt.Fatalf(\"ERROR: body should not be nil!\\n\")\n\t}\n\n\tanalysis := sentiment.Analysis{}\n\terr = json.Unmarshal(body, &analysis)\n\tif err != nil {\n\t\tt.Fatalf(\"ERROR: error unmarshalling JSON response\\n\\t%v\\n\", err)\n\t}\n\n\tif ts != nil {\n\t\tt.Errorf(\"ERROR: time series should be nil!\\n\\t%v\\n\", ts)\n\t}\n\n\tshould := model.SentimentAnalysis(text, sentiment.English)\n\tif should.Score != analysis.Score {\n\t\tt.Errorf(\"ERROR: responded text sentiment score should equal the same score from the library!\\n\\tShould be: %v\\n\\tReturned: %v\\n\", should.Score, analysis.Score)\n\t}\n\tif len(should.Words) != len(analysis.Words) {\n\t\tt.Errorf(\"ERROR: responded individual word sentiment should equal in length the same response from the library!\\n\\tShould be: %v\\n\\tReturned: %v\\n\", should.Words, analysis.Words)\n\t}\n}", "title": "" } ]
e6957839ca28ada2fa187bab8aa39de6
GetCLIApp gets the configuration for the cli app by name
[ { "docid": "f32afc77e05c539c9307f4888ca8ebb8", "score": "0.7951929", "text": "func (m *Manager) GetCLIApp(appName string) (*CLIApp, error) {\n\tconfigPath := m.getConfigPath()\n\tapps := loadConfig(configPath)\n\tfor _, app := range apps {\n\t\tif app.App == appName {\n\t\t\treturn app, nil\n\t\t}\n\t}\n\tfor _, app := range apps {\n\t\tif app.InstallName == appName {\n\t\t\treturn app, nil\n\t\t}\n\t}\n\treturn nil, fmt.Errorf(\"App is not installed: %s\", appName)\n}", "title": "" } ]
[ { "docid": "b0e2bf2d3e2415b4422488b0649ca034", "score": "0.68013036", "text": "func (a App) cli() string {\n\treturn a.Name + \"cli\"\n}", "title": "" }, { "docid": "ff034d89a787563e2fcab49da537869f", "score": "0.6606023", "text": "func GetApp(ctx context.Context) string {\n\treturn GetString(ctx, AppName)\n}", "title": "" }, { "docid": "3b89cb157109f030de42bb0ace7d1f84", "score": "0.6363156", "text": "func AppGetAction(clientConfig spinnaker.ClientConfig) cli.ActionFunc {\n\treturn func(cc *cli.Context) error {\n\t\tappName := cc.Args().Get(0)\n\n\t\tclient, err := clientFromContext(cc, clientConfig)\n\t\tif err != nil {\n\t\t\treturn errors.Wrapf(err, \"creating spinnaker client\")\n\t\t}\n\n\t\tlogrus.WithField(\"appName\", appName).Info(\"Fetching application\")\n\t\texists, appInfo, err := client.ApplicationGet(appName)\n\t\tif err != nil {\n\t\t\treturn errors.Wrap(err, \"Fetching app info\")\n\t\t}\n\n\t\tif exists == false {\n\t\t\tlogrus.Error(\"App does not exist or insufficient permission\")\n\t\t\treturn fmt.Errorf(\"Could not fetch app info\")\n\t\t}\n\t\tappYaml, err := yaml.JSONToYAML(appInfo)\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"could not unmarshal: %v\", err)\n\t\t}\n\t\tfmt.Printf(\"%s\", appYaml)\n\t\treturn nil\n\t}\n}", "title": "" }, { "docid": "5db260e67c20bb2820e804b1dbf31c8e", "score": "0.6295795", "text": "func NewApp() *App {\n\treturn &App{\n\t\tName: \"cli\",\n\t\tAuthors: make([]Author, 0),\n\t\tHelpCommands: map[string]bool{\n\t\t\t\"--help\": true,\n\t\t\t\"-h\": true,\n\t\t\t\"help\": true,\n\t\t},\n\t\tParsingOrder: []ParsingType{\n\t\t\tEnvironmentVariables,\n\t\t\tJsonConfig,\n\t\t\tTomlConfig,\n\t\t\tCliFlags,\n\t\t},\n\t\tHelpTextVariablesInTable: true,\n\t}\n}", "title": "" }, { "docid": "e47d27399200b297a2bc86261908f29a", "score": "0.62338334", "text": "func GetApp() (*App, error) {\n\treturn GetAppWithName(defaultAppName)\n}", "title": "" }, { "docid": "e2cb33ce00fd935da88e37143fe1f574", "score": "0.6138618", "text": "func (c *Cli) AppName() string {\n\treturn c.appName\n}", "title": "" }, { "docid": "4f642a8833950cab3734fd933fc35399", "score": "0.6138112", "text": "func CLI(args []string, app BaseApp) int {\n\tif err := app.initApp(); err != nil {\n\t\tfmt.Println(err)\n\t\treturn 2\n\t}\n\n\tif err := app.run(); err != nil {\n\t\tfmt.Println(err)\n\t\treturn 3\n\t}\n\n\treturn 0\n}", "title": "" }, { "docid": "9031253d80c1f84f0f5d40f08b17dbe2", "score": "0.6123908", "text": "func (c *CfInstances) getAppName(args []string) (string, error) {\n if len(args) < 2 {\n\treturn \"\", errors.New(\"missing application name\")\n }\n return args[1], nil\n}", "title": "" }, { "docid": "3a10cee335cdb7ae5c5e73c41c6acbfb", "score": "0.60803795", "text": "func GetApp(ctx *pulumi.Context,\n\tname string, id pulumi.ID, state *AppState, opts ...pulumi.ResourceOpt) (*App, error) {\n\tinputs := make(map[string]interface{})\n\tif state != nil {\n\t\tinputs[\"applicationId\"] = state.ApplicationId\n\t\tinputs[\"arn\"] = state.Arn\n\t\tinputs[\"campaignHook\"] = state.CampaignHook\n\t\tinputs[\"limits\"] = state.Limits\n\t\tinputs[\"name\"] = state.Name\n\t\tinputs[\"namePrefix\"] = state.NamePrefix\n\t\tinputs[\"quietTime\"] = state.QuietTime\n\t\tinputs[\"tags\"] = state.Tags\n\t}\n\ts, err := ctx.ReadResource(\"aws:pinpoint/app:App\", name, id, inputs, opts...)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn &App{s: s}, nil\n}", "title": "" }, { "docid": "ac1a28a8cc48fff8d07899295c487d3f", "score": "0.60467184", "text": "func GetApp(ctx *pulumi.Context,\n\tname string, id pulumi.IDInput, state *AppState, opts ...pulumi.ResourceOption) (*App, error) {\n\tvar resource App\n\terr := ctx.ReadResource(\"azure:containerapp/app:App\", name, id, state, &resource, opts...)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn &resource, nil\n}", "title": "" }, { "docid": "0acbc601c4f33a018aa0d60b7e977384", "score": "0.6038487", "text": "func (a *App) Get(name string) interface{} {\n\treturn a.getConfig()[name]\n}", "title": "" }, { "docid": "c1427b7a36eae1f5d4cab07b0e181652", "score": "0.5986703", "text": "func (hv *Hypervisor) getApp() http.HandlerFunc {\n\treturn hv.withCtx(hv.appCtx, func(w http.ResponseWriter, r *http.Request, ctx *httpCtx) {\n\t\thttputil.WriteJSON(w, r, http.StatusOK, ctx.App)\n\t})\n}", "title": "" }, { "docid": "f76d74c1f6f40e007bdc52ce44fe6605", "score": "0.5953644", "text": "func GetDefaultTestApp(logger zap.Logger) (*api.App, error) {\n\toptions := api.DefaultOptions()\n\toptions.ConfigFile = \"../config/test.yaml\"\n\treturn api.New(options, logger, false)\n}", "title": "" }, { "docid": "5f0f7a3736c893e7724f24f095dccc81", "score": "0.5935529", "text": "func NewApp(settings ...string) *Application {\n\tapp = &Application{Name: \"My CLI Application\", Version: \"1.0.0\"}\n\tapp.Logo.Style = \"info\"\n\n\tfor k, v := range settings {\n\t\tswitch k {\n\t\tcase 0:\n\t\t\tapp.Name = v\n\t\tcase 1:\n\t\t\tapp.Version = v\n\t\tcase 2:\n\t\t\tapp.Description = v\n\t\t}\n\t}\n\n\t// init\n\tapp.Init()\n\n\treturn app\n}", "title": "" }, { "docid": "b604b8038a86a3b8cafd2a3b681ec4c8", "score": "0.5902256", "text": "func GetApps() []*App {\n\tapps := viper.GetStringMap(\"apps\")\n\tvar appList []*App\n\tfor appName, appProps := range apps {\n\t\tappPropsMap := appProps.(map[string]interface{})\n\t\tapp := &App{\n\t\t\tName: appName,\n\t\t\tDescription: ValueOfMap(\"description\", appPropsMap, \"\"),\n\t\t\tRoot: ValueOfMap(\"root\", appPropsMap, \"\"),\n\t\t\tPrefix: ValueOfMap(\"prefix\", appPropsMap, \"\"),\n\t\t\tTmpl: ValueOfMap(\"tmpl\", appPropsMap, \".env.tmpl\"),\n\t\t\tDest: ValueOfMap(\"dest\", appPropsMap, \".env\"),\n\t\t\tCmd: ValueOfMap(\"cmd\", appPropsMap, \"\"),\n\t\t}\n\t\tappList = append(appList, app)\n\t}\n\treturn appList\n}", "title": "" }, { "docid": "bc1eeec7edf964f986f786877e6ccdd7", "score": "0.58948123", "text": "func GetAppWithName(name string) (*App, error) {\n\tapps.Lock()\n\tdefer apps.Unlock()\n\tname = normalize(name)\n\tif app, ok := apps.m[name]; ok {\n\t\treturn app, nil\n\t}\n\treturn nil, fmt.Errorf(\"App with name %s not yet initialized!\", name)\n}", "title": "" }, { "docid": "80701aab612964eb29489a968b97e379", "score": "0.58859414", "text": "func (a *Client) GetApp(params *GetAppParams, authInfo runtime.ClientAuthInfoWriter) (*GetAppOK, error) {\n\t// TODO: Validate the params before sending\n\tif params == nil {\n\t\tparams = NewGetAppParams()\n\t}\n\n\tresult, err := a.transport.Submit(&runtime.ClientOperation{\n\t\tID: \"getApp\",\n\t\tMethod: \"GET\",\n\t\tPathPattern: \"/apps/{appNameOrId}\",\n\t\tProducesMediaTypes: []string{\"application/json\"},\n\t\tConsumesMediaTypes: []string{\"application/json\"},\n\t\tSchemes: []string{\"https\"},\n\t\tParams: params,\n\t\tReader: &GetAppReader{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.(*GetAppOK)\n\tif ok {\n\t\treturn success, nil\n\t}\n\t// unexpected success response\n\tunexpectedSuccess := result.(*GetAppDefault)\n\treturn nil, runtime.NewAPIError(\"unexpected success response: content available as default response in error\", unexpectedSuccess, unexpectedSuccess.Code())\n}", "title": "" }, { "docid": "cb914c70bf7ba8344135b5e19818f61c", "score": "0.58843493", "text": "func GetAppInfo(ctx *gin.Context) {\n\t// appName, exists := os.LookupEnv(\"APP_NAME\")\n\t// if !exists {\n\t// \tappName = \"go-react\"\n\t// }\n\t// appVersion, exists := os.LookupEnv(\"APP_VERSION\")\n\t// if !exists {\n\t// \tappVersion = \"1.0.0\"\n\t// }\n\n\t// appDeveloper, exists := os.LookupEnv(\"APP_DEVELOPER\")\n\t// if !exists {\n\t// \tappDeveloper = \"imhshekhar47\"\n\t// }\n\n\tconfig := config.GetConfig()\n\tctx.JSON(http.StatusOK, AppInfo{\n\t\tName: config.Application.Name,\n\t\tVersion: config.Application.Version,\n\t\tDeveloper: config.Application.Developer,\n\t})\n}", "title": "" }, { "docid": "52962184df5f7dfef0be9109fb2e31dc", "score": "0.5776033", "text": "func (Executor) GetApp(nodeId string, appId string) (int, map[string]interface{}, error) {\n\tlogger.Logging(logger.DEBUG, \"IN\")\n\tdefer logger.Logging(logger.DEBUG, \"OUT\")\n\n\t// Get node including app specified by appId parameter.\n\tnode, err := nodeDbExecutor.GetNodeByAppID(nodeId, appId)\n\tif err != nil {\n\t\tlogger.Logging(logger.ERROR, err.Error())\n\t\treturn results.ERROR, nil, err\n\t}\n\n\taddress := getNodeAddress(node)\n\turls := util.MakeRequestUrl(address, url.Management(), url.Apps(), \"/\", appId)\n\n\t// Request get target application's information\n\tcodes, respStr := httpExecutor.SendHttpRequest(\"GET\", urls, nil)\n\n\t// Convert the received response from string to map.\n\tresult := codes[0]\n\trespMap, err := convertRespToMap(respStr)\n\tif err != nil {\n\t\tlogger.Logging(logger.ERROR, err.Error())\n\t\treturn results.ERROR, nil, err\n\t}\n\n\treturn result, respMap, err\n}", "title": "" }, { "docid": "88a80715434ec069c32681d37f4bad0e", "score": "0.57548106", "text": "func NewApp() *cli.App {\n\tapp := cli.NewApp()\n\n\tapp.Name = \"gt\"\n\tapp.Author = \"Benjamin Pannell <benjamin@pannell.dev>\"\n\tapp.Copyright = \"Copyright © Sierra Softworks 2019\"\n\tapp.Usage = \"Manage your git repositories\"\n\tapp.Version = \"0.0.0-dev\"\n\n\tapp.EnableBashCompletion = true\n\n\tapp.Description = \"A tool which helps manage your local git repositories and development folders.\"\n\n\tapp.Commands = []cli.Command{\n\t\trepoInfoCommand,\n\t\topenAppCommand,\n\t\tnewRepoCommand,\n\t\tlistReposCommand,\n\t\tlistAppsCommand,\n\t\tlistServicesCommand,\n\t\tgetGitignoreCommand,\n\t\topenScratchCommand,\n\t\tcompleteCommand,\n\t}\n\n\tapp.Flags = []cli.Flag{\n\t\tcli.StringFlag{\n\t\t\tName: \"config,c\",\n\t\t\tEnvVar: \"GITTOOL_CONFIG\",\n\t\t\tUsage: \"specify the path to your configuration file\",\n\t\t},\n\t\tcli.BoolFlag{\n\t\t\tName: \"verbose\",\n\t\t\tUsage: \"enable verbose logging\",\n\t\t},\n\t\tcli.StringFlag{\n\t\t\tName: \"bash-completion-filter\",\n\t\t\tUsage: \"A filter used to select matches for the local argument\",\n\t\t\tHidden: true,\n\t\t},\n\t}\n\n\tapp.Before = func(c *cli.Context) error {\n\t\tif c.GlobalString(\"config\") != \"\" {\n\t\t\tlogrus.WithField(\"config_path\", c.GlobalString(\"config\")).Debug(\"Loading configuration file\")\n\t\t\tcfgResult, err := config.Load(c.GlobalString(\"config\"))\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\n\t\t\tlogrus.WithField(\"config_path\", c.GlobalString(\"config\")).Debug(\"Loaded configuration file\")\n\t\t\tdi.SetConfig(cfgResult)\n\t\t}\n\n\t\tif c.GlobalBool(\"verbose\") {\n\t\t\tlogrus.SetLevel(logrus.DebugLevel)\n\t\t}\n\n\t\treturn nil\n\t}\n\n\tapp.BashComplete = func(c *cli.Context) {\n\t\tfilter := c.GlobalString(\"bash-completion-filter\")\n\n\t\tfor _, cmd := range c.App.Commands {\n\t\t\tfor _, name := range cmd.Names() {\n\t\t\t\tif filter == \"\" || strings.HasPrefix(strings.ToLower(name), strings.ToLower(filter)) {\n\t\t\t\t\tdi.GetOutput().Println(name)\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\tapp.Writer = di.GetOutput()\n\tapp.ErrWriter = di.GetOutput()\n\n\treturn app\n}", "title": "" }, { "docid": "e053b72b27dda27b75c724242603d41b", "score": "0.5750121", "text": "func NewApp() *cli.App {\n\tapp := cli.NewApp()\n\tapp.Flags = []cli.Flag{\n\t\tcli.StringFlag{\n\t\t\tName: modeFlag,\n\t\t\tUsage: \"app running mode\",\n\t\t\tValue: developmentMode,\n\t\t},\n\t\tcli.StringFlag{\n\t\t\tName: deployment.Flag,\n\t\t\tUsage: \"Kyber Network deployment name\",\n\t\t\tValue: productionMode,\n\t\t},\n\t}\n\tapp.Flags = append(app.Flags, NewSentryFlags()...)\n\treturn app\n}", "title": "" }, { "docid": "b5eb482172b21034be279db1d46158b8", "score": "0.573328", "text": "func NewCliApp(commands []Command) Cli {\n\tcliInstance := cli{\n\t\tconfig: commands,\n\t}\n\n\treturn &cliInstance\n}", "title": "" }, { "docid": "6ee1916cf9644601b083313540739f43", "score": "0.57156914", "text": "func NewCliApp() *cli.App {\n\tapp := cli.NewApp()\n\tapp.Name = \"cadence\"\n\tapp.Usage = \"A command-line tool for cadence users\"\n\tapp.Version = Version\n\tapp.Flags = []cli.Flag{\n\t\tcli.StringFlag{\n\t\t\tName: FlagAddressWithAlias,\n\t\t\tValue: \"\",\n\t\t\tUsage: \"host:port for cadence frontend service\",\n\t\t\tEnvVar: \"CADENCE_CLI_ADDRESS\",\n\t\t},\n\t\tcli.StringFlag{\n\t\t\tName: FlagDomainWithAlias,\n\t\t\tUsage: \"cadence workflow domain\",\n\t\t\tEnvVar: \"CADENCE_CLI_DOMAIN\",\n\t\t},\n\t\tcli.IntFlag{\n\t\t\tName: FlagContextTimeoutWithAlias,\n\t\t\tValue: defaultContextTimeoutInSeconds,\n\t\t\tUsage: \"optional timeout for context of RPC call in seconds\",\n\t\t\tEnvVar: \"CADENCE_CONTEXT_TIMEOUT\",\n\t\t},\n\t}\n\tapp.Commands = []cli.Command{\n\t\t{\n\t\t\tName: \"domain\",\n\t\t\tAliases: []string{\"d\"},\n\t\t\tUsage: \"Operate cadence domain\",\n\t\t\tSubcommands: newDomainCommands(),\n\t\t},\n\t\t{\n\t\t\tName: \"workflow\",\n\t\t\tAliases: []string{\"wf\"},\n\t\t\tUsage: \"Operate cadence workflow\",\n\t\t\tSubcommands: newWorkflowCommands(),\n\t\t},\n\t\t{\n\t\t\tName: \"tasklist\",\n\t\t\tAliases: []string{\"tl\"},\n\t\t\tUsage: \"Operate cadence tasklist\",\n\t\t\tSubcommands: newTaskListCommands(),\n\t\t},\n\t\t{\n\t\t\tName: \"admin\",\n\t\t\tAliases: []string{\"adm\"},\n\t\t\tUsage: \"Run admin operation\",\n\t\t\tSubcommands: []cli.Command{\n\t\t\t\t{\n\t\t\t\t\tName: \"workflow\",\n\t\t\t\t\tAliases: []string{\"wf\"},\n\t\t\t\t\tUsage: \"Run admin operation on workflow\",\n\t\t\t\t\tSubcommands: newAdminWorkflowCommands(),\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tName: \"shard\",\n\t\t\t\t\tAliases: []string{\"shar\"},\n\t\t\t\t\tUsage: \"Run admin operation on specific shard\",\n\t\t\t\t\tSubcommands: newAdminShardManagementCommands(),\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tName: \"history_host\",\n\t\t\t\t\tAliases: []string{\"hist\"},\n\t\t\t\t\tUsage: \"Run admin operation on history host\",\n\t\t\t\t\tSubcommands: newAdminHistoryHostCommands(),\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tName: \"kafka\",\n\t\t\t\t\tAliases: []string{\"ka\"},\n\t\t\t\t\tUsage: \"Run admin operation on kafka messages\",\n\t\t\t\t\tSubcommands: newAdminKafkaCommands(),\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tName: \"domain\",\n\t\t\t\t\tAliases: []string{\"d\"},\n\t\t\t\t\tUsage: \"Run admin operation on domain\",\n\t\t\t\t\tSubcommands: newAdminDomainCommands(),\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tName: \"elasticsearch\",\n\t\t\t\t\tAliases: []string{\"es\"},\n\t\t\t\t\tUsage: \"Run admin operation on ElasticSearch\",\n\t\t\t\t\tSubcommands: newAdminElasticSearchCommands(),\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tName: \"tasklist\",\n\t\t\t\t\tAliases: []string{\"tl\"},\n\t\t\t\t\tUsage: \"Run admin operation on taskList\",\n\t\t\t\t\tSubcommands: newAdminTaskListCommands(),\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tName: \"cluster\",\n\t\t\t\t\tAliases: []string{\"cl\"},\n\t\t\t\t\tUsage: \"Run admin operation on cluster\",\n\t\t\t\t\tSubcommands: newAdminClusterCommands(),\n\t\t\t\t},\n\t\t\t},\n\t\t},\n\t\t{\n\t\t\tName: \"cluster\",\n\t\t\tAliases: []string{\"cl\"},\n\t\t\tUsage: \"Operate cadence cluster\",\n\t\t\tSubcommands: newClusterCommands(),\n\t\t},\n\t}\n\n\t// set builder if not customized\n\tif cFactory == nil {\n\t\tSetFactory(NewClientFactory())\n\t}\n\treturn app\n}", "title": "" }, { "docid": "e587308cdb85471e3bacead2304c035e", "score": "0.5698301", "text": "func getAppId(accessToken, environment, appName, appOwner string) (string, error) {\n\t// Application REST API endpoint of the environment from the config file\n\tapplicationEndpoint := utils.GetAdminApplicationListEndpointOfEnv(environment, utils.MainConfigFilePath) +\n\t\t\"?user=\" + appOwner + \"&name=\" + appName\n\n\t// Prepping headers\n\theaders := make(map[string]string)\n\theaders[utils.HeaderAuthorization] = utils.HeaderValueAuthBearerPrefix + \" \" + accessToken\n\tresp, err := utils.InvokeGETRequest(applicationEndpoint, headers)\n\n\tif resp.StatusCode() == http.StatusOK || resp.StatusCode() == http.StatusCreated {\n\t\t// 200 OK or 201 Created\n\t\tappData := &utils.AppList{}\n\t\tdata := []byte(resp.Body())\n\t\terr = json.Unmarshal(data, &appData)\n\t\tappId := \"\"\n\t\tif appData.Count != 0 {\n\t\t\tfor _, app := range appData.List {\n\t\t\t\tif app.Name == appName {\n\t\t\t\t\tappId = app.ApplicationID\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn appId, err\n\t\t}\n\t\treturn \"\", errors.New(\"Cannot find the application: \" + appName + \" for owner: \" + appOwner)\n\n\t} else {\n\t\tutils.Logf(\"Error: %s\\n\", resp.Error())\n\t\tutils.Logf(\"Body: %s\\n\", resp.Body())\n\t\tif resp.StatusCode() == http.StatusUnauthorized {\n\t\t\t// 401 Unauthorized\n\t\t\treturn \"\", fmt.Errorf(\"Authorization failed while searching CLI application: \" + appName)\n\t\t}\n\t\treturn \"\", errors.New(\"Request didn't respond 200 OK for searching existing applications. \" +\n\t\t\t\"Status: \" + resp.Status())\n\t}\n}", "title": "" }, { "docid": "27f5e5878dbb14425498401d0029e2f1", "score": "0.5690677", "text": "func GetApp(s Snapshot, name string) (app *App, err error) {\n\tapp = NewApp(name, \"\", \"\", s)\n\n\tf, err := Get(s, app.Path.Prefix(\"attrs\"), new(JSONCodec))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tvalue := f.Value.(map[string]interface{})\n\n\tapp.RepoUrl = value[\"repo-url\"].(string)\n\tapp.Stack = Stack(value[\"stack\"].(string))\n\tapp.DeployType = value[\"deploy-type\"].(string)\n\n\treturn\n}", "title": "" }, { "docid": "52fd20569f282a38d5554a58980c7dec", "score": "0.56903076", "text": "func mainApp() (err error) {\n\terr = swagger.ProcessProject(\n\t\tviper.GetString(\"project_folder\"),\n\t\tviper.GetString(\"api_host\"),\n\t\tviper.GetString(\"api_basepath\"),\n\t\tstrings.Split(viper.GetString(\"api_scheme\"), \",\"),\n\t\tviper.GetBool(\"verbose\"),\n\t\tviper.GetString(\"output\"),\n\t)\n\treturn\n}", "title": "" }, { "docid": "d5dbb98e65bfedbdc5e0f3c27317419d", "score": "0.5689337", "text": "func (r *Applications) GetApp(locator loc.Locator) (*appservice.Application, error) {\n\tif locator.IsEqualTo(appservice.Phony.Package) {\n\t\treturn appservice.Phony, nil\n\t}\n\n\tlocator, err := r.processMetadata(locator)\n\tif err != nil {\n\t\treturn nil, trace.Wrap(err)\n\t}\n\n\tenvelope, err := r.config.Packages.ReadPackageEnvelope(locator)\n\tif err != nil {\n\t\treturn nil, trace.Wrap(err)\n\t}\n\n\treturn toApp(*envelope, r)\n}", "title": "" }, { "docid": "5319cd89ecb1442d3aed6e0c78eada74", "score": "0.56784475", "text": "func Cli() *cli.App {\n\tapp := cli.NewApp()\n\tcli.HelpFlag = cli.BoolFlag{\n\t\tName: \"h\",\n\t\tDestination: &MainFlagVal.Help,\n\t}\n\tcli.VersionFlag = cli.BoolFlag{\n\t\tName: \"v\",\n\t\tDestination: &MainFlagVal.Version,\n\t}\n\tapp.Name = \"kms-pass\"\n\tapp.Usage = \"The cloud password manager\"\n\tapp.Commands = []cli.Command{\n\t\tsftpConfCli,\n\t}\n\tapp.Flags = mainCliFlags\n\treturn app\n}", "title": "" }, { "docid": "b8b9527da55ec7f2b775bb6294f92f49", "score": "0.5668375", "text": "func AppConfig() ClientConfig {\n\tvar config ClientConfig\n\tif err := viper.Unmarshal(&config); err != nil {\n\t\tpanic(err.Error())\n\t}\n\n\treturn config\n}", "title": "" }, { "docid": "ad43b1cf0e7d017969dc01d954f97661", "score": "0.5664361", "text": "func getAddAppCommand() *cobra.Command {\n\tcmd := &cobra.Command{\n\t\tUse: \"app [args]\",\n\t\tShort: \"Add an app to the test cluster\",\n\t\tArgs: cobra.ArbitraryArgs,\n\t\tRunE: runInCluster(runAddAppCommand),\n\t}\n\n\tcmd.Flags().StringP(\"name\", \"n\", \"\", \"the name of the app to add\")\n\tcmd.Flags().StringP(\"image\", \"i\", \"\", \"the image to deploy\")\n\t_ = cmd.MarkFlagRequired(\"image\")\n\tcmd.Flags().IntP(\"replicas\", \"r\", 1, \"the number of replicas to deploy\")\n\tcmd.Flags().String(\"image-pull-policy\", string(corev1.PullIfNotPresent), \"the Docker image pull policy\")\n\tcmd.Flags().StringToIntP(\"port\", \"p\", map[string]int{}, \"ports to expose\")\n\tcmd.Flags().BoolP(\"debug\", \"d\", false, \"enable debug mode\")\n\tcmd.Flags().StringToStringP(\"secret\", \"s\", map[string]string{}, \"secrets to add to the application\")\n\tcmd.Flags().Bool(\"privileged\", false, \"run the application in privileged mode\")\n\tcmd.Flags().IntP(\"user\", \"u\", -1, \"set the user with which to run the application\")\n\tcmd.Flags().StringToStringP(\"env\", \"e\", map[string]string{}, \"set environment variables\")\n\treturn cmd\n}", "title": "" }, { "docid": "baddd96c6098350e0d9564d02e0e964f", "score": "0.56533617", "text": "func (s *Server) GetApp() *model.App {\n\treturn s.app\n}", "title": "" }, { "docid": "ad4cc5de3f1276765bf013a631e2b84f", "score": "0.5649529", "text": "func GetAppInfo(appID string) (*GetAppInfoResult, error) {\n\tclient := NewClientByApp(appID)\n\n\tresp, err := client.get(\"/1.1/clients/self/apps/\"+appID, nil)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tresult := new(GetAppInfoResult)\n\terr = resp.JSON(result)\n\treturn result, err\n}", "title": "" }, { "docid": "e3620333f245ec0fd3c2b9b177d4d8c1", "score": "0.563717", "text": "func (c *CR2UX) getApp(ctx context.Context, name, namespace string) (*model.Application, string, error) {\n\talreadyCreated := &model.Application{Name: formatAppComposedName(name, namespace)}\n\terr1 := c.ds.Get(ctx, alreadyCreated)\n\tif err1 == nil {\n\t\treturn alreadyCreated, alreadyCreated.Name, nil\n\t}\n\n\t// check if it's created the first in database\n\texistApp := &model.Application{Name: name}\n\terr2 := c.ds.Get(ctx, existApp)\n\tif err2 == nil {\n\t\ten := existApp.Labels[model.LabelSyncNamespace]\n\t\t// it means the namespace/app is not created yet, the appname is occupied by app from other namespace\n\t\tif en != namespace {\n\t\t\treturn nil, formatAppComposedName(name, namespace), err1\n\t\t}\n\t\treturn existApp, name, nil\n\t}\n\treturn nil, name, err2\n}", "title": "" }, { "docid": "ee9035090df0b8799d3474eff553ea60", "score": "0.563084", "text": "func (_self *Client) GetAppConfig(longPull bool, lastIndex int) (*PullAppResult, error) {\n\turl := _self.url + \"/api/config\" + \"?token=\" + _self.token\n\tif longPull {\n\t\turl = url + \"&longPull=true&lastIndex=\" + strconv.Itoa(lastIndex)\n\t}\n\n\tresult, code, err := _self.get(url)\n\tif code != http.StatusOK || err != nil {\n\t\treturn nil, errors.New(\"request error, status: \" + strconv.Itoa(code))\n\t}\n\n\tvar appResult PullAppResult\n\tif err := json.Unmarshal([]byte(result), &appResult); err != nil {\n\t\treturn nil, errors.New(\"decode error, detail: \" + err.Error())\n\t}\n\treturn &appResult, nil\n}", "title": "" }, { "docid": "30bcd819cdb95fab99c07f012048b34a", "score": "0.5622817", "text": "func getAddAppCommand() *cobra.Command {\n\tcmd := &cobra.Command{\n\t\tUse: \"app image-name [name]\",\n\t\tShort: \"Add an app to the test cluster\",\n\t\tArgs: cobra.MaximumNArgs(1),\n\t\tRun: func(cmd *cobra.Command, args []string) {\n\t\t\tvar name string\n\t\t\tif len(args) == 1 {\n\t\t\t\tname = args[0]\n\t\t\t}\n\n\t\t\t// If the name is not set, assign a generic UUID based name.\n\t\t\tif name == \"\" {\n\t\t\t\tname = fmt.Sprintf(\"app-%d\", newUUIDInt())\n\t\t\t}\n\n\t\t\timage, _ := cmd.Flags().GetString(\"image\")\n\t\t\timagePullPolicy, _ := cmd.Flags().GetString(\"image-pull-policy\")\n\t\t\tpullPolicy := corev1.PullPolicy(imagePullPolicy)\n\n\t\t\tif pullPolicy != corev1.PullAlways && pullPolicy != corev1.PullIfNotPresent && pullPolicy != corev1.PullNever {\n\t\t\t\texitError(fmt.Errorf(\"invalid pull policy; must of one of %s, %s or %s\", corev1.PullAlways, corev1.PullIfNotPresent, corev1.PullNever))\n\t\t\t}\n\n\t\t\t// Get the onit controller\n\t\t\tcontroller, err := k8s.NewController()\n\t\t\tif err != nil {\n\t\t\t\texitError(err)\n\t\t\t}\n\n\t\t\t// Get the cluster ID\n\t\t\tclusterID, err := cmd.Flags().GetString(\"cluster\")\n\t\t\tif err != nil {\n\t\t\t\texitError(err)\n\t\t\t}\n\n\t\t\t// Get the cluster controller\n\t\t\tcluster, err := controller.GetCluster(clusterID)\n\t\t\tif err != nil {\n\t\t\t\texitError(err)\n\t\t\t}\n\n\t\t\t// Create the app configuration\n\t\t\tconfig := &k8s.AppConfig{\n\t\t\t\tImage: image,\n\t\t\t\tPullPolicy: pullPolicy,\n\t\t\t}\n\n\t\t\t// Add the app to the cluster\n\t\t\tif status := cluster.AddApp(name, config); status.Failed() {\n\t\t\t\texitStatus(status)\n\t\t\t} else {\n\t\t\t\tfmt.Println(name)\n\t\t\t}\n\t\t},\n\t}\n\n\tcmd.Flags().StringP(\"image\", \"i\", \"\", \"the image name\")\n\t_ = cmd.MarkFlagRequired(\"image\")\n\tcmd.Flags().String(\"image-pull-policy\", string(corev1.PullIfNotPresent), \"the Docker image pull policy\")\n\tcmd.Flags().StringP(\"cluster\", \"c\", getDefaultCluster(), \"the cluster to which to add the app\")\n\tcmd.Flags().Lookup(\"cluster\").Annotations = map[string][]string{\n\t\tcobra.BashCompCustom: {\"__onit_get_clusters\"},\n\t}\n\treturn cmd\n}", "title": "" }, { "docid": "4fbcbc34ce12f556bef962678b2fd11b", "score": "0.5610619", "text": "func GetDefaultTestApp() *app.App {\n\tviper.SetConfigFile(\"../config/test.yaml\")\n\tapp := app.GetApp(\"0.0.0.0\", 8888, true)\n\n\treturn app\n}", "title": "" }, { "docid": "ad60b335b2cd045bed6ed9500490b014", "score": "0.5598582", "text": "func GetAppReference(ctx *cli.Context) (vapp *App) {\n\tmetadata := ctx.App.Metadata\n\tfmt.Println(metadata)\n\tvi, found := metadata[\"teak\"]\n\tif found {\n\t\tvapp, _ = vi.(*App)\n\t}\n\treturn vapp\n}", "title": "" }, { "docid": "ba740154527a6d3fa4618f3478d4aa44", "score": "0.55756885", "text": "func (c *Config) AppName() string {\n\tif len(c.ExecArray()) > 0 {\n\t\treturn c.ExecArray()[0]\n\t}\n\n\treturn \"\"\n}", "title": "" }, { "docid": "75a929c54a2b5e460864fdd9bd201462", "score": "0.5562206", "text": "func GetAppByName(client *fnclient.Fn, appName string) (*modelsv2.App, error) {\n\tappsResp, err := client.Apps.ListApps(&apiapps.ListAppsParams{\n\t\tContext: context.Background(),\n\t\tName: &appName,\n\t})\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tvar app *modelsv2.App\n\tif len(appsResp.Payload.Items) > 0 {\n\t\tapp = appsResp.Payload.Items[0]\n\t} else {\n\t\treturn nil, NameNotFoundError{appName}\n\t}\n\n\treturn app, nil\n}", "title": "" }, { "docid": "503febeb059e06c2ce3555f977dc1619", "score": "0.5556367", "text": "func NewApp() *App {\n\treturn &App{\n\t\tName: filepath.Base(os.Args[0]),\n\t\tHelpName: filepath.Base(os.Args[0]),\n\t\tUsage: \"A new cli application\",\n\t\tUsageText: \"\",\n\t\tBashComplete: DefaultAppComplete,\n\t\tAction: helpCommand.Action,\n\t\tCompiled: compileTime(),\n\t\tWriter: os.Stdout,\n\t}\n}", "title": "" }, { "docid": "c42f1479d7b94180865c1efac7de0da5", "score": "0.55442727", "text": "func NewApp() *cli.App {\n\tapp := cli.NewApp()\n\tapp.Version = climbcomp.VERSION\n\tapp.Usage = \"A competition climbing API\"\n\tapp.EnableBashCompletion = true\n\n\tapp.Commands = []cli.Command{\n\t\t{\n\t\t\tName: \"server\",\n\t\t\tUsage: \"Starts the climbcomp server\",\n\t\t\tAction: OnServerCmd,\n\t\t},\n\t\t{\n\t\t\tName: \"meta\",\n\t\t\tUsage: \"Meta API commands\",\n\t\t\tSubcommands: []cli.Command{\n\t\t\t\t{\n\t\t\t\t\tName: \"version\",\n\t\t\t\t\tUsage: \"Returns the server version\",\n\t\t\t\t\tAction: OnMetaVersionCmd,\n\t\t\t\t},\n\t\t\t},\n\t\t},\n\t}\n\n\treturn app\n}", "title": "" }, { "docid": "54c3f3bdce397bb74736af7e96c5fdf5", "score": "0.5536446", "text": "func (c* Config) GetProgram( name string) *ConfigEntry {\n\tfor _, entry := range c.entries {\n\t\tif entry.IsProgram() && entry.GetProgramName() == name {\n\t\t\treturn entry\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "c8b47dc6b91f56a987563a4a5d531b49", "score": "0.5517679", "text": "func (c *AppClient) Get(ctx context.Context, guid string) (*resource.App, error) {\n\tvar app resource.App\n\terr := c.client.get(ctx, path.Format(\"/v3/apps/%s\", guid), &app)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn &app, nil\n}", "title": "" }, { "docid": "84fea9603e5d9500962cc0eefd98f7bd", "score": "0.5513549", "text": "func GetConfig() (AppConfig, error) {\n\tvar cfg AppConfig\n\terr := envconfig.Process(\"\", &cfg)\n\tif err != nil {\n\t\tfmt.Println(err)\n\t}\n\treturn cfg, nil\n}", "title": "" }, { "docid": "477a0c7e52566477ed7dc9b02074ea48", "score": "0.5512497", "text": "func NewApp() *Application {\n\ta := cli.NewApp()\n\ta.Usage = \"A console application\"\n\ta.Metadata = make(map[string]interface{})\n\treturn a\n}", "title": "" }, { "docid": "a351608f483703099fbc9ffe694731fc", "score": "0.5507188", "text": "func (permissions *Permissionist) GetApp(appID string) (App, error) {\n\tvar app App\n\terr := permissions.DB.Get(&app, `\n\tSELECT id, name\n\tFROM apps\n\tWHERE id = $1;\n\t`, appID)\n\n\tif err != nil {\n\t\treturn app, errors.Wrap(err, \"Could not get app\")\n\t}\n\n\treturn app, nil\n}", "title": "" }, { "docid": "e303adfce28656ff6f4af4bf77ae65ae", "score": "0.5501951", "text": "func New(name, usage, version string) *cli.App {\n\tapp := cli.NewApp()\n\tapp.Name = name\n\tapp.Usage = usage\n\tapp.Version = version\n\tapp.Commands = commands()\n\treturn app\n}", "title": "" }, { "docid": "c7967b082ff0d82c596703cf8ed648e6", "score": "0.5481097", "text": "func New(version string) *CliApp {\n\tio := cli.NewApp()\n\tio.Version = version\n\tio.Usage = \"An acceptance testing tool for Algolia indexes\"\n\tio.Flags = flags\n\n\tif len(os.Args) > 1 {\n\t\tio.Action = validate(Run)\n\t} else {\n\t\tio.Action = cli.ShowAppHelp\n\t}\n\n\tcliApp := CliApp{Io: io}\n\n\treturn &cliApp\n}", "title": "" }, { "docid": "b771d011c4f944325bd6cea73531a6ab", "score": "0.5467353", "text": "func (aaa *ItemService) GetApp(input *item.GetAppParams) (*platformclientmodels.FullAppInfo, error) {\n\ttoken, err := aaa.TokenRepository.GetToken()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tok, err := aaa.Client.Item.GetApp(input, client.BearerToken(*token.AccessToken))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn ok.GetPayload(), nil\n}", "title": "" }, { "docid": "07087dd5f1935507021d411d7a7cdd22", "score": "0.54662186", "text": "func NewApp(gitCommit, usage string) *cli.App {\n\tapp := cli.NewApp()\n\tapp.Name = filepath.Base(os.Args[0])\n\tapp.Author = \"\"\n\t//app.Authors = nil\n\tapp.Email = \"\"\n\tapp.Version = params.Version\n\tif len(gitCommit) >= 8 {\n\t\tapp.Version += \"-\" + gitCommit[:8]\n\t}\n\tapp.Usage = usage\n\treturn app\n}", "title": "" }, { "docid": "8bab294ca43b39111dee4775ad2bd772", "score": "0.5427652", "text": "func (c *Client) GetAppInfo() (*ResponseMessage, error) {\n\tinfo := new(ResponseMessage)\n\tc.Get(\"app/details\", info)\n\treturn info, nil\n}", "title": "" }, { "docid": "bb1af26f2dd8d0604072d2951ecf45a3", "score": "0.5421209", "text": "func NewApp(name string, addDefaults bool) *App {\n\tif name == \"\" {\n\t\tname = filepath.Base(os.Args[0])\n\t}\n\n\tapp := &App{\n\t\tName: name,\n\t\tCommands: make([]*Command, 0),\n\t\tOutput: os.Stdout,\n\t\tErrOutput: os.Stderr,\n\t\tInput: os.Stdin,\n\t}\n\n\tif addDefaults {\n\t\tfor _, cmd := range DefaultCommands {\n\t\t\tif err := app.AddCommand(*cmd); err != nil {\n\t\t\t\tpanic(err)\n\t\t\t}\n\t\t}\n\t}\n\n\treturn app\n}", "title": "" }, { "docid": "0c47092fa5306ce8a4bc4f4770640e5e", "score": "0.5419984", "text": "func (rm *ResourceManager) GetApp(mode table.AppMode) uint32 {\n\treturn rm.App[mode][0]\n}", "title": "" }, { "docid": "0b14388c3408cad87c63df3046c189ce", "score": "0.54049844", "text": "func (m *Node) getApp() http.HandlerFunc {\n\treturn m.withCtx(m.appCtx, func(w http.ResponseWriter, r *http.Request, ctx *httpCtx) {\n\t\thttputil.WriteJSON(w, r, http.StatusOK, ctx.App)\n\t})\n}", "title": "" }, { "docid": "c170f182e077f0ae50d13f7ffae3e90d", "score": "0.540264", "text": "func LoadAppCfg() (*infra.AppCfg, error) {\n\tvar cfg infra.AppCfg\n\tif err := envconfig.Process(\"APP\", &cfg); err != nil {\n\t\treturn nil, err\n\t}\n\treturn &cfg, nil\n}", "title": "" }, { "docid": "e2f9bb010400403ffa47f38f5b3776d4", "score": "0.53789264", "text": "func (p *processer) GetAppInfo(name Hash) *AppInfo {\n\tout := AppInfo{}\n\tval, _ := p.pDbApp.Get(name[:])\n\tif len(val) == 0 {\n\t\treturn nil\n\t}\n\tp.Decode(0, val, &out)\n\treturn &out\n}", "title": "" }, { "docid": "2a2a4f767941c72c006a4d7920850206", "score": "0.5374839", "text": "func (c *SmartThingsClient) AppGet(app string) (*App, error) {\n\treq, err := c.newRequest(http.MethodGet, fmt.Sprintf(\"/v1/apps/%s\", app), nil)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tvar appResult App\n\t_, err = c.do(req, &appResult)\n\treturn &appResult, err\n}", "title": "" }, { "docid": "a8402ffdce239694af6ba72f33b92d06", "score": "0.5374051", "text": "func (r *swanClient) GetApplication(appID string) (*types.App, error) {\n\tresult := new(types.App)\n\tif err := r.apiGet(APIApps+\"/\"+appID, nil, result); err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn result, nil\n}", "title": "" }, { "docid": "1167b5723fa268f071b0be5246fd7947", "score": "0.53708726", "text": "func Generate() *cli.App {\n\tapp := cli.NewApp()\n\tapp.Name = \"server-info\"\n\tapp.Usage = \"Search IP Address and Names on internet\"\n\n\tflags := []cli.Flag{\n\t\tcli.StringFlag{\n\t\t\tName: \"host\",\n\t\t\tValue: defaultHost,\n\t\t},\n\t}\n\n\tapp.Commands = []cli.Command{\n\t\t{\n\t\t\tName: \"ips\",\n\t\t\tUsage: \"Search IP Address in internet\",\n\t\t\tFlags: flags,\n\t\t\tAction: ips,\n\t\t},\n\t\t{\n\t\t\tName: \"servers\",\n\t\t\tUsage: \"Search Server Names in internet\",\n\t\t\tFlags: flags,\n\t\t\tAction: servers,\n\t\t},\n\t}\n\n\treturn app\n}", "title": "" }, { "docid": "21876ac2c638e098edcec2b401c9c66c", "score": "0.53474796", "text": "func Get() *Config {\n\tmu.Lock()\n\tdefer mu.Unlock()\n\n\treturn appConfig\n}", "title": "" }, { "docid": "b8ff6b3bd5f0f3b01c9eea197bbe1fde", "score": "0.5347117", "text": "func Cli(args []string) int {\n\n\tapp := &cli.App{\n\t\tName: \"backlogcli\",\n\t\tVersion: Version,\n\t\tUsage: \"A CLI application for Backlog users.\",\n\t\tCommands: []*cli.Command{\n\t\t\t{\n\t\t\t\tName: \"user\",\n\t\t\t\tAliases: []string{\"u\"},\n\t\t\t\tUsage: \"List of users in your space.\",\n\t\t\t\tSubcommands: []*cli.Command{\n\t\t\t\t\t{\n\t\t\t\t\t\tName: \"list\",\n\t\t\t\t\t\tAliases: []string{\"ls\"},\n\t\t\t\t\t\tUsage: \"List of users.\",\n\t\t\t\t\t\tAction: func(c *cli.Context) error {\n\t\t\t\t\t\t\t\tif err := UserList(); err != nil {\n\t\t\t\t\t\t\t\t\treturn err\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},\n\t\t\t\t},\n\t\t\t},\n\t\t\t{\n\t\t\t\tName: \"act\",\n\t\t\t\tAliases: []string{\"a\"},\n\t\t\t\tUsage: \"Recent updates in your space.\",\n\t\t\t\tAction: func(c *cli.Context) error {\n\t\t\t\t\tif err := ActivityList(); err != nil {\n\t\t\t\t\t\treturn err\n\t\t\t\t\t}\n\t\t\t\t\treturn nil\n\t\t\t\t},\n\t\t\t},\n\t\t\t{\n\t\t\t\tName: \"notify\",\n\t\t\t\tAliases: []string{\"n\"},\n\t\t\t\tUsage: \"Updates space notification.\",\n\t\t\t\tAction: func(c *cli.Context) error {\n\t\t\t\t\tif err := NotifyList(); err != nil {\n\t\t\t\t\t\treturn err\n\t\t\t\t\t}\n\t\t\t\t\treturn nil\n\t\t\t\t},\n\t\t\t},\n\t\t\t{\n\t\t\t\tName: \"space\",\n\t\t\t\tAliases: []string{\"s\"},\n\t\t\t\tUsage: \"Information about space disk usage.\",\n\t\t\t\tAction: func(c *cli.Context) error {\n\t\t\t\t\tif err := SpaceUsage(); err != nil {\n\t\t\t\t\t\treturn err\n\t\t\t\t\t}\n\t\t\t\t\treturn nil\n\t\t\t\t},\n\t\t\t},\n\t\t\t{\n\t\t\t\tName: \"project\",\n\t\t\t\tAliases: []string{\"p\"},\n\t\t\t\tUsage: \"Operations project\",\n\t\t\t\tSubcommands: []*cli.Command{\n\t\t\t\t\t{\n\t\t\t\t\t\tName: \"list\",\n\t\t\t\t\t\tAliases: []string{\"ls\"},\n\t\t\t\t\t\tUsage: \"List of projects.\",\n\t\t\t\t\t\tAction: func(c *cli.Context) error {\n\t\t\t\t\t\t\tif err := ProjectList(); err != nil {\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\treturn nil\n\t\t\t\t\t\t},\n\t\t\t\t\t},\n\t\t\t\t\t{\n\t\t\t\t\t\tName: \"info\",\n\t\t\t\t\t\tUsage: \"print information about the project.\",\n\t\t\t\t\t\tAction: func(c *cli.Context) error {\n\t\t\t\t\t\t\tprojectKey := c.Args().First()\n\t\t\t\t\t\t\tif projectKey == \"\" {\n\t\t\t\t\t\t\t\terr := fmt.Errorf(\"Error: Argument not found. %s\", \"Project key\")\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\tif err := ProjectInfo(projectKey); err != nil {\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\treturn nil\n\t\t\t\t\t\t},\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t},\n\t\t\t{\n\t\t\t\tName: \"issue\",\n\t\t\t\tAliases: []string{\"i\"},\n\t\t\t\tUsage: \"Operations issue\",\n\t\t\t\tSubcommands: []*cli.Command{\n\t\t\t\t\t{\n\t\t\t\t\t\tName: \"list\",\n\t\t\t\t\t\tAliases: []string{\"ls\"},\n\t\t\t\t\t\tUsage: \"List of issues.\",\n\t\t\t\t\t\tAction: func(c *cli.Context) error {\n\t\t\t\t\t\t\tif err := IssueList(); err != nil {\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\treturn nil\n\t\t\t\t\t\t},\n\t\t\t\t\t},\n\t\t\t\t\t{\n\t\t\t\t\t\tName: \"info\",\n\t\t\t\t\t\tUsage: \"Information of issues.\",\n\t\t\t\t\t\tAction: func(c *cli.Context) error {\n\t\t\t\t\t\t\tif err := IssueInfo(c.Args().First()); err != nil {\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\treturn nil\n\t\t\t\t\t\t},\n\t\t\t\t\t},\n\t\t\t\t\t{\n\t\t\t\t\t\tName: \"add\",\n\t\t\t\t\t\tUsage: \"Add issue.\",\n\t\t\t\t\t\tAction: func(c *cli.Context) error {\n\t\t\t\t\t\t\tfile := c.Args().First()\n\t\t\t\t\t\t\tif err := IssueAdd(file); err != nil {\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\treturn nil\n\t\t\t\t\t\t},\n\t\t\t\t\t},\n\t\t\t\t\t{\n\t\t\t\t\t\tName: \"update\",\n\t\t\t\t\t\tUsage: \"Update issue.\",\n\t\t\t\t\t\tAliases: []string{\"u\"},\n\t\t\t\t\t\tFlags: []cli.Flag{\n\t\t\t\t\t\t\t&cli.StringFlag{Name: \"file\", Aliases: []string{\"f\"}},\n\t\t\t\t\t\t\t&cli.StringFlag{Name: \"status\", Aliases: []string{\"s\"}},\n\t\t\t\t\t\t\t&cli.StringFlag{Name: \"assignee\", Aliases: []string{\"a\"}},\n\t\t\t\t\t\t\t&cli.StringFlag{Name: \"comment\", Aliases: []string{\"c\"}},\n\t\t\t\t\t\t\t&cli.StringSliceFlag{Name: \"notify\", Aliases: []string{\"n\"}},\n\t\t\t\t\t\t},\n\t\t\t\t\t\tAction: func(c *cli.Context) error {\n\t\t\t\t\t\t\tfile := c.String(\"file\")\n\t\t\t\t\t\t\tstatus := c.String(\"status\")\n\t\t\t\t\t\t\tassignee := c.String(\"assignee\")\n\t\t\t\t\t\t\tcomment := c.String(\"comment\")\n\t\t\t\t\t\t\t//notifiedUsers := c.StringSlice(\"notify\")\n\t\t\t\t\t\t\t//for i, n := range notifiedUsers {\n\t\t\t\t\t\t\t//\tfmt.Printf(\"notify:%d %s\\n\", i, n)\n\t\t\t\t\t\t\t//}\n\t\t\t\t\t\t\tissueKey := c.Args().First()\n\t\t\t\t\t\t\terr := IssueUpdate(file, status, assignee, comment, issueKey)\n\t\t\t\t\t\t\tif err != nil {\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\treturn nil\n\t\t\t\t\t\t},\n\t\t\t\t\t},\n\t\t\t\t\t{\n\t\t\t\t\t\tName: \"delete\",\n\t\t\t\t\t\tUsage: \"Deletes issue.\",\n\t\t\t\t\t\tAction: func(c *cli.Context) error {\n\t\t\t\t\t\t\tif err := IssueDelete(c.Args().First()); err != nil {\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\treturn nil\n\t\t\t\t\t\t},\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t},\n\t\t\t{\n\t\t\t\tName: \"comment\",\n\t\t\t\tAliases: []string{\"c\"},\n\t\t\t\tUsage: \"Operations comment\",\n\t\t\t\tSubcommands: []*cli.Command{\n\t\t\t\t\t{\n\t\t\t\t\t\tName: \"add\",\n\t\t\t\t\t\tUsage: \"Add comment.\",\n\t\t\t\t\t\tAction: func(c *cli.Context) error {\n\t\t\t\t\t\t\tif err := CommentAdd(c.Args().First(), c.Args().Get(1)); err != nil {\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\treturn nil\n\t\t\t\t\t\t},\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t},\n\t\t},\n\t}\n\n\tif err := app.Run(os.Args); err != nil {\n\t\tfmt.Fprintln(os.Stderr, err)\n\t\treturn ExitCodeError\n\t}\n\treturn ExitCodeOK\n}", "title": "" }, { "docid": "f5b4b2cb79f8c0512717514b21e6f41c", "score": "0.53322554", "text": "func main() {\n\tflag.Parse()\n\tappName := flag.Arg(0)\n\n\tresource.ReportSingleApp(appName, \"\")\n}", "title": "" }, { "docid": "2ad38398aadd41b18f7dac2eeb972b85", "score": "0.5319088", "text": "func Conf() *AppConf {\n\tappConf := ConfMgr()\n\tif appConf != nil && appConf.Confs != nil {\n\t\tif flagAppKey == \"\" {\n\t\t\treturn appConf.frist\n\t\t}\n\t\tc, ok := appConf.Confs[flagAppKey]\n\t\tif c != nil && ok {\n\t\t\treturn c\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "261ad8a9e9fe13a8e597bae444023e38", "score": "0.5317245", "text": "func NewApp() *cobra.Command {\n\tc := &cobra.Command{\n\t\tUse: \"app [github.com/org/repo]\",\n\t\tShort: \"Generates an empty application\",\n\t\tArgs: cobra.ExactArgs(1),\n\t\tRunE: appHandler,\n\t}\n\tc.Flags().String(\"address-prefix\", \"cosmos\", \"Address prefix\")\n\taddSdkVersionFlag(c)\n\treturn c\n}", "title": "" }, { "docid": "3a9c4922b8996221ccf2f6e0a9c67aca", "score": "0.52991694", "text": "func New(router *huma.Router) *CLI {\n\tviper.SetEnvPrefix(\"SERVICE\")\n\tviper.SetEnvKeyReplacer(strings.NewReplacer(\"-\", \"_\"))\n\tviper.AutomaticEnv()\n\n\tapp := &CLI{\n\t\tRouter: router,\n\t}\n\n\tapp.root = &cobra.Command{\n\t\tUse: filepath.Base(os.Args[0]),\n\t\tVersion: app.GetVersion(),\n\t\tPersistentPreRun: func(cmd *cobra.Command, args []string) {\n\t\t\tfor _, f := range app.argsParsed {\n\t\t\t\tf()\n\t\t\t}\n\t\t},\n\t\tRun: func(cmd *cobra.Command, args []string) {\n\t\t\tfmt.Printf(\"Starting %s %s on %s:%v\\n\", app.GetTitle(), app.GetVersion(), viper.Get(\"host\"), viper.Get(\"port\"))\n\n\t\t\t// Call any pre-start functions.\n\t\t\tfor _, f := range app.prestart {\n\t\t\t\tf()\n\t\t\t}\n\n\t\t\t// Start the server.\n\t\t\tgo func() {\n\t\t\t\t// Start either an HTTP or HTTPS server based on whether TLS cert/key\n\t\t\t\t// paths were given or Let's Encrypt is used.\n\t\t\t\tcert := viper.GetString(\"cert\")\n\t\t\t\tkey := viper.GetString(\"key\")\n\t\t\t\tif cert == \"\" && key == \"\" {\n\t\t\t\t\tif err := app.Listen(fmt.Sprintf(\"%s:%v\", viper.Get(\"host\"), viper.Get(\"port\"))); err != nil && err != http.ErrServerClosed {\n\t\t\t\t\t\tpanic(err)\n\t\t\t\t\t}\n\t\t\t\t\treturn\n\t\t\t\t}\n\n\t\t\t\tif cert != \"\" && key != \"\" {\n\t\t\t\t\tif err := app.ListenTLS(fmt.Sprintf(\"%s:%v\", viper.Get(\"host\"), viper.Get(\"port\")), cert, key); err != nil && err != http.ErrServerClosed {\n\t\t\t\t\t\tpanic(err)\n\t\t\t\t\t}\n\t\t\t\t\treturn\n\t\t\t\t}\n\n\t\t\t\tpanic(\"must pass key and cert for TLS\")\n\t\t\t}()\n\n\t\t\t// Handle graceful shutdown.\n\t\t\tquit := make(chan os.Signal)\n\t\t\tsignal.Notify(quit, syscall.SIGINT, syscall.SIGTERM)\n\t\t\t<-quit\n\n\t\t\tfmt.Println(\"Gracefully shutting down the server...\")\n\n\t\t\tctx, cancel := context.WithTimeout(context.Background(), viper.GetDuration(\"grace-period\")*time.Second)\n\t\t\tdefer cancel()\n\t\t\tapp.Shutdown(ctx)\n\t\t},\n\t}\n\n\tapp.root.AddCommand(&cobra.Command{\n\t\tUse: \"openapi FILENAME.json\",\n\t\tShort: \"Get OpenAPI spec\",\n\t\tArgs: cobra.ExactArgs(1),\n\t\tRun: func(cmd *cobra.Command, args []string) {\n\t\t\t// Get the OpenAPI route from the server.\n\t\t\tw := httptest.NewRecorder()\n\t\t\treq, _ := http.NewRequest(http.MethodGet, \"/openapi.json\", nil)\n\t\t\tapp.ServeHTTP(w, req)\n\n\t\t\tif w.Result().StatusCode != 200 {\n\t\t\t\tpanic(w.Body.String())\n\t\t\t}\n\n\t\t\t// Dump the response to a file.\n\t\t\tioutil.WriteFile(args[0], append(w.Body.Bytes(), byte('\\n')), 0644)\n\n\t\t\tfmt.Printf(\"Successfully wrote OpenAPI JSON to %s\\n\", args[0])\n\t\t},\n\t})\n\n\tapp.Flag(\"host\", \"\", \"Hostname\", \"0.0.0.0\")\n\tapp.Flag(\"port\", \"p\", \"Port\", 8888)\n\tapp.Flag(\"cert\", \"\", \"SSL certificate file path\", \"\")\n\tapp.Flag(\"key\", \"\", \"SSL key file path\", \"\")\n\tapp.Flag(\"grace-period\", \"\", \"Graceful shutdown wait duration in seconds\", 20)\n\n\treturn app\n}", "title": "" }, { "docid": "2511b277b89b2f08d8cfe3cbdc3cbc5d", "score": "0.52897215", "text": "func (sys *SystemInstance) GetAppById(appId string) (App, error) {\n\tsys.logger.Debugf(\"Getting ASC App with ID %v...\", appId)\n\tvar app App\n\n\tdata, err := sendRequest(sys, http.MethodGet, fmt.Sprintf(\"api/v1/apps/%v\", appId), nil, nil)\n\tif err != nil {\n\t\treturn app, errors.Wrapf(err, \"fetching app %v failed\", appId)\n\t}\n\n\tjson.Unmarshal(data, &app)\n\treturn app, nil\n}", "title": "" }, { "docid": "394d9529a1794fcf3ff6083ae6306c82", "score": "0.5286751", "text": "func GetConfig() (*AppConfig, error) {\n\tif c == nil {\n\n\t\tconfigFile := flag.String(\"conf\", confFileName, \"Fully qualified json configs file\")\n\t\tflag.Parse()\n\t\tlog.Infof(\"Loading configuration from [%v]\", *configFile)\n\n\t\tfile, err := os.Open(*configFile)\n\t\tif err != nil {\n\t\t\tlog.Fatalf(\"Error opening file [%v]\", err)\n\t\t\tflag.Usage()\n\t\t\treturn nil, err\n\n\t\t\t// os.Exit(1)\n\t\t}\n\t\tdefer file.Close()\n\n\t\tdecoder := json.NewDecoder(file)\n\t\terr = decoder.Decode(&c)\n\t\tif err != nil {\n\t\t\tlog.Error(err)\n\t\t\treturn nil, err\n\t\t}\n\n\t}\n\n\treturn c, nil\n}", "title": "" }, { "docid": "d2047a76938c13e640c60f2ee20aef9d", "score": "0.52751005", "text": "func AppName() string {\n\treturn mcore.String(os.Args[0]).ReplaceAll(\"\\\\\", \"/\").SepEnd(\"/\").String()\n}", "title": "" }, { "docid": "fff3a38c0a803cc49250996f30a0af44", "score": "0.52727795", "text": "func (ar *appRepo) Get(name string) (*app.App, error) {\n\tcursor, err := r.Table(appTable).Get(name).Run(ar.session)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tdefer cursor.Close()\n\tif cursor.IsNil() {\n\t\treturn nil, errors.New(\"no record found\")\n\t}\n\tvar model AppModel\n\tif err = cursor.One(&model); err != nil {\n\t\treturn nil, err\n\t}\n\treturn &app.App{\n\t\tName: model.ID,\n\t\tConfig: model.Config,\n\t\tRepoURL: model.RepoURL,\n\t\tUser: model.User,\n\t}, nil\n}", "title": "" }, { "docid": "cfe149216d96a7b1d0dfd9d64104912c", "score": "0.5264957", "text": "func (stg *RedisStorage) GetApp(appID string) (*storage.App, error) {\n\tconn := stg.pool.Get()\n\tdefer conn.Close()\n\n\tvalue, err := redigo.Bytes(conn.Do(\"HGET\", keyApps(), appID))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tvar app *storage.App\n\tif err := json.Unmarshal(value, &app); err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn app, nil\n}", "title": "" }, { "docid": "ef6a1c10eab6daf4a257502d75d0e8f5", "score": "0.5264586", "text": "func createApplication(accessToken string) (string, string, error) {\n\n\tapplicationEndpoint := utils.GetDevPortalApplicationListEndpointOfEnv(keyGenEnv, utils.MainConfigFilePath)\n\theaders := make(map[string]string)\n\theaders[utils.HeaderAuthorization] = utils.HeaderValueAuthBearerPrefix + \" \" + accessToken\n\theaders[utils.HeaderContentType] = utils.HeaderValueApplicationJSON\n\tconf := utils.GetMainConfigFromFile(utils.MainConfigFilePath)\n\tappUpdateReq := utils.AppCreateRequest{\n\t\tName: utils.DefaultCliApp,\n\t\tThrottlingPolicy: throttlingTier,\n\t\tDescription: \"Default application for apictl testing purposes\",\n\t\tTokenType: conf.Config.TokenType,\n\t}\n\tbody, err := json.Marshal(appUpdateReq);\n\tif body == nil && err != nil {\n\t\tutils.HandleErrorAndExit(\"Error occurred while creating CLI application update request.\", err)\n\t}\n\tresp, err := utils.InvokePOSTRequest(applicationEndpoint, headers, string(body))\n\tif resp.StatusCode() == http.StatusOK || resp.StatusCode() == http.StatusCreated {\n\t\t// 200 OK or 201 Created\n\t\tapplicationResponse := &utils.Application{}\n\t\tdata := []byte(resp.Body())\n\t\terr = json.Unmarshal(data, &applicationResponse)\n\t\tappId := applicationResponse.ID\n\t\tappName := applicationResponse.Name\n\t\treturn appId, appName, err\n\n\t} else {\n\t\tutils.Logf(\"Error: %s\\n\", resp.Error())\n\t\tutils.Logf(\"Body: %s\\n\", resp.Body())\n\t\tif resp.StatusCode() == http.StatusUnauthorized {\n\t\t\t// 401 Unauthorized\n\t\t\treturn \"\", \"\", fmt.Errorf(\"authorization failed while trying to create the CLI application\")\n\t\t}\n\t\treturn \"\", \"\", errors.New(\"Request didn't respond 200 OK for application creation. Status: \" + resp.Status())\n\t}\n}", "title": "" }, { "docid": "bb14cd9fdc453360e357ff27a7695cbc", "score": "0.52639943", "text": "func NewApp() *cli.App {\n\tvar configFile string\n\tloader := newConfigLoader(configDefaultFile)\n\to := &options{\n\t\tConfigFile: configFile,\n\t\tConfigLoader: loader,\n\t}\n\n\tapp := cli.NewApp()\n\tapp.Name = \"eskip-match\"\n\tapp.Usage = \"A command line tool that helps you test .eskip files routing matching logic\"\n\n\tapp.Flags = []cli.Flag{\n\t\tcli.StringFlag{\n\t\t\tName: \"config, c\",\n\t\t\tUsage: \"Load configuration from `FILE`\",\n\t\t\tDestination: &configFile,\n\t\t},\n\t}\n\n\tapp.Commands = []cli.Command{\n\t\tnewTestCommand(o),\n\t}\n\treturn app\n}", "title": "" }, { "docid": "e1b82adbbeca0049ccc100c34cd7a131", "score": "0.5261506", "text": "func CreateCliApp() *cli.App {\n\tapp := cli.NewApp()\n\tapp.Name = \"stuy-spec-uploader\"\n\tapp.Usage = \"Automatically upload the articles and graphics of The Spectator.\"\n\tapp.Flags = []cli.Flag{\n\t\tcli.BoolFlag{\n\t\t\tName: \"reload, r\",\n\t\t\tUsage: \"should reload and cache Drive files?\",\n\t\t},\n\t\tcli.BoolFlag{\n\t\t\tName: \"window, w\",\n\t\t\tUsage: \"should open core files when bulk uploading?\",\n\t\t},\n\n\t\tcli.IntFlag{\n\t\t\tName: \"volume, m\",\n\t\t\tUsage: \"volume number\",\n\t\t},\n\t\tcli.IntFlag{\n\t\t\tName: \"issue, i\",\n\t\t\tUsage: \"issue number\",\n\t\t},\n\n\t\tcli.StringFlag{\n Name: \"url\",\n Usage: \"individual article Drive url\",\n },\n\t}\n\tapp.Action = func(c *cli.Context) (err error) {\n\t\tif !c.IsSet(\"volume\") && !c.IsSet(\"issue\") {\n\t\t\tlog.Fatalf(\"Must provide both a volume and an issue.\")\n\t\t}\n\t\tDriveFilesMap = GenerateDriveFilesMap(c.Bool(\"reload\"))\n\t\tTransferFlags(c) // Move flag information to global variables\n\n\t\tif c.IsSet(\"url\") {\n\t\t\tUploadArticleByUrl(c.String(\"url\"))\n\t\t}\n\t\treturn\n\t}\n\treturn app\n}", "title": "" }, { "docid": "c658f717856d362252fb1eca0a78ece2", "score": "0.52516556", "text": "func GetName() string {\n\treturn os.Getenv(\"APP_NAME\")\n}", "title": "" }, { "docid": "25ef7778df94c0942ebc8efd8cd91a14", "score": "0.52489334", "text": "func getConfig() (*rest.Config, error) {\n\tkubeconfig := os.Getenv(\"KUBECONFIG\")\n\t// K8s Core api client\n\tconfig, err := clientcmd.BuildConfigFromFlags(\"\", kubeconfig)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn config, nil\n}", "title": "" }, { "docid": "080c400a2d74cca206ac8524f2b26439", "score": "0.5246047", "text": "func getMainConfig() *viper.Viper {\n\treturn config.MainConfig\n}", "title": "" }, { "docid": "aaab1ff477ab1d06129b7326aef95a39", "score": "0.52400315", "text": "func (svc *service) GetPrimaryBrowser(ctx context.Context, req *empty.Empty) (*pb.App, error) {\n\treturn common.UseTconn(ctx, svc.sharedObject, func(tconn *chrome.TestConn) (*pb.App, error) {\n\t\tapp, err := PrimaryBrowser(ctx, tconn)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn &pb.App{Id: app.ID, Name: app.Name}, nil\n\t})\n}", "title": "" }, { "docid": "5a1f4a915b6fb000602496d656082699", "score": "0.52291936", "text": "func InitAppConfig(builder *di.Builder) (err error) {\n\n\terr = builder.Add(\n\t\tdi.Def{\n\t\t\tName: InstAppConfig,\n\t\t\tScope: di.App,\n\t\t\tBuild: func(ctn di.Container) (i interface{}, e error) {\n\t\t\t\tpath := os.Getenv(ConfigPath)\n\t\t\t\tc := viper.New()\n\t\t\t\tc.SetConfigName(\"config\")\n\t\t\t\tc.SetConfigType(\"yaml\")\n\t\t\t\tif path == \"\" {\n\t\t\t\t\tc.AddConfigPath(DefaultConfigPath) // look for config in the working directory\n\t\t\t\t\tlog.Println(\"Loading configs from default location...\")\n\t\t\t\t} else {\n\t\t\t\t\tc.AddConfigPath(path)\n\t\t\t\t\tlog.Printf(\"Loading configs from location: %s\\n\", path)\n\t\t\t\t}\n\n\t\t\t\terr = c.ReadInConfig()\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn\n\t\t\t\t}\n\t\t\t\ti = c\n\t\t\t\treturn\n\t\t\t},\n\t\t})\n\n\treturn\n}", "title": "" }, { "docid": "50a310f1a1c68b71809982cccc8be83d", "score": "0.52225333", "text": "func NewApp() *App {\n\tapp := &App{\n\t\tClusterInfo: ClusterInfo,\n\t\tNamespace: Namespace,\n\t\tService: Service,\n\t\tDeployment: Deployment,\n\t\tPod: Pod,\n\t\tNavigation: Navigation,\n\t\tDetail: Detail,\n\t\tOption: Option,\n\t}\n\n\t//Todo: add app config\n\tconf := config.GuiConfig{\n\t\tHighlight: true,\n\t\tSelFgColor: gocui.ColorGreen,\n\t\tFgColor: gocui.ColorWhite,\n\t\tMouse: true,\n\t\tInputEsc: true,\n\t}\n\tapp.Gui = guilib.NewGui(\n\t\tconf,\n\t\tapp.ClusterInfo,\n\t\tapp.Namespace,\n\t\tapp.Service,\n\t\tapp.Deployment,\n\t\tapp.Pod,\n\t\tapp.Navigation,\n\t\tapp.Detail,\n\t\tapp.Option,\n\t)\n\tapp.Gui.OnRender = app.OnRender\n\tapp.Gui.OnRenderOptions = app.OnRenderOptions\n\tapp.Gui.Actions = appActions\n\tapp.Gui.OnSizeChange = func(gui *guilib.Gui) error {\n\t\tif err := resizePanelHeight(gui); err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\treturn nil\n\t}\n\treturn app\n}", "title": "" }, { "docid": "25ebc4b654cf1afb9fb5cf0f2005de90", "score": "0.5216977", "text": "func (a *App) GetCommand(name string) CommandInterface {\n\tfor _, cmd := range a.commands {\n\t\tif cmd.GetName() == name {\n\t\t\treturn cmd\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "51db35831be148f47e6e82db975dc294", "score": "0.5216661", "text": "func LoadMainAppConfig() (MainAppConfig, error) {\n\tconfig := MainAppConfig{}\n\terr := envconfig.Process(\"\", &config)\n\tif err != nil {\n\t\treturn config, err\n\t}\n\n\treturn config, err\n}", "title": "" }, { "docid": "4eb4c7e05d3c80a7a2b76eab60939e07", "score": "0.521378", "text": "func InitApp(appConfigPath string) {\n\tif len(appConfigPath) != 0 {\n\t\tappConfigFile = appConfigPath\n\t}\n\n\tconfigData := &appConfigHolder{}\n\n\tdata, err := ioutil.ReadFile(appConfigFile)\n\tif err != nil {\n\t\tlog.Fatalf(\"[InitApp] %v\\n\", err)\n\t}\n\n\terr = json.Unmarshal(data, &configData)\n\tif err != nil {\n\t\tlog.Fatalf(\"[InitApp] %v\\n\", err)\n\t}\n\n\tApplicationName = configData.ApplicationName\n\tAPIInstance = configData.APIInstance\n\tHTTPServerAddress = configData.HTTPServerAddress\n\tHTTPServerPort = configData.HTTPServerPort\n\tProtocol = configData.Protocol\n\tAccountActivationEndpoint = configData.AccountActivationEndpoint\n\tPasswordResetEndpoint = configData.PasswordResetEndpoint\n}", "title": "" }, { "docid": "580313e36aa13e8a9bffc026c02e44cb", "score": "0.51997256", "text": "func GetConfig() *AppConfig {\n\n\tif reflect.DeepEqual(appConfig, AppConfig{}) {\n\t\tinitIDPConfig()\n\t\t_, b, _, _ := runtime.Caller(0)\n\t\tinitBaseConfig(filepath.Join(filepath.Dir(b), \"../..\"+CONFIG_JSON))\n\n\t\tif !appConfig.BaseConfig.Debug {\n\t\t\tlog.SetLevel(log.WarnLevel)\n\t\t} else {\n\t\t\tlog.SetLevel(log.DebugLevel)\n\t\t}\n\n\t\tlog.WithFields(log.Fields{\n\t\t\t\"BaseConfig\": fmt.Sprintf(\"%+v\", appConfig.BaseConfig),\n\t\t\t\"IDPConfig\": fmt.Sprintf(\"%+v\", appConfig.IDPConfig),\n\t\t}).Debug(\"Configuration set to:\")\n\t}\n\n\tlog.Println(\"appconfig.....\")\n\tlog.Printf(\"%+v\", appConfig.BaseConfig)\n\n\treturn &appConfig\n}", "title": "" }, { "docid": "6670efdb69dd9e3f4d7c310100af38ce", "score": "0.51947486", "text": "func (m *UserExperienceAnalyticsAppHealthAppPerformanceByAppVersion) GetAppName()(*string) {\n val, err := m.GetBackingStore().Get(\"appName\")\n if err != nil {\n panic(err)\n }\n if val != nil {\n return val.(*string)\n }\n return nil\n}", "title": "" }, { "docid": "5c57015562bbdbbe1c90be86d7030e89", "score": "0.5194268", "text": "func (a App) ncli() string {\n\treturn a.n() + \"cli\"\n}", "title": "" }, { "docid": "dbaf0f4383b572fa45dd7b6b7cecc6f8", "score": "0.51771575", "text": "func NewCliApp() *cli.App {\n\tapp := cli.NewApp()\n\tapp.Name = \"tdbg\"\n\tapp.Usage = \"A command-line tool for Temporal server debugging\"\n\tapp.Version = headers.ServerVersion\n\tapp.Flags = []cli.Flag{\n\t\t&cli.StringFlag{\n\t\t\tName: FlagAddress,\n\t\t\tValue: \"\",\n\t\t\tUsage: \"host:port for Temporal frontend service\",\n\t\t\tEnvVars: []string{\"TEMPORAL_CLI_ADDRESS\"},\n\t\t},\n\t\t&cli.StringFlag{\n\t\t\tName: FlagNamespace,\n\t\t\tAliases: FlagNamespaceAlias,\n\t\t\tValue: \"default\",\n\t\t\tUsage: \"Temporal workflow namespace\",\n\t\t\tEnvVars: []string{\"TEMPORAL_CLI_NAMESPACE\"},\n\t\t},\n\t\t&cli.IntFlag{\n\t\t\tName: FlagContextTimeout,\n\t\t\tAliases: FlagContextTimeoutAlias,\n\t\t\tValue: defaultContextTimeoutInSeconds,\n\t\t\tUsage: \"Optional timeout for context of RPC call in seconds\",\n\t\t\tEnvVars: []string{\"TEMPORAL_CONTEXT_TIMEOUT\"},\n\t\t},\n\t\t&cli.BoolFlag{\n\t\t\tName: FlagYes,\n\t\t\tUsage: \"Automatically confirm all prompts\",\n\t\t},\n\t\t&cli.StringFlag{\n\t\t\tName: FlagTLSCertPath,\n\t\t\tValue: \"\",\n\t\t\tUsage: \"Path to x509 certificate\",\n\t\t\tEnvVars: []string{\"TEMPORAL_CLI_TLS_CERT\"},\n\t\t},\n\t\t&cli.StringFlag{\n\t\t\tName: FlagTLSKeyPath,\n\t\t\tValue: \"\",\n\t\t\tUsage: \"Path to private key\",\n\t\t\tEnvVars: []string{\"TEMPORAL_CLI_TLS_KEY\"},\n\t\t},\n\t\t&cli.StringFlag{\n\t\t\tName: FlagTLSCaPath,\n\t\t\tValue: \"\",\n\t\t\tUsage: \"Path to server CA certificate\",\n\t\t\tEnvVars: []string{\"TEMPORAL_CLI_TLS_CA\"},\n\t\t},\n\t\t&cli.BoolFlag{\n\t\t\tName: FlagTLSDisableHostVerification,\n\t\t\tUsage: \"Disable tls host name verification (tls must be enabled)\",\n\t\t\tEnvVars: []string{\"TEMPORAL_CLI_TLS_DISABLE_HOST_VERIFICATION\"},\n\t\t},\n\t\t&cli.StringFlag{\n\t\t\tName: FlagTLSServerName,\n\t\t\tValue: \"\",\n\t\t\tUsage: \"Override for target server name\",\n\t\t\tEnvVars: []string{\"TEMPORAL_CLI_TLS_SERVER_NAME\"},\n\t\t},\n\t\t&cli.StringFlag{\n\t\t\tName: color.FlagColor,\n\t\t\tUsage: fmt.Sprintf(\"when to use color: %v, %v, %v.\", color.Auto, color.Always, color.Never),\n\t\t\tValue: string(color.Auto),\n\t\t},\n\t}\n\tapp.Commands = commands\n\tapp.ExitErrHandler = handleError\n\n\t// set builder if not customized\n\tif cFactory == nil {\n\t\tSetFactory(NewClientFactory())\n\t}\n\n\treturn app\n}", "title": "" }, { "docid": "85b36e38c23b67fc058ef7fe4a4351c5", "score": "0.51692927", "text": "func LoadAppConfig(path string) (App, error) {\n\tapp, appOK, appErr := FindApp(path)\n\tif appErr != nil {\n\t\treturn App{}, appErr\n\t}\n\tif !appOK {\n\t\treturn App{}, nil\n\t}\n\n\tif err := app.LoadConfig(); err != nil {\n\t\treturn App{}, err\n\t}\n\treturn app, nil\n}", "title": "" }, { "docid": "cea4b1368181180f42af1c6bfb44c60e", "score": "0.51665694", "text": "func GetApp() *gin.Engine {\n\tApp := gin.Default()\n\tApp.Use(cors.Default())\n\tApplyRoutes(App)\n\treturn App\n}", "title": "" }, { "docid": "295b663b5d881eab7c4195da2b887167", "score": "0.51652724", "text": "func (ar *appRepo) GetConfig(name, key string) (map[string]string, error) {\n\tapp, err := ar.Get(name)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tif app.Config != nil {\n\t\tvalue, ok := app.Config[key]\n\t\tif ok {\n\t\t\tconfig := make(map[string]string, 1)\n\t\t\tconfig[key] = value\n\t\t\treturn config, nil\n\t\t}\n\t}\n\treturn nil, errors.New(\"no config found\")\n}", "title": "" }, { "docid": "8b4b647ffef3cfd1eeeaaef3d628b41f", "score": "0.51571757", "text": "func App() *Application {\n\treturn defaultApp\n}", "title": "" }, { "docid": "db4453c3ab7756f6f893e42956be3754", "score": "0.51553833", "text": "func (i *App) GetConfig() models.Config {\n\treturn i.Raptor.GetConfig()\n}", "title": "" }, { "docid": "3a2b27439a98b757200a513e5bf8b3f2", "score": "0.51533306", "text": "func GetApps(mc *rancher.MasterClient, pc *projectClient.Client, kc *kubernetes.Clientset, req appmgrcommon.GenericRequester,\n\tappCycle, catalogId string, verbose bool) (*appmanager.AppsInfo, error) {\n\n\t// Identify application type\n\tappType, _ := appmgrcommon.AppCycleToAppType(appCycle)\n\n\t// Get workloads\n\tapps, err := mc.ProjectClient.App.List(rancher.DefaultListOpts())\n\tif nil != err {\n\t\treturn nil, err\n\t}\n\n\t// Create empty body\n\tbody := &appmanager.AppsInfo{}\n\tbody.Apps = make(map[string]*appmanager.AppInfo)\n\n\tvar monEndpoint string\n\tvar logEndpoint string\n\tif len(apps.Data) > 0 {\n\t\t// Discover monitoring endpoint\n\t\tmonEndpoint, err = rancher.GetEndpoint(pc, mc.ManagementClient, grpccommon.ServiceMonitoringNamespace,\n\t\t\tgrpccommon.ServiceMonitoringName, viper.GetString(appcommon.EnvApphSvcsUrlExternalIp))\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\n\t\t// Discover logging endpoint\n\t\tlogEndpoint, err = rancher.GetEndpoint(pc, mc.ManagementClient, grpccommon.ServiceLoggingNamespace,\n\t\t\tgrpccommon.ServiceLoggingeName, viper.GetString(appcommon.EnvApphSvcsUrlExternalIp))\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\n\tlimits := &appmanager.Resources_Limits{}\n\tvar requests *appmanager.Resources_Requests\n\n\t// Iterate over workload data\n\tfor _, item := range apps.Data {\n\t\tif appName := appcommon.MapGet(item.Annotations, appmgrcommon.AppAnnotationBaseName); appName != \"\" {\n\t\t\t// Continue if the annotation value is no equal to the name in the request\n\t\t\tif req.GetName() != \"\" && req.GetName() != appName {\n\t\t\t\tcontinue\n\t\t\t}\n\n\t\t\tif req.GetRootGroupId() != \"\" && req.GetRootGroupId() != appcommon.MapGet(item.Annotations,\n\t\t\t\tappmgrcommon.AppInstanceAnnotationRootGroupId) {\n\t\t\t\tcontinue\n\t\t\t}\n\n\t\t\t// Find Group ID\n\t\t\tappAnnotationGroupId := appcommon.MapGet(item.Annotations, appmgrcommon.AppInstanceAnnotationGroupId)\n\t\t\tif appAnnotationGroupId == \"\" {\n\t\t\t\tcontinue\n\t\t\t}\n\n\t\t\t// If application type appears in request , filter according to the type\n\t\t\tappAnnotationsCycle := appcommon.MapGet(item.Annotations, appmgrcommon.AppAnnotationCycle)\n\t\t\tif appType != \"\" && appType != appAnnotationsCycle {\n\t\t\t\tcontinue\n\t\t\t}\n\n\t\t\tfound := false\n\t\t\tif len(req.GetGroupIds()) > 0 {\n\t\t\t\t// if more that a single Group ID provided , iterate over the list\n\t\t\t\t// and find a particular Group ID\n\t\t\t\tfor _, gid := range req.GetGroupIds() {\n\t\t\t\t\tif gid == appAnnotationGroupId {\n\t\t\t\t\t\tfound = true\n\t\t\t\t\t\tbreak\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tif !found {\n\t\t\t\t\tcontinue\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t// If version comes in request , get application instance version\n\t\t\tversion := appcommon.MapGet(item.Annotations, appmgrcommon.AppInstanceAnnotationVersion)\n\t\t\tif req.GetVersion() != \"\" && req.GetVersion() != version {\n\t\t\t\tcontinue\n\t\t\t}\n\n\t\t\tif body.Apps[appName] == nil {\n\t\t\t\tlimits.Cpu, limits.Memory, err = resourcemgr.GetResourcesLimit(kc, item.TargetNamespace)\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\tif limits != nil {\n\t\t\t\t\trequests = &appmanager.Resources_Requests{}\n\t\t\t\t\trequests.Cpu, err = strconv.ParseFloat(appmgrcommon.AppInstanceDefaultCpuRequest, 64)\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\trequests.Memory, err = resourcemgr.ParseMemoryString(appmgrcommon.AppInstanceDefaultMemoryRequest)\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}\n\n\t\t\t\tai := &appmanager.AppInfo{}\n\t\t\t\tif appAnnotationsCycle == appmgrcommon.TypePeriodic {\n\t\t\t\t\tif sched := appcommon.MapGet(item.Annotations, appmgrcommon.AppAnnotationSchedule); sched != \"\" {\n\t\t\t\t\t\tf, err := appmgrcommon.CronStringToCyclePeriodicRespAttr(appcommon.MapGet(item.Annotations, appmgrcommon.AppAnnotationSchedule))\n\t\t\t\t\t\tif err != nil {\n\t\t\t\t\t\t\treturn nil, err\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tai.CyclePeriodicFields = f\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tai.TotalResources = &appmanager.Resources{}\n\t\t\t\tai.TotalResources.Requests = &appmanager.Resources_Requests{}\n\t\t\t\tai.TotalResources.Limits = &appmanager.Resources_Limits{}\n\n\t\t\t\topts := rancher.DefaultListOpts()\n\t\t\t\topts.Filters[\"name\"] = item.TargetNamespace + \"-shared-pv\"\n\t\t\t\tif ai.SharedStorage, err = getStorageCapacity(mc, opts); err != nil {\n\t\t\t\t\treturn nil, err\n\t\t\t\t}\n\n\t\t\t\tif ai.MonitorUrl, err = appmgrcommon.GetAppMonitorUrl(monEndpoint, appName, appAnnotationsCycle); err != nil {\n\t\t\t\t\treturn nil, err\n\t\t\t\t}\n\t\t\t\tai.LogsUrl = getAppLogsEndpoint(logEndpoint, appName, req.GetRootGroupId())\n\t\t\t\tbody.Apps[appName] = ai\n\n\t\t\t}\n\n\t\t\td := &appmanager.Instance{}\n\t\t\td.Resources = &appmanager.Resources{}\n\n\t\t\topts := rancher.DefaultListOpts()\n\t\t\topts.Filters[\"name\"] = item.Name\n\t\t\tw, err := mc.ProjectClient.Workload.List(opts)\n\n\t\t\tif len(w.Data) > 0 {\n\t\t\t\t// Gather instances for a particular application\n\t\t\t\tif d, err = getWorkloadInstanceData(mc, &w.Data[0], catalogId, verbose); err != nil {\n\t\t\t\t\treturn nil, err\n\t\t\t\t}\n\t\t\t} else if d, err = getAppInstanceData(mc, &item, catalogId, verbose); err != nil {\n\t\t\t\treturn nil, err\n\t\t\t}\n\n\t\t\tif limits != nil {\n\t\t\t\td.Resources.Limits = limits\n\t\t\t\td.Resources.Requests = requests\n\t\t\t\tbody.Apps[appName].TotalResources.Requests.Cpu += d.Resources.Requests.Cpu\n\t\t\t\tbody.Apps[appName].TotalResources.Requests.Memory += d.Resources.Requests.Memory\n\t\t\t\tbody.Apps[appName].TotalResources.Limits.Cpu += d.Resources.Limits.Cpu\n\t\t\t\tbody.Apps[appName].TotalResources.Limits.Memory += d.Resources.Limits.Memory\n\t\t\t\tbody.Apps[appName].TotalResources.PersistentStorage += d.Resources.PersistentStorage\n\t\t\t\tbody.Apps[appName].TotalResources.Requests.Cpu = math.Round(body.Apps[appName].TotalResources.Requests.Cpu*100) / 100\n\t\t\t\tbody.Apps[appName].TotalResources.Limits.Cpu = math.Round(body.Apps[appName].TotalResources.Limits.Cpu*100) / 100\n\t\t\t}\n\t\t\tbody.Apps[appName].Instances = append(body.Apps[appName].Instances, d)\n\t\t}\n\t}\n\n\t// Return body\n\treturn body, nil\n}", "title": "" }, { "docid": "4960a25246367593c4da0d084c097dd9", "score": "0.51528233", "text": "func CLI(args []string) error {\n\tvar app appEnv\n\terr := app.ParseArgs(args)\n\tif err != nil {\n\t\treturn err\n\t}\n\tif err = app.Exec(); err != nil {\n\t\tfmt.Fprintf(os.Stderr, \"Error: %v\\n\", err)\n\t}\n\treturn err\n}", "title": "" }, { "docid": "06bbdfb82362a60567716406099b3725", "score": "0.5152406", "text": "func Config(appName string) string {\n\treturn appData(appName)\n}", "title": "" }, { "docid": "38530c45918445dad1c88409f6eee582", "score": "0.5146403", "text": "func (app *App) GetByName(name string) (*Command, error) {\n\tfor _, cmd := range app.Commands {\n\t\tif name == cmd.Name {\n\t\t\treturn cmd, nil\n\t\t}\n\t}\n\n\treturn nil, fmt.Errorf(\"App.GetByName: command '%s' does not exist\", name)\n}", "title": "" }, { "docid": "b25fce6e483710d417bbc0fa785dab68", "score": "0.5131219", "text": "func NewApp(basename string) *app.App {\n\topts := options.NewOptions()\n\tapplication := app.NewApp(\"DEEP_PROCESS API Server\",\n\t\tbasename,\n\t\tapp.WithOptions(opts),\n\t\tapp.WithDescription(commandDesc),\n\t\tapp.WithDefaultValidArgs(),\n\t\tapp.WithRunFunc(run(opts)),\n\t)\n\n\treturn application\n}", "title": "" }, { "docid": "c3b82bb96ca5065980c0f6328211b266", "score": "0.51202166", "text": "func (a *ApplicationAPI) Get(ctx context.Context, req *pb.GetApplicationRequest) (*pb.GetApplicationResponse, error) {\n\tvar eui lorawan.EUI64\n\tif err := eui.UnmarshalText([]byte(req.AppEUI)); err != nil {\n\t\treturn nil, grpc.Errorf(codes.InvalidArgument, err.Error())\n\t}\n\n\tif err := a.validator.Validate(ctx,\n\t\tauth.ValidateAPIMethod(\"Application.Get\"),\n\t\tauth.ValidateApplication(eui),\n\t); err != nil {\n\t\treturn nil, grpc.Errorf(codes.Unauthenticated, \"authentication failed: %s\", err)\n\t}\n\n\tapp, err := storage.GetApplication(a.ctx.DB, eui)\n\tif err != nil {\n\t\treturn nil, grpc.Errorf(codes.Unknown, err.Error())\n\t}\n\tb, err := app.AppEUI.MarshalText()\n\tif err != nil {\n\t\treturn nil, grpc.Errorf(codes.Internal, err.Error())\n\t}\n\treturn &pb.GetApplicationResponse{\n\t\tAppEUI: string(b),\n\t\tName: app.Name,\n\t}, nil\n}", "title": "" }, { "docid": "85006f44e030bce294d6a5876f1cdda7", "score": "0.51180226", "text": "func (m *ServicePrincipalIdentity) GetAppId()(*string) {\n return m.appId\n}", "title": "" }, { "docid": "62c9002345c6ebbab841e511eb859090", "score": "0.5117774", "text": "func NewApp(name string, version string) *App {\n\treturn &App{\n\t\tExecPrefix: name + \"-\",\n\t\tName: name,\n\t\tUsage: name + \" <command> [<args>]\",\n\t\tVersion: version,\n\t}\n}", "title": "" }, { "docid": "9868beee291cfd00d5cb5b12ffb47425", "score": "0.51138437", "text": "func GetConfig() *config {\n\treturn appConfig\n}", "title": "" } ]
b5d40e4135c7406ebc7eb5effb57f572
GetStatus returns the Status field value if set, zero value otherwise.
[ { "docid": "b24ef7b0177a07be0819425cdefd6526", "score": "0.6546259", "text": "func (o *VirtualizationBaseClusterAllOf) GetStatus() string {\n\tif o == nil || o.Status == nil {\n\t\tvar ret string\n\t\treturn ret\n\t}\n\treturn *o.Status\n}", "title": "" } ]
[ { "docid": "4c7e10b9022fe2b184e6d76083932dec", "score": "0.74682146", "text": "func GetStatus() uint16 {\n\treturn status\n}", "title": "" }, { "docid": "9ae9e9c7691bac06b97d6905f011b1b7", "score": "0.7343414", "text": "func GetStatus() (Status, error) {\n\treturn Status{}, nil\n}", "title": "" }, { "docid": "be27205f807e6ee91f2ef8f0b7221492", "score": "0.7337578", "text": "func (vars V) GetStatus() int {\n\tresult, ok := vars[statusIndex].(int)\n\tif !ok {\n\t\treturn 0\n\t}\n\treturn result\n}", "title": "" }, { "docid": "3a1ea12ed620190d3a4b0c1c91931aae", "score": "0.7263272", "text": "func (s *ServiceObject) GetStatus() int{\n\treturn s.Status\n}", "title": "" }, { "docid": "1dbda7220db989b2048d79022b39983a", "score": "0.7217223", "text": "func (o *InlineResponseDefault) GetStatus() float32 {\n\tif o == nil || o.Status == nil {\n\t\tvar ret float32\n\t\treturn ret\n\t}\n\treturn *o.Status\n}", "title": "" }, { "docid": "25d03058b3e22a3f6b68ff7d02cddb86", "score": "0.7175389", "text": "func (o *FollowUp) GetStatus() (value string, ok bool) {\n\tok = o != nil && o.bitmap_&2048 != 0\n\tif ok {\n\t\tvalue = o.status\n\t}\n\treturn\n}", "title": "" }, { "docid": "ac2251278224fa3f7833b1e75744f1bf", "score": "0.7163317", "text": "func (s *SyntheticsTest) GetStatus() string {\n\tif s == nil || s.Status == nil {\n\t\treturn \"\"\n\t}\n\treturn *s.Status\n}", "title": "" }, { "docid": "26197819409476220c96f18933d06e97", "score": "0.71186477", "text": "func (o *IaasServiceRequestAllOf) GetStatus() string {\n\tif o == nil || o.Status == nil {\n\t\tvar ret string\n\t\treturn ret\n\t}\n\treturn *o.Status\n}", "title": "" }, { "docid": "4426fde5fb02b29264388e06882f7b20", "score": "0.7068075", "text": "func (c *ClusterService) GetStatus() int {\n env.Output.WriteChDebug(\"(ClusterService::SetStatus) Get value\")\n return c.Status\n}", "title": "" }, { "docid": "2a5df1efde4a527684b62b8ef712d42b", "score": "0.7018725", "text": "func (r *Registers) GetStatus(s Status) byte {\r\n\tif (r.PS & s) == 0 {\r\n\t\treturn 0\r\n\t} else {\r\n\t\treturn 1\r\n\t}\r\n}", "title": "" }, { "docid": "86e573a8ba09cb851392cc30159d865f", "score": "0.70117015", "text": "func (h DefaultStatusHandler) GetStatus() Status {\n\tcapacityCopy := *h.Capacity\n\treturn Status{\n\t\ttime: time.Now(),\n\t\tcapacity: capacityCopy,\n\t}\n}", "title": "" }, { "docid": "8f3bd118e479bb6a86d5c9c0bd33f54d", "score": "0.6998291", "text": "func (c *KeycodeMgt) GetStatus() int {\n\treturn c.Status.GetStatus()\n}", "title": "" }, { "docid": "0bda7c6f72cb34ccd79d94f229701568", "score": "0.69971526", "text": "func (m *_MultipleServiceResponse) GetStatus() uint8 {\n\treturn m.Status\n}", "title": "" }, { "docid": "71453c1228afe59e51d90e6b21495459", "score": "0.6953534", "text": "func (o *ModelsNamespace) GetStatus() string {\n\tif o == nil || o.Status == nil {\n\t\tvar ret string\n\t\treturn ret\n\t}\n\treturn *o.Status\n}", "title": "" }, { "docid": "24f6684764a413ea623a4569ec8265af", "score": "0.69197583", "text": "func (o *Domain) GetStatus() string {\n\tif o == nil || o.Status == nil {\n\t\tvar ret string\n\t\treturn ret\n\t}\n\treturn *o.Status\n}", "title": "" }, { "docid": "35d0a167be757e88eaa7871ba1046db7", "score": "0.69031495", "text": "func (o *SearchEntity) GetStatus() string {\n\tif o == nil || o.Status == nil {\n\t\tvar ret string\n\t\treturn ret\n\t}\n\treturn *o.Status\n}", "title": "" }, { "docid": "4a11db1bc8ed91b2d090268e59c5789c", "score": "0.69005805", "text": "func (s *server) GetStatus(ctx context.Context, req *proto.GetStatusRequest) (*proto.GetStatusResponse, error) {\n\n\ts.RLock()\n\tdefer s.RUnlock()\n\n\tstartTime, err := tspb.TimestampProto(s.startTime)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"failed to convert startTime: %s\", err)\n\t}\n\n\tarchiveStatus := DefaultArchive.GetStatus()\n\n\tlastUpdated, err := tspb.TimestampProto(archiveStatus.LastUpdated)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"failed to convert lastUpdate: %s\", err)\n\t}\n\tresp := &proto.GetStatusResponse{\n\t\tServerStarted: startTime,\n\t\tLastUpdate: lastUpdated,\n\t\tUpdateCount: int32(archiveStatus.UpdateCount),\n\t\tTotalSymbols: int32(archiveStatus.TotalSymbols),\n\t}\n\n\treturn resp, nil\n}", "title": "" }, { "docid": "cb3abc60eb95d63848869d4f0e3424db", "score": "0.6869884", "text": "func (o *NetworkSupervisorCardAllOf) GetStatus() string {\n\tif o == nil || o.Status == nil {\n\t\tvar ret string\n\t\treturn ret\n\t}\n\treturn *o.Status\n}", "title": "" }, { "docid": "10bf3e8184f97e7569645954e0d12d20", "score": "0.6865643", "text": "func (o *IamDomainNameInfoAllOf) GetStatus() string {\n\tif o == nil || o.Status == nil {\n\t\tvar ret string\n\t\treturn ret\n\t}\n\treturn *o.Status\n}", "title": "" }, { "docid": "75a8e2e01a4c3b3a61c27207184b550c", "score": "0.68600667", "text": "func (o *ContractProperties) GetStatus() *string {\n\tif o == nil {\n\t\treturn nil\n\t}\n\n\treturn o.Status\n\n}", "title": "" }, { "docid": "a427a605d07c6f724b468eaccdb29227", "score": "0.6859859", "text": "func (c *Check) GetStatus() Status {\n\tif c == nil || c.Status == nil {\n\t\treturn 0\n\t}\n\treturn *c.Status\n}", "title": "" }, { "docid": "c4309cffd59bfa87d6003bb8e77a2ecf", "score": "0.6840064", "text": "func (ls *Lidar) GetStatus() (byte, error) {\n\tvalue, err := ls.bus.ReadByteFromReg(ls.address, 0x01)\n\treturn value, err\n}", "title": "" }, { "docid": "c20b80c7fc52cea02df181f310232932", "score": "0.68359476", "text": "func (a *API) GetStatus() error {\n\tvar _, err = a.rpc(\"GET\", \"status\", \"\")\n\tif err != nil {\n\t\treturn fmt.Errorf(\"Unable to retrieve server status: %w\", err)\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "3322c304f18a17d5cc245a9af377d4de", "score": "0.68358254", "text": "func (o *AuthorizationUpdateRequest) GetStatus() string {\n\tif o == nil || o.Status == nil {\n\t\tvar ret string\n\t\treturn ret\n\t}\n\treturn *o.Status\n}", "title": "" }, { "docid": "11d013214f50389d4aaab788c0c7714b", "score": "0.6832736", "text": "func (server *FlexibleServer) GetStatus() genruntime.ConvertibleStatus {\n\treturn &server.Status\n}", "title": "" }, { "docid": "dd7781cfcec6fe81cfbc7e3b8eb10ead", "score": "0.6810474", "text": "func (x *FinishJudgeTaskRequest) GetStatus() string {\n\tif x != nil {\n\t\treturn x.Status\n\t}\n\treturn \"\"\n}", "title": "" }, { "docid": "bac679c8dadc941746325ef5e9ce3402", "score": "0.680199", "text": "func (o *SourceDynamoDb) GetStatus() StatusDynamoDb {\n\tif o == nil || IsNil(o.Status) {\n\t\tvar ret StatusDynamoDb\n\t\treturn ret\n\t}\n\treturn *o.Status\n}", "title": "" }, { "docid": "61a3f5ba2e790cff081e208dc86f6d3e", "score": "0.67975783", "text": "func (o *IPOEvent) GetStatus() string {\n\tif o == nil || o.Status == nil {\n\t\tvar ret string\n\t\treturn ret\n\t}\n\treturn *o.Status\n}", "title": "" }, { "docid": "c8cd4d54293551e2d7f8084aaf79637e", "score": "0.6796663", "text": "func (o *DecisionRequest) GetStatus() string {\n\tif o == nil || o.Status == nil {\n\t\tvar ret string\n\t\treturn ret\n\t}\n\treturn *o.Status\n}", "title": "" }, { "docid": "29fe8844cde708cb9e9e92192989678c", "score": "0.6780885", "text": "func (d *Device) GetStatus() Status {\n\td.mutex.RLock()\n\tdefer d.mutex.RUnlock()\n\treturn d.status\n}", "title": "" }, { "docid": "7768566ec9e2404e8b58c6edb7c13649", "score": "0.6778411", "text": "func (o *CrossAccountRequestByUserId) GetStatus() string {\n\tif o == nil || o.Status == nil {\n\t\tvar ret string\n\t\treturn ret\n\t}\n\treturn *o.Status\n}", "title": "" }, { "docid": "183336042b4666c42815c59bb853e56e", "score": "0.6769745", "text": "func (b *Base) GetStatus() influxdb.Status {\n\treturn b.Status\n}", "title": "" }, { "docid": "f0408d35df566756404278f4e53c721f", "score": "0.6756142", "text": "func (f *Function) GetStatus() *duckv1.Status {\n\treturn &f.Status.Status\n}", "title": "" }, { "docid": "0c9effba0035ea86af7f54c0b4696a3a", "score": "0.67555654", "text": "func (o *InlineResponse200123) GetSTATUS() string {\n\tif o == nil || o.STATUS == nil {\n\t\tvar ret string\n\t\treturn ret\n\t}\n\treturn *o.STATUS\n}", "title": "" }, { "docid": "2ffd9269785fa460e80eed1fc5f8c91b", "score": "0.67549855", "text": "func (o *IncidentUpdate) GetStatus() string {\n\tif o == nil || o.Status == nil {\n\t\tvar ret string\n\t\treturn ret\n\t}\n\treturn *o.Status\n}", "title": "" }, { "docid": "3f7b2f71f4969bc1fbd6a30f9431438b", "score": "0.67443377", "text": "func (o *MetricsCommand) GetStatus() string {\n\tif o == nil || o.Status == nil {\n\t\tvar ret string\n\t\treturn ret\n\t}\n\treturn *o.Status\n}", "title": "" }, { "docid": "ffea4d7bb0c2cd655c7f4d594e2f19e3", "score": "0.67370826", "text": "func (o *InlineResponse200105) GetSTATUS() string {\n\tif o == nil || o.STATUS == nil {\n\t\tvar ret string\n\t\treturn ret\n\t}\n\treturn *o.STATUS\n}", "title": "" }, { "docid": "26c03034abc0055d207aa9fbac6d4a1b", "score": "0.67274314", "text": "func (c *DefaultApiController) GetStatus(w http.ResponseWriter, r *http.Request) { \n\tresult, err := c.service.GetStatus(r.Context())\n\t//If an error occured, encode the error with the status code\n\tif err != nil {\n\t\tEncodeJSONResponse(err.Error(), &result.Code, w)\n\t\treturn\n\t}\n\t//If no error, encode the body and the result code\n\tEncodeJSONResponse(result.Body, &result.Code, w)\n\t\n}", "title": "" }, { "docid": "af0911f4b8127df4a32558f52aaeefc1", "score": "0.67203057", "text": "func (o *NodeDTO) GetStatus() string {\n\tif o == nil || o.Status == nil {\n\t\tvar ret string\n\t\treturn ret\n\t}\n\treturn *o.Status\n}", "title": "" }, { "docid": "a55f08b40efe47184a194b6253b2730a", "score": "0.67179817", "text": "func (c *OPCUAClient) GetStatus() string {\n\treturn \"OK\"\n}", "title": "" }, { "docid": "a6eef4a8a5c6fc36a8d5819d8e7e5394", "score": "0.67129505", "text": "func (o *InlineResponse20041) GetSTATUS() string {\n\tif o == nil || o.STATUS == nil {\n\t\tvar ret string\n\t\treturn ret\n\t}\n\treturn *o.STATUS\n}", "title": "" }, { "docid": "0fb7b78875699dfcee9fbdb55da2844e", "score": "0.67099726", "text": "func (o *InlineResponse200106) GetSTATUS() string {\n\tif o == nil || o.STATUS == nil {\n\t\tvar ret string\n\t\treturn ret\n\t}\n\treturn *o.STATUS\n}", "title": "" }, { "docid": "a0d38f474af71ffdd9c585d0eec1b1c4", "score": "0.67002636", "text": "func (o *InlineResponse200110) GetSTATUS() string {\n\tif o == nil || o.STATUS == nil {\n\t\tvar ret string\n\t\treturn ret\n\t}\n\treturn *o.STATUS\n}", "title": "" }, { "docid": "3e8c655c832a78a67be0ce8887598ae1", "score": "0.66986877", "text": "func (p *Payment) GetStatus() string {\n\tif p == nil || p.Status == nil {\n\t\treturn \"\"\n\t}\n\treturn *p.Status\n}", "title": "" }, { "docid": "2cd6ac6408578fa7ffb63fd3ad4bd6f6", "score": "0.66980255", "text": "func (l *LicenseResponse) GetStatus() int {\n\tif l == nil || l.Status == nil {\n\t\treturn 0\n\t}\n\treturn *l.Status\n}", "title": "" }, { "docid": "b5d7b02e59bfbfc60be6c7c444df4c16", "score": "0.6696495", "text": "func (domain *Domain) GetStatus() genruntime.ConvertibleStatus {\n\treturn &domain.Status\n}", "title": "" }, { "docid": "64b1ea46739362f2f05d9301e674d371", "score": "0.66954476", "text": "func (r *Facade) GetStatus() string {\n\treturn r.Status\n}", "title": "" }, { "docid": "40193fe18f6adedfa8b4efe21c9d3ca2", "score": "0.6694653", "text": "func (h *HALicenseResponse) GetStatus() int {\n\tif h == nil || h.Status == nil {\n\t\treturn 0\n\t}\n\treturn *h.Status\n}", "title": "" }, { "docid": "212d39adfbaf7dde5d9b6348a6e58a93", "score": "0.66837263", "text": "func (o *InlineResponse20073) GetSTATUS() string {\n\tif o == nil || o.STATUS == nil {\n\t\tvar ret string\n\t\treturn ret\n\t}\n\treturn *o.STATUS\n}", "title": "" }, { "docid": "3d200e75b36c4b7156c693ba70b5536b", "score": "0.66777074", "text": "func GetStatus() (int, string) {\n\n\t// construct target URL\n\turl := fmt.Sprintf(\"%s/status\", config.Configuration.IDServiceURL)\n\n\t// issue the request\n\tstart := time.Now()\n\tresp, responseBody, errs := gorequest.New().\n\t\tSetDebug(config.Configuration.Debug).\n\t\tGet(url).\n\t\tTimeout(statusTimeout).\n\t\tEnd()\n\tduration := time.Since(start)\n\n\t// check for errors\n\tif errs != nil {\n\t\tlogger.Log(fmt.Sprintf(\"ERROR: service (%s) returns %s in %s\", url, errs, duration))\n\t\treturn http.StatusInternalServerError, errs[0].Error()\n\t}\n\n\tdefer io.Copy(ioutil.Discard, resp.Body)\n\tdefer resp.Body.Close()\n\n\tlogger.Log(fmt.Sprintf(\"INFO: service (%s) returns http %d in %s\", url, resp.StatusCode, duration))\n\n\t// check the response body for errors\n\tif !statusIsOk(responseBody) {\n\t\tlogger.Log(fmt.Sprintf(\"WARNING: error response body: [%s]\", responseBody))\n\t\treturn http.StatusBadRequest, fmt.Sprintf(\"service reports failure (%s)\", responseBody)\n\t}\n\n\t// all good...\n\treturn http.StatusOK, \"\"\n}", "title": "" }, { "docid": "91f6a218eed9a114e1b5e66e50610692", "score": "0.66767997", "text": "func (o *InlineResponse20055) GetSTATUS() string {\n\tif o == nil || o.STATUS == nil {\n\t\tvar ret string\n\t\treturn ret\n\t}\n\treturn *o.STATUS\n}", "title": "" }, { "docid": "5cf4d3bf421a61d27cc2d68f4241d9b4", "score": "0.667621", "text": "func (o *Deal) GetStatus() string {\n\tif o == nil {\n\t\tvar ret string\n\t\treturn ret\n\t}\n\n\treturn o.Status\n}", "title": "" }, { "docid": "d4fedaa0e8e53a314bd3220ba340c2d3", "score": "0.6675669", "text": "func (o *Subscription) GetStatus() string {\n\tif o == nil || o.Status == nil {\n\t\tvar ret string\n\t\treturn ret\n\t}\n\treturn *o.Status\n}", "title": "" }, { "docid": "c73b521284560b8eb678b49135806f49", "score": "0.6670194", "text": "func (o *InlineResponse20061) GetSTATUS() string {\n\tif o == nil || o.STATUS == nil {\n\t\tvar ret string\n\t\treturn ret\n\t}\n\treturn *o.STATUS\n}", "title": "" }, { "docid": "e3fb92685bcfc38295b7c768a85f5bad", "score": "0.6663514", "text": "func GetStatus(c *gin.Context) {\n\tc.JSON(http.StatusOK,\n\t\tbindings.StatusResponse{Status: \"OK\"},\n\t)\n}", "title": "" }, { "docid": "d1e977ae8ba0c3cad3269c2c7fe8c3b2", "score": "0.66631293", "text": "func (_ContractLifeCycle *ContractLifeCycleCaller) GetStatus(opts *bind.CallOpts, addr common.Address) (*big.Int, string, error) {\n\tvar (\n\t\tret0 = new(*big.Int)\n\t\tret1 = new(string)\n\t)\n\tout := &[]interface{}{\n\t\tret0,\n\t\tret1,\n\t}\n\terr := _ContractLifeCycle.contract.Call(opts, out, \"getStatus\", addr)\n\treturn *ret0, *ret1, err\n}", "title": "" }, { "docid": "87f611b49b39dd5a00b61cb41daf2531", "score": "0.66602767", "text": "func (s Storage) GetStatus(ctx context.Context) (*ServerStatus, error) {\n\tresp, err := s.Get(ctx, KeyStatus)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tif len(resp.Kvs) == 0 {\n\t\treturn nil, ErrNotFound\n\t}\n\n\tst := &ServerStatus{}\n\terr = json.Unmarshal(resp.Kvs[0].Value, &st)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn st, nil\n}", "title": "" }, { "docid": "b9aaee242bae0790590259d2c73a86e3", "score": "0.6657101", "text": "func (o *InlineResponse2007) GetSTATUS() string {\n\tif o == nil || o.STATUS == nil {\n\t\tvar ret string\n\t\treturn ret\n\t}\n\treturn *o.STATUS\n}", "title": "" }, { "docid": "0bc3012b6754837bab7cf780eb8894cc", "score": "0.66566247", "text": "func (c *Controller) GetStatus() *Status {\n\treturn &Status{\n\t\tLastSeenFloor: c.GetLastSeenFloor(),\n\t\tMovingDirection: c.GetMovingDirection(),\n\t\tRequestedFloor: c.GetRequestedFloor(),\n\n\t\t// TODO add floors' status\n\t}\n}", "title": "" }, { "docid": "18b8f72211534c0cd8786dc355afcda0", "score": "0.6651599", "text": "func (c *PSQLServerClient) GetStatus(obj runtime.Object) (*v1alpha1.ASOStatus, error) {\n\tinstance, err := c.convert(obj)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tst := v1alpha1.ASOStatus(instance.Status)\n\treturn &st, nil\n}", "title": "" }, { "docid": "dfe5bbf394bba165b160f00241020835", "score": "0.6649464", "text": "func GetStatus() Status {\n\tnow := time.Now().Unix()\n\n\ts := Status{}\n\ts.Status = \"ok\"\n\ts.Version = Version()\n\ts.PID = os.Getpid()\n\ts.CPUs = runtime.NumCPU()\n\ts.GoVers = runtime.Version()\n\ts.TimeStamp = now\n\ts.UpTime = now - started\n\n\treturn s\n}", "title": "" }, { "docid": "ba418bc3a365c4250d34facfddb5ed81", "score": "0.663662", "text": "func (m *Operation) GetStatus()(*OperationStatus) {\n return m.status\n}", "title": "" }, { "docid": "8603dccca50a064ee0fb9a4e53c6ff95", "score": "0.6631234", "text": "func (a StatusInfo_Status) Get(fieldName string) (value string, found bool) {\n\tif a.AdditionalProperties != nil {\n\t\tvalue, found = a.AdditionalProperties[fieldName]\n\t}\n\treturn\n}", "title": "" }, { "docid": "d779a9418cca249f2eff28935677080a", "score": "0.6629841", "text": "func (o *Authentication) GetStatus() string {\n\tif o == nil || o.Status == nil {\n\t\tvar ret string\n\t\treturn ret\n\t}\n\treturn *o.Status\n}", "title": "" }, { "docid": "5cf796937ca7c33366d83c01eec63079", "score": "0.66229045", "text": "func (_IMultiSession *IMultiSessionCaller) GetStatus(opts *bind.CallOpts, _session [32]byte) (uint8, error) {\n\tvar (\n\t\tret0 = new(uint8)\n\t)\n\tout := ret0\n\terr := _IMultiSession.contract.Call(opts, out, \"getStatus\", _session)\n\treturn *ret0, err\n}", "title": "" }, { "docid": "04107b5cdbf86f52f39c977d3899d8c8", "score": "0.6614356", "text": "func (o *ApplianceClusterInstallBaseAllOf) GetStatus() string {\n\tif o == nil || o.Status == nil {\n\t\tvar ret string\n\t\treturn ret\n\t}\n\treturn *o.Status\n}", "title": "" }, { "docid": "11d5caf20b5abca64e8f8ed661319c28", "score": "0.661381", "text": "func (cli *Client) GetStatus(mxid string) (resp *RespUserStatus, err error) {\n\turlPath := cli.BuildURL(\"presence\", mxid, \"status\")\n\terr = cli.MakeRequest(\"GET\", urlPath, nil, &resp)\n\treturn\n}", "title": "" }, { "docid": "9318a2d798e553f8293b06c235d49f6f", "score": "0.6612347", "text": "func (g *GroupData) GetStatus() string {\n\tif g == nil || g.Status == nil {\n\t\treturn \"\"\n\t}\n\treturn *g.Status\n}", "title": "" }, { "docid": "368edce2e77a7ce07a427ecae4cd37b3", "score": "0.6609374", "text": "func (o *InlineResponse2014) GetSTATUS() string {\n\tif o == nil || o.STATUS == nil {\n\t\tvar ret string\n\t\treturn ret\n\t}\n\treturn *o.STATUS\n}", "title": "" }, { "docid": "0dfe9c664e92e48f31c86468407160d8", "score": "0.66026914", "text": "func (o *InlineResponse20052) GetSTATUS() string {\n\tif o == nil || o.STATUS == nil {\n\t\tvar ret string\n\t\treturn ret\n\t}\n\treturn *o.STATUS\n}", "title": "" }, { "docid": "75ed1f3394c5db12a97d602a1e52d1cb", "score": "0.6599465", "text": "func (o *CheckDigitalCurrencyAddressResponse) GetStatus() string {\n\tif o == nil || o.Status == nil {\n\t\tvar ret string\n\t\treturn ret\n\t}\n\treturn *o.Status\n}", "title": "" }, { "docid": "810f6e951da160b9af23b00e8464a559", "score": "0.6599419", "text": "func (m *ServiceHealthIssue) GetStatus()(*ServiceHealthStatus) {\n val, err := m.GetBackingStore().Get(\"status\")\n if err != nil {\n panic(err)\n }\n if val != nil {\n return val.(*ServiceHealthStatus)\n }\n return nil\n}", "title": "" }, { "docid": "70bb5e9e2d4e75c5957ab9918e2cd418", "score": "0.65943", "text": "func (d *Docker) GetStatus(ctx context.Context, name string) error {\n\treturn nil\n}", "title": "" }, { "docid": "25f70dc0957e6f7951af001e3e9571aa", "score": "0.65896326", "text": "func (s *StatusService) Get(statusID string) (*Status, *Response, error) {\n\treturn s.GetWithContext(context.Background(), statusID)\n}", "title": "" }, { "docid": "dd0e6848e701187cafb703128dd4ce27", "score": "0.6589146", "text": "func (o *ConfigImporter) GetStatus() string {\n\tif o == nil || o.Status == nil {\n\t\tvar ret string\n\t\treturn ret\n\t}\n\treturn *o.Status\n}", "title": "" }, { "docid": "49364075ffaf273fb1f848b3d29b88b8", "score": "0.657562", "text": "func (r *Response) GetStatus() string {\n\tif r == nil || r.Status == nil {\n\t\treturn \"\"\n\t}\n\treturn *r.Status\n}", "title": "" }, { "docid": "2dcf750c41e5e26096e3b033d09abb22", "score": "0.65731716", "text": "func (o *Cluster) GetStatus() (value *ClusterStatus, ok bool) {\n\tok = o != nil && o.bitmap_&549755813888 != 0\n\tif ok {\n\t\tvalue = o.status\n\t}\n\treturn\n}", "title": "" }, { "docid": "3800745e14a4912a0ee54b6469c2b51f", "score": "0.6567621", "text": "func GetStatus(w http.ResponseWriter, r *http.Request) {\n\tmiddleware.EnableCors(&w)\n\n\tstatus := core.GetStatus()\n\tw.Header().Set(\"Content-Type\", \"application/json\")\n\n\tjson.NewEncoder(w).Encode(status)\n}", "title": "" }, { "docid": "368b75aba8f8156092cc0f2e9d215bd4", "score": "0.65561116", "text": "func (c *Client) GetStatus() (*StatusResponse, error) {\n\treq, err := c.newRequest(\"GET\", status, nil, nil)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tvar response StatusResponse\n\terr = c.do(req, &response)\n\treturn &response, err\n}", "title": "" }, { "docid": "cf0663349ebc260b063a4ed926ff4ee0", "score": "0.65558827", "text": "func (p Professional) GetStatus() Status {\n\treturn p.status\n}", "title": "" }, { "docid": "fca6ed32ef7bd990f94a1b7d1596355b", "score": "0.65475607", "text": "func (s *SocketService) GetStatus() int {\n\treturn s.status\n}", "title": "" }, { "docid": "e9d6a4698011c1787843100a020884dd", "score": "0.65380424", "text": "func (s *MysqlServer) GetStatus() *SQLServerStatus {\n\treturn &s.Status\n}", "title": "" }, { "docid": "b107353d5afbc58e2eef67d9761b4590", "score": "0.65373003", "text": "func (o *InlineResponse2006) GetSTATUS() string {\n\tif o == nil || o.STATUS == nil {\n\t\tvar ret string\n\t\treturn ret\n\t}\n\treturn *o.STATUS\n}", "title": "" }, { "docid": "7959f447355b0c0644af09a1d33e7da9", "score": "0.6533251", "text": "func GetStatus(ctx context.Context, rpc RPC) (*Status, error) {\n\tvar status Status\n\tif err := rpc.Call(ctx, MsgGetStatus, &struct{}{}, &status); err != nil {\n\t\treturn nil, err\n\t}\n\treturn &status, nil\n}", "title": "" }, { "docid": "4f0fdcb0940dd908076b726d8dd11839", "score": "0.6523707", "text": "func GetStatus(context echo.Context) error {\n\tvar s si.Status\n\tvar err error\n\n\ts.Version, err = si.GetVersion(\"version.txt\")\n\tif err != nil {\n\t\treturn context.JSON(http.StatusOK, \"Failed to open version.txt\")\n\t}\n\n\t// Test a database retrieval to assess the status.\n\tvals, err := db.GetDB().GetAllBuildings()\n\tif len(vals) < 1 || err != nil {\n\t\ts.Status = si.StatusDead\n\t\ts.StatusInfo = fmt.Sprintf(\"Unable to access database. Error: %s\", err)\n\t} else {\n\t\ts.Status = si.StatusOK\n\t\ts.StatusInfo = \"\"\n\t}\n\tlog.L.Info(\"Getting Mstatus\")\n\n\treturn context.JSON(http.StatusOK, s)\n}", "title": "" }, { "docid": "2e8e08491c3d43fd669d3cf4f7395353", "score": "0.652146", "text": "func (vk *VK) StatusGet(params map[string]string) (response StatusGetResponse, vkErr Error) {\n\tvk.RequestUnmarshal(\"status.get\", params, &response, &vkErr)\n\treturn\n}", "title": "" }, { "docid": "092add403d45e97a98e5991ab0d11208", "score": "0.65209544", "text": "func (d *Response) GetStatus() int32 {\n\treturn int32(C.gocef_response_get_status(d.toNative(), d.get_status))\n}", "title": "" }, { "docid": "61bf8a755322ef338e068cd1ed8af0aa", "score": "0.6519589", "text": "func (o *EnrolledMfaDevicesResponse) GetStatus() Status {\n\tif o == nil || o.Status == nil {\n\t\tvar ret Status\n\t\treturn ret\n\t}\n\treturn *o.Status\n}", "title": "" }, { "docid": "4699fa6e5c3f291a370d8dedb3368914", "score": "0.6516625", "text": "func (namespace *Namespace) GetStatus() genruntime.ConvertibleStatus {\n\treturn &namespace.Status\n}", "title": "" }, { "docid": "4699fa6e5c3f291a370d8dedb3368914", "score": "0.6516625", "text": "func (namespace *Namespace) GetStatus() genruntime.ConvertibleStatus {\n\treturn &namespace.Status\n}", "title": "" }, { "docid": "6e62163aea15904a148a6cc6d93cd905", "score": "0.65153486", "text": "func (d *Deploy) GetStatus() (err error) {\n\tvar (\n\t\trequest *http.Request\n\t\tresp *http.Response\n\t\traw []byte\n\t\tok bool\n\t)\n\trequest, _ = http.NewRequest(\"GET\", fmt.Sprintf(\"%s/deploy/%s/status\", apiBaseURL, d.id), nil)\n\n\tif resp, err = doRequest(request); err != nil {\n\t\treturn\n\t}\n\n\tdefer resp.Body.Close()\n\n\tif raw, err = ioutil.ReadAll(resp.Body); err != nil {\n\t\treturn\n\t}\n\n\tvar data = make(map[string]interface{})\n\n\tif err = json.Unmarshal(raw, &data); err != nil {\n\t\treturn\n\t}\n\n\tif d.Status, ok = data[\"status\"].(string); !ok {\n\t\terr = ErrUnexpectedResponse\n\t\treturn\n\t}\n\n\tif d.Status == \"failed\" {\n\t\terr = ErrDeployFailed\n\t\treturn\n\t}\n\n\tif d.Status == \"success\" {\n\t\tif d.url, ok = data[\"url\"].(string); !ok {\n\t\t\terr = ErrUnexpectedResponse\n\t\t\treturn\n\t\t}\n\t}\n\n\treturn\n}", "title": "" }, { "docid": "2764c81723e156d67e4a266a5326125f", "score": "0.65120935", "text": "func (m *Simulation) GetStatus()(*SimulationStatus) {\n val, err := m.GetBackingStore().Get(\"status\")\n if err != nil {\n panic(err)\n }\n if val != nil {\n return val.(*SimulationStatus)\n }\n return nil\n}", "title": "" }, { "docid": "f070255d6361e51e058d1c17debeccbf", "score": "0.65118635", "text": "func (farm *ServerFarm) GetStatus() genruntime.ConvertibleStatus {\n\treturn &farm.Status\n}", "title": "" }, { "docid": "d489c73d562ae2b7e94ca874009c2a0b", "score": "0.6511071", "text": "func (service *ServiceState) GetStatus() watcher.Status {\n\treturn service.status\n}", "title": "" }, { "docid": "802f97130ea5060a4ac06a324b07aa68", "score": "0.6509643", "text": "func (t *EventType) GetStatus() *duckv1.Status {\n\treturn &t.Status.Status\n}", "title": "" }, { "docid": "eede37ba229f5c2c85f764064c9b13a0", "score": "0.6504815", "text": "func (o *InlineResponse20041ClockIns) GetStatus() string {\n\tif o == nil || o.Status == nil {\n\t\tvar ret string\n\t\treturn ret\n\t}\n\treturn *o.Status\n}", "title": "" }, { "docid": "650bfa27bc0913c5cfa15a8bc1bad3d5", "score": "0.6493358", "text": "func (recv *PrintOperation) GetStatus() PrintStatus {\n\tretC := C.gtk_print_operation_get_status((*C.GtkPrintOperation)(recv.native))\n\tretGo := (PrintStatus)(retC)\n\n\treturn retGo\n}", "title": "" }, { "docid": "0c7b074ef092ae4b258f892bdfd93b39", "score": "0.64855725", "text": "func (o *Publishers) GetStatus() string {\n\tif o == nil {\n\t\tvar ret string\n\t\treturn ret\n\t}\n\n\treturn o.Status\n}", "title": "" }, { "docid": "694dadc985c8ac213a5446e70cba8161", "score": "0.6483875", "text": "func (o *IncidentIntegrationMetadataAttributes) GetStatus() int32 {\n\tif o == nil || o.Status == nil {\n\t\tvar ret int32\n\t\treturn ret\n\t}\n\treturn *o.Status\n}", "title": "" }, { "docid": "dd359cb1173265f202f3762f0ef9958e", "score": "0.6483813", "text": "func (o *InlineResponse200117Webhooks) GetStatus() string {\n\tif o == nil || o.Status == nil {\n\t\tvar ret string\n\t\treturn ret\n\t}\n\treturn *o.Status\n}", "title": "" } ]
51c8b5b0cc9ef48e2b5ea569313f057b
jig:template Observable First First emits only the first item, or the first item that meets a condition, from an Observable.
[ { "docid": "f48fc40f0956767884dd0c89583c070b", "score": "0.69186777", "text": "func (o Observable) First() Observable {\n\tobservable := func(observe Observer, subscribeOn Scheduler, subscriber Subscriber) {\n\t\tstart := true\n\t\tobserver := func(next interface{}, err error, done bool) {\n\t\t\tif done || start {\n\t\t\t\tobserve(next, err, done)\n\t\t\t}\n\t\t\tstart = false\n\t\t}\n\t\to(observer, subscribeOn, subscriber)\n\t}\n\treturn observable\n}", "title": "" } ]
[ { "docid": "77b566294b11f81d048c56ecb7e4434e", "score": "0.75189894", "text": "func (parent *Observable) First() (o *Observable) {\n\to = parent.newFilteringObservable(\"first\")\n\to.first, o.last, o.ignoreElement, o.distinct = true, false, false, false\n\to.debounce, o.take, o.skip = 0, 0, 0\n\to.operator = filteringTotalOperator\n\treturn o\n\n}", "title": "" }, { "docid": "b4c38648611354372cd178818a413df8", "score": "0.7405995", "text": "func (parent *Observable) First() (o *Observable) {\n\to = parent.newFilterObservable(\"first\")\n\to.only_first, o.only_last, o.only_distinct = true,false, false\n\to.debounce_timespan = 0\n\to.take, o.skip = 0, 0\n\to.operator = firstOperator\n\treturn o\n\n}", "title": "" }, { "docid": "1b37260afbb90f717941a73f3f4c2d14", "score": "0.7051728", "text": "func (o ObservableFoo) First() ObservableFoo {\n\treturn o.AsObservable().First().AsObservableFoo()\n}", "title": "" }, { "docid": "d287f4e7871e217f57a3f6f6e331f9a3", "score": "0.6493082", "text": "func (o Observable) Single() Observable {\n\tobservable := func(observe Observer, subscribeOn Scheduler, subscriber Subscriber) {\n\t\tvar (\n\t\t\tcount int\n\t\t\tlatest interface{}\n\t\t)\n\t\tobserver := func(next interface{}, err error, done bool) {\n\t\t\tif count < 2 {\n\t\t\t\tif done {\n\t\t\t\t\tif err != nil {\n\t\t\t\t\t\tobserve(nil, err, true)\n\t\t\t\t\t} else {\n\t\t\t\t\t\tif count == 1 {\n\t\t\t\t\t\t\tobserve(latest, nil, false)\n\t\t\t\t\t\t\tobserve(nil, nil, true)\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tobserve(nil, DidNotEmitValue, true)\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t} else {\n\t\t\t\t\tcount++\n\t\t\t\t\tif count == 1 {\n\t\t\t\t\t\tlatest = next\n\t\t\t\t\t} else {\n\t\t\t\t\t\tobserve(nil, EmittedMultipleValues, true)\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\to(observer, subscribeOn, subscriber)\n\t}\n\treturn observable\n}", "title": "" }, { "docid": "a97f070e490c3e8fab661d86fc5e2d08", "score": "0.59721166", "text": "func (o ObservableFoo) Single() ObservableFoo {\n\treturn o.AsObservable().Single().AsObservableFoo()\n}", "title": "" }, { "docid": "517fe1b402c75a56bf64abe059b14895", "score": "0.56668687", "text": "func (j *JetStreamMgmt) ObservableNext(set string, observable string) (msg *nats.Msg, err error) {\n\ts := fmt.Sprintf(\"%s.%s.%s\", api.JetStreamRequestNextPre, set, observable)\n\n\tmsg, err = j.request(s, []byte(\"1\"))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn msg, err\n}", "title": "" }, { "docid": "fb8f18af2dc22a10b454446f42a14e92", "score": "0.56169754", "text": "func (li *TemplateVersionsIterator) First(ctx context.Context, items *[]TemplateVersion) bool {\n\tif li.err != nil {\n\t\treturn false\n\t}\n\tli.err = li.fetch(ctx, li.Paging.First)\n\tif li.err != nil {\n\t\treturn false\n\t}\n\tcpy := make([]TemplateVersion, len(li.Template.Versions))\n\tcopy(cpy, li.Template.Versions)\n\t*items = cpy\n\treturn true\n}", "title": "" }, { "docid": "b4e28c8f57330b365a667bb1f8ecc81b", "score": "0.54925823", "text": "func (o ObservableFoo) Filter(predicate func(next foo) bool) ObservableFoo {\n\tobservable := func(observe FooObserver, subscribeOn Scheduler, subscriber Subscriber) {\n\t\tobserver := func(next foo, err error, done bool) {\n\t\t\tif done || predicate(next) {\n\t\t\t\tobserve(next, err, done)\n\t\t\t}\n\t\t}\n\t\to(observer, subscribeOn, subscriber)\n\t}\n\treturn observable\n}", "title": "" }, { "docid": "385f3ecc7348209d35481b12451f24be", "score": "0.54528666", "text": "func (EmptyPersistentList) First() (ww.Any, error) { return nil, nil }", "title": "" }, { "docid": "a05f744bcf428f10113bff652fdeb407", "score": "0.53956103", "text": "func FirstJust(fn func() error) SequenceBuilder {\n\treturn SequenceOf(PhaseOf(fn))\n}", "title": "" }, { "docid": "5e30d85fc037e684aee1f8b7cba56791", "score": "0.53852624", "text": "func (t *SimilarTomates) First() *SimilarTomate {\n\tvar ret *SimilarTomate\n\tif len(t.items) > 0 {\n\t\tret = t.items[0]\n\t}\n\treturn ret\n}", "title": "" }, { "docid": "df74e454a5df66f461b2a7307a0fc358", "score": "0.5313605", "text": "func First(query string, replicas ...Search) Result { // HL\n\t// Buffered channel to hold obtained results.\n\tc := make(chan Result, len(replicas)) // HL\n\tsearch := func(replica Search) { c <- replica(query) } // HL\n\tfor _, replica := range replicas {\n\t\tgo search(replica) // HL\n\t}\n\treturn <-c // The value is returned, not the channel. // HL\n}", "title": "" }, { "docid": "4a5f6f9deb76a4366a85d58a953bedf7", "score": "0.53085804", "text": "func (m CMap) Single(predicate func(Value) bool) (Value, bool) {\n\tf := m.FilteredSnapshot(predicate)\n\tif len(f) == 1 {\n\t\tfor _, v := range f {\n\t\t\treturn v, true\n\t\t}\n\t}\n\tvar v Value\n\treturn v, false\n}", "title": "" }, { "docid": "d7fde41dc699db0270b98a4053b6fd42", "score": "0.5293309", "text": "func (s Set) First(less Less) interface{} {\n\tfor _, i := range s.OrderedFirstN(1, less) {\n\t\treturn i\n\t}\n\tpanic(\"Set.First(): empty set\")\n}", "title": "" }, { "docid": "b873ee211d2eaa34bb9984c249ba9aff", "score": "0.52794456", "text": "func (e Entries) First(matcher Matcher) (Entry, bool) {\n\tfor _, entry := range e {\n\t\tif matcher.Match(entry) {\n\t\t\treturn entry, true\n\t\t}\n\t}\n\treturn Entry{}, false\n}", "title": "" }, { "docid": "80445747d089b22fab03bedc3d77e80b", "score": "0.52654856", "text": "func (l PersistentHeadList) First() (ww.Any, error) {\n\tlist, err := l.Any.List()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\thead, err := list.Head()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn AsAny(head)\n}", "title": "" }, { "docid": "c452624217f0718c2829a2338074b0f6", "score": "0.5235969", "text": "func (o Observable) Last() Observable {\n\tobservable := func(observe Observer, subscribeOn Scheduler, subscriber Subscriber) {\n\t\thave := false\n\t\tvar last interface{}\n\t\tobserver := func(next interface{}, err error, done bool) {\n\t\t\tif done {\n\t\t\t\tif have {\n\t\t\t\t\tobserve(last, nil, false)\n\t\t\t\t}\n\t\t\t\tobserve(nil, err, true)\n\t\t\t} else {\n\t\t\t\tlast = next\n\t\t\t\thave = true\n\t\t\t}\n\t\t}\n\t\to(observer, subscribeOn, subscriber)\n\t}\n\treturn observable\n}", "title": "" }, { "docid": "5e1fe7bd7f5e81b6078e27e736704ead", "score": "0.5232732", "text": "func (us Units) First(filters ...Filter) *Unit {\n\tif len(filters) == 0 {\n\t\tif len(us) == 0 {\n\t\t\treturn nil\n\t\t}\n\t\treturn us[0]\n\t}\nNextUnit:\n\tfor _, unit := range us {\n\t\tfor _, filter := range filters {\n\t\t\tif !filter(unit) {\n\t\t\t\tcontinue NextUnit\n\t\t\t}\n\t\t}\n\t\treturn unit\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "4fad12a06931dab65d40c6f4f43fbee9", "score": "0.51615375", "text": "func (t Timeline) First(matcher Matcher) (Entry, bool) {\n\treturn t.Entries.First(matcher)\n}", "title": "" }, { "docid": "568f895bb7912c243cf12a10ad72053c", "score": "0.51537716", "text": "func (e Errors) First() error {\n\tif errorCount := len(e); errorCount > 0 {\n\t\tvar err error\n\t\tfor x := 0; x < errorCount; x++ {\n\t\t\terr = <-e\n\t\t\tif err != nil {\n\t\t\t\treturn ex.New(err)\n\t\t\t}\n\t\t}\n\t\treturn nil\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "eef2fb05305a5ca785227019d8d8f32d", "score": "0.51277393", "text": "func (txn *Txn) First(key []byte) ([]byte, interface{}, error) {\n\t_, k, val, err := txn.FirstWatch(key)\n\treturn k, val, err\n}", "title": "" }, { "docid": "24bbc96c7ca0219e7c5094bfeb74687a", "score": "0.51134765", "text": "func (collection *Collection) First() Modellable {\n\treturn collection.items[0]\n}", "title": "" }, { "docid": "d5934b667f1363023733fcba75b47258", "score": "0.51030266", "text": "func (res *SaucenaoResponse) First() SearchResult {\n\tif res.Count() == 0 {\n\t\treturn SearchResult{}\n\t}\n\n\treturn res.Results[0]\n}", "title": "" }, { "docid": "6488c3afb28d4f4b9a48c21afb55f92a", "score": "0.5096559", "text": "func (a arrayBool) First() ResultBool {\n\tif len(a) > 0 {\n\t\treturn OkBool(a[0])\n\t}\n\treturn ErrBool(\"Out Of Bound Array Access\")\n}", "title": "" }, { "docid": "26c0e48cf83cf3f0c5c5e7718b53d515", "score": "0.5096144", "text": "func (tcq *TradeConditionQuery) FirstX(ctx context.Context) *TradeCondition {\n\tnode, err := tcq.First(ctx)\n\tif err != nil && !IsNotFound(err) {\n\t\tpanic(err)\n\t}\n\treturn node\n}", "title": "" }, { "docid": "eb42f44e5d3c6f8eea68c842b0365055", "score": "0.5083313", "text": "func (list *List) First() Modellable {\n\treturn list.items[0]\n}", "title": "" }, { "docid": "1b7eb4bd4611bb82a98ae9eeaef2ee9f", "score": "0.50822324", "text": "func (m *Model) First(c *sqlquery.Condition) error {\n\tif !m.isInitialized {\n\t\treturn fmt.Errorf(errInit, FIRST, reflect.TypeOf(m.caller))\n\t}\n\n\t// reset loop detection TODO in every mode (ALL,CREATE,UPDATE,DELETE)\n\tif m.parentModel == nil {\n\t\tm.loopDetection = nil\n\t}\n\n\t// TODO Callbacks before\n\n\t// create sql condition\n\tif c == nil {\n\t\tc = &sqlquery.Condition{}\n\t}\n\n\ts, err := m.strategy()\n\tif err != nil {\n\t\treturn err\n\t}\n\n\terr = m.scope.setFieldPermission()\n\tif err != nil {\n\t\treturn err\n\t}\n\n\terr = m.scope.checkLoopMap(c.Config(true, sqlquery.WHERE))\n\tif err != nil {\n\t\treturn err\n\t}\n\n\terr = s.First(m.scope, c, Permission{Read: true})\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// TODO Callbacks after\n\n\treturn nil\n}", "title": "" }, { "docid": "b5144be6dfca608205b854bbf09f98c1", "score": "0.50756353", "text": "func (c BaseCollection) First(...CB) interface{} {\n\tpanic(\"not implement\")\n}", "title": "" }, { "docid": "f439692e8cd8f952f9d20dae6d8513f5", "score": "0.50690264", "text": "func (l *list) First() (interface{}, bool) {\n\tif l.len == 0 {\n\t\treturn nil, false\n\t}\n\n\treturn l.first.value, true\n}", "title": "" }, { "docid": "4352417f896dea11114dc67cbf5184f8", "score": "0.5061903", "text": "func (c BaseCollection) FirstWhere(key string, values ...interface{}) map[string]interface{} {\n\tpanic(\"not implement\")\n}", "title": "" }, { "docid": "6c4404e7f44d89543a0e0d9c358c61af", "score": "0.5057909", "text": "func (l PackedPersistentList) First() (ww.Any, error) {\n\tlist, err := l.List()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tcell, err := list.PackedConsCell()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\thead, err := cell.Head()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn AsAny(head)\n}", "title": "" }, { "docid": "2a3304a31043f767b68d530972675519", "score": "0.50550574", "text": "func (eq *EventQuery) FirstX(ctx context.Context) *Event {\n\te, err := eq.First(ctx)\n\tif err != nil && !IsNotFound(err) {\n\t\tpanic(err)\n\t}\n\treturn e\n}", "title": "" }, { "docid": "c5d51117789c6d63f9083982ea0a6e97", "score": "0.5049603", "text": "func (parent *Observable) Last() (o *Observable) {\n\to = parent.newFilteringObservable(\"last\")\n\to.first, o.last, o.distinct, o.ignoreElement = false, true, false, false\n\to.debounce, o.take, o.skip = 0, 0, 0\n\to.operator = filteringTotalOperator\n\treturn o\n}", "title": "" }, { "docid": "ff190ecdb71945967d5c4b49cce06943", "score": "0.5046585", "text": "func (l DeepPersistentList) First() (ww.Any, error) {\n\tlist, err := l.Any.List()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tcell, err := list.ConsCell()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\thead, err := cell.Head()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn AsAny(head)\n}", "title": "" }, { "docid": "4fff47d39b958d8cc090b2b560983a7c", "score": "0.5031611", "text": "func (oliq *OrderLineItemQuery) FirstX(ctx context.Context) *OrderLineItem {\n\toli, err := oliq.First(ctx)\n\tif err != nil && !IsNotFound(err) {\n\t\tpanic(err)\n\t}\n\treturn oli\n}", "title": "" }, { "docid": "2373dfbdfe53fb3d900fd94c070e8850", "score": "0.5028394", "text": "func (s Selector) First() Node {\n\treturn Node{func(delta wit.Delta) {\n\t\ts.parent.Send(wit.First{\n\t\t\tSelector: s.selector,\n\t\t\tDelta: delta,\n\t\t})\n\t}}\n}", "title": "" }, { "docid": "fa41ad86c5cc7dba2e22a094977a929e", "score": "0.5004699", "text": "func (o ObservableFoo) Last() ObservableFoo {\n\treturn o.AsObservable().Last().AsObservableFoo()\n}", "title": "" }, { "docid": "09c74074beb7daa7d0e9b48e4671c4b1", "score": "0.49924994", "text": "func (r *Results) First() map[string]interface{} {\n\tif len(r.Output[0]) == 0 {\n\t\treturn nil\n\t}\n\n\treturn r.Output[0][0]\n}", "title": "" }, { "docid": "be0b43f83c913e4c41d8fbe8fa5b274f", "score": "0.49608758", "text": "func (rq *ReceiptQuery) First(ctx context.Context) (*Receipt, error) {\n\trs, err := rq.Limit(1).All(ctx)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tif len(rs) == 0 {\n\t\treturn nil, &ErrNotFound{receipt.Label}\n\t}\n\treturn rs[0], nil\n}", "title": "" }, { "docid": "ec16ce3042e9195b484c0382b7d60fb2", "score": "0.49477506", "text": "func (m Masker) First() Masker {\n\treturn m &^ (m - 1)\n}", "title": "" }, { "docid": "1522f12befb2c616130238b91985cb5a", "score": "0.4938949", "text": "func First(query string, replicas ...Search) string {\n\tc := make(chan string)\n\tsearchReplica := func(i int) { c <- replicas[i](query) }\n\tfor i := range replicas {\n\t\tgo searchReplica(i)\n\t}\n\treturn <-c\n}", "title": "" }, { "docid": "be05e03905c62aaba77e6185693d0010", "score": "0.49197906", "text": "func (this Querier) First(e Entity) error {\n\ti := this.q.Run(this.c)\n\tkey, err := i.Next(e)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\te.SetKey(key)\n\treturn nil\n}", "title": "" }, { "docid": "1d766ad2c7337eca8baf6a01de2f1d93", "score": "0.49113855", "text": "func FluxFromSlice(items []cesium.T) cesium.Flux {\n\tif len(items) == 0 {\n\t\treturn FluxEmpty()\n\t}\n\n\tif len(items) == 1 {\n\t\treturn fluxFromCallable(func() (cesium.T, bool) {\n\t\t\treturn items[0], true\n\t\t})\n\t}\n\n\tonPublish := func(subscriber cesium.Subscriber, scheduler cesium.Scheduler) cesium.Subscription {\n\t\tif scheduler == nil {\n\t\t\tscheduler = SeparateGoroutineScheduler()\n\t\t}\n\n\t\tmux := sync.Mutex{}\n\t\tindex := 0\n\t\trequested := int64(0)\n\t\tunbounded := false\n\n\t\tswitch s := subscriber.(type) {\n\t\tcase ConditionalSubscriber:\n\t\t\tfastPath := func(canceller cesium.Canceller) {\n\t\t\t\tfor ; index < len(items); index++ {\n\t\t\t\t\tif canceller.IsCancelled() {\n\t\t\t\t\t\treturn\n\t\t\t\t\t}\n\n\t\t\t\t\ts.OnNextIf(items[index])\n\t\t\t\t}\n\n\t\t\t\tif canceller.IsCancelled() {\n\t\t\t\t\treturn\n\t\t\t\t}\n\n\t\t\t\ts.OnComplete()\n\t\t\t}\n\n\t\t\tcancellable := scheduler.Schedule(func(canceller cesium.Canceller) {\n\t\t\tsliceFor:\n\t\t\t\tfor ; index < len(items); index++ {\n\t\t\t\t\tfor {\n\t\t\t\t\t\tif canceller.IsCancelled() {\n\t\t\t\t\t\t\treturn\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tmux.Lock()\n\t\t\t\t\t\tif unbounded {\n\t\t\t\t\t\t\tmux.Unlock()\n\t\t\t\t\t\t\tfastPath(canceller)\n\t\t\t\t\t\t\treturn\n\t\t\t\t\t\t}\n\t\t\t\t\t\tmux.Unlock()\n\n\t\t\t\t\t\tmux.Lock()\n\t\t\t\t\t\tif requested > 0 {\n\t\t\t\t\t\t\trequested = requested - 1\n\t\t\t\t\t\t\tmux.Unlock()\n\n\t\t\t\t\t\t\tif canceller.IsCancelled() {\n\t\t\t\t\t\t\t\treturn\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\tif !s.OnNextIf(items[index]) {\n\t\t\t\t\t\t\t\tmux.Lock()\n\t\t\t\t\t\t\t\trequested = requested + 1\n\t\t\t\t\t\t\t\tmux.Unlock()\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tcontinue sliceFor\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tmux.Unlock()\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tif canceller.IsCancelled() {\n\t\t\t\t\treturn\n\t\t\t\t}\n\n\t\t\t\ts.OnComplete()\n\t\t\t})\n\n\t\t\tsub := &Subscription{\n\t\t\t\tCancelFunc: func() {\n\t\t\t\t\tcancellable.Cancel()\n\t\t\t\t},\n\t\t\t\tRequestFunc: func(n int64) {\n\t\t\t\t\tmux.Lock()\n\t\t\t\t\tif unbounded {\n\t\t\t\t\t\tmux.Unlock()\n\t\t\t\t\t\treturn\n\t\t\t\t\t}\n\n\t\t\t\t\tif n == math.MaxInt64 {\n\t\t\t\t\t\tunbounded = true\n\t\t\t\t\t} else {\n\t\t\t\t\t\trequested = requested + n\n\t\t\t\t\t}\n\t\t\t\t\tmux.Unlock()\n\t\t\t\t},\n\t\t\t}\n\n\t\t\ts.OnSubscribe(sub)\n\t\t\treturn sub\n\t\tdefault:\n\t\t\tfastPath := func(canceller cesium.Canceller) {\n\t\t\t\tfor ; index < len(items); index++ {\n\t\t\t\t\tif canceller.IsCancelled() {\n\t\t\t\t\t\treturn\n\t\t\t\t\t}\n\n\t\t\t\t\tsubscriber.OnNext(items[index])\n\t\t\t\t}\n\n\t\t\t\tif canceller.IsCancelled() {\n\t\t\t\t\treturn\n\t\t\t\t}\n\n\t\t\t\tsubscriber.OnComplete()\n\t\t\t}\n\n\t\t\tcancellable := scheduler.Schedule(func(canceller cesium.Canceller) {\n\t\t\tsliceFor:\n\t\t\t\tfor ; index < len(items); index++ {\n\t\t\t\t\tfor {\n\t\t\t\t\t\tif canceller.IsCancelled() {\n\t\t\t\t\t\t\treturn\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tmux.Lock()\n\t\t\t\t\t\tif unbounded {\n\t\t\t\t\t\t\tmux.Unlock()\n\t\t\t\t\t\t\tfastPath(canceller)\n\t\t\t\t\t\t\treturn\n\t\t\t\t\t\t}\n\t\t\t\t\t\tmux.Unlock()\n\n\t\t\t\t\t\tmux.Lock()\n\t\t\t\t\t\tif requested > 0 {\n\t\t\t\t\t\t\trequested = requested - 1\n\t\t\t\t\t\t\tmux.Unlock()\n\n\t\t\t\t\t\t\tif canceller.IsCancelled() {\n\t\t\t\t\t\t\t\treturn\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\tsubscriber.OnNext(items[index])\n\t\t\t\t\t\t\tcontinue sliceFor\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tmux.Unlock()\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tif canceller.IsCancelled() {\n\t\t\t\t\treturn\n\t\t\t\t}\n\n\t\t\t\tsubscriber.OnComplete()\n\t\t\t})\n\n\t\t\tsub := &Subscription{\n\t\t\t\tCancelFunc: func() {\n\t\t\t\t\tcancellable.Cancel()\n\t\t\t\t},\n\t\t\t\tRequestFunc: func(n int64) {\n\t\t\t\t\tmux.Lock()\n\t\t\t\t\tif unbounded {\n\t\t\t\t\t\tmux.Unlock()\n\t\t\t\t\t\treturn\n\t\t\t\t\t}\n\n\t\t\t\t\tif n == math.MaxInt64 {\n\t\t\t\t\t\tunbounded = true\n\t\t\t\t\t} else {\n\t\t\t\t\t\trequested = requested + n\n\t\t\t\t\t}\n\t\t\t\t\tmux.Unlock()\n\t\t\t\t},\n\t\t\t}\n\n\t\t\tsubscriber.OnSubscribe(sub)\n\t\t\treturn sub\n\t\t}\n\t}\n\n\treturn &Flux{OnSubscribe: onPublish}\n}", "title": "" }, { "docid": "be714c6a244ff8862d099d18ebcbfc3d", "score": "0.4908556", "text": "func (s *ItemFilter) MustGetFirstItem() Item {\n\ti, err := s.GetFirstItem()\n\tif err != nil {\n\t\treturn Item{unmarshalErr: err}\n\t}\n\treturn i\n}", "title": "" }, { "docid": "58a72274d7ac9a4cd697441b391dd5b9", "score": "0.49071148", "text": "func (mm *MultiMap[K, V]) First() *MapIterator[K, V] {\n\tmm.locker.RLock()\n\tdefer mm.locker.RUnlock()\n\n\treturn &MapIterator[K, V]{node: mm.tree.First()}\n}", "title": "" }, { "docid": "f911550e1cca69b9ee5afc817be580e4", "score": "0.49068388", "text": "func (rq *ReceiptQuery) FirstX(ctx context.Context) *Receipt {\n\tr, err := rq.First(ctx)\n\tif err != nil && !IsNotFound(err) {\n\t\tpanic(err)\n\t}\n\treturn r\n}", "title": "" }, { "docid": "a22e386ff755ac1e313bb73dd0320ec3", "score": "0.49055663", "text": "func (o *One) First() error {\n\treturn o.err\n}", "title": "" }, { "docid": "118c768e1effc7e43513bd1460eb8286", "score": "0.49018353", "text": "func (observable Observable) Just(publisher Publisher) Observable {\n\tobservable.Publisher = publisher\n\treturn observable\n}", "title": "" }, { "docid": "ec7b9754d90a80a3d6620d0b36881963", "score": "0.48905945", "text": "func (l *SingleList) First() (interface{}, error) {\n\tif l.head == nil {\n\t\treturn \"\", fmt.Errorf(\"Single List is empty\")\n\t}\n\treturn l.head.Data, nil\n}", "title": "" }, { "docid": "24ed4e947ef544517bdccd09c9cd4dc5", "score": "0.48868367", "text": "func (q *Query) First(consumer RowsConsumer) (err error) {\n\tdefer func() { err = q.finalizer(recover(), err) }()\n\n\tvar rows *sql.Rows\n\trows, err = q.exec()\n\tif err != nil {\n\t\treturn\n\t}\n\tdefer rows.Close()\n\n\terr = rows.Err()\n\tif err != nil {\n\t\terr = exception.New(err)\n\t\treturn\n\t}\n\n\tif rows.Next() {\n\t\terr = consumer(rows)\n\t\tif err != nil {\n\t\t\treturn\n\t\t}\n\t}\n\treturn\n}", "title": "" }, { "docid": "0b73fae603c48572a5457bb579ffedcb", "score": "0.4879233", "text": "func (ms *MultiSet[T]) First() *SetIterator[T] {\n\tms.locker.RLock()\n\tdefer ms.locker.RUnlock()\n\n\treturn &SetIterator[T]{node: ms.tree.First()}\n}", "title": "" }, { "docid": "3568d52953873479cb7aac7f0366753d", "score": "0.4863003", "text": "func (itr *SortedSetIterator[T]) First() {\n\titr.mi.First()\n}", "title": "" }, { "docid": "24d7786a3a735a89dc031fec362f0b7a", "score": "0.48619404", "text": "func (o Observable) Distinct() Observable {\n\tobservable := func(observe Observer, subscribeOn Scheduler, subscriber Subscriber) {\n\t\tseen := map[interface{}]struct{}{}\n\t\tobserver := func(next interface{}, err error, done bool) {\n\t\t\tif !done {\n\t\t\t\tif _, present := seen[next]; present {\n\t\t\t\t\treturn\n\t\t\t\t}\n\t\t\t\tseen[next] = struct{}{}\n\t\t\t}\n\t\t\tobserve(next, err, done)\n\t\t}\n\t\to(observer, subscribeOn, subscriber)\n\t}\n\treturn observable\n}", "title": "" }, { "docid": "4ccfa25414377608275fef598557f0a7", "score": "0.48567754", "text": "func (itr *SetIterator[T]) First() {\n\titr.mi.First()\n}", "title": "" }, { "docid": "3c15c58728ffea1c485675f959008aa6", "score": "0.4855926", "text": "func (alq *AuditLogQuery) First(ctx context.Context) (*AuditLog, error) {\n\tals, err := alq.Limit(1).All(ctx)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tif len(als) == 0 {\n\t\treturn nil, &ErrNotFound{auditlog.Label}\n\t}\n\treturn als[0], nil\n}", "title": "" }, { "docid": "4e52aecce0cb1e90c359824d935604b5", "score": "0.48488766", "text": "func (eq *EventQuery) FirstX(ctx context.Context) *Event {\n\tnode, err := eq.First(ctx)\n\tif err != nil && !IsNotFound(err) {\n\t\tpanic(err)\n\t}\n\treturn node\n}", "title": "" }, { "docid": "742ca8b64152d543ddf4bb46d4b235cc", "score": "0.48271242", "text": "func (this *setOp) First() Subresult {\n\treturn this.first\n}", "title": "" }, { "docid": "c78555584d4e7f6f45116369ea70c349", "score": "0.48265558", "text": "func (o Observable) TakeLast(n int) Observable {\n\tobservable := func(observe Observer, subscribeOn Scheduler, subscriber Subscriber) {\n\t\tread := 0\n\t\twrite := 0\n\t\tn++\n\t\tbuffer := make([]interface{}, n)\n\t\tobserver := func(next interface{}, err error, done bool) {\n\t\t\tif done {\n\t\t\t\tfor read != write {\n\t\t\t\t\tobserve(buffer[read], nil, false)\n\t\t\t\t\tread = (read + 1) % n\n\t\t\t\t}\n\t\t\t\tobserve(nil, err, true)\n\t\t\t} else {\n\t\t\t\tbuffer[write] = next\n\t\t\t\twrite = (write + 1) % n\n\t\t\t\tif write == read {\n\t\t\t\t\tread = (read + 1) % n\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\to(observer, subscribeOn, subscriber)\n\t}\n\treturn observable\n}", "title": "" }, { "docid": "77ff2b9b53904537eab832e493e18f0f", "score": "0.4825836", "text": "func (l *Generic) GetFirst() interface{} {\n\treturn l.list[0]\n}", "title": "" }, { "docid": "10ca9085eed8631bcf6cd2d9528a92f4", "score": "0.48243156", "text": "func (s OverflowSlice) UntilFirst(f func(Peer) bool) OverflowSlice {\n\ttail := s\n\tfor len(tail) > 0 {\n\t\tp := tail[0]\n\t\ttail = tail[1:]\n\t\tif f(p) {\n\t\t\tbreak\n\t\t}\n\t}\n\treturn tail\n}", "title": "" }, { "docid": "f920f0aaead86c32ba0f66a8162384b2", "score": "0.4822228", "text": "func (sr *StatusRQuery) FirstX(ctx context.Context) *StatusR {\n\ts, err := sr.First(ctx)\n\tif err != nil && !IsNotFound(err) {\n\t\tpanic(err)\n\t}\n\treturn s\n}", "title": "" }, { "docid": "4f9be3db1abb27ebbef38249b163e3cc", "score": "0.48149902", "text": "func (b *DB) First(out interface{}, where ...interface{}) *DB {\n\treturn b.clone(b.DB.First(out, where...))\n}", "title": "" }, { "docid": "0df2b2da22279f697595a2192e392955", "score": "0.48117644", "text": "func (o ObservableObservable) CombineLatestAll() ObservableSlice {\n\tobservable := func(observe SliceObserver, subscribeOn Scheduler, subscriber Subscriber) {\n\t\tobservables := []Observable(nil)\n\t\tvar observers struct {\n\t\t\tsync.Mutex\n\t\t\tassigned\t[]bool\n\t\t\tvalues\t\t[]interface{}\n\t\t\tinitialized\tint\n\t\t\tactive\t\tint\n\t\t}\n\t\tmakeObserver := func(index int) Observer {\n\t\t\tobserver := func(next interface{}, err error, done bool) {\n\t\t\t\tobservers.Lock()\n\t\t\t\tdefer observers.Unlock()\n\t\t\t\tif observers.active > 0 {\n\t\t\t\t\tswitch {\n\t\t\t\t\tcase !done:\n\t\t\t\t\t\tif !observers.assigned[index] {\n\t\t\t\t\t\t\tobservers.assigned[index] = true\n\t\t\t\t\t\t\tobservers.initialized++\n\t\t\t\t\t\t}\n\t\t\t\t\t\tobservers.values[index] = next\n\t\t\t\t\t\tif observers.initialized == len(observers.values) {\n\t\t\t\t\t\t\tobserve(observers.values, nil, false)\n\t\t\t\t\t\t}\n\t\t\t\t\tcase err != nil:\n\t\t\t\t\t\tobservers.active = 0\n\t\t\t\t\t\tvar zero []interface{}\n\t\t\t\t\t\tobserve(zero, err, true)\n\t\t\t\t\tdefault:\n\t\t\t\t\t\tif observers.active--; observers.active == 0 {\n\t\t\t\t\t\t\tvar zero []interface{}\n\t\t\t\t\t\t\tobserve(zero, nil, true)\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\treturn observer\n\t\t}\n\n\t\tobserver := func(next Observable, err error, done bool) {\n\t\t\tswitch {\n\t\t\tcase !done:\n\t\t\t\tobservables = append(observables, next)\n\t\t\tcase err != nil:\n\t\t\t\tvar zero []interface{}\n\t\t\t\tobserve(zero, err, true)\n\t\t\tdefault:\n\t\t\t\tsubscribeOn.Schedule(func() {\n\t\t\t\t\tif subscriber.Subscribed() {\n\t\t\t\t\t\tnumObservables := len(observables)\n\t\t\t\t\t\tobservers.assigned = make([]bool, numObservables)\n\t\t\t\t\t\tobservers.values = make([]interface{}, numObservables)\n\t\t\t\t\t\tobservers.active = numObservables\n\t\t\t\t\t\tfor i, v := range observables {\n\t\t\t\t\t\t\tif !subscriber.Subscribed() {\n\t\t\t\t\t\t\t\treturn\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tv(makeObserver(i), subscribeOn, subscriber)\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\to(observer, subscribeOn, subscriber)\n\t}\n\treturn observable\n}", "title": "" }, { "docid": "931f1644fd42639f1590b37faa37a9d8", "score": "0.4798172", "text": "func (ob *Observer) OnNext(v interface{}) {\n ob.observable.C <- v\n}", "title": "" }, { "docid": "9b848b2ef8361aec288c9e9b246a51e9", "score": "0.47966912", "text": "func (alq *AuditLogQuery) FirstX(ctx context.Context) *AuditLog {\n\tal, err := alq.First(ctx)\n\tif err != nil && !IsNotFound(err) {\n\t\tpanic(err)\n\t}\n\treturn al\n}", "title": "" }, { "docid": "e3816818491f51739c7a28d8db26eb23", "score": "0.4796631", "text": "func (tq *TaskQuery) FirstX(ctx context.Context) *Task {\n\tnode, err := tq.First(ctx)\n\tif err != nil && !IsNotFound(err) {\n\t\tpanic(err)\n\t}\n\treturn node\n}", "title": "" }, { "docid": "125aa3a791081fd6a0ac0cd1cc8c1415", "score": "0.47891298", "text": "func (txn *Txn) FirstWatch(key []byte) (<-chan struct{}, []byte, interface{}, error) {\n\t// Get the index itself\n\tindexTxn := txn.readableIndex(defTable, id)\n\n\tkey = toIndexKey(key)\n\t// Do an exact lookup\n\tif key != nil {\n\t\twatch, obj, ok := indexTxn.GetWatch(key)\n\t\tif !ok {\n\t\t\treturn watch, nil, nil, nil\n\t\t}\n\t\treturn watch, nil, obj, nil\n\t}\n\n\t// Handle non-unique index by using an iterator and getting the first value\n\titer := indexTxn.Root().Iterator()\n\twatch := iter.SeekPrefixWatch(key)\n\tk, value, _ := iter.Next()\n\treturn watch, extractFromIndexKey(k), value, nil\n}", "title": "" }, { "docid": "c9bb09350bef9add904d0fa292139398", "score": "0.4787275", "text": "func FirstNonEmpty(v ...interface{}) interface{} {\n\tfor _, val := range v {\n\t\tif !IsEmpty(val) {\n\t\t\treturn val\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "e157014df58568189424314ed9b7f4eb", "score": "0.4784658", "text": "func FromObservable(slice ...Observable) ObservableObservable {\n\tobservable := func(observe ObservableObserver, scheduler Scheduler, subscriber Subscriber) {\n\t\ti := 0\n\t\trunner := scheduler.ScheduleRecursive(func(self func()) {\n\t\t\tif subscriber.Subscribed() {\n\t\t\t\tif i < len(slice) {\n\t\t\t\t\tobserve(slice[i], nil, false)\n\t\t\t\t\tif subscriber.Subscribed() {\n\t\t\t\t\t\ti++\n\t\t\t\t\t\tself()\n\t\t\t\t\t}\n\t\t\t\t} else {\n\t\t\t\t\tvar zero Observable\n\t\t\t\t\tobserve(zero, nil, true)\n\t\t\t\t}\n\t\t\t}\n\t\t})\n\t\tsubscriber.OnUnsubscribe(runner.Cancel)\n\t}\n\treturn observable\n}", "title": "" }, { "docid": "02b7d66119a55cd6f56c4d642eb73ce4", "score": "0.47829154", "text": "func FirstOrZero[E comparable](s ...E) E {\n\tvar zeroE E\n\treturn FirstOrZeroFunc(s, func(e E) bool { return e != zeroE })\n}", "title": "" }, { "docid": "32f89543c6e17718bb65a63ad6d72408", "score": "0.47800317", "text": "func (a *Alias) First(t *testing.T, aliases ...*kms.AliasListEntry) *Alias {\n\tvar err error\n\taliases, err = a.filter(aliases)\n\tif err != nil {\n\t\tt.Fatal(err)\n\t}\n\n\tif len(aliases) == 0 {\n\t\tt.Fatal(\"no matching alias was found\")\n\t} else {\n\t\ta.alias = aliases[0]\n\t}\n\n\ta.filters = []shared.Filter{}\n\treturn a\n}", "title": "" }, { "docid": "9c3796ebed0db288c5adc3791afafa47", "score": "0.47713193", "text": "func FirstFunc[S ~[]E, E any](s S, f func(E) bool) (e E, ok bool) {\n\tvar zeroE E\n\ti := slices.IndexFunc(s, f)\n\tif i == -1 {\n\t\treturn zeroE, false\n\t}\n\treturn s[i], true\n}", "title": "" }, { "docid": "6b7791cbfb9a69f5bed65f49647c3783", "score": "0.4762146", "text": "func (s AuthSentCodeSuccessArray) First() (v AuthSentCodeSuccess, ok bool) {\n\tif len(s) < 1 {\n\t\treturn\n\t}\n\treturn s[0], true\n}", "title": "" }, { "docid": "133ccd29dfdc9cccf09e980dc44e38bb", "score": "0.4757715", "text": "func (parent *Observable) Last() (o *Observable) {\n\to = parent.newFilterObservable(\"last\")\n\to.operator = lastOperator\n\n\to.only_first, o.only_last, o.only_distinct = false, true, false\n\to.debounce_timespan = 0\n\to.take, o.skip = 0, 0\n\n\treturn o\n}", "title": "" }, { "docid": "4926da0de4e304e767098e915b8e4ec5", "score": "0.47571653", "text": "func (o ObservableFoo) Take(n int) ObservableFoo {\n\treturn o.AsObservable().Take(n).AsObservableFoo()\n}", "title": "" }, { "docid": "cde7994321971b9a6d92d69c78f91ec2", "score": "0.4756011", "text": "func (r *DB) First() (map[string]interface{}, error) {\n\tres, err := r.Get()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tif len(res) > 0 {\n\t\treturn res[0], nil\n\t}\n\treturn nil, fmt.Errorf(\"no records were produced by query: %s\", r.Builder.buildSelect())\n}", "title": "" }, { "docid": "b15cfeab9626fedb9163b6a93f4f2f03", "score": "0.47550917", "text": "func first() {\n\tfmt.Println(\"one\")\n\toneDone <- true\n}", "title": "" }, { "docid": "3e43bf901c98713c41ff7c964aa296a7", "score": "0.47503003", "text": "func (cl *ContactsList) First() *Contact {\n\tcl.iter = 0 // reset iteration\n\treturn cl.cnt[0]\n}", "title": "" }, { "docid": "fb14fd90a7ffce86332af7bf994787ed", "score": "0.4748281", "text": "func (mo MultiOperator) First() Node {\n\tif len(mo.Arguments) > 0 {\n\t\treturn mo.Arguments[0]\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "7b90610ef1d1aecf497a539f41b0f634", "score": "0.47402677", "text": "func (s NotificationSoundRingtoneArray) First() (v NotificationSoundRingtone, ok bool) {\n\tif len(s) < 1 {\n\t\treturn\n\t}\n\treturn s[0], true\n}", "title": "" }, { "docid": "e77ec5b0e75b901e4959afc7ff462164", "score": "0.4738105", "text": "func (s *Selection) First(thread *starlark.Thread, _ *starlark.Builtin, args starlark.Tuple, kwargs []starlark.Tuple) (starlark.Value, error) {\n\treturn NewSelectionStruct(s.sel.First()), nil\n}", "title": "" }, { "docid": "967e75f4783e0da6a77680ba29e3f13e", "score": "0.47247657", "text": "func (m *NotificationQueuer) Next(arg0 context.Context) (*sql.ProjectionNotification, bool) {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"Next\", arg0)\n\tret0, _ := ret[0].(*sql.ProjectionNotification)\n\tret1, _ := ret[1].(bool)\n\treturn ret0, ret1\n}", "title": "" }, { "docid": "30506c784c19658d58269a9f3314aad7", "score": "0.47140154", "text": "func (mnq *MedicalNoteQuery) FirstX(ctx context.Context) *MedicalNote {\n\tmn, err := mnq.First(ctx)\n\tif err != nil && !IsNotFound(err) {\n\t\tpanic(err)\n\t}\n\treturn mn\n}", "title": "" }, { "docid": "0a55969309d18e5bf7066ef950c49c50", "score": "0.47090632", "text": "func pickFirst[T ndp.Option](options []ndp.Option) (T, bool) {\n\tfor _, o := range options {\n\t\tif t, ok := o.(T); ok {\n\t\t\treturn t, true\n\t\t}\n\t}\n\n\treturn *new(T), false\n}", "title": "" }, { "docid": "d088581a5383e5c2c5dd57f295292d13", "score": "0.47078833", "text": "func (o Observable) SkipLast(n int) Observable {\n\tobservable := func(observe Observer, subscribeOn Scheduler, subscriber Subscriber) {\n\t\tread := 0\n\t\twrite := 0\n\t\tn++\n\t\tbuffer := make([]interface{}, n)\n\t\tobserver := func(next interface{}, err error, done bool) {\n\t\t\tif done {\n\t\t\t\tobserve(nil, err, true)\n\t\t\t} else {\n\t\t\t\tbuffer[write] = next\n\t\t\t\twrite = (write + 1) % n\n\t\t\t\tif write == read {\n\t\t\t\t\tobserve(buffer[read], nil, false)\n\t\t\t\t\tread = (read + 1) % n\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\to(observer, subscribeOn, subscriber)\n\t}\n\treturn observable\n}", "title": "" }, { "docid": "a83bf414a8ceb7e05ef841b9a65db81f", "score": "0.47068983", "text": "func (it *flushIterator) First() (*base.InternalKey, base.LazyValue) {\n\tkey, val := it.Iterator.First()\n\tif key == nil {\n\t\treturn nil, base.LazyValue{}\n\t}\n\t*it.bytesIterated += uint64(it.nd.allocSize)\n\treturn key, val\n}", "title": "" }, { "docid": "3479e3cd97e451e895eae64e724f2f0c", "score": "0.4706361", "text": "func (coll *Collection) First(filter interface{}, model Model, opts ...*options.FindOneOptions) error {\n\treturn first(coll, filter, model, opts...)\n}", "title": "" }, { "docid": "a9e093ae5a807b28054d300b4889146e", "score": "0.47063595", "text": "func firstSend(dic *di.Container, n models.Notification, trans models.Transmission) models.Transmission {\n\tlc := bootstrapContainer.LoggingClientFrom(dic.Get)\n\n\trecord := sendNotificationViaChannel(dic, n, trans.Channel)\n\ttrans.Records = append(trans.Records, record)\n\ttrans.Status = record.Status\n\tlc.Debugf(\"sent the notification to %s with address %v, transmission status %s\", trans.SubscriptionName, trans.Channel.GetBaseAddress(), trans.Status)\n\treturn trans\n}", "title": "" }, { "docid": "08e46dc7e000008a049834fec27668a3", "score": "0.46977803", "text": "func (m *MemKVStore) First(start, end []byte) sdk.Model {\n\tkey := \"\"\n\tfor _, k := range m.keysInRange(start, end) {\n\t\tif key == \"\" || k < key {\n\t\t\tkey = k\n\t\t}\n\t}\n\tif key == \"\" {\n\t\treturn sdk.Model{}\n\t}\n\treturn sdk.Model{\n\t\tKey: []byte(key),\n\t\tValue: m.m[key],\n\t}\n}", "title": "" }, { "docid": "7ab5b293bdb80130526163014861f3a4", "score": "0.46869895", "text": "func (s *eventSink) PullFirst() (Event, error) {\n\tvar event Event\n\ts.mutex.Lock()\n\tif len(s.events) > 0 {\n\t\tevent = s.events[0]\n\t\ts.events = s.events[1:]\n\t}\n\ts.mutex.Unlock()\n\treturn event, s.check()\n}", "title": "" }, { "docid": "820e6ce08eb0b9f335a10b8382dd93f3", "score": "0.46799737", "text": "func Take(pred Predicate, s <-chan interface{}) <-chan interface{} {\n\tch := make(chan interface{}, 1)\n\tgo func() {\n\t\tfor v := range s {\n\t\t\tif !pred(v) {\n\t\t\t\tclose(ch)\n\t\t\t\treturn\n\t\t\t}\n\t\t\tch <- v\n\t\t}\n\t}()\n\treturn ch\n}", "title": "" }, { "docid": "1317a0b84761ebd9e41add7075560230", "score": "0.4678144", "text": "func (ss Float64s) First() float64 {\n\treturn ss.FirstOr(0)\n}", "title": "" }, { "docid": "653e179f234646606019d40a2ef66b2f", "score": "0.46751824", "text": "func (ciq *CoinInfoQuery) FirstX(ctx context.Context) *CoinInfo {\n\tnode, err := ciq.First(ctx)\n\tif err != nil && !IsNotFound(err) {\n\t\tpanic(err)\n\t}\n\treturn node\n}", "title": "" }, { "docid": "cab58b6b1a3dcbbb6d84dc8461af1a7f", "score": "0.4672176", "text": "func (tq *TransactionQuery) FirstX(ctx context.Context) *Transaction {\n\tnode, err := tq.First(ctx)\n\tif err != nil && !IsNotFound(err) {\n\t\tpanic(err)\n\t}\n\treturn node\n}", "title": "" }, { "docid": "e844b0172e3c25440a93d772cb84b643", "score": "0.46715364", "text": "func (tq *SQuery) First(dest interface{}) error {\n\tmapResult, err := tq.FirstStringMap()\n\tif err != nil {\n\t\treturn err\n\t}\n\tdestPtrValue := reflect.ValueOf(dest)\n\tif destPtrValue.Kind() != reflect.Ptr {\n\t\treturn errors.Wrap(ErrNeedsPointer, \"input must be a pointer\")\n\t}\n\tdestValue := destPtrValue.Elem()\n\terr = mapString2Struct(mapResult, destValue)\n\tif err != nil {\n\t\treturn err\n\t}\n\tcallAfterQuery(destPtrValue)\n\treturn nil\n}", "title": "" }, { "docid": "8b599be1ae2ffcccc51be1905654222d", "score": "0.46684512", "text": "func (ms *mergeSort) First() builder {\n\treturn ms.input.First()\n}", "title": "" }, { "docid": "132afce7cb383d4d488cf5ae90464ad6", "score": "0.46661976", "text": "func (o ObservableFoo) SkipLast(n int) ObservableFoo {\n\treturn o.AsObservable().SkipLast(n).AsObservableFoo()\n}", "title": "" }, { "docid": "8b47f323dcbd7575b46c9d3d00ad131b", "score": "0.46641132", "text": "func (o ObservableFoo) Skip(n int) ObservableFoo {\n\treturn o.AsObservable().Skip(n).AsObservableFoo()\n}", "title": "" }, { "docid": "8a05bf0ec1dfa1fc50b7327a89e44068", "score": "0.46632624", "text": "func (sq *StockQuery) FirstX(ctx context.Context) *Stock {\n\ts, err := sq.First(ctx)\n\tif err != nil && !IsNotFound(err) {\n\t\tpanic(err)\n\t}\n\treturn s\n}", "title": "" }, { "docid": "7da971c07179dcc5a59c5e537a94642a", "score": "0.46626267", "text": "func (parent *Observable) Take(num int) (o *Observable) {\n\to = parent.newFilteringObservable(\"Take\")\n\to.first, o.last, o.distinct, o.ignoreElement, o.takeOrSkip = false, false, false, false, true\n\to.debounce, o.skip, o.take = 0, 0, num\n\to.operator = filteringTotalOperator\n\treturn o\n}", "title": "" } ]
c04599a51b3c6465df9d5c1b5d0c318b
fooUsage displays the usage of the foo command and its subcommands.
[ { "docid": "b14dcc5593ea977a7fe93a0f167a217e", "score": "0.8108181", "text": "func fooUsage() {\n\tfmt.Fprintf(os.Stderr, `Service is the foo service interface.\nUsage:\n %s [globalflags] foo COMMAND [flags]\n\nCOMMAND:\n foo1: Foo1 implements foo1.\n foo2: Foo2 implements foo2.\n foo3: Foo3 implements foo3.\n foo-options: FooOptions implements fooOptions.\n\nAdditional help:\n %s foo COMMAND --help\n`, os.Args[0], os.Args[0])\n}", "title": "" } ]
[ { "docid": "3fee8e72a1d47f60584c907f1634788e", "score": "0.7306995", "text": "func UsageCommands() string {\n\treturn `foo (foo1|foo2|foo3|foo-options)\n`\n}", "title": "" }, { "docid": "c7a5bae8757409ccc4e6d5fb02d6e5df", "score": "0.68366027", "text": "func usage() {\n\tfmt.Printf(\"%s\", helpString)\n}", "title": "" }, { "docid": "733ca5cf75afafb42b68309cefffaf9c", "score": "0.6512138", "text": "func usage(c *cobra.Command) error {\n\ts := \"Usage: \"\n\tif c.Runnable() {\n\t\ts += c.UseLine() + \"\\n\"\n\t} else {\n\t\ts += c.CommandPath() + \" [command]\\n\"\n\t}\n\ts += \"\\n\"\n\tif len(c.Aliases) > 0 {\n\t\ts += \"Aliases: \" + c.NameAndAliases() + \"\\n\"\n\t}\n\tif c.HasExample() {\n\t\ts += \"Example:\\n\"\n\t\ts += c.Example + \"\\n\"\n\t}\n\n\tvar managementCommands, nonManagementCommands []*cobra.Command\n\tfor _, f := range c.Commands() {\n\t\tf := f\n\t\tif f.Hidden {\n\t\t\tcontinue\n\t\t}\n\t\tif f.Annotations[Category] == Management {\n\t\t\tmanagementCommands = append(managementCommands, f)\n\t\t} else {\n\t\t\tnonManagementCommands = append(nonManagementCommands, f)\n\t\t}\n\t}\n\tprintCommands := func(title string, commands []*cobra.Command) string {\n\t\tif len(commands) == 0 {\n\t\t\treturn \"\"\n\t\t}\n\t\tvar longest int\n\t\tfor _, f := range commands {\n\t\t\tif l := len(f.Name()); l > longest {\n\t\t\t\tlongest = l\n\t\t\t}\n\t\t}\n\n\t\ttitle = Bold(title)\n\t\tt := title + \":\\n\"\n\t\tfor _, f := range commands {\n\t\t\tt += \" \"\n\t\t\tt += f.Name()\n\t\t\tt += strings.Repeat(\" \", longest-len(f.Name()))\n\t\t\tt += \" \" + f.Short + \"\\n\"\n\t\t}\n\t\tt += \"\\n\"\n\t\treturn t\n\t}\n\ts += printCommands(\"Management commands\", managementCommands)\n\ts += printCommands(\"Commands\", nonManagementCommands)\n\n\ts += Bold(\"Flags\") + \":\\n\"\n\ts += c.LocalFlags().FlagUsages() + \"\\n\"\n\n\tif c == c.Root() {\n\t\ts += \"Run '\" + c.CommandPath() + \" COMMAND --help' for more information on a command.\\n\"\n\t} else {\n\t\ts += \"See also '\" + c.Root().CommandPath() + \" --help' for the global flags such as '--namespace', '--snapshotter', and '--cgroup-manager'.\"\n\t}\n\tfmt.Fprintln(c.OutOrStdout(), s)\n\treturn nil\n}", "title": "" }, { "docid": "ba4a829f82e41c7d1ccf01fc27866eb0", "score": "0.6433014", "text": "func Usage(cmd *Command) error {\n\tif cmd == nil {\n\t\tapplicationUsage()\n\t} else {\n\t\terr := commandUsage(cmd)\n\t\tif err != nil {\n\t\t\terrPrintln(err)\n\t\t}\n\t}\n\terrPrintln()\n\treturn nil\n}", "title": "" }, { "docid": "d95005ecfd89c459be3370c94c0aaee0", "score": "0.6430528", "text": "func ShowUsage() {\n\tfmt.Fprintf(os.Stderr, \"usage: %s TYPE\\n\\n\", os.Args[0])\n\tfmt.Fprintf(os.Stderr, \"where TYPE := { deploy | add | get | remove | kill } COMMAND\\n\")\n\n\tos.Exit(1)\n}", "title": "" }, { "docid": "b0fc14d2d2a6d16f05efc45b6459200d", "score": "0.6392957", "text": "func usage() {\n\tfor _, key := range commandKeys {\n\t\tfmt.Printf(\"%v\\n\", commands[key])\n\t}\n\n}", "title": "" }, { "docid": "b0fc14d2d2a6d16f05efc45b6459200d", "score": "0.6392957", "text": "func usage() {\n\tfor _, key := range commandKeys {\n\t\tfmt.Printf(\"%v\\n\", commands[key])\n\t}\n\n}", "title": "" }, { "docid": "85fc41a96201e76bd16c5c262319fda2", "score": "0.63344276", "text": "func PrintUsage() {\n\tfmt.Printf(`\n Usage: %s <command>\n\n command:\n\n init - create a new app\n\n add <subcommand>\n\n subcommand:\n\n view <view name> - create a new view with the given name\n model <model name> - create a new model with the given name\n font <font string> - add a font from Google Web Fonts\n\n remove <subcommand>\n\n subcommand:\n\n view <view name> - remove the view with the given name\n model <model name> - remove the model with the given name\n font <font string> - remove a font\n\n`, path.Base(os.Args[0]))\n}", "title": "" }, { "docid": "95f05609cf0a7c7d2e85dee6ba3e07dd", "score": "0.6313422", "text": "func (c *DialDeleteCommand) usage() {\n\tfmt.Println(`\nDelete an existing dial.\n\nUsage:\n\n\twtf dial delete DIAL_ID\n`[1:])\n}", "title": "" }, { "docid": "c38a5149f656c3cf44bcef5f6797169b", "score": "0.63036454", "text": "func usage() {\n\tfmt.Fprint(os.Stderr, USAGE)\n}", "title": "" }, { "docid": "0ab1b5655c7619b0e9a658f87880556d", "score": "0.629479", "text": "func MainUsageTemplate() string {\n\treturn `Available Commands:{{range .Commands}}{{if (or .IsAvailableCommand (eq .Name \"help\"))}}\n {{rpad .Name .NamePadding }} {{prepare .Short}}{{end}}{{end}}\n\nUse \"{{ProgramName}} <command> --help\" for more information about a given command.\nUse \"{{ProgramName}} options\" for a list of global command-line options (applies to all commands).\n`\n}", "title": "" }, { "docid": "3a7a4b68d50c9efbe32f127cef6f2468", "score": "0.62137467", "text": "func (c *CmdHandler) Usage() string {\n\thelp := \"Prompt:\\n\" +\n\t\t\"%d>: prompt where %d is the number of tracking \" +\n\t\t\"addresses.\\n\" +\n\t\t\"Commands:\\n\" +\n\t\t\"* scan val - scans the current values of all \" +\n\t\t\"tracked addresses and filters the tracked \" +\n\t\t\"addresses by value. Scans the whole of mapped \" +\n\t\t\"memory if there are no tracked addresses (such \" +\n\t\t\"as on startup or after a reset).\\n\" +\n\t\t\"* list - lists all tracked addresses and their \" +\n\t\t\"last values.\\n\" +\n\t\t\"* update - scans the current values of all \" +\n\t\t\"tracked addresses.\\n\" +\n\t\t\"* set addr val - Writes val to address addr.\\n\" +\n\t\t\"* setall val - Writes val to all tracked \" +\n\t\t\"addresses.\\n\" +\n\t\t\"* reset - Removes all tracked addresses. The \" +\n\t\t\"next scan will read all of mapped memory.\\n\" +\n\t\t\"* help - prints the commands\\n\"\n \n\treturn help\n}", "title": "" }, { "docid": "ff25a1adaf09e2603f22043528a33b51", "score": "0.6195", "text": "func usageMessage() {\n\tfmt.Printf(\"Help for %s\\n\", GetVersionString())\n\tfmt.Println(\" --Help Prints this help message.\")\n\tfmt.Println(\" --Version Prints the version number of this utility.\")\n\tfmt.Println(\" --Licence Prints the copyright licence this utility is release under.\")\n\tfmt.Println(\" --Problem <number> Specifies problem ID to evaluate.\")\n\tfmt.Println(\" --AllProblems Evaluates all problems for which there is code (overrides --Problem)\")\n\tfmt.Println(\" --Concurrent Sovlves problems concurrently (instead of the sequential default)\")\n\tos.Exit(0)\n}", "title": "" }, { "docid": "4a714f2593a660063ad395f891a5a3e2", "score": "0.61785537", "text": "func (cli *CLI) printUsage() {\n\tfmt.Println(\"Usage:\")\n\tfmt.Printf(\" getbal -address ADDRESS\\t Gets the balance for an address.\\n\")\n\tfmt.Printf(\" create -address ADDRESS\\t Creates a blockchain and sends genesis reward to address.\\n\")\n\tfmt.Printf(\" print\\t Prints the blocks in the chain.\\n\")\n\tfmt.Printf(\" send -from FROM -to TO -amount AMOUNT\\t Sends amount of coins from one address to another.\\n\")\n\tfmt.Printf(\" createwallet\\t Creates a new Wallet.\\n\")\n\tfmt.Printf(\" listaddresses\\t List the addresses in the wallets file.\\n\")\n}", "title": "" }, { "docid": "8e5e370eaf272630efbf8a231709a939", "score": "0.6176716", "text": "func usageMain(w io.Writer, set *flag.FlagSet) error {\n\toutputPara(w, usageLineLength, 0, usageShort)\n\toutputPara(w, usageLineLength, 0, usageMainPara)\n\n\tcmdNames := commands.Names()\n\n\tfieldWidth := 0\n\tfor _, name := range cmdNames {\n\t\tif n := len(name); n+4 > fieldWidth {\n\t\t\tfieldWidth = n + 4\n\t\t}\n\t}\n\n\tfmt.Fprintln(w, \"Commands:\")\n\tfor _, name := range cmdNames {\n\t\tcmd, _ := commands[name]\n\t\tfmt.Fprintf(w, \"%s%-*s %s\\n\", strings.Repeat(\" \", usageIndent), fieldWidth, name, cmd.shortDesc)\n\t}\n\tfmt.Fprintln(w)\n\toutputPara(w, usageLineLength, 0, usageCommandPara)\n\n\tif !isFlagPassed(set, commonFlag) {\n\t\toutputPara(w, usageLineLength, 0, usageCommonPara)\n\n\t\treturn nil\n\t}\n\n\tfmt.Fprintln(w, \"Configuration file:\")\n\toutputPara(w, usageLineLength, usageIndent, usageConfigIntroPara)\n\toutputPara(w, usageLineLength, usageIndent, usageConfigLocationPara)\n\toutputPara(w, usageLineLength, usageIndent, usageConfigKeysPara)\n\n\tfmt.Fprintln(w, \"Explicit and implicit anchors:\")\n\toutputPara(w, usageLineLength, usageIndent, usageAnchorsIntroPara)\n\toutputPara(w, usageLineLength, usageIndent, usageAnchorsFormatPara)\n\toutputPara(w, usageLineLength, usageIndent, usageAnchorsInsecurePara)\n\n\tfmt.Fprintln(w, \"Additional path segment:\")\n\toutputPara(w, usageLineLength, usageIndent, usageAPSIntroPara)\n\n\tfmt.Fprintln(w, \"TLS client certificates:\")\n\toutputPara(w, usageLineLength, usageIndent, usageCertsIntroPara)\n\toutputPara(w, usageLineLength, usageIndent, usageCertsFormatPara)\n\toutputPara(w, usageLineLength, usageIndent, usageCertsKeyPara)\n\n\tfmt.Fprintln(w, \"Additional HTTP headers:\")\n\toutputPara(w, usageLineLength, usageIndent, usageHeadersPara)\n\toutputPara(w, usageLineLength, usageIndent*2, usageHeadersExample)\n\n\tfmt.Fprintln(w, \"HTTP Host header:\")\n\toutputPara(w, usageLineLength, usageIndent, usageHostHeaderPara)\n\n\tfmt.Fprintln(w, \"Request timeout:\")\n\toutputPara(w, usageLineLength, usageIndent, usageTimeoutPara)\n\n\treturn nil\n}", "title": "" }, { "docid": "0e3648d063ab5818aa5d2b6fe85e5156", "score": "0.61673", "text": "func usage() {\n\tfmt.Printf(\"%s\\n\", usageStr)\n\tos.Exit(0)\n}", "title": "" }, { "docid": "0e3648d063ab5818aa5d2b6fe85e5156", "score": "0.61673", "text": "func usage() {\n\tfmt.Printf(\"%s\\n\", usageStr)\n\tos.Exit(0)\n}", "title": "" }, { "docid": "e34f5e8151e1adac99f9a17b3ddd86ae", "score": "0.61488366", "text": "func Usage(cmd string, posArgs ...string) func() {\n\treturn func() {\n\t\tvar b strings.Builder\n\t\tfmt.Fprintf(&b, \"Usage: %s \", cmd)\n\t\tfor _, arg := range posArgs {\n\t\t\tb.WriteString(arg + \" \")\n\t\t}\n\t\tb.WriteString(\"[Options]\\n\\n\")\n\t\tb.WriteString(\"Options:\\n\")\n\t\tflag.VisitAll(func(f *flag.Flag) {\n\t\t\tfType, _ := flag.UnquoteUsage(f)\n\t\t\tfmt.Fprintf(&b, \" --%s %s\\n\", f.Name, fType)\n\n\t\t\tb.WriteString(\"\\t\" + f.Usage)\n\t\t\tif f.DefValue == \"\" {\n\t\t\t\tfmt.Fprintf(&b, \" (default %q)\\n\", f.DefValue)\n\t\t\t} else {\n\t\t\t\tfmt.Fprintf(&b, \" (default %s)\\n\", f.DefValue)\n\t\t\t}\n\t\t})\n\t\tfmt.Fprint(flag.CommandLine.Output(), b.String())\n\t}\n}", "title": "" }, { "docid": "0ce5b3d90366e877381a1e1f2f9139f3", "score": "0.614608", "text": "func usageCmd(args []string) error {\n\tswitch len(args) {\n\tcase 1:\n\t\t// gonzoctl help COMMAND\n\t\tvar (\n\t\t\tcmd = args[0]\n\t\t\tcu = commandUsage[cmd]\n\t\t)\n\t\tif cu != nil {\n\t\t\treturn cu()\n\t\t}\n\t\treturn errors.New(\"unrecognized command: \" + cmd)\n\tdefault:\n\t\tusage()\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "a46bf6b0e758fecb1cf1bd1a995305a8", "score": "0.61434317", "text": "func CommonUsage(cmd *cobra.Command) error {\n\tfmt.Printf(`usage: gost %s\n\n`,\n\t\tcmd.Use)\n\treturn nil\n}", "title": "" }, { "docid": "dc2c2349dd04131ba27040348eae80f4", "score": "0.6129003", "text": "func (h *Help) Usage(name string) string {\n\treturn fmt.Sprintf(\"usage: %s %s\", name, h.Args)\n}", "title": "" }, { "docid": "96efe63435b2d56b6056961729643bb1", "score": "0.6125222", "text": "func usage() {\r\n\r\n\r\n\t// get only the file name from the absolute path in os.Args[0]\r\n\t_, file := filepath.Split(os.Args[0])\r\n\r\n fmt.Fprintf(os.Stderr, \"\\nBasic Usage: %s IP_Adderess:TCP_Port\\n\\n\", file )\r\n fmt.Fprintf(os.Stderr, \"Advanced Flag Usage: %s Flags:\\n\", file )\r\n flag.PrintDefaults()\r\n fmt.Fprintf(os.Stderr, \"\\n\")\r\n os.Exit(2)\r\n}", "title": "" }, { "docid": "97910f6fa52f6b21ced12ea57a10d24f", "score": "0.61216104", "text": "func Usage(w io.Writer, cmdName string, flags []Flag) {\n\tbase := filepath.Base(os.Args[0])\n\tpre := fmt.Sprintf(\"%s \", base)\n\tif cmdName == base {\n\t\tpre = \"\"\n\t}\n\tfmt.Fprintf(w, \"%s%s [flags] [args...]\\n\", pre, cmdName)\n\tfor _, f := range flags {\n\t\tfmt.Fprintf(w, \"\\t-%s\\n\", f.Describe())\n\t}\n\n}", "title": "" }, { "docid": "6f74f17f85acadcbedaa9083d282b90b", "score": "0.61176825", "text": "func (cmd *Android) Usage() {\n\tdata := struct {\n\t\tName string\n\t\tDescription string\n\t}{\n\t\tName: cmd.Name(),\n\t\tDescription: cmd.Description(),\n\t}\n\n\ttemplate := `\nUsage: fyne-cross {{ .Name }} [options] [package]\n\n{{ .Description }}\n\nOptions:\n`\n\n\tprintUsage(template, data)\n\tflagSet.PrintDefaults()\n}", "title": "" }, { "docid": "36c060ab9c371bdf284632f9847fb601", "score": "0.6103484", "text": "func usage() {\n\tlog.Print(createUsage)\n\tlog.Print(deleteUsgage)\n}", "title": "" }, { "docid": "9d5af7ed7bcf5d14128a9c86c51b207d", "score": "0.60980743", "text": "func showUsage() {\n\tgenUsage().Render()\n}", "title": "" }, { "docid": "9ffb2a8fb613fc13ed55baaf0e5789cb", "score": "0.60973305", "text": "func setupUsage(fs *flag.FlagSet) {\n printNonEmpty := func(s string) {\n if s != \"\" {\n fmt.Fprintf(os.Stderr, \"%s\\n\", s)\n }\n }\n tmpUsage := fs.Usage\n fs.Usage = func() {\n printNonEmpty(CommandLineHelpUsage)\n tmpUsage()\n printNonEmpty(CommandLineHelpFooter)\n }\n}", "title": "" }, { "docid": "c6e1ec36e15c09f0cbe8fe2a28a2acec", "score": "0.60973096", "text": "func UsageCommands() string {\n\treturn `neat-thing (neat-thing-today|new-neat-thing)\n`\n}", "title": "" }, { "docid": "1fc0ede2c6e79f05fe5cecdfdc402969", "score": "0.6095858", "text": "func UsageCommands() string {\n\treturn `want-go (get-simple-card-list|get-card-info|post-card-info|put-card-info|delete-card-info)\n`\n}", "title": "" }, { "docid": "95cab0d71484d9429b05c72ba90df5f7", "score": "0.6086383", "text": "func usage(writer io.Writer, cfg *CmdConfig) {\n\tflags := flagSet(\"<global options help>\", cfg)\n\tflags.SetOutput(writer)\n\tflags.PrintDefaults()\n}", "title": "" }, { "docid": "f43f709384606b9ef7060fd8aea39125", "score": "0.60859275", "text": "func showCmdUsage(cmd *RunCmd) {\n\tvar shell = \"\"\n\t//noinspection GoBoolExpressions\n\tif config.ShowCmdShells {\n\t\tshell = fmt.Sprintf(\" (%s)\", cmd.Shell())\n\t}\n\tif !cmd.EnableHelp() {\n\t\tfmt.Fprintf(config.ErrOut, \"%s%s: No help available.\\n\", cmd.Name, shell)\n\t\treturn\n\t}\n\t// Usages\n\t//\n\tfor i, usage := range cmd.Config.Usages {\n\t\tor := \"or\"\n\t\tif i == 0 {\n\t\t\tfmt.Fprintf(config.ErrOut, \"Usage:\\n\")\n\t\t\tor = \" \" // 2 spaces\n\t\t}\n\t\tpad := strings.Repeat(\" \", len(cmd.Name)-1)\n\t\tif usage[0] == '(' {\n\t\t\tfmt.Fprintf(config.ErrOut, \" %s %s\\n\", pad, usage)\n\t\t} else {\n\t\t\tfmt.Fprintf(config.ErrOut, \" %s %s %s\\n\", or, cmd.Name, usage)\n\t\t}\n\t}\n\thasHelpShort := false\n\thasHelpLong := false\n\tfor _, opt := range cmd.Config.Opts {\n\t\tif opt.Short == 'h' {\n\t\t\thasHelpShort = true\n\t\t}\n\t\tif opt.Long == \"help\" {\n\t\t\thasHelpLong = true\n\t\t}\n\t}\n\t// Options\n\t//\n\tif len(cmd.Config.Opts) > 0 {\n\t\tfmt.Fprintln(config.ErrOut, \"Options:\")\n\t\tif !hasHelpShort || !hasHelpLong {\n\t\t\tswitch {\n\t\t\tcase !hasHelpShort && hasHelpLong:\n\t\t\t\tfmt.Fprintln(config.ErrOut, \" -h\")\n\t\t\tcase hasHelpShort && !hasHelpLong:\n\t\t\t\tfmt.Fprintln(config.ErrOut, \" --help\")\n\t\t\tdefault:\n\t\t\t\tfmt.Fprintln(config.ErrOut, \" -h, --help\")\n\t\t\t}\n\t\t\tfmt.Fprintln(config.ErrOut, \" Show full help screen\")\n\t\t}\n\t}\n\tfor _, opt := range cmd.Config.Opts {\n\t\tb := &strings.Builder{}\n\t\tb.WriteString(\" \")\n\t\tif opt.Short != 0 {\n\t\t\tb.WriteRune('-')\n\t\t\tb.WriteRune(opt.Short)\n\t\t}\n\t\tif opt.Long != \"\" {\n\t\t\tif opt.Short != 0 {\n\t\t\t\tb.WriteString(\", \")\n\t\t\t}\n\t\t\tb.WriteString(\"--\")\n\t\t\tb.WriteString(opt.Long)\n\t\t}\n\t\tif opt.Value != \"\" {\n\t\t\tb.WriteRune(' ')\n\t\t\tb.WriteRune('<')\n\t\t\tb.WriteString(opt.Value)\n\t\t\tb.WriteRune('>')\n\t\t}\n\t\tif opt.Desc != \"\" {\n\t\t\tif opt.Short != 0 && opt.Long == \"\" && opt.Value == \"\" {\n\t\t\t\tb.WriteString(\" \")\n\t\t\t} else {\n\t\t\t\tb.WriteString(\"\\n \")\n\t\t\t}\n\t\t\tb.WriteString(opt.Desc)\n\t\t}\n\t\tfmt.Fprintln(config.ErrOut, b.String())\n\t}\n}", "title": "" }, { "docid": "ae7fca11bcd91889c1ce203df66ab7bd", "score": "0.6070574", "text": "func (c *Command) Usage() {\n\ttool.TmplTextParseAndOutput(cmdUsage, c)\n\tos.Exit(2)\n}", "title": "" }, { "docid": "9a33f4ae7b8f96b647178619bf41bfd5", "score": "0.6055331", "text": "func (o *Options) Usage() {\n\t_ = o.cmd.Flags().FlagUsages()\n}", "title": "" }, { "docid": "07ec93f97df2b39b11b06ad8945c3095", "score": "0.6054031", "text": "func PrintUsage() {\n\tfmt.Fprintln(os.Stdout, \"Usage: gitio [-code=] url\\nIf you will be use any code, set code flag\")\n}", "title": "" }, { "docid": "64786761c8a21e9bdfd9576c2b217882", "score": "0.6030446", "text": "func (b *Base) PrintUsage() {\n\tvar usageTemplate = `Usage: c14 {{.UsageLine}}\n\n{{.Help}}\n\n{{.Options}}\n{{.ExamplesHelp}}\n`\n\n\tt := template.New(\"full\")\n\ttemplate.Must(t.Parse(usageTemplate))\n\t_ = t.Execute(os.Stdout, b)\n}", "title": "" }, { "docid": "6c72bb5afa50fb7bac172433dac7b351", "score": "0.6011341", "text": "func Usage() {\n\tfmt.Print(UsageString())\n\treturn\n}", "title": "" }, { "docid": "a7866850c54817ce8bfef6d39f718dc4", "score": "0.6010305", "text": "func printUsage() {\n\tfmt.Println(`Check YAML or JSON files for specific paths, and print a message if \nthose paths are present/missing. Useful for checking for missing \nkeys or targets in your YAML and JSON documents.\n\t`)\n\tfmt.Printf(\"Usage:\\n %s -s specfile /path/to/yaml-or-json ...\\n\\n\", os.Args[0])\n\tfmt.Println(\"Flags:\")\n\tpflag.PrintDefaults()\n}", "title": "" }, { "docid": "c82481085c7d34168a5472cd7f091b7b", "score": "0.5999177", "text": "func UsageTemplate() string {\n\treturn `Usage:{{if .Runnable}}\n {{prepare .UseLine}}{{end}}{{if .HasAvailableSubCommands}}\n {{prepare .CommandPath}} [command]{{end}}{{if gt (len .Aliases) 0}}\n\nAliases:\n {{.NameAndAliases}}{{end}}{{if .HasExample}}\n\nExamples:\n{{prepare .Example}}{{end}}{{if .HasAvailableSubCommands}}\n\nAvailable Commands:{{range .Commands}}{{if (or .IsAvailableCommand (eq .Name \"help\"))}}\n {{rpad .Name .NamePadding }} {{prepare .Short}}{{end}}{{end}}{{end}}{{if .HasAvailableLocalFlags}}\n\nFlags:\n{{.LocalFlags.FlagUsages | trimTrailingWhitespaces}}{{end}}{{if .HasAvailableInheritedFlags}}\n\nUse \"{{ProgramName}} options\" for a list of global command-line options (applies to all commands).{{end}}\n`\n}", "title": "" }, { "docid": "f5b986def20e519f75f9fddb8adaa827", "score": "0.5998409", "text": "func (cmd *CLI) Usage() {\n\tif cmd.usage == nil {\n\t\tcmd.usage = cmd.DefaultUsage\n\t}\n\tcmd.usage()\n}", "title": "" }, { "docid": "728146c0aae03812b9893bfeaa8bc2d4", "score": "0.5989601", "text": "func (cmd *CLI) SubCommandsUsageString() string {\n\tvar maxBufferLen int\n\tfor _, cmd := range cmd.subCommands {\n\t\tbuffLen := len(cmd.name)\n\t\tif buffLen > maxBufferLen {\n\t\t\tmaxBufferLen = buffLen\n\t\t}\n\t}\n\n\tvar outputLines []string\n\tfor _, cmd := range cmd.subCommands {\n\t\tvar whitespace bytes.Buffer\n\t\tfor {\n\t\t\tbuffLen := len(cmd.name) + len(whitespace.String())\n\t\t\tif buffLen == maxBufferLen+5 {\n\t\t\t\tbreak\n\t\t\t}\n\t\t\twhitespace.WriteString(\" \")\n\t\t}\n\t\toutputLines = append(outputLines, fmt.Sprintf(\" %s%s%s\", cmd.name, whitespace.String(), cmd.Description()))\n\t}\n\n\treturn strings.Join(outputLines, \"\\n\")\n}", "title": "" }, { "docid": "f78e8620006a3249adf50927147dc479", "score": "0.5987602", "text": "func flagUsage (){\n\tusageText := \"This program is an example cli tool \\n\" +\n\t\t\"Usage: \\n\" +\n\t\t\"ArgsSub command [arguments] \\n\" +\n\t\t\"The commands are \\n\" +\n\t\t\"uppercase uppercase a string \\n\" +\n\t\t\"lowercase lowercase a string \\n\" +\n\t\t\"use \\\"ArgsSubTest.txt [command] -- help \\\" for more information about a command \"\n\n\tfmt.Println(os.Stderr, \"%s \\n\", usageText)\n}", "title": "" }, { "docid": "ce1db0ada55f8e157e60a733c7cd2c43", "score": "0.5986429", "text": "func (cli *CommandLine) printUsage() {\n\tfmt.Println(\"Usage : \")\n\tfmt.Println(\"getbalance -address ADDRESS - print blockchain \")\n\tfmt.Println(\"createblockchain -address ADDRESS - print blockchain \")\n\tfmt.Println(\"send -from FROM -to TO -amount AMOUNT - print blockchain \")\n\tfmt.Println(\"printchain - print blockchain \")\n}", "title": "" }, { "docid": "a0eb646fd6376707b4768f7738d9a587", "score": "0.59809256", "text": "func Usage() {\n\tfmt.Fprintf(os.Stderr, \"Usage of %s:\\n\", os.Args[0])\n}", "title": "" }, { "docid": "14891fb9706311f43107f07d8d34b3cb", "score": "0.5980612", "text": "func (plugin *recommended) Usage() string {\n\treturn \"cat recommended [branch]\"\n}", "title": "" }, { "docid": "cf80f3b67652d7d1e115bec8dd8dbe07", "score": "0.59788764", "text": "func UsageCommands() string {\n\treturn `organization (list|show|add|remove|update)\nstep (list|add|remove|update)\nwalkthrough (list|show|add|remove|update|rename|publish)\n`\n}", "title": "" }, { "docid": "55c46685ec8be79a300464f15297979d", "score": "0.5976727", "text": "func usage(err error) {\n\tif err != nil {\n\t\tfmt.Fprintf(os.Stderr, \"Error: %v\\n\\n\", err)\n\t}\n\tfmt.Fprintf(os.Stderr, \"Usage%s:\\n\", os.Args[0])\n\tflag.PrintDefaults()\n\tos.Exit(2)\n}", "title": "" }, { "docid": "5332f237101fa7cb703b6ecf52a932d5", "score": "0.59759504", "text": "func usage(cliName string) string {\n\treturn \"Interpreter for TriggerMesh's Integration Language.\\n\" +\n\t\t\"\\n\" +\n\t\t\"USAGE:\\n\" +\n\t\t\" \" + cliName + \" <command>\\n\" +\n\t\t\"\\n\" +\n\t\t\"COMMANDS:\\n\" +\n\t\t\" \" + cmdGenerate + \" Generate Kubernetes manifests for deploying a Bridge.\\n\" +\n\t\t\" \" + cmdValidate + \" Validate a Bridge description.\\n\" +\n\t\t\" \" + cmdGraph + \" Represent a Bridge as a directed graph in DOT format.\\n\"\n}", "title": "" }, { "docid": "f04b90d1dce75fa2ba018c731c3a6040", "score": "0.5967758", "text": "func UsageString(tasks []Task) string {\n\treturn strings.TrimSuffix(helpCobraCmd(tasks).UsageString(), \"\\n\")\n}", "title": "" }, { "docid": "312dc5ac11fb99fabd61450378a0e8ee", "score": "0.5945168", "text": "func MainUsageTemplate() string {\n\tsections := []string{\n\t\t\"\\n\\n\",\n\t\tSectionVars,\n\t\tSectionAliases,\n\t\tSectionExamples,\n\t\tSectionSubcommands,\n\t\tSectionFlags,\n\t\tSectionUsage,\n\t\tSectionTipsHelp,\n\t\tSectionTipsGlobalOptions,\n\t}\n\treturn strings.TrimRightFunc(strings.Join(sections, \"\"), unicode.IsSpace)\n}", "title": "" }, { "docid": "592afd21f619f0caa6dd8ce1b0fccdf3", "score": "0.59411967", "text": "func SimpleUsage(description string, args ...string) func() {\n\treturn func() {\n\t\tprefix := fmt.Sprintf(\"Usage: %s \", filepath.Base(os.Args[0]))\n\t\talignArgs(len(prefix), args)\n\t\tfmt.Fprintf(os.Stderr, `%s%s\n%s\n\n%s\n\nFlags:\n`, prefix, strings.Join(args, \" \"), description, build.VersionLine())\n\t\tflag.PrintDefaults()\n\t}\n}", "title": "" }, { "docid": "9c6771d5cb4e9200ad644ac698cd93c5", "score": "0.5923165", "text": "func displayHelp(subcommand ...string) {\n\tswitch subcommand[0] {\n\tcase \"\":\n\t\tfmt.Println(MainHelp)\n\tcase \"run\":\n\t\tfmt.Println(RunHelp)\n\tcase \"build\":\n\t\tfmt.Println(BuildHelp)\n\tcase \"test\":\n\t\tfmt.Println(TestHelp)\n\tcase \"deps\":\n\t\tfmt.Println(DepsHelp)\n\tdefault:\n\t\tfmt.Println(MainHelp)\n\t}\n}", "title": "" }, { "docid": "25eeca0dfcf3d694d852f8a9a620c490", "score": "0.5910079", "text": "func (opt *Options) PrintUsage() {\n\tvar banner = ` _ __ ___ ___ _ __ ___ ___\n| '_ ' _ \\ / _ \\ '_ ' _ \\ / _ \\\n| | | | | | __/ | | | | | __/\n|_| |_| |_|\\___|_| |_| |_|\\___|\n\n`\n\tcolor.Green(banner)\n\tfmt.Println(\"\")\n\tflag.Usage()\n\tfmt.Println(\"\")\n\n\tfmt.Println(\" Templates\")\n\tfmt.Println(\"\")\n\tfor x, name := range ImageIds {\n\t\tif ((x + 1) % 2) == 0 {\n\t\t\tfmt.Fprintln(output.Stdout, color.CyanString(\"%s\", name))\n\t\t} else {\n\t\t\tfmt.Fprint(output.Stdout, color.CyanString(\" %-30s\", name))\n\t\t}\n\t}\n\n\tif len(ImageIds)%3 != 0 {\n\t\tfmt.Println(\"\")\n\t}\n\n\tfmt.Println(\"\")\n\n\tfmt.Println(\" Examples\")\n\tfmt.Println(\"\")\n\tcolor.Cyan(\" meme -i kirk-khan -t \\\"|khaaaan\\\"\")\n\tcolor.Cyan(\" meme -i brace-yourselves -t \\\"Brace yourselves|The memes are coming!\\\"\")\n\tcolor.Cyan(\" meme -i http://i.imgur.com/FsWetC0.jpg -t \\\"|China\\\"\")\n\tcolor.Cyan(\" meme -i ~/Pictures/face.png -t \\\"Hello\\\"\")\n\tfmt.Println(\"\")\n}", "title": "" }, { "docid": "796f771ba9efbdf91fd8722daf0a2c0a", "score": "0.59084535", "text": "func (c *Command) Usage() {\n\tfmt.Fprintf(os.Stderr, \"usage: %s\\n\\n\", c.UsageLine)\n\tfmt.Fprintf(os.Stderr, \"%s\\n\", strings.TrimSpace(c.Long))\n\tos.Exit(2)\n}", "title": "" }, { "docid": "39c2785175202d5c0485f3407231c10e", "score": "0.5903737", "text": "func printUsage() {\n\tmessage := `----------------------------------------------\n\tWelcome to Use %s %s\n----------------------------------------------\n\nusage:\n`\n\tfmt.Printf(message, appname, appversion)\n\tflag.PrintDefaults()\n\n\tos.Exit(0)\n}", "title": "" }, { "docid": "6e171abf420d79d0652f6c4adc734f7b", "score": "0.5903166", "text": "func usage() {\n\tfmt.Fprintf(os.Stderr, \"Optgen is a tool for generating optimizer code.\\n\\n\")\n\tfmt.Fprintf(os.Stderr, \"Usage:\\n\")\n\n\tfmt.Fprintf(os.Stderr, \"\\toptgen command [flags] sources...\\n\\n\")\n\n\tfmt.Fprintf(os.Stderr, \"The commands are:\\n\\n\")\n\tfmt.Fprintf(os.Stderr, \"\\taggs generates aggregation definitions and functions\\n\")\n\tfmt.Fprintf(os.Stderr, \"\\n\")\n\n\tfmt.Fprintf(os.Stderr, \"Flags:\\n\")\n\n\tflag.PrintDefaults()\n\n\tfmt.Fprintf(os.Stderr, \"\\n\")\n}", "title": "" }, { "docid": "851d9497cacf8d3c128362a92ce6e29f", "score": "0.59000206", "text": "func UsageExamples() string {\n\treturn os.Args[0] + ` foo foo1 --p 6458532619907689287` + \"\\n\" +\n\t\t\"\"\n}", "title": "" }, { "docid": "76950c8044c33ace2a8555afbd2ea589", "score": "0.58930635", "text": "func usage() {\n\tprintUsage(os.Stderr)\n\tos.Exit(1)\n}", "title": "" }, { "docid": "f57e9ce2ee231d809b54157641a8a7ab", "score": "0.5882454", "text": "func usage() {\n\tfmt.Fprintln(os.Stderr)\n\tfmt.Fprintln(os.Stderr, `Runs a HTTP API Endpoint for testing a Docker Logging Plugin that sends data to an HTTP API endpoint`)\n\tfmt.Fprintln(os.Stderr)\n\tfmt.Fprintln(os.Stderr, `Syntax: http_api_endpoint [options]`)\n\tfmt.Fprintln(os.Stderr)\n\tfmt.Fprintln(os.Stderr, `Options:`)\n\tflag.PrintDefaults()\n\tfmt.Fprintln(os.Stderr)\n}", "title": "" }, { "docid": "617921ad46234e8759e88459c6078689", "score": "0.5875811", "text": "func Usage(a App, invocation []string, w io.Writer) error {\n\tif len(invocation) < 1 {\n\t\treturn errors.New(\"invalid invocation path []\")\n\t}\n\n\tdescr := a.Description()\n\tcmds := a.Commands()\n\targs := a.Args()\n\topts := a.Options()\n\n\tif len(invocation) > 1 {\n\t\tfor _, key := range invocation[1:] {\n\t\t\tmatched := false\n\t\t\tfor _, cmd := range cmds {\n\t\t\t\tif cmd.Key() == key {\n\t\t\t\t\tdescr = cmd.Description()\n\t\t\t\t\tcmds = cmd.Commands()\n\t\t\t\t\targs = cmd.Args()\n\t\t\t\t\topts = append(opts, cmd.Options()...)\n\t\t\t\t\tmatched = true\n\t\t\t\t\tbreak\n\t\t\t\t}\n\t\t\t}\n\t\t\t// should never happen if invocation originates from the parser\n\t\t\tif !matched {\n\t\t\t\t// ignore errors here as no alternative writer is available\n\t\t\t\terr := fmt.Errorf(\"fatal: invalid invocation path %v\\n\", invocation)\n\t\t\t\tfmt.Fprint(w, err.Error())\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\n\tindent := \" \"\n\tthiscmd := strings.Join(invocation, \" \")\n\tfmt.Fprintf(w, \"%s%s%s\\n\\n\", thiscmd, optstring(opts), argstring(args))\n\tfmt.Fprintln(w, \"Description:\")\n\tfmt.Fprintf(w, \"%s%s\\n\", indent, descr)\n\n\tvar lines []usageline\n\tmaxkey := 0\n\tif len(args) > 0 {\n\t\tfor _, arg := range args {\n\t\t\tvalue := arg.Description()\n\t\t\tif arg.Optional() {\n\t\t\t\tvalue += \", optional\"\n\t\t\t}\n\t\t\tline := usageline{\n\t\t\t\tsection: \"Arguments\",\n\t\t\t\tkey: arg.Key(),\n\t\t\t\tvalue: value,\n\t\t\t}\n\t\t\tlines = append(lines, line)\n\t\t\tif len(line.key) > maxkey {\n\t\t\t\tmaxkey = len(line.key)\n\t\t\t}\n\t\t}\n\t}\n\n\tif len(opts) > 0 {\n\t\tfor _, opt := range opts {\n\t\t\tcharstr := \" \"\n\t\t\tif opt.CharKey() != rune(0) {\n\t\t\t\tcharstr = \"-\" + string(opt.CharKey()) + \", \"\n\t\t\t}\n\n\t\t\tline := usageline{\n\t\t\t\tsection: \"Options\",\n\t\t\t\tkey: charstr + \"--\" + opt.Key(),\n\t\t\t\tvalue: opt.Description(),\n\t\t\t}\n\t\t\tlines = append(lines, line)\n\t\t\tif len(line.key) > maxkey {\n\t\t\t\tmaxkey = len(line.key)\n\t\t\t}\n\t\t}\n\t}\n\n\tif len(cmds) > 0 {\n\t\tfor _, cmd := range cmds {\n\t\t\tshortstr := \"\"\n\t\t\tif cmd.Shortcut() != \"\" {\n\t\t\t\tshortstr = \", shortcut: \" + cmd.Shortcut()\n\t\t\t}\n\n\t\t\tline := usageline{\n\t\t\t\tsection: \"Sub-commands\",\n\t\t\t\tkey: thiscmd + \" \" + cmd.Key(),\n\t\t\t\tvalue: cmd.Description() + shortstr,\n\t\t\t}\n\t\t\tlines = append(lines, line)\n\t\t\tif len(line.key) > maxkey {\n\t\t\t\tmaxkey = len(line.key)\n\t\t\t}\n\t\t}\n\t}\n\n\tlastsection := \"\"\n\tfor _, line := range lines {\n\t\tif line.section != lastsection {\n\t\t\tfmt.Fprintf(w, \"\\n%s:\\n\", line.section)\n\t\t}\n\t\tlastsection = line.section\n\t\tspacer := 3 + maxkey - len(line.key)\n\t\tfmt.Fprintf(w, \"%s%s%s%s\\n\", indent, line.key, strings.Repeat(\" \", spacer), line.value)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "83eb262c5d8719124f6349b30f0101e7", "score": "0.5872297", "text": "func getUsageTemplate() string {\n\treturn `{{printf \"\\n\"}}Usage:{{if .Runnable}}\n {{.UseLine}}{{end}}{{if gt (len .Aliases) 0}}{{printf \"\\n\" }}\nAliases:\n {{.NameAndAliases}}{{end}}{{if .HasExample}}{{printf \"\\n\" }}\nExamples:\n{{.Example}}{{end}}{{if .HasAvailableSubCommands}}{{printf \"\\n\"}}\nAvailable Commands:{{range .Commands}}{{if (or .IsAvailableCommand (eq .Name \"help\"))}}\n {{rpad .Name .NamePadding }} {{.Short}}{{end}}{{end}}{{end}}{{if .HasAvailableLocalFlags}}{{printf \"\\n\"}}\nFlags:\n{{.LocalFlags.FlagUsages | trimTrailingWhitespaces}}{{end}}{{if .HasAvailableInheritedFlags}}{{printf \"\\n\"}}\nGlobal Flags:\n{{.InheritedFlags.FlagUsages | trimTrailingWhitespaces}}{{end}}{{if .HasHelpSubCommands}}{{printf \"\\n\"}}\nAdditional help topics:{{range .Commands}}{{if .IsAdditionalHelpTopicCommand}}\n {{rpad .CommandPath .CommandPathPadding}} {{.Short}}{{end}}{{end}}{{end}}{{if .HasAvailableSubCommands}}{{printf \"\\n\"}}\nUse \"{{.CommandPath}} [command] --help\" for more information about a command.{{end}}\"\n{{printf \"\\n\"}}`\n}", "title": "" }, { "docid": "c025519df81a1eea2d76ea8f0baa7585", "score": "0.5856789", "text": "func (this *config) Usage(name string) {\n\tname = strings.ToLower(strings.TrimSpace(name))\n\tparts := strings.Fields(name)\n\tif cmd, _ := this.GetCommand(parts); cmd != nil {\n\t\tthis.usageOne(cmd)\n\t} else {\n\t\tthis.usageAll()\n\t}\n}", "title": "" }, { "docid": "e5531b12f3baad4affb829709eefa1ad", "score": "0.585373", "text": "func usage() {\n\tfmt.Fprintf(os.Stderr,\n\t\t\"%s ver %s\\n\\n\"+\n\t\t\t\"Usage: %s [flags] <local-address:port> [<remote-address:port>]+\\n\\n\"+\n\t\t\t\"flags:\\n\\n\",\n\t\tme, version, me)\n\tflag.PrintDefaults()\n\tfmt.Fprintf(os.Stderr, \"\\n\")\n}", "title": "" }, { "docid": "999a96e26b674c4c1022cb5c1e68f7f2", "score": "0.585151", "text": "func usage() {\n\tfmt.Fprintf(os.Stderr, \"%s [OPTIONS],,,\\n\", os.Args[0])\n\tflag.PrintDefaults()\n}", "title": "" }, { "docid": "bdf75451974c38a067e8214a874aad0a", "score": "0.58447623", "text": "func usage() {\n\tlog.Fatalf(usageStr)\n}", "title": "" }, { "docid": "08866d741566396d48fad315398a3380", "score": "0.58382004", "text": "func PrintCommandUsage(cms string) {\n\tswitch cms {\n\tcase \"monitor\":\n\t\tprintDashes()\n\t\tfmt.Println(\"- switches the given interface in to MONITOR mode\")\n\t\tfmt.Println(\"- example: \\\\monitor\")\n\t\tprintDashes()\n\t\tbreak\n\tcase \"managed\":\n\t\tprintDashes()\n\t\tfmt.Println(\"- switches the given interface in to MANAGED mode\")\n\t\tfmt.Println(\"- example: \\\\managed\")\n\t\tprintDashes()\n\t\tbreak\n\tcase \"listen\":\n\t\tprintDashes()\n\t\tfmt.Println(\"- listen all or specific bssid traffic\")\n\t\tfmt.Println(\"- example (listen all): \\\\listen \")\n\t\tfmt.Println(\"- example (listen bssid only): \\\\listen bssid\")\n\t\tprintDashes()\n\tdefault:\n\t\tprintDashes()\n\t\tfmt.Println(\"- no help found for arg \" + cms)\n\t\tprintDashes()\n\t}\n}", "title": "" }, { "docid": "e2feba05e97e0a048d978d8a984cd289", "score": "0.5817189", "text": "func (p *stats) Usage() string {\n\treturn \"admin stats\"\n}", "title": "" }, { "docid": "54d701a0b7d0d8d0a276115637bd98f6", "score": "0.58135265", "text": "func (c *VersionCommand) Usage() {\n\tfmt.Println(`\nPrints the version.\n\nUsage:\n\n\tlitestream version\n`[1:])\n}", "title": "" }, { "docid": "90ea3f7a824452a07ff7c6df8cd312ae", "score": "0.5808369", "text": "func TestCommandsHaveUsage(t *testing.T) {\n\tfor i, c := range allCommands() {\n\t\tt.Run(fmt.Sprintf(\"test usage term of command %d\", i), func(t *testing.T) {\n\t\t\tassert.NotEmpty(t, c.Use)\n\t\t})\n\t}\n}", "title": "" }, { "docid": "f402f8f6f5ba87abf336c7664ae90e37", "score": "0.5805836", "text": "func usage() string {\n\treturn fmt.Sprintf(\"Usage: %s <filename> (try -h)\", os.Args[0])\n}", "title": "" }, { "docid": "80e88d42b25597c0dc2377714f4c9449", "score": "0.5800626", "text": "func usage(out *os.File, description bool) {\n\tif description {\n\t\tfmt.Fprintf(out, \"Returns the IP addresses of the system.\\n\")\n\t\tfmt.Fprintf(out, \"\\n\")\n\t}\n\tfmt.Fprintf(out, \"Usage: %s [options]\\n\", os.Args[0])\n\tfmt.Fprintf(out, \"\\n\")\n\tfmt.Fprintf(out, \"Options:\\n\")\n\tflag.PrintDefaults()\n}", "title": "" }, { "docid": "6b83651bf5b8e742f63031f30e52e2e5", "score": "0.5799652", "text": "func (fc *FooCommand) HelpString() string {\n\treturn \"foo\"\n}", "title": "" }, { "docid": "08d54f199dd1b4697d8afb9e806e5108", "score": "0.57945514", "text": "func Usage() {\n\tfmt.Fprintf(os.Stderr, \"Usage of gensv:\\n\")\n\tfmt.Fprintf(os.Stderr, \"\\tgensv -package P -type T\\n\")\n\tfmt.Fprintf(os.Stderr, \"\\tgensv -package [package] -type [type] -o [filename]\\n\")\n}", "title": "" }, { "docid": "cae74d55256c70becc3adda1dba7bd0b", "score": "0.5794176", "text": "func printProgUsage() {\n\tfmt.Printf(\"\\nUsage:\\n\")\n\tfmt.Printf(\" %s -inputOSM=filename -outputNodes=filename -startNode=number\\n\", progName)\n\tfmt.Printf(\"\\nExample:\\n\")\n\tfmt.Printf(\" %s -inputOSM=osmdata.pbf -outputNodes=osmpp.xml -startNode=1000000000000\\n\", progName)\n\tfmt.Printf(\"\\nOptions:\\n\")\n\tflag.PrintDefaults()\n\n\tos.Exit(1)\n}", "title": "" }, { "docid": "cda2bd2e5d117d12b5270f0f102a949f", "score": "0.57806677", "text": "func ShowSubcommandHelp(ctx *Context, command, subcommand string) {\n\tfor _, c := range ctx.App.Commands {\n\t\tif c.HasName(command) {\n\t\t\tfor _, s := range c.Subcommands {\n\t\t\t\tif s.HasName(subcommand) {\n\t\t\t\t\tHelpPrinter(SubcommandHelpTemplate, s)\n\t\t\t\t\treturn\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\tif ctx.App.CommandNotFound != nil {\n\t\tctx.App.CommandNotFound(ctx, command)\n\t} else {\n\t\tfmt.Printf(\"No help topic for '%v'\\n\", command)\n\t}\n}", "title": "" }, { "docid": "1c2f6117f74a55fd569402e3417d7f79", "score": "0.577714", "text": "func PrintUsage(output io.Writer, usage string) {\n\tfmt.Fprintf(output, usage, path.Base(os.Args[0]))\n\tfmt.Fprint(output, \"\\n\\nOptions:\\n\")\n\n\tflag.VisitAll(func(f *flag.Flag) {\n\t\tfmt.Fprintf(output, \" -%s %s\\n\", f.Name, f.Usage)\n\t})\n\n\tos.Exit(2)\n}", "title": "" }, { "docid": "187a36e3b432795cc917344ed7ac548b", "score": "0.5776756", "text": "func CmdUsage(toolName string, command Command) {\n\tPrintCmdUsage(os.Stderr, toolName, command)\n\tos.Exit(2)\n}", "title": "" }, { "docid": "4157644d67a7023e748cdbbed3e6f4e3", "score": "0.5763291", "text": "func (p *Parser) PrintUsage() {\n\tfmt.Print(p.Usage)\n\toptFormat := fmt.Sprintf(\"%%-%ds%%s\\n\", p.OptPadding+4)\n\tprintHeader := true\n\tfor _, op := range p.options {\n\t\tif !op.hidden {\n\t\t\tif printHeader {\n\t\t\t\tfmt.Print(\"\\nOptions:\\n\")\n\t\t\t\tprintHeader = false\n\t\t\t}\n\t\t\top.Print(optFormat)\n\t\t}\n\t}\n}", "title": "" }, { "docid": "327ecbf0330afd746473829ef9f1d5a7", "score": "0.57534695", "text": "func usage() {\n\tfmt.Printf(\"pst version %s (C) 2015 M. Dittrich\\n\", version)\n\tfmt.Println()\n\tfmt.Println(\"usage: pst <options> file1 file2 ...\")\n\tfmt.Println()\n\tfmt.Println(\"options:\")\n\tflag.PrintDefaults()\n}", "title": "" }, { "docid": "58074273b993bd70e6da8475220e0d78", "score": "0.574885", "text": "func (a *Args) Usage() string {\n\tif len(a.schema) > 0 {\n\t\treturn fmt.Sprintf(\"[%s]\", a.schema)\n\t}\n\treturn \"\"\n}", "title": "" }, { "docid": "c3021c2335aaa1ee58f5bce0271ffa83", "score": "0.5742762", "text": "func printUsage() {\n\tfmt.Println(\"Usage:\")\n\tfmt.Println(\"- list jobs\\t// List all configured jobs\")\n\tfmt.Println(\"- list machines\\t// List all configured machines\")\n\tfmt.Println(\"- list scripts\\t// List all configured scripts\")\n\tfmt.Println(\"- list logs\\t// List all stored logs\")\n\tfmt.Println(\"- run <job id>\\t// Run the job with the given id\")\n\tfmt.Println(\"- exec <action id>\\t// Execute the action with the given id\")\n\tfmt.Println(\"- logs <log id>\\t// Tail the log with the given id\")\n\tfmt.Println(\"- ssh <machine id>\\t// SSH into the machine with the given id\")\n\tfmt.Println(\"- scp <machine id>:<path> <machine id>:<path>\\t// Copy files/directories from one machine to another. Only one of the machines can be specified. The other must be a path to a local file / directory without ':'\")\n fmt.Println(\"- mount <machine id> <remote path> <local path>\\t// Mount a remote directory (to which you have read access) locally\")\n fmt.Println(\"- unmount <local path>\\t// Unmount a previously Mount'ed directory\")\n}", "title": "" }, { "docid": "22e660ab270190305bb2e5d69a57678a", "score": "0.5732585", "text": "func usage() {\n\tvar b bytes.Buffer\n\tflag.CommandLine.SetOutput(&b)\n\tflag.PrintDefaults()\n\tlog.Fatalf(\"Usage: cpu [options] host [shell command]:\\n%v\", b.String())\n}", "title": "" }, { "docid": "a765965f281446a25620d31aacfa41eb", "score": "0.57290596", "text": "func (c *Subcommand) Help(flags *flag.FlagSet) {\n\tfmt.Printf(\"%s\\n\\n%s\\n\\n\", c.shortHelp, c.longHelp)\n\tflags.PrintDefaults()\n}", "title": "" }, { "docid": "2c51f4d4fbbbe5a57f6b499da312f90d", "score": "0.57231116", "text": "func ShowUsage() {\n\tprintln(\"Usage:\\n\\thref_links <html source file>\\n\\tRead content from stdin: href_links -\\ne.g. curl https://example.com/ | href_links -\\nBy default utility tries read ./home.html\")\n\n}", "title": "" }, { "docid": "90ac8847a36648c9f8ac5dc1c7503494", "score": "0.57226086", "text": "func Usage() {\n\t_, _ = fmt.Fprintf(os.Stderr, \"Usage of go-import:\\n\")\n\t_, _ = fmt.Fprintf(os.Stderr, \"\\tgo-import [flags] [directory]\\n\")\n\t_, _ = fmt.Fprintf(os.Stderr, \"\\tgo-import [flags] -tag T [directory]\\n\")\n\t_, _ = fmt.Fprintf(os.Stderr, \"For more information, see:\\n\")\n\t_, _ = fmt.Fprintf(os.Stderr, \"\\thttps://pkg.go.dev/github.com/searKing/golang/tools/go-import\\n\")\n\t_, _ = fmt.Fprintf(os.Stderr, \"Flags:\\n\")\n\tflag.PrintDefaults()\n}", "title": "" }, { "docid": "f49adade89dc8f480afd4d09f3add5a1", "score": "0.572188", "text": "func usage() {\n\tfmt.Fprintf(os.Stderr, \"Scriptgen is a tool for generating optimizer code.\\n\\n\")\n\tfmt.Fprintf(os.Stderr, \"Usage:\\n\")\n\n\tfmt.Fprintf(os.Stderr, \"\\tscriptgen command [flags] sources...\\n\\n\")\n\n\tfmt.Fprintf(os.Stderr, \"The commands are:\\n\\n\")\n\tfmt.Fprintf(os.Stderr, \"\\taggs generates aggregation definitions and functions\\n\")\n\tfmt.Fprintf(os.Stderr, \"\\n\")\n\n\tfmt.Fprintf(os.Stderr, \"Flags:\\n\")\n\n\tflag.PrintDefaults()\n\n\tfmt.Fprintf(os.Stderr, \"\\n\")\n}", "title": "" }, { "docid": "4f23f7ec02337a1c7ec05d7e510585ae", "score": "0.5717317", "text": "func printUsage(f *os.File, kind HelpType) {\n\tconst usageTempl = `\nUSAGE:\n{{.Sp3}}{{.AppName}} --mount=<directory> --shadow=<directory> [--out=<file>]\n{{.Sp3}}{{.AppNameFiller}} [(--csv | --json)] [--ro]\n{{.Sp3}}{{.AppName}} --help\n{{.Sp3}}{{.AppName}} --version\n{{if eq .UsageVersion \"short\"}}\nUse '{{.AppName}} --help' to get detailed information about options and\nexamples of usage.{{else}}\n\nDESCRIPTION:\n{{.Sp3}}{{.AppName}} mounts a synthesized file system which purpose is to generate\n{{.Sp3}}trace events for each low level file I/O operation executed on any file\n{{.Sp3}}or directory under its control. Examples of such operations are open(2),\n{{.Sp3}}read(2), write(2), close(2), access(2), etc.\n\n{{.Sp3}}{{.AppName}} exposes the contents of the directory specified by the\n{{.Sp3}}option '--shadow' via the path specified by the option '--mount'. {{.AppName}}\n{{.Sp3}}generates a trace event for each I/O operation and forwards the operation\n{{.Sp3}}to the target file system, that is, the one which actually hosts the shadow\n{{.Sp3}}directory. See the EXAMPLES section below.\n\n{{.Sp3}}Individual trace events generated by {{.AppName}} are written to the specified\n{{.Sp3}}output file (option --out) in the specified format.\n\n\nOPTIONS:\n{{.Sp3}}--mount=<directory>\n{{.Tab1}}This is the top directory through which the files and directories residing\n{{.Tab1}}under the shadow directory will be exposed. See the EXAMPLES section below.\n{{.Tab1}}The specified directory must exist and must be empty.\n\n{{.Sp3}}--shadow=<directory>\n{{.Tab1}}This is a directory where the files and directories you want to trace\n{{.Tab1}}actually reside.\n{{.Tab1}}The specified directory must exist but may be empty.\n\n{{.Sp3}}--out=<file>\n{{.Tab1}}Path of the text file to write the trace events to. If this file\n{{.Tab1}}does not exist it will be created, otherwise new events will be appended.\n{{.Tab1}}Note that this file cannot be located under the shadow directory.\n{{.Tab1}}Use '-' (dash) to write the trace events to the standard output.\n{{.Tab1}}In addition, you can specify a file name with extension '.csv' or '.json'\n{{.Tab1}}to instruct {{.AppName}} to emit records in the corresponding format,\n{{.Tab1}}as if you had used the '--csv' or '--json' options (see below).\n{{.Tab1}}Default: write trace records to standard output.\n\n{{.Sp3}}--csv\n{{.Tab1}}Format each individual trace event generated by {{.AppName}} as a set of\n{{.Tab1}}comma-separated values in a single line.\n{{.Tab1}}Note that not all events contain the same information since each\n{{.Tab1}}low level I/O operation requires specific arguments. Please refer to\n{{.Tab1}}the documentation at 'https://github.com/airnandez/{{.AppName}}' for\n{{.Tab1}}details on the format of each event.\n{{.Tab1}}CSV is the default output format unless the output file name (see option\n{{.Tab1}}'--out' above) has a '.json' extension.\n\n{{.Sp3}}--json\n{{.Tab1}}Format each individual trace event generated by {{.AppName}} as\n{{.Tab1}}a JSON object. Events in this format are self-described but not all\n{{.Tab1}}events contain the same information since each low level I/O operation\n{{.Tab1}}requires specific arguments. Please refer to the documentation\n{{.Tab1}}at 'https://github.com/airnandez/{{.AppName}}' for details on the format\n{{.Tab1}}of each event.\n\n{{.Sp3}}--ro\n{{.Tab1}}Expose the shadow file system as a read-only file system.\n{{.Tab1}}Default: if this option is not specified, the file system is mounted in\n{{.Tab1}}read-write mode.\n\n{{.Sp3}}--allowother\n{{.Tab1}}Allow other users to access the file system.\n\n{{.Sp3}}--help\n{{.Tab1}}Show this help\n\n{{.Sp3}}--version\n{{.Tab1}}Show version information and source repository location\n\nEXAMPLES:\n{{.Sp3}}To trace file I/O operations on files under $HOME/data use:\n\n{{.Tab1}}{{.AppName}} --mount=/tmp/trace --shadow=$HOME/data\n\n{{.Sp3}}After a successfull mount, the contents under $HOME/data are also\n{{.Sp3}}accessible by using the path /tmp/trace. For instance, if the\n{{.Sp3}}file $HOME/data/hello.txt exists, {{.AppName}} traces all the file I/O\n{{.Sp3}}operations induced by the command:\n\n{{.Tab1}}cat /tmp/trace/hello.txt\n\n{{.Sp3}}Trace events for each one of the low level operations induced by the\n{{.Sp3}}'cat' command above will be written to the output file, the standard\n{{.Sp3}}output in this particular example.\n\n{{.Sp3}}You can also create new files under /tmp/trace. For instance, the file\n{{.Sp3}}I/O operations induced by the shell command:\n\n{{.Tab1}}echo \"This is a new file\" > /tmp/trace/newfile.txt\n\n{{.Sp3}}will be traced and the file will actually be created in\n{{.Sp3}}$HOME/data/newfile.txt. This file will persist even after unmounting\n{{.Sp3}}{{.AppName}} (see below on how to unmount the synthetized file system).\n\n{{.Sp3}}Please note that any destructive action, such as removing or modifying\n{{.Sp3}}the contents of a file or directory using the path /tmp/trace will\n{{.Sp3}}affect the corresponding file or directory under $HOME/data.\n{{.Sp3}}For example, the command:\n\n{{.Tab1}}rm /tmp/trace/notes.txt\n\n{{.Sp3}}will have the same destructive effect as if you had executed\n\n{{.Tab1}}rm $HOME/data/notes.txt\n\n{{.Sp3}}To unmount the file system exposed by {{.AppName}} use:\n\n{{.Tab1}}umount /tmp/trace\n\n{{.Sp3}}Alternatively, on MacOS X you can also use the diskutil(8) command:\n\n{{.Tab1}}/usr/sbin/diskutil unmount /tmp/trace\n{{end}}\n`\n\n\tfields := map[string]string{\n\t\t\"AppName\": programName,\n\t\t\"AppNameFiller\": strings.Repeat(\" \", len(programName)),\n\t\t\"Sp2\": \" \",\n\t\t\"Sp3\": \" \",\n\t\t\"Sp4\": \" \",\n\t\t\"Sp5\": \" \",\n\t\t\"Sp6\": \" \",\n\t\t\"Tab1\": \"\\t\",\n\t\t\"Tab2\": \"\\t\\t\",\n\t\t\"Tab3\": \"\\t\\t\\t\",\n\t\t\"Tab4\": \"\\t\\t\\t\\t\",\n\t\t\"Tab5\": \"\\t\\t\\t\\t\\t\",\n\t\t\"Tab6\": \"\\t\\t\\t\\t\\t\\t\",\n\t\t\"UsageVersion\": \"short\",\n\t}\n\tif kind == HelpLong {\n\t\tfields[\"UsageVersion\"] = \"long\"\n\t}\n\tminWidth, tabWidth, padding := 8, 4, 0\n\ttabwriter := tabwriter.NewWriter(f, minWidth, tabWidth, padding, byte(' '), 0)\n\ttempl := template.Must(template.New(\"\").Parse(usageTempl))\n\ttempl.Execute(tabwriter, fields)\n\ttabwriter.Flush()\n}", "title": "" }, { "docid": "a56d92ce72bf7b0e1857f853a7995621", "score": "0.5716619", "text": "func (f Function) Usage() string {\n\t// Name1 ${VAR} ARG [OPT_ARG]\n\t// Name1 ${VAR} ARG [OPT_ARG]\n\t// Description\n\targline := \"\"\n\tif f.NeedsVariable {\n\t\targline = fmt.Sprintf(\" ${VAR}\")\n\t}\n\targc := 0\n\tif f.NumArgsMin > 0 {\n\t\tfor i := 0; i < f.NumArgsMin; i++ {\n\t\t\targline = fmt.Sprintf(\"%s ARG%d\", argline, argc)\n\t\t\targc++\n\t\t}\n\t}\n\tif f.NumArgsMax > f.NumArgsMin {\n\t\targline = fmt.Sprintf(\"%s [\", argline)\n\t\tfor i := 0; i < f.NumArgsMax-f.NumArgsMin; i++ {\n\t\t\targline = fmt.Sprintf(\"%s ARG%d\", argline, argc)\n\t\t\targc++\n\t\t}\n\t\targline = fmt.Sprintf(\"%s ]\", argline)\n\t}\n\n\tresult := \"\"\n\tfor i, name := range f.Names {\n\t\tif i > 0 {\n\t\t\tresult = fmt.Sprintf(\"%s\\n\", result)\n\t\t}\n\t\tresult = fmt.Sprintf(\"%s#! %s%s\", result, name, argline)\n\t}\n\tif len(f.Description) > 0 {\n\t\tif len(result) > 0 {\n\t\t\tresult = fmt.Sprintf(\"%s\\n\", result)\n\t\t}\n\t\tresult = fmt.Sprintf(\"%s%s\", result, f.Description)\n\t}\n\treturn result\n}", "title": "" }, { "docid": "2beed47f56a41436238f09fad4269b30", "score": "0.5716383", "text": "func (cmd *EnableCommand) Usage() string {\n\treturn EnableUsage\n}", "title": "" }, { "docid": "57e6c6c08c63b87326d6bcc1af9b03a7", "score": "0.5714604", "text": "func usage() {\n\tfmt.Fprintf(os.Stderr, \"Usage of %s:\\n\", progName)\n\tfmt.Fprintf(os.Stderr, \" %s CONFIG_PATH CACHESIZE (test)\\n\", progName)\n\tfmt.Fprintf(os.Stderr, \"ex: $GOPATH/bin/CFconfig.json 50 test\\n\")\n\tflag.PrintDefaults()\n}", "title": "" }, { "docid": "f92a4f98d4a9c5f82b871b745a6ab46c", "score": "0.5713031", "text": "func Usage() {\n\t// To embed the bot user and password comment the line above and uncomment the line below\n\tfmt.Printf(\"Usage: %v -i <ip address> -p <port> -d <domain name>\\n\", runAs)\n\tflag.PrintDefaults()\n}", "title": "" }, { "docid": "58e00fc1b64d1267149cbd4e594b5717", "score": "0.57041985", "text": "func Usage() {\n\tfmt.Fprintf(os.Stderr, \"Usage of %s:\\n\", os.Args[0])\n\tfmt.Fprintf(os.Stderr, \"\\tgen-bash-completion\\n\")\n\tos.Exit(2)\n}", "title": "" }, { "docid": "e60da5b7d5545df3b35d21d28eedb30a", "score": "0.57018894", "text": "func UsageCommands() string {\n\treturn `user-service (signup|verify-confirmation-token|update-username|verify-password-reset-token|reset-password|change-password|login|refresh-access-token|logout|list-users)\n`\n}", "title": "" }, { "docid": "924f341062b70ccd55622afce73cdd59", "score": "0.56913036", "text": "func usage() {\n\tfmt.Fprintf(os.Stderr, \"LangGen generates the AST for the Optgen language.\\n\\n\")\n\n\tfmt.Fprintf(os.Stderr, \"LangGen uses the Optgen definition language to generate its own AST.\\n\")\n\n\tfmt.Fprintf(os.Stderr, \"Usage:\\n\")\n\n\tfmt.Fprintf(os.Stderr, \"\\tlanggen [flags] command sources...\\n\\n\")\n\n\tfmt.Fprintf(os.Stderr, \"The commands are:\\n\\n\")\n\tfmt.Fprintf(os.Stderr, \"\\texprs generate expression definitions and functions\\n\")\n\tfmt.Fprintf(os.Stderr, \"\\tops generate operator definitions and functions\\n\")\n\tfmt.Fprintf(os.Stderr, \"\\n\")\n\n\tfmt.Fprintf(os.Stderr, \"Flags:\\n\")\n\n\tflag.PrintDefaults()\n\n\tfmt.Fprintf(os.Stderr, \"\\n\")\n}", "title": "" }, { "docid": "197ab6d7e8d11f923d0751f0ed96bed8", "score": "0.56854486", "text": "func neatThingUsage() {\n\tfmt.Fprintf(os.Stderr, `Allows access to discover neat things.\nUsage:\n %s [globalflags] neat-thing COMMAND [flags]\n\nCOMMAND:\n neat-thing-today: NeatThingToday implements neatThingToday.\n new-neat-thing: NewNeatThing implements newNeatThing.\n\nAdditional help:\n %s neat-thing COMMAND --help\n`, os.Args[0], os.Args[0])\n}", "title": "" }, { "docid": "3be18d24544d0ac1fc42b2c513e265d2", "score": "0.5683747", "text": "func UsageFunc(usageTemplate string) func() {\n\treturn func() {\n\t\tvar t *template.Template\n\t\tvar err error\n\t\tif t, err = template.New(\"usage\").Parse(usageTemplate); err != nil {\n\t\t\tfmt.Fprintln(os.Stderr, err)\n\t\t\tos.Exit(1)\n\t\t}\n\t\tif err := t.Execute(os.Stdout, os.Args[0]); err != nil {\n\t\t\tfmt.Fprintln(os.Stderr, err)\n\t\t\tos.Exit(1)\n\t\t}\n\t\t// TODO(aoeu): Print default flags before printing usage examples.\n\t\tflag.PrintDefaults()\n\t\tos.Exit(2)\n\t}\n}", "title": "" }, { "docid": "1a201cb2bb9f02ef9ac27da72bb495e8", "score": "0.5670818", "text": "func printUsage() {\n\tmessage := `\napt_volume_service keeps track of how much disk space we have in our staging\narea. Workers reserve space with the volume service before trying to download\nlarge files for processing. Without this service, we regularly run into errors\nbecause the disk fills up. The service listens for HTTP requests on localhost,\non the port specified in the VolumeServicePort setting of the JSON config file.\nUse Control-C, SIGINT, or SIGKILL to shut down the service.\n\nUsage: apt_volume_service -config=<absolute path to APTrust config file>\n\nParam -config is required.\n`\n\tfmt.Println(message)\n}", "title": "" }, { "docid": "b698b61961a39f059fc5ff00042bc398", "score": "0.5669369", "text": "func usage() {\n fmt.Printf(\"Usage of %s:\\n\", os.Args[0])\n fmt.Println(\" [-unsafe] inputfile outfile search-string replace-string\")\n fmt.Println(\"\\nAvailable options:\")\n flag.PrintDefaults()\n fmt.Printf(\"\\nThe -unsafe flag can increase performance. The performance gain is, however, marginal\\n\")\n fmt.Println(\"and is generally not worth the added risks, hence the name: unsafe\")\n}", "title": "" }, { "docid": "b47e75312f853db872eb88634d03a481", "score": "0.5661686", "text": "func (o *Options) Usage() {\n\to.flags.Usage()\n}", "title": "" }, { "docid": "1535ac70c7a6bbf7d6163fc13db4686a", "score": "0.56537133", "text": "func (cli *CLI) Usage() {\n\tfmt.Printf(`\nUsage: floop [-c <config_file>] [key=value ...] -exec <command> [args]\n\nfloop is a tool to add lifecycle event handlers to any arbitrary process\n\n`)\n}", "title": "" }, { "docid": "ebf852e81bc48d389300ec08bef9c97b", "score": "0.5642899", "text": "func Usage() {\n\t_, _ = fmt.Fprintf(os.Stderr, \"Usage of plc4xgenerator:\\n\")\n\t_, _ = fmt.Fprintf(os.Stderr, \"\\tplc4xgenerator [flags] -type T [directory]\\n\")\n\t_, _ = fmt.Fprintf(os.Stderr, \"\\tplc4xgenerator [flags] -type T files... # Must be a single package\\n\")\n\t_, _ = fmt.Fprintf(os.Stderr, \"Flags:\\n\")\n\tflag.PrintDefaults()\n}", "title": "" } ]
97cb9b519b8f8ad9e5f8d367a9a8a3b6
isAuthed retursn if the given value as a string may be an authenticated cookie value. Should this falsely fire due to a remote attacker doing something mean, all that should happen is that the cookie subsequently fails the check and is therefore removed from the cookie pile. This should be indistinguishable from a client never sending it, which is a thing we can't prevent anyhow, so any resulting insecurity would be "real" anyhow and not caused by Sphyraena.
[ { "docid": "d53b7819b85d12d3c5485b2635be9f0c", "score": "0.6546219", "text": "func isAuthed(s string) bool {\n\tif len(s) < authedLength {\n\t\treturn false\n\t}\n\n\tsig := s[len(s)-authedLength:]\n\tif sig[:len(signSuffix)] != signSuffix {\n\t\treturn false\n\t}\n\n\tif !maybeSignature(sig[len(signSuffix):]) {\n\t\treturn false\n\t}\n\n\treturn true\n}", "title": "" } ]
[ { "docid": "2d27e37c02a37f9c6f1a74c0ac341814", "score": "0.55793643", "text": "func (ic *InCookie) Authenticated() bool {\n\treturn ic.authenticated\n}", "title": "" }, { "docid": "377fb978cfb93844cc5b2fd17903a0f0", "score": "0.5561583", "text": "func isUserAuthed(ctx *gin.Context) bool {\n\t_, ok := userClients.Get(getSessId(ctx))\n\treturn ok\n}", "title": "" }, { "docid": "8cbe6e551702899f3b69f93c046c5f8d", "score": "0.5484956", "text": "func (a *Auth) IsSet() bool {\n\treturn a.ClientID != \"\"\n}", "title": "" }, { "docid": "e2bdcd53fc675178ce5152af5e263bc7", "score": "0.54689014", "text": "func (a *CookieAuth) shouldAuth(req *http.Request) bool {\n\tif _, err := req.Cookie(kivik.SessionCookieName); err == nil {\n\t\treturn false\n\t}\n\tcookie := a.Cookie()\n\tif cookie == nil {\n\t\treturn true\n\t}\n\tif !cookie.Expires.IsZero() {\n\t\treturn cookie.Expires.Before(time.Now().Add(time.Minute))\n\t}\n\t// If we get here, it means the server did not include an expiry time in\n\t// the session cookie. Some CouchDB configurations do this, but rather than\n\t// re-authenticating for every request, we'll let the session expire. A\n\t// future change might be to make a client-configurable option to set the\n\t// re-authentication timeout.\n\treturn false\n}", "title": "" }, { "docid": "967412a0e0011596f85e47468c8c95e6", "score": "0.54514915", "text": "func (l *LoginCookie) Check(value string) bool {\n\t// Prevents timing atack\n\treturn subtle.ConstantTimeCompare([]byte(l.validatorHash()), []byte(value)) == 1\n}", "title": "" }, { "docid": "00c4e52b523c2d0c3e937886792829c1", "score": "0.54470104", "text": "func (r *userContext) isCookie() bool {\n\treturn !r.isBearer()\n}", "title": "" }, { "docid": "d892aef1fe730d96a82bb33601128d41", "score": "0.5331246", "text": "func isAuthJwtTokenValide(cookie *http.Cookie, jwtSecret []byte) bool {\n\ttknStr := cookie.Value\n\tclaims := &Claims{}\n\n\ttkn, err := jwt.ParseWithClaims(tknStr, claims, func(token *jwt.Token) (interface{}, error) {\n\t\treturn jwtSecret, nil\n\t})\n\n\tif err != nil {\n\t\treturn false\n\t}\n\n\tif !tkn.Valid {\n\t\treturn false\n\t}\n\n\treturn true\n}", "title": "" }, { "docid": "ed93ec7233b5366286ddaa5a5e9ebe3c", "score": "0.531286", "text": "func IsAdminAutenticathed() (cr Credentials) {\n\tvar ok bool\n\tif UserSession == nil {\n\t\treturn Credentials{false, false}\n\t}\n\tif cr.Auth, ok = UserSession.Values[\"authenticated\"].(bool); !ok {\n\t\tcr.Auth = false\n\t}\n\tif cr.Admin, ok = UserSession.Values[\"Admin\"].(bool); !ok {\n\t\tcr.Admin = false\n\t}\n\treturn\n}", "title": "" }, { "docid": "e1a03612db058cc368f4fdb98b959720", "score": "0.5137302", "text": "func (t *GithubProvider) isAuthenticated(r *http.Request) bool {\n\tif _, err := t.CookieStore.Get(r, t.Config.CookieSessionName); err == nil {\n\t\treturn true\n\t}\n\treturn false\n}", "title": "" }, { "docid": "7619f2365f94bfb334585798e5895a17", "score": "0.5053408", "text": "func (w *wsContext) isAuthenticated() bool {\n\treturn w.uuid != \"\"\n}", "title": "" }, { "docid": "48fc231a312112fe90244804f113e53c", "score": "0.5033666", "text": "func IsValidCookie(r *http.Request) bool {\n\tcookie, err := r.Cookie(\"Authorization\")\n\tif cookie != nil && err == nil {\n\t\tclaims, err := GetClaimsFromToken(cookie.Value)\n\n\t\tif err == nil && claims[\"nick\"] != nil && claims[\"nick\"].(string) != \"\" {\n\t\t\treturn true\n\t\t}\n\t}\n\treturn false\n}", "title": "" }, { "docid": "3e4c6e92cb28551d25488fecc158d50e", "score": "0.5031919", "text": "func (u *User) HasAuthed() bool {\n\treturn u.name != \"\"\n}", "title": "" }, { "docid": "98a6c831ea3afb5ec0330d63fd2dddcb", "score": "0.5019456", "text": "func CookieString(c *http.Cookie,) string", "title": "" }, { "docid": "3e132a27cc9821f630983bd0b3027fe3", "score": "0.5001913", "text": "func checkAuth(tuid string) (bool, error) {\n\topt, err := redisClient.HMGet(tuid, \"username\", \"passwd\").Result()\n\tif err != nil {\n\t\treturn false, err\n\t}\n\t_, ok := opt[0].(string)\n\tif !ok {\n\t\treturn false, err\n\t}\n\t_, ok = opt[1].(string)\n\tif !ok {\n\t\treturn false, err\n\t}\n\treturn true, nil\n}", "title": "" }, { "docid": "7a9f28b0e507ec801f880fa739927b80", "score": "0.4990719", "text": "func (a Auth) IsSet() bool {\n\treturn a.Server != \"\" ||\n\t\ta.Username != \"\" ||\n\t\ta.Password != \"\"\n}", "title": "" }, { "docid": "f720dd637790897826ad903353724de8", "score": "0.49878025", "text": "func (ca *clientAuth) authToken() (token string, ok bool) {\n\tca.mu.Lock()\n\tdefer ca.mu.Unlock()\n\tif ca.token == \"\" || ca.lastRefresh.Add(tokenFreshnessDuration).Before(time.Now()) {\n\t\treturn \"\", false\n\t}\n\treturn ca.token, true\n}", "title": "" }, { "docid": "e6338d4ce1d6912dfef27d7511fed680", "score": "0.49695078", "text": "func Authenticate(ctx context.Context, tokenString string) (bool, error) {\n\ttoken, err := jwt.ParseWithClaims(tokenString, &jwtClaims{}, func(token *jwt.Token) (interface{}, error) {\n\t\tjwtClaims, ok := token.Claims.(*jwtClaims)\n\t\tif !ok {\n\t\t\treturn false, ErrorAuth\n\t\t}\n\t\tuser := &model.User{Username: jwtClaims.Username}\n\t\terr := orm.SelectOne(ctx, user)\n\t\tif err != nil {\n\t\t\treturn false, ErrorAuth\n\t\t}\n\t\tif !reflect.DeepEqual(&jwtClaims.User, user) {\n\t\t\treturn false, ErrorAuth\n\t\t}\n\t\treturn secret, nil\n\t})\n\n\treturn token.Valid, err\n}", "title": "" }, { "docid": "ce6a69301c44a5060d1460a064fc94f4", "score": "0.49439752", "text": "func authenticate(req *http.Request) bool {\n\n\tuid, err := req.Cookie(\"uid\")\n\tif err != http.ErrNoCookie {\n\n\t\t// they already have a cookie\n\t\tdb, err := sql.Open(\"mysql\", dbCreds)\n\t\tif err != nil {\n\t\t\tlog.Fatal(err)\n\t\t}\n\t\tdefer db.Close()\n\n\t\t// get the corresponding uid from the database\n\t\t// then scan the count of uid into ct\n\t\tvar ct int\n\t\terr = db.QueryRow(\"SELECT count(uid) FROM logins WHERE uid = ?\", uid.Value).Scan(&ct)\n\t\tif err == sql.ErrNoRows {\n\t\t\treturn false\n\t\t}\n\t\tif err != nil {\n\t\t\tlog.Fatal(err)\n\t\t}\n\n\t\treturn ct > 0\n\t}\n\treturn false\n}", "title": "" }, { "docid": "36c29efd473076b35bed76d830851009", "score": "0.49378252", "text": "func (a *API) Authenticated() bool {\n\treturn a.sessionkey != \"\"\n}", "title": "" }, { "docid": "c3b010a4b21a602037bb8955c9fb2bac", "score": "0.49020824", "text": "func isLoggedIn(r *http.Request) bool {\n\tcookie, err := r.Cookie(\"session\")\n\tif err != nil {\n\t\tderr(err.Error())\n\t\treturn false\n\t}\n\n\tvar u UserClient\n\tif err = cookieHandler.Decode(\"session\", cookie.Value, &u); err != nil {\n\t\tderr(err.Error())\n\t\treturn false\n\t}\n\tif len([]rune(u.Username)) > 1 {\n\t\treturn true\n\t}\n\treturn false\n}", "title": "" }, { "docid": "3084be9498cd90c7b9e81c67f357e6ae", "score": "0.48951736", "text": "func (a App) Authed(r *http.Request) *HTTPRedirect {\n\tif a.User == nil {\n\t\tvar to string\n\t\tif r == nil || r.URL == nil {\n\t\t\tto = \"/login\"\n\t\t} else {\n\t\t\tto = \"/login?redirect=\" + url.QueryEscape(r.URL.RequestURI())\n\t\t}\n\t\treturn &HTTPRedirect{\n\t\t\tTo: to,\n\t\t\tCode: http.StatusSeeOther,\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "b01fbd0e123f53d40ef1db49a106f9ae", "score": "0.48850933", "text": "func (s *WebServer) tryAuth(w http.ResponseWriter, r *http.Request, user *userInfo) bool {\n\tif !user.Authed {\n\t\ts.handleLogin(w, r)\n\t\treturn true\n\t}\n\treturn false\n}", "title": "" }, { "docid": "e3895b1c6d7da5479f9da710b0c02d09", "score": "0.48793232", "text": "func IsStun(data []byte) bool {\n\tif len(data) < 20 {\n\t\treturn false\n\t}\n\n\treturn isMagicCookie(data[4:8])\n}", "title": "" }, { "docid": "4295247f7051b49bb50e556b3903c7d0", "score": "0.4869164", "text": "func (recv *Auth) IsAuthenticated() bool {\n\tretC := C.soup_auth_is_authenticated((*C.SoupAuth)(recv.native))\n\tretGo := retC == C.TRUE\n\n\treturn retGo\n}", "title": "" }, { "docid": "da9bd9c4d5b90ab953a790a6f56cda81", "score": "0.48606196", "text": "func (a AlwaysCheck) Authorized(_, _, _ string) bool {\n\treturn bool(a)\n}", "title": "" }, { "docid": "8ef7978ad88a6de5abd8dbef151cdb1a", "score": "0.48569378", "text": "func (c *IkaClient) Authorized() bool {\n\turi := c.BaseURL\n\tsession := getSessionFromCookie(splatoonCookieName, c.hc.Jar.Cookies(uri))\n\treturn len(session) != 0\n}", "title": "" }, { "docid": "4252433dd25d27c9392edf1ba81b1d8b", "score": "0.482073", "text": "func IsAuthenticated(r *http.Request) *Session {\n\tkey := getSession(r)\n\ts := Session{}\n\tGet(&s, \"`key` = ?\", key)\n\tif isValidSession(&s) {\n\t\treturn &s\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "23c136b47e640299d0b3050d435f8f01", "score": "0.48119825", "text": "func isLoggedIn(r *http.Request) bool {\n\tcookie, err := r.Cookie(\"UserName\")\n\n\tif err == nil {\n\t\taccess.Lock()\n\t\tdefer access.Unlock()\n\n\t\t_, flag := userList[cookie.Value]\n\t\treturn flag\n\t} else {\n\t\treturn false\n\t}\n}", "title": "" }, { "docid": "472d2d6bb9ae407ba6c900036a11f5b8", "score": "0.47604787", "text": "func (s *session) Init() bool {\n\tcookie := s.cookie\n\tif cookie == nil {\n\t\treturn false\n\t}\n\n\t// Separate the data from the signature.\n\thyphen := strings.Index(cookie.Value, \"-\")\n\tif hyphen == -1 || hyphen >= len(cookie.Value)-1 {\n\t\treturn false\n\t}\n\tsig, data := cookie.Value[:hyphen], cookie.Value[hyphen+1:]\n\n\t// Verify the signature.\n\tif !Verify(data, sig) {\n\t\treturn false\n\t}\n\n\ts.key = data\n\ts.data = store.Get(data)\n\ts.status = true\n\n\treturn true\n}", "title": "" }, { "docid": "12db56368178cfb403b9aa7cf79bb599", "score": "0.47503832", "text": "func (s *Session) Authenticated() bool {\n\treturn s.AccessToken != \"\" && s.AccessSecret != \"\"\n}", "title": "" }, { "docid": "29d4b51f5d3c0f1a824e46fd431d66f6", "score": "0.4720366", "text": "func (c *secureCookies) Bool(key string) (bool, error) {\n\tck, err := c.req.Cookie(key)\n\tif err != nil {\n\t\treturn false, err\n\t}\n\ts := parseSecureCookie(c.secret, ck.Value)\n\treturn strconv.ParseBool(s)\n}", "title": "" }, { "docid": "f5e68dc286927fb51a3b6c237ad77ea6", "score": "0.46734995", "text": "func isSAMLAuthorized(r *http.Request, cookieName string, sp saml.ServiceProvider) bool {\n\tcookie, err := r.Cookie(cookieName)\n\tif err != nil {\n\t\treturn false\n\t}\n\n\ttoken, tokenClaims, err := parseSAMLJWT(cookie.Value)\n\tif err != nil || !token.Valid {\n\t\tlogger.ErrorIf(err, \"Invalid token\")\n\t\treturn false\n\t}\n\tif err = tokenClaims.StandardClaims.Valid(); err != nil {\n\t\tlogger.ErrorIf(err, \"Invalid token claims\")\n\t\treturn false\n\t}\n\tif tokenClaims.Audience != sp.Metadata().EntityID {\n\t\tlogger.ErrorIf(err, \"Invalid audience\")\n\t\treturn false\n\t}\n\treturn true\n}", "title": "" }, { "docid": "857d47c90b0d73275d92edd64955be54", "score": "0.46699995", "text": "func isLoggedIn(req *http.Request) bool {\n\n\t// get cookie\n\t// if there's no sid cookie -- redirect to login page\n\n\tc, err := req.Cookie(\"sid\")\n\n\tfmt.Println(c)\n\n\tif err == http.ErrNoCookie {\n\t\tfmt.Println(\"no sid found\")\n\t\treturn false\n\t}\n\n\t// query the database with the UID\n\t// if nil - then return false\n\t// prevent injection somehow?\n\n\tdb, err := sql.Open(\"mysql\", dbCreds)\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\tdefer db.Close()\n\n\tvar u string\n\terr = db.QueryRow(\"SELECT user FROM sessions WHERE sid = '?'\", c).Scan(&u)\n\n\tfmt.Println(u)\n\n\treturn true\n}", "title": "" }, { "docid": "0525871eef15b544233365e41bd3cd1c", "score": "0.46676198", "text": "func (c *cookies) Bool(key string) (bool, error) {\n\tck, err := c.req.Cookie(key)\n\tif err != nil {\n\t\treturn false, err\n\t}\n\treturn strconv.ParseBool(ck.Value)\n}", "title": "" }, { "docid": "e03104224553768d0fb7e0a9bfcb4573", "score": "0.46648306", "text": "func IsAuthenticatedSession(w http.ResponseWriter, r *http.Request) (bool, string) {\r\n\tsessionData := make(map[string]string)\r\n\r\n\tsessionData[\"clientip\"] = \"127.0.0.1\" // setting default to 127.0.0.1. Must be overwritten using x-forward-for\r\n\tsessionData[\"token\"] = r.Header.Get(\"NHR-TOKEN\") // adding token informaiton\r\n\r\n\t//// session validation\r\n\tif len(authsession) == 0 {\r\n\t\treturn false, \"No active session found\"\r\n\t}\r\n\tasIndex := asmap[sessionData[\"token\"]]\r\n\r\n\t//// Check all the failing conditions\r\n\tif asIndex < 0 || asIndex > len(authsession) {\r\n\t\treturn false, \"Invalid token provided\"\r\n\t}\r\n\r\n\tif authsession[asIndex].Token != sessionData[\"token\"] {\r\n\t\treturn false, \"Token does not exist in authenticated session\"\r\n\t}\r\n\r\n\tif authsession[asIndex].ClientIp != sessionData[\"clientip\"] {\r\n\t\treturn false, \"Invalid Client IP for authenticated session\"\r\n\t}\r\n\r\n\tthisActivityTime := time.Now().UTC().Unix()\r\n\tif thisActivityTime > authsession[asIndex].TokenHardExpiry {\r\n\t\treturn false, \"Token has expired\"\r\n\t}\r\n\r\n\t// TODO: v1.5\r\n\t/*\r\n\t\tif thisActivityTime > (authsession[asIndex].LastActivity + authsession[asIndex].IdleTimeOut) {\r\n\t\t\treturn false\r\n\t\t}\r\n\t*/\r\n\r\n\treturn true, \"Authenticated session\"\r\n}", "title": "" }, { "docid": "0ee366d994a259b72fc12819c6d86de2", "score": "0.46617597", "text": "func (sa *staticAuthenticator) Authenticate(user string, pass string) bool {\n\tpassword, found := sa.credentials[user]\n\tif !found {\n\t\treturn false\n\t}\n\treturn pass == password\n}", "title": "" }, { "docid": "08117dd38ed088cfee643cfd3ebd9b81", "score": "0.46411994", "text": "func isAuthorized(h *Hub, token string, username string) bool {\n\tif h.clients[username] == nil {\n\t\treturn false\n\t}\n\tsessionToken := findSessionToken(h, username)\n\treturn len(sessionToken) > 0\n}", "title": "" }, { "docid": "507b4479ac98dbf52cd8143db990fe74", "score": "0.46375737", "text": "func AccessIsWithExplicitAuth(path string) (bool, string, error) {\n\turi, err := url.Parse(path)\n\tif err != nil {\n\t\treturn false, \"\", err\n\t}\n\thasExplicitAuth := false\n\tswitch uri.Scheme {\n\tcase \"s3\":\n\t\tauth := uri.Query().Get(AuthParam)\n\t\thasExplicitAuth = auth == AuthParamSpecified || auth == \"\"\n\n\t\t// If a custom endpoint has been specified in the S3 URI then this is no\n\t\t// longer an explicit AUTH.\n\t\thasExplicitAuth = hasExplicitAuth && uri.Query().Get(AWSEndpointParam) == \"\"\n\tcase \"gs\":\n\t\tauth := uri.Query().Get(AuthParam)\n\t\thasExplicitAuth = auth == AuthParamSpecified\n\tcase \"azure\":\n\t\t// Azure does not support implicit authentication i.e. all credentials have\n\t\t// to be specified as part of the URI.\n\t\thasExplicitAuth = true\n\tcase \"http\", \"https\", \"nodelocal\":\n\t\thasExplicitAuth = false\n\tcase \"experimental-workload\", \"workload\", \"userfile\":\n\t\thasExplicitAuth = true\n\tdefault:\n\t\treturn hasExplicitAuth, \"\", nil\n\t}\n\treturn hasExplicitAuth, uri.Scheme, nil\n}", "title": "" }, { "docid": "f1da3783c85d83025b96cca26b4885ae", "score": "0.46205515", "text": "func (app *application) isAuthenticated(r *http.Request) bool {\r\n\t_, ok := r.Context().Value(contextKeyAuthUser).(AuthUser)\r\n\treturn ok\r\n}", "title": "" }, { "docid": "2830e5ac1ebf7419cee21c0cc055ad9e", "score": "0.4612561", "text": "func secretAuth(username, password string) bool {\n\tif username == user && password == pass {\n\t\treturn true\n\t}\n\treturn false\n}", "title": "" }, { "docid": "b29b03f07b9cbdddd1a18ae1442ad0e2", "score": "0.45999178", "text": "func (gomd *Govasmd) IsAuthenticated() bool {\n\treturn gomd.Authenticated\n}", "title": "" }, { "docid": "03c7dc2fd72436501d38d7832bad4b25", "score": "0.4577837", "text": "func (s *Scram) Authenticated() bool {\n\treturn s.authenticated\n}", "title": "" }, { "docid": "02f8ffea2aab8635863affdc98b65e56", "score": "0.45734128", "text": "func attatchCookietoUser(cookieID string, user User) bool {\n\tdb := opendb()\n\tdefer db.Close()\n\n\t// add cookie to database to show user is logged in\n\tsqlStatement, err := db.Prepare(\"UPDATE \\\"user\\\" SET cookie_id = $1 WHERE user_id = $2;\")\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\tsqlStatement.Exec(cookieID, user.UserID)\n\n\t// show success of cookie placement\n\treturn true\n}", "title": "" }, { "docid": "5beceb7f8aa15bf634db7287ec316ed5", "score": "0.45553482", "text": "func (c *CookieUtils) IsToken(token string) bool {\n\t_, found := c.token.Get(token)\n\tif found {\n\t\tc.token.Delete(token)\n\t}\n\treturn found\n}", "title": "" }, { "docid": "aa9b57125ddd81a502bbf4fd3b9e4e34", "score": "0.45490754", "text": "func (wc *WebConn) IsAuthenticated() bool {\n\t// Check the expiry to see if we need to check for a new session\n\tif wc.GetSessionExpiresAt() < model.GetMillis() {\n\t\tif wc.GetSessionToken() == \"\" {\n\t\t\treturn false\n\t\t}\n\n\t\tsession, err := wc.App.GetSession(wc.GetSessionToken())\n\t\tif err != nil {\n\t\t\tif err.StatusCode >= http.StatusBadRequest && err.StatusCode < http.StatusInternalServerError {\n\t\t\t\tmlog.Debug(\"Invalid session.\", mlog.Err(err))\n\t\t\t} else {\n\t\t\t\tmlog.Error(\"Could not get session\", mlog.String(\"session_token\", wc.GetSessionToken()), mlog.Err(err))\n\t\t\t}\n\n\t\t\twc.SetSessionToken(\"\")\n\t\t\twc.SetSession(nil)\n\t\t\twc.SetSessionExpiresAt(0)\n\t\t\treturn false\n\t\t}\n\n\t\twc.SetSession(session)\n\t\twc.SetSessionExpiresAt(session.ExpiresAt)\n\t}\n\n\treturn true\n}", "title": "" }, { "docid": "89f48b36336a091ed76ab88484988b6f", "score": "0.4526844", "text": "func (s *Session) Authed(account, client uint64, token string) error {\n\tif s.accountID != 0 || s.clientID != 0 || s.authToken != \"\" {\n\t\treturn errors.New(\"session already authed\")\n\t}\n\ts.accountID, s.clientID, s.authToken = account, client, token\n\treturn nil\n}", "title": "" }, { "docid": "3c8c211a69a813a10a14c0859c3ec9c2", "score": "0.45147493", "text": "func (p CacheSlidePointer3) Authenticated() bool {\n\treturn types.ExtractBits(uint64(p), 63, 1) != 0\n}", "title": "" }, { "docid": "3c8c211a69a813a10a14c0859c3ec9c2", "score": "0.45147493", "text": "func (p CacheSlidePointer3) Authenticated() bool {\n\treturn types.ExtractBits(uint64(p), 63, 1) != 0\n}", "title": "" }, { "docid": "f9e9f616d942b0b731e05bd76844ade6", "score": "0.4499273", "text": "func authenticated(r *http.Request) string {\n\tsession, _ := store.Get(r, sessionName)\n\tlog.Println(session)\n\treturn \"\"\n}", "title": "" }, { "docid": "35226aedd030fca3849795b3cdaa9d3a", "score": "0.44992143", "text": "func Validate(cookie *http.Cookie, seed string, expiration time.Duration) (value []byte, t time.Time, ok bool) {\n\t// value, timestamp, sig\n\tparts := strings.Split(cookie.Value, \"|\")\n\tif len(parts) != 3 {\n\t\treturn\n\t}\n\tif checkSignature(parts[2], seed, cookie.Name, parts[0], parts[1]) {\n\t\tts, err := strconv.Atoi(parts[1])\n\t\tif err != nil {\n\t\t\treturn\n\t\t}\n\t\t// The expiration timestamp set when the cookie was created\n\t\t// isn't sent back by the browser. Hence, we check whether the\n\t\t// creation timestamp stored in the cookie falls within the\n\t\t// window defined by (Now()-expiration, Now()].\n\t\tt = time.Unix(int64(ts), 0)\n\t\tif (expiration == time.Duration(0)) || (t.After(time.Now().Add(expiration*-1)) && t.Before(time.Now().Add(time.Minute*5))) {\n\t\t\t// it's a valid cookie. now get the contents\n\t\t\trawValue, err := base64.URLEncoding.DecodeString(parts[0])\n\t\t\tif err == nil {\n\t\t\t\tvalue = rawValue\n\t\t\t\tok = true\n\t\t\t\treturn\n\t\t\t}\n\t\t}\n\t}\n\treturn\n}", "title": "" }, { "docid": "43ac2a6e197e030790b90b453d7d5e59", "score": "0.44978198", "text": "func GetSignedCookieValue(s string) string {\n\tidx := strings.LastIndex(s, \":\")\n\tif idx < 0 {\n\t\treturn \"\"\n\t}\n\tts, err := strconv.ParseInt(s[idx+1:], 10, 64)\n\tif err != nil {\n\t\treturn \"\"\n\t}\n\texpiry := time.Unix(ts, 0)\n\tif time.Since(expiry) > 0 {\n\t\treturn \"\"\n\t}\n\tvalue := s[:idx]\n\tidx = strings.LastIndex(s, \":\")\n\tif idx < 0 {\n\t\treturn \"\"\n\t}\n\texpected := signCookieValue(value, expiry)\n\tif subtle.ConstantTimeCompare([]byte(s), []byte(expected)) != 1 {\n\t\treturn \"\"\n\t}\n\treturn value\n}", "title": "" }, { "docid": "57ff0324dc8831975c28ef0c7cf7f6b7", "score": "0.44938183", "text": "func CheckIsAuthorised(context *gin.Context) {\n\ttoken, err := context.Cookie(tokenString)\n\t//if err != nil {\n\t//\treturn\n\t//}\n\t_, ok := service.TokensCache[token]\n\tif ok {\n\t\tcontext.Redirect(http.StatusMovedPermanently, MblogURI+HomeURI)\n\t\tcontext.Abort()\n\t}\n\n\ttoken, err = context.Cookie(googleTokenString)\n\tif err != nil {\n\t\treturn\n\t}\n\tif len(token) > 0 {\n\t\tcontext.Redirect(http.StatusMovedPermanently, MblogURI+HomeURI)\n\t\tcontext.Abort()\n\t}\n}", "title": "" }, { "docid": "560f7177879f110be7eb6607f4c1dc3b", "score": "0.44829497", "text": "func isLoggedIn(r *http.Request) (bool, int, error) {\n\tsignature, err := session.GetBytes(r, \"signature\")\n\taccountId, err := session.GetInt(r, \"accountId\")\n\tif err != nil {\n\t\treturn false, http.StatusInternalServerError, err\n\t}\n\t// if fresh clear token\n\tif signature == nil || accountId == 0 {\n\t\treturn false, http.StatusUnauthorized, nil\n\t}\n\n\tdbConn, err := db.GetDbConn()\n\n\tif err != nil {\n\t\treturn false, http.StatusInternalServerError, err\n\t}\n\n\tac := &public_models.Account{}\n\n\tif ac, err = public_models.Accounts(dbConn, qm.Where(\"id = $1\", accountId)).One(); err != nil {\n\t\treturn false, http.StatusBadRequest, errors.Wrapf(err, \"couldn't find account id %d\", ac.ID)\n\t}\n\n\t// check if cookie has expired due to password change\n\tmatch := bcrypt.CompareHashAndPassword(signature, []byte(ac.Password.String))\n\n\tif match != nil {\n\t\treturn false, http.StatusForbidden, errors.New(\"signature match fail\")\n\t}\n\n\tloggedIn, err := session.GetBool(r, \"loggedIn\")\n\n\tif err != nil {\n\t\treturn false, http.StatusInternalServerError, errors.Wrap(err, \"couldn't get loggedIn from session\")\n\t}\n\n\tif !loggedIn {\n\t\treturn false, http.StatusForbidden, nil\n\t}\n\n\treturn true, http.StatusOK, nil\n}", "title": "" }, { "docid": "b58f534d4b4da533e390214cf4e7abf8", "score": "0.44776678", "text": "func isOwner(w http.ResponseWriter, r *http.Request) bool {\n\tparams := mux.Vars(r)\n\t//Checks if user is logged in\n\tcookie := checkLoggedIn(r)\n\tif cookie == nil {\n\t\thttp.Redirect(w, r, \"/Users/LogIn\", http.StatusSeeOther)\n\t\treturn false\n\t}\n\t//Get the userid for a note\n\tuserValue := isOwnerSQL(params[\"NoteID\"], cookie.Value)\n\n\tif strconv.Itoa(userValue) != cookie.Value {\n\t\thttp.Redirect(w, r, \"/Users/Notes/\"+cookie.Value, http.StatusSeeOther)\n\t\treturn false\n\t}\n\t//Returns true if owner\n\treturn true\n}", "title": "" }, { "docid": "cf133320b88634ab8a3f27f64a8698ba", "score": "0.44749746", "text": "func (c *Controller) isAuthenticated(r *http.Request, endpoint string) bool {\n\tif !c.spec.JWTEnabled {\n\t\treturn true\n\t}\n\ttoken, claims := c.jwt.Validate(r.Header.Get(\"Authorization\"))\n\tif token == nil || !token.Valid {\n\t\treturn false\n\t}\n\tswitch endpoint {\n\tcase \"list\":\n\t\tif c.spec.Endpoints.List.Secret == \"\" {\n\t\t\treturn true\n\t\t}\n\t\treturn claims.Secret == c.spec.Endpoints.List.Secret\n\tcase \"start\":\n\t\tif c.spec.Endpoints.Start.Secret == \"\" {\n\t\t\treturn true\n\t\t}\n\t\treturn claims.Secret == c.spec.Endpoints.Start.Secret\n\tcase \"stop\":\n\t\tif c.spec.Endpoints.Stop.Secret == \"\" {\n\t\t\treturn true\n\t\t}\n\t\treturn claims.Secret == c.spec.Endpoints.Stop.Secret\n\tcase \"static\":\n\t\tif c.spec.Endpoints.Static.Secret == \"\" {\n\t\t\treturn true\n\t\t}\n\t\treturn claims.Secret == c.spec.Endpoints.Static.Secret\n\t}\n\treturn true\n}", "title": "" }, { "docid": "bcc3b8cb53cf05d5155965dcfcbd5d46", "score": "0.44737026", "text": "func getCookie(w http.ResponseWriter, r *http.Request) bool {\n\tsession := getSession()\n\tnameCookie, _ := r.Cookie(\"username\")\n\tif nameCookie == nil {\n\t\treturn false\n\t} else {\n\t\tcookie, _ := r.Cookie(nameCookie.Value)\n\t\treturn session.checkCookie(*cookie)\n\t}\n}", "title": "" }, { "docid": "5917a62832adadc32ab6bff14c7ad758", "score": "0.44716418", "text": "func isDuplicate(w http.ResponseWriter, r *http.Request) bool {\n\t_, e := r.Cookie(cooKIE)\n\tif e != nil {\n\t\thttp.SetCookie(w, &http.Cookie{Name: cooKIE, Value: \"__\", Expires: time.Now().Add(time.Minute), HttpOnly: true, Path: \"/\"})\n\t\treturn false\n\t}\n\treturn true\n}", "title": "" }, { "docid": "97d13db33c82f06514b57edd5646d892", "score": "0.446258", "text": "func shouldReprompt(r *http.Request) bool {\n\t_, err := r.Cookie(cookieLastSeen)\n\tif err == nil {\n\t\treturn true\n\t}\n\treturn false\n}", "title": "" }, { "docid": "b85b9165915b596558a7f301fb1da03d", "score": "0.44464764", "text": "func Authenticate(c *context.Context) error {\n\t// Check Auth Cookie\n\tsignkey := beego.AppConfig.String(\"signkey\")\n\tval, found := c.GetSecureCookie(signkey, \"AuthCookie\")\n\tif !found || val != authToken {\n\t\treturn errors.New(\"Please login to continue\")\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "51b7540cd1fe23272c9c3b05eb46724b", "score": "0.44372627", "text": "func AuthSession(c *gin.Context, rdb *db.DbConn) (string, bool, error) {\n\t//Get cookie from the gin router\n\tsessionKey, err := c.Cookie(sessionCookieName)\n\tif err != nil {\n\t\treturn \"\", false, err\n\t\t//Cookie not found, apparently...\n\t}\n\n\t//Lookup session in database\n\tsession, found, err := rdb.GetSession(sessionKey)\n\tif err != nil {\n\t\tfmt.Println(\"couldnt run query\")\n\t\treturn \"\", false, err\n\t}\n\tif !found {\n\t\tfmt.Println(\"no matching cookies\")\n\t\treturn \"\", false, nil\n\t} else {\n\t\tcurTime := time.Now().UTC().Unix()\n\t\texpireTime := session.Expires\n\t\tif expireTime < curTime {\n\t\t\treturn \"\", false, nil\n\t\t} else {\n\t\t\treturn session.UID, true, nil\n\t\t}\n\t}\n}", "title": "" }, { "docid": "cd760ad700ff898d3ad0d566ff94431e", "score": "0.4436526", "text": "func (g *Getter) IsString(name string) bool {\n\t_, ok := g.getSafelyKindly(name, reflect.String)\n\treturn ok\n}", "title": "" }, { "docid": "8ab5b1af77dfccd5d736a7dad8adfd55", "score": "0.44309974", "text": "func Authenticate(username, pass string) bool {\n\t//savedPass = get []byte from db\n\tsavedPass, salt, err := getPassSalt(username)\n\tif err == nil {\n\t\tkey, err := encrypt(pass, salt)\n\t\tif err == nil {\n\t\t\ti := bytes.Compare(savedPass, key)\n\t\t\tif i == 0 {\n\t\t\t\treturn true\n\t\t\t}\n\t\t}\n\t}\n\tHandleError(err)\n\treturn false\n}", "title": "" }, { "docid": "62fdc489cfe785db9f163ade9914e083", "score": "0.44305447", "text": "func getCredentialSpec(prefix, value string) (bool, string) {\n\tif strings.HasPrefix(value, prefix) {\n\t\treturn true, strings.TrimPrefix(value, prefix)\n\t}\n\treturn false, \"\"\n}", "title": "" }, { "docid": "58973ccd645a5b524bf79a00b19828f2", "score": "0.44198275", "text": "func (c *VaultClient) Authenticated() bool {\n\t_, err := c.api.Auth().Token().LookupSelf()\n\tif err != nil {\n\t\treturn false\n\t} else {\n\t\treturn true\n\t}\n}", "title": "" }, { "docid": "da06774fac1b2daa8d4eaad1f1e62a4e", "score": "0.44181064", "text": "func authFunctino(auth authType) (ok bool, matches bool) {\n\tfmt.Println(\"trying to auth: \", auth, userExistsDB)\n\tval, ok := userExistsDB[auth.Email]\n\n\tif ok && val == auth.Pw {\n\t\tmatches = true\n\t} else {\n\t\tfmt.Println(auth, val, ok)\n\t\tmatches = false\n\t}\n\treturn\n}", "title": "" }, { "docid": "51e1c5359e86cca3a99eac8f623d3e58", "score": "0.44163385", "text": "func (c *cookies) MustString(key string, defaults ...string) string {\n\tck, err := c.req.Cookie(key)\n\tif err != nil {\n\t\tif len(defaults) > 0 {\n\t\t\treturn defaults[0]\n\t\t}\n\t\treturn \"\"\n\t}\n\treturn ck.Value\n}", "title": "" }, { "docid": "f2fc59b5b608e97f0a95c3b556b1da3b", "score": "0.44157344", "text": "func Authenticate(req *http.Request) bool {\n\tvar token string\n\tauthHeaderList := req.Header[\"Authorization\"]\n\tif len(authHeaderList) > 0 {\n\t\tauthHeader := strings.Split(authHeaderList[0], \" \")\n\t\tif len(authHeader) == 2 && authHeader[0] == \"Bearer\" {\n\t\t\ttoken = strings.TrimSpace(authHeader[1])\n\t\t}\n\t}\n\t// if not specified token, authenticate failed\n\tif token == \"\" {\n\t\treturn false\n\t}\n\n\tu := models.BcsUser{\n\t\tUserToken: token,\n\t}\n\tuser := sqlstore.GetUserByCondition(&u)\n\tif user == nil {\n\t\treturn false\n\t}\n\n\t// only authenticate admin user\n\tif user.UserType == sqlstore.AdminUser && !user.HasExpired() {\n\t\treturn true\n\t}\n\treturn false\n}", "title": "" }, { "docid": "431fac2c7e3b4a39e62ea8fe1b7aafd2", "score": "0.4407066", "text": "func IsAuthTokenPresent(req *http.Request) bool {\n\treturn req.Header.Get(tokenHeader) == \"yes\"\n}", "title": "" }, { "docid": "a58a9893309b7675bb1389ba6abc8df9", "score": "0.43972927", "text": "func IsAuthorized(r *http.Request, ckName string, s *SessStore) (Session, bool) {\n\tauth := false\n\t//300 OMIT\n\tck, err := r.Cookie(ckName)\n\t//310 OMIT\n\tvar sess Session\n\tif err == nil { // cookie found\n\t\tsess, auth = s.Get(ck.Value) // valid session found\n\t}\n\treturn sess, auth\n}", "title": "" }, { "docid": "cbb71dbff248151cb9f6579fc7fcad1b", "score": "0.43962497", "text": "func (c ConstCheck) Authorized(capability, _, _ string) bool {\n\treturn string(c) == capability\n}", "title": "" }, { "docid": "d95cee91b1f503ade906340dbfe4cc08", "score": "0.4395219", "text": "func (cd CookieDatum) Equals(o CookieDatum) bool {\n\texpTimeEq := (cd.ExpiresInSec == nil && o.ExpiresInSec == nil) ||\n\t\t(cd.ExpiresInSec != nil && o.ExpiresInSec != nil && *cd.ExpiresInSec == *o.ExpiresInSec)\n\n\treturn cd.Name == o.Name &&\n\t\tcd.Value == o.Value &&\n\t\tcd.ValueIsLiteral == o.ValueIsLiteral &&\n\t\texpTimeEq &&\n\t\tcd.Domain == o.Domain &&\n\t\tcd.Path == o.Path &&\n\t\tcd.Secure == o.Secure &&\n\t\tcd.HttpOnly == o.HttpOnly &&\n\t\tcd.SameSite == o.SameSite\n}", "title": "" }, { "docid": "24a0bb58faa37b79bbba5965d9107089", "score": "0.43807077", "text": "func (c *Client) AuthenticationRequired() bool {\n\treturn c.authentication.AccessToken == \"\" || c.authentication.ExpiresAt <= time.Now().Unix()\n}", "title": "" }, { "docid": "40e0455b64dc9adda7c5d2496dec950b", "score": "0.43735078", "text": "func (c Cookie) Get() (*http.Cookie, error) {\r\n\tif c.c.Value != \"\" {\r\n\t\treturn c.c, nil\r\n\t}\r\n\tvar err error\r\n\tc.c, err = c.core.Req.Cookie(c.c.Name)\r\n\tif err != nil {\r\n\t\treturn nil, err\r\n\t}\r\n\r\n\tif !c.secure || c.core.App.CookieHashKey == nil {\r\n\t\treturn c.c, nil\r\n\t}\r\n\r\n\tif c.c.Value == \"\" {\r\n\t\treturn c.c, nil\r\n\t}\r\n\r\n\treader, err := c.core.Crypto().Base64HmacReader(strings.NewReader(c.c.Value), c.core.App.CookieHashKey,\r\n\t\tc.core.App.CookieBlockKey)\r\n\tif err != nil {\r\n\t\tif c.validate {\r\n\t\t\tc.Delete()\r\n\t\t\treturn nil, err\r\n\t\t} else {\r\n\t\t\treturn c.c, nil\r\n\t\t}\r\n\t}\r\n\r\n\tbuf := &bytes.Buffer{}\r\n\tdefer buf.Reset()\r\n\tbuf.ReadFrom(reader)\r\n\r\n\tstr := buf.String()\r\n\tnameLen := len(c.c.Name)\r\n\tif len(str) < nameLen {\r\n\t\tc.Delete()\r\n\t\treturn nil, ErrorStr(c.core.Lang().Key(\"errCookieNameCheck\"))\r\n\t}\r\n\r\n\tif c.c.Name != str[:nameLen] {\r\n\t\tc.Delete()\r\n\t\treturn nil, ErrorStr(c.core.Lang().Key(\"errCookieNameCheck\"))\r\n\t}\r\n\r\n\tc.c.Value = str[nameLen:]\r\n\r\n\treturn c.c, nil\r\n}", "title": "" }, { "docid": "41051cf4c37b95d59abbeb3fb9499950", "score": "0.43603235", "text": "func (this *Database) authString() (auth string) {\n\tif this.dbType == SqLite {\n\t\treturn\n\t}\n\n\tauth = this.User\n\n\tif !isEmpty(this.Password) {\n\t\tauth += \":\" + this.Password\n\t}\n\n\treturn\n}", "title": "" }, { "docid": "afdb9b1bdc5bd6b66afbe8feb0dd4f19", "score": "0.4341614", "text": "func (s *Store) Auth(token string) bool {\n\tif s.AuthToken != \"\" && s.AuthToken == token {\n\t\treturn true\n\t}\n\n\treturn s.driver.auth(token)\n}", "title": "" }, { "docid": "86f8b88a47d2c2a9a3dbe7d3542f02ba", "score": "0.4332019", "text": "func isUserAuthenticated(c *gin.Context) bool {\n\tuser := activeUser(c)\n\treturn user != nil\n}", "title": "" }, { "docid": "7f75ec44dc4a0fa5836b9eda9b39b8b4", "score": "0.43245977", "text": "func (ic *InCookies) GetPossiblyUnauthenticated(name string) *InCookie {\n\tif ic == nil {\n\t\treturn nil\n\t}\n\treturn ic.cookies[name]\n}", "title": "" }, { "docid": "9404475f709843e2299d663b6b06bf26", "score": "0.43124086", "text": "func (repo *Repository) IsAuthenticated(r *http.Request) bool {\n\texists := repo.AppConf.Session.Exists(r.Context(), \"user_id\")\n\treturn exists\n}", "title": "" }, { "docid": "1086acaedf5c4cbd174471277d6cf204", "score": "0.43122607", "text": "func (vl VippsLogin) Authenticate(w http.ResponseWriter, r *http.Request) (caddyauth.User, bool, error) {\n\tif vl.isRedirURL(r) {\n\t\treturn vl.handleRedir(w, r)\n\t}\n\tnumbers, open := vl.allowedNumbers(r)\n\tif open {\n\t\treturn caddyauth.User{}, true, nil\n\t}\n\tcookie, err := r.Cookie(\"vipps-login-user\")\n\tif err == http.ErrNoCookie {\n\t\treturn vl.redirectToLogin(w, r)\n\t} else if err != nil {\n\t\treturn caddyauth.User{}, false, err\n\t}\n\n\t// If we see a malformed cookie, we assume it's due to some tinkering or old\n\t// version of this plugin. In that case, we'll redirect the user to the login\n\t// page to reauthenticate.\n\tcookieParts := strings.Split(cookie.Value, \".\")\n\tif len(cookieParts) != 3 {\n\t\treturn vl.redirectToLogin(w, r)\n\t}\n\tphoneNumberBytes, err := base64.StdEncoding.DecodeString(cookieParts[0])\n\tif err != nil {\n\t\treturn vl.redirectToLogin(w, r)\n\t}\n\tphoneNumber := string(phoneNumberBytes)\n\n\ttimeBytes, err := base64.StdEncoding.DecodeString(cookieParts[1])\n\tif err != nil {\n\t\treturn vl.redirectToLogin(w, r)\n\t}\n\tvar expiryDate time.Time\n\terr = expiryDate.UnmarshalBinary(timeBytes)\n\tif err != nil {\n\t\treturn vl.redirectToLogin(w, r)\n\t}\n\tif time.Now().After(expiryDate) {\n\t\treturn vl.redirectToLogin(w, r)\n\t}\n\n\tactualMAC, err := base64.StdEncoding.DecodeString(cookieParts[2])\n\tif err != nil {\n\t\treturn vl.redirectToLogin(w, r)\n\t}\n\tmac := hmac.New(sha256.New, vl.signingKey)\n\tmac.Write(phoneNumberBytes)\n\tmac.Write([]byte{'.'})\n\tmac.Write(timeBytes)\n\texpectedMAC := mac.Sum(nil)\n\tif !hmac.Equal(actualMAC, expectedMAC) {\n\t\treturn vl.redirectToLogin(w, r)\n\t}\n\n\tfor _, n := range numbers {\n\t\tif phoneNumber == n {\n\t\t\treturn caddyauth.User{ID: phoneNumber}, true, nil\n\t\t}\n\t}\n\tw.WriteHeader(http.StatusForbidden)\n\tif vl.ForbiddenPage == \"\" {\n\t\tw.Write([]byte(\"Access denied\"))\n\t\treturn caddyauth.User{}, false, nil\n\t}\n\thttp.ServeFile(w, r, vl.ForbiddenPage)\n\treturn caddyauth.User{}, false, nil\n}", "title": "" }, { "docid": "92a6a6694be588b293ff0c592e2a6277", "score": "0.43118", "text": "func IsUserLoggedIn() bool {\n\tif viper.IsSet(configs.FirebaseRefreshTokenViperConfigKey) && viper.GetString(configs.FirebaseLoggedInUserEmailViperConfigKey) != \"\" {\n\t\t// todo: probably check the format of the token to ensure its correct\n\t\treturn true\n\t}\n\treturn false\n}", "title": "" }, { "docid": "86adec1294e355266189b70dd020b1cc", "score": "0.4309763", "text": "func (c Claim) IsUser(userID int64) bool {\n\treturn c.userID == userID\n}", "title": "" }, { "docid": "d7db0bae2e8e25334014e3ddcd1b433a", "score": "0.42859715", "text": "func authUser(c *gin.Context) (bool, int, string) {\n\ttokenString, err := c.Cookie(\"authToken\")\n\tif err != nil {\n\t\tif err == http.ErrNoCookie {\n\t\t\t//c.JSON(http.StatusUnauthorized, \"User not authorised\")\n\t\t\treturn false, http.StatusUnauthorized, \"User not authorised\"\n\t\t}\n\t\tc.JSON(http.StatusBadRequest, gin.H{\"error\": err})\n\t\treturn false, http.StatusBadRequest, err.Error()\n\t}\n\n\tclaims := &models.Claims{}\n\n\ttoken, err := jwt.ParseWithClaims(tokenString, claims, func(token *jwt.Token) (interface{}, error) {\n\t\tif _, ok := token.Method.(*jwt.SigningMethodHMAC); !ok {\n\t\t\treturn nil, fmt.Errorf(\"Unexpected signing method: %s\", token.Header[\"alg\"])\n\t\t}\n\t\treturn secretKey, nil\n\t})\n\n\tif err != nil {\n\t\tif err == jwt.ErrSignatureInvalid {\n\t\t\t//\tc.JSON(http.StatusUnauthorized, gin.H{\"error\": err})\n\t\t\treturn false, http.StatusUnauthorized, err.Error()\n\t\t}\n\t\t//c.JSON(http.StatusBadRequest, gin.H{\"error\": err})\n\t\treturn false, http.StatusBadRequest, err.Error()\n\t}\n\n\t_, ok := token.Claims.(*models.Claims)\n\n\tif !ok || !token.Valid {\n\t\t//c.JSON(http.StatusUnauthorized, \"User not authorized\")\n\t\treturn false, http.StatusUnauthorized, \"User not authorized\"\n\t}\n\n\treturn true, http.StatusOK, \"\"\n}", "title": "" }, { "docid": "1b5c006e78c020fec190f14580523a0b", "score": "0.4283624", "text": "func (vrs *VolatileRequestStore) IsAuthenticated(reqRef *requestpb.RequestRef) (bool, error) {\n\n\tif reqInfo, ok := vrs.requests[requestKey(reqRef)]; !ok {\n\t\t// If an entry for the referenced request is present, return the authenticated flag.\n\t\treturn reqInfo.authenticated, nil\n\t} else {\n\t\t// If the entry does not exist, return an error.\n\t\treturn false, fmt.Errorf(fmt.Sprintf(\"request (%d.%d.%x) not present\",\n\t\t\treqRef.ClientId, reqRef.ReqNo, reqRef.Digest))\n\t}\n}", "title": "" }, { "docid": "0b7a2ab827cb4462145803c33b4b0c30", "score": "0.428001", "text": "func CheckCookie(urlString string, cookieName string) bool {\n\tcookieURL, _ := url.Parse(urlString)\n\tfound := false\n\tfor _, cookie := range defaultClient.Jar.Cookies(cookieURL) {\n\t\tif cookie.Name == cookieName {\n\t\t\tfound = true\n\t\t\tbreak\n\t\t}\n\t}\n\treturn found\n}", "title": "" }, { "docid": "839cf08b107fcfacb20a372a51a39379", "score": "0.42734745", "text": "func (detector *valueDetector) IsValue(value string) bool {\n\tif value == \"\" {\n\t\treturn true\n\t}\n\n\tif detector.isNumber(value) {\n\t\treturn true\n\t}\n\n\tif detector.isUUID(value) {\n\t\treturn true\n\t}\n\n\tif detector.isDataURI(value) {\n\t\treturn true\n\t}\n\n\tif detector.isIP(value) {\n\t\treturn true\n\t}\n\n\tif detector.isEmail(value) {\n\t\treturn true\n\t}\n\n\tif detector.isSemVer(value) {\n\t\treturn true\n\t}\n\n\tif detector.isEthereumAddress(value) {\n\t\treturn true\n\t}\n\n\tif detector.isJWTToken(value) {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "690c1cc7d16b65e2970bb1081cb01b72", "score": "0.4270863", "text": "func (s *GRPCServer) FetchAuth(accessUUID string) error {\n\tredis, err := redis.NewClient(s.Conf.RedisDSN)\n\tredisClient := redis.Client\n\tdefer redisClient.Close()\n\n\tvalue, err := redisClient.Get(accessUUID).Result()\n\tif err != nil || value == \"\" {\n\t\treturn fmt.Errorf(\"Пользователь еще не авторизован\")\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "90ef9bcd7f18a734f04e22929e6b73e8", "score": "0.42699888", "text": "func (ic *InCookie) Value() string {\n\treturn ic.value\n}", "title": "" }, { "docid": "bc27c12fb7fd56cc2b0602d4e9b88025", "score": "0.42548245", "text": "func Authenticate(authorization string) (bool, string) {\n\tif myIdam == nil {\n\t\treturn false, \"\"\n\t}\n\treturn myIdam.authenticate(authorization)\n}", "title": "" }, { "docid": "358af8762a637640665c9fac03716088", "score": "0.42545372", "text": "func IsAuthenticated() gin.HandlerFunc {\n\n\treturn func(c *gin.Context) {\n\t\tif _, ok := c.Get(\"UserSession\"); ok {\n\t\t\tc.Next()\n\t\t} else {\n\t\t\tc.AbortWithStatus(401)\n\t\t}\n\t}\n}", "title": "" }, { "docid": "a609bf362c095252c43d66b7f3ba9fd4", "score": "0.42515934", "text": "func validateCookie(req *http.Request) bool {\n\n\tfor key, value := range cookiesDigests {\n\n\t\tlog.Println(\"Key:\", key, \"Value:\", value)\n\t\tcookie, err := req.Cookie(key)\n\n\t\tif err == nil {\n\t\t\tlog.Println(\"Cookie:\" + cookie.String())\n\n\t\t\t// Logging the possible errors\n\t\t\tif value != generateDigest(cookie.Value) {\n\t\t\t\tlog.Println(\"The following cookie has been changed: [\" + key + \"]\")\n\t\t\t\treturn true\n\t\t\t}\n\n\t\t} else {\n\t\t\tlog.Println(err)\n\t\t}\n\t}\n\treturn false\n}", "title": "" }, { "docid": "125f2fd53596705eda4a827bccd9f4d6", "score": "0.42475188", "text": "func (user *User) IsCook() bool {\n\treturn getKthBit(user.Permissions, 0)\n}", "title": "" }, { "docid": "33d5dbdc6129361f5ef9436f2a6723be", "score": "0.4246716", "text": "func testHashedPassword() bool {\n\tif !testValidPost() {\n\t\treturn false\n\t}\n\n\tif !testGetTooSoon() {\n\t\treturn false\n\t}\n\n\tif !testGetHashedPassword() {\n\t\treturn false\n\t}\n\n\tif !testGetSingleStats() {\n\t\treturn false\n\t}\n\n\treturn true\n}", "title": "" }, { "docid": "399dc22c8f1f1af7ed7575387b6e52d5", "score": "0.4244343", "text": "func CheckCookie(urlString string, cookieName string) bool {\n\tcookieURL, _ := url.Parse(urlString)\n\tfound := false\n\tfor _, cookie := range DefaultClient.Jar.Cookies(cookieURL) {\n\t\tif cookie.Name == cookieName {\n\t\t\tfound = true\n\t\t\tbreak\n\t\t}\n\t}\n\treturn found\n}", "title": "" }, { "docid": "c0c878e2ce5176dc36d4f53bce3c461e", "score": "0.42432678", "text": "func (c *Client) CASString(ctx context.Context, key string, nonce []byte, origValue, value string) ([]byte, error) {\n\treturn c.driver.CAS(ctx, c.member, key, nonce, []byte(origValue), []byte(value))\n}", "title": "" }, { "docid": "d376f9c3773f7339cde00c8827da7636", "score": "0.4240844", "text": "func (r *RestrictedToken) Authenticates(req *http.Request) bool {\n\tif req == nil || req.URL == nil {\n\t\treturn false\n\t}\n\tif time.Now().After(r.ExpirationTime) {\n\t\treturn false\n\t}\n\tif r.Paths != nil {\n\t\tescapedPath := req.URL.EscapedPath()\n\t\tfor _, path := range *r.Paths {\n\t\t\tif path == escapedPath || strings.HasPrefix(escapedPath, strings.TrimSuffix(path, \"/\")+\"/\") {\n\t\t\t\treturn true\n\t\t\t}\n\t\t}\n\t\treturn false\n\t}\n\treturn true\n}", "title": "" }, { "docid": "667e476fb5b995014665f3f7e08dce55", "score": "0.4235635", "text": "func VerifyCaptchaAndIsClear(identifier, verifyValue string, isClear bool) bool {\n\tif verifyValue == \"\" {\n\t\treturn false\n\t}\n\tstoreValue := globalStore.Get(identifier, isClear)\n\treturn strings.ToLower(storeValue) == strings.ToLower(verifyValue)\n}", "title": "" }, { "docid": "4934275659fcfcbe56ef61f142164ee0", "score": "0.42319083", "text": "func (u *SQLUser) IsAuthenticated() bool {\n\treturn u.authenticated\n}", "title": "" }, { "docid": "3b7d1496b20f34b61fbf382ab8ab0bc1", "score": "0.42314082", "text": "func Wrapped(c *WrapConfig) bool {\n\tif c.CookieKey == \"\" {\n\t\tc.CookieKey = DEFAULT_COOKIE_KEY\n\t}\n\n\tif c.CookieValue == \"\" {\n\t\tc.CookieValue = DEFAULT_COOKIE_VAL\n\t}\n\n\t// If the cookie key/value match our environment, then we are the\n\t// child, so just exit now and tell the caller that we're the child\n\treturn os.Getenv(c.CookieKey) == c.CookieValue\n}", "title": "" }, { "docid": "04bedbb4419b0b16be01d3dd01dfeb95", "score": "0.42201033", "text": "func (value Value) IsString() bool {\n\treturn value.kind == valueString\n}", "title": "" }, { "docid": "2f00fb027fc00bb1098a3a4035e9aacc", "score": "0.4216482", "text": "func (s *server) auth(login, password string) (ok bool) {\n\tif time.Now().Sub(s.authUpdate) > time.Minute {\n\t\ts.loadAuth()\n\t}\n\n\treturn s.authList[login] == password\n}", "title": "" } ]
78909dddfbf07126406e783b7b5531ea
NewRequestDataStream returns a new RequestDataStream
[ { "docid": "fcea3b30fde000bbb89b10dd62eedf8a", "score": "0.7291775", "text": "func NewRequestDataStream(REQ_MESSAGE_RATE uint16, TARGET_SYSTEM uint8, TARGET_COMPONENT uint8, REQ_STREAM_ID uint8, START_STOP uint8) *RequestDataStream {\n\tm := RequestDataStream{}\n\tm.REQ_MESSAGE_RATE = REQ_MESSAGE_RATE\n\tm.TARGET_SYSTEM = TARGET_SYSTEM\n\tm.TARGET_COMPONENT = TARGET_COMPONENT\n\tm.REQ_STREAM_ID = REQ_STREAM_ID\n\tm.START_STOP = START_STOP\n\treturn &m\n}", "title": "" } ]
[ { "docid": "1f9fd8bf4c60b7ac05cdde8bab39da7a", "score": "0.66826195", "text": "func (c *InputService1ProtocolTest) newRequest(op *aws.Operation, params, data interface{}) *aws.Request {\n\treq := aws.NewRequest(c.Service, op, params, data)\n\n\treturn req\n}", "title": "" }, { "docid": "5ed618d043ff04ee64a0baf6193c3b7b", "score": "0.6643572", "text": "func (r *Request) DataStream(data io.Reader) Interface {\n\tr.requestData, r.requestDataInterface = &bytes.Reader{}, data\n\treturn r\n}", "title": "" }, { "docid": "bd4666b64a376b3f67d20223490cae2b", "score": "0.66357684", "text": "func (c *InputService1ProtocolTest) newRequest(op *request.Operation, params, data interface{}) *request.Request {\n\treq := c.NewRequest(op, params, data)\n\n\treturn req\n}", "title": "" }, { "docid": "bd4666b64a376b3f67d20223490cae2b", "score": "0.66357684", "text": "func (c *InputService1ProtocolTest) newRequest(op *request.Operation, params, data interface{}) *request.Request {\n\treq := c.NewRequest(op, params, data)\n\n\treturn req\n}", "title": "" }, { "docid": "8c6f2b96ce944d54365055b96043b3a4", "score": "0.66166204", "text": "func (c *InputService4ProtocolTest) newRequest(op *aws.Operation, params, data interface{}) *aws.Request {\n\treq := aws.NewRequest(c.Service, op, params, data)\n\n\treturn req\n}", "title": "" }, { "docid": "12d44c833339080f897e13ccc2481f24", "score": "0.66137403", "text": "func (c *InputService16ProtocolTest) newRequest(op *request.Operation, params, data interface{}) *request.Request {\n\treq := c.NewRequest(op, params, data)\n\n\treturn req\n}", "title": "" }, { "docid": "12d44c833339080f897e13ccc2481f24", "score": "0.66137403", "text": "func (c *InputService16ProtocolTest) newRequest(op *request.Operation, params, data interface{}) *request.Request {\n\treq := c.NewRequest(op, params, data)\n\n\treturn req\n}", "title": "" }, { "docid": "bc65467a731d0520f18586b51c9eaa86", "score": "0.6611908", "text": "func (c *InputService4ProtocolTest) newRequest(op *request.Operation, params, data interface{}) *request.Request {\n\treq := c.NewRequest(op, params, data)\n\n\treturn req\n}", "title": "" }, { "docid": "bc65467a731d0520f18586b51c9eaa86", "score": "0.6611908", "text": "func (c *InputService4ProtocolTest) newRequest(op *request.Operation, params, data interface{}) *request.Request {\n\treq := c.NewRequest(op, params, data)\n\n\treturn req\n}", "title": "" }, { "docid": "a84a808a0b94291e95209a9ea351a150", "score": "0.660301", "text": "func (c *InputService17ProtocolTest) newRequest(op *request.Operation, params, data interface{}) *request.Request {\n\treq := c.NewRequest(op, params, data)\n\n\treturn req\n}", "title": "" }, { "docid": "2b82f233e3d8f31db7418131bde62cd7", "score": "0.65881413", "text": "func (c *DataPipeline) newRequest(op *request.Operation, params, data interface{}) *request.Request {\n\treq := c.NewRequest(op, params, data)\n\n\t// Run custom request initialization if present\n\tif initRequest != nil {\n\t\tinitRequest(req)\n\t}\n\n\treturn req\n}", "title": "" }, { "docid": "688c35b18b973f0b5536dd82de8409df", "score": "0.6574008", "text": "func (c *InputService8ProtocolTest) newRequest(op *aws.Operation, params, data interface{}) *aws.Request {\n\treq := aws.NewRequest(c.Service, op, params, data)\n\n\treturn req\n}", "title": "" }, { "docid": "03ac67b0a6dd4edb0da1da6f3318acec", "score": "0.6546312", "text": "func (c *InputService8ProtocolTest) newRequest(op *request.Operation, params, data interface{}) *request.Request {\n\treq := c.NewRequest(op, params, data)\n\n\treturn req\n}", "title": "" }, { "docid": "03ac67b0a6dd4edb0da1da6f3318acec", "score": "0.6546312", "text": "func (c *InputService8ProtocolTest) newRequest(op *request.Operation, params, data interface{}) *request.Request {\n\treq := c.NewRequest(op, params, data)\n\n\treturn req\n}", "title": "" }, { "docid": "38c6659a545ef17d6c4a1a6d75fdb6b4", "score": "0.6527839", "text": "func (c *InputService12ProtocolTest) newRequest(op *request.Operation, params, data interface{}) *request.Request {\n\treq := c.NewRequest(op, params, data)\n\n\treturn req\n}", "title": "" }, { "docid": "38c6659a545ef17d6c4a1a6d75fdb6b4", "score": "0.6527839", "text": "func (c *InputService12ProtocolTest) newRequest(op *request.Operation, params, data interface{}) *request.Request {\n\treq := c.NewRequest(op, params, data)\n\n\treturn req\n}", "title": "" }, { "docid": "9e731c5ed694a8110e631bf25819a72f", "score": "0.65155554", "text": "func (c *InputService7ProtocolTest) newRequest(op *aws.Operation, params, data interface{}) *aws.Request {\n\treq := aws.NewRequest(c.Service, op, params, data)\n\n\treturn req\n}", "title": "" }, { "docid": "20904a58492efa46d3886eee1bcb19eb", "score": "0.6513822", "text": "func (c *InputService14ProtocolTest) newRequest(op *request.Operation, params, data interface{}) *request.Request {\n\treq := c.NewRequest(op, params, data)\n\n\treturn req\n}", "title": "" }, { "docid": "20904a58492efa46d3886eee1bcb19eb", "score": "0.6513822", "text": "func (c *InputService14ProtocolTest) newRequest(op *request.Operation, params, data interface{}) *request.Request {\n\treq := c.NewRequest(op, params, data)\n\n\treturn req\n}", "title": "" }, { "docid": "9cdb31360cf1ba7c6fd4dc95c46463d2", "score": "0.65091884", "text": "func (c *InputService2ProtocolTest) newRequest(op *aws.Operation, params, data interface{}) *aws.Request {\n\treq := aws.NewRequest(c.Service, op, params, data)\n\n\treturn req\n}", "title": "" }, { "docid": "6769ab56be9d773701ae9ebb9e0dc618", "score": "0.65062714", "text": "func (c *InputService6ProtocolTest) newRequest(op *aws.Operation, params, data interface{}) *aws.Request {\n\treq := aws.NewRequest(c.Service, op, params, data)\n\n\treturn req\n}", "title": "" }, { "docid": "a3cd86fe981988a24240e7206cbb206a", "score": "0.64952904", "text": "func (c *InputService18ProtocolTest) newRequest(op *request.Operation, params, data interface{}) *request.Request {\n\treq := c.NewRequest(op, params, data)\n\n\treturn req\n}", "title": "" }, { "docid": "b15bbdcde11503e7a87962bbe8f72ac7", "score": "0.64806813", "text": "func (c *InputService15ProtocolTest) newRequest(op *request.Operation, params, data interface{}) *request.Request {\n\treq := c.NewRequest(op, params, data)\n\n\treturn req\n}", "title": "" }, { "docid": "b15bbdcde11503e7a87962bbe8f72ac7", "score": "0.64806813", "text": "func (c *InputService15ProtocolTest) newRequest(op *request.Operation, params, data interface{}) *request.Request {\n\treq := c.NewRequest(op, params, data)\n\n\treturn req\n}", "title": "" }, { "docid": "66a7ec5ecbc66ff1f2c17dca7e624bc7", "score": "0.6468705", "text": "func (c *InputService2ProtocolTest) newRequest(op *request.Operation, params, data interface{}) *request.Request {\n\treq := c.NewRequest(op, params, data)\n\n\treturn req\n}", "title": "" }, { "docid": "66a7ec5ecbc66ff1f2c17dca7e624bc7", "score": "0.6468705", "text": "func (c *InputService2ProtocolTest) newRequest(op *request.Operation, params, data interface{}) *request.Request {\n\treq := c.NewRequest(op, params, data)\n\n\treturn req\n}", "title": "" }, { "docid": "af1e372f431d0bc9b2198648fc1c94cd", "score": "0.64664304", "text": "func (c *InputService9ProtocolTest) newRequest(op *request.Operation, params, data interface{}) *request.Request {\n\treq := c.NewRequest(op, params, data)\n\n\treturn req\n}", "title": "" }, { "docid": "af1e372f431d0bc9b2198648fc1c94cd", "score": "0.64664304", "text": "func (c *InputService9ProtocolTest) newRequest(op *request.Operation, params, data interface{}) *request.Request {\n\treq := c.NewRequest(op, params, data)\n\n\treturn req\n}", "title": "" }, { "docid": "ccad233ba137f04a8a161ada8974d9b0", "score": "0.64592993", "text": "func (c *InputService13ProtocolTest) newRequest(op *request.Operation, params, data interface{}) *request.Request {\n\treq := c.NewRequest(op, params, data)\n\n\treturn req\n}", "title": "" }, { "docid": "ccad233ba137f04a8a161ada8974d9b0", "score": "0.64592993", "text": "func (c *InputService13ProtocolTest) newRequest(op *request.Operation, params, data interface{}) *request.Request {\n\treq := c.NewRequest(op, params, data)\n\n\treturn req\n}", "title": "" }, { "docid": "41166de2f4848fc23640120f6d85e0c8", "score": "0.64508593", "text": "func (c *InputService11ProtocolTest) newRequest(op *request.Operation, params, data interface{}) *request.Request {\n\treq := c.NewRequest(op, params, data)\n\n\treturn req\n}", "title": "" }, { "docid": "41166de2f4848fc23640120f6d85e0c8", "score": "0.64508593", "text": "func (c *InputService11ProtocolTest) newRequest(op *request.Operation, params, data interface{}) *request.Request {\n\treq := c.NewRequest(op, params, data)\n\n\treturn req\n}", "title": "" }, { "docid": "69aebbb300391bfe3f12ce935866dee9", "score": "0.6443687", "text": "func (c *InputService3ProtocolTest) newRequest(op *aws.Operation, params, data interface{}) *aws.Request {\n\treq := aws.NewRequest(c.Service, op, params, data)\n\n\treturn req\n}", "title": "" }, { "docid": "27087697d82b91d40dca5f981237c7f9", "score": "0.6438749", "text": "func (c *InputService3ProtocolTest) newRequest(op *request.Operation, params, data interface{}) *request.Request {\n\treq := c.NewRequest(op, params, data)\n\n\treturn req\n}", "title": "" }, { "docid": "27087697d82b91d40dca5f981237c7f9", "score": "0.6438749", "text": "func (c *InputService3ProtocolTest) newRequest(op *request.Operation, params, data interface{}) *request.Request {\n\treq := c.NewRequest(op, params, data)\n\n\treturn req\n}", "title": "" }, { "docid": "702af20907e798db9172bab50fe8a7a4", "score": "0.6433328", "text": "func (c *InputService7ProtocolTest) newRequest(op *request.Operation, params, data interface{}) *request.Request {\n\treq := c.NewRequest(op, params, data)\n\n\treturn req\n}", "title": "" }, { "docid": "702af20907e798db9172bab50fe8a7a4", "score": "0.6433328", "text": "func (c *InputService7ProtocolTest) newRequest(op *request.Operation, params, data interface{}) *request.Request {\n\treq := c.NewRequest(op, params, data)\n\n\treturn req\n}", "title": "" }, { "docid": "145ad088b6aca6e5f8c531ad78515144", "score": "0.6426211", "text": "func (c *InputService6ProtocolTest) newRequest(op *request.Operation, params, data interface{}) *request.Request {\n\treq := c.NewRequest(op, params, data)\n\n\treturn req\n}", "title": "" }, { "docid": "145ad088b6aca6e5f8c531ad78515144", "score": "0.6426211", "text": "func (c *InputService6ProtocolTest) newRequest(op *request.Operation, params, data interface{}) *request.Request {\n\treq := c.NewRequest(op, params, data)\n\n\treturn req\n}", "title": "" }, { "docid": "5baee392869957e56d8a2c8d797df104", "score": "0.6397924", "text": "func (c *InputService19ProtocolTest) newRequest(op *request.Operation, params, data interface{}) *request.Request {\n\treq := c.NewRequest(op, params, data)\n\n\treturn req\n}", "title": "" }, { "docid": "200927996b123025f369229416a3b685", "score": "0.6395247", "text": "func (c *InputService10ProtocolTest) newRequest(op *request.Operation, params, data interface{}) *request.Request {\n\treq := c.NewRequest(op, params, data)\n\n\treturn req\n}", "title": "" }, { "docid": "200927996b123025f369229416a3b685", "score": "0.6395247", "text": "func (c *InputService10ProtocolTest) newRequest(op *request.Operation, params, data interface{}) *request.Request {\n\treq := c.NewRequest(op, params, data)\n\n\treturn req\n}", "title": "" }, { "docid": "c0b926ab41d6ad3ca2b89f933b8ef2ac", "score": "0.6383481", "text": "func (c *InputService5ProtocolTest) newRequest(op *aws.Operation, params, data interface{}) *aws.Request {\n\treq := aws.NewRequest(c.Service, op, params, data)\n\n\treturn req\n}", "title": "" }, { "docid": "351a5850a038ebb79e92dc6b7041574a", "score": "0.6340707", "text": "func (c *InputService21ProtocolTest) newRequest(op *request.Operation, params, data interface{}) *request.Request {\n\treq := c.NewRequest(op, params, data)\n\n\treturn req\n}", "title": "" }, { "docid": "9c3f665d235084d305cd79b416830308", "score": "0.6324096", "text": "func (s *ThirdPartyServicesService) newRequest(op *request.Operation, params, data interface{}) *request.Request {\n\treq := s.NewRequest(op, params, data)\n\n\treturn req\n}", "title": "" }, { "docid": "25ea9622c8fb1051bebe509839790cd2", "score": "0.6319766", "text": "func (c *InputService5ProtocolTest) newRequest(op *request.Operation, params, data interface{}) *request.Request {\n\treq := c.NewRequest(op, params, data)\n\n\treturn req\n}", "title": "" }, { "docid": "25ea9622c8fb1051bebe509839790cd2", "score": "0.6319766", "text": "func (c *InputService5ProtocolTest) newRequest(op *request.Operation, params, data interface{}) *request.Request {\n\treq := c.NewRequest(op, params, data)\n\n\treturn req\n}", "title": "" }, { "docid": "4394ee27d8e2208d78ae2ec5a9bf106d", "score": "0.6314524", "text": "func (c *InputService20ProtocolTest) newRequest(op *request.Operation, params, data interface{}) *request.Request {\n\treq := c.NewRequest(op, params, data)\n\n\treturn req\n}", "title": "" }, { "docid": "203a4e148c6fff942ed00c1a5e99e65f", "score": "0.6234995", "text": "func (s *AcmeService) newRequest(op *request.Operation, params, data interface{}) *request.Request {\n\treq := s.NewRequest(op, params, data)\n\n\treturn req\n}", "title": "" }, { "docid": "f1f7602c80c4b07f72645740f0ed4c6b", "score": "0.6143161", "text": "func (t binary) NewRequest(urlString string, data interface{}, context EventContext) (*http.Request, error) {\n\turl, err := url.Parse(urlString)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\th := http.Header{}\n\terr = t.ToHeaders(&context, h)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tb, err := marshalEventData(context.ContentType, data)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn &http.Request{\n\t\tMethod: http.MethodPost,\n\t\tURL: url,\n\t\tHeader: h,\n\t\tBody: ioutil.NopCloser(bytes.NewReader(b)),\n\t}, nil\n}", "title": "" }, { "docid": "2400e0b5375cc08902113d70991ba06c", "score": "0.6131763", "text": "func (c *CodePipeline) newRequest(op *request.Operation, params, data interface{}) *request.Request {\n\treq := c.NewRequest(op, params, data)\n\n\t// Run custom request initialization if present\n\tif initRequest != nil {\n\t\tinitRequest(req)\n\t}\n\n\treturn req\n}", "title": "" }, { "docid": "9c0a2ff1be9bf6d7be235e3680cab89e", "score": "0.6111295", "text": "func (c *Client) NewRequest(operation *Operation, input interface{}, data interface{}) *Request {\n c.GetLogger().Debug(\"client: NewRequest() executing\")\n return NewRequest(c.GetConfig(), c.GetMiddleware(), operation, input, data)\n}", "title": "" }, { "docid": "76e1a5e92c9f41a094d82323168227f2", "score": "0.60301787", "text": "func (s *Sock) StreamRequest(op string) (*StreamRequest, chan Response) {\n reschan := make(chan Response)\n id := s.allocResChan(reschan)\n return &StreamRequest{sock:s, op:op, id:id}, reschan\n}", "title": "" }, { "docid": "f8a0dbc44f5cfbb467f4d3ab7956843f", "score": "0.5938285", "text": "func (s *EngineListenersService) newRequest(op *request.Operation, params, data interface{}) *request.Request {\n\treq := s.NewRequest(op, params, data)\n\n\treturn req\n}", "title": "" }, { "docid": "2a8e18d69ae2dad2dab3c227f396dcc7", "score": "0.5895997", "text": "func newRequest(ctx context.Context, url string, reqBody io.Reader, contentType string) (*http.Request, error) {\n\treq, err := http.NewRequest(\"POST\", url, reqBody)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treq = req.WithContext(ctx)\n\tif customHeader := getCustomHTTPReqHeaders(ctx); customHeader != nil {\n\t\treq.Header = customHeader\n\t}\n\treq.Header.Set(\"Content-Type\", contentType)\n\treq.Header.Set(\"Twirp-Version\", \"v5.0.0\")\n\treturn req, nil\n}", "title": "" }, { "docid": "b7daedcee94a2f536b11db620f7a5e00", "score": "0.5873662", "text": "func (s *AdminConfigService) newRequest(op *request.Operation, params, data interface{}) *request.Request {\n\treq := s.NewRequest(op, params, data)\n\n\treturn req\n}", "title": "" }, { "docid": "4f10eaac8f11c0a3ce0065b0af8a48a0", "score": "0.58217746", "text": "func (c *IAM) newRequest(op *request.Operation, params, data interface{}) *request.Request {\n\treq := c.NewRequest(op, params, data)\n\n\t// Run custom request initialization if present\n\tif initRequest != nil {\n\t\tinitRequest(req)\n\t}\n\n\treturn req\n}", "title": "" }, { "docid": "afc743ad7724c8eda9aafe271c9b5f21", "score": "0.5790885", "text": "func NewRequest(urlString string, data interface{}, context EventContext) (*http.Request, error) {\n\treturn Structured.NewRequest(urlString, data, context)\n}", "title": "" }, { "docid": "8244008f1e29e2947233a2680fac3766", "score": "0.57903695", "text": "func newRequest(ctx context.Context, url string, reqBody io.Reader, contentType string) (*http.Request, error) {\n\treq, err := http.NewRequest(\"POST\", url, reqBody)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treq = req.WithContext(ctx)\n\tif customHeader := getCustomHTTPReqHeaders(ctx); customHeader != nil {\n\t\treq.Header = customHeader\n\t}\n\treq.Header.Set(\"Accept\", contentType)\n\treq.Header.Set(\"Content-Type\", contentType)\n\treq.Header.Set(\"Twirp-Version\", \"v8.1.0\")\n\treturn req, nil\n}", "title": "" }, { "docid": "574ae6f9e32f1941a0e34b43bfe863f9", "score": "0.5790106", "text": "func (m *RequestDataStream) Pack() []byte {\n\tdata := new(bytes.Buffer)\n\tbinary.Write(data, binary.LittleEndian, m.REQ_MESSAGE_RATE)\n\tbinary.Write(data, binary.LittleEndian, m.TARGET_SYSTEM)\n\tbinary.Write(data, binary.LittleEndian, m.TARGET_COMPONENT)\n\tbinary.Write(data, binary.LittleEndian, m.REQ_STREAM_ID)\n\tbinary.Write(data, binary.LittleEndian, m.START_STOP)\n\treturn data.Bytes()\n}", "title": "" }, { "docid": "e23f9d198e94b9bd97e027e458e3ccd8", "score": "0.5783592", "text": "func newRequest(ctx context.Context, url string, reqBody io.Reader, contentType string) (*http.Request, error) {\n\treq, err := http.NewRequest(\"POST\", url, reqBody)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treq = req.WithContext(ctx)\n\tif customHeader := getCustomHTTPReqHeaders(ctx); customHeader != nil {\n\t\treq.Header = customHeader\n\t}\n\treq.Header.Set(\"Accept\", contentType)\n\treq.Header.Set(\"Content-Type\", contentType)\n\treq.Header.Set(\"Twirp-Version\", \"v7.1.1\")\n\treturn req, nil\n}", "title": "" }, { "docid": "79cacbbe68c6568d22daa443eeb13f0a", "score": "0.57832974", "text": "func newfileUploadRequest(params map[string]string, paths []string) (*http.Request, error) {\n\tr, w := io.Pipe()\n\twriter := multipart.NewWriter(w)\n\tgo streamingUploadFile(params, paths, w, writer)\n\n\treq, reqerr := http.NewRequest(\"POST\", Config.Client.Url, r)\n\treq.Header.Add(\"Content-Type\", writer.FormDataContentType())\n\treturn req, reqerr\n}", "title": "" }, { "docid": "df06913ff476607b244c5c5da53e434a", "score": "0.57757574", "text": "func newRequest(ctx context.Context, url string, reqBody io.Reader, contentType string) (*http.Request, error) {\n\treq, err := http.NewRequest(\"POST\", url, reqBody)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treq = req.WithContext(ctx)\n\tif customHeader := getCustomHTTPReqHeaders(ctx); customHeader != nil {\n\t\treq.Header = customHeader\n\t}\n\treq.Header.Set(\"Accept\", contentType)\n\treq.Header.Set(\"Content-Type\", contentType)\n\treq.Header.Set(\"Twirp-Version\", \"v7.1.0\")\n\treturn req, nil\n}", "title": "" }, { "docid": "eb4a2bd74779edb524091fe92c134b14", "score": "0.57559425", "text": "func newRequest(ctx context.Context, url string, reqBody io.Reader, contentType string) (*http.Request, error) {\n\treq, err := http.NewRequest(\"POST\", url, reqBody)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treq = req.WithContext(ctx)\n\tif customHeader := getCustomHTTPReqHeaders(ctx); customHeader != nil {\n\t\treq.Header = customHeader\n\t}\n\treq.Header.Set(\"Accept\", contentType)\n\treq.Header.Set(\"Content-Type\", contentType)\n\treq.Header.Set(\"Twirp-Version\", \"v5.12.1\")\n\treturn req, nil\n}", "title": "" }, { "docid": "563891ab80256e9e937a0b17ec0dc66f", "score": "0.5748143", "text": "func newRequest(ctx context.Context, url string, reqBody io.Reader, contentType string) (*http.Request, error) {\n\treq, err := http.NewRequest(\"POST\", url, reqBody)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treq = req.WithContext(ctx)\n\tif customHeader := getCustomHTTPReqHeaders(ctx); customHeader != nil {\n\t\treq.Header = customHeader\n\t}\n\treq.Header.Set(\"Accept\", contentType)\n\treq.Header.Set(\"Content-Type\", contentType)\n\treq.Header.Set(\"Twirp-Version\", \"v5.10.0\")\n\treturn req, nil\n}", "title": "" }, { "docid": "5c84f5d87e5571850cc7c0948e8a33af", "score": "0.5674336", "text": "func NewFrameRequestStream(id uint32, n uint32, data, metadata []byte, flags ...FrameFlag) *FrameRequestStream {\n\tfg := newFlags(flags...)\n\tbf := common.NewByteBuff()\n\tvar b4 [4]byte\n\tbinary.BigEndian.PutUint32(b4[:], n)\n\tif _, err := bf.Write(b4[:]); err != nil {\n\t\tpanic(err)\n\t}\n\tif len(metadata) > 0 {\n\t\tfg |= FlagMetadata\n\t\tif err := bf.WriteUint24(len(metadata)); err != nil {\n\t\t\tpanic(err)\n\t\t}\n\t\tif _, err := bf.Write(metadata); err != nil {\n\t\t\tpanic(err)\n\t\t}\n\t}\n\tif len(data) > 0 {\n\t\tif _, err := bf.Write(data); err != nil {\n\t\t\tpanic(err)\n\t\t}\n\t}\n\treturn &FrameRequestStream{\n\t\tNewBaseFrame(NewFrameHeader(id, FrameTypeRequestStream, fg), bf),\n\t}\n}", "title": "" }, { "docid": "6bea318726daa2bb4388b0a316c13a97", "score": "0.5657518", "text": "func NewRequest(reqLine *RequestLine, h Header, data []byte, b bool) *Request {\n\tr := &Request{\n\t\trequestLine: reqLine,\n\t\theaders: h.Clone(),\n\t\tcookies: nil,\n\t\tdata: data,\n\t\traw: nil,\n\t\tautoCompleteHeaders: b,\n\t}\n\treturn r\n}", "title": "" }, { "docid": "652c02a8ee51c6f96b3b9abd2170d333", "score": "0.5655674", "text": "func NewRequest(data string, low uint64, up uint64) *Message {\n\treturn &Message{\n\t\tType: Request,\n\t\tData: data,\n\t\tLower: low,\n\t\tUpper: up}\n\n}", "title": "" }, { "docid": "74ea5959e9bebdaf14c90938f6e7b05f", "score": "0.5655262", "text": "func (c *Client) newRequest(ctx context.Context, method string, subPath string, body io.Reader) (*http.Request, error) {\n\tendpointURL := *c.BaseURL\n\tendpointURL.Path = path.Join(c.BaseURL.Path, subPath)\n\n\treq, err := http.NewRequest(method, endpointURL.String(), body)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"failed to build HTTP request: err = %s, method = %s, endpointURL = %s, body = %#v\", err, method, endpointURL.String(), body)\n\t}\n\n\treq = req.WithContext(ctx)\n\n\treq.Header.Set(\"Content-Type\", \"application/json\")\n\n\treturn req, nil\n}", "title": "" }, { "docid": "7fdf2bba2ae90117da8daa1708269eba", "score": "0.5618571", "text": "func NewRequest() *Request {\n\treq := &Request{\n\t\tfinished: false,\n\t\tBody: make([]byte, 0),\n\t\tHeader: make(map[string]string),\n\t\tParams: make(map[string]string),\n\t}\n\treturn req\n}", "title": "" }, { "docid": "76812103624267fafdda39a7423ea8ae", "score": "0.55960417", "text": "func AlexaNewRequest(body io.ReadCloser) (*AlexaRequest, error) {\n\trBody, err := ioutil.ReadAll(body)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\talexa := new(AlexaRequest)\n\terr = json.Unmarshal(rBody, alexa)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn alexa, nil\n}", "title": "" }, { "docid": "9b89a40bb60157e016c191a2d7a32be2", "score": "0.55647147", "text": "func (d *Doc) NewRequest(method, path string, body io.Reader) *Element {\n\tr := must.NewRequest(method, path, body)\n\treturn d.Use(r)\n}", "title": "" }, { "docid": "6f468100c6408cd8ffdb268b29b8c5c4", "score": "0.5541372", "text": "func (c *httpClient) newRequest(payload *api.Payload) (*http.Request, error) {\n\tif c.token == \"\" {\n\t\treturn nil, errors.New(\"empty token\")\n\t}\n\n\tdata, err := json.Marshal(payload)\n\tif err != nil {\n\t\treturn nil, errors.Wrap(err, \"failed to encode payload\")\n\t}\n\n\treq, err := http.NewRequest(http.MethodPost, c.endpoint, bytes.NewReader(data))\n\tif err != nil {\n\t\treturn nil, errors.Wrap(err, \"failed to create new POST request\")\n\t}\n\n\treq.Header.Set(\"Content-Type\", \"application/json\")\n\treq.Header.Set(\"User-Agent\", UserAgent)\n\n\treturn req, nil\n}", "title": "" }, { "docid": "f665a5a7d81b9e37f6df2daadeca20ea", "score": "0.5539423", "text": "func NewRequest(data string, lower, upper uint64) *Message {\r\n\treturn &Message{\r\n\t\tType: Request,\r\n\t\tData: data,\r\n\t\tLower: lower,\r\n\t\tUpper: upper,\r\n\t}\r\n}", "title": "" }, { "docid": "6772de6f7432170cdfe32717f7210b0b", "score": "0.5529713", "text": "func NewRequest(requestType string) Request {\n\treturn Request{RequestId: uuid.NewString(), Type: requestType}\n}", "title": "" }, { "docid": "344cd7e374653904dc0c6e1facf3d5c8", "score": "0.55206245", "text": "func newRequest() *asanaRequest {\n\treturn &asanaRequest{\n\t\tpNames: make([]string, 0, maxParam),\n\t\tpValues: make([]string, 0, maxParam),\n\t\tdata: make(map[interface{}]interface{}),\n\t}\n}", "title": "" }, { "docid": "4d6930a444219cf7304102e32eadf906", "score": "0.5515418", "text": "func newRequest(ctx context.Context, absUrl, contentType string, payload io.Reader) (*http.Request, error) {\n\treq, err := http.NewRequest(\"POST\", absUrl, payload)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treq = req.WithContext(ctx)\n\treq.Header.Set(\"X-Gogo-Version\", \"v1.0.0\")\n\treq.Header.Set(\"Content-Type\", contentType)\n\treq.Header.Set(\"Accept\", contentType)\n\n\treturn req, nil\n}", "title": "" }, { "docid": "6145e33e92a74da984055ea20f2d8280", "score": "0.5512128", "text": "func (c *ECR) newRequest(op *request.Operation, params, data interface{}) *request.Request {\n\treq := c.NewRequest(op, params, data)\n\n\t// Run custom request initialization if present\n\tif initRequest != nil {\n\t\tinitRequest(req)\n\t}\n\n\treturn req\n}", "title": "" }, { "docid": "c9dafbd864e31a721f01fa1e9160a4da", "score": "0.55016464", "text": "func MustNewRequest(method, urlStr string, body io.Reader) *http.Request {\n\trequest, err := http.NewRequest(method, urlStr, body)\n\tif err != nil {\n\t\tpanic(fmt.Sprintf(\"failed to create HTTP %s Request for '%s': %s\", method, urlStr, err))\n\t}\n\treturn request\n}", "title": "" }, { "docid": "3e0b1c718820af19267a3dd59a04ada3", "score": "0.5498956", "text": "func NewRequest(t testing.TB, method, url string, body io.Reader) *http.Request {\n\treq, err := http.NewRequest(method, url, body)\n\tif err != nil {\n\t\tt.Fatalf(\"Bug in test: cannot construct http.Request from method=%q, url=%q, body=%#v: %s\", method, url, body, err)\n\t}\n\treturn req\n}", "title": "" }, { "docid": "1bb5f3fd6218e4af238f003d57cd772d", "score": "0.54984313", "text": "func NewRequest(method, url string, body io.Reader, timeoutSecond int) (req *Request, err error) {\n\trequest, err := http.NewRequest(method, url, nil)\n\tif err != nil {\n\t\treturn\n\t}\n\ttimeout := time.Duration(timeoutSecond) * time.Second\n\treq = &Request{\n\t\tRequest: request,\n\t\tTimeout: timeout,\n\t\tGzip: false,\n\t}\n\treturn\n}", "title": "" }, { "docid": "0ba67158df51d26ce1ae3a86df1f4efe", "score": "0.5495198", "text": "func (c *Client) newRequest(method, path string, params url.Values, payload io.Reader) (*http.Request, error) {\n\turl := c.getURL(path, params)\n\treq, err := http.NewRequest(method, url.String(), payload)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treq.Header.Set(\"Accept\", \"application/json\")\n\treq.Header.Set(\"User-Agent\", c.UserAgent)\n\treturn req, nil\n}", "title": "" }, { "docid": "0f27d75d22a92211576e54c5389bb6ad", "score": "0.54934937", "text": "func createNewRequest(t *testing.T, method string, path string, body io.Reader) *http.Request {\n\trequest, err := http.NewRequest(method, path, body)\n\tassert.Nil(t, err)\n\treturn request\n}", "title": "" }, { "docid": "0f27d75d22a92211576e54c5389bb6ad", "score": "0.54934937", "text": "func createNewRequest(t *testing.T, method string, path string, body io.Reader) *http.Request {\n\trequest, err := http.NewRequest(method, path, body)\n\tassert.Nil(t, err)\n\treturn request\n}", "title": "" }, { "docid": "8667a50cb8a72e45630d81eda1ca9da5", "score": "0.5493047", "text": "func NewRequest() *Request {\n\tr := Request{\n\t\tContext: context.Background(),\n\t\tReply: true,\n\t\tmiddlewares: []ClientMiddlewareFunc{},\n\t\tPublishing: amqp.Publishing{\n\t\t\tContentType: \"text/plain\",\n\t\t\tHeaders: amqp.Table{},\n\t\t},\n\t}\n\n\treturn &r\n}", "title": "" }, { "docid": "7c6ac409fe71ca18315a60ee7a163b4f", "score": "0.5476273", "text": "func (c *Client) newRequest(r *Request) (*http.Request, error) {\n\n\turi := url.URL{\n\t\tScheme: \"http\",\n\t\tHost: c.Address,\n\t\tPath: r.Path,\n\t\t//RawQuery: params.Encode\n\t}\n\turi.RawQuery = r.Values.Encode()\n\t//url.Query you can set parameters\n\treq, err := http.NewRequest(r.Method, uri.RequestURI(), r.Body)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treq.URL.Scheme = uri.Scheme\n\treq.URL.Host = uri.Host\n\treq.Host = uri.Host\n\n\treq.Header.Set(\"X-Envoy-Token\", c.Token)\n\treturn req, nil\n}", "title": "" }, { "docid": "2fa4b629c7800426ec9d6aaee080753d", "score": "0.545609", "text": "func NewRequest(method string, urlStr string, body io.Reader) (*http.Request, error) {\n\trequest, err := http.NewRequest(method, urlStr, body)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\trequest.Header.Set(\"Content-Type\", jsh.ContentType)\n\trequest.Header.Set(\"Content-Length\", strconv.Itoa(int(request.ContentLength)))\n\n\treturn request, err\n}", "title": "" }, { "docid": "3d2ef3a53f8f4cdd45ed8fab66d0bbd2", "score": "0.541757", "text": "func (c *Client) NewRequest(data RequestData) (*http.Request, error) {\n\tif len(data.Placements) == 0 {\n\t\treturn nil, ErrNoPlacements\n\t}\n\tfor _, p := range data.Placements {\n\t\tif p.NetworkID == 0 {\n\t\t\treturn nil, ErrMissingNetworkID\n\t\t}\n\t\tif p.SiteID == 0 {\n\t\t\treturn nil, ErrMissingSiteID\n\t\t}\n\t\tif len(p.AdTypes) == 0 {\n\t\t\treturn nil, ErrMissingAdTypes\n\t\t}\n\t\tif p.DivName == \"\" {\n\t\t\treturn nil, ErrMissingDivName\n\t\t}\n\t}\n\tvar buf io.ReadWriter\n\tbody := Request{\n\t\tEnableBotFiltering: data.EnableBotFiltering,\n\t\tIncludePricingData: data.IncludePricingData,\n\t\tIsMobile: data.IsMobile,\n\t\tNoTrack: data.NoTrack,\n\t\tIP: data.IP,\n\t\tReferrer: data.Referrer,\n\t\tURL: data.URL,\n\t\tTime: time.Now().Unix(),\n\t\tKeywords: data.Keywords,\n\t\tUser: User{\n\t\t\tKey: data.UserID,\n\t\t},\n\t\tPlacements: data.Placements,\n\t\tBlockedCreatives: data.BlockedCreatives,\n\t}\n\n\tbuf = new(bytes.Buffer)\n\terr := json.NewEncoder(buf).Encode(body)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treq, err := http.NewRequest(\"POST\", c.URL, buf)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treq.Header.Set(\"Content-Type\", \"application/json\")\n\n\treturn req, nil\n}", "title": "" }, { "docid": "a96f45f7b473988f2e32432f9bf9e052", "score": "0.5407922", "text": "func (c *Conn) newRequest(method, urlStr string, body io.Reader) (*http.Request, error) {\n\tc.log.Debugf(\"%s: %s\", method, urlStr)\n\treq, err := http.NewRequest(method, urlStr, body)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treq.Header.Set(\"User-Agent\", \"go-sechat (https://qms.li/gsc)\")\n\treturn req, nil\n}", "title": "" }, { "docid": "ed7e27f2b35bac9939e397db581208b1", "score": "0.540747", "text": "func (*RequestDataStream) Id() uint8 {\n\treturn 66\n}", "title": "" }, { "docid": "a53be9b43f184727d5e64280b2daeac7", "score": "0.5404178", "text": "func NewRequestReader(c *http.Client, r *http.Request, maxfail uint32, totalsize int64) io.ReadCloser {\n\treturn &requestReader{client: c, request: r, maxFailures: maxfail, totalSize: totalsize, waitDuration: 5 * time.Second}\n}", "title": "" }, { "docid": "cbf9e8e5620bd53ca23aaf2f6ecd3164", "score": "0.53907984", "text": "func newRequest(method string, params interface{}, id uint64) (req *request, err error) {\n\tdata, err := json.Marshal(params)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\trawMsg := json.RawMessage(data)\n\tr := &request{method, &rawMsg, id}\n\treturn r, err\n}", "title": "" }, { "docid": "8a54512ac8137e7d24541ad7d160ccb5", "score": "0.5382918", "text": "func NewRequest(method, url string, body io.Reader) (*Request, error) {\n\treq, err := http.NewRequest(method, url, body)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treq.Header.Add(\"User-Agent\", \"DorisLoader/\"+Version+\" (\"+runtime.GOOS+\"-\"+runtime.GOARCH+\")\")\n\treturn (*Request)(req), nil\n}", "title": "" }, { "docid": "df8dad9301e572e4c7ebd8736ee78625", "score": "0.538034", "text": "func (preFlight *PreFlight) newRequest() (*http.Request, error) {\n\treq, err := http.NewRequest(http.MethodOptions, preFlight.target, nil)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treq.Header.Add(\"Origin\", preFlight.origin)\n\treq.Header.Add(\"Access-Control-Request-Method\", preFlight.method)\n\n\theaders := strings.Join(preFlight.header, \",\")\n\treq.Header.Add(\"Access-Control-Request-Headers\", headers)\n\n\treturn req, err\n}", "title": "" }, { "docid": "c9dca3c104ea46b40fde3a787b60fcd2", "score": "0.535193", "text": "func newReadBarrierRequest() net.Request {\n\treturn net.NewEmptyRequest(metaReadBarrier)\n}", "title": "" }, { "docid": "3e4ea9103916d1d1d2147861e6675c8b", "score": "0.53511643", "text": "func MustNewRequest(method, urlStr string, body io.Reader) *http.Request {\n\tr, err := http.NewRequest(method, urlStr, body)\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\treturn r\n}", "title": "" }, { "docid": "d3e79c6dd7fbbbd58882e6a577e3e3e6", "score": "0.5348035", "text": "func (c *Client) NewRequest(operation *request.Operation, params map[string]string, data interface{}) *request.Request {\n\treturn request.New(c.Config, operation, params, data)\n}", "title": "" }, { "docid": "55cf0d852092dd8568bef696c32743d1", "score": "0.5344053", "text": "func NewRequest(method, url string, body io.Reader) (*http.Request, error) {\n\treturn http.NewRequest(method, dcy.URL(url), body)\n}", "title": "" }, { "docid": "12d6a3fcd6cd8ea839387617a855e7f8", "score": "0.53399014", "text": "func NewRequest() *Request {\n\treturn &Request{\n\t\tClaims: make(map[string]interface{}),\n\t\tMetadata: make(map[string]interface{}),\n\t}\n}", "title": "" }, { "docid": "253fd570268c930f33dc4a3348aa9b46", "score": "0.5337136", "text": "func (ep *OCITransportMethod) NewRequest(opType SyncOpType, objname, objloc string, sizelimit int64, ackback bool, reply chan *DronaRequest) *DronaRequest {\n\tdR := &DronaRequest{}\n\tdR.syncEp = ep\n\tdR.operation = opType\n\tdR.name = objname\n\tdR.ackback = ackback\n\n\t// FIXME:...we need this later\n\tdR.localName = objname\n\tdR.objloc = objloc\n\n\t// limit for this download\n\tdR.sizelimit = sizelimit\n\tdR.result = reply\n\n\treturn dR\n}", "title": "" } ]
789f6ae04afe9e4294f4d31afc0fce73
CheckExists checks whether the given `path` exists
[ { "docid": "a60241dfa66cf753b62260795b87e918", "score": "0.7374624", "text": "func CheckExists(path string) (bool, error) {\r\n\tif _, err := os.Stat(path); err == nil {\r\n\t\treturn true, nil\r\n\t} else if os.IsNotExist(err) {\r\n\t\treturn false, nil\r\n\t} else {\r\n\t\treturn false, err\r\n\t}\r\n}", "title": "" } ]
[ { "docid": "39d3778c5bb9ef27e202e8c22c34c45e", "score": "0.78380597", "text": "func pathExists(path string) bool {\n\tif _, err := os.Stat(path); os.IsNotExist(err) {\n\t\treturn false\n\t}\n\treturn true\n}", "title": "" }, { "docid": "a61a5910ca944b3618798bd3d39e9c63", "score": "0.78304964", "text": "func pathExists(path string) bool {\n\t_, err := os.Stat(path)\n\tif os.IsNotExist(err) {\n\t\treturn false\n\t}\n\treturn true\n}", "title": "" }, { "docid": "2b9552c23e029d6f18198053aad942d0", "score": "0.78215146", "text": "func pathExists(path string) bool {\n\t_, err := os.Stat(path)\n\treturn !os.IsNotExist(err)\n}", "title": "" }, { "docid": "1a22d8575d304426ff7e06f75af8332e", "score": "0.78180057", "text": "func pathExists(path string) (bool, error) {\n\t_, err := os.Stat(path)\n\tif err == nil {\n\t\treturn true, nil\n\t}\n\tif os.IsNotExist(err) {\n\t\treturn false, nil\n\t}\n\treturn true, err\n}", "title": "" }, { "docid": "130805f35f878f6f0bfdf234bf93e345", "score": "0.77963173", "text": "func pathExists(path string) (bool, error) {\n\t_, err := os.Stat(path)\n\tif err == nil {\n\t\treturn true, nil\n\t}\n\tif os.IsNotExist(err) {\n\t\treturn false, nil\n\t}\n\treturn false, err\n}", "title": "" }, { "docid": "7a90d08c63bdf4cbbc9a69735d061f75", "score": "0.77899194", "text": "func pathExists(path string) (bool, error) {\n\t_, err := os.Stat(path)\n\tif err == nil {\n\t\treturn true, nil\n\t} else if os.IsNotExist(err) {\n\t\treturn false, nil\n\t} else {\n\t\treturn false, err\n\t}\n}", "title": "" }, { "docid": "1b9d1770321ec54bc151f39ccdd882e5", "score": "0.7749454", "text": "func PathExists(path string) bool {\n\tif _, err := os.Stat(path); os.IsNotExist(err) {\n\t\treturn false\n\t}\n\treturn true\n}", "title": "" }, { "docid": "c77664b9df05ae64b92f9ecc242d8bab", "score": "0.7745443", "text": "func PathExists(path string) bool {\n\t_, err := os.Stat(path)\n\tif os.IsNotExist(err) {\n\t\treturn false\n\t}\n\n\tif err == nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "5e76b157200ef49f64becc685b282af1", "score": "0.7729253", "text": "func PathExists(path string) bool {\n\tif path == \"\" {\n\t\treturn false\n\t}\n\n\tif _, err := os.Stat(path); err != nil {\n\t\tif os.IsNotExist(err) {\n\t\t\treturn false\n\t\t}\n\t}\n\treturn true\n}", "title": "" }, { "docid": "45abb9f1a1816f5d3f23fae6f5ae17db", "score": "0.77217454", "text": "func PathExists(path string) (bool, error) {\n\t_, err := os.Stat(path)\n\tif err == nil {\n\t\treturn true, nil\n\t} else if os.IsNotExist(err) {\n\t\treturn false, nil\n\t} else if IsCorruptedMnt(err) {\n\t\treturn true, err\n\t} else {\n\t\treturn false, err\n\t}\n}", "title": "" }, { "docid": "216c142aec823e18c6fdb310f3d4335b", "score": "0.7706657", "text": "func PathExists(path string) bool {\n\t_, err := os.Stat(path)\n\tif err == nil {\n\t\treturn true\n\t}\n\treturn false\n}", "title": "" }, { "docid": "ddeb2c75d85e156672a9182d9d5bc69b", "score": "0.76988554", "text": "func PathExists(path string) (bool, error) {\n\t_, err := os.Stat(path)\n\tif os.IsNotExist(err) {\n\t\treturn false, nil\n\t}\n\n\tif err != nil {\n\t\treturn false, err\n\t}\n\n\treturn true, nil\n}", "title": "" }, { "docid": "239b616436e27f999ec9fc72a5e7fa26", "score": "0.7688897", "text": "func PathExists(path string) bool {\n\t_, err := os.Stat(path)\n\treturn err == nil\n}", "title": "" }, { "docid": "239b616436e27f999ec9fc72a5e7fa26", "score": "0.7688897", "text": "func PathExists(path string) bool {\n\t_, err := os.Stat(path)\n\treturn err == nil\n}", "title": "" }, { "docid": "bbeb3bad21e568034cea5a14901b4f37", "score": "0.76870716", "text": "func PathExists(path string) (bool, error) {\n\t_, err := os.Stat(path)\n\tif err == nil {\n\t\treturn true, nil\n\t}\n\tif os.IsNotExist(err) {\n\t\treturn false, nil\n\t}\n\treturn false, err\n}", "title": "" }, { "docid": "bbeb3bad21e568034cea5a14901b4f37", "score": "0.76870716", "text": "func PathExists(path string) (bool, error) {\n\t_, err := os.Stat(path)\n\tif err == nil {\n\t\treturn true, nil\n\t}\n\tif os.IsNotExist(err) {\n\t\treturn false, nil\n\t}\n\treturn false, err\n}", "title": "" }, { "docid": "8ecf695e16111fc7e17be4e69a65a996", "score": "0.7685717", "text": "func PathExists(path string) bool {\n\t_, e := os.Stat(path)\n\treturn e == nil\n\n}", "title": "" }, { "docid": "c430710288a2af87cd1ae83b1b2f3caa", "score": "0.7682176", "text": "func PathExists(path string) bool {\n\t_, err := os.Stat(path) //os.Stat获取文件信息\n\tif err != nil {\n\t\tif os.IsExist(err) {\n\t\t\treturn true\n\t\t}\n\t\treturn false\n\t}\n\treturn true\n}", "title": "" }, { "docid": "2076d16287e97020d6df210f342bc691", "score": "0.7661646", "text": "func PathExists(path string) (bool, error) {\n\t_, err := os.Stat(path)\n\tif err == nil {\n\t\treturn true, nil\n\t}\n\tif os.IsNotExist(err) {\n\t\treturn false, &PathNotFound{path}\n\t}\n\treturn false, err\n}", "title": "" }, { "docid": "06b188b1733ae51f500b47888467df49", "score": "0.76046854", "text": "func PathExists(path string) bool {\n\tinfo, err := os.Stat(path)\n\treturn !errors.Is(err, os.ErrNotExist) && info != nil\n}", "title": "" }, { "docid": "9b6adedca0f660692d36ecb55f898879", "score": "0.76025635", "text": "func pathExists(ss ...string) bool {\n\tname := filepath.Join(ss...)\n\tif _, err := os.Stat(name); err != nil {\n\t\tif os.IsNotExist(err) {\n\t\t\treturn false\n\t\t}\n\t}\n\treturn true\n}", "title": "" }, { "docid": "d5a965da7ce4954559c53ac28a57cbdc", "score": "0.7531624", "text": "func DoesPathExist(path string) bool {\n\tif _, err := os.Stat(path); os.IsNotExist(err) {\n\t\treturn false\n\t}\n\treturn true\n}", "title": "" }, { "docid": "045413733fd5234c81b902607ddf822f", "score": "0.74870723", "text": "func getPathExists(path string) bool {\n\t// We can do this by getting the stat for the path specified. If we get a NotExist error then we\n\t// know that the path is not valid.\n\t_, err := os.Stat(path)\n\n\t// Return the inverted value of IsNotExists.\n\treturn !os.IsNotExist(err)\n}", "title": "" }, { "docid": "54720ed98dcf6d67de4d74a6f8564ea2", "score": "0.7471141", "text": "func exists(path string) bool {\n\t_, err := os.Stat(path)\n\tif err == nil {\n\t\treturn true\n\t}\n\n\tif os.IsNotExist(err) {\n\t\treturn false\n\t}\n\n\tif err != nil {\n\t\tlog.Panic(\"--- ERROR \" + err.Error())\n\t}\n\n\treturn true\n}", "title": "" }, { "docid": "36d996cabbf8570195f7d7d24f7c2616", "score": "0.74549365", "text": "func exists(path string) (bool, error) {\n _, err := os.Stat(path)\n if err == nil { return true, nil }\n if os.IsNotExist(err) { return false, nil }\n return true, err\n}", "title": "" }, { "docid": "9959649dfb3394f90c5567d62713037b", "score": "0.7451631", "text": "func IsExistsPath(pa string) bool {\n\tif _, err := os.Stat(pa); err != nil {\n\t\treturn os.IsExist(err)\n\t}\n\treturn true\n}", "title": "" }, { "docid": "5824d5e573f6002574f158238b3461eb", "score": "0.7450454", "text": "func PathExists(filename string) bool {\n\n\t_, err := os.Stat(filename)\n\n\tif err != nil {\n\t\tif os.IsNotExist(err) {\n\t\t\treturn false\n\t\t}\n\t\tpanic(err)\n\t} else {\n\t\treturn true\n\t}\n\n}", "title": "" }, { "docid": "343f4f169c21fb6400eaab967d46f67e", "score": "0.744277", "text": "func exists(path string) bool {\n\tif path == \"\" {\n\t\treturn false\n\t}\n\t_, err := os.Stat(path)\n\tif err == nil {\n\t\treturn true\n\t}\n\tif !os.IsNotExist(err) {\n\t\tfmt.Println(err)\n\t}\n\treturn false\n}", "title": "" }, { "docid": "f02c85a090eea2c7dff45b97df2b3775", "score": "0.74292", "text": "func PathExists(filePath string) bool {\n\tabsolutePath, _ := filepath.Abs(filePath)\n\t_, err := os.Stat(absolutePath)\n\n\treturn err == nil\n}", "title": "" }, { "docid": "26c3199f89db6e6d683206963b70aeab", "score": "0.7418884", "text": "func IsPathExists(path string) bool {\n\tif _, err := os.Stat(path); os.IsNotExist(err) {\n\t\treturn false\n\t}\n\treturn true\n}", "title": "" }, { "docid": "a6e9a231a8365e0cf37d97cb96b63f51", "score": "0.74100965", "text": "func PathFileExists(path string) (bool, error) {\n\t_, err := os.Stat(path)\n\tif err == nil {\n\t\treturn true, nil\n\t}\n\tif os.IsNotExist(err) {\n\t\treturn false, err\n\t}\n\treturn false, err\n}", "title": "" }, { "docid": "699b15e58e84eb19eedecd35f0cff06c", "score": "0.7408098", "text": "func exists(path string) bool {\n\t_, err := os.Stat(path)\n\tif err == nil {\n\t\treturn true\n\t}\n\tif os.IsNotExist(err) {\n\t\treturn false\n\t}\n\tif err != nil {\n\t\tfmt.Println(err)\n\t}\n\treturn false\n}", "title": "" }, { "docid": "765aa8d4ac1c41884a51750991fc3412", "score": "0.73975307", "text": "func _exists(path string) bool {\n\t_, err := os.Stat(path)\n\tif err == nil {\n\t\treturn true\n\t}\n\tif os.IsNotExist(err) {\n\t\treturn false\n\t}\n\treturn false\n}", "title": "" }, { "docid": "45d05932289541deedd0a74f20cd0b01", "score": "0.7395098", "text": "func exists(path string) (bool, error) {\n\t_, err := os.Stat(path)\n\tif err == nil {\n\t\treturn true, nil\n\t}\n\tif os.IsNotExist(err) {\n\t\treturn false, nil\n\t}\n\treturn false, err\n}", "title": "" }, { "docid": "45d05932289541deedd0a74f20cd0b01", "score": "0.7393967", "text": "func exists(path string) (bool, error) {\n\t_, err := os.Stat(path)\n\tif err == nil {\n\t\treturn true, nil\n\t}\n\tif os.IsNotExist(err) {\n\t\treturn false, nil\n\t}\n\treturn false, err\n}", "title": "" }, { "docid": "45d05932289541deedd0a74f20cd0b01", "score": "0.7393967", "text": "func exists(path string) (bool, error) {\n\t_, err := os.Stat(path)\n\tif err == nil {\n\t\treturn true, nil\n\t}\n\tif os.IsNotExist(err) {\n\t\treturn false, nil\n\t}\n\treturn false, err\n}", "title": "" }, { "docid": "45d05932289541deedd0a74f20cd0b01", "score": "0.7393967", "text": "func exists(path string) (bool, error) {\n\t_, err := os.Stat(path)\n\tif err == nil {\n\t\treturn true, nil\n\t}\n\tif os.IsNotExist(err) {\n\t\treturn false, nil\n\t}\n\treturn false, err\n}", "title": "" }, { "docid": "45d05932289541deedd0a74f20cd0b01", "score": "0.7393967", "text": "func exists(path string) (bool, error) {\n\t_, err := os.Stat(path)\n\tif err == nil {\n\t\treturn true, nil\n\t}\n\tif os.IsNotExist(err) {\n\t\treturn false, nil\n\t}\n\treturn false, err\n}", "title": "" }, { "docid": "45d05932289541deedd0a74f20cd0b01", "score": "0.7393967", "text": "func exists(path string) (bool, error) {\n\t_, err := os.Stat(path)\n\tif err == nil {\n\t\treturn true, nil\n\t}\n\tif os.IsNotExist(err) {\n\t\treturn false, nil\n\t}\n\treturn false, err\n}", "title": "" }, { "docid": "45d05932289541deedd0a74f20cd0b01", "score": "0.7393967", "text": "func exists(path string) (bool, error) {\n\t_, err := os.Stat(path)\n\tif err == nil {\n\t\treturn true, nil\n\t}\n\tif os.IsNotExist(err) {\n\t\treturn false, nil\n\t}\n\treturn false, err\n}", "title": "" }, { "docid": "45d05932289541deedd0a74f20cd0b01", "score": "0.7393967", "text": "func exists(path string) (bool, error) {\n\t_, err := os.Stat(path)\n\tif err == nil {\n\t\treturn true, nil\n\t}\n\tif os.IsNotExist(err) {\n\t\treturn false, nil\n\t}\n\treturn false, err\n}", "title": "" }, { "docid": "45d05932289541deedd0a74f20cd0b01", "score": "0.7393967", "text": "func exists(path string) (bool, error) {\n\t_, err := os.Stat(path)\n\tif err == nil {\n\t\treturn true, nil\n\t}\n\tif os.IsNotExist(err) {\n\t\treturn false, nil\n\t}\n\treturn false, err\n}", "title": "" }, { "docid": "45d05932289541deedd0a74f20cd0b01", "score": "0.7393967", "text": "func exists(path string) (bool, error) {\n\t_, err := os.Stat(path)\n\tif err == nil {\n\t\treturn true, nil\n\t}\n\tif os.IsNotExist(err) {\n\t\treturn false, nil\n\t}\n\treturn false, err\n}", "title": "" }, { "docid": "049a334d093f4c34882eb499c77c3b3d", "score": "0.7393691", "text": "func exists(path string) (bool, error) {\n\t_, err := os.Stat(path)\n\tif err == nil {\n\t\treturn true, nil\n\t} else if os.IsNotExist(err) {\n\t\treturn false, nil\n\t}\n\treturn true, err\n}", "title": "" }, { "docid": "2860fc0e411b7d19e411bf0a1a2c48d1", "score": "0.73870766", "text": "func PathExist(_path string) bool {\n\t_, err := os.Stat(_path)\n\tif err != nil && os.IsNotExist(err) {\n\t\treturn false\n\t}\n\treturn true\n}", "title": "" }, { "docid": "df55c08c776b393c100fdfe2106b3067", "score": "0.73852724", "text": "func PathExist(path string) bool {\n\t_, err := os.Stat(path)\n\tif err != nil && os.IsNotExist(err) {\n\t\treturn false\n\t}\n\treturn true\n}", "title": "" }, { "docid": "835b5159aa85a5d8553f5265882efcdc", "score": "0.7385255", "text": "func exists(path string) (bool, error) {\n\t_, err := os.Stat(path)\n\tif err == nil {\n\t\treturn true, nil\n\t}\n\tif os.IsNotExist(err) {\n\t\treturn false, nil\n\t}\n\treturn true, err\n}", "title": "" }, { "docid": "835b5159aa85a5d8553f5265882efcdc", "score": "0.7385255", "text": "func exists(path string) (bool, error) {\n\t_, err := os.Stat(path)\n\tif err == nil {\n\t\treturn true, nil\n\t}\n\tif os.IsNotExist(err) {\n\t\treturn false, nil\n\t}\n\treturn true, err\n}", "title": "" }, { "docid": "835b5159aa85a5d8553f5265882efcdc", "score": "0.7385255", "text": "func exists(path string) (bool, error) {\n\t_, err := os.Stat(path)\n\tif err == nil {\n\t\treturn true, nil\n\t}\n\tif os.IsNotExist(err) {\n\t\treturn false, nil\n\t}\n\treturn true, err\n}", "title": "" }, { "docid": "835b5159aa85a5d8553f5265882efcdc", "score": "0.7385255", "text": "func exists(path string) (bool, error) {\n\t_, err := os.Stat(path)\n\tif err == nil {\n\t\treturn true, nil\n\t}\n\tif os.IsNotExist(err) {\n\t\treturn false, nil\n\t}\n\treturn true, err\n}", "title": "" }, { "docid": "835b5159aa85a5d8553f5265882efcdc", "score": "0.7385255", "text": "func exists(path string) (bool, error) {\n\t_, err := os.Stat(path)\n\tif err == nil {\n\t\treturn true, nil\n\t}\n\tif os.IsNotExist(err) {\n\t\treturn false, nil\n\t}\n\treturn true, err\n}", "title": "" }, { "docid": "835b5159aa85a5d8553f5265882efcdc", "score": "0.7385255", "text": "func exists(path string) (bool, error) {\n\t_, err := os.Stat(path)\n\tif err == nil {\n\t\treturn true, nil\n\t}\n\tif os.IsNotExist(err) {\n\t\treturn false, nil\n\t}\n\treturn true, err\n}", "title": "" }, { "docid": "835b5159aa85a5d8553f5265882efcdc", "score": "0.7385255", "text": "func exists(path string) (bool, error) {\n\t_, err := os.Stat(path)\n\tif err == nil {\n\t\treturn true, nil\n\t}\n\tif os.IsNotExist(err) {\n\t\treturn false, nil\n\t}\n\treturn true, err\n}", "title": "" }, { "docid": "11d7d4fc13c3eec2492b2745466580da", "score": "0.7381939", "text": "func exists(path string) (bool, error) {\n\t_, err := os.Stat(path)\n\n\tif err == nil {\n\t\treturn true, nil\n\t}\n\n\tif os.IsNotExist(err) {\n\t\treturn false, nil\n\t}\n\n\treturn true, err\n}", "title": "" }, { "docid": "120c7b3c33fe2541e2e3ec7edd172cef", "score": "0.7375235", "text": "func Exists(path string) bool {\n _, err := os.Stat(path)\n if err == nil { return true }\n if os.IsNotExist(err) { return false }\n return true\n}", "title": "" }, { "docid": "f38c59d6de81c21c117e7e1e8b5826d7", "score": "0.73669094", "text": "func IsPathExists(path string) bool {\n\tresult := false\n\tif _, err := os.Stat(path); err == nil {\n\t\tresult = true\n\t}\n\treturn result\n}", "title": "" }, { "docid": "5fada83e3b2bee11470e54ef75d36ba7", "score": "0.73665893", "text": "func PathExists(filePath string) bool {\n\tabsolutePath, _ := filepath.Abs(filePath)\n\t_, err := os.Stat(absolutePath)\n\n\tif err == nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "d5a711417c1229dc803c481243ff5dcb", "score": "0.7348756", "text": "func exists(path string) bool {\n\t_, err := os.Stat(path)\n\tif err == nil {\n\t\treturn true\n\t}\n\tif os.IsNotExist(err) {\n\t\treturn false\n\t}\n\treturn true\n}", "title": "" }, { "docid": "723f22759b1822ddcbc740023439b6cf", "score": "0.73415905", "text": "func exists(path string) bool {\n\t_, err := os.Stat(path)\n\treturn err == nil\n}", "title": "" }, { "docid": "723f22759b1822ddcbc740023439b6cf", "score": "0.73415905", "text": "func exists(path string) bool {\n\t_, err := os.Stat(path)\n\treturn err == nil\n}", "title": "" }, { "docid": "723f22759b1822ddcbc740023439b6cf", "score": "0.73415905", "text": "func exists(path string) bool {\n\t_, err := os.Stat(path)\n\treturn err == nil\n}", "title": "" }, { "docid": "723f22759b1822ddcbc740023439b6cf", "score": "0.73415905", "text": "func exists(path string) bool {\n\t_, err := os.Stat(path)\n\treturn err == nil\n}", "title": "" }, { "docid": "8eca641891ca99e30a133dca12a175ed", "score": "0.73369604", "text": "func (f *File) PathExists(path string) (bool, error) {\n\t_, err := os.Stat(path)\n\tif err == nil {\n\t\treturn true, nil\n\t}\n\tif os.IsNotExist(err) {\n\t\treturn false, nil\n\t}\n\treturn false, err\n}", "title": "" }, { "docid": "197efb01eaefad1a241f23c02c4f275a", "score": "0.7325789", "text": "func exists(path string) (bool, error) {\n\tif path == \"\" {\n\t\treturn false, nil\n\t}\n\n\t_, err := os.Stat(path)\n\tif err == nil {\n\t\treturn true, nil\n\t}\n\tif !os.IsNotExist(err) {\n\t\treturn false, err\n\t}\n\n\treturn false, nil\n}", "title": "" }, { "docid": "b212aae094b8be14417ee58a81176f31", "score": "0.7302342", "text": "func Exists(path string) bool {\n\t_, ok := pathToData[normalpath.Normalize(path)]\n\treturn ok\n}", "title": "" }, { "docid": "f2ef8d28085edea99ad9cc9c6da6e877", "score": "0.7294315", "text": "func exist(path string) (exist bool, err error) {\n\t_, err = os.Stat(path)\n\tif err == nil {\n\t\texist = true\n\t\treturn\n\t}\n\tif os.IsNotExist(err) {\n\t\texist = false\n\t\terr = nil\n\t\treturn\n\t}\n\treturn\n}", "title": "" }, { "docid": "15af60ae1d5275869a24ec3fc3f1e554", "score": "0.7247977", "text": "func exists(path string) (bool, error) {\n\t_, err := os.Stat(path)\n\tif err == nil {\n\t\treturn true, nil\n\t}\n\tif os.IsNotExist(err) {\n\t\treturn false, nil\n\t}\n\treturn false, berror.Wrapf(err, InvalidFileCachePath, \"file cache path is invalid: %s\", path)\n}", "title": "" }, { "docid": "fc90d835712894ae11674166fb66afbe", "score": "0.7211607", "text": "func IsExists(path string) bool {\n\t_, err := os.Stat(path)\n\tif err != nil {\n\t\treturn os.IsExist(err)\n\t}\n\treturn true\n}", "title": "" }, { "docid": "5ed8e2c0f958269792be2fd7797ff188", "score": "0.7210816", "text": "func Exists(path string) bool {\n\t_, err := os.Stat(path)\n\tif err == nil {\n\t\treturn true\n\t}\n\tif os.IsNotExist(err) {\n\t\treturn false\n\t}\n\treturn true // ignoring error\n}", "title": "" }, { "docid": "e754ea7b7ce013c4aee3e3c09f9d2e2e", "score": "0.72098523", "text": "func (i installSystemd) checkFileExists(path string) bool {\n\tfi, err := os.Stat(path)\n\treturn err == nil && !fi.IsDir()\n}", "title": "" }, { "docid": "83dcc7c2a22f63307e05ee8db374df5f", "score": "0.72059506", "text": "func Exists(path string) bool {\n\t_, err := os.Stat(path)\n\tif err != nil {\n\t\tif os.IsExist(err) {\n\t\t\treturn true\n\t\t}\n\t\treturn false\n\t}\n\treturn true\n}", "title": "" }, { "docid": "6b414a5661c40f588f4325d76b271ecd", "score": "0.718739", "text": "func IsPathExists(path string) (bool, error) {\n\t_, err := os.Stat(path)\n\tif err == nil {\n\t\treturn true, nil\n\t}\n\tif os.IsNotExist(err) {\n\t\treturn false, nil\n\t}\n\treturn true, err\n}", "title": "" }, { "docid": "61e3fe9adbeb250487a7612b20cdd3ec", "score": "0.71768796", "text": "func IsExists(path string) bool {\n\t_, err := os.Stat(path)\n\treturn err == nil\n}", "title": "" }, { "docid": "0e8be9e452ad51dec28df5393aa07759", "score": "0.7162566", "text": "func Exists(path string) bool {\n\t_, err := os.Stat(path)\n\tif err == nil {\n\t\treturn true\n\t}\n\tif os.IsNotExist(err) {\n\t\treturn false\n\t}\n\treturn true\n}", "title": "" }, { "docid": "7a4c235ec2464bd895e2927f4c0787a8", "score": "0.71610004", "text": "func Exists(path string) bool {\n\tif _, err := os.Stat(path); os.IsNotExist(err) == false {\n\t\treturn true\n\t}\n\treturn false\n}", "title": "" }, { "docid": "da546feb1a788956f3b7f666f1fbcb04", "score": "0.7151789", "text": "func Exists(path string) bool {\n\t_, err := os.Stat(path)\n\tif err == nil {\n\t\treturn true\n\t}\n\tif os.IsNotExist(err) {\n\t\treturn false\n\t}\n\treturn false\n}", "title": "" }, { "docid": "57c0d8c28ac76e6e26387a745d0879bc", "score": "0.715169", "text": "func Exists(path string) (bool) {\n\t_, err := os.Stat(path)\n\tif err == nil { return true }\n\tif os.IsNotExist(err) { return false }\n\treturn true\n}", "title": "" }, { "docid": "ab785c559134f7010cad15db601eebb2", "score": "0.7143673", "text": "func exists(fs afero.Fs, path string) (bool, error) {\n\t_, err := fs.Stat(path)\n\tif err == nil {\n\t\treturn true, nil\n\t}\n\tif os.IsNotExist(err) {\n\t\treturn false, nil\n\t}\n\treturn false, err\n}", "title": "" }, { "docid": "69074c18ff3e2bc48f19f5144c8f89d9", "score": "0.7140838", "text": "func Exists(path string) (bool, error) {\n\n\t_, err := os.Stat(path)\n\tif err == nil {\n\t\treturn true, nil\n\t}\n\tif os.IsNotExist(err) {\n\t\treturn false, nil\n\t}\n\treturn false, err\n}", "title": "" }, { "docid": "34366531b2045bf209ec33aa1a22c6f5", "score": "0.71320516", "text": "func Exists(path string) bool {\n\tif _, err := os.Stat(path); err != nil {\n\t\tif os.IsNotExist(err) {\n\t\t\treturn false\n\t\t}\n\t}\n\n\treturn true\n}", "title": "" }, { "docid": "19b73c95955be408f4fad0fc23d9a0d1", "score": "0.71240604", "text": "func IsExist(path string) bool {\n _, err := os.Stat(path)\n return err == nil || os.IsExist(err)\n}", "title": "" }, { "docid": "764643df8fe08d28293e90f62f6abaf5", "score": "0.71162736", "text": "func Exists(path string) (bool, error) {\n\tif _, err := os.Stat(path); os.IsNotExist(err) {\n\t\treturn false, err\n\t}\n\treturn true, nil\n}", "title": "" }, { "docid": "5210da79c7ce5002f788e6c959990822", "score": "0.7115818", "text": "func Exists(path string) (bool, errors.Error) {\n\treturn DefaultFileSystem.Exists(path)\n}", "title": "" }, { "docid": "7fdbc226227e4ad827d9ef70a418506c", "score": "0.7110369", "text": "func Exists(path string) (bool, error) {\n\t_, err := os.Stat(path)\n\tif err != nil {\n\t\tif os.IsNotExist(err) {\n\t\t\treturn false, nil\n\t\t}\n\t}\n\treturn true, nil\n}", "title": "" }, { "docid": "bfe66ce3109ef7a9b3fa4f63494bbb56", "score": "0.7074414", "text": "func Exists(path string) (bool, error) {\n\tif _, err := os.Stat(path); err != nil {\n\t\tif os.IsNotExist(err) {\n\t\t\treturn false, nil\n\t\t}\n\t\treturn false, err\n\t}\n\treturn true, nil\n}", "title": "" }, { "docid": "03dcedabfcb5140957d5780923b72b20", "score": "0.70729256", "text": "func FileExists(path string) bool {\n\t_, err := Root.Stat(path)\n\n\tif os.IsNotExist(err) {\n\t\treturn false\n\t}\n\n\treturn true\n}", "title": "" }, { "docid": "4540948f9c3ea9c32c7a0d77ca3b0f67", "score": "0.70719963", "text": "func Exists(path string) bool {\n\t_, err := os.Stat(path)\n\treturn !os.IsNotExist(err)\n}", "title": "" }, { "docid": "5730a7075b0a9b73c846a9529a674648", "score": "0.7060438", "text": "func Exists(absolutePath string) bool {\n _, err := os.Stat(absolutePath)\n return !os.IsNotExist(err)\n}", "title": "" }, { "docid": "0bab0ceced175d3752d0f34e96cca3bd", "score": "0.7060373", "text": "func (ge *GabsExplorer) PathExists(path string) bool {\n\tse := ge.GetPath(path)\n\treturn se.Data() != nil\n}", "title": "" }, { "docid": "4fbb21c2c64ccd30f68ece3ae3a9f0e2", "score": "0.705974", "text": "func Exists(path string) bool {\n\t_, err := os.Stat(path)\n\treturn err == nil\n}", "title": "" }, { "docid": "9aad4c906137c556c7192a6dd14c9eb0", "score": "0.7059211", "text": "func Exists(path string) (bool, error) {\n\t_, err := os.Stat(path)\n\tif err == nil {\n\t\treturn true, nil\n\t}\n\tif os.IsNotExist(err) {\n\t\treturn false, nil\n\t}\n\treturn false, err\n}", "title": "" }, { "docid": "9aad4c906137c556c7192a6dd14c9eb0", "score": "0.7059211", "text": "func Exists(path string) (bool, error) {\n\t_, err := os.Stat(path)\n\tif err == nil {\n\t\treturn true, nil\n\t}\n\tif os.IsNotExist(err) {\n\t\treturn false, nil\n\t}\n\treturn false, err\n}", "title": "" }, { "docid": "de3efbb3953ac32c065265adc3de9a30", "score": "0.7059133", "text": "func Exist(path string) bool {\n\t_, e := os.Stat(path)\n\tif e != nil {\n\t\treturn false\n\t}\n\treturn true\n}", "title": "" }, { "docid": "bc9683dfb29a927c0b5ab2bd45839405", "score": "0.70507324", "text": "func Exists(path string) (bool, error) {\n\t_, err := os.Stat(path)\n\tif err == nil {\n\t\treturn true, nil\n\t}\n\tif os.IsNotExist(err) {\n\t\treturn false, nil\n\t}\n\treturn true, err\n}", "title": "" }, { "docid": "bc9683dfb29a927c0b5ab2bd45839405", "score": "0.70507324", "text": "func Exists(path string) (bool, error) {\n\t_, err := os.Stat(path)\n\tif err == nil {\n\t\treturn true, nil\n\t}\n\tif os.IsNotExist(err) {\n\t\treturn false, nil\n\t}\n\treturn true, err\n}", "title": "" }, { "docid": "bc9683dfb29a927c0b5ab2bd45839405", "score": "0.70507324", "text": "func Exists(path string) (bool, error) {\n\t_, err := os.Stat(path)\n\tif err == nil {\n\t\treturn true, nil\n\t}\n\tif os.IsNotExist(err) {\n\t\treturn false, nil\n\t}\n\treturn true, err\n}", "title": "" }, { "docid": "bc9683dfb29a927c0b5ab2bd45839405", "score": "0.70507324", "text": "func Exists(path string) (bool, error) {\n\t_, err := os.Stat(path)\n\tif err == nil {\n\t\treturn true, nil\n\t}\n\tif os.IsNotExist(err) {\n\t\treturn false, nil\n\t}\n\treturn true, err\n}", "title": "" }, { "docid": "bc9683dfb29a927c0b5ab2bd45839405", "score": "0.70507324", "text": "func Exists(path string) (bool, error) {\n\t_, err := os.Stat(path)\n\tif err == nil {\n\t\treturn true, nil\n\t}\n\tif os.IsNotExist(err) {\n\t\treturn false, nil\n\t}\n\treturn true, err\n}", "title": "" }, { "docid": "bc9683dfb29a927c0b5ab2bd45839405", "score": "0.70507324", "text": "func Exists(path string) (bool, error) {\n\t_, err := os.Stat(path)\n\tif err == nil {\n\t\treturn true, nil\n\t}\n\tif os.IsNotExist(err) {\n\t\treturn false, nil\n\t}\n\treturn true, err\n}", "title": "" }, { "docid": "bdead08832cf0cc268766413e1ba41e7", "score": "0.7050288", "text": "func Exists(path string) (bool, error) {\n\t_, err := os.Stat(path)\n\tif err == nil {\n\t\treturn true, nil\n\t} else if os.IsNotExist(err) {\n\t\treturn false, nil\n\t}\n\treturn false, err\n}", "title": "" } ]
4f89d049441804efcf9b4e6fc22c53b2
appAccessWebsockets makes sure that websocket requests get forwarded.
[ { "docid": "03b307ece2d0cc1b5eae8337258857ad", "score": "0.71403384", "text": "func (p *pack) appAccessWebsockets(t *testing.T) {\n\ttests := []struct {\n\t\tdesc string\n\t\tinCookie string\n\t\toutMessage string\n\t\terr error\n\t}{\n\t\t{\n\t\t\tdesc: \"root cluster, valid application session cookie, successful websocket (ws://) request\",\n\t\t\tinCookie: p.createAppSession(t, p.rootWSPublicAddr, p.rootAppClusterName),\n\t\t\toutMessage: p.rootWSMessage,\n\t\t},\n\t\t{\n\t\t\tdesc: \"root cluster, valid application session cookie, successful secure websocket (wss://) request\",\n\t\t\tinCookie: p.createAppSession(t, p.rootWSSPublicAddr, p.rootAppClusterName),\n\t\t\toutMessage: p.rootWSSMessage,\n\t\t},\n\t\t{\n\t\t\tdesc: \"leaf cluster, valid application session cookie, successful websocket (ws://) request\",\n\t\t\tinCookie: p.createAppSession(t, p.leafWSPublicAddr, p.leafAppClusterName),\n\t\t\toutMessage: p.leafWSMessage,\n\t\t},\n\t\t{\n\t\t\tdesc: \"leaf cluster, valid application session cookie, successful secure websocket (wss://) request\",\n\t\t\tinCookie: p.createAppSession(t, p.leafWSSPublicAddr, p.leafAppClusterName),\n\t\t\toutMessage: p.leafWSSMessage,\n\t\t},\n\t\t{\n\t\t\tdesc: \"invalid application session cookie, websocket request fails to dial\",\n\t\t\tinCookie: \"ABCDEFGHIJKLMNOPQRSTUVWXYZ\",\n\t\t\terr: errors.New(\"\"),\n\t\t},\n\t}\n\tfor _, tt := range tests {\n\t\tt.Run(tt.desc, func(t *testing.T) {\n\t\t\ttt := tt\n\t\t\tbody, err := p.makeWebsocketRequest(tt.inCookie, \"/\")\n\t\t\tif tt.err != nil {\n\t\t\t\trequire.IsType(t, tt.err, trace.Unwrap(err))\n\t\t\t} else {\n\t\t\t\trequire.NoError(t, err)\n\t\t\t\trequire.Equal(t, tt.outMessage, body)\n\t\t\t}\n\t\t})\n\t}\n}", "title": "" } ]
[ { "docid": "2630ea2335e6bf7859fb2b9f4d734df8", "score": "0.6469943", "text": "func WebSocketApp(port int, tls bool, onNewClient func(conn *websocket.Conn) *Client) {\n\n\thttp.HandleFunc(\"/ws\", handleConnections(onNewClient))\n\tlog.Println(\"http server started on :\" + strconv.Itoa(port))\n\tdieIfErr(listenAndServeTo(port, tls), \"Cannot serve\")\n}", "title": "" }, { "docid": "7a6d66e203ca319378f2a0ec196cec12", "score": "0.63730747", "text": "func wsConnect(w http.ResponseWriter, r *http.Request) {\n\tw.Header().Set(\"Access-Control-Allow-Methods\", \"*\")\n\n\tchannel := chanIdEncode(strings.Trim(r.URL.Query().Get(\"channel\"), \" \"))\n\tif channel == \"\" || chats[channel] == nil {\n\t\thttp.Error(w, \"403 Forbidden (Channel not found)\", http.StatusForbidden)\n\t\treturn\n\t}\n\n\tcookie, _ := r.Cookie(channel)\n\tif cookie == nil || chats[channel].Users[cookie.Value] == nil {\n\t\thttp.Error(w, \"403 Forbidden (Not authenticated)\", http.StatusForbidden)\n\t\treturn\n\t}\n\tsid := cookie.Value\n\n\tc, err := upgrader.Upgrade(w, r, nil)\n\tif err != nil {\n\t\tlog.Print(\"Unable to upgrade websocket connection:\", err)\n\t\thttp.Error(w, fmt.Sprintf(\"Unable to handle websocket: %s\", err), http.StatusInternalServerError)\n\t\treturn\n\t}\n\tdefer c.Close()\n\n\tchats[channel].Users[sid].Online = true\n\tchats[channel].Users[sid].Socket = c\n\n\t// Send the entire history to the user on first connection\n\tchats[channel].HistoryMutex.Lock()\n\tfor _, data := range chats[channel].History {\n\t\tc.WriteJSON(data)\n\t}\n\tchats[channel].HistoryMutex.Unlock()\n\n\t// Handle incoming messages\n\tfor {\n\t\tvar data MessageData\n\t\terr := c.ReadJSON(&data) // Blocks until a message is received\n\t\tif err != nil {\n\t\t\tlog.Println(\"Unable to read client data:\", err)\n\t\t\tc.Close()\n\t\t\tchats[channel].Users[sid].Online = false\n\t\t\tbreak\n\t\t}\n\n\t\tif data.Message != \"\" && len(data.Message) <= 500 {\n\t\t\tdata.Username = chats[channel].Users[sid].Name\n\t\t\tdata.Color = chats[channel].Users[sid].Color\n\t\t\tdata.Timestamp = (time.Now().UnixNano() / int64(time.Millisecond))\n\t\t\tbroadcast(channel, &data)\n\t\t}\n\t}\n}", "title": "" }, { "docid": "e77471cfc4446bb8ad19f30e4af57b45", "score": "0.6367645", "text": "func serveWs(w http.ResponseWriter, r *http.Request) {\n if r.Method != \"GET\" {\n http.Error(w, \"Method not allowed\", 405)\n return\n }\n if r.Header.Get(\"Origin\") != \"http://\"+r.Host {\n http.Error(w, \"Origin not allowed\", 403)\n return\n }\n ws, err := websocket.Upgrade(w, r, nil, Conf.Websocket.ReadBufSize, Conf.Websocket.WriteBufSize)\n if _, ok := err.(websocket.HandshakeError); ok {\n http.Error(w, \"Not a websocket handshake\", 400)\n return\n } else if err != nil {\n log.Println(err)\n return\n }\n c := &connection{send: make(chan []byte, 256), ws: ws}\n h.register <- c\n go c.writePump()\n c.readPump()\n}", "title": "" }, { "docid": "56144b8f9f4abb65ce6312173c3fcb3d", "score": "0.6345331", "text": "func webSocketHandler(w http.ResponseWriter, r *http.Request) {\n\tconn, err := upgrader.Upgrade(w, r, nil)\n\tif err != nil {\n\t\tlog.Println(err)\n\t\treturn\n\t}\n\n\tsockets.register(conn)\n\n\t// Make session.\n\tclientSession := user.NewSession(conn)\n\tgo messageHandler(conn, clientSession.MessageChannel)\n\tgo navigationHandler(clientSession)\n\tgo welcome.Index(clientSession)\n}", "title": "" }, { "docid": "68a18ab2a14425f3eed4589ccff3b307", "score": "0.628939", "text": "func serveWs(w http.ResponseWriter, r *http.Request) {\n\tif r.Method != \"GET\" {\n\t\thttp.Error(w, \"Method not allowed\", 405)\n\t\treturn\n\t}\n\t/*\n\t\tif r.Header.Get(\"Origin\") != \"http://\"+r.Host {\n\t\t\tlog.Println(\"403\")\n\t\t\thttp.Error(w, \"Origin not allowed\", 403)\n\t\t\treturn\n\t\t}\n\t*/\n\tws, err := websocket.Upgrade(w, r, nil, 1024, 1024)\n\tif _, ok := err.(websocket.HandshakeError); ok {\n\t\thttp.Error(w, \"Not a websocket handshake\", 400)\n\t\treturn\n\t} else if err != nil {\n\t\tlog.Println(err)\n\t\treturn\n\t}\n\tc := &connection{send: make(chan []byte, 256), ws: ws}\n\th.register <- c\n\tgo c.writePump()\n\tc.readPump()\n}", "title": "" }, { "docid": "dcaf21797aad439bff6098ddefaa4901", "score": "0.62791497", "text": "func (a *API) Websocket(w http.ResponseWriter, r *http.Request) {\n\tdefer r.Body.Close()\n\tuser, ok := a.isUser(w, r)\n\tif !ok {\n\t\treturn\n\t}\n\tconn, err := a.upgrader.Upgrade(w, r, nil)\n\tif err != nil {\n\t\tw.WriteHeader(http.StatusBadRequest)\n\t\treturn\n\t}\n\tclient := &websocketClient{\n\t\tconn: conn,\n\t\tmsg: make(chan *Message, 256),\n\t\tname: user.Name,\n\t}\n\n\ta.websocketClients[user.Name] = client\n\ta.writeClientMessage(client)\n\ta.readClientMessage(client)\n}", "title": "" }, { "docid": "e785e697af9f8e5086447d74adb21dfe", "score": "0.62275445", "text": "func serveWs(w http.ResponseWriter, r *http.Request) {\n\t// upgrade this connection to a WebSocket\n\t// connection\n\tws, err := upgrader.Upgrade(w, r, nil)\n\tif err != nil {\n\t\tlog.Printf(\"Error while upgrade connection: %v\", err)\n\t\treturn\n\t}\n\t// listen indefinitely for new messages coming\n\t// through on our WebSocket connection\n\t// ch := NewChannel(ws)\n\tNewChannel(ws)\n}", "title": "" }, { "docid": "f683e5098822471bb77bbc67647358a2", "score": "0.62047553", "text": "func serveWs(gsp *gossiper.Gossiper) http.HandlerFunc {\n\treturn http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {\n\t\tfmt.Println(r.Host)\n\n\t\t// upgrade this connection to a WebSocket\n\t\t// connection\n\t\tws, err := upgrader.Upgrade(w, r, nil)\n\t\tif err != nil {\n\t\t\tlog.Println(err)\n\t\t}\n\t\tgsp.UIWebsocket = ws\n\t\t// listen indefinitely for new messages coming\n\t\t// through on our WebSocket connection\n\t\tgo ReadUIMessage(ws, gsp)\n\t\tgo WriteUIMessage(gsp)\n\t})\n}", "title": "" }, { "docid": "ac69a20de1b885170d4a1fe6ae1f3e28", "score": "0.6113519", "text": "func serveWs(pool *websocket.Pool, w http.ResponseWriter, r *http.Request) {\n\tfmt.Println(\"Websocket Endpoint Hit ...\")\n\tconn, err := websocket.Upgrade(w, r)\n\tif err != nil {\n\t\tfmt.Fprintf(w, \"%+v\\n\", err)\n\t}\n\n\tclient := &websocket.Client{\n\t\tConn: conn,\n\t\tPool: pool,\n\t}\n\n\tpool.Register <- client\n\tclient.Read()\n}", "title": "" }, { "docid": "0be736c2d4e0d2212bef70d8627b89ef", "score": "0.6039645", "text": "func WsHandler(w http.ResponseWriter, r *http.Request) {\n\tif r.Header.Get(\"Origin\") != \"http://\"+r.Host {\n\t\thttp.Error(w, \"Incorrect host origin\", 403)\n\t\treturn\n\t}\n\n\tconn, err := websocket.Upgrade(w, r, w.Header(), 1024, 1024)\n\tif err != nil {\n\t\thttp.Error(w, \"Failed to open websocket connection\", http.StatusBadRequest)\n\t}\n\n\tdefer conn.Close()\n\n\tLog(conn)\n}", "title": "" }, { "docid": "7530f4094bcdc4f8d03fed7a44b72e28", "score": "0.60330695", "text": "func serveWs(hub *sessHub, w http.ResponseWriter, r *http.Request) {\r\n\tvar (\r\n\t\t//sessData SessionData\r\n\t\terr error\r\n\t\t//res int\r\n\t\tc *sessClient\r\n\t)\r\n\r\n\tkerr.PrintDebugMsg(false, \"ws\", \" serveWs HERE!\")\r\n\r\n\tif c, _, err = getSession(r); err != nil {\r\n\t\tkerr.SysErrPrintf(\"serveWs : error=%v\", err.Error())\r\n\t\tw.WriteHeader(400)\r\n\t\tw.Write([]byte(fmt.Sprintf(\"serveWs : error=%v\", err.Error())))\r\n\t\treturn\r\n\t}\r\n\r\n\tif c == nil {\r\n\t\tkerr.SysErrPrintf(\"serveWs : session does not registered; Request =%v\", khttputils.ReqLabel(r))\r\n\t\tw.WriteHeader(400)\r\n\t\tw.Write([]byte(fmt.Sprintf(\"serveWs : session does not registered; Request =%v\", khttputils.ReqLabel(r))))\r\n\t\treturn\r\n\t}\r\n\tif c.conn != nil { //Why? I seemingly have said that the connection would be overrided by a next \"/ws\"\r\n\t\tkerr.SysErrPrintf(\"serveWs : session already has WS; user_id=%v\", c.User_ID)\r\n\t\tw.WriteHeader(400)\r\n\t\tw.Write([]byte(fmt.Sprintf(\"serveWs : session already has WS; user_id=%v\", c.User_ID)))\r\n\t\treturn\r\n\t}\r\n\r\n\tconn, err := upgrader.Upgrade(w, r, nil)\r\n\tif err != nil {\r\n\t\tkerr.SysErrPrintf(\"serveWs : upgrader.Upgrade error=%v\", err.Error())\r\n\t\treturn\r\n\t}\r\n\r\n\tsetConn.Lock()\r\n\tc.conn = conn\r\n\tc.send = make(chan []byte, userSendChanLen)\r\n\tsetConn.Unlock()\r\n\r\n\tgo c.writePump()\r\n\tgo c.readPump()\r\n}", "title": "" }, { "docid": "4e14bb468a6326168bb5dbd398da599a", "score": "0.60261136", "text": "func serveWs(pool *websocket.Pool, w http.ResponseWriter, r *http.Request) {\n\tfmt.Println(\"WebSocket Endpoint Hit\")\n\tconn, err := websocket.Upgrade(w, r)\n\tif err != nil {\n\t\tfmt.Fprintf(w, \"%+v\\n\", err)\t//shows a resulting error in endpoint connection\n\t}\n\n\tclient := &websocket.Client{\n\t\tConn: conn,\n\t\tPool: pool,\n\t}\n\n\tpool.Register <- client\n\tclient.Read()\n}", "title": "" }, { "docid": "17db64b1515c66a9361c445625524776", "score": "0.59763134", "text": "func isWebsocket(r *http.Request) bool {\n\tupgrade := false\n\tfor _, h := range r.Header[\"Connection\"] {\n\t\tif strings.Contains(strings.ToLower(h), \"upgrade\") {\n\t\t\tupgrade = true\n\t\t\tbreak\n\t\t}\n\t}\n\tif !upgrade {\n\t\treturn false\n\t}\n\n\t// FIXME(kyle): Can we just check for websocket in 'Upgrade'?\n\tfor _, h := range r.Header[\"Upgrade\"] {\n\t\tif strings.Contains(strings.ToLower(h), \"websocket\") {\n\t\t\treturn true\n\t\t}\n\t}\n\treturn false\n}", "title": "" }, { "docid": "aeb3210b54c33f51227fac1edb9fbf2d", "score": "0.59680027", "text": "func handleWebsocket(w http.ResponseWriter, r *http.Request) {\n\tif r.Method != \"GET\" {\n\t\thttp.Error(w, \"Method not allowed\", 405)\n\t\treturn\n\t}\n\n\tlog.Println(\"Attempting websocket upgrade...\")\n\tws, err := upgrader.Upgrade(w, r, nil)\n\tif err != nil {\n\t\tlog.WithField(\"err\", err).Println(\"Upgrading to websockets\")\n\t\thttp.Error(w, \"Error Upgrading to websockets\", 400)\n\t\treturn\n\t}\n\n\tfor {\n\t\tmt, data, err := ws.ReadMessage()\n\t\tctx := log.Fields{\"mt\": mt, \"data\": data, \"err\": err}\n\t\tif err != nil {\n\t\t\tif err == io.EOF {\n\t\t\t\tlog.WithFields(ctx).Info(\"Websocket closed!\")\n\t\t\t} else {\n\t\t\t\tlog.WithFields(ctx).Error(\"Error reading websocket message\")\n\t\t\t}\n\t\t\tbreak\n\t\t}\n\t\tswitch mt {\n\t\tcase websocket.TextMessage:\n\t\t\tmsg, err := validateMessage(data)\n\t\t\tif err != nil {\n\t\t\t\tctx[\"msg\"] = msg\n\t\t\t\tctx[\"err\"] = err\n\t\t\t\tlog.WithFields(ctx).Error(\"Invalid Message\")\n\t\t\t\tbreak\n\t\t\t}\n\n\t\t\tswitch msg.Status {\n\n\t\t\tcase \"init\":\n\n\t\t\t\tvar data initData\n\n\t\t\t\tclient, err := docker.NewClientFromEnv()\n\t\t\t\tif err != nil {\n\t\t\t\t\tlog.Fatal(err)\n\t\t\t\t}\n\n\t\t\t\tdata.Containers, err = client.ListContainers(docker.ListContainersOptions{\n\t\t\t\t\tAll: true,\n\t\t\t\t})\n\t\t\t\tif err != nil {\n\t\t\t\t\tlog.Fatal(err)\n\t\t\t\t}\n\n\t\t\t\tdata.Status = \"initResponse\"\n\n\t\t\t\tjsonOut, err := json.Marshal(data)\n\t\t\t\tif err != nil {\n\t\t\t\t\tlog.Fatal(err)\n\t\t\t\t}\n\t\t\t\tws.WriteMessage(websocket.TextMessage, jsonOut)\n\t\t\t}\n\t\t\tlog.WithFields(ctx).Info(msg)\n\t\t\t// rw.publish(data)\n\t\tdefault:\n\t\t\tlog.WithFields(ctx).Warning(\"Unknown Message!\")\n\t\t}\n\t}\n\n\t// rr.deRegister(id)\n\n\tws.WriteMessage(websocket.CloseMessage, []byte{})\n}", "title": "" }, { "docid": "1bd8de1161f0bbc9b359d819fff0b2f2", "score": "0.59676063", "text": "func serveWs(c echo.Context) error {\n\tconn, err := upgrader.Upgrade(c.Response(), c.Request(), nil)\n\tif err != nil {\n\t\treturn err\n\t}\n\tclients = append(clients, conn)\n\treturn nil\n}", "title": "" }, { "docid": "475b80676254e4fcdff2af80edcd7611", "score": "0.5949694", "text": "func WebSocket(w http.ResponseWriter, r *http.Request) {\n\tconn, err := upgrader.Upgrade(w, r, nil)\n\tif err != nil {\n\t\treturnError(w, err)\n\t\treturn\n\t}\n\n\tkey := common.AddSubscriber(conn)\n\tconn.SetCloseHandler(func(code int, text string) error {\n\t\tcommon.RemoveSubscriber(key)\n\t\treturn nil\n\t})\n\n\tfor {\n\t\tvar msg []int\n\t\tif err := conn.ReadJSON(&msg); err != nil {\n\t\t\tconn.Close()\n\t\t\treturn\n\t\t}\n\n\t\t// The only data we receive from the client is a number that tells\n\t\t// the router the connection only wants to receive updates for that\n\t\t// tracer ID.\n\t\tif len(msg) == 1 {\n\t\t\tcommon.ChangeTracer(key, msg[0])\n\t\t}\n\t}\n}", "title": "" }, { "docid": "3c378a8edb873241635d358aeea1e0c6", "score": "0.5939452", "text": "func serveWs(c echo.Context) error {\n\tconn, err := upgrader.Upgrade(c.Response(), c.Request(), nil)\n\tcc := c.(*ChatContext)\n\tif err != nil {\n\t\tlog.Println(err)\n\t\treturn err\n\t}\n\n\tclient := &Client{hub: cc.hub, conn: conn, send: make(chan []byte, 256)}\n\tclient.hub.register <- client\n\n\t// Allow collection of memory referenced by the caller by doing all work in\n\t// new goroutines.\n\tr := make(chan error)\n\tgo client.writePump(r)\n\tgo client.readPump()\n\tselect {\n\tcase err := <-r:\n\t\treturn err\n\t}\n}", "title": "" }, { "docid": "34d6d2913022dcc0550163f55bc00485", "score": "0.5934852", "text": "func wsHandler(w http.ResponseWriter, r *http.Request) {\n\n\tconn, err := upgrader.Upgrade(w, r, nil)\n\tif err != nil {\n\t\tcommon.LogErrorln(\"Error upgrading to websocket:\", err)\n\t\treturn\n\t}\n\n\tcommon.LogDebugln(\"Connection has been upgraded to websocket\")\n\n\tchatConn := &chatConnection{\n\t\tConn: conn,\n\t\t// If the server is behind a reverse proxy (eg, Nginx), look\n\t\t// for this header to get the real IP address of the client.\n\t\tforwardedFor: common.ExtractForwarded(r),\n\t}\n\n\tgo func() {\n\t\tvar client *Client\n\n\t\t// Get the client object\n\t\tfor client == nil {\n\t\t\tvar data common.ClientData\n\t\t\terr := chatConn.ReadData(&data)\n\t\t\tif err != nil {\n\t\t\t\tcommon.LogInfof(\"[handler] Client closed connection: %s: %v\\n\",\n\t\t\t\t\tconn.RemoteAddr().String(), err)\n\t\t\t\tconn.Close()\n\t\t\t\treturn\n\t\t\t}\n\n\t\t\tif data.Type == common.CdPing {\n\t\t\t\tcontinue\n\t\t\t}\n\n\t\t\tvar joinData common.JoinData\n\t\t\terr = json.Unmarshal([]byte(data.Message), &joinData)\n\t\t\tif err != nil {\n\t\t\t\tcommon.LogInfof(\"[handler] Could not unmarshal websocket %d data %#v: %v\\n\", data.Type, data.Message, err)\n\t\t\t\tcontinue\n\t\t\t}\n\n\t\t\tclient, err = chat.Join(chatConn, joinData)\n\t\t\tif err != nil {\n\t\t\t\tswitch err.(type) { //nolint:errorlint\n\t\t\t\tcase UserFormatError, UserTakenError:\n\t\t\t\t\tcommon.LogInfof(\"[handler|%s] %v\\n\", errorName(err), err)\n\t\t\t\tcase BannedUserError:\n\t\t\t\t\tcommon.LogInfof(\"[handler|%s] %v\\n\", errorName(err), err)\n\t\t\t\t\t// close connection since banned users shouldn't be connecting\n\t\t\t\t\tconn.Close()\n\t\t\t\tdefault:\n\t\t\t\t\t// for now all errors not caught need to be warned\n\t\t\t\t\tcommon.LogErrorf(\"[handler|uncaught] %v\\n\", err)\n\t\t\t\t\tconn.Close()\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\t// Handle incomming messages\n\t\tfor {\n\t\t\tvar data common.ClientData\n\t\t\terr := conn.ReadJSON(&data)\n\t\t\tif err != nil { //if error then assuming that the connection is closed\n\t\t\t\tclient.Exit()\n\t\t\t\treturn\n\t\t\t}\n\t\t\tclient.NewMsg(data)\n\t\t}\n\n\t}()\n}", "title": "" }, { "docid": "895df4c8ac8ea70c14b15a7b2ca1253c", "score": "0.5932557", "text": "func (s *Server) Websocket(route string, httpHandler websocket.Handler) {\n s.addRoute(route, \"GET\", httpHandler)\n}", "title": "" }, { "docid": "6ef42f90fb2620934d96d34be133112c", "score": "0.5916996", "text": "func (e *Endpoints) APIDocWebsocket(ctx context.Context, w http.ResponseWriter, r *http.Request, vars map[string]string) error {\n\tidentity, err := user.GetIdentityInfo(r)\n\tif err != nil {\n\t\treturn err\n\t}\n\torgID, err := user.GetOrgID(r)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tapiErr := e.fileTreeSvc.Upgrade(w, r, &apistructs.WsAPIDocHandShakeReq{\n\t\tOrgID: orgID,\n\t\tIdentity: &identity,\n\t\tURIParams: &apistructs.FileTreeDetailURI{\n\t\t\tTreeName: \"api-docs\",\n\t\t\tInode: vars[\"inode\"],\n\t\t},\n\t})\n\tif apiErr != nil {\n\t\thttpserver.WriteErr(w, apiErr.Code(), apiErr.Error())\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "7d24f2b6c503abce820e922187b0323f", "score": "0.5866073", "text": "func wsHandler(ws *websocket.Conn) {\r\n\tio.Copy(ws, ws)\r\n}", "title": "" }, { "docid": "a4f5f08a4f6fdfc1857069bfb5a5c364", "score": "0.5847012", "text": "func (r *WebSocketApi) serveWs(w http.ResponseWriter, req *http.Request) {\n\tglog.Infof(\"Registering client to WS\")\n\tif req.Method != \"GET\" {\n\t\thttp.Error(w, \"Method not allowed\", 405)\n\t\treturn\n\t}\n\tws, err := upgrader.Upgrade(w, req, nil)\n\tif err != nil {\n\t\tglog.Errorf(\"Error %+v\", err)\n\t\treturn\n\t}\n\tc := &connection{send: make(chan []byte, 256), ws: ws}\n\th.register <- c\n\tgo c.writePump()\n}", "title": "" }, { "docid": "a9fd73f413ba5c66bcff95a653b32b5d", "score": "0.5843753", "text": "func serveWebsockets(config ServeConfig) http.Handler {\n\tvar clients WebSockets\n\n\t// fire up a trade server to listen for trades from the collector\n\tgo NewTradeServer(func(t Trade) {\n\t\tclients.Map(func(client *websocket.Conn) {\n\t\t\tif err := client.WriteJSON(t); err != nil {\n\t\t\t\tpanic(err)\n\t\t\t}\n\t\t})\n\t})\n\n\tm := martini.Classic()\n\n\t// a route for websockets to connect to be sent trades\n\tm.Get(\"/ws/v1/trades\", WebSocketHandler(func(ws *websocket.Conn) {\n\t\tclients.Add(ws)\n\n\t\tfor {\n\t\t\tvar obj struct{}\n\t\t\terr := ws.ReadJSON(&obj)\n\t\t\tif err != nil {\n\t\t\t\tclients.Delete(ws)\n\t\t\t\tws.Close()\n\t\t\t\tbreak\n\t\t\t} else {\n\t\t\t\tlog.Printf(\"Client sent %v\", obj)\n\t\t\t}\n\t\t}\n\t}))\n\n\treturn m\n}", "title": "" }, { "docid": "a7933474857cf457490bc4db61093773", "score": "0.58369833", "text": "func (s *Server) Websockets() *WebsocketBag {\n\ts.wsBagLocker.Lock()\n\tdefer s.wsBagLocker.Unlock()\n\n\tif s.wsBag == nil {\n\t\ts.wsBag = &WebsocketBag{}\n\t}\n\n\treturn s.wsBag\n}", "title": "" }, { "docid": "15211cedb53383d896a81ceddab646ef", "score": "0.5830227", "text": "func serveWs(pool *SocketPool, w http.ResponseWriter, r *http.Request) {\n\tlog.Print(\"Websocket requested\")\n\tconn, err := upgrader.Upgrade(w, r, nil)\n\tif err != nil {\n\t\tlog.Println(err)\n\t\treturn\n\t}\n\tclient := &Client{pool: pool, conn: conn, send: make(chan []byte, 256)}\n\tclient.pool.register <- client\n\n\t// We use goroutine (a kind of light thread)\n\tgo client.writePump()\n\tgo client.readPump()\n\n\tlog.Print(\"New websocket client\")\n}", "title": "" }, { "docid": "8da550cc9e3a694b4f6574cff1c1d67d", "score": "0.5812192", "text": "func serveWs(wsclient *WSClient, w http.ResponseWriter, r *http.Request) {\n\tvar err error\n\n\twsclient.socket, err = upgrader.Upgrade(w, r, nil)\n\tif err != nil {\n\t\tio.WriteString(w, \"Protocol error: Please use Websocket to connect\\n\")\n\t\tlog.Printf(\"<failed upgrade %v>\\n\", err)\n\t\treturn\n\t}\n\n\tlog.Printf(\"<websocket: ready>\\n\")\n\n\t// Do responses in separate thread\n\tgo wsclient.Respond()\n\n\t// Use this thread for read\n\twsclient.ReadWS()\n\treturn\n}", "title": "" }, { "docid": "b622acfa61c63f1693cbca924c174766", "score": "0.5808274", "text": "func EchoServer(ws *websocket.Conn) {\n io.Copy(ws, ws)\n}", "title": "" }, { "docid": "1ea83fb216a0794c12c7717a175017cb", "score": "0.57825303", "text": "func WSHandler(w http.ResponseWriter, r *http.Request) {\n\ts := websocket.Server{Handler: websocket.Handler(\n\t\tfunc(ws *websocket.Conn) {\n\t\t\tconnection := &webSocketConnection{ws: ws}\n\n\t\t\t// add connection\n\t\t\tmanager.AddConnection(connection)\n\t\t\tdefer func() {\n\t\t\t\t// delete connection\n\t\t\t\tmanager.DelConnection(connection)\n\t\t\t}()\n\n\t\t\tfor {\n\t\t\t\t// receive message\n\t\t\t\tmessage := new(Message)\n\t\t\t\terr := websocket.JSON.Receive(ws, message)\n\t\t\t\tif err != nil {\n\t\t\t\t\t// close event\n\t\t\t\t\tif err == io.EOF {\n\t\t\t\t\t\treturn\n\t\t\t\t\t}\n\n\t\t\t\t\tlog.Println(err)\n\t\t\t\t}\n\t\t\t\tlog.Printf(\"client: %#v\\n\", message)\n\t\t\t}\n\t\t}),\n\t}\n\ts.ServeHTTP(w, r)\n}", "title": "" }, { "docid": "f083a7d7ba8cd1d6041ed617c29703f2", "score": "0.57742864", "text": "func (eventsClient eventsClient) serveWebsocket(websocketConn *websocket.Conn, state State) error {\n\t// initial state\n\tif err := websocket.JSON.Send(websocketConn, state); err != nil {\n\t\treturn fmt.Errorf(\"webSocket.JSON.Send: %v\", err)\n\t}\n\n\t// update events\n\tfor event := range eventsClient {\n\t\tif err := websocket.JSON.Send(websocketConn, event); err != nil {\n\t\t\treturn fmt.Errorf(\"webSocket.JSON.Send: %v\", err)\n\t\t}\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "303231c6caefd23a55e02c31bfa4eb2d", "score": "0.5774255", "text": "func WSHandler(c echo.Context) error {\n\tdefer (func() {\n\t\tif err := recover(); err != nil {\n\t\t\tlog.Println(err)\n\t\t}\n\t})()\n\tkey := c.QueryParam(\"key\")\n\tallowed := TriggerWebhook(Event{\n\t\tAction: \"connect\",\n\t\tKey: key,\n\t})\n\tif !allowed {\n\t\treturn c.JSON(403, \"You aren't allowed to access this resource\")\n\t}\n\tconn, err := WSUpgrader.Upgrade(c.Response(), c.Request(), nil)\n\tif err != nil {\n\t\treturn nil\n\t}\n\tdefer conn.Close()\n\tsubscriber, err := Broker.Attach()\n\tif err != nil {\n\t\tconn.WriteJSON(map[string]string{\n\t\t\t\"error\": \"Sorry, couldn't allocate resources for you\",\n\t\t})\n\t\treturn nil\n\t}\n\tcloseCh := make(chan bool)\n\tclosed := false\n\tconn.SetCloseHandler(func(_ int, _ string) error {\n\t\tcloseCh <- true\n\t\treturn nil\n\t})\n\tgo (func() {\n\t\tvar action Event\n\t\tstop := false\n\t\tfor !stop {\n\t\t\tif conn.ReadJSON(&action) != nil {\n\t\t\t\tstop = true\n\t\t\t\tbreak\n\t\t\t}\n\t\t\tif action.Action == \"subscribe\" || action.Action == \"unsubscribe\" {\n\t\t\t\tif !TriggerWebhook(Event{Action: action.Action, Key: key, Value: action.Value}) {\n\t\t\t\t\tconn.WriteJSON(map[string]string{\n\t\t\t\t\t\t\"error\": \"You aren't allowed to access the requested resource\",\n\t\t\t\t\t})\n\t\t\t\t\tcontinue\n\t\t\t\t}\n\t\t\t}\n\t\t\tif action.Action == \"subscribe\" {\n\t\t\t\tBroker.Subscribe(subscriber, action.Value)\n\t\t\t} else if action.Action == \"unsubscribe\" {\n\t\t\t\tBroker.Unsubscribe(subscriber, action.Value)\n\t\t\t}\n\t\t}\n\t\tcloseCh <- true\n\t})()\n\tfor !closed {\n\t\tselect {\n\t\tcase <-closeCh:\n\t\t\tclosed = true\n\t\t\tclose(closeCh)\n\t\t\tBroker.Detach(subscriber)\n\t\t\tTriggerWebhook(Event{Action: \"disconnect\", Key: key})\n\t\tcase data := <-subscriber.GetMessages():\n\t\t\tmsg := (data.GetPayload()).(Message)\n\t\t\tif !msg.IsUserAllowed(key) {\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tmsg.Topic = data.GetTopic()\n\t\t\tmsg.Time = data.GetCreatedAt()\n\t\t\tmsg.To = nil\n\t\t\tif conn.WriteJSON(msg) != nil {\n\t\t\t\tcloseCh <- true\n\t\t\t}\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "703ddfe6c4caff085b05cf8e82afb739", "score": "0.5768799", "text": "func (s *Server) serveWS(w http.ResponseWriter, r *http.Request) {\n\tctx := r.Context()\n\therder := http.Header{}\n\twsProto := strings.Split(r.Header.Get(\"Sec-WebSocket-Protocol\"), \",\")\n\tif len(wsProto) < 2 {\n\t\treturn\n\t}\n\ttoken := wsProto[0]\n\troomID := strings.TrimSpace(wsProto[1])\n\targs := &ConnectArg{\n\t\tAuth: token,\n\t\tRoomID: roomID,\n\t\tServerID: conf.Conf.Base.ServerID,\n\t}\n\tuid, err := s.operator.Connect(ctx, args)\n\n\tif err != nil {\n\t\tlog.Bg().Error(\"调用logic Connect 方法失败\", zap.Error(err))\n\t}\n\n\therder.Add(\"Sec-WebSocket-Protocol\", roomID)\n\n\tupgrades := websocket.Upgrader{\n\t\tReadBufferSize: s.c.Websocket.ReadBufferSize,\n\t\tWriteBufferSize: s.c.Websocket.WriteBufferSize,\n\t\tEnableCompression: true,\n\t}\n\t// CORS\n\tupgrades.CheckOrigin = func(r *http.Request) bool { return true }\n\tconn, err := upgrades.Upgrade(w, r, herder)\n\n\tif err != nil {\n\t\tlog.Bg().Error(\"\", zap.Error(err))\n\t\treturn\n\t}\n\tif uid == \"\" {\n\t\t_ = conn.WriteJSON(map[string]string{\"code\": \"401\", \"msg\": \"token error!\"})\n\t\t_ = conn.Close()\n\t\treturn\n\t}\n\n\tch := NewChannel(s.c.Bucket.BroadcastSize)\n\tch.conn = conn\n\n\tb := s.Bucket(ctx, uid)\n\terr = b.Put(uid, roomID, ch)\n\tif err != nil {\n\t\tlog.Bg().Error(\"bucket Put err: \", zap.Error(err))\n\t\t_ = ch.conn.Close()\n\t}\n\n\tgo s.writePump(ctx, ch)\n\tgo s.readPump(ctx, ch)\n}", "title": "" }, { "docid": "fd312a1145af5d3bd01c2a14996758fa", "score": "0.5766529", "text": "func WebSocket(c *gin.Context) {\n\t// get user part\n\tvar headerUser interface{}\n\t//\tif common.Secure {\n\theaderUser, _ = c.Get(\"user\")\n\t//\t} else {\n\t//\t\theaderUser = \"rod41732\"\n\t//\t}\n\tusername := headerUser.(string)\n\tuserObject := storage.GetUserStateInfo(username)\n\twsRouter(c.Writer, c.Request, userObject)\n}", "title": "" }, { "docid": "d25b847847f789a6727716ee3df88cb5", "score": "0.57595617", "text": "func isWebsocketRequest(req *http.Request) bool {\n\treturn containsHeader(req, \"Connection\", \"upgrade\") && containsHeader(req, \"Upgrade\", \"websocket\")\n}", "title": "" }, { "docid": "40547df18d70fffb8eb960db146631d9", "score": "0.5737411", "text": "func (s *Server) WebsocketHandler(w http.ResponseWriter, r *http.Request) {\n\tws, err := upgrader.Upgrade(w, r, nil)\n\tif err != nil {\n\t\tlog.Println(err)\n\t\treturn\n\t}\n\tc := &connection{send: make(chan []byte, 256), ws: ws}\n\ts.addConn <- c\n\tgo s.websocketWritePump(c)\n\tgo s.websocketReadPump(c)\n}", "title": "" }, { "docid": "1806284f2a2737a1ea8965db3600924a", "score": "0.5729015", "text": "func serveWs(roomserver *RoomServer, c echo.Context) {\n\tclientName, _, _ := getSession(c)\n\tif len(clientName) == 0 {\n\t\tlog.Println(\"clientName is missing\")\n\t\treturn\n\t}\n\n\tconn, err := upgrader.Upgrade(c.Response(), c.Request(), nil)\n\tif err != nil {\n\t\tlog.Println(err)\n\t\treturn\n\t}\n\t// client := &Client{hub: hub, conn: conn, send: make(chan []byte, 256)}\n\tclient := newClient(conn, roomserver, clientName)\n\n\t// Allow collection of memory referenced by the caller by doing all work in\n\t// new goroutines.\n\tgo client.writePump()\n\tgo client.readPump()\n\troomserver.register <- client\n}", "title": "" }, { "docid": "9d09e4567a11830308889128eb250b86", "score": "0.5728005", "text": "func WsEndpoint(w http.ResponseWriter, r *http.Request) {\n\tconn, err := upgrader.Upgrade(w, r, nil)\n\tif err != nil {\n\t\tlog.Printf(\"Something went wrong while Upgrading to WebSocket : %v\", err)\n\t}\n\tlog.Printf(\"Successfully Upgraded to WS\")\n\tresponse := models.WsResponse{\n\t\tMessage: `<em><small>Connected to server</small></em>`,\n\t}\n\terr = conn.WriteJSON(response)\n\twsConn := models.WsConnection{Conn: conn}\n\tconns[wsConn] = \"\"\n\tif err != nil {\n\t\tlog.Printf(\"Something went wrong while Wring Ws response : %v\", err)\n\t}\n\tgo listenWS(&wsConn)\n}", "title": "" }, { "docid": "2a909f7a33a34ff30ba3b8e8654f2275", "score": "0.57204616", "text": "func serveWs(exch *Exchange, w http.ResponseWriter, r *http.Request) {\n\tconn, err := upgrader.Upgrade(w, r, nil)\n\tif err != nil {\n\t\tlog.Println(err)\n\t\treturn\n\t}\n\t// TODO: add some sort of authentication and display stocks only for that user.\n\tid := r.Header.Get(\"id\")\n\t// if id == \"\" {\n\t// \tlog.Printf(\"Client did not send id. IP: %s\", conn.RemoteAddr())\n\t// \tconn.WriteMessage(websocket.CloseMessage, websocket.FormatCloseMessage(1008, \"You did not send an ID.\"))\n\t// }\n\tclient := &Client{exch: exch, conn: conn, send: make(chan []byte, 256), id: id}\n\tclient.exch.register <- client\n\n\t// Allow collection of memory referenced by the caller by doing all work in\n\t// new goroutines.\n\tgo client.writePump()\n\tgo client.readPump()\n}", "title": "" }, { "docid": "12b054166203599d1f4c2527f932bea6", "score": "0.5714407", "text": "func socketEchoHandler(ws *websocket.Conn) {\n\tio.Copy(ws, ws)\n}", "title": "" }, { "docid": "6b13c3c595d2d2e4213d96941a5022e6", "score": "0.5699214", "text": "func WsEndpoint(rw http.ResponseWriter, r *http.Request) {\n\tws, err := upgradeConnection.Upgrade(rw, r, nil)\n\tif err != nil {\n\t\tlog.Println(\"Upgrade to websocket error : \", err)\n\t}\n\n\tlog.Println(\"Client connected to Websocket endpoint\")\n\n\tvar response WsJsonResponse\n\tresponse.Message = `<em><small>Connected to server</small></em>`\n\terr = ws.WriteJSON(response)\n\tif err != nil {\n\t\tlog.Println(\"Error parsing and sending json response : \", err)\n\t}\n}", "title": "" }, { "docid": "9041efc86c5546a643e87413af602ee0", "score": "0.5696402", "text": "func WebsocketHandler(r render.Render, w http.ResponseWriter, req *http.Request, params martini.Params, db *gorp.DbMap, gs GameService, session sessions.Session, log *log.Logger) {\n\t// upgrade to websocket\n\tws, err := websocket.Upgrade(w, req, nil, 1024, 1024)\n\tif _, ok := err.(websocket.HandshakeError); ok {\n\t\thttp.Error(w, \"Not a websocket handshake\", 400)\n\t\treturn\n\t} else if err != nil {\n\t\tlog.Println(err)\n\t\treturn\n\t}\n\tdefer ws.Close()\n\tlog.Println(\"Succesfully upgraded connection\")\n\n\t// get the player and game ids so the handers can get the game and player objects later\n\tgameId := params[\"id\"]\n\tp := session.Get(\"player_id\")\n\tif p == nil {\n\t\tlog.Println(\"Player not found in session\")\n\t\treturn\n\t}\n\tplayerId := p.(int)\n\n\t// start a goroutine dedicated to listening to the websocket\n\twsReadChan := make(chan Message)\n\tgo func() {\n\t\tmsg := Message{}\n\t\tfor {\n\t\t\t// Blocks\n\t\t\terr := ws.ReadJSON(&msg)\n\t\t\tif err != nil {\n\t\t\t\tlog.Printf(\"Error message from websocket: %#v\", err)\n\t\t\t\tclose(wsReadChan) // causes all of the goroutines waiting on this to stop\n\t\t\t\twsReadChan = nil\n\t\t\t\treturn\n\t\t\t}\n\t\t\tlog.Printf(\"Got message: %v\", msg)\n\t\t\twsReadChan <- msg\n\t\t}\n\t}()\n\tdefer func() {\n\t\tif wsReadChan != nil {\n\t\t\tclose(wsReadChan)\n\t\t}\n\t}()\n\n\t_, player, err := gs.GetGame(db, gameId, playerId)\n\tif err != nil {\n\t\tlog.Printf(\"Unable to get game here: %#v\", err)\n\t\treturn\n\t}\n\n\tif player.Role == Host {\n\t\tlog.Printf(\"Host (player %v) has connected\", playerId)\n\n\t\thostRead := gs.HostJoin(gameId)\n\n\t\tlog.Printf(\"Initializing host\")\n\t\tHostInit(playerId, gameId, gs, ws, wsReadChan, db)\n\n\t\tfor {\n\t\t\tselect {\n\t\t\tcase msg, ok := <-wsReadChan: // player website action\n\t\t\t\tif !ok {\n\t\t\t\t\tlog.Printf(\"Read Channel closed!!11111\")\n\t\t\t\t\treturn\n\t\t\t\t}\n\t\t\t\thandled, err := dispatchMessage(HostFromWeb, msg, gameId, playerId, gs, ws, db, log)\n\t\t\t\tif err != nil {\n\t\t\t\t\tlog.Printf(\"Error while handling message from web to host: %#v\", err)\n\t\t\t\t\treturn\n\t\t\t\t}\n\t\t\t\tif !handled {\n\t\t\t\t\tlog.Printf(\"Unknown message from web to host: %#v\", msg)\n\t\t\t\t}\n\t\t\tcase msg := <-hostRead: // messages from host\n\t\t\t\thandled, err := dispatchMessage(HostFromPlayer, msg, gameId, playerId, gs, ws, db, log)\n\t\t\t\tif err != nil {\n\t\t\t\t\tlog.Printf(\"Error while handling message from player to host: %#v\", err)\n\t\t\t\t\treturn\n\t\t\t\t}\n\t\t\t\tif !handled {\n\t\t\t\t\tlog.Printf(\"Unknown message from player to host: %#v\", msg)\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t} else {\n\t\tlog.Printf(\"Player %v connected\", playerId)\n\n\t\tplayerRead := gs.PlayerJoin(gameId, playerId)\n\t\tdefer gs.PlayerLeave(gameId, playerId)\n\t\tdefer PlayerLeave(playerId, gameId, gs, ws, db)\n\n\t\tPlayerInit(playerId, gameId, gs, ws, db)\n\n\t\tfor {\n\t\t\tselect {\n\t\t\tcase msg, ok := <-wsReadChan: // player website action\n\t\t\t\tif !ok {\n\t\t\t\t\treturn\n\t\t\t\t}\n\t\t\t\thandled, err := dispatchMessage(PlayerFromWeb, msg, gameId, playerId, gs, ws, db, log)\n\t\t\t\tif err != nil {\n\t\t\t\t\tlog.Printf(\"Error while handling message from web to player: %#v\", err)\n\t\t\t\t\treturn\n\t\t\t\t}\n\t\t\t\tif !handled {\n\t\t\t\t\tlog.Printf(\"Unknown message from web to player: %#v\", msg)\n\t\t\t\t}\n\t\t\tcase msg := <-playerRead: // server side message from player to host\n\t\t\t\thandled, err := dispatchMessage(PlayerFromHost, msg, gameId, playerId, gs, ws, db, log)\n\t\t\t\tif err != nil {\n\t\t\t\t\tlog.Printf(\"Error while handling message from host to player: %#v\", err)\n\t\t\t\t\treturn\n\t\t\t\t}\n\t\t\t\tif !handled {\n\t\t\t\t\tlog.Printf(\"Unknown message from host to player: %#v\", msg)\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n}", "title": "" }, { "docid": "f0526fc4ba378ab0d4ee56d7ff5f07d7", "score": "0.56906223", "text": "func serveWs(w http.ResponseWriter, r *http.Request) {\n\tvars := mux.Vars(r)\n\tbattleID := vars[\"id\"]\n\n\t// make sure battle is legit\n\tb, battleErr := GetBattle(battleID)\n\tif battleErr != nil {\n\t\thttp.NotFound(w, r)\n\t\treturn\n\t}\n\tbattle, _ := json.Marshal(b)\n\n\t// make sure warrior cookies are valid\n\twarriorID, cookieErr := ValidateWarriorCookie(w, r)\n\tif cookieErr != nil {\n\t\tw.WriteHeader(http.StatusUnauthorized)\n\t\treturn\n\t}\n\n\t// make sure warrior exists\n\t_, warErr := GetBattleWarrior(battleID, warriorID)\n\n\tif warErr != nil {\n\t\tlog.Println(\"error finding warrior : \" + warErr.Error() + \"\\n\")\n\t\tClearWarriorCookies(w)\n\t\tw.WriteHeader(http.StatusUnauthorized)\n\t\treturn\n\t}\n\n\t// upgrade to WebSocket connection\n\tws, err := upgrader.Upgrade(w, r, nil)\n\tif err != nil {\n\t\tlog.Println(err)\n\t\treturn\n\t}\n\n\tc := &connection{send: make(chan []byte, 256), ws: ws}\n\ts := subscription{c, battleID, warriorID}\n\th.register <- s\n\n\tWarriors, _ := AddWarriorToBattle(s.arena, warriorID)\n\tupdatedWarriors, _ := json.Marshal(Warriors)\n\n\tinitEvent := CreateSocketEvent(\"init\", string(battle), warriorID)\n\t_ = c.write(websocket.TextMessage, initEvent)\n\n\tjoinedEvent := CreateSocketEvent(\"warrior_joined\", string(updatedWarriors), warriorID)\n\tm := message{joinedEvent, s.arena}\n\th.broadcast <- m\n\n\tgo s.writePump()\n\ts.readPump()\n}", "title": "" }, { "docid": "14ec4cae2b5dcf8787570137dc6ffd23", "score": "0.5666768", "text": "func serveWs(cID int32, w http.ResponseWriter, r *http.Request) {\n\t//conn, err := upgrader.Upgrade(w, r, nil)\n\tconn, err := (&websocket.Upgrader{\n\t\tCheckOrigin: func(r *http.Request) bool {\n\t\t\treturn true\n\t\t}}).Upgrade(w, r, nil)\n\n\tif err != nil {\n\t\thttp.NotFound(w, r)\n\t\treturn\n\t}\n\tclient := &Client{id: int(cID), conn: conn, send: make(chan []byte, 256)}\n\thub.register <- client\n\n\t// Allow collection of memory referenced by the caller by doing all work in\n\t// new goroutines.\n\tgo client.write()\n\tgo client.read()\n}", "title": "" }, { "docid": "b51a9c59923e3aeced4bc1ee837c19a5", "score": "0.56507367", "text": "func serveWs(pool *websocket.Pool, w http.ResponseWriter, r *http.Request) {\n\tlog.Println(\"new connection from host\", r.Host)\n\tdefer log.Println(\"websocket endpoint end\", r.Host)\n\n\t// upgrade this connection to a WebSocket\n\t// connection\n\tconn, err := websocket.Upgrade(w, r)\n\tif err != nil {\n\t\tlog.Fatal(\"Upgrader problem\", err)\n\t}\n\n\tclient := &websocket.Client{\n\t\tID: clnID,\n\t\tConn: conn,\n\t\tPool: pool,\n\t}\n\tclnID = clnID + 1\n\n\tpool.Register <- client\n\tclient.Read()\n}", "title": "" }, { "docid": "42376129b4822eac1c8dc30276956332", "score": "0.5628247", "text": "func ListenAndServeWebsocketSecure(addr string, cert string, key string) error {\n\treturn http.ListenAndServeTLS(addr, cert, key, nil)\n}", "title": "" }, { "docid": "827a92b8b65e60ead6345712ab3914d2", "score": "0.5626218", "text": "func serveWs(n *node, w http.ResponseWriter, r *http.Request) error {\n\tsock, err := upgrader.Upgrade(w, r, nil)\n\n\tif err != nil {\n\t\treturn err\n\t}\n\n\treturn n.hub.onClientConnected(sock)\n}", "title": "" }, { "docid": "2ca2dad4705d9d877da7c2b1b361477e", "score": "0.5617662", "text": "func webToSocks5Yamux(ws *websocket.Conn) {\n\tconf:=yamux.DefaultConfig();\n\tconf.AcceptBacklog=1024;\n\tconf.KeepAliveInterval=59* time.Second;\n\tconf.MaxStreamWindowSize=512*1024;\n\t// Setup server side of yamux\n\tsession, err := yamux.Server(ws, conf)\n\tif err != nil {\n\t\treturn;\n\t}\n\tfor {\n\t\t// Accept a stream\n\t\tstream, err := session.Accept()\n\t\tif err != nil {\n\t\t\treturn ;\n\t\t}\n\t\tgo proxy(stream)\n\t}\n}", "title": "" }, { "docid": "7484b93be7122bfa1c8a2fbb4cb7f3a4", "score": "0.5608033", "text": "func (req *asanaRequest) IsWebsocket() bool {\n\treturn strings.EqualFold(req.Header(\"Upgrade\"), \"websocket\")\n}", "title": "" }, { "docid": "6854bb81cafe42735bc210c7df08272e", "score": "0.560163", "text": "func wsHandler(msgChan chan []byte, hub *Hub, w http.ResponseWriter, r *http.Request) {\n\tcloseChan := make(chan struct{})\n\tupgrader.CheckOrigin = func(r *http.Request) bool { return true }\n\tconn, err := upgrader.Upgrade(w, r, nil)\n\tif err != nil {\n\t\tlog.Println(err)\n\t\treturn\n\t}\n\t//register client\n\thub.clients[conn] = true\n\tlog.Println(hub.clients)\n\n\tgo writer(closeChan, conn, msgChan)\n\n\tgo reader(closeChan, hub, conn)\n}", "title": "" }, { "docid": "b3fb437ebb1d27c68f0761dd87ca5073", "score": "0.5600346", "text": "func (s *Signal) ServeWebsocket() {\n\tr := mux.NewRouter()\n\n\tupgrader := websocket.Upgrader{\n\t\tCheckOrigin: func(r *http.Request) bool {\n\t\t\treturn true\n\t\t},\n\t\tReadBufferSize: 1024,\n\t\tWriteBufferSize: 1024,\n\t}\n\n\tr.Handle(\"/session/{id}\", http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {\n\t\tvars := mux.Vars(r)\n\t\tsid := vars[\"id\"]\n\n\t\tif s.config.Auth.Enabled {\n\t\t\ttoken, err := authGetAndValidateToken(s.config.Auth, r)\n\t\t\tif err != nil {\n\t\t\t\tlog.Error(err, \"error authenticating token\")\n\t\t\t\thttp.Error(w, \"Invalid Token\", http.StatusForbidden)\n\t\t\t\treturn\n\t\t\t}\n\n\t\t\tlog.Info(\"valid token with claims\", \"token\", token)\n\t\t\tif token.SID != sid {\n\t\t\t\tlog.Error(err, \"invalid claims for session\", \"sessionID\", sid)\n\t\t\t\thttp.Error(w, \"Invalid Token\", http.StatusForbidden)\n\t\t\t\treturn\n\t\t\t}\n\t\t}\n\n\t\tmeta, err := s.c.getOrCreateSession(vars[\"id\"])\n\t\tif err != nil {\n\t\t\tw.WriteHeader(http.StatusInternalServerError)\n\t\t\treturn\n\t\t}\n\n\t\tif meta.Redirect {\n\t\t\tendpoint := fmt.Sprintf(\"%v/session/%v\", meta.NodeEndpoint, meta.SessionID)\n\t\t\turl, err := url.Parse(endpoint)\n\t\t\tif err != nil {\n\t\t\t\tlog.Error(err, \"error parsing backend url to proxy websocket\")\n\t\t\t\treturn\n\t\t\t}\n\t\t\tproxy := websocketproxy.NewProxy(url)\n\t\t\tproxy.Upgrader = &upgrader\n\n\t\t\tlog.Info(\"starting proxy for session\", \"sessionID\", meta.SessionID, \"nodeID\", meta.NodeID, \"endpoint\", endpoint)\n\t\t\tprometheusGaugeProxyClients.Inc()\n\t\t\tproxy.ServeHTTP(w, r)\n\t\t\tprometheusGaugeProxyClients.Dec()\n\t\t\tlog.Info(\"closed proxy for session\", \"sessionID\", meta.SessionID, \"nodeID\", meta.NodeID, \"endpoint\", endpoint)\n\t\t\treturn\n\t\t}\n\n\t\tc, err := upgrader.Upgrade(w, r, nil)\n\t\tif err != nil {\n\t\t\tpanic(err)\n\t\t}\n\t\tdefer c.Close()\n\n\t\tprometheusGaugeClients.Inc()\n\t\tp := JSONSignal{\n\t\t\tsync.Mutex{},\n\t\t\ts.c,\n\t\t\tsfu.NewPeer(s.c),\n\t\t\t\"\",\n\t\t}\n\t\tdefer p.Close()\n\n\t\tjc := jsonrpc2.NewConn(r.Context(), websocketjsonrpc2.NewObjectStream(c), &p)\n\t\t<-jc.DisconnectNotify()\n\t\tprometheusGaugeClients.Dec()\n\t}))\n\n\tr.Handle(\"/metrics\", metricsHandler())\n\tr.Handle(\"/\", http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {\n\t\tw.WriteHeader(http.StatusOK)\n\t}))\n\n\thttp.Handle(\"/\", r)\n\n\tvar err error\n\tif s.config.Key != \"\" && s.config.Cert != \"\" {\n\t\tlog.Info(\"Started JSONRPC Server (https)\", \"listen\", s.config.HTTPAddr)\n\t\terr = http.ListenAndServeTLS(s.config.HTTPAddr, s.config.Cert, s.config.Key, nil)\n\t} else {\n\t\tlog.Info(\"Started JSONRPC Server\", \"listen\", s.config.HTTPAddr)\n\t\terr = http.ListenAndServe(s.config.HTTPAddr, nil)\n\t}\n\n\tif err != nil {\n\t\ts.errChan <- err\n\t}\n}", "title": "" }, { "docid": "b3c1a60e00fc1f88cb480f6ca04b0227", "score": "0.55907255", "text": "func (b *Bitfinex) WsConnect() error {\n\tif !b.Websocket.IsEnabled() || !b.IsEnabled() {\n\t\treturn errors.New(stream.WebsocketNotEnabled)\n\t}\n\n\tvar dialer websocket.Dialer\n\terr := b.Websocket.Conn.Dial(&dialer, http.Header{})\n\tif err != nil {\n\t\treturn fmt.Errorf(\"%v unable to connect to Websocket. Error: %s\",\n\t\t\tb.Name,\n\t\t\terr)\n\t}\n\n\tb.Websocket.Wg.Add(1)\n\tgo b.wsReadData(b.Websocket.Conn)\n\n\tif b.Websocket.CanUseAuthenticatedEndpoints() {\n\t\terr = b.Websocket.AuthConn.Dial(&dialer, http.Header{})\n\t\tif err != nil {\n\t\t\tlog.Errorf(log.ExchangeSys,\n\t\t\t\t\"%v unable to connect to authenticated Websocket. Error: %s\",\n\t\t\t\tb.Name,\n\t\t\t\terr)\n\t\t\tb.Websocket.SetCanUseAuthenticatedEndpoints(false)\n\t\t}\n\t\tb.Websocket.Wg.Add(1)\n\t\tgo b.wsReadData(b.Websocket.AuthConn)\n\t\terr = b.WsSendAuth()\n\t\tif err != nil {\n\t\t\tlog.Errorf(log.ExchangeSys,\n\t\t\t\t\"%v - authentication failed: %v\\n\",\n\t\t\t\tb.Name,\n\t\t\t\terr)\n\t\t\tb.Websocket.SetCanUseAuthenticatedEndpoints(false)\n\t\t}\n\t}\n\n\tb.Websocket.Wg.Add(1)\n\tgo b.WsDataHandler()\n\treturn nil\n}", "title": "" }, { "docid": "39912182a75759b5c78e848c8d2a288c", "score": "0.5581816", "text": "func (h *Hub) serveWs(w http.ResponseWriter, r *http.Request) {\n\tconn, err := upgrader.Upgrade(w, r, nil)\n\tif err != nil {\n\t\treturn\n\t}\n\tclient := &Client{\n\t\thub: h,\n\t\tconn: conn,\n\t\tid: uuid.New().String(),\n\t\tsend: make(chan []byte, 256),\n\t\trchan: make(chan wsRoomActionMessage, 100),\n\t\trooms: make([]string, maxRoomSize),\n\t\tlogger: logger.Get(),\n\t}\n\tclient.rooms = []string{client.id}\n\tclient.hub.register <- client\n\n\t// Allow collection of memory referenced by the caller by doing all work in\n\t// new goroutines.\n\tgo client.roomPump()\n\tgo client.writePump()\n\tgo client.readPump()\n\tclient.sendIdentityMsg()\n\tclient.welcome()\n\n}", "title": "" }, { "docid": "af8e083bcbb2e45449ba57282561484f", "score": "0.55791247", "text": "func WsEndpoint(w http.ResponseWriter, r *http.Request) {\n\tws, err := upgradeConnection.Upgrade(w, r, nil)\n\tif err != nil {\n\t\tlog.Panicln(err)\n\t}\n\n\tlog.Println(\"Client connected to endpoint\")\n\n\tvar res WsJsonResponse\n\n\tres.Message = `<em><small>Connected to server</small></em>`\n\n\tconn := WebSocketConnection{Conn: ws}\n\n\tclients[conn] = \"\"\n\n\terr = ws.WriteJSON(res)\n\tif err != nil {\n\t\tlog.Println(err)\n\t}\n\n\tgo ListenForWs(&conn)\n}", "title": "" }, { "docid": "353b671bbfe880ea07dae24b9ba04fd1", "score": "0.5578069", "text": "func serveWs(w http.ResponseWriter, req *http.Request) {\n\tfmt.Println(\"Registering client to WS\")\n\tif req.Method != \"GET\" {\n\t\thttp.Error(w, \"Method not allowed\", 405)\n\t\treturn\n\t}\n\tws, err := upgrader.Upgrade(w, req, nil)\n\tif err != nil {\n\t\tfmt.Printf(\"Error %+v\\n\", err)\n\t\treturn\n\t}\n\tc := &connection{send: make(chan []byte, 256), ws: ws}\n\th.register <- c\n\tgo c.writePump()\n}", "title": "" }, { "docid": "3846941519a2b1e35382089019057dd2", "score": "0.55682623", "text": "func (b *Binance) WsConnect() error {\n\tif !b.Websocket.IsEnabled() || !b.IsEnabled() {\n\t\treturn errors.New(stream.WebsocketNotEnabled)\n\t}\n\n\tvar dialer websocket.Dialer\n\tvar err error\n\tif b.Websocket.CanUseAuthenticatedEndpoints() {\n\t\tlistenKey, err = b.GetWsAuthStreamKey()\n\t\tif err != nil {\n\t\t\tb.Websocket.SetCanUseAuthenticatedEndpoints(false)\n\t\t\tlog.Errorf(log.ExchangeSys,\n\t\t\t\t\"%v unable to connect to authenticated Websocket. Error: %s\",\n\t\t\t\tb.Name,\n\t\t\t\terr)\n\t\t} else {\n\t\t\t// cleans on failed connection\n\t\t\tclean := strings.Split(b.Websocket.GetWebsocketURL(), \"?streams=\")\n\t\t\tauthPayload := clean[0] + \"?streams=\" + listenKey\n\t\t\terr = b.Websocket.SetWebsocketURL(authPayload, false, false)\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\n\terr = b.Websocket.Conn.Dial(&dialer, http.Header{})\n\tif err != nil {\n\t\treturn fmt.Errorf(\"%v - Unable to connect to Websocket. Error: %s\",\n\t\t\tb.Name,\n\t\t\terr)\n\t}\n\n\tif b.Websocket.CanUseAuthenticatedEndpoints() {\n\t\tgo b.KeepAuthKeyAlive()\n\t}\n\n\tb.Websocket.Conn.SetupPingHandler(stream.PingHandler{\n\t\tUseGorillaHandler: true,\n\t\tMessageType: websocket.PongMessage,\n\t\tDelay: pingDelay,\n\t})\n\n\tenabledPairs, err := b.GetEnabledPairs(asset.Spot)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tfor i := range enabledPairs {\n\t\terr = b.SeedLocalCache(enabledPairs[i])\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\tgo b.wsReadData()\n\n\tsubs, err := b.GenerateSubscriptions()\n\tif err != nil {\n\t\treturn err\n\t}\n\treturn b.Websocket.SubscribeToChannels(subs)\n}", "title": "" }, { "docid": "2e4d8e9dd912b8ab20e629b4b3f63aea", "score": "0.5546998", "text": "func serveWs(w http.ResponseWriter, r *http.Request) {\n\tws, err := upgrader.Upgrade(w, r, nil)\n\tif err != nil {\n\t\tlog.Println(err)\n\t\treturn\n\t}\n\n\tvars := mux.Vars(r)\n\tc := &connection{send: make(chan Payload), ws: ws}\n\n\tif vars == nil {\n\t\ts := subscription{c, \"\"}\n\t\th.register <- s\n\t\tgo s.writePump()\n\t\ts.readPump()\n\n\t} else {\n\t\tlog.Println(\"Room:\" + vars[\"room\"])\n\t\ts := subscription{c, vars[\"room\"]}\n\t\th.register <- s\n\t\tgo s.writePump()\n\t\ts.readPump()\n\t}\n\n}", "title": "" }, { "docid": "bba1e7ff399a2da5a37b3cb8210f9ce7", "score": "0.5540126", "text": "func WriteOnlyWebsocket(connection *websocket.Conn, b *broadcaster.Broadcaster) {\n\t// The underlying connection is never closed so this cannot error\n\tsubscriber, _ := b.Subscribe()\n\tgo readControl(connection, b, subscriber)\n\twrite(connection, subscriber)\n}", "title": "" }, { "docid": "81d76a2c7eb448f37353d100ca271e7e", "score": "0.5535477", "text": "func (s *Server) WebsocketHandler(allowedOrigins []string) http.Handler {\n\tvar upgrader = websocket.Upgrader{\n\t\tReadBufferSize: wsReadBuffer,\n\t\tWriteBufferSize: wsWriteBuffer,\n\t\tWriteBufferPool: wsBufferPool,\n\t\tCheckOrigin: wsHandshakeValidator(allowedOrigins),\n\t}\n\treturn http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {\n\t\tconn, err := upgrader.Upgrade(w, r, nil)\n\t\tif err != nil {\n\t\t\tlog.Debug(\"WebSocket upgrade failed\", \"err\", err)\n\t\t\treturn\n\t\t}\n\t\tcodec := newWebsocketCodec(conn, r.Host, r.Header)\n\t\ts.ServeCodec(codec, 0)\n\t})\n}", "title": "" }, { "docid": "5e7cb2451fe8cb0e130daa6d7726975e", "score": "0.5524518", "text": "func InitWebsocket(s *Server, c *conf.WebsocketConf) (err error) {\n\tmux := s.createServeMux()\n\tgo func() {\n\t\tif err = http.ListenAndServe(c.Bind, mux); err != nil {\n\t\t\tlog.Bg().Panic(\"启动失败:\", zap.Error(err))\n\n\t\t}\n\t}()\n\n\treturn err\n\n}", "title": "" }, { "docid": "c42cdbcfff76cb2bbc7042895e8a252c", "score": "0.552418", "text": "func ServeWs(hub *Hub, gameState *GameState, w http.ResponseWriter, r *http.Request) {\n\tconn, err := upgrader.Upgrade(w, r, nil)\n\tif err != nil {\n\t\tlog.Println(err)\n\t\treturn\n\t}\n\tclient := &Client{\n\t\tconn: conn,\n\t\tgameState: gameState,\n\t\thub: hub,\n\t\tid: uuid.New().String(),\n\t\tmuted: false,\n\t\tsend: make(chan Event, 256),\n\t}\n\n\t// So when the websocket is activated, add/register client to hub\n\tclient.hub.register <- client\n\n\t// Allow collection of memory referenced by the caller by doing all work in\n\t// new goroutines.\n\t// Start read and write operations in goroutines\n\tgo client.writePump()\n\tgo client.readPump()\n}", "title": "" }, { "docid": "9735f0ab0a79ad5bd1c67a948866e57d", "score": "0.54905516", "text": "func serveWs(hub *Hub, w http.ResponseWriter, r *http.Request) {\n\tconn, err := upgrader.Upgrade(w, r, nil)\n\tif err != nil {\n\t\tlog.Println(err)\n\t\treturn\n\t}\n\tclient := &Client{hub: hub, conn: conn, send: make(chan []byte, 256), position: Position{x: 0, y: 0}}\n\tclient.hub.register <- client\n\tgo client.writePump()\n\tclient.readPump()\n}", "title": "" }, { "docid": "292482b6da7be074a1feda69de554c90", "score": "0.54875875", "text": "func ServerWs(hub *Hub, w http.ResponseWriter, r *http.Request) {\n\tconn, err := upgrader.Upgrade(w, r, nil)\n\tif err != nil {\n\t\tLog.Errorf(\"Connet upgrade is err: %v\", err)\n\t\tfmt.Println(err)\n\t\treturn\n\t}\n\n\tLog.Info(\"ServerWs..............\")\n\tuserInfo, err := ParseParms(r)\n\tif err != nil {\n\t\tLog.Errorf(\"Parse parms is err: %v\", err)\n\t\treturn\n\t}\n\n\tclient := &Client{hub: hub,\n\t\tconn: conn,\n\t\tsend: make(chan []byte, conf.Conf.WebsocketConf.ClientSendMax),\n\t\tUser: userInfo}\n\tclient.hub.Register <- client\n\n\t// Allow collection of memory referenced by the caller by doing all work in\n\t// new goroutines.\n\tgo client.writePump()\n\tgo client.readPump()\n}", "title": "" }, { "docid": "1f7b72c31755a231fa2f227ae579b905", "score": "0.5487453", "text": "func websocketProxy(target string) http.Handler {\n\treturn http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {\n\t\td, err := net.Dial(\"tcp\", target)\n\t\tif err != nil {\n\t\t\thttp.Error(w, \"Error contacting backend server.\", 500)\n\t\t\tlog.Printf(\"Error dialing websocket backend %s: %v\", target, err)\n\t\t\treturn\n\t\t}\n\t\tdefer d.Close()\n\t\thj, ok := w.(http.Hijacker)\n\t\tif !ok {\n\t\t\thttp.Error(w, \"Not a hijacker?\", 500)\n\t\t\treturn\n\t\t}\n\t\tnc, _, err := hj.Hijack()\n\t\tif err != nil {\n\t\t\tlog.Printf(\"Hijack error: %v\", err)\n\t\t\treturn\n\t\t}\n\t\tdefer nc.Close()\n\n\t\terr = r.Write(d)\n\t\tif err != nil {\n\t\t\tlog.Printf(\"Error copying request to target: %v\", err)\n\t\t\treturn\n\t\t}\n\n\t\terrc := make(chan error, 2)\n\t\tcp := func(dst io.Writer, src io.Reader) {\n\t\t\t_, err := io.Copy(dst, src)\n\t\t\terrc <- err\n\t\t}\n\t\tgo cp(d, nc)\n\t\tgo cp(nc, d)\n\t\tif err = <-errc; err != nil {\n\t\t\tlog.Print(err)\n\t\t}\n\t})\n}", "title": "" }, { "docid": "c104c13a772227b97b4a98e830e3a468", "score": "0.54826766", "text": "func serveWs(hub *Hub, w http.ResponseWriter, r *http.Request) {\n\tconn, err := upgrader.Upgrade(w, r, nil)\n\tif err != nil {\n\t\tlog.Println(err)\n\t\treturn\n\t}\n session, _ := store.Get(r, \"cookie-name\")\n\tclient := &Client{hub: hub, conn: conn, send: make(chan []byte, 256), user: session.Values[\"user\"].(*pupil)}\n\tclient.hub.register <- client\n\n\t// Allow collection of memory referenced by the caller by doing all work in\n\t// new goroutines.\n\tgo client.writePump()\n\tgo client.readPump()\n}", "title": "" }, { "docid": "65ff51e405e15d8a897844c8f3061cd9", "score": "0.54800993", "text": "func wsHandler(w http.ResponseWriter, r *http.Request) {\n\tlog.Print(\"Started a new websocket handler\")\n\n\tif r.Method != \"GET\" {\n\t\thttp.Error(w, \"Method not allowed\", 405)\n\t\treturn\n\t}\n\n\t// Create a websocket and check it was created properly\n\tws, err := upgrader.Upgrade(w, r, nil)\n\tif _, ok := err.(websocket.HandshakeError); ok {\n\t\thttp.Error(w, \"Not a websocket handshake\", 400)\n\t\treturn\n\t} else if err != nil {\n\t\tlog.Println(\"Error opening socket: \" + err.Error())\n\t\treturn\n\t}\n\n\t// Make a async channel to create the websocket connection\n\t// This will block until the buffer is full\n\tc := &websocketConn{send: make(chan []byte, 256*10), ws: ws}\n\n\t// Register the connection with echo\n\techo.register <- c\n\n\tlog.Println(\"Create Websocket\")\n\n\t// GoRoutine for the writer\n\tgo c.writer()\n\n\tlog.Println(\"Create Websocket writer\")\n\n\t// Reader\n\tc.reader()\n\n\tlog.Println(\"Create Websocket reader\")\n}", "title": "" }, { "docid": "747a1caadc90467cf6e79ab93ce0f5e7", "score": "0.54640746", "text": "func serveWs(w http.ResponseWriter, r *http.Request) {\n vars := mux.Vars(r)\n log.Printf(\"New connection : %s\", vars[\"name\"])\n\n\tif r.Method != \"GET\" {\n\t\thttp.Error(w, \"Method not allowed\", 405)\n\t\treturn\n\t}\n\tws, err := upgrader.Upgrade(w, r, nil)\n\tif err != nil {\n\t\tlog.Println(err)\n\t\treturn\n\t}\n c := &connection{send: make(chan []byte, 256), ws: ws, name: vars[\"name\"]}\n\th.register <- c\n\tgo c.writePump()\n\tc.readPump()\n}", "title": "" }, { "docid": "e7cea8f5ceb14c3227d609edd03785cb", "score": "0.5460577", "text": "func socketHandler(w http.ResponseWriter, r *http.Request) {\n socket.ServeWs(globalRoom, w, r)\n}", "title": "" }, { "docid": "6c317964b047ef0345a1ec8c987e3852", "score": "0.5456756", "text": "func broadcastWebSocket(d TransferData) {\n\tdata, err := json.Marshal(d)\n\tif err != nil {\n\t\tbeego.Error(\"Fail to marshal event:\", err)\n\t\treturn\n\t}\n\n\tfor i, ws := range client {\n\t\terr = ws.WriteMessage(websocket.TextMessage, data)\n\t\tif err != nil {\n\t\t\tfmt.Printf(\"send ws failed, i %d len %d err: %s\\n\", i, len(client), err)\n\t\t\tif i >= len(client) {\n\t\t\t\tclient = client[:0]\n\t\t\t\treturn\n\t\t\t}\n\t\t\tclient = append(client[:i], client[i+1:]...)\n\t\t}\n\t}\n}", "title": "" }, { "docid": "6cd8dfbbc91d8c6bb9b3530b2d81659c", "score": "0.5450877", "text": "func ServeWebSockets(pool *websockets.Pool, w http.ResponseWriter, r *http.Request) {\n\tws, err := websockets.Upgrade(w, r)\n\tif err != nil {\n\t\t//write the output error\n\t\tfmt.Fprintf(w, \"%+v\\n\", err)\n\t}\n\n\tclient := &websockets.Client{\n\t\tConn: ws,\n\t\tPool: pool,\n\t}\n\n\tpool.Register <- client\n\tclient.Read()\n}", "title": "" }, { "docid": "8259faba3c100437e7c282a415a7b476", "score": "0.54489905", "text": "func HandleWebsocket(w http.ResponseWriter, r *http.Request) {\n\n\t//Get the userProfileId from request params\n\tuserProfileID := httprouter.ParamsFromContext(r.Context()).ByName(\"userProfileId\")\n\n\t// Check origin of the request. For now, allowing every request by returning true without checking\n\tupgrader.CheckOrigin = func(r *http.Request) bool { return true }\n\n\t// Upgrade the request to websocket\n\tconn, err := upgrader.Upgrade(w, r, nil)\n\tif err != nil {\n\t\tlog.Println(err)\n\t\treturn\n\t}\n\n\tlog.Println(\"Client with userProfileId: \" + userProfileID + \" connected!\")\n\n\t// Register the client\n\tclient := &Client{userProfileID: userProfileID, conn: conn, send: make(chan models.Message)}\n\tGetHub().register <- client\n\n\t// Read and write messages in new goroutines\n\tgo client.writePump()\n\tgo client.readPump()\n}", "title": "" }, { "docid": "b88a6006a0f30128c749d92a56d64b53", "score": "0.54433995", "text": "func WebSocket(strategies strategy.Strategies, store WebSocketDB, relMe *microformats.RelMe) http.Handler {\n\treturn &webSocketServer{\n\t\tstrategies: strategies,\n\t\tstore: store,\n\t\tconnections: map[*conn]struct{}{},\n\t\trelMe: relMe,\n\t}\n}", "title": "" }, { "docid": "8ee2dbe9d5af15cbf0a53090268f7daf", "score": "0.5440615", "text": "func wsHandler(ws *websocket.Conn) {\n\t// create client object\n\tc := &client.WebSocketClient{Conn: ws}\n\tc.Send = make(chan []byte, 256)\n\n\t// register client in list, and boot up to read/write\n\tWsClients.Register <- c\n\tdefer func() { WsClients.Unregister <- c }()\n\tgo c.Sender()\n\tc.Listener(Manager.Incoming)\n}", "title": "" }, { "docid": "1b0030cc67c986a1061918912786f3f8", "score": "0.5433662", "text": "func WebSocketHandler(c buffalo.Context) error {\n\tvar err error\n\twebsocketConn, err = GetWebsocketConnection(c)\n\tif err != nil {\n\t\treturn nil\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "98c6d65aad0fd5d8107c720eff81f015", "score": "0.54280436", "text": "func main() {\n http.Handle(\"/echo\", websocket.Handler(EchoServer))\n fmt.Println(\"listen at :12345\")\n err := http.ListenAndServe(\":12345\", nil)\n if err != nil {\n panic(\"ListenAndServe: \" + err.Error())\n }\n}", "title": "" }, { "docid": "e060071d7a3d6eb8e475d6e832ab2019", "score": "0.5412896", "text": "func broadcastWebSocket(event models.Event) {\n\tdata, err := json.Marshal(event)\n\tif err != nil {\n\t\tbeego.Error(\"Fail to marshal event:\", err)\n\t\treturn\n\t}\n\n\tfor sub := subscribers.Front(); sub != nil; sub = sub.Next() {\n\t\t// Immediately send event to WebSocket users.\n\t\tws := sub.Value.(Subscriber).Conn\n\t\tif ws != nil {\n\t\t\tif ws.WriteMessage(websocket.TextMessage, data) != nil {\n\t\t\t\t// User disconnected.\n\t\t\t\tunsubscribe <- sub.Value.(Subscriber).Name\n\t\t\t}\n\t\t}\n\t}\n}", "title": "" }, { "docid": "88c61c9f95a70c42b4ad3e5e820f0ac7", "score": "0.54057854", "text": "func (web *WebServer) updateWsClients() {\n\n\tappState, err := web.getAppState()\n\tif err != nil {\n\t\tlog.Println(\"getAppState:\", err)\n\t\treturn\n\t}\n\n\tdata, err := json.Marshal(appState)\n\tif err != nil {\n\t\tlog.Println(err)\n\t}\n\tfor client := range web.wsClients {\n\t\tclient.send <- data\n\t}\n}", "title": "" }, { "docid": "af20524adff54afbbfbe32d4cf0b30cb", "score": "0.5403112", "text": "func (c *Action) IsWebsocket() bool {\r\n\treturn c.Header(\"Upgrade\") == \"websocket\"\r\n}", "title": "" }, { "docid": "a47452db35c53904462124b28a88004e", "score": "0.54005164", "text": "func ListenWsServer(addr string, webdir string, chmgr *oo.ChannelManager,\n\topen_fn func(*oo.WebSock) error, certkey ...string) error {\n\n\tvar http_handler http.Handler\n\tif webdir != \"\" {\n\t\thttp_handler = http.FileServer(http.Dir(webdir))\n\t}\n\n\tmux := http.NewServeMux()\n\tmux.HandleFunc(\"/\", func(w http.ResponseWriter, r *http.Request) {\n\t\tif _, exists := r.Header[\"Upgrade\"]; !exists {\n\t\t\tif http_handler != nil {\n\t\t\t\thttp_handler.ServeHTTP(w, r)\n\t\t\t} else {\n\t\t\t\tw.WriteHeader(http.StatusForbidden)\n\t\t\t}\n\t\t\treturn\n\t\t}\n\t\tif open_fn == nil {\n\t\t\tw.WriteHeader(http.StatusForbidden)\n\t\t\treturn\n\t\t}\n\n\t\tclient, err := oo.InitWebSock(w, r, chmgr, oo.RecvRpcFn)\n\t\tif err != nil {\n\t\t\too.LogD(\"Failed to init ws. err:%v\", err)\n\t\t\treturn\n\t\t}\n\t\tdefer client.Close()\n\n\t\tip := r.RemoteAddr\n\t\tif fw := r.Header.Get(\"X-Forwarded-For\"); fw != \"\" {\n\t\t\tip = fw\n\t\t\tif ips := strings.Split(fw, \", \"); len(ips) > 1 {\n\t\t\t\tip = ips[0]\n\t\t\t}\n\t\t}\n\t\t// if IsAddrReject(ip) {\n\t\t// \too.StatChg(\"reject addr\", 1)\n\t\t// \too.LogD(\"reject %s\", ip)\n\t\t// \treturn\n\t\t// }\n\n\t\tif IsPeerConnected(ip) {\n\t\t\too.StatChg(\"double accept\", 1)\n\t\t\t// oo.LogD(\"cancel double accept. %v\", ip)\n\t\t\treturn\n\t\t}\n\t\too.StatChg(\"active accept\", 1)\n\n\t\tclient.Sess = &oo.Session{\n\t\t\tIp: ip,\n\t\t\tConnid: client.Ch.GetSeq(),\n\t\t}\n\t\t// client.Data = r //for request uri / request header\n\t\tclient.SetOpenHandler(open_fn)\n\n\t\t// client.Data = NodeEvent(types.NSEVENT_ACCEPTED, client)\n\n\t\t//not return\n\t\tclient.RecvRequest()\n\t\too.StatChg(\"active accept\", -1)\n\t})\n\n\tif len(certkey) < 2 || len(certkey[0]) == 0 {\n\t\treturn http.ListenAndServe(addr, mux)\n\t} else {\n\t\treturn http.ListenAndServeTLS(addr, certkey[0], certkey[1], mux)\n\t}\n}", "title": "" }, { "docid": "f33732bfc16cb88551fbee69a006d7ce", "score": "0.5399237", "text": "func (p *pack) appAccessJWT(t *testing.T) {\n\t// Create an application session.\n\tappCookie := p.createAppSession(t, p.jwtAppPublicAddr, p.jwtAppClusterName)\n\n\t// Get JWT.\n\tstatus, token, err := p.makeRequest(appCookie, http.MethodGet, \"/\")\n\trequire.NoError(t, err)\n\trequire.Equal(t, http.StatusOK, status)\n\n\t// Verify JWT token.\n\tverifyJWT(t, p, token, p.jwtAppURI)\n\n\t// Connect to websocket application that dumps the upgrade request.\n\twsCookie := p.createAppSession(t, p.wsHeaderAppPublicAddr, p.wsHeaderAppClusterName)\n\tbody, err := p.makeWebsocketRequest(wsCookie, \"/\")\n\trequire.NoError(t, err)\n\n\t// Parse the upgrade request the websocket application received.\n\treq, err := http.ReadRequest(bufio.NewReader(strings.NewReader(body)))\n\trequire.NoError(t, err)\n\n\t// Extract JWT token from header and verify it.\n\twsToken := req.Header.Get(teleport.AppJWTHeader)\n\trequire.NotEmpty(t, wsToken, \"websocket upgrade request doesn't contain JWT header\")\n\tverifyJWT(t, p, wsToken, p.wsHeaderAppURI)\n}", "title": "" }, { "docid": "c8c22145fa9f8e62a8da74c9007d4eb6", "score": "0.5372331", "text": "func wsListener() {\n\tif err := func() error {\n\t\thttpServeMux := http.NewServeMux()\n\t\thttpServeMux.Handle(\"/pub\", websocket.Handler(WsHandle))\n\t\tvar (\n\t\t\tl net.Listener\n\t\t\terr error\n\t\t)\n\t\tif Conf.Tls {\n\t\t\ttlsConf := new(tls.Config)\n\t\t\ttlsConf.Certificates = make([]tls.Certificate, 1)\n\t\t\ttlsConf.Certificates[0], err = tls.X509KeyPair(Conf.Cert, Conf.Key)\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t\tl, err = tls.Listen(\"tcp\", Conf.WebSocket_addr, tlsConf)\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t\treturn http.Serve(l, httpServeMux)\n\t\t} else {\n\t\t\treturn http.ListenAndServe(Conf.WebSocket_addr, httpServeMux)\n\t\t}\n\t}(); err != nil {\n\t\tpanic(err)\n\t}\n}", "title": "" }, { "docid": "ed4eb9ee9f1e72230e4b0f9237e8d9c3", "score": "0.5368913", "text": "func webToSocks5Smux(ws *websocket.Conn) {\n\tconf:=smux.DefaultConfig();\n\tconf.KeepAliveInterval=59* time.Second;\n\tconf.KeepAliveTimeout=60 * time.Second;\n\t// Setup server side of yamux\n\tsession, err := smux.Server(ws, conf)\n\tif err != nil {\n\t\treturn;\n\t}\n\tfor {\n\t\t// Accept a stream\n\t\tstream, err := session.AcceptStream()\n\t\tif err != nil {\n\t\t\treturn ;\n\t\t}\n\t\tgo proxy(stream)\n\t}\n}", "title": "" }, { "docid": "f3717764c4117e62339d0491c734e15f", "score": "0.5365175", "text": "func ListenAndServeWebsocket(addr string) error {\n\treturn http.ListenAndServe(addr, nil)\n}", "title": "" }, { "docid": "c855869435655e9ac34d8a66675a58b1", "score": "0.5355231", "text": "func asgiWebsocketHandler(w http.ResponseWriter, req *http.Request) (err error) {\n\t// Create a reply channel name.\n\tchannelname, err := createWebsocketReplyChannel()\n\tif err != nil {\n\t\treturn asgi.NewForwardError(\"can not create new channel for websocket send\", err)\n\t}\n\n\t// Send the request to the channel layer.\n\tif err = forwardWebsocketConnection(req, channelname); err != nil {\n\t\tif asgi.IsChannelFullError(err) {\n\t\t\tw.WriteHeader(503)\n\t\t\treturn nil\n\t\t}\n\t\treturn asgi.NewForwardError(\"could not establish websocket connection\", err)\n\t}\n\n\t// Try to receive the answer from the channel layer and open the websocket\n\t// connection, if it tells us to do.\n\tconn, readChan, done, err := receiveAccept(w, req, channelname)\n\tdefer close(done)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"could not establish websocket connection: %s\", err)\n\t}\n\tif conn == nil {\n\t\t// The websocket connection was not opend but no error occurred. In this\n\t\t// case the http response was already send. There is nothing else to do.\n\t\treturn nil\n\t}\n\n\t// The websocket connection was opened. Handle all messages in a loop\n\twebsocketLoop(conn, channelname, readChan, req.URL.Path)\n\treturn nil\n}", "title": "" }, { "docid": "b5ef42e5fc7d4593a5433727d8444b88", "score": "0.534233", "text": "func asgiWebsocketHandler(w http.ResponseWriter, req *http.Request) (err error) {\n\t// Create a reply channel name.\n\tchannel, err := createWebsocketReplyChannel()\n\tif err != nil {\n\t\treturn asgi.NewForwardError(\"can not create new channel for websocket send\", err)\n\t}\n\n\t// Send the request to the channel layer and get the reply channel name.\n\tif err = forwardWebsocketConnection(req, channel); err != nil {\n\t\tif asgi.IsChannelFullError(err) {\n\t\t\tw.WriteHeader(503)\n\t\t\treturn nil\n\t\t}\n\t\treturn asgi.NewForwardError(\"could not establish websocket connection\", err)\n\t}\n\n\t// Try to receive the answer from the channel layer and open the websocket\n\t// connection, if it tells us to do.\n\tconn, err := receiveAccept(w, req, channel)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"could not establish websocket connection: %s\", err)\n\t}\n\tif conn == nil {\n\t\t// The websocket connection was not opend but no error occured. In this\n\t\t// case the http response was already send. There is nothing else to do.\n\t\treturn nil\n\t}\n\n\t// The websocket connection was opened. Handle all messages in a loop\n\twebsocketLoop(conn, channel, req.URL.Path)\n\treturn nil\n}", "title": "" }, { "docid": "51f2398cab2de43698925e749d6c756f", "score": "0.53403914", "text": "func (c *Context) IsWebsocket() bool {\n\treturn c.Header(\"Upgrade\") == \"websocket\"\n}", "title": "" }, { "docid": "fe894abdadc36e09d86ed1f4cae436af", "score": "0.533957", "text": "func connectHandler(w http.ResponseWriter, r *http.Request, ps httprouter.Params) {\n\tlog.Println(\"Attempting to establish WebSocket connection\")\n\n\tid := ps.ByName(\"id\")\n\n\t// upgrade request\n\tsocketMutex.Lock()\n\tif sockets[id] != nil {\n\t\tlog.Println(\"Closing existing socket\")\n\t\tsockets[id].Close()\n\t}\n\tsocketMutex.Unlock()\n\n\tnewSocket, err := upgrader.Upgrade(w, r, nil)\n\tif err != nil {\n\t\tlog.Println(\"Failed to upgrade: \", err)\n\t\treturn\n\t}\n\n\tgo (func() {\n\t\tlog.Printf(\"robot %s is listening for messages\", id)\n\n\t\tfor {\n\t\t\tlog.Printf(\"robot %s blocking\", id)\n\t\t\tmsgType, msg, err := newSocket.ReadMessage()\n\t\t\tlog.Printf(\"got message, msgType: %v, msg: %v, err: %v\", msgType, msg, err)\n\n\t\t\tif err != nil {\n\t\t\t\tlog.Println(\"close\")\n\t\t\t\tbreak\n\t\t\t}\n\n\t\t\tif msgType == websocket.TextMessage {\n\t\t\t\tmsg := string(msg)\n\t\t\t\tlog.Printf(\"got text message: %s\", msg)\n\n\t\t\t\t_, err := infoClient.ButtonPress(context.Background(), &infoserver.ButtonPressEvent{\n\t\t\t\t\tButton: msg,\n\t\t\t\t\tRobotId: id,\n\t\t\t\t})\n\t\t\t\tif err != nil {\n\t\t\t\t\tlog.Printf(\"err sending button press: %v\", err)\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t})()\n\n\tlog.Println(\"Socket opened\")\n\tsocketMutex.Lock()\n\tsockets[id] = newSocket\n\tsocketMutex.Unlock()\n}", "title": "" }, { "docid": "890331451092ed21bae59982b1a6b62e", "score": "0.53350025", "text": "func serveWs(hub *Hub, w http.ResponseWriter, r *http.Request) {\n\tlog.Println(r)\n\tconn, err := upgrader.Upgrade(w, r, nil)\n\tif err != nil {\n\n\t\tlog.Println(err)\n\t\treturn\n\t}\n\thost, _, _ := net.SplitHostPort(r.RemoteAddr)\n\n\tdevice := &device{Type: \"\", Name: \"\", Desc: \"\", State: \"\", Address: host}\n\tclient := &Client{hub: hub, conn: conn, send: make(chan message), device: device}\n\tclient.hub.register <- client\n\n\t// Allow collection of memory referenced by the caller by doing all work in\n\t// new goroutines.\n\tgo client.writePump()\n\tgo client.readPump()\n\n}", "title": "" }, { "docid": "3e6b046d91559f84f2e07981cbafb8d2", "score": "0.53322273", "text": "func (a *ChatHandler) Subscribe(res server.Response, context server.Context) {\n\tconn, err := upgrader.Upgrade(res.GetWriter(), context.GetRequest(), http.Header{\"Sec-WebSocket-Protocol\": {\"access_token\"}})\n\tif err != nil {\n\t\tlogrus.Error(\"Error creating websocket connection\", err)\n\t\tres.Respond(http.StatusInternalServerError)\n\t}\n\ta.connections = append(a.connections, conn)\n\tauthenticated := false\n\tfor {\n\t\tmessageType, reader, err := conn.NextReader()\n\t\tif err != nil {\n\t\t\tlogrus.Error(\"Error processing message\", err)\n\t\t\tbreak\n\t\t}\n\t\tmessageBytes, err := ioutil.ReadAll(reader)\n\n\t\tif err != nil {\n\t\t\tlogrus.Errorf(\"Error reading message from ws: %v\", err)\n\t\t\tcontinue\n\t\t}\n\t\tvar message = new(chatMessage)\n\t\tif err := json.Unmarshal(messageBytes, message); err != nil {\n\t\t\t_ = conn.Close()\n\t\t\tlogrus.Errorf(\"Error reading message from ws: %v\", err)\n\t\t\treturn\n\t\t}\n\t\tif !authenticated && message.MessageType == \"token\" {\n\t\t\tauthenticated = true\n\t\t\tauthToken := message.Content\n\t\t\tuser := new(models.UserWithRoles)\n\t\t\tcontext.GetServer().GetCache().GetStruct(authToken, user)\n\t\t\tif user.UserID == 0 {\n\t\t\t\terr := conn.Close()\n\t\t\t\tif err != nil {\n\t\t\t\t\tlog.Println(\"Error closing connection\", err)\n\t\t\t\t}\n\t\t\t\treturn\n\t\t\t}\n\t\t\tcontinue\n\t\t}\n\t\tif !authenticated {\n\t\t\t_ = conn.Close()\n\t\t\treturn\n\t\t}\n\t\t_ = conn.WriteMessage(messageType, messageBytes)\n\t\tfor _, otherConn := range a.connections {\n\t\t\tif otherConn != conn {\n\t\t\t\t_ = otherConn.WriteMessage(messageType, messageBytes)\n\t\t\t}\n\t\t}\n\t}\n\t_ = conn.Close()\n\n}", "title": "" }, { "docid": "bf0d277098f35b17e8eb0f50a2e0629d", "score": "0.5320519", "text": "func handleWebsocketHandshake(w http.ResponseWriter, r *http.Request) {\n\tconn, err := websocket.Accept(w, r, &websocket.AcceptOptions{})\n\tif err != nil {\n\t\tlog.Printf(\"test server: error accepting websocket handshake: %+v\\n\", err)\n\t}\n\tdefer conn.Close(websocket.StatusNormalClosure, \"\")\n}", "title": "" }, { "docid": "4224a8e300fd71b93056997298345237", "score": "0.53185534", "text": "func (s *Server) WebsocketHandler(conn *websocket.Conn, remoteAddr string,\n\tauthenticated bool, isAdmin bool) {\n\n\t// Clear the read deadline that was set before the websocket hijacked\n\t// the connection.\n\tconn.SetReadDeadline(timeZeroVal)\n\n\t// Limit max number of websocket clients.\n\tlog.Infof(\"New websocket client %s\", remoteAddr)\n\tif s.ntfnMgr.NumClients()+1 > s.cfg.RPCMaxWebsockets {\n\t\tlog.Infof(\"Max websocket clients exceeded [%d] - \"+\n\t\t\t\"disconnecting client %s\", s.cfg.RPCMaxWebsockets,\n\t\t\tremoteAddr)\n\t\tconn.Close()\n\t\treturn\n\t}\n\n\t// Create a new websocket client to handle the new websocket connection\n\t// and wait for it to shutdown. Once it has shutdown (and hence\n\t// disconnected), remove it and any notifications it registered for.\n\tclient, err := newWebsocketClient(s, conn, remoteAddr, authenticated, isAdmin)\n\tif err != nil {\n\t\tlog.Errorf(\"Failed to serve client %s: %s\", remoteAddr, err)\n\t\tconn.Close()\n\t\treturn\n\t}\n\ts.ntfnMgr.AddClient(client)\n\tclient.Start()\n\tclient.WaitForShutdown()\n\ts.ntfnMgr.RemoveClient(client)\n\tlog.Infof(\"Disconnected websocket client %s\", remoteAddr)\n}", "title": "" }, { "docid": "9f29c88cade8eb2d099a72536db70908", "score": "0.5315702", "text": "func StartWebsocket() error {\n\tfor _, bind := range Conf.WebsocketBind {\n\t\tlog.Info(\"start websocket listen addr:\\\"%s\\\"\", bind)\n\t\tgo websocketListen(bind)\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "11f91b1025125fdcaa8ff53515e14923", "score": "0.5314518", "text": "func TestWsAuth(t *testing.T) {\n\tt.Parallel()\n\tif !p.Websocket.IsEnabled() && !p.API.AuthenticatedWebsocketSupport || !sharedtestvalues.AreAPICredentialsSet(p) {\n\t\tt.Skip(stream.WebsocketNotEnabled)\n\t}\n\tvar dialer websocket.Dialer\n\terr := p.Websocket.Conn.Dial(&dialer, http.Header{})\n\tif err != nil {\n\t\tt.Fatal(err)\n\t}\n\tgo p.wsReadData()\n\tcreds, err := p.GetCredentials(context.Background())\n\tif err != nil {\n\t\tt.Fatal(err)\n\t}\n\terr = p.wsSendAuthorisedCommand(creds.Secret, creds.Key, \"subscribe\")\n\tif err != nil {\n\t\tt.Fatal(err)\n\t}\n\ttimer := time.NewTimer(sharedtestvalues.WebsocketResponseDefaultTimeout)\n\tselect {\n\tcase response := <-p.Websocket.DataHandler:\n\t\tt.Error(response)\n\tcase <-timer.C:\n\t}\n\ttimer.Stop()\n}", "title": "" }, { "docid": "ec0dc0626fced69afe28743c041a49e0", "score": "0.53141254", "text": "func (r *Router) HandleWebsocket(c *websocket.Conn) {\n\tu, err := url.Parse(c.LocalAddr().String())\n\tif err != nil {\n\t\tlog.Println(err)\n\t\treturn\n\t}\n\n\t// split url path into components, e.g.\n\t// url: http://leeps.ucsc.edu/redwood/session/1/subject1@example.com\n\t// path: /redwood/session/1/subject1@example.com\n\t// -> [redwood, session, 1, subject1@example.com]\n\tcomponents := strings.Split(u.Path, \"/\")\n\n\t// map components into instance_prefix, session_id, and subject_name\n\tvar instance, session_id_string, subject_name string\n\tif len(components) >= 4 {\n\t\tinstance = components[1]\n\t\tsession_id_string = components[2]\n\t\tsubject_name = components[3]\n\t} else {\n\t\tsession_id_string = components[1]\n\t\tsubject_name = components[2]\n\t}\n\n\tsession_id, err := strconv.Atoi(session_id_string)\n\tif err != nil {\n\t\tlog.Println(err)\n\t\treturn\n\t}\n\n\tvar subject *Subject\n\tif subject_name == \"admin\" || subject_name == \"listener\" {\n\t\tsubject = &Subject{name: subject_name, period: -1, group: -1}\n\t} else {\n\t\t// put in a request to the server loop for the given subject object\n\t\t// this ensures only one subject object exists per session/name pair\n\t\trequest := &SubjectRequest{instance: instance, session: session_id, name: subject_name, response: make(chan *Subject)}\n\t\tr.requestSubject <- request\n\t\tsubject = <-request.response\n\t}\n\tif subject == nil {\n\t\tlog.Panicln(\"nil subject\")\n\t}\n\n\tlistener := NewListener(r, instance, session_id, subject, c)\n\tack := make(chan bool)\n\tr.newListeners <- &ListenerRequest{listener, ack}\n\t// wait for listener to be registered before starting sync\n\t<-ack\n\n\tlog.Printf(\"STARTED SYNC: %s\\n\", subject.name)\n\tlistener.Sync()\n\tlog.Printf(\"FINISHED SYNC: %s\\n\", subject.name)\n\n\tgo listener.SendLoop()\n\tlistener.ReceiveLoop()\n}", "title": "" }, { "docid": "4200601d915610a60ec89dcfeed5d855", "score": "0.5313652", "text": "func ServeWs(server *Server, w http.ResponseWriter, r *http.Request) {\n\tconn, err := upgrader.Upgrade(w, r, nil)\n\tif err != nil {\n\t\tlog.Println(err)\n\t\treturn\n\t}\n\tlog.Println(\"Client connected\")\n\n\tc := &Connection{\n\t\tserver: server,\n\t\tconn: conn,\n\t\tsend: make(chan []byte, 256),\n\t\tsubscriptions: make(map[string]*PublicationContext),\n\t}\n\tc.server.register <- c\n\n\t// Start connection go routines\n\tc.run()\n}", "title": "" }, { "docid": "c32ec1d6d8a120c9484459073f12fec1", "score": "0.5302866", "text": "func (bot *Engine) WebsocketRoutine() {\n\tif bot.Settings.Verbose {\n\t\tlog.Debugln(log.WebsocketMgr, \"Connecting exchange websocket services...\")\n\t}\n\n\texchanges := bot.GetExchanges()\n\tfor i := range exchanges {\n\t\tgo func(i int) {\n\t\t\tif exchanges[i].SupportsWebsocket() {\n\t\t\t\tif bot.Settings.Verbose {\n\t\t\t\t\tlog.Debugf(log.WebsocketMgr,\n\t\t\t\t\t\t\"Exchange %s websocket support: Yes Enabled: %v\\n\",\n\t\t\t\t\t\texchanges[i].GetName(),\n\t\t\t\t\t\tcommon.IsEnabled(exchanges[i].IsWebsocketEnabled()),\n\t\t\t\t\t)\n\t\t\t\t}\n\n\t\t\t\tws, err := exchanges[i].GetWebsocket()\n\t\t\t\tif err != nil {\n\t\t\t\t\tlog.Errorf(\n\t\t\t\t\t\tlog.WebsocketMgr,\n\t\t\t\t\t\t\"Exchange %s GetWebsocket error: %s\\n\",\n\t\t\t\t\t\texchanges[i].GetName(),\n\t\t\t\t\t\terr,\n\t\t\t\t\t)\n\t\t\t\t\treturn\n\t\t\t\t}\n\n\t\t\t\t// Exchange sync manager might have already started ws\n\t\t\t\t// service or is in the process of connecting, so check\n\t\t\t\tif ws.IsConnected() || ws.IsConnecting() {\n\t\t\t\t\treturn\n\t\t\t\t}\n\n\t\t\t\t// Data handler routine\n\t\t\t\tgo bot.WebsocketDataReceiver(ws)\n\n\t\t\t\tif ws.IsEnabled() {\n\t\t\t\t\terr = ws.Connect()\n\t\t\t\t\tif err != nil {\n\t\t\t\t\t\tlog.Errorf(log.WebsocketMgr, \"%v\\n\", err)\n\t\t\t\t\t}\n\t\t\t\t\terr = ws.FlushChannels()\n\t\t\t\t\tif err != nil {\n\t\t\t\t\t\tlog.Errorf(log.WebsocketMgr, \"Failed to subscribe: %v\\n\", err)\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t} else if bot.Settings.Verbose {\n\t\t\t\tlog.Debugf(log.WebsocketMgr,\n\t\t\t\t\t\"Exchange %s websocket support: No\\n\",\n\t\t\t\t\texchanges[i].GetName(),\n\t\t\t\t)\n\t\t\t}\n\t\t}(i)\n\t}\n}", "title": "" }, { "docid": "7bc4959db8e9486315c4ba2041cd7567", "score": "0.5285581", "text": "func (e *tokenEndpoint) ws(input interface{}, c *ws.Client) {\n\t// it means that we can handle not only WebSocketPayload but other Payloads as well\n\tmsg := &types.WebsocketEvent{}\n\tbytes, _ := json.Marshal(input)\n\tif err := json.Unmarshal(bytes, &msg); err != nil {\n\t\tlogger.Error(err)\n\t\tc.SendMessage(ws.TokenChannel, types.ERROR, err.Error())\n\t}\n\n\tswitch msg.Type {\n\tcase \"GET_TOKENS\":\n\t\te.handleGetTokensWS(msg, c)\n\t\tlog.Printf(\"Data: %+v\", msg)\n\tdefault:\n\t\tlog.Print(\"Response with error\")\n\t}\n\n}", "title": "" }, { "docid": "dd82f204bc9cc468b133e0cd82b06ba6", "score": "0.5283906", "text": "func (g *server) connect(w http.ResponseWriter, req *http.Request) error {\n\tgadget, err := g.gadget(req)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tif err := g.register(gadget); err != nil {\n\t\treturn err\n\t}\n\n\tws := make(chan schema.Message)\n\tq := make(chan bool)\n\n\tch := make(chan schema.Message)\n\tuuid := schema.UUID()\n\tg.clients.Add(gadget.URL, uuid, ch)\n\n\tupgrader := websocket.Upgrader{\n\t\tReadBufferSize: 1024,\n\t\tWriteBufferSize: 1024,\n\t\tCheckOrigin: func(r *http.Request) bool { return true },\n\t}\n\n\tconn, err := upgrader.Upgrade(w, req, nil)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tgo listen(conn, ws, q)\n\n\tfor {\n\t\tselect {\n\t\tcase msg := <-ws: // user is sending a command\n\t\t\tif err := gadget.Send(msg); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\tcase msg := <-ch: // gadget is sending an update to all those that care.\n\t\t\tsendSocketMessage(conn, msg)\n\t\tcase <-q: // user has left the page where the websocket lived.\n\t\t\tg.clients.Delete(gadget.URL, uuid)\n\t\t\treturn nil\n\t\t}\n\t}\n}", "title": "" }, { "docid": "87e4155f74c35a6d6b436cb661887a14", "score": "0.52755994", "text": "func websocketaction(name string) *route.Route_Route {\n\tc := clusteraction(name)\n\tc.Route.UseWebsocket = &types.BoolValue{Value: true}\n\treturn c\n}", "title": "" }, { "docid": "d4d21cbd8146c263a8dd63cf3feb2b73", "score": "0.5265918", "text": "func (b *Binance) WsConnect() error {\n\tif !b.Websocket.IsEnabled() || !b.IsEnabled() {\n\t\treturn errors.New(wshandler.WebsocketNotEnabled)\n\t}\n\n\tvar dialer websocket.Dialer\n\tvar err error\n\tif b.Websocket.CanUseAuthenticatedEndpoints() {\n\t\tlistenKey, err = b.GetWsAuthStreamKey()\n\t\tif err != nil {\n\t\t\tb.Websocket.SetCanUseAuthenticatedEndpoints(false)\n\t\t\tlog.Errorf(log.ExchangeSys, \"%v unable to connect to authenticated Websocket. Error: %s\", b.Name, err)\n\t\t}\n\t}\n\n\tpairs := b.GetEnabledPairs(asset.Spot).Strings()\n\ttick := strings.ToLower(\n\t\tstrings.Replace(\n\t\t\tstrings.Join(pairs, \"@ticker/\"), \"-\", \"\", -1)) + \"@ticker\"\n\ttrade := strings.ToLower(\n\t\tstrings.Replace(\n\t\t\tstrings.Join(pairs, \"@trade/\"), \"-\", \"\", -1)) + \"@trade\"\n\tkline := strings.ToLower(\n\t\tstrings.Replace(\n\t\t\tstrings.Join(pairs, \"@kline_1m/\"), \"-\", \"\", -1)) + \"@kline_1m\"\n\tdepth := strings.ToLower(\n\t\tstrings.Replace(\n\t\t\tstrings.Join(pairs, \"@depth/\"), \"-\", \"\", -1)) + \"@depth\"\n\n\twsurl := b.Websocket.GetWebsocketURL() +\n\t\t\"/stream?streams=\" +\n\t\ttick +\n\t\t\"/\" +\n\t\ttrade +\n\t\t\"/\" +\n\t\tkline +\n\t\t\"/\" +\n\t\tdepth\n\tif listenKey != \"\" {\n\t\twsurl += \"/\" +\n\t\t\tlistenKey\n\t}\n\n\tb.WebsocketConn.URL = wsurl\n\tb.WebsocketConn.Verbose = b.Verbose\n\n\terr = b.WebsocketConn.Dial(&dialer, http.Header{})\n\tif err != nil {\n\t\treturn fmt.Errorf(\"%v - Unable to connect to Websocket. Error: %s\",\n\t\t\tb.Name,\n\t\t\terr)\n\t}\n\tb.WebsocketConn.SetupPingHandler(wshandler.WebsocketPingHandler{\n\t\tUseGorillaHandler: true,\n\t\tMessageType: websocket.PongMessage,\n\t\tDelay: pingDelay,\n\t})\n\n\tenabledPairs := b.GetEnabledPairs(asset.Spot)\n\tfor i := range enabledPairs {\n\t\terr = b.SeedLocalCache(enabledPairs[i])\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\tgo b.wsReadData()\n\tgo b.KeepAuthKeyAlive()\n\treturn nil\n}", "title": "" }, { "docid": "c67828a0154c9982e28bcf3dee6f621e", "score": "0.526385", "text": "func main() {\n\tosoServer := os.Args[1] // api.starter-us-east-2a.openshift.com\n\tosoNamespace := os.Args[2] // nvirani-preview\n\tosoToken := os.Args[3]\n\n\taddr := osoServer\n\t// path := fmt.Sprintf(\"/oapi/v1/namespaces/%s/buildconfigs\", osoNamespace)\n\tpath := fmt.Sprintf(\"/oapi/v1/namespaces/%s/builds\", osoNamespace)\n\n\tu := url.URL{Scheme: \"wss\", Host: addr, Path: path, RawQuery: \"watch=true\"}\n\treqHeader := http.Header{\n\t\t\"Authorization\": {fmt.Sprintf(\"Bearer %s\", osoToken)},\n\t\t\"Origin\": {\"localhost:8080\"},\n\t}\n\n\tlog.Printf(\"Connecting to url:%s\", u.String())\n\tc, _, err := websocket.DefaultDialer.Dial(u.String(), reqHeader)\n\tif err != nil {\n\t\tlog.Fatal(\"dial:\", err)\n\t}\n\tdefer c.Close()\n\n\tfor i := 0; ; i++ {\n\t\tstart := time.Now()\n\t\t_, msg, err := c.ReadMessage()\n\t\tif err != nil {\n\t\t\tlog.Printf(\"Got err:%s, after=%f sec\", err, time.Since(start).Seconds())\n\t\t\tbreak\n\t\t}\n\t\t// log.Printf(\"msg-%d:%s\", (i + 1), string(msg))\n\t\tlog.Printf(\"Got msg-%d, with len=%d, after=%f sec\", (i + 1), len(msg), time.Since(start).Seconds())\n\t}\n}", "title": "" }, { "docid": "67fcc6ffe81ac685b38ad0bcfec42678", "score": "0.52377814", "text": "func ServeWs(wsServer *WsServer, w http.ResponseWriter, r *http.Request) {\n\tname, ok := r.URL.Query()[\"name\"]\n\n\tif !ok || len(name[0]) < 1 {\n\t\tlog.Println(\"Url Param 'name' is missing\")\n\t\treturn\n\t}\n\n\t// 从http升级为websocket协议,并返回websocket链接\n\tconn, err := upgrader.Upgrade(w, r, nil)\n\tif err != nil {\n\t\tlog.Println(err)\n\t\treturn\n\t}\n\n\tclient := newClient(conn, wsServer, name[0])\n\n\tgo client.readPump()\n\tgo client.writePump()\n\n\twsServer.register <- client\n}", "title": "" } ]
8d8b9a8e8003036e22888598ada6f36d
IsAlphabet tests a rune if it is a character in alphabet [azAZ].
[ { "docid": "92a4a06a5211ed8554c5d2d16e5384c3", "score": "0.8618838", "text": "func IsAlphabet(r rune) bool {\n\treturn (r >= 'a' && r <= 'z') || (r >= 'A' && r <= 'Z')\n}", "title": "" } ]
[ { "docid": "45059a0a2b45b08994d66b92bb0b1dac", "score": "0.7954284", "text": "func isAlphabet(s string) bool {\n\tif len(s) == utf8.RuneCountInString(s) {\n\t\treturn true\n\t}\n\treturn false\n}", "title": "" }, { "docid": "06900ef056fd7d8fde4fe7936cdbe5e9", "score": "0.79436994", "text": "func isLetter(ch rune) bool { return (ch >= 'a' && ch <= 'z') || (ch >= 'A' && ch <= 'Z') }", "title": "" }, { "docid": "06900ef056fd7d8fde4fe7936cdbe5e9", "score": "0.79436994", "text": "func isLetter(ch rune) bool { return (ch >= 'a' && ch <= 'z') || (ch >= 'A' && ch <= 'Z') }", "title": "" }, { "docid": "4c2498cfb597572325125b6f433ef769", "score": "0.7862851", "text": "func isAlphabet(r rune) bool {\n\tif !unicode.IsLetter(r) {\n\t\treturn false\n\t}\n\n\tswitch {\n\t// Quick check for non-CJK character.\n\tcase r < minCJKCharacter:\n\t\treturn true\n\n\t// Common CJK characters.\n\tcase r >= '\\u4E00' && r <= '\\u9FCC':\n\t\treturn false\n\n\t// Rare CJK characters.\n\tcase r >= '\\u3400' && r <= '\\u4D85':\n\t\treturn false\n\n\t// Rare and historic CJK characters.\n\tcase r >= '\\U00020000' && r <= '\\U0002B81D':\n\t\treturn false\n\t}\n\n\treturn true\n}", "title": "" }, { "docid": "e06829cfbcc684079ec409037e15968a", "score": "0.7778948", "text": "func IsAlphabet(value string) bool {\n\tfor _, s := range value {\n\t\tif !unicode.IsLetter(s) {\n\t\t\treturn false\n\t\t}\n\t}\n\treturn true\n}", "title": "" }, { "docid": "1e7acc6d50cf50735297e3e01c8323eb", "score": "0.7334215", "text": "func (*GuluRune) IsLetter(r rune) bool {\n\treturn 'a' <= r && 'z' >= r || 'A' <= r && 'Z' >= r\n}", "title": "" }, { "docid": "c3ecde8b13555503838325594996fc6d", "score": "0.7328297", "text": "func isLetter(ch byte) bool {\n\treturn 'a' <= ch && ch <= 'z' || 'A' <= ch && ch <= 'Z' || ch == '_'\n}", "title": "" }, { "docid": "bd430827609078ec1233dbafcb401127", "score": "0.73257345", "text": "func isLetter(ch rune) bool {\n\treturn unicode.IsLetter(ch)\n}", "title": "" }, { "docid": "ee246cab86286ea46846d6e28a04c08b", "score": "0.73085356", "text": "func isLetter(ch rune) bool {\n\treturn 'a' <= ch && ch <= 'z' || 'A' <= ch && ch <= 'Z' || ch == '_' || ch >= 0x80 && unicode.IsLetter(ch)\n}", "title": "" }, { "docid": "a96191b6e0f080f73d32b36674ac4072", "score": "0.7306181", "text": "func isLetter(ch rune) bool {\n\treturn unicode.IsLetter(ch) || unicode.IsPunct(ch)\n}", "title": "" }, { "docid": "78da70ac2a8900a3313f214d2b3eb1e6", "score": "0.7304647", "text": "func IsLetter(ch byte) bool {\n\treturn 'a' <= ch && ch <= 'z' || 'A' <= ch && ch <= 'Z' || ch == '_'\n}", "title": "" }, { "docid": "faac6ce3e624bae26fb184ece3a2357e", "score": "0.72807515", "text": "func isLetter(s string) bool {\n\treturn s == \"a\" || s == \"b\" || s == \"c\" || s == \"d\" || s == \"e\" || s == \"f\" || s == \"g\" || s == \"h\"\n}", "title": "" }, { "docid": "6636c254dea18c595ea96e6a36dab812", "score": "0.7233715", "text": "func isLetter(ch rune) bool {\n\treturn 'a' <= ch && ch <= 'z' || 'A' <= ch && ch <= 'Z' || ch == '_' || ch >= utf8.RuneSelf && unicode.IsLetter(ch)\n}", "title": "" }, { "docid": "ba4114430b1ae953122068dadb256ad7", "score": "0.72150064", "text": "func isLetter(c rune) bool {\n\treturn unicode.IsLetter(c)\n}", "title": "" }, { "docid": "fe96c41783a8b78e17545e9e8b8ae94b", "score": "0.7204551", "text": "func isLetter(char string) bool {\n\tif char == \"\" {\n\t\treturn false\n\t}\n\tletter := []rune(char)[0]\n\tif letter >= 'a' && letter <= 'z' {\n\t\treturn true\n\t}\n\treturn false\n}", "title": "" }, { "docid": "d51c852386c60896db6803c0a097a701", "score": "0.71900845", "text": "func IsLetter(l uint8) bool {\n\tn := (l | 0x20) - 'a'\n\tif n >= 0 && n < 26 {\n\t\treturn true\n\t}\n\treturn false\n}", "title": "" }, { "docid": "b01c625c0b1467817d563050add3850d", "score": "0.7175088", "text": "func (I *Detector) isLetter(r rune) bool {\n\treturn (r >= 'a' && r <= 'z') || (r >= 'A' && r <= 'Z')\n}", "title": "" }, { "docid": "5c53785c5517609f337f5de800a22005", "score": "0.7163476", "text": "func IsLetter(r rune) bool {\n\treturn is(letter, r)\n}", "title": "" }, { "docid": "ca5fee4e471544d85343505a062593c5", "score": "0.7142569", "text": "func isLetter(r rune) bool {\n\treturn 'a' <= r && r <= 'z' || 'A' <= r && r <= 'Z' || r == '_' ||\n\t\tr >= 0x80 && unicode.IsLetter(r)\n}", "title": "" }, { "docid": "334642f264cc62cbe56f91f8bdeb3dbd", "score": "0.71370995", "text": "func isLetter(char byte) bool {\n\treturn ('a' <= char && char <= 'z') || ('A' <= char && char <= 'Z') || char == '_'\n}", "title": "" }, { "docid": "f0d89d72352c866b560146a45e74b856", "score": "0.7109022", "text": "func isLetter(letter byte) bool {\n\tisCapital := letter <= upperLetterIndexCap && letter >= lowerLetterIndexCap\n\tisSmall := letter <= upperLetterIndexSmall && letter >= lowerLetterIndexSmall\n\n\tif !isCapital && !isSmall {\n\t\treturn false\n\t}\n\treturn true\n}", "title": "" }, { "docid": "ff5280215a0198aa1620d08efe830950", "score": "0.7027779", "text": "func IsLetter(val byte) bool {\n\tif (val >= 'a' && val <= 'z') || (val >= 'A' && val <= 'Z') || (val == '_') {\n\t\treturn true\n\t}\n\treturn false\n}", "title": "" }, { "docid": "58e275b328fabc401a8324bf2438543f", "score": "0.7002833", "text": "func isAlpha(char byte) bool {\n\treturn ('a' <= char && char <= 'z') || ('A' <= char && char <= 'Z')\n}", "title": "" }, { "docid": "e9ef460be0ecff4e9ede131cfbe39e6f", "score": "0.6998887", "text": "func IsLetter(s string) bool {\n\tfor _, r := range s {\n\t\tif (r < 'a' || r > 'z') && (r < 'A' || r > 'Z') {\n\t\t\treturn false\n\t\t}\n\t}\n\treturn true\n}", "title": "" }, { "docid": "97c7413f921a6b842fdfb6e5b88a8a70", "score": "0.68648875", "text": "func isAlpha(c rune) bool {\n\n\treturn (c >= 'a' && c <= 'z') ||\n\t\t(c >= 'A' && c <= 'Z') || c == '_'\n}", "title": "" }, { "docid": "9fa5f6e65a8bb880f82e0405b2a6f6fe", "score": "0.68580616", "text": "func validateInputMatchesAlphabet(toValidate string) {\n\tfor _, r := range toValidate {\n\t\tisNotLetter := (r < 'a' || r > 'z') && (r < 'A' || r > 'Z')\n\t\tisNotBraces := (r != '{') && (r != '}')\n\t\tisNotComma := r != ','\n\t\tif isNotLetter && isNotBraces && isNotComma {\n\t\t\t// If character is not any, fail\n\t\t\tos.Exit(1)\n\t\t}\n\t}\n}", "title": "" }, { "docid": "e73451c8d9d1aac3ef6e0490fcd6afb9", "score": "0.68489397", "text": "func isAlpha(c rune) bool {\n\treturn c == '_' || 'a' <= c && c <= 'z' || 'A' <= c && c <= 'Z'\n}", "title": "" }, { "docid": "63129e0e9abf6368dae0b0911119232c", "score": "0.684488", "text": "func isAlpha(b byte) bool {\n\treturn (b >= 'a' && b <= 'z') || (b >= 'A' && b <= 'Z')\n}", "title": "" }, { "docid": "cd72f196b764e63a8bb6c589961a2b6a", "score": "0.67921853", "text": "func IsLetter(s string) bool {\n\tfor _, r := range s {\n\t\tif !unicode.IsLetter(r) {\n\t\t\treturn false\n\t\t}\n\t}\n\treturn true\n}", "title": "" }, { "docid": "1e1dfe84ad41dde3ef8378f1b710a911", "score": "0.6783208", "text": "func IsAlpha(r rune) bool {\n\treturn unicode.IsLetter(r)\n}", "title": "" }, { "docid": "1e1dfe84ad41dde3ef8378f1b710a911", "score": "0.6783208", "text": "func IsAlpha(r rune) bool {\n\treturn unicode.IsLetter(r)\n}", "title": "" }, { "docid": "1e1dfe84ad41dde3ef8378f1b710a911", "score": "0.6783208", "text": "func IsAlpha(r rune) bool {\n\treturn unicode.IsLetter(r)\n}", "title": "" }, { "docid": "1e1dfe84ad41dde3ef8378f1b710a911", "score": "0.6783208", "text": "func IsAlpha(r rune) bool {\n\treturn unicode.IsLetter(r)\n}", "title": "" }, { "docid": "3e0d568be0d04941717e97dddddd8b10", "score": "0.6780102", "text": "func IsLetter(s string) bool {\n\tr, _ := regexp.Compile(`[A-Za-z]+`)\n\n\tif r.FindString(s) == \"\" {\n\t\treturn false\n\t}\n\n\treturn true\n}", "title": "" }, { "docid": "24e7cb07d5393e39767e0fce9a2ad549", "score": "0.6777595", "text": "func (s *Scanner) isAlpha(char string) bool {\n\treturn char >= \"a\" && char <= \"z\" || char >= \"A\" && char <= \"Z\" || char == \"_\"\n}", "title": "" }, { "docid": "0f75f3f802eddc740a97aa55880897e8", "score": "0.6751065", "text": "func isAlpha(r rune) bool {\n\treturn r == '_' || unicode.IsLetter(r)\n}", "title": "" }, { "docid": "1eb9403f3c55dc33c5c02d47ff94cad3", "score": "0.673047", "text": "func isalpha(c byte) bool {\n\treturn (c >= 97 && c <= 122) || (c >= 65 && c <= 90)\n}", "title": "" }, { "docid": "7073a515dec812a0594c42b71e778190", "score": "0.67038965", "text": "func IsLatinAlpha(r rune) bool {\n\treturn (r >= 'a' && r <= 'z') || (r >= 'A' && r <= 'Z')\n}", "title": "" }, { "docid": "9fc8e7a83fa478a4206729989abe4621", "score": "0.6703096", "text": "func isLetter(input []byte) bool {\n\ts := string(input)\n\tfor _, r := range s {\n\t\tif !unicode.IsLetter(r) {\n\t\t\treturn false\n\t\t}\n\t}\n\treturn true\n}", "title": "" }, { "docid": "d00a93f71aad57345dd348253554e502", "score": "0.66174495", "text": "func isAlpha (str string) bool {\n for _, char := range str {\n if !unicode.IsLetter (char) { return false }\n }\n return true\n}", "title": "" }, { "docid": "28a8cae1a53f7c06523b5c2eace5bf32", "score": "0.65804064", "text": "func containsLetter(remark string) bool {\n\tfor _, r := range remark {\n\t\tif (r > 'A' && r < 'Z') || (r > 'a' && r < 'z') {\n\t\t\treturn true\n\t\t}\n\t}\n\treturn false\n}", "title": "" }, { "docid": "1ca34f97353b50e153c2fa26b598a5fe", "score": "0.65487754", "text": "func isASCIILower(c byte) bool {\n\treturn 'a' <= c && c <= 'z'\n}", "title": "" }, { "docid": "1ca34f97353b50e153c2fa26b598a5fe", "score": "0.65487754", "text": "func isASCIILower(c byte) bool {\n\treturn 'a' <= c && c <= 'z'\n}", "title": "" }, { "docid": "8a680d4ad592c52c99d7f14be767180b", "score": "0.6441032", "text": "func isAlnum(c rune) bool {\n\treturn c == '_' || unicode.IsLetter(c) || unicode.IsDigit(c) \n}", "title": "" }, { "docid": "5649bf9398f56e035367b53fd1c45ca7", "score": "0.63892144", "text": "func IsValidEnglishAlphabet(text string) bool {\n\treturn regexEnglishAlphabet.MatchString(text)\n}", "title": "" }, { "docid": "f899167dc08528dc6d0dc5fbe9f3f5cd", "score": "0.6374084", "text": "func IsAlpha(s string) bool {\n\tfor _, r := range s {\n\t\tif !unicode.IsLetter(r) {\n\t\t\treturn false\n\t\t}\n\t}\n\n\treturn len(s) > 0\n}", "title": "" }, { "docid": "8d2854e6502640dc09ce4aeda4df7ded", "score": "0.636813", "text": "func (r CharRecipe) Alphabet() string {\n\ts := r.buildCharacterList()\n\tsort.Strings(s)\n\treturn strings.Join(s, \"\")\n}", "title": "" }, { "docid": "e70c9fcdda6762c5b7696bd02fd3ab0f", "score": "0.63465685", "text": "func isAlphaNum(c rune) bool {\n\treturn isAlpha(c) || isNum(c)\n}", "title": "" }, { "docid": "463f954592e89154dbe4654132f6f2bd", "score": "0.6316136", "text": "func HasLetter(s string) bool {\n\tfor _, r := range s {\n\t\tif unicode.IsLetter(r) {\n\t\t\treturn true\n\t\t}\n\t}\n\treturn false\n}", "title": "" }, { "docid": "075db1b8afe51b19b9f40dbddce5e6cd", "score": "0.6306241", "text": "func isAlphanum(r rune) bool {\n\tif 'a' <= r && r <= 'z' {\n\t\treturn true\n\t}\n\tif 'A' <= r && r <= 'Z' {\n\t\treturn true\n\t}\n\tif '0' <= r && r <= '9' {\n\t\treturn true\n\t}\n\treturn false\n}", "title": "" }, { "docid": "9a4d4d9997fce08c9b4e2a8bcdf9cb1e", "score": "0.6263003", "text": "func (Latin) Is(ch rune) bool {\n\treturn unicode.Is(unicode.Latin, ch)\n}", "title": "" }, { "docid": "5e871b8ab182d8a7ae742034de1aeb7f", "score": "0.6261779", "text": "func ContainsLetter(str string) bool {\n\tfor i := range str {\n\t\tif (str[i] >= 'a' && str[i] <= 'z') || (str[i] >= 'A' && str[i] <= 'Z') || str[i] == ' ' {\n\t\t\treturn true\n\t\t}\n\t}\n\treturn false\n}", "title": "" }, { "docid": "0928d5c2fad7a561b38617bee639e218", "score": "0.6261585", "text": "func IsLower(letter string) bool {\n\t//\tvar thisChar string\n\tvar ret bool\n\tfor _, c := range letter {\n\t\t//\t\tthisChar = Sprintf(\"%c\", c)\n\t\t//\t\tPrintf(\"%s: %d\\n\", thisChar, c)\n\t\tret = (c >= LOWER_A_ORD && c <= LOWER_Z_ORD)\n\t}\n\treturn ret\n}", "title": "" }, { "docid": "a5918d6690c2d28cfde1f587cb927a3b", "score": "0.6242949", "text": "func isLower(ch rune) bool {\n\treturn ch >= 'a' && ch <= 'z'\n}", "title": "" }, { "docid": "3fcfff5f46daef98c9d44a110aa3ccc4", "score": "0.6227181", "text": "func IsAlNum(r rune) bool {\n\treturn IsAlpha(r) || IsDigit(r)\n}", "title": "" }, { "docid": "3fcfff5f46daef98c9d44a110aa3ccc4", "score": "0.6227181", "text": "func IsAlNum(r rune) bool {\n\treturn IsAlpha(r) || IsDigit(r)\n}", "title": "" }, { "docid": "3fcfff5f46daef98c9d44a110aa3ccc4", "score": "0.6227181", "text": "func IsAlNum(r rune) bool {\n\treturn IsAlpha(r) || IsDigit(r)\n}", "title": "" }, { "docid": "3fcfff5f46daef98c9d44a110aa3ccc4", "score": "0.6227181", "text": "func IsAlNum(r rune) bool {\n\treturn IsAlpha(r) || IsDigit(r)\n}", "title": "" }, { "docid": "a29cbe156a988632396da762cd04c8f3", "score": "0.61938536", "text": "func AlphaStart(text string) bool {\n\tr, _ := utf8.DecodeRuneInString(text)\n\treturn unicode.IsLetter(r)\n}", "title": "" }, { "docid": "a9cda7976af555dc46186d2c1ffe005e", "score": "0.61850965", "text": "func (*GuluRune) IsNumOrLetter(r rune) bool {\n\treturn ('0' <= r && '9' >= r) || Rune.IsLetter(r)\n}", "title": "" }, { "docid": "74925345f4268a7f21de89254817dec3", "score": "0.6166463", "text": "func UnicharIsalpha(c rune) bool {\n\tc_c := (C.gunichar)(c)\n\n\tretC := C.g_unichar_isalpha(c_c)\n\tretGo := retC == C.TRUE\n\n\treturn retGo\n}", "title": "" }, { "docid": "4752c6ed44dac532a0224e5d591f3b1e", "score": "0.61519027", "text": "func isAlphaNumeric(r rune) bool {\n\treturn unicode.IsLetter(r) || unicode.IsDigit(r)\n}", "title": "" }, { "docid": "80c5c1ed553ac17d105935f7708a0f61", "score": "0.6123924", "text": "func IsASCIIRune(r rune) bool {\n\treturn r < 128\n}", "title": "" }, { "docid": "16d089f71ee1047530d661a35aeb674c", "score": "0.61218846", "text": "func IsAlphaNum(ch rune) bool {\n\treturn unicode.IsDigit(ch) || unicode.IsLetter(ch) || ch == '.'\n}", "title": "" }, { "docid": "dde6b7743e801b0131a9b32616ff3cd2", "score": "0.6101125", "text": "func IsLetterUpper(b byte) bool {\n\tif b >= byte('A') && b <= byte('Z') {\n\t\treturn true\n\t}\n\treturn false\n}", "title": "" }, { "docid": "b15a378321696ab83508887f04fbfcf4", "score": "0.6021285", "text": "func IsASCII(s rune) bool {\n\treturn s < unicode.MaxASCII\n}", "title": "" }, { "docid": "83400df764a901283a97105ab9022c23", "score": "0.6018269", "text": "func isAlphaNumeric(c rune) bool {\n\n\treturn isAlpha(c) || isDigit(c)\n}", "title": "" }, { "docid": "36a2b8c9085a1d28d9fbf18cca30053a", "score": "0.6013756", "text": "func (s *Scanner) isAlphaNumeric(char string) bool {\n\treturn s.isAlpha(char) || s.isDigit(char)\n}", "title": "" }, { "docid": "8555f2655138962a5c5a07adcdae48e7", "score": "0.59566003", "text": "func (l *Lexer) acceptLetters() bool {\n\tvar r rune = l.next()\n\tfor unicode.IsLetter(r) {\n\t\tr = l.next()\n\t}\n\tl.backup()\n\treturn l.Offset > l.Start\n}", "title": "" }, { "docid": "a4448767aac969f3e235858a3e5d84d2", "score": "0.5933618", "text": "func ABCheck(str string) bool {\n\tfor i, letter := range str {\n\t\tif strings.ToLower(string(letter)) == \"a\" &&\n\t\t\tlen(str) > (i+4) &&\n\t\t\tstrings.ToLower(string(str[i+4])) == \"b\" {\n\t\t\treturn true\n\t\t}\n\t\tif strings.ToLower(string(letter)) == \"b\" &&\n\t\t\tlen(str) > (i+4) &&\n\t\t\tstrings.ToLower(string(str[i+4])) == \"a\" {\n\t\t\treturn true\n\t\t}\n\t}\n\treturn false\n}", "title": "" }, { "docid": "ceeeb144d763f2e094f8ab84f24c5405", "score": "0.592191", "text": "func IsAlphaNumeric(rune rune) bool {\n\treturn rune == '_' || rune == '|' || rune == '*' || rune == '&' || unicode.IsLetter(rune)\n}", "title": "" }, { "docid": "15febb6fe7d9d4a059746fe046dca404", "score": "0.59178084", "text": "func IsAlpha(data []byte) bool {\n\tfor _, b := range data {\n\t\tif (b < 0x20 || b > 0x7e) && b != 0xa {\n\t\t\treturn false\n\t\t}\n\t}\n\n\treturn true\n}", "title": "" }, { "docid": "299a5f446d2995a4c69d602a4bb06469", "score": "0.5901458", "text": "func IsASCIILower(r rune) bool {\n\treturn IsASCII(r) && unicode.IsLower(r)\n}", "title": "" }, { "docid": "516228b22a85fecb3dbbd1f9b2458224", "score": "0.589995", "text": "func asciiAlpha(c byte) bool {\n\treturn 'A' <= c && c <= 'Z' || 'a' <= c && c <= 'z'\n}", "title": "" }, { "docid": "0c9de38ec04365c6c954f5eafae51cfa", "score": "0.5843921", "text": "func isAlphaNumeric(r rune) bool {\n\treturn r == '_' || unicode.IsLetter(r) || unicode.IsDigit(r)\n}", "title": "" }, { "docid": "0c9de38ec04365c6c954f5eafae51cfa", "score": "0.5843921", "text": "func isAlphaNumeric(r rune) bool {\n\treturn r == '_' || unicode.IsLetter(r) || unicode.IsDigit(r)\n}", "title": "" }, { "docid": "0c9de38ec04365c6c954f5eafae51cfa", "score": "0.5843921", "text": "func isAlphaNumeric(r rune) bool {\n\treturn r == '_' || unicode.IsLetter(r) || unicode.IsDigit(r)\n}", "title": "" }, { "docid": "0c9de38ec04365c6c954f5eafae51cfa", "score": "0.5843921", "text": "func isAlphaNumeric(r rune) bool {\n\treturn r == '_' || unicode.IsLetter(r) || unicode.IsDigit(r)\n}", "title": "" }, { "docid": "0c9de38ec04365c6c954f5eafae51cfa", "score": "0.5843921", "text": "func isAlphaNumeric(r rune) bool {\n\treturn r == '_' || unicode.IsLetter(r) || unicode.IsDigit(r)\n}", "title": "" }, { "docid": "8e7ceb226c624ddba005b142803935bd", "score": "0.5837383", "text": "func isAlphaNumeric(r rune) bool {\n\treturn r == '_' || unicode.IsNumber(r) || unicode.IsLetter(r)\n}", "title": "" }, { "docid": "c72598b720d89af36111067853895fb1", "score": "0.5816589", "text": "func (v GreekAlphabet) IsValid() bool {\n\treturn v.Ordinal() >= 0\n}", "title": "" }, { "docid": "2273a1ac022ce18a3bd27640fdecf414", "score": "0.5813288", "text": "func (Kana) Is(ch rune) bool {\n\treturn (ch == 'ー' ||\n\t\tunicode.Is(unicode.Hiragana, ch) ||\n\t\tunicode.Is(unicode.Katakana, ch))\n}", "title": "" }, { "docid": "b681128f0ba05d1d00b6d17a091db5ca", "score": "0.5809865", "text": "func isAlphaNum(b byte) bool {\n\treturn isAlpha(b) || (b >= '0' && b <= '9')\n}", "title": "" }, { "docid": "98dcc8dd954b1d5c4d7ab6b99f69d18f", "score": "0.5776365", "text": "func IsAlphaNumeric(r rune) bool {\r\n\treturn unicode.IsLetter(r) || unicode.IsDigit(r) || strings.IndexRune(charValidString, r) >= 0\r\n}", "title": "" }, { "docid": "c3512d540b6ef1e666241d4456feb128", "score": "0.57726234", "text": "func isDecorative(s string) bool {\n\tfor _, c := range s {\n\t\tif unicode.IsLetter(c) || unicode.IsDigit(c) {\n\t\t\treturn false\n\t\t}\n\t}\n\treturn true\n}", "title": "" }, { "docid": "801686f87db497db1c927e0a19b7f9f7", "score": "0.57416034", "text": "func isLowerAlphanumeric(r rune) bool {\n\treturn ('0' <= r && r <= '9') || ('a' <= r && r <= 'z')\n}", "title": "" }, { "docid": "887b67f2e26626cea65516b3d8fcd9be", "score": "0.5735617", "text": "func isIdentFirstChar(ch rune) bool { return isLetter(ch) }", "title": "" }, { "docid": "8546f3f2d528a957ce0d58b12fdab749", "score": "0.5711397", "text": "func IsPangram(input string) bool {\n\tif len(input) < 26 {\n\t\treturn false\n\t}\n\n\tinput = strings.ToUpper(input)\n\t// create the map that will house character count\n\talphaCount := make(map[rune]int)\n\tfor char := 'A'; char <= 'Z'; char++ {\n\t\talphaCount[char] = 0\n\t}\n\n\t// iterate through input and tally up alphabetical runes\n\tfor _, char := range input {\n\t\tval, present := alphaCount[char]\n\t\tif present {\n\t\t\talphaCount[char] = val + 1\n\t\t}\n\t}\n\n\t// check to see if any alpha values are still zero\n\tfor _, value := range alphaCount {\n\t\tif value == 0 {\n\t\t\treturn false\n\t\t}\n\t}\n\n\treturn true\n}", "title": "" }, { "docid": "d4069c32989a4a29d48af9ee7183ddf9", "score": "0.5707407", "text": "func PrintAlphabet() {\n\tvar thisChar string\n\tfor _, c := range ALPHABET {\n\t\tthisChar = Sprintf(\"%c\", c)\n\t\tPrintf(\"%s: %d\\n\", thisChar, c)\n\t}\n}", "title": "" }, { "docid": "824392bd951540c74276a106ee95d1f5", "score": "0.57062685", "text": "func ContainsOnlyLetter(str string) bool {\n\tfor i := range str {\n\t\tif !((str[i] >= 'a' && str[i] <= 'z') || (str[i] >= 'A' && str[i] <= 'Z') || str[i] == ' ') {\n\t\t\treturn false\n\t\t}\n\t}\n\treturn true\n}", "title": "" }, { "docid": "8303879622f4029475d203733f7ce068", "score": "0.57016075", "text": "func IsAcronym(short string, long string) bool {\n\twords := strings.Split(long, \" \")\n\tj := 0\n\tfor i := 0; i < len(short); i++ {\n\t\t// Skip any empty words.\n\t\tfor j < len(words) && words[j] == \"\" {\n\t\t\tj++\n\t\t}\n\n\t\t// See if we are out of words.\n\t\tif j == len(words) {\n\t\t\treturn false\n\t\t}\n\n\t\t// See if we have the wrong char for this word.\n\t\tif short[i] != words[j][0] {\n\t\t\treturn false\n\t\t}\n\t\tj++\n\n\t}\n\n\t// See if we did not use up all the words.\n\tif j != len(words) {\n\t\treturn false\n\t}\n\n\t// All tests passed.\n\treturn true\n}", "title": "" }, { "docid": "37d4d1100293ad14d3a37b4459745fcb", "score": "0.57002854", "text": "func (n *NFA) GetAlphabet() Set {\n\tletters := NewSet()\n\tfor _, rest := range n.rules {\n\t\tfor letter := range rest {\n\t\t\tletters.Add(letter)\n\t\t}\n\t}\n\treturn letters\n}", "title": "" }, { "docid": "4d4a165e4f7586068a47b5006787eac6", "score": "0.5698268", "text": "func isAlphaNumeric(r rune) bool {\n\treturn !(unicode.IsSpace(r) || isOperator(r) || r == ';')\n}", "title": "" }, { "docid": "a0164a54ad81fa45537e5d41b00122c9", "score": "0.5694266", "text": "func isUpper(ch rune) bool {\n\treturn ch >= 'A' && ch <= 'Z'\n}", "title": "" }, { "docid": "6e1f79e6f2c857f8b7d00aa8c9de9fde", "score": "0.5686968", "text": "func isAnagram(s string, t string) bool {\n\n\tif len(s) != len(t) {\n\t\treturn false\n\t}\n\n\tcomparisonResult := make([]int, 26)\n\tfor i := 0; i < len(s); i++ {\n\t\tcomparisonResult[s[i]-'a']++\n\t\tcomparisonResult[t[i]-'a']--\n\t}\n\n\tfor i := 0; i < len(comparisonResult); i++ {\n\t\tif comparisonResult[i] != 0 {\n\t\t\treturn false\n\t\t}\n\t}\n\n\treturn true\n}", "title": "" }, { "docid": "bdff2f0277d5834c82c36d89ab01b082", "score": "0.5683941", "text": "func alphanum(r rune) bool {\n\treturn r == '_' || r == '.' || unicode.IsLetter(r) || unicode.IsDigit(r)\n}", "title": "" }, { "docid": "831ac4229ab92056d40b785895d4bc58", "score": "0.5666468", "text": "func isName(r rune) bool {\n\treturn unicode.IsLetter(r) || unicode.IsDigit(r) || r == '_'\n}", "title": "" }, { "docid": "ab0c88d27fdd0a4be41ab0f7d8458c74", "score": "0.5651764", "text": "func ByteIsAsciiLetter(b byte) bool {\n\tisLetter, _ := regexp.MatchString(`[A-Za-z]{1}`, string(b));\n\treturn isLetter\n}", "title": "" }, { "docid": "9b671bff5d3dfaced5f85976b8e6cddd", "score": "0.5641756", "text": "func isAlphaNum(bites []byte) bool {\n\tresult := re.Match(bites)\n\tlog.Debug(\"Alphanumeric match: \", result)\n\treturn result\n}", "title": "" }, { "docid": "b3a0ee319fa012ef45f7aa856aefcdc6", "score": "0.5640379", "text": "func IsPangram(input string) bool {\n\tinput = strings.ToLower(input)\n\tres := make(map[rune]bool)\n\n\tfor _, l := range input {\n\t\tif unicode.IsLetter(l) && !res[l] {\n\t\t\tres[l] = true\n\t\t}\n\t}\n\n\treturn len(res) == 26\n}", "title": "" } ]
d2a1b08e053fc6b2ac8bc7720ac87f9c
Creates and returns an Apicurito Deployment object
[ { "docid": "abd0a8458457b152121f7f676dbf1ca0", "score": "0.73478264", "text": "func apicuritoDeployment(c *configuration.Config, a *api.Apicurito) client.Object {\n\t// Define a new deployment\n\tvar dm int32 = 420\n\tname := fmt.Sprintf(\"%s-%s\", a.Name, \"ui\")\n\tdeployLabels := labelComponent(name)\n\tdeployment := &appsv1.Deployment{\n\t\tTypeMeta: metav1.TypeMeta{\n\t\t\tAPIVersion: \"apps/v1\",\n\t\t\tKind: \"Deployment\",\n\t\t},\n\t\tObjectMeta: metav1.ObjectMeta{\n\t\t\tName: name,\n\t\t\tNamespace: a.Namespace,\n\t\t\tOwnerReferences: []metav1.OwnerReference{\n\t\t\t\t*metav1.NewControllerRef(a, schema.GroupVersionKind{\n\t\t\t\t\tGroup: api.SchemeGroupVersion.Group,\n\t\t\t\t\tVersion: api.SchemeGroupVersion.Version,\n\t\t\t\t\tKind: a.Kind,\n\t\t\t\t}),\n\t\t\t},\n\t\t},\n\t\tSpec: appsv1.DeploymentSpec{\n\t\t\tReplicas: &a.Spec.Size,\n\t\t\tSelector: &metav1.LabelSelector{\n\t\t\t\tMatchLabels: deployLabels,\n\t\t\t},\n\t\t\tStrategy: appsv1.DeploymentStrategy{\n\t\t\t\tType: appsv1.RollingUpdateDeploymentStrategyType,\n\t\t\t},\n\t\t\tTemplate: corev1.PodTemplateSpec{\n\t\t\t\tObjectMeta: metav1.ObjectMeta{\n\t\t\t\t\tLabels: deployLabels,\n\t\t\t\t},\n\t\t\t\tSpec: corev1.PodSpec{\n\t\t\t\t\tContainers: []corev1.Container{{\n\t\t\t\t\t\tImage: c.UiImage,\n\t\t\t\t\t\tImagePullPolicy: corev1.PullIfNotPresent,\n\t\t\t\t\t\tName: name,\n\t\t\t\t\t\tPorts: []corev1.ContainerPort{{\n\t\t\t\t\t\t\tContainerPort: 8080,\n\t\t\t\t\t\t\tName: \"api-port\",\n\t\t\t\t\t\t\tProtocol: corev1.ProtocolTCP,\n\t\t\t\t\t\t}},\n\t\t\t\t\t\tLivenessProbe: &corev1.Probe{\n\t\t\t\t\t\t\tHandler: corev1.Handler{\n\t\t\t\t\t\t\t\tHTTPGet: &corev1.HTTPGetAction{\n\t\t\t\t\t\t\t\t\tScheme: corev1.URISchemeHTTP,\n\t\t\t\t\t\t\t\t\tPort: intstr.FromString(\"api-port\"),\n\t\t\t\t\t\t\t\t\tPath: \"/\",\n\t\t\t\t\t\t\t\t}},\n\t\t\t\t\t\t},\n\t\t\t\t\t\tReadinessProbe: &corev1.Probe{\n\t\t\t\t\t\t\tHandler: corev1.Handler{\n\t\t\t\t\t\t\t\tHTTPGet: &corev1.HTTPGetAction{\n\t\t\t\t\t\t\t\t\tScheme: corev1.URISchemeHTTP,\n\t\t\t\t\t\t\t\t\tPort: intstr.FromString(\"api-port\"),\n\t\t\t\t\t\t\t\t\tPath: \"/\",\n\t\t\t\t\t\t\t\t}},\n\t\t\t\t\t\t\tPeriodSeconds: 5,\n\t\t\t\t\t\t\tFailureThreshold: 2,\n\t\t\t\t\t\t},\n\t\t\t\t\t\tVolumeMounts: []corev1.VolumeMount{\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tName: name,\n\t\t\t\t\t\t\t\tMountPath: \"/html/config\",\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t},\n\t\t\t\t\t\tResources: corev1.ResourceRequirements{\n\t\t\t\t\t\t\tRequests: Normalize(corev1.ResourceList{\n\t\t\t\t\t\t\t\tcorev1.ResourceCPU: resource.MustParse(\"500m\"),\n\t\t\t\t\t\t\t\tcorev1.ResourceMemory: resource.MustParse(\"64Mi\"),\n\t\t\t\t\t\t\t}),\n\t\t\t\t\t\t\tLimits: Normalize(corev1.ResourceList{\n\t\t\t\t\t\t\t\tcorev1.ResourceCPU: resource.MustParse(\"1000m\"),\n\t\t\t\t\t\t\t\tcorev1.ResourceMemory: resource.MustParse(\"128Mi\"),\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\tVolumes: []corev1.Volume{\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tName: name,\n\t\t\t\t\t\t\tVolumeSource: corev1.VolumeSource{\n\t\t\t\t\t\t\t\tConfigMap: &corev1.ConfigMapVolumeSource{\n\t\t\t\t\t\t\t\t\tLocalObjectReference: corev1.LocalObjectReference{\n\t\t\t\t\t\t\t\t\t\tName: name,\n\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\tDefaultMode: &dm,\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t},\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t},\n\t\t},\n\t}\n\n\tif a.Spec.ResourcesUI != nil {\n\t\tif a.Spec.ResourcesUI.Requests != nil {\n\t\t\tdeployment.Spec.Template.Spec.Containers[0].Resources.Requests = Normalize(a.Spec.ResourcesUI.Requests)\n\t\t}\n\t\tif a.Spec.ResourcesUI.Limits != nil {\n\t\t\tdeployment.Spec.Template.Spec.Containers[0].Resources.Limits = Normalize(a.Spec.ResourcesUI.Limits)\n\t\t}\n\t}\n\n\treturn deployment\n}", "title": "" } ]
[ { "docid": "452d3f59110a93fb8e79e45dd98655d2", "score": "0.6885522", "text": "func (c *deployments) Create(deployment *deployapi.Deployment) (result *deployapi.Deployment, err error) {\n\tresult = &deployapi.Deployment{}\n\terr = c.r.Post().Namespace(c.ns).Resource(\"deployments\").Body(deployment).Do().Into(result)\n\treturn\n}", "title": "" }, { "docid": "180e14de355eeff6485ea30293183821", "score": "0.6780433", "text": "func newDeploymentForAPI(cr *analyticsv1alpha1.TFAnalytics) *betav1.Deployment {\n\tlabels := map[string]string{\n\t\t\"app\": cr.Name + \"-api\",\n\t}\n\n\tdeploy := &betav1.Deployment{\n\t\tObjectMeta: metav1.ObjectMeta{\n\t\t\tName: cr.Name + \"-api\",\n\t\t\tNamespace: cr.Namespace,\n\t\t\tLabels: labels,\n\t\t},\n\t\tSpec: betav1.DeploymentSpec{\n\t\t\tReplicas: cr.Spec.APISpec.Replicas,\n\t\t\tTemplate: corev1.PodTemplateSpec{\n\t\t\t\tObjectMeta: metav1.ObjectMeta{\n\t\t\t\t\tLabels: labels,\n\t\t\t\t},\n\t\t\t\tSpec: corev1.PodSpec{\n\t\t\t\t\tContainers: []corev1.Container{\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tName: cr.Name + \"-api\",\n\t\t\t\t\t\t\tImage: cr.Spec.APISpec.Image,\n\t\t\t\t\t\t\t// Command: cmd,\n\t\t\t\t\t\t},\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t},\n\t\t},\n\t}\n\t// set co config maps\n\tconfigMaps := getConfigMapsObject(cr)\n\tif len(configMaps) > 0 {\n\t\tdeploy.Spec.Template.Spec.Containers[0].EnvFrom = configMaps\n\t}\n\t// set ports if defined\n\tports := cr.Spec.APISpec.Ports.GetContainerPortList()\n\tif len(ports) > 0 {\n\t\tdeploy.Spec.Template.Spec.Containers[0].Ports = ports\n\t} else {\n\t\t// If ports are not defined\n\t\tdeploy.Spec.Template.Spec.Containers[0].Ports = []corev1.ContainerPort{\n\t\t\t{Name: \"api\", ContainerPort: 8081},\n\t\t\t{Name: \"introspect\", ContainerPort: 8090},\n\t\t}\n\t}\n\t// set environment variable(s) if defined in spec\n\tenvs := cr.Spec.APISpec.EnvList\n\tif len(envs) > 0 {\n\t\tdeploy.Spec.Template.Spec.Containers[0].Env = envs\n\t}\n\treturn deploy\n}", "title": "" }, { "docid": "34f3afbd59504d6674640a0d42cd4a7e", "score": "0.6704436", "text": "func newDeployment(\n\tnamespace,\n\tname,\n\timage string,\n\tports []int32,\n\tenv []corev1.EnvVar,\n\tlabels map[string]string,\n\tpullPolicy corev1.PullPolicy,\n) *appsv1.Deployment {\n\tcontainerPorts := make([]corev1.ContainerPort, len(ports))\n\tfor i, port := range ports {\n\t\tcontainerPorts[i] = corev1.ContainerPort{\n\t\t\tContainerPort: port,\n\t\t}\n\t}\n\tdeployment := &appsv1.Deployment{\n\t\tTypeMeta: metav1.TypeMeta{\n\t\t\tKind: \"Deployment\",\n\t\t},\n\t\tObjectMeta: metav1.ObjectMeta{\n\t\t\tName: name,\n\t\t\tNamespace: namespace,\n\t\t\tLabels: labels,\n\t\t},\n\t\tSpec: appsv1.DeploymentSpec{\n\t\t\tSelector: &metav1.LabelSelector{\n\t\t\t\tMatchLabels: labels,\n\t\t\t},\n\t\t\tReplicas: Int32P(1),\n\t\t\tTemplate: corev1.PodTemplateSpec{\n\t\t\t\tObjectMeta: metav1.ObjectMeta{\n\t\t\t\t\tLabels: labels,\n\t\t\t\t},\n\t\t\t\tSpec: corev1.PodSpec{\n\t\t\t\t\tContainers: []corev1.Container{\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tImage: image,\n\t\t\t\t\t\t\tName: name,\n\t\t\t\t\t\t\tImagePullPolicy: pullPolicy,\n\t\t\t\t\t\t\tPorts: containerPorts,\n\t\t\t\t\t\t\tEnv: env,\n\t\t\t\t\t\t},\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t},\n\t\t},\n\t}\n\n\treturn deployment\n}", "title": "" }, { "docid": "9c3967217ca1f4c72eec8968a0b142b5", "score": "0.66536367", "text": "func CreateDeployment(client *rancher.Client, clusterName, deploymentName, namespace string, template corev1.PodTemplateSpec) (*appv1.Deployment, error) {\n\tdynamicClient, err := client.GetDownStreamClusterClient(clusterName)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tlabels := map[string]string{}\n\tlabels[\"workload.user.cattle.io/workloadselector\"] = fmt.Sprintf(\"apps.deployment-%v-%v\", namespace, deploymentName)\n\n\ttemplate.ObjectMeta = metav1.ObjectMeta{\n\t\tLabels: labels,\n\t}\n\n\ttemplate.Spec.RestartPolicy = corev1.RestartPolicyAlways\n\tdeployment := &appv1.Deployment{\n\t\tObjectMeta: metav1.ObjectMeta{\n\t\t\tName: deploymentName,\n\t\t\tNamespace: namespace,\n\t\t},\n\t\tSpec: appv1.DeploymentSpec{\n\t\t\tSelector: &metav1.LabelSelector{\n\t\t\t\tMatchLabels: labels,\n\t\t\t},\n\t\t\tTemplate: template,\n\t\t},\n\t}\n\n\tdeploymentResource := dynamicClient.Resource(DeploymentGroupVersionResource).Namespace(namespace)\n\n\tunstructuredResp, err := deploymentResource.Create(context.TODO(), unstructured.MustToUnstructured(deployment), metav1.CreateOptions{})\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tnewDeployment := &appv1.Deployment{}\n\terr = scheme.Scheme.Convert(unstructuredResp, newDeployment, unstructuredResp.GroupVersionKind())\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn newDeployment, nil\n}", "title": "" }, { "docid": "e4918ed66bb4f1d46d3bba9d44d30a51", "score": "0.66525936", "text": "func NewDeploy(owner *mygroupv1.Mykind, logger logr.Logger, scheme *runtime.Scheme) *appsv1.Deployment {\n\tlabels := map[string]string{\"app\": owner.Name}\n\tselector := &metav1.LabelSelector{MatchLabels: labels}\n\tdeploy := &appsv1.Deployment{\n\t\tTypeMeta: metav1.TypeMeta{\n\t\t\tAPIVersion: \"apps/v1\",\n\t\t\tKind: \"Deployment\",\n\t\t},\n\t\tObjectMeta: metav1.ObjectMeta{\n\t\t\tName: owner.Name,\n\t\t\tNamespace: owner.Namespace,\n\t\t},\n\t\tSpec: appsv1.DeploymentSpec{\n\t\t\tReplicas: owner.Spec.Replicas,\n\t\t\tTemplate: corev1.PodTemplateSpec{\n\t\t\t\tObjectMeta: metav1.ObjectMeta{\n\t\t\t\t\tLabels: labels,\n\t\t\t\t},\n\t\t\t\tSpec: corev1.PodSpec{\n\t\t\t\t\tContainers: []corev1.Container{\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tName: owner.Name,\n\t\t\t\t\t\t\tImage: owner.Spec.Image,\n\t\t\t\t\t\t\tPorts: []corev1.ContainerPort{{ContainerPort: owner.Spec.Port}},\n\t\t\t\t\t\t\tImagePullPolicy: corev1.PullIfNotPresent,\n\t\t\t\t\t\t\tEnv: owner.Spec.Envs,\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\tSelector: selector,\n\t\t},\n\t}\n\t// add ControllerReference for deployment\n\tif err := controllerutil.SetControllerReference(owner, deploy, scheme); err != nil {\n\t\tmsg := fmt.Sprintf(\"***SetControllerReference for Deployment %s/%s failed!***\", owner.Namespace, owner.Name)\n\t\tlogger.Error(err, msg)\n\t}\n\treturn deploy\n}", "title": "" }, { "docid": "4a54654fe9dd4e5d3e8a16eef0262659", "score": "0.6602238", "text": "func MakeDeployment(\n\tapp *v1alpha1.App,\n\tspace *v1alpha1.Space,\n) (*appsv1.Deployment, error) {\n\timage := app.Status.Image\n\tif image == \"\" {\n\t\treturn nil, errors.New(\"waiting for build image in latestReadyBuild\")\n\t}\n\n\treplicas, err := app.Spec.Instances.DeploymentReplicas()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tpodSpec, err := makePodSpec(app, space)\n\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn &appsv1.Deployment{\n\t\tObjectMeta: metav1.ObjectMeta{\n\t\t\tName: DeploymentName(app),\n\t\t\tNamespace: app.Namespace,\n\t\t\tOwnerReferences: []metav1.OwnerReference{\n\t\t\t\t*kmeta.NewControllerRef(app),\n\t\t\t},\n\t\t\tLabels: v1alpha1.UnionMaps(app.GetLabels(), app.ComponentLabels(\"app-scaler\")),\n\t\t},\n\t\tSpec: appsv1.DeploymentSpec{\n\t\t\tSelector: metav1.SetAsLabelSelector(labels.Set(PodLabels(app))),\n\t\t\tTemplate: corev1.PodTemplateSpec{\n\t\t\t\tObjectMeta: metav1.ObjectMeta{\n\t\t\t\t\tLabels: v1alpha1.UnionMaps(\n\t\t\t\t\t\tapp.GetLabels(),\n\t\t\t\t\t\t// Add in the App's labels, which may be user-defined.\n\t\t\t\t\t\tPodLabels(app),\n\n\t\t\t\t\t\t// Insert a label for isolating apps with their own NetworkPolicies.\n\t\t\t\t\t\tmap[string]string{\n\t\t\t\t\t\t\tv1alpha1.NetworkPolicyLabel: v1alpha1.NetworkPolicyApp,\n\t\t\t\t\t\t}),\n\t\t\t\t\tAnnotations: v1alpha1.UnionMaps(\n\t\t\t\t\t\t// Add in the App's annotations, which may be user-defined.\n\t\t\t\t\t\tapp.GetAnnotations(),\n\n\t\t\t\t\t\tmap[string]string{\n\t\t\t\t\t\t\t// Inject the Envoy sidecar on all apps so networking rules\n\t\t\t\t\t\t\t// apply.\n\t\t\t\t\t\t\t\"sidecar.istio.io/inject\": \"true\",\n\t\t\t\t\t\t\t\"traffic.sidecar.istio.io/includeOutboundIPRanges\": \"*\",\n\n\t\t\t\t\t\t\t// Follow KEP-2227 which allows setting the default\n\t\t\t\t\t\t\t// container name for kubectl logs/exec/debug/attach etc.\n\t\t\t\t\t\t\t\"kubectl.kubernetes.io/default-container\": v1alpha1.DefaultUserContainerName,\n\t\t\t\t\t\t}),\n\t\t\t\t},\n\t\t\t\tSpec: *podSpec,\n\t\t\t},\n\t\t\tRevisionHistoryLimit: ptr.Int32(DefaultRevisionHistoryLimit),\n\t\t\tReplicas: ptr.Int32(int32(replicas)),\n\t\t\tStrategy: appsv1.DeploymentStrategy{\n\t\t\t\tType: appsv1.RollingUpdateDeploymentStrategyType,\n\t\t\t\tRollingUpdate: &appsv1.RollingUpdateDeployment{\n\t\t\t\t\tMaxUnavailable: &defaultMaxUnavailable,\n\t\t\t\t\tMaxSurge: &defaultMaxSurge,\n\t\t\t\t},\n\t\t\t},\n\t\t\tProgressDeadlineSeconds: space.Status.RuntimeConfig.ProgressDeadlineSeconds,\n\t\t},\n\t}, nil\n}", "title": "" }, { "docid": "cee70e0ca4c48d262e1bafc9483a9fc2", "score": "0.65862244", "text": "func (m *okDeploymentOps) Create(deploy *k8sApisExtnsV1Beta1.Deployment) (*k8sApisExtnsV1Beta1.Deployment, error) {\n\treturn deploy, nil\n}", "title": "" }, { "docid": "cabb270849508293cd83544adf357db4", "score": "0.6502758", "text": "func generatorDeployment(c *configuration.Config, a *api.Apicurito) client.Object {\n\t// Define a new deployment\n\tname := fmt.Sprintf(\"%s-%s\", a.Name, \"generator\")\n\tdeployLabels := labelComponent(name)\n\tdeployment := &appsv1.Deployment{\n\t\tTypeMeta: metav1.TypeMeta{\n\t\t\tAPIVersion: \"apps/v1\",\n\t\t\tKind: \"Deployment\",\n\t\t},\n\t\tObjectMeta: metav1.ObjectMeta{\n\t\t\tName: name,\n\t\t\tNamespace: a.Namespace,\n\t\t\tOwnerReferences: []metav1.OwnerReference{\n\t\t\t\t*metav1.NewControllerRef(a, schema.GroupVersionKind{\n\t\t\t\t\tGroup: api.SchemeGroupVersion.Group,\n\t\t\t\t\tVersion: api.SchemeGroupVersion.Version,\n\t\t\t\t\tKind: a.Kind,\n\t\t\t\t}),\n\t\t\t},\n\t\t},\n\n\t\tSpec: appsv1.DeploymentSpec{\n\t\t\tReplicas: &a.Spec.Size,\n\t\t\tSelector: &metav1.LabelSelector{\n\t\t\t\tMatchLabels: deployLabels,\n\t\t\t},\n\t\t\tStrategy: appsv1.DeploymentStrategy{\n\t\t\t\tType: appsv1.RollingUpdateDeploymentStrategyType,\n\t\t\t},\n\t\t\tTemplate: corev1.PodTemplateSpec{\n\t\t\t\tObjectMeta: metav1.ObjectMeta{\n\t\t\t\t\tLabels: deployLabels,\n\t\t\t\t},\n\t\t\t\tSpec: corev1.PodSpec{\n\t\t\t\t\tContainers: []corev1.Container{{\n\t\t\t\t\t\tImage: c.GeneratorImage,\n\t\t\t\t\t\tImagePullPolicy: corev1.PullIfNotPresent,\n\t\t\t\t\t\tName: name,\n\t\t\t\t\t\tPorts: []corev1.ContainerPort{\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tContainerPort: 8080,\n\t\t\t\t\t\t\t\tName: \"http\",\n\t\t\t\t\t\t\t\tProtocol: corev1.ProtocolTCP,\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tContainerPort: 8181,\n\t\t\t\t\t\t\t\tName: \"health\",\n\t\t\t\t\t\t\t\tProtocol: corev1.ProtocolTCP,\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tContainerPort: 9779,\n\t\t\t\t\t\t\t\tName: \"prometheus\",\n\t\t\t\t\t\t\t\tProtocol: corev1.ProtocolTCP,\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tContainerPort: 8778,\n\t\t\t\t\t\t\t\tName: \"jolokia\",\n\t\t\t\t\t\t\t\tProtocol: corev1.ProtocolTCP,\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t},\n\t\t\t\t\t\tLivenessProbe: &corev1.Probe{\n\t\t\t\t\t\t\tFailureThreshold: 3,\n\t\t\t\t\t\t\tInitialDelaySeconds: 180,\n\t\t\t\t\t\t\tPeriodSeconds: 10,\n\t\t\t\t\t\t\tSuccessThreshold: 1,\n\t\t\t\t\t\t\tTimeoutSeconds: 1,\n\t\t\t\t\t\t\tHandler: corev1.Handler{\n\t\t\t\t\t\t\t\tHTTPGet: &corev1.HTTPGetAction{\n\t\t\t\t\t\t\t\t\tScheme: corev1.URISchemeHTTP,\n\t\t\t\t\t\t\t\t\tPort: intstr.FromString(\"health\"),\n\t\t\t\t\t\t\t\t\tPath: \"/health\",\n\t\t\t\t\t\t\t\t}},\n\t\t\t\t\t\t},\n\t\t\t\t\t\tReadinessProbe: &corev1.Probe{\n\t\t\t\t\t\t\tFailureThreshold: 3,\n\t\t\t\t\t\t\tInitialDelaySeconds: 10,\n\t\t\t\t\t\t\tPeriodSeconds: 10,\n\t\t\t\t\t\t\tSuccessThreshold: 1,\n\t\t\t\t\t\t\tTimeoutSeconds: 1,\n\t\t\t\t\t\t\tHandler: corev1.Handler{\n\t\t\t\t\t\t\t\tHTTPGet: &corev1.HTTPGetAction{\n\t\t\t\t\t\t\t\t\tScheme: corev1.URISchemeHTTP,\n\t\t\t\t\t\t\t\t\tPort: intstr.FromString(\"health\"),\n\t\t\t\t\t\t\t\t\tPath: \"/health\",\n\t\t\t\t\t\t\t\t}},\n\t\t\t\t\t\t},\n\t\t\t\t\t\tResources: corev1.ResourceRequirements{\n\t\t\t\t\t\t\tRequests: Normalize(corev1.ResourceList{\n\t\t\t\t\t\t\t\tcorev1.ResourceCPU: resource.MustParse(\"500m\"),\n\t\t\t\t\t\t\t\tcorev1.ResourceMemory: resource.MustParse(\"256Mi\"),\n\t\t\t\t\t\t\t}),\n\t\t\t\t\t\t\tLimits: Normalize(corev1.ResourceList{\n\t\t\t\t\t\t\t\tcorev1.ResourceCPU: resource.MustParse(\"1000m\"),\n\t\t\t\t\t\t\t\tcorev1.ResourceMemory: resource.MustParse(\"512Mi\"),\n\t\t\t\t\t\t\t}),\n\t\t\t\t\t\t},\n\t\t\t\t\t}},\n\t\t\t\t},\n\t\t\t},\n\t\t},\n\t}\n\n\tif a.Spec.ResourcesGenerator != nil {\n\t\tif a.Spec.ResourcesGenerator.Requests != nil {\n\t\t\tdeployment.Spec.Template.Spec.Containers[0].Resources.Requests = Normalize(a.Spec.ResourcesGenerator.Requests)\n\t\t}\n\t\tif a.Spec.ResourcesGenerator.Limits != nil {\n\t\t\tdeployment.Spec.Template.Spec.Containers[0].Resources.Limits = Normalize(a.Spec.ResourcesGenerator.Limits)\n\t\t}\n\t}\n\n\treturn deployment\n}", "title": "" }, { "docid": "a3ed5822fa1def213fbda5fc7e661722", "score": "0.64819765", "text": "func (h *Handler) CreateDeployment(c *gin.Context) {\n\tnamespace := c.Param(\"namespace\")\n\n\tdeployment := &appsv1.Deployment{}\n\tif err := c.BindJSON(&deployment); err != nil {\n\t\th.handleError(c, err)\n\t\treturn\n\t}\n\n\tnewDeployment, err := h.kubeClient.AppsV1().Deployments(namespace).Create(c, deployment, metav1.CreateOptions{})\n\tif err != nil {\n\t\th.handleError(c, err)\n\t\treturn\n\t}\n\n\tc.JSON(201, gin.H{\n\t\t\"deployment\": newDeployment,\n\t})\n}", "title": "" }, { "docid": "e11e8643c665550088510893a2694bbb", "score": "0.64207584", "text": "func newDeployment(cr *mamezouv1.GithubSearch, secretName string) *appv1.Deployment {\n\n\tlabels := map[string]string{\n\t\t\"app\": cr.Name,\n\t}\n\n\tprobe := &corev1.Probe{\n\t\tHandler: corev1.Handler{\n\t\t\tHTTPGet: &corev1.HTTPGetAction{\n\t\t\t\tPath: \"/actuator/health\",\n\t\t\t\tPort: intstr.FromInt(8080),\n\t\t\t},\n\t\t},\n\t\tInitialDelaySeconds: 30,\n\t\tTimeoutSeconds: 5,\n\t}\n\n\treturn &appv1.Deployment{\n\t\tTypeMeta: metav1.TypeMeta{\n\t\t\tKind: \"Deployment\",\n\t\t\tAPIVersion: \"apps/v1\",\n\t\t},\n\t\tObjectMeta: metav1.ObjectMeta{\n\t\t\tName: cr.Name,\n\t\t\tLabels: labels,\n\t\t\tNamespace: cr.Namespace,\n\t\t},\n\t\tSpec: appv1.DeploymentSpec{\n\t\t\tReplicas: getReplicaSize(cr),\n\t\t\tStrategy: appv1.DeploymentStrategy{\n\t\t\t\tType: appv1.DeploymentStrategyType(\"RollingUpdate\"),\n\t\t\t},\n\t\t\tSelector: &metav1.LabelSelector{\n\t\t\t\tMatchLabels: labels,\n\t\t\t},\n\t\t\tTemplate: corev1.PodTemplateSpec{\n\t\t\t\tObjectMeta: metav1.ObjectMeta{\n\t\t\t\t\tLabels: labels,\n\t\t\t\t},\n\t\t\t\tSpec: corev1.PodSpec{\n\t\t\t\t\tContainers: []corev1.Container{\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tName: \"github-service\",\n\t\t\t\t\t\t\tImage: fmt.Sprintf(\"kudohn/github-service:%s\", getAppVersion(cr)),\n\t\t\t\t\t\t\tImagePullPolicy: \"IfNotPresent\",\n\t\t\t\t\t\t\tPorts: []corev1.ContainerPort{\n\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\tName: \"http\",\n\t\t\t\t\t\t\t\t\tContainerPort: 8080,\n\t\t\t\t\t\t\t\t\tProtocol: \"TCP\",\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\tReadinessProbe: probe,\n\t\t\t\t\t\t\tLivenessProbe: probe,\n\t\t\t\t\t\t\tLifecycle: &corev1.Lifecycle{\n\t\t\t\t\t\t\t\tPreStop: &corev1.Handler{\n\t\t\t\t\t\t\t\t\tExec: &corev1.ExecAction{\n\t\t\t\t\t\t\t\t\t\tCommand: []string{\"sh\", \"-c\", \"sleep 5\"},\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\tEnv: []corev1.EnvVar{\n\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\tName: \"GITHUB_USER\",\n\t\t\t\t\t\t\t\t\tValueFrom: &corev1.EnvVarSource{\n\t\t\t\t\t\t\t\t\t\tSecretKeyRef: &corev1.SecretKeySelector{\n\t\t\t\t\t\t\t\t\t\t\tLocalObjectReference: corev1.LocalObjectReference{\n\t\t\t\t\t\t\t\t\t\t\t\tName: secretName,\n\t\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\t\tKey: \"user\",\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\t\tName: \"GITHUB_PASSWORD\",\n\t\t\t\t\t\t\t\t\tValueFrom: &corev1.EnvVarSource{\n\t\t\t\t\t\t\t\t\t\tSecretKeyRef: &corev1.SecretKeySelector{\n\t\t\t\t\t\t\t\t\t\t\tLocalObjectReference: corev1.LocalObjectReference{\n\t\t\t\t\t\t\t\t\t\t\t\tName: secretName,\n\t\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\t\tKey: \"password\",\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\tResources: corev1.ResourceRequirements{\n\t\t\t\t\t\t\t\tRequests: corev1.ResourceList{\n\t\t\t\t\t\t\t\t\tcorev1.ResourceCPU: resource.MustParse(\"200m\"),\n\t\t\t\t\t\t\t\t\tcorev1.ResourceMemory: resource.MustParse(\"1Gi\"),\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\tLimits: corev1.ResourceList{\n\t\t\t\t\t\t\t\t\tcorev1.ResourceCPU: resource.MustParse(\"200m\"),\n\t\t\t\t\t\t\t\t\tcorev1.ResourceMemory: resource.MustParse(\"1Gi\"),\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t},\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t},\n\t\t},\n\t}\n}", "title": "" }, { "docid": "8854b67a00359732356fe911f70c8e36", "score": "0.6405501", "text": "func (s *ReleaseDeploymentsService) Create(ctx context.Context, organizationSlug string, version string, params *ReleaseDeployment) (*ReleaseDeployment, *Response, error) {\n\tu := fmt.Sprintf(\"0/organizations/%v/releases/%s/deploys/\", organizationSlug, version)\n\treq, err := s.client.NewRequest(\"POST\", u, params)\n\tif err != nil {\n\t\treturn nil, nil, err\n\t}\n\n\tdeploy := new(ReleaseDeployment)\n\tresp, err := s.client.Do(ctx, req, deploy)\n\tif err != nil {\n\t\treturn nil, resp, err\n\t}\n\n\treturn deploy, resp, nil\n}", "title": "" }, { "docid": "e2b569fe82f7eabca453f2ea1b13e108", "score": "0.6315858", "text": "func NewDeployment() (*Deployment, error) {\n\tnow := time.Now()\n\n\tuid, _ := uuid.NewRandom()\n\tid := uid.String()\n\n\treturn &Deployment{\n\t\tCreated: &now,\n\t\tId: id,\n\t\tDeploymentConstructor: &DeploymentConstructor{},\n\t\tStats: NewDeviceDeploymentStats(),\n\t}, nil\n}", "title": "" }, { "docid": "719e91571a40babf10cd8236ef6dc3e2", "score": "0.62834215", "text": "func CreateDeployment(client kubernetes.Interface, deploymentName string, namespace string, volumeMount bool) (*appsv1.Deployment, error) {\n\tlogrus.Infof(\"Creating Deployment\")\n\tdeploymentClient := client.AppsV1().Deployments(namespace)\n\tvar deploymentObj *appsv1.Deployment\n\tif volumeMount {\n\t\tdeploymentObj = GetDeployment(namespace, deploymentName)\n\t} else {\n\t\tdeploymentObj = GetDeploymentWithEnvVars(namespace, deploymentName)\n\t}\n\tdeployment, err := deploymentClient.Create(context.TODO(), deploymentObj, metav1.CreateOptions{})\n\ttime.Sleep(3 * time.Second)\n\treturn deployment, err\n}", "title": "" }, { "docid": "635ba5f7820fc2658c1925a4334ce0fc", "score": "0.62709403", "text": "func (r *ReconcileAppService) createDeployment(a *appv1alpha1.AppService) *appsv1.Deployment {\n\tls := labelsForApp(a.Name)\n\treplicas := a.Spec.Size\n\n\tdep := &appsv1.Deployment{\n\t\tTypeMeta: metav1.TypeMeta{\n\t\t\tAPIVersion: \"apps/v1\",\n\t\t\tKind: \"Deployment\",\n\t\t},\n\t\tObjectMeta: metav1.ObjectMeta{\n\t\t\tName: a.Name,\n\t\t\tNamespace: a.Namespace,\n\t\t},\n\t\tSpec: appsv1.DeploymentSpec{\n\t\t\tReplicas: &replicas,\n\t\t\tSelector: &metav1.LabelSelector{\n\t\t\t\tMatchLabels: ls,\n\t\t\t},\n\t\t\tTemplate: corev1.PodTemplateSpec{\n\t\t\t\tObjectMeta: metav1.ObjectMeta{\n\t\t\t\t\tLabels: ls,\n\t\t\t\t},\n\t\t\t\tSpec: corev1.PodSpec{\n\t\t\t\t\tContainers: []corev1.Container{{\n\t\t\t\t\t\tName: \"busybox\",\n\t\t\t\t\t\tImage: \"busybox\",\n\t\t\t\t\t\tCommand: []string{\"sleep\", \"3600\"},\n\t\t\t\t\t\t// Image: \"memcached:1.4.36-alpine\",\n\t\t\t\t\t\t// Name: \"memcached\",\n\t\t\t\t\t\t// Command: []string{\"memcached\", \"-m=64\", \"-o\", \"modern\", \"-v\"},\n\t\t\t\t\t\tPorts: []corev1.ContainerPort{{\n\t\t\t\t\t\t\tContainerPort: 11211,\n\t\t\t\t\t\t\tName: \"demoapp\",\n\t\t\t\t\t\t}},\n\t\t\t\t\t}},\n\t\t\t\t},\n\t\t\t},\n\t\t},\n\t}\n\t// Set instance as the owner and controller\n\tcontrollerutil.SetControllerReference(a, dep, r.scheme)\n\treturn dep\n}", "title": "" }, { "docid": "4dc4a42f859ea64848cc7eab0b4e6e83", "score": "0.6262656", "text": "func (a *ArgoCD) CreateDeployment(request parvaeres.CreateDeploymentRequest) (*parvaeres.CreateDeploymentResponse, error) {\n\texistingApplications, err := a.listApplications(request.Email, request.Repository, request.Path)\n\tif err != nil {\n\t\terr = errors.Wrap(err, \"CreateDeployment failed\")\n\t\treturn &parvaeres.CreateDeploymentResponse{\n\t\t\tError: true,\n\t\t\tMessage: err.Error(),\n\t\t\tItems: []parvaeres.DeploymentStatus{},\n\t\t}, err\n\t}\n\tif len(existingApplications.Items) > 0 {\n\t\terr = errors.Errorf(\"application exists\")\n\t\treturn &parvaeres.CreateDeploymentResponse{\n\t\t\tError: true,\n\t\t\tMessage: err.Error(),\n\t\t\tItems: []parvaeres.DeploymentStatus{},\n\t\t}, err\n\t}\n\n\tapplication, err := a.createApplication(request.Email, request.Repository, request.Path)\n\tif err != nil {\n\t\terr = errors.Wrap(err, \"CreateDeployment failed\")\n\t\treturn &parvaeres.CreateDeploymentResponse{\n\t\t\tError: true,\n\t\t\tMessage: err.Error(),\n\t\t\tItems: []parvaeres.DeploymentStatus{},\n\t\t}, err\n\t}\n\n\tstatus, err := a.getDeploymentStatusOfApplication(application)\n\tif err != nil {\n\t\t//FIXME: handle cannot get status: the app is created but status cannot be retrieved\n\t}\n\n\treturn &parvaeres.CreateDeploymentResponse{\n\t\tError: false,\n\t\tMessage: \"CREATED\",\n\t\tItems: []parvaeres.DeploymentStatus{*status},\n\t}, nil\n}", "title": "" }, { "docid": "a63dfa041a0ef3ab8671c9f9c5032a75", "score": "0.62238324", "text": "func (m *AppManager) Deploy() (*appsv1.Deployment, error) {\n\tdeploymentsClient := m.client.Deployments(m.namespace)\n\tobj := buildDeploymentObject(m.namespace, m.app)\n\n\tctx, cancel := context.WithTimeout(m.ctx, time.Minute)\n\tresult, err := deploymentsClient.Create(ctx, obj, metav1.CreateOptions{})\n\tcancel()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn result, nil\n}", "title": "" }, { "docid": "1f9ba7627a83b1cb5790a81cf77bd936", "score": "0.62131304", "text": "func (d *deployer) Deploy(\n\tdeploymentName string,\n\tresourceGroupName string,\n\tlocation string,\n\ttemplate []byte,\n\tparams map[string]interface{},\n\ttags map[string]string,\n) (map[string]interface{}, error) {\n\tlogFields := log.Fields{\n\t\t\"resourceGroup\": resourceGroupName,\n\t\t\"deployment\": deploymentName,\n\t}\n\n\tauthorizer, err := az.GetBearerTokenAuthorizer(\n\t\td.azureEnvironment,\n\t\td.tenantID,\n\t\td.clientID,\n\t\td.clientSecret,\n\t)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\n\t\t\t`error deploying \"%s\" in resource group \"%s\": error getting bearer `+\n\t\t\t\t`token authorizer: %s`,\n\t\t\tdeploymentName,\n\t\t\tresourceGroupName,\n\t\t\terr,\n\t\t)\n\t}\n\n\tdeploymentsClient := resources.NewDeploymentsClientWithBaseURI(\n\t\td.azureEnvironment.ResourceManagerEndpoint,\n\t\td.subscriptionID,\n\t)\n\tdeploymentsClient.Authorizer = authorizer\n\n\t// Get the deployment and its current status\n\tdeployment, ds, err := getDeploymentAndStatus(\n\t\tdeploymentsClient,\n\t\tdeploymentName,\n\t\tresourceGroupName,\n\t)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\n\t\t\t`error deploying \"%s\" in resource group \"%s\": error getting `+\n\t\t\t\t`deployment: %s`,\n\t\t\tdeploymentName,\n\t\t\tresourceGroupName,\n\t\t\terr,\n\t\t)\n\t}\n\n\t// Handle according to status...\n\tswitch ds {\n\tcase deploymentStatusNotFound:\n\t\t// The deployment wasn't found, which means we are free to proceed with\n\t\t// initiating a new deployment\n\t\tlog.WithFields(logFields).Debug(\n\t\t\t\"deployment does not already exist; beginning new deployment\",\n\t\t)\n\t\tif deployment, err = d.doNewDeployment(\n\t\t\tdeploymentsClient,\n\t\t\tauthorizer,\n\t\t\tdeploymentName,\n\t\t\tresourceGroupName,\n\t\t\tlocation,\n\t\t\ttemplate,\n\t\t\tparams,\n\t\t\ttags,\n\t\t); err != nil {\n\t\t\treturn nil, fmt.Errorf(\n\t\t\t\t`error deploying \"%s\" in resource group \"%s\": %s`,\n\t\t\t\tdeploymentName,\n\t\t\t\tresourceGroupName,\n\t\t\t\terr,\n\t\t\t)\n\t\t}\n\tcase deploymentStatusRunning:\n\t\t// The deployment exists and is currently running, which means we'll poll\n\t\t// until it completes. The return at the end of the function will return the\n\t\t// deployment's outputs.\n\t\tlog.WithFields(logFields).Debug(\n\t\t\t\"deployment exists and is in-progress; polling until complete\",\n\t\t)\n\t\tif deployment, err = d.pollUntilComplete(\n\t\t\tdeploymentsClient,\n\t\t\tdeploymentName,\n\t\t\tresourceGroupName,\n\t\t); err != nil {\n\t\t\treturn nil, fmt.Errorf(\n\t\t\t\t`error deploying \"%s\" in resource group \"%s\": %s`,\n\t\t\t\tdeploymentName,\n\t\t\t\tresourceGroupName,\n\t\t\t\terr,\n\t\t\t)\n\t\t}\n\tcase deploymentStatusSucceeded:\n\t\t// The deployment exists and has succeeded already. There's nothing to do.\n\t\t// The return at the end of the function will return the deployment's\n\t\t// outputs.\n\t\tlog.WithFields(logFields).Debug(\n\t\t\t\"deployment exists and has already succeeded\",\n\t\t)\n\tcase deploymentStatusFailed:\n\t\t// The deployment exists and has failed already.\n\t\treturn nil, fmt.Errorf(\n\t\t\t`error deploying \"%s\" in resource group \"%s\": deployment is in failed `+\n\t\t\t\t`state`,\n\t\t\tdeploymentName,\n\t\t\tresourceGroupName,\n\t\t)\n\tcase deploymentStatusUnknown:\n\t\tfallthrough\n\tdefault:\n\t\t// Unrecognized state\n\t\treturn nil, fmt.Errorf(\n\t\t\t`error deploying \"%s\" in resource group \"%s\": deployment is in an `+\n\t\t\t\t`unrecognized state`,\n\t\t\tdeploymentName,\n\t\t\tresourceGroupName,\n\t\t)\n\t}\n\n\treturn getOutputs(deployment), nil\n}", "title": "" }, { "docid": "f0e26fa05ab77f8845e0b4edd1fa5426", "score": "0.6208347", "text": "func NewDeployment(ctx *pulumi.Context,\n\tname string, args *DeploymentArgs, opts ...pulumi.ResourceOption) (*Deployment, error) {\n\tif args == nil {\n\t\treturn nil, errors.New(\"missing one or more required arguments\")\n\t}\n\n\tif args.ApplicationId == nil {\n\t\treturn nil, errors.New(\"invalid value for required argument 'ApplicationId'\")\n\t}\n\tif args.ConfigurationProfileId == nil {\n\t\treturn nil, errors.New(\"invalid value for required argument 'ConfigurationProfileId'\")\n\t}\n\tif args.ConfigurationVersion == nil {\n\t\treturn nil, errors.New(\"invalid value for required argument 'ConfigurationVersion'\")\n\t}\n\tif args.DeploymentStrategyId == nil {\n\t\treturn nil, errors.New(\"invalid value for required argument 'DeploymentStrategyId'\")\n\t}\n\tif args.EnvironmentId == nil {\n\t\treturn nil, errors.New(\"invalid value for required argument 'EnvironmentId'\")\n\t}\n\tvar resource Deployment\n\terr := ctx.RegisterResource(\"aws:appconfig/deployment:Deployment\", name, args, &resource, opts...)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn &resource, nil\n}", "title": "" }, { "docid": "eb7d85eadf8a716003c2d39f0cd00bfb", "score": "0.61988354", "text": "func NewDeployment(ctx *pulumi.Context,\n\tname string, args *DeploymentArgs, opts ...pulumi.ResourceOption) (*Deployment, error) {\n\tif args == nil {\n\t\treturn nil, errors.New(\"missing one or more required arguments\")\n\t}\n\n\tif args.ApiDeploymentId == nil {\n\t\treturn nil, errors.New(\"invalid value for required argument 'ApiDeploymentId'\")\n\t}\n\tif args.ApiId == nil {\n\t\treturn nil, errors.New(\"invalid value for required argument 'ApiId'\")\n\t}\n\treplaceOnChanges := pulumi.ReplaceOnChanges([]string{\n\t\t\"apiDeploymentId\",\n\t\t\"apiId\",\n\t\t\"location\",\n\t\t\"project\",\n\t})\n\topts = append(opts, replaceOnChanges)\n\topts = internal.PkgResourceDefaultOpts(opts)\n\tvar resource Deployment\n\terr := ctx.RegisterResource(\"google-native:apigeeregistry/v1:Deployment\", name, args, &resource, opts...)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn &resource, nil\n}", "title": "" }, { "docid": "ae5be36caea25834655e007aa301e5b9", "score": "0.61900586", "text": "func (ca *CA) CreateDeployment() {\n\tsubPath := ca.GetSubPath()\n\tname := ca.GetName()\n\n\tmatchLabel := map[string]string{\n\t\t\"app\": \"mictract\",\n\t\t\"net\": strconv.Itoa(ca.NetworkID),\n\t\t\"org\": strconv.Itoa(ca.OrganizationID),\n\t\t\"tier\": \"ca\",\n\t}\n\n\tif ca.IsOrdererCA() {\n\t\tmatchLabel = map[string]string{\n\t\t\t\"app\": \"mictract\",\n\t\t\t\"net\": strconv.Itoa(ca.NetworkID),\n\t\t\t\"org\": \"orderer\",\n\t\t\t\"tier\": \"ca\",\n\t\t}\n\t}\n\n\tdeployment := &appsv1.Deployment{\n\t\tObjectMeta: metav1.ObjectMeta{\n\t\t\tName: name,\n\t\t},\n\t\tSpec: appsv1.DeploymentSpec{\n\t\t\tSelector: &metav1.LabelSelector{\n\t\t\t\tMatchLabels: matchLabel,\n\t\t\t},\n\t\t\tTemplate: corev1.PodTemplateSpec{\n\t\t\t\tObjectMeta: metav1.ObjectMeta{\n\t\t\t\t\tName: name,\n\t\t\t\t\tLabels: matchLabel,\n\t\t\t\t},\n\t\t\t\tSpec: corev1.PodSpec{\n\t\t\t\t\tContainers: []corev1.Container{\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tName: \"fabric-ca\",\n\t\t\t\t\t\t\tImage: \"hyperledger/fabric-ca:1.4.9\",\n\t\t\t\t\t\t\tCommand: []string{ \"sh\", \"-c\", \"fabric-ca-server start -b admin:adminpw -d > /dev/termination-log\" },\n\t\t\t\t\t\t\tEnvFrom: []corev1.EnvFromSource{\n\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\tConfigMapRef: &corev1.ConfigMapEnvSource{\n\t\t\t\t\t\t\t\t\t\tLocalObjectReference: corev1.LocalObjectReference{\n\t\t\t\t\t\t\t\t\t\t\tName: name + \"-env\",\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\tPorts: []corev1.ContainerPort{\n\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\tName: \"ca\",\n\t\t\t\t\t\t\t\t\tProtocol: corev1.ProtocolTCP,\n\t\t\t\t\t\t\t\t\tContainerPort: 7054,\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\tVolumeMounts: []corev1.VolumeMount{\n\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\tName: \"data\",\n\t\t\t\t\t\t\t\t\tMountPath: \"/etc/hyperledger/fabric-ca-server\",\n\t\t\t\t\t\t\t\t\tSubPath:\tsubPath,\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t},\n\t\t\t\t\t},\n\t\t\t\t\tVolumes: []corev1.Volume{\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tName: \"data\",\n\t\t\t\t\t\t\tVolumeSource: corev1.VolumeSource{\n\t\t\t\t\t\t\t\tNFS: &corev1.NFSVolumeSource{\n\t\t\t\t\t\t\t\t\tServer: config.NFS_SERVER_URL,\n\t\t\t\t\t\t\t\t\tPath: config.NFS_EXPOSED_PATH,\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t},\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t},\n\t\t},\n\t}\n\n\t_, err := global.K8sClientset.AppsV1().\n\t\tDeployments(corev1.NamespaceDefault).\n\t\tCreate(context.TODO(), deployment, metav1.CreateOptions{})\n\n\tif err != nil {\n\t\tglobal.Logger.Error(\"Create CA deployment error\", zap.Error(err))\n\t}\n}", "title": "" }, { "docid": "df67240c939e6f6d5d8294571192cd3a", "score": "0.6138944", "text": "func (d *Deployment) Create(deploymentCreate ReqDeploymentCreate) (deployment *ResDeploymentCreate, err error) {\n\tdeployment = &ResDeploymentCreate{}\n\tvar data []byte\n\tbody := bytes.NewBuffer(data)\n\tw := multipart.NewWriter(body)\n\n\tif err = w.WriteField(\"deployment-name\", deploymentCreate.DeploymentName); err != nil {\n\t\treturn nil, err\n\t}\n\n\tif deploymentCreate.EnableDuplicateFiltering != nil {\n\t\tif err = w.WriteField(\"enable-duplicate-filtering\", strconv.FormatBool(*deploymentCreate.EnableDuplicateFiltering)); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\n\tif deploymentCreate.DeployChangedOnly != nil {\n\t\tif err = w.WriteField(\"deploy-changed-only\", strconv.FormatBool(*deploymentCreate.DeployChangedOnly)); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\n\tif deploymentCreate.DeploymentSource != nil {\n\t\tif err = w.WriteField(\"deployment-source\", *deploymentCreate.DeploymentSource); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\n\tif deploymentCreate.TenantId != nil {\n\t\tif err = w.WriteField(\"tenant-id\", *deploymentCreate.TenantId); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\n\tfor key, resource := range deploymentCreate.Resources {\n\t\tvar fw io.Writer\n\n\t\tif x, ok := resource.(io.Closer); ok {\n\t\t\tdefer x.Close()\n\t\t}\n\n\t\tif x, ok := resource.(*os.File); ok {\n\t\t\tif fw, err = w.CreateFormFile(key, x.Name()); err != nil {\n\t\t\t\treturn nil, err\n\t\t\t}\n\t\t} else if _, ok := resource.(multipart.File); ok {\n\t\t\tif fw, err = w.CreateFormFile(key, key); err != nil {\n\t\t\t\treturn nil, err\n\t\t\t}\n\t\t} else {\n\t\t\tif fw, err = w.CreateFormField(key); err != nil {\n\t\t\t\treturn nil, err\n\t\t\t}\n\t\t}\n\n\t\tif r, ok := resource.(io.Reader); ok {\n\t\t\tif _, err = io.Copy(fw, r); err != nil {\n\t\t\t\treturn nil, err\n\t\t\t}\n\t\t}\n\t}\n\n\tif err := w.Close(); err != nil {\n\t\treturn nil, err\n\t}\n\n\tres, err := d.client.do(http.MethodPost, \"/deployment/create\", map[string]string{}, body, w.FormDataContentType())\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\terr = d.client.readJsonResponse(res, deployment)\n\n\treturn deployment, err\n}", "title": "" }, { "docid": "ebbff3ba0f1ce4079683b6cd5c70429b", "score": "0.61364067", "text": "func (c Client) Create(input *CreateDeploymentInput) (*CreateDeploymentResponse, error) {\n\treturn c.CreateWithContext(context.Background(), input)\n}", "title": "" }, { "docid": "f729b9d1426221de972bf8c8ca944567", "score": "0.6131192", "text": "func (mgr *DeploymentManager) Create(spec interface{}) error {\n\n\tswitch s := spec.(type) {\n\tdefault:\n\t\tlog.Errorf(\"Invalid spec type %T for Deployment create action.\", s)\n\t\treturn fmt.Errorf(\"Invalid spec type %T for Deployment create action.\", s)\n\tcase *appsv1.Deployment:\n\t\ttid, _ := strconv.Atoi(s.Labels[\"tid\"])\n\t\tcid := tid % len(mgr.clientsets)\n\n\t\tns := mgr.namespace\n\t\tif s.Namespace != \"\" {\n\t\t\tns = s.Namespace\n\t\t\tmgr.depMutex.Lock()\n\t\t\tif _, exist := mgr.nsSet[ns]; !exist && ns != apiv1.NamespaceDefault {\n\t\t\t\tnsSpec := &apiv1.Namespace{ObjectMeta: metav1.ObjectMeta{Name: ns}}\n\t\t\t\t_, err := mgr.client.CoreV1().Namespaces().Create(nsSpec)\n\t\t\t\tmgr.nsSet[ns] = true\n\t\t\t\tif err != nil {\n\t\t\t\t\tif strings.Contains(err.Error(), \"already exists\") {\n\t\t\t\t\t\tmgr.nsSet[ns] = true\n\t\t\t\t\t} else {\n\t\t\t\t\t\tlog.Warningf(\"Fail to create namespace %s, %v\", ns, err)\n\t\t\t\t\t}\n\t\t\t\t} else {\n\t\t\t\t\tmgr.nsSet[ns] = true\n\t\t\t\t}\n\t\t\t}\n\t\t\tmgr.depMutex.Unlock()\n\t\t}\n\n\t\tstartTime := metav1.Now()\n\t\tdep, err := mgr.clientsets[cid].AppsV1().Deployments(ns).Create(s)\n\n\t\tlatency := metav1.Now().Time.Sub(startTime.Time).Round(time.Microsecond)\n\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\tmgr.alMutex.Lock()\n\t\tmgr.apiTimes[CREATE_ACTION] = append(mgr.apiTimes[CREATE_ACTION], latency)\n\t\tmgr.alMutex.Unlock()\n\n\t\tmgr.depMutex.Lock()\n\t\tmgr.depNs[dep.Name] = ns\n\t\tmgr.depMutex.Unlock()\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "4f04c186bfe8b1478e68ddbd62eb067a", "score": "0.61208785", "text": "func NewDeployment(name, namespace string, do ...DeploymentOption) *appsv1.Deployment {\n\td := &appsv1.Deployment{\n\t\tObjectMeta: metav1.ObjectMeta{\n\t\t\tNamespace: namespace,\n\t\t\tName: name,\n\t\t},\n\t\tSpec: appsv1.DeploymentSpec{\n\t\t\tTemplate: corev1.PodTemplateSpec{\n\t\t\t\tSpec: corev1.PodSpec{\n\t\t\t\t\tContainers: []corev1.Container{{}},\n\t\t\t\t},\n\t\t\t},\n\t\t},\n\t}\n\tfor _, opt := range do {\n\t\topt(d)\n\t}\n\treturn d\n}", "title": "" }, { "docid": "dc99190fae45bbc1452d4e66ef6b748a", "score": "0.6106538", "text": "func NewDeployment() DeploymentBuilder {\n\treturn &Deployment{}\n}", "title": "" }, { "docid": "9896b656edcec7d0f35f28cb1138d6fe", "score": "0.6073959", "text": "func NewDeployment(name, ns string, replicas int32, labels map[string]string, containers []v1.Container) *DeploymentBuilder {\n\tif containers == nil {\n\t\tcontainers = []v1.Container{\n\t\t\t{\n\t\t\t\tName: \"container-busybox\",\n\t\t\t\tImage: \"gcr.io/velero-gcp/busybox:latest\",\n\t\t\t\tCommand: []string{\"sleep\", \"1000000\"},\n\t\t\t\t// Make pod obeys the restricted pod security standards.\n\t\t\t\tSecurityContext: &v1.SecurityContext{\n\t\t\t\t\tAllowPrivilegeEscalation: boolptr.False(),\n\t\t\t\t\tCapabilities: &v1.Capabilities{\n\t\t\t\t\t\tDrop: []v1.Capability{\"ALL\"},\n\t\t\t\t\t},\n\t\t\t\t\tRunAsNonRoot: boolptr.True(),\n\t\t\t\t\tRunAsUser: func(i int64) *int64 { return &i }(65534),\n\t\t\t\t\tRunAsGroup: func(i int64) *int64 { return &i }(65534),\n\t\t\t\t\tSeccompProfile: &v1.SeccompProfile{\n\t\t\t\t\t\tType: v1.SeccompProfileTypeRuntimeDefault,\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t},\n\t\t}\n\t}\n\treturn &DeploymentBuilder{\n\t\t&apps.Deployment{\n\t\t\tTypeMeta: metav1.TypeMeta{\n\t\t\t\tKind: \"Deployment\",\n\t\t\t\tAPIVersion: \"apps/v1\",\n\t\t\t},\n\t\t\tObjectMeta: metav1.ObjectMeta{\n\t\t\t\tNamespace: ns,\n\t\t\t\tName: name,\n\t\t\t\tLabels: labels,\n\t\t\t},\n\t\t\tSpec: apps.DeploymentSpec{\n\t\t\t\tReplicas: &replicas,\n\t\t\t\tSelector: &metav1.LabelSelector{MatchLabels: labels},\n\t\t\t\tStrategy: apps.DeploymentStrategy{\n\t\t\t\t\tType: apps.RollingUpdateDeploymentStrategyType,\n\t\t\t\t\tRollingUpdate: new(apps.RollingUpdateDeployment),\n\t\t\t\t},\n\t\t\t\tTemplate: v1.PodTemplateSpec{\n\t\t\t\t\tObjectMeta: metav1.ObjectMeta{\n\t\t\t\t\t\tLabels: labels,\n\t\t\t\t\t},\n\t\t\t\t\tSpec: v1.PodSpec{\n\t\t\t\t\t\tSecurityContext: &v1.PodSecurityContext{\n\t\t\t\t\t\t\tFSGroup: func(i int64) *int64 { return &i }(65534),\n\t\t\t\t\t\t\tFSGroupChangePolicy: func(policy v1.PodFSGroupChangePolicy) *v1.PodFSGroupChangePolicy { return &policy }(v1.FSGroupChangeAlways),\n\t\t\t\t\t\t},\n\t\t\t\t\t\tContainers: containers,\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t},\n\t\t},\n\t}\n}", "title": "" }, { "docid": "86e27ebcfacf59cd01c587dcfbd73d1b", "score": "0.60678744", "text": "func NewDeployment(ns, name string, opts ...ObjectOption) *appsv1.Deployment {\n\td := &appsv1.Deployment{\n\t\tObjectMeta: metav1.ObjectMeta{\n\t\t\tNamespace: ns,\n\t\t\tName: name,\n\t\t},\n\t}\n\n\tfor _, opt := range opts {\n\t\topt(d)\n\t}\n\n\t// If the Deployment was created without defining a Container\n\t// explicitly, ensure its default container's name is not empty.\n\tcontainers := d.Spec.Template.Spec.Containers\n\tif len(containers) == 1 && containers[0].Name == \"\" {\n\t\tcontainers[0].Name = defaultContainerName\n\t}\n\n\treturn d\n}", "title": "" }, { "docid": "5f7993dc1417c591da8bdde2adb50d04", "score": "0.60665816", "text": "func NewDeployment(\n\tclient client.Client,\n\tkConfig *rest.Config,\n\tstosCluster *storageosv1.StorageOSCluster,\n\tnfsServer *storageosv1.NFSServer,\n\tlabels map[string]string,\n\trecorder record.EventRecorder,\n\tscheme *runtime.Scheme) *Deployment {\n\treturn &Deployment{\n\t\tclient: client,\n\t\tkConfig: kConfig,\n\t\tnfsServer: nfsServer,\n\t\trecorder: recorder,\n\t\tscheme: scheme,\n\t\tcluster: stosCluster,\n\t\tk8sResourceManager: k8s.NewResourceManager(client).SetLabels(labels),\n\t}\n}", "title": "" }, { "docid": "69ca5eaa74f6e6dda7467ac8fe2cee55", "score": "0.606249", "text": "func newClientDeployment() *appsv1.Deployment {\n\treturn &appsv1.Deployment{\n\t\tObjectMeta: metav1.ObjectMeta{\n\t\t\tName: \"scalog-client-deployment\",\n\t\t\tNamespace: \"scalog\",\n\t\t\tLabels: map[string]string{\n\t\t\t\t\"app\": \"scalog-client\",\n\t\t\t},\n\t\t},\n\t\tSpec: appsv1.DeploymentSpec{\n\t\t\tSelector: &metav1.LabelSelector{\n\t\t\t\tMatchLabels: map[string]string{\n\t\t\t\t\t\"app\": \"scalog-client\",\n\t\t\t\t},\n\t\t\t},\n\t\t\tTemplate: corev1.PodTemplateSpec{\n\t\t\t\tObjectMeta: metav1.ObjectMeta{\n\t\t\t\t\tLabels: map[string]string{\n\t\t\t\t\t\t\"app\": \"scalog-client\",\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t\tSpec: corev1.PodSpec{\n\t\t\t\t\tServiceAccountName: \"scalog-service-account\",\n\t\t\t\t\tContainers: []corev1.Container{\n\t\t\t\t\t\tcorev1.Container{\n\t\t\t\t\t\t\tName: \"scalog-client-node\",\n\t\t\t\t\t\t\tImage: \"scalog/scalog:latest\",\n\t\t\t\t\t\t\tCommand: []string{\"./scalog\"},\n\t\t\t\t\t\t\tArgs: []string{\"k8sclient\"},\n\t\t\t\t\t\t\tImagePullPolicy: \"Always\",\n\t\t\t\t\t\t\tStdin: true,\n\t\t\t\t\t\t\tTTY: true,\n\t\t\t\t\t\t\tPorts: []corev1.ContainerPort{\n\t\t\t\t\t\t\t\tcorev1.ContainerPort{ContainerPort: 21024},\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\tEnv: []corev1.EnvVar{\n\t\t\t\t\t\t\t\tcorev1.EnvVar{\n\t\t\t\t\t\t\t\t\tName: \"NAME\",\n\t\t\t\t\t\t\t\t\tValueFrom: &corev1.EnvVarSource{\n\t\t\t\t\t\t\t\t\t\tFieldRef: &corev1.ObjectFieldSelector{\n\t\t\t\t\t\t\t\t\t\t\tFieldPath: \"metadata.name\",\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\tcorev1.EnvVar{\n\t\t\t\t\t\t\t\t\tName: \"NAMESPACE\",\n\t\t\t\t\t\t\t\t\tValueFrom: &corev1.EnvVarSource{\n\t\t\t\t\t\t\t\t\t\tFieldRef: &corev1.ObjectFieldSelector{\n\t\t\t\t\t\t\t\t\t\t\tFieldPath: \"metadata.namespace\",\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\tcorev1.EnvVar{\n\t\t\t\t\t\t\t\t\tName: \"POD_IP\",\n\t\t\t\t\t\t\t\t\tValueFrom: &corev1.EnvVarSource{\n\t\t\t\t\t\t\t\t\t\tFieldRef: &corev1.ObjectFieldSelector{\n\t\t\t\t\t\t\t\t\t\t\tFieldPath: \"status.podIP\",\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},\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t},\n\t\t},\n\t}\n}", "title": "" }, { "docid": "e89d3eba3434d915a81aef15068022e3", "score": "0.60106105", "text": "func (s *Deployment) Deploy() error {\n\tif err := s.createNamespace(); err != nil {\n\t\treturn err\n\t}\n\n\tif err := s.createServiceAccountForDaemonSet(); err != nil {\n\t\treturn err\n\t}\n\n\tif err := s.createRoleForKeyMgmt(); err != nil {\n\t\treturn err\n\t}\n\n\tif err := s.createRoleBindingForKeyMgmt(); err != nil {\n\t\treturn err\n\t}\n\n\tif err := s.createClusterRoleForNFS(); err != nil {\n\t\treturn err\n\t}\n\n\tif err := s.createClusterRoleBindingForNFS(); err != nil {\n\t\treturn err\n\t}\n\n\tif err := s.createClusterRoleForInit(); err != nil {\n\t\treturn err\n\t}\n\n\tif err := s.createClusterRoleBindingForInit(); err != nil {\n\t\treturn err\n\t}\n\n\tif err := s.createInitSecret(); err != nil {\n\t\treturn err\n\t}\n\n\tif err := s.createTLSEtcdSecret(); err != nil {\n\t\treturn err\n\t}\n\n\tif err := s.createConfigMap(); err != nil {\n\t\treturn err\n\t}\n\n\tif err := s.createDaemonSet(); err != nil {\n\t\treturn err\n\t}\n\n\tif err := s.createService(); err != nil {\n\t\treturn err\n\t}\n\n\tif s.stos.Spec.Ingress.Enable {\n\t\tif s.stos.Spec.Ingress.TLS {\n\t\t\tif err := s.createTLSSecret(); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t\tif err := s.createIngress(); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\tif s.stos.Spec.CSI.Enable {\n\t\t// Create CSIDriver if supported.\n\t\tsupportsCSIDriver, err := HasCSIDriverKind(s.discoveryClient)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tif supportsCSIDriver {\n\t\t\tif err := s.createCSIDriver(); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t\t// Create CSI exclusive resources.\n\t\tif err := s.createCSISecrets(); err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\tif err := s.createClusterRoleForDriverRegistrar(); err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\tif err := s.createClusterRoleBindingForDriverRegistrar(); err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\tif err := s.createClusterRoleBindingForK8SDriverRegistrar(); err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\tif err := s.createServiceAccountForCSIHelper(); err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\tif err := s.createClusterRoleForProvisioner(); err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\tif err := s.createClusterRoleForAttacher(); err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\tif err := s.createClusterRoleBindingForProvisioner(); err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\tif err := s.createClusterRoleBindingForAttacher(); err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\tif err := s.createCSIHelper(); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\tif !s.stos.Spec.DisableScheduler {\n\t\tif err := s.createSchedulerExtender(); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\t// Add openshift security context constraints.\n\tif strings.Contains(s.stos.Spec.K8sDistro, K8SDistroOpenShift) {\n\t\tif err := s.createClusterRoleForSCC(); err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\tif err := s.createClusterRoleBindingForSCC(); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\t// Create role for Pod Fencing.\n\tif !s.stos.Spec.DisableFencing {\n\t\tif err := s.createClusterRoleForFencing(); err != nil {\n\t\t\treturn err\n\t\t}\n\t\tif err := s.createClusterRoleBindingForFencing(); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\tif err := s.createStorageClass(); err != nil {\n\t\treturn err\n\t}\n\n\tstatus, err := s.getStorageOSStatus()\n\tif err != nil {\n\t\treturn fmt.Errorf(\"failed to get storageos status: %v\", err)\n\t}\n\treturn s.updateStorageOSStatus(status)\n}", "title": "" }, { "docid": "834e3171946e955b13fd79e967fe4492", "score": "0.5992537", "text": "func (builder *GatewayBuilder) DeployAPI() error {\n\tsvc := apigateway.New(session.New(), &aws.Config{Region: builder.Settings.Region})\n\n\tparams := &apigateway.CreateDeploymentInput{\n\t\tRestApiId: builder.APIGateway.Id,\n\t\tStageName: aws.String(\"prod\"),\n\t}\n\t_, err := svc.CreateDeployment(params)\n\n\treturn err\n}", "title": "" }, { "docid": "6f54b7507c7c23f0bd7606acd2820f1b", "score": "0.59717", "text": "func newDeploymentForCR(cr *uniformv1alpha1.Integration) *appsv1.Deployment {\n\ttopics := \"\"\n\n\tfor i, topic := range cr.Spec.Events {\n\t\ttopics = topics + topic\n\t\tif i < len(cr.Spec.Events)-1 {\n\t\t\ttopics = topics + \",\"\n\t\t}\n\t}\n\n\tf := func(s int32) *int32 {\n\t\treturn &s\n\t}\n\n\tenvVars := cr.Spec.Env\n\n\tversion := \"n/a\"\n\tsplit := strings.Split(cr.Spec.Image, \":\")\n\tif len(split) > 1 {\n\t\tversion = split[1]\n\t}\n\n\treturn &appsv1.Deployment{\n\t\tObjectMeta: metav1.ObjectMeta{\n\t\t\tName: cr.Name,\n\t\t\tNamespace: \"keptn\",\n\t\t},\n\t\tSpec: appsv1.DeploymentSpec{\n\t\t\tReplicas: f(1),\n\t\t\tSelector: &metav1.LabelSelector{\n\t\t\t\tMatchLabels: map[string]string{\n\t\t\t\t\t\"run\": cr.Name,\n\t\t\t\t},\n\t\t\t},\n\t\t\tTemplate: corev1.PodTemplateSpec{\n\t\t\t\tObjectMeta: metav1.ObjectMeta{\n\t\t\t\t\tLabels: map[string]string{\n\t\t\t\t\t\t\"run\": cr.Name,\n\t\t\t\t\t\t\"app.kubernetes.io/version\": version,\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t\tSpec: corev1.PodSpec{\n\t\t\t\t\tContainers: []corev1.Container{\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tName: cr.Name,\n\t\t\t\t\t\t\tImage: cr.Spec.Image,\n\t\t\t\t\t\t\tPorts: []corev1.ContainerPort{\n\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\tContainerPort: 8080,\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\tEnv: envVars,\n\t\t\t\t\t\t},\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tName: \"distributor\",\n\t\t\t\t\t\t\tImage: \"keptn/distributor:0.8.4\",\n\t\t\t\t\t\t\tEnv: []corev1.EnvVar{\n\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\tName: \"PUBSUB_RECIPIENT\",\n\t\t\t\t\t\t\t\t\tValue: cr.Name,\n\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\tName: \"PUBSUB_TOPIC\",\n\t\t\t\t\t\t\t\t\tValue: topics,\n\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\tName: \"PUBSUB_URL\",\n\t\t\t\t\t\t\t\t\tValue: \"nats://keptn-nats-cluster\",\n\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\tName: \"VERSION\",\n\t\t\t\t\t\t\t\t\tValueFrom: &corev1.EnvVarSource{\n\t\t\t\t\t\t\t\t\t\tFieldRef: &corev1.ObjectFieldSelector{\n\t\t\t\t\t\t\t\t\t\t\tAPIVersion: \"v1\",\n\t\t\t\t\t\t\t\t\t\t\tFieldPath: \"metadata.labels['app.kubernetes.io/version']\",\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\t{\n\t\t\t\t\t\t\t\t\tName: \"K8S_DEPLOYMENT_NAME\",\n\t\t\t\t\t\t\t\t\tValue: cr.Name,\n\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\tName: \"K8S_POD_NAME\",\n\t\t\t\t\t\t\t\t\tValueFrom: &corev1.EnvVarSource{\n\t\t\t\t\t\t\t\t\t\tFieldRef: &corev1.ObjectFieldSelector{\n\t\t\t\t\t\t\t\t\t\t\tAPIVersion: \"v1\",\n\t\t\t\t\t\t\t\t\t\t\tFieldPath: \"metadata.name\",\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\t{\n\t\t\t\t\t\t\t\t\tName: \"K8S_NAMESPACE\",\n\t\t\t\t\t\t\t\t\tValueFrom: &corev1.EnvVarSource{\n\t\t\t\t\t\t\t\t\t\tFieldRef: &corev1.ObjectFieldSelector{\n\t\t\t\t\t\t\t\t\t\t\tAPIVersion: \"v1\",\n\t\t\t\t\t\t\t\t\t\t\tFieldPath: \"metadata.namespace\",\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\t{\n\t\t\t\t\t\t\t\t\tName: \"K8S_NODE_NAME\",\n\t\t\t\t\t\t\t\t\tValueFrom: &corev1.EnvVarSource{\n\t\t\t\t\t\t\t\t\t\tFieldRef: &corev1.ObjectFieldSelector{\n\t\t\t\t\t\t\t\t\t\t\tAPIVersion: \"v1\",\n\t\t\t\t\t\t\t\t\t\t\tFieldPath: \"spec.nodeName\",\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\tSecurityContext: &corev1.SecurityContext{\n\t\t\t\t\t\t\t\tRunAsUser: intp(65532),\n\t\t\t\t\t\t\t\tRunAsNonRoot: boolp(true),\n\t\t\t\t\t\t\t\tReadOnlyRootFilesystem: boolp(true),\n\t\t\t\t\t\t\t\tAllowPrivilegeEscalation: boolp(false),\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t},\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t},\n\t\t},\n\t}\n}", "title": "" }, { "docid": "b8d9b80e74d177f2a6b47d83521d0bc3", "score": "0.5939297", "text": "func NewDeployment(cfg DeploymentConfig, out io.Writer) (*Deployment, error) {\n\tcommon.RemoveContents(directory)\n\n\t// Set up git repository\n\tpemFile, err := os.Open(cfg.PemFilePath)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tauthMethod, err := auth.GetGithubKey(pemFile)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\trepo, err := git.InitializeRepository(directory, cfg.RemoteURL, cfg.Branch, authMethod, out)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\t// Set up deployment database\n\tmanager, err := newDataManager(cfg.DatabasePath)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\t// Create deployment\n\treturn &Deployment{\n\t\t// Properties\n\t\tdirectory: directory,\n\t\tproject: cfg.ProjectName,\n\t\tbranch: cfg.Branch,\n\t\tbuildType: cfg.BuildType,\n\n\t\t// Functions\n\t\tbuilders: map[string]Builder{\n\t\t\t\"herokuish\": herokuishBuild,\n\t\t\t\"dockerfile\": dockerBuild,\n\t\t\t\"docker-compose\": dockerCompose,\n\t\t},\n\t\tcontainerStopper: containers.StopActiveContainers,\n\n\t\t// Repository\n\t\tauth: authMethod,\n\t\trepo: repo,\n\n\t\t// Persistent data manager\n\t\tdataManager: manager,\n\t}, nil\n}", "title": "" }, { "docid": "cf4621eea208094787ce9ad9fd4161c3", "score": "0.59193027", "text": "func (r *Deployer) CreateOrUpdateDeployment(d *extensions.Deployment, env string) (*extensions.Deployment, error) {\n\tlog.WithField(\"image\", d.Spec.Template.Spec.Containers[0].Image).Info(\"Deployment\")\n\n\tnewD, err := r.Client.Deployments(env).Create(d)\n\tif err != nil {\n\t\tif !apierrs.IsAlreadyExists(err) {\n\t\t\treturn nil, err\n\t\t}\n\t\td, err = r.Client.Deployments(env).Update(d)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tlog.Infof(\"Deployment updated: %+v\", d)\n\t\treturn d, nil\n\n\t}\n\tlog.Infof(\"Deployment created: %+v\", d)\n\treturn newD, nil\n}", "title": "" }, { "docid": "0487ce6099b6052a7ef417ca9b1fc087", "score": "0.5892561", "text": "func CreateOrUpdateDeployment(\n\tk8sClient client.Client,\n\tdeployment *appsv1.Deployment,\n\townerRef *metav1.OwnerReference,\n) error {\n\texistingDeployment := &appsv1.Deployment{}\n\terr := k8sClient.Get(\n\t\tcontext.TODO(),\n\t\ttypes.NamespacedName{\n\t\t\tName: deployment.Name,\n\t\t\tNamespace: deployment.Namespace,\n\t\t},\n\t\texistingDeployment,\n\t)\n\tif errors.IsNotFound(err) {\n\t\tlogrus.Infof(\"Creating %s Deployment\", deployment.Name)\n\t\treturn k8sClient.Create(context.TODO(), deployment)\n\t} else if err != nil {\n\t\treturn err\n\t}\n\n\tfor _, o := range existingDeployment.OwnerReferences {\n\t\tif o.UID != ownerRef.UID {\n\t\t\tdeployment.OwnerReferences = append(deployment.OwnerReferences, o)\n\t\t}\n\t}\n\n\tlogrus.Debugf(\"Updating %s Deployment\", deployment.Name)\n\treturn k8sClient.Update(context.TODO(), deployment)\n}", "title": "" }, { "docid": "574e6639ba73ea072f4d1f6b5c5652c1", "score": "0.58882904", "text": "func (td *OsmTestData) CreateDeployment(ns string, deployment appsv1.Deployment) (*appsv1.Deployment, error) {\n\tmaxRetries := td.getMaxPodCreationRetries()\n\n\tfor i := 1; i <= maxRetries; i++ {\n\t\tif i > 1 {\n\t\t\t// Sleep before next retry\n\t\t\ttime.Sleep(delayIntervalForPodCreationRetries)\n\t\t}\n\t\tdeploymentRet, err := td.Client.AppsV1().Deployments(ns).Create(context.Background(), &deployment, metav1.CreateOptions{})\n\t\tif err != nil {\n\t\t\ttd.T.Logf(\"Could not create Deployment in attempt %d due to error: %v\", i, err)\n\t\t\tcontinue\n\t\t}\n\t\treturn deploymentRet, nil\n\t}\n\treturn nil, fmt.Errorf(\"Error creating Deployment in namespace %s after %d attempts\", ns, maxRetries)\n}", "title": "" }, { "docid": "741719fce27ab52b53d63e40b81a8532", "score": "0.588664", "text": "func (s *DeprecatedREST) Create(ctx kapi.Context, obj runtime.Object) (runtime.Object, error) {\n\trollback, ok := obj.(*deployapi.DeploymentConfigRollback)\n\tif !ok {\n\t\treturn nil, kerrors.NewBadRequest(fmt.Sprintf(\"not a rollback spec: %#v\", obj))\n\t}\n\n\tif errs := validation.ValidateDeploymentConfigRollbackDeprecated(rollback); len(errs) > 0 {\n\t\treturn nil, kerrors.NewInvalid(deployapi.Kind(\"DeploymentConfigRollback\"), \"\", errs)\n\t}\n\n\t// Roll back \"from\" the current deployment \"to\" a target deployment\n\n\t// Find the target (\"to\") deployment and decode the DeploymentConfig\n\ttargetDeployment, err := s.generator.GetDeployment(ctx, rollback.Spec.From.Name)\n\tif err != nil {\n\t\tif kerrors.IsNotFound(err) {\n\t\t\treturn nil, newInvalidDeploymentError(rollback, \"Deployment not found\")\n\t\t}\n\t\treturn nil, newInvalidDeploymentError(rollback, fmt.Sprintf(\"%v\", err))\n\t}\n\n\tto, err := deployutil.DecodeDeploymentConfig(targetDeployment, s.codec)\n\tif err != nil {\n\t\treturn nil, newInvalidDeploymentError(rollback,\n\t\t\tfmt.Sprintf(\"couldn't decode DeploymentConfig from Deployment: %v\", err))\n\t}\n\n\t// Find the current (\"from\") version of the target deploymentConfig\n\tfrom, err := s.generator.GetDeploymentConfig(ctx, to.Name)\n\tif err != nil {\n\t\tif kerrors.IsNotFound(err) {\n\t\t\treturn nil, newInvalidDeploymentError(rollback,\n\t\t\t\tfmt.Sprintf(\"couldn't find a current DeploymentConfig %s/%s\", targetDeployment.Namespace, to.Name))\n\t\t}\n\t\treturn nil, newInvalidDeploymentError(rollback,\n\t\t\tfmt.Sprintf(\"error finding current DeploymentConfig %s/%s: %v\", targetDeployment.Namespace, to.Name, err))\n\t}\n\n\treturn s.generator.GenerateRollback(from, to, &rollback.Spec)\n}", "title": "" }, { "docid": "6cd5bb772f250d5d9649d8af2fe3594c", "score": "0.5880999", "text": "func newDeploymentForAlarmGen(cr *analyticsv1alpha1.TFAnalytics) *betav1.Deployment {\n\tlabels := map[string]string{\n\t\t\"app\": cr.Name + \"-alarm-gen\",\n\t}\n\n\tdeploy := &betav1.Deployment{\n\t\tObjectMeta: metav1.ObjectMeta{\n\t\t\tName: cr.Name + \"-alarm-gen\",\n\t\t\tNamespace: cr.Namespace,\n\t\t\tLabels: labels,\n\t\t},\n\t\tSpec: betav1.DeploymentSpec{\n\t\t\tReplicas: cr.Spec.AlarmGenSpec.Replicas,\n\t\t\tTemplate: corev1.PodTemplateSpec{\n\t\t\t\tObjectMeta: metav1.ObjectMeta{\n\t\t\t\t\tLabels: labels,\n\t\t\t\t},\n\t\t\t\tSpec: corev1.PodSpec{\n\t\t\t\t\tContainers: []corev1.Container{\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tName: cr.Name + \"-alarm-gen\",\n\t\t\t\t\t\t\tImage: cr.Spec.AlarmGenSpec.Image,\n\t\t\t\t\t\t},\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t},\n\t\t},\n\t}\n\t// set co config maps\n\tconfigMaps := getConfigMapsObject(cr)\n\tif len(configMaps) > 0 {\n\t\tdeploy.Spec.Template.Spec.Containers[0].EnvFrom = configMaps\n\t}\n\t// set ports if defined\n\tports := cr.Spec.AlarmGenSpec.Ports.GetContainerPortList()\n\tif len(ports) > 0 {\n\t\tdeploy.Spec.Template.Spec.Containers[0].Ports = ports\n\t} else {\n\t\t// If ports are not defined\n\t\tdeploy.Spec.Template.Spec.Containers[0].Ports = []corev1.ContainerPort{\n\t\t\t{Name: \"introspect\", ContainerPort: 5995},\n\t\t}\n\t}\n\n\t// set environment variable(s) if defined in spec\n\tenvs := cr.Spec.AlarmGenSpec.EnvList\n\tif len(envs) > 0 {\n\t\tdeploy.Spec.Template.Spec.Containers[0].Env = envs\n\t}\n\n\treturn deploy\n}", "title": "" }, { "docid": "450bf4288b4dc36aa7038a0386da1722", "score": "0.58781034", "text": "func CreateDeployment(db Database) (err error) {\n\tname := *db.Name\n\n\tdeploySpec := &extensions.Deployment{\n\t\tTypeMeta: vapi.TypeMeta{\n\t\t\tKind: \"Deployment\",\n\t\t\tAPIVersion: \"extensions/v1beta1\",\n\t\t},\n\t\tObjectMeta: api.ObjectMeta{\n\t\t\tName: name,\n\t\t},\n\t\tSpec: extensions.DeploymentSpec{\n\t\t\tReplicas: 1,\n\t\t\tTemplate: api.PodTemplateSpec{\n\t\t\t\tObjectMeta: api.ObjectMeta{\n\t\t\t\t\tName: name,\n\t\t\t\t\tLabels: map[string]string{\"database\": name},\n\t\t\t\t},\n\t\t\t\tSpec: api.PodSpec{\n\t\t\t\t\tContainers: []api.Container{\n\t\t\t\t\t\tapi.Container{\n\t\t\t\t\t\t\tName: \"couchdb\",\n\t\t\t\t\t\t\tImage: \"klaemo/couchdb:latest\",\n\t\t\t\t\t\t\tPorts: []api.ContainerPort{\n\t\t\t\t\t\t\t\tapi.ContainerPort{ContainerPort: 5984, Protocol: api.ProtocolTCP},\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\tImagePullPolicy: api.PullIfNotPresent,\n\t\t\t\t\t\t\tEnv: []api.EnvVar{\n\t\t\t\t\t\t\t\tapi.EnvVar{\n\t\t\t\t\t\t\t\t\tName: \"COUCHDB_USER\",\n\t\t\t\t\t\t\t\t\tValue: couchdbUser,\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\tapi.EnvVar{\n\t\t\t\t\t\t\t\t\tName: \"COUCHDB_PASSWORD\",\n\t\t\t\t\t\t\t\t\tValue: couchdbPassword,\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t},\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t},\n\t\t},\n\t}\n\n\tdeploy := kube.Extensions().Deployments(namespace)\n\t_, err = deploy.Create(deploySpec)\n\treturn err\n\n}", "title": "" }, { "docid": "cda6a2da7d3eed169837d6da9ad41120", "score": "0.58563876", "text": "func Create(cxn *connection.Connection, accessor Accessor) error {\n\tdeployment := accessor.(connection.Deployment)\n\n\tnewDeployment, err := cxn.CreateDeployment(deployment)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tif err := cxn.AddTeams(newDeployment.ID, deployment); err != nil {\n\t\treturn err\n\t}\n\tcxn.Add(newDeployment.ID)\n\treturn nil\n}", "title": "" }, { "docid": "410c3e4a217f3228d5c9265509089556", "score": "0.5849404", "text": "func CreateApp(client kubernetes.Interface, istioClient istio.Interface, namespace *common.NamespaceQuery, appName string, newApp *api.NewApplication) error {\n\t// TODO validation\n\tvar err error\n\tversion := newApp.Version\n\tif version == \"\" {\n\t\treturn errors.New(\"Application creation without app version\")\n\t}\n\n\t// 1. Create service\n\tsvc := &v1.Service{\n\t\tTypeMeta: metav1.TypeMeta{\n\t\t\tKind: api2.ResourceKindService,\n\t\t\tAPIVersion: \"v1\",\n\t\t},\n\t\tObjectMeta: metav1.ObjectMeta{\n\t\t\tName: appName,\n\t\t\tNamespace: namespace.ToRequestParam(),\n\t\t\tLabels: map[string]string{\n\t\t\t\t\"app\": appName,\n\t\t\t\t\"qcloud-app\": appName,\n\t\t\t},\n\t\t},\n\t\tSpec: v1.ServiceSpec{\n\t\t\tPorts: newApp.Ports,\n\t\t\tSelector: map[string]string{\n\t\t\t\t\"app\": appName,\n\t\t\t},\n\t\t\tType: v1.ServiceTypeClusterIP,\n\t\t},\n\t}\n\t_, err = client.CoreV1().Services(namespace.ToRequestParam()).Create(svc)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tvar replica int32\n\tif newApp.Replicas > 0 {\n\t\treplica = newApp.Replicas\n\t} else {\n\t\t// default value\n\t\treplica = 2\n\t}\n\n\tnewPodSpec := newApp.PodTemplate\n\tnewPodSpec.Labels[\"app\"] = appName\n\tnewPodSpec.Labels[\"qcloud-app\"] = appName\n\tnewPodSpec.Labels[\"version\"] = version\n\n\tvar limit int32 = 5\n\tvar deadlineSeconds int32 = 600\n\tnewDep := &v1beta1.Deployment{\n\t\tTypeMeta: metav1.TypeMeta{\n\t\t\tKind: api2.ResourceKindDeployment,\n\t\t\tAPIVersion: \"extensions/v1beta1\",\n\t\t},\n\t\tObjectMeta: metav1.ObjectMeta{\n\t\t\tName: fmt.Sprintf(\"%s-%s\", appName, version),\n\t\t\tNamespace: namespace.ToRequestParam(),\n\t\t\tLabels: map[string]string{\n\t\t\t\t\"app\": appName,\n\t\t\t\t\"qcloud-app\": appName,\n\t\t\t\t\"version\": version,\n\t\t\t},\n\t\t},\n\t\tSpec: v1beta1.DeploymentSpec{\n\t\t\tReplicas: &replica,\n\t\t\tSelector: &metav1.LabelSelector{\n\t\t\t\tMatchLabels: map[string]string{\n\t\t\t\t\t\"app\": appName,\n\t\t\t\t\t\"version\": version,\n\t\t\t\t},\n\t\t\t},\n\t\t\tTemplate: newPodSpec,\n\t\t\tStrategy: v1beta1.DeploymentStrategy{\n\t\t\t\tType: v1beta1.RollingUpdateDeploymentStrategyType,\n\t\t\t},\n\t\t\tMinReadySeconds: 10,\n\t\t\tRevisionHistoryLimit: &limit,\n\t\t\tProgressDeadlineSeconds: &deadlineSeconds,\n\t\t},\n\t}\n\n\t_, err = client.ExtensionsV1beta1().Deployments(namespace.ToRequestParam()).Create(newDep)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// 3. Create destination rule\n\trule := &istioApi.DestinationRule{\n\t\tObjectMeta: metav1.ObjectMeta{\n\t\t\tName: appName,\n\t\t\tNamespace: namespace.ToRequestParam(),\n\t\t},\n\t\tSpec: istioApi.DestinationRuleSpec{\n\t\t\tHost: appName,\n\t\t\tSubsets: []*istioApi.Subset{\n\t\t\t\t{\n\t\t\t\t\tName: version,\n\t\t\t\t\tLabels: map[string]string{\n\t\t\t\t\t\t\"version\": version,\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t},\n\t\t},\n\t}\n\t_, err = istioClient.NetworkingV1alpha3().DestinationRules(namespace.ToRequestParam()).Create(rule)\n\tif err != nil {\n\t\treturn err\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "cbb88d497bd11c9c024df796b53f7347", "score": "0.58461946", "text": "func New() *Deployer {\n\treturn &Deployer{}\n}", "title": "" }, { "docid": "bbcdaf650114587224f4ff5fa0b3a223", "score": "0.58426005", "text": "func CreateOrUpdateDeployment(clientset *kubernetes.Clientset, namespace string, deployment *appv1.Deployment) error {\n\tdeploymentExists, err := deploymentExists(clientset, namespace, deployment.Name)\n\tif deploymentExists {\n\t\tlog.Printf(\"📦 Found existing deployment '%s'. Updating.\", deployment.Name)\n\t\t_, err = clientset.AppsV1().Deployments(namespace).Update(deployment)\n\t\treturn err\n\t}\n\tlog.Printf(\"📦 Creating new deployment '%s'. Updating.\", deployment.Name)\n\t_, err = clientset.AppsV1().Deployments(namespace).Create(deployment)\n\treturn err\n}", "title": "" }, { "docid": "d7690fdedfa4f63fbf8ea83a1f7c642a", "score": "0.5830008", "text": "func NewDeployment(config Config, outputs map[string]map[string]string) *Deployment {\n\tfile, err := ioutil.TempFile(\"\", config.Name)\n\tdefer file.Close()\n\tif err != nil {\n\t\tlog.Fatalf(\"Error creating temp file for deployment: %s, error: %v\", config.FullName(), err)\n\t}\n\n\tdata := replaceOutRefs(config, outputs)\n\n\t_, err = file.Write(data)\n\tif err != nil {\n\t\tlog.Fatalf(\"Error wirte to file: %s, error: %v\", file.Name(), err)\n\t}\n\n\treturn &Deployment{\n\t\tconfig: config,\n\t\tconfigFile: file.Name(),\n\t}\n}", "title": "" }, { "docid": "47f481b3ef5b2b31a6f8fa2adec91745", "score": "0.58284944", "text": "func makeKubernetesDeployment(t *testing.T, pod TestPodDescriptor) *appsv1.Deployment {\n\treplicaCount := new(int32)\n\t*replicaCount = 1\n\n\tvolumeMounts := make([]v1.VolumeMount, 0)\n\tvolumes := make([]v1.Volume, 0)\n\n\tfor i, volume := range pod.Volumes {\n\t\tvolumeName := fmt.Sprintf(\"volume-%v\", i)\n\t\tvolumeMounts = append(volumeMounts, v1.VolumeMount{\n\t\t\tMountPath: fmt.Sprintf(\"/data-%v\", i),\n\t\t\tName: volumeName,\n\t\t})\n\t\tvolumes = append(volumes, v1.Volume{\n\t\t\tName: volumeName,\n\t\t\tVolumeSource: v1.VolumeSource{\n\t\t\t\tPersistentVolumeClaim: &v1.PersistentVolumeClaimVolumeSource{\n\t\t\t\t\tClaimName: volume.ClaimName,\n\t\t\t\t},\n\t\t\t},\n\t\t})\n\t}\n\n\tdeployment := &appsv1.Deployment{\n\t\tObjectMeta: metav1.ObjectMeta{\n\t\t\tName: pod.Name,\n\t\t},\n\t\tSpec: appsv1.DeploymentSpec{\n\t\t\tReplicas: replicaCount,\n\t\t\tSelector: &metav1.LabelSelector{\n\t\t\t\tMatchLabels: map[string]string{\n\t\t\t\t\t\"app\": pod.Name,\n\t\t\t\t},\n\t\t\t},\n\t\t\tTemplate: v1.PodTemplateSpec{\n\t\t\t\tObjectMeta: metav1.ObjectMeta{\n\t\t\t\t\tLabels: map[string]string{\n\t\t\t\t\t\t\"app\": pod.Name,\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t\tSpec: v1.PodSpec{\n\t\t\t\t\t// use google's pause container instead of a sleeping busybox\n\t\t\t\t\t// reasoning: the pause container properly terminates when the container runtime\n\t\t\t\t\t// signals TERM; a sleeping busybox will not and it will take a while before the\n\t\t\t\t\t// container is killed, unless we were to explicitly handle the TERM signal\n\t\t\t\t\tContainers: []v1.Container{\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tName: \"pause\",\n\t\t\t\t\t\t\tImage: \"gcr.io/google-containers/pause-amd64:3.1\",\n\t\t\t\t\t\t\tVolumeMounts: volumeMounts,\n\t\t\t\t\t\t},\n\t\t\t\t\t},\n\t\t\t\t\tVolumes: volumes,\n\t\t\t\t},\n\t\t\t},\n\t\t},\n\t}\n\n\tt.Logf(\"Creating deployment %v\", pod.Name)\n\t_, err := client.AppsV1().Deployments(namespace).Create(deployment)\n\tassert.NoError(t, err)\n\n\treturn deployment\n}", "title": "" }, { "docid": "b9c8b772475e78b4769d9636d96b8bd3", "score": "0.58175784", "text": "func (d *Deployer) Run(payload *DeployRequest) (*DeployResponse, error) {\n\tres := &DeployResponse{Request: *payload}\n\n\t// create namespace if needed\n\tif _, err := d.Client.Namespaces().Create(newNamespace(payload)); err != nil {\n\t\tif !apierrs.IsAlreadyExists(err) {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\n\t// create service\n\tsvc, err := d.CreateOrUpdateService(newService(payload), payload.Environment)\n\tif err != nil {\n\t\treturn res, err\n\t}\n\n\tif len(svc.Spec.Ports) > 0 {\n\t\tres.NodePort = svc.Spec.Ports[0].NodePort\n\t}\n\n\t// create deployment\n\tdeployment, err := d.CreateOrUpdateDeployment(newDeployment(payload), payload.Environment)\n\tif err != nil {\n\t\treturn res, err\n\t}\n\n\t// get deployment status\n\tr, err := labels.NewRequirement(\"name\", labels.EqualsOperator, sets.NewString(payload.ServiceID))\n\tif err != nil {\n\t\treturn res, err\n\t}\n\tselector := labels.Everything().Add(*r)\n\twatcher, err := d.Client.Deployments(payload.Environment).Watch(api.ListOptions{\n\t\tLabelSelector: selector,\n\t\tFieldSelector: fields.Everything(),\n\t\tResourceVersion: deployment.ResourceVersion,\n\t})\n\tif err != nil {\n\t\treturn res, err\n\t}\n\t// TODO: timeout?\n\td.WatchLoop(watcher, func(e watch.Event) bool {\n\t\tswitch e.Type {\n\t\tcase watch.Modified:\n\t\t\td, err := d.Client.Deployments(payload.Environment).Get(payload.ServiceID)\n\t\t\tif err != nil {\n\t\t\t\tlog.Errorf(\"Error getting deployment: %+v\", err)\n\t\t\t\treturn true\n\t\t\t}\n\t\t\tif d.Status.Replicas == d.Spec.Replicas {\n\t\t\t\treturn true\n\t\t\t}\n\t\t}\n\t\treturn false\n\t})\n\n\t_, err = d.CreateOrUpdateIngress(newIngress(res), payload.Environment)\n\tif err != nil {\n\t\treturn res, err\n\t}\n\n\tlog.Infof(\"Deployment completed: %+v\", svc)\n\treturn res, nil\n}", "title": "" }, { "docid": "e1669318ea944dc957f74774e153230b", "score": "0.58110076", "text": "func (deployer *GCPDeployer) CreateDeployment(uploadedFiles map[string]string) (interface{}, error) {\n\tif err := deployCluster(deployer, uploadedFiles); err != nil {\n\t\treturn nil, errors.New(\"Unable to deploy kubernetes: \" + err.Error())\n\t}\n\n\tresponse := &CreateDeploymentResponse{\n\t\tName: deployer.Deployment.Name,\n\t\tClusterId: deployer.GCPCluster.ClusterId,\n\t\tServices: deployer.Services,\n\t}\n\n\treturn response, nil\n}", "title": "" }, { "docid": "c18577cb314e5e84df7169f96530a196", "score": "0.58099735", "text": "func NewInstanceDeployment() *InstanceDeployment {\n\tvar instanceDeployment InstanceDeployment\n\tinstanceDeployment.Settings.Service.GSU.APIList = []string{\n\t\t\"appengine.googleapis.com\",\n\t\t\"cloudfunctions.googleapis.com\",\n\t\t\"pubsub.googleapis.com\"}\n\tinstanceDeployment.Settings.Service.GSU.APIList = append(deploy.GetCommonAPIlist(), instanceDeployment.Settings.Service.GSU.APIList...)\n\n\tinstanceDeployment.Settings.Service.IAM.RunRoles.MonitoringOrg = []iam.Role{\n\t\tmonitoringOrgRunRole()}\n\t// instanceDeployment.Settings.Service.IAM.RunRoles.Project = []iam.Role{\n\t// \tprojectRunRole()}\n\tinstanceDeployment.Settings.Service.IAM.DeployRoles.Project = []iam.Role{\n\t\tprojectDeployCoreRole(),\n\t\tiamgt.ProjectDeployExtendedRole()}\n\n\tinstanceDeployment.Settings.Service.GCB.BuildTimeout = \"600s\"\n\tinstanceDeployment.Settings.Service.GCB.DeployIAMServiceAccount = true\n\tinstanceDeployment.Settings.Service.GCB.DeployIAMBindings = true\n\tinstanceDeployment.Settings.Service.GCB.ServiceAccountBindings.GRM.Hosting.Project.CustomRoles = []string{\n\t\tprojectDeployCoreRole().Title,\n\t\tiamgt.ProjectDeployExtendedRole().Title}\n\tinstanceDeployment.Settings.Service.GCB.ServiceAccountBindings.IAM.RolesOnServiceAccounts = []string{\n\t\t\"roles/iam.serviceAccountUser\"}\n\n\tinstanceDeployment.Settings.Service.GCF.ServiceAccountBindings.GRM.Monitoring.Org.CustomRoles = []string{\n\t\tmonitoringOrgRunRole().Title}\n\n\t// Data store permissions are not supported in custom roles\n\t// instanceDeployment.Settings.Service.GCF.ServiceAccountBindings.GRM.Hosting.Project.CustomRoles = []string{\n\t// \tprojectRunRole().Title}\n\tinstanceDeployment.Settings.Service.GCF.ServiceAccountBindings.GRM.Hosting.Project.Roles = []string{\n\t\t\"roles/datastore.viewer\",\n\t\t\"roles/pubsub.publisher\"}\n\n\tinstanceDeployment.Settings.Service.GCF.AvailableMemoryMb = 128\n\tinstanceDeployment.Settings.Service.GCF.RetryTimeOutSeconds = 3600\n\tinstanceDeployment.Settings.Service.GCF.Timeout = \"60s\"\n\n\tinstanceDeployment.Settings.Service.AssetsFolderName = \"/assets\"\n\tinstanceDeployment.Settings.Service.AssetsFileName = \"data.json\"\n\tinstanceDeployment.Settings.Service.OPAFolderPath = solution.PathToFunctionCode + \"opa\"\n\tinstanceDeployment.Settings.Service.RegoModulesFolderName = \"modules\"\n\tinstanceDeployment.Settings.Service.WritabelOPAFolderPath = \"/tmp/opa\"\n\n\treturn &instanceDeployment\n}", "title": "" }, { "docid": "8716fe9cca3edf805fb8be2da589997b", "score": "0.58036053", "text": "func (a *Account) CreateDeployment(name string, e *engine.Engine) error {\n\tlog.Print(\"Creating deployment this make take a few minutes.\")\n\td := Deployment{\n\t\tName: name,\n\t\tTemplateDirectory: e.Config.GeneratedDefinitionPath,\n\t}\n\n\tticker := time.NewTicker(1 * time.Minute)\n\tquit := make(chan bool)\n\tgo func() {\n\t\tfor {\n\t\t\tselect {\n\t\t\tcase <-ticker.C:\n\t\t\t\tfmt.Print(\".\")\n\t\t\tcase <-quit:\n\t\t\t\tfmt.Print(\"\\n\")\n\t\t\t\tticker.Stop()\n\t\t\t\treturn\n\t\t\t}\n\t\t}\n\t}()\n\n\toutput, err := exec.Command(\"az\", \"group\", \"deployment\", \"create\",\n\t\t\"--name\", d.Name,\n\t\t\"--resource-group\", a.ResourceGroup.Name,\n\t\t\"--template-file\", e.Config.GeneratedTemplatePath,\n\t\t\"--parameters\", e.Config.GeneratedParametersPath).CombinedOutput()\n\tif err != nil {\n\t\tlog.Printf(\"Error while trying to start deployment for %s in resource group %s:%s\", d.Name, a.ResourceGroup.Name, err)\n\t\tlog.Printf(\"Command Output: %s\\n\", output)\n\t\treturn err\n\t}\n\tquit <- true\n\ta.Deployment = d\n\treturn nil\n}", "title": "" }, { "docid": "5c9886a9e3aae0b7e91a81627202fbdb", "score": "0.5775306", "text": "func (client *Client) CreateOrUpdate(ctx context.Context, resourceGroupName string, resourceName string, resource resources.Deployment) (*resources.DeploymentExtended, error) {\n\tresp, err := utils.NewPollerWrapper(client.DeploymentsClient.BeginCreateOrUpdate(ctx, resourceGroupName, resourceName, resource, nil)).WaitforPollerResp(ctx)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn &resp.DeploymentExtended, nil\n}", "title": "" }, { "docid": "7a142790b3fe6b3fb5fe11e7f7515a92", "score": "0.5767861", "text": "func (e *Events) CreateDeployment(pipeline signalcd.Pipeline) (signalcd.Deployment, error) {\n\tdeployment, err := e.BoltDB.CreateDeployment(pipeline)\n\tif err != nil {\n\t\treturn deployment, err\n\t}\n\n\te.events.PublishDeployment(deployment)\n\treturn deployment, nil\n}", "title": "" }, { "docid": "50b10c187b89554884701d831c9cfb08", "score": "0.5765481", "text": "func GenerateDeployment(\n\tname string,\n\tnamespace string,\n\tlabels map[string]string,\n\tannotations map[string]string,\n\tports []int32,\n\treplicas int32,\n\tspec corev1.PodSpec,\n) (*appsv1.Deployment, error) {\n\tdeployment := &appsv1.Deployment{\n\t\tObjectMeta: metav1.ObjectMeta{\n\t\t\tName: name,\n\t\t\tNamespace: namespace,\n\t\t\tLabels: labels,\n\t\t\tAnnotations: annotations,\n\t\t},\n\t\tSpec: appsv1.DeploymentSpec{\n\t\t\tReplicas: &replicas,\n\t\t\tSelector: &metav1.LabelSelector{\n\t\t\t\tMatchLabels: labels,\n\t\t\t},\n\t\t\tTemplate: corev1.PodTemplateSpec{\n\t\t\t\tObjectMeta: metav1.ObjectMeta{Labels: map[string]string{}, Annotations: map[string]string{}},\n\t\t\t\tSpec: spec,\n\t\t\t},\n\t\t},\n\t}\n\t// copy all of the labels to the pod including poddefault related labels\n\tl := &deployment.Spec.Template.ObjectMeta.Labels\n\tfor k, v := range labels {\n\t\t(*l)[k] = v\n\t}\n\n\t// copy all of the annotations to the pod including poddefault related labels\n\ta := &deployment.Spec.Template.ObjectMeta.Annotations\n\tfor k, v := range annotations {\n\t\t(*a)[k] = v\n\t}\n\n\t// Check container\n\tif len(spec.Containers) == 0 {\n\t\treturn nil, fmt.Errorf(\"Service deployment has no container in Spec %q\", &spec)\n\t}\n\tcontainer := &spec.Containers[0]\n\n\t// check that the container has the ports\n\tmissingPorts := []int32{}\n\tfor _, sp := range ports {\n\n\t\thasPort := false\n\n\t\tfor _, cp := range container.Ports {\n\t\t\tif cp.ContainerPort == sp {\n\t\t\t\thasPort = true\n\t\t\t\tbreak\n\t\t\t}\n\t\t}\n\n\t\tif hasPort {\n\t\t\tcontinue\n\t\t} else {\n\t\t\tmissingPorts = append(missingPorts, sp)\n\t\t}\n\n\t}\n\n\tif len(missingPorts) > 0 {\n\t\tcports := []corev1.ContainerPort{}\n\n\t\tif container.Ports != nil {\n\t\t\tcports = container.Ports\n\t\t}\n\n\t\tfor _, mp := range ports {\n\t\t\tcports = append(cports, corev1.ContainerPort{\n\t\t\t\tContainerPort: mp,\n\t\t\t\tProtocol: \"TCP\",\n\t\t\t})\n\t\t}\n\n\t\tcontainer.Ports = cports\n\t}\n\n\treturn deployment, nil\n}", "title": "" }, { "docid": "9078d63c668a3225a2cd1152645059ca", "score": "0.574925", "text": "func ForDeployment(ns, name string) *DeploymentBuilder {\n\treturn &DeploymentBuilder{\n\t\tobject: &appsv1api.Deployment{\n\t\t\tTypeMeta: metav1.TypeMeta{\n\t\t\t\tAPIVersion: appsv1api.SchemeGroupVersion.String(),\n\t\t\t\tKind: \"Deployment\",\n\t\t\t},\n\t\t\tObjectMeta: metav1.ObjectMeta{\n\t\t\t\tNamespace: ns,\n\t\t\t\tName: name,\n\t\t\t},\n\t\t},\n\t}\n}", "title": "" }, { "docid": "929e28f2a6f8230dbf6599ad9ba562ec", "score": "0.5749177", "text": "func (a *PipedAPI) CreateDeployment(ctx context.Context, req *pipedservice.CreateDeploymentRequest) (*pipedservice.CreateDeploymentResponse, error) {\n\t_, pipedID, _, err := rpcauth.ExtractPipedToken(ctx)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tif err := a.validateAppBelongsToPiped(ctx, req.Deployment.ApplicationId, pipedID); err != nil {\n\t\treturn nil, err\n\t}\n\n\terr = a.deploymentStore.AddDeployment(ctx, req.Deployment)\n\tif errors.Is(err, datastore.ErrAlreadyExists) {\n\t\treturn nil, status.Error(codes.AlreadyExists, \"deployment already exists\")\n\t}\n\tif err != nil {\n\t\ta.logger.Error(\"failed to create deployment\", zap.Error(err))\n\t\treturn nil, status.Error(codes.Internal, \"failed to create deployment\")\n\t}\n\treturn &pipedservice.CreateDeploymentResponse{}, nil\n}", "title": "" }, { "docid": "f7e81229069a18d0fda657cea0b07539", "score": "0.5738309", "text": "func generateDeployment(codewind Codewind, name string, image string, volumes []corev1.Volume, volumeMounts []corev1.VolumeMount, envVars []corev1.EnvVar, labels map[string]string) appsv1.Deployment {\n\tblockOwnerDeletion := true\n\tcontroller := true\n\treplicas := int32(1)\n\tlabels2 := map[string]string{\n\t\t\"app\": \"javamicroprofiletemplate-selector\",\n\t\t\"version\": \"current\",\n\t\t\"release\": codewind.PFEName,\n\t}\n\tdeployment := appsv1.Deployment{\n\t\tTypeMeta: metav1.TypeMeta{\n\t\t\tKind: \"Deployment\",\n\t\t\tAPIVersion: \"apps/v1\",\n\t\t},\n\t\tObjectMeta: metav1.ObjectMeta{\n\t\t\tName: codewind.PFEName,\n\t\t\tNamespace: codewind.Namespace,\n\t\t\tLabels: labels,\n\t\t\tOwnerReferences: []metav1.OwnerReference{\n\t\t\t\t{\n\t\t\t\t\tAPIVersion: \"apps/v1\",\n\t\t\t\t\tBlockOwnerDeletion: &blockOwnerDeletion,\n\t\t\t\t\tController: &controller,\n\t\t\t\t\tKind: \"ReplicaSet\",\n\t\t\t\t\tName: codewind.OwnerReferenceName,\n\t\t\t\t\tUID: codewind.OwnerReferenceUID,\n\t\t\t\t},\n\t\t\t},\n\t\t},\n\t\tSpec: appsv1.DeploymentSpec{\n\t\t\tReplicas: &replicas,\n\t\t\tSelector: &metav1.LabelSelector{\n\t\t\t\tMatchLabels: labels2,\n\t\t\t},\n\t\t\tTemplate: corev1.PodTemplateSpec{\n\t\t\t\tObjectMeta: metav1.ObjectMeta{\n\t\t\t\t\tLabels: labels2,\n\t\t\t\t},\n\t\t\t\tSpec: corev1.PodSpec{\n\t\t\t\t\tServiceAccountName: codewind.ServiceAccountName,\n\t\t\t\t\tVolumes: volumes,\n\t\t\t\t\tContainers: []corev1.Container{\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tName: name,\n\t\t\t\t\t\t\tImage: image,\n\t\t\t\t\t\t\tImagePullPolicy: corev1.PullAlways,\n\t\t\t\t\t\t\tSecurityContext: &corev1.SecurityContext{\n\t\t\t\t\t\t\t\tPrivileged: &codewind.Privileged,\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\tVolumeMounts: volumeMounts,\n\t\t\t\t\t\t\tCommand: []string{\"/bin/sh\", \"-c\", \"--\"},\n\t\t\t\t\t\t\tArgs: []string{\"/home/default/artifacts/new_entrypoint.sh\"},\n\t\t\t\t\t\t\tEnv: envVars,\n\t\t\t\t\t\t},\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t},\n\t\t},\n\t}\n\treturn deployment\n}", "title": "" }, { "docid": "29beaee200f8a9efd5b500791c4222e3", "score": "0.5731888", "text": "func CreateDeployment(command *CLICommand) error {\n\tdeploymentFolder, err := createScriptsFolder(command)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// update automatic port\n\tserverPort := updatePort(command)\n\n\t// first of all create Dockerfile\n\tdockerfilePath := filepath.Join(deploymentFolder, \"Dockerfile\")\n\terr = WriteDockerfileToFile(dockerfilePath, DockerfileData{\n\t\tBuildProxy: command.BuildProxy,\n\t\tLogLevel: command.LogLevel,\n\t\tPort: command.Port,\n\t\tCertificateFile: fmt.Sprintf(\"/run/secrets/%s/tls.crt\", command.ApplicationName),\n\t\tPrivateKeyFile: fmt.Sprintf(\"/run/secrets/%s/tls.key\", command.ApplicationName),\n\t})\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// now create deployment\n\tcaBundle, err := buildTlsKeys(command)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tdeploymentData := DeploymentData{\n\t\tName: command.ApplicationName,\n\t\tNamespace: command.Namespace,\n\t\tRunAsUser: command.RunAsUser,\n\t\tLogLevel: command.LogLevel,\n\t\tImageRegistry: command.PullImageRegistry,\n\t\tImageName: command.ImageName,\n\t\tImageTag: command.ImageTag,\n\t\tContainerPort: command.Port,\n\t\tServerPort: serverPort,\n\t\tInsecure: command.Insecure,\n\t\tCABundle: caBundle,\n\t\tTlsSecretName: command.SecretName,\n\t\tServiceName: command.ServiceName,\n\t\tServiceUser: command.ServiceUser,\n\t}\n\n\tfor _, hook := range command.Webhooks {\n\t\tdata := WebhookData{\n\t\t\tName: hook.Name(),\n\t\t\tRules: hook.Rules(),\n\t\t\tTimeoutInSeconds: hook.TimeoutInSeconds(),\n\t\t\tSideEffects: string(hook.SideEffects()),\n\t\t\tConfigurations: hook.Configurations(),\n\t\t\tSupportedAdmissionVersions: hook.SupportedAdmissionVersions(),\n\t\t}\n\t\tif hook.Type() == MutatingAdmissionWebhook {\n\t\t\tdeploymentData.MutatingWebhooks = append(deploymentData.MutatingWebhooks, data)\n\t\t} else {\n\t\t\tdeploymentData.ValidatingWebhooks = append(deploymentData.ValidatingWebhooks, data)\n\t\t}\n\t}\n\n\tdeploymentfilePath := filepath.Join(deploymentFolder, \"deployment.yml\")\n\terr = WriteDeploymentToFile(deploymentfilePath, deploymentData)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// and at last create deploy.sh\n\tdeployScriptData := DeployScriptData{\n\t\tInsecure: command.Insecure,\n\t\tNamespace: command.Namespace,\n\t\tTlsSecretName: command.SecretName,\n\t\tCertificateFile: command.CertificateFile,\n\t\tPrivateKeyFile: command.PrivateKeyFile,\n\t\tDeploymentFolder: deploymentFolder,\n\t\tImageRegistry: command.PushImageRegistry,\n\t\tImageName: command.ImageName,\n\t\tImageTag: command.ImageTag,\n\t\tKubectl: command.Kubectl,\n\t}\n\n\tdeployScriptFilePath := \"deploy.sh\"\n\terr = WriteDeployScriptToFile(deployScriptFilePath, deployScriptData)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tos.Chmod(deployScriptFilePath, 0744)\n\n\treturn nil\n}", "title": "" }, { "docid": "9da0720f43c68db4c9d49e77d1b65928", "score": "0.57114536", "text": "func NewDeployment(resource *v2alpha1.HorusecPlatform) appsv1.Deployment {\n\tcomponent := resource.Spec.Components.Manager\n\treturn appsv1.Deployment{\n\t\tObjectMeta: metav1.ObjectMeta{\n\t\t\tName: resource.GetManagerName(),\n\t\t\tNamespace: resource.GetNamespace(),\n\t\t\tLabels: resource.GetManagerLabels(),\n\t\t},\n\t\tSpec: appsv1.DeploymentSpec{\n\t\t\tReplicas: resource.GetManagerReplicaCount(),\n\t\t\tSelector: &metav1.LabelSelector{MatchLabels: resource.GetManagerLabels()},\n\t\t\tTemplate: corev1.PodTemplateSpec{\n\t\t\t\tObjectMeta: metav1.ObjectMeta{Labels: resource.GetManagerLabels()},\n\t\t\t\tSpec: corev1.PodSpec{\n\t\t\t\t\tImagePullSecrets: component.Container.Image.PullSecrets,\n\t\t\t\t\tContainers: []corev1.Container{{\n\t\t\t\t\t\tName: resource.GetManagerName(),\n\t\t\t\t\t\tImage: resource.GetManagerImage(),\n\t\t\t\t\t\tImagePullPolicy: component.Container.Image.PullPolicy,\n\t\t\t\t\t\tEnv: []corev1.EnvVar{\n\t\t\t\t\t\t\t{Name: \"REACT_APP_HORUSEC_ENDPOINT_API\", Value: resource.GetAPIEndpoint()},\n\t\t\t\t\t\t\t{Name: \"REACT_APP_HORUSEC_ENDPOINT_ANALYTIC\", Value: resource.GetAnalyticEndpoint()},\n\t\t\t\t\t\t\t{Name: \"REACT_APP_HORUSEC_ENDPOINT_CORE\", Value: resource.GetCoreEndpoint()},\n\t\t\t\t\t\t\t{Name: \"REACT_APP_HORUSEC_ENDPOINT_WEBHOOK\", Value: resource.GetWebhookEndpoint()},\n\t\t\t\t\t\t\t{Name: \"REACT_APP_HORUSEC_ENDPOINT_AUTH\", Value: resource.GetAuthEndpoint()},\n\t\t\t\t\t\t\t{Name: \"REACT_APP_HORUSEC_ENDPOINT_VULNERABILITY\", Value: resource.GetVulnerabilityEndpoint()},\n\t\t\t\t\t\t\t{Name: \"REACT_APP_HORUSEC_MANAGER_PATH\", Value: \"\\\\/manager\"},\n\t\t\t\t\t\t\t{Name: \"REACT_APP_KEYCLOAK_BASE_PATH\", Value: resource.Spec.Global.Keycloak.PublicURL},\n\t\t\t\t\t\t\t{Name: \"REACT_APP_KEYCLOAK_CLIENT_ID\", Value: resource.Spec.Global.Keycloak.Clients.Public.ID},\n\t\t\t\t\t\t\t{Name: \"REACT_APP_KEYCLOAK_REALM\", Value: resource.Spec.Global.Keycloak.Realm},\n\t\t\t\t\t\t},\n\t\t\t\t\t\tPorts: []corev1.ContainerPort{\n\t\t\t\t\t\t\t{Name: \"http\", ContainerPort: int32(resource.GetManagerPortHTTP())},\n\t\t\t\t\t\t},\n\t\t\t\t\t\tLivenessProbe: newLivenessProbe(resource),\n\t\t\t\t\t\tReadinessProbe: newReadinessProbe(resource),\n\t\t\t\t\t}},\n\t\t\t\t},\n\t\t\t},\n\t\t},\n\t}\n}", "title": "" }, { "docid": "e4c8dec3c599f7dcd00d45ce4a225e35", "score": "0.5708631", "text": "func (c *apiServerComponent) apiServerDeployment() *appsv1.Deployment {\n\tvar name string\n\tswitch c.cfg.Installation.Variant {\n\tcase operatorv1.TigeraSecureEnterprise:\n\t\tname = \"tigera-apiserver\"\n\tcase operatorv1.Calico:\n\t\tname = \"calico-apiserver\"\n\t}\n\n\thostNetwork := c.hostNetwork()\n\tdnsPolicy := corev1.DNSClusterFirst\n\tif hostNetwork {\n\t\t// Adjust DNS policy so we can access in-cluster services.\n\t\tdnsPolicy = corev1.DNSClusterFirstWithHostNet\n\t}\n\n\tvar initContainers []corev1.Container\n\tif c.cfg.TLSKeyPair.UseCertificateManagement() {\n\t\t// Use the same CSR init container name for both OSS and Enterprise.\n\t\tinitContainer := c.cfg.TLSKeyPair.InitContainer(rmeta.APIServerNamespace(c.cfg.Installation.Variant))\n\t\tinitContainer.Name = fmt.Sprintf(\"%s-%s\", calicoAPIServerTLSSecretName, certificatemanagement.CSRInitContainerName)\n\t\tinitContainers = append(initContainers, initContainer)\n\t}\n\n\tannotations := map[string]string{\n\t\tc.cfg.TLSKeyPair.HashAnnotationKey(): c.cfg.TLSKeyPair.HashAnnotationValue(),\n\t}\n\tif c.cfg.ManagementCluster != nil {\n\t\tannotations[c.cfg.TunnelCASecret.HashAnnotationKey()] = c.cfg.TunnelCASecret.HashAnnotationValue()\n\t}\n\n\td := &appsv1.Deployment{\n\t\tTypeMeta: metav1.TypeMeta{Kind: \"Deployment\", APIVersion: \"apps/v1\"},\n\t\tObjectMeta: metav1.ObjectMeta{\n\t\t\tName: name,\n\t\t\tNamespace: rmeta.APIServerNamespace(c.cfg.Installation.Variant),\n\t\t\tLabels: map[string]string{\n\t\t\t\t\"apiserver\": \"true\",\n\t\t\t},\n\t\t},\n\t\tSpec: appsv1.DeploymentSpec{\n\t\t\tReplicas: c.cfg.Installation.ControlPlaneReplicas,\n\t\t\tStrategy: appsv1.DeploymentStrategy{\n\t\t\t\tType: appsv1.RecreateDeploymentStrategyType,\n\t\t\t},\n\t\t\t// For legacy reasons we use apiserver: true here instead of the k8s-app: name label,\n\t\t\t// so we need to set it explicitly rather than use the common labeling logic.\n\t\t\tSelector: &metav1.LabelSelector{MatchLabels: map[string]string{\"apiserver\": \"true\"}},\n\t\t\tTemplate: corev1.PodTemplateSpec{\n\t\t\t\tObjectMeta: metav1.ObjectMeta{\n\t\t\t\t\tName: name,\n\t\t\t\t\tNamespace: rmeta.APIServerNamespace(c.cfg.Installation.Variant),\n\t\t\t\t\tLabels: map[string]string{\n\t\t\t\t\t\t\"apiserver\": \"true\",\n\t\t\t\t\t},\n\t\t\t\t\tAnnotations: annotations,\n\t\t\t\t},\n\t\t\t\tSpec: corev1.PodSpec{\n\t\t\t\t\tDNSPolicy: dnsPolicy,\n\t\t\t\t\tNodeSelector: c.cfg.Installation.ControlPlaneNodeSelector,\n\t\t\t\t\tHostNetwork: hostNetwork,\n\t\t\t\t\tServiceAccountName: APIServerServiceAccountName(c.cfg.Installation.Variant),\n\t\t\t\t\tTolerations: c.tolerations(),\n\t\t\t\t\tImagePullSecrets: secret.GetReferenceList(c.cfg.PullSecrets),\n\t\t\t\t\tInitContainers: initContainers,\n\t\t\t\t\tContainers: []corev1.Container{\n\t\t\t\t\t\tc.apiServerContainer(),\n\t\t\t\t\t},\n\t\t\t\t\tVolumes: c.apiServerVolumes(),\n\t\t\t\t},\n\t\t\t},\n\t\t},\n\t}\n\n\tif c.cfg.Installation.ControlPlaneReplicas != nil && *c.cfg.Installation.ControlPlaneReplicas > 1 {\n\t\td.Spec.Template.Spec.Affinity = podaffinity.NewPodAntiAffinity(name, rmeta.APIServerNamespace(c.cfg.Installation.Variant))\n\t}\n\n\tif c.cfg.Installation.Variant == operatorv1.TigeraSecureEnterprise {\n\t\td.Spec.Template.Spec.Containers = append(d.Spec.Template.Spec.Containers, c.queryServerContainer())\n\n\t\tif c.cfg.TrustedBundle != nil {\n\t\t\ttrustedBundleHashAnnotations := c.cfg.TrustedBundle.HashAnnotations()\n\t\t\tfor k, v := range trustedBundleHashAnnotations {\n\t\t\t\td.Spec.Template.ObjectMeta.Annotations[k] = v\n\t\t\t}\n\t\t}\n\t}\n\n\tif overrides := c.cfg.APIServer.APIServerDeployment; overrides != nil {\n\t\trcomp.ApplyDeploymentOverrides(d, overrides)\n\t}\n\n\treturn d\n}", "title": "" }, { "docid": "5726422eb1a8089bf4320b02687848ba", "score": "0.5703628", "text": "func (dc *DeploymentConfiguration) Create() (*component.Summary, error) {\n\tif dc.deployment == nil {\n\t\treturn nil, errors.New(\"deployment is nil\")\n\t}\n\n\tsections := make([]component.SummarySection, 0)\n\n\tstrategyType := dc.deployment.Spec.Strategy.Type\n\tsections = append(sections, component.SummarySection{\n\t\tHeader: \"Deployment Strategy\",\n\t\tContent: component.NewText(string(strategyType)),\n\t})\n\n\tswitch strategyType {\n\tcase appsv1.RollingUpdateDeploymentStrategyType:\n\t\trollingUpdate := dc.deployment.Spec.Strategy.RollingUpdate\n\t\tif rollingUpdate == nil {\n\t\t\treturn nil, errors.Errorf(\"deployment strategy type is RollingUpdate, but configuration is nil\")\n\t\t}\n\n\t\trollingUpdateText := fmt.Sprintf(\"Max Surge %s, Max Unavailable %s\",\n\t\t\trollingUpdate.MaxSurge.String(),\n\t\t\trollingUpdate.MaxUnavailable.String(),\n\t\t)\n\n\t\tsections = append(sections, component.SummarySection{\n\t\t\tHeader: \"Rolling Update Strategy\",\n\t\t\tContent: component.NewText(rollingUpdateText),\n\t\t})\n\n\t\tif selector := dc.deployment.Spec.Selector; selector != nil {\n\t\t\tvar selectors []component.Selector\n\n\t\t\tfor _, lsr := range selector.MatchExpressions {\n\t\t\t\to, err := component.MatchOperator(string(lsr.Operator))\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\tes := component.NewExpressionSelector(lsr.Key, o, lsr.Values)\n\t\t\t\tselectors = append(selectors, es)\n\t\t\t}\n\n\t\t\tfor k, v := range selector.MatchLabels {\n\t\t\t\tls := component.NewLabelSelector(k, v)\n\t\t\t\tselectors = append(selectors, ls)\n\t\t\t}\n\n\t\t\tsections = append(sections, component.SummarySection{\n\t\t\t\tHeader: \"Selectors\",\n\t\t\t\tContent: component.NewSelectors(selectors),\n\t\t\t})\n\t\t}\n\n\t\tminReadySeconds := fmt.Sprintf(\"%d\", dc.deployment.Spec.MinReadySeconds)\n\t\tsections = append(sections, component.SummarySection{\n\t\t\tHeader: \"Min Ready Seconds\",\n\t\t\tContent: component.NewText(minReadySeconds),\n\t\t})\n\n\t\tif rhl := dc.deployment.Spec.RevisionHistoryLimit; rhl != nil {\n\t\t\trevisionHistoryLimit := fmt.Sprintf(\"%d\", *rhl)\n\t\t\tsections = append(sections, component.SummarySection{\n\t\t\t\tHeader: \"Revision History Limit\",\n\t\t\t\tContent: component.NewText(revisionHistoryLimit),\n\t\t\t})\n\t\t}\n\t}\n\n\tvar replicas int32\n\tif dc.deployment.Spec.Replicas != nil {\n\t\treplicas = *dc.deployment.Spec.Replicas\n\t}\n\n\tsections = append(sections, component.SummarySection{\n\t\tHeader: \"Replicas\",\n\t\tContent: component.NewText(fmt.Sprintf(\"%d\", replicas)),\n\t})\n\n\tsummary := component.NewSummary(\"Configuration\", sections...)\n\n\tfor _, generator := range dc.actionGenerators {\n\t\tactions := generator(dc.deployment)\n\t\tfor _, action := range actions {\n\t\t\tsummary.AddAction(action)\n\t\t}\n\t}\n\n\treturn summary, nil\n}", "title": "" }, { "docid": "73bb33f25da00a3554760788150fddba", "score": "0.57000077", "text": "func (s *Service) CreateOrUpdateDeployment(machine *clusterv1.Machine, clusterConfig *providerv1.AirshipClusterProviderSpec, machineConfig *providerv1.AirshipMachineProviderSpec) (*deckhand.DeploymentsCreateOrUpdateFuture, error) {\n\t// Parse the ARM template\n\t//JEB template, err := readJSON(templateFile)\n\t//JEB if err != nil {\n\t//JEB return nil, err\n\t//JEB }\n\t//JEB params, err := convertMachineToDeploymentParams(machine, machineConfig)\n\t//JEB if err != nil {\n\t//JEB return nil, err\n\t//JEB }\n\t//JEB deployment := deckhand.Deployment{\n\t//JEB Properties: &deckhand.DeploymentProperties{\n\t//JEB Template: template,\n\t//JEB Parameters: params,\n\t//JEB Mode: deckhand.Incremental,\n\t//JEB },\n\t//JEB }\n\t//JEB\n\t//JEB deploymentFuture, err := s.scope.AirshipClients.Deployments.CreateOrUpdate(s.scope.Context, clusterConfig.ResourceGroup, machine.ObjectMeta.Name, deployment)\n\t//JEB if err != nil {\n\t//JEB return nil, err\n\t//JEB }\n\t//JEB return &deploymentFuture, nil\n\treturn &deckhand.DeploymentsCreateOrUpdateFuture{}, nil\n}", "title": "" }, { "docid": "e24343778d13726d25d68807aec3360f", "score": "0.5669721", "text": "func (c *client) CreateDeployment(d cloudrunner.Deployment) error {\n\treturn c.db.Create(&d).Error\n}", "title": "" }, { "docid": "724caf45ce5ca6403c85b82964f7de53", "score": "0.56634295", "text": "func AdmissionWebhookDeployment(name, image string) *appsv1.Deployment {\n\treturn &appsv1.Deployment{\n\t\tObjectMeta: metav1.ObjectMeta{\n\t\t\tName: name,\n\t\t\tLabels: map[string]string{\n\t\t\t\t\"app\": \"nsm-admission-webhook\",\n\t\t\t},\n\t\t},\n\t\tTypeMeta: metav1.TypeMeta{\n\t\t\tKind: \"Deployment\",\n\t\t},\n\t\tSpec: appsv1.DeploymentSpec{\n\t\t\tSelector: &metav1.LabelSelector{\n\t\t\t\tMatchLabels: map[string]string{\"app\": \"nsm-admission-webhook\"},\n\t\t\t},\n\t\t\tTemplate: v1.PodTemplateSpec{\n\t\t\t\tObjectMeta: metav1.ObjectMeta{\n\t\t\t\t\tLabels: map[string]string{\n\t\t\t\t\t\t\"app\": \"nsm-admission-webhook\",\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t\tSpec: v1.PodSpec{\n\t\t\t\t\tContainers: []v1.Container{\n\t\t\t\t\t\tcontainerMod(&v1.Container{\n\t\t\t\t\t\t\tName: name,\n\t\t\t\t\t\t\tImage: image,\n\t\t\t\t\t\t\tImagePullPolicy: v1.PullIfNotPresent,\n\t\t\t\t\t\t\tEnv: []v1.EnvVar{\n\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\tName: \"TAG\",\n\t\t\t\t\t\t\t\t\tValue: containerTag,\n\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\tName: \"REPO\",\n\t\t\t\t\t\t\t\t\tValue: containerRepo,\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\tVolumeMounts: []v1.VolumeMount{\n\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\tName: \"webhook-certs\",\n\t\t\t\t\t\t\t\t\tMountPath: \"/etc/webhook/certs\",\n\t\t\t\t\t\t\t\t\tReadOnly: true,\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\tLivenessProbe: createProbe(\"/liveness\"),\n\t\t\t\t\t\t\tReadinessProbe: createProbe(\"/readiness\"),\n\t\t\t\t\t\t}),\n\t\t\t\t\t},\n\t\t\t\t\tVolumes: []v1.Volume{\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tName: \"webhook-certs\",\n\t\t\t\t\t\t\tVolumeSource: v1.VolumeSource{\n\t\t\t\t\t\t\t\tSecret: &v1.SecretVolumeSource{\n\t\t\t\t\t\t\t\t\tSecretName: \"nsm-admission-webhook-certs\",\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t},\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t},\n\t\t},\n\t}\n}", "title": "" }, { "docid": "37ac68afffcc163a6f951c7524207695", "score": "0.56535286", "text": "func (rt *lambda) GetDeploymentTemplate(tpl *rfv1beta3.Xenv) *appsv1.Deployment {\n\tvar replicas = defaultPoolSize\n\tif tpl.Spec.PoolSize != 0 {\n\t\treplicas = int32(tpl.Spec.PoolSize)\n\t}\n\tvar extraCfg struct {\n\t\tNoInject bool `json:\"noInject,omitempty\"`\n\t}\n\tjson.Unmarshal(tpl.Spec.Extra, &extraCfg) // nolint:errcheck\n\n\t// setting up containers\n\tcontainer := tpl.Spec.Container.DeepCopyContainer()\n\tcontainer.Name = \"body\"\n\n\tvar initContainers []corev1.Container\n\tif !extraCfg.NoInject {\n\t\torginCmd := container.Command\n\t\t// overrride original command wiht dinit, block and wait\n\t\tcontainer.Command = []string{pathInVolume(\"loader\"), \"--v\", \"3\"}\n\t\tif len(orginCmd) > 0 {\n\t\t\tcontainer.Command = append(container.Command, \"--\")\n\t\t\tcontainer.Command = append(container.Command, orginCmd...)\n\t\t}\n\t\tinitContainers = append(initContainers, *initContainer.DeepCopy())\n\t}\n\n\t// set volume mounts\n\tcontainer.VolumeMounts = append(container.VolumeMounts, *(refuncVolumeMnt.DeepCopy()))\n\n\t// set environs\n\tcontainer.Env = append(container.Env,\n\t\t// FIXME(bin)\n\t\tcorev1.EnvVar{\n\t\t\tName: \"REFUNC_APP\",\n\t\t\tValue: \"aws-lambda\",\n\t\t},\n\t)\n\n\t// hpa requires those fields to be set\n\tif len(container.Resources.Requests) == 0 {\n\t\tcontainer.Resources.Requests = defaultResource.Requests.DeepCopy()\n\t} else {\n\t\tif _, has := container.Resources.Requests[corev1.ResourceCPU]; !has {\n\t\t\tcontainer.Resources.Requests[corev1.ResourceCPU] = defaultResource.Requests[corev1.ResourceCPU].DeepCopy()\n\t\t}\n\t\tif _, has := container.Resources.Requests[corev1.ResourceMemory]; !has {\n\t\t\tcontainer.Resources.Requests[corev1.ResourceMemory] = defaultResource.Requests[corev1.ResourceMemory].DeepCopy()\n\t\t}\n\t}\n\tif len(container.Resources.Limits) == 0 {\n\t\tcontainer.Resources.Limits = defaultResource.Limits.DeepCopy()\n\t} else {\n\t\tif _, has := container.Resources.Limits[corev1.ResourceCPU]; !has {\n\t\t\tcontainer.Resources.Limits[corev1.ResourceCPU] = defaultResource.Limits[corev1.ResourceCPU].DeepCopy()\n\t\t}\n\t\tif _, has := container.Resources.Limits[corev1.ResourceMemory]; !has {\n\t\t\tcontainer.Resources.Limits[corev1.ResourceMemory] = defaultResource.Limits[corev1.ResourceMemory].DeepCopy()\n\t\t}\n\t}\n\n\t// ensure container user is root\n\tif container.SecurityContext == nil {\n\t\tcontainer.SecurityContext = new(corev1.SecurityContext)\n\t}\n\tvar rootUID int64\n\tcontainer.SecurityContext.RunAsUser = &rootUID\n\n\tvar containers = []corev1.Container{*container}\n\ttransp := transport.ForXenv(tpl)\n\tif sidecar := transp.GetTransportContainer(tpl); sidecar != nil {\n\t\tsidecar.VolumeMounts = append(sidecar.VolumeMounts, *(refuncVolumeMnt.DeepCopy()))\n\t\tcontainers = append(containers, *sidecar)\n\t}\n\n\tdep := &appsv1.Deployment{\n\t\tSpec: appsv1.DeploymentSpec{\n\t\t\tReplicas: &replicas,\n\t\t\tSelector: &metav1.LabelSelector{}, // MatchLabels will be filled by controller\n\t\t\tRevisionHistoryLimit: &historyLimits,\n\t\t\tTemplate: corev1.PodTemplateSpec{\n\t\t\t\tSpec: corev1.PodSpec{\n\t\t\t\t\tInitContainers: initContainers,\n\t\t\t\t\tContainers: containers,\n\t\t\t\t\tImagePullSecrets: tpl.Spec.ImagePullSecrets[:],\n\t\t\t\t\tVolumes: append([]corev1.Volume{*(refuncVolume.DeepCopy())}, tpl.Spec.Volumes...),\n\t\t\t\t},\n\t\t\t},\n\t\t},\n\t}\n\tif tpl.Spec.ServiceAccount != \"\" {\n\t\tdep.Spec.Template.Spec.ServiceAccountName = tpl.Spec.ServiceAccount\n\t}\n\n\treturn dep\n}", "title": "" }, { "docid": "2d3300d726359e21c7ca520538e563a6", "score": "0.5651248", "text": "func createWebprojectWorkload(client *kubernetes.Clientset, deploymentInput WebProjectInput) {\n\t// WebProject Deployment.\n\tdeployment := &appsv1.Deployment{\n\t\tTypeMeta: genTypeMeta(\"Deployment\"),\n\t\tObjectMeta: metav1.ObjectMeta{\n\t\t\tName: deploymentInput.DeploymentName,\n\t\t\tNamespace: deploymentInput.Namespace,\n\t\t\tLabels: genDefaultLabels(deploymentInput),\n\t\t},\n\t\tSpec: appsv1.DeploymentSpec{\n\t\t\tReplicas: int32ptr(deploymentInput.Replicas),\n\t\t\tSelector: &metav1.LabelSelector{\n\t\t\t\tMatchLabels: genDefaultLabels(deploymentInput),\n\t\t\t},\n\t\t\tTemplate: corev1.PodTemplateSpec{\n\t\t\t\tObjectMeta: metav1.ObjectMeta{\n\t\t\t\t\tName: deploymentInput.DeploymentName,\n\t\t\t\t\tLabels: genDefaultLabels(deploymentInput),\n\t\t\t\t},\n\t\t\t\tSpec: corev1.PodSpec{\n\t\t\t\t\tContainers: []corev1.Container{\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tName: deploymentInput.PrimaryContainerName,\n\t\t\t\t\t\t\tImage: deploymentInput.PrimaryContainerImageTag,\n\t\t\t\t\t\t\tImagePullPolicy: corev1.PullAlways,\n\t\t\t\t\t\t\tVolumeMounts: []corev1.VolumeMount{\n\t\t\t\t\t\t\t\tcreateVolumeMount(\"webroot\", deploymentInput.WebrootMountPoint),\n\t\t\t\t\t\t\t\tcreateVolumeMount(\"files\", deploymentInput.FilesMountPoint),\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\tPorts: []corev1.ContainerPort{\n\t\t\t\t\t\t\t\tcreateContainerPort(int32(deploymentInput.PrimaryContainerPort)),\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t},\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tName: deploymentInput.SidecarContainerName,\n\t\t\t\t\t\t\tImage: deploymentInput.SidecarContainerImageTag,\n\t\t\t\t\t\t\tImagePullPolicy: corev1.PullAlways,\n\t\t\t\t\t\t\tVolumeMounts: []corev1.VolumeMount{\n\t\t\t\t\t\t\t\tcreateVolumeMount(\"webroot\", deploymentInput.WebrootMountPoint),\n\t\t\t\t\t\t\t\tcreateVolumeMount(\"files\", deploymentInput.FilesMountPoint),\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\tPorts: []corev1.ContainerPort{\n\t\t\t\t\t\t\t\tcreateContainerPort(int32(deploymentInput.SidecarContainerPort)),\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\tRestartPolicy: corev1.RestartPolicyAlways,\n\t\t\t\t\tVolumes: []corev1.Volume{\n\t\t\t\t\t\tcreateEmptyDirVolume(\"webroot\"),\n\t\t\t\t\t\tattachVolumeFromClaim(\"files\", \"webfiles\", deploymentInput),\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t},\n\t\t},\n\t}\n\n\t// Create Web Project Deployment\n\tfoundWebProject, foundErr := client.AppsV1().Deployments(deploymentInput.Namespace).Get(deploymentInput.DeploymentName, metav1.GetOptions{})\n\tif foundErr != nil {\n\t\tresultWebProject, errWebProject := client.AppsV1().Deployments(deploymentInput.Namespace).Create(deployment)\n\t\tif errWebProject != nil {\n\t\t\tpanic(errWebProject)\n\t\t}\n\t\tlog.Printf(\"Created Deployment - Name: %q, UID: %q\\n\", resultWebProject.GetObjectMeta().GetName(), resultWebProject.GetObjectMeta().GetUID())\n\t} else {\n\t\tfoundWebProject.Spec.Replicas = int32ptr(deploymentInput.Replicas)\n\t\tfoundWebProject.Spec.Template.Spec.Containers[0].Image = deploymentInput.PrimaryContainerImageTag\n\t\tfoundWebProjectResult, errFoundWebProject := client.AppsV1().Deployments(deploymentInput.Namespace).Update(foundWebProject)\n\t\tif errFoundWebProject != nil {\n\t\t\tpanic(errFoundWebProject)\n\t\t}\n\t\tlog.Printf(\"Updated Deployment - Name: %q, UID: %q\\n\", foundWebProjectResult.GetObjectMeta().GetName(), foundWebProjectResult.GetObjectMeta().GetUID())\n\t}\n\n\tserviceName := deploymentInput.DeploymentName + \"-svc\"\n\n\twebprojectLabels := map[string]string{\n\t\t\"app\": deploymentInput.DeploymentName,\n\t}\n\twebprojectService := &v1.Service{\n\t\tObjectMeta: metav1.ObjectMeta{\n\t\t\tName: serviceName,\n\t\t\tLabels: genDefaultLabels(deploymentInput),\n\t\t},\n\t\tSpec: v1.ServiceSpec{\n\t\t\tSelector: webprojectLabels,\n\t\t\tPorts: []v1.ServicePort{{\n\t\t\t\tPort: int32(deploymentInput.PrimaryContainerPort),\n\t\t\t\tProtocol: \"TCP\",\n\t\t\t\tTargetPort: intstr.FromInt(deploymentInput.PrimaryContainerPort),\n\t\t\t}},\n\t\t},\n\t}\n\n\t_, foundWebprojectServiceErr := client.CoreV1().Services(deploymentInput.Namespace).Get(deploymentInput.DeploymentName+\"-svc\", metav1.GetOptions{})\n\tif foundWebprojectServiceErr != nil {\n\t\twebprojectServiceResp, errWebprojectService := client.CoreV1().Services(deploymentInput.Namespace).Create(webprojectService)\n\t\tif errWebprojectService != nil {\n\t\t\tpanic(errWebprojectService)\n\t\t}\n\t\tlog.Printf(\"Created Webproject Service - Name: %q, UID: %q\\n\", webprojectServiceResp.GetObjectMeta().GetName(), webprojectServiceResp.GetObjectMeta().GetUID())\n\n\t}\n}", "title": "" }, { "docid": "6bceac9e3267654194e5d1b09f81070b", "score": "0.56324065", "text": "func CreateDeployment(clientset *kubernetes.Clientset, funcSpecs types.FuncSpecs) (string, error) {\n\n\tdeploymentsClient := clientset.AppsV1().Deployments(apiv1.NamespaceDefault)\n\n\tdeployment := &appsv1.Deployment{\n\t\tObjectMeta: metav1.ObjectMeta{\n\t\t\tName: funcSpecs.FuncName,\n\t\t},\n\t\tSpec: appsv1.DeploymentSpec{\n\t\t\tReplicas: int32Ptr(funcSpecs.Instances),\n\t\t\tSelector: &metav1.LabelSelector{\n\t\t\t\tMatchLabels: map[string]string{\n\t\t\t\t\t\"app\": funcSpecs.FuncName,\n\t\t\t\t},\n\t\t\t},\n\t\t\tTemplate: apiv1.PodTemplateSpec{\n\t\t\t\tObjectMeta: metav1.ObjectMeta{\n\t\t\t\t\tLabels: map[string]string{\n\t\t\t\t\t\t\"app\": funcSpecs.FuncName,\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t\tSpec: apiv1.PodSpec{\n\t\t\t\t\tContainers: []apiv1.Container{\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tName: funcSpecs.FuncName,\n\t\t\t\t\t\t\tImage: funcSpecs.ImageName,\n\t\t\t\t\t\t\tImagePullPolicy: \"Never\",\n\t\t\t\t\t\t\tPorts: []apiv1.ContainerPort{\n\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\tName: \"http\",\n\t\t\t\t\t\t\t\t\tContainerPort: funcSpecs.FuncPort,\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\tEnvFrom: []apiv1.EnvFromSource{},\n\t\t\t\t\t\t\tEnv: []apiv1.EnvVar{\n\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\tName: \"OPEN_FUNC_PORT\",\n\t\t\t\t\t\t\t\t\tValue: strconv.Itoa(int(funcSpecs.FuncPort)),\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t},\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t},\n\t\t},\n\t}\n\n\t// Create Deployment\n\tlog.Println(\"Creating deployment...\")\n\tresult, err := deploymentsClient.Create(context.TODO(), deployment, metav1.CreateOptions{})\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\n\tlog.Printf(\"Created deployment %q.\\n\", result.GetObjectMeta().GetName())\n\treturn funcSpecs.FuncName, nil\n}", "title": "" }, { "docid": "0c12a2d56cf1ab1ea47f984a521e2a1b", "score": "0.56217486", "text": "func GetDeployment(c client.Client, ns string) (*appsv1.Deployment, error) {\n\tpod, err := k8sutil.GetPod(context.TODO(), c, ns)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\trsOwner := metav1.GetControllerOf(pod)\n\tif rsOwner == nil {\n\t\treturn nil, fmt.Errorf(\"no controller found for Pod: %s\", pod.Name)\n\t} else if rsOwner.Kind != \"ReplicaSet\" {\n\t\treturn nil, fmt.Errorf(\"unexpected controller found for Pod: %s, kind: %s\", pod.Name, rsOwner.Kind)\n\t}\n\n\tvar rs appsv1.ReplicaSet\n\tif err := c.Get(context.TODO(), client.ObjectKey{Name: rsOwner.Name, Namespace: ns}, &rs); err != nil {\n\t\treturn nil, err\n\t}\n\n\tdOwner := metav1.GetControllerOf(&rs)\n\tif dOwner == nil {\n\t\treturn nil, fmt.Errorf(\"no controller found for ReplicaSet: %s\", pod.Name)\n\t} else if dOwner.Kind != \"Deployment\" {\n\t\treturn nil, fmt.Errorf(\"unexpected controller found for ReplicaSet: %s, kind: %s\", pod.Name, dOwner.Kind)\n\t}\n\n\tvar d appsv1.Deployment\n\tif err := c.Get(context.TODO(), client.ObjectKey{Name: dOwner.Name, Namespace: ns}, &d); err != nil {\n\t\treturn nil, err\n\t}\n\treturn &d, nil\n}", "title": "" }, { "docid": "f4e61b303b80a3990678935aa7c683de", "score": "0.5615402", "text": "func generateDeployment(name, hostname, image string) *apps.Deployment {\n\tpodLabels := map[string]string{\"systemd_test\": name}\n\treturn &apps.Deployment{\n\t\tObjectMeta: metav1.ObjectMeta{\n\t\t\tName: name,\n\t\t\tAnnotations: make(map[string]string),\n\t\t\tLabels: podLabels,\n\t\t},\n\t\tSpec: apps.DeploymentSpec{\n\t\t\tReplicas: func(i int32) *int32 { return &i }(0),\n\t\t\tSelector: &metav1.LabelSelector{MatchLabels: podLabels},\n\t\t\tTemplate: v1.PodTemplateSpec{\n\t\t\t\tObjectMeta: metav1.ObjectMeta{\n\t\t\t\t\tLabels: podLabels,\n\t\t\t\t},\n\t\t\t\tSpec: v1.PodSpec{\n\t\t\t\t\tTolerations: []v1.Toleration{\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tKey: \"test\",\n\t\t\t\t\t\t\tOperator: v1.TolerationOpEqual,\n\t\t\t\t\t\t\tValue: \"systemdhang\",\n\t\t\t\t\t\t\tEffect: v1.TaintEffectNoSchedule,\n\t\t\t\t\t\t},\n\t\t\t\t\t},\n\t\t\t\t\tContainers: []v1.Container{\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tName: \"test\",\n\t\t\t\t\t\t\tResources: v1.ResourceRequirements{\n\t\t\t\t\t\t\t\t\tLimits: v1.ResourceList{\n\t\t\t\t\t\t\t\t\t\tv1.ResourceName(v1.ResourceCPU): resource.MustParse(\"5\"),\n\t\t\t\t\t\t\t\t\t\tv1.ResourceName(v1.ResourceMemory): resource.MustParse(\"5G\"),\n\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\tRequests: v1.ResourceList{\n\t\t\t\t\t\t\t\t\t\tv1.ResourceName(v1.ResourceCPU): resource.MustParse(\"50m\"),\n\t\t\t\t\t\t\t\t\t\tv1.ResourceName(v1.ResourceMemory): resource.MustParse(\"50m\"),\n\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\tArgs: []string{\"/bin/sh\", \"-c\", \"sleep 3600\"},\n\t\t\t\t\t\t\tImage: image,\n\t\t\t\t\t\t\tImagePullPolicy: v1.PullAlways,\n\t\t\t\t\t\t\tTerminationMessagePath: v1.TerminationMessagePathDefault,\n\t\t\t\t\t\t\tVolumeMounts: []v1.VolumeMount{\n\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\tMountPath: \"/var/nfs/test1\",\n\t\t\t\t\t\t\t\t\tName: \"nfs1\",\n\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\tMountPath: \"/var/nfs/test2\",\n\t\t\t\t\t\t\t\t\tName: \"nfs2\",\n\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\tMountPath: \"/var/nfs/test3\",\n\t\t\t\t\t\t\t\t\tName: \"nfs3\",\n\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\tMountPath: \"/var/nfs/test4\",\n\t\t\t\t\t\t\t\t\tName: \"nfs4\",\n\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\tMountPath: \"/var/nfs/test5\",\n\t\t\t\t\t\t\t\t\tName: \"nfs5\",\n\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\tMountPath: \"/var/nfs/test6\",\n\t\t\t\t\t\t\t\t\tName: \"nfs6\",\n\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\tMountPath: \"/var/nfs/test7\",\n\t\t\t\t\t\t\t\t\tName: \"nfs7\",\n\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\tMountPath: \"/var/nfs/test8\",\n\t\t\t\t\t\t\t\t\tName: \"nfs8\",\n\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\tMountPath: \"/var/nfs/test9\",\n\t\t\t\t\t\t\t\t\tName: \"nfs9\",\n\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\tMountPath: \"/var/nfs/test10\",\n\t\t\t\t\t\t\t\t\tName: \"nfs10\",\n\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\tMountPath: \"/var/nfs/test11\",\n\t\t\t\t\t\t\t\t\tName: \"nfs11\",\n\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\tMountPath: \"/var/nfs/test12\",\n\t\t\t\t\t\t\t\t\tName: \"nfs12\",\n\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\tMountPath: \"/var/nfs/test13\",\n\t\t\t\t\t\t\t\t\tName: \"nfs13\",\n\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\tMountPath: \"/var/nfs/test14\",\n\t\t\t\t\t\t\t\t\tName: \"nfs14\",\n\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\tMountPath: \"/var/nfs/test15\",\n\t\t\t\t\t\t\t\t\tName: \"nfs15\",\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t},\n\t\t\t\t\t},\n\t\t\t\t\tHostNetwork: true,\n\t\t\t\t\tNodeName: hostname,\n\t\t\t\t\tRestartPolicy: v1.RestartPolicyAlways,\n\t\t\t\t\tVolumes: []v1.Volume{\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tName: \"nfs1\",\n\t\t\t\t\t\t\tVolumeSource: v1.VolumeSource{\n\t\t\t\t\t\t\t\tNFS: &v1.NFSVolumeSource{\n\t\t\t\t\t\t\t\t\tServer: \"10.196.147.93\",\n\t\t\t\t\t\t\t\t\tPath: \"/var/nfsshare\",\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\t{\n\t\t\t\t\t\t\tName: \"nfs2\",\n\t\t\t\t\t\t\tVolumeSource: v1.VolumeSource{\n\t\t\t\t\t\t\t\tNFS: &v1.NFSVolumeSource{\n\t\t\t\t\t\t\t\t\tServer: \"10.196.147.93\",\n\t\t\t\t\t\t\t\t\tPath: \"/var/nfsshare\",\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\t{\n\t\t\t\t\t\t\tName: \"nfs3\",\n\t\t\t\t\t\t\tVolumeSource: v1.VolumeSource{\n\t\t\t\t\t\t\t\tNFS: &v1.NFSVolumeSource{\n\t\t\t\t\t\t\t\t\tServer: \"10.196.147.93\",\n\t\t\t\t\t\t\t\t\tPath: \"/var/nfsshare\",\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\t{\n\t\t\t\t\t\t\tName: \"nfs4\",\n\t\t\t\t\t\t\tVolumeSource: v1.VolumeSource{\n\t\t\t\t\t\t\t\tNFS: &v1.NFSVolumeSource{\n\t\t\t\t\t\t\t\t\tServer: \"10.196.147.93\",\n\t\t\t\t\t\t\t\t\tPath: \"/var/nfsshare\",\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\t{\n\t\t\t\t\t\t\tName: \"nfs5\",\n\t\t\t\t\t\t\tVolumeSource: v1.VolumeSource{\n\t\t\t\t\t\t\t\tNFS: &v1.NFSVolumeSource{\n\t\t\t\t\t\t\t\t\tServer: \"10.196.147.93\",\n\t\t\t\t\t\t\t\t\tPath: \"/var/nfsshare\",\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\t{\n\t\t\t\t\t\t\tName: \"nfs6\",\n\t\t\t\t\t\t\tVolumeSource: v1.VolumeSource{\n\t\t\t\t\t\t\t\tNFS: &v1.NFSVolumeSource{\n\t\t\t\t\t\t\t\t\tServer: \"10.196.147.93\",\n\t\t\t\t\t\t\t\t\tPath: \"/var/nfsshare\",\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\t\tName: \"nfs7\",\n\t\t\t\t\t\t\tVolumeSource: v1.VolumeSource{\n\t\t\t\t\t\t\t\tNFS: &v1.NFSVolumeSource{\n\t\t\t\t\t\t\t\t\tServer: \"10.196.147.93\",\n\t\t\t\t\t\t\t\t\tPath: \"/var/nfsshare\",\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\t{\n\t\t\t\t\t\t\tName: \"nfs8\",\n\t\t\t\t\t\t\tVolumeSource: v1.VolumeSource{\n\t\t\t\t\t\t\t\tNFS: &v1.NFSVolumeSource{\n\t\t\t\t\t\t\t\t\tServer: \"10.196.147.93\",\n\t\t\t\t\t\t\t\t\tPath: \"/var/nfsshare\",\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\t{\n\t\t\t\t\t\t\tName: \"nfs9\",\n\t\t\t\t\t\t\tVolumeSource: v1.VolumeSource{\n\t\t\t\t\t\t\t\tNFS: &v1.NFSVolumeSource{\n\t\t\t\t\t\t\t\t\tServer: \"10.196.147.93\",\n\t\t\t\t\t\t\t\t\tPath: \"/var/nfsshare\",\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\t{\n\t\t\t\t\t\t\tName: \"nfs10\",\n\t\t\t\t\t\t\tVolumeSource: v1.VolumeSource{\n\t\t\t\t\t\t\t\tNFS: &v1.NFSVolumeSource{\n\t\t\t\t\t\t\t\t\tServer: \"10.196.147.93\",\n\t\t\t\t\t\t\t\t\tPath: \"/var/nfsshare\",\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\t{\n\t\t\t\t\t\t\tName: \"nfs11\",\n\t\t\t\t\t\t\tVolumeSource: v1.VolumeSource{\n\t\t\t\t\t\t\t\tNFS: &v1.NFSVolumeSource{\n\t\t\t\t\t\t\t\t\tServer: \"10.196.147.93\",\n\t\t\t\t\t\t\t\t\tPath: \"/var/nfsshare\",\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\t{\n\t\t\t\t\t\t\tName: \"nfs12\",\n\t\t\t\t\t\t\tVolumeSource: v1.VolumeSource{\n\t\t\t\t\t\t\t\tNFS: &v1.NFSVolumeSource{\n\t\t\t\t\t\t\t\t\tServer: \"10.196.147.93\",\n\t\t\t\t\t\t\t\t\tPath: \"/var/nfsshare\",\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\t{\n\t\t\t\t\t\t\tName: \"nfs13\",\n\t\t\t\t\t\t\tVolumeSource: v1.VolumeSource{\n\t\t\t\t\t\t\t\tNFS: &v1.NFSVolumeSource{\n\t\t\t\t\t\t\t\t\tServer: \"10.196.147.93\",\n\t\t\t\t\t\t\t\t\tPath: \"/var/nfsshare\",\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\t{\n\t\t\t\t\t\t\tName: \"nfs14\",\n\t\t\t\t\t\t\tVolumeSource: v1.VolumeSource{\n\t\t\t\t\t\t\t\tNFS: &v1.NFSVolumeSource{\n\t\t\t\t\t\t\t\t\tServer: \"10.196.147.93\",\n\t\t\t\t\t\t\t\t\tPath: \"/var/nfsshare\",\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\t{\n\t\t\t\t\t\t\tName: \"nfs15\",\n\t\t\t\t\t\t\tVolumeSource: v1.VolumeSource{\n\t\t\t\t\t\t\t\tNFS: &v1.NFSVolumeSource{\n\t\t\t\t\t\t\t\t\tServer: \"10.196.147.93\",\n\t\t\t\t\t\t\t\t\tPath: \"/var/nfsshare\",\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t},\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t},\n\t\t},\n\t}\n}", "title": "" }, { "docid": "28e524e986b55361ab9c2832d89c2f34", "score": "0.56044006", "text": "func (td *OsmTestData) SimpleDeploymentApp(def SimpleDeploymentAppDef) (corev1.ServiceAccount, appsv1.Deployment, corev1.Service, error) {\n\tif len(def.OS) == 0 {\n\t\treturn corev1.ServiceAccount{}, appsv1.Deployment{}, corev1.Service{}, fmt.Errorf(\"ClusterOS must be explicitly specified\")\n\t}\n\n\tif def.Labels == nil {\n\t\tdef.Labels = map[string]string{constants.AppLabel: def.DeploymentName}\n\t}\n\n\tserviceAccountName := def.ServiceAccountName\n\tif serviceAccountName == \"\" {\n\t\tserviceAccountName = RandomNameWithPrefix(\"serviceaccount\")\n\t}\n\n\tserviceName := def.ServiceName\n\tif serviceName == \"\" {\n\t\tserviceName = RandomNameWithPrefix(\"service\")\n\t}\n\n\tserviceAccountDefinition := corev1.ServiceAccount{\n\t\tObjectMeta: metav1.ObjectMeta{\n\t\t\tName: serviceAccountName,\n\t\t\tNamespace: def.Namespace,\n\t\t},\n\t}\n\tcontainerName := def.ContainerName\n\tif containerName == \"\" {\n\t\tcontainerName = def.DeploymentName\n\t}\n\n\t// Required, as replica count is a pointer to distinguish between 0 and not specified\n\treplicaCountExplicitDeclaration := def.ReplicaCount\n\n\tdeploymentDefinition := appsv1.Deployment{\n\t\tObjectMeta: metav1.ObjectMeta{\n\t\t\tName: def.DeploymentName,\n\t\t\tNamespace: def.Namespace,\n\t\t},\n\t\tSpec: appsv1.DeploymentSpec{\n\t\t\tReplicas: &replicaCountExplicitDeclaration,\n\t\t\tSelector: &metav1.LabelSelector{\n\t\t\t\tMatchLabels: def.Labels,\n\t\t\t},\n\t\t\tTemplate: corev1.PodTemplateSpec{\n\t\t\t\tObjectMeta: metav1.ObjectMeta{\n\t\t\t\t\tLabels: def.Labels,\n\t\t\t\t},\n\t\t\t\tSpec: corev1.PodSpec{\n\t\t\t\t\tTerminationGracePeriodSeconds: new(int64), // 0\n\t\t\t\t\tServiceAccountName: serviceAccountName,\n\t\t\t\t\tNodeSelector: map[string]string{\n\t\t\t\t\t\t\"kubernetes.io/os\": def.OS,\n\t\t\t\t\t},\n\t\t\t\t\tContainers: []corev1.Container{\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tName: containerName,\n\t\t\t\t\t\t\tImage: def.Image,\n\t\t\t\t\t\t\tImagePullPolicy: corev1.PullIfNotPresent,\n\t\t\t\t\t\t},\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t},\n\t\t},\n\t}\n\n\tif td.AreRegistryCredsPresent() {\n\t\tdeploymentDefinition.Spec.Template.Spec.ImagePullSecrets = []corev1.LocalObjectReference{\n\t\t\t{\n\t\t\t\tName: RegistrySecretName,\n\t\t\t},\n\t\t}\n\t}\n\n\tif def.Command != nil && len(def.Command) > 0 {\n\t\tdeploymentDefinition.Spec.Template.Spec.Containers[0].Command = def.Command\n\t}\n\tif def.Args != nil && len(def.Args) > 0 {\n\t\tdeploymentDefinition.Spec.Template.Spec.Containers[0].Args = def.Args\n\t}\n\n\tserviceDefinition := corev1.Service{\n\t\tObjectMeta: metav1.ObjectMeta{\n\t\t\tName: serviceName,\n\t\t\tNamespace: def.Namespace,\n\t\t\tLabels: def.Labels,\n\t\t},\n\t\tSpec: corev1.ServiceSpec{\n\t\t\tSelector: def.Labels,\n\t\t},\n\t}\n\n\tif def.Ports != nil && len(def.Ports) > 0 {\n\t\tdeploymentDefinition.Spec.Template.Spec.Containers[0].Ports = []corev1.ContainerPort{}\n\t\tserviceDefinition.Spec.Ports = []corev1.ServicePort{}\n\n\t\tfor _, p := range def.Ports {\n\t\t\tdeploymentDefinition.Spec.Template.Spec.Containers[0].Ports = append(deploymentDefinition.Spec.Template.Spec.Containers[0].Ports,\n\t\t\t\tcorev1.ContainerPort{\n\t\t\t\t\tContainerPort: int32(p),\n\t\t\t\t},\n\t\t\t)\n\n\t\t\tsvcPort := corev1.ServicePort{\n\t\t\t\tPort: int32(p),\n\t\t\t\tTargetPort: intstr.FromInt(p),\n\t\t\t}\n\n\t\t\tif def.AppProtocol != \"\" {\n\t\t\t\tif ver, err := td.getKubernetesServerVersionNumber(); err != nil {\n\t\t\t\t\tsvcPort.Name = fmt.Sprintf(\"%s-%d\", def.AppProtocol, p) // use named port with AppProtocol\n\t\t\t\t} else {\n\t\t\t\t\t// use appProtocol field in servicePort if k8s server version >= 1.19\n\t\t\t\t\tif ver[0] >= 1 && ver[1] >= 19 {\n\t\t\t\t\t\tsvcPort.AppProtocol = &def.AppProtocol // set the appProtocol field\n\t\t\t\t\t} else {\n\t\t\t\t\t\tsvcPort.Name = fmt.Sprintf(\"%s-%d\", def.AppProtocol, p) // use named port with AppProtocol\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tserviceDefinition.Spec.Ports = append(serviceDefinition.Spec.Ports, svcPort)\n\t\t}\n\t}\n\n\treturn serviceAccountDefinition, deploymentDefinition, serviceDefinition, nil\n}", "title": "" }, { "docid": "0de444357c08dcfd90673655babe764f", "score": "0.5604261", "text": "func (e *Environment) Create() error {\n\tk8s := kubernetes.GetCli(e.Region)\n\tif k8s == nil {\n\t\treturn fmt.Errorf(\"Get cluster failed: no region %s\", e.Region)\n\t}\n\treturn k8s.CreateDeployment(e.ProjName, e.Name, e.CodeBranch, e.NodeNum)\n}", "title": "" }, { "docid": "51cc6240aa605df8f0777620b3616bd7", "score": "0.56009614", "text": "func (a *Activity) Deployment(db XODB) (*Deployment, error) {\n\treturn DeploymentByID(db, int(a.DeploymentID.Int64))\n}", "title": "" }, { "docid": "c6c27edc575740ff36cc8c059d4ae520", "score": "0.5592668", "text": "func Deployment(name string) Opt {\n\tresource := Resource(\"deployments\", name)\n\tversion := ApiVersion(\"/apis/apps/v1\")\n\n\treturn func(q Query) *Query {\n\t\treturn resource(*version(q))\n\t}\n}", "title": "" }, { "docid": "ea51d4f3664c1066962dafbd3dcdbd24", "score": "0.55585927", "text": "func (s *DataStore) CreateDeployment(obj *appsv1.Deployment) (*appsv1.Deployment, error) {\n\treturn s.kubeClient.AppsV1().Deployments(s.namespace).Create(context.TODO(), obj, metav1.CreateOptions{})\n}", "title": "" }, { "docid": "77e6cdeb67df9426a73dcd73c31ce973", "score": "0.5546332", "text": "func NewDeploymentForCR(cr *devopsv1alpha1.Learn, scheme *runtime.Scheme) *appsv1.Deployment {\n\tlabels := map[string]string{\n\t\t\"app\": cr.Name,\n\t\t\"devops\": cr.Name,\n\t}\n\tvar defaultMode int32 = 0755\n\tvar defaultFSGroup int64 = 65534\n\tdeployment := &appsv1.Deployment{\n\t\tObjectMeta: metav1.ObjectMeta{\n\t\t\tNamespace: cr.Namespace,\n\t\t\tName: cr.Name,\n\t\t\tLabels: labels,\n\t\t},\n\t\tSpec: appsv1.DeploymentSpec{\n\t\t\tSelector: &metav1.LabelSelector{\n\t\t\t\tMatchLabels: labels,\n\t\t\t},\n\t\t\tReplicas: &cr.Spec.Replicas,\n\t\t\tStrategy: appsv1.DeploymentStrategy{\n\t\t\t\tRollingUpdate: &appsv1.RollingUpdateDeployment{\n\t\t\t\t\tMaxUnavailable: &intstr.IntOrString{\n\t\t\t\t\t\tType: intstr.Int,\n\t\t\t\t\t\tIntVal: 0,\n\t\t\t\t\t},\n\t\t\t\t\tMaxSurge: &intstr.IntOrString{\n\t\t\t\t\t\tType: intstr.Int,\n\t\t\t\t\t\tIntVal: 2,\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t},\n\t\t\tTemplate: corev1.PodTemplateSpec{\n\t\t\t\tObjectMeta: metav1.ObjectMeta{\n\t\t\t\t\tLabels: labels,\n\t\t\t\t},\n\t\t\t\tSpec: corev1.PodSpec{\n\t\t\t\t\tVolumes: []corev1.Volume{\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tName: cr.Name + \"-conf\",\n\t\t\t\t\t\t\tVolumeSource: corev1.VolumeSource{\n\t\t\t\t\t\t\t\tConfigMap: &corev1.ConfigMapVolumeSource{\n\t\t\t\t\t\t\t\t\tLocalObjectReference: corev1.LocalObjectReference{\n\t\t\t\t\t\t\t\t\t\tName: cr.Name + \"-conf\",\n\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\tDefaultMode: &defaultMode,\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t},\n\t\t\t\t\t},\n\t\t\t\t\tInitContainers: []corev1.Container{\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tName: \"pull-secrets\",\n\t\t\t\t\t\t\tImage: \"busybox\",\n\t\t\t\t\t\t\tImagePullPolicy: corev1.PullIfNotPresent,\n\t\t\t\t\t\t\tEnvFrom: []corev1.EnvFromSource{\n\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\tConfigMapRef: &corev1.ConfigMapEnvSource{\n\t\t\t\t\t\t\t\t\t\tLocalObjectReference: corev1.LocalObjectReference{\n\t\t\t\t\t\t\t\t\t\t\tName: cr.Name + \"-conf\",\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\tEnv: []corev1.EnvVar{\n\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\tName: \"POD_IP\",\n\t\t\t\t\t\t\t\t\tValueFrom: &corev1.EnvVarSource{\n\t\t\t\t\t\t\t\t\t\tFieldRef: &corev1.ObjectFieldSelector{\n\t\t\t\t\t\t\t\t\t\t\tAPIVersion: \"v1\",\n\t\t\t\t\t\t\t\t\t\t\tFieldPath: \"status.podIP\",\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\t{\n\t\t\t\t\t\t\t\t\tName: \"POD_NAMESPACE\",\n\t\t\t\t\t\t\t\t\tValueFrom: &corev1.EnvVarSource{\n\t\t\t\t\t\t\t\t\t\tFieldRef: &corev1.ObjectFieldSelector{\n\t\t\t\t\t\t\t\t\t\t\tAPIVersion: \"v1\",\n\t\t\t\t\t\t\t\t\t\t\tFieldPath: \"metadata.namespace\",\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\tResources: corev1.ResourceRequirements{\n\t\t\t\t\t\t\t\tRequests: corev1.ResourceList{\n\t\t\t\t\t\t\t\t\tcorev1.ResourceCPU: resource.MustParse(\"5m\"),\n\t\t\t\t\t\t\t\t\tcorev1.ResourceMemory: resource.MustParse(\"16Mi\"),\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\tLimits: corev1.ResourceList{\n\t\t\t\t\t\t\t\t\tcorev1.ResourceCPU: resource.MustParse(\"5m\"),\n\t\t\t\t\t\t\t\t\tcorev1.ResourceMemory: resource.MustParse(\"16Mi\"),\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t},\n\t\t\t\t\t},\n\t\t\t\t\tContainers: []corev1.Container{\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tName: cr.Name,\n\t\t\t\t\t\t\tImage: cr.Spec.Image,\n\t\t\t\t\t\t\tImagePullPolicy: corev1.PullIfNotPresent,\n\t\t\t\t\t\t\tPorts: []corev1.ContainerPort{\n\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\tName: \"web\",\n\t\t\t\t\t\t\t\t\tContainerPort: 8080,\n\t\t\t\t\t\t\t\t\tProtocol: \"TCP\",\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\tEnvFrom: []corev1.EnvFromSource{\n\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\tConfigMapRef: &corev1.ConfigMapEnvSource{\n\t\t\t\t\t\t\t\t\t\tLocalObjectReference: corev1.LocalObjectReference{\n\t\t\t\t\t\t\t\t\t\t\tName: cr.Name + \"-conf\",\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\tEnv: []corev1.EnvVar{\n\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\tName: \"POD_IP\",\n\t\t\t\t\t\t\t\t\tValueFrom: &corev1.EnvVarSource{\n\t\t\t\t\t\t\t\t\t\tFieldRef: &corev1.ObjectFieldSelector{\n\t\t\t\t\t\t\t\t\t\t\tAPIVersion: \"v1\",\n\t\t\t\t\t\t\t\t\t\t\tFieldPath: \"status.podIP\",\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\t{\n\t\t\t\t\t\t\t\t\tName: \"POD_NAME\",\n\t\t\t\t\t\t\t\t\tValueFrom: &corev1.EnvVarSource{\n\t\t\t\t\t\t\t\t\t\tFieldRef: &corev1.ObjectFieldSelector{\n\t\t\t\t\t\t\t\t\t\t\tAPIVersion: \"v1\",\n\t\t\t\t\t\t\t\t\t\t\tFieldPath: \"metadata.name\",\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\t{\n\t\t\t\t\t\t\t\t\tName: \"MY_NAMESPACE\",\n\t\t\t\t\t\t\t\t\tValueFrom: &corev1.EnvVarSource{\n\t\t\t\t\t\t\t\t\t\tFieldRef: &corev1.ObjectFieldSelector{\n\t\t\t\t\t\t\t\t\t\t\tAPIVersion: \"v1\",\n\t\t\t\t\t\t\t\t\t\t\tFieldPath: \"metadata.namespace\",\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\t{\n\t\t\t\t\t\t\t\t\tName: \"USER\",\n\t\t\t\t\t\t\t\t\tValueFrom: &corev1.EnvVarSource{\n\t\t\t\t\t\t\t\t\t\tFieldRef: &corev1.ObjectFieldSelector{\n\t\t\t\t\t\t\t\t\t\t\tAPIVersion: \"v1\",\n\t\t\t\t\t\t\t\t\t\t\tFieldPath: \"metadata.name\",\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\tVolumeMounts: []corev1.VolumeMount{\n\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\tName: cr.Name + \"-conf\",\n\t\t\t\t\t\t\t\t\tMountPath: \"/conf\",\n\t\t\t\t\t\t\t\t\tReadOnly: true,\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\tReadinessProbe: &corev1.Probe{\n\t\t\t\t\t\t\t\tHandler: corev1.Handler{\n\t\t\t\t\t\t\t\t\tHTTPGet: &corev1.HTTPGetAction{\n\t\t\t\t\t\t\t\t\t\tPath: \"/healthz\",\n\t\t\t\t\t\t\t\t\t\tPort: intstr.IntOrString{\n\t\t\t\t\t\t\t\t\t\t\tType: intstr.String,\n\t\t\t\t\t\t\t\t\t\t\tStrVal: \"web\",\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\tInitialDelaySeconds: 3,\n\t\t\t\t\t\t\t\tTimeoutSeconds: 2,\n\t\t\t\t\t\t\t\tFailureThreshold: 5,\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\tResources: corev1.ResourceRequirements{\n\t\t\t\t\t\t\t\tRequests: corev1.ResourceList{\n\t\t\t\t\t\t\t\t\tcorev1.ResourceCPU: resource.MustParse(\"10m\"),\n\t\t\t\t\t\t\t\t\tcorev1.ResourceMemory: resource.MustParse(\"48Mi\"),\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\tLimits: corev1.ResourceList{\n\t\t\t\t\t\t\t\t\tcorev1.ResourceCPU: resource.MustParse(\"10m\"),\n\t\t\t\t\t\t\t\t\tcorev1.ResourceMemory: resource.MustParse(\"48Mi\"),\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\tTerminationMessagePath: \"/dev/termination-log\",\n\t\t\t\t\t\t\tTerminationMessagePolicy: \"File\",\n\t\t\t\t\t\t},\n\t\t\t\t\t},\n\t\t\t\t\tDNSPolicy: corev1.DNSClusterFirst,\n\t\t\t\t\tRestartPolicy: corev1.RestartPolicyAlways,\n\t\t\t\t\tSecurityContext: &corev1.PodSecurityContext{\n\t\t\t\t\t\tFSGroup: &defaultFSGroup,\n\t\t\t\t\t},\n\t\t\t\t\tServiceAccountName: cr.Name + \"-sa\",\n\t\t\t\t},\n\t\t\t},\n\t\t},\n\t}\n\tcontrollerutil.SetControllerReference(cr, deployment, scheme)\n\treturn deployment\n}", "title": "" }, { "docid": "7139dad09afaa0ddacded71866eb014d", "score": "0.5535384", "text": "func CreateDeployment(node *fogappsCRDs.ServiceGraphNode, graph *fogappsCRDs.ServiceGraph) (*apps.Deployment, error) {\n\tdeployment := apps.Deployment{\n\t\tObjectMeta: *createNodeObjectMeta(node, graph),\n\t\tSpec: apps.DeploymentSpec{},\n\t}\n\n\treturn UpdateDeployment(&deployment, node, graph)\n}", "title": "" }, { "docid": "464a5f2bde288d293bdf0e9f773f19c4", "score": "0.5529961", "text": "func (d *Deployment) Build() Deployment {\n\treturn Deployment{\n\t\tname: d.name,\n\t\tpod: d.pod,\n\t\treplicas: d.replicas,\n\t\tlabels: d.labels,\n\t}\n}", "title": "" }, { "docid": "703d8835d5f80dce8e5096799699b76f", "score": "0.54988873", "text": "func (k *K8S) Deploy(\n\tctx context.Context,\n\tworkdir string,\n\tname string,\n\tports []int32,\n) error {\n\tnamespace := \"default\"\n\n\tdockerClient, err := runtime.CreateClient(ctx)\n\tif err != nil {\n\t\treturn err\n\t}\n\tif err := dockerClient.BuildImage(ctx, workdir, name); err != nil {\n\t\treturn err\n\t}\n\timage, err := dockerClient.PushImage(ctx, name)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// By using a label selector between Pod and Service, we can link Service and Pod directly, it means a Endpoint will\n\t// be created automatically, then incoming traffic to Service will be forward to Pod.\n\t// Then we have no need to create Endpoint manually anymore.\n\tselector := map[string]string{\n\t\t\"app\": \"fx-app-\" + uuid.New().String(),\n\t}\n\n\tconst replicas = int32(3)\n\tif _, err := k.GetDeployment(namespace, name); err != nil {\n\t\t// TODO enable passing replica from fx CLI\n\t\tif _, err := k.CreateDeployment(\n\t\t\tnamespace,\n\t\t\tname,\n\t\t\timage,\n\t\t\treplicas,\n\t\t\tselector,\n\t\t); err != nil {\n\t\t\treturn err\n\t\t}\n\t} else {\n\t\tif _, err := k.UpdateDeployment(namespace, name, image, replicas, selector); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\t// TODO fx should be able to know what's the target Kubernetes service platform\n\t// it's going to deploy to\n\tconst isOnPublicCloud = true\n\ttyp := \"LoadBalancer\"\n\tif !isOnPublicCloud {\n\t\ttyp = \"NodePort\"\n\t}\n\n\tif _, err := k.GetService(namespace, name); err != nil {\n\t\tif _, err := k.CreateService(\n\t\t\tnamespace,\n\t\t\tname,\n\t\t\ttyp,\n\t\t\tports,\n\t\t\tselector,\n\t\t); err != nil {\n\t\t\treturn err\n\t\t}\n\t} else {\n\t\tif _, err := k.UpdateService(\n\t\t\tnamespace,\n\t\t\tname,\n\t\t\ttyp,\n\t\t\tports,\n\t\t\tselector,\n\t\t); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "fcd5df26fb2011985b23b981594fa76e", "score": "0.5483159", "text": "func CreateDeploy(form resources.DeployForm) model.Deploy {\n\ttag := model.Deploy{\n\t\tAppID: form.AppID,\n\t\tCommitID: form.CommitID,\n\t\tCommitTag: form.CommitTag,\n\t\tInterval: form.Interval,\n\t\tMax: form.Max,\n\t\tDesc: form.Desc,\n\t\tStatus: form.Status,\n\t\tBinaryURL: form.BinaryURL,\n\t\tHosts: strings.Join(form.Hosts, \",\"),\n\t}\n\tnow := time.Now()\n\ttag.UpdatedAt = now\n\ttag.CreatedAt = now\n\ttag.StartedAt = now\n\ttag.FinishedAt = now\n\tdb.Session().Create(&tag)\n\n\treturn tag\n\n}", "title": "" }, { "docid": "6eb3148bb0c5d1ce37f1a3dce673046d", "score": "0.54813945", "text": "func (r *ReconcileWebsite) newDeploymentForWebsite(ws *examplev1beta1.Website, labels map[string]string) (*appsv1.Deployment, error) {\n\n\t/*\n\t\tWe need to create Deployment resource that will be owned by our Website resource.\n\t\tWe need to model the following deployment resource using the Go types defined in\n\t\tthe k8s.io/api package which defines all the resource types.\n\n\t\tapiVersion: apps/v1\n\t\tkind: Deployment\n\t\tmetadata:\n\t\t labels:\n\t\t webserver: kubia-website\n\t\t name: kubia-website\n\t\t namespace: default\n\t\tspec:\n\t\t replicas: 1\n\t\t selector:\n\t\t matchLabels:\n\t\t webserver: kubia-website\n\t\t strategy:\n\t\t rollingUpdate:\n\t\t maxSurge: 1\n\t\t maxUnavailable: 1\n\t\t type: RollingUpdate\n\t\t template:\n\t\t metadata:\n\t\t labels:\n\t\t webserver: kubia-website\n\t\t name: kubia-website\n\t\t spec:\n\t\t containers:\n\t\t - image: nginx:alpine\n\t\t imagePullPolicy: IfNotPresent\n\t\t name: main\n\t\t ports:\n\t\t - containerPort: 80\n\t\t protocol: TCP\n\t\t resources: {}\n\t\t volumeMounts:\n\t\t - mountPath: /usr/share/nginx/html\n\t\t name: html\n\t\t readOnly: true\n\t\t - image: openweb/git-sync\n\t\t imagePullPolicy: Always\n\t\t\t\t\t\tname: git-sync\n\t\t\t\t\t\tenv:\n\t\t - name: GIT_SYNC_REPO\n\t\t value: https://github.com/luksa/kubia-website-example.git\n\t\t - name: GIT_SYNC_DEST\n\t\t value: /gitrepo\n\t\t - name: GIT_SYNC_BRANCH\n\t\t value: master\n\t\t - name: GIT_SYNC_REV\n\t\t value: FETCH_HEAD\n\t\t - name: GIT_SYNC_WAIT\n\t\t value: \"10\"\n\t\t resources: {}\n\t\t volumeMounts:\n\t\t - mountPath: /gitrepo\n\t\t name: html\n\t\t volumes:\n\t\t - emptyDir: {}\n\t\t name: html\n\t*/\n\tdeployment := &appsv1.Deployment{\n\t\tObjectMeta: metav1.ObjectMeta{\n\t\t\tName: ws.Name,\n\t\t\tNamespace: ws.Namespace,\n\t\t\tLabels: labels,\n\t\t},\n\t\tSpec: appsv1.DeploymentSpec{\n\t\t\tReplicas: &ws.Spec.Replicas,\n\t\t\tSelector: &metav1.LabelSelector{\n\t\t\t\tMatchLabels: labels,\n\t\t\t},\n\t\t\tTemplate: v1.PodTemplateSpec{\n\t\t\t\tObjectMeta: metav1.ObjectMeta{\n\t\t\t\t\tName: ws.Name,\n\t\t\t\t\tLabels: labels,\n\t\t\t\t},\n\t\t\t\tSpec: v1.PodSpec{\n\t\t\t\t\tContainers: []v1.Container{\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tName: \"main\",\n\t\t\t\t\t\t\tImage: \"nginx:alpine\",\n\t\t\t\t\t\t\tPorts: []v1.ContainerPort{\n\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\tContainerPort: 80,\n\t\t\t\t\t\t\t\t\tProtocol: v1.ProtocolTCP,\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\tVolumeMounts: []v1.VolumeMount{\n\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\tName: \"html\",\n\t\t\t\t\t\t\t\t\tMountPath: \"/usr/share/nginx/html\",\n\t\t\t\t\t\t\t\t\tReadOnly: true,\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\t{\n\t\t\t\t\t\t\tName: \"git-sync\",\n\t\t\t\t\t\t\tImage: \"openweb/git-sync\",\n\t\t\t\t\t\t\tEnv: []v1.EnvVar{\n\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\tName: \"GIT_SYNC_REPO\",\n\t\t\t\t\t\t\t\t\tValue: ws.Spec.GitRepo,\n\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\tName: \"GIT_SYNC_DEST\",\n\t\t\t\t\t\t\t\t\tValue: \"/gitrepo\",\n\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\tName: \"GIT_SYNC_BRANCH\",\n\t\t\t\t\t\t\t\t\tValue: \"master\",\n\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\tName: \"GIT_SYNC_REV\",\n\t\t\t\t\t\t\t\t\tValue: \"FETCH_HEAD\",\n\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\tName: \"GIT_SYNC_WAIT\",\n\t\t\t\t\t\t\t\t\tValue: \"10\",\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\tVolumeMounts: []v1.VolumeMount{\n\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\tName: \"html\",\n\t\t\t\t\t\t\t\t\tMountPath: \"/gitrepo\",\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t},\n\t\t\t\t\t},\n\t\t\t\t\tVolumes: []v1.Volume{\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tName: \"html\",\n\t\t\t\t\t\t\tVolumeSource: v1.VolumeSource{\n\t\t\t\t\t\t\t\tEmptyDir: &v1.EmptyDirVolumeSource{},\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t},\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t},\n\t\t},\n\t}\n\n\tif err := controllerutil.SetControllerReference(ws, deployment, r.scheme); err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn deployment, nil\n}", "title": "" }, { "docid": "9481a6b27e9134df152b6dfd74da9d95", "score": "0.5476468", "text": "func New(params Params) *Deployer {\n\treturn &Deployer{\n\t\tscopeGetter: params.ScopeGetter,\n\t}\n}", "title": "" }, { "docid": "521243807d5285ff5269cd0c6b56badd", "score": "0.5474109", "text": "func (s deploymentService) Add(resource *Deployment) (*Deployment, error) {\n\tpath, err := getAddPath(s, resource)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tresp, err := apiAdd(s.getClient(), resource, new(Deployment), path)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn resp.(*Deployment), nil\n}", "title": "" }, { "docid": "068d781d5f9488daa79807bfa0aa4a08", "score": "0.5463263", "text": "func (c *KubeClientSet) CreateDeployment(ns string, body *v12.Deployment, opts v1.CreateOptions) (*v12.Deployment, error) {\n\tclient := c.GetDeploymentClient(ns)\n\treturn client.Create(c.Ctx, body, opts)\n}", "title": "" }, { "docid": "d01684de6fd4a2a46482d5c14429e788", "score": "0.5429865", "text": "func New(opts types.Options) (types.Deployer, *pflag.FlagSet) {\n\t// create a deployer object and set fields that are not flag controlled\n\td := &deployer{\n\t\tcommonOptions: opts,\n\t\tlogsDir: filepath.Join(opts.ArtifactsDir(), \"logs\"),\n\t}\n\t// register flags and return\n\treturn d, bindFlags(d)\n}", "title": "" }, { "docid": "c4335f9382d2baa1dbc0b18f486d47f0", "score": "0.54268837", "text": "func newDeployments(c *Client, namespace string) *deployments {\n\treturn &deployments{\n\t\tr: c,\n\t\tns: namespace,\n\t}\n}", "title": "" }, { "docid": "a5d79f556a306dedf38361911e854b6a", "score": "0.5409822", "text": "func (s *Supervisor) Deploy(user, model string, version int) (err error) {\n\tr := routeName{user, model}\n\n\t// get the bundle and model information form the storage.\n\tinfo, bundle, err := s.storage.Get(user, model, version)\n\tif err != nil {\n\t\treturn err\n\t}\n\tdeployId, ids, err := s.storage.NewDeployment(user, model, version)\n\tif err != nil {\n\t\treturn err\n\t}\n\ts.instMu.Lock()\n\tfor _, id := range ids {\n\t\ts.insts[id] = deployId\n\t}\n\ts.instMu.Unlock()\n\tdeployment := &Deployment{\n\t\tExpNum: len(ids),\n\t\tUsername: user,\n\t\tModelname: model,\n\t\tVersion: version,\n\t\tInfo: info,\n\t\tBundle: bundle,\n\t\tDeployId: deployId,\n\t\tinstanceIds: ids,\n\t\tmu: new(sync.Mutex),\n\t\tpool: s.pool,\n\t}\n\tdeployment.ctx, deployment.cancel = context.WithCancel(context.Background())\n\n\ts.mu.Lock()\n\tcurrDeployment, ok := s.deployments[r]\n\t// grab the space in the deployments map\n\ts.deployments[r] = deployment\n\ts.mu.Unlock()\n\n\tif ok {\n\t\tgo func() {\n\t\t\t//TODO(eric): logging\n\t\t\tcurrDeployment.Kill()\n\t\t}()\n\t}\n\n\tsetStatus := func(status string) {\n\t\ts.storage.SetBuildStatus(user, model, status)\n\t}\n\tdefer func() {\n\t\tif err != nil && err != ErrDeploymentCancelled {\n\t\t\tsetStatus(StatusFailed)\n\t\t\ts.mu.Lock()\n\t\t\tdelete(s.deployments, r)\n\t\t\ts.mu.Unlock()\n\t\t}\n\t}()\n\n\tsetStatus(StatusQueued)\n\n\tif deployment.IsCancelled() {\n\t\treturn ErrDeploymentCancelled\n\t}\n\n\ts.deploymentPool <- struct{}{}\n\t// defer opening a space\n\tdefer func() { <-s.deploymentPool }()\n\tsetStatus(StatusBuilding)\n\n\tif err := deployment.BuildInstances(ids); err != nil {\n\t\treturn err\n\t}\n\tdefer func() {\n\t\tif err != nil {\n\t\t\tdeployment.Kill()\n\t\t}\n\t}()\n\n\t// set the route to the new route\n\ts.mu.Lock()\n\tif deployment.IsCancelled() {\n\t\ts.mu.Unlock()\n\t\treturn ErrDeploymentCancelled\n\t}\n\tdelete(s.deployments, r)\n\toldDeployment, ok := s.routes[r]\n\ts.routes[r] = deployment\n\ts.mu.Unlock()\n\n\ts.storage.SetBuildStatus(user, model, StatusOnline)\n\n\t// clean up all the old instances\n\tif ok && oldDeployment != nil {\n\t\toldDeployment.Kill()\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "ed356502eb4fa270f5af14cf8a8d3985", "score": "0.54069114", "text": "func New(opts types.Options) (types.Deployer, *pflag.FlagSet) {\n\t// create a deployer object and set fields that are not flag controlled\n\td := &deployer{\n\t\tcommonOptions: opts,\n\t\tlocalLogsDir: filepath.Join(opts.ArtifactsDir(), \"logs\"),\n\t}\n\n\t// register flags and return\n\treturn d, bindFlags(d)\n}", "title": "" }, { "docid": "efa00aaa80ea85f5156644d8a5bbf882", "score": "0.5406394", "text": "func newDeploymentService(sling *sling.Sling, uriTemplate string) *deploymentService {\n\tdeploymentService := &deploymentService{}\n\tdeploymentService.service = newService(ServiceDeploymentService, sling, uriTemplate)\n\n\treturn deploymentService\n}", "title": "" }, { "docid": "24178c2541501a0aa6c143737a9d00a3", "score": "0.5402881", "text": "func (e *Empire) Deploy(ctx context.Context, opts DeployOpts) (*Release, error) {\n\tif err := opts.Validate(e); err != nil {\n\t\treturn nil, err\n\t}\n\n\tr, err := e.deployer.Deploy(ctx, opts)\n\tif err != nil {\n\t\treturn r, err\n\t}\n\n\tevent := opts.Event()\n\tevent.Release = r.Version\n\tevent.Environment = e.Environment\n\t// Deals with new app creation on first deploy\n\tif event.App == \"\" && r.App != nil {\n\t\tevent.App = r.App.Name\n\t\tevent.app = r.App\n\t}\n\n\treturn r, e.PublishEvent(event)\n}", "title": "" }, { "docid": "d5971b73ede782ace0f8cae43d5225ce", "score": "0.5398573", "text": "func (r *ProxyServiceReconciler) constructDeployment(proxy *api.ProxyService, config *corev1.ConfigMap) (*apps.Deployment, error) {\n\tdeployment := createDeployment(*proxy, *config)\n\tr.Log.Info(\"Deploying\", \"deployment\", deployment)\n\tif err := ctrl.SetControllerReference(proxy, deployment, r.Scheme); err != nil {\n\t\treturn nil, err\n\t}\n\treturn deployment, nil\n}", "title": "" }, { "docid": "7e9dc81a25ce16e4b28999d0c469746f", "score": "0.53946155", "text": "func newDeploymentInfo(d Deployment) DeploymentInfo {\n\tversion, license := d.DatabaseVersion()\n\treturn DeploymentInfo{\n\t\tName: d.Name(),\n\t\tNamespace: d.Namespace(),\n\t\tMode: d.GetMode(),\n\t\tEnvironment: d.Environment(),\n\t\tStateColor: d.StateColor(),\n\t\tPodCount: d.PodCount(),\n\t\tReadyPodCount: d.ReadyPodCount(),\n\t\tVolumeCount: d.VolumeCount(),\n\t\tReadyVolumeCount: d.ReadyVolumeCount(),\n\t\tStorageClasses: d.StorageClasses(),\n\t\tDatabaseURL: d.DatabaseURL(),\n\t\tDatabaseVersion: version,\n\t\tDatabaseLicense: license,\n\t}\n}", "title": "" }, { "docid": "92d6b8b0601d511598746dfad163ec44", "score": "0.53859144", "text": "func (d *Client) CreateDeployments(appID string) error {\n\tcmd := exec.Command(\"sh\", \"-c\", fmt.Sprintf(\"doctl app create-deployment %s\", appID))\n\t_, err := cmd.Output()\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"unable to create-deployment for app\")\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "eaf86abbe65536a454c59ba91301f0ee", "score": "0.53822464", "text": "func CreateDeploymentWithEnvVarSource(client kubernetes.Interface, deploymentName string, namespace string) (*appsv1.Deployment, error) {\n\tlogrus.Infof(\"Creating Deployment\")\n\tdeploymentClient := client.AppsV1().Deployments(namespace)\n\tdeploymentObj := GetDeploymentWithEnvVarSources(namespace, deploymentName)\n\tdeployment, err := deploymentClient.Create(context.TODO(), deploymentObj, metav1.CreateOptions{})\n\ttime.Sleep(3 * time.Second)\n\treturn deployment, err\n\n}", "title": "" }, { "docid": "058893066b5c6a246a28ff865a329326", "score": "0.5378935", "text": "func newDeploymentForCollector(cr *analyticsv1alpha1.TFAnalytics) *betav1.Deployment {\n\tlabels := map[string]string{\n\t\t\"app\": cr.Name + \"-collector\",\n\t}\n\n\tdeploy := &betav1.Deployment{\n\t\tObjectMeta: metav1.ObjectMeta{\n\t\t\tName: cr.Name + \"-collector\",\n\t\t\tNamespace: cr.Namespace,\n\t\t\tLabels: labels,\n\t\t},\n\t\tSpec: betav1.DeploymentSpec{\n\t\t\tReplicas: cr.Spec.CollectorSpec.Replicas,\n\t\t\tTemplate: corev1.PodTemplateSpec{\n\t\t\t\tObjectMeta: metav1.ObjectMeta{\n\t\t\t\t\tLabels: labels,\n\t\t\t\t},\n\t\t\t\tSpec: corev1.PodSpec{\n\t\t\t\t\tContainers: []corev1.Container{\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tName: cr.Name + \"-collector\",\n\t\t\t\t\t\t\tImage: cr.Spec.CollectorSpec.Image,\n\t\t\t\t\t\t},\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t},\n\t\t},\n\t}\n\t// set co config maps\n\tconfigMaps := getConfigMapsObject(cr)\n\tif len(configMaps) > 0 {\n\t\tdeploy.Spec.Template.Spec.Containers[0].EnvFrom = configMaps\n\t}\n\t// set ports if defined\n\tports := cr.Spec.CollectorSpec.Ports.GetContainerPortList()\n\tif len(ports) > 0 {\n\t\tdeploy.Spec.Template.Spec.Containers[0].Ports = ports\n\t} else {\n\t\t// If ports are not defined\n\t\tdeploy.Spec.Template.Spec.Containers[0].Ports = []corev1.ContainerPort{\n\t\t\t{Name: \"collector\", ContainerPort: 8086},\n\t\t\t{Name: \"introspect\", ContainerPort: 8089},\n\t\t}\n\t}\n\t// set environment variable(s) if defined in spec\n\tenvs := cr.Spec.CollectorSpec.EnvList\n\tif len(envs) > 0 {\n\t\tdeploy.Spec.Template.Spec.Containers[0].Env = envs\n\t}\n\n\treturn deploy\n}", "title": "" }, { "docid": "874aaf4d5f8f0a95df22a21b9080ed9c", "score": "0.5378248", "text": "func (b *Platform) deploy(ctx context.Context, ui terminal.UI) (*Deployment, error) {\n\tu := ui.Status()\n\tdefer u.Close()\n\tu.Update(\"Deploy application\")\n\n\t//u.Step(terminal.StatusOK, \"To: \" + deployConfig.Env())\n\n\tfile, err := os.Open(\"cluster_config.json\")\n\tif err != nil {\n\t\tu.Step(terminal.StatusError, \"Error opening cluster config\")\n\t\treturn nil, err\n\t}\n\n\tbyteValue, _ := ioutil.ReadAll(file)\n\tconfig := make(map[string]interface{})\n\n\terr = json.Unmarshal(byteValue, &config)\n\tif err != nil {\n\t\tu.Step(terminal.StatusError, \"Error parsing cluster config\")\n\t\treturn nil, err\n\t}\n\n\tprojectId := config[\"project_id\"].(string)\n\tregion := config[\"region\"].(string)\n\tclusterName := config[\"name\"].(string)\n\n\tu.Step(terminal.InfoStyle, \"Project Id: \" + projectId)\n\tu.Step(terminal.InfoStyle, \"Region: \" + region)\n\tu.Step(terminal.InfoStyle, \"Cluster Name: \" + clusterName)\n\n\tendpoint := fmt.Sprintf(\"%s-dataproc.googleapis.com:443\", region)\n\tjobClient, err := dataproc.NewJobControllerClient(ctx, option.WithEndpoint(endpoint))\n\tif err != nil {\n\t\tlog.Fatalf(\"error creating the job client: %s\\n\", err)\n\t}\n\n\n\t//// Create the job config.\n\tsubmitJobReq := &dataprocpb.SubmitJobRequest{\n\t\tProjectId: projectId,\n\t\tRegion: region,\n\t\tJob: &dataprocpb.Job{\n\t\t\tPlacement: &dataprocpb.JobPlacement{\n\t\t\t\tClusterName: clusterName,\n\t\t\t},\n\t\t\tTypeJob: &dataprocpb.Job_SparkJob{\n\t\t\t\tSparkJob: &dataprocpb.SparkJob{\n\t\t\t\t\tDriver: &dataprocpb.SparkJob_MainClass{\n\t\t\t\t\t\tMainClass: \"org.apache.spark.examples.SparkPi\",\n\t\t\t\t\t},\n\t\t\t\t\tJarFileUris: []string{\"file:///usr/lib/spark/examples/jars/spark-examples.jar\"},\n\t\t\t\t\tArgs: []string{\"1000\"},\n\t\t\t\t},\n\t\t\t},\n\t\t},\n\t}\n\tsubmitJobOp, err := jobClient.SubmitJobAsOperation(ctx, submitJobReq)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tsubmitJobResp, err := submitJobOp.Wait(ctx)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\t//\n\tre := regexp.MustCompile(\"gs://(.+?)/(.+)\")\n\tmatches := re.FindStringSubmatch(submitJobResp.DriverOutputResourceUri)\n\t//\n\tif len(matches) < 3 {\n\t\treturn nil, err\n\t}\n\t//\n\t//// Dataproc job output gets saved to a GCS bucket allocated to it.\n\t//storageClient, err := storage.NewClient(ctx)\n\t//if err != nil {\n\t//\treturn fmt.Errorf(\"error creating storage client: %v\", err)\n\t//}\n\t//\n\t//obj := fmt.Sprintf(\"%s.000000000\", matches[2])\n\t//reader, err := storageClient.Bucket(matches[1]).Object(obj).NewReader(ctx)\n\t//if err != nil {\n\t//\treturn fmt.Errorf(\"error reading job output: %v\", err)\n\t//}\n\t//\n\t//defer reader.Close()\n\t//\n\t//body, err := ioutil.ReadAll(reader)\n\t//if err != nil {\n\t//\treturn fmt.Errorf(\"could not read output from Dataproc Job: %v\", err)\n\t//}\n\n\t//fmt.Fprintf(w, \"Job finished successfully: %s\", body)\n\n\n\treturn &Deployment{}, nil\n}", "title": "" }, { "docid": "612774423fbb0bb85412cd80c079157b", "score": "0.536726", "text": "func CreateDeploymentWithEnvVarSourceAndAnnotations(client kubernetes.Interface, deploymentName string, namespace string, annotations map[string]string) (*appsv1.Deployment, error) {\n\tlogrus.Infof(\"Creating Deployment\")\n\tdeploymentClient := client.AppsV1().Deployments(namespace)\n\tdeploymentObj := GetDeploymentWithEnvVarSources(namespace, deploymentName)\n\tdeploymentObj.Annotations = annotations\n\tdeployment, err := deploymentClient.Create(context.TODO(), deploymentObj, metav1.CreateOptions{})\n\ttime.Sleep(3 * time.Second)\n\treturn deployment, err\n}", "title": "" }, { "docid": "e8104c2df91d0f3da57dc4afd6303b8b", "score": "0.53642344", "text": "func (p *tigeraPrometheusAPIComponent) deployment(prometheusServiceListenPort int) *appsv1.Deployment {\n\tvar replicas int32 = 1\n\tpodDnsPolicy := corev1.DNSClusterFirst\n\tpodHostNetworked := false\n\n\t// set to host networked if cluster is on EKS using Calico CNI since the EKS managed Kubernetes APIserver\n\t// cannot reach the pod network in this configuration. This is because Calico cannot manage\n\t// the managed control plane nodes' network\n\tif p.installation.KubernetesProvider == operatorv1.ProviderEKS &&\n\t\tp.installation.CNI.Type == operatorv1.PluginCalico {\n\t\tpodHostNetworked = true\n\t\t// corresponding dns policy for hostnetwoked pods to resolve the service hostname urls\n\t\tpodDnsPolicy = corev1.DNSClusterFirstWithHostNet\n\t}\n\n\td := &appsv1.Deployment{\n\t\tTypeMeta: metav1.TypeMeta{\n\t\t\tKind: \"Deployment\",\n\t\t\tAPIVersion: \"apps/v1\",\n\t\t},\n\t\tObjectMeta: metav1.ObjectMeta{\n\t\t\tName: TigeraPrometheusAPIName,\n\t\t\tNamespace: common.TigeraPrometheusNamespace,\n\t\t\tLabels: map[string]string{\n\t\t\t\t\"k8s-app\": TigeraPrometheusAPIName,\n\t\t\t},\n\t\t},\n\t\tSpec: appsv1.DeploymentSpec{\n\t\t\tReplicas: &replicas,\n\t\t\tSelector: &metav1.LabelSelector{\n\t\t\t\tMatchLabels: map[string]string{\n\t\t\t\t\t\"k8s-app\": TigeraPrometheusAPIName,\n\t\t\t\t},\n\t\t\t},\n\t\t\tTemplate: corev1.PodTemplateSpec{\n\t\t\t\tObjectMeta: metav1.ObjectMeta{\n\t\t\t\t\tName: TigeraPrometheusAPIName,\n\t\t\t\t\tNamespace: common.TigeraPrometheusNamespace,\n\t\t\t\t\tLabels: map[string]string{\n\t\t\t\t\t\t\"k8s-app\": TigeraPrometheusAPIName,\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t\tSpec: corev1.PodSpec{\n\t\t\t\t\tDNSPolicy: podDnsPolicy,\n\t\t\t\t\tHostNetwork: podHostNetworked,\n\t\t\t\t\tImagePullSecrets: secret.GetReferenceList(p.pullSecrets),\n\t\t\t\t\tNodeSelector: p.installation.ControlPlaneNodeSelector,\n\t\t\t\t\tTolerations: append(p.installation.ControlPlaneTolerations, rmeta.TolerateMaster),\n\t\t\t\t\tContainers: []corev1.Container{\n\t\t\t\t\t\tp.tigeraPrometheusAPIContainers(prometheusServiceListenPort),\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t},\n\t\t},\n\t}\n\n\treturn d\n}", "title": "" }, { "docid": "9258f61cd801ded77ba5160b580d33a7", "score": "0.53594285", "text": "func GetDeploymentWithInitContainerAndEnv(namespace string, deploymentName string) *appsv1.Deployment {\n\treplicaset := int32(1)\n\treturn &appsv1.Deployment{\n\t\tObjectMeta: getObjectMeta(namespace, deploymentName, true),\n\t\tSpec: appsv1.DeploymentSpec{\n\t\t\tSelector: &metav1.LabelSelector{\n\t\t\t\tMatchLabels: map[string]string{\"secondLabel\": \"temp\"},\n\t\t\t},\n\t\t\tReplicas: &replicaset,\n\t\t\tStrategy: appsv1.DeploymentStrategy{\n\t\t\t\tType: appsv1.RollingUpdateDeploymentStrategyType,\n\t\t\t},\n\t\t\tTemplate: getPodTemplateSpecWithInitContainerAndEnv(deploymentName),\n\t\t},\n\t}\n}", "title": "" }, { "docid": "fafb4c447d90c2dd1176bba7fb081538", "score": "0.5358158", "text": "func CanaryApp(client kubernetes.Interface, istioClient istio.Interface, namespace *common.NamespaceQuery,\n\tappName string, canaryDep *api.CanaryDeployment) error {\n\tversion := canaryDep.Version\n\n\t// check if the specified app exist\n\tdataSelector := dataselect.NoDataSelect\n\tdataSelector.FilterQuery = dataselect.NewFilterQuery([]string{dataselect.NameProperty, appName})\n\n\t_, err := GetAppDetail(client, istioClient, namespace, appName, dataSelector)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// check if the app is in canary\n\t// if multiple destination rules exist\n\tdRules, err := destinationrule.GetDestinationRuleListByHostname(client, istioClient, namespace, []string{appName})\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tif dRules.ListMeta.TotalItems > 1 {\n\t\treturn fmt.Errorf(\"app %s is in canary\", appName)\n\t}\n\n\t// 3. create a deployment with specified version & canary plan name\n\t// find the existed deployment first, and inherent from its deployment configuration\n\tvar parent v1beta1.Deployment\n\tif parentDeps, err := getDeploymentByLabels(client, namespace, map[string]string{\"app\": appName}); err != nil || len(parentDeps) != 1 {\n\t\treturn fmt.Errorf(\"support only one parent deployment, %d given\", len(parentDeps))\n\t} else {\n\t\tparent = parentDeps[0]\n\t}\n\n\t// fix parent deployment when some label is not set correctly.\n\tif err := fixDeployment(client, &parent); err != nil {\n\t\treturn err\n\t}\n\n\t// create new deployment\n\tnewPodSpec := canaryDep.PodTemplate\n\tnewPodSpec.Labels[\"app\"] = appName\n\tnewPodSpec.Labels[\"qcloud-app\"] = appName\n\tnewPodSpec.Labels[\"version\"] = version\n\n\tvar replica int32\n\tif canaryDep.Replicas > 0 {\n\t\treplica = canaryDep.Replicas\n\t} else {\n\t\treplica = *parent.Spec.Replicas\n\t}\n\tnewDep := &v1beta1.Deployment{\n\t\tTypeMeta: metav1.TypeMeta{\n\t\t\tKind: api2.ResourceKindDeployment,\n\t\t\tAPIVersion: parent.APIVersion,\n\t\t},\n\t\tObjectMeta: metav1.ObjectMeta{\n\t\t\tName: fmt.Sprintf(\"%s-%s\", appName, version),\n\t\t\tNamespace: parent.Namespace,\n\t\t\tLabels: map[string]string{\n\t\t\t\t\"app\": appName,\n\t\t\t\t\"qcloud-app\": appName,\n\t\t\t\t\"version\": version,\n\t\t\t},\n\t\t},\n\t\tSpec: v1beta1.DeploymentSpec{\n\t\t\tReplicas: &replica,\n\t\t\tSelector: &metav1.LabelSelector{\n\t\t\t\tMatchLabels: map[string]string{\n\t\t\t\t\t\"app\": appName,\n\t\t\t\t\t\"version\": version,\n\t\t\t\t},\n\t\t\t},\n\t\t\tTemplate: newPodSpec,\n\t\t\tStrategy: parent.Spec.Strategy,\n\t\t\tMinReadySeconds: parent.Spec.MinReadySeconds,\n\t\t\tRevisionHistoryLimit: parent.Spec.RevisionHistoryLimit,\n\t\t\tProgressDeadlineSeconds: parent.Spec.ProgressDeadlineSeconds,\n\t\t},\n\t}\n\n\tnewDep, err = client.ExtensionsV1beta1().Deployments(namespace.ToRequestParam()).Create(newDep)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// create destination rules\n\tdestinationRule, err := istioClient.NetworkingV1alpha3().DestinationRules(namespace.ToRequestParam()).Get(appName, metav1.GetOptions{})\n\tif err != nil {\n\t\tif kdErrors.IsNotFoundError(err) {\n\t\t\t// create a new destinationRule\n\t\t\trule := &istioApi.DestinationRule{\n\t\t\t\tObjectMeta: metav1.ObjectMeta{\n\t\t\t\t\tName: appName,\n\t\t\t\t\tNamespace: namespace.ToRequestParam(),\n\t\t\t\t},\n\t\t\t\tSpec: istioApi.DestinationRuleSpec{\n\t\t\t\t\tHost: appName,\n\t\t\t\t\tSubsets: []*istioApi.Subset{\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tName: parent.Labels[\"version\"],\n\t\t\t\t\t\t\tLabels: map[string]string{\n\t\t\t\t\t\t\t\t\"version\": parent.Labels[\"version\"],\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t},\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tName: newDep.Labels[\"version\"],\n\t\t\t\t\t\t\tLabels: map[string]string{\n\t\t\t\t\t\t\t\t\"version\": newDep.Labels[\"version\"],\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\t_, err := istioClient.NetworkingV1alpha3().DestinationRules(namespace.ToRequestParam()).Create(rule)\n\t\t\treturn err\n\t\t}\n\t\treturn err\n\t}\n\n\treturn addToDestinationRule(istioClient, destinationRule, version, namespace.ToRequestParam())\n}", "title": "" }, { "docid": "7da3f3ba67246b4e2c9da31d678e0b34", "score": "0.53531784", "text": "func ForDeployment(client kubernetes.Interface, namespace string) Interface {\n\treturn &InterfaceFuncs{\n\t\tGetFunc: func(ctx context.Context, name string, options metav1.GetOptions) (runtime.Object, error) {\n\t\t\treturn client.AppsV1().Deployments(namespace).Get(ctx, name, options)\n\t\t},\n\t\tCreateFunc: func(ctx context.Context, obj runtime.Object, options metav1.CreateOptions) (runtime.Object, error) {\n\t\t\treturn client.AppsV1().Deployments(namespace).Create(ctx, obj.(*appsv1.Deployment), options)\n\t\t},\n\t\tUpdateFunc: func(ctx context.Context, obj runtime.Object, options metav1.UpdateOptions) (runtime.Object, error) {\n\t\t\treturn client.AppsV1().Deployments(namespace).Update(ctx, obj.(*appsv1.Deployment), options)\n\t\t},\n\t\tDeleteFunc: func(ctx context.Context, name string, options metav1.DeleteOptions) error {\n\t\t\treturn client.AppsV1().Deployments(namespace).Delete(ctx, name, options)\n\t\t},\n\t\tListFunc: func(ctx context.Context, options metav1.ListOptions) ([]runtime.Object, error) {\n\t\t\tl, err := client.AppsV1().Deployments(namespace).List(ctx, options)\n\t\t\treturn MustExtractList(l), err\n\t\t},\n\t}\n}", "title": "" }, { "docid": "52bf568b1d46ea17edec4cd3c16e8027", "score": "0.5350366", "text": "func getDeployment(cl *apiserver.APIClient, name string, namespace string) ([]byte, error) {\n\tdeploy, err := cl.Cl.AppsV1().Deployments(namespace).Get(context.TODO(), name, metav1.GetOptions{})\n\tif err != nil {\n\t\tlog.Debugf(\"Can't retrieve Deployment %v from the API server: %s\", name, err.Error())\n\t\treturn nil, err\n\t}\n\treturn convertToYAMLBytes(deploy)\n}", "title": "" }, { "docid": "5700ff84339a3d0eb88f16950555e8fc", "score": "0.53401065", "text": "func (c *deployments) Get(name string) (result *deployapi.Deployment, err error) {\n\tresult = &deployapi.Deployment{}\n\terr = c.r.Get().Namespace(c.ns).Resource(\"deployments\").Name(name).Do().Into(result)\n\treturn\n}", "title": "" } ]
c2c1fa795a5bd39c83e5d06b1fc9aab6
MarkdownFromDocument makes a Markdownformatted document. Formatting: ongoing predictions are plain predictions that were called correctly are bold predictions that were miscalled are struck through excludedforcause predictions are italicized Note that MarkdownFromDocument also uses HTML for the italics and the strikethrough. This may be a problem in some contexts that allow markdown but not HTML, like some forum software in some configurations.
[ { "docid": "8f50a0b79e8c58c1d9a1b9d2721e3cf6", "score": "0.7484171", "text": "func MarkdownFromDocument(d streams.PredictionDocument) string {\n\tmeat := fmt.Sprintf(\"%v: %v%%\", d.Claim, *(d.Confidence))\n\twithToppings := \"\"\n\n\tswitch Evaluate(d) {\n\tcase ExcludedForCause:\n\t\twithToppings = fmt.Sprintf(\"- <i>%v</i>\", meat)\n\tcase Ongoing:\n\t\twithToppings = fmt.Sprintf(\"- %v\", meat)\n\tcase CalledTruePositive, CalledTrueNegative:\n\t\twithToppings = fmt.Sprintf(\"- <b>%v</b>\", meat)\n\tcase MissedFalsePositive, MissedFalseNegative:\n\t\twithToppings = fmt.Sprintf(\"- <s>%v</s>\", meat)\n\tcase Resolved:\n\t\twithToppings = fmt.Sprintf(\"- <b><s>%v</s></b>\", meat) // Ugly and confusing but I don’t see a better way at the moment\n\tdefault:\n\t\tpanic(fmt.Sprintf(\"logic error in MarkdownFromDocument given document: %#v\", d))\n\t}\n\n\treturn withToppings + \"\\n\"\n}", "title": "" } ]
[ { "docid": "8c66d008ce1d6f42d321c5a4e956f2ac", "score": "0.6622011", "text": "func NewMarkdownDocument(src string) (*textDocument, error) {\n\td := textDocument{\n\t\tSrcPath: src,\n\t\tencoding: encodingMarkdown,\n\t\tdependencies: map[string]struct{}{},\n\t}\n\tif err := d.load(); err != nil {\n\t\treturn nil, err\n\t}\n\treturn &d, d.slurpHTML()\n}", "title": "" }, { "docid": "6cfdae44c71a2cd4dcec2597a2bed1a5", "score": "0.65960336", "text": "func (d *Document) Markdown() []byte {\n\treturn d.Format(ToMarkdown)\n}", "title": "" }, { "docid": "4cdab79c925aef94a92c0b281b8ce5be", "score": "0.639151", "text": "func Markdown(ctx *context.APIContext, form api.MarkdownOption) {\n\t// swagger:operation POST /markdown miscellaneous renderMarkdown\n\t// ---\n\t// summary: Render a markdown document as HTML\n\t// parameters:\n\t// - name: body\n\t// in: body\n\t// schema:\n\t// \"$ref\": \"#/definitions/MarkdownOption\"\n\t// consumes:\n\t// - application/json\n\t// produces:\n\t// - text/html\n\t// responses:\n\t// \"200\":\n\t// \"$ref\": \"#/responses/MarkdownRender\"\n\t// \"422\":\n\t// \"$ref\": \"#/responses/validationError\"\n\n\tif ctx.HasAPIError() {\n\t\tctx.Error(http.StatusUnprocessableEntity, \"\", ctx.GetErrMsg())\n\t\treturn\n\t}\n\n\tif len(form.Text) == 0 {\n\t\t_, _ = ctx.Write([]byte(\"\"))\n\t\treturn\n\t}\n\n\tswitch form.Mode {\n\tcase \"comment\":\n\t\tfallthrough\n\tcase \"gfm\":\n\t\tmd := []byte(form.Text)\n\t\turlPrefix := form.Context\n\t\tmeta := map[string]string{}\n\t\tif !strings.HasPrefix(setting.AppSubURL+\"/\", urlPrefix) {\n\t\t\t// check if urlPrefix is already set to a URL\n\t\t\tlinkRegex, _ := xurls.StrictMatchingScheme(\"https?://\")\n\t\t\tm := linkRegex.FindStringIndex(urlPrefix)\n\t\t\tif m == nil {\n\t\t\t\turlPrefix = util.URLJoin(setting.AppURL, form.Context)\n\t\t\t}\n\t\t}\n\t\tif ctx.Repo != nil && ctx.Repo.Repository != nil {\n\t\t\t// \"gfm\" = Github Flavored Markdown - set this to render as a document\n\t\t\tif form.Mode == \"gfm\" {\n\t\t\t\tmeta = ctx.Repo.Repository.ComposeDocumentMetas()\n\t\t\t} else {\n\t\t\t\tmeta = ctx.Repo.Repository.ComposeMetas()\n\t\t\t}\n\t\t}\n\t\tif form.Mode == \"gfm\" {\n\t\t\tmeta[\"mode\"] = \"document\"\n\t\t}\n\t\tif form.Wiki {\n\t\t\t_, err := ctx.Write([]byte(markdown.RenderWiki(md, urlPrefix, meta)))\n\t\t\tif err != nil {\n\t\t\t\tctx.InternalServerError(err)\n\t\t\t\treturn\n\t\t\t}\n\t\t} else {\n\t\t\t_, err := ctx.Write(markdown.Render(md, urlPrefix, meta))\n\t\t\tif err != nil {\n\t\t\t\tctx.InternalServerError(err)\n\t\t\t\treturn\n\t\t\t}\n\t\t}\n\tdefault:\n\t\t_, err := ctx.Write(markdown.RenderRaw([]byte(form.Text), \"\", false))\n\t\tif err != nil {\n\t\t\tctx.InternalServerError(err)\n\t\t\treturn\n\t\t}\n\t}\n}", "title": "" }, { "docid": "42bddf6e3e13d603f507e93ad79eb7fa", "score": "0.6175912", "text": "func Markdown(str interface{}) []byte {\n\t// this did use blackfriday.MarkdownCommon, but it was stripping out <script>\n\tvar c []byte\n\n\thtmlFlags := 0\n\thtmlFlags |= blackfriday.HTML_USE_XHTML\n\thtmlFlags |= blackfriday.HTML_USE_SMARTYPANTS\n\thtmlFlags |= blackfriday.HTML_SMARTYPANTS_FRACTIONS\n\thtmlFlags |= blackfriday.HTML_SMARTYPANTS_LATEX_DASHES\n\trenderer := blackfriday.HtmlRenderer(htmlFlags, \"\", \"\")\n\n\t// set up the parser\n\textensions := 0\n\textensions |= blackfriday.EXTENSION_NO_INTRA_EMPHASIS\n\textensions |= blackfriday.EXTENSION_TABLES\n\textensions |= blackfriday.EXTENSION_FENCED_CODE\n\textensions |= blackfriday.EXTENSION_AUTOLINK\n\textensions |= blackfriday.EXTENSION_STRIKETHROUGH\n\textensions |= blackfriday.EXTENSION_SPACE_HEADERS\n\textensions |= blackfriday.EXTENSION_FOOTNOTES\n\n\tswitch str.(type) {\n\tdefault:\n\t\treturn c\n\tcase string:\n\t\tc = []byte(str.(string))\n\tcase []byte:\n\t\tc = []byte(str.([]byte))\n\t}\n\n\treturn blackfriday.Markdown(c, renderer, extensions)\n}", "title": "" }, { "docid": "159c3a3338447a5502265f47c2fd7c3e", "score": "0.61087877", "text": "func Markdown(input []byte, renderer *Renderer, extensions uint32) []byte {\n\t// no point in parsing if we can't render\n\tif renderer == nil {\n\t\treturn nil\n\t}\n\n\t// fill in the render structure\n\trndr := new(render)\n\trndr.mk = renderer\n\trndr.flags = extensions\n\trndr.refs = make(map[string]*reference)\n\trndr.maxNesting = 16\n\n\t// register inline parsers\n\tif rndr.mk.emphasis != nil || rndr.mk.doubleEmphasis != nil || rndr.mk.tripleEmphasis != nil {\n\t\trndr.inline['*'] = inlineEmphasis\n\t\trndr.inline['_'] = inlineEmphasis\n\t\tif extensions&EXTENSION_STRIKETHROUGH != 0 {\n\t\t\trndr.inline['~'] = inlineEmphasis\n\t\t}\n\t}\n\tif rndr.mk.codespan != nil {\n\t\trndr.inline['`'] = inlineCodespan\n\t}\n\tif rndr.mk.linebreak != nil {\n\t\trndr.inline['\\n'] = inlineLinebreak\n\t}\n\tif rndr.mk.image != nil || rndr.mk.link != nil {\n\t\trndr.inline['['] = inlineLink\n\t}\n\trndr.inline['<'] = inlineLangle\n\trndr.inline['\\\\'] = inlineEscape\n\trndr.inline['&'] = inlineEntity\n\n\tif extensions&EXTENSION_AUTOLINK != 0 {\n\t\trndr.inline['h'] = inlineAutolink // http, https\n\t\trndr.inline['H'] = inlineAutolink\n\n\t\trndr.inline['f'] = inlineAutolink // ftp\n\t\trndr.inline['F'] = inlineAutolink\n\n\t\trndr.inline['m'] = inlineAutolink // mailto\n\t\trndr.inline['M'] = inlineAutolink\n\t}\n\n\t// first pass: look for references, copy everything else\n\ttext := bytes.NewBuffer(nil)\n\tbeg, end := 0, 0\n\tfor beg < len(input) { // iterate over lines\n\t\tif end = isReference(rndr, input[beg:]); end > 0 {\n\t\t\tbeg += end\n\t\t} else { // skip to the next line\n\t\t\tend = beg\n\t\t\tfor end < len(input) && input[end] != '\\n' && input[end] != '\\r' {\n\t\t\t\tend++\n\t\t\t}\n\n\t\t\t// add the line body if present\n\t\t\tif end > beg {\n\t\t\t\texpandTabs(text, input[beg:end])\n\t\t\t}\n\n\t\t\tfor end < len(input) && (input[end] == '\\n' || input[end] == '\\r') {\n\t\t\t\t// add one \\n per newline\n\t\t\t\tif input[end] == '\\n' || (end+1 < len(input) && input[end+1] != '\\n') {\n\t\t\t\t\ttext.WriteByte('\\n')\n\t\t\t\t}\n\t\t\t\tend++\n\t\t\t}\n\n\t\t\tbeg = end\n\t\t}\n\t}\n\n\t// second pass: actual rendering\n\toutput := bytes.NewBuffer(nil)\n\tif rndr.mk.documentHeader != nil {\n\t\trndr.mk.documentHeader(output, rndr.mk.opaque)\n\t}\n\n\tif text.Len() > 0 {\n\t\t// add a final newline if not already present\n\t\tfinalchar := text.Bytes()[text.Len()-1]\n\t\tif finalchar != '\\n' && finalchar != '\\r' {\n\t\t\ttext.WriteByte('\\n')\n\t\t}\n\t\tparseBlock(output, rndr, text.Bytes())\n\t}\n\n\tif rndr.mk.documentFooter != nil {\n\t\trndr.mk.documentFooter(output, rndr.mk.opaque)\n\t}\n\n\tif rndr.nesting != 0 {\n\t\tpanic(\"Nesting level did not end at zero\")\n\t}\n\n\treturn output.Bytes()\n}", "title": "" }, { "docid": "5b49307527c75f87f0888dc9ab6d6f8d", "score": "0.60194564", "text": "func NewMarkdown() *markdown {\n\tm := markdown{\n\t\tgm: goldmark.New(\n\t\t\tgoldmark.WithExtensions(meta.Meta, highlighting.Highlighting),\n\t\t),\n\t}\n\treturn &m\n}", "title": "" }, { "docid": "d9029a575539f822228532076c198c4f", "score": "0.59870327", "text": "func MarkdownFromStream(st streams.Stream) string {\n\tvar buf strings.Builder\n\n\tfor _, d := range st.Predictions {\n\t\tif d.ShouldExclude() {\n\t\t\tcontinue\n\t\t}\n\n\t\tbuf.WriteString(MarkdownFromDocument(d))\n\t}\n\treturn buf.String()\n}", "title": "" }, { "docid": "929e2b166f224125792ab2702ef274ee", "score": "0.59693784", "text": "func Markdown(data string) template.HTML {\n\treturn template.HTML(MdPolicy.RenderToString([]byte(data)))\n}", "title": "" }, { "docid": "176437019edb0353a65483f57a5b6657", "score": "0.5930449", "text": "func NewMarkdown(v versions.Versions, opts ...Option) Markdown {\n\tmd := Markdown{\n\t\tversions: v,\n\t}\n\n\tfor _, opt := range opts {\n\t\topt(&md)\n\t}\n\n\treturn md\n}", "title": "" }, { "docid": "291cfb67d828423b4bd4385c9b5f40a9", "score": "0.5882504", "text": "func (ap ApiRender) Markdown(r render.Render, req *http.Request) {\n\tif err := req.ParseForm(); err != nil {\n\t\tr.Data(500, []byte(err.Error()))\n\t\treturn\n\t}\n\n\tif _, ok := req.Form[\"raw\"]; !ok {\n\t\tr.Data(500, []byte(\"No Data\"))\n\t\treturn\n\t}\n\n\traw := req.Form[\"raw\"][0]\n\tdata := util.Markdown([]byte(raw))\n\n\tr.JSON(200, apiRenderResponse{Data: string(data)})\n}", "title": "" }, { "docid": "e809c7ef78ab129a01b6b458753847a8", "score": "0.58622974", "text": "func (gmc GithubMarkdownConverter) Convert(markdown string) (string, error) {\n\trequest, err := http.NewRequest(\"POST\",\n\t\t\"https://api.github.com/markdown/raw\", strings.NewReader(markdown))\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\n\trequest.Header.Add(\"Accept\", \"application/json\")\n\trequest.Header.Add(\"Content-Type\", \"text/plain\")\n\trequest.Header.Add(\"Authorization\", \"token \"+gmc.conf.GithubAccessToken)\n\n\tclient := http.Client{}\n\tresponse, err := client.Do(request)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\tif response.StatusCode != http.StatusOK {\n\t\treturn \"\", fmt.Errorf(\"Response is not okay, status code is %d\",\n\t\t\tresponse.StatusCode)\n\t}\n\n\tdefer response.Body.Close()\n\tresult, err := ioutil.ReadAll(response.Body)\n\treturn string(result), nil\n}", "title": "" }, { "docid": "9d92e2cc18e0797ce33cd83ee517d898", "score": "0.58557594", "text": "func FormatMarkdown(dst io.Writer, schema *ast.Schema) error {\n\tmd := &markdown{\n\t\tcount: make(map[string]int),\n\t\tAnchor: make(map[string]map[string]string),\n\t\tImplementers: schema.PossibleTypes,\n\t\tTypes: schema.Types,\n\t}\n\tmd.Query = md.filterFields(schema.Query)\n\tmd.updateAnchors(\"Query\", \"#queries\", md.Query)\n\tmd.Mutation = md.filterFields(schema.Mutation)\n\tmd.updateAnchors(\"Mutation\", \"#mutations\", md.Mutation)\n\tmd.Subscription = md.filterFields(schema.Subscription)\n\tmd.updateAnchors(\"Subscription\", \"#subscriptions\", md.Subscription)\n\tmd.Objects = md.filterKind(schema.Types, ast.Object)\n\tmd.updateAnchors(\"Objects\", \"#objects\", md.Objects)\n\tmd.Interfaces = md.filterKind(schema.Types, ast.Interface)\n\tmd.updateAnchors(\"Interfaces\", \"#interfaces\", md.Interfaces)\n\tmd.Enums = md.filterKind(schema.Types, ast.Enum)\n\tmd.updateAnchors(\"Enums\", \"#enums\", md.Enums)\n\tmd.Unions = md.filterKind(schema.Types, ast.Union)\n\tmd.updateAnchors(\"Unions\", \"#unions\", md.Unions)\n\tmd.Inputs = md.filterKind(schema.Types, ast.InputObject)\n\tmd.updateAnchors(\"Input objects\", \"#input-objects\", md.Inputs)\n\tmd.Scalars = md.filterKind(schema.Types, ast.Scalar)\n\tmd.updateAnchors(\"Scalars\", \"#scalars\", md.Scalars)\n\treturn mdTemplate.Execute(dst, md)\n}", "title": "" }, { "docid": "886013753fc9fb1332d7d0b9ef2fe9fd", "score": "0.5823758", "text": "func Run(source []byte, opts Options) (doc *Document, err error) {\n\tdefer func() {\n\t\tif e := recover(); e != nil {\n\t\t\terr = errors.Errorf(\"panic while rendering Markdown: %s\", e)\n\t\t}\n\t}()\n\n\tmeta, source, err := parseMetadata(source)\n\tif err != nil {\n\t\treturn nil, errors.Wrap(err, \"parse metadata\")\n\t}\n\n\tmd := New(opts)\n\n\tctx := parser.NewContext(\n\t\tfunc(cfg *parser.ContextConfig) {\n\t\t\tcfg.IDs = setHeadingIDs()\n\t\t},\n\t)\n\tmdAST := md.Parser().Parse(text.NewReader(source), parser.WithContext(ctx))\n\ttree := newTree(mdAST, source)\n\ttitle := meta.Title\n\tif title == \"\" {\n\t\ttitle = GetTitle(mdAST, source)\n\t}\n\n\tvar buf bytes.Buffer\n\terr = md.Renderer().Render(&buf, source, mdAST)\n\tif err != nil {\n\t\treturn nil, errors.Wrap(err, \"render\")\n\t}\n\n\treturn &Document{\n\t\tMeta: meta,\n\t\tTitle: title,\n\t\tHTML: buf.Bytes(),\n\t\tTree: tree,\n\t}, nil\n}", "title": "" }, { "docid": "bbdc669c8a9e352bde3aa5a59ee58673", "score": "0.5812493", "text": "func textToMarkdown(text string) string {\n\ttext = strings.Replace(text, \"\\n\", \" \\n\", -1)\n\treturn text\n}", "title": "" }, { "docid": "f88d0efa43abfd72c0c8523b5bcdd1b9", "score": "0.5810626", "text": "func (cmd DiffCmd) CreateMarkdown(fs filesys.Filesys, path, commandStr string) error {\n\tap := cmd.createArgParser()\n\treturn CreateMarkdown(fs, path, cli.GetCommandDocumentation(commandStr, diffDocs, ap))\n}", "title": "" }, { "docid": "afb2e1cf8049658efb884d356034831c", "score": "0.5802341", "text": "func NewMarkdown(writer io.Writer) *Markdown {\n\treturn &Markdown{\n\t\tWriter: writer,\n\t}\n}", "title": "" }, { "docid": "13823e9cc095b5168280b2dee6fb814e", "score": "0.57893157", "text": "func Markdown(text interface{}) string {\n\treturn string(blackfriday.MarkdownCommon([]byte(fmt.Sprint(text))))\n}", "title": "" }, { "docid": "7d2fafc2ed9b8f6da2e95663a55810a9", "score": "0.5774544", "text": "func PlainMarkdown(md string) (string, error) {\n\tpt := &Text{}\n\n\thtml := blackfriday.MarkdownOptions([]byte(md), pt, blackfriday.Options{})\n\n\treturn string(html), nil\n}", "title": "" }, { "docid": "86dd71a1a6b9d30c7c4a81b2f7a0e066", "score": "0.57447636", "text": "func markdownConverter(src []byte, out io.Writer) error {\n\t_, err := out.Write(mdStart)\n\tif err == nil {\n\t\t_, err = out.Write(src)\n\t}\n\tif err == nil {\n\t\t_, err = out.Write(mdEnd)\n\t}\n\treturn err\n}", "title": "" }, { "docid": "419c7976c6efc377b0ebfab1bca086bb", "score": "0.5708211", "text": "func getMarkdownConverter() (c *md.Converter) {\n\tc = md.NewConverter(\"\", true, &md.Options{HeadingStyle: \"setext\"})\n\n\t// Striketrough text should be deleted\n\tc.Remove(\"s\")\n\n\tc.AddRules(\n\t\t// Text decorations should be ignored\n\t\tmd.Rule{\n\t\t\tFilter: []string{\"strong\", \"em\", \"span\"},\n\t\t\tReplacement: func(content string, selec *goquery.Selection, options *md.Options) *string {\n\t\t\t\treturn &content\n\t\t\t},\n\t\t},\n\n\t\t// Blockquotes should be indented\n\t\tmd.Rule{\n\t\t\tFilter: []string{\"blockquote\"},\n\t\t\tReplacement: func(content string, selec *goquery.Selection, options *md.Options) *string {\n\t\t\t\tvar newContent string\n\t\t\t\tfor _, line := range strings.Split(content, \"\\n\") {\n\t\t\t\t\tnewContent += \" \" + line\n\t\t\t\t}\n\t\t\t\treturn &newContent\n\t\t\t},\n\t\t},\n\t)\n\treturn\n}", "title": "" }, { "docid": "3e2185f7b411e6cc0ed5c5e28dde01f4", "score": "0.5687758", "text": "func Markdown(source interface{}, state data.Map) (interface{}, error) {\n\tvar input = toolbox.AsString(source)\n\tresponse, err := Cat(input, state)\n\tif err == nil && response != nil {\n\t\tinput = toolbox.AsString(response)\n\t}\n\tresult := blackfriday.Run([]byte(input))\n\treturn string(result), nil\n}", "title": "" }, { "docid": "704abcdeddc487446996a838c7eb2db1", "score": "0.5673979", "text": "func NewArticleFromMarkdown(markdown string) {\n\n}", "title": "" }, { "docid": "c99dc2f2d22fe458e0e6112eebe32dd1", "score": "0.56466204", "text": "func (github *GitHubClient) RenderMarkdown(markdown *Markdown) (string, error) {\n\tif markdown.Markdown == \"\" {\n\t\treturn \"\", errors.New(\"You must not send an empty string as the markdown contents.\")\n\t}\n\n\tapiUrl := github.createUrl(\"/markdown\")\n\treader, err := github.CreateReader(markdown)\n\n\tres, err := github.Client.Post(apiUrl, \"application/json\", reader)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\tdefer res.Body.Close()\n\n\tif res.StatusCode == 200 {\n\t\thtmlBytes, err := ioutil.ReadAll(res.Body)\n\t\tif err != nil {\n\t\t\treturn \"\", err\n\t\t}\n\n\t\thtml := string(htmlBytes)\n\t\tgithub.getLimits(res)\n\t\treturn html, nil\n\t}\n\n\treturn \"\", errors.New(\"Didn't receive 200 status from Github: \" + res.Status)\n}", "title": "" }, { "docid": "e45c1cd1ec3ab104ae3cc43e47e750ee", "score": "0.5639662", "text": "func Markdown(content string) string {\n\tif !tty {\n\t\treturn content\n\t}\n\n\t// For now, just use syntax highlighting. Later, we might replace this\n\t// with something to render nice tables and lists, replace formatting\n\t// characters, etc.\n\tbuilder := strings.Builder{}\n\tif err := quick.Highlight(&builder, content, \"markdown\", \"terminal256\", \"cli-dark\"); err != nil {\n\t\treturn content\n\t}\n\n\treturn builder.String()\n}", "title": "" }, { "docid": "d242581947fcd78a66e6590278a8599b", "score": "0.5621324", "text": "func (cmd CpCmd) CreateMarkdown(fs filesys.Filesys, path, commandStr string) error {\n\tap := cmd.createArgParser()\n\treturn commands.CreateMarkdown(fs, path, cli.GetCommandDocumentation(commandStr, tblCpDocs, ap))\n}", "title": "" }, { "docid": "5f88c6aec1767dddac095f0fab96893d", "score": "0.56032515", "text": "func Markdown(content string) Option {\n\treturn func(text *Text) error {\n\t\ttext.Builder.TextPanel.Mode = \"markdown\"\n\t\ttext.Builder.TextPanel.Content = content\n\n\t\treturn nil\n\t}\n}", "title": "" }, { "docid": "8130d2731b30d86c6d3bc668c192c727", "score": "0.5597378", "text": "func (m Markdown) RenderMarkdown(Serve ServeHandler) ServeHandler {\n\n\treturn func(w http.ResponseWriter, resource Resource) error {\n\t\tif !isMarkdown(resource) {\n\t\t\treturn Serve(w, resource)\n\t\t}\n\n\t\tcontent, err := ioutil.ReadAll(resource.Data)\n\t\tresource.Data = bytes.NewReader(content)\n\t\tif err != nil {\n\t\t\treturn Serve(w, resource)\n\t\t}\n\n\t\trendered := m.md.RenderToString(content)\n\t\tvar buf bytes.Buffer\n\t\terr = m.template.Execute(&buf, TemplateData{Content: template.HTML(rendered)})\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tw.Header().Set(\"Content-Type\", \"text/html; charset=utf-8\")\n\t\tw.Header().Set(\"Content-Length\", strconv.FormatInt(int64(len(buf.Bytes())), 10))\n\t\t_, err = w.Write(buf.Bytes())\n\t\treturn err\n\t}\n}", "title": "" }, { "docid": "96ba673f1aa3156d1fe0d03122a31a11", "score": "0.55568963", "text": "func NewMarkdownFormatter(version VersionInformation) MarkdownFormatter {\n\treturn MarkdownFormatter{\n\t\tversion: version,\n\t}\n}", "title": "" }, { "docid": "f2506307225f3a7de57ed27ada33c786", "score": "0.5546329", "text": "func GenerateMarkdown(errors []rules.GitError) string {\n\tif len(errors) == 0 {\n\t\treturn \"\"\n\t}\n\n\tvar builder strings.Builder\n\tfmt.Fprintf(&builder, \"## Errors found: %d\\n\\n\", len(errors))\n\tfor _, element := range errors {\n\t\tfmt.Fprintf(&builder, \"- %s\\n\", element.Title)\n\t}\n\treturn builder.String()\n}", "title": "" }, { "docid": "d67b5c433cecb9e94959d98c52eca6a2", "score": "0.55332965", "text": "func parsedMarkdown(b []byte) []byte {\n\treturn blackfriday.MarkdownCommon(b)\n}", "title": "" }, { "docid": "c81c7e74aecc0b6194fbea5f774a8d20", "score": "0.5519495", "text": "func (m *WhisperClient) Markdown(ctx context.Context, content *WhisperContentMarkdown) error {\n\t_, err := m.client.WhisperMarkdown(ctx, &proto.WhisperMarkdownRequest{\n\t\tMeta: &proto.WhisperMeta{\n\t\t\tLabel: content.Label,\n\t\t},\n\t\tMarkdown: content.Markdown,\n\t\tSession: m.session.ToProto(),\n\t})\n\treturn err\n}", "title": "" }, { "docid": "539ad7ae357b1e9c12f50c7fe1e1d731", "score": "0.5514145", "text": "func GenerateMarkdown(model *kingpin.ApplicationModel, writer io.Writer) error {\n\th := header(model.Name, model.Help)\n\tif _, err := writer.Write(h); err != nil {\n\t\treturn err\n\t}\n\n\tif err := writeFlagTable(writer, 0, model.FlagGroupModel); err != nil {\n\t\treturn err\n\t}\n\n\tif err := writeArgTable(writer, 0, model.ArgGroupModel); err != nil {\n\t\treturn err\n\t}\n\n\tif err := writeCmdTable(writer, model.CmdGroupModel); err != nil {\n\t\treturn err\n\t}\n\n\treturn writeSubcommands(writer, 1, model.Name, model.CmdGroupModel.Commands)\n}", "title": "" }, { "docid": "7dff83da7209adc303e0d66d1ec674bc", "score": "0.54758346", "text": "func (b Book) DescriptionMarkdown() string { return HTML2Markdown(b.Description) }", "title": "" }, { "docid": "7ae3fd02043fc6149a322bb9a83af594", "score": "0.54637575", "text": "func (ns *Namespace) Markdownify(ctx context.Context, s any) (template.HTML, error) {\n\n\thome := ns.deps.Site.Home()\n\tif home == nil {\n\t\tpanic(\"home must not be nil\")\n\t}\n\tss, err := home.RenderString(ctx, s)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\n\t// Strip if this is a short inline type of text.\n\tbb := ns.deps.ContentSpec.TrimShortHTML([]byte(ss))\n\n\treturn helpers.BytesToHTML(bb), nil\n}", "title": "" }, { "docid": "31403f4cf74084691f33156759f40e9b", "score": "0.54563296", "text": "func MarkdownFromStreams(sts []streams.Stream, options ...Option) string {\n\tvar buf strings.Builder\n\n\to := formattingOptions{}\n\tfor _, f := range options {\n\t\tf(&o)\n\t}\n\n\t// TODO: first by title/scope, then by each individual tag…\n\tbuf.WriteString(\"# Everything\\n\\n\")\n\tfor _, st := range sts {\n\t\tbuf.WriteString(MarkdownFromStream(st))\n\t}\n\n\tbuf.WriteString(\"\\n\")\n\n\tkeysUsed := streams.KeysUsed(sts)\n\tif len(keysUsed) > 1 {\n\t\tfor _, key := range keysUsed {\n\t\t\tfmt.Fprintf(&buf, \"# %s\\n\\n\", key)\n\n\t\t\tfor _, d := range streams.DocumentsMatching(sts, streams.MatchingKey(key)) {\n\t\t\t\tbuf.WriteString(MarkdownFromDocument(d))\n\t\t\t}\n\n\t\t\tbuf.WriteString(\"\\n\")\n\t\t}\n\t}\n\n\ttagsUsed := streams.TagsUsed(sts)\n\tif len(tagsUsed) > 0 {\n\t\tfor _, tag := range tagsUsed {\n\t\t\tfmt.Fprintf(&buf, \"# %s\\n\\n\", tag)\n\n\t\t\tfor _, d := range streams.DocumentsMatching(sts, streams.MatchingTag(tag)) {\n\t\t\t\tbuf.WriteString(MarkdownFromDocument(d))\n\t\t\t}\n\n\t\t\tbuf.WriteString(\"\\n\")\n\t\t}\n\t}\n\n\treturn buf.String()\n}", "title": "" }, { "docid": "5ce3e5a80dd5cb0bae349353431b5b60", "score": "0.5414901", "text": "func ConvertMarkdownFileToHTML(filepath string) (string, map[string]interface{}, error) {\n\tsource, err := ioutil.ReadFile(filepath)\n\tif err != nil {\n\t\tfmt.Print(err)\n\t\treturn \"\", nil, err\n\t}\n\n\tvar buf bytes.Buffer\n\tcontext := parser.NewContext()\n\tif err := md.Convert(source, &buf, parser.WithContext(context)); err != nil {\n\t\tpanic(err)\n\t}\n\n\tmeta := meta.Get(context)\n\n\treturn string(buf.String()), meta, nil\n}", "title": "" }, { "docid": "c30f3b79328a9dfea0e3ec4b5213c509", "score": "0.5411756", "text": "func (cmd PushCmd) CreateMarkdown(wr io.Writer, commandStr string) error {\n\tap := cmd.createArgParser()\n\treturn CreateMarkdown(wr, cli.GetCommandDocumentation(commandStr, pushDocs, ap))\n}", "title": "" }, { "docid": "eabea624a05f5ba0fc660969eb9fc773", "score": "0.5358342", "text": "func New(opts ...Option) *Markdown {\n\tvar p Markdown\n\tfor _, opt := range opts {\n\t\topt(&p)\n\t}\n\tp.refs = make(map[string]*reference)\n\tp.maxNesting = 16\n\tp.insideLink = false\n\tdocNode := NewNode(Document)\n\tp.doc = docNode\n\tp.tip = docNode\n\tp.oldTip = docNode\n\tp.lastMatchedContainer = docNode\n\tp.allClosed = true\n\t// register inline parsers\n\tp.inlineCallback[' '] = maybeLineBreak\n\tp.inlineCallback['*'] = emphasis\n\tp.inlineCallback['_'] = emphasis\n\tif p.extensions&Strikethrough != 0 {\n\t\tp.inlineCallback['~'] = emphasis\n\t}\n\tp.inlineCallback['`'] = codeSpan\n\tp.inlineCallback['\\n'] = lineBreak\n\tp.inlineCallback['['] = link\n\tp.inlineCallback['<'] = leftAngle\n\tp.inlineCallback['\\\\'] = escape\n\tp.inlineCallback['&'] = entity\n\tp.inlineCallback['!'] = maybeImage\n\tp.inlineCallback['^'] = maybeInlineFootnote\n\tif p.extensions&Autolink != 0 {\n\t\tp.inlineCallback['h'] = maybeAutoLink\n\t\tp.inlineCallback['m'] = maybeAutoLink\n\t\tp.inlineCallback['f'] = maybeAutoLink\n\t\tp.inlineCallback['H'] = maybeAutoLink\n\t\tp.inlineCallback['M'] = maybeAutoLink\n\t\tp.inlineCallback['F'] = maybeAutoLink\n\t}\n\tif p.extensions&Footnotes != 0 {\n\t\tp.notes = make([]*reference, 0)\n\t}\n\treturn &p\n}", "title": "" }, { "docid": "9444d8dffeedec9dc621855de1ee0dc5", "score": "0.53189147", "text": "func Parse(r io.Reader) (md Markdown, err error) {\n\tb, err := ioutil.ReadAll(r)\n\tif err != nil {\n\t\treturn md, err\n\t}\n\n\tmd.mdToHTML = markdown.ToHTML(b, nil, nil)\n\treturn md, nil\n}", "title": "" }, { "docid": "40a86e488a6270cf843ca9eaa0b0a721", "score": "0.527511", "text": "func NewMarkdownMessage(markdown string) *Message {\n\treturn NewMessage().WithMarkdown(markdown)\n}", "title": "" }, { "docid": "2d292df45ee504e8077058e511e98f2f", "score": "0.5268406", "text": "func MarkdownRaw(ctx *context.APIContext) {\n\t// swagger:operation POST /markdown/raw miscellaneous renderMarkdownRaw\n\t// ---\n\t// summary: Render raw markdown as HTML\n\t// parameters:\n\t// - name: body\n\t// in: body\n\t// description: Request body to render\n\t// required: true\n\t// schema:\n\t// type: string\n\t// consumes:\n\t// - text/plain\n\t// produces:\n\t// - text/html\n\t// responses:\n\t// \"200\":\n\t// \"$ref\": \"#/responses/MarkdownRender\"\n\t// \"422\":\n\t// \"$ref\": \"#/responses/validationError\"\n\n\tbody, err := ctx.Req.Body().Bytes()\n\tif err != nil {\n\t\tctx.Error(http.StatusUnprocessableEntity, \"\", err)\n\t\treturn\n\t}\n\t_, err = ctx.Write(markdown.RenderRaw(body, \"\", false))\n\tif err != nil {\n\t\tctx.InternalServerError(err)\n\t\treturn\n\t}\n}", "title": "" }, { "docid": "cc82b43c3c7c0098eb32d1c9ec3e09bd", "score": "0.5246339", "text": "func (m Markdown) ConvertToPDF() (pdfFile pdf.PdfParser, err error) {\n\tpdfFile = pdfshift.PDF{Html: m.mdToHTML}\n\treturn pdfFile, err\n}", "title": "" }, { "docid": "2110d0f8fb78e8d6962dacaa6394c0ed", "score": "0.52170444", "text": "func PreviewMD(env *handler.Env, w http.ResponseWriter, r *http.Request) error {\n\tw.Header().Set(\"Content-Type\", \"text/html\")\n\n\tif r.Method == http.MethodPost {\n\n\t\ttype markdown struct {\n\t\t\tMd string `json:\"md\"`\n\t\t}\n\t\tvar response markdown\n\t\tdecoder := json.NewDecoder(r.Body)\n\t\tdecoder.DisallowUnknownFields()\n\t\terr := decoder.Decode(&response)\n\n\t\tif err != nil {\n\t\t\thttp.Error(w, err.Error(), http.StatusBadRequest)\n\t\t\treturn nil\n\t\t}\n\n\t\tt := template.Must(template.New(\"md\").Parse(\"{{.}}\"))\n\t\tt.Execute(w, parseMD(response.Md))\n\n\t\treturn nil\n\t}\n\treturn handler.StatusError{Code: http.StatusBadRequest, Err: errors.New(\"must be POST\")}\n}", "title": "" }, { "docid": "42893f953b8dd6e4726088915ea2d608", "score": "0.52048224", "text": "func ToText(text string) string {\n\t// good enough md to text conversion\n\tre1 := regexp.MustCompile(\"(?m)^((#+) +(.*$))\")\n\tsub := re1.FindAllStringSubmatch(text, -1)\n\tfor i := range sub {\n\t\tch := \"\"\n\t\tn := len(sub[i][3])\n\t\tswitch len(sub[i][2]) {\n\t\tcase 1:\n\t\t\tch = \"\\n\" + strings.Repeat(\"=\", n)\n\t\tcase 2:\n\t\t\tch = \"\\n\" + strings.Repeat(\"-\", n)\n\t\t}\n\t\ttext = strings.ReplaceAll(text, sub[i][1], sub[i][3]+ch)\n\t}\n\n\tre2 := regexp.MustCompile(\"(?m)\\n```.*$\")\n\tre3 := regexp.MustCompile(`(?m)\\(http[^\\)]*\\)`)\n\ttext = re2.ReplaceAllString(text, \"\")\n\ttext = re3.ReplaceAllString(text, \"\")\n\n\treturn text\n}", "title": "" }, { "docid": "f0998375bf006f6e8ed50d19d8723384", "score": "0.5197342", "text": "func NewMarkdownConfig() *Config {\n\tnodeRenderers := map[string]Option{\n\t\t\"paragraph\": SimpleOption{After: \"\\n\"},\n\t\t\"blockquote\": SimpleOption{Before: \"> \", After: \"\\n\"},\n\t\t\"horizontal_rule\": SimpleOption{Before: \"---\\n\"},\n\t\t\"heading\": markdownHeadingOption{},\n\t\t\"hard_break\": SimpleOption{Before: \"\\n\\n\"},\n\t\t\"ordered_list\": SimpleOption{After: \"\\n\"},\n\t\t\"bullet_list\": SimpleOption{After: \"\\n\"},\n\t\t\"list_item\": plainListItemOption{},\n\t\t\"code_block\": SimpleOption{Before: \"```\\n\", After: \"```\\n\"},\n\t\t\"variable\": variableOption{},\n\t}\n\n\tmarkRenderers := map[string]Option{\n\t\t\"link\": plainLinkOption{},\n\t\t\"em\": SimpleOption{Before: \"_\", After: \"_\"},\n\t\t\"strong\": SimpleOption{Before: \"**\", After: \"**\"},\n\t}\n\n\treturn &Config{nodeRenderers, markRenderers}\n}", "title": "" }, { "docid": "cdc7c7bce4c5b42f167302f32645d950", "score": "0.5176945", "text": "func convertMarkdownRoute(chromium API, engine gotenberg.PDFEngine) api.Route {\n\treturn api.Route{\n\t\tMethod: http.MethodPost,\n\t\tPath: \"/forms/chromium/convert/markdown\",\n\t\tIsMultipart: true,\n\t\tHandler: func(c echo.Context) error {\n\t\t\tctx := c.Get(\"context\").(*api.Context)\n\t\t\tform, options := FormDataChromiumPDFOptions(ctx)\n\n\t\t\tvar (\n\t\t\t\tinputPath string\n\t\t\t\tmarkdownPaths []string\n\t\t\t\tPDFformat string\n\t\t\t)\n\n\t\t\terr := form.\n\t\t\t\tMandatoryPath(\"index.html\", &inputPath).\n\t\t\t\tMandatoryPaths([]string{\".md\"}, &markdownPaths).\n\t\t\t\tString(\"pdfFormat\", &PDFformat, \"\").\n\t\t\t\tValidate()\n\n\t\t\tif err != nil {\n\t\t\t\treturn fmt.Errorf(\"validate form data: %w\", err)\n\t\t\t}\n\n\t\t\t// We have to convert each markdown file referenced in the HTML\n\t\t\t// file to... HTML. Thanks to the \"html/template\" package, we are\n\t\t\t// able to provide the \"toHTML\" function which the user may call\n\t\t\t// directly inside the HTML file.\n\n\t\t\tvar markdownFilesNotFoundErr error\n\n\t\t\ttmpl, err := template.\n\t\t\t\tNew(filepath.Base(inputPath)).\n\t\t\t\tFuncs(template.FuncMap{\n\t\t\t\t\t\"toHTML\": func(filename string) (template.HTML, error) {\n\t\t\t\t\t\tvar path string\n\n\t\t\t\t\t\tfor _, markdownPath := range markdownPaths {\n\t\t\t\t\t\t\tmarkdownFilename := filepath.Base(markdownPath)\n\n\t\t\t\t\t\t\tif filename == markdownFilename {\n\t\t\t\t\t\t\t\tpath = markdownPath\n\t\t\t\t\t\t\t\tbreak\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tif path == \"\" {\n\t\t\t\t\t\t\tmarkdownFilesNotFoundErr = multierr.Append(\n\t\t\t\t\t\t\t\tmarkdownFilesNotFoundErr,\n\t\t\t\t\t\t\t\tfmt.Errorf(\"'%s'\", filename),\n\t\t\t\t\t\t\t)\n\n\t\t\t\t\t\t\treturn \"\", nil\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tb, err := os.ReadFile(path)\n\t\t\t\t\t\tif err != nil {\n\t\t\t\t\t\t\treturn \"\", fmt.Errorf(\"read markdown file '%s': %w\", filename, err)\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tunsafe := blackfriday.Run(b)\n\t\t\t\t\t\tsanitized := bluemonday.UGCPolicy().SanitizeBytes(unsafe)\n\n\t\t\t\t\t\t// #nosec\n\t\t\t\t\t\treturn template.HTML(sanitized), nil\n\t\t\t\t\t},\n\t\t\t\t}).ParseFiles(inputPath)\n\n\t\t\tif err != nil {\n\t\t\t\treturn fmt.Errorf(\"parse template file: %w\", err)\n\t\t\t}\n\n\t\t\tvar buffer bytes.Buffer\n\n\t\t\terr = tmpl.Execute(&buffer, &struct{}{})\n\t\t\tif err != nil {\n\t\t\t\treturn fmt.Errorf(\"execute template: %w\", err)\n\t\t\t}\n\n\t\t\tif markdownFilesNotFoundErr != nil {\n\t\t\t\treturn api.WrapError(\n\t\t\t\t\tfmt.Errorf(\"markdown files not found: %w\", markdownFilesNotFoundErr),\n\t\t\t\t\tapi.NewSentinelHTTPError(\n\t\t\t\t\t\thttp.StatusBadRequest,\n\t\t\t\t\t\tfmt.Sprintf(\"Markdown file(s) not found: %s\", markdownFilesNotFoundErr),\n\t\t\t\t\t),\n\t\t\t\t)\n\t\t\t}\n\n\t\t\tinputPath = ctx.GeneratePath(\".html\")\n\n\t\t\terr = os.WriteFile(inputPath, buffer.Bytes(), 0600)\n\t\t\tif err != nil {\n\t\t\t\treturn fmt.Errorf(\"write template result: %w\", err)\n\t\t\t}\n\n\t\t\tURL := fmt.Sprintf(\"file://%s\", inputPath)\n\n\t\t\terr = convertURL(ctx, chromium, engine, URL, PDFformat, options)\n\t\t\tif err != nil {\n\t\t\t\treturn fmt.Errorf(\"convert markdown to PDF: %w\", err)\n\t\t\t}\n\n\t\t\treturn nil\n\t\t},\n\t}\n}", "title": "" }, { "docid": "71a9525e423ebca473dd5ef570b9bcfe", "score": "0.5170435", "text": "func (m *MarkdownServer) handleMarkdown(w http.ResponseWriter, r *http.Request) {\n\tupath := strings.TrimPrefix(r.URL.Path, \"/-/\")\n\n\tif !strings.HasPrefix(upath, \"/\") {\n\t\tupath = \"/\" + upath\n\t}\n\n\tf, err := m.dir.Open(path.Clean(upath))\n\tif err != nil {\n\t\treturn\n\t}\n\tdefer f.Close()\n\n\td, err := f.Stat()\n\tif err != nil {\n\t\treturn\n\t}\n\n\tname := d.Name()\n\n\tif d.IsDir() {\n\t\tindex := strings.TrimSuffix(upath, \"/\") + \"/README.md\"\n\t\tff, err := m.dir.Open(index)\n\t\tif err == nil {\n\t\t\tdefer ff.Close()\n\t\t\tdd, err := ff.Stat()\n\t\t\tif err == nil {\n\t\t\t\tname = dd.Name()\n\t\t\t\tf = ff\n\t\t\t\td = dd\n\t\t\t}\n\t\t}\n\n\t}\n\n\tif d.IsDir() {\n\t\tdirList(w, name, f)\n\t\treturn\n\t}\n\n\tif !strings.HasSuffix(name, \".md\") {\n\t\treturn\n\t}\n\n\tcontent, err := ioutil.ReadAll(f)\n\tif err != nil {\n\t\treturn\n\t}\n\n\tunsafe := blackfriday.MarkdownCommon(content)\n\n\tff := Dir{\n\t\tName: name,\n\t\tIsDir: false,\n\t\tIsMarkdown: true,\n\t\tSize: d.Size(),\n\t\tContent: template.HTML(unsafe),\n\t}\n\n\tout, err := json.MarshalIndent(ff, \"\", \" \")\n\tif err != nil {\n\t\treturn\n\t}\n\n\tfmt.Fprintf(w, \"%s\", out)\n}", "title": "" }, { "docid": "65345e6cb792ab6c56f88c8a0697a60e", "score": "0.51580095", "text": "func (handler markdownHandler) handleMarkdown(w http.ResponseWriter, r *http.Request) {\n\tcleanPath := filepath.Clean(r.URL.Path)\n\textension := filepath.Ext(cleanPath)\n\tmdParser, renderer := handler.markdownArgs()\n\n\t// If file extension was not provided...\n\tif extension == \"\" {\n\n\t\t_, dirErr := os.Stat(filepath.Join(handler.dir, cleanPath))\n\t\t_, fileErr := os.Stat(filepath.Join(handler.dir, cleanPath+\".md\"))\n\n\t\t// If not a directory nor an extension-less markdown file, return an HTTP 404.\n\t\tif dirErr != nil && fileErr != nil {\n\t\t\tw.WriteHeader(404)\n\t\t\treturn\n\t\t}\n\n\t\t// Directories take precedence over extension-less markdown files. Check if directory...\n\t\tif dirErr == nil {\n\t\t\thandler.handleDirectory(w, r)\n\t\t\treturn\n\t\t}\n\n\t\t// Reply with HTTP 404 if file extension is required, since the path isn't a directory.\n\t\tif handler.requireExt {\n\t\t\tw.WriteHeader(404)\n\t\t\treturn\n\t\t}\n\n\t\t// otherwise append it so we can properly find the files.\n\t\t// WARN: note, this means we will not support files which do not include a file extension.\n\t\tcleanPath = cleanPath + \".md\"\n\t}\n\n\tfileContent, err := ioutil.ReadFile(filepath.Join(handler.dir, cleanPath))\n\tif err != nil {\n\t\tw.WriteHeader(404)\n\t\treturn\n\t}\n\n\tvar parent Node\n\tvar children []Node\n\n\t// If not at root...\n\tif filepath.Dir(cleanPath) != cleanPath {\n\t\tparent, _, err = readNodes(handler.dir, filepath.Join(handler.dir, filepath.Dir(cleanPath)))\n\t\tif err != nil {\n\t\t\tw.WriteHeader(500)\n\t\t\treturn\n\t\t}\n\t}\n\n\tnode, children, err := readNodes(handler.dir, filepath.Join(handler.dir, cleanPath))\n\tif err != nil {\n\t\tw.WriteHeader(500)\n\t\treturn\n\t}\n\trenderedHTML := markdown.ToHTML(fileContent, mdParser, renderer)\n\tdata := newTemplateDataBuilder().WithContent(string(renderedHTML)).WithNode(node, parent, children).Build()\n\n\tif err := handler.template.Execute(w, data); err != nil {\n\t\tlog.Println(\"failed to execute template\", err)\n\t\tw.WriteHeader(500)\n\t\treturn\n\t}\n}", "title": "" }, { "docid": "5fead702fd0198a38c5ef668e03da1b1", "score": "0.5154221", "text": "func NewMarkdownMessage(title string, text string, at AtTag) *MarkdownMessage {\n\treturn &MarkdownMessage{\n\t\tbaseMessage: baseMessage{\"markdown\"},\n\t\tMarkdown: Markdown{\n\t\t\tTitle: title,\n\t\t\tText: text,\n\t\t},\n\t\tAt: at,\n\t}\n}", "title": "" }, { "docid": "144855ae7f98100286730b6fc739e4e3", "score": "0.5141481", "text": "func markdownPage(sw io.StringWriter, idx int, n *Node) error {\n\tvar err error\n\n\t_, err = sw.WriteString(fmt.Sprintf(\"**Page %d**\\n\\n\", idx+1))\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tfor node := n; node != nil; node = node.Next() {\n\t\t// TODO: we might attempt to \"guess\" markdown here,\n\t\t_, err = sw.WriteString(node.Token().String())\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "69e6c1bf89eda1fa60a4cca7a274df7b", "score": "0.51372176", "text": "func createMarkdownTemplate(template string, filename string, isPage bool) error {\n\tthemePath := basePath + string(filepath.Separator) + \"sites\" + string(filepath.Separator) + domain + string(filepath.Separator) + \"theme\" + string(filepath.Separator) + theme\n\tsitePath := basePath + string(filepath.Separator) + \"sites\" + string(filepath.Separator) + domain\n\n\tif !dirExist(themePath) {\n\t\tlog.Fatal(\"Error cannot find theme to create markdown templates\")\n\t}\n\tif !dirExist(themePath + string(filepath.Separator) + template) {\n\t\tlog.Fatal(\"Error cannot find specified theme template\")\n\t}\n\n\t// Only create the markdown file if it does not already exist\n\tif !dirExist(sitePath + string(filepath.Separator) + filename) {\n\t\tvar fileOutput string\n\n\t\t// Open template file & get contents\n\t\ttemp, err := ioutil.ReadFile(themePath + string(filepath.Separator) + template)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\t// Is it a page or a partial template?\n\t\tif isPage {\n\t\t\t// Parse meta with regex\n\t\t\tvar metaToken = regexp.MustCompile(`\\[\\[meta\\sname\\=\\\"([a-zA-Z0-9_-]*)\\\"]]`)\n\t\t\tmetaTokens := metaToken.FindAllStringSubmatch(string(temp), -1)\n\n\t\t\t// Compose meta output\n\n\t\t\tfileOutput += \"+++\\n\\n\"\n\t\t\tfileOutput += \"[Meta]\\n\"\n\t\t\tfor i := range metaTokens {\n\t\t\t\tfileOutput += metaTokens[i][1] + \" = \\\"\\\"\\n\"\n\t\t\t}\n\n\t\t\t// Add navigation tokens\n\t\t\tfileOutput += \"\\n[Navigation]\\n\"\n\t\t\tfileOutput += \"text = \\\"\\\"\\n\"\n\t\t\tfileOutput += \"order = \\\"99\\\"\\n\"\n\n\t\t\t// Add design tokens\n\t\t\tfileOutput += \"\\n[Design]\\n\"\n\t\t\tfileOutput += \"template = \\\"\" + strings.Replace(template, \".html\", \"\", -1) + \"\\\"\\n\"\n\t\t\tfileOutput += \"\\n+++\\n\\n\"\n\t\t}\n\n\t\t// Parse element with regex\n\t\tvar elementToken = regexp.MustCompile(`\\[\\[element\\stype\\=\\\"([a-zA-Z0-9]*)\\\"\\sname\\=\\\"([a-zA-Z0-9_-]*)\\\"\\sdescription\\=\\\"(.*)\"]]`)\n\t\telementTokens := elementToken.FindAllStringSubmatch(string(temp), -1)\n\n\t\t// Compose element output\n\t\tfor i := range elementTokens {\n\t\t\tfileOutput += \"***\" + strings.ToUpper(elementTokens[i][1]) + \"*** \" + strings.Title(elementTokens[i][2]) + \" (\" + elementTokens[i][3] + \")\\n\\n\"\n\t\t\tif elementTokens[i][1] == \"html\" {\n\t\t\t\tfileOutput += \"# Your \" + strings.Title(elementTokens[i][2]) + \" markdown/html syntax here\\n\\n\"\n\t\t\t} else {\n\t\t\t\tfileOutput += \"Your \" + strings.Title(elementTokens[i][2]) + \" text syntax here\\n\\n\"\n\t\t\t}\n\n\t\t\tfileOutput += \"***\\n\\n\\n\\n\\n\"\n\t\t}\n\n\t\t// Write to file\n\t\terr = writeFile(sitePath+string(filepath.Separator)+filename, fileOutput)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "79e9f9a49cb98a2c572d5f69541e7ef1", "score": "0.5119586", "text": "func WriteToMarkdown() {\n\tvar mdString string\n\tfor _, tweet := range processtweets.SplitTweets {\n\t\tmdString = mdString + formatTweet(tweet)\n\n\t}\n\tmdByte := []byte(mdString)\n\terr := ioutil.WriteFile(\"log.md\", mdByte, 0644)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n}", "title": "" }, { "docid": "f12f0a9f533433a39204b56a6a990498", "score": "0.5097649", "text": "func MarkdownCommon(input []byte) (*ParseResult, error) {\n\n\treturn New().Parse(input)\n\n}", "title": "" }, { "docid": "db3f8020e519db45d83a3668715493b8", "score": "0.5063476", "text": "func serializeMarkdown(val interface{}, options ...map[string]interface{}) ([]byte, error) {\n\n\t// parse the options\n\tvar (\n\t\tsanitize bool\n\t)\n\tif options != nil && len(options) > 0 {\n\t\topt := options[0]\n\t\tsanitize = tryParseBoolOption(opt, \"sanitize\", false)\n\t}\n\n\tvar b []byte\n\tif s, isString := val.(string); isString {\n\t\tb = []byte(s)\n\t} else {\n\t\tb = val.([]byte)\n\t}\n\tbuf := blackfriday.MarkdownCommon(b)\n\tif sanitize {\n\t\tbuf = bluemonday.UGCPolicy().SanitizeBytes(buf)\n\t}\n\n\treturn buf, nil\n}", "title": "" }, { "docid": "901274f1f50c7597cce6948461164add", "score": "0.5062685", "text": "func parseTFMarkdown(g *generator, info tfbridge.ResourceOrDataSourceInfo, kind DocKind,\n\tmarkdown, markdownFileName, resourcePrefix, rawname string) (parsedDoc, error) {\n\n\tret := parsedDoc{\n\t\tArguments: make(map[string]*argument),\n\t\tAttributes: make(map[string]string),\n\t\tURL: getDocsDetailsURL(g.info.GetGitHubOrg(), resourcePrefix, string(kind), markdownFileName),\n\t}\n\n\t// Replace any Windows-style newlines.\n\tmarkdown = strings.Replace(markdown, \"\\r\\n\", \"\\n\", -1)\n\n\t// Split the sections by H2 topics in the MarkDown file.\n\tfor _, section := range splitGroupLines(markdown, \"## \") {\n\t\t// Extract the header name, since this will drive how we process the content.\n\t\tif len(section) == 0 {\n\t\t\tcmdutil.Diag().Warningf(diag.Message(\"\",\n\t\t\t\t\"Unparseable H2 doc section for %v; consider overriding doc source location\"), rawname)\n\t\t\tcontinue\n\t\t}\n\n\t\t// Skip certain headers that we don't support.\n\t\theader := section[0]\n\t\tif strings.Index(header, \"## \") == 0 {\n\t\t\theader = header[3:]\n\t\t}\n\t\tif header == \"Import\" || header == \"Imports\" || header == \"Timeout\" ||\n\t\t\theader == \"Timeouts\" || header == \"User Project Overrides\" || header == \"User Project Override\" {\n\t\t\tignoredDocSections++\n\t\t\tignoredDocHeaders[header]++\n\t\t\tcontinue\n\t\t}\n\n\t\t// Add shortcode around each examples block.\n\t\tvar headerIsExampleUsage bool\n\t\tif header == \"Example Usage\" {\n\t\t\theaderIsExampleUsage = true\n\t\t\tret.Description += \"{{% examples %}}\\n\"\n\t\t}\n\n\t\t// Now split the sections by H3 topics. This is done because we'll ignore sub-sections with code\n\t\t// snippets that are unparseable (we don't want to ignore entire H2 sections).\n\t\tvar wroteHeader bool\n\t\tfor _, subsection := range groupLines(section[1:], \"### \") {\n\t\t\tif len(subsection) == 0 {\n\t\t\t\tcmdutil.Diag().Warningf(diag.Message(\"\",\n\t\t\t\t\t\"Unparseable H3 doc section for %v; consider overriding doc source location\"), rawname)\n\t\t\t\tcontinue\n\t\t\t}\n\n\t\t\t// Skip empty sections (they just add unnecessary padding and headers).\n\t\t\tvar allEmpty bool\n\t\t\tfor i, sub := range subsection {\n\t\t\t\tif !isBlank(sub) {\n\t\t\t\t\tbreak\n\t\t\t\t}\n\t\t\t\tif i == len(subsection)-1 {\n\t\t\t\t\tallEmpty = true\n\t\t\t\t\tbreak\n\t\t\t\t}\n\t\t\t}\n\t\t\tif allEmpty {\n\t\t\t\tcontinue\n\t\t\t}\n\n\t\t\t// Detect important section kinds.\n\t\t\tvar headerIsArgsReference bool\n\t\t\tvar headerIsAttributesReference bool\n\t\t\tvar headerIsFrontMatter bool\n\t\t\tswitch header {\n\t\t\tcase \"Arguments Reference\", \"Argument Reference\", \"Nested Blocks\", \"Nested blocks\":\n\t\t\t\theaderIsArgsReference = true\n\t\t\tcase \"Attributes Reference\", \"Attribute Reference\":\n\t\t\t\theaderIsAttributesReference = true\n\t\t\tcase \"---\":\n\t\t\t\theaderIsFrontMatter = true\n\t\t\t}\n\n\t\t\t// Convert any code snippets, if there are any. If this yields a fatal error, we\n\t\t\t// bail out, but most errors are ignorable and just lead to us skipping one section.\n\t\t\tvar skippableExamples bool\n\t\t\tvar err error\n\t\t\tsubsection, skippableExamples, err = parseExamples(g.language, subsection)\n\t\t\tif err != nil {\n\t\t\t\treturn parsedDoc{}, err\n\t\t\t} else if skippableExamples && !headerIsArgsReference &&\n\t\t\t\t!headerIsAttributesReference && !headerIsFrontMatter {\n\t\t\t\t// Skip sections with failed examples, so long as they aren't \"essential\" blocks.\n\t\t\t\tcontinue\n\t\t\t}\n\n\t\t\t// Now process the content based on the H2 topic. These are mostly standard across TF's docs.\n\t\t\tswitch {\n\t\t\tcase headerIsArgsReference:\n\t\t\t\tvar lastMatch, nested string\n\t\t\t\tfor _, line := range subsection {\n\t\t\t\t\tmatches := argumentBulletRegexp.FindStringSubmatch(line)\n\t\t\t\t\tif len(matches) >= 4 {\n\t\t\t\t\t\t// found a property bullet, extract the name and description\n\t\t\t\t\t\tif nested != \"\" {\n\t\t\t\t\t\t\t// We found this line within a nested field. We should record it as such.\n\t\t\t\t\t\t\tif ret.Arguments[nested] == nil {\n\t\t\t\t\t\t\t\tret.Arguments[nested] = &argument{\n\t\t\t\t\t\t\t\t\targuments: make(map[string]string),\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t} else if ret.Arguments[nested].arguments == nil {\n\t\t\t\t\t\t\t\tret.Arguments[nested].arguments = make(map[string]string)\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tret.Arguments[nested].arguments[matches[1]] = matches[4]\n\n\t\t\t\t\t\t\t// Also record this as a top-level argument just in case, since sometimes the recorded nested\n\t\t\t\t\t\t\t// argument doesn't match the resource's argument.\n\t\t\t\t\t\t\t// For example, see `cors_rule` in s3_bucket.html.markdown.\n\t\t\t\t\t\t\tif ret.Arguments[matches[1]] == nil {\n\t\t\t\t\t\t\t\tret.Arguments[matches[1]] = &argument{\n\t\t\t\t\t\t\t\t\tdescription: matches[4],\n\t\t\t\t\t\t\t\t\tisNested: true, // Mark that this argument comes from a nested field.\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tret.Arguments[matches[1]] = &argument{description: matches[4]}\n\t\t\t\t\t\t}\n\t\t\t\t\t\tlastMatch = matches[1]\n\t\t\t\t\t} else if !isBlank(line) && lastMatch != \"\" {\n\t\t\t\t\t\t// this is a continuation of the previous bullet\n\t\t\t\t\t\tif nested != \"\" {\n\t\t\t\t\t\t\tret.Arguments[nested].arguments[lastMatch] += \"\\n\" + strings.TrimSpace(line)\n\n\t\t\t\t\t\t\t// Also update the top-level argument if we took it from a nested field.\n\t\t\t\t\t\t\tif ret.Arguments[lastMatch].isNested {\n\t\t\t\t\t\t\t\tret.Arguments[lastMatch].description += \"\\n\" + strings.TrimSpace(line)\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tret.Arguments[lastMatch].description += \"\\n\" + strings.TrimSpace(line)\n\t\t\t\t\t\t}\n\t\t\t\t\t} else {\n\t\t\t\t\t\t// This line might declare the beginning of a nested object.\n\t\t\t\t\t\t// If we do not find a \"nested\", then this is an empty line or there were no bullets yet.\n\t\t\t\t\t\tfor _, match := range nestedObjectRegexps {\n\t\t\t\t\t\t\tmatches := match.FindStringSubmatch(line)\n\t\t\t\t\t\t\tif len(matches) >= 2 {\n\t\t\t\t\t\t\t\tnested = strings.ToLower(matches[1])\n\t\t\t\t\t\t\t\tbreak\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\t// Clear the lastMatch.\n\t\t\t\t\t\tlastMatch = \"\"\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\tcase headerIsAttributesReference:\n\t\t\t\tvar lastMatch string\n\t\t\t\tfor _, line := range subsection {\n\t\t\t\t\tmatches := attributeBulletRegexp.FindStringSubmatch(line)\n\t\t\t\t\tif len(matches) >= 2 {\n\t\t\t\t\t\t// found a property bullet, extract the name and description\n\t\t\t\t\t\tret.Attributes[matches[1]] = matches[2]\n\t\t\t\t\t\tlastMatch = matches[1]\n\t\t\t\t\t} else if !isBlank(line) && lastMatch != \"\" {\n\t\t\t\t\t\t// this is a continuation of the previous bullet\n\t\t\t\t\t\tret.Attributes[lastMatch] += \"\\n\" + strings.TrimSpace(line)\n\t\t\t\t\t} else {\n\t\t\t\t\t\t// This is an empty line or there were no bullets yet - clear the lastMatch\n\t\t\t\t\t\tlastMatch = \"\"\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\tcase headerIsFrontMatter:\n\t\t\t\t// The header of the MarkDown will have two \"---\"s paired up to delineate the header. Skip this.\n\t\t\t\tvar foundEndHeader bool\n\t\t\t\tfor len(subsection) > 0 {\n\t\t\t\t\tcurr := subsection[0]\n\t\t\t\t\tsubsection = subsection[1:]\n\t\t\t\t\tif curr == \"---\" {\n\t\t\t\t\t\tfoundEndHeader = true\n\t\t\t\t\t\tbreak\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tif !foundEndHeader {\n\t\t\t\t\tcmdutil.Diag().Warningf(\n\t\t\t\t\t\tdiag.Message(\"\", \"Expected to pair --- begin/end for resource %v's Markdown header\"), rawname)\n\t\t\t\t}\n\n\t\t\t\t// Now extract the description section. We assume here that the first H1 (line starting with #) is the name\n\t\t\t\t// of the resource, because we aren't detecting code fencing. Comments in HCL are prefixed with # (the\n\t\t\t\t// same as H1 in Markdown, so we treat further H1's in this section as part of the description. If there\n\t\t\t\t// are no matching H1s, we emit a warning for the resource as it is likely a problem with the documentation.\n\t\t\t\tlastBlank := true\n\t\t\t\tvar foundH1Resource bool\n\t\t\t\tfor _, line := range subsection {\n\t\t\t\t\tif strings.Index(line, \"# \") == 0 {\n\t\t\t\t\t\tfoundH1Resource = true\n\t\t\t\t\t\tlastBlank = true\n\t\t\t\t\t} else if !isBlank(line) || !lastBlank {\n\t\t\t\t\t\tret.Description += line + \"\\n\"\n\t\t\t\t\t\tlastBlank = false\n\t\t\t\t\t} else if isBlank(line) {\n\t\t\t\t\t\tlastBlank = true\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tif !foundH1Resource {\n\t\t\t\t\tcmdutil.Diag().Warningf(diag.Message(\"\", \"Expected an H1 in markdown for resource %v\"), rawname)\n\t\t\t\t}\n\t\t\tdefault:\n\t\t\t\t// For all other sections, append them to the description section.\n\t\t\t\tif !wroteHeader {\n\t\t\t\t\tret.Description += fmt.Sprintf(\"## %s\\n\", header)\n\t\t\t\t\twroteHeader = true\n\t\t\t\t\tif !isBlank(subsection[0]) {\n\t\t\t\t\t\tret.Description += \"\\n\"\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tdescription := strings.Join(subsection, \"\\n\") + \"\\n\"\n\t\t\t\tif headerIsExampleUsage {\n\t\t\t\t\t// Wrap each example in shortcode.\n\t\t\t\t\tdescription = \"{{% example %}}\\n\" + description + \"{{% /example %}}\\n\"\n\t\t\t\t}\n\t\t\t\tret.Description += description\n\t\t\t}\n\t\t}\n\n\t\t// Add the closing shortcode around the examples block.\n\t\tif headerIsExampleUsage {\n\t\t\tret.Description += \"{{% /examples %}}\\n\"\n\t\t}\n\t}\n\n\tdoc, elided := cleanupDoc(g, info, ret)\n\tif elided {\n\t\tcmdutil.Diag().Warningf(diag.Message(\"\",\n\t\t\t\"Resource %v contains an <elided> doc reference that needs updated\"), rawname)\n\t}\n\n\treturn doc, nil\n}", "title": "" }, { "docid": "80b4c12b00e37d486a517c1f1562ed85", "score": "0.5024384", "text": "func (cwp *ContextWriterPatches) Markdown(patchFunc func(ctx Context, v []byte, options *Markdown) error) {\n\tcontext.WriteMarkdown = patchFunc\n}", "title": "" }, { "docid": "0633966e5374e370c3704afbf74dd033", "score": "0.5004322", "text": "func NewRenderer(opt *Options) blackfriday.Renderer {\n\tmr := &markdownRenderer{\n\t\tnormalTextMarker: make(map[*bytes.Buffer]int),\n\t\torderedListCounter: make(map[int]int),\n\t\tparagraph: make(map[int]bool),\n\n\t\tstringWidth: runewidth.StringWidth,\n\t}\n\tif opt != nil {\n\t\tmr.opt = *opt\n\t}\n\tif mr.opt.Terminal {\n\t\tmr.stringWidth = terminalStringWidth\n\t}\n\treturn mr\n}", "title": "" }, { "docid": "0633966e5374e370c3704afbf74dd033", "score": "0.5004322", "text": "func NewRenderer(opt *Options) blackfriday.Renderer {\n\tmr := &markdownRenderer{\n\t\tnormalTextMarker: make(map[*bytes.Buffer]int),\n\t\torderedListCounter: make(map[int]int),\n\t\tparagraph: make(map[int]bool),\n\n\t\tstringWidth: runewidth.StringWidth,\n\t}\n\tif opt != nil {\n\t\tmr.opt = *opt\n\t}\n\tif mr.opt.Terminal {\n\t\tmr.stringWidth = terminalStringWidth\n\t}\n\treturn mr\n}", "title": "" }, { "docid": "0da30ae76ac6df245d9ac9532df8dca0", "score": "0.49924508", "text": "func NewMarkdownPublisher(ctx context.Context, asynchWorkers uint, linkFactory link.Factory, bpc markdown.BasePathConfigurator, options ...interface{}) (*MarkdownPublisher, error) {\n\tresult := new(MarkdownPublisher)\n\tresult.AsynchWorkers = asynchWorkers\n\tresult.LinkFactory = linkFactory\n\tresult.BasePathConfigurator = bpc\n\tresult.BoundedPR = progress.NewSummaryReporter(\"\")\n\tresult.StopAfterErrorsCount = 10\n\n\tif err := result.initOptions(ctx, options...); err != nil {\n\t\treturn result, err\n\t}\n\n\treturn result, nil\n}", "title": "" }, { "docid": "1e640b62c7feec25d6e18b9708220766", "score": "0.4985536", "text": "func getParsedMarkdown(buf []byte) (string, error) {\n\tclient := &http.Client{}\n\treq, err := http.NewRequest(\"POST\", url, bytes.NewReader(buf))\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\n\treq.Header.Add(\"Content-Type\", \"text/plain\")\n\treq.Header.Add(\"User-Agent\", ua)\n\n\tres, err := client.Do(req)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\tdefer res.Body.Close()\n\n\tbody, err := ioutil.ReadAll(res.Body)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\treturn string(body), nil\n}", "title": "" }, { "docid": "927b1ad7d4312cd747388f7830b25093", "score": "0.49682078", "text": "func RenderGitHub(src []byte) []byte {\n\treturn gfm.Markdown(src)\n}", "title": "" }, { "docid": "2f7aba22477b03151e3f3d2d5abf5995", "score": "0.495028", "text": "func MarkdownBasic(input []byte) (*ParseResult, error) {\n\n\treturn NewBasic().Parse(input)\n}", "title": "" }, { "docid": "a24ac4715ddf0c573f25412715904111", "score": "0.49017373", "text": "func (me Nodes) Markdown() io.Reader {\n\tbuf := &bytes.Buffer{}\n\tfor _, node := range me {\n\t\tio.Copy(buf, node.Markdown())\n\t}\n\treturn buf\n}", "title": "" }, { "docid": "f271d7b731fc39184b88c0c264c6448b", "score": "0.4858553", "text": "func getCodeMarkdown(user, repo, repoPath, word, lines string, isTruncated bool) string {\n\tfinal := fmt.Sprintf(\"\\n[%s/%s/%s](%s)\\n\", user, repo, repoPath, word)\n\text := path.Ext(repoPath)\n\t// remove the preceding dot\n\tif len(ext) > 1 {\n\t\text = strings.TrimPrefix(ext, \".\")\n\t}\n\tfinal += \"```\" + ext + \"\\n\"\n\tfinal += lines\n\tif isTruncated { // add an ellipsis if lines were cut off\n\t\tfinal += \"...\\n\"\n\t}\n\tfinal += \"```\\n\"\n\treturn final\n}", "title": "" }, { "docid": "449979f5f5c0c79067b6aed7ec9205c7", "score": "0.4849608", "text": "func MarkdownServer(port int, markdownDir string, templateDir string, staticDir string) {\n\tgin.SetMode(gin.ReleaseMode)\n\n\tpostsMap := make(map[string]Post)\n\t\n\trouter := gin.Default()\n\n\tresources := loadAllResources(router, markdownDir, templateDir, staticDir)\n\n\tfor _, post := range resources.Posts {\n\t\tpostsMap[post.Slug] = post\n\t}\n\n\trouter.GET(\"/\", func(c *gin.Context) {\n\t\tc.HTML(http.StatusOK, \"landing.gohtml\", nil)\n\t})\n\n\trouter.GET(\"/posts/:postName\", func(c *gin.Context) {\n\t\tpostName := c.Param(\"postName\")\n\t\tcurrentPost := postsMap[postName]\n\t\tfreshCurrentPost, err := cachedLoadPost(&currentPost, markdownDir)\n\n\t\tif err != nil {\n\t\t\tfmt.Printf(\"Error while loading post: %s\", err)\n\t\t}\n\n\n\t\tpostHTML := template.HTML(github_flavored_markdown.Markdown(freshCurrentPost.Content))\n\t \t \n\t\tc.HTML(http.StatusOK, \"post.gohtml\", gin.H{\n\t\t \"Title\": freshCurrentPost.Title,\n\t\t \"Content\": postHTML,\n\t\t})\n\t})\n\n\tfmt.Printf(\"Started server on port %d\", port)\n\trouter.Run(fmt.Sprintf(\":%d\", port))\n\n}", "title": "" }, { "docid": "dba62170b7c5cd0bcbfc54413ab8c1ad", "score": "0.4847737", "text": "func (m *Markdown) Render() vecty.ComponentOrHTML {\n\t// Render the markdown input into HTML using Blackfriday.\n\tunsafeHTML := blackfriday.Run([]byte(m.Input))\n\n\t// Sanitize the HTML.\n\tsafeHTML := string(bluemonday.UGCPolicy().SanitizeBytes(unsafeHTML))\n\n\t// Return the HTML, which we guarantee to be safe / sanitized.\n\treturn elem.Div(\n\t\tvecty.Markup(\n\t\t\tvecty.UnsafeHTML(safeHTML),\n\t\t),\n\t)\n}", "title": "" }, { "docid": "996f22f4a275244627dcf0c4411c1089", "score": "0.48463774", "text": "func wrapMarkdowns(t DocType, md []*charm.Markdown) (m []*markdown) {\n\tfor _, v := range md {\n\t\tm = append(m, &markdown{\n\t\t\tdocType: t,\n\t\t\tMarkdown: *v,\n\t\t})\n\t}\n\treturn m\n}", "title": "" }, { "docid": "79b8a859e0b0e9a305788684b96c31d1", "score": "0.47987124", "text": "func NewGithubMarkdownConverter(conf Configuration) GithubMarkdownConverter {\n\treturn GithubMarkdownConverter{\n\t\tconf: conf,\n\t}\n}", "title": "" }, { "docid": "3452efbcff140a5483875b54f13c0403", "score": "0.47583273", "text": "func generateDoc(commandDocFile string) error {\n\n\tif commandDocFile == \"\" {\n\t\treturn errors.New(\"no docFile specified\")\n\t}\n\tdir := filepath.Dir(commandDocFile)\n\n\tif _, statErr := os.Stat(dir); os.IsNotExist(statErr) {\n\t\tmkdirErr := os.MkdirAll(dir, 0755)\n\t\tif mkdirErr != nil {\n\t\t\tError.log(\"Could not create doc file directory: \", mkdirErr)\n\t\t\treturn mkdirErr\n\t\t}\n\t}\n\tdocFile, createErr := os.Create(commandDocFile)\n\tif createErr != nil {\n\t\tError.log(\"Could not create doc file (.md): \", createErr)\n\t\treturn createErr\n\t}\n\n\tdefer docFile.Close()\n\n\tpreAmble := \"---\\nnote: generated by cobra\\npath: /cmd/docs.go\\n---\\n# kabanero CLI\\n\"\n\t//preAmble := \"---\\ntitle: CLI Reference\\npath: /cmd/docs.go\\nsection: Using kabanero\\n---\\n# kabanero CLI\\n\"\n\tpreAmbleBytes := []byte(preAmble)\n\t_, preambleErr := docFile.Write(preAmbleBytes)\n\tif preambleErr != nil {\n\t\tError.log(\"Could not write to markdown file:\", preambleErr)\n\t\treturn preambleErr\n\t}\n\n\tlinkHandler := func(name string) string {\n\t\tbase := strings.TrimSuffix(name, path.Ext(name))\n\t\tnewbase := strings.ReplaceAll(base, \"_\", \"-\")\n\t\treturn \"#\" + newbase\n\t}\n\tcommandArray := []*cobra.Command{rootCmd, loginCmd, logoutCmd, listCmd, syncCmd, deactivateCmd, describeCmd}\n\tfor _, cmd := range commandArray {\n\n\t\tmarkdownGenErr := doc.GenMarkdownCustom(cmd, docFile, linkHandler)\n\n\t\tif markdownGenErr != nil {\n\t\t\tError.log(\"Doc file generation failed: \", markdownGenErr)\n\t\t\treturn markdownGenErr\n\t\t}\n\t}\n\treturn nil\n\n}", "title": "" }, { "docid": "1fd19ae151d51b1506d708f8db16ed03", "score": "0.47499335", "text": "func (n *DingTalkNotifier) transform(notification model.Notification) (markdown *model.DingTalkMarkdown, robotURL string, err error) {\n\n\tannotations := notification.CommonAnnotations\n\tvar dingtalkToken = annotations[\"dingtalkToken\"]\n\tvar dingtalkPrefix = annotations[\"dingtalkPrefix\"]\n\tif dingtalkToken == \"\" {\n\t\tdingtalkToken = n.defaultToken\n\t}\n\tif dingtalkPrefix == \"\" {\n\t\tdingtalkPrefix = n.defaultPrefix\n\t}\n\tif dingtalkToken == \"\" {\n\t\treturn nil, \"\", fmt.Errorf(\"no dingtalk token\")\n\t}\n\trobotURL = fmt.Sprintf(\"https://oapi.dingtalk.com/robot/send?access_token=%s\", dingtalkToken)\n\n\ttitle, body := BuildMarkdown(notification)\n\tif dingtalkPrefix != \"\" {\n\t\tbody = fmt.Sprintf(\"%s\\n%s\", dingtalkPrefix, body)\n\t}\n\n\tmarkdown = &model.DingTalkMarkdown{\n\t\tMsgType: \"markdown\",\n\t\tMarkdown: &model.Markdown{\n\t\t\tTitle: title,\n\t\t\tText: body,\n\t\t},\n\t\tAt: &model.At{\n\t\t\tIsAtAll: false,\n\t\t},\n\t}\n\n\treturn\n}", "title": "" }, { "docid": "b6680522c6a9e70c7c86ad9b2a4a04b3", "score": "0.47422886", "text": "func transform(w io.Writer, r io.Reader) error {\n\tvar page PageData\n\n\tsource,err := ioutil.ReadAll(r)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t\t// Render the Markdown to HTML in the buffer\n\tvar buf bytes.Buffer\n\tmarkdown := newMarkdown()\n\tn := markdown.Parser().Parse(text.NewReader(source))\n\tif err := markdown.Renderer().Render(&buf, source, n); err != nil {\n\t\treturn err\n\t}\n\tpage.Body = template.HTML(buf.Bytes())\n\tpage.Menu = buildMenu(n, source)\n\t\n\t// Attempt to use a template file, otherwise use the built-in template\n\tt, err := template.ParseFiles(*templ)\n\tif err != nil {\n\t\tt = defaultTemplate\n\t}\n\n\tif *doMinify {\n\t\n\t}\n\t// Finally write it all to the client\n\treturn t.Execute(w, page)\n}", "title": "" }, { "docid": "8692e84e0f734aa087867b91b7042ede", "score": "0.47333646", "text": "func generateMarkdown(schema bigquery.Schema) []byte {\n\tbuf := &bytes.Buffer{}\n\tfmt.Fprintln(buf, \"| Field name | Type | Description |\")\n\tfmt.Fprintln(buf, \"| :----------------|:----------:|:---------------|\")\n\tbqx.WalkSchema(schema, func(prefix []string, field *bigquery.FieldSchema) error {\n\t\tvar path string\n\t\tif len(prefix) == 1 {\n\t\t\tpath = \"\"\n\t\t} else {\n\t\t\tpath = strings.Join(prefix[:len(prefix)-1], \".\") + \".\"\n\t\t}\n\t\tfmt.Fprintf(buf, \"| %s**%s** | %s | %s |\\n\", path, prefix[len(prefix)-1], field.Type, field.Description)\n\t\treturn nil\n\t})\n\treturn buf.Bytes()\n}", "title": "" }, { "docid": "9acb12f20cdd1e4faa5c4dc58d78133e", "score": "0.4729813", "text": "func DocGenInMarkdown() string {\n\tvar doc bytes.Buffer\n\tdocTemplate.Execute(&doc, fullAttrValidator.GenerateTableInHTML())\n\n\treturn doc.String()\n}", "title": "" }, { "docid": "455d65d927793944b888035b617682e1", "score": "0.47090018", "text": "func Render(markdown string) string {\n\tmarkdown = renderBold(markdown)\n\tmarkdown = renderItalic(markdown)\n\n\treturn htmlize(markdown)\n}", "title": "" }, { "docid": "e6e79feba4a4a65fb4c3df10ab300be5", "score": "0.46895266", "text": "func TestMarkdownHandler(t *testing.T) {\n\tpwd, _ := os.Getwd()\n\n\tt.Logf(\"pwd: %+v\", pwd)\n\n\ttests := []struct {\n\t\tprefix string\n\t\treqPath string\n\t\tdocPath string\n\t\thttpStatus int\n\t}{\n\t\t{\"/doc\", \"/\", pwd, http.StatusOK},\n\t\t{\"/doc\", \"/foo\", \".\", http.StatusOK},\n\t\t{\"/doc\", \"/foo\", \".foo/test\", http.StatusOK},\n\t\t{\"/doc\", \"/test.md\", \"./test/md\", http.StatusOK},\n\t\t{\"/doc\", \"/test\", pwd, http.StatusMovedPermanently},\n\t\t{\"/doc\", \"/markdown.go\", \".\", http.StatusOK},\n\t}\n\n\t// creating a \"test\" dir\n\ttestPath := filepath.Join(pwd, \"test\")\n\tos.MkdirAll(testPath, 0777)\n\n\tfor idx, test := range tests {\n\t\treq, err := http.NewRequest(\"GET\", test.reqPath, nil)\n\t\tif err != nil {\n\t\t\tt.Fatal(err)\n\t\t}\n\n\t\tnext := func(w http.ResponseWriter, r *http.Request) {}\n\t\tappHandler := NewMarkdown(test.prefix, test.docPath, \"README.md\")\n\t\trr := httptest.NewRecorder()\n\t\tappHandler.ServeHTTP(rr, req, http.HandlerFunc(next))\n\t\tmsg := fmt.Sprintf(\"%s [%s] - rr: %+v\", test.reqPath, test.docPath, rr.Code)\n\t\tt.Logf(\"Test %2d: %s\", idx+1, msg)\n\t\tassert.Equal(t, test.httpStatus, rr.Code, msg)\n\t\tassert.False(t, rr.Flushed)\n\t}\n\n\t// deleting the \"test\" dir\n\tos.RemoveAll(testPath)\n}", "title": "" }, { "docid": "15af982ab33111bd9fddf9c903bf71bf", "score": "0.46587223", "text": "func markdownSourceApply(commandParts ...string) error {\n\treturn spartamage.ApplyToSource(\"md\", ignoreSubdirectoryPaths, commandParts...)\n}", "title": "" }, { "docid": "bebd18c89c3eb1a045e44847272fead4", "score": "0.46418318", "text": "func JSONToMD(json []Tag) string {\n\tvar content []string\n\tfor _, j := range json {\n\t\tkey := j.Name\n\t\ti, ok := headings[key]\n\t\tif ok {\n\t\t\ts := getHeader(j.Content.Text, i)\n\t\t\tcontent = append(content, s, \"\\n\")\n\t\t} else if key == \"p\" {\n\t\t\ts := j.Content.Text\n\t\t\tcontent = append(content, s, \"\\n\")\n\t\t} else if key == \"img\" {\n\t\t\ti := getImageTag(j.Content.Image)\n\t\t\tcontent = append(content, i, \"\\n\")\n\t\t} else if key == \"table\" {\n\t\t\tt := getTableTag(j.Content.Table)\n\t\t\tcontent = append(content, t, \"\\n\")\n\t\t} else if key == \"code\" {\n\t\t\tc := getCodeTag(j.Content.CodeBlock)\n\t\t\tcontent = append(content, c, \"\\n\")\n\t\t} else if key == \"ol\" {\n\t\t\tlist := convertOrderedList(j.Content.List)\n\t\t\tcontent = append(content, list, \"\\n\")\n\t\t} else if key == \"ul\" {\n\t\t\tlist := convertUnorderedList(j.Content.List)\n\t\t\tcontent = append(content, list, \"\\n\")\n\t\t} else {\n\n\t\t}\n\t}\n\treturn strings.Join(content, \"\")\n}", "title": "" }, { "docid": "b541fb615d47bcfcff427c55864d80f1", "score": "0.4639224", "text": "func (b *Client) MarkdownPullLink(pull models.PullRequest) (string, error) {\n\treturn fmt.Sprintf(\"#%d\", pull.Num), nil\n}", "title": "" }, { "docid": "c6afed941db948f7c191f72b5de702d2", "score": "0.46222144", "text": "func formatDocs(txt string) string {\n\ttxt = doc.StripNulls(txt)\n\n\tvar format doc.Formatter\n\tif strings.Contains(txt, \"~~~\") || len(rstDirectiveRegex.FindStringIndex(txt)) > 0 {\n\t\tformat = doc.ReStructuredText\n\n\t\tvar err error\n\t\ttxt, err = rstPreprocess(txt)\n\t\tif err != nil {\n\t\t\tlog.Printf(\"rstPreprocess failed: %s\", err)\n\t\t}\n\t} else if strings.Contains(txt, \"====\") {\n\t\tformat = doc.Markdown\n\t} else {\n\t\tformat = doc.Text\n\t}\n\n\thtml, err := doc.ToHTML(format, []byte(txt))\n\tif err != nil {\n\t\tlog.Printf(\"doc.ToHTML failed: %s\", err)\n\t}\n\treturn string(html)\n}", "title": "" }, { "docid": "a2c84da058d5162552aea16e29661a7c", "score": "0.4621586", "text": "func Render(document string, options Options) ([]byte, error) {\n\t// Set default options.\n\tif options.Command == \"\" {\n\t\toptions.Command = \"pdflatex\"\n\t}\n\n\t// Create the temporary directory where LaTeX will dump its ugliness.\n\tvar dir, err = ioutil.TempDir(\"\", \"gotex-\")\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\t// The directory cleanup is purposefully not deferred here because we need\n\t// to leave the log file for postmortem in the case of failure.\n\n\t// Unless a number was given, don't let automagic mode run more than this\n\t// many times.\n\tvar maxRuns = 5\n\tif options.Runs > 0 {\n\t\tmaxRuns = options.Runs\n\t}\n\t// Keep running until the document is finished or we hit an arbitrary limit.\n\tvar runs int\n\tfor rerun := true; rerun && runs < maxRuns; runs++ {\n\t\terr = runLatex(document, options, dir)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\t// If in automagic mode, determine whether we need to run again.\n\t\tif options.Runs == 0 {\n\t\t\trerun = needsRerun(dir)\n\t\t}\n\t}\n\n\t// Slurp the output.\n\toutput, err := ioutil.ReadFile(path.Join(dir, \"gotex.pdf\"))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\t// Clean up the temp directory.\n\t_ = os.RemoveAll(dir)\n\treturn output, nil\n}", "title": "" }, { "docid": "1e6f940395b433cf6b1fe9cf7d3fe750", "score": "0.46144518", "text": "func readMarkdown(repo string, kind DocKind, possibleLocations []string) ([]byte, string, bool) {\n\tfor _, name := range possibleLocations {\n\t\tlocation := path.Join(repo, \"website\", \"docs\", string(kind), name)\n\t\tmarkdownBytes, err := ioutil.ReadFile(location)\n\t\tif err == nil {\n\t\t\treturn markdownBytes, name, true\n\t\t}\n\t}\n\treturn nil, \"\", false\n}", "title": "" }, { "docid": "7d6eb5139e7a7bf8ad676eb09b199654", "score": "0.4606984", "text": "func markup2HTML(paragraph string) string {\n\treturn emphasize(paragraph)\n}", "title": "" }, { "docid": "4b7807a0f15387f450024cd2a3fe5005", "score": "0.46027645", "text": "func NewMarkdownComposer() ComposeFunc {\n\treturn composeMarkdown\n}", "title": "" }, { "docid": "e2cd58f37a3863dd1c2efde307559ba0", "score": "0.4589239", "text": "func (validator lengthAtMostValidator) MarkdownDescription(ctx context.Context) string {\n\treturn validator.Description(ctx)\n}", "title": "" }, { "docid": "c441525ee25f36af1d2420ed4ea79ecb", "score": "0.4578301", "text": "func newProcCmd() *cobra.Command {\n\tprocCmd := &cobra.Command{\n\t\tUse: \"proc [flags] [markdown file]\",\n\t\tShort: \"Processing Markdown\",\n\t\tLong: \"Processing Markdown\",\n\t\tRunE: func(cmd *cobra.Command, args []string) error {\n\t\t\topt := options.New()\n\t\t\tf, err := cmd.Flags().GetBool(\"github\")\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t\tif f {\n\t\t\t\topt.SetProcType(options.GitHub)\n\t\t\t}\n\t\t\tf, err = cmd.Flags().GetBool(\"line-break\")\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t\tif f {\n\t\t\t\topt.AddExtensions(blackfriday.HardLineBreak)\n\t\t\t}\n\t\t\tf, err = cmd.Flags().GetBool(\"page\")\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t\tif f {\n\t\t\t\topt.EnablePageFlag()\n\t\t\t}\n\t\t\tf, err = cmd.Flags().GetBool(\"sanitize\")\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t\tif f {\n\t\t\t\topt.EnableSanitizing()\n\t\t\t}\n\t\t\tcss, err := cmd.Flags().GetString(\"css\")\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t\tif len(css) > 0 {\n\t\t\t\topt.SetCSS(css)\n\t\t\t}\n\t\t\toutPath, err := cmd.Flags().GetString(\"output\")\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\n\t\t\treader := cui.Reader()\n\t\t\tif len(args) > 0 {\n\t\t\t\tfile, err := os.OpenFile(args[0], os.O_RDONLY, 0400) //args[0] is maybe file path\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn err\n\t\t\t\t}\n\t\t\t\tdefer file.Close()\n\t\t\t\treader = file\n\t\t\t}\n\t\t\thtml, err := proc.Run(reader, opt)\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\n\t\t\tif len(outPath) > 0 {\n\t\t\t\tfile, err := os.OpenFile(outPath, os.O_WRONLY|os.O_CREATE, 0666)\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn err\n\t\t\t\t}\n\t\t\t\tdefer file.Close()\n\t\t\t\tio.Copy(file, html)\n\t\t\t} else {\n\t\t\t\tcui.WriteFrom(html)\n\t\t\t}\n\t\t\treturn nil\n\t\t},\n\t}\n\n\tprocCmd.Flags().StringP(\"css\", \"c\", \"\", \"CSS file URL (with --page option)\")\n\tprocCmd.Flags().StringP(\"output\", \"o\", \"\", \"output file path\")\n\tprocCmd.Flags().BoolP(\"github\", \"g\", false, \"use GitHub Markdown API\")\n\tprocCmd.Flags().BoolP(\"line-break\", \"l\", false, \"translate newlines into line breaks\")\n\tprocCmd.Flags().BoolP(\"page\", \"p\", false, \"generate a complete HTML page\")\n\tprocCmd.Flags().BoolP(\"sanitize\", \"s\", false, \"sanitize untrusted content\")\n\n\treturn procCmd\n}", "title": "" }, { "docid": "09f8d778a1cf1546fac2184214fbbc7e", "score": "0.45724857", "text": "func main() {\n\tfmt.Println(\"Hello World\")\n\t// markdownLocal.MDWrite()\n}", "title": "" }, { "docid": "da4eac2e156b24ea61291ba305a1c1f8", "score": "0.45699403", "text": "func (validator lengthBetweenValidator) MarkdownDescription(ctx context.Context) string {\n\treturn validator.Description(ctx)\n}", "title": "" }, { "docid": "bf1addd8ce4637d0b198aef41c227021", "score": "0.45674708", "text": "func (md *Markdown) GetMarkdownString(lst *KeywordMappingList) string {\n\tif lst != nil && len(lst.Keywords) > 0 {\n\t\tlstline := strings.Split(md.str, \"\\n\")\n\t\tincode := false\n\n\t\tfor i, cl := range lstline {\n\t\t\tif len(cl) == 0 {\n\t\t\t\tcontinue\n\t\t\t}\n\n\t\t\tif !incode && !isTitle(cl) {\n\t\t\t\tif isCodeBegin(cl) {\n\t\t\t\t\tincode = true\n\t\t\t\t}\n\n\t\t\t\tif !incode {\n\t\t\t\t\tfor _, v := range lst.Keywords {\n\t\t\t\t\t\tif v.URL == \"\" {\n\t\t\t\t\t\t\tlstline[i] = strings.Replace(lstline[i], v.Keyword,\n\t\t\t\t\t\t\t\tadacorebase.AppendString(\"``\", v.Keyword, \"``\"), -1)\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tlstline[i] = strings.Replace(lstline[i], v.Keyword,\n\t\t\t\t\t\t\t\tadacorebase.AppendString(\"[\", v.Keyword, \"](\"+v.URL+\")\"), -1)\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t} else if incode {\n\t\t\t\tif isCodeEnd(cl) {\n\t\t\t\t\tincode = false\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tmd.str = strings.Join(lstline, \"\\n\")\n\t}\n\n\treturn md.str\n}", "title": "" }, { "docid": "c0bc96efc37d10c6d49824b4e09d5f4e", "score": "0.45402244", "text": "func (b *Box) UpdateMarkdown(ctx context.Context, title, filename string, content []byte) error {\n\tmd, err := ioutil.ReadFile(filename)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"steambox.UpdateMarkdown: Error reade a file: %w\", err)\n\t}\n\n\tstart := []byte(\"<!-- steam-box start -->\")\n\tbefore := md[:bytes.Index(md, start)+len(start)]\n\tend := []byte(\"<!-- steam-box end -->\")\n\tafter := md[bytes.Index(md, end):]\n\n\tnewMd := bytes.NewBuffer(nil)\n\tnewMd.Write(before)\n\tnewMd.WriteString(\"\\n\" + title + \"\\n\")\n\tnewMd.WriteString(\"```text\\n\")\n\tnewMd.Write(content)\n\tnewMd.WriteString(\"\\n\")\n\tnewMd.WriteString(\"```\\n\")\n\tnewMd.WriteString(\"<!-- Powered by https://github.com/YouEclipse/steam-box . -->\\n\")\n\tnewMd.Write(after)\n\n\terr = ioutil.WriteFile(filename, newMd.Bytes(), os.ModeAppend)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"steambox.UpdateMarkdown: Error write a file: %w\", err)\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "2f365295c81990b20720584349d5c48c", "score": "0.45297912", "text": "func InfoMarkdown(pl sdk.GRPCPlugin) string {\n\tvar sp string\n\n\tkeys := make([]string, 0, len(pl.Inputs))\n\tfor k := range pl.Inputs {\n\t\tkeys = append(keys, k)\n\t}\n\tsort.Strings(keys)\n\n\tfor _, k := range keys {\n\t\tsp += fmt.Sprintf(\"* **%s**: %s\\n\", k, pl.Inputs[k].Description)\n\t}\n\n\tinfo := fmt.Sprintf(`\n%s\n\n## Parameters\n\n%s\n\n`,\n\t\tpl.Description,\n\t\tsp)\n\n\treturn info\n}", "title": "" }, { "docid": "384db967b40b4436611dd6b431e214f7", "score": "0.4524155", "text": "func (v isRequiredValidator) MarkdownDescription(ctx context.Context) string {\n\treturn v.Description(ctx)\n}", "title": "" }, { "docid": "ec5a43c1679ea4fa4dd06c7f7ccb8dc1", "score": "0.45188102", "text": "func (fix *Fix) WithDescriptionMarkdown(markdown string) *Fix {\n\tif fix.Description == nil {\n\t\tfix.Description = &Message{}\n\t}\n\tfix.Description.Markdown = &markdown\n\treturn fix\n}", "title": "" }, { "docid": "bc006d4f19a4a805e2965d487616e091", "score": "0.45138156", "text": "func makeTextMarkdownSafe(s string) string {\n\tr := strings.NewReplacer(\n\t\t`&`, \"&amp;\",\n\t\t`'`, \"&apos;\",\n\t\t`<`, \"&lt;\",\n\t\t`>`, \"&gt;\",\n\t\t`\"`, \"&quot;\",\n\t\t`*`, `\\*`,\n\t\t`_`, `\\_`,\n\t\t`#`, `\\#`,\n\t\t`+`, `\\+`,\n\t\t`-`, `\\-`,\n\t\t`.`, `\\.`,\n\t\t`!`, `\\!`,\n\t\t`(`, `\\(`,\n\t\t`)`, `\\)`,\n\t\t`{`, `\\{`,\n\t\t`}`, `\\}`,\n\t\t`[`, `\\[`,\n\t\t`]`, `\\]`,\n\t\t`\\`, `\\\\`,\n\t)\n\treturn r.Replace(s)\n}", "title": "" }, { "docid": "8b6a80491c75942b8e057af18d3fe5d5", "score": "0.45133284", "text": "func (a *Article) ParseHTML() {\n\tmarkdown := []byte(a.Body)\n\thtml := blackfriday.Run(markdown, blackfriday.WithExtensions(config.Config.MarkdownExtensions))\n\ta.HTML = template.HTML(string(html))\n}", "title": "" }, { "docid": "ae699dd92a0560ce3572bcacc969d043", "score": "0.45017388", "text": "func getMarkdownDecorator(templateFile string) (ServeHandlerDecorator, error) {\n\ttemplate, err := template.ParseFiles(templateFile)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tmd := markdown.New(\n\t\tmarkdown.HTML(true),\n\t\tmarkdown.Tables(true),\n\t\tmarkdown.Linkify(true),\n\t\tmarkdown.Typographer(true),\n\t\tmarkdown.XHTMLOutput(true))\n\n\text := Markdown{template: template, md: md}\n\treturn ext.RenderMarkdown, nil\n}", "title": "" }, { "docid": "c9c3b496c58415571d0ffe470db8be84", "score": "0.44945186", "text": "func customMarkdown(cmd *cobra.Command, w io.Writer) error {\n\tbuf := new(bytes.Buffer)\n\n\tbuf.WriteString(\"## Use\\n\\n\")\n\tbuf.WriteString(\"`\")\n\tbuf.WriteString(strings.Replace(cmd.UseLine(), \"[flags]\", \"\", 1))\n\tcmd.Flags().VisitAll(func(f *pflag.Flag) {\n\t\tvar shorthand string\n\t\tif f.Shorthand != \"\" {\n\t\t\tshorthand = fmt.Sprintf(\"-%s \", f.Shorthand)\n\t\t}\n\t\tbuf.WriteString(fmt.Sprintf(\"[%s%s] \", shorthand, f.Name))\n\t})\n\tbuf.WriteString(\"`\\n\\n\")\n\n\tif len(cmd.Aliases) > 0 {\n\t\tbuf.WriteString(\"*Aliases*: \")\n\t\tfor i, a := range cmd.Aliases {\n\t\t\tbuf.WriteString(a)\n\t\t\tif i != len(cmd.Aliases)-1 {\n\t\t\t\tbuf.WriteString(\", \")\n\t\t\t}\n\t\t}\n\t\tbuf.WriteString(\".\\n\\n\")\n\t}\n\n\tbuf.WriteString(\"## Description\\n\\n\")\n\tif cmd.Long != \"\" {\n\t\tbuf.WriteString(cmd.Long)\n\t\tbuf.WriteString(\"\\n\\n\")\n\t} else {\n\t\tbuf.WriteString(cmd.Short)\n\t\tbuf.WriteString(\".\\n\\n\")\n\t}\n\n\tif cmd.HasSubCommands() {\n\t\turl := getURL(cmd)\n\t\tbuf.WriteString(\"## Subcommands\\n\\n\")\n\t\tfor _, c := range cmd.Commands() {\n\t\t\tname := c.Name()\n\t\t\tif !c.HasSubCommands() {\n\t\t\t\tname += \".md\"\n\t\t\t}\n\t\t\tbuf.WriteString(fmt.Sprintf(\"- [`%s`](%s%s): %s.\\n\", c.CommandPath(), url, name, c.Short))\n\t\t}\n\t}\n\tbuf.WriteString(\"\\n\")\n\n\tbuf.WriteString(\"## Flags\\n\\n\")\n\tflags := cmd.Flags()\n\tif flags.HasFlags() {\n\t\tbuf.WriteString(\"| Name | Shorthand | Type | Default | Description |\\n\")\n\t\tbuf.WriteString(\"|------|-----------|------|---------|-------------|\\n\")\n\t\tflags.VisitAll(func(f *pflag.Flag) {\n\t\t\t// Uppercase the first letter only\n\t\t\tusage := []byte(f.Usage)\n\t\t\tusage[0] = byte(unicode.ToUpper(rune(usage[0])))\n\n\t\t\tbuf.WriteString(fmt.Sprintf(\"| %s | %s | %s | %s | %s |\\n\", f.Name, f.Shorthand, f.Value.Type(), f.DefValue, usage))\n\t\t})\n\t} else {\n\t\tbuf.WriteString(\"No flags.\\n\")\n\t}\n\n\tif cmd.Example != \"\" {\n\t\tbuf.WriteString(\"\\n### Examples\\n\\n\")\n\t\texamples := strings.Split(cmd.Example, \"\\n\")\n\n\t\tfor _, e := range examples {\n\t\t\tif strings.HasPrefix(e, \"*\") {\n\t\t\t\tbuf.WriteString(strings.Replace(e, \"* \", \"\", 1) + \":\\n\")\n\t\t\t} else if e != \"\" {\n\t\t\t\tbuf.WriteString(\"```\\n\" + e + \"\\n```\\n\\n\")\n\t\t\t}\n\t\t}\n\t}\n\n\t_, err := buf.WriteTo(w)\n\treturn err\n}", "title": "" }, { "docid": "f6a610cb3b60f8c3ea85b31a31ed0619", "score": "0.4459877", "text": "func md2html(filename string) error {\n\toutFilename := MarkdownSuffix.ReplaceAllString(path.Base(filename), \".html\")\n\toutPath := path.Join(*outputDir, outFilename)\n\t\n\tmdFile,err := os.Open(filename)\n\tif err != nil {\n\t\treturn err\n\t}\n\tdefer mdFile.Close()\n\n\thtmlFile,err := os.Create(outPath)\n\tif err != nil {\n\t\treturn err\n\t}\n\tdefer htmlFile.Close()\n\n\tlog.Printf(\"Converting %s to %s\\n\", filename, outPath)\n\n\n\treturn transform(htmlFile, mdFile)\n}", "title": "" }, { "docid": "43a1c53099d019efe41e13d2ac029e82", "score": "0.44509017", "text": "func isMarkdown(resource Resource) bool {\n\treturn strings.Contains(strings.ToLower(resource.Info.ContentType), \"markdown\") || strings.HasSuffix(strings.ToLower(resource.Info.Key), \".md\")\n}", "title": "" }, { "docid": "3ca771d8326f591ab87d633fdcdafc15", "score": "0.444234", "text": "func htmlSlide(mdown string) (string, string) {\n\tsplits := strings.SplitN(mdown, \"\\n\", 2)\n\tslidetype := strings.Trim(splits[0], \" \\t\")\n\tstyle := \"\"\n\tclass := \"\"\n\tswitch slidetype {\n\tcase \"\":\n\t\tclass = \"default\"\n\t\tstyle += \" padding: 2em; \"\n\tcase \"center\":\n\t\tclass = \"center\"\n\t\tstyle += \"text-align: center; \"\n\tcase \"bullets\":\n\t\tclass = \"bullets\"\n\tdefault:\n\t\tpanic(fmt.Errorf(\"invalid slide type %v\", slidetype))\n\t}\n\tsplits = strings.SplitN(splits[1], \".notes\", 2)\n\tcontent := splits[0]\n\tnotes := \"\"\n\tif len(splits) == 2 {\n\t\tnotes = strings.Trim(splits[1], \" \\t\\r\\n\")\n\t}\n\tpostProcessCodeBlocks := strings.Contains(content, \" @@@\")\n\n\tr := blackfriday.HtmlRenderer(blackfriday.HTML_OMIT_CONTENTS|blackfriday.HTML_SKIP_STYLE, \"\", \"\")\n\trendered := string(blackfriday.Markdown([]byte(content), r, 0))\n\t// TODO(augie): stop using this horrible hack for images!\n\trendered = strings.Replace(rendered, \"<img src=\\\"\", \"<img src=\\\"images/\", -1)\n\trendered = fmt.Sprintf(\"<div class=\\\"%s innerContent\\\" style=\\\"%s\\\">%s</div>\",\n\t\tclass, style, rendered)\n\t// TODO(augie): stop using this horrible hack for code blocks!\n\tif postProcessCodeBlocks {\n\t\trendered = renderedCodeBlock.ReplaceAllStringFunc(rendered, func(match string) string {\n\t\t\tparts := strings.SplitN(match, \"@@@\", 2)\n\t\t\tlang := \"\"\n\t\t\tif len(parts) > 1 {\n\t\t\t\tlang = strings.TrimSpace(parts[1])\n\t\t\t\treturn fmt.Sprintf(\"<pre class=\\\"sh_%s sh_sourceCode\\\"><code>\\n\", lang)\n\t\t\t}\n\t\t\treturn \"<pre class=\\\"sh_sourceCode\\\"><code>\\n\"\n\t\t})\n\t}\n\treturn rendered, notes\n}", "title": "" }, { "docid": "6582e3ab0386d4494eb74ba1af9464d9", "score": "0.44326603", "text": "func (p Post) Process(content string, sourcePath string) error {\n\n\tif !strings.HasSuffix(sourcePath, \".md\") {\n\t\treturn nil\n\t}\n\n\tpost, err := markdown.ToHTMLPost(content, sourcePath)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tvar postBuffer bytes.Buffer\n\n\ttmpl := template.Must(template.ParseFiles(\"./templates/post.html\", \"./templates/base.html\"))\n\tif err := tmpl.Execute(&postBuffer, post); err != nil {\n\t\treturn err\n\t}\n\n\twritePath := \"./static/\" + post.Permalink + \".html\"\n\tif err := io.WriteToDisk(writePath, postBuffer.String()); err != nil {\n\t\treturn err\n\t}\n\n\treturn nil\n}", "title": "" } ]
1ea7ddb47ea7914fb967dfd9988c0224
Validate inspects the fields of the type to determine if they are valid.
[ { "docid": "f4aa80d2d4bfdf67d5fc2f7d9a02aaaa", "score": "0.0", "text": "func (s *SignUpInput) Validate() error {\n\tinvalidParams := aws.ErrInvalidParams{Context: \"SignUpInput\"}\n\n\tif s.ClientId == nil {\n\t\tinvalidParams.Add(aws.NewErrParamRequired(\"ClientId\"))\n\t}\n\tif s.ClientId != nil && len(*s.ClientId) < 1 {\n\t\tinvalidParams.Add(aws.NewErrParamMinLen(\"ClientId\", 1))\n\t}\n\n\tif s.Password == nil {\n\t\tinvalidParams.Add(aws.NewErrParamRequired(\"Password\"))\n\t}\n\tif s.Password != nil && len(*s.Password) < 6 {\n\t\tinvalidParams.Add(aws.NewErrParamMinLen(\"Password\", 6))\n\t}\n\tif s.SecretHash != nil && len(*s.SecretHash) < 1 {\n\t\tinvalidParams.Add(aws.NewErrParamMinLen(\"SecretHash\", 1))\n\t}\n\n\tif s.Username == nil {\n\t\tinvalidParams.Add(aws.NewErrParamRequired(\"Username\"))\n\t}\n\tif s.Username != nil && len(*s.Username) < 1 {\n\t\tinvalidParams.Add(aws.NewErrParamMinLen(\"Username\", 1))\n\t}\n\tif s.UserAttributes != nil {\n\t\tfor i, v := range s.UserAttributes {\n\t\t\tif err := v.Validate(); err != nil {\n\t\t\t\tinvalidParams.AddNested(fmt.Sprintf(\"%s[%v]\", \"UserAttributes\", i), err.(aws.ErrInvalidParams))\n\t\t\t}\n\t\t}\n\t}\n\tif s.ValidationData != nil {\n\t\tfor i, v := range s.ValidationData {\n\t\t\tif err := v.Validate(); err != nil {\n\t\t\t\tinvalidParams.AddNested(fmt.Sprintf(\"%s[%v]\", \"ValidationData\", i), err.(aws.ErrInvalidParams))\n\t\t\t}\n\t\t}\n\t}\n\n\tif invalidParams.Len() > 0 {\n\t\treturn invalidParams\n\t}\n\treturn nil\n}", "title": "" } ]
[ { "docid": "cfdd0541d367a55405b1e49ce38950ab", "score": "0.66212136", "text": "func validateFields(val interface{}) error {\n\tif err := v.Struct(val); err != nil {\n\n\t\t// Use a type assertion to get the real error value.\n\t\tverr := err.(validator.ValidationErrors)\n\n\t\t// lang controls the language of the error messages. You could pass in the\n\t\t// *http.Request and look at the Accept-Language header if you intend to\n\t\t// support multiple languages.\n\t\tlang, _ := translator.GetTranslator(\"en\")\n\n\t\tvar fields []fieldError\n\t\tfor field, msg := range verr.Translate(lang) {\n\t\t\tfields = append(\n\t\t\t\tfields,\n\t\t\t\tfieldError{Field: field, Error: msg},\n\t\t\t)\n\t\t}\n\n\t\treturn &statusError{\n\t\t\terr: errors.New(\"Field validation error\"),\n\t\t\tstatus: http.StatusBadRequest,\n\t\t\tfields: fields,\n\t\t}\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "0cf6f7a2dd879c1970271683c0275354", "score": "0.6527907", "text": "func (info Info) Validate() error {\n\tif err := info.validateRequiredFields(); err != nil {\n\t\treturn err\n\t}\n\treturn info.validateFields()\n}", "title": "" }, { "docid": "0775d2947f9aec7ba3b1768538e5ae81", "score": "0.6486684", "text": "func ValidateFields(key string, field string, value string) CVLRetCode {\n\treturn CVL_NOT_IMPLEMENTED\n}", "title": "" }, { "docid": "a8a24b626b6c50b5e61601274b47fe3e", "score": "0.6386656", "text": "func (mv *Validation) Validate(obj interface{}) bool {\n\tif obj == nil {\n\t\treturn true\n\t}\n\n\tv := reflect.ValueOf(obj)\n\tif v.Kind() == reflect.Ptr || v.Kind() == reflect.Interface {\n\t\tv = v.Elem()\n\t}\n\n\tt := v.Type()\n\n\t// Here only accept structs\n\tif v.Kind() != reflect.Struct {\n\t\terr := &ErrOnlyStrcut{Type: v.Type()}\n\t\tmv.AddError(\"Object\", obj, err)\n\t\treturn false\n\t}\n\n\tDebugf(\"Check struct [%s]\", t.Name())\n\n\tobjvk, ok := obj.(TValidater)\n\tif ok {\n\t\tif err := objvk.TValidater(); err != nil {\n\t\t\tmv.AddError(\"Object\", obj, err)\n\t\t}\n\t}\n\n\tfor i := 0; i < v.NumField(); i++ {\n\t\ttf := t.Field(i) // type field\n\t\tvf := v.Field(i) // vaule field\n\n\t\t// Skip Anonymous and private field\n\t\tif !tf.Anonymous && len(tf.PkgPath) > 0 {\n\t\t\tcontinue\n\t\t}\n\n\t\tfns := mv.getValidFuns(tf, ValidTag)\n\n\t\t// Already skip ValidIgnor flag, such as \"-\"\n\t\tif len(fns) == 0 {\n\t\t\tcontinue\n\t\t}\n\n\t\tmv.typeCheck(vf, tf, v)\n\t}\n\n\tif mv.HasError() {\n\t\treturn false\n\t}\n\n\treturn true\n}", "title": "" }, { "docid": "f08222ba45781c5c3d4efd8c6200fb94", "score": "0.6331695", "text": "func Validate(options interface{}) error {\n\tval := reflect.ValueOf(options)\n\n\tif val.Kind() != reflect.Struct {\n\t\treturn fmt.Errorf(\"Invalid input type %s, expected Struct\", val.Kind())\n\t}\n\n\tstructTyp := reflect.TypeOf(options)\n\tfor i := 0; i < val.NumField(); i++ {\n\t\tfield := val.Field(i)\n\t\tfieldType := structTyp.Field(i)\n\t\ttag := fieldType.Tag.Get(validationTagName)\n\n\t\tif tag == \"true\" {\n\t\t\tswitch field.Kind() {\n\t\t\tcase reflect.Int:\n\t\t\t\tif field.Int() == 0 {\n\t\t\t\t\treturn invalidField(fieldType.Name)\n\t\t\t\t}\n\t\t\tcase reflect.String:\n\t\t\t\tfallthrough\n\t\t\tcase reflect.Slice:\n\t\t\t\tfallthrough\n\t\t\tcase reflect.Array:\n\t\t\t\tif field.Len() == 0 {\n\t\t\t\t\treturn invalidField(fieldType.Name)\n\t\t\t\t}\n\t\t\tcase reflect.Struct:\n\t\t\t\tif err := Validate(field.Interface()); err != nil {\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}", "title": "" }, { "docid": "9d9a95c5ead4d03a61d9b20cba9ac6dd", "score": "0.6328041", "text": "func (user User) Validate(validate FieldsToValidate) error {\n\tvar err error\n\n\tif validate.FirstName {\n\t\terr = validation.ValidateStruct(&user,\n\t\t\tvalidation.Field(\n\t\t\t\t&user.FirstName,\n\t\t\t\tvalidation.Required,\n\t\t\t\tvalidation.Length(3, 250),\n\t\t\t),\n\t\t)\n\t}\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tif validate.LastName {\n\t\terr = validation.ValidateStruct(&user,\n\t\t\tvalidation.Field(\n\t\t\t\t&user.LastName,\n\t\t\t\tvalidation.Required,\n\t\t\t\tvalidation.Length(3, 250),\n\t\t\t),\n\t\t)\n\t}\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tif validate.Email {\n\t\terr = validation.ValidateStruct(&user,\n\t\t\tvalidation.Field(\n\t\t\t\t&user.Email,\n\t\t\t\tvalidation.Required,\n\t\t\t\tvalidation.Length(3, 300),\n\t\t\t\tis.Email,\n\t\t\t),\n\t\t)\n\t}\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tif validate.Address {\n\t\terr = validation.ValidateStruct(&user,\n\t\t\tvalidation.Field(\n\t\t\t\t&user.Address,\n\t\t\t\tvalidation.Required,\n\t\t\t\tvalidation.Length(3, 250),\n\t\t\t),\n\t\t)\n\t}\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tif validate.Phone {\n\t\terr = validation.ValidateStruct(&user,\n\t\t\tvalidation.Field(\n\t\t\t\t&user.Phone,\n\t\t\t\tvalidation.Required,\n\t\t\t\tvalidation.Length(3, 250),\n\t\t\t),\n\t\t)\n\t}\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tif validate.CityID {\n\t\terr = validation.ValidateStruct(&user,\n\t\t\tvalidation.Field(\n\t\t\t\t&user.CityID,\n\t\t\t\tvalidation.Required,\n\t\t\t),\n\t\t)\n\t}\n\tif err != nil {\n\t\treturn err\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "d5c37ee81372e761a81fcfb0f97e9756", "score": "0.6278985", "text": "func (v *Validator) Validate(fields []string) (bool, []*FieldError) {\n\trules := v.data.Rules()\n\tsv := reflect.ValueOf(v.data).Elem()\n\n\tif fields == nil {\n\t\tfor fieldName, ruleSet := range rules {\n\t\t\tfor _, rul := range ruleSet {\n\t\t\t\tcont := true // we validate until first rule fails\n\t\t\t\tif cont {\n\t\t\t\t\tdd := sv.FieldByName(fieldName).Interface()\n\t\t\t\t\tif val := rul.validate(dd); !val {\n\t\t\t\t\t\tferr := &FieldError{\n\t\t\t\t\t\t\tName: fieldName,\n\t\t\t\t\t\t\tVal: dd,\n\t\t\t\t\t\t\tMsg: rul.errorMsg(),\n\t\t\t\t\t\t}\n\t\t\t\t\t\tv.errors = append(v.errors, ferr)\n\t\t\t\t\t\tcont = false\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t} else if len(fields) > 0 {\n\t\tfor _, f := range fields {\n\t\t\truleSet, ok := rules[f]\n\t\t\tif !ok {\n\t\t\t\tpanic(\"validator: field needs to be validated, but has no rules; check spelling\")\n\t\t\t}\n\n\t\t\tfor _, rul := range ruleSet {\n\t\t\t\tcont := true // we validate until first rule fails\n\t\t\t\tif cont {\n\t\t\t\t\tdd := sv.FieldByName(f).Interface()\n\t\t\t\t\tif val := rul.validate(dd); !val {\n\t\t\t\t\t\tferr := &FieldError{\n\t\t\t\t\t\t\tName: f,\n\t\t\t\t\t\t\tVal: val,\n\t\t\t\t\t\t\tMsg: rul.errorMsg(),\n\t\t\t\t\t\t}\n\t\t\t\t\t\tv.errors = append(v.errors, ferr)\n\t\t\t\t\t\tcont = false\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\treturn !(len(v.errors) > 0), v.errors\n}", "title": "" }, { "docid": "69fbfa289da1ba92ac4d6669a624cd61", "score": "0.6275892", "text": "func (ms Store) Validate(model store.Model) error {\n\terr := ms.valid.Struct(model)\n\tif err != nil {\n\t\tif _, ok := err.(*validator.InvalidValidationError); ok {\n\t\t\treturn err\n\t\t}\n\t\tvar invalidFields []string\n\t\tfor _, err := range err.(validator.ValidationErrors) {\n\t\t\tinvalidFields = append(invalidFields, err.Field())\n\t\t}\n\n\t\treturn errors.BadRequest(\"fields not valid:%s\", strings.Join(invalidFields, \", \"))\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "41603d67893d6c9611f3e586857915e6", "score": "0.62669057", "text": "func (s Struct) Validate(v interface{}) error {\n\n\tval := reflect.ValueOf(v)\n\n\tif val.Kind() == reflect.Ptr {\n\t\tval = val.Elem()\n\t}\n\n\tif val.Kind() != reflect.Struct {\n\t\treturn ValidationErr(\"struct.type\", \"not a struct\")\n\t}\n\n\terrs := fail.Map{}\n\n\tfor fieldname, validator := range s {\n\t\tfield := val.FieldByName(fieldname)\n\n\t\tif field.Kind() == reflect.Invalid {\n\t\t\terrs[fieldname] = ValidationErr(\"struct.field\", \"no such field\", fieldname)\n\t\t\tcontinue\n\t\t}\n\n\t\tif err := fail.OrNil(validator.Validate(field.Interface())); err != nil {\n\t\t\terrs[fieldname] = err\n\t\t}\n\t}\n\n\treturn fail.OrNil(errs)\n}", "title": "" }, { "docid": "a8c1795b8ccc566d3ce0318dbe2916ee", "score": "0.6199109", "text": "func isValid(field interface{}) bool {\n\tvalue := reflect.ValueOf(field)\n\tvalid := false\n\n\tswitch value.Kind() {\n\tcase reflect.String:\n\t\tif value.String() != \"\" {\n\t\t\tvalid = true\n\t\t}\n\tcase reflect.Float64:\n\t\tif value.Float() >= 1 {\n\t\t\tvalid = true\n\t\t}\n\t}\n\n\treturn valid\n}", "title": "" }, { "docid": "1661b14fbdf3b4039ed6788f36eab40d", "score": "0.6190671", "text": "func (model ClinicalCase) ValidateFields(structFields ...[]string) (bool, error) {\n\tif len(structFields) == 0 {\n\t\treturn helper.ValidateFields(model)\n\t}\n\treturn helper.ValidateFields(model, structFields[0])\n}", "title": "" }, { "docid": "a148fb7f0524c5135634ab4077536f19", "score": "0.617665", "text": "func Validate(current interface{}) error {\n\t// Perform field-only validation first, that way the struct validators can assume\n\t// individual fields are valid format.\n\tif err := validate.Struct(current); err != nil {\n\t\treturn convertError(err)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "d7cf42e8ad9a4c7141d9838a312f9c18", "score": "0.616057", "text": "func validateFields(name string, fields []*ast.Field, items typeDecls, errs *[]error) map[string]struct {\n\tfield *ast.Field\n\tcount int\n} {\n\tfMap := make(map[string]struct {\n\t\tfield *ast.Field\n\t\tcount int\n\t})\n\tfor _, f := range fields {\n\t\ti, exists := fMap[f.Name.Name]\n\t\tif !exists {\n\t\t\ti = struct {\n\t\t\t\tfield *ast.Field\n\t\t\t\tcount int\n\t\t\t}{field: f}\n\t\t\tfMap[f.Name.Name] = i\n\t\t}\n\n\t\ti.count++\n\t\tfMap[f.Name.Name] = i\n\t}\n\n\tfor fname, f := range fMap {\n\t\t// Ensure field uniqueness\n\t\tif f.count > 1 {\n\t\t\t*errs = append(*errs, fmt.Errorf(\"%s:%s: field must be unique\", name, fname))\n\t\t}\n\n\t\t// Check field name\n\t\tif strings.HasPrefix(fname, \"__\") {\n\t\t\t*errs = append(*errs, fmt.Errorf(\"%s:%s: field name cannot start with \\\"__\\\" (double underscore)\", name, fname))\n\t\t}\n\n\t\t// Validate args\n\t\tif args := f.field.Args; args != nil {\n\t\t\tvalidateArgDefs(fmt.Sprintf(\"%s:%s\", name, fname), args.List, items, errs)\n\t\t}\n\n\t\t// Validate field type is an OutputType\n\t\tvar id *ast.Ident\n\t\tswitch v := f.field.Type.(type) {\n\t\tcase *ast.Field_Ident:\n\t\t\tid = v.Ident\n\t\tcase *ast.Field_List:\n\t\t\tid = unwrapType(v.List)\n\t\tcase *ast.Field_NonNull:\n\t\t\tid = unwrapType(v.NonNull)\n\t\tdefault:\n\t\t\tpanic(fmt.Sprintf(\"compiler: %s:%s: field must have a type\", name, fname))\n\t\t}\n\n\t\tif !isOutputType(id, items) {\n\t\t\t*errs = append(*errs, fmt.Errorf(\"%s:%s: field type must be a valid output type, not: %s\", name, fname, id.Name))\n\t\t}\n\n\t\tif len(f.field.Directives) > 0 {\n\t\t\tvalidateDirectives(f.field.Directives, ast.DirectiveLocation_FIELD_DEFINITION, items, errs)\n\t\t}\n\t}\n\n\treturn fMap\n}", "title": "" }, { "docid": "5d032562ef4cbf916a81f3d84b9826d8", "score": "0.61540776", "text": "func (m *FieldMetadata) Validate() error {\n\tif m == nil {\n\t\treturn nil\n\t}\n\n\t// no validation rules for DisplayName\n\n\t// no validation rules for Required\n\n\tswitch m.Type.(type) {\n\n\tcase *FieldMetadata_StringField:\n\n\t\tif v, ok := interface{}(m.GetStringField()).(interface{ Validate() error }); ok {\n\t\t\tif err := v.Validate(); err != nil {\n\t\t\t\treturn FieldMetadataValidationError{\n\t\t\t\t\tfield: \"StringField\",\n\t\t\t\t\treason: \"embedded message failed validation\",\n\t\t\t\t\tcause: err,\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\tcase *FieldMetadata_OptionField:\n\n\t\tif v, ok := interface{}(m.GetOptionField()).(interface{ Validate() error }); ok {\n\t\t\tif err := v.Validate(); err != nil {\n\t\t\t\treturn FieldMetadataValidationError{\n\t\t\t\t\tfield: \"OptionField\",\n\t\t\t\t\treason: \"embedded message failed validation\",\n\t\t\t\t\tcause: err,\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "7de427433c3a5ef77f932409e8c1c5dc", "score": "0.61455953", "text": "func validateFields(req *logical.Request, data *framework.FieldData) error {\n\tvar unknownFields []string\n\tfor k := range req.Data {\n\t\tif _, ok := data.Schema[k]; !ok {\n\t\t\tunknownFields = append(unknownFields, k)\n\t\t}\n\t}\n\n\tswitch len(unknownFields) {\n\tcase 0:\n\t\treturn nil\n\tcase 1:\n\t\treturn fmt.Errorf(\"unknown field: %s\", unknownFields[0])\n\tdefault:\n\t\tsort.Strings(unknownFields)\n\t\treturn fmt.Errorf(\"unknown fields: %s\", strings.Join(unknownFields, \",\"))\n\t}\n}", "title": "" }, { "docid": "6a6847533c8aefca08411c98da7a4f6b", "score": "0.61419994", "text": "func ValidateFields(parent string, ins interface{}) []error {\n\tallErrors := make([]error, 0)\n\tv := reflect.ValueOf(ins)\n\t// recover if reflect panics\n\tdefer recover()\nhere:\n\tfor i := 0; i < v.NumField(); i++ {\n\t\ttag := strings.SplitN(v.Type().Field(i).Tag.Get(\"validate\"), \",\", 2)\n\t\tif len(tag) > 0 && tag[0] == \"-\" {\n\t\t\tcontinue here\n\t\t}\n\t\tif v.Type().Field(i).Type.Kind().String() == \"struct\" {\n\t\t\terrs := ValidateFields(v.Type().Field(i).Name, v.Field(i).Interface())\n\t\t\tif len(errs) > 0 {\n\t\t\t\tallErrors = append(allErrors, errs...)\n\t\t\t}\n\t\t} else {\n\t\t\tvalidator := getValidator(v.Type().Field(i))\n\t\t\tf := v.Type().Field(i)\n\t\t\tfName := f.Tag.Get(\"json\")\n\t\t\tif fName == \"\" {\n\t\t\t\tfName = v.Type().Field(i).Name\n\t\t\t}\n\t\t\terr := validator.Validate(v.Field(i).Interface(), parent+\".\"+fName)\n\t\t\tif err != nil {\n\t\t\t\tallErrors = append(allErrors, err)\n\t\t\t}\n\t\t}\n\t}\n\treturn allErrors\n}", "title": "" }, { "docid": "b17d3039b96b96131d9cd873ce810101", "score": "0.61253756", "text": "func validateFields(req *logical.Request, data *framework.FieldData) error {\n\tvar unknownFields []string\n\tfor k := range req.Data {\n\t\tif _, ok := data.Schema[k]; !ok {\n\t\t\tunknownFields = append(unknownFields, k)\n\t\t}\n\t}\n\n\tif len(unknownFields) > 0 {\n\t\t// Sort since this is a human error\n\t\tsort.Strings(unknownFields)\n\n\t\treturn fmt.Errorf(\"unknown fields: %q\", unknownFields)\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "b17d3039b96b96131d9cd873ce810101", "score": "0.61253756", "text": "func validateFields(req *logical.Request, data *framework.FieldData) error {\n\tvar unknownFields []string\n\tfor k := range req.Data {\n\t\tif _, ok := data.Schema[k]; !ok {\n\t\t\tunknownFields = append(unknownFields, k)\n\t\t}\n\t}\n\n\tif len(unknownFields) > 0 {\n\t\t// Sort since this is a human error\n\t\tsort.Strings(unknownFields)\n\n\t\treturn fmt.Errorf(\"unknown fields: %q\", unknownFields)\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "f2c12e7155c1b73cac1234e00225ec5c", "score": "0.61117655", "text": "func Validate(name []string, value reflect.Value, md *mapstructure.Metadata) *DecodeError {\n\tvar missing []string\n\tfor i := 0; i < value.NumField(); i++ {\n\t\tfld := value.Type().Field(i)\n\t\ttag, ok := fld.Tag.Lookup(\"required\")\n\t\tfldArr := append(name, fld.Name)\n\t\tfldName := strings.Join(fldArr, \".\")\n\t\tvfld := value.Field(i)\n\t\tif !ok {\n\t\t\ttag = string(fld.Tag)\n\t\t}\n\t\tif ok || strings.Contains(tag, \"required\") {\n\t\t\tfound := false\n\t\t\tfor _, k := range md.Keys {\n\t\t\t\tif k == fldName {\n\t\t\t\t\tfound = true\n\t\t\t\t\tbreak\n\t\t\t\t}\n\t\t\t}\n\t\t\tif !found {\n\t\t\t\tglog.Errorf(\"%#v >> %#v >> not found %s, %#v\", fld, vfld, fld.Name, md.Keys)\n\t\t\t\tmissing = append(missing, fldName)\n\t\t\t}\n\t\t}\n\t\tif vfld.Kind() == reflect.Struct {\n\t\t\ter := Validate(fldArr, vfld, md)\n\t\t\tif er != nil {\n\t\t\t\tmissing = append(missing, er.Missing...)\n\t\t\t}\n\t\t}\n\t}\n\tif len(missing) > 0 {\n\t\treturn &DecodeError{\n\t\t\terr: errors.New(\"Missing \" + strings.Join(missing, \",\")),\n\t\t\tMissing: missing,\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "7884768f9eed3e3cff2f50059c440808", "score": "0.60614", "text": "func (m *Embed) ValidateFields(paths ...string) error {\n\tif len(paths) > 0 {\n\t\treturn fmt.Errorf(\"message Embed has no fields, but paths %s were specified\", paths)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "74654916de1790299307324d59ae1a32", "score": "0.6052849", "text": "func (typedData *TypedData) validate() error {\n\tif err := typedData.Types.validate(); err != nil {\n\t\treturn err\n\t}\n\tif err := typedData.Domain.validate(); err != nil {\n\t\treturn err\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "9822d2fd61accd1951e0fb025519e893", "score": "0.60421634", "text": "func ValidateFields(path Path, resource interface{}) error {\n\tptrValue := reflect.ValueOf(resource)\n\tvalue := ptrValue.Elem()\n\n\tif kind := value.Kind(); kind != reflect.Struct {\n\t\treturn fmt.Errorf(\"invalid target type %s, must be a Struct\", kind)\n\t}\n\n\tfor i := 0; i < value.Type().NumField(); i++ {\n\t\tfield := value.Type().Field(i)\n\t\tif err := validateField(path, ptrValue, field); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "42d06674956a913b0765a991adf94447", "score": "0.6029159", "text": "func ValidateFields(fields []string) error {\n\tallowedFields := map[string]struct{}{}\n\n\tallowedFields[\"productId\"] = struct{}{}\n\tallowedFields[\"title\"] = struct{}{}\n\tallowedFields[\"sku\"] = struct{}{}\n\tallowedFields[\"barcodes\"] = struct{}{}\n\tallowedFields[\"description\"] = struct{}{}\n\tallowedFields[\"attributes\"] = struct{}{}\n\tallowedFields[\"price\"] = struct{}{}\n\tallowedFields[\"created\"] = struct{}{}\n\tallowedFields[\"lastUpdated\"] = struct{}{}\n\n\tfor _, field := range fields {\n\t\t_, ok := allowedFields[field]\n\n\t\tif !ok {\n\t\t\treturn fmt.Errorf(\"Unknown field (%s) field list\", field)\n\t\t}\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "61a3d83bd4361040bedc1953272b602a", "score": "0.5995586", "text": "func (ch *ContentHandler) Validate(contentType string, fieldsDef map[string]contenttype.FieldDef, inputs InputMap, checkAllRequired bool) (bool, ValidationResult) {\n\t//todo: check max length\n\t//todo: check all kind of validation\n\tresult := ValidationResult{Fields: map[string]string{}}\n\n\t//check required\n\tfor identifier, fieldDef := range fieldsDef {\n\t\tinput, fieldExists := inputs[identifier]\n\t\tfieldResult := \"\"\n\t\t//validat both required and others together.\n\t\tisEmpty := fieldtype.IsEmptyInput(input)\n\t\tif fieldExists {\n\t\t\tif fieldDef.Required && isEmpty {\n\t\t\t\tfieldResult = \"1\"\n\t\t\t} else {\n\t\t\t\tfield := fieldtype.NewField(fieldDef.FieldType)\n\t\t\t\terr := field.LoadFromInput(input, fieldDef.Parameters)\n\t\t\t\tif err != nil {\n\t\t\t\t\tfieldResult = err.Error()\n\t\t\t\t} else {\n\t\t\t\t\tif fieldDef.Required && field.IsEmpty() { //not empty input, but empty in this fieldtype. eg. {} or [] for json fieldtype\n\t\t\t\t\t\tfieldResult = \"1\"\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t} else if fieldDef.Required && checkAllRequired {\n\t\t\tfieldResult = \"1\"\n\t\t}\n\t\tif fieldResult != \"\" {\n\t\t\tresult.Fields[identifier] = fieldResult\n\t\t}\n\t}\n\n\treturn result.Passed(), result\n}", "title": "" }, { "docid": "c39f2dd18b932050b3087bb621a9319f", "score": "0.5994661", "text": "func (t Types) validate() error {\n\tfor typeKey, typeArr := range t {\n\t\tif len(typeKey) == 0 {\n\t\t\treturn fmt.Errorf(\"empty type key\")\n\t\t}\n\t\tfor i, typeObj := range typeArr {\n\t\t\tif len(typeObj.Type) == 0 {\n\t\t\t\treturn fmt.Errorf(\"type %q:%d: empty Type\", typeKey, i)\n\t\t\t}\n\t\t\tif len(typeObj.Name) == 0 {\n\t\t\t\treturn fmt.Errorf(\"type %q:%d: empty Name\", typeKey, i)\n\t\t\t}\n\t\t\tif typeKey == typeObj.Type {\n\t\t\t\treturn fmt.Errorf(\"type %q cannot reference itself\", typeObj.Type)\n\t\t\t}\n\t\t\tif typeObj.isReferenceType() {\n\t\t\t\tif _, exist := t[typeObj.typeName()]; !exist {\n\t\t\t\t\treturn fmt.Errorf(\"reference type %q is undefined\", typeObj.Type)\n\t\t\t\t}\n\t\t\t\tif !typedDataReferenceTypeRegexp.MatchString(typeObj.Type) {\n\t\t\t\t\treturn fmt.Errorf(\"unknown reference type %q\", typeObj.Type)\n\t\t\t\t}\n\t\t\t} else if !isPrimitiveTypeValid(typeObj.Type) {\n\t\t\t\treturn fmt.Errorf(\"unknown type %q\", typeObj.Type)\n\t\t\t}\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "af16a5ff8dc2c4ed693773da3344ccdf", "score": "0.596415", "text": "func (city City) Validate(validate FieldsToValidate) error {\n\tvar err error\n\n\tif validate.Name {\n\t\terr = validation.ValidateStruct(&city,\n\t\t\tvalidation.Field(\n\t\t\t\t&city.Name,\n\t\t\t\tvalidation.Required,\n\t\t\t\tvalidation.Length(3, 250),\n\t\t\t),\n\t\t)\n\t}\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tif validate.CountryID {\n\t\terr = validation.ValidateStruct(&city,\n\t\t\tvalidation.Field(\n\t\t\t\t&city.CountryID,\n\t\t\t\tvalidation.Required,\n\t\t\t),\n\t\t)\n\t}\n\tif err != nil {\n\t\treturn err\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "6c3b04c9f35daeb80790c48f31c7f57d", "score": "0.59567994", "text": "func (ps PublicService) Validate(validate FieldsToValidate) error {\n\tvar err error\n\n\tif validate.Company {\n\t\terr = validation.ValidateStruct(&ps,\n\t\t\tvalidation.Field(\n\t\t\t\t&ps.Company, validation.Required,\n\t\t\t\tvalidation.Length(3, 250),\n\t\t\t),\n\t\t)\n\t}\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tif validate.Email {\n\t\terr = validation.ValidateStruct(&ps,\n\t\t\tvalidation.Field(\n\t\t\t\t&ps.Email,\n\t\t\t\tvalidation.Required,\n\t\t\t\tis.Email,\n\t\t\t),\n\t\t)\n\t}\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tif validate.Type {\n\t\terr = validation.ValidateStruct(&ps,\n\t\t\tvalidation.Field(\n\t\t\t\t&ps.Type,\n\t\t\t\tvalidation.Required,\n\t\t\t),\n\t\t)\n\t}\n\tif err != nil {\n\t\treturn err\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "8d093c07c1872a265d423ffb43e2eb6c", "score": "0.59443736", "text": "func (e Entry) ValidatePresentFields() error {\n\tif (e.Moment != nil) && (*e.Moment != tools.JSONTime(time.Time{})) {\n\t\treturn errors.New(\"moment is not valid\")\n\t}\n\n\tif e.Transactions != nil {\n\t\tif len(*e.Transactions) == 0 {\n\t\t\treturn errors.New(\"entry does not have any transactions\")\n\t\t}\n\n\t\tfor _, t := range *e.Transactions {\n\t\t\tif len(string(t.Type)) == 0 {\n\t\t\t\treturn errors.New(\"type is not valid\")\n\t\t\t}\n\t\t\tif !tools.IsUUID(t.ItemUUID) {\n\t\t\t\treturn errors.New(\"itemUUID is not valid\")\n\t\t\t}\n\t\t\tif t.Count <= 0 {\n\t\t\t\treturn errors.New(\"transaction count must be positive\")\n\t\t\t}\n\t\t}\n\t}\n\n\tif (e.Moment != nil) && (*e.Moment != tools.JSONTime(time.Time{})) {\n\t\treturn errors.New(\"moment is not valid\")\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "da4743dc5acd532f0a9c52b52c9279e0", "score": "0.59351623", "text": "func (m *Field) Validate() error {\n\tif m == nil {\n\t\treturn nil\n\t}\n\n\t// no validation rules for Name\n\n\tif v, ok := interface{}(m.GetMetadata()).(interface{ Validate() error }); ok {\n\t\tif err := v.Validate(); err != nil {\n\t\t\treturn FieldValidationError{\n\t\t\t\tfield: \"Metadata\",\n\t\t\t\treason: \"embedded message failed validation\",\n\t\t\t\tcause: err,\n\t\t\t}\n\t\t}\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "c3ce13ed49253b625ca492eabb9d28bc", "score": "0.5910539", "text": "func (m *Schema) Validate() error {\n\tif m == nil {\n\t\treturn nil\n\t}\n\n\t// no validation rules for TypeUrl\n\n\tif v, ok := interface{}(m.GetMetadata()).(interface{ Validate() error }); ok {\n\t\tif err := v.Validate(); err != nil {\n\t\t\treturn SchemaValidationError{\n\t\t\t\tfield: \"Metadata\",\n\t\t\t\treason: \"embedded message failed validation\",\n\t\t\t\tcause: err,\n\t\t\t}\n\t\t}\n\t}\n\n\tfor idx, item := range m.GetFields() {\n\t\t_, _ = idx, item\n\n\t\tif v, ok := interface{}(item).(interface{ Validate() error }); ok {\n\t\t\tif err := v.Validate(); err != nil {\n\t\t\t\treturn SchemaValidationError{\n\t\t\t\t\tfield: fmt.Sprintf(\"Fields[%v]\", idx),\n\t\t\t\t\treason: \"embedded message failed validation\",\n\t\t\t\t\tcause: err,\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t}\n\n\tif v, ok := interface{}(m.GetError()).(interface{ Validate() error }); ok {\n\t\tif err := v.Validate(); err != nil {\n\t\t\treturn SchemaValidationError{\n\t\t\t\tfield: \"Error\",\n\t\t\t\treason: \"embedded message failed validation\",\n\t\t\t\tcause: err,\n\t\t\t}\n\t\t}\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "680be7124bca84947d381d388b3c42b9", "score": "0.5906632", "text": "func (v *ParamValidator) ValidateFields(htsgetReq *HtsgetRequest, fields []string) (bool, string) {\n\n\t// incompatible with header only request\n\tif htsgetReq.HeaderOnlyRequested() {\n\t\treturn false, \"'fields' incompatible with header-only request\"\n\t}\n\n\tfor _, fieldItem := range fields {\n\t\tif _, ok := htsconstants.BamFields[fieldItem]; !ok {\n\t\t\treturn false, \"'\" + fieldItem + \"' not an acceptable field\"\n\t\t}\n\t}\n\treturn true, \"\"\n}", "title": "" }, { "docid": "a0a0df456d632eab7ff9ed316d7c662e", "score": "0.58880436", "text": "func (mv *Validator) Validate(v interface{}) error {\r\n\tsv := reflect.ValueOf(v)\r\n\tst := reflect.TypeOf(v)\r\n\tif sv.Kind() == reflect.Ptr && !sv.IsNil() {\r\n\t\treturn mv.Validate(sv.Elem().Interface())\r\n\t}\r\n\tif sv.Kind() != reflect.Struct {\r\n\t\treturn ErrUnsupported\r\n\t}\r\n\tnfields := sv.NumField()\r\n\tm := make(ErrorMap)\r\n\tfor i := 0; i < nfields; i++ {\r\n\t\tf := sv.Field(i)\r\n\t\t// deal with pointers\r\n\t\tfor f.Kind() == reflect.Ptr && !f.IsNil() {\r\n\t\t\tf = f.Elem()\r\n\t\t}\r\n\t\ttag := st.Field(i).Tag.Get(mv.tagName)\r\n\t\tif tag == \"-\" {\r\n\t\t\tcontinue\r\n\t\t}\r\n\t\tfname := mv.getFieldName(st.Field(i))\r\n\t\tvar errs ErrorArray\r\n\t\tif tag != \"\" {\r\n\t\t\terr := mv.Valid(f.Interface(), tag)\r\n\t\t\tif errors, ok := err.(ErrorArray); ok {\r\n\t\t\t\terrs = errors\r\n\t\t\t} else if err != nil {\r\n\t\t\t\terrs = ErrorArray{err}\r\n\t\t\t}\r\n\t\t}\r\n\t\tif f.Kind() == reflect.Struct {\r\n\t\t\tif !unicode.IsUpper(rune(fname[0])) {\r\n\t\t\t\tcontinue\r\n\t\t\t}\r\n\t\t\te := mv.Validate(f.Interface())\r\n\t\t\tif e, ok := e.(ErrorMap); ok && len(e) > 0 {\r\n\t\t\t\tfor j, k := range e {\r\n\t\t\t\t\tm[fname+\".\"+j] = k\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\t\tif len(errs) > 0 {\r\n\t\t\tm[fname] = errs\r\n\t\t}\r\n\t}\r\n\tif len(m) > 0 {\r\n\t\treturn m\r\n\t}\r\n\treturn nil\r\n}", "title": "" }, { "docid": "bb3b5abd882e3ebb3c2e5096a86daaa3", "score": "0.5842006", "text": "func (c *CheckType) Validate() error {\n\tintervalCheck := c.IsScript() || c.HTTP != \"\" || c.TCP != \"\" || c.GRPC != \"\"\n\n\tif c.Interval > 0 && c.TTL > 0 {\n\t\treturn fmt.Errorf(\"Interval and TTL cannot both be specified\")\n\t}\n\tif intervalCheck && c.Interval <= 0 {\n\t\treturn fmt.Errorf(\"Interval must be > 0 for Script, HTTP, or TCP checks\")\n\t}\n\tif intervalCheck && c.IsAlias() {\n\t\treturn fmt.Errorf(\"Interval cannot be set for Alias checks\")\n\t}\n\tif c.IsAlias() && c.TTL > 0 {\n\t\treturn fmt.Errorf(\"TTL must be not be set for Alias checks\")\n\t}\n\tif !intervalCheck && !c.IsAlias() && c.TTL <= 0 {\n\t\treturn fmt.Errorf(\"TTL must be > 0 for TTL checks\")\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "fa7c740464315a6f084b36bde9ee4d29", "score": "0.5816659", "text": "func (s *Schema) Validate() []error {\n\terrs := make([]error, 0)\n\t// NOTE: Not sure how to validate some of these\n\t// s.Title\n\t// s.Description\n\t// s.MaxProperties\n\t// s.MinProperties\n\t// s.Required\n\t// s.AllOf\n\t// s.Properties\n\tif s.Properties != nil {\n\t\tfor _, t := range s.Properties {\n\t\t\terrs = append(errs, t.Validate()...)\n\t\t}\n\t}\n\t// Adds support for polymorphism. The discriminator is the schema property name that is used to differentiate between other schema that inherit this schema. The property name used MUST be defined at this schema and it MUST be in the required property list. When used, the value MUST be the name of this schema or any schema that inherits it.\n\t// s.Discriminator\n\t// Relevant only for Schema \"properties\" definitions. Declares the property as \"read only\". This means that it MAY be sent as part of a response but MUST NOT be sent as part of the request. Properties marked as readOnly being true SHOULD NOT be in the required list of the defined schema. Default value is false.\n\t// s.ReadOnly\n\t// This MAY be used only on properties schemas. It has no effect on root schemas. Adds Additional metadata to describe the XML representation format of this property.\n\tif s.Xml != nil {\n\t\terrs = append(errs, s.Xml.Validate()...)\n\t}\n\t// Additional external documentation for this schema.\n\tif s.ExternalDocs != nil {\n\t\terrs = append(errs, s.ExternalDocs.Validate()...)\n\t}\n\t// A free-form property to include a an example of an instance for this schema.\n\t// s.Example\n\n\t// Other fields\n\terrs = append(errs, s.ItemsDef.Validate()...)\n\n\treturn errs\n}", "title": "" }, { "docid": "8e743b9d9671fef93e04061a2e51872e", "score": "0.5811266", "text": "func (s ServiceType) Validate() error {\n\t// Must have\n\tif _, ok := s[\"@context\"]; ok == false {\n\t\t//return false, fmt.Errorf(\"Must have @context\")\n\t\treturn fmt.Errorf(\"Must have @context\")\n\t}\n\t// Should have\n\tif _, ok := s[\"@id\"]; ok == false {\n\t\t//return false, fmt.Errorf(\"Should have @id\")\n\t\treturn fmt.Errorf(\"Should have @id\")\n\t}\n\t//return true\n\treturn nil\n}", "title": "" }, { "docid": "b7aa0786256dfce91254d0033f23c504", "score": "0.57736623", "text": "func Validate(r *http.Request, v interface{}) error {\n\ts := reflectr.Struct(v)\n\tif !s.IsPtr() {\n\t\treturn errInvalidForm\n\t}\n\tif err := s.Error(); err != nil {\n\t\treturn errInvalidForm\n\t}\n\tvalidated := true\n\tfor _, fieldName := range s.Fields() {\n\t\tf, _ := s.Field(fieldName).Value()\n\t\tif err := field(f, r.Form.Get(fieldName)); err != nil {\n\t\t\tif err == errInvalidValue {\n\t\t\t\tvalidated = false\n\t\t\t} else {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\tif !validated {\n\t\treturn ErrInvalid\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "64db2df86645fc9dc9ad339bd86e484b", "score": "0.5773055", "text": "func (ds *DomainSpec) Validate(ctx context.Context) *apis.FieldError {\n\t// Spec must not be empty.\n\tif equality.Semantic.DeepEqual(ds, &DomainSpec{}) {\n\t\treturn apis.ErrMissingField(apis.CurrentField)\n\t}\n\tvar all *apis.FieldError\n\tif ds.IngressClass == \"\" {\n\t\tall = all.Also(apis.ErrMissingField(\"ingressClass\"))\n\t}\n\tif len(ds.LoadBalancers) == 0 {\n\t\tall = all.Also(apis.ErrMissingField(\"loadBalancers\"))\n\t}\n\tfor idx, lbSpec := range ds.LoadBalancers {\n\t\tall = all.Also(lbSpec.Validate(ctx).ViaFieldIndex(\"loadBalancers\", idx))\n\t}\n\tfor idx, cfg := range ds.Configs {\n\t\tall = all.Also(cfg.Validate(ctx).ViaFieldIndex(\"configs\", idx))\n\t}\n\treturn all\n}", "title": "" }, { "docid": "d2d9ad7275d59105e8e8e21fa5e979e6", "score": "0.57703835", "text": "func validate(c *Config) error {\n\tval := reflect.ValueOf(c)\n\trefType := reflect.TypeOf(c)\n\tfor i := 0; i < val.Elem().NumField(); i++ {\n\t\tfield := val.Elem().Field(i)\n\n\t\t// required fields are all strings\n\t\tif _, ok := refType.Elem().Field(i).Tag.Lookup(\"required\"); ok && field.String() == \"\" {\n\t\t\treturn fmt.Errorf(\"required key %s missing value\", refType.Elem().Field(i).Name)\n\t\t}\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "b2905e17cd13f656f2edcee492573319", "score": "0.57679963", "text": "func (contact *Contact) Validate() error {\n\treturn validator.Validate.Struct(contact)\n}", "title": "" }, { "docid": "c4df8662884d166c9acf60aa92b96dea", "score": "0.5764954", "text": "func (p *Profile) Validate() error {\n\n\treturn validation.ValidateStruct(p,\n\t\tvalidation.Field(&p.Nid, validation.Required, validation.Length(10, 17), is.Digit),\n\t\tvalidation.Field(&p.DateOfBirth, validation.Required),\n\t)\n}", "title": "" }, { "docid": "7a392a44ccb263d84ca2104f8450b04b", "score": "0.57614446", "text": "func (m *Meta) Validate(formats strfmt.Registry) error {\n\tvar res []error\n\n\tif err := m.validateRequestDateTime(formats); err != nil {\n\t\tres = append(res, err)\n\t}\n\n\tif err := m.validateTotalPages(formats); err != nil {\n\t\tres = append(res, err)\n\t}\n\n\tif err := m.validateTotalRecords(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}", "title": "" }, { "docid": "ce763ecacd2eaffd1b6682639dec021b", "score": "0.574893", "text": "func (r *Record) Validate(typ Type) error {\n\t// validate A address\n\tif typ == A {\n\t\tip := net.ParseIP(r.Address)\n\t\tif ip == nil || ip.To4() == nil {\n\t\t\treturn errors.Errorf(\"invalid IPv4 address: %s\", r.Address)\n\t\t}\n\t}\n\n\t// validate AAAA address\n\tif typ == AAAA {\n\t\tip := net.ParseIP(r.Address)\n\t\tif ip == nil || ip.To16() == nil {\n\t\t\treturn errors.Errorf(\"invalid IPv6 address: %s\", r.Address)\n\t\t}\n\t}\n\n\t// validate CNAME and MX addresses\n\tif typ == CNAME || typ == MX {\n\t\tif !IsDomain(r.Address, true) {\n\t\t\treturn errors.Errorf(\"invalid domain name: %s\", r.Address)\n\t\t}\n\t}\n\n\t// check TXT data\n\tif typ == TXT {\n\t\tif len(r.Data) == 0 {\n\t\t\treturn errors.Errorf(\"missing data\")\n\t\t}\n\n\t\tfor _, data := range r.Data {\n\t\t\tif len(data) > 255 {\n\t\t\t\treturn errors.Errorf(\"data too long\")\n\t\t\t}\n\t\t}\n\t}\n\n\t// validate NS addresses\n\tif typ == NS {\n\t\tif !IsDomain(r.Address, true) {\n\t\t\treturn errors.Errorf(\"invalid ns name: %s\", r.Address)\n\t\t}\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "c5861dccde6a4addf7fc47f9e9ff600f", "score": "0.57242143", "text": "func (s *GroupMembers) Validate() error {\n\tinvalidParams := request.ErrInvalidParams{Context: \"GroupMembers\"}\n\tif s.MemberGroups != nil && len(s.MemberGroups) < 1 {\n\t\tinvalidParams.Add(request.NewErrParamMinLen(\"MemberGroups\", 1))\n\t}\n\tif s.MemberUsers != nil && len(s.MemberUsers) < 1 {\n\t\tinvalidParams.Add(request.NewErrParamMinLen(\"MemberUsers\", 1))\n\t}\n\tif s.MemberGroups != nil {\n\t\tfor i, v := range s.MemberGroups {\n\t\t\tif v == nil {\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tif err := v.Validate(); err != nil {\n\t\t\t\tinvalidParams.AddNested(fmt.Sprintf(\"%s[%v]\", \"MemberGroups\", i), err.(request.ErrInvalidParams))\n\t\t\t}\n\t\t}\n\t}\n\tif s.MemberUsers != nil {\n\t\tfor i, v := range s.MemberUsers {\n\t\t\tif v == nil {\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tif err := v.Validate(); err != nil {\n\t\t\t\tinvalidParams.AddNested(fmt.Sprintf(\"%s[%v]\", \"MemberUsers\", i), err.(request.ErrInvalidParams))\n\t\t\t}\n\t\t}\n\t}\n\tif s.S3PathforGroupMembers != nil {\n\t\tif err := s.S3PathforGroupMembers.Validate(); err != nil {\n\t\t\tinvalidParams.AddNested(\"S3PathforGroupMembers\", err.(request.ErrInvalidParams))\n\t\t}\n\t}\n\n\tif invalidParams.Len() > 0 {\n\t\treturn invalidParams\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "f0c95d66e5b8b792258030d6d36fbaa9", "score": "0.57217616", "text": "func (s Schema) Validate() diag.Diagnostics {\n\tvar diags diag.Diagnostics\n\n\tattributes := s.GetAttributes()\n\n\tfor k, v := range attributes {\n\t\td := validateAttributeFieldName(path.Root(k), k, v)\n\n\t\tdiags.Append(d...)\n\t}\n\n\treturn diags\n}", "title": "" }, { "docid": "e8e811f13987dba1bffb58fb3e7f3388", "score": "0.5721612", "text": "func (s *Server) validate(idlField Field, implType reflect.Type, path string) {\n\ttestVal := idlField.testVal(s.idl)\n\tconv := newConvert(s.idl, &idlField, implType, testVal, \"\")\n\t_, err := conv.run()\n\tif err != nil {\n\t\tmsg := fmt.Sprintf(\"barrister: %s has invalid type: %s reason: %s\", path, implType, err)\n\t\tpanic(msg)\n\t}\n}", "title": "" }, { "docid": "4e9bb5df104ee9bf9d317345fdf2b066", "score": "0.5715798", "text": "func validateStruct(value reflect.Value) error {\n\ttyp := value.Type()\n\n\t// Iterate over struct fields\n\tfor i := 0; i < typ.NumField(); i++ {\n\t\tvalidators := getValidators(typ.Field(i).Tag)\n\t\tfieldName := typ.Field(i).Name\n\t\tif err := validateField(value.Field(i), fieldName, validators); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "3b1928e4c2137f93e33241aa79ece9ff", "score": "0.57150453", "text": "func (ActorStrategy) Validate(ctx context.Context, obj runtime.Object) field.ErrorList {\n\to := obj.(*Actor)\n\tklog.V(5).Infof(\"Validating fields for Actor %s\", o.Name)\n\terrors := field.ErrorList{}\n\t// perform validation here and add to errors using field.Invalid\n\treturn errors\n}", "title": "" }, { "docid": "b8180c26268cd6200115f1e4fea9fdc8", "score": "0.5706334", "text": "func (s Service) Validate() error {\n\terr := s.Type.Validate()\n\tif err != nil {\n\t\treturn err\n\t}\n\tif s.Status != \"\" {\n\t\tif err := s.Status.Validate(); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\tif s.URL == \"\" {\n\t\treturn errInvalidField(\"url\")\n\t}\n\tif s.Path == \"\" {\n\t\treturn errInvalidField(\"path\")\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "b091cc628d7a51640998df7dbf191c59", "score": "0.5672766", "text": "func (mv *Validation) typeCheck(v reflect.Value, t reflect.StructField, o reflect.Value) {\n\tfns := mv.getValidFuns(t, ValidTag)\n\n\t// skip\n\tif len(fns) == 0 {\n\t\treturn\n\t}\n\n\t// First check all field for required\n\tif fns[RequiredKey] != nil {\n\t\tif err := mv.checkRequire(v, t); err != nil {\n\t\t\tmv.AddError(t.Name, v.Interface(), err)\n\t\t}\n\n\t\tdelete(fns, RequiredKey)\n\t}\n\n\tswitch v.Kind() {\n\tcase reflect.Bool,\n\t\treflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64,\n\t\treflect.Uint, reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64, reflect.Uintptr,\n\t\treflect.Float32, reflect.Float64,\n\t\treflect.String:\n\n\t\tDebugf(\"\\tCheck field [%s]\", t.Name)\n\n\t\tfor fname := range fns {\n\t\t\tDebugf(\"CheckerName: [%s]\", fname)\n\n\t\t\t// find custom map and pkg map\n\t\t\tvar vck Validater\n\t\t\tvar find bool\n\n\t\t\tif vck, find = CustomValidatorsMap.FindValidater(fname); !find {\n\t\t\t\tvck = ValidatorsMap[fname]\n\t\t\t}\n\n\t\t\tif vck == nil {\n\t\t\t\terr := fmt.Errorf(\"can't find checker for [%s]\", fname)\n\t\t\t\tmv.AddError(t.Name, v.Interface(), err)\n\t\t\t\tDebugf(\"can't find checker for [%s]\", fname)\n\t\t\t\tcontinue\n\t\t\t}\n\n\t\t\terr := vck.Validater(v.Interface())\n\t\t\tif err != nil {\n\t\t\t\tmv.AddError(t.Name, v.Interface(), err)\n\t\t\t}\n\t\t}\n\n\tcase reflect.Slice:\n\t\tfor i := 0; i < v.Len(); i++ {\n\t\t\tif v.Index(i).Kind() != reflect.Struct {\n\t\t\t\tmv.typeCheck(v.Index(i), t, o)\n\t\t\t} else {\n\t\t\t\tmv.Validate(v.Index(i).Interface())\n\t\t\t}\n\t\t}\n\n\tcase reflect.Array:\n\t\tfor i := 0; i < v.Len(); i++ {\n\t\t\tif v.Index(i).Kind() != reflect.Struct {\n\t\t\t\tmv.typeCheck(v.Index(i), t, o)\n\t\t\t} else {\n\t\t\t\tmv.Validate(v.Index(i).Interface())\n\t\t\t}\n\t\t}\n\n\tcase reflect.Interface:\n\t\t// If the value is an interface then encode its element\n\t\tif !v.IsNil() {\n\t\t\tmv.Validate(v.Interface())\n\t\t}\n\n\tcase reflect.Ptr:\n\t\t// only check\n\t\t// If the value is a pointer then check its element\n\t\tif !v.IsNil() {\n\t\t\tmv.typeCheck(v.Elem(), t, o)\n\t\t}\n\n\tcase reflect.Struct:\n\t\tmv.Validate(v.Interface())\n\n\t// case reflect.Map: // don't support map now\n\tdefault:\n\t\terr := fmt.Errorf(\"UnspportType %s\", v.Type())\n\t\tmv.AddError(t.Name, v.Interface(), err)\n\t}\n\n\treturn\n}", "title": "" }, { "docid": "5339355da7891c996450b46949765514", "score": "0.56698906", "text": "func (u *Unit) Validate() error {\n\tmissing := make([]string, 0)\n\n\tif u.Name == nil {\n\t\tmissing = append(missing, \"'name'\")\n\t}\n\n\tif u.Members == nil {\n\t\tmissing = append(missing, \"'members'\")\n\t}\n\n\tif u.Readings == nil {\n\t\tmissing = append(missing, \"'readings'\")\n\t}\n\n\tif len(missing) > 0 {\n\t\treturn fmt.Errorf(\"Bad Request: %s\", strings.Join(missing, \", \"))\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "ff6ddee5cff9e722da4bb24714050133", "score": "0.56611735", "text": "func (s *IndexField) Validate() error {\n\tinvalidParams := request.ErrInvalidParams{Context: \"IndexField\"}\n\tif s.IndexFieldName == nil {\n\t\tinvalidParams.Add(request.NewErrParamRequired(\"IndexFieldName\"))\n\t}\n\tif s.IndexFieldName != nil && len(*s.IndexFieldName) < 1 {\n\t\tinvalidParams.Add(request.NewErrParamMinLen(\"IndexFieldName\", 1))\n\t}\n\tif s.IndexFieldType == nil {\n\t\tinvalidParams.Add(request.NewErrParamRequired(\"IndexFieldType\"))\n\t}\n\tif s.DateOptions != nil {\n\t\tif err := s.DateOptions.Validate(); err != nil {\n\t\t\tinvalidParams.AddNested(\"DateOptions\", err.(request.ErrInvalidParams))\n\t\t}\n\t}\n\tif s.DoubleOptions != nil {\n\t\tif err := s.DoubleOptions.Validate(); err != nil {\n\t\t\tinvalidParams.AddNested(\"DoubleOptions\", err.(request.ErrInvalidParams))\n\t\t}\n\t}\n\tif s.IntOptions != nil {\n\t\tif err := s.IntOptions.Validate(); err != nil {\n\t\t\tinvalidParams.AddNested(\"IntOptions\", err.(request.ErrInvalidParams))\n\t\t}\n\t}\n\tif s.LatLonOptions != nil {\n\t\tif err := s.LatLonOptions.Validate(); err != nil {\n\t\t\tinvalidParams.AddNested(\"LatLonOptions\", err.(request.ErrInvalidParams))\n\t\t}\n\t}\n\tif s.LiteralOptions != nil {\n\t\tif err := s.LiteralOptions.Validate(); err != nil {\n\t\t\tinvalidParams.AddNested(\"LiteralOptions\", err.(request.ErrInvalidParams))\n\t\t}\n\t}\n\tif s.TextOptions != nil {\n\t\tif err := s.TextOptions.Validate(); err != nil {\n\t\t\tinvalidParams.AddNested(\"TextOptions\", err.(request.ErrInvalidParams))\n\t\t}\n\t}\n\n\tif invalidParams.Len() > 0 {\n\t\treturn invalidParams\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "7c0c8623cb54ae29a8d88a8cdefe5624", "score": "0.5645289", "text": "func (s *AssociatePersonasToEntitiesInput) Validate() error {\n\tinvalidParams := request.ErrInvalidParams{Context: \"AssociatePersonasToEntitiesInput\"}\n\tif s.Id == nil {\n\t\tinvalidParams.Add(request.NewErrParamRequired(\"Id\"))\n\t}\n\tif s.Id != nil && len(*s.Id) < 1 {\n\t\tinvalidParams.Add(request.NewErrParamMinLen(\"Id\", 1))\n\t}\n\tif s.IndexId == nil {\n\t\tinvalidParams.Add(request.NewErrParamRequired(\"IndexId\"))\n\t}\n\tif s.IndexId != nil && len(*s.IndexId) < 36 {\n\t\tinvalidParams.Add(request.NewErrParamMinLen(\"IndexId\", 36))\n\t}\n\tif s.Personas == nil {\n\t\tinvalidParams.Add(request.NewErrParamRequired(\"Personas\"))\n\t}\n\tif s.Personas != nil && len(s.Personas) < 1 {\n\t\tinvalidParams.Add(request.NewErrParamMinLen(\"Personas\", 1))\n\t}\n\tif s.Personas != nil {\n\t\tfor i, v := range s.Personas {\n\t\t\tif v == nil {\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tif err := v.Validate(); err != nil {\n\t\t\t\tinvalidParams.AddNested(fmt.Sprintf(\"%s[%v]\", \"Personas\", i), err.(request.ErrInvalidParams))\n\t\t\t}\n\t\t}\n\t}\n\n\tif invalidParams.Len() > 0 {\n\t\treturn invalidParams\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "bcf031bd013e571524ad12598742ba27", "score": "0.56448317", "text": "func (v *Validator) validate(i interface{}) error {\n\tval := reflect.ValueOf(i)\n\tif val.Kind() == reflect.Ptr {\n\t\tval = reflect.Indirect(val)\n\t}\n\n\tif val.Kind() == reflect.Struct {\n\t\tfor i := 0; i < val.NumField(); i++ {\n\t\t\tfield := val.Field(i)\n\t\t\tswitch field.Kind() {\n\t\t\tcase reflect.Ptr, reflect.Struct:\n\t\t\t\tif field.CanInterface() {\n\t\t\t\t\tif err := v.validate(field.Interface()); err != nil {\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\t}\n\t}\n\n\tif val.Kind() == reflect.Struct {\n\t\treturn v.Validate(i)\n\t}\n\n\treturn nil\n\n}", "title": "" }, { "docid": "af9f3261e90a74377d93aa00702375f1", "score": "0.56411296", "text": "func (m *Large) Validate() error {\n\tif m == nil {\n\t\treturn nil\n\t}\n\n\tif val := m.GetField1(); val <= 0 || val > 10 {\n\t\treturn LargeValidationError{\n\t\t\tfield: \"Field1\",\n\t\t\treason: \"value must be inside range (0, 10]\",\n\t\t}\n\t}\n\n\tif val := m.GetField2(); val <= 0 || val > 10 {\n\t\treturn LargeValidationError{\n\t\t\tfield: \"Field2\",\n\t\t\treason: \"value must be inside range (0, 10]\",\n\t\t}\n\t}\n\n\tif val := m.GetField3(); val <= 0 || val > 10 {\n\t\treturn LargeValidationError{\n\t\t\tfield: \"Field3\",\n\t\t\treason: \"value must be inside range (0, 10]\",\n\t\t}\n\t}\n\n\tif val := m.GetField4(); val <= 0 || val > 10 {\n\t\treturn LargeValidationError{\n\t\t\tfield: \"Field4\",\n\t\t\treason: \"value must be inside range (0, 10]\",\n\t\t}\n\t}\n\n\tif val := m.GetField5(); val <= 0 || val > 10 {\n\t\treturn LargeValidationError{\n\t\t\tfield: \"Field5\",\n\t\t\treason: \"value must be inside range (0, 10]\",\n\t\t}\n\t}\n\n\tif val := m.GetField6(); val <= 10 || val > 50 {\n\t\treturn LargeValidationError{\n\t\t\tfield: \"Field6\",\n\t\t\treason: \"value must be inside range (10, 50]\",\n\t\t}\n\t}\n\n\tif val := m.GetField7(); val <= 10 || val > 50 {\n\t\treturn LargeValidationError{\n\t\t\tfield: \"Field7\",\n\t\t\treason: \"value must be inside range (10, 50]\",\n\t\t}\n\t}\n\n\tif val := m.GetField8(); val <= 10 || val > 50 {\n\t\treturn LargeValidationError{\n\t\t\tfield: \"Field8\",\n\t\t\treason: \"value must be inside range (10, 50]\",\n\t\t}\n\t}\n\n\tif val := m.GetField9(); val <= 10 || val > 50 {\n\t\treturn LargeValidationError{\n\t\t\tfield: \"Field9\",\n\t\t\treason: \"value must be inside range (10, 50]\",\n\t\t}\n\t}\n\n\tif val := m.GetField10(); val <= 10 || val > 50 {\n\t\treturn LargeValidationError{\n\t\t\tfield: \"Field10\",\n\t\t\treason: \"value must be inside range (10, 50]\",\n\t\t}\n\t}\n\n\tif val := m.GetField11(); val <= 5 || val > 15 {\n\t\treturn LargeValidationError{\n\t\t\tfield: \"Field11\",\n\t\t\treason: \"value must be inside range (5, 15]\",\n\t\t}\n\t}\n\n\tif val := m.GetField12(); val <= 5 || val > 15 {\n\t\treturn LargeValidationError{\n\t\t\tfield: \"Field12\",\n\t\t\treason: \"value must be inside range (5, 15]\",\n\t\t}\n\t}\n\n\tif val := m.GetField13(); val <= 5 || val > 15 {\n\t\treturn LargeValidationError{\n\t\t\tfield: \"Field13\",\n\t\t\treason: \"value must be inside range (5, 15]\",\n\t\t}\n\t}\n\n\tif val := m.GetField14(); val <= 5 || val > 15 {\n\t\treturn LargeValidationError{\n\t\t\tfield: \"Field14\",\n\t\t\treason: \"value must be inside range (5, 15]\",\n\t\t}\n\t}\n\n\tif val := m.GetField15(); val <= 5 || val > 15 {\n\t\treturn LargeValidationError{\n\t\t\tfield: \"Field15\",\n\t\t\treason: \"value must be inside range (5, 15]\",\n\t\t}\n\t}\n\n\tif val := m.GetField16(); val <= 5 || val > 100 {\n\t\treturn LargeValidationError{\n\t\t\tfield: \"Field16\",\n\t\t\treason: \"value must be inside range (5, 100]\",\n\t\t}\n\t}\n\n\tif val := m.GetField17(); val <= 5 || val > 100 {\n\t\treturn LargeValidationError{\n\t\t\tfield: \"Field17\",\n\t\t\treason: \"value must be inside range (5, 100]\",\n\t\t}\n\t}\n\n\tif val := m.GetField18(); val <= 5 || val > 100 {\n\t\treturn LargeValidationError{\n\t\t\tfield: \"Field18\",\n\t\t\treason: \"value must be inside range (5, 100]\",\n\t\t}\n\t}\n\n\tif val := m.GetField19(); val <= 5 || val > 100 {\n\t\treturn LargeValidationError{\n\t\t\tfield: \"Field19\",\n\t\t\treason: \"value must be inside range (5, 100]\",\n\t\t}\n\t}\n\n\tif val := m.GetField20(); val <= 5 || val > 100 {\n\t\treturn LargeValidationError{\n\t\t\tfield: \"Field20\",\n\t\t\treason: \"value must be inside range (5, 100]\",\n\t\t}\n\t}\n\n\tif val := m.GetField21(); val <= 5 || val > 100 {\n\t\treturn LargeValidationError{\n\t\t\tfield: \"Field21\",\n\t\t\treason: \"value must be inside range (5, 100]\",\n\t\t}\n\t}\n\n\tif val := m.GetField22(); val <= 5 || val > 100 {\n\t\treturn LargeValidationError{\n\t\t\tfield: \"Field22\",\n\t\t\treason: \"value must be inside range (5, 100]\",\n\t\t}\n\t}\n\n\tif val := m.GetField23(); val <= 5 || val > 100 {\n\t\treturn LargeValidationError{\n\t\t\tfield: \"Field23\",\n\t\t\treason: \"value must be inside range (5, 100]\",\n\t\t}\n\t}\n\n\tif val := m.GetField24(); val <= 5 || val > 100 {\n\t\treturn LargeValidationError{\n\t\t\tfield: \"Field24\",\n\t\t\treason: \"value must be inside range (5, 100]\",\n\t\t}\n\t}\n\n\tif val := m.GetField25(); val <= 5 || val > 100 {\n\t\treturn LargeValidationError{\n\t\t\tfield: \"Field25\",\n\t\t\treason: \"value must be inside range (5, 100]\",\n\t\t}\n\t}\n\n\tif val := m.GetField26(); val <= 5 || val > 100 {\n\t\treturn LargeValidationError{\n\t\t\tfield: \"Field26\",\n\t\t\treason: \"value must be inside range (5, 100]\",\n\t\t}\n\t}\n\n\tif val := m.GetField27(); val <= 5 || val > 100 {\n\t\treturn LargeValidationError{\n\t\t\tfield: \"Field27\",\n\t\t\treason: \"value must be inside range (5, 100]\",\n\t\t}\n\t}\n\n\tif val := m.GetField28(); val <= 5 || val > 100 {\n\t\treturn LargeValidationError{\n\t\t\tfield: \"Field28\",\n\t\t\treason: \"value must be inside range (5, 100]\",\n\t\t}\n\t}\n\n\tif val := m.GetField29(); val <= 5 || val > 100 {\n\t\treturn LargeValidationError{\n\t\t\tfield: \"Field29\",\n\t\t\treason: \"value must be inside range (5, 100]\",\n\t\t}\n\t}\n\n\tif val := m.GetField30(); val <= 5 || val > 100 {\n\t\treturn LargeValidationError{\n\t\t\tfield: \"Field30\",\n\t\t\treason: \"value must be inside range (5, 100]\",\n\t\t}\n\t}\n\n\tif val := m.GetField31(); val <= 20 || val > 2500000000 {\n\t\treturn LargeValidationError{\n\t\t\tfield: \"Field31\",\n\t\t\treason: \"value must be inside range (20, 2500000000]\",\n\t\t}\n\t}\n\n\tif val := m.GetField32(); val <= 20 || val > 2500000000 {\n\t\treturn LargeValidationError{\n\t\t\tfield: \"Field32\",\n\t\t\treason: \"value must be inside range (20, 2500000000]\",\n\t\t}\n\t}\n\n\tif val := m.GetField33(); val <= 20 || val > 2500000000 {\n\t\treturn LargeValidationError{\n\t\t\tfield: \"Field33\",\n\t\t\treason: \"value must be inside range (20, 2500000000]\",\n\t\t}\n\t}\n\n\tif val := m.GetField34(); val <= 20 || val > 2500000000 {\n\t\treturn LargeValidationError{\n\t\t\tfield: \"Field34\",\n\t\t\treason: \"value must be inside range (20, 2500000000]\",\n\t\t}\n\t}\n\n\tif val := m.GetField35(); val <= 20 || val > 2500000000 {\n\t\treturn LargeValidationError{\n\t\t\tfield: \"Field35\",\n\t\t\treason: \"value must be inside range (20, 2500000000]\",\n\t\t}\n\t}\n\n\tif val := m.GetField36(); val <= 20 || val > 2500000000 {\n\t\treturn LargeValidationError{\n\t\t\tfield: \"Field36\",\n\t\t\treason: \"value must be inside range (20, 2500000000]\",\n\t\t}\n\t}\n\n\tif val := m.GetField37(); val <= 20 || val > 2500000000 {\n\t\treturn LargeValidationError{\n\t\t\tfield: \"Field37\",\n\t\t\treason: \"value must be inside range (20, 2500000000]\",\n\t\t}\n\t}\n\n\tif val := m.GetField38(); val <= 20 || val > 2500000000 {\n\t\treturn LargeValidationError{\n\t\t\tfield: \"Field38\",\n\t\t\treason: \"value must be inside range (20, 2500000000]\",\n\t\t}\n\t}\n\n\tif val := m.GetField39(); val <= 20 || val > 2500000000 {\n\t\treturn LargeValidationError{\n\t\t\tfield: \"Field39\",\n\t\t\treason: \"value must be inside range (20, 2500000000]\",\n\t\t}\n\t}\n\n\tif val := m.GetField40(); val <= 20 || val > 2500000000 {\n\t\treturn LargeValidationError{\n\t\t\tfield: \"Field40\",\n\t\t\treason: \"value must be inside range (20, 2500000000]\",\n\t\t}\n\t}\n\n\tif v, ok := interface{}(m.GetField41()).(interface{ Validate() error }); ok {\n\t\tif err := v.Validate(); err != nil {\n\t\t\treturn LargeValidationError{\n\t\t\t\tfield: \"Field41\",\n\t\t\t\treason: \"embedded message failed validation\",\n\t\t\t\tcause: err,\n\t\t\t}\n\t\t}\n\t}\n\n\tif v, ok := interface{}(m.GetField42()).(interface{ Validate() error }); ok {\n\t\tif err := v.Validate(); err != nil {\n\t\t\treturn LargeValidationError{\n\t\t\t\tfield: \"Field42\",\n\t\t\t\treason: \"embedded message failed validation\",\n\t\t\t\tcause: err,\n\t\t\t}\n\t\t}\n\t}\n\n\tif v, ok := interface{}(m.GetField43()).(interface{ Validate() error }); ok {\n\t\tif err := v.Validate(); err != nil {\n\t\t\treturn LargeValidationError{\n\t\t\t\tfield: \"Field43\",\n\t\t\t\treason: \"embedded message failed validation\",\n\t\t\t\tcause: err,\n\t\t\t}\n\t\t}\n\t}\n\n\tif v, ok := interface{}(m.GetField44()).(interface{ Validate() error }); ok {\n\t\tif err := v.Validate(); err != nil {\n\t\t\treturn LargeValidationError{\n\t\t\t\tfield: \"Field44\",\n\t\t\t\treason: \"embedded message failed validation\",\n\t\t\t\tcause: err,\n\t\t\t}\n\t\t}\n\t}\n\n\tif v, ok := interface{}(m.GetField45()).(interface{ Validate() error }); ok {\n\t\tif err := v.Validate(); err != nil {\n\t\t\treturn LargeValidationError{\n\t\t\t\tfield: \"Field45\",\n\t\t\t\treason: \"embedded message failed validation\",\n\t\t\t\tcause: err,\n\t\t\t}\n\t\t}\n\t}\n\n\tif v, ok := interface{}(m.GetField46()).(interface{ Validate() error }); ok {\n\t\tif err := v.Validate(); err != nil {\n\t\t\treturn LargeValidationError{\n\t\t\t\tfield: \"Field46\",\n\t\t\t\treason: \"embedded message failed validation\",\n\t\t\t\tcause: err,\n\t\t\t}\n\t\t}\n\t}\n\n\tif v, ok := interface{}(m.GetField47()).(interface{ Validate() error }); ok {\n\t\tif err := v.Validate(); err != nil {\n\t\t\treturn LargeValidationError{\n\t\t\t\tfield: \"Field47\",\n\t\t\t\treason: \"embedded message failed validation\",\n\t\t\t\tcause: err,\n\t\t\t}\n\t\t}\n\t}\n\n\tif v, ok := interface{}(m.GetField48()).(interface{ Validate() error }); ok {\n\t\tif err := v.Validate(); err != nil {\n\t\t\treturn LargeValidationError{\n\t\t\t\tfield: \"Field48\",\n\t\t\t\treason: \"embedded message failed validation\",\n\t\t\t\tcause: err,\n\t\t\t}\n\t\t}\n\t}\n\n\tif v, ok := interface{}(m.GetField49()).(interface{ Validate() error }); ok {\n\t\tif err := v.Validate(); err != nil {\n\t\t\treturn LargeValidationError{\n\t\t\t\tfield: \"Field49\",\n\t\t\t\treason: \"embedded message failed validation\",\n\t\t\t\tcause: err,\n\t\t\t}\n\t\t}\n\t}\n\n\tif v, ok := interface{}(m.GetField50()).(interface{ Validate() error }); ok {\n\t\tif err := v.Validate(); err != nil {\n\t\t\treturn LargeValidationError{\n\t\t\t\tfield: \"Field50\",\n\t\t\t\treason: \"embedded message failed validation\",\n\t\t\t\tcause: err,\n\t\t\t}\n\t\t}\n\t}\n\n\tif len(m.GetField51()) > 10 {\n\t\treturn LargeValidationError{\n\t\t\tfield: \"Field51\",\n\t\t\treason: \"value length must be at most 10 bytes\",\n\t\t}\n\t}\n\n\tif len(m.GetField52()) > 20 {\n\t\treturn LargeValidationError{\n\t\t\tfield: \"Field52\",\n\t\t\treason: \"value length must be at most 20 bytes\",\n\t\t}\n\t}\n\n\tif len(m.GetField53()) > 30 {\n\t\treturn LargeValidationError{\n\t\t\tfield: \"Field53\",\n\t\t\treason: \"value length must be at most 30 bytes\",\n\t\t}\n\t}\n\n\tif len(m.GetField54()) > 40 {\n\t\treturn LargeValidationError{\n\t\t\tfield: \"Field54\",\n\t\t\treason: \"value length must be at most 40 bytes\",\n\t\t}\n\t}\n\n\tif len(m.GetField55()) > 50 {\n\t\treturn LargeValidationError{\n\t\t\tfield: \"Field55\",\n\t\t\treason: \"value length must be at most 50 bytes\",\n\t\t}\n\t}\n\n\tif v, ok := interface{}(m.GetField61()).(interface{ Validate() error }); ok {\n\t\tif err := v.Validate(); err != nil {\n\t\t\treturn LargeValidationError{\n\t\t\t\tfield: \"Field61\",\n\t\t\t\treason: \"embedded message failed validation\",\n\t\t\t\tcause: err,\n\t\t\t}\n\t\t}\n\t}\n\n\tif v, ok := interface{}(m.GetField62()).(interface{ Validate() error }); ok {\n\t\tif err := v.Validate(); err != nil {\n\t\t\treturn LargeValidationError{\n\t\t\t\tfield: \"Field62\",\n\t\t\t\treason: \"embedded message failed validation\",\n\t\t\t\tcause: err,\n\t\t\t}\n\t\t}\n\t}\n\n\tif v, ok := interface{}(m.GetField63()).(interface{ Validate() error }); ok {\n\t\tif err := v.Validate(); err != nil {\n\t\t\treturn LargeValidationError{\n\t\t\t\tfield: \"Field63\",\n\t\t\t\treason: \"embedded message failed validation\",\n\t\t\t\tcause: err,\n\t\t\t}\n\t\t}\n\t}\n\n\tif v, ok := interface{}(m.GetField64()).(interface{ Validate() error }); ok {\n\t\tif err := v.Validate(); err != nil {\n\t\t\treturn LargeValidationError{\n\t\t\t\tfield: \"Field64\",\n\t\t\t\treason: \"embedded message failed validation\",\n\t\t\t\tcause: err,\n\t\t\t}\n\t\t}\n\t}\n\n\tif v, ok := interface{}(m.GetField65()).(interface{ Validate() error }); ok {\n\t\tif err := v.Validate(); err != nil {\n\t\t\treturn LargeValidationError{\n\t\t\t\tfield: \"Field65\",\n\t\t\t\treason: \"embedded message failed validation\",\n\t\t\t\tcause: err,\n\t\t\t}\n\t\t}\n\t}\n\n\tif v, ok := interface{}(m.GetField66()).(interface{ Validate() error }); ok {\n\t\tif err := v.Validate(); err != nil {\n\t\t\treturn LargeValidationError{\n\t\t\t\tfield: \"Field66\",\n\t\t\t\treason: \"embedded message failed validation\",\n\t\t\t\tcause: err,\n\t\t\t}\n\t\t}\n\t}\n\n\tif v, ok := interface{}(m.GetField67()).(interface{ Validate() error }); ok {\n\t\tif err := v.Validate(); err != nil {\n\t\t\treturn LargeValidationError{\n\t\t\t\tfield: \"Field67\",\n\t\t\t\treason: \"embedded message failed validation\",\n\t\t\t\tcause: err,\n\t\t\t}\n\t\t}\n\t}\n\n\tif v, ok := interface{}(m.GetField68()).(interface{ Validate() error }); ok {\n\t\tif err := v.Validate(); err != nil {\n\t\t\treturn LargeValidationError{\n\t\t\t\tfield: \"Field68\",\n\t\t\t\treason: \"embedded message failed validation\",\n\t\t\t\tcause: err,\n\t\t\t}\n\t\t}\n\t}\n\n\tif v, ok := interface{}(m.GetField69()).(interface{ Validate() error }); ok {\n\t\tif err := v.Validate(); err != nil {\n\t\t\treturn LargeValidationError{\n\t\t\t\tfield: \"Field69\",\n\t\t\t\treason: \"embedded message failed validation\",\n\t\t\t\tcause: err,\n\t\t\t}\n\t\t}\n\t}\n\n\tif v, ok := interface{}(m.GetField70()).(interface{ Validate() error }); ok {\n\t\tif err := v.Validate(); err != nil {\n\t\t\treturn LargeValidationError{\n\t\t\t\tfield: \"Field70\",\n\t\t\t\treason: \"embedded message failed validation\",\n\t\t\t\tcause: err,\n\t\t\t}\n\t\t}\n\t}\n\n\tif val := m.GetField101(); val <= -100 || val > 100 {\n\t\treturn LargeValidationError{\n\t\t\tfield: \"Field101\",\n\t\t\treason: \"value must be inside range (-100, 100]\",\n\t\t}\n\t}\n\n\tif val := m.GetField102(); val <= -100 || val > 100 {\n\t\treturn LargeValidationError{\n\t\t\tfield: \"Field102\",\n\t\t\treason: \"value must be inside range (-100, 100]\",\n\t\t}\n\t}\n\n\tif val := m.GetField103(); val <= -100 || val > 100 {\n\t\treturn LargeValidationError{\n\t\t\tfield: \"Field103\",\n\t\t\treason: \"value must be inside range (-100, 100]\",\n\t\t}\n\t}\n\n\tif val := m.GetField104(); val <= -100 || val > 100 {\n\t\treturn LargeValidationError{\n\t\t\tfield: \"Field104\",\n\t\t\treason: \"value must be inside range (-100, 100]\",\n\t\t}\n\t}\n\n\tif val := m.GetField105(); val <= -100 || val > 100 {\n\t\treturn LargeValidationError{\n\t\t\tfield: \"Field105\",\n\t\t\treason: \"value must be inside range (-100, 100]\",\n\t\t}\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "d1d2389348fbf1aff094187f5b0acdc6", "score": "0.56297004", "text": "func (account *Account) ValidateFields() error {\n\tswitch {\n\tcase account.Name == \"\":\n\t\treturn tryerr.ErrInvalidName\n\tcase account.Email == \"\":\n\t\treturn tryerr.ErrInvalidEmail\n\tcase len(account.Name) == 0 || len(account.Name) > 256:\n\t\treturn tryerr.ErrInvalidName\n\tcase len(account.Email) == 0 || len(account.Email) > 256 || RegexpEmail.MatchString(account.Email) == false:\n\t\treturn tryerr.ErrInvalidEmail\n\tdefault:\n\t\treturn nil\n\t}\n}", "title": "" }, { "docid": "c002f306ad4618faf42d45dc37fc3e66", "score": "0.56288177", "text": "func (s *CreateHITWithHITTypeInput) Validate() error {\n\tinvalidParams := request.ErrInvalidParams{Context: \"CreateHITWithHITTypeInput\"}\n\tif s.HITLayoutId != nil && len(*s.HITLayoutId) < 1 {\n\t\tinvalidParams.Add(request.NewErrParamMinLen(\"HITLayoutId\", 1))\n\t}\n\tif s.HITTypeId == nil {\n\t\tinvalidParams.Add(request.NewErrParamRequired(\"HITTypeId\"))\n\t}\n\tif s.HITTypeId != nil && len(*s.HITTypeId) < 1 {\n\t\tinvalidParams.Add(request.NewErrParamMinLen(\"HITTypeId\", 1))\n\t}\n\tif s.LifetimeInSeconds == nil {\n\t\tinvalidParams.Add(request.NewErrParamRequired(\"LifetimeInSeconds\"))\n\t}\n\tif s.UniqueRequestToken != nil && len(*s.UniqueRequestToken) < 1 {\n\t\tinvalidParams.Add(request.NewErrParamMinLen(\"UniqueRequestToken\", 1))\n\t}\n\tif s.AssignmentReviewPolicy != nil {\n\t\tif err := s.AssignmentReviewPolicy.Validate(); err != nil {\n\t\t\tinvalidParams.AddNested(\"AssignmentReviewPolicy\", err.(request.ErrInvalidParams))\n\t\t}\n\t}\n\tif s.HITLayoutParameters != nil {\n\t\tfor i, v := range s.HITLayoutParameters {\n\t\t\tif v == nil {\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tif err := v.Validate(); err != nil {\n\t\t\t\tinvalidParams.AddNested(fmt.Sprintf(\"%s[%v]\", \"HITLayoutParameters\", i), err.(request.ErrInvalidParams))\n\t\t\t}\n\t\t}\n\t}\n\tif s.HITReviewPolicy != nil {\n\t\tif err := s.HITReviewPolicy.Validate(); err != nil {\n\t\t\tinvalidParams.AddNested(\"HITReviewPolicy\", err.(request.ErrInvalidParams))\n\t\t}\n\t}\n\n\tif invalidParams.Len() > 0 {\n\t\treturn invalidParams\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "f929f260a853e88dc7b8a7fc00e93221", "score": "0.562607", "text": "func (m *ObjectTypeDefinition) Validate(formats strfmt.Registry) error {\n\treturn nil\n}", "title": "" }, { "docid": "635bc7a286c7bffdd5e113e7a0020bb1", "score": "0.562406", "text": "func (m *Member) Validate(formats strfmt.Registry) error {\n\tvar res []error\n\n\tif err := m.validateArea(formats); err != nil {\n\t\t// prop\n\t\tres = append(res, err)\n\t}\n\n\tif err := m.validateAvatar(formats); err != nil {\n\t\t// prop\n\t\tres = append(res, err)\n\t}\n\n\tif err := m.validateBirth(formats); err != nil {\n\t\t// prop\n\t\tres = append(res, err)\n\t}\n\n\tif err := m.validateGender(formats); err != nil {\n\t\t// prop\n\t\tres = append(res, err)\n\t}\n\n\tif err := m.validateGrade(formats); err != nil {\n\t\t// prop\n\t\tres = append(res, err)\n\t}\n\n\tif err := m.validateID(formats); err != nil {\n\t\t// prop\n\t\tres = append(res, err)\n\t}\n\n\tif err := m.validateLevel(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 err := m.validatePhone(formats); err != nil {\n\t\t// prop\n\t\tres = append(res, err)\n\t}\n\n\tif err := m.validateTags(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}", "title": "" }, { "docid": "920558e6b1f71ed5de14d425efd147de", "score": "0.56222", "text": "func (ContactStrategy) Validate(ctx context.Context, obj runtime.Object) field.ErrorList {\n\to := obj.(*Contact)\n\tklog.V(5).Infof(\"Validating fields for Contact %s\", o.Name)\n\terrors := field.ErrorList{}\n\t// perform validation here and add to errors using field.Invalid\n\treturn errors\n}", "title": "" }, { "docid": "bfac200e7f51ec9a5730dfe37878e1e8", "score": "0.5621101", "text": "func (n *NamesMatch) Validate(t *types.Type) ([]string, error) {\n\tfields := make([]string, 0)\n\n\t// Only validate struct type and ignore the rest\n\tswitch t.Kind {\n\tcase types.Struct:\n\t\tfor _, m := range t.Members {\n\t\t\tgoName := m.Name\n\t\t\tjsonTag, ok := reflect.StructTag(m.Tags).Lookup(\"json\")\n\t\t\t// Distinguish empty JSON tag and missing JSON tag. Empty JSON tag / name is\n\t\t\t// allowed (in JSON name blacklist) but missing JSON tag is invalid.\n\t\t\tif !ok {\n\t\t\t\tfields = append(fields, goName)\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tif jsonTagBlacklist.Has(jsonTag) {\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tjsonName := strings.Split(jsonTag, \",\")[0]\n\t\t\tif !namesMatch(goName, jsonName) {\n\t\t\t\tfields = append(fields, goName)\n\t\t\t}\n\t\t}\n\t}\n\treturn fields, nil\n}", "title": "" }, { "docid": "d01dcd4ed56c79f73f8f92467e6ab0ee", "score": "0.5617318", "text": "func (k *Kalivent) Validate(tx *pop.Connection) (*validate.Errors, error) {\n\treturn validate.Validate(\n\t\t&validators.IntIsPresent{Field: k.UserID, Name: \"UserID\"},\n\t\t&validators.TimeIsPresent{Field: k.Date, Name: \"Date\"},\n\t\t&validators.StringIsPresent{Field: k.Type, Name: \"Type\"},\n\t), nil\n}", "title": "" }, { "docid": "7bccc89a8af2020a5ad7dd24ebfea2ac", "score": "0.56093866", "text": "func (m CollectionField) Validate() error {\n\tif err := m.metaInit(); err != nil {\n\t\treturn err\n\t}\n\n\treturn validation.ValidateStruct(&m,\n\t\tvalidation.Field(&m.Key, validation.Required, validation.Length(1, 255), validation.Match(regexp.MustCompile(`^\\w+$`))),\n\t\tvalidation.Field(&m.Label, validation.Required, validation.Length(1, 255)),\n\t\tvalidation.Field(&m.Type, validation.Required, validation.In(\n\t\t\tFieldTypePlain,\n\t\t\tFieldTypeSwitch,\n\t\t\tFieldTypeChecklist,\n\t\t\tFieldTypeSelect,\n\t\t\tFieldTypeDate,\n\t\t\tFieldTypeEditor,\n\t\t\tFieldTypeMedia,\n\t\t\tFieldTypeRelation,\n\t\t)),\n\t\tvalidation.Field(&m.Meta),\n\t)\n}", "title": "" }, { "docid": "0c3245d682356f40077d2e8f7eb99707", "score": "0.5606525", "text": "func (s *ActivateTypeInput) Validate() error {\n\tinvalidParams := request.ErrInvalidParams{Context: \"ActivateTypeInput\"}\n\tif s.ExecutionRoleArn != nil && len(*s.ExecutionRoleArn) < 1 {\n\t\tinvalidParams.Add(request.NewErrParamMinLen(\"ExecutionRoleArn\", 1))\n\t}\n\tif s.MajorVersion != nil && *s.MajorVersion < 1 {\n\t\tinvalidParams.Add(request.NewErrParamMinValue(\"MajorVersion\", 1))\n\t}\n\tif s.PublisherId != nil && len(*s.PublisherId) < 1 {\n\t\tinvalidParams.Add(request.NewErrParamMinLen(\"PublisherId\", 1))\n\t}\n\tif s.TypeName != nil && len(*s.TypeName) < 10 {\n\t\tinvalidParams.Add(request.NewErrParamMinLen(\"TypeName\", 10))\n\t}\n\tif s.TypeNameAlias != nil && len(*s.TypeNameAlias) < 10 {\n\t\tinvalidParams.Add(request.NewErrParamMinLen(\"TypeNameAlias\", 10))\n\t}\n\tif s.LoggingConfig != nil {\n\t\tif err := s.LoggingConfig.Validate(); err != nil {\n\t\t\tinvalidParams.AddNested(\"LoggingConfig\", err.(request.ErrInvalidParams))\n\t\t}\n\t}\n\n\tif invalidParams.Len() > 0 {\n\t\treturn invalidParams\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "9380e9286eb9fe5b8105aaa2ed1a36b1", "score": "0.5598765", "text": "func (p Params) Validate() error {\n\tif err := validateUnbondingTime(p.UnbondingTime); err != nil {\n\t\treturn err\n\t}\n\n\tif err := validateMaxValidators(p.MaxValidators); err != nil {\n\t\treturn err\n\t}\n\n\tif err := validateMaxEntries(p.MaxEntries); err != nil {\n\t\treturn err\n\t}\n\n\tif err := validateBondDenom(p.BondDenom); err != nil {\n\t\treturn err\n\t}\n\n\tif err := validateMinCommissionRate(p.MinCommissionRate); err != nil {\n\t\treturn err\n\t}\n\n\tif err := validateHistoricalEntries(p.HistoricalEntries); err != nil {\n\t\treturn err\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "db3be61fff37d53b20485323f3c99918", "score": "0.5597098", "text": "func Validate() error {\n\treturn def.Validate()\n}", "title": "" }, { "docid": "720dd58b684e3475aa7e2eaa35c304d8", "score": "0.55900306", "text": "func (s *CreateMembersInput) Validate() error {\n\tinvalidParams := request.ErrInvalidParams{Context: \"CreateMembersInput\"}\n\tif s.AccountDetails == nil {\n\t\tinvalidParams.Add(request.NewErrParamRequired(\"AccountDetails\"))\n\t}\n\tif s.AccountDetails != nil && len(s.AccountDetails) < 1 {\n\t\tinvalidParams.Add(request.NewErrParamMinLen(\"AccountDetails\", 1))\n\t}\n\tif s.DetectorId == nil {\n\t\tinvalidParams.Add(request.NewErrParamRequired(\"DetectorId\"))\n\t}\n\tif s.DetectorId != nil && len(*s.DetectorId) < 1 {\n\t\tinvalidParams.Add(request.NewErrParamMinLen(\"DetectorId\", 1))\n\t}\n\tif s.AccountDetails != nil {\n\t\tfor i, v := range s.AccountDetails {\n\t\t\tif v == nil {\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tif err := v.Validate(); err != nil {\n\t\t\t\tinvalidParams.AddNested(fmt.Sprintf(\"%s[%v]\", \"AccountDetails\", i), err.(request.ErrInvalidParams))\n\t\t\t}\n\t\t}\n\t}\n\n\tif invalidParams.Len() > 0 {\n\t\treturn invalidParams\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "bab10aa4205265ca4248a64d6aa85b8d", "score": "0.5588028", "text": "func (s *PutPrincipalMappingInput) Validate() error {\n\tinvalidParams := request.ErrInvalidParams{Context: \"PutPrincipalMappingInput\"}\n\tif s.DataSourceId != nil && len(*s.DataSourceId) < 1 {\n\t\tinvalidParams.Add(request.NewErrParamMinLen(\"DataSourceId\", 1))\n\t}\n\tif s.GroupId == nil {\n\t\tinvalidParams.Add(request.NewErrParamRequired(\"GroupId\"))\n\t}\n\tif s.GroupId != nil && len(*s.GroupId) < 1 {\n\t\tinvalidParams.Add(request.NewErrParamMinLen(\"GroupId\", 1))\n\t}\n\tif s.GroupMembers == nil {\n\t\tinvalidParams.Add(request.NewErrParamRequired(\"GroupMembers\"))\n\t}\n\tif s.IndexId == nil {\n\t\tinvalidParams.Add(request.NewErrParamRequired(\"IndexId\"))\n\t}\n\tif s.IndexId != nil && len(*s.IndexId) < 36 {\n\t\tinvalidParams.Add(request.NewErrParamMinLen(\"IndexId\", 36))\n\t}\n\tif s.GroupMembers != nil {\n\t\tif err := s.GroupMembers.Validate(); err != nil {\n\t\t\tinvalidParams.AddNested(\"GroupMembers\", err.(request.ErrInvalidParams))\n\t\t}\n\t}\n\n\tif invalidParams.Len() > 0 {\n\t\treturn invalidParams\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "283e845c78b5fcc2403c72ca9ab4b3a6", "score": "0.5587394", "text": "func (cv *Validator) Validate(i interface{}) error {\n\treturn cv.validator.Struct(i)\n}", "title": "" }, { "docid": "283e845c78b5fcc2403c72ca9ab4b3a6", "score": "0.5587394", "text": "func (cv *Validator) Validate(i interface{}) error {\n\treturn cv.validator.Struct(i)\n}", "title": "" }, { "docid": "1a6cc67a2f17dc28d77b50f332e857f7", "score": "0.5584163", "text": "func (m *SimulateMetadataParams) ValidateFields(paths ...string) error {\n\tif m == nil {\n\t\treturn nil\n\t}\n\n\tif len(paths) == 0 {\n\t\tpaths = SimulateMetadataParamsFieldPathsNested\n\t}\n\n\tfor name, subs := range _processPaths(append(paths[:0:0], paths...)) {\n\t\t_ = subs\n\t\tswitch name {\n\t\tcase \"rssi\":\n\t\t\t// no validation rules for Rssi\n\t\tcase \"snr\":\n\t\t\t// no validation rules for Snr\n\t\tcase \"timestamp\":\n\t\t\t// no validation rules for Timestamp\n\t\tcase \"time\":\n\n\t\t\tif v, ok := interface{}(m.GetTime()).(interface{ ValidateFields(...string) error }); ok {\n\t\t\t\tif err := v.ValidateFields(subs...); err != nil {\n\t\t\t\t\treturn SimulateMetadataParamsValidationError{\n\t\t\t\t\t\tfield: \"time\",\n\t\t\t\t\t\treason: \"embedded message failed validation\",\n\t\t\t\t\t\tcause: err,\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\n\t\tcase \"lorawan_version\":\n\t\t\t// no validation rules for LorawanVersion\n\t\tcase \"lorawan_phy_version\":\n\t\t\t// no validation rules for LorawanPhyVersion\n\t\tcase \"band_id\":\n\t\t\t// no validation rules for BandId\n\t\tcase \"frequency\":\n\t\t\t// no validation rules for Frequency\n\t\tcase \"channel_index\":\n\t\t\t// no validation rules for ChannelIndex\n\t\tcase \"bandwidth\":\n\t\t\t// no validation rules for Bandwidth\n\t\tcase \"spreading_factor\":\n\t\t\t// no validation rules for SpreadingFactor\n\t\tcase \"data_rate_index\":\n\t\t\t// no validation rules for DataRateIndex\n\t\tdefault:\n\t\t\treturn SimulateMetadataParamsValidationError{\n\t\t\t\tfield: name,\n\t\t\t\treason: \"invalid field path\",\n\t\t\t}\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "01a9b7f462447c29e9655588382cd7a9", "score": "0.55808777", "text": "func (m *WritableCustomField) Validate(formats strfmt.Registry) error {\n\tvar res []error\n\n\tif err := m.validateChoices(formats); err != nil {\n\t\tres = append(res, err)\n\t}\n\n\tif err := m.validateContentTypes(formats); err != nil {\n\t\tres = append(res, err)\n\t}\n\n\tif err := m.validateDescription(formats); err != nil {\n\t\tres = append(res, err)\n\t}\n\n\tif err := m.validateFilterLogic(formats); err != nil {\n\t\tres = append(res, err)\n\t}\n\n\tif err := m.validateLabel(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.validateType(formats); err != nil {\n\t\tres = append(res, err)\n\t}\n\n\tif err := m.validateURL(formats); err != nil {\n\t\tres = append(res, err)\n\t}\n\n\tif err := m.validateValidationMaximum(formats); err != nil {\n\t\tres = append(res, err)\n\t}\n\n\tif err := m.validateValidationMinimum(formats); err != nil {\n\t\tres = append(res, err)\n\t}\n\n\tif err := m.validateValidationRegex(formats); err != nil {\n\t\tres = append(res, err)\n\t}\n\n\tif err := m.validateWeight(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}", "title": "" }, { "docid": "5c34548bfa5c7d41335d550455e03a4b", "score": "0.5575236", "text": "func (m *Info) Validate() error {\n\treturn m.validate(false)\n}", "title": "" }, { "docid": "efac24fe5cd69e0868ba203f78b73a8d", "score": "0.55750287", "text": "func (v *Validator) Validate(i interface{}) error {\n\treturn v.Validator.Struct(i)\n}", "title": "" }, { "docid": "90dc41e0a2c45e2761f331dfc1cd389d", "score": "0.55708987", "text": "func (v Verify) Validate() error {\n\treturn validation.ValidateStruct(&v,\n\t\tvalidation.Field(&v.Otp, validation.Required, validation.Length(6, 6).Error(\"Sorry that is not a valid OTP\")),\n\t)\n}", "title": "" }, { "docid": "c47e8b4dfa3f92dee571d2b0800afce2", "score": "0.5570076", "text": "func (ut *UpdateUserPayload) Validate() (err error) {\n\tif ut.Name == \"\" {\n\t\terr = goa.MergeErrors(err, goa.MissingAttributeError(`type`, \"name\"))\n\t}\n\tif ut.Email == \"\" {\n\t\terr = goa.MergeErrors(err, goa.MissingAttributeError(`type`, \"email\"))\n\t}\n\tif ut.Bio == \"\" {\n\t\terr = goa.MergeErrors(err, goa.MissingAttributeError(`type`, \"bio\"))\n\t}\n\tif err2 := goa.ValidateFormat(goa.FormatEmail, ut.Email); err2 != nil {\n\t\terr = goa.MergeErrors(err, goa.InvalidFormatError(`type.email`, ut.Email, goa.FormatEmail, err2))\n\t}\n\tif ok := goa.ValidatePattern(`\\S`, ut.Name); !ok {\n\t\terr = goa.MergeErrors(err, goa.InvalidPatternError(`type.name`, ut.Name, `\\S`))\n\t}\n\tif utf8.RuneCountInString(ut.Name) > 256 {\n\t\terr = goa.MergeErrors(err, goa.InvalidLengthError(`type.name`, ut.Name, utf8.RuneCountInString(ut.Name), 256, false))\n\t}\n\treturn\n}", "title": "" }, { "docid": "9853c5f4fc45b3a56887bb998545e091", "score": "0.556781", "text": "func (ut *UserPayload) Validate() (err error) {\n\tif ut.Name == \"\" {\n\t\terr = goa.MergeErrors(err, goa.MissingAttributeError(`type`, \"name\"))\n\t}\n\tif ut.Email == \"\" {\n\t\terr = goa.MergeErrors(err, goa.MissingAttributeError(`type`, \"email\"))\n\t}\n\tif ut.City == \"\" {\n\t\terr = goa.MergeErrors(err, goa.MissingAttributeError(`type`, \"city\"))\n\t}\n\treturn\n}", "title": "" }, { "docid": "4ce70e70eaeeffb839977f3731abfb3c", "score": "0.55655897", "text": "func Validate(src interface{}) error {\n\treturn validate.Struct(src)\n}", "title": "" }, { "docid": "bde3c2a387d1c1420fd2e6e5abd29660", "score": "0.5563085", "text": "func (s *QueryInput) Validate() error {\n\tinvalidParams := request.ErrInvalidParams{Context: \"QueryInput\"}\n\tif s.IndexId == nil {\n\t\tinvalidParams.Add(request.NewErrParamRequired(\"IndexId\"))\n\t}\n\tif s.IndexId != nil && len(*s.IndexId) < 36 {\n\t\tinvalidParams.Add(request.NewErrParamMinLen(\"IndexId\", 36))\n\t}\n\tif s.RequestedDocumentAttributes != nil && len(s.RequestedDocumentAttributes) < 1 {\n\t\tinvalidParams.Add(request.NewErrParamMinLen(\"RequestedDocumentAttributes\", 1))\n\t}\n\tif s.VisitorId != nil && len(*s.VisitorId) < 1 {\n\t\tinvalidParams.Add(request.NewErrParamMinLen(\"VisitorId\", 1))\n\t}\n\tif s.AttributeFilter != nil {\n\t\tif err := s.AttributeFilter.Validate(); err != nil {\n\t\t\tinvalidParams.AddNested(\"AttributeFilter\", err.(request.ErrInvalidParams))\n\t\t}\n\t}\n\tif s.DocumentRelevanceOverrideConfigurations != nil {\n\t\tfor i, v := range s.DocumentRelevanceOverrideConfigurations {\n\t\t\tif v == nil {\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tif err := v.Validate(); err != nil {\n\t\t\t\tinvalidParams.AddNested(fmt.Sprintf(\"%s[%v]\", \"DocumentRelevanceOverrideConfigurations\", i), err.(request.ErrInvalidParams))\n\t\t\t}\n\t\t}\n\t}\n\tif s.Facets != nil {\n\t\tfor i, v := range s.Facets {\n\t\t\tif v == nil {\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tif err := v.Validate(); err != nil {\n\t\t\t\tinvalidParams.AddNested(fmt.Sprintf(\"%s[%v]\", \"Facets\", i), err.(request.ErrInvalidParams))\n\t\t\t}\n\t\t}\n\t}\n\tif s.SortingConfiguration != nil {\n\t\tif err := s.SortingConfiguration.Validate(); err != nil {\n\t\t\tinvalidParams.AddNested(\"SortingConfiguration\", err.(request.ErrInvalidParams))\n\t\t}\n\t}\n\tif s.SpellCorrectionConfiguration != nil {\n\t\tif err := s.SpellCorrectionConfiguration.Validate(); err != nil {\n\t\t\tinvalidParams.AddNested(\"SpellCorrectionConfiguration\", err.(request.ErrInvalidParams))\n\t\t}\n\t}\n\tif s.UserContext != nil {\n\t\tif err := s.UserContext.Validate(); err != nil {\n\t\t\tinvalidParams.AddNested(\"UserContext\", err.(request.ErrInvalidParams))\n\t\t}\n\t}\n\n\tif invalidParams.Len() > 0 {\n\t\treturn invalidParams\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "8002c6a2a778e2fa1f4c03ade575ee8c", "score": "0.5559609", "text": "func (m *ProcessWorkItemTypeField) Validate(formats strfmt.Registry) error {\n\treturn nil\n}", "title": "" }, { "docid": "172995aadd4575aedf4884ece64f5762", "score": "0.5558009", "text": "func (payload *updateCarrierAccountPayload) Validate() (err error) {\n\tif payload.Type == nil {\n\t\terr = goa.MergeErrors(err, goa.MissingAttributeError(`raw`, \"type\"))\n\t}\n\n\treturn\n}", "title": "" }, { "docid": "2f418c067c9f03f53242617e97b424b3", "score": "0.55568945", "text": "func (r *RouteSpec) Validate(ctx context.Context) (errs *apis.FieldError) {\n\t// don't include a ViaField because the field is embedded\n\treturn errs.Also(r.RouteSpecFields.Validate(ctx))\n}", "title": "" }, { "docid": "c0d505d2c47fbc76977ffa4d075f4d14", "score": "0.55539465", "text": "func (s *SalesforceCustomKnowledgeArticleTypeConfiguration) Validate() error {\n\tinvalidParams := request.ErrInvalidParams{Context: \"SalesforceCustomKnowledgeArticleTypeConfiguration\"}\n\tif s.DocumentDataFieldName == nil {\n\t\tinvalidParams.Add(request.NewErrParamRequired(\"DocumentDataFieldName\"))\n\t}\n\tif s.DocumentDataFieldName != nil && len(*s.DocumentDataFieldName) < 1 {\n\t\tinvalidParams.Add(request.NewErrParamMinLen(\"DocumentDataFieldName\", 1))\n\t}\n\tif s.DocumentTitleFieldName != nil && len(*s.DocumentTitleFieldName) < 1 {\n\t\tinvalidParams.Add(request.NewErrParamMinLen(\"DocumentTitleFieldName\", 1))\n\t}\n\tif s.FieldMappings != nil && len(s.FieldMappings) < 1 {\n\t\tinvalidParams.Add(request.NewErrParamMinLen(\"FieldMappings\", 1))\n\t}\n\tif s.Name == nil {\n\t\tinvalidParams.Add(request.NewErrParamRequired(\"Name\"))\n\t}\n\tif s.Name != nil && len(*s.Name) < 1 {\n\t\tinvalidParams.Add(request.NewErrParamMinLen(\"Name\", 1))\n\t}\n\tif s.FieldMappings != nil {\n\t\tfor i, v := range s.FieldMappings {\n\t\t\tif v == nil {\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tif err := v.Validate(); err != nil {\n\t\t\t\tinvalidParams.AddNested(fmt.Sprintf(\"%s[%v]\", \"FieldMappings\", i), err.(request.ErrInvalidParams))\n\t\t\t}\n\t\t}\n\t}\n\n\tif invalidParams.Len() > 0 {\n\t\treturn invalidParams\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "26f6c74a23de6eecaa314e596e68c36b", "score": "0.55508935", "text": "func (m Beer) Validate() error {\n\treturn validation.ValidateStruct(&m,\n\t\tvalidation.Field(&m.Name, validation.Required, validation.Length(0, 120)),\n\t\tvalidation.Field(&m.Content, validation.Required),\n\t)\n}", "title": "" }, { "docid": "0432e1d54b378168a3f7022223c1c26e", "score": "0.55507755", "text": "func (s *CreateHITWithHITTypeInput) Validate() error {\n\tinvalidParams := aws.ErrInvalidParams{Context: \"CreateHITWithHITTypeInput\"}\n\tif s.HITLayoutId != nil && len(*s.HITLayoutId) < 1 {\n\t\tinvalidParams.Add(aws.NewErrParamMinLen(\"HITLayoutId\", 1))\n\t}\n\n\tif s.HITTypeId == nil {\n\t\tinvalidParams.Add(aws.NewErrParamRequired(\"HITTypeId\"))\n\t}\n\tif s.HITTypeId != nil && len(*s.HITTypeId) < 1 {\n\t\tinvalidParams.Add(aws.NewErrParamMinLen(\"HITTypeId\", 1))\n\t}\n\n\tif s.LifetimeInSeconds == nil {\n\t\tinvalidParams.Add(aws.NewErrParamRequired(\"LifetimeInSeconds\"))\n\t}\n\tif s.UniqueRequestToken != nil && len(*s.UniqueRequestToken) < 1 {\n\t\tinvalidParams.Add(aws.NewErrParamMinLen(\"UniqueRequestToken\", 1))\n\t}\n\tif s.AssignmentReviewPolicy != nil {\n\t\tif err := s.AssignmentReviewPolicy.Validate(); err != nil {\n\t\t\tinvalidParams.AddNested(\"AssignmentReviewPolicy\", err.(aws.ErrInvalidParams))\n\t\t}\n\t}\n\tif s.HITLayoutParameters != nil {\n\t\tfor i, v := range s.HITLayoutParameters {\n\t\t\tif err := v.Validate(); err != nil {\n\t\t\t\tinvalidParams.AddNested(fmt.Sprintf(\"%s[%v]\", \"HITLayoutParameters\", i), err.(aws.ErrInvalidParams))\n\t\t\t}\n\t\t}\n\t}\n\tif s.HITReviewPolicy != nil {\n\t\tif err := s.HITReviewPolicy.Validate(); err != nil {\n\t\t\tinvalidParams.AddNested(\"HITReviewPolicy\", err.(aws.ErrInvalidParams))\n\t\t}\n\t}\n\n\tif invalidParams.Len() > 0 {\n\t\treturn invalidParams\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "2849b905a9d9794e97c547321df70c44", "score": "0.55482256", "text": "func (s *UpdateCanaryInput) Validate() error {\n\tinvalidParams := request.ErrInvalidParams{Context: \"UpdateCanaryInput\"}\n\tif s.ArtifactS3Location != nil && len(*s.ArtifactS3Location) < 1 {\n\t\tinvalidParams.Add(request.NewErrParamMinLen(\"ArtifactS3Location\", 1))\n\t}\n\tif s.ExecutionRoleArn != nil && len(*s.ExecutionRoleArn) < 1 {\n\t\tinvalidParams.Add(request.NewErrParamMinLen(\"ExecutionRoleArn\", 1))\n\t}\n\tif s.FailureRetentionPeriodInDays != nil && *s.FailureRetentionPeriodInDays < 1 {\n\t\tinvalidParams.Add(request.NewErrParamMinValue(\"FailureRetentionPeriodInDays\", 1))\n\t}\n\tif s.Name == nil {\n\t\tinvalidParams.Add(request.NewErrParamRequired(\"Name\"))\n\t}\n\tif s.Name != nil && len(*s.Name) < 1 {\n\t\tinvalidParams.Add(request.NewErrParamMinLen(\"Name\", 1))\n\t}\n\tif s.RuntimeVersion != nil && len(*s.RuntimeVersion) < 1 {\n\t\tinvalidParams.Add(request.NewErrParamMinLen(\"RuntimeVersion\", 1))\n\t}\n\tif s.SuccessRetentionPeriodInDays != nil && *s.SuccessRetentionPeriodInDays < 1 {\n\t\tinvalidParams.Add(request.NewErrParamMinValue(\"SuccessRetentionPeriodInDays\", 1))\n\t}\n\tif s.ArtifactConfig != nil {\n\t\tif err := s.ArtifactConfig.Validate(); err != nil {\n\t\t\tinvalidParams.AddNested(\"ArtifactConfig\", err.(request.ErrInvalidParams))\n\t\t}\n\t}\n\tif s.Code != nil {\n\t\tif err := s.Code.Validate(); err != nil {\n\t\t\tinvalidParams.AddNested(\"Code\", err.(request.ErrInvalidParams))\n\t\t}\n\t}\n\tif s.RunConfig != nil {\n\t\tif err := s.RunConfig.Validate(); err != nil {\n\t\t\tinvalidParams.AddNested(\"RunConfig\", err.(request.ErrInvalidParams))\n\t\t}\n\t}\n\tif s.Schedule != nil {\n\t\tif err := s.Schedule.Validate(); err != nil {\n\t\t\tinvalidParams.AddNested(\"Schedule\", err.(request.ErrInvalidParams))\n\t\t}\n\t}\n\tif s.VisualReference != nil {\n\t\tif err := s.VisualReference.Validate(); err != nil {\n\t\t\tinvalidParams.AddNested(\"VisualReference\", err.(request.ErrInvalidParams))\n\t\t}\n\t}\n\n\tif invalidParams.Len() > 0 {\n\t\treturn invalidParams\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "e003a7028a3bf3d8e1650a6069db89ba", "score": "0.554589", "text": "func (f *fig) validateStruct(fieldVal reflect.Value, errs fieldErrors, parentName string) {\n\tkind := fieldVal.Kind()\n\tif (kind == reflect.Ptr || kind == reflect.Interface) && !fieldVal.IsNil() {\n\t\tf.validateStruct(fieldVal.Elem(), errs, parentName)\n\t\treturn\n\t}\n\n\tfieldType := fieldVal.Type()\n\tfor i := 0; i < fieldType.NumField(); i++ {\n\t\tf.validateField(fieldVal.Field(i), fieldType.Field(i), errs, parentName)\n\t}\n}", "title": "" }, { "docid": "140341324b11c9b37694c289f303b1bb", "score": "0.5543818", "text": "func (mt *User) Validate() (err error) {\n\tif mt.ID == \"\" {\n\t\terr = goa.MergeErrors(err, goa.MissingAttributeError(`response`, \"id\"))\n\t}\n\tif mt.FirstName == \"\" {\n\t\terr = goa.MergeErrors(err, goa.MissingAttributeError(`response`, \"firstName\"))\n\t}\n\tif mt.LastName == \"\" {\n\t\terr = goa.MergeErrors(err, goa.MissingAttributeError(`response`, \"lastName\"))\n\t}\n\tif mt.Age != nil {\n\t\tif *mt.Age < 18 {\n\t\t\terr = goa.MergeErrors(err, goa.InvalidRangeError(`response.age`, *mt.Age, 18, true))\n\t\t}\n\t}\n\tif mt.Age != nil {\n\t\tif *mt.Age > 150 {\n\t\t\terr = goa.MergeErrors(err, goa.InvalidRangeError(`response.age`, *mt.Age, 150, false))\n\t\t}\n\t}\n\treturn\n}", "title": "" }, { "docid": "2c3f739844f138023dde340d2efc8f5f", "score": "0.554252", "text": "func (ad Advert) Validate() error {\n\tif ad.Currency == \"\" {\n\t\treturn errors.New(\"wrong_currency\")\n\t}\n\tif len(ad.Locations) == 0 {\n\t\treturn errors.New(\"wrong_country\")\n\t}\n\tfor _, l := range ad.Locations {\n\t\tif l.CountryID == \"\" {\n\t\t\treturn errors.New(\"wrong_country\")\n\t\t}\n\t}\n\tif ad.Name == \"\" {\n\t\treturn errors.New(\"empty_name\")\n\t}\n\n\t// check if date not in the past\n\tnow := time.Now()\n\tyear, month, day := now.Date()\n\ttoday := time.Date(year, month, day, 0, 0, 0, 0, now.Location())\n\n\tif ad.StartDate.Before(today) {\n\t\treturn errors.New(\"wrong_start_date\")\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "c4badbf37487d5820fd2379f8a4bce74", "score": "0.5540947", "text": "func (s *PutRecordsInput) Validate() error {\n\tinvalidParams := request.ErrInvalidParams{Context: \"PutRecordsInput\"}\n\tif s.Environment == nil {\n\t\tinvalidParams.Add(request.NewErrParamRequired(\"Environment\"))\n\t}\n\tif s.SdkRecords == nil {\n\t\tinvalidParams.Add(request.NewErrParamRequired(\"SdkRecords\"))\n\t}\n\tif s.Environment != nil {\n\t\tif err := s.Environment.Validate(); err != nil {\n\t\t\tinvalidParams.AddNested(\"Environment\", err.(request.ErrInvalidParams))\n\t\t}\n\t}\n\tif s.SdkRecords != nil {\n\t\tfor i, v := range s.SdkRecords {\n\t\t\tif v == nil {\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tif err := v.Validate(); err != nil {\n\t\t\t\tinvalidParams.AddNested(fmt.Sprintf(\"%s[%v]\", \"SdkRecords\", i), err.(request.ErrInvalidParams))\n\t\t\t}\n\t\t}\n\t}\n\n\tif invalidParams.Len() > 0 {\n\t\treturn invalidParams\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "d2d9c3aa1cc40565b66b94e0c13bdb62", "score": "0.55378985", "text": "func (ci ConfigInstance) Validate() (bool, error) {\n\n\t// ValueOf returns a Value representing the run-time data\n\tv := reflect.ValueOf(ci)\n\tfor i := 0; i < v.NumField(); i++ {\n\t\t// Get the field tag value\n\t\ttag := v.Type().Field(i).Tag.Get(tagName)\n\n\t\t// Skip if tag is not defined or ignored\n\t\tif tag == \"\" || tag == \"-\" {\n\t\t\tcontinue\n\t\t}\n\n\t\t// Get a validator that corresponds to a tag\n\t\tvalidator := getValidatorFromTag(tag)\n\n\t\t// Perform validation\n\t\tvalid, err := validator.Validate(v.Field(i).Interface())\n\n\t\t// Append error to results\n\t\tif !valid && err != nil {\n\t\t\treturn false, fmt.Errorf(\"%s %s\", v.Type().Field(i).Name, err.Error())\n\t\t}\n\t}\n\treturn true, nil\n}", "title": "" }, { "docid": "78d17da16f2de5c6a4c787fe21db27a0", "score": "0.5534823", "text": "func (cv *MyStruct) Validate(e *v.Errors) {\n\t// validating that ID > 0 and URL is not empty\n\tif cv.ID > 0 && cv.URL != \"\" {\n\t\treturn\n\t}\n\n\t// Adding error if any of the conditions have failed.\n\te.Add(\"MyStruct\", fmt.Sprintf(\"MyStruct validation failed\"))\n\t// First argument to e.Add() method is the path where errors of validation will be stored.\n\t// Idiomatic way is to define Name field in the struct (see other examples).\n\t// Another option is to hard-code the path (done here). In this case the DIVE is impossible.\n\t// Yet another options are to use any other string field / global variable as the path.\n}", "title": "" }, { "docid": "63a52bb3779ec4b2d431f59cadc763c8", "score": "0.5534611", "text": "func (s *SalesforceChatterFeedConfiguration) Validate() error {\n\tinvalidParams := request.ErrInvalidParams{Context: \"SalesforceChatterFeedConfiguration\"}\n\tif s.DocumentDataFieldName == nil {\n\t\tinvalidParams.Add(request.NewErrParamRequired(\"DocumentDataFieldName\"))\n\t}\n\tif s.DocumentDataFieldName != nil && len(*s.DocumentDataFieldName) < 1 {\n\t\tinvalidParams.Add(request.NewErrParamMinLen(\"DocumentDataFieldName\", 1))\n\t}\n\tif s.DocumentTitleFieldName != nil && len(*s.DocumentTitleFieldName) < 1 {\n\t\tinvalidParams.Add(request.NewErrParamMinLen(\"DocumentTitleFieldName\", 1))\n\t}\n\tif s.FieldMappings != nil && len(s.FieldMappings) < 1 {\n\t\tinvalidParams.Add(request.NewErrParamMinLen(\"FieldMappings\", 1))\n\t}\n\tif s.IncludeFilterTypes != nil && len(s.IncludeFilterTypes) < 1 {\n\t\tinvalidParams.Add(request.NewErrParamMinLen(\"IncludeFilterTypes\", 1))\n\t}\n\tif s.FieldMappings != nil {\n\t\tfor i, v := range s.FieldMappings {\n\t\t\tif v == nil {\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tif err := v.Validate(); err != nil {\n\t\t\t\tinvalidParams.AddNested(fmt.Sprintf(\"%s[%v]\", \"FieldMappings\", i), err.(request.ErrInvalidParams))\n\t\t\t}\n\t\t}\n\t}\n\n\tif invalidParams.Len() > 0 {\n\t\treturn invalidParams\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "14a2769eab0ad797282b4a172a1f8683", "score": "0.5533908", "text": "func (s *DataSourceToIndexFieldMapping) Validate() error {\n\tinvalidParams := request.ErrInvalidParams{Context: \"DataSourceToIndexFieldMapping\"}\n\tif s.DataSourceFieldName == nil {\n\t\tinvalidParams.Add(request.NewErrParamRequired(\"DataSourceFieldName\"))\n\t}\n\tif s.DataSourceFieldName != nil && len(*s.DataSourceFieldName) < 1 {\n\t\tinvalidParams.Add(request.NewErrParamMinLen(\"DataSourceFieldName\", 1))\n\t}\n\tif s.DateFieldFormat != nil && len(*s.DateFieldFormat) < 4 {\n\t\tinvalidParams.Add(request.NewErrParamMinLen(\"DateFieldFormat\", 4))\n\t}\n\tif s.IndexFieldName == nil {\n\t\tinvalidParams.Add(request.NewErrParamRequired(\"IndexFieldName\"))\n\t}\n\tif s.IndexFieldName != nil && len(*s.IndexFieldName) < 1 {\n\t\tinvalidParams.Add(request.NewErrParamMinLen(\"IndexFieldName\", 1))\n\t}\n\n\tif invalidParams.Len() > 0 {\n\t\treturn invalidParams\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "87684cfa742112f21a30dd8608be1602", "score": "0.553299", "text": "func (payload *updateUserPayload) Validate() (err error) {\n\tif payload.Email != nil {\n\t\tif len(*payload.Email) < 2 {\n\t\t\terr = goa.MergeErrors(err, goa.InvalidLengthError(`raw.email`, *payload.Email, len(*payload.Email), 2, true))\n\t\t}\n\t}\n\tif payload.FirstName != nil {\n\t\tif len(*payload.FirstName) < 2 {\n\t\t\terr = goa.MergeErrors(err, goa.InvalidLengthError(`raw.first_name`, *payload.FirstName, len(*payload.FirstName), 2, true))\n\t\t}\n\t}\n\tif payload.LastName != nil {\n\t\tif len(*payload.LastName) < 2 {\n\t\t\terr = goa.MergeErrors(err, goa.InvalidLengthError(`raw.last_name`, *payload.LastName, len(*payload.LastName), 2, true))\n\t\t}\n\t}\n\tif payload.Password != nil {\n\t\tif len(*payload.Password) < 8 {\n\t\t\terr = goa.MergeErrors(err, goa.InvalidLengthError(`raw.password`, *payload.Password, len(*payload.Password), 8, true))\n\t\t}\n\t}\n\tif payload.ValidationCode != nil {\n\t\tif len(*payload.ValidationCode) < 8 {\n\t\t\terr = goa.MergeErrors(err, goa.InvalidLengthError(`raw.validation_code`, *payload.ValidationCode, len(*payload.ValidationCode), 8, true))\n\t\t}\n\t}\n\treturn err\n}", "title": "" }, { "docid": "5a10227104a1770081a94572407e3db3", "score": "0.55303717", "text": "func (s *ServiceNowServiceCatalogConfiguration) Validate() error {\n\tinvalidParams := request.ErrInvalidParams{Context: \"ServiceNowServiceCatalogConfiguration\"}\n\tif s.DocumentDataFieldName == nil {\n\t\tinvalidParams.Add(request.NewErrParamRequired(\"DocumentDataFieldName\"))\n\t}\n\tif s.DocumentDataFieldName != nil && len(*s.DocumentDataFieldName) < 1 {\n\t\tinvalidParams.Add(request.NewErrParamMinLen(\"DocumentDataFieldName\", 1))\n\t}\n\tif s.DocumentTitleFieldName != nil && len(*s.DocumentTitleFieldName) < 1 {\n\t\tinvalidParams.Add(request.NewErrParamMinLen(\"DocumentTitleFieldName\", 1))\n\t}\n\tif s.FieldMappings != nil && len(s.FieldMappings) < 1 {\n\t\tinvalidParams.Add(request.NewErrParamMinLen(\"FieldMappings\", 1))\n\t}\n\tif s.FieldMappings != nil {\n\t\tfor i, v := range s.FieldMappings {\n\t\t\tif v == nil {\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tif err := v.Validate(); err != nil {\n\t\t\t\tinvalidParams.AddNested(fmt.Sprintf(\"%s[%v]\", \"FieldMappings\", i), err.(request.ErrInvalidParams))\n\t\t\t}\n\t\t}\n\t}\n\n\tif invalidParams.Len() > 0 {\n\t\treturn invalidParams\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "041646c3cf8ca6f5f0f2b3b4a5626b21", "score": "0.5529051", "text": "func (s *MemberDefinition) Validate() error {\n\tinvalidParams := aws.ErrInvalidParams{Context: \"MemberDefinition\"}\n\tif s.CognitoMemberDefinition != nil {\n\t\tif err := s.CognitoMemberDefinition.Validate(); err != nil {\n\t\t\tinvalidParams.AddNested(\"CognitoMemberDefinition\", err.(aws.ErrInvalidParams))\n\t\t}\n\t}\n\n\tif invalidParams.Len() > 0 {\n\t\treturn invalidParams\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "041646c3cf8ca6f5f0f2b3b4a5626b21", "score": "0.5529051", "text": "func (s *MemberDefinition) Validate() error {\n\tinvalidParams := aws.ErrInvalidParams{Context: \"MemberDefinition\"}\n\tif s.CognitoMemberDefinition != nil {\n\t\tif err := s.CognitoMemberDefinition.Validate(); err != nil {\n\t\t\tinvalidParams.AddNested(\"CognitoMemberDefinition\", err.(aws.ErrInvalidParams))\n\t\t}\n\t}\n\n\tif invalidParams.Len() > 0 {\n\t\treturn invalidParams\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "20e4458f5c6855b4470b2ec29c21dda6", "score": "0.5528176", "text": "func (s *ColumnConfiguration) Validate() error {\n\tinvalidParams := request.ErrInvalidParams{Context: \"ColumnConfiguration\"}\n\tif s.ChangeDetectingColumns == nil {\n\t\tinvalidParams.Add(request.NewErrParamRequired(\"ChangeDetectingColumns\"))\n\t}\n\tif s.ChangeDetectingColumns != nil && len(s.ChangeDetectingColumns) < 1 {\n\t\tinvalidParams.Add(request.NewErrParamMinLen(\"ChangeDetectingColumns\", 1))\n\t}\n\tif s.DocumentDataColumnName == nil {\n\t\tinvalidParams.Add(request.NewErrParamRequired(\"DocumentDataColumnName\"))\n\t}\n\tif s.DocumentDataColumnName != nil && len(*s.DocumentDataColumnName) < 1 {\n\t\tinvalidParams.Add(request.NewErrParamMinLen(\"DocumentDataColumnName\", 1))\n\t}\n\tif s.DocumentIdColumnName == nil {\n\t\tinvalidParams.Add(request.NewErrParamRequired(\"DocumentIdColumnName\"))\n\t}\n\tif s.DocumentIdColumnName != nil && len(*s.DocumentIdColumnName) < 1 {\n\t\tinvalidParams.Add(request.NewErrParamMinLen(\"DocumentIdColumnName\", 1))\n\t}\n\tif s.DocumentTitleColumnName != nil && len(*s.DocumentTitleColumnName) < 1 {\n\t\tinvalidParams.Add(request.NewErrParamMinLen(\"DocumentTitleColumnName\", 1))\n\t}\n\tif s.FieldMappings != nil && len(s.FieldMappings) < 1 {\n\t\tinvalidParams.Add(request.NewErrParamMinLen(\"FieldMappings\", 1))\n\t}\n\tif s.FieldMappings != nil {\n\t\tfor i, v := range s.FieldMappings {\n\t\t\tif v == nil {\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tif err := v.Validate(); err != nil {\n\t\t\t\tinvalidParams.AddNested(fmt.Sprintf(\"%s[%v]\", \"FieldMappings\", i), err.(request.ErrInvalidParams))\n\t\t\t}\n\t\t}\n\t}\n\n\tif invalidParams.Len() > 0 {\n\t\treturn invalidParams\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "acd2dbf97bb726d17ae796a4ff5d7c10", "score": "0.55274063", "text": "func (s *SdkMonitoringRecord) Validate() error {\n\tinvalidParams := request.ErrInvalidParams{Context: \"SdkMonitoringRecord\"}\n\tif s.AggregationKey == nil {\n\t\tinvalidParams.Add(request.NewErrParamRequired(\"AggregationKey\"))\n\t}\n\tif s.Id == nil {\n\t\tinvalidParams.Add(request.NewErrParamRequired(\"Id\"))\n\t}\n\tif s.UncompressedSamplesLength != nil && *s.UncompressedSamplesLength < 1 {\n\t\tinvalidParams.Add(request.NewErrParamMinValue(\"UncompressedSamplesLength\", 1))\n\t}\n\tif s.Version == nil {\n\t\tinvalidParams.Add(request.NewErrParamRequired(\"Version\"))\n\t}\n\tif s.AggregationKey != nil {\n\t\tif err := s.AggregationKey.Validate(); err != nil {\n\t\t\tinvalidParams.AddNested(\"AggregationKey\", err.(request.ErrInvalidParams))\n\t\t}\n\t}\n\tif s.FrequencyMetrics != nil {\n\t\tfor i, v := range s.FrequencyMetrics {\n\t\t\tif v == nil {\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tif err := v.Validate(); err != nil {\n\t\t\t\tinvalidParams.AddNested(fmt.Sprintf(\"%s[%v]\", \"FrequencyMetrics\", i), err.(request.ErrInvalidParams))\n\t\t\t}\n\t\t}\n\t}\n\tif s.SehMetrics != nil {\n\t\tfor i, v := range s.SehMetrics {\n\t\t\tif v == nil {\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tif err := v.Validate(); err != nil {\n\t\t\t\tinvalidParams.AddNested(fmt.Sprintf(\"%s[%v]\", \"SehMetrics\", i), err.(request.ErrInvalidParams))\n\t\t\t}\n\t\t}\n\t}\n\n\tif invalidParams.Len() > 0 {\n\t\treturn invalidParams\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "9993f90e40a75f40c8828294a0fda4d0", "score": "0.5525793", "text": "func (ftu *FieldTypeUpdate) check() error {\n\tif v, ok := ftu.mutation.ValidateOptionalInt32(); ok {\n\t\tif err := fieldtype.ValidateOptionalInt32Validator(v); err != nil {\n\t\t\treturn &ValidationError{Name: \"validate_optional_int32\", err: fmt.Errorf(`ent: validator failed for field \"FieldType.validate_optional_int32\": %w`, err)}\n\t\t}\n\t}\n\tif v, ok := ftu.mutation.State(); ok {\n\t\tif err := fieldtype.StateValidator(v); err != nil {\n\t\t\treturn &ValidationError{Name: \"state\", err: fmt.Errorf(`ent: validator failed for field \"FieldType.state\": %w`, err)}\n\t\t}\n\t}\n\tif v, ok := ftu.mutation.MAC(); ok {\n\t\tif err := fieldtype.MACValidator(v.String()); err != nil {\n\t\t\treturn &ValidationError{Name: \"mac\", err: fmt.Errorf(`ent: validator failed for field \"FieldType.mac\": %w`, err)}\n\t\t}\n\t}\n\tif v, ok := ftu.mutation.Ndir(); ok {\n\t\tif err := fieldtype.NdirValidator(string(v)); err != nil {\n\t\t\treturn &ValidationError{Name: \"ndir\", err: fmt.Errorf(`ent: validator failed for field \"FieldType.ndir\": %w`, err)}\n\t\t}\n\t}\n\tif v, ok := ftu.mutation.Link(); ok {\n\t\tif err := fieldtype.LinkValidator(v.String()); err != nil {\n\t\t\treturn &ValidationError{Name: \"link\", err: fmt.Errorf(`ent: validator failed for field \"FieldType.link\": %w`, err)}\n\t\t}\n\t}\n\tif v, ok := ftu.mutation.RawData(); ok {\n\t\tif err := fieldtype.RawDataValidator(v); err != nil {\n\t\t\treturn &ValidationError{Name: \"raw_data\", err: fmt.Errorf(`ent: validator failed for field \"FieldType.raw_data\": %w`, err)}\n\t\t}\n\t}\n\tif v, ok := ftu.mutation.IP(); ok {\n\t\tif err := fieldtype.IPValidator([]byte(v)); err != nil {\n\t\t\treturn &ValidationError{Name: \"ip\", err: fmt.Errorf(`ent: validator failed for field \"FieldType.ip\": %w`, err)}\n\t\t}\n\t}\n\tif v, ok := ftu.mutation.Role(); ok {\n\t\tif err := fieldtype.RoleValidator(v); err != nil {\n\t\t\treturn &ValidationError{Name: \"role\", err: fmt.Errorf(`ent: validator failed for field \"FieldType.role\": %w`, err)}\n\t\t}\n\t}\n\tif v, ok := ftu.mutation.Priority(); ok {\n\t\tif err := fieldtype.PriorityValidator(v); err != nil {\n\t\t\treturn &ValidationError{Name: \"priority\", err: fmt.Errorf(`ent: validator failed for field \"FieldType.priority\": %w`, err)}\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "1b8f39bc01eb5f9893bd6f801aa83ab1", "score": "0.55244917", "text": "func (v *validator) validateField(i int) error {\n\n\telem := reflect.TypeOf(v.data).Field(i)\n\tif !fieldIsExported(elem) {\n\t\treturn nil\n\t}\n\tfieldName := elem.Name\n\n\t//TODO: check if field is a pointer\n\tfieldVal := reflect.ValueOf(v.data).Field(i).Interface()\n\tif IsStruct(fieldVal) {\n\t\tv.fieldPrefix.push(fieldName)\n\t\tdefer v.fieldPrefix.pop()\n\n\t\terr := v.Validate(fieldVal)\n\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\treturn nil\n\t}\n\n\ttag := elem.Tag.Get(v.tagName)\n\tif tag == \"\" {\n\t\treturn nil\n\t}\n\n\tfor _, ruleStr := range strings.Split(tag, \"|\") {\n\t\tvar j = strings.Index(tag, \":\")\n\t\tvar ruleParamsStr = ruleStr[j+1:]\n\t\tvar namedParams map[string]string\n\t\tvar ruleParams []string\n\n\t\tvar ruleName = ruleStr[0:j]\n\n\t\tnamedParams = make(map[string]string, 0)\n\n\t\tfor _, paramPart := range strings.Split(ruleParamsStr, \",\") {\n\t\t\tisNamed := strings.Index(paramPart, \":\") != -1\n\t\t\tif isNamed {\n\t\t\t\tvar tmpParam = strings.Split(paramPart, \":\")\n\t\t\t\tif len(tmpParam) != 2 {\n\t\t\t\t\treturn ErrInvalidParamFormat\n\t\t\t\t}\n\t\t\t\tnamedParams[tmpParam[0]] = tmpParam[1]\n\t\t\t} else {\n\t\t\t\truleParams = append(ruleParams, paramPart)\n\t\t\t}\n\t\t}\n\n\t\tvar fieldCheck = func() {\n\t\t\trule, err := v.getRule(ruleName)\n\t\t\tif err != nil {\n\t\t\t\tv.logicError = err\n\t\t\t\treturn\n\t\t\t}\n\n\t\t\tlogicErr, inputErr := rule.Validate(v.data, fieldName, ruleParams, namedParams)\n\t\t\tif logicErr != nil {\n\t\t\t\tv.logicError = logicErr\n\t\t\t\treturn\n\t\t\t}\n\t\t\tif inputErr != nil {\n\t\t\t\tkey := v.fieldPrefix.String() + fieldName\n\t\t\t\tv.errors[key] = append(v.errors[key], inputErr)\n\t\t\t}\n\t\t}\n\n\t\tv.safeExec(fieldCheck)\n\t\tif v.logicError != nil {\n\t\t\treturn v.logicError\n\t\t}\n\t}\n\treturn nil\n}", "title": "" } ]
a344c4903dfee6191bcbe87234122a2b
Length returns the number of distinct keys in the multiset
[ { "docid": "a8f246da05f22b834e589c1f0cefedab", "score": "0.0", "text": "func (t *MapInt8Error) Length() int {\n\treturn t.length\n}", "title": "" } ]
[ { "docid": "b6b7e402c4e2973f74a745f662919b72", "score": "0.7149689", "text": "func (set *itemSet) Len() int {\n\treturn len(set.keys)\n}", "title": "" }, { "docid": "b726c85cb549669e0dbbb39197b27876", "score": "0.6864715", "text": "func (a ByKey) Len() int { return len(a) }", "title": "" }, { "docid": "b726c85cb549669e0dbbb39197b27876", "score": "0.6864715", "text": "func (a ByKey) Len() int { return len(a) }", "title": "" }, { "docid": "b726c85cb549669e0dbbb39197b27876", "score": "0.6864715", "text": "func (a ByKey) Len() int { return len(a) }", "title": "" }, { "docid": "b726c85cb549669e0dbbb39197b27876", "score": "0.6864715", "text": "func (a ByKey) Len() int { return len(a) }", "title": "" }, { "docid": "b726c85cb549669e0dbbb39197b27876", "score": "0.6864715", "text": "func (a ByKey) Len() int { return len(a) }", "title": "" }, { "docid": "b726c85cb549669e0dbbb39197b27876", "score": "0.6864715", "text": "func (a ByKey) Len() int { return len(a) }", "title": "" }, { "docid": "b726c85cb549669e0dbbb39197b27876", "score": "0.6864715", "text": "func (a ByKey) Len() int { return len(a) }", "title": "" }, { "docid": "b726c85cb549669e0dbbb39197b27876", "score": "0.6864715", "text": "func (a ByKey) Len() int { return len(a) }", "title": "" }, { "docid": "b726c85cb549669e0dbbb39197b27876", "score": "0.6864715", "text": "func (a ByKey) Len() int { return len(a) }", "title": "" }, { "docid": "b726c85cb549669e0dbbb39197b27876", "score": "0.6864715", "text": "func (a ByKey) Len() int { return len(a) }", "title": "" }, { "docid": "b726c85cb549669e0dbbb39197b27876", "score": "0.6864715", "text": "func (a ByKey) Len() int { return len(a) }", "title": "" }, { "docid": "b726c85cb549669e0dbbb39197b27876", "score": "0.6864715", "text": "func (a ByKey) Len() int { return len(a) }", "title": "" }, { "docid": "b726c85cb549669e0dbbb39197b27876", "score": "0.6864715", "text": "func (a ByKey) Len() int { return len(a) }", "title": "" }, { "docid": "b726c85cb549669e0dbbb39197b27876", "score": "0.6864715", "text": "func (a ByKey) Len() int { return len(a) }", "title": "" }, { "docid": "b726c85cb549669e0dbbb39197b27876", "score": "0.6864715", "text": "func (a ByKey) Len() int { return len(a) }", "title": "" }, { "docid": "b726c85cb549669e0dbbb39197b27876", "score": "0.6864715", "text": "func (a ByKey) Len() int { return len(a) }", "title": "" }, { "docid": "b726c85cb549669e0dbbb39197b27876", "score": "0.6864715", "text": "func (a ByKey) Len() int { return len(a) }", "title": "" }, { "docid": "b726c85cb549669e0dbbb39197b27876", "score": "0.6864715", "text": "func (a ByKey) Len() int { return len(a) }", "title": "" }, { "docid": "b726c85cb549669e0dbbb39197b27876", "score": "0.6864715", "text": "func (a ByKey) Len() int { return len(a) }", "title": "" }, { "docid": "0597e80a93c5cebaa6bd57e7fa2f02ac", "score": "0.6843462", "text": "func (set Set) Len() int {\n\tm := map[string]bool(set)\n\treturn (len(m))\n}", "title": "" }, { "docid": "90c5d6bf44f8a986dc929fb7e48ec14b", "score": "0.6798969", "text": "func (s *idSet) size() int {\n\tvar size int\n\titerator, cancel := s.iterator()\n\tdefer cancel()\n\tfor i := iterator(); i != nil; i = iterator() {\n\t\tsize += i.length()\n\t}\n\treturn size\n}", "title": "" }, { "docid": "919b1da21f597cd1d200cebd91feda5a", "score": "0.6783829", "text": "func (set OrderedStringSet) Len() int {\r\n\treturn len(set.values)\r\n}", "title": "" }, { "docid": "4ac33931fec9e7656a26a299ae6b5e02", "score": "0.6746228", "text": "func (set *Set) Length() int {\n\treturn len(set.hash)\n}", "title": "" }, { "docid": "051aeb93eb79658cfcff28c3346b7051", "score": "0.67459834", "text": "func (s IntersectionSet) Len() int { return len(s) }", "title": "" }, { "docid": "e87dc466b5130af5350a47cd606a59f7", "score": "0.6711048", "text": "func (set Set[T]) Len() int {\n\treturn len(set)\n}", "title": "" }, { "docid": "1661bab0b460bd8e2612248a3f6b51aa", "score": "0.6690742", "text": "func iset_len(iset_c4go_postfix []iset, key int32) int32 {\n\t//if key >= 0 && key < iset_c4go_postfix[0].cnt {\n\t// return iset_c4go_postfix[0].len_[key]\n\treturn int32(len(iset_c4go_postfix[0].set[key]))\n\t//}\n\t//return 0\n}", "title": "" }, { "docid": "ca4f9a6f216c5f62bb7e18c42d1aa643", "score": "0.6653511", "text": "func (a byKey) Len() int {\n\treturn len(a)\n}", "title": "" }, { "docid": "882f5f8d51288640e3d3c5258146a324", "score": "0.6499146", "text": "func (cs *ConcurrentSet) Len() int {\n\tcs.Lock()\n\tdefer cs.Unlock()\n\treturn cs.items.Len()\n}", "title": "" }, { "docid": "6dce9cfe93a834ec3f6514a106a5cffe", "score": "0.6488231", "text": "func (set *Set) Len() int64 {\n\tset.lock.RLock()\n\n\tsize := int64(len(set.items))\n\n\tset.lock.RUnlock()\n\n\treturn size\n}", "title": "" }, { "docid": "ac2c6380fcc5da97de3fa4f32f8745f4", "score": "0.6433224", "text": "func (s Set[T]) Len() int {\n\treturn len(s)\n}", "title": "" }, { "docid": "ac2c6380fcc5da97de3fa4f32f8745f4", "score": "0.6433224", "text": "func (s Set[T]) Len() int {\n\treturn len(s)\n}", "title": "" }, { "docid": "76fa51a87e8128358ee773bce14f43d3", "score": "0.6423749", "text": "func (iset *IntSet) Len() (total int) {\n\tfor range iset.data {\n\t\ttotal++\n\t}\n\treturn\n}", "title": "" }, { "docid": "d2e32f93b2297e28d4060e433fdb9cbd", "score": "0.63852644", "text": "func (s *QSet) Len() int {\n\treturn s.set.Len()\n}", "title": "" }, { "docid": "97360d18b7fe6efb2d73ff5b8083e05c", "score": "0.63774896", "text": "func iset_len(iset_c4go_postfix []iset, key int32) int32 {\n\tif key >= 0 && key < iset_c4go_postfix[0].cnt {\n\t\treturn iset_c4go_postfix[0].len_[key]\n\t}\n\treturn 0\n}", "title": "" }, { "docid": "aa037321b91287aa21f577e07b04b2ca", "score": "0.6349091", "text": "func (s TSIDSet) Len() int {\n\tif t := s.tag(); t != 0 {\n\t\treturn int(t)\n\t} else if s.p == nil {\n\t\treturn 0\n\t}\n\treturn len(*s.p)\n}", "title": "" }, { "docid": "6d66df3ffd2090e73c733afaa2d64792", "score": "0.6292201", "text": "func (s *Set) Len() int {\n\treturn len(s.set)\n}", "title": "" }, { "docid": "8c03805e03586a1bd7fafd9dcc04ac85", "score": "0.6275502", "text": "func (t *UniqList) Len() int {\n return t.List.Len()\n}", "title": "" }, { "docid": "6bfec6664a05cec653be5aa4464f2284", "score": "0.62629056", "text": "func (s *IntSet) Len() int {\n\tcount := 0\n\tfor _, word := range s.words {\n\t\tcount += popcount(word)\n\t}\n\treturn count\n}", "title": "" }, { "docid": "7eebcea5b6ad1f28bdea1e9e265be9bc", "score": "0.6247364", "text": "func (s *objectMetaSet) len() int {\n\ts.RLock()\n\tdefer s.RUnlock()\n\n\treturn len(s.contents)\n}", "title": "" }, { "docid": "486160593e36bab61bf542f0570fc8bf", "score": "0.6246801", "text": "func (s *Set) Len() int {\n\treturn len(s.items)\n}", "title": "" }, { "docid": "c9fa1c570910f24094d0b7fd9c2c2de4", "score": "0.6242447", "text": "func (s *mwkSorter) Len() int {\n\treturn len(s.keySet)\n}", "title": "" }, { "docid": "764742a48c45903d41e5b7cbce98ade8", "score": "0.623336", "text": "func (r *Redis) Len(ctx context.Context) (int64, error) {\n\treturn r.client.ZCount(ctx, SortedSetKey, \"-inf\", \"+inf\").Result()\n}", "title": "" }, { "docid": "b0e7d8d87d900d1ac3e150756b321c92", "score": "0.6231899", "text": "func (sets *Sets) Len() int {\n\treturn len(sets.sets)\n}", "title": "" }, { "docid": "9287c2f46b6e1a21abbd22d6460a4775", "score": "0.6218192", "text": "func (s *Set) Len() int {\n\treturn len(s.m)\n}", "title": "" }, { "docid": "9287c2f46b6e1a21abbd22d6460a4775", "score": "0.6218192", "text": "func (s *Set) Len() int {\n\treturn len(s.m)\n}", "title": "" }, { "docid": "5ee733efb00905f6716c897d6c1b818b", "score": "0.620541", "text": "func (s *Dense) Len() int {\n\tsz := 0\n\tfor _, t := range s.sets {\n\t\tsz += t.Len()\n\t}\n\treturn sz\n}", "title": "" }, { "docid": "aa813bf3a610eab9d3a0d5a66b4747b0", "score": "0.61927086", "text": "func (set StringSet) Size() int {\n\treturn len(set)\n}", "title": "" }, { "docid": "9f6c698583959d0a1b7e938ef6d1ffe4", "score": "0.6176993", "text": "func (ps *peerSet) len() int {\n\tps.lock.RLock()\n\tdefer ps.lock.RUnlock()\n\n\treturn len(ps.peers)\n}", "title": "" }, { "docid": "202563506df7c49b8c0ced54b466d23b", "score": "0.6167929", "text": "func (u *UID) NKeys() int { return 0 }", "title": "" }, { "docid": "e452810a079c224a1ef7cf2c52df23c8", "score": "0.616356", "text": "func (f *Bitset) Len() int {\n\treturn popCount(f.Bucket)\n}", "title": "" }, { "docid": "a4b73c49138f10db062c97b529b51d82", "score": "0.61628497", "text": "func (m MultiSet) Count(val string) int {\n\treturn m[val]\n}", "title": "" }, { "docid": "0891d0d3073407dde73f56121a8b374c", "score": "0.61416864", "text": "func (this *EdgeSetDb) Len() int {\n\trdr, _ := this.store.Reader()\n\tdefer rdr.Close()\n\n\tprefix := fmt.Sprintf(\"\\xffe\\xff%s\\xff\", this.v.StringID())\n\tit := rdr.PrefixIterator([]byte(prefix))\n\tvar n int\n\tfor ; it.Valid(); it.Next() {\n\t\tn++\n\t}\n\treturn n\n}", "title": "" }, { "docid": "afc386be2bafab33d9f71bd5bd80978a", "score": "0.6122944", "text": "func (set *threadSafeSet) Size() int {\n\tset.elementsMutex.RLock()\n\tdefer set.elementsMutex.RUnlock()\n\n\treturn len(set.elements)\n}", "title": "" }, { "docid": "b0abc30ce1b24c6ef04164858ab80faf", "score": "0.61181784", "text": "func (set *Set) Size() int {\n\treturn len(*set)\n}", "title": "" }, { "docid": "3be301fc2bafc1d48f3673ecfc50db6c", "score": "0.61031294", "text": "func (s *Set) Len() int {\n\treturn s.data.Len()\n}", "title": "" }, { "docid": "ebbf9507fb5c864f2c3a9a33110f7eb9", "score": "0.6089767", "text": "func (s *IntSet) Len() int {\n\tvar count int\n\tfor _, word := range s.words {\n\t\tif word == 0 {\n\t\t\tcontinue\n\t\t}\n\t\tfor j := 0; j < 64; j++ {\n\t\t\tif word&(1<<uint(j)) != 0 {\n\t\t\t\tcount++\n\t\t\t}\n\t\t}\n\t}\n\treturn count\n}", "title": "" }, { "docid": "2489a3494d598e3caf16aff2977ca982", "score": "0.60812616", "text": "func (p *Properties) Len() int {\n\t// Acquire read lock\n\tp.mutex.RLock()\n\tdefer p.mutex.RUnlock()\n\treturn len(p.keys)\n}", "title": "" }, { "docid": "c95406ed0eca723b01199aa395c39fd8", "score": "0.6053255", "text": "func (om *OrderedMap[K, V]) Len() int {\n\treturn len(om.s)\n}", "title": "" }, { "docid": "f8e1ccb8728d6982f69d4772fe4adb8c", "score": "0.6050189", "text": "func (ss *StringSet) Length() int {\n\treturn len(ss.set)\n}", "title": "" }, { "docid": "71ddf53ca319dc9eaaa5fe99a219d6df", "score": "0.6042577", "text": "func (v Fileset) N() int {\n\tvar n int\n\tfor _, v := range v.List {\n\t\tn += v.N()\n\t}\n\tn += len(v.Map)\n\treturn n\n}", "title": "" }, { "docid": "2e7ed2409eb958be7aee8d611dbaae4e", "score": "0.60348994", "text": "func (a ByID) Len() int { return len(a) }", "title": "" }, { "docid": "e34cfc80ae4faa6855ec2eb6104df339", "score": "0.60074866", "text": "func (this *SafeSet) Size() int {\n\t\n\tdefer this.RUnlock()\n\n\tthis.RLock()\n\treturn len(this.elements)\n}", "title": "" }, { "docid": "03160fbeeebd03863a24686e74f8092a", "score": "0.6004775", "text": "func (s *storeSet) length() int {\n\treturn len(s.working) + len(s.expired)\n}", "title": "" }, { "docid": "3c0caa657cdd1aab67804e43d1ff468c", "score": "0.60001594", "text": "func (p *Publisher) NKeys() int { return 0 }", "title": "" }, { "docid": "0fc380a50a575fead348d297d0edf1fe", "score": "0.5997871", "text": "func (ts *TagsSet) Size() int {\n\treturn len(ts.set)\n}", "title": "" }, { "docid": "4989e48f71032dbbffb014b86ce7ef61", "score": "0.5992249", "text": "func (s *Combination) Size() int {\n\treturn len(s.set)\n}", "title": "" }, { "docid": "1b072428be3e3e6190751c0cdb94b20a", "score": "0.5989225", "text": "func (l *Hash) Len() (keyCount int, err error) {\n\terr = l.cyclone.Raw.Do(radix.Cmd(&keyCount, \"HLEN\", l.key))\n\treturn\n}", "title": "" }, { "docid": "6ac22073f8811f018d7f8be19d994aa0", "score": "0.5988793", "text": "func (p *OrderedMap) Len() int {\n\treturn len(p.keys)\n}", "title": "" }, { "docid": "7f98b26b1a27ce9009c7e1d319b677ec", "score": "0.59812295", "text": "func (rc RecordCollection) Len() int {\n\trSet := rc.Fetch()\n\treturn len(rSet.ids)\n}", "title": "" }, { "docid": "bd2be18f6a3b994ce302b697c3c45dcc", "score": "0.5976213", "text": "func (k *KeyList) Len() int {\n\treturn len(k.keys)\n}", "title": "" }, { "docid": "02557f1d82824d9e24d75b25a16f7c87", "score": "0.59748113", "text": "func (s *Set) Len() int {\n\treturn s.len\n}", "title": "" }, { "docid": "bb4bb4fd956d16831232ccde49cf8859", "score": "0.5971069", "text": "func (m *Map[K, V]) Len() int {\n\tvar i int\n\tm.m.Range(func(k, v interface{}) bool {\n\t\ti++\n\t\treturn true\n\t})\n\treturn i\n}", "title": "" }, { "docid": "718b0f6238058aada528cdb2e088520c", "score": "0.59607995", "text": "func (s *Set) Length() int {\n\treturn int(s.length)\n}", "title": "" }, { "docid": "6c94c6e46f01c2e7da6d3ef43aa25bbc", "score": "0.59606546", "text": "func (s IPSet) Len() int {\n\treturn len(s)\n}", "title": "" }, { "docid": "dc1d88573c1ac3989f18da1fd85ff1ce", "score": "0.596009", "text": "func length(s map[int]bool) int {\n\tn := 0\n\tfor _, ok := range s {\n\t\tif ok {\n\t\t\tn++\n\t\t}\n\t}\n\treturn n\n}", "title": "" }, { "docid": "52fb94d30d2bf9e3a483d73d74fba110", "score": "0.59599274", "text": "func (s *IntSet) Len() (res int) {\n\tfor _, word := range s.words {\n\t\tif word == 0 {\n\t\t\tcontinue\n\t\t}\n\n\t\tfor j := 0; j < Size; j++ {\n\t\t\tif word&(1<<uint(j)) != 0 {\n\t\t\t\tres++\n\t\t\t}\n\t\t}\n\t}\n\treturn\n}", "title": "" }, { "docid": "9cc0b9668550e06e8f52dc7c2d0f02be", "score": "0.5954317", "text": "func (dict *ConcurrentDict) Len() int {\n\tif dict == nil {\n\t\tpanic(\"dict is nil\")\n\t}\n\treturn int(atomic.LoadInt32(&dict.count))\n}", "title": "" }, { "docid": "3a9cea1f19ae1fc6e529fa8262518d81", "score": "0.59502524", "text": "func (s *Set) Len() int32 {\n\treturn s.length\n}", "title": "" }, { "docid": "4334328d65747a7db3df0272e3ba7d60", "score": "0.5949485", "text": "func (s *Set) Len() int {\n\treturn s.ll.Len()\n}", "title": "" }, { "docid": "c3d05b8ea501a4fe7df275f54b6588cc", "score": "0.59438825", "text": "func (a *IntSet) Len() int {\n\tlen := 0\n\tif a != nil {\n\t\ta.RLock()\n\t\t// Make sure to call Sparse implementation of Len()\n\t\tlen = a.Sparse.Len()\n\t\ta.RUnlock()\n\t}\n\treturn len\n}", "title": "" }, { "docid": "60021f312f02e31c659d889258ba0bad", "score": "0.59349", "text": "func (t *TaskSet) Len() int {\n\treturn len(t.set)\n}", "title": "" }, { "docid": "6428bd19b141b29e052eb4a6f4af726f", "score": "0.59312624", "text": "func (s *IntSet) Len() (res int) {\n\tfor _, word := range s.words {\n\t\tfor ; word != 0; word &= word - 1 {\n\t\t\tres ++\n\t\t}\n\t}\n\treturn res\n}", "title": "" }, { "docid": "b4db578f91bdbecff226a592b22204d5", "score": "0.5901298", "text": "func (hm2 *HashMap2) Count() (int64, error) {\n\ta, err := hm2.All()\n\tif err != nil {\n\t\treturn 0, err\n\t}\n\treturn int64(len(a)), nil\n\t// return hm2.KeyValue().Count() is not correct, since it counts all owners + fieldSep + keys\n}", "title": "" }, { "docid": "a0f8e943605e673bd9aa7c7ab4178b0a", "score": "0.5887128", "text": "func (sp *Span) KeyCount(keyCtx *KeyContext, prefixLength int) (int64, bool) {\n\tif prefixLength < 1 {\n\t\t// The length must be at least one because distinct count is undefined for\n\t\t// empty keys.\n\t\treturn 0, false\n\t}\n\tif sp.startBoundary == ExcludeBoundary || sp.endBoundary == ExcludeBoundary {\n\t\t// Bounds must be inclusive.\n\t\treturn 0, false\n\t}\n\n\tstartKey := sp.start\n\tendKey := sp.end\n\tif startKey.Length() < prefixLength || endKey.Length() < prefixLength {\n\t\t// Both keys must have at least 'prefixLength' values.\n\t\treturn 0, false\n\t}\n\n\t// All the datums up to index [prefixLength-2] must be equal.\n\tfor i := 0; i <= (prefixLength - 2); i++ {\n\t\tif startKey.Value(i).ResolvedType() != endKey.Value(i).ResolvedType() {\n\t\t\t// The datums must be of the same type.\n\t\t\treturn 0, false\n\t\t}\n\t\tif keyCtx.Compare(i, startKey.Value(i), endKey.Value(i)) != 0 {\n\t\t\t// The datums must be equal.\n\t\t\treturn 0, false\n\t\t}\n\t}\n\n\tthisVal := startKey.Value(prefixLength - 1)\n\totherVal := endKey.Value(prefixLength - 1)\n\n\tif thisVal.ResolvedType() != otherVal.ResolvedType() {\n\t\t// The datums at index [prefixLength-1] must be of the same type.\n\t\treturn 0, false\n\t}\n\tif keyCtx.Compare(prefixLength-1, thisVal, otherVal) == 0 {\n\t\t// If the datums are equal, the distinct count is 1.\n\t\treturn 1, true\n\t}\n\n\t// If the last columns are countable, return the distinct count between them.\n\tvar start, end int64\n\n\tswitch t := thisVal.(type) {\n\tcase *tree.DInt:\n\t\totherDInt, otherOk := tree.AsDInt(otherVal)\n\t\tif otherOk {\n\t\t\tstart = int64(*t)\n\t\t\tend = int64(otherDInt)\n\t\t}\n\n\tcase *tree.DOid:\n\t\totherDOid, otherOk := tree.AsDOid(otherVal)\n\t\tif otherOk {\n\t\t\tstart = int64((*t).DInt)\n\t\t\tend = int64(otherDOid.DInt)\n\t\t}\n\n\tcase *tree.DDate:\n\t\totherDDate, otherOk := otherVal.(*tree.DDate)\n\t\tif otherOk {\n\t\t\tif !t.IsFinite() || !otherDDate.IsFinite() {\n\t\t\t\t// One of the DDates isn't finite, so we can't extract a distinct count.\n\t\t\t\treturn 0, false\n\t\t\t}\n\t\t\tstart = int64((*t).PGEpochDays())\n\t\t\tend = int64(otherDDate.PGEpochDays())\n\t\t}\n\n\tdefault:\n\t\t// Uncountable type.\n\t\treturn 0, false\n\t}\n\n\tif keyCtx.Columns.Get(prefixLength - 1).Descending() {\n\t\t// Normalize delta according to the key ordering.\n\t\tstart, end = end, start\n\t}\n\n\tif start > end {\n\t\t// Incorrect ordering.\n\t\treturn 0, false\n\t}\n\n\tdelta := end - start\n\tif delta < 0 {\n\t\t// Overflow or underflow.\n\t\treturn 0, false\n\t}\n\treturn delta + 1, true\n}", "title": "" }, { "docid": "ba1388cefd551c89dc7beb986395df04", "score": "0.5886773", "text": "func (h hashArray) Len() int { return len(h) }", "title": "" }, { "docid": "e35e6322c49a3963d9816fb7e9311095", "score": "0.5886294", "text": "func (v Fileset) Size() int64 {\n\tvar s int64\n\tfor _, v := range v.List {\n\t\ts += v.Size()\n\t}\n\tfor _, f := range v.Map {\n\t\ts += f.Size\n\t}\n\treturn s\n}", "title": "" }, { "docid": "66fcd469910dbfb2f0f455ad2bfd9e0b", "score": "0.58832145", "text": "func (s *Set) Size() int {\n\ts.l.RLock()\n\tdefer s.l.RUnlock()\n\n\tl := len(s.m)\n\treturn l\n}", "title": "" }, { "docid": "22c466d7ccc45168e1838529aac66b8e", "score": "0.58828336", "text": "func (s Set) Len() int {\n\treturn len(s)\n}", "title": "" }, { "docid": "bafa205cedb987aa3ecec8cd445b3ae6", "score": "0.58761257", "text": "func (m *UserIdlerMap) Len() int {\n\tm.RLock()\n\tl := len(m.internal)\n\tm.RUnlock()\n\treturn l\n}", "title": "" }, { "docid": "f693a77cf62b0d5264090ffa85af179f", "score": "0.5865078", "text": "func (rm *ResultMap) Len() int {\n\tl := 0\n\trm.sm.Range(func(_, _ interface{}) bool {\n\t\tl++\n\t\treturn true\n\t})\n\treturn l\n}", "title": "" }, { "docid": "cf34a0eba7e2ba0b9444278d05f3cb48", "score": "0.58613783", "text": "func (k *UniqueKey) Len() int {\n\treturn k.Columns.Len()\n}", "title": "" }, { "docid": "0595877cc78e32539a2bb6d75b68ff3e", "score": "0.58527046", "text": "func (rs Runeset) Len() int {\n\treturn len(rs)\n}", "title": "" }, { "docid": "c36b3102c18704ef857726666f30c5d1", "score": "0.58486444", "text": "func (s *IntSet) Len() int {\n\tvar sum int\n\n\tfor _, word := range s.words {\n\t\tif word == 0 {\n\t\t\tcontinue\n\t\t}\n\t\tfor j := 0; j < UINT_SIZE; j++ {\n\t\t\tif word&(1<<uint(j)) != 0 {\n\t\t\t\tsum += 1\n\t\t\t}\n\t\t}\n\t}\n\n\treturn sum\n}", "title": "" }, { "docid": "4263f9c9d734326f982cd2d4155c317d", "score": "0.5846999", "text": "func (s srcSetElements) Len() int {\n\treturn len(s)\n}", "title": "" }, { "docid": "5deadd4e95adecb560b33e8484581fe0", "score": "0.5844078", "text": "func (rm *FilteredResultMap) Len() int {\n\tl := 0\n\trm.sm.Range(func(_, _ interface{}) bool {\n\t\tl++\n\t\treturn true\n\t})\n\treturn l\n}", "title": "" }, { "docid": "a60a6c68c3b5175741f61f7d1072387c", "score": "0.5835832", "text": "func (set *IntSet) Size() int {\n\tset.mu.RLock()\n\tl := len(set.data)\n\tset.mu.RUnlock()\n\treturn l\n}", "title": "" }, { "docid": "6df1fc5f8cdb33cc065dc836d5cc0acf", "score": "0.5829988", "text": "func Size(s Set) int {\n\tr := reflect.TypeOf(s)\n\tvar size uint32\n\tswitch r {\n\tcase staticType:\n\t\tss := s.(*Static)\n\t\tsize = atomic.LoadUint32(&ss.count)\n\t\tif size == 0 {\n\t\t\tss.Range(func(x uint32) bool {\n\t\t\t\tsize += 1\n\t\t\t\treturn true\n\t\t\t})\n\t\t\tatomic.CompareAndSwapUint32(&ss.count, 0, size)\n\t\t}\n\tcase dynamicType:\n\t\tss := s.(*Dynamic)\n\t\te := ss.getEntry()\n\t\tsize = atomic.LoadUint32(&e.count)\n\t\tif size == 0 {\n\t\t\tss.Range(func(x uint32) bool {\n\t\t\t\tsize += 1\n\t\t\t\treturn true\n\t\t\t})\n\t\t\tatomic.CompareAndSwapUint32(&e.count, 0, size)\n\t\t}\n\tdefault:\n\t\ts.Range(func(x uint32) bool {\n\t\t\tsize += 1\n\t\t\treturn true\n\t\t})\n\t}\n\treturn int(size)\n}", "title": "" }, { "docid": "e53efc08bfe6186bd0f23a58369b6453", "score": "0.58111775", "text": "func (m *UserIdlerMap) Len() int {\n\treturn m.internal.Count()\n}", "title": "" }, { "docid": "04d536d47113cbcabba69e0a0316d84d", "score": "0.580505", "text": "func (ndbm *NDBM) Len() int {\n\tcount := 0\n\t_ = ndbm.KeysCallback(func(_ []byte) error {\n\t\tcount++\n\t\treturn nil\n\t})\n\treturn count\n}", "title": "" }, { "docid": "00bbd126a1d4c057a3ccf97d78510cdb", "score": "0.5804021", "text": "func (ss *stringSetImpl) Size() int {\n\treturn len(*ss)\n}", "title": "" } ]
ae8b4847680815deea0a32f51e466482
IfNoneMatch sets the optional parameter which makes the operation fail if the object's ETag matches the given value. This is useful for getting updates only after the object has changed since the last request. Use googleapi.IsNotModified to check whether the response error from Do is the result of InNoneMatch.
[ { "docid": "b2769d7dfb761aa9290633048f5faed8", "score": "0.73515165", "text": "func (c *ProjectsLocationsOperationsGetCall) IfNoneMatch(entityTag string) *ProjectsLocationsOperationsGetCall {\n\tc.ifNoneMatch_ = entityTag\n\treturn c\n}", "title": "" } ]
[ { "docid": "91354648f724b2e202a1591f0ae541c8", "score": "0.79354554", "text": "func (c *RevisionsCheckCall) IfNoneMatch(entityTag string) *RevisionsCheckCall {\n\tc.ifNoneMatch_ = entityTag\n\treturn c\n}", "title": "" }, { "docid": "06910b112c438ec714777f9c114faad5", "score": "0.7863312", "text": "func (c *RevisionsGetCall) IfNoneMatch(entityTag string) *RevisionsGetCall {\n\tc.ifNoneMatch_ = entityTag\n\treturn c\n}", "title": "" }, { "docid": "89ced2e75a141da2cd05d1841b59ce82", "score": "0.7678038", "text": "func (c *RevisionsListCall) IfNoneMatch(entityTag string) *RevisionsListCall {\n\tc.ifNoneMatch_ = entityTag\n\treturn c\n}", "title": "" }, { "docid": "313f3e5d86a5896372e86c1d53e85805", "score": "0.7660166", "text": "func (c *ChangesListCall) IfNoneMatch(entityTag string) *ChangesListCall {\n\tc.ifNoneMatch_ = entityTag\n\treturn c\n}", "title": "" }, { "docid": "33508bfc082f14abd7cf4287b4fc01ef", "score": "0.7656869", "text": "func (c *OperationsGetCall) IfNoneMatch(entityTag string) *OperationsGetCall {\n\tc.ifNoneMatch_ = entityTag\n\treturn c\n}", "title": "" }, { "docid": "33508bfc082f14abd7cf4287b4fc01ef", "score": "0.7656869", "text": "func (c *OperationsGetCall) IfNoneMatch(entityTag string) *OperationsGetCall {\n\tc.ifNoneMatch_ = entityTag\n\treturn c\n}", "title": "" }, { "docid": "33508bfc082f14abd7cf4287b4fc01ef", "score": "0.7656869", "text": "func (c *OperationsGetCall) IfNoneMatch(entityTag string) *OperationsGetCall {\n\tc.ifNoneMatch_ = entityTag\n\treturn c\n}", "title": "" }, { "docid": "33508bfc082f14abd7cf4287b4fc01ef", "score": "0.7656869", "text": "func (c *OperationsGetCall) IfNoneMatch(entityTag string) *OperationsGetCall {\n\tc.ifNoneMatch_ = entityTag\n\treturn c\n}", "title": "" }, { "docid": "33508bfc082f14abd7cf4287b4fc01ef", "score": "0.7656869", "text": "func (c *OperationsGetCall) IfNoneMatch(entityTag string) *OperationsGetCall {\n\tc.ifNoneMatch_ = entityTag\n\treturn c\n}", "title": "" }, { "docid": "6eb2c6bb431e87530daa6bc7d5d9c665", "score": "0.76386863", "text": "func (c *RepliesGetCall) IfNoneMatch(entityTag string) *RepliesGetCall {\n\tc.ifNoneMatch_ = entityTag\n\treturn c\n}", "title": "" }, { "docid": "0d808e995722fd500bd510bde12c7809", "score": "0.75749403", "text": "func (c *ResourcesGetCall) IfNoneMatch(entityTag string) *ResourcesGetCall {\n\tc.ifNoneMatch_ = entityTag\n\treturn c\n}", "title": "" }, { "docid": "9e1fe9b57e0e1e329a71233ec5865f8b", "score": "0.756131", "text": "func (c *RollingUpdatesGetCall) IfNoneMatch(entityTag string) *RollingUpdatesGetCall {\n\tc.ifNoneMatch_ = entityTag\n\treturn c\n}", "title": "" }, { "docid": "0f347fa287e45deb5fd5d6bf0577d174", "score": "0.7546139", "text": "func (c *SnapshotsGetCall) IfNoneMatch(entityTag string) *SnapshotsGetCall {\n\tc.ifNoneMatch_ = entityTag\n\treturn c\n}", "title": "" }, { "docid": "0d74aa5ac849e29a41c3e9e51d50f7e8", "score": "0.74949646", "text": "func (c *ProjectsLocationsGetStatusCall) IfNoneMatch(entityTag string) *ProjectsLocationsGetStatusCall {\n\tc.ifNoneMatch_ = entityTag\n\treturn c\n}", "title": "" }, { "docid": "801381a39ecd1f3a1034e1d0aa5ef5ed", "score": "0.74869466", "text": "func (c *RollingUpdatesListInstanceUpdatesCall) IfNoneMatch(entityTag string) *RollingUpdatesListInstanceUpdatesCall {\n\tc.ifNoneMatch_ = entityTag\n\treturn c\n}", "title": "" }, { "docid": "ff54730016002d4bf6ca19e8989ec10a", "score": "0.74800193", "text": "func (c *ZoneOperationsGetCall) IfNoneMatch(entityTag string) *ZoneOperationsGetCall {\n\tc.ifNoneMatch_ = entityTag\n\treturn c\n}", "title": "" }, { "docid": "ac4bc6946a61715ace6ea03e412bd312", "score": "0.74725646", "text": "func (c *AboutGetCall) IfNoneMatch(entityTag string) *AboutGetCall {\n\tc.ifNoneMatch_ = entityTag\n\treturn c\n}", "title": "" }, { "docid": "20b1b6d5651ed250943e04c76cb3e606", "score": "0.7457441", "text": "func (c *StatesGetCall) IfNoneMatch(entityTag string) *StatesGetCall {\n\tc.ifNoneMatch_ = entityTag\n\treturn c\n}", "title": "" }, { "docid": "159a08b69c7d8e38e8dacfeee4845c8d", "score": "0.74337757", "text": "func (c *ChangesGetStartPageTokenCall) IfNoneMatch(entityTag string) *ChangesGetStartPageTokenCall {\n\tc.ifNoneMatch_ = entityTag\n\treturn c\n}", "title": "" }, { "docid": "aed607b5a90940033f5389b05ae7b932", "score": "0.7428779", "text": "func (c *FilesGetCall) IfNoneMatch(entityTag string) *FilesGetCall {\n\tc.ifNoneMatch_ = entityTag\n\treturn c\n}", "title": "" }, { "docid": "fb4b7f29a800bb451087505030a5840f", "score": "0.74256796", "text": "func (c *StatsGetUserCall) IfNoneMatch(entityTag string) *StatsGetUserCall {\n\tc.ifNoneMatch_ = entityTag\n\treturn c\n}", "title": "" }, { "docid": "7fad40fc3eda7895f8d845088cfd3d25", "score": "0.7419555", "text": "func (c *RepliesListCall) IfNoneMatch(entityTag string) *RepliesListCall {\n\tc.ifNoneMatch_ = entityTag\n\treturn c\n}", "title": "" }, { "docid": "eeb01d9d17e237f377a5accb9b9c1955", "score": "0.7414923", "text": "func (c *StatsGetSessionCall) IfNoneMatch(entityTag string) *StatsGetSessionCall {\n\tc.ifNoneMatch_ = entityTag\n\treturn c\n}", "title": "" }, { "docid": "798e948573c464c36499ff58371571b4", "score": "0.7414206", "text": "func (c *EndpointsGetCall) IfNoneMatch(entityTag string) *EndpointsGetCall {\n\tc.ifNoneMatch_ = entityTag\n\treturn c\n}", "title": "" }, { "docid": "3d5d64c4c5d90f45d93a04ced5c04d49", "score": "0.7405345", "text": "func (c *OperationsListCall) IfNoneMatch(entityTag string) *OperationsListCall {\n\tc.ifNoneMatch_ = entityTag\n\treturn c\n}", "title": "" }, { "docid": "3d5d64c4c5d90f45d93a04ced5c04d49", "score": "0.7405345", "text": "func (c *OperationsListCall) IfNoneMatch(entityTag string) *OperationsListCall {\n\tc.ifNoneMatch_ = entityTag\n\treturn c\n}", "title": "" }, { "docid": "3d5d64c4c5d90f45d93a04ced5c04d49", "score": "0.7405345", "text": "func (c *OperationsListCall) IfNoneMatch(entityTag string) *OperationsListCall {\n\tc.ifNoneMatch_ = entityTag\n\treturn c\n}", "title": "" }, { "docid": "3d5d64c4c5d90f45d93a04ced5c04d49", "score": "0.7405345", "text": "func (c *OperationsListCall) IfNoneMatch(entityTag string) *OperationsListCall {\n\tc.ifNoneMatch_ = entityTag\n\treturn c\n}", "title": "" }, { "docid": "69544baf9950ebcdddbbdee4efe10956", "score": "0.73814857", "text": "func (c *ManifestsGetCall) IfNoneMatch(entityTag string) *ManifestsGetCall {\n\tc.ifNoneMatch_ = entityTag\n\treturn c\n}", "title": "" }, { "docid": "98a4533749df1f32789ab45531d8e20a", "score": "0.7381332", "text": "func (c *ResourcesListCall) IfNoneMatch(entityTag string) *ResourcesListCall {\n\tc.ifNoneMatch_ = entityTag\n\treturn c\n}", "title": "" }, { "docid": "753aeb6769fb88c40aa39f9ab166b5a8", "score": "0.73782015", "text": "func (c *OrganizationsProtectedResourcesSearchCall) IfNoneMatch(entityTag string) *OrganizationsProtectedResourcesSearchCall {\n\tc.ifNoneMatch_ = entityTag\n\treturn c\n}", "title": "" }, { "docid": "a65631a5ecd2e943ef5aace5390f56b2", "score": "0.73765296", "text": "func (c *StatesListCall) IfNoneMatch(entityTag string) *StatesListCall {\n\tc.ifNoneMatch_ = entityTag\n\treturn c\n}", "title": "" }, { "docid": "e6261f886fcaa83d75f6a9ca28a9eafe", "score": "0.7351304", "text": "func (c *SnapshotsListCall) IfNoneMatch(entityTag string) *SnapshotsListCall {\n\tc.ifNoneMatch_ = entityTag\n\treturn c\n}", "title": "" }, { "docid": "7222c9c52087154062bb552dfc0ad4ed", "score": "0.7326938", "text": "func (c *ProjectsLocationsInstancesIsUpgradeableCall) IfNoneMatch(entityTag string) *ProjectsLocationsInstancesIsUpgradeableCall {\n\tc.ifNoneMatch_ = entityTag\n\treturn c\n}", "title": "" }, { "docid": "a997c136f9276629c4054fade7a40a59", "score": "0.73254436", "text": "func (c *RollingUpdatesListCall) IfNoneMatch(entityTag string) *RollingUpdatesListCall {\n\tc.ifNoneMatch_ = entityTag\n\treturn c\n}", "title": "" }, { "docid": "82e45e877ee99ac66935ae3142bb3dad", "score": "0.7323768", "text": "func (c *LimitsGetLabelCall) IfNoneMatch(entityTag string) *LimitsGetLabelCall {\n\tc.ifNoneMatch_ = entityTag\n\treturn c\n}", "title": "" }, { "docid": "2d1a8e498c7ed3a6a89e51ef84785489", "score": "0.7323637", "text": "func (c *StatsGetCall) IfNoneMatch(entityTag string) *StatsGetCall {\n\tc.ifNoneMatch_ = entityTag\n\treturn c\n}", "title": "" }, { "docid": "ab8408c81ff837aeb5048aa0c09be5f6", "score": "0.7316337", "text": "func (c *EndpointsListCall) IfNoneMatch(entityTag string) *EndpointsListCall {\n\tc.ifNoneMatch_ = entityTag\n\treturn c\n}", "title": "" }, { "docid": "a924810a209ebc043d6286f028dd7c6e", "score": "0.7308618", "text": "func (c *OperationsLroListCall) IfNoneMatch(entityTag string) *OperationsLroListCall {\n\tc.ifNoneMatch_ = entityTag\n\treturn c\n}", "title": "" }, { "docid": "678f682c65e481347b21a1620e233368", "score": "0.7306772", "text": "func (c *StatsGetIndexCall) IfNoneMatch(entityTag string) *StatsGetIndexCall {\n\tc.ifNoneMatch_ = entityTag\n\treturn c\n}", "title": "" }, { "docid": "f64654df24b1da67106ab3c37ea742ec", "score": "0.72858936", "text": "func (c *OrganizationsLocationsOperationsGetCall) IfNoneMatch(entityTag string) *OrganizationsLocationsOperationsGetCall {\n\tc.ifNoneMatch_ = entityTag\n\treturn c\n}", "title": "" }, { "docid": "500f2dc690d7acd06511ee11d0dccb78", "score": "0.72773415", "text": "func (c *CseListCall) IfNoneMatch(entityTag string) *CseListCall {\n\tc.ifNoneMatch_ = entityTag\n\treturn c\n}", "title": "" }, { "docid": "20bf010ae9c4484657797f2ed2264916", "score": "0.7277313", "text": "func (c *ManifestsListCall) IfNoneMatch(entityTag string) *ManifestsListCall {\n\tc.ifNoneMatch_ = entityTag\n\treturn c\n}", "title": "" }, { "docid": "e82f7fe6c7e3c700a85e191c7073fd60", "score": "0.72766256", "text": "func (c *EventsListByPlayerCall) IfNoneMatch(entityTag string) *EventsListByPlayerCall {\n\tc.ifNoneMatch_ = entityTag\n\treturn c\n}", "title": "" }, { "docid": "0fb07ff5e1d0b06a5ec209ed1e2c9303", "score": "0.7262246", "text": "func (c *ProjectsLocationsFunctionsGetCall) IfNoneMatch(entityTag string) *ProjectsLocationsFunctionsGetCall {\n\tc.ifNoneMatch_ = entityTag\n\treturn c\n}", "title": "" }, { "docid": "48e9c351001ac4182520fdc122976a10", "score": "0.72616714", "text": "func (c *StatsGetQueryCall) IfNoneMatch(entityTag string) *StatsGetQueryCall {\n\tc.ifNoneMatch_ = entityTag\n\treturn c\n}", "title": "" }, { "docid": "aa14c0c582c227fd31bd15ec07c530bc", "score": "0.7261471", "text": "func (c *PlayersGetCall) IfNoneMatch(entityTag string) *PlayersGetCall {\n\tc.ifNoneMatch_ = entityTag\n\treturn c\n}", "title": "" }, { "docid": "59b08c60ae4add8101ac7521bedb2b1e", "score": "0.7259619", "text": "func IfNoneMatch(etag string) Option {\n\treturn func(in *inputModel) { in.etag = etag }\n}", "title": "" }, { "docid": "1f21ef3e05c6a005e43aa8d716db7fee", "score": "0.72575057", "text": "func (c *TypeProvidersGetTypeCall) IfNoneMatch(entityTag string) *TypeProvidersGetTypeCall {\n\tc.ifNoneMatch_ = entityTag\n\treturn c\n}", "title": "" }, { "docid": "8dab9f2d7ed4a0ed8efb25d317507b9e", "score": "0.7248711", "text": "func (c *BeaconsGetCall) IfNoneMatch(entityTag string) *BeaconsGetCall {\n\tc.ifNoneMatch_ = entityTag\n\treturn c\n}", "title": "" }, { "docid": "a54d6b4a1f52559e097f397e14fae795", "score": "0.7242458", "text": "func (c *NamespacesListCall) IfNoneMatch(entityTag string) *NamespacesListCall {\n\tc.ifNoneMatch_ = entityTag\n\treturn c\n}", "title": "" }, { "docid": "b58b603fdb72cabc2f3266d560603e1b", "score": "0.7240068", "text": "func (c *TeamdrivesListCall) IfNoneMatch(entityTag string) *TeamdrivesListCall {\n\tc.ifNoneMatch_ = entityTag\n\treturn c\n}", "title": "" }, { "docid": "17b8fbed7820eeb650c736c11ff843db", "score": "0.72327214", "text": "func (c *LabelsRevisionsLocksListCall) IfNoneMatch(entityTag string) *LabelsRevisionsLocksListCall {\n\tc.ifNoneMatch_ = entityTag\n\treturn c\n}", "title": "" }, { "docid": "578057c2771b96ba16988efa596dac72", "score": "0.7231982", "text": "func (c *SitemapsGetCall) IfNoneMatch(entityTag string) *SitemapsGetCall {\n\tc.ifNoneMatch_ = entityTag\n\treturn c\n}", "title": "" }, { "docid": "b8e06eb5e71978ae6368e60a02722d64", "score": "0.72277176", "text": "func (c *AccountsCreativesGetCall) IfNoneMatch(entityTag string) *AccountsCreativesGetCall {\n\tc.ifNoneMatch_ = entityTag\n\treturn c\n}", "title": "" }, { "docid": "75a56233fbed7828690d42d5fe088e63", "score": "0.72188854", "text": "func (c *DrivesGetCall) IfNoneMatch(entityTag string) *DrivesGetCall {\n\tc.ifNoneMatch_ = entityTag\n\treturn c\n}", "title": "" }, { "docid": "34bff9d369b4791586b5b52e4a1acdc5", "score": "0.721272", "text": "func (c *DeploymentsGetIamPolicyCall) IfNoneMatch(entityTag string) *DeploymentsGetIamPolicyCall {\n\tc.ifNoneMatch_ = entityTag\n\treturn c\n}", "title": "" }, { "docid": "67c54c510a7710cf563252c0f20bf03a", "score": "0.72104895", "text": "func (c *FilesExportCall) IfNoneMatch(entityTag string) *FilesExportCall {\n\tc.ifNoneMatch_ = entityTag\n\treturn c\n}", "title": "" }, { "docid": "da8940d62e6e450e8651af4e3ff8a4f2", "score": "0.72096807", "text": "func (c *AccountsClientsGetCall) IfNoneMatch(entityTag string) *AccountsClientsGetCall {\n\tc.ifNoneMatch_ = entityTag\n\treturn c\n}", "title": "" }, { "docid": "55419a61278b5a1a036e7d969d73e05d", "score": "0.7204025", "text": "func (c *TeamdrivesGetCall) IfNoneMatch(entityTag string) *TeamdrivesGetCall {\n\tc.ifNoneMatch_ = entityTag\n\treturn c\n}", "title": "" }, { "docid": "58aba81bf262ffca3996959f58b72d72", "score": "0.72003126", "text": "func (c *ProjectsLocationsInstancesGetInstanceHealthCall) IfNoneMatch(entityTag string) *ProjectsLocationsInstancesGetInstanceHealthCall {\n\tc.ifNoneMatch_ = entityTag\n\treturn c\n}", "title": "" }, { "docid": "8822c31e1a09140ba00f184a95bc4a3b", "score": "0.7198967", "text": "func (c *IndexingDatasourcesItemsGetCall) IfNoneMatch(entityTag string) *IndexingDatasourcesItemsGetCall {\n\tc.ifNoneMatch_ = entityTag\n\treturn c\n}", "title": "" }, { "docid": "61e361a77965cd19cefaba365fa4d7ed", "score": "0.7192991", "text": "func (c *ApplicationsVerifyCall) IfNoneMatch(entityTag string) *ApplicationsVerifyCall {\n\tc.ifNoneMatch_ = entityTag\n\treturn c\n}", "title": "" }, { "docid": "fd02628b40fc49a1d088f9eddf09daab", "score": "0.71824235", "text": "func (c *PlayersListCall) IfNoneMatch(entityTag string) *PlayersListCall {\n\tc.ifNoneMatch_ = entityTag\n\treturn c\n}", "title": "" }, { "docid": "2be339ef12c8ca98a79753d8844c27eb", "score": "0.7180504", "text": "func (c *ProjectsLocationsVolumesLunsGetCall) IfNoneMatch(entityTag string) *ProjectsLocationsVolumesLunsGetCall {\n\tc.ifNoneMatch_ = entityTag\n\treturn c\n}", "title": "" }, { "docid": "c05bd8ef0c68af4d005bcf8b44f5b794", "score": "0.7177649", "text": "func (c *ProjectsLocationsVolumesLunsListCall) IfNoneMatch(entityTag string) *ProjectsLocationsVolumesLunsListCall {\n\tc.ifNoneMatch_ = entityTag\n\treturn c\n}", "title": "" }, { "docid": "49d4860ece438a1bad56aaaa836804b6", "score": "0.71751606", "text": "func (c *ProjectsLocationsImageVersionsListCall) IfNoneMatch(entityTag string) *ProjectsLocationsImageVersionsListCall {\n\tc.ifNoneMatch_ = entityTag\n\treturn c\n}", "title": "" }, { "docid": "8fb1bdcdcd718994a6f4147651dcf85f", "score": "0.71729934", "text": "func (c *ZoneOperationsListCall) IfNoneMatch(entityTag string) *ZoneOperationsListCall {\n\tc.ifNoneMatch_ = entityTag\n\treturn c\n}", "title": "" }, { "docid": "cfb23883cf71aab0ead27c01271ebd12", "score": "0.71724725", "text": "func (c *ProjectsLocationsRuntimesGetIamPolicyCall) IfNoneMatch(entityTag string) *ProjectsLocationsRuntimesGetIamPolicyCall {\n\tc.ifNoneMatch_ = entityTag\n\treturn c\n}", "title": "" }, { "docid": "d596dbacca2190892e0d044e6f1d7997", "score": "0.71714175", "text": "func (c *BeaconsListCall) IfNoneMatch(entityTag string) *BeaconsListCall {\n\tc.ifNoneMatch_ = entityTag\n\treturn c\n}", "title": "" }, { "docid": "d86aa50d6fc5af4ce5bfb9d1d219579a", "score": "0.7169985", "text": "func (o *GetLatestIntelRuleFileParams) SetIfNoneMatch(ifNoneMatch *string) {\n\to.IfNoneMatch = ifNoneMatch\n}", "title": "" }, { "docid": "aca44aaf284339161d87529d39db63fd", "score": "0.7167138", "text": "func (c *SiterestrictListCall) IfNoneMatch(entityTag string) *SiterestrictListCall {\n\tc.ifNoneMatch_ = entityTag\n\treturn c\n}", "title": "" }, { "docid": "c086a6c027b32e35d09ba702c51d98bc", "score": "0.716107", "text": "func (c *ProjectsLocationsFunctionsGetIamPolicyCall) IfNoneMatch(entityTag string) *ProjectsLocationsFunctionsGetIamPolicyCall {\n\tc.ifNoneMatch_ = entityTag\n\treturn c\n}", "title": "" }, { "docid": "46f6dad8624b8089e4a3786b9dc19646", "score": "0.71541667", "text": "func (c *ProjectsLocationsGetCall) IfNoneMatch(entityTag string) *ProjectsLocationsGetCall {\n\tc.ifNoneMatch_ = entityTag\n\treturn c\n}", "title": "" }, { "docid": "46f6dad8624b8089e4a3786b9dc19646", "score": "0.71541667", "text": "func (c *ProjectsLocationsGetCall) IfNoneMatch(entityTag string) *ProjectsLocationsGetCall {\n\tc.ifNoneMatch_ = entityTag\n\treturn c\n}", "title": "" }, { "docid": "46f6dad8624b8089e4a3786b9dc19646", "score": "0.71541667", "text": "func (c *ProjectsLocationsGetCall) IfNoneMatch(entityTag string) *ProjectsLocationsGetCall {\n\tc.ifNoneMatch_ = entityTag\n\treturn c\n}", "title": "" }, { "docid": "46f6dad8624b8089e4a3786b9dc19646", "score": "0.71541667", "text": "func (c *ProjectsLocationsGetCall) IfNoneMatch(entityTag string) *ProjectsLocationsGetCall {\n\tc.ifNoneMatch_ = entityTag\n\treturn c\n}", "title": "" }, { "docid": "46f6dad8624b8089e4a3786b9dc19646", "score": "0.71541667", "text": "func (c *ProjectsLocationsGetCall) IfNoneMatch(entityTag string) *ProjectsLocationsGetCall {\n\tc.ifNoneMatch_ = entityTag\n\treturn c\n}", "title": "" }, { "docid": "46f6dad8624b8089e4a3786b9dc19646", "score": "0.71541667", "text": "func (c *ProjectsLocationsGetCall) IfNoneMatch(entityTag string) *ProjectsLocationsGetCall {\n\tc.ifNoneMatch_ = entityTag\n\treturn c\n}", "title": "" }, { "docid": "46f6dad8624b8089e4a3786b9dc19646", "score": "0.71541667", "text": "func (c *ProjectsLocationsGetCall) IfNoneMatch(entityTag string) *ProjectsLocationsGetCall {\n\tc.ifNoneMatch_ = entityTag\n\treturn c\n}", "title": "" }, { "docid": "46f6dad8624b8089e4a3786b9dc19646", "score": "0.71541667", "text": "func (c *ProjectsLocationsGetCall) IfNoneMatch(entityTag string) *ProjectsLocationsGetCall {\n\tc.ifNoneMatch_ = entityTag\n\treturn c\n}", "title": "" }, { "docid": "46f6dad8624b8089e4a3786b9dc19646", "score": "0.71541667", "text": "func (c *ProjectsLocationsGetCall) IfNoneMatch(entityTag string) *ProjectsLocationsGetCall {\n\tc.ifNoneMatch_ = entityTag\n\treturn c\n}", "title": "" }, { "docid": "46f6dad8624b8089e4a3786b9dc19646", "score": "0.71541667", "text": "func (c *ProjectsLocationsGetCall) IfNoneMatch(entityTag string) *ProjectsLocationsGetCall {\n\tc.ifNoneMatch_ = entityTag\n\treturn c\n}", "title": "" }, { "docid": "9ae1ae45aacf81be59da17883a3016b7", "score": "0.71525574", "text": "func (c *ProjectsLocationsGetServerConfigCall) IfNoneMatch(entityTag string) *ProjectsLocationsGetServerConfigCall {\n\tc.ifNoneMatch_ = entityTag\n\treturn c\n}", "title": "" }, { "docid": "930b60c1d9e8ec86591c0140a47c854d", "score": "0.7151157", "text": "func (c *ProjectsLocationsDocumentSchemasListCall) IfNoneMatch(entityTag string) *ProjectsLocationsDocumentSchemasListCall {\n\tc.ifNoneMatch_ = entityTag\n\treturn c\n}", "title": "" }, { "docid": "4a49f77318442e07f7855878a8967275", "score": "0.71510965", "text": "func (c *OrganizationsLocationsOperationsListCall) IfNoneMatch(entityTag string) *OrganizationsLocationsOperationsListCall {\n\tc.ifNoneMatch_ = entityTag\n\treturn c\n}", "title": "" }, { "docid": "a31b465b136d9aca280028056472b10a", "score": "0.71471477", "text": "func (c *CompositeTypesGetCall) IfNoneMatch(entityTag string) *CompositeTypesGetCall {\n\tc.ifNoneMatch_ = entityTag\n\treturn c\n}", "title": "" }, { "docid": "f1101c641816291ec9b7de30a095299e", "score": "0.71447563", "text": "func (c *FilesListCall) IfNoneMatch(entityTag string) *FilesListCall {\n\tc.ifNoneMatch_ = entityTag\n\treturn c\n}", "title": "" } ]
46e7709f59014719d0e5b3d33b2fbf9e
endstyle modifies an SVG object, with either a series of name="value" pairs, or a single string containing a style
[ { "docid": "adb64f817fa63c53c38dd2e18d49165d", "score": "0.66828763", "text": "func endstyle(s []string, endtag string) string {\n\tif len(s) > 0 {\n\t\tnv := \"\"\n\t\tfor i := 0; i < len(s); i++ {\n\t\t\tif strings.Index(s[i], \"=\") > 0 {\n\t\t\t\tnv += (s[i]) + \" \"\n\t\t\t} else {\n\t\t\t\tnv += style(s[i]) + \" \"\n\t\t\t}\n\t\t}\n\t\treturn nv + endtag\n\t}\n\treturn endtag\n\n}", "title": "" } ]
[ { "docid": "255d8e914010ff09d717771031984f5a", "score": "0.67112464", "text": "func (svg *SVG) Gstyle(s string) { svg.println(group(\"style\", s)) }", "title": "" }, { "docid": "089f73cff7c634fab0e2e14f3ab94484", "score": "0.6704565", "text": "func endstyle(s []string, endtag string) string {\n\tif len(s) > 0 {\n\t\tnv := \"\"\n\t\tfor i := 0; i < len(s); i++ {\n\t\t\tif strings.Index(s[i], \"=\") > 0 {\n\t\t\t\tnv += (s[i]) + \" \"\n\t\t\t} else {\n\t\t\t\tnv += style(s[i])\n\t\t\t}\n\t\t}\n\t\treturn nv + endtag\n\t}\n\treturn endtag\n\n}", "title": "" }, { "docid": "6d4ac0bac374fa25580a91e59dae73c0", "score": "0.62955576", "text": "func (svg *SVG) End() { svg.println(\"</svg>\") }", "title": "" }, { "docid": "7313f9c73da14407ddff2e3cacb34131", "score": "0.62813705", "text": "func (svg *SVG) Gend() { svg.println(`</g>`) }", "title": "" }, { "docid": "96b0c76fb4eff1d3f98f4d514f494617", "score": "0.61923116", "text": "func SVGEnd() string {\n\tvar endstr string\n\tendstr = `</svg>`\n\treturn endstr\n}", "title": "" }, { "docid": "0dee0a7a2abd918ff2c70492fc98f96f", "score": "0.58802414", "text": "func (svg *SVG) End() {\n\tsvg.println(\"</svg>\")\n}", "title": "" }, { "docid": "121d10bdb241e50e0b93f4747d53694b", "score": "0.5533187", "text": "func (svg *SVG) DefEnd() { svg.println(`</defs>`) }", "title": "" }, { "docid": "f0a101be0a96c063f1ca405d2074f1f4", "score": "0.5205764", "text": "func SVGWriter(w io.Writer, t time.Time) {\n\tio.WriteString(w, svgStart)\n\tio.WriteString(w, bezel)\n\tsecondHand(w, t)\n\tminuteHand(w, t)\n\thourHand(w, t)\n\tio.WriteString(w, svgEnd)\n}", "title": "" }, { "docid": "b7e6af15c0ccc8c87f46725ac7eabea5", "score": "0.5179476", "text": "func (svg *SVG) Close(tag string) {\n\tsvg.printf(\"</%s>\\n\", tag)\n}", "title": "" }, { "docid": "dda209f6f0504573281a7956de908585", "score": "0.5177331", "text": "func (s *Canvas) DocClose() { s.println(`</svg>`) }", "title": "" }, { "docid": "7aa9702dc01534169f79e14820cfcf15", "score": "0.5120326", "text": "func StyleSVG(gii gi.Node2D) {\n\tg := gii.AsNode2D()\n\tmvp := g.ViewportSafe()\n\tif mvp == nil { // robust\n\t\tgii.Init2D()\n\t}\n\n\tpntr, ok := gii.(gist.Painter)\n\tif !ok {\n\t\treturn\n\t}\n\tpc := pntr.Paint()\n\n\t// todo: do StyleMu for SVG nodes, then can access viewport directly\n\tmvp = g.ViewportSafe()\n\tif mvp == nil {\n\t\treturn\n\t}\n\tctxt := mvp.This().(gist.Context)\n\tpsvg := ParentSVG(g)\n\tif psvg != nil {\n\t\tctxt = psvg.This().(gist.Context)\n\t}\n\n\tmvp.SetCurStyleNode(gii)\n\tdefer mvp.SetCurStyleNode(nil)\n\n\tpc.StyleSet = false // this is always first call, restart\n\n\tpp := g.ParentPaint()\n\tif pp != nil {\n\t\tpc.CopyStyleFrom(pp)\n\t\tpc.SetStyleProps(pp, *gii.Properties(), ctxt)\n\t} else {\n\t\tpc.SetStyleProps(nil, *gii.Properties(), ctxt)\n\t}\n\t// pc.SetUnitContext(g.Viewport, mat32.Vec2Zero)\n\tpc.ToDotsImpl(&pc.UnContext) // we always inherit parent's unit context -- SVG sets it once-and-for-all\n\n\tpagg := g.ParentCSSAgg()\n\tif pagg != nil {\n\t\tgi.AggCSS(&g.CSSAgg, *pagg)\n\t} else {\n\t\tg.CSSAgg = nil\n\t}\n\tgi.AggCSS(&g.CSSAgg, g.CSS)\n\tStyleCSS(gii, g.CSSAgg)\n\tif !pc.Display || pc.HasNoStrokeOrFill() {\n\t\tpc.Off = true\n\t} else {\n\t\tpc.Off = false\n\t}\n}", "title": "" }, { "docid": "bbfeb4417ddce45e0bf9d6274ff69ac1", "score": "0.50794566", "text": "func (svg *SVG) Fend() {\n\tsvg.println(`</filter>`)\n}", "title": "" }, { "docid": "e320cce78b13021b8a464021f32836c6", "score": "0.4922834", "text": "func (svg *SVG) MarkerEnd() { svg.println(`</marker>`) }", "title": "" }, { "docid": "832cb19f71b09f5d0d313b11cbb7a2c5", "score": "0.48479226", "text": "func (svg *SVG) MaskEnd() { svg.println(`</mask>`) }", "title": "" }, { "docid": "381665e57da0041cbfcb83f2158c4505", "score": "0.4845454", "text": "func newStyle(fg, bg lib.ColorPair, bold bool) func(string) string {\n\ts := te.Style{}.Foreground(fg.Color()).Background(bg.Color())\n\tif bold {\n\t\ts = s.Bold()\n\t}\n\treturn s.Styled\n}", "title": "" }, { "docid": "3685697dbabe2e721727cfa7e2cf7564", "score": "0.48177195", "text": "func newStyle(fg, bg common.ColorPair) func(string) string {\n\treturn te.Style{}.Foreground(fg.Color()).Background(bg.Color()).Styled\n}", "title": "" }, { "docid": "32198d8c22c05e14686f50c382285e22", "score": "0.4800652", "text": "func (s *StyleFormat) afterSet() {\n\t//pack fill\n\tif s.fill.Pattern != nil && *s.fill.Pattern == (ml.PatternFill{}) {\n\t\ts.fill.Pattern = nil\n\t}\n\n\tif s.fill.Gradient != nil && reflect.DeepEqual(s.fill.Gradient, &ml.GradientFill{}) {\n\t\ts.fill.Gradient = nil\n\t}\n\n\t//pack border\n\tif s.border.Left != nil && *s.border.Left == (ml.BorderSegment{}) {\n\t\ts.border.Left = nil\n\t}\n\n\tif s.border.Right != nil && *s.border.Right == (ml.BorderSegment{}) {\n\t\ts.border.Right = nil\n\t}\n\n\tif s.border.Top != nil && *s.border.Top == (ml.BorderSegment{}) {\n\t\ts.border.Top = nil\n\t}\n\n\tif s.border.Bottom != nil && *s.border.Bottom == (ml.BorderSegment{}) {\n\t\ts.border.Bottom = nil\n\t}\n\n\tif s.border.Diagonal != nil && *s.border.Diagonal == (ml.BorderSegment{}) {\n\t\ts.border.Diagonal = nil\n\t}\n\n\tif s.border.Vertical != nil && *s.border.Vertical == (ml.BorderSegment{}) {\n\t\ts.border.Vertical = nil\n\t}\n\n\tif s.border.Horizontal != nil && *s.border.Horizontal == (ml.BorderSegment{}) {\n\t\ts.border.Horizontal = nil\n\t}\n}", "title": "" }, { "docid": "fcf5a077d450548db2eb6a5576965e2c", "score": "0.47985768", "text": "func (svg *SVG) Group(s ...string) { svg.printf(\"<g %s\\n\", endstyle(s, `>`)) }", "title": "" }, { "docid": "c19f140528f68438f47e5f143294f48c", "score": "0.4795661", "text": "func (g *Graphic) addStyles(canvas *svg.SVG) {\n\tfmt.Fprintln(canvas.Writer, \"<style>\")\n\n\t// !!TEMP!!\n\tfmt.Fprintln(canvas.Writer, \"@font-face {\")\n\tfmt.Fprintln(canvas.Writer, \" font-family: 'DejaVuSans';\")\n\tfmt.Fprintln(canvas.Writer, \" src: url('https://fontlibrary.org/assets/fonts/dejavu-sans/f5ec8426554a3a67ebcdd39f9c3fee83/49c0f03ec2fa354df7002bcb6331e106/DejaVuSansBook.ttf') format('truetype');\")\n\tfmt.Fprintln(canvas.Writer, \" font-weight: normal;\")\n\tfmt.Fprintln(canvas.Writer, \" font-style: normal;\")\n\tfmt.Fprintln(canvas.Writer, \"}\")\n\t// !!END TEMP!!\n\n\tfmt.Fprintln(canvas.Writer, \"</style>\")\n}", "title": "" }, { "docid": "69b86c345c9df81fe5015be5746564de", "score": "0.47749186", "text": "func (d *Painter) EndDrawing() {\n\tvar _, height = d.screen.Size()\n\td.screen.SetContent(0, height-1, ' ', nil, d.defStyle)\n\td.screen.Show()\n}", "title": "" }, { "docid": "be38408bec2fad4b4b5db8514cf0bfd1", "score": "0.46987504", "text": "func (me *TxsdPresentationAttributesGraphicsShapeRendering) Set(s string) { (*xsdt.String)(me).Set(s) }", "title": "" }, { "docid": "2ddc516725e7a1beb6122ca37701ff5c", "score": "0.4687846", "text": "func (s ASpacer) GUMIStyle(style *Style) {\n}", "title": "" }, { "docid": "4723c09f7c98db948d6745508a7ea370", "score": "0.46288437", "text": "func (svg *SVG) LinkEnd() { svg.println(`</a>`) }", "title": "" }, { "docid": "dcbff9d2205f43419023a84d384644d8", "score": "0.4569471", "text": "func (feature Feature) SetStyleString(style string) {\n\tcStyle := C.CString(style)\n\tC.OGR_F_SetStyleStringDirectly(feature.cval, cStyle)\n}", "title": "" }, { "docid": "79bdb667512d725047bd95ebef3cba7a", "score": "0.45649785", "text": "func (t *RichText) SetStyle(\n\tfrom,\n\tto *RGATreeSplitNodePos,\n\tattributes map[string]string,\n\texecutedAt *time.Ticket,\n) {\n\t// 01. Split nodes with from and to\n\t_, toRight := t.rgaTreeSplit.findNodeWithSplit(to, executedAt)\n\t_, fromRight := t.rgaTreeSplit.findNodeWithSplit(from, executedAt)\n\n\t// 02. style nodes between from and to\n\tnodes := t.rgaTreeSplit.findBetween(fromRight, toRight)\n\tfor _, node := range nodes {\n\t\tval := node.value.(*RichTextValue)\n\t\tfor key, value := range attributes {\n\t\t\tval.attrs.Set(key, value, executedAt)\n\t\t}\n\t}\n\n\tif log.Core.Enabled(zap.DebugLevel) {\n\t\tlog.Logger.Debugf(\n\t\t\t\"STYL: '%s' styles %s\",\n\t\t\texecutedAt.ActorID().Hex(),\n\t\t\tt.rgaTreeSplit.AnnotatedString(),\n\t\t)\n\t}\n}", "title": "" }, { "docid": "cedb9d63592ce5801cc9a50656eba27a", "score": "0.4561509", "text": "func (s Style) SVG(dpi float64) string {\n\tsw := s.StrokeWidth\n\tsc := s.StrokeColor\n\tfc := s.FillColor\n\tfs := s.FontSize\n\tfnc := s.FontColor\n\n\tstrokeWidthText := \"stroke-width:0\"\n\tif sw != 0 {\n\t\tstrokeWidthText = \"stroke-width:\" + fmt.Sprintf(\"%d\", int(sw))\n\t}\n\n\tstrokeText := \"stroke:none\"\n\tif !sc.IsZero() {\n\t\tstrokeText = \"stroke:\" + sc.String()\n\t}\n\n\tfillText := \"fill:none\"\n\tif !fc.IsZero() {\n\t\tfillText = \"fill:\" + fc.String()\n\t}\n\n\tfontSizeText := \"\"\n\tif fs != 0 {\n\t\tfontSizeText = \"font-size:\" + fmt.Sprintf(\"%.1fpx\", drawing.PointsToPixels(dpi, fs))\n\t}\n\n\tif !fnc.IsZero() {\n\t\tfillText = \"fill:\" + fnc.String()\n\t}\n\treturn strings.Join([]string{strokeWidthText, strokeText, fillText, fontSizeText}, \";\")\n}", "title": "" }, { "docid": "1a4d98c6a477b8c74cf118ac3030ce51", "score": "0.45459357", "text": "func (svg *SVG) PatternEnd() { svg.println(`</pattern>`) }", "title": "" }, { "docid": "e5082634be8972598e56a6837a8cac5a", "score": "0.45164487", "text": "func (svg *SVG) Startraw(ns ...string) {\n\tsvg.printf(svgtop)\n\tsvg.genattr(ns)\n}", "title": "" }, { "docid": "54bb3abd504c65e396e5fd295f1d30fc", "score": "0.45150277", "text": "func (r *OldSeriesRule) End() {\n\tvar keys []string\n\tfor k := range r.series {\n\t\tkeys = append(keys, k)\n\t}\n\tsort.Strings(keys)\n\n\tfor _, key := range keys {\n\t\tts := r.series[key]\n\t\tr.formater.format(r.out, key, ts)\n\t}\n}", "title": "" }, { "docid": "772fb9de04aa574b3cb83affd36fe88c", "score": "0.4494863", "text": "func (ps *Paths) SVG(w io.Writer) error {\n\tvar werr error\n\tbi := bufio.NewWriter(w)\n\twr := func(f string, args ...interface{}) {\n\t\tif werr != nil {\n\t\t\treturn\n\t\t}\n\t\t_, werr = fmt.Fprintf(bi, f, args...)\n\t}\n\twr(svgh, int(ps.Bounds.Max[1]), int(ps.Bounds.Max[0]), int(ps.Bounds.Min[0]), int(ps.Bounds.Min[1]), int(ps.Bounds.Max[0]-ps.Bounds.Min[0]), int(ps.Bounds.Max[1]-ps.Bounds.Min[1]))\n\twr(\"\\n\")\n\twr(\"<g fill=\\\"none\\\" stroke=\\\"black\\\" stroke-width=\\\"0.1\\\">\\n\")\n\tfor _, p := range ps.P {\n\t\tif len(p.V) == 0 {\n\t\t\tcontinue\n\t\t}\n\t\twr(`<path d=\"`)\n\t\tfor i, v := range p.V {\n\t\t\tif i == 0 {\n\t\t\t\twr(\"M %.2f %.2f\", v[0], v[1])\n\t\t\t} else {\n\t\t\t\twr(\" %.2f %.2f\", v[0], v[1])\n\t\t\t}\n\t\t}\n\t\twr(\"\\\"/>\\n\")\n\t}\n\twr(\"</g>\")\n\twr(\"</svg>\")\n\tif werr == nil {\n\t\twerr = bi.Flush()\n\t}\n\treturn werr\n}", "title": "" }, { "docid": "ddc120b3215c327d9e6ab08454cb4cd3", "score": "0.44569007", "text": "func applyStyleCSS(widget *gtk.Widget, css string) error {\n\t//\tprovider, err := gtk.CssProviderNew()\n\tprovider, err := gtk.CssProviderNew()\n\tif err != nil {\n\t\treturn err\n\t}\n\terr = provider.LoadFromData(css)\n\tif err != nil {\n\t\treturn err\n\t}\n\tsc, err := widget.GetStyleContext()\n\tif err != nil {\n\t\treturn err\n\t}\n\tsc.AddProvider(provider, gtk.STYLE_PROVIDER_PRIORITY_USER)\n\t//sc.AddClass(\"osd\")\n\treturn nil\n}", "title": "" }, { "docid": "cb75f36615b03a132a0ba919d118d093", "score": "0.44287807", "text": "func (s OutputStyle) setOutputStyle(p *gofpdf.Fpdf) {\n\tif r, g, b := p.GetFillColor(); s.FillR != r || s.FillG != g || s.FillB != b {\n\t\tp.SetFillColor(s.FillR, s.FillG, s.FillB)\n\t}\n\n\tif r, g, b := p.GetDrawColor(); s.DrawR != r || s.DrawG != g || s.DrawB != b {\n\t\tp.SetDrawColor(s.DrawR, s.DrawG, s.DrawB)\n\t}\n\n\tif r, g, b := p.GetTextColor(); s.TextR != r || s.TextG != g || s.TextB != b {\n\t\tp.SetTextColor(s.TextR, s.TextG, s.TextB)\n\t}\n\n\tif tr, blend := p.GetAlpha(); tr != s.Transparency || blend != s.BlendMode {\n\t\tp.SetAlpha(s.Transparency, s.BlendMode)\n\t}\n\n\tif s.Linewidth != p.GetLineWidth() {\n\t\tp.SetLineWidth(s.Linewidth)\n\t}\n\n\tif fs, _ := p.GetFontSize(); fs != s.Fontsize {\n\t\tp.SetFontSize(fs)\n\t}\n\n\tif s.CellMargin != p.GetCellMargin() {\n\t\tp.SetCellMargin(s.CellMargin)\n\t}\n}", "title": "" }, { "docid": "2cd0024d323c3369ba16ab1e3374a992", "score": "0.44270086", "text": "func (v *StyleContext) Save() {\n\tC.gtk_style_context_save(v.native())\n}", "title": "" }, { "docid": "ecae8e6e2c33915530a214c9c86c59ef", "score": "0.4420677", "text": "func (svg *SVG) ClipEnd() {\n\tsvg.println(`</clipPath>`)\n}", "title": "" }, { "docid": "d20d8bedfff9d9bb55b19ddd04ae6139", "score": "0.44141027", "text": "func (ts *Text) SetStylePost(props ki.Props) {\n}", "title": "" }, { "docid": "e2a7048a9d7b9a53c180502aa8cdc6ee", "score": "0.4411139", "text": "func (svg *SVG) stopcolor(oc []Offcolor) {\n\tfor _, v := range oc {\n\t\tsvg.printf(\"<stop offset=\\\"%d%%\\\" stop-color=\\\"%s\\\" stop-opacity=\\\"%.2f\\\"/>\\n\",\n\t\t\tpct(v.Offset), v.Color, v.Opacity)\n\t}\n}", "title": "" }, { "docid": "e6dcc97cf2781d7e1e7eb06101b9fd9f", "score": "0.43986022", "text": "func (s *SVG) Write(w io.Writer) error {\n\t//\tif s.tag != \"\" {\n\t//\t\treturn errors.New(\"I will only write from the outermost svg element\")\n\t//\t}\n\tfor k, v := range defaultNamespace {\n\t\ts.a[k] = v\n\t}\n\n\tvar writeGroupPtr func(*SVG, int)\n\twriteGroup := func(s *SVG, level int) {\n\t\ttabs := bytes.Repeat([]byte(\"\\t\"), level)\n\n\t\t// Encode attributes to form att1=\"val1\" att2=\"val2\"...\n\t\tbuf := bytes.NewBuffer(nil)\n\t\tkeys, vals := s.a.Sort()\n\t\tfor i := range keys {\n\t\t\tfmt.Fprintf(buf, `%s=\"%v\" `, keys[i], vals[i])\n\t\t}\n\n\t\tatts := buf.Bytes()\n\t\tif len(atts) > 0 { // Remove superfluous space\n\t\t\tatts = atts[:len(atts)-1]\n\t\t}\n\n\t\tfor _, v := range s.comments {\n\t\t\tw.Write([]byte(\"<!--\" + v + \"-->\\n\"))\n\t\t}\n\n\t\tw.Write(tabs)\n\t\tw.Write([]byte(\"<\" + s.tag))\n\t\tif len(atts) != 0 {\n\t\t\tw.Write([]byte(\" \"))\n\t\t}\n\t\tw.Write(atts)\n\n\t\tswitch {\n\t\tcase len(s.mids) == 0 && len(s.data) == 0:\n\t\t\tw.Write([]byte(\" />\\n\"))\n\t\tcase len(s.mids) != 0:\n\t\t\tw.Write([]byte(\">\\n\"))\n\t\t\tfor _, v := range s.mids {\n\t\t\t\twriteGroupPtr(v, level+1)\n\t\t\t}\n\t\t\tw.Write(tabs)\n\t\t\tw.Write([]byte(\"</\" + s.tag + \">\\n\"))\n\t\tdefault:\n\t\t\tw.Write([]byte(\">\" + s.data + \"</\" + s.tag + \">\\n\"))\n\t\t}\n\t}\n\tif s.declaration != \"\" {\n\t\tw.Write([]byte(s.declaration))\n\t}\n\twriteGroupPtr = writeGroup\n\twriteGroup(s, 0)\n\treturn nil\n}", "title": "" }, { "docid": "88d55cd5918e664a7d0d4170c3a1de78", "score": "0.4367711", "text": "func (s *BaseMapCSSListener) ExitFill_opacity_decl(ctx *Fill_opacity_declContext) {}", "title": "" }, { "docid": "3679e6f66df67ca881f029844e741a65", "score": "0.43669495", "text": "func (s *SVG) SetCSS(href string) {\n\ts.declaration = `<?xml-stylesheet type=\"text/css\" href=\"` + href + \"\\\" ?>\\n\"\n}", "title": "" }, { "docid": "c7d38d27d80f7042424cccb887df0b92", "score": "0.43642348", "text": "func (svg *SVG) FeSpecEnd() {\n\tsvg.println(`</feSpecularLighting>`)\n}", "title": "" }, { "docid": "0e3ed3a01fb952575f1f25b04f715d47", "score": "0.43536347", "text": "func style(s string) string {\n\tif len(s) > 0 {\n\t\treturn fmt.Sprintf(`style=\"%s\"`, s)\n\t}\n\treturn s\n}", "title": "" }, { "docid": "5299ae7f9d7814ed1f6b6f5b24c148a3", "score": "0.4341002", "text": "func (s *BaseMapCSSListener) ExitStylesheet(ctx *StylesheetContext) {}", "title": "" }, { "docid": "0ad78d8e31fa6b0a007332529a2658ec", "score": "0.43339536", "text": "func (b *Buffer) WriteStyleds(ss []*Styled) {\n\tfor _, s := range ss {\n\t\tb.WriteString(s.Text, s.Styles.String())\n\t}\n}", "title": "" }, { "docid": "69b1cc8101bb14b313c3983becedff4e", "score": "0.4326389", "text": "func styleRender(ctx context.Context, v string) string {\n\tvalue, _ := ctx.Value(styleCtxKey).([]*styleComponent)\n\tfor _, s := range value {\n\t\tv = s.render(v)\n\t}\n\n\treturn v\n}", "title": "" }, { "docid": "8fed4d00ed0ebe0e9023f70994cbda0c", "score": "0.43102914", "text": "func (cg *ColorGenerator) SetEndColor(ec, ecr color.Color) {\n\tcg.EndColor = ec\n\tcg.EndColorRand = ecr\n}", "title": "" }, { "docid": "d2ad5db0f015c85e2424a955507e1d12", "score": "0.43045503", "text": "func (svg *SVG) Bezier(sx int, sy int, cx int, cy int, px int, py int, ex int, ey int, s ...string) {\n\tsvg.printf(`%s C%s %s %s\" %s`,\n\t\tptag(sx, sy), coord(cx, cy), coord(px, py), coord(ex, ey), endstyle(s, emptyclose))\n}", "title": "" }, { "docid": "1c2b8fd4954d7cd60b37f9d66a94a2a7", "score": "0.43001756", "text": "func (self *String) SetStyle(style ulong) {\n return C.sfString_SetStyle(self.Cref, style)\n}", "title": "" }, { "docid": "e954db5832544966da286a389206e8b3", "score": "0.42965683", "text": "func (s *style) color(colors []string) *style {\n\tif len(colors) == 1 && (colors[0] == \"0\" || colors[0] == \"\") {\n\t\t// Shortcut for full style reset\n\t\treturn &emptyStyle\n\t}\n\n\tnewStyle := style(*s)\n\ts = &newStyle\n\ts.colors = append(s.colors, colors...)\n\tcolor_mode := COLOR_NORMAL\n\n\tfor _, ccs := range colors {\n\t\t// If multiple colors are defined, i.e. \\e[30;42m\\e then loop through each\n\t\t// one, and assign it to s.fgColor or s.bgColor\n\t\tcc, err := strconv.ParseUint(ccs, 10, 8)\n\t\tif err != nil {\n\t\t\tcontinue\n\t\t}\n\n\t\t// State machine for XTerm colors, eg 38;5;150\n\t\tswitch color_mode {\n\t\tcase COLOR_GOT_38_NEED_5:\n\t\t\tif cc == 5 {\n\t\t\t\tcolor_mode = COLOR_GOT_38\n\t\t\t} else {\n\t\t\t\tcolor_mode = COLOR_NORMAL\n\t\t\t}\n\t\t\tcontinue\n\t\tcase COLOR_GOT_48_NEED_5:\n\t\t\tif cc == 5 {\n\t\t\t\tcolor_mode = COLOR_GOT_48\n\t\t\t} else {\n\t\t\t\tcolor_mode = COLOR_NORMAL\n\t\t\t}\n\t\t\tcontinue\n\t\tcase COLOR_GOT_38:\n\t\t\ts.meta.fgColor = uint8(cc)\n\t\t\ts.meta.fgColorX = true\n\t\t\tcolor_mode = COLOR_NORMAL\n\t\t\tcontinue\n\t\tcase COLOR_GOT_48:\n\t\t\ts.meta.bgColor = uint8(cc)\n\t\t\ts.meta.bgColorX = true\n\t\t\tcolor_mode = COLOR_NORMAL\n\t\t\tcontinue\n\t\t}\n\n\t\tswitch cc {\n\t\tcase 0:\n\t\t\t// Reset all styles - don't use &emptyStyle here as we could end up adding colours\n\t\t\t// in this same action.\n\t\t\ts = &style{}\n\t\tcase 1:\n\t\t\ts.meta.bold = true\n\t\t\ts.meta.faint = false\n\t\tcase 2:\n\t\t\ts.meta.faint = true\n\t\t\ts.meta.bold = false\n\t\tcase 3:\n\t\t\ts.meta.italic = true\n\t\tcase 4:\n\t\t\ts.meta.underline = true\n\t\tcase 5, 6:\n\t\t\ts.meta.blink = true\n\t\tcase 9:\n\t\t\ts.meta.strike = true\n\t\tcase 21, 22:\n\t\t\ts.meta.bold = false\n\t\t\ts.meta.faint = false\n\t\tcase 23:\n\t\t\ts.meta.italic = false\n\t\tcase 24:\n\t\t\ts.meta.underline = false\n\t\tcase 25:\n\t\t\ts.meta.blink = false\n\t\tcase 29:\n\t\t\ts.meta.strike = false\n\t\tcase 38:\n\t\t\tcolor_mode = COLOR_GOT_38_NEED_5\n\t\tcase 39:\n\t\t\ts.meta.fgColor = 0\n\t\t\ts.meta.fgColorX = false\n\t\tcase 48:\n\t\t\tcolor_mode = COLOR_GOT_48_NEED_5\n\t\tcase 49:\n\t\t\ts.meta.bgColor = 0\n\t\t\ts.meta.bgColorX = false\n\t\tcase 30, 31, 32, 33, 34, 35, 36, 37, 90, 91, 92, 93, 94, 95, 96, 97:\n\t\t\ts.meta.fgColor = uint8(cc)\n\t\t\ts.meta.fgColorX = false\n\t\tcase 40, 41, 42, 43, 44, 45, 46, 47, 100, 101, 102, 103, 104, 105, 106, 107:\n\t\t\ts.meta.bgColor = uint8(cc)\n\t\t\ts.meta.bgColorX = false\n\t\t}\n\t}\n\treturn s\n}", "title": "" }, { "docid": "ef79310fb20c14aa35cd7c07add613db", "score": "0.42917445", "text": "func (t *TextStyle) SetEmboss(value bool) {\r\n\tif value && len(t.Document.GetChildren(\"emboss\")) == 0 {\r\n\t\tn := t.Document.CreateNode(\"emboss\")\r\n\t\tn.SetAttributeValue(\"val\", \"true\")\r\n\t\tn.GetAttribute(\"val\").NS = &xmldom.Namespace{Name: \"w\"}\r\n\t\tn.NS = &xmldom.Namespace{Name: \"w\"}\r\n\t}\r\n\tif value == false && len(t.Document.GetChildren(\"emboss\")) != 0 {\r\n\t\tt.Document.RemoveChild(t.Document.GetChild(\"emboss\"))\r\n\t}\r\n\tt.emboss = value\r\n\r\n}", "title": "" }, { "docid": "845d4c0abc83b9e6a7047ef3156e7fb5", "score": "0.42905536", "text": "func (svg *SVG) Def() { svg.println(`<defs>`) }", "title": "" }, { "docid": "9f0b5e8d13fed54cad341aaf4e317da1", "score": "0.428272", "text": "func (f *fsm) endCommand() {\n\tif f.curCommand != ' ' {\n\t\tf.Commands = append(f.Commands, Command{\n\t\t\tCommand: f.curCommand,\n\t\t\tParameters: f.numbers,\n\t\t})\n\n\t\tcmdLength := len(f.Commands)\n\t\tif cmdLength > 1 {\n\t\t\tf.Commands[cmdLength-1].Parse(&f.Commands[cmdLength-2].EndPos, f.transform)\n\t\t} else {\n\t\t\tstartPos := model.Point{}\n\t\t\tf.Commands[cmdLength-1].Parse(&startPos, f.transform)\n\t\t}\n\n\t\tf.curCommand = ' '\n\t\tf.numbers = make([]float32, 0, 16)\n\t} else {\n\t\tlog.Printf(\"[SvgParser] -> Invalid command \\\"%c\\\" in d attribute.\", f.curCommand)\n\t}\n}", "title": "" }, { "docid": "887d09604d7a3fa1725de67c07f8b7f8", "score": "0.42796218", "text": "func (me *TxsdPresentationAttributesGraphicsTextRendering) Set(s string) { (*xsdt.String)(me).Set(s) }", "title": "" }, { "docid": "1f3f4cae4b2c4c12284ff26ccfc14b0c", "score": "0.42634574", "text": "func (me *TxsdPresentationAttributesColorColorInterpolation) Set(s string) { (*xsdt.String)(me).Set(s) }", "title": "" }, { "docid": "2eca28551427a41eaabad615641d6801", "score": "0.42588955", "text": "func ApplyCSSSVG(node gi.Node2D, key string, css ki.Props) bool {\n\tpntr, ok := node.(gist.Painter)\n\tif !ok {\n\t\treturn false\n\t}\n\tpp, got := css[key]\n\tif !got {\n\t\treturn false\n\t}\n\tpmap, ok := pp.(ki.Props) // must be a props map\n\tif !ok {\n\t\treturn false\n\t}\n\tnb := node.AsNode2D()\n\tpc := pntr.Paint()\n\n\tif pgi, _ := gi.KiToNode2D(node.Parent()); pgi != nil {\n\t\tif pp, ok := pgi.(gist.Painter); ok {\n\t\t\tpc.SetStyleProps(pp.Paint(), pmap, nb.Viewport)\n\t\t} else {\n\t\t\tpc.SetStyleProps(nil, pmap, nb.Viewport)\n\t\t}\n\t} else {\n\t\tpc.SetStyleProps(nil, pmap, nb.Viewport)\n\t}\n\treturn true\n}", "title": "" }, { "docid": "e88f6a954c93dee3f060c7d377fb81ed", "score": "0.42353746", "text": "func removeStyle(familyName, styleName string) string {\n\tif lF, lS := len(familyName), len(styleName); lF > lS {\n\t\tidx := 1\n\t\tfor ; idx <= len(styleName); idx++ {\n\t\t\tif familyName[lF-idx] != styleName[lS-idx] {\n\t\t\t\tbreak\n\t\t\t}\n\t\t}\n\n\t\tif idx > lS {\n\t\t\t// familyName ends with styleName; remove it\n\t\t\tidx = lF - lS - 1\n\n\t\t\t// also remove special characters\n\t\t\t// between real family name and style\n\t\t\tfor idx > 0 &&\n\t\t\t\t(familyName[idx] == '-' || familyName[idx] == ' ' ||\n\t\t\t\t\tfamilyName[idx] == '_' || familyName[idx] == '+') {\n\t\t\t\tidx--\n\t\t\t}\n\n\t\t\tif idx > 0 {\n\t\t\t\tfamilyName = familyName[:idx+1]\n\t\t\t}\n\t\t}\n\t}\n\treturn familyName\n}", "title": "" }, { "docid": "d3af65080e67f4a2a2a06f361a016218", "score": "0.422579", "text": "func (self *Item) DecrementOutOfStyle() {\n\tself.TTOutOfStyle--\n\n\tif self.TTOutOfStyle <= 0 {\n\t\tRemoveFromMainstreamKeys(self.Key)\n\t\tlog.Printf(\"%s is now out of style\", self.Key)\n\t\tself.MainstreamScore = 0\n\t}\n}", "title": "" }, { "docid": "0888c82a14b3395afbee0001e9fdce56", "score": "0.42174563", "text": "func (me *TSVGColorType) Set(s string) { (*xsdt.String)(me).Set(s) }", "title": "" }, { "docid": "107365fd40f949a083986aad9f9027cc", "score": "0.42142636", "text": "func newFgStyle(c lib.ColorPair) styleFunc {\n\treturn te.Style{}.Foreground(c.Color()).Styled\n}", "title": "" }, { "docid": "088809f7b60f369ae40970fab715b90a", "score": "0.4213611", "text": "func (v *Toolbar) UnsetStyle() {\n\tC.gtk_toolbar_unset_style(v.native())\n}", "title": "" }, { "docid": "e913ab7212a00a4be15a1484555c34cb", "score": "0.42047703", "text": "func (paint *Paint) SetStyle(style PaintStyle) {\n\tpaint.style = style\n}", "title": "" }, { "docid": "2e72ce9475564d5591a90acb79acda2a", "score": "0.41909045", "text": "func (s *BaseMapCSSListener) ExitFill_color_decl(ctx *Fill_color_declContext) {}", "title": "" }, { "docid": "757d25c3bb1d792b700eed38005f7d21", "score": "0.41719246", "text": "func (t *TextStyle) SetColor(value string) {\r\n\tif value != \"\" && len(t.Document.GetChildren(\"color\")) == 0 {\r\n\t\tn := t.Document.CreateNode(\"color\")\r\n\t\tn.SetAttributeValue(\"val\", value)\r\n\t\tn.GetAttribute(\"val\").NS = &xmldom.Namespace{Name: \"w\"}\r\n\t\tn.NS = &xmldom.Namespace{Name: \"w\"}\r\n\t}\r\n\tif value == \"\" && len(t.Document.GetChildren(\"color\")) != 0 {\r\n\t\tt.Document.RemoveChild(t.Document.GetChild(\"color\"))\r\n\t}\r\n\tt.color = value\r\n}", "title": "" }, { "docid": "5af100438fafa138817fbf2713d32258", "score": "0.41715232", "text": "func (style Style) SetColor(id StyleColorID, value Vec4) {\n\tvalueArg, _ := value.wrapped()\n\tC.iggStyleSetColor(style.handle(), C.int(id), valueArg)\n}", "title": "" }, { "docid": "0b1c5a071f5f4e42a005dbeab2f0a086", "score": "0.41689938", "text": "func endoff() {\n\tvar i int32\n\tfor i = 0; i < 44; i++ {\n\t\tif linestop[i] != 0 {\n\t\t\tnoarch.Fprintf(tabout, []byte(\".nr #%c 0\\n\\x00\"), linestop[i]+int32('a')-1)\n\t\t}\n\t}\n\tfor i = 0; i < texct; i++ {\n\t\tnoarch.Fprintf(tabout, []byte(\".rm %c+\\n\\x00\"), int32(texstr[i]))\n\t}\n\tnoarch.Fprintf(tabout, []byte(\"%s\\n\\x00\"), last)\n}", "title": "" }, { "docid": "f915e64ef07ea577e35e2b2a129b166b", "score": "0.4167982", "text": "func (s *AImage) GUMIStyle(style *Style) {\n}", "title": "" }, { "docid": "2f0161a0506f1142888b77c18a8b1656", "score": "0.41510904", "text": "func (me *TextDecorationValueType) Set(s string) { (*xsdt.String)(me).Set(s) }", "title": "" }, { "docid": "b15d0d17b363d05115a32fe3aa386ca3", "score": "0.41460237", "text": "func (svg *SVG) FeDiffEnd() {\n\tsvg.println(`</feDiffuseLighting>`)\n}", "title": "" }, { "docid": "229be8973d2227e16245c07b9b0bc5a4", "score": "0.41446733", "text": "func (r *Region) SetForeground(x, y int, fg termbox.Attribute) {\n\tif r.IsOutOfBound(x, y) {\n\t\treturn\n\t}\n\tr.Cells[y][x].Fg = fg\n\tr.dirty = true\n}", "title": "" }, { "docid": "bd9d388315a74509c73fe913973693e9", "score": "0.41401634", "text": "func (r *OldSeriesRule) EndTSM() {\n\n}", "title": "" }, { "docid": "0e53b7a9eed2a37e3b6e89842588986a", "score": "0.41349417", "text": "func newFgStyle(c common.ColorPair) styleFunc {\n\treturn te.Style{}.Foreground(c.Color()).Styled\n}", "title": "" }, { "docid": "c24619c584ce0313db9e2b44fdcaee98", "score": "0.41277954", "text": "func Svg(tag string, attributes nodes.Attributes, children nodes.Children) *nodes.HTMLNode {\n\tnode := Html(tag, attributes, children)\n\tnode.Namespace = \"http://www.w3.org/2000/svg\"\n\treturn node\n}", "title": "" }, { "docid": "c47c7a53aa972aa4c3b286f0540494c8", "score": "0.41235602", "text": "func (me *TxsdPresentationAttributesColorColorRendering) Set(s string) { (*xsdt.String)(me).Set(s) }", "title": "" }, { "docid": "5d123130c2d8956f92cec21d90903a9b", "score": "0.41064432", "text": "func New(w io.Writer) *SVG { return &SVG{w} }", "title": "" }, { "docid": "caac57982f85df084ce48bc1e1485788", "score": "0.4096679", "text": "func ExpandStyle(style string) string {\n\tswitch {\n\tcase strings.HasPrefix(style, \"Fg#\"):\n\t\tfgstyle := style[3:]\n\t\treturn Fg(fgstyle)\n\tcase strings.HasPrefix(style, \"Bg#\"):\n\t\tbgstyle := style[3:]\n\t\treturn Bg(bgstyle)\n\tcase style == \"Bold\":\n\t\treturn Bold\n\tcase style == \"Underline\":\n\t\treturn Underline\n\tcase style == \"Reverse\":\n\t\treturn Reverse\n\tdefault:\n\t\tzap.S().Warnf(\"Unhandled style [%s]\", style)\n\t}\n\treturn style\n}", "title": "" }, { "docid": "94eecc5af096e9bf0c7766d363789fe7", "score": "0.4095643", "text": "func (s *BaseMapCSSListener) ExitAntialiasing_decl(ctx *Antialiasing_declContext) {}", "title": "" }, { "docid": "5e6690bf2dd253c51242b19d7671508b", "score": "0.40954876", "text": "func (svg *SVG) Gtransform(s string) { svg.println(group(\"transform\", s)) }", "title": "" }, { "docid": "0a1cbb78dc578413ce63be99c1f2a89e", "score": "0.4080451", "text": "func SetStylePropsXML(style string, props *ki.Props) {\n\tst := strings.Split(style, \";\")\n\tfor _, s := range st {\n\t\tkv := strings.Split(s, \":\")\n\t\tif len(kv) >= 2 {\n\t\t\tk := strings.TrimSpace(strings.ToLower(kv[0]))\n\t\t\tv := strings.TrimSpace(kv[1])\n\t\t\tif *props == nil {\n\t\t\t\t*props = make(ki.Props)\n\t\t\t}\n\t\t\t(*props)[k] = v\n\t\t}\n\t}\n}", "title": "" }, { "docid": "0c1c1ac1e49c1ba5563910b8c2fdc577", "score": "0.40672135", "text": "func setTcellFontEffectStyle(st tcell.Style, attr Attribute) tcell.Style {\n\tif attr&AttrBold != 0 {\n\t\tst = st.Bold(true)\n\t}\n\tif attr&AttrUnderline != 0 {\n\t\tst = st.Underline(true)\n\t}\n\tif attr&AttrReverse != 0 {\n\t\tst = st.Reverse(true)\n\t}\n\tif attr&AttrBlink != 0 {\n\t\tst = st.Blink(true)\n\t}\n\tif attr&AttrDim != 0 {\n\t\tst = st.Dim(true)\n\t}\n\tif attr&AttrItalic != 0 {\n\t\tst = st.Italic(true)\n\t}\n\tif attr&AttrStrikeThrough != 0 {\n\t\tst = st.StrikeThrough(true)\n\t}\n\treturn st\n}", "title": "" }, { "docid": "3cef1e652bfb5706ecb8ee8f2cc32931", "score": "0.40614542", "text": "func (s *ACanvas) GUMIStyle(style *Style) {\n\tif s.style != style{\n\t\ts.style = style\n\t\ts.rnode.Require()\n\t}\n}", "title": "" }, { "docid": "61691dee2ffaffc85a88c72ed8d71932", "score": "0.40539494", "text": "func (svg *SVG) Gid(s string) {\n\tsvg.print(`<g id=\"`)\n\txml.Escape(svg.Writer, []byte(s))\n\tsvg.println(`\">`)\n}", "title": "" }, { "docid": "a10937a8342247efcbbe3d534ef19e88", "score": "0.40496287", "text": "func (s *BasewktListener) ExitCircularStringGeometry(ctx *CircularStringGeometryContext) {}", "title": "" }, { "docid": "aac7f07418f8fe81db06b848b7010b4c", "score": "0.40479958", "text": "func cleanSVGData(shapes [][]interface{}) {\n\tfor i, sl := range shapes {\n\t\tvar svgSplit *svg.Split\n\t\tfor j, si := range sl {\n\t\t\tswitch s := si.(type) {\n\t\t\tcase *merge:\n\t\t\t\tsl[j] = s.svg\n\t\t\tcase *decl:\n\t\t\t\tsl[j] = s.svgOp\n\t\t\t\tif s.svgSplit != nil && len(s.svgSplit.Shapes) > 0 {\n\t\t\t\t\tcleanSVGData(s.svgSplit.Shapes)\n\t\t\t\t\tif j < len(sl)-1 {\n\t\t\t\t\t\tpanic(\"decls with splits have to be at the end of their row!\")\n\t\t\t\t\t}\n\t\t\t\t\tsvgSplit = s.svgSplit\n\t\t\t\t}\n\t\t\tcase *svg.Merge, *svg.Rect, *svg.Arrow, *svg.Op:\n\t\t\t\t// nothing to do\n\t\t\tdefault:\n\t\t\t\tpanic(fmt.Sprintf(\"found unexpected shape type: %T\", si))\n\t\t\t}\n\t\t\tif svgSplit != nil {\n\t\t\t\tshapes[i] = append(sl, svgSplit)\n\t\t\t}\n\t\t}\n\t}\n}", "title": "" }, { "docid": "972185ddc69fbd47c7a6db2c02bb62e6", "score": "0.4047077", "text": "func (m *WorkbookRangeFont) Serialize(writer i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.SerializationWriter)(error) {\n err := m.Entity.Serialize(writer)\n if err != nil {\n return err\n }\n {\n err = writer.WriteBoolValue(\"bold\", m.GetBold())\n if err != nil {\n return err\n }\n }\n {\n err = writer.WriteStringValue(\"color\", m.GetColor())\n if err != nil {\n return err\n }\n }\n {\n err = writer.WriteBoolValue(\"italic\", m.GetItalic())\n if err != nil {\n return err\n }\n }\n {\n err = writer.WriteStringValue(\"name\", m.GetName())\n if err != nil {\n return err\n }\n }\n {\n err = writer.WriteFloat64Value(\"size\", m.GetSize())\n if err != nil {\n return err\n }\n }\n {\n err = writer.WriteStringValue(\"underline\", m.GetUnderline())\n if err != nil {\n return err\n }\n }\n return nil\n}", "title": "" }, { "docid": "07cf71ab079b5d637050142ac38ed0ee", "score": "0.40420806", "text": "func writeSVGResponse(writer *http.ResponseWriter, code int,\n\tsvg *string) {\n\t(*writer).Header().Set(\"Strict-Transport-Security\", \"max-age=15552001\")\n\t(*writer).Header().Set(\"Vary\", \"Accept-Encoding\")\n\t(*writer).Header().Set(\"Content-Type\", \"image/svg+xml\")\n\t(*writer).WriteHeader(code)\n\tfmt.Fprint(*writer, *svg)\n}", "title": "" }, { "docid": "6dfee564272f8d5d1dd2213e99dd1962", "score": "0.40292692", "text": "func AutoStyle(i int, fill bool) (style Style) {\n\tnc, nl, ns := len(StandardColors), len(StandardLineStyles), len(StandardSymbols)\n\n\tsi := i % ns\n\tci := i % nc\n\tli := i % nl\n\n\tstyle.Symbol = StandardSymbols[si]\n\tstyle.SymbolColor = StandardColors[ci]\n\tstyle.LineColor = StandardColors[ci]\n\tstyle.SymbolSize = 1\n\tstyle.Alpha = 0\n\n\tif fill {\n\t\tstyle.LineStyle = SolidLine\n\t\tstyle.LineWidth = 3\n\t\tif i < nc {\n\t\t\tstyle.FillColor = lighter(style.LineColor, StandardFillFactor)\n\t\t} else if i <= 2*nc {\n\t\t\tstyle.FillColor = darker(style.LineColor, StandardFillFactor)\n\t\t} else {\n\t\t\tstyle.FillColor = style.LineColor\n\t\t}\n\t} else {\n\t\tstyle.LineStyle = StandardLineStyles[li]\n\t\tstyle.LineWidth = 1\n\t}\n\treturn\n}", "title": "" }, { "docid": "8e6da245c9bd6396032f9ae350c202db", "score": "0.4024034", "text": "func (c *Canvas) TextEnd(x, y, size float32, s string, fillcolor color.RGBA) {\n\tx, y = dimen(x, y, c.Width, c.Height)\n\tsize = pct(size, c.Width)\n\tc.textops(x, y, size, text.End, s, fillcolor)\n}", "title": "" }, { "docid": "ec7683c62b28cc506a4786afa68dbbc7", "score": "0.40210012", "text": "func (t *TextStyle) SetSize(value int) {\r\n\tif value != t.size && len(t.Document.GetChildren(\"sz\")) == 0 {\r\n\t\tn := t.Document.CreateNode(\"sz\")\r\n\t\tn.SetAttributeValue(\"val\", strconv.Itoa(value))\r\n\t\tn.GetAttribute(\"val\").NS = &xmldom.Namespace{Name: \"w\"}\r\n\t\tn.NS = &xmldom.Namespace{Name: \"w\"}\r\n\t}\r\n\tif value != t.size && len(t.Document.GetChildren(\"sz\")) != 0 {\r\n\t\tt.Document.GetChild(\"sz\").SetAttributeValue(\"val\", strconv.Itoa(value)).NS = &xmldom.Namespace{Name: \"w\"}\r\n\t}\r\n\tt.size = value\r\n}", "title": "" }, { "docid": "736a5e948b6ae49ac9927df7f0a27b24", "score": "0.4017545", "text": "func (v *FontDescription) SetStyle(style Style) {\n\tC.pango_font_description_set_style(v.native(), (C.PangoStyle)(style))\n}", "title": "" }, { "docid": "68177d72f4e667a293172184dc0a8645", "score": "0.40167734", "text": "func (me *TStyleSheetType) Set(s string) { (*xsdt.String)(me).Set(s) }", "title": "" }, { "docid": "0097d43ddd67dde0a15f95982868bc25", "score": "0.40050256", "text": "func (e StartElement) End() EndElement {}", "title": "" }, { "docid": "6192b14d5726e97fb579abeec3f7a5df", "score": "0.39985448", "text": "func (me TStyleSheetType) String() string { return xsdt.String(me).String() }", "title": "" }, { "docid": "a6e2718224978e0f7d502d04b7d58ae8", "score": "0.39932108", "text": "func (s *style) asClasses() []string {\n\tvar styles []string\n\n\tif s.meta.fgColor > 0 && s.meta.fgColor < 38 && !s.meta.fgColorX {\n\t\tstyles = append(styles, \"term-fg\"+strconv.Itoa(int(s.meta.fgColor)))\n\t}\n\tif s.meta.fgColor > 38 && !s.meta.fgColorX {\n\t\tstyles = append(styles, \"term-fgi\"+strconv.Itoa(int(s.meta.fgColor)))\n\n\t}\n\tif s.meta.fgColorX {\n\t\tstyles = append(styles, \"term-fgx\"+strconv.Itoa(int(s.meta.fgColor)))\n\n\t}\n\n\tif s.meta.bgColor > 0 && s.meta.bgColor < 48 && !s.meta.bgColorX {\n\t\tstyles = append(styles, \"term-bg\"+strconv.Itoa(int(s.meta.bgColor)))\n\t}\n\tif s.meta.bgColor > 48 && !s.meta.bgColorX {\n\t\tstyles = append(styles, \"term-bgi\"+strconv.Itoa(int(s.meta.bgColor)))\n\t}\n\tif s.meta.bgColorX {\n\t\tstyles = append(styles, \"term-bgx\"+strconv.Itoa(int(s.meta.bgColor)))\n\t}\n\n\tif s.meta.bold {\n\t\tstyles = append(styles, \"term-fg1\")\n\t}\n\tif s.meta.faint {\n\t\tstyles = append(styles, \"term-fg2\")\n\t}\n\tif s.meta.italic {\n\t\tstyles = append(styles, \"term-fg3\")\n\t}\n\tif s.meta.underline {\n\t\tstyles = append(styles, \"term-fg4\")\n\t}\n\tif s.meta.blink {\n\t\tstyles = append(styles, \"term-fg5\")\n\t}\n\tif s.meta.strike {\n\t\tstyles = append(styles, \"term-fg9\")\n\t}\n\n\treturn styles\n}", "title": "" }, { "docid": "b47a121c5f9fbcde018110889e8ba898", "score": "0.3983475", "text": "func NewStyle(border, bg *gdk.Color, colorByDepth []*gdk.Color, fontSize int) *Style {\n\tif gc == nil {\n\t\tpanic(\"InitGC must be called before calling NewStyle\")\n\t}\n\n\talloc := func(c *gdk.Color) *gdk.Color {\n\t\treturn gc.GetColormap().AllocColorRGB(c.Red(), c.Green(), c.Blue())\n\t}\n\n\tfor i, v := range colorByDepth {\n\t\tcolorByDepth[i] = alloc(v)\n\t}\n\n\tfontDesc := pango.NewFontDescription()\n\tfontDesc.SetSize(fontSize * pango.SCALE)\n\n\tlayout := pango.NewLayout(pc)\n\tlayout.SetFontDescription(fontDesc)\n\n\treturn &Style{\n\t\tBgColor: alloc(bg),\n\t\tBorderColor: alloc(border),\n\t\tColorByDepth: colorByDepth,\n\t\tTitleLayout: layout,\n\t}\n}", "title": "" }, { "docid": "fb018898719e5933eda8c6b099772860", "score": "0.397953", "text": "func (t *TextStyle) SetVertAlign(value string) {\r\n\tif value != t.vertAlign && len(t.Document.GetChildren(\"sz\")) == 0 {\r\n\t\tn := t.Document.CreateNode(\"sz\")\r\n\t\tn.SetAttributeValue(\"val\", value)\r\n\t\tn.GetAttribute(\"val\").NS = &xmldom.Namespace{Name: \"w\"}\r\n\t}\r\n\tif value != t.vertAlign && len(t.Document.GetChildren(\"sz\")) != 0 {\r\n\t\tt.Document.GetChild(\"sz\").SetAttributeValue(\"val\", value).NS = &xmldom.Namespace{Name: \"w\"}\r\n\t}\r\n\tt.vertAlign = value\r\n}", "title": "" }, { "docid": "d2e99ab3ad0de1d133709109aedf61f6", "score": "0.39761752", "text": "func (me TextDecorationValueType) String() string { return xsdt.String(me).String() }", "title": "" }, { "docid": "6539dfd8d2cf8cef0e11dd69f23a9498", "score": "0.39740258", "text": "func (obj *PDFobj) SetGraphicsState(gs *GraphicsState, objects *[]*PDFobj) {\n\tvar obj2 *PDFobj\n\tindex := -1\n\tfor i, token := range obj.dict {\n\t\tif token == \"/Resources\" {\n\t\t\ttoken2 := obj.dict[i+1]\n\t\t\tif token2 == \"<<\" {\n\t\t\t\tobj2 = obj\n\t\t\t\tindex = i + 2\n\t\t\t} else {\n\t\t\t\tindex, err := strconv.Atoi(token2)\n\t\t\t\tif err != nil {\n\t\t\t\t\tlog.Fatal(err)\n\t\t\t\t}\n\t\t\t\tobj2 = (*objects)[index-1]\n\t\t\t\tfor j := 0; j < len(obj2.dict); j++ {\n\t\t\t\t\tif obj2.dict[j] == \"<<\" {\n\t\t\t\t\t\tindex = j + 1\n\t\t\t\t\t\tbreak\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\tbreak\n\t\t}\n\t}\n\n\tgsNumber := getMaxGSNumber(obj)\n\tif gsNumber == 0 { // No existing ExtGState dictionary\n\t\tobj.dict = insertStringAt(obj.dict, \"/ExtGState\", index) // Add ExtGState dictionary\n\t\tindex++\n\t\tobj.dict = insertStringAt(obj.dict, \"<<\", index)\n\t} else {\n\t\tfor index < len(obj.dict) {\n\t\t\ttoken := obj.dict[index]\n\t\t\tif token == \"/ExtGState\" {\n\t\t\t\tindex++\n\t\t\t\tbreak\n\t\t\t}\n\t\t\tindex++\n\t\t}\n\t}\n\n\tindex++\n\tobj.dict = insertStringAt(obj.dict, \"/GS\"+strconv.Itoa(gsNumber+1), index)\n\tindex++\n\tobj.dict = insertStringAt(obj.dict, \"<<\", index)\n\tindex++\n\tobj.dict = insertStringAt(obj.dict, \"/CA\", index)\n\tindex++\n\tobj.dict = insertStringAt(obj.dict, fmt.Sprintf(\"%f\", gs.GetAlphaStroking()), index)\n\tindex++\n\tobj.dict = insertStringAt(obj.dict, \"/ca\", index)\n\tindex++\n\tobj.dict = insertStringAt(obj.dict, fmt.Sprintf(\"%f\", gs.GetAlphaNonStroking()), index)\n\tindex++\n\tobj.dict = insertStringAt(obj.dict, \">>\", index)\n\tif gsNumber == 0 {\n\t\tindex++\n\t\tobj.dict = insertStringAt(obj.dict, \">>\", index)\n\t}\n\n\tvar buf strings.Builder\n\tbuf.WriteString(\"q\\n\")\n\tbuf.WriteString(\"/GS\" + strconv.Itoa(gsNumber+1) + \" gs\\n\")\n\tobj.addPrefixContent([]byte(buf.String()), objects)\n}", "title": "" }, { "docid": "6cd7edf2cbf43f5cc2a5ce44904533d8", "score": "0.39695966", "text": "func (p *Pattern) SvgStr() string {\n\tp.generateBackground()\n\tp.genaratePattern()\n\n\treturn p.Svg.Str()\n}", "title": "" }, { "docid": "394cb3637475e95eb5b43940700095f6", "score": "0.3968845", "text": "func (f *Function) End() {\n\tf.parseString += fmt.Sprintf(\"}\")\n}", "title": "" }, { "docid": "fbcf95b3d38adc849fe3db4d8e6fa0bc", "score": "0.39666376", "text": "func (me *TxsdPresentationAttributesFillStrokeStrokeLinecap) Set(s string) { (*xsdt.String)(me).Set(s) }", "title": "" }, { "docid": "baa72f065c5dd5fcef33389c971adcff", "score": "0.39644304", "text": "func (t *TextStyle) SetVanish(value bool) {\r\n\r\n\tif value && len(t.Document.GetChildren(\"vanish\")) == 0 {\r\n\t\tt.Document.CreateNode(\"vanish\")\r\n\t\t//n.NS = &xmldom.Namespace{Name: \"w\"}\r\n\t}\r\n\tif value == false && len(t.Document.GetChildren(\"vanish\")) != 0 {\r\n\t\tt.Document.RemoveChild(t.Document.GetChild(\"vanish\"))\r\n\t}\r\n\tt.vanish = value\r\n\r\n}", "title": "" } ]
b2cdc4fa81dd98471d1c309b623b39b6
GetSignalName is an internal getter (TBD...)
[ { "docid": "fa081f75461ba33bbcdfe45ad85abdb8", "score": "0.7213723", "text": "func (v *SignalWorkflowExecutionRequest) GetSignalName() (o string) {\n\tif v != nil {\n\t\treturn v.SignalName\n\t}\n\treturn\n}", "title": "" } ]
[ { "docid": "7fdf54991a730a4042f93f63896caaf7", "score": "0.74458826", "text": "func (s *SignalInfo) GetName() (o string) {\n\tif s != nil {\n\t\treturn s.Name\n\t}\n\treturn\n}", "title": "" }, { "docid": "f7bc6fced71081f65d41a2c92505f748", "score": "0.74243957", "text": "func (v *SignalExternalWorkflowExecutionInitiatedEventAttributes) GetSignalName() (o string) {\n\tif v != nil {\n\t\treturn v.SignalName\n\t}\n\treturn\n}", "title": "" }, { "docid": "9003b22ecef449c97856d856827c4bec", "score": "0.73794997", "text": "func (v *SignalExternalWorkflowExecutionDecisionAttributes) GetSignalName() (o string) {\n\tif v != nil {\n\t\treturn v.SignalName\n\t}\n\treturn\n}", "title": "" }, { "docid": "3ecaf768cf0869d6e51d23ca5fcc5392", "score": "0.73272735", "text": "func (v *CrossClusterSignalExecutionRequestAttributes) GetSignalName() (o string) {\n\tif v != nil {\n\t\treturn v.SignalName\n\t}\n\treturn\n}", "title": "" }, { "docid": "1fd6be3d25c43e6071cefe9206347c20", "score": "0.72568005", "text": "func (v *WorkflowExecutionSignaledEventAttributes) GetSignalName() (o string) {\n\tif v != nil {\n\t\treturn v.SignalName\n\t}\n\treturn\n}", "title": "" }, { "docid": "1256699e432c9b48ce63b0c8c83a740a", "score": "0.70319986", "text": "func (v *SignalWithStartWorkflowExecutionRequest) GetSignalName() (o string) {\n\tif v != nil {\n\t\treturn v.SignalName\n\t}\n\treturn\n}", "title": "" }, { "docid": "2c9de7c141c380b3a2bdf612b4911e85", "score": "0.6920948", "text": "func signalControlName(sig signals.Signal, sigNo signals.SignalNo) string {\n\tswitch sig {\n\tcase signals.Input, signals.FXReturn:\n\t\treturn controls.Fader.String()\n\tcase signals.Direct:\n\t\treturn \"Invalid\"\n\tcase signals.Aux:\n\t\treturn fmt.Sprintf(\"%s %d\", controls.Aux, sigNo)\n\tcase signals.Group:\n\t\treturn fmt.Sprintf(\"%s %d\", controls.Group, sigNo)\n\tdefault:\n\t\treturn controls.Unknown.String()\n\t}\n}", "title": "" }, { "docid": "585be73f3019e0fedd60d50acdf88cac", "score": "0.67511046", "text": "func (w Waitmsg) Signal() string {\r\n\treturn w.signal\r\n}", "title": "" }, { "docid": "a7b60a90fbfab48798ce5d5b8a983c8e", "score": "0.66592354", "text": "func (signalR *SignalR_Spec_ARM) GetName() string {\n\treturn signalR.Name\n}", "title": "" }, { "docid": "228651a1308fa345d978c71fe88a7344", "score": "0.6603369", "text": "func (macds MACDSignalSeries) GetName() string {\n\treturn macds.Name\n}", "title": "" }, { "docid": "04d86602ab097c57872bb014c6d8a0ad", "score": "0.65352917", "text": "func Signame(sig int32) string", "title": "" }, { "docid": "6f751e26f2aefe80a4f0417c6603bacb", "score": "0.6441303", "text": "func (p proxy) SignalID(name string) (uint32, error) {\n\treturn p.meta.SignalID(name)\n}", "title": "" }, { "docid": "2a675b1236b7f73460f591971837c062", "score": "0.6277074", "text": "func GetUnhandledSignalNames(ctx Context) []string {\n\treturn internal.GetUnhandledSignalNames(ctx)\n}", "title": "" }, { "docid": "4a9464c044e26f40571530abe7029225", "score": "0.62445956", "text": "func (o CxFlowEventHandlerOutput) Name() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v CxFlowEventHandler) *string { return v.Name }).(pulumi.StringPtrOutput)\n}", "title": "" }, { "docid": "d3c7da0db8f2650121c8d6595096f1a3", "score": "0.61442226", "text": "func (r *Resolver) GetName(context.Context) string {\n\treturn \"Hub\"\n}", "title": "" }, { "docid": "b732ca4c07460c831aeceefb2f2a2a75", "score": "0.6118136", "text": "func (v *promiseVirtual) EventName() string { return v.name }", "title": "" }, { "docid": "07fe8e08a768c23d38460b1791468d63", "score": "0.602293", "text": "func (t SignalMessageType) String() string {\n\treturn signalMessageOps[t]\n}", "title": "" }, { "docid": "d0c16a0d4bd3fa3a28036f35bf41ea30", "score": "0.5969819", "text": "func (m *MonitoringRule) GetSignal()(*MonitoringSignal) {\n val, err := m.GetBackingStore().Get(\"signal\")\n if err != nil {\n panic(err)\n }\n if val != nil {\n return val.(*MonitoringSignal)\n }\n return nil\n}", "title": "" }, { "docid": "68601e148c2adc6f10c92525c0a16b18", "score": "0.5964243", "text": "func GetSignal() os.Signal {\n\treturn signalReceived\n}", "title": "" }, { "docid": "e8fb009de162e17f1600685b2138d97e", "score": "0.58729315", "text": "func ExampleSignal() {\n\tVerbosity = 0\n\n\tchn := Listen(\"example.hello\")\n\n\tgo func() {\n\t\tSignal(\"example.hello\")\n\t}()\n\n\te := <-chn\n\tfmt.Println(e.Tag)\n\n\t// Output:\n\t// example.hello\n}", "title": "" }, { "docid": "64b61f59aa2ddaa9388dd646d999f376", "score": "0.5851557", "text": "func (v *CrossClusterSignalExecutionRequestAttributes) GetSignalInput() (o []byte) {\n\tif v != nil && v.SignalInput != nil {\n\t\treturn v.SignalInput\n\t}\n\treturn\n}", "title": "" }, { "docid": "15ea1d9fb38fc0694b608ef4a1b0afe9", "score": "0.58224237", "text": "func (e *event) Name() string { return e.name }", "title": "" }, { "docid": "a46389d61fd3aa4d378ed41113399bfc", "score": "0.5788409", "text": "func (m *WindowsVpnConfiguration) GetConnectionName()(*string) {\n val, err := m.GetBackingStore().Get(\"connectionName\")\n if err != nil {\n panic(err)\n }\n if val != nil {\n return val.(*string)\n }\n return nil\n}", "title": "" }, { "docid": "2794013283a80157ccbe102741cbe517", "score": "0.5786979", "text": "func TestSignalNamespaces(t *testing.T) {\n\tunnamedSignalArrived := NewPending(1, 1*time.Second, true)\n\tshortestNameSignalArrived := NewPending(1, 1*time.Second, true)\n\tlongestNameSignalArrived := NewPending(1, 1*time.Second, true)\n\tcurrentStep := 1\n\n\tshortestPossibleName := \"s\"\n\tbuf := make([]rune, 255)\n\tfor i := 0; i < 255; i++ {\n\t\tbuf[i] = 'x'\n\t}\n\tlongestPossibleName := string(buf)\n\n\t// Initialize server\n\t_, addr := setupServer(\n\t\tt,\n\t\twebwire.ServerOptions{\n\t\t\tHooks: webwire.Hooks{\n\t\t\t\tOnSignal: func(ctx context.Context) {\n\t\t\t\t\tmsg := ctx.Value(webwire.Msg).(webwire.Message)\n\n\t\t\t\t\tif currentStep == 1 && msg.Name != \"\" {\n\t\t\t\t\t\tt.Errorf(\"Expected unnamed signal, got: '%s'\", msg.Name)\n\t\t\t\t\t}\n\t\t\t\t\tif currentStep == 2 && msg.Name != shortestPossibleName {\n\t\t\t\t\t\tt.Errorf(\"Expected shortest possible signal name, got: '%s'\", msg.Name)\n\t\t\t\t\t}\n\t\t\t\t\tif currentStep == 3 && msg.Name != longestPossibleName {\n\t\t\t\t\t\tt.Errorf(\"Expected longest possible signal name, got: '%s'\", msg.Name)\n\t\t\t\t\t}\n\n\t\t\t\t\tswitch currentStep {\n\t\t\t\t\tcase 1:\n\t\t\t\t\t\tunnamedSignalArrived.Done()\n\t\t\t\t\tcase 2:\n\t\t\t\t\t\tshortestNameSignalArrived.Done()\n\t\t\t\t\tcase 3:\n\t\t\t\t\t\tlongestNameSignalArrived.Done()\n\t\t\t\t\t}\n\t\t\t\t},\n\t\t\t},\n\t\t},\n\t)\n\n\t// Initialize client\n\tclient := webwireClient.NewClient(\n\t\taddr,\n\t\twebwireClient.Options{\n\t\t\tDefaultRequestTimeout: 2 * time.Second,\n\t\t},\n\t)\n\n\tif err := client.Connect(); err != nil {\n\t\tt.Fatalf(\"Couldn't connect: %s\", err)\n\t}\n\n\t/*****************************************************************\\\n\t\tStep 1 - Unnamed signal name\n\t\\*****************************************************************/\n\t// Send unnamed signal\n\terr := client.Signal(\"\", webwire.Payload{Data: []byte(\"dummy\")})\n\tif err != nil {\n\t\tt.Fatalf(\"Request failed: %s\", err)\n\t}\n\tif err := unnamedSignalArrived.Wait(); err != nil {\n\t\tt.Fatal(\"Unnamed signal didn't arrive\")\n\t}\n\n\t/*****************************************************************\\\n\t\tStep 2 - Shortest possible request name\n\t\\*****************************************************************/\n\tcurrentStep = 2\n\t// Send request with the shortest possible name\n\terr = client.Signal(shortestPossibleName, webwire.Payload{Data: []byte(\"dummy\")})\n\tif err != nil {\n\t\tt.Fatalf(\"Request failed: %s\", err)\n\t}\n\tif err := shortestNameSignalArrived.Wait(); err != nil {\n\t\tt.Fatal(\"Signal with shortest name didn't arrive\")\n\t}\n\n\t/*****************************************************************\\\n\t\tStep 3 - Longest possible request name\n\t\\*****************************************************************/\n\tcurrentStep = 3\n\t// Send request with the longest possible name\n\terr = client.Signal(longestPossibleName, webwire.Payload{Data: []byte(\"dummy\")})\n\tif err != nil {\n\t\tt.Fatalf(\"Request failed: %s\", err)\n\t}\n\tif err := longestNameSignalArrived.Wait(); err != nil {\n\t\tt.Fatal(\"Signal with longest name didn't arrive\")\n\t}\n}", "title": "" }, { "docid": "62d230d714018f888f1ee5cbcf720f75", "score": "0.5770998", "text": "func (sms ProximusSMS) Name() string {\n\treturn notifierName\n}", "title": "" }, { "docid": "06e991b289328e927c71cee424bf2c93", "score": "0.5770135", "text": "func (*Signal) Descriptor() ([]byte, []int) {\n\treturn file_proto_signals_proto_signals_proto_rawDescGZIP(), []int{0}\n}", "title": "" }, { "docid": "bd50ad59cd4ddb1060d4ab999d4d1051", "score": "0.5745499", "text": "func (d *SpectrumPrepareLockinTxData) GetName() string {\n\treturn SpectrumPrepareLockinTxDataName\n}", "title": "" }, { "docid": "41deebb15ca178aa7da6435e3d8759b1", "score": "0.5733344", "text": "func (msg *Inform) GetName() string {\n\treturn \"Inform\"\n}", "title": "" }, { "docid": "5ca93c10863361a6d4693c894b8df95c", "score": "0.57019055", "text": "func (self *Notification) Name() string {\n\treturn self.name\n}", "title": "" }, { "docid": "0b19fc268ab1cc7b328a4bf333493f93", "score": "0.56948334", "text": "func (o CxPageEventHandlerOutput) Name() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v CxPageEventHandler) *string { return v.Name }).(pulumi.StringPtrOutput)\n}", "title": "" }, { "docid": "519470399943671a37d3ac1b192030f5", "score": "0.56892097", "text": "func (this *RangerAppFunctionDesc) Get_name() string {\n return this.name\n}", "title": "" }, { "docid": "977d5a75d0a216d3c7190998d71757c4", "score": "0.56832886", "text": "func ToSignal(signalName string) (os.Signal, error) {\n\tif signalName == \"HUP\" {\n\t\treturn syscall.SIGHUP, nil\n\t} else if signalName == \"INT\" {\n\t\treturn syscall.SIGINT, nil\n\t} else if signalName == \"QUIT\" {\n\t\treturn syscall.SIGQUIT, nil\n\t} else if signalName == \"KILL\" {\n\t\treturn syscall.SIGKILL, nil\n\t} else if signalName == \"USR1\" {\n\t\treturn syscall.SIGUSR1, nil\n\t} else if signalName == \"USR2\" {\n\t\treturn syscall.SIGUSR2, nil\n\t} else {\n\t\treturn syscall.SIGTERM, nil\n\n\t}\n\n}", "title": "" }, { "docid": "62d269ffb0112ed123b00f9e062e09d1", "score": "0.56793845", "text": "func (c *EventHubClient) Name() string {\n\treturn c.runtimeInfo.Path\n}", "title": "" }, { "docid": "3e9a4ae44585cf4528e19e4f3aa91a92", "score": "0.5665846", "text": "func GetName() string {\n\treturn newRelay().GetName()\n}", "title": "" }, { "docid": "5627f5df5d58a0ce5c383e89f4d149f8", "score": "0.56538594", "text": "func (o *DocumentRiskSignal) GetSignalDescription() string {\n\tif o == nil || o.SignalDescription.Get() == nil {\n\t\tvar ret string\n\t\treturn ret\n\t}\n\n\treturn *o.SignalDescription.Get()\n}", "title": "" }, { "docid": "51afcda9a5576fcd0341f0038bbcc4f7", "score": "0.56325793", "text": "func (v *SignalWithStartWorkflowExecutionRequest) GetSignalInput() (o []byte) {\n\tif v != nil && v.SignalInput != nil {\n\t\treturn v.SignalInput\n\t}\n\treturn\n}", "title": "" }, { "docid": "a66866935e74ac50dcaf8ac8da7b1c19", "score": "0.5620777", "text": "func (v *UpdateLabelUpdateLabelUpdateLabelPayloadLabel) GetName() string { return v.Name }", "title": "" }, { "docid": "55b4aa0d2939f6806e98967a417897fb", "score": "0.56200916", "text": "func (v *CreateLabelCreateLabelCreateLabelPayloadLabel) GetName() string { return v.Name }", "title": "" }, { "docid": "756810ea93884cad6af2197ecc3dbc63", "score": "0.561157", "text": "func ToSignal(signalName string) (os.Signal, error) {\n\tif signalName == \"HUP\" {\n\t\treturn syscall.SIGHUP, nil\n\t} else if signalName == \"INT\" {\n\t\treturn syscall.SIGINT, nil\n\t} else if signalName == \"QUIT\" {\n\t\treturn syscall.SIGQUIT, nil\n\t} else if signalName == \"KILL\" {\n\t\treturn syscall.SIGKILL, nil\n\t} else if signalName == \"STOP\" {\n\t\treturn syscall.SIGSTOP, nil\n\t} else if signalName == \"TERM\" {\n\t\treturn syscall.SIGTERM, nil\n\t}\n\n\treturn syscall.SIGINT, nil\n}", "title": "" }, { "docid": "45241206282915527ddec362db1b44b9", "score": "0.5605163", "text": "func (o *EventType) 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}", "title": "" }, { "docid": "21cc07e65c877ecdd493228f28a26bfe", "score": "0.5581599", "text": "func (b *BaseDiagnoser) GetName() string {\n\treturn b.diagnoserType.name()\n}", "title": "" }, { "docid": "75d59550a9a6af6c50b9fefaf605ceb7", "score": "0.55618083", "text": "func (inst *InstFSub) GetName() string {\n\treturn inst.Name\n}", "title": "" }, { "docid": "2bfbac88d7ec5332ef759c29b372af1c", "score": "0.5556016", "text": "func (b *Bin) GetName() string {\n\treturn b.Name\n}", "title": "" }, { "docid": "c11912f85aecf1b202a392c5dc695e83", "score": "0.55540043", "text": "func (o EndpointEventhubOutput) Name() pulumi.StringOutput {\n\treturn o.ApplyT(func(v *EndpointEventhub) pulumi.StringOutput { return v.Name }).(pulumi.StringOutput)\n}", "title": "" }, { "docid": "4d290684ed1d875affd1578cbf6c579d", "score": "0.5541096", "text": "func (m *ExternalConnection) 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}", "title": "" }, { "docid": "c76ed0038fcc88ecbec17934e199912c", "score": "0.5527803", "text": "func (m *SynchronizationRule) 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}", "title": "" }, { "docid": "c6654eb833b3abcd9055ee3cefc70bfc", "score": "0.5525026", "text": "func (m *MacOSCustomConfiguration) GetPayloadName()(*string) {\n return m.payloadName\n}", "title": "" }, { "docid": "9450e32133f33bf24f3a7f720e753dfb", "score": "0.5521741", "text": "func (c *Client) Name() string {\n\treturn \"signalrest\"\n}", "title": "" }, { "docid": "3b9e0a51d65e74d5d0bf86ff615ec266", "score": "0.5521533", "text": "func (h DeviceStateChangedEventHandler) EventName() string {\n\treturn \"device-state-changed\"\n}", "title": "" }, { "docid": "462f8ecd7f5adbc0f545af04076fe9cf", "score": "0.5519979", "text": "func (m *ServiceNowNotificationConfig) Name() *string {\n\treturn m.nameField\n}", "title": "" }, { "docid": "10589252a9411296074f47d9d9dba5f2", "score": "0.55129194", "text": "func (inst *InstSub) GetName() string {\n\treturn inst.Name\n}", "title": "" }, { "docid": "c654f2ea52d630fd2724c5c2ba6dba15", "score": "0.55038416", "text": "func (ev *Shutdown) GetName() string {\n\treturn \"Shutdown\"\n}", "title": "" }, { "docid": "be413fc05f5399ff7bef12830f702d0c", "score": "0.550266", "text": "func (d DynamicMessage) GetName() string {\n\treturn d.T.Msg.OriginalName\n}", "title": "" }, { "docid": "02bdaa28fa464dfaf8054a75cc3e416f", "score": "0.5500064", "text": "func (r *Dummy) Name() string {\n\tr.RLock()\n\tdefer r.RUnlock()\n\treturn r.name\n}", "title": "" }, { "docid": "a301be9de193784ac5ac59ebc2f8cb91", "score": "0.5499736", "text": "func (n *Interface_SubinterfacePathAny) Name() *Interface_Subinterface_NamePathAny {\n\treturn &Interface_Subinterface_NamePathAny{\n\t\tNodePath: ygot.NewNodePath(\n\t\t\t[]string{\"state\", \"name\"},\n\t\t\tmap[string]interface{}{},\n\t\t\tn,\n\t\t),\n\t}\n}", "title": "" }, { "docid": "ffe9cf6edc4b80e13a59a710fa581a3d", "score": "0.5498682", "text": "func (b *Bot) getHandlerName(i interface{}) string {\n\treturn runtime.FuncForPC(reflect.ValueOf(i).Pointer()).Name()\n}", "title": "" }, { "docid": "139eae80badc48aca74bf5a132c96e98", "score": "0.549528", "text": "func (q *queue) GetSignal() (signal <-chan struct{}) {\n\tq.Lock()\n\tdefer q.Unlock()\n\tsignal = q.signal\n\treturn\n}", "title": "" }, { "docid": "1fe234eb25c71527c0b5a58557fcd5cb", "score": "0.5494679", "text": "func (i *IBM) Name() string {\n\treturn i.Path()\n}", "title": "" }, { "docid": "663e0392babf714481db3c500508862e", "score": "0.54764444", "text": "func (c *interaction) GetName() string {\n\treturn c.name\n}", "title": "" }, { "docid": "6fb571e0e3b3128d85985cf92a888c88", "score": "0.54701215", "text": "func (m *AndroidForWorkVpnConfiguration) GetConnectionName()(*string) {\n val, err := m.GetBackingStore().Get(\"connectionName\")\n if err != nil {\n panic(err)\n }\n if val != nil {\n return val.(*string)\n }\n return nil\n}", "title": "" }, { "docid": "9f8127ab3732def241c904c702e5e4ff", "score": "0.5466765", "text": "func (a *attributes) GetName() string {\n\tif a.event.ObjectRef == nil {\n\t\treturn \"\"\n\t}\n\treturn a.event.ObjectRef.Name\n}", "title": "" }, { "docid": "99a25cdcb9fff9ec24f739c1a0638f88", "score": "0.54615617", "text": "func getHandlerName(i worker.Handler) string {\n\treturn runtime.FuncForPC(reflect.ValueOf(i).Pointer()).Name()\n}", "title": "" }, { "docid": "4bbf79eb0a96876192a7da0383a818d3", "score": "0.54425716", "text": "func (r *RelayType) GetName() string {\n\treturn RelayX\n}", "title": "" }, { "docid": "f231eef8d0509a18b73c443e3f9ba194", "score": "0.54377234", "text": "func GetSignalChannel(ctx Context, signalName string) Channel {\n\treturn internal.GetSignalChannel(ctx, signalName)\n}", "title": "" }, { "docid": "7305a351a2c1190370ce1cc86e910aba", "score": "0.54249215", "text": "func (obj *label) Name() string {\n\treturn obj.name\n}", "title": "" }, { "docid": "dbcbc13acbe7aaf238149446c9f395eb", "score": "0.5424108", "text": "func (w *Websocket) GetName() string {\n\treturn w.exchangeName\n}", "title": "" }, { "docid": "a83790c9295248f45d2218552065006d", "score": "0.54222375", "text": "func (macd MACDSeries) GetName() string {\n\treturn macd.Name\n}", "title": "" }, { "docid": "5434ec75a8ef8f859727c154245d3c66", "score": "0.54216653", "text": "func (this *RangerAppMethodVariants) Get_name() string {\n return this.name\n}", "title": "" }, { "docid": "051fc860d882bca42a77d31cee2c47be", "score": "0.5411732", "text": "func (t *WorkflowOutboundCallsInterceptorBase) GetSignalChannel(ctx Context, signalName string) ReceiveChannel {\n\treturn t.Next.GetSignalChannel(ctx, signalName)\n}", "title": "" }, { "docid": "ec2350eca6ed6566256cbaa7e6648f52", "score": "0.5411521", "text": "func (b OVSBridge) GetName() string {\n\treturn b.Name\n}", "title": "" }, { "docid": "ccf2dcea74aeaf28726b11deea2e18d0", "score": "0.5408984", "text": "func (o *Integration) GetName() string {\n\tif o == nil {\n\t\tvar ret string\n\t\treturn ret\n\t}\n\n\treturn o.Name\n}", "title": "" }, { "docid": "cec45985c6d60fcbc9cc083a147d8274", "score": "0.5393298", "text": "func (b Bridge) Name() string {\n\treturn b.IfName\n}", "title": "" }, { "docid": "eeabd6eac3b90f51230fc6552b85f1d4", "score": "0.5392621", "text": "func (ev *HealingResync) GetName() string {\n\treturn \"Healing Resync\"\n}", "title": "" }, { "docid": "e195c361562beb1f3d06100b851f59c5", "score": "0.5386135", "text": "func (b *ValueDriver) Name() string { return b.name }", "title": "" }, { "docid": "4021587de1f55b287023006bd29d9606", "score": "0.5385444", "text": "func GetName() string {\n\treturn BackendName\n}", "title": "" }, { "docid": "24ae5dc1eb7774240c5008f3b85340da", "score": "0.5384995", "text": "func (n *Stp_Mstp_MstInstance_InterfacePathAny) Name() *Stp_Mstp_MstInstance_Interface_NamePathAny {\n\treturn &Stp_Mstp_MstInstance_Interface_NamePathAny{\n\t\tNodePath: ygot.NewNodePath(\n\t\t\t[]string{\"config\", \"name\"},\n\t\t\tmap[string]interface{}{},\n\t\t\tn,\n\t\t),\n\t}\n}", "title": "" }, { "docid": "eb209c0e54412c2695cea9c763a48e04", "score": "0.5381679", "text": "func (state *State) GetName() string {\n return state.Name\n}", "title": "" }, { "docid": "824ca13a4c84ea48bff6cf992dc39834", "score": "0.5381246", "text": "func (e ServerRegistryEvent) SubjectName() string {\n\tswitch e {\n\tcase ServerRegistryEventLBAdded:\n\t\treturn \"sr.lb.added\"\n\tcase ServerRegistryEventLBRemovedUnhealthy:\n\t\treturn \"sr.lb.removed.unhealthy\"\n\t}\n\tpanic(fmt.Errorf(\"unk event %d\", e))\n}", "title": "" }, { "docid": "2aff069f495b65aa02b986ae9f0c42be", "score": "0.53812146", "text": "func (m *WebHookNotificationConfig) Name() *string {\n\treturn m.nameField\n}", "title": "" }, { "docid": "a77c255ad61bf63ed4e83e2df26fe95c", "score": "0.53807366", "text": "func (p *X5C) GetName() string {\n\treturn p.Name\n}", "title": "" }, { "docid": "60b0e323cddddbba7c29c49cb8b7fc9e", "score": "0.537902", "text": "func (b *MakeyButtonDriver) Name() string { return b.name }", "title": "" }, { "docid": "467b29a45766a2395610abf90651bd57", "score": "0.53726643", "text": "func (f *function) GetName() string {\n\treturn f.Function.Labels[\"name\"]\n}", "title": "" }, { "docid": "1832fb26a95e1dd1aefb2d3fc661fbd4", "score": "0.537119", "text": "func (_Ubt *UbtCallerSession) Name() (string, error) {\n\treturn _Ubt.Contract.Name(&_Ubt.CallOpts)\n}", "title": "" }, { "docid": "963dd8aee6324651ba177c6a65c1c189", "score": "0.5366328", "text": "func (pulse *Client) DispatchSignal(s *dbus.Signal) {\n\tname := strings.TrimPrefix(string(s.Name), DbusInterface+\".\")\n\tif name != s.Name { // dbus interface matched.\n\t\tif pulse.hooker.Call(name, s) {\n\t\t\treturn // signal was defined (even if no clients are connected).\n\t\t}\n\t}\n\tpulse.unknownSignal(s)\n}", "title": "" }, { "docid": "011c32692acbcdf3d428ab663402cc2d", "score": "0.53660434", "text": "func (v *CreateLabelInput) GetName() string { return v.Name }", "title": "" }, { "docid": "fd022da1d78d0b3bb73723e56fa2e0ff", "score": "0.5364283", "text": "func (hw *HandlerWrapper) Name() string {\n\tif hw == nil {\n\t\treturn \"nil\"\n\t}\n\treturn hw.NameValue\n}", "title": "" }, { "docid": "cca1cca464ede68a1c9a0067ef261c5e", "score": "0.536338", "text": "func (global *GlobalDummy) GetName() string {\n\treturn global.Name\n}", "title": "" }, { "docid": "13091569750f114ecd9182030757a1f8", "score": "0.5361084", "text": "func (b *Button) GetName() string {\n\treturn b.Name\n}", "title": "" }, { "docid": "0bc7062d7913f855c23cd7919336cf9f", "score": "0.5360499", "text": "func (n *Lldp_Interface_Neighbor_CapabilityPathAny) Name() *Lldp_Interface_Neighbor_Capability_NamePathAny {\n\treturn &Lldp_Interface_Neighbor_Capability_NamePathAny{\n\t\tNodePath: ygot.NewNodePath(\n\t\t\t[]string{\"state\", \"name\"},\n\t\t\tmap[string]interface{}{},\n\t\t\tn,\n\t\t),\n\t}\n}", "title": "" }, { "docid": "b903dfe5669545273570890d4d15e01d", "score": "0.53574944", "text": "func (r Registration) Name() string {\n\treturn \"PowerBI\"\n}", "title": "" }, { "docid": "12f2bce0d7c8030a525801ef2ea39e6d", "score": "0.5355663", "text": "func (d *MCP3004Driver) Name() string { return d.name }", "title": "" }, { "docid": "f79b7856e856331649a70655472cd1f2", "score": "0.5348497", "text": "func GetName(id core.Id) (core.Path, error) {\n\tvar out *C.char\n\tsze := C.H5Iget_name(C.hid_t(id), out, 1)\n\tif err := core.Status(int(sze), \"getting name\"); err != nil {\n\t\treturn \"\", err\n\t} else if err := core.Status(int(C.H5Iget_name(C.hid_t(id),\n\t\tout, C.size_t(sze+1))), \"getting name\"); err != nil {\n\t\treturn \"\", err\n\t}\n\treturn core.Path(C.GoString(out)), nil\n}", "title": "" }, { "docid": "12cd614c0485392e55af8090f8eed59c", "score": "0.5347157", "text": "func (b Bond) Name() string {\n\treturn b.IfName\n}", "title": "" }, { "docid": "b6fca5e4cf4f9bb8ad107e4c832ae7f8", "score": "0.5346777", "text": "func (v *UpdateLabelInput) GetName() string { return v.Name }", "title": "" }, { "docid": "44896bd07368ca1021ed044ece3983be", "score": "0.53463113", "text": "func (n *Stp_Rstp_InterfacePathAny) Name() *Stp_Rstp_Interface_NamePathAny {\n\treturn &Stp_Rstp_Interface_NamePathAny{\n\t\tNodePath: ygot.NewNodePath(\n\t\t\t[]string{\"config\", \"name\"},\n\t\t\tmap[string]interface{}{},\n\t\t\tn,\n\t\t),\n\t}\n}", "title": "" }, { "docid": "b4023e9637ed1d588b54db64c960d21e", "score": "0.534612", "text": "func (s MpuSensor) GetName() string {\n\treturn \"Ac-Mg-Gy\"\n}", "title": "" }, { "docid": "2286963a9341d4fba2fe699b9632fcec", "score": "0.53362405", "text": "func (o *UserSessionEvents) 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}", "title": "" }, { "docid": "c12973b9541d0a0b93797836dce3b53d", "score": "0.5335669", "text": "func (t *IfName) Name() string { return \"Name\" }", "title": "" }, { "docid": "3955987753994ad172ce1bb43a9a6aeb", "score": "0.5333368", "text": "func (m *customIntegrationSpec) Name() *string {\n\treturn m.nameField\n}", "title": "" }, { "docid": "26a3fd886df041b0923f2561c978f292", "score": "0.5331348", "text": "func (o ApplicationGatewayProbeOutput) Name() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v ApplicationGatewayProbe) *string { return v.Name }).(pulumi.StringPtrOutput)\n}", "title": "" } ]
7b181cad524c970c996fe3fab044384b
Workspace returns a WorkspaceService for the corresponding client.
[ { "docid": "2a818bc66e2882320ee64c97234f0fa7", "score": "0.7898868", "text": "func (c *Client) Workspace() *WorkspaceService {\n\treturn &WorkspaceService{\n\t\tclient: *c,\n\t}\n}", "title": "" } ]
[ { "docid": "a77d17cfe0571b67397b8fdf9f3ce033", "score": "0.6306654", "text": "func (service *WorkspaceService) GetWorkspace(id string) (models.Workspace, error) {\n\tworkspace := models.Workspace{}\n\terr := service.db.\n\t\tWhere(\"id = ?\", id).\n\t\tFirst(&workspace).Error\n\n\tif err != nil {\n\t\treturn workspace, err\n\t}\n\n\treturn workspace, nil\n}", "title": "" }, { "docid": "77531537d4ac1b82c5372b19039b508f", "score": "0.60846114", "text": "func (c *Controller) GetWorkspace() (workspace string) {\n\tc.workspaceAccess.RLock()\n\tworkspace = c.workspace\n\tc.workspaceAccess.RUnlock()\n\treturn\n}", "title": "" }, { "docid": "b567ff217ccc7bf68a7a1eef67878a22", "score": "0.5963434", "text": "func GetWorkspace(ctx *pulumi.Context,\n\tname string, id pulumi.IDInput, state *WorkspaceState, opts ...pulumi.ResourceOption) (*Workspace, error) {\n\tvar resource Workspace\n\terr := ctx.ReadResource(\"azure-native:operationalinsights/v20151101preview:Workspace\", name, id, state, &resource, opts...)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn &resource, nil\n}", "title": "" }, { "docid": "15067093981c7bdbe85abd8154f41f92", "score": "0.585442", "text": "func GetWorkspace(ctx *pulumi.Context,\n\tname string, id pulumi.IDInput, state *WorkspaceState, opts ...pulumi.ResourceOption) (*Workspace, error) {\n\tvar resource Workspace\n\terr := ctx.ReadResource(\"azure:databricks/workspace:Workspace\", name, id, state, &resource, opts...)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn &resource, nil\n}", "title": "" }, { "docid": "63c5eaa679b0fa9f409e364f48a97901", "score": "0.58024406", "text": "func (assistant *AssistantV1) GetWorkspace(getWorkspaceOptions *GetWorkspaceOptions) (result *Workspace, response *core.DetailedResponse, err error) {\n\treturn assistant.GetWorkspaceWithContext(context.Background(), getWorkspaceOptions)\n}", "title": "" }, { "docid": "36e4d94eaf167ef1dd6b79adbd66a6e5", "score": "0.5779887", "text": "func GetWorkspace(ctx *pulumi.Context,\n\tname string, id pulumi.IDInput, state *WorkspaceState, opts ...pulumi.ResourceOption) (*Workspace, error) {\n\tvar resource Workspace\n\terr := ctx.ReadResource(\"azure:machinelearning/workspace:Workspace\", name, id, state, &resource, opts...)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn &resource, nil\n}", "title": "" }, { "docid": "f2103f2dc212f027455f7e7816d497a3", "score": "0.56919837", "text": "func (service *WorkspaceService) GetWorkspaceByWorkspaceID(workspaceID string) (models.Workspace, error) {\n\tworkspace := models.Workspace{}\n\terr := service.db.\n\t\tWhere(\"workspace_id = ?\", workspaceID).\n\t\tFirst(&workspace).Error\n\n\tif err != nil {\n\t\treturn workspace, err\n\t}\n\n\treturn workspace, nil\n}", "title": "" }, { "docid": "5e28ba96330d5b8421d45b8f8894d2fa", "score": "0.56125546", "text": "func (_e *MockFactory_Expecter) GetWorkspace() *MockFactory_GetWorkspace_Call {\n\treturn &MockFactory_GetWorkspace_Call{Call: _e.mock.On(\"GetWorkspace\")}\n}", "title": "" }, { "docid": "1015a74bf0c4d618fd7ed141fcef2279", "score": "0.55962384", "text": "func (s *Service) GetWorkspaceForUser(userID, id string) (*model.Workspace, error) {\n\treturn s.stor.GetWorkspaceForUser(userID, id)\n}", "title": "" }, { "docid": "8663ed49787beecf1bd1d76f8bfa24cb", "score": "0.5575509", "text": "func (o *MenuItem) Workspace(mods ...qm.QueryMod) workspaceQuery {\n\tqueryMods := []qm.QueryMod{\n\t\tqm.Where(\"id=?\", o.WorkspaceID),\n\t}\n\n\tqueryMods = append(queryMods, mods...)\n\n\tquery := Workspaces(queryMods...)\n\tqueries.SetFrom(query.Query, \"\\\"workspaces\\\"\")\n\n\treturn query\n}", "title": "" }, { "docid": "dc2baf035603d32f59cedeaa38835586", "score": "0.5542477", "text": "func (o *ActionScopes) GetWorkspace() int32 {\n\tif o == nil || IsNil(o.Workspace.Get()) {\n\t\tvar ret int32\n\t\treturn ret\n\t}\n\treturn *o.Workspace.Get()\n}", "title": "" }, { "docid": "4ba5c18ab70c54f8ee6dcf495f2dc12e", "score": "0.5497022", "text": "func (o *CIAppHostInfo) GetWorkspace() string {\n\tif o == nil || o.Workspace == nil {\n\t\tvar ret string\n\t\treturn ret\n\t}\n\treturn *o.Workspace\n}", "title": "" }, { "docid": "736a55ee62852d7a5d0066e09f39896e", "score": "0.5362122", "text": "func NewWorkspace(ctx context.Context, src *url.URL, dest *url.URL) (*Workspace, error) {\n\tw := &Workspace{\n\t\tsrc: src,\n\t\tdest: dest,\n\t}\n\n\tcfg := ConfigFromContext(ctx)\n\tclient, err := storage.NewClient(ctx, option.WithServiceAccountFile(cfg.KeyFile))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tw.client = client\n\n\terr = w.setup()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn w, nil\n}", "title": "" }, { "docid": "94d8c61fd762e63047fe350aa19f7adc", "score": "0.5347933", "text": "func (c *AppDevConfig) workspace(cliOverride bool) config.ConfigSource {\n\tvar cliConfig config.ConfigSource\n\tif cliOverride {\n\t\tcliConfig = c.doctl()\n\t}\n\n\treturn config.Multi(\n\t\tcliConfig,\n\t\tappsDevFlagConfigCompat(c.appDevConfig),\n\t)\n}", "title": "" }, { "docid": "b2be69d9e9640a70b13ef110018a529b", "score": "0.52992564", "text": "func (c *DBApiClient) MWSWorkspaces() MWSWorkspacesAPI {\n\treturn MWSWorkspacesAPI{Client: c}\n}", "title": "" }, { "docid": "c17f7019de29642a93d1ae39423790c8", "score": "0.5265469", "text": "func (service *WorkspaceService) GetWorkspaceByBotAccessToken(botAccessToken string) (models.Workspace, error) {\n\tworkspace := models.Workspace{}\n\terr := service.db.\n\t\tWhere(\"bot_access_token = ?\", botAccessToken).\n\t\tFirst(&workspace).Error\n\n\tif err != nil {\n\t\treturn workspace, err\n\t}\n\n\treturn workspace, nil\n}", "title": "" }, { "docid": "31892add2e1d8c375bd48562616b500f", "score": "0.5246543", "text": "func (service *WorkspaceService) GetWorkspaceByToken(token string) (models.Workspace, error) {\n\tworkspace := models.Workspace{}\n\terr := service.db.\n\t\tPreload(\"Projects.Participants\").\n\t\tPreload(\"Projects.Questions\", func(db *gorm.DB) *gorm.DB {\n\t\t\treturn db.Order(\"questions.sequence ASC\")\n\t\t}).\n\t\tWhere(\"personal_token = ?\", token).\n\t\tFirst(&workspace).Error\n\n\tif err != nil {\n\t\treturn workspace, err\n\t}\n\n\treturn workspace, nil\n}", "title": "" }, { "docid": "a9ab8cc35a792a027803f31f111e0665", "score": "0.5240933", "text": "func (t *MultiRobotChaincode) getWorkspace(stub shim.ChaincodeStubInterface, args []string) pb.Response {\n\tvar jsonResp string\n\tvar err error\n\n\tif len(args) != 0 {\n\t\tjsonResp = \"{\\\"Error\\\": \\\"Expecting no arguments for \" + INVK_GET_WORKSPACE + \"\\\"}\"\n\t\treturn shim.Error(jsonResp)\n\t}\n\n\t// read workspace from database\n\tbytesWorkspace, err := stub.GetState(K_WORKSPACE)\n\tif err != nil {\n\t\tjsonResp = \"{\\\"Error\\\": \\\"Failed to get state for \" + K_WORKSPACE + \"\\\"}\"\n\t\treturn shim.Error(jsonResp)\n\t} else if bytesWorkspace == nil {\n\t\tjsonResp = \"{\\\"Error\\\": \\\"Workspace does not exist!\\\"}\"\n\t\treturn shim.Error(jsonResp)\n\t}\n\n\treturn shim.Success(bytesWorkspace)\n}", "title": "" }, { "docid": "b6e83b08ba98295a9dec5c83b787a441", "score": "0.5238848", "text": "func GetWorkspaces() []Workspace {\n\tSend(\"\", GET_WORKSPACES)\n\n\treturn <-ChWorkspaces\n}", "title": "" }, { "docid": "d8cf4a5e75e0a87b81090ae76322769c", "score": "0.5235736", "text": "func GetLogAnalyticsWorkspace(t testing.TestingT, workspaceName string, resourceGroupName string, subscriptionID string) *operationalinsights.Workspace {\n\tws, err := GetLogAnalyticsWorkspaceE(workspaceName, resourceGroupName, subscriptionID)\n\trequire.NoError(t, err)\n\n\treturn ws\n}", "title": "" }, { "docid": "87e4f748f17610228aa508879e757981", "score": "0.52285916", "text": "func (s *WorkspacesService) List() ([]Workspace, error) {\n\tu := \"workspaces\"\n\n\treq, err := s.client.NewRequest(\"GET\", u, nil)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tdata := new([]Workspace)\n\t_, err = s.client.Do(req, data)\n\n\treturn *data, err\n}", "title": "" }, { "docid": "ac322bdf963316d27fec4a7798a7490c", "score": "0.5205154", "text": "func (s *WorkspaceService) Create() (*Workspace, *http.Response, error) {\n\t// prepare request\n\tparam := url.Values{}\n\tparam.Set(\"name\", defaultName)\n\tparam.Set(\"eMail\", defaultEmail)\n\n\treq, err := s.client.NewReaderRequest(\"POST\", \"workspace\", strings.NewReader(param.Encode()), \"\")\n\tif err != nil {\n\t\treturn nil, nil, err\n\t}\n\n\t// do the request\n\tbody, resp, err := s.client.DoPlain(req)\n\tif err != nil {\n\t\treturn nil, resp, err\n\t}\n\n\twsCreatedRegex := regexp.MustCompile(`/api/v0.1/workspace/([0-9A-F]*)`)\n\tmatches := wsCreatedRegex.FindSubmatch(body)\n\tif len(matches) != 2 {\n\t\treturn nil, resp, fmt.Errorf(\"no Workspace ID - %s\", string(body))\n\t}\n\n\ts.ID = string(matches[1])\n\tw := &Workspace{\n\t\tID: s.ID,\n\t}\n\n\treturn w, resp, nil\n}", "title": "" }, { "docid": "5416a901a1955544cd06e1cdb2673b13", "score": "0.51859397", "text": "func (o *UserWorkspaceInvitation) GetWorkspace() string {\n\tif o == nil {\n\t\tvar ret string\n\t\treturn ret\n\t}\n\n\treturn o.Workspace\n}", "title": "" }, { "docid": "e09af1dacbba9212102a8065e935a5c8", "score": "0.51708114", "text": "func (in *Workspace) DeepCopy() *Workspace {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(Workspace)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "e09af1dacbba9212102a8065e935a5c8", "score": "0.51708114", "text": "func (in *Workspace) DeepCopy() *Workspace {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(Workspace)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "464c7d5718ad47925630c1e55ab4a231", "score": "0.51308936", "text": "func (_m *MockFactory) GetWorkspace() (dto.Workspace, error) {\n\tret := _m.Called()\n\n\tvar r0 dto.Workspace\n\tif rf, ok := ret.Get(0).(func() dto.Workspace); ok {\n\t\tr0 = rf()\n\t} else {\n\t\tr0 = ret.Get(0).(dto.Workspace)\n\t}\n\n\tvar r1 error\n\tif rf, ok := ret.Get(1).(func() error); ok {\n\t\tr1 = rf()\n\t} else {\n\t\tr1 = ret.Error(1)\n\t}\n\n\treturn r0, r1\n}", "title": "" }, { "docid": "f3703d50822c3a023a8c778eb88bce1c", "score": "0.51227176", "text": "func serviceClient(logger *zap.Logger, appName, addr string) (workflowserviceclient.Interface, error) {\n\tch, err := tchannel.NewChannelTransport(\n\t\ttchannel.ServiceName(appName),\n\t\ttchannel.Logger(logger),\n\t)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"failed to set up tchannel: %w\", err)\n\t}\n\n\tdispatcher := yarpc.NewDispatcher(yarpc.Config{\n\t\tName: appName,\n\t\tOutbounds: yarpc.Outbounds{\n\t\t\tcadenceServiceName: {\n\t\t\t\tUnary: ch.NewSingleOutbound(addr),\n\t\t\t},\n\t\t},\n\t})\n\tif err := dispatcher.Start(); err != nil {\n\t\treturn nil, fmt.Errorf(\"failed to start yarpc dispatcher: %w\", err)\n\t}\n\n\treturn workflowserviceclient.New(dispatcher.ClientConfig(cadenceServiceName)), nil\n}", "title": "" }, { "docid": "a45e654d4207b246065771a007c9828d", "score": "0.51223075", "text": "func (assistant *AssistantV1) GetWorkspaceWithContext(ctx context.Context, getWorkspaceOptions *GetWorkspaceOptions) (result *Workspace, response *core.DetailedResponse, err error) {\n\terr = core.ValidateNotNil(getWorkspaceOptions, \"getWorkspaceOptions cannot be nil\")\n\tif err != nil {\n\t\treturn\n\t}\n\terr = core.ValidateStruct(getWorkspaceOptions, \"getWorkspaceOptions\")\n\tif err != nil {\n\t\treturn\n\t}\n\n\tpathParamsMap := map[string]string{\n\t\t\"workspace_id\": *getWorkspaceOptions.WorkspaceID,\n\t}\n\n\tbuilder := core.NewRequestBuilder(core.GET)\n\tbuilder = builder.WithContext(ctx)\n\tbuilder.EnableGzipCompression = assistant.GetEnableGzipCompression()\n\t_, err = builder.ResolveRequestURL(assistant.Service.Options.URL, `/v1/workspaces/{workspace_id}`, pathParamsMap)\n\tif err != nil {\n\t\treturn\n\t}\n\n\tfor headerName, headerValue := range getWorkspaceOptions.Headers {\n\t\tbuilder.AddHeader(headerName, headerValue)\n\t}\n\n\tsdkHeaders := common.GetSdkHeaders(\"conversation\", \"V1\", \"GetWorkspace\")\n\tfor headerName, headerValue := range sdkHeaders {\n\t\tbuilder.AddHeader(headerName, headerValue)\n\t}\n\tbuilder.AddHeader(\"Accept\", \"application/json\")\n\n\tbuilder.AddQuery(\"version\", fmt.Sprint(*assistant.Version))\n\tif getWorkspaceOptions.Export != nil {\n\t\tbuilder.AddQuery(\"export\", fmt.Sprint(*getWorkspaceOptions.Export))\n\t}\n\tif getWorkspaceOptions.IncludeAudit != nil {\n\t\tbuilder.AddQuery(\"include_audit\", fmt.Sprint(*getWorkspaceOptions.IncludeAudit))\n\t}\n\tif getWorkspaceOptions.Sort != nil {\n\t\tbuilder.AddQuery(\"sort\", fmt.Sprint(*getWorkspaceOptions.Sort))\n\t}\n\n\trequest, err := builder.Build()\n\tif err != nil {\n\t\treturn\n\t}\n\n\tvar rawResponse map[string]json.RawMessage\n\tresponse, err = assistant.Service.Request(request, &rawResponse)\n\tif err != nil {\n\t\treturn\n\t}\n\tif rawResponse != nil {\n\t\terr = core.UnmarshalModel(rawResponse, \"\", &result, UnmarshalWorkspace)\n\t\tif err != nil {\n\t\t\treturn\n\t\t}\n\t\tresponse.Result = result\n\t}\n\n\treturn\n}", "title": "" }, { "docid": "221b0ce226d24ebd8987971dc7f53428", "score": "0.5121359", "text": "func (o LookupRuleGroupsNamespaceResultOutput) Workspace() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v LookupRuleGroupsNamespaceResult) *string { return v.Workspace }).(pulumi.StringPtrOutput)\n}", "title": "" }, { "docid": "03c63958d77672fdbb34d0c599a5da13", "score": "0.5103732", "text": "func RequestWorkspace(ctx context.Context, serviceRegistry serviceregistry.ServiceRegistry, id string) (*nsmdapi.ClientConnectionReply, error) {\n\tspan := spanhelper.FromContext(ctx, \"RequestWorkspace\")\n\tdefer span.Finish()\n\tclient, con, err := serviceRegistry.NSMDApiClient(span.Context())\n\tif err != nil {\n\t\tspan.Logger().Fatalf(\"Failed to connect to NSMD: %+v...\", err)\n\t}\n\tdefer con.Close()\n\n\treply, err := client.RequestClientConnection(ctx, &nsmdapi.ClientConnectionRequest{Workspace: id})\n\tspan.LogError(err)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tspan.LogObject(\"response\", reply)\n\tspan.Logger().Infof(\"nsmd allocated workspace %+v for client operations...\", reply)\n\treturn reply, nil\n}", "title": "" }, { "docid": "a2854981a403b33f5c63b699508b22c9", "score": "0.50893134", "text": "func (o RuleGroupsNamespaceOutput) Workspace() pulumi.StringOutput {\n\treturn o.ApplyT(func(v *RuleGroupsNamespace) pulumi.StringOutput { return v.Workspace }).(pulumi.StringOutput)\n}", "title": "" }, { "docid": "ee3c504e404f1c7046a886c4c4d1ec8f", "score": "0.50341284", "text": "func restWorkspaceToWorkspace(restWorkspace *restWorkspace) *Workspace {\n\tif restWorkspace != nil {\n\t\treturn &Workspace{\n\t\t\tName: restWorkspace.Name,\n\t\t\tHref: restWorkspace.Href,\n\t\t}\n\t}\n\n\treturn &Workspace{}\n}", "title": "" }, { "docid": "4b753fb9dfada55ec06f28b3fdd88efb", "score": "0.5023126", "text": "func (r *OpsSightReconciler) GetClient() client.Client {\n\treturn r.Client\n}", "title": "" }, { "docid": "bde3412f67ab00d9701ec415d793c2d6", "score": "0.501994", "text": "func GetLogAnalyticsWorkspacesClientE(subscriptionID string) (*operationalinsights.WorkspacesClient, error) {\n\tsubscriptionID, err := getTargetAzureSubscription(subscriptionID)\n\tif err != nil {\n\t\tfmt.Println(\"Workspace client error getting subscription\")\n\t\treturn nil, err\n\t}\n\n\tclient := operationalinsights.NewWorkspacesClient(subscriptionID)\n\tauthorizer, err := NewAuthorizer()\n\tif err != nil {\n\t\tfmt.Println(\"authorizer error\")\n\t\treturn nil, err\n\t}\n\n\tclient.Authorizer = *authorizer\n\treturn &client, nil\n}", "title": "" }, { "docid": "cea838ad22602800a73755a8b4807eef", "score": "0.49853683", "text": "func (workspace *Workspace) GetType() string {\n\treturn \"Microsoft.Synapse/workspaces\"\n}", "title": "" }, { "docid": "cea838ad22602800a73755a8b4807eef", "score": "0.49853683", "text": "func (workspace *Workspace) GetType() string {\n\treturn \"Microsoft.Synapse/workspaces\"\n}", "title": "" }, { "docid": "44f6bcadfbff6060bbac9d2cd845a03e", "score": "0.49797645", "text": "func (s *WorkspaceService) GetInfo() (*Workspace, *http.Response, error) {\n\treq, err := s.client.NewRequest(\"GET\", \"workspace/\"+s.ID, nil)\n\tif err != nil {\n\t\treturn nil, nil, err\n\t}\n\n\tw := new(Workspace)\n\tresp, err := s.client.Do(req, w)\n\tif err != nil {\n\t\treturn nil, resp, err\n\t}\n\n\tif w.ID != s.ID {\n\t\treturn nil, nil, fmt.Errorf(\"we got response for %v a different workspace\", w)\n\t}\n\n\treturn w, resp, err\n}", "title": "" }, { "docid": "d45f1be94db0c3dd3bcd77e5e17ecbb3", "score": "0.49791968", "text": "func (a *CloudApiService) GetCloudTfcWorkspaceByMoid(ctx _context.Context, moid string) ApiGetCloudTfcWorkspaceByMoidRequest {\n\treturn ApiGetCloudTfcWorkspaceByMoidRequest{\n\t\tApiService: a,\n\t\tctx: ctx,\n\t\tmoid: moid,\n\t}\n}", "title": "" }, { "docid": "6013cb5ee1e6adbb5e3a1f2f6a22df65", "score": "0.49357086", "text": "func getDispatcherClient() (protos.SyncRPCServiceClient, error) {\n\tconn, err := platformregistry.GetConnection(ServiceName)\n\tif err != nil {\n\t\tinitErr := errors.NewInitError(err, ServiceName)\n\t\tglog.Error(initErr)\n\t\treturn nil, initErr\n\t}\n\treturn protos.NewSyncRPCServiceClient(conn), nil\n}", "title": "" }, { "docid": "14949e62a68a9cf6fa78ea419463f329", "score": "0.4919262", "text": "func FindWorkspace(ctx context.Context, exec boil.ContextExecutor, iD int, selectCols ...string) (*Workspace, error) {\n\tworkspaceObj := &Workspace{}\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 `workspaces` where `id`=?\", sel,\n\t)\n\n\tq := queries.Raw(query, iD)\n\n\terr := q.Bind(ctx, exec, workspaceObj)\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 workspaces\")\n\t}\n\n\treturn workspaceObj, nil\n}", "title": "" }, { "docid": "1b6b497a8c1e23e74f03702c54d8686f", "score": "0.4917352", "text": "func (b *PipelineBuilder) Workspace(name string, optional bool) {\n\n\tb.Pipeline.Spec.Workspaces = append(b.Pipeline.Spec.Workspaces, v1beta1.WorkspacePipelineDeclaration{\n\t\tName: name,\n\t\tOptional: optional,\n\t})\n}", "title": "" }, { "docid": "c3fccde6faadda4c054609bb77f93a8b", "score": "0.4904434", "text": "func (h *HatcherySwarm) Client() cdsclient.Interface {\n\treturn h.client\n}", "title": "" }, { "docid": "7dd8b1f78a9719d0f429dd1c94a4787f", "score": "0.4903182", "text": "func (q workspaceQuery) One(ctx context.Context, exec boil.ContextExecutor) (*Workspace, error) {\n\to := &Workspace{}\n\n\tqueries.SetLimit(q.Query, 1)\n\n\terr := q.Bind(ctx, exec, o)\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: failed to execute a one query for workspaces\")\n\t}\n\n\tif err := o.doAfterSelectHooks(ctx, exec); err != nil {\n\t\treturn o, err\n\t}\n\n\treturn o, nil\n}", "title": "" }, { "docid": "3de2628b0e3d41fc334075c79ce4d0e9", "score": "0.48938566", "text": "func NewWorkspaceAPI(baseURL, token string) model.WorkspaceAPI {\n\treturn &WorkspaceAPI{\n\t\trestClient: &togglRESTAPIClient{\n\t\t\tbaseURL: baseURL,\n\t\t\ttoken: token,\n\t\t},\n\t}\n}", "title": "" }, { "docid": "86741c9278f081d4ca097d3a32825bfa", "score": "0.48795635", "text": "func NewWorkspace(ctx *pulumi.Context,\n\tname string, args *WorkspaceArgs, opts ...pulumi.ResourceOption) (*Workspace, error) {\n\tif args == nil {\n\t\treturn nil, errors.New(\"missing one or more required arguments\")\n\t}\n\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:operationalinsights/v20151101preview:Workspace\"),\n\t\t},\n\t\t{\n\t\t\tType: pulumi.String(\"azure-native:operationalinsights:Workspace\"),\n\t\t},\n\t\t{\n\t\t\tType: pulumi.String(\"azure-nextgen:operationalinsights:Workspace\"),\n\t\t},\n\t\t{\n\t\t\tType: pulumi.String(\"azure-native:operationalinsights/v20200301preview:Workspace\"),\n\t\t},\n\t\t{\n\t\t\tType: pulumi.String(\"azure-nextgen:operationalinsights/v20200301preview:Workspace\"),\n\t\t},\n\t\t{\n\t\t\tType: pulumi.String(\"azure-native:operationalinsights/v20200801:Workspace\"),\n\t\t},\n\t\t{\n\t\t\tType: pulumi.String(\"azure-nextgen:operationalinsights/v20200801:Workspace\"),\n\t\t},\n\t\t{\n\t\t\tType: pulumi.String(\"azure-native:operationalinsights/v20201001:Workspace\"),\n\t\t},\n\t\t{\n\t\t\tType: pulumi.String(\"azure-nextgen:operationalinsights/v20201001:Workspace\"),\n\t\t},\n\t\t{\n\t\t\tType: pulumi.String(\"azure-native:operationalinsights/v20210601:Workspace\"),\n\t\t},\n\t\t{\n\t\t\tType: pulumi.String(\"azure-nextgen:operationalinsights/v20210601:Workspace\"),\n\t\t},\n\t})\n\topts = append(opts, aliases)\n\tvar resource Workspace\n\terr := ctx.RegisterResource(\"azure-native:operationalinsights/v20151101preview:Workspace\", name, args, &resource, opts...)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn &resource, nil\n}", "title": "" }, { "docid": "9f8df6090bdba6a8344822bfb854435f", "score": "0.48773205", "text": "func getWorkspaces() ([]Workspace, error) {\n\tcmd := exec.Command(\"i3-msg\", \"-t\", \"get_workspaces\")\n\tresult, err := cmd.Output()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tvar rawJson interface{}\n\terr = json.Unmarshal(result, &rawJson)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tjsonList, ok := rawJson.([]interface{})\n\tif !ok {\n\t\treturn nil, fmt.Errorf(\"get_workspaces result is not a list\")\n\t}\n\n\tvar workspaces []Workspace\n\tfor _, rawW := range jsonList {\n\t\tw, ok := rawW.(map[string]interface{})\n\t\tif !ok {\n\t\t\treturn nil, fmt.Errorf(\"get_workspaces result is not a list of maps\")\n\t\t}\n\n\t\trawNum, ok := w[\"num\"]\n\t\tif !ok {\n\t\t\treturn nil, fmt.Errorf(\"get_workspaces did not return num\")\n\t\t}\n\t\tnum, ok := rawNum.(float64)\n\t\tif !ok {\n\t\t\treturn nil, fmt.Errorf(\"get_workspaces num is not a number\")\n\t\t}\n\n\t\trawName, ok := w[\"name\"]\n\t\tif !ok {\n\t\t\treturn nil, fmt.Errorf(\"get_workspaces did not return name\")\n\t\t}\n\t\tname, ok := rawName.(string)\n\t\tif !ok {\n\t\t\treturn nil, fmt.Errorf(\"get_workspaces name is not a string\")\n\t\t}\n\n\t\trawFocused, ok := w[\"focused\"]\n\t\tif !ok {\n\t\t\treturn nil, fmt.Errorf(\"get_workspace did not return focused\")\n\t\t}\n\t\tfocused, ok := rawFocused.(bool)\n\t\tif !ok {\n\t\t\treturn nil, fmt.Errorf(\"get_workspace focused is not a bool\")\n\t\t}\n\n\t\trawOutput, ok := w[\"output\"]\n\t\tif !ok {\n\t\t\treturn nil, fmt.Errorf(\"get_workspace did not return output\")\n\t\t}\n\t\toutput, ok := rawOutput.(string)\n\t\tif !ok {\n\t\t\treturn nil, fmt.Errorf(\"get_workspace output is not a string\")\n\t\t}\n\n\t\trawRect, ok := w[\"rect\"]\n\t\tif !ok {\n\t\t\treturn nil, fmt.Errorf(\"get_workspace did not return rect\")\n\t\t}\n\t\trect, ok := rawRect.(map[string]interface{})\n\t\tif !ok {\n\t\t\treturn nil, fmt.Errorf(\"get_workspace rect is not a map\")\n\t\t}\n\n\t\trawX, ok := rect[\"x\"]\n\t\tif !ok {\n\t\t\treturn nil, fmt.Errorf(\"get_workspace did not return rect.x\")\n\t\t}\n\t\tx, ok := rawX.(float64)\n\t\tif !ok {\n\t\t\treturn nil, fmt.Errorf(\"get_workspace rect.x is not a number\")\n\t\t}\n\n\t\trawY, ok := rect[\"y\"]\n\t\tif !ok {\n\t\t\treturn nil, fmt.Errorf(\"get_workspace did not return rect.y\")\n\t\t}\n\t\ty, ok := rawY.(float64)\n\t\tif !ok {\n\t\t\treturn nil, fmt.Errorf(\"get_workspace rect.y is not a number\")\n\t\t}\n\n\t\tworkspaces = append(workspaces, Workspace{\n\t\t\tint(num),\n\t\t\tname,\n\t\t\tfocused,\n\t\t\toutput,\n\t\t\tint(x),\n\t\t\tint(y),\n\t\t})\n\t}\n\n\t// Sort by ascending workspace number.\n\tsort.Slice(workspaces, func(i, j int) bool {\n\t\treturn workspaces[i].Num < workspaces[j].Num\n\t})\n\n\treturn workspaces, nil\n}", "title": "" }, { "docid": "30c05efa93c8580dc7ef821c94860514", "score": "0.48649514", "text": "func (_e *MockFactory_Expecter) GetWorkspaceID() *MockFactory_GetWorkspaceID_Call {\n\treturn &MockFactory_GetWorkspaceID_Call{Call: _e.mock.On(\"GetWorkspaceID\")}\n}", "title": "" }, { "docid": "b4cc3d6c3db139610a5003f1817e95a0", "score": "0.48487782", "text": "func GetClientByName(\n\tc api.Client,\n\tworkspace string,\n\tclient string,\n) (string, error) {\n\treturn findByName(\n\t\tclient,\n\t\t\"client\", func() ([]named, error) {\n\n\t\t\tcs, err := c.GetClients(api.GetClientsParam{\n\t\t\t\tWorkspace: workspace,\n\t\t\t\tPaginationParam: api.AllPages(),\n\t\t\t})\n\t\t\tif err != nil {\n\t\t\t\treturn []named{}, err\n\t\t\t}\n\n\t\t\tns := make([]named, len(cs))\n\t\t\tfor i := 0; i < len(ns); i++ {\n\t\t\t\tns[i] = cs[i]\n\t\t\t}\n\t\t\treturn ns, nil\n\t\t},\n\t)\n}", "title": "" }, { "docid": "ed1375cf276871fb13c55920058089e6", "score": "0.4825449", "text": "func (rm ResourceManager) GetClient() *gc.GateapiClient {\n\treturn rm.client\n}", "title": "" }, { "docid": "e4aa82dae04f7c6352be3b6f21eb3fba", "score": "0.47887918", "text": "func (m *manager) GetClient(i *v1.MessagingInfrastructure) InfraClient {\n\tm.lock.Lock()\n\tdefer m.lock.Unlock()\n\tkey := clientKey{Name: i.Name, Namespace: i.Namespace}\n\tclient, exists := m.clients[key]\n\tif !exists {\n\t\tclient = NewInfra(router.NewRouterState, broker.NewBrokerState, &systemClock{})\n\t\tm.clients[key] = client\n\t\tclient.Start()\n\t}\n\treturn client\n}", "title": "" }, { "docid": "d8dc1752038b180caf803011a12760ff", "score": "0.4773743", "text": "func NewWorkspace(ctx *pulumi.Context,\n\tname string, args *WorkspaceArgs, opts ...pulumi.ResourceOption) (*Workspace, error) {\n\tif args == nil {\n\t\treturn nil, errors.New(\"missing one or more required arguments\")\n\t}\n\n\tif args.ResourceGroupName == nil {\n\t\treturn nil, errors.New(\"invalid value for required argument 'ResourceGroupName'\")\n\t}\n\tif args.Sku == nil {\n\t\treturn nil, errors.New(\"invalid value for required argument 'Sku'\")\n\t}\n\topts = internal.PkgResourceDefaultOpts(opts)\n\tvar resource Workspace\n\terr := ctx.RegisterResource(\"azure:databricks/workspace:Workspace\", name, args, &resource, opts...)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn &resource, nil\n}", "title": "" }, { "docid": "bcd0f8c019551dbfab8bf554db497291", "score": "0.4773632", "text": "func NewWorkspace(ctx *pulumi.Context,\n\tname string, args *WorkspaceArgs, opts ...pulumi.ResourceOption) (*Workspace, error) {\n\tif args == nil {\n\t\treturn nil, errors.New(\"missing one or more required arguments\")\n\t}\n\n\tif args.ApplicationInsightsId == nil {\n\t\treturn nil, errors.New(\"invalid value for required argument 'ApplicationInsightsId'\")\n\t}\n\tif args.Identity == nil {\n\t\treturn nil, errors.New(\"invalid value for required argument 'Identity'\")\n\t}\n\tif args.KeyVaultId == nil {\n\t\treturn nil, errors.New(\"invalid value for required argument 'KeyVaultId'\")\n\t}\n\tif args.ResourceGroupName == nil {\n\t\treturn nil, errors.New(\"invalid value for required argument 'ResourceGroupName'\")\n\t}\n\tif args.StorageAccountId == nil {\n\t\treturn nil, errors.New(\"invalid value for required argument 'StorageAccountId'\")\n\t}\n\topts = internal.PkgResourceDefaultOpts(opts)\n\tvar resource Workspace\n\terr := ctx.RegisterResource(\"azure:machinelearning/workspace:Workspace\", name, args, &resource, opts...)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn &resource, nil\n}", "title": "" }, { "docid": "972e11944e5f74d6101c7e422ccb9c60", "score": "0.47733948", "text": "func (svc Service) GetClient() *ent.Client {\n\treturn svc.repo.Client\n}", "title": "" }, { "docid": "ff31abe47626439ca857cf546e0618e1", "score": "0.4769956", "text": "func (o *AirtableImportJobJob) GetWorkspaceId() int32 {\n\tif o == nil {\n\t\tvar ret int32\n\t\treturn ret\n\t}\n\n\treturn o.WorkspaceId\n}", "title": "" }, { "docid": "c68ef86dbfe5d0154bb45390118640a3", "score": "0.47601345", "text": "func GetClient() *goxldeploy.Client {\n\n\tcfg := goxldeploy.Config{\n\t\tUser: username,\n\t\tPassword: password,\n\t\tHost: host,\n\t\tPort: port,\n\t\tContext: context,\n\t\tScheme: scheme,\n\t}\n\n\treturn goxldeploy.New(&cfg)\n\n}", "title": "" }, { "docid": "aff6cf9345a594ee90009e531e48d6c9", "score": "0.47564918", "text": "func Client() (client *docker.Client, err error) {\n\tmu.Lock()\n\tdefer mu.Unlock()\n\tif clientInstance != nil {\n\t\tclient = clientInstance\n\t\treturn\n\t}\n\tclient, err = createClient()\n\tif err != nil {\n\t\treturn\n\t}\n\terr = createSwarmIfNeeded(client)\n\tif err != nil {\n\t\treturn\n\t}\n\terr = createSharedNetworkIfNeeded(client)\n\tif err != nil {\n\t\treturn\n\t}\n\tclientInstance = client\n\treturn\n}", "title": "" }, { "docid": "d0db0b8a9a23ef874fc5f32c51d09f89", "score": "0.47424823", "text": "func (s *Store) Client() lungo.IClient {\n\treturn s.client\n}", "title": "" }, { "docid": "cf058350988918833f73d0f2763aa09a", "score": "0.4728031", "text": "func NewWorkflowClient(logger *zap.Logger, appName string, config Config) (client.Client, error) {\n\tsvc, err := serviceClient(logger, appName, config.Address)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\topts := &client.Options{\n\t\tMetricsScope: tally.NoopScope,\n\t}\n\treturn client.NewClient(svc, config.Domain, opts), nil\n}", "title": "" }, { "docid": "b9780d6927b0650a6c7a3cb84dd4f58a", "score": "0.4715625", "text": "func (s *Service) List(ctx context.Context) (*WorkspaceList, error) {\n\t// List Timeout\n\tctx, cancelFunc := context.WithTimeout(ctx, listTimeout*time.Second)\n\tdefer cancelFunc()\n\n\tresp, err := s.clientWithResponses.ListWorkspacesWithResponse(ctx, &apiv1.ListWorkspacesParams{})\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tif code := resp.StatusCode(); code != 200 {\n\t\treturn nil, getAPIError(\"failed to list the workspaces\", resp.Body)\n\t}\n\tresponse := resp.JSON200\n\n\tif response.Workspaces == nil {\n\t\treturn &WorkspaceList{\n\t\t\tWorkspaces: []WorkspaceSummary{},\n\t\t}, nil\n\t}\n\n\tworkspaces := []WorkspaceSummary{}\n\tfor _, wksp := range *response.Workspaces {\n\t\tworkspace := WorkspaceSummary{\n\t\t\tID: *wksp.Id,\n\t\t\tName: *wksp.Name,\n\t\t\tDescription: *wksp.Description,\n\t\t\tLocation: *wksp.Location,\n\t\t\tOwner: *wksp.CreatedBy,\n\t\t\tState: (string)(*wksp.Status),\n\t\t\tCreated: *wksp.CreatedAt,\n\t\t}\n\t\tworkspaces = append(workspaces, workspace)\n\t}\n\n\treturn &WorkspaceList{\n\t\tWorkspaces: workspaces,\n\t}, nil\n}", "title": "" }, { "docid": "d6572aa2969d91454418b561b72429df", "score": "0.47137916", "text": "func (a *API) GetWorkspaces(repoID int) (*Workspaces, error) {\n\n\tclient := http.DefaultClient\n\tgetWorkspacesURI := fmt.Sprintf(\"%v/p2/repositories/%v/workspaces\", zenhubRoot, repoID)\n\trequest, err := a.createDefaultRequest(http.MethodGet, getWorkspacesURI)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tresponse, err := client.Do(request)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tif response.StatusCode != http.StatusOK {\n\t\treturn nil, fmt.Errorf(\"the get workspaces endpoint returned %v\", response.StatusCode)\n\t}\n\n\tbody, err := ioutil.ReadAll(response.Body)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tworkspaces := new(Workspaces)\n\terr = json.Unmarshal(body, workspaces)\n\n\treturn workspaces, err\n}", "title": "" }, { "docid": "99f9b03f64cf9edf0da33b284b97e66b", "score": "0.46764064", "text": "func GetClient(pathToCfg string) (*kubernetes.Clientset, error) {\n\tvar config *rest.Config\n\tvar err error\n\tif pathToCfg == \"\" {\n\t\tlogrus.Info(\"Using in cluster config; deployed as a pod\")\n\t\tconfig, err = rest.InClusterConfig()\n\t} else {\n\t\tlogrus.Info(\"Using out of cluster config; deployed externally\")\n\t\tconfig, err = clientcmd.BuildConfigFromFlags(\"\", pathToCfg)\n\t}\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn kubernetes.NewForConfig(config)\n}", "title": "" }, { "docid": "675a7edf97355c3103cc78001607bf46", "score": "0.46707413", "text": "func (repository *WorkspaceAPI) GetWorkspaces() ([]model.Workspace, error) {\n\tcontent, err := repository.restClient.Request(http.MethodGet, \"workspaces\", nil)\n\tif err != nil {\n\t\treturn nil, errors.Wrap(err, \"Failed to retrieve workspaces\")\n\t}\n\n\tvar workspaces []model.Workspace\n\tif unmarshalError := json.Unmarshal(content, &workspaces); unmarshalError != nil {\n\t\treturn nil, errors.Wrap(unmarshalError, \"Failed to deserialize the workspaces\")\n\t}\n\n\treturn workspaces, nil\n}", "title": "" }, { "docid": "a207be0ddb83493a5f18c840c7e28ab8", "score": "0.46677", "text": "func GetLogAnalyticsWorkspaceE(workspaceName, resoureGroupName, subscriptionID string) (*operationalinsights.Workspace, error) {\n\tclient, err := GetLogAnalyticsWorkspacesClientE(subscriptionID)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tws, err := client.Get(context.Background(), resoureGroupName, workspaceName)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn &ws, nil\n}", "title": "" }, { "docid": "99419b305859be348ed2c6372c4eee13", "score": "0.46665516", "text": "func (cw *ConfigWrapper) Client() (*VSphereClient, error) {\n\tclient := new(VSphereClient)\n\n\tu, err := cw.vimURL()\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"error generating SOAP endpoint url: %s\", err)\n\t}\n\n\terr = cw.config.EnableDebug()\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"error setting up client debug: %s\", err)\n\t}\n\n\t// Set up the VIM/govmomi client connection, or load a previous session\n\tclient.vimClient, err = cw.config.SavedVimSessionOrNew(u)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\ts := new(cache.Session)\n\ts, err = cw.restURL()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tclient.restClient, err = cw.config.SavedRestSessionOrNew(s)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tlog.Printf(\"[DEBUG] VMWare vSphere Client configured for URL: %s\", cw.config.VSphereServer)\n\n\treturn client, nil\n}", "title": "" }, { "docid": "d5810a9057986b77205961906bd1577e", "score": "0.46467268", "text": "func WorkspaceSelect(path, workspace string) (*string, error) {\n\targs := []string{\"workspace\", \"select\", workspace}\n\toutStr, err := commandHelper(path, args)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn outStr, nil\n}", "title": "" }, { "docid": "eea1cb29c28e888422771d6de435634d", "score": "0.46291766", "text": "func (v *WorkSpaceCommand) WorkSpace() workspace.WorkSpace {\n\tvar err error\n\tif v.ws == nil {\n\t\tv.ws, err = workspace.NewWorkSpace(\"\")\n\t\tif err != nil {\n\t\t\tlog.Fatal(err)\n\t\t}\n\t}\n\tif !v.SingleOK && config.IsSingleMode() {\n\t\tlog.Fatal(\"cannot run in single mode\")\n\t}\n\tif v.ws != nil {\n\t\tif !v.MirrorOK && v.ws.IsMirror() {\n\t\t\tlog.Fatal(\"cannot run in a mirror\")\n\t\t}\n\t}\n\treturn v.ws\n}", "title": "" }, { "docid": "e5389ba78d0ab3750c4826d781350cc6", "score": "0.4622151", "text": "func GetClient(master string) (*kubernetes.Clientset, error) {\n\n\tkubeConfigPath := kubeConfigPath()\n\tconfig, err := clientcmd.BuildConfigFromFlags(master, kubeConfigPath)\n\tif err != nil {\n\t\tlog.Fatal(err.Error())\n\t}\n\n\tclientset, err := kubernetes.NewForConfig(config)\n\tif err != nil {\n\t\tlog.Fatal(err.Error())\n\t}\n\n\t// return the clientset\n\treturn clientset, err\n}", "title": "" }, { "docid": "5be201266eba310b13522a1392b8eb94", "score": "0.46216828", "text": "func (svc *CloudwatchLogs) GetClient() *SDK.Client {\n\treturn svc.client\n}", "title": "" }, { "docid": "e2a9f2daa655017954e279f209b9b591", "score": "0.46188796", "text": "func (service *WorkspaceService) Save(workspace models.Workspace) (models.Workspace, error) {\n\t//err := bs.Validate()\n\t//if err != nil {\n\t//\treturn bs, err\n\t//}\n\terr := service.db.Save(&workspace).Error\n\treturn workspace, err\n}", "title": "" }, { "docid": "affcc3cfed3f9c9446e0ff3380af5821", "score": "0.46170837", "text": "func getService(client *http.Client) *storage.Service {\n\tservice, err := storage.New(client)\n\tif err != nil {\n\t\tlog.Fatalf(\"Unable to create storage service: %v\", err)\n\t}\n\tlog.Info(\"Created storage service\")\n\treturn service\n\n}", "title": "" }, { "docid": "6b130c66aaa41fcc1126eaf8684e4eb7", "score": "0.46132514", "text": "func Workspaces(mods ...qm.QueryMod) workspaceQuery {\n\tmods = append(mods, qm.From(\"`workspaces`\"))\n\treturn workspaceQuery{NewQuery(mods...)}\n}", "title": "" }, { "docid": "a720cebb25795a8526c634fd1ceda16c", "score": "0.45995995", "text": "func getClient() (marathon.Marathon, bool) {\n\tconfig := marathon.NewDefaultConfig()\n\tconfig.URL = marathonURL\n\tclient, err := marathon.NewClient(config)\n\tif err != nil {\n\t\tlog.WithFields(log.Fields{\"handle\": \"/rampage\"}).Error(\"Failed to create Marathon client due to \", err)\n\t\treturn nil, false\n\t}\n\treturn client, true\n}", "title": "" }, { "docid": "d0cb9f05a67d54ce0e3676ecee020a09", "score": "0.45995176", "text": "func getClient() *http.Client {\n\t// get google api creds from file\n\tb, err := ioutil.ReadFile(\"credentials.json\")\n\tif err != nil {\n\t\tlog.Fatalf(\"Unable to read client secret file: %v\", err)\n\t}\n\n\t// If modifying these scopes, delete your previously saved token.json.\n\tconfig, err := google.ConfigFromJSON(b, \"https://www.googleapis.com/auth/spreadsheets.readonly\")\n\tif err != nil {\n\t\tlog.Fatalf(\"Unable to parse client secret file to config: %v\", err)\n\t}\n\n\t// The file token.json stores the user's access and refresh tokens, and is\n\t// created automatically when the authorization flow completes for the first\n\t// time.\n\ttokFile := \"token.json\"\n\ttok, err := tokenFromFile(tokFile)\n\tif err != nil {\n\t\ttok = getTokenFromWeb(config)\n\t\tsaveToken(tokFile, tok)\n\t}\n\treturn config.Client(context.Background(), tok)\n}", "title": "" }, { "docid": "df15e1a6b0d424133bd49c6c862171a4", "score": "0.4599516", "text": "func (s Trunking) GetClient() *client.Client {\n\treturn s.client\n}", "title": "" }, { "docid": "1672a1a17428462c5b3b183940b13831", "score": "0.4596919", "text": "func getCurrentWorkspace(ws []Workspace) (int, error) {\n\tfor i, w := range ws {\n\t\tif w.Focused {\n\t\t\treturn i, nil\n\t\t}\n\t}\n\treturn -1, fmt.Errorf(\"No workspace currently focused\")\n}", "title": "" }, { "docid": "a3a8eb17df35fe0eb79e4873d5a413a5", "score": "0.45822868", "text": "func (r *FeatureGate) getClient() (client.Client, error) {\n\tif cl != nil && !reflect.ValueOf(cl).IsNil() {\n\t\treturn cl, nil\n\t}\n\n\ts, err := getScheme()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tcfg, err := config.GetConfig()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn client.New(cfg, client.Options{Scheme: s})\n}", "title": "" }, { "docid": "4266852aca8783e6eed2cee3cc327753", "score": "0.45705283", "text": "func GetClient(kfg string) (*kubernetes.Clientset, error) {\n\tconfig, err := clientcmd.BuildConfigFromFlags(\"\", kfg)\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\n\treturn kubernetes.NewForConfig(config)\n}", "title": "" }, { "docid": "c7ae5ac29f8d71941754f833c72cf5d3", "score": "0.45695484", "text": "func (r *Reconciler) GetSharedClient() sharedclientset.Interface {\n\treturn r.SharedClientSet\n}", "title": "" }, { "docid": "1876b1193ebbd89074d3ddae6e99e67e", "score": "0.45670697", "text": "func (o WorkspaceOutput) WorkspaceId() pulumi.StringOutput {\n\treturn o.ApplyT(func(v *Workspace) pulumi.StringOutput { return v.WorkspaceId }).(pulumi.StringOutput)\n}", "title": "" }, { "docid": "1876b1193ebbd89074d3ddae6e99e67e", "score": "0.45670697", "text": "func (o WorkspaceOutput) WorkspaceId() pulumi.StringOutput {\n\treturn o.ApplyT(func(v *Workspace) pulumi.StringOutput { return v.WorkspaceId }).(pulumi.StringOutput)\n}", "title": "" }, { "docid": "273359a32f0d8a98763523cd83938e09", "score": "0.4562509", "text": "func NewMockWorkspace(ctrl *gomock.Controller) *MockWorkspace {\n\tmock := &MockWorkspace{ctrl: ctrl}\n\tmock.recorder = &MockWorkspaceMockRecorder{mock}\n\treturn mock\n}", "title": "" }, { "docid": "273359a32f0d8a98763523cd83938e09", "score": "0.4562509", "text": "func NewMockWorkspace(ctrl *gomock.Controller) *MockWorkspace {\n\tmock := &MockWorkspace{ctrl: ctrl}\n\tmock.recorder = &MockWorkspaceMockRecorder{mock}\n\treturn mock\n}", "title": "" }, { "docid": "6b76d5f9ff5fa038102ed799573c4002", "score": "0.45591298", "text": "func (l *LookerSDK) AllWorkspaces(\n options *rtl.ApiSettings) ([]Workspace, error) {\n var result []Workspace\n err := l.session.Do(&result, \"GET\", \"/4.0\", \"/workspaces\", nil, nil, options)\n return result, err\n\n}", "title": "" }, { "docid": "7f919454798b9d2a5bbf5d799a4be847", "score": "0.45555034", "text": "func (workspace *Workspace) GetType() string {\n\treturn \"Microsoft.OperationalInsights/workspaces\"\n}", "title": "" }, { "docid": "c5c41f3d43e7ddbc157ad3a991f141ed", "score": "0.45532724", "text": "func (k *Kubernetes) Client() (clientset *kubernetes.Clientset) {\n\tvar err error\n\tvar config *rest.Config\n\n\tif k.clientset == nil {\n\t\tif k.KubeConfig != \"\" {\n\t\t\t// KUBECONFIG\n\t\t\tconfig, err = buildConfigFromFlags(k.KubeContext, k.KubeConfig)\n\t\t\tif err != nil {\n\t\t\t\tpanic(err.Error())\n\t\t\t}\n\t\t} else {\n\t\t\t// K8S in cluster\n\t\t\tconfig, err = rest.InClusterConfig()\n\t\t\tif err != nil {\n\t\t\t\tpanic(err.Error())\n\t\t\t}\n\t\t}\n\n\t\tk.clientset, err = kubernetes.NewForConfig(config)\n\t\tif err != nil {\n\t\t\tpanic(err.Error())\n\t\t}\n\t}\n\n\treturn k.clientset\n}", "title": "" }, { "docid": "b852bb3cd812682c719d13a6ebe58f15", "score": "0.45492536", "text": "func WorkspaceList(path string) ([]string, error) {\n\targs := []string{\"workspace\", \"list\"}\n\toutStr, err := commandHelper(path, args)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\twsDirty := strings.Split(strings.Replace(*outStr, \"*\", \"\", 1), \"\\n\")\n\tvar workspaces []string\n\tfor _, w := range wsDirty {\n\t\tworkspaces = append(workspaces, strings.TrimSpace(w))\n\t}\n\treturn workspaces, nil\n}", "title": "" }, { "docid": "13b17b21ca61be0437b7f19fc36432e5", "score": "0.45402738", "text": "func (gs *NsGroupService) GetMasterKeyService() (vs *MasterKeyService) {\n\tif gs.masterKeyService == nil {\n\t\tgs.masterKeyService = NewMasterKeyService(gs)\n\t}\n\treturn gs.masterKeyService\n}", "title": "" }, { "docid": "ed02f3ec83bdce0ada08781370368cc0", "score": "0.4539144", "text": "func (s *Service) GetAllWorkspacesForUser(userID string) ([]*model.Workspace, error) {\n\treturn s.stor.GetAllWorkspacesForUser(userID)\n}", "title": "" }, { "docid": "3781babe17c4d8dbc8012e9a602a79b4", "score": "0.45293203", "text": "func GetClient(ctx ClusterContext) (*kubernetes.Clientset, string, error) {\n\tc, err := GetCluster(ctx)\n\tif err != nil {\n\t\treturn nil, \"\", err\n\t}\n\tif c.cs != nil {\n\t\treturn c.cs, c.nameSpace, nil\n\t}\n\n\tif c.remoteCluster {\n\t\tlog.WithField(\"config\", c.kubeConfig).Info(\"Loading kubeConfig from path\")\n\t\tconfig, err := clientcmd.BuildConfigFromFlags(\"\", c.kubeConfig)\n\t\tif err != nil {\n\t\t\treturn nil, \"\", err\n\t\t}\n\t\tclientset, err := kubernetes.NewForConfig(config)\n\t\tif err != nil {\n\t\t\treturn nil, \"\", err\n\t\t}\n\t\tc.cs = clientset\n\t} else if c.inCluster {\n\t\tc.cs, c.nameSpace, err = k8sInClusterClient()\n\t}\n\n\treturn c.cs, c.nameSpace, err\n}", "title": "" }, { "docid": "ba45d007c336a7a870296c593322c7d4", "score": "0.45292526", "text": "func (k *CfgWatcherService) apiClient() (svcsclient.Services, error) {\n\tvar sclient svcsclient.Services\n\tvar err error\n\tvar r resolver.Interface\n\n\tif env.ResolverClient != nil {\n\t\tr = env.ResolverClient.(resolver.Interface)\n\t}\n\tif r != nil {\n\t\tsclient, err = svcsclient.NewGrpcAPIClient(globals.Perseus, k.apiServerAddr, env.Logger, rpckit.WithBalancer(balancer.New(r)))\n\t} else {\n\t\tsclient, err = svcsclient.NewGrpcAPIClient(globals.Perseus, k.apiServerAddr, env.Logger, rpckit.WithRemoteServerName(globals.APIServer))\n\t}\n\tif err != nil {\n\t\tk.logger.Errorf(\"#### RPC client to [%v] creation failed with error: %v\", k.apiServerAddr, err)\n\t\treturn nil, errors.NewInternalError(err)\n\t}\n\treturn sclient, err\n}", "title": "" }, { "docid": "79b48693c38bb82ea1864b95a46b267f", "score": "0.45122668", "text": "func getClient() *console.Clientset {\n\tconfig, err := rest.InClusterConfig()\n\tif err != nil {\n\t\tklog.Fatal(err)\n\t}\n\tclientset, err := console.NewForConfig(config)\n\tif err != nil {\n\t\tklog.Fatal(err)\n\t}\n\treturn clientset\n}", "title": "" }, { "docid": "fa157564d41a725a66fc3c8a7b1077f9", "score": "0.45040858", "text": "func NewMathServiceClient(conn xnet.ISession) IMathServiceClient {\n\treturn &MathServiceClient{conn}\n}", "title": "" }, { "docid": "654e72d876eb96c2f57d03e6c4027027", "score": "0.4496738", "text": "func getTestWorkspace(t *testing.T) (cmakeWorkspace, error) {\n\tprotoData, err := textProtoToProtobuf(workspaceTestTextProto)\n\tif err != nil {\n\t\treturn cmakeWorkspace{}, skerr.Wrap(err)\n\t}\n\n\t// Export to CMake buffer.\n\tfs := mocks.NewFileSystem(t)\n\tfs.On(\"OpenFile\", mock.Anything).Return(new(bytes.Buffer), nil).Once()\n\te := NewCMakeExporter(\"projName\", workspaceTestWorkspaceDir, \"CMakeLists.txt\", fs)\n\tqcmd := mocks.NewQueryCommand(t)\n\tqcmd.On(\"Read\", mock.Anything).Return(protoData, nil)\n\terr = e.Export(qcmd)\n\tif err != nil {\n\t\treturn cmakeWorkspace{}, skerr.Wrap(err)\n\t}\n\n\treturn e.workspace, nil\n}", "title": "" }, { "docid": "0d6559935bc6f4d3a996df0752b88ad6", "score": "0.44963506", "text": "func getClient() (*client.Client, error) {\n\n\tif dockerClient == nil {\n\t\tcli, err := client.NewEnvClient()\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tdockerClient = cli\n\t}\n\n\treturn dockerClient, nil\n}", "title": "" }, { "docid": "0d6559935bc6f4d3a996df0752b88ad6", "score": "0.44963506", "text": "func getClient() (*client.Client, error) {\n\n\tif dockerClient == nil {\n\t\tcli, err := client.NewEnvClient()\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tdockerClient = cli\n\t}\n\n\treturn dockerClient, nil\n}", "title": "" }, { "docid": "fc5b1cd26171ceb8ff78b33be0d2a2e8", "score": "0.4492923", "text": "func (f *factory) New(serviceName string) (general.GeneralClient, error) {\n\tf.m.Lock()\n\tdefer f.m.Unlock()\n\n\t// client exists...\n\tif _, ok := f.clientMap[serviceName]; ok {\n\t\treturn f.clientMap[serviceName], nil\n\t}\n\n\t// configuration for client exists...\n\tif _, ok := f.configuration[serviceName]; ok {\n\t\tf.clientMap[serviceName] = general.NewGeneralClient(\n\t\t\turlclient.New(\n\t\t\t\tf.ctx,\n\t\t\t\tf.wg,\n\t\t\t\tf.registryClient,\n\t\t\t\tserviceName,\n\t\t\t\t\"/\",\n\t\t\t\tinternal.ClientMonitorDefault,\n\t\t\t\tf.configuration[serviceName].Url(),\n\t\t\t),\n\t\t)\n\t\treturn f.clientMap[serviceName], nil\n\t}\n\n\t// look to registry for client...\n\tif f.registryClient == nil {\n\t\treturn nil, fmt.Errorf(\"registryClient not initialized; required to handle unknown service: %s\", serviceName)\n\t}\n\n\t// Service unknown to SMA, so ask the Registry whether `serviceName` is available.\n\tok, err := f.registryClient.IsServiceAvailable(serviceName)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tif !ok {\n\t\treturn nil, fmt.Errorf(\"service %s is not available\", serviceName)\n\t}\n\n\t// Since serviceName is unknown to SMA, ask the Registry for a ServiceEndpoint associated with `serviceName`\n\tep, err := f.registryClient.GetServiceEndpoint(serviceName)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"GetServiceEndpoint for %s got error: %v\", serviceName, err.Error())\n\t}\n\n\tconfigClient := bootstrapConfig.ClientInfo{\n\t\tProtocol: f.serviceProtocol,\n\t\tHost: ep.Host,\n\t\tPort: ep.Port,\n\t}\n\n\tf.clientMap[serviceName] = general.NewGeneralClient(\n\t\turlclient.New(\n\t\t\tf.ctx,\n\t\t\tf.wg,\n\t\t\tf.registryClient,\n\t\t\tserviceName,\n\t\t\t\"/\",\n\t\t\tinternal.ClientMonitorDefault,\n\t\t\tconfigClient.Url(),\n\t\t),\n\t)\n\treturn f.clientMap[serviceName], nil\n}", "title": "" }, { "docid": "fb475628f3e0a29bc3eed09b4ed5725c", "score": "0.44922894", "text": "func client() *kubernetes.Clientset {\n\tconfig, err := rest.InClusterConfig()\n\tif err != nil {\n\t\tklog.Fatal(err)\n\t}\n\tclientset, err := kubernetes.NewForConfig(config)\n\tif err != nil {\n\t\tklog.Fatal(err)\n\t}\n\treturn clientset\n}", "title": "" }, { "docid": "0cd1cebade531449aab4b75c8fbfb604", "score": "0.44902635", "text": "func GetClient() *containers.Client {\n\tif client.CClient == nil {\n\t\tvar err error\n\t\tclient.CClient, err = containers.GetClient()\n\t\tclient.ServerAdress = SystemdClient\n\t\tif err != nil {\n\t\t\tlog.Error(err.Error)\n\t\t}\n\t}\n\treturn &client\n}", "title": "" }, { "docid": "cf8cfff53a8a40462cbd7006f3676040", "score": "0.44837463", "text": "func (*AssistantV1) NewGetWorkspaceOptions(workspaceID string) *GetWorkspaceOptions {\n\treturn &GetWorkspaceOptions{\n\t\tWorkspaceID: core.StringPtr(workspaceID),\n\t}\n}", "title": "" }, { "docid": "99c78d302fe26b8100d3167f0e649a30", "score": "0.44821596", "text": "func NewFirewallClient(cc grpc.ClientConnInterface) FirewallClient { return src.NewFirewallClient(cc) }", "title": "" } ]
3b8537e3c3fd4dec17a14052d97d695d
GetEnclosureResponse translate the enclosure into response.
[ { "docid": "c95672bdf8885680f19de97739be7dbc", "score": "0.7622537", "text": "func (c *BaseImpl) GetEnclosureResponse() *dto.GetEnclosureResponse {\n\tresponse := dto.GetEnclosureResponse{}\n\tif err := response.Load(c.GetEnclosure()); err != nil {\n\t\tlog.WithFields(log.Fields{\n\t\t\t\"id\": c.GetID(),\n\t\t\t\"error\": err,\n\t\t}).Warn(\"Context get response failed, create response failed.\")\n\t\treturn nil\n\t}\n\treturn &response\n}", "title": "" } ]
[ { "docid": "f6b8906bb52f8fa4cc9439550df27a01", "score": "0.5878667", "text": "func (c *BaseImpl) GetEnclosure() *model.Enclosure {\n\treturn c.Enclosure\n}", "title": "" }, { "docid": "0bc67304ce51f02d5ef750331e7d118a", "score": "0.5750281", "text": "func (page ResponseWithContinuationArtifactSourcePage) Response() ResponseWithContinuationArtifactSource {\n\treturn page.rwcas\n}", "title": "" }, { "docid": "a43bc5712f12a5e24df8144431bca669", "score": "0.57315034", "text": "func (crlr ContainerReleaseLeaseResponse) Response() *http.Response {\n\treturn crlr.rawResponse\n}", "title": "" }, { "docid": "4a852001832f4c6dcc6a7b542fe7e4c5", "score": "0.5711995", "text": "func (calr ContainerAcquireLeaseResponse) Response() *http.Response {\n\treturn calr.rawResponse\n}", "title": "" }, { "docid": "62a64c82f5664c393ab15911dd51e2c8", "score": "0.57049954", "text": "func (page ResponseWithContinuationArtifactPage) Response() ResponseWithContinuationArtifact {\n\treturn page.rwca\n}", "title": "" }, { "docid": "87e95783b70ac495d1eae73ad2d504ff", "score": "0.55630744", "text": "func (crlr ContainerRenewLeaseResponse) Response() *http.Response {\n\treturn crlr.rawResponse\n}", "title": "" }, { "docid": "8ccee430a0cf229804d94ed9025a8b8e", "score": "0.555493", "text": "func (brlr BlobReleaseLeaseResponse) Response() *http.Response {\n\treturn brlr.rawResponse\n}", "title": "" }, { "docid": "b4cd31d3a981d304a669a003b6630396", "score": "0.5539974", "text": "func encodeToResponse(_ context.Context, t *transaction.Payment) interface{} {\n\tvar r Response\n\n\tr.Payment = t\n\tr.Type = store.PaymentType\n\n\treturn &r\n}", "title": "" }, { "docid": "3118a5e4029d303042568812eaca6c74", "score": "0.5507918", "text": "func (client OperationsClient) GetBase64EncodedResponder(resp *http.Response) (result Base64Url, err error) { \n err = autorest.Respond(\n resp,\n client.ByInspecting(),\n azure.WithErrorUnlessStatusCode(http.StatusOK),\n autorest.ByUnmarshallingJSON(&result.Value),\n autorest.ByClosing())\n result.Response = autorest.Response{Response: resp}\n return\n}", "title": "" }, { "docid": "b3e0a1acdd16a41ef110a61ef02545d1", "score": "0.5498834", "text": "func (page ResponseWithContinuationSecretPage) Response() ResponseWithContinuationSecret {\n\treturn page.rwcs\n}", "title": "" }, { "docid": "cfb2c5b58637f99534b8f515d791efdb", "score": "0.54634076", "text": "func (brlr BlobRenewLeaseResponse) Response() *http.Response {\n\treturn brlr.rawResponse\n}", "title": "" }, { "docid": "7b997b11e60815ef65ff8d4e244049eb", "score": "0.5462463", "text": "func (balr BlobAcquireLeaseResponse) Response() *http.Response {\n\treturn balr.rawResponse\n}", "title": "" }, { "docid": "013686353c7c9f1c6e65587aa04719ea", "score": "0.54595804", "text": "func (crr ContainerRestoreResponse) Response() *http.Response {\n\treturn crr.rawResponse\n}", "title": "" }, { "docid": "454d344c4fcc8d82c205fce6a678820e", "score": "0.5435964", "text": "func (cblr ContainerBreakLeaseResponse) Response() *http.Response {\n\treturn cblr.rawResponse\n}", "title": "" }, { "docid": "e8b339610955f1aa035c991deb170fc5", "score": "0.54178166", "text": "func (iter ResponseWithContinuationArtifactSourceIterator) Response() ResponseWithContinuationArtifactSource {\n\treturn iter.page.Response()\n}", "title": "" }, { "docid": "815bdf22a733d99f54558b781aed11ad", "score": "0.5416374", "text": "func (bser BlobSetExpiryResponse) Response() *http.Response {\n\treturn bser.rawResponse\n}", "title": "" }, { "docid": "c043f7209ff531fd5030541231ff333a", "score": "0.53963083", "text": "func (cclr ContainerChangeLeaseResponse) Response() *http.Response {\n\treturn cclr.rawResponse\n}", "title": "" }, { "docid": "a31903710048157b1460c05194604e40", "score": "0.53829396", "text": "func (page ResponseWithContinuationServiceRunnerPage) Response() ResponseWithContinuationServiceRunner {\n\treturn page.rwcsr\n}", "title": "" }, { "docid": "a4ea338fe393f2fddb584fead78f8f8c", "score": "0.5366658", "text": "func ResponseEncoder(_ context.Context, r interface{}) (interface{}, error) {\n\treturn r, nil\n}", "title": "" }, { "docid": "0e61e83945cf0532c21787202c5693a2", "score": "0.53576833", "text": "func (csapr ContainerSetAccessPolicyResponse) Response() *http.Response {\n\treturn csapr.rawResponse\n}", "title": "" }, { "docid": "57a93e8642971bfb9a5b59eee291d49d", "score": "0.534375", "text": "func encodeUppercaseResponse(ctx context.Context, w http.ResponseWriter, response interface{}) error {\n\treturn encoding.Default().EncodeResponse()(ctx, w, response)\n}", "title": "" }, { "docid": "b21f1f1f7877ba81987816cb13a36766", "score": "0.5340329", "text": "func (page CommitmentAssociationListResultPage) Response() CommitmentAssociationListResult {\n\treturn page.calr\n}", "title": "" }, { "docid": "3cf5d0997c2e8bcd02d8567a1928fdca", "score": "0.53115684", "text": "func (ccr ContainerCreateResponse) Response() *http.Response {\n\treturn ccr.rawResponse\n}", "title": "" }, { "docid": "21ba39bc8dc361bf77aaee6ca6fa298c", "score": "0.53105456", "text": "func (bclr BlobChangeLeaseResponse) Response() *http.Response {\n\treturn bclr.rawResponse\n}", "title": "" }, { "docid": "98a5fce953d09055c17100f979efed9f", "score": "0.52944136", "text": "func encodeGetResponse(ctx context.Context, w http1.ResponseWriter, response interface{}) (err error) {\n\tif f, ok := response.(endpoint.Failure); ok && f.Failed() != nil {\n\t\tErrorEncoder(ctx, f.Failed(), w)\n\t\treturn nil\n\t}\n\tw.Header().Set(\"Content-Type\", \"application/json; charset=utf-8\")\n\terr = json.NewEncoder(w).Encode(response)\n\treturn\n}", "title": "" }, { "docid": "ea45a3abd468ed55a4cc1931829c9680", "score": "0.5275822", "text": "func (cgpr ContainerGetPropertiesResponse) Response() *http.Response {\n\treturn cgpr.rawResponse\n}", "title": "" }, { "docid": "fec343a300ce49b21d2ea1c237de9a07", "score": "0.5273446", "text": "func (iter ResponseWithContinuationArtifactIterator) Response() ResponseWithContinuationArtifact {\n\treturn iter.page.Response()\n}", "title": "" }, { "docid": "f7d3bdb8596691e7b31bbb49e49b8e4f", "score": "0.52686745", "text": "func (bblr BlobBreakLeaseResponse) Response() *http.Response {\n\treturn bblr.rawResponse\n}", "title": "" }, { "docid": "875d14d5c8e726292d2b6455d1c73862", "score": "0.5251165", "text": "func (si SignedIdentifiers) Response() *http.Response {\n\treturn si.rawResponse\n}", "title": "" }, { "docid": "875d14d5c8e726292d2b6455d1c73862", "score": "0.5251165", "text": "func (si SignedIdentifiers) Response() *http.Response {\n\treturn si.rawResponse\n}", "title": "" }, { "docid": "46d463e359b317fe0db2ce1a8fe2eed7", "score": "0.524823", "text": "func (page ResponseWithContinuationFormulaPage) Response() ResponseWithContinuationFormula {\n\treturn page.rwcf\n}", "title": "" }, { "docid": "ef8bb3e5d43ad0f861e2503401a499d1", "score": "0.5236081", "text": "func (page ResponseWithContinuationPolicyPage) Response() ResponseWithContinuationPolicy {\n\treturn page.rwcp\n}", "title": "" }, { "docid": "a490d41b4cbc9b9faec8099eba4df1eb", "score": "0.5234947", "text": "func (this RequestResponsePairView) GetResponse() interfaces.Response { return this.Response }", "title": "" }, { "docid": "e1c2bcce1b18f36b5cdf2c6a3c96d290", "score": "0.5231716", "text": "func (iter ResponseWithContinuationSecretIterator) Response() ResponseWithContinuationSecret {\n\treturn iter.page.Response()\n}", "title": "" }, { "docid": "22a98b0b3cdd6f297902c190b09271fc", "score": "0.52231866", "text": "func encodeApiResponse(_ context.Context, r interface{}) (interface{}, error) {\n\treturn nil, errors.New(\"'Control API' Encoder is not impelemented\")\n}", "title": "" }, { "docid": "6574015685a1d10540c8ae1c51402b94", "score": "0.5215404", "text": "func encodeGetResponse(_ context.Context, r interface{}) (interface{}, error) {\n\treturn nil, errors.New(\"'Club' Encoder is not impelemented\")\n}", "title": "" }, { "docid": "d59cae771c19d4ccaa0f735505491f22", "score": "0.5210802", "text": "func (page ResponseWithContinuationSchedulePage) Response() ResponseWithContinuationSchedule {\n\treturn page.rwcs\n}", "title": "" }, { "docid": "104eb432e902f4864eb5394d6e3f9c76", "score": "0.51849157", "text": "func (client *EncryptionScopesClient) getHandleResponse(resp *azcore.Response) (EncryptionScopeResponse, error) {\n\tvar val *EncryptionScope\n\tif err := resp.UnmarshalAsJSON(&val); err != nil {\n\t\treturn EncryptionScopeResponse{}, err\n\t}\n\treturn EncryptionScopeResponse{RawResponse: resp.Response, EncryptionScope: val}, nil\n}", "title": "" }, { "docid": "3eaa14285519074b135b0fd4a93c2055", "score": "0.51753086", "text": "func (udk UserDelegationKey) Response() *http.Response {\n\treturn udk.rawResponse\n}", "title": "" }, { "docid": "e7b5aa0c6abc844356cb1283dcc9e70a", "score": "0.51727444", "text": "func (client OperationsClient) GetBase64URLEncodedResponder(resp *http.Response) (result Base64Url, err error) { \n err = autorest.Respond(\n resp,\n client.ByInspecting(),\n azure.WithErrorUnlessStatusCode(http.StatusOK),\n autorest.ByUnmarshallingJSON(&result.Value),\n autorest.ByClosing())\n result.Response = autorest.Response{Response: resp}\n return\n}", "title": "" }, { "docid": "f7da088e313498d8a1e8ede564373a71", "score": "0.5170541", "text": "func (bslhr BlobSetLegalHoldResponse) Response() *http.Response {\n\treturn bslhr.rawResponse\n}", "title": "" }, { "docid": "eacd4d78390eab22ced47702e1fe7652", "score": "0.5163349", "text": "func (page ResponseWithContinuationCustomImagePage) Response() ResponseWithContinuationCustomImage {\n\treturn page.rwcci\n}", "title": "" }, { "docid": "713aa8b883d83bf4a4a27308c78e168c", "score": "0.5161634", "text": "func (bsipr BlobSetImmutabilityPolicyResponse) Response() *http.Response {\n\treturn bsipr.rawResponse\n}", "title": "" }, { "docid": "26c0fa2b9ac8b2e02b9b33e166af3411", "score": "0.51439893", "text": "func encodeGetByProvinceResponse(ctx context.Context, w http.ResponseWriter, response interface{}) (err error) {\n\tif f, ok := response.(endpoint.Failure); ok && f.Failed() != nil {\n\t\tErrorEncoder(ctx, f.Failed(), w)\n\t\treturn nil\n\t}\n\tw.Header().Set(\"Content-Type\", \"application/json; charset=utf-8\")\n\terr = json.NewEncoder(w).Encode(response)\n\treturn\n}", "title": "" }, { "docid": "0b90dab4db3aba73ea988e5243a859c7", "score": "0.51439524", "text": "func (absr AppendBlobSealResponse) Response() *http.Response {\n\treturn absr.rawResponse\n}", "title": "" }, { "docid": "d7a9805a049e3d110c356b128b3a400c", "score": "0.5139695", "text": "func encodeCurriculumResponse(_ context.Context, r interface{}) (interface{}, error) {\n\tresponse := r.(endpoint.CurriculumResponse)\n\tvar info = &pb.CurriculumInfo{\n\t\tId:response.C0.Id,\n\t\tUserId:response.C0.UserId,\n\t\tTitle:response.C0.Title,\n\t\tDesc:response.C0.Desc,\n\t}\n\treturn &pb.CurriculumReply{\n\t\tInfo:info,\n\t},nil\n}", "title": "" }, { "docid": "cfd9880864f66cf6de80df4bb4b1985d", "score": "0.5135991", "text": "func (cgair ContainerGetAccountInfoResponse) Response() *http.Response {\n\treturn cgair.rawResponse\n}", "title": "" }, { "docid": "680cd54c5e6cc6a8e393efd3dba83a9f", "score": "0.5121128", "text": "func (bdipr BlobDeleteImmutabilityPolicyResponse) Response() *http.Response {\n\treturn bdipr.rawResponse\n}", "title": "" }, { "docid": "68b365b6200b2d3006baa8f0c29d9c95", "score": "0.51126003", "text": "func (resource *AddOn) GetResponse() *ResponseMetadata {\n\treturn resource.recurlyResponse\n}", "title": "" }, { "docid": "a34669c73b7f3b98d04cfdaa9705a02d", "score": "0.51067185", "text": "func (resource *Coupon) GetResponse() *ResponseMetadata {\n\treturn resource.recurlyResponse\n}", "title": "" }, { "docid": "6456b54c71b5fc69096a14aaa7671490", "score": "0.5091538", "text": "func (page ResponseWithContinuationDtlEnvironmentPage) Response() ResponseWithContinuationDtlEnvironment {\n\treturn page.rwcde\n}", "title": "" }, { "docid": "fdd7c8ac0f22ed62f4dffbec57ae5f31", "score": "0.50750285", "text": "func (page ResponseWithContinuationLabPage) Response() ResponseWithContinuationLab {\n\treturn page.rwcl\n}", "title": "" }, { "docid": "39ac0fd7a4d90a2ad0c0ec34714b5caf", "score": "0.5067857", "text": "func (bgpr BlobGetPropertiesResponse) Response() *http.Response {\n\treturn bgpr.rawResponse\n}", "title": "" }, { "docid": "72dc901c0527cf22ff0823c7210af94e", "score": "0.5066772", "text": "func (iter ResponseWithContinuationPolicyIterator) Response() ResponseWithContinuationPolicy {\n\treturn iter.page.Response()\n}", "title": "" }, { "docid": "b6de6dbfd9af4cb6dce2300624eefe8e", "score": "0.50654835", "text": "func (page ResponseWithContinuationArmTemplatePage) Response() ResponseWithContinuationArmTemplate {\n\treturn page.rwcat\n}", "title": "" }, { "docid": "76562c7e92a1292c43bbacb46e6b5dbf", "score": "0.5055928", "text": "func (iter ResponseWithContinuationFormulaIterator) Response() ResponseWithContinuationFormula {\n\treturn iter.page.Response()\n}", "title": "" }, { "docid": "c15a45878dabe1f41ce508a176fe6117", "score": "0.5045379", "text": "func (bstr BlobSetTierResponse) Response() *http.Response {\n\treturn bstr.rawResponse\n}", "title": "" }, { "docid": "75005d6aa3e7a0d60ece043206fdb5b6", "score": "0.50299895", "text": "func (page ResponseWithContinuationNotificationChannelPage) Response() ResponseWithContinuationNotificationChannel {\n\treturn page.rwcnc\n}", "title": "" }, { "docid": "f5f8addea3175fc3818f7aad360c7498", "score": "0.5021869", "text": "func (iter ResponseWithContinuationArmTemplateIterator) Response() ResponseWithContinuationArmTemplate {\n\treturn iter.page.Response()\n}", "title": "" }, { "docid": "945db979038ba8781c30fe4ba2342bfe", "score": "0.5018601", "text": "func (iter ResponseWithContinuationLabIterator) Response() ResponseWithContinuationLab {\n\treturn iter.page.Response()\n}", "title": "" }, { "docid": "3b3b443f353292ce8b452a86136d826e", "score": "0.5009071", "text": "func (lcsr ListContainersSegmentResponse) Response() *http.Response {\n\treturn lcsr.rawResponse\n}", "title": "" }, { "docid": "85234b8392afab0f7b7ef22c4ec2b822", "score": "0.5006986", "text": "func (resource *addOnList) GetResponse() *ResponseMetadata {\n\treturn resource.recurlyResponse\n}", "title": "" }, { "docid": "9ddd5337bed79b2e6f7082c5407db12c", "score": "0.49953243", "text": "func (bstr BlobSetTagsResponse) Response() *http.Response {\n\treturn bstr.rawResponse\n}", "title": "" }, { "docid": "4fbcdc168c8ef39b9f394cc2369e5e63", "score": "0.49830604", "text": "func (csmr ContainerSetMetadataResponse) Response() *http.Response {\n\treturn csmr.rawResponse\n}", "title": "" }, { "docid": "7798ccfde598d4c4098d7f93de1d0d76", "score": "0.4976826", "text": "func (ssapr ShareSetAccessPolicyResponse) Response() *http.Response {\n\treturn ssapr.rawResponse\n}", "title": "" }, { "docid": "30394c66cc4d111ae77394c5bd53094f", "score": "0.49698818", "text": "func (iter CommitmentAssociationListResultIterator) Response() CommitmentAssociationListResult {\n\treturn iter.page.Response()\n}", "title": "" }, { "docid": "a4144a1f83c3a6551d0ea406d51ea199", "score": "0.49609444", "text": "func (rw *ResponseWriterV2) GetResponse() (events.APIGatewayV2HTTPResponse, error) {\n\trw.resp.Body = rw.body.String()\n\trw.resp.Headers = make(map[string]string, len(rw.header))\n\tfor key, values := range rw.header {\n\t\tif strings.ToLower(key) == \"set-cookie\" {\n\t\t\tfor i, v := range values {\n\t\t\t\trw.resp.Headers[setCookieCasing(i)] = v\n\t\t\t}\n\t\t} else {\n\t\t\trw.resp.Headers[key] = strings.Join(values, \",\")\n\t\t}\n\t}\n\treturn rw.resp, nil\n}", "title": "" }, { "docid": "4cf8e4b357e1803010ebe9175e3a3947", "score": "0.49518424", "text": "func (page ResponseWithContinuationVirtualNetworkPage) Response() ResponseWithContinuationVirtualNetwork {\n\treturn page.rwcvn\n}", "title": "" }, { "docid": "6feebcc6b9ed3ffef403d18520190167", "score": "0.49503657", "text": "func (cdr ContainerDeleteResponse) Response() *http.Response {\n\treturn cdr.rawResponse\n}", "title": "" }, { "docid": "54cbd549cbb70a49ce09c112f72a8ecc", "score": "0.49482122", "text": "func (bacfur BlobAbortCopyFromURLResponse) Response() *http.Response {\n\treturn bacfur.rawResponse\n}", "title": "" }, { "docid": "716a4df054ae4fd08046efe76be529ad", "score": "0.49473318", "text": "func EncodeSignInResponse(encoder func(context.Context, http.ResponseWriter) goahttp.Encoder) func(context.Context, http.ResponseWriter, interface{}) error {\n\treturn func(ctx context.Context, w http.ResponseWriter, v interface{}) error {\n\t\tres := v.(*userquery.JWTToken)\n\t\tenc := encoder(ctx, w)\n\t\tbody := NewSignInResponseBody(res)\n\t\tw.WriteHeader(http.StatusOK)\n\t\treturn enc.Encode(body)\n\t}\n}", "title": "" }, { "docid": "089307274fddeee9a891e7f283e5147d", "score": "0.49453646", "text": "func (iter ResponseWithContinuationCustomImageIterator) Response() ResponseWithContinuationCustomImage {\n\treturn iter.page.Response()\n}", "title": "" }, { "docid": "4b93d46475209a57a85382c37c6bcb45", "score": "0.49446982", "text": "func (page OutboundEnvironmentEndpointCollectionPage) Response() OutboundEnvironmentEndpointCollection {\n\treturn page.oeec\n}", "title": "" }, { "docid": "973e53de9ed803e3188e2a469572f2c5", "score": "0.4943028", "text": "func encodeResponse(ctx context.Context, w http.ResponseWriter, response interface{}) error {\n\tif e, ok := response.(booking.Errorer); ok && e.Error() != nil {\n\t\t// Not a Go kit transport error, but a business-logic error.\n\t\t// Provide those as HTTP errors.\n\t\tencodeError(ctx, e.Error(), w)\n\t\treturn nil\n\t}\n\tw.Header().Set(\"Content-Type\", \"application/json; charset=utf-8\")\n\treturn json.NewEncoder(w).Encode(response)\n}", "title": "" }, { "docid": "1f8644bf914d780f4a79cc7318bb0229", "score": "0.49410322", "text": "func (bur BlobUndeleteResponse) Response() *http.Response {\n\treturn bur.rawResponse\n}", "title": "" }, { "docid": "fda4fb314fe1c87a71bbf0e540c985d4", "score": "0.49386758", "text": "func (bgair BlobGetAccountInfoResponse) Response() *http.Response {\n\treturn bgair.rawResponse\n}", "title": "" }, { "docid": "4bb59667bec80e6ab3b4be9b173d7feb", "score": "0.49373502", "text": "func (f *FinanceReportResponse) ToEncoding(e encoding.Encoding) ([]byte, error) {\n\treturn f.raw, nil\n}", "title": "" }, { "docid": "c7fd987b3bd3859592ad9055da5fbc9b", "score": "0.4934639", "text": "func (scr ShareCreateResponse) Response() *http.Response {\n\treturn scr.rawResponse\n}", "title": "" }, { "docid": "ee30cca7395956870167df8a259a8576", "score": "0.4930066", "text": "func (sgpr ShareGetPropertiesResponse) Response() *http.Response {\n\treturn sgpr.rawResponse\n}", "title": "" }, { "docid": "6a0b77e5d41f97e5da775ea01114673b", "score": "0.49264735", "text": "func (bshhr BlobSetHTTPHeadersResponse) Response() *http.Response {\n\treturn bshhr.rawResponse\n}", "title": "" }, { "docid": "834e46d737415aba7d58183a63f1f971", "score": "0.48999095", "text": "func encodeResponse(ctx context.Context, w http.ResponseWriter, response interface{}) error {\n\tfmt.Println(\"encoding tag response.\")\n\t// Set JSON type\n\tw.Header().Set(\"Content-Type\", \"application/json; charset=utf-8\")\n\n\t// Check error\n\tif e, ok := response.(errorer); ok {\n\t\t// This is a errorer class, now check for error\n\t\tif err := e.error(); err != nil {\n\t\t\tencodeError(ctx, e.error(), w)\n\t\t\treturn nil\n\t\t}\n\t}\n\n\t// cast to dataHolder to get Data, otherwise just encode the resposne\n\tif holder, ok := response.(dataHolder); ok {\n\t\treturn json.NewEncoder(w).Encode(holder.getData())\n\t} else {\n\t\treturn json.NewEncoder(w).Encode(response)\n\t}\n}", "title": "" }, { "docid": "cef6a6354641f57c6d0e682290758361", "score": "0.4895608", "text": "func (page ProviderOperationResultPage) Response() ProviderOperationResult {\n\treturn page.por\n}", "title": "" }, { "docid": "e6403ce19ff38744c26a81c8d43381f6", "score": "0.48939008", "text": "func encodeGetByNameResponse(_ context.Context, r interface{}) (interface{}, error) {\n\treturn nil, errors.New(\"'Category' Encoder is not impelemented\")\n}", "title": "" }, { "docid": "3d4837a16cbeeb866ead16067172b5f1", "score": "0.4893196", "text": "func (page ResponseWithContinuationGalleryImagePage) Response() ResponseWithContinuationGalleryImage {\n\treturn page.rwcgi\n}", "title": "" }, { "docid": "c0056f2b1b20541c1e980e75dd3ce789", "score": "0.48919767", "text": "func (resource *PlanHostedPages) GetResponse() *ResponseMetadata {\n\treturn resource.recurlyResponse\n}", "title": "" }, { "docid": "146a77e5c238e7b7e9ade79e63b9694b", "score": "0.4891892", "text": "func (iter ResponseWithContinuationServiceRunnerIterator) Response() ResponseWithContinuationServiceRunner {\n\treturn iter.page.Response()\n}", "title": "" }, { "docid": "ed13c548edd8505850122dae6fde1546", "score": "0.48915377", "text": "func (ctx *context) Response() ResponseWriter {\n\treturn ctx.res\n}", "title": "" }, { "docid": "b26ec0caedfa9b779eacea8741a3814f", "score": "0.4890772", "text": "func (iter ResponseWithContinuationLabVhdIterator) Response() ResponseWithContinuationLabVhd {\n\treturn iter.page.Response()\n}", "title": "" }, { "docid": "1fe85470e8cbc978049f8886f1ee5087", "score": "0.48906088", "text": "func (resource *couponList) GetResponse() *ResponseMetadata {\n\treturn resource.recurlyResponse\n}", "title": "" }, { "docid": "9f560dc1b37106177dbacd5ec3a0c347", "score": "0.4887079", "text": "func (page ResponseWithContinuationUserPage) Response() ResponseWithContinuationUser {\n\treturn page.rwcu\n}", "title": "" }, { "docid": "c0e9d7d5da9f4f35da3c3f994ccf1f35", "score": "0.48739585", "text": "func (rw *ResponseWriter) GetResponse() (events.APIGatewayProxyResponse, error) {\n\trw.resp.Body = rw.body.String()\n\trw.resp.Headers = make(map[string]string, len(rw.header))\n\tfor key, values := range rw.header {\n\t\tif strings.ToLower(key) == \"set-cookie\" {\n\t\t\tfor i, v := range values {\n\t\t\t\trw.resp.Headers[setCookieCasing(i)] = v\n\t\t\t}\n\t\t} else {\n\t\t\trw.resp.Headers[key] = strings.Join(values, \",\")\n\t\t}\n\t}\n\treturn rw.resp, nil\n}", "title": "" }, { "docid": "06034ad411b42dc961d9a129083bbf7f", "score": "0.48737076", "text": "func (crr ContainerRenameResponse) Response() *http.Response {\n\treturn crr.rawResponse\n}", "title": "" }, { "docid": "da0bcf15ad67627f98d07da023c1dbf7", "score": "0.48718607", "text": "func (resource *planHostedPagesList) GetResponse() *ResponseMetadata {\n\treturn resource.recurlyResponse\n}", "title": "" }, { "docid": "e83a8a7b2623b3db9e445abf39e511b7", "score": "0.48702073", "text": "func encodeGetCommentResponse(ctx context.Context, w http1.ResponseWriter, response interface{}) (err error) {\n\tw.Header().Set(\"Content-Type\", \"application/json; charset=utf-8\")\n\terr = json.NewEncoder(w).Encode(response)\n\treturn\n}", "title": "" }, { "docid": "5f98ba50319f53e852cc55fa37d5fc70", "score": "0.48699516", "text": "func (iter ResponseWithContinuationScheduleIterator) Response() ResponseWithContinuationSchedule {\n\treturn iter.page.Response()\n}", "title": "" }, { "docid": "2fb5fe0d36c75534e601c7431d2b5c06", "score": "0.48691648", "text": "func (iter ResponseWithContinuationDtlEnvironmentIterator) Response() ResponseWithContinuationDtlEnvironment {\n\treturn iter.page.Response()\n}", "title": "" }, { "docid": "c4f49e4e1252e2e09ec8d4b44f19a064", "score": "0.4868955", "text": "func (abcr AppendBlobCreateResponse) Response() *http.Response {\n\treturn abcr.rawResponse\n}", "title": "" }, { "docid": "ec549bf420b45422e72b60a6a0bbc32c", "score": "0.48679662", "text": "func (iter ResponseWithContinuationLabVirtualMachineIterator) Response() ResponseWithContinuationLabVirtualMachine {\n\treturn iter.page.Response()\n}", "title": "" }, { "docid": "e9708428d3e08e1243c56a3c4291d631", "score": "0.48667058", "text": "func (page InvoicesListResultPage) Response() InvoicesListResult {\n\treturn page.ilr\n}", "title": "" }, { "docid": "76adc78be107967bc5001bed4fe65656", "score": "0.4865022", "text": "func (bsmr BlobSetMetadataResponse) Response() *http.Response {\n\treturn bsmr.rawResponse\n}", "title": "" } ]
02acdf00dc0e6876093c00fbd55c4bea
GetReview to get review detail information. Example:
[ { "docid": "c8f4feba74bff8197e8cfadf620790fd", "score": "0.76123667", "text": "func (m *Malscraper) GetReview(id int) (*model.Review, int, error) {\n\treturn m.api.GetReview(id)\n}", "title": "" } ]
[ { "docid": "8d19093950050265a33f8960830346f5", "score": "0.78959423", "text": "func GetReview(ctx *Context, id int) (*Review, error) {\n\tendpoint := fmt.Sprintf(\"api/v9/reviews/%d\", id)\n\t// The response wraps the review in a JSON object with a \"review\" key.\n\tmsg := struct {\n\t\tReview *Review\n\t}{}\n\tif err := ctx.doSwarmRequest(\"GET\", endpoint, nil, &msg); err != nil {\n\t\treturn nil, err\n\t}\n\treturn msg.Review, nil\n}", "title": "" }, { "docid": "87f50a620516e13d2762f30a6775a682", "score": "0.76899946", "text": "func GetReview(w http.ResponseWriter, r *http.Request) {\r\n\tw.Header().Set(\"Content-Type\", \"application/json\")\r\n\r\n\t// var reviews []Review\r\n\tvar review Review\r\n\tparams := mux.Vars(r)\r\n\r\n\tfmt.Println(\"this is db in getReview\", db)\r\n\tdb.Where(\"snack_id = ? AND id = ?\", params[\"id\"], params[\"revId\"]).First(&review)\r\n\r\n\tif review.ID <= 0 {\r\n\t\tfmt.Println(\"Error thrown in GetReview by checking ID = 0\")\r\n\t\thttp.Error(w, \"Review is not found for this snack\", 404)\r\n\t\treturn\r\n\t}\r\n\r\n\tjson.NewEncoder(w).Encode(&review)\r\n}", "title": "" }, { "docid": "c8bb59b8f21efce674aa640425c61377", "score": "0.7669511", "text": "func GetReview(w http.ResponseWriter, r *http.Request) {\n\tvars := mux.Vars(r)\n\tplaceID, ok := vars[\"id\"]\n\tif !ok {\n\t\tsupport.ReturnString(w, 400, \"Place ID required\")\n\t}\n\n\treviews := &models.Reviews{}\n\tif err := models.DB.Where(\"place_id = ?\", placeID).Find(&reviews).Error; err != nil {\n\t\tsupport.LogError(err, \"GetReview (%v)\", placeID)\n\t\treturn\n\t}\n\n\tsupport.ReturnPrettyJSON(w, 200, reviews)\n}", "title": "" }, { "docid": "c91b71bc76e9658b100f16e784a83dd2", "score": "0.71302056", "text": "func (c *ReviewClient) Get(ctx context.Context, id int) (*Review, error) {\n\treturn c.Query().Where(review.ID(id)).Only(ctx)\n}", "title": "" }, { "docid": "577a6e5cac760cbe78ceb602d054071d", "score": "0.7040115", "text": "func (p *Protocol) GetReview(reviewID uint64) (*protocol.Review, error) {\n\tdb := p.Store.GetDB()\n\n\tgetQuery := fmt.Sprintf(\"SELECT * FROM %s WHERE review_ID=?\", protocol.ReviewTableName)\n\tstmt, err := db.Prepare(getQuery)\n\tif err != nil {\n\t\treturn nil, errors.Wrap(err, \"failed to prepare get query\")\n\t}\n\n\trows, err := stmt.Query(reviewID)\n\tif err != nil {\n\t\treturn nil, errors.Wrap(err, \"failed to execute get query\")\n\t}\n\n\tvar review protocol.Review\n\tparsedRows, err := s.ParseSQLRows(rows, &review)\n\tif err != nil {\n\t\treturn nil, errors.Wrap(err, \"failed to parse results\")\n\t}\n\n\tif len(parsedRows) == 0 {\n\t\treturn nil, protocol.ErrNotExist\n\t}\n\n\tif len(parsedRows) > 1 {\n\t\treturn nil, errors.New(\"only one row is expected\")\n\t}\n\n\tr := parsedRows[0].(*protocol.Review)\n\treturn r, nil\n}", "title": "" }, { "docid": "fb9924cdc1f0d113fbfaafa3a0f061f2", "score": "0.7002896", "text": "func GetReview(stub shim.ChaincodeStubInterface, reviewId string) (Review, error) {\n\tvar featureRelationAgent Review\n\tfeatureRelationAgentAsBytes, err := stub.GetState(reviewId) // getState retreives a key/value from the ledger\n\tif err != nil { // this seems to always succeed, even if key didn't exist\n\t\tnewError := errors.New(\"Error in finding feature relation with agent: \" + err.Error())\n\t\treviewLog.Error(newError)\n\t\treturn featureRelationAgent, newError\n\t}\n\n\tjson.Unmarshal(featureRelationAgentAsBytes, &featureRelationAgent) // un stringify it aka JSON.parse()\n\n\t// TODO: Inserire controllo di tipo (Verificare sia di tipo Review?)\n\n\treturn featureRelationAgent, nil\n}", "title": "" }, { "docid": "99da3e2b8863315439ed97f7286da134", "score": "0.6607708", "text": "func (r *ReviewStorage) GetReview(ctx context.Context, reviewID int64) (bookly.Review, error) {\n\tconst queryCheck = `\n SELECT *\n\tFROM reviews\n\tWHERE id = $1\n`\n\n\trow := r.connPool.QueryRow(ctx, queryCheck,\n\t\treviewID,\n\t)\n\treview := bookly.Review{}\n\terr := row.Scan(&review.ID, &review.UserID, &review.OfferID, &review.Content, &review.Rating, &review.ReviewDate)\n\tif err != nil {\n\t\tif err == pgx.ErrNoRows {\n\t\t\treturn bookly.Review{}, bookly.ErrReviewNotFound\n\t\t}\n\t\treturn bookly.Review{}, fmt.Errorf(\"postgres: could not get review: %w\", err)\n\t}\n\n\treturn review, nil\n}", "title": "" }, { "docid": "9852ce81e4f5ba017bdc6d0206af1074", "score": "0.65416", "text": "func (c *Client) ShowReview(ctx context.Context, path string) (*http.Response, error) {\n\tvar body io.Reader\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\treq, err := http.NewRequest(\"GET\", u.String(), body)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\theader := req.Header\n\theader.Set(\"Content-Type\", \"application/json\")\n\treturn c.Client.Do(ctx, req)\n}", "title": "" }, { "docid": "b045f35b9977e99c4639ce9136dfef39", "score": "0.6441441", "text": "func (p *parser) GetReviews(a *goquery.Selection) []model.Review {\n\tv := review{area: a, cleanImg: p.cleanImg}\n\tv.setDetail()\n\treturn v.data\n}", "title": "" }, { "docid": "4adcb6e6f7a8c142b582a704ab8be074", "score": "0.6439823", "text": "func GetReviews(w http.ResponseWriter, r *http.Request) {\r\n\tw.Header().Set(\"Content-Type\", \"application/json\")\r\n\r\n\tvar reviews []Review\r\n\tparams := mux.Vars(r)\r\n\r\n\tdb.Find(&reviews, \"snack_id = ?\", params[\"id\"])\r\n\tif len(reviews) <= 0 {\r\n\t\thttp.Error(w, \"Review not found for this snack\", 404)\r\n\t\treturn\r\n\t}\r\n\r\n\tjson.NewEncoder(w).Encode(&reviews)\r\n}", "title": "" }, { "docid": "3d578d51794d3972299a5653a9d22bd8", "score": "0.6381652", "text": "func GetReviewById(ReviewID int64) (*Review, *gorm.DB) {\n\tvar getReview Review\n\tdb := db.Where(\"ReviewID = ?\", ReviewID).Find(&getReview)\n\treturn &getReview, db\n\n}", "title": "" }, { "docid": "1411c5eebe17078a374df3d230ca60ef", "score": "0.6301395", "text": "func (m *MockUseCase) GetReview(arg0 uint64) (*models.Review, error) {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"GetReview\", arg0)\n\tret0, _ := ret[0].(*models.Review)\n\tret1, _ := ret[1].(error)\n\treturn ret0, ret1\n}", "title": "" }, { "docid": "aadfd30df835f0192d0d779a7c60dbee", "score": "0.6288534", "text": "func GetReviews(w http.ResponseWriter, r *http.Request) {\n\tvars := mux.Vars(r)\n\tbeerID, _ := strconv.ParseInt(vars[\"beerID\"], 0, 64)\n\n\treviews := storage.DB.FindReviews(int(beerID))\n\n\tutils.RespondWithJSON(w, http.StatusOK, reviews)\n}", "title": "" }, { "docid": "79e95136330ac174465747cacb279dd3", "score": "0.61115074", "text": "func (product *Product) GetReviews() {\n\t// now := time.Now().UTC()\n\tresp, err := soup.Get(product.Link)\n\t// fmt.Println(\"Fetching time: \", time.Since(now))\n\n\t// now = time.Now().UTC()\n\n\tif err != nil {\n\t\tlog.Error(\"Encountered error: {\", err, \"} while fetching reviews for: \", product.Name)\n\t\treturn\n\t}\n\n\tdoc := soup.HTMLParse(resp)\n\n\treviewsContainer := doc.Find(\"div\", \"class\", \"reviews-content\")\n\n\tif reviewsContainer.Error != nil {\n\t\treturn\n\t}\n\n\trawReviews := reviewsContainer.FindAll(\"div\", \"class\", \"review\")\n\treviews := []Review{}\n\n\tfor _, rawReview := range rawReviews {\n\t\treview := Review{}\n\t\terr := review.ParseReviews(rawReview)\n\n\t\tif err == nil {\n\t\t\treviews = append(reviews, review)\n\t\t}\n\t}\n\n\tproduct.Reviews = reviews\n\t// fmt.Println(\"Review parsing time: \", time.Since(now))\n}", "title": "" }, { "docid": "b16f8eccd612f84677fe16fec4ce27d1", "score": "0.59956115", "text": "func getAnimeReview(w http.ResponseWriter, r *http.Request) {\n\tid, _ := strconv.Atoi(chi.URLParam(r, \"id\"))\n\tpage, _ := strconv.Atoi(r.URL.Query().Get(\"page\"))\n\n\tif page == 0 {\n\t\tpage = 1\n\t}\n\n\tparser, err := MalService.GetAnimeReview(id, page)\n\n\tif err != nil {\n\t\tview.RespondWithJSON(w, parser.ResponseCode, err.Error(), nil)\n\t} else {\n\t\tview.RespondWithJSON(w, parser.ResponseCode, parser.ResponseMessage.Error(), parser.Data)\n\t}\n}", "title": "" }, { "docid": "13e964489c76851ace6a99dfc506215c", "score": "0.59027857", "text": "func (m *Malscraper) GetReviews(_type int, page ...int) ([]model.Review, int, error) {\n\tp := 1\n\tif len(page) > 0 {\n\t\tp = page[0]\n\t}\n\treturn m.api.GetReviews(reviewStr[_type], p)\n}", "title": "" }, { "docid": "309abcd68113f030fd0a6ccbfe4446f4", "score": "0.58658886", "text": "func (mr *MockUseCaseMockRecorder) GetReview(arg0 interface{}) *gomock.Call {\n\tmr.mock.ctrl.T.Helper()\n\treturn mr.mock.ctrl.RecordCallWithMethodType(mr.mock, \"GetReview\", reflect.TypeOf((*MockUseCase)(nil).GetReview), arg0)\n}", "title": "" }, { "docid": "c9d15154c4304704a17bfe3033f00904", "score": "0.58406144", "text": "func (rh *ReviewHandler) Fetch(c echo.Context) error {\n\tctx := c.Request().Context()\n\n\treviews, err := rh.reviewUsecase.Fetch(ctx)\n\tif err != nil {\n\t\treturn c.JSONPretty(http.StatusInternalServerError, ResponseError{err.Error()}, Indent)\n\t}\n\n\treturn c.JSONPretty(http.StatusOK, reviews, Indent)\n}", "title": "" }, { "docid": "d41bcfe21211622359ef3b07db7be325", "score": "0.5794093", "text": "func (a *API) Review(pr *model.PullRequest, w http.ResponseWriter) {\n\turl := fmt.Sprintf(`%s/repos/%s/%s/pulls/%d/reviews`, a.Config.Github.APIURL, pr.Repository.Owner.Login, pr.Repository.Name, pr.Number)\n\tcommentPayload := model.ReviewCommentPayload{\n\t\tBody: \"## Release Coordination Checklist \\r\\n\\r\\n- [ ] item 1\\r\\n- [ ] item 2\\r\\n- [ ] item 3\",\n\t\tEvent: \"REQUEST_CHANGES\",\n\t}\n\tstatus, _ := request(\"POST\", url, commentPayload, a.Config.Github.Token)\n\tw.WriteHeader(status)\n}", "title": "" }, { "docid": "8837c3c7987144db1b00a5b544cb8dad", "score": "0.5766711", "text": "func (h *Handler) GetMovieReviews() http.Handler {\n\treturn http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {\n\t\terrorMessage := \"Error reading reviews\"\n\t\tvars := mux.Vars(r)\n\t\tid := vars[\"id\"]\n\n\t\tdata, err := h.service.FindMovieReviews(id)\n\t\tif err != nil {\n\t\t\thttp.Error(w, errorMessage, http.StatusInternalServerError)\n\t\t\treturn\n\t\t}\n\n\t\trespondWithJSON(w, data, http.StatusOK)\n\t})\n}", "title": "" }, { "docid": "41a1a85b70343d0430dde452820130e8", "score": "0.57505274", "text": "func getReviewsHandler(formatter *render.Render) http.HandlerFunc {\n\n\treturn func(w http.ResponseWriter, req *http.Request) {\n\t\tsession, err := mgo.Dial(mongodb_server)\n\t\tif err != nil {\n\t\t\tpanic(err)\n\t\t}\n\n\t\tif err != nil {\n\t\t\tfmt.Println(\"Reviews API - Unable to connect to MongoDB during read operation\")\n\t\t\tpanic(err)\n\t\t}\n\t\tdefer session.Close()\n\t\tsession.SetMode(mgo.Monotonic, true)\n\t\tc := session.DB(mongodb_database).C(mongodb_collection)\n\t\tvar results []Review\n\t\terr = c.Find(bson.M{}).All(&results)\n\t\tif err != nil {\n\t\t\tlog.Fatal(err)\n\t\t}\n\t\tfmt.Println(results)\n\t\tformatter.JSON(w, http.StatusOK, results)\n\t}\n}", "title": "" }, { "docid": "ddd68bc90792476917d946deb1d96959", "score": "0.5723526", "text": "func PatchReview(ctx *Context, review int, patch *ReviewPatch) (*Review, error) {\n\tvar response struct {\n\t\tReview *Review `json:\"review\"`\n\t}\n\tif err := ctx.doSwarmRequest(\"PATCH\", fmt.Sprintf(\"api/v9/reviews/%d\", review), patch, &response); err != nil {\n\t\treturn nil, fmt.Errorf(\"swarm.PatchReview: %w\", err)\n\t}\n\tif response.Review == nil {\n\t\treturn nil, fmt.Errorf(\"swarm.PatchReview invalid response\")\n\t}\n\treturn response.Review, nil\n}", "title": "" }, { "docid": "e404451ace7faee2f4529151c9e13394", "score": "0.5657272", "text": "func GetReviews(ctx *Context, args string) (ReviewCollection, error) {\n\tvar rc ReviewCollection\n\n\tpage, err := getReviewsPage(ctx, 0, args)\n\tif err != nil {\n\t\treturn rc, err\n\t}\n\tfor len(page.Reviews) > 0 {\n\t\trc.Reviews = append(rc.Reviews, page.Reviews...)\n\t\tpage, err = getReviewsPage(ctx, page.LastSeen, args)\n\t\tif err != nil {\n\t\t\treturn rc, err\n\t\t}\n\t}\n\treturn rc, nil\n}", "title": "" }, { "docid": "e33b463454e24f22e3e3cc5425a72b36", "score": "0.5575817", "text": "func (m *ReviewDB) OneReview(ctx context.Context, id int, proposalID int, userID int) (*app.Review, error) {\n\tdefer goa.MeasureSince([]string{\"goa\", \"db\", \"review\", \"onereview\"}, time.Now())\n\n\tvar native Review\n\terr := m.Db.Scopes(ReviewFilterByProposal(proposalID, m.Db), ReviewFilterByUser(userID, m.Db)).Table(m.TableName()).Preload(\"Proposal\").Preload(\"User\").Where(\"id = ?\", id).Find(&native).Error\n\n\tif err != nil && err != gorm.ErrRecordNotFound {\n\t\tgoa.LogError(ctx, \"error getting Review\", \"error\", err.Error())\n\t\treturn nil, err\n\t}\n\n\tview := *native.ReviewToReview()\n\treturn &view, err\n}", "title": "" }, { "docid": "a5826187623735a52c2ea6ce9dd65845", "score": "0.551276", "text": "func (client *DBClient) GetReviewByID(id int64) (review model.ManualReview, err error) {\n\terr = client.Table(\"dice_manual_review\").Where(\"id = ?\", id).First(&review).Error\n\treturn\n}", "title": "" }, { "docid": "8808c418ecf792441a48d28039c371bd", "score": "0.54663545", "text": "func (m *MockReviewUC) Get(arg0 requests.GetReview) (entity.Review, error) {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"Get\", arg0)\n\tret0, _ := ret[0].(entity.Review)\n\tret1, _ := ret[1].(error)\n\treturn ret0, ret1\n}", "title": "" }, { "docid": "95592740dff80d16f2524fb722d35e5b", "score": "0.54108423", "text": "func (m *AccessReviewItemRequestBuilder) Get(ctx context.Context, requestConfiguration *AccessReviewItemRequestBuilderGetRequestConfiguration)(ie233ee762e29b4ba6970aa2a2efce4b7fde11697ca9ea81099d0f8269309c1be.AccessReviewable, error) {\n requestInfo, err := m.ToGetRequestInformation(ctx, requestConfiguration);\n if err != nil {\n return nil, err\n }\n errorMapping := i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.ErrorMappings {\n \"4XX\": i20a3050780ee0b0cde0a884a4f35429a20d60067e3bcda382ec5400079147459.CreateODataErrorFromDiscriminatorValue,\n \"5XX\": i20a3050780ee0b0cde0a884a4f35429a20d60067e3bcda382ec5400079147459.CreateODataErrorFromDiscriminatorValue,\n }\n res, err := m.BaseRequestBuilder.RequestAdapter.Send(ctx, requestInfo, ie233ee762e29b4ba6970aa2a2efce4b7fde11697ca9ea81099d0f8269309c1be.CreateAccessReviewFromDiscriminatorValue, errorMapping)\n if err != nil {\n return nil, err\n }\n if res == nil {\n return nil, nil\n }\n return res.(ie233ee762e29b4ba6970aa2a2efce4b7fde11697ca9ea81099d0f8269309c1be.AccessReviewable), nil\n}", "title": "" }, { "docid": "c10b7e937ce8a259b9e86e2db1967c38", "score": "0.5397102", "text": "func (c *Client) ListReview(ctx context.Context, path string) (*http.Response, error) {\n\tvar body io.Reader\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\treq, err := http.NewRequest(\"GET\", u.String(), body)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\theader := req.Header\n\theader.Set(\"Content-Type\", \"application/json\")\n\treturn c.Client.Do(ctx, req)\n}", "title": "" }, { "docid": "8c3ee703859fd61aaf4113068dea8b8f", "score": "0.53877634", "text": "func (c *Cacher) GetAnimeReview(id int, page int) (data []model.Review, code int, err error) {\n\t// Get from cache.\n\tkey := internal.GetKey(internal.KeyAnimeReview, id, page)\n\tif c.cacher.Get(key, &data) == nil {\n\t\treturn data, http.StatusOK, nil\n\t}\n\n\t// Parse.\n\tdata, code, err = c.api.GetAnimeReview(id, page)\n\tif err != nil {\n\t\treturn nil, code, err\n\t}\n\n\t// Save to cache. Won't return error.\n\t_ = c.cacher.Set(key, data)\n\treturn data, http.StatusOK, nil\n}", "title": "" }, { "docid": "9fc7b04ac8e1eb1321f4b0cbe0aeb43b", "score": "0.5344411", "text": "func getReviewsHandler(formatter *render.Render) http.HandlerFunc {\n\n\treturn func(w http.ResponseWriter, req *http.Request) {\n\t\tparams := mux.Vars(req)\n\t\tvar ItemName string = params[\"itemName\"]\n\t\tfmt.Println( \"Item Name: \", ItemName )\n\n\t\tsession, err := mgo.Dial(mongodb_server)\n\t\tif err != nil {\n\t\t\tpanic(err)\n\t\t}\n\n\t\tif err != nil {\n\t\t\tfmt.Println(\"Reviews API (Get) - Unable to connect to MongoDB during read operation\")\n\t\t\tpanic(err)\n\t\t}\n\t\tdefer session.Close()\n\t\tsession.SetMode(mgo.Monotonic, true)\n\t\tc := session.DB(mongodb_database).C(mongodb_collection)\n\t\tvar results []Review\n\t\terr = c.Find(bson.M{\"itemname\": ItemName}).All(&results)\n\t\tif err != nil {\n\t\t\tlog.Fatal(err)\n\t\t}\n\t\tfmt.Println(results)\n\t\tif len(results) > 0 {\n\t\t\tformatter.JSON(w, http.StatusOK, results)\n\t\t}else{\n\t\t\tformatter.JSON(w, http.StatusNoContent, struct{ Response string }{\"No reviews found for the given ID\"})\n\t\t}\n\t}\n}", "title": "" }, { "docid": "6418268a5fdd1143d672ca152da7e6d2", "score": "0.5335596", "text": "func (rh *ReviewHandler) GetByID(c echo.Context) error {\n\tctx := c.Request().Context()\n\treviewID := c.Param(\"reviewID\")\n\n\treview, err := rh.reviewUsecase.GetByID(ctx, reviewID)\n\tif err != nil {\n\t\treturn c.JSONPretty(http.StatusNotFound, ResponseError{err.Error()}, Indent)\n\t}\n\n\treturn c.JSONPretty(http.StatusOK, review, Indent)\n}", "title": "" }, { "docid": "50f60a6e5d0ce4a15fee1279c712dcd4", "score": "0.5316578", "text": "func (c *Client) AccessReview() *AccessReviewClient {\n\treturn NewAccessReviewClient(\n\t\tc.transport,\n\t\tpath.Join(c.path, \"access_review\"),\n\t)\n}", "title": "" }, { "docid": "b49341be78204e9c7bc7a0bf87ef2d7e", "score": "0.5315323", "text": "func (*buildReviewModel) GetById(id int64) (v *BuildReview, err error) {\n\tv = &BuildReview{Id: id}\n\n\tif err = Ormer().Read(v); err == nil {\n\t\treturn v, nil\n\t}\n\treturn nil, err\n}", "title": "" }, { "docid": "b1170139dda5f3a97ed5af0ef12f9c8e", "score": "0.52455944", "text": "func (r *Reviewer) Review(number int) error {\n\t// Check if the PR changes only the version.rb file\n\tif err := r.reviewFile(number); err != nil {\n\t\treturn r.handleReviewError(number, err)\n\t}\n\n\t// Check if the PR's version.rb follows the expected pattern\n\tif err := r.reviewVersion(number); err != nil {\n\t\treturn r.handleReviewError(number, err)\n\t}\n\n\t// Approve the PR\n\tif err := r.approvePullRequest(number); err != nil {\n\t\treturn err\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "0f7fc86426a262ddcf381ed01f82cfe7", "score": "0.5241532", "text": "func (l *ResourceReviewList) Get(i int) *ResourceReview {\n\tif l == nil || i < 0 || i >= len(l.items) {\n\t\treturn nil\n\t}\n\treturn l.items[i]\n}", "title": "" }, { "docid": "784fc00d640c52ac69fd7f10a49d5ad6", "score": "0.5234458", "text": "func (m *MatrixPayload) Review(p *api.PullRequestPayload, event webhook_module.HookEventType) (api.Payloader, error) {\n\tsenderLink := MatrixLinkFormatter(setting.AppURL+url.PathEscape(p.Sender.UserName), p.Sender.UserName)\n\ttitle := fmt.Sprintf(\"#%d %s\", p.Index, p.PullRequest.Title)\n\ttitleLink := MatrixLinkFormatter(p.PullRequest.URL, title)\n\trepoLink := MatrixLinkFormatter(p.Repository.HTMLURL, p.Repository.FullName)\n\tvar text string\n\n\tswitch p.Action {\n\tcase api.HookIssueReviewed:\n\t\taction, err := parseHookPullRequestEventType(event)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\n\t\ttext = fmt.Sprintf(\"[%s] Pull request review %s: %s by %s\", repoLink, action, titleLink, senderLink)\n\t}\n\n\treturn getMatrixPayload(text, nil, m.MsgType), nil\n}", "title": "" }, { "docid": "41ae52f7883e49c1ac843dd7720f0b56", "score": "0.52281755", "text": "func (r *Review) String() string {\n\tvar builder strings.Builder\n\tbuilder.WriteString(\"Review(\")\n\tbuilder.WriteString(fmt.Sprintf(\"id=%v\", r.ID))\n\tbuilder.WriteString(\", is_approved=\")\n\tbuilder.WriteString(fmt.Sprintf(\"%v\", r.IsApproved))\n\tbuilder.WriteString(\", operator_note=\")\n\tbuilder.WriteString(r.OperatorNote)\n\tbuilder.WriteString(\", createtime_utc=\")\n\tbuilder.WriteString(fmt.Sprintf(\"%v\", r.CreatetimeUtc))\n\tbuilder.WriteString(\", updatetime_utc=\")\n\tbuilder.WriteString(fmt.Sprintf(\"%v\", r.UpdatetimeUtc))\n\tbuilder.WriteByte(')')\n\treturn builder.String()\n}", "title": "" }, { "docid": "4e8f15c7eda6379a2db016901e569d33", "score": "0.52099043", "text": "func (c *ReviewClient) GetX(ctx context.Context, id int) *Review {\n\tobj, err := c.Get(ctx, id)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn obj\n}", "title": "" }, { "docid": "1eb08e4d27cf9e03fe98e8f9827ab9d5", "score": "0.5191185", "text": "func GetReviews(client *http.Client, baseUrl string, pages int) []Review {\n\n\t//Create our return boject\n\treviews := make([]Review, 0)\n\n\t//Loop through al lthe pages\n\tfor i := 1; i <= pages; i++ {\n\t\t//Generate the URL to the reviews for a given i\n\t\turl := strings.Replace(baseUrl, \"{PAGENUM}\", strconv.Itoa(i), 1)\n\t\t//Retreive Reviews\n\t\tpageReviews := GetReviewsByURL(client, url)\n\t\t//Append reviews to return list\n\t\treviews = append(reviews, pageReviews...)\n\t}\n\t//return reviews\n\treturn reviews\n}", "title": "" }, { "docid": "6df082293af2aaf6a3306b64ec1aa0dd", "score": "0.5190644", "text": "func ShowReviewPath(proposalID string, reviewID int, userID string) string {\n\treturn fmt.Sprintf(\"/api/users/%v/proposals/%v/review/%v\", userID, proposalID, reviewID)\n}", "title": "" }, { "docid": "a8aa9b8384db6f79c96235d96f8d5c5d", "score": "0.5175392", "text": "func (c *Client) FeatureReview() *FeatureReviewClient {\n\treturn NewFeatureReviewClient(\n\t\tc.transport,\n\t\tpath.Join(c.path, \"feature_review\"),\n\t)\n}", "title": "" }, { "docid": "a293f1f9ee7e2b94fb30f43e8133f76d", "score": "0.51658905", "text": "func NewReview(config *NewReviewConfig) (*Review, error) {\n\tID, err := uuid.NewV4()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn &Review{\n\t\tID: ID,\n\t\tUserID: config.UserID,\n\t\tStoreID: config.StoreID,\n\t\tPurchaseID: config.PurchaseID,\n\t\tScore: config.Score,\n\t\tOpinion: config.Opinion,\n\t}, nil\n}", "title": "" }, { "docid": "518adbbc02e03a27f35c6a9a6a985a86", "score": "0.51631314", "text": "func (c *Client) ResourceReview() *ResourceReviewClient {\n\treturn NewResourceReviewClient(\n\t\tc.transport,\n\t\tpath.Join(c.path, \"resource_review\"),\n\t)\n}", "title": "" }, { "docid": "658ea9f3b944e379236085d5327b4dad", "score": "0.5100902", "text": "func (ec *executionContext) _Review(sel []query.Selection, obj *Review) graphql.Marshaler {\n\tfields := graphql.CollectFields(ec.doc, sel, reviewImplementors, ec.variables)\n\tout := graphql.NewOrderedMap(len(fields))\n\tfor i, field := range fields {\n\t\tout.Keys[i] = field.Alias\n\n\t\tswitch field.Name {\n\t\tcase \"__typename\":\n\t\t\tout.Values[i] = graphql.MarshalString(\"Review\")\n\t\tcase \"stars\":\n\t\t\tout.Values[i] = ec._Review_stars(field, obj)\n\t\tcase \"commentary\":\n\t\t\tout.Values[i] = ec._Review_commentary(field, obj)\n\t\tcase \"time\":\n\t\t\tout.Values[i] = ec._Review_time(field, obj)\n\t\tdefault:\n\t\t\tpanic(\"unknown field \" + strconv.Quote(field.Name))\n\t\t}\n\t}\n\n\treturn out\n}", "title": "" }, { "docid": "f8186851e9ab75940db70225a1535c46", "score": "0.5092339", "text": "func (c *Client) Review(ctx context.Context, obj interface{}, opts ...QueryOpt) (*types.Responses, error) {\n\tcfg := &queryCfg{}\n\tfor _, opt := range opts {\n\t\topt(cfg)\n\t}\n\tresponses := types.NewResponses()\n\terrMap := make(ErrorMap)\nTargetLoop:\n\tfor name, target := range c.targets {\n\t\thandled, review, err := target.HandleReview(obj)\n\t\t// Short-circuiting question applies here as well\n\t\tif err != nil {\n\t\t\terrMap[name] = err\n\t\t\tcontinue\n\t\t}\n\t\tif !handled {\n\t\t\tcontinue\n\t\t}\n\t\tinput := map[string]interface{}{\"review\": review}\n\t\tresp, err := c.backend.driver.Query(ctx, fmt.Sprintf(`hooks[\"%s\"].violation`, name), input, drivers.Tracing(cfg.enableTracing))\n\t\tif err != nil {\n\t\t\terrMap[name] = err\n\t\t\tcontinue\n\t\t}\n\t\tfor _, r := range resp.Results {\n\t\t\tif err := target.HandleViolation(r); err != nil {\n\t\t\t\terrMap[name] = err\n\t\t\t\tcontinue TargetLoop\n\t\t\t}\n\t\t}\n\t\tresp.Target = name\n\t\tresponses.ByTarget[name] = resp\n\t}\n\tif len(errMap) == 0 {\n\t\treturn responses, nil\n\t}\n\treturn responses, errMap\n}", "title": "" }, { "docid": "d80d0ad5a4d4ac0af03e8915fd09ffcd", "score": "0.50798446", "text": "func PostReview(c echo.Context) error {\n\n\t// newReview: a new Review Struct (to be stored in the database)\n\tnewReview := models.Review{}\n\tc.Bind(&newReview)\n\n\tdatabase.Db.Debug().Create(&newReview)\n\n\treturn returnData(c, newReview)\n}", "title": "" }, { "docid": "840e3825f271c9d5be6bcbbfdcd984e0", "score": "0.5067964", "text": "func (m *Review) ReviewToReview() *app.Review {\n\treview := &app.Review{}\n\treview.Comment = m.Comment\n\treview.ID = &m.ID\n\treview.Rating = &m.Rating\n\n\treturn review\n}", "title": "" }, { "docid": "3738561f812b25090bf4b8b5d2db65cc", "score": "0.49580953", "text": "func (h *GithubClient) GetAllReviews(uri string, ita token.InsTokenInterface) (reviews []*github.PullRequestReview, err error) {\n\ti := 1\n\tfor {\n\t\tvar revs []*github.PullRequestReview\n\t\tbody, err := h.Get(paginate(uri, i), ita)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\n\t\tif err := json.Unmarshal(body, &revs); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\n\t\treviews = append(reviews, revs...)\n\n\t\tif len(revs) < 99 {\n\t\t\tbreak\n\t\t}\n\n\t\ti++\n\t}\n\n\treturn reviews, nil\n}", "title": "" }, { "docid": "48407c6f82d9088bda7b9e2df5a20845", "score": "0.4947831", "text": "func (m *ReviewDB) ListReview(ctx context.Context, proposalID int, userID int) []*app.Review {\n\tdefer goa.MeasureSince([]string{\"goa\", \"db\", \"review\", \"listreview\"}, time.Now())\n\n\tvar native []*Review\n\tvar objs []*app.Review\n\terr := m.Db.Scopes(ReviewFilterByProposal(proposalID, m.Db), ReviewFilterByUser(userID, m.Db)).Table(m.TableName()).Find(&native).Error\n\n\tif err != nil {\n\t\tgoa.LogError(ctx, \"error listing Review\", \"error\", err.Error())\n\t\treturn objs\n\t}\n\n\tfor _, t := range native {\n\t\tobjs = append(objs, t.ReviewToReview())\n\t}\n\n\treturn objs\n}", "title": "" }, { "docid": "3bbe212a3f38d387a710e82916be5421", "score": "0.49377796", "text": "func (m *GetReviewsResponse) Validate() error {\n\tif m == nil {\n\t\treturn nil\n\t}\n\n\tfor idx, item := range m.GetReviews() {\n\t\t_, _ = idx, item\n\n\t\tif v, ok := interface{}(item).(interface{ Validate() error }); ok {\n\t\t\tif err := v.Validate(); err != nil {\n\t\t\t\treturn GetReviewsResponseValidationError{\n\t\t\t\t\tfield: fmt.Sprintf(\"Reviews[%v]\", idx),\n\t\t\t\t\treason: \"embedded message failed validation\",\n\t\t\t\t\tcause: err,\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "38c2bf71f276db6c7ab76002296ceaee", "score": "0.49333066", "text": "func (client *ClientImpl) GetPullRequestReviewer(ctx context.Context, args GetPullRequestReviewerArgs) (*IdentityRefWithVote, error) {\n\trouteValues := make(map[string]string)\n\tif args.Project != nil && *args.Project != \"\" {\n\t\trouteValues[\"project\"] = *args.Project\n\t}\n\tif args.RepositoryId == nil || *args.RepositoryId == \"\" {\n\t\treturn nil, &azuredevops.ArgumentNilOrEmptyError{ArgumentName: \"args.RepositoryId\"}\n\t}\n\trouteValues[\"repositoryId\"] = *args.RepositoryId\n\tif args.PullRequestId == nil {\n\t\treturn nil, &azuredevops.ArgumentNilError{ArgumentName: \"args.PullRequestId\"}\n\t}\n\trouteValues[\"pullRequestId\"] = strconv.Itoa(*args.PullRequestId)\n\tif args.ReviewerId == nil || *args.ReviewerId == \"\" {\n\t\treturn nil, &azuredevops.ArgumentNilOrEmptyError{ArgumentName: \"args.ReviewerId\"}\n\t}\n\trouteValues[\"reviewerId\"] = *args.ReviewerId\n\n\tlocationId, _ := uuid.Parse(\"4b6702c7-aa35-4b89-9c96-b9abf6d3e540\")\n\tresp, err := client.Client.Send(ctx, http.MethodGet, locationId, \"5.1\", routeValues, nil, nil, \"\", \"application/json\", nil)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tvar responseValue IdentityRefWithVote\n\terr = client.Client.UnmarshalBody(resp, &responseValue)\n\treturn &responseValue, err\n}", "title": "" }, { "docid": "71c35635bf53b0af41301ad62f1253e1", "score": "0.49195215", "text": "func TestreviewXML(t *testing.T) {\n\tr := getRouter(true)\n\n\t// Define the route similar to its definition in the routes file\n\tr.GET(\"/review/view/:review_id\", getreview)\n\n\t// Create a request to send to the above route\n\treq, _ := http.NewRequest(\"GET\", \"/review/view/1\", nil)\n\treq.Header.Add(\"Accept\", \"application/xml\")\n\n\ttestHTTPResponse(t, r, req, func(w *httptest.ResponseRecorder) bool {\n\t\t// Test that the http status code is 200\n\t\tstatusOK := w.Code == http.StatusOK\n\n\t\t// Test that the response is JSON which can be converted to\n\t\t// an array of review structs\n\t\tp, err := ioutil.ReadAll(w.Body)\n\t\tif err != nil {\n\t\t\treturn false\n\t\t}\n\t\tvar a review\n\t\terr = xml.Unmarshal(p, &a)\n\n\t\treturn err == nil && a.ID == 1 && len(a.Title) >= 0 && statusOK\n\t})\n}", "title": "" }, { "docid": "253fd97cbcfec0afb40eed720ad478ce", "score": "0.48905048", "text": "func (_m *Remote) GetReviews(c context.Context, _a0 *model.User, _a1 *model.Repo, _a2 int) ([]*model.Review, error) {\n\tret := _m.Called(c, _a0, _a1, _a2)\n\n\tvar r0 []*model.Review\n\tif rf, ok := ret.Get(0).(func(context.Context, *model.User, *model.Repo, int) []*model.Review); ok {\n\t\tr0 = rf(c, _a0, _a1, _a2)\n\t} else {\n\t\tif ret.Get(0) != nil {\n\t\t\tr0 = ret.Get(0).([]*model.Review)\n\t\t}\n\t}\n\n\tvar r1 error\n\tif rf, ok := ret.Get(1).(func(context.Context, *model.User, *model.Repo, int) error); ok {\n\t\tr1 = rf(c, _a0, _a1, _a2)\n\t} else {\n\t\tr1 = ret.Error(1)\n\t}\n\n\treturn r0, r1\n}", "title": "" }, { "docid": "70f3f8511f4cd073277fc66a4273bb0c", "score": "0.48758706", "text": "func GetCommentsForReview(ctx *Context, reviewIndex int) (CommentCollection, error) {\n\treturn GetComments(ctx, fmt.Sprintf(\"topic=reviews/%d\", reviewIndex))\n}", "title": "" }, { "docid": "61c153e6423cffcdca604500086808b6", "score": "0.48677155", "text": "func GetAllReviews() []Review {\n\tvar Reviews []Review\n\tdb.Find(&Reviews)\n\treturn Reviews\n}", "title": "" }, { "docid": "a7faad8b0405327687aff96b96e9f3a8", "score": "0.48656115", "text": "func (ap *AnimeParser) getReviewDate(topArea *goquery.Selection) common.DateTime {\n\treviewDate := topArea.Find(\"div:nth-of-type(1)\").Find(\"div:nth-of-type(1)\")\n\tdateDate := reviewDate.Text()\n\tdateTime, _ := reviewDate.Attr(\"title\")\n\treturn common.DateTime{\n\t\tDate: dateDate,\n\t\tTime: dateTime,\n\t}\n}", "title": "" }, { "docid": "e87a534c9bb37feaac59b0404bd62eb6", "score": "0.4864135", "text": "func (m *EdiscoveryAddToReviewSetOperation) GetReviewSet()(EdiscoveryReviewSetable) {\n return m.reviewSet\n}", "title": "" }, { "docid": "2b95e35de10d66fcd3b507c87f365c13", "score": "0.4859731", "text": "func (ap *AnimeParser) getReviewImage(topArea *goquery.Selection) string {\n\treviewImage, _ := topArea.Find(\"table td img\").Attr(\"src\")\n\treturn utils.URLCleaner(reviewImage, \"image\", ap.Config.CleanImageURL)\n}", "title": "" }, { "docid": "183ff903c1c843c02eba834552f0f331", "score": "0.48596057", "text": "func (c *MetadataCore) Review(callback resources.Callback) (xerr fail.Error) {\n\tdefer fail.OnPanic(&xerr)\n\n\tif c == nil || c.IsNull() {\n\t\treturn fail.InvalidInstanceError()\n\t}\n\tif callback == nil {\n\t\treturn fail.InvalidParameterCannotBeNilError(\"callback\")\n\t}\n\tif c.properties == nil {\n\t\treturn fail.InvalidInstanceContentError(\"c.properties\", \"cannot be nil\")\n\t}\n\n\tc.lock.RLock()\n\tdefer c.lock.RUnlock()\n\n\treturn c.shielded.Inspect(func(clonable data.Clonable) fail.Error {\n\t\treturn callback(clonable, c.properties)\n\t})\n}", "title": "" }, { "docid": "2fab16dbca2e55ba69f9817c5f28a411", "score": "0.48110884", "text": "func (controller *Controller) GetComment(c echo.Context) error {\n\t// fetch record specified by parameter id\n\tid, err := strconv.ParseInt(c.Param(\"id\"), 10, 64)\n\tif err != nil {\n\t\tc.Logger().Error(\"ParseInt: \", err)\n\t\treturn c.String(http.StatusBadRequest, \"ParseInt: \"+err.Error())\n\t}\n\tcomment, err := controller.client.Comment.Get(context.Background(), int(id))\n\tif err != nil {\n\t\tif !ent.IsNotFound(err) {\n\t\t\tc.Logger().Error(\"Get: \", err)\n\t\t\treturn c.String(http.StatusBadRequest, \"Get: \"+err.Error())\n\t\t}\n\t\treturn c.String(http.StatusNotFound, \"Not Found\")\n\t}\n\treturn c.JSON(http.StatusOK, comment)\n}", "title": "" }, { "docid": "72efa7eb142d7ce0c92d5aff2d4567ce", "score": "0.4804897", "text": "func (r *ReviewStorage) GetReviewByOwner(ctx context.Context, userID int64, offerID int64) (bookly.Review, error) {\n\tconst queryCheck = `\n SELECT *\n\tFROM reviews\n\tWHERE user_id = $1 AND offer_id = $2\n`\n\n\trow := r.connPool.QueryRow(ctx, queryCheck,\n\t\tuserID,\n\t\tofferID,\n\t)\n\treview := bookly.Review{}\n\terr := row.Scan(&review.ID, &review.UserID, &review.OfferID, &review.Content, &review.Rating, &review.ReviewDate)\n\tif err != nil {\n\t\tif err == pgx.ErrNoRows {\n\t\t\treturn bookly.Review{}, bookly.ErrReviewNotFound\n\t\t}\n\t\treturn bookly.Review{}, fmt.Errorf(\"postgres: could not get review: %w\", err)\n\t}\n\n\treturn review, nil\n}", "title": "" }, { "docid": "624fcbc4639ef03358f2de020debdf7e", "score": "0.4792223", "text": "func ToPullReview(ctx context.Context, r *issues_model.Review, doer *user_model.User) (*api.PullReview, error) {\n\tif err := r.LoadAttributes(ctx); err != nil {\n\t\tif !user_model.IsErrUserNotExist(err) {\n\t\t\treturn nil, err\n\t\t}\n\t\tr.Reviewer = user_model.NewGhostUser()\n\t}\n\n\tapiTeam, err := ToTeam(ctx, r.ReviewerTeam)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tresult := &api.PullReview{\n\t\tID: r.ID,\n\t\tReviewer: ToUser(ctx, r.Reviewer, doer),\n\t\tReviewerTeam: apiTeam,\n\t\tState: api.ReviewStateUnknown,\n\t\tBody: r.Content,\n\t\tCommitID: r.CommitID,\n\t\tStale: r.Stale,\n\t\tOfficial: r.Official,\n\t\tDismissed: r.Dismissed,\n\t\tCodeCommentsCount: r.GetCodeCommentsCount(),\n\t\tSubmitted: r.CreatedUnix.AsTime(),\n\t\tUpdated: r.UpdatedUnix.AsTime(),\n\t\tHTMLURL: r.HTMLURL(),\n\t\tHTMLPullURL: r.Issue.HTMLURL(),\n\t}\n\n\tswitch r.Type {\n\tcase issues_model.ReviewTypeApprove:\n\t\tresult.State = api.ReviewStateApproved\n\tcase issues_model.ReviewTypeReject:\n\t\tresult.State = api.ReviewStateRequestChanges\n\tcase issues_model.ReviewTypeComment:\n\t\tresult.State = api.ReviewStateComment\n\tcase issues_model.ReviewTypePending:\n\t\tresult.State = api.ReviewStatePending\n\tcase issues_model.ReviewTypeRequest:\n\t\tresult.State = api.ReviewStateRequestReview\n\t}\n\n\treturn result, nil\n}", "title": "" }, { "docid": "81ad92ba585c44604d2acff03c5ac34f", "score": "0.47919217", "text": "func FetchUserReview(userName string) ([]Review, error) {\n\tres, err := http.Get(Root + \"/profile/\" + userName + \"/reviews\")\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tdefer res.Body.Close()\n\tdata := struct {\n\t\tPayload struct {\n\t\t\tReviews []Review `json:\"reviews\"`\n\t\t\tTotalReviewCount int64 `json:\"total_review_count\"`\n\t\t\tUser User `json:\"user\"`\n\t\t}\n\t\tError string\n\t}{}\n\terr = json.NewDecoder(res.Body).Decode(&data)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tif data.Error != \"\" {\n\t\treturn nil, errors.New(data.Error)\n\t}\n\treturn data.Payload.Reviews, nil\n}", "title": "" }, { "docid": "de3ce6ab049fb8de3ba3839f150c5392", "score": "0.4777984", "text": "func postReviewHandler(formatter *render.Render) http.HandlerFunc {\n\n\treturn func(w http.ResponseWriter, req *http.Request) {\n\t\tvar m Review\n\t\t_ = json.NewDecoder(req.Body).Decode(&m)\n\t\tfmt.Println(\"Review is: \", m.Review, \" \", m.ItemId,\" \", m.UserId)\n\t\tsession, err := mgo.Dial(mongodb_server)\n\t\tif err != nil {\n\t\t\tpanic(err)\n\t\t}\n\n\t\tif err != nil {\n\t\t\tfmt.Println(\"Reviews API - Unable to connect to MongoDB during read operation\")\n\t\t\tpanic(err)\n\t\t}\n\t\tdefer session.Close()\n\t\tsession.SetMode(mgo.Monotonic, true)\n\t\tc := session.DB(mongodb_database).C(mongodb_collection)\n\t\tentry := Review{\n\t\t\tReview: m.Review,\n\t\t\tUserId: m.UserId,\n\t\t\tItemId: m.ItemId,\n\t\t}\n\t\terr = c.Insert(entry)\n\t\tif err != nil {\n\t\t\tfmt.Println(\"Error while inserting purchase: \", err)\n\t\t} else {\n\t\t\tformatter.JSON(w, http.StatusOK, struct{ Test string }{\"Review added\"})\n\t\t}\n\t}\n}", "title": "" }, { "docid": "9b4eba43a7ff5999bf6242175705fa65", "score": "0.47740087", "text": "func (p *Protocol) PutReview(ctx context.Context, reviewInput *protocol.ReviewInput) (*protocol.Review, error) {\n\tinsertQuery := fmt.Sprintf(\"INSERT INTO %s (user_ID, art_ID, [text], timestamp, upvotes) \"+\n\t\t\"VALUES (?, ?, ?, ?, ?)\", protocol.ReviewTableName)\n\n\tif err := p.Store.Transact(func(tx *sql.Tx) error {\n\t\tif _, err := tx.Exec(insertQuery, reviewInput.UserID, reviewInput.ArtID, reviewInput.Text,\n\t\t\treviewInput.TimeStamp, reviewInput.Upvotes); err != nil {\n\t\t\treturn err\n\t\t}\n\t\treturn nil\n\t}); err != nil {\n\t\treturn nil, err\n\t}\n\n\tgetQuery := fmt.Sprintf(\"SELECT MAX(review_ID) FROM %s\", protocol.ReviewTableName)\n\n\tstmt, err := p.Store.GetDB().Prepare(getQuery)\n\tif err != nil {\n\t\treturn nil, errors.Wrap(err, \"failed to prepare get query\")\n\t}\n\n\tvar reviewID uint64\n\tif err = stmt.QueryRow().Scan(&reviewID); err != nil {\n\t\treturn nil, errors.Wrap(err, \"failed to execute get query\")\n\t}\n\treturn &protocol.Review{\n\t\tReviewID: reviewID,\n\t\tUserID: reviewInput.UserID,\n\t\tArtID: reviewInput.ArtID,\n\t\tText: reviewInput.Text,\n\t\tTimeStamp: reviewInput.TimeStamp,\n\t\tUpvotes: reviewInput.Upvotes,\n\t}, nil\n}", "title": "" }, { "docid": "9588ddd77b351c1a3ad324a0128f2334", "score": "0.47536618", "text": "func CreateReview(w http.ResponseWriter, r *http.Request) {\r\n\tw.Header().Set(\"Content-Type\", \"application/json\")\r\n\r\n\tvar review Review\r\n\tfmt.Printf(\"%T\", r.Body)\r\n\tparams := mux.Vars(r)\r\n\r\n\t// review.SnackID = params[\"id\"]\r\n\tjson.NewDecoder(r.Body).Decode(&review)\r\n\tid := params[\"id\"]\r\n\tid1, _ := strconv.ParseUint(id, 10, 64)\r\n\treview.SnackID = id1\r\n\tdb.Create(&review)\r\n\tjson.NewEncoder(w).Encode(&review)\r\n}", "title": "" }, { "docid": "c36ebc7851d605439f80d94fee660fe4", "score": "0.47530136", "text": "func (ap *AnimeParser) getReviewContent(bottomArea *goquery.Selection) string {\n\tbottomArea.Find(\"div[id^=score]\").Remove()\n\tbottomArea.Find(\"div[id^=revhelp_output]\").Remove()\n\tbottomArea.Find(\"a[id^=reviewToggle]\").Remove()\n\n\tr := regexp.MustCompile(`[^\\S\\r\\n]+`)\n\treviewContent := r.ReplaceAllString(bottomArea.Text(), \" \")\n\n\tr = regexp.MustCompile(`(\\n\\n \\n)`)\n\treviewContent = r.ReplaceAllString(reviewContent, \"\")\n\n\treturn strings.TrimSpace(reviewContent)\n}", "title": "" }, { "docid": "9b937b55e500433b16c950b515ea7929", "score": "0.47368133", "text": "func PostReview(c *gin.Context) {\n\tid := c.Param(\"id\")\n\ttext := c.PostForm(\"text\")\n\tuser := models.GetUserFromContext(c)\n\tnum, err := strconv.Atoi(id)\n\tif err != nil || text == \"\" {\n\t\tc.String(http.StatusBadRequest, \"Bad Request\")\n\t\treturn\n\t}\n\titem := models.NewItem()\n\tif ok := models.GetItem(num, item); !ok {\n\t\tc.String(http.StatusNotFound, \"Not Found\")\n\t\treturn\n\t}\n\treview := models.Review{Author: user, Item: item, Text: text}\n\treview.Save()\n\tsession := sessions.Default(c)\n\tsession.AddFlash(\"Обзор добавлен. Он появится после одобрения модератором.\")\n\tsession.Save()\n\tc.Redirect(http.StatusSeeOther, app.RootURL+c.DefaultQuery(\"redirect\", \"/\"))\n}", "title": "" }, { "docid": "4dac28ae79a2dfa71a82875117b1a279", "score": "0.47356454", "text": "func (m *GetReviewsResponse_Reviews) Validate() error {\n\tif m == nil {\n\t\treturn nil\n\t}\n\n\t// no validation rules for Firstname\n\n\t// no validation rules for Lastname\n\n\t// no validation rules for Feedback\n\n\tif v, ok := interface{}(m.GetCreatedAt()).(interface{ Validate() error }); ok {\n\t\tif err := v.Validate(); err != nil {\n\t\t\treturn GetReviewsResponse_ReviewsValidationError{\n\t\t\t\tfield: \"CreatedAt\",\n\t\t\t\treason: \"embedded message failed validation\",\n\t\t\t\tcause: err,\n\t\t\t}\n\t\t}\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "d548acb4c8d3968781ee8bb086c0876c", "score": "0.47266302", "text": "func (c *Client) CreateReview(ctx context.Context, path string, payload *CreateReviewPayload) (*http.Response, error) {\n\tvar body io.Reader\n\tb, err := json.Marshal(payload)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"failed to serialize body: %s\", err)\n\t}\n\tbody = bytes.NewBuffer(b)\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\treq, err := http.NewRequest(\"POST\", u.String(), body)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\theader := req.Header\n\theader.Set(\"Content-Type\", \"application/json\")\n\treturn c.Client.Do(ctx, req)\n}", "title": "" }, { "docid": "dd3addf7d4956f30b4995c08f8f19cda", "score": "0.4718619", "text": "func GetMangaReviews(id, page int) (*MangaReviews, error) {\n\tres := &MangaReviews{}\n\terr := urlToStruct(fmt.Sprintf(\"/manga/%d/reviews?page=%d\", id, page), res)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn res, nil\n}", "title": "" }, { "docid": "dba62cee6548031cff75c7da64b00385", "score": "0.47078356", "text": "func NewReviewClient(c config) *ReviewClient {\n\treturn &ReviewClient{config: c}\n}", "title": "" }, { "docid": "9636c5cf9aa18e3171eaee4b66b4b052", "score": "0.47017086", "text": "func TopStudentsWithReview(c echo.Context) error {\n\t//// Get user token authenticate\n\t//user := c.Get(\"user\").(*jwt.Token)\n\t//claims := user.Claims.(*utilities.Claim)\n\t//currentUser := claims.User\n\t//\n\t//// Get connection\n\t//db := provider.GetConnection()\n\t//defer db.Close()\n\t//\n\t//// All modules\n\t//var countModules uint\n\t//if err := db.Model(&institutemodel.Module{}).Where(\"program_id = ?\", currentUser.DefaultProgramID).Count(&countModules).Error; err != nil {\n\t// return c.JSON(http.StatusOK,utilities.Response{Message: fmt.Sprintf(\"%s\", err)})\n\t//}\n\t//\n\t//// All students\n\t//var countStudents uint\n\t//if err := db.Model(&institutemodel.Student{}).Where(\"program_id = ?\", currentUser.DefaultProgramID).Count(&countStudents).Error; err != nil {\n\t// return c.JSON(http.StatusOK,utilities.Response{Message: fmt.Sprintf(\"%s\", err)})\n\t//}\n\t//\n\t//// All revisions\n\t//countAllRevisions := countModules * countStudents\n\t//var countReviews uint\n\t//if err := db.Table(\"reviews\").Joins(\"INNER JOIN students on reviews.student_id = students.id\").\n\t//\tWhere(\"students.program_id = ?\", currentUser.DefaultProgramID).Count(&countReviews).Error; err != nil {\n\t// return c.JSON(http.StatusOK,utilities.Response{Message: fmt.Sprintf(\"%s\", err)})\n\t//}\n\t//\n\t//percentageP := uint(0)\n\t//percentageN := uint(0)\n\t//\n\t//if countAllRevisions > 0 {\n\t//\tpercentageP = uint((countReviews * 100) / countAllRevisions)\n\t//\tpercentageN = uint(100 - percentageP)\n\t//}\n\t//\n\t//return c.JSON(http.StatusOK, studentsWithReviewResponse{\n\t//\tSuccess: true,\n\t//\tStudents: countStudents,\n\t//\tReviews: countReviews,\n\t//\tPercentagePositiveReviews: percentageP,\n\t//\tPercentageNegativeReviews: percentageN,\n\t//})\n\treturn c.JSON(http.StatusOK, utilities.Response{Success: true})\n}", "title": "" }, { "docid": "7502245a785058f100302b1b046eb292", "score": "0.4700449", "text": "func ObtainDetailGet(req model.RequestAbstract) model.ResponseAbstract {\n\n\tdbAbs := commonRequestProcess(req, \"obtain_detail\")\n\n\treturn prepareResponse(dbAbs)\n}", "title": "" }, { "docid": "e5a015f04fc281c0f1dd9ce7702bdded", "score": "0.46991688", "text": "func (c *Client) SelfAccessReview() *SelfAccessReviewClient {\n\treturn NewSelfAccessReviewClient(\n\t\tc.transport,\n\t\tpath.Join(c.path, \"self_access_review\"),\n\t)\n}", "title": "" }, { "docid": "a7a08c3e402ee8a829626b23371eb190", "score": "0.4693406", "text": "func GetOpenReviews(ctx *Context, username string) (ReviewCollection, error) {\n\treturn GetReviews(ctx, fmt.Sprintf(\"participants=%s&state=needsReview\", username))\n}", "title": "" }, { "docid": "197b9b36fa9c847d3de1620ff56a8b6c", "score": "0.46859297", "text": "func (m *MockUseCase) GetUserReviews(arg0, arg1, arg2 uint64) ([]*models.Review, uint64, error) {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"GetUserReviews\", arg0, arg1, arg2)\n\tret0, _ := ret[0].([]*models.Review)\n\tret1, _ := ret[1].(uint64)\n\tret2, _ := ret[2].(error)\n\treturn ret0, ret1, ret2\n}", "title": "" }, { "docid": "25ba9f9b8ac1423aa78977f3268e2171", "score": "0.46834785", "text": "func (dr *DefaultReviewersService) Get(owner, repoSlug, userID string, opts ...interface{}) (*User, *simpleresty.Response, error) {\n\tresult := new(User)\n\turlStr, urlStrErr := dr.client.http.RequestURLWithQueryParams(\n\t\tfmt.Sprintf(\"/repositories/%s/%s/default-reviewers/%s\", owner, repoSlug, userID), opts...)\n\tif urlStrErr != nil {\n\t\treturn nil, nil, urlStrErr\n\t}\n\n\tresponse, err := dr.client.http.Get(urlStr, result, nil)\n\n\treturn result, response, err\n}", "title": "" }, { "docid": "88a42ad69b140c637697d47a713db7d8", "score": "0.46826017", "text": "func GetReviews(daysStr string) (reviews []Review, err error) {\n\tvar days int\n\tif days, err = strconv.Atoi(daysStr); err != nil {\n\t\treturn\n\t}\n\tdays = days + 1\n\tif days > 5 {\n\t\terr = errors.New(\"Sorry, I can only get reviews from the last five days\")\n\t\treturn\n\t}\n\tdoc, err := goquery.NewDocument(baseurl)\n\tif err != nil {\n\t\treturn\n\t}\n\n\treviews = make([]Review, 0)\n\n\treschan := make(chan response, 5)\n\tvar wg sync.WaitGroup\n\n\tdoc.Find(\"#review-day-\" + strconv.Itoa(days) + \" .review-list a\").Each(func(i int, s *goquery.Selection) {\n\t\tpath, _ := s.Attr(\"href\")\n\t\tq := query{path: path, responseChan: reschan}\n\t\twg.Add(1)\n\t\tgo getReviewDetails(q)\n\t})\n\n\tgo func() {\n\t\tfor response := range reschan {\n\t\t\tif response.err != nil {\n\t\t\t\terr = response.err\n\t\t\t} else {\n\t\t\t\treviews = append(reviews, response.review)\n\t\t\t}\n\t\t\twg.Done()\n\t\t}\n\t}()\n\n\twg.Wait()\n\tclose(reschan)\n\n\treturn reviews, err\n}", "title": "" }, { "docid": "f369b92e728b59ce01a5e5e36c082e90", "score": "0.4673509", "text": "func (c *Client) DeleteReview(ctx context.Context, path string) (*http.Response, error) {\n\tvar body io.Reader\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\treq, err := http.NewRequest(\"DELETE\", u.String(), body)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\theader := req.Header\n\theader.Set(\"Content-Type\", \"application/json\")\n\treturn c.Client.Do(ctx, req)\n}", "title": "" }, { "docid": "adcd401fa5b97c5ed4f7fb923b203408", "score": "0.4661674", "text": "func ReviewDelete(c *gin.Context) {\n\tid := c.Param(\"id\")\n\tnum, err := strconv.Atoi(id)\n\tif err != nil {\n\t\tc.String(http.StatusBadRequest, \"Bad Request\")\n\t\treturn\n\t}\n\tmodels.ReviewDelete(num)\n\tc.String(http.StatusOK, \"OK\")\n}", "title": "" }, { "docid": "a16828d66476fcb74834db06aba74ac4", "score": "0.46479836", "text": "func DeleteReview(w http.ResponseWriter, r *http.Request) {\r\n\tw.Header().Set(\"Content-Type\", \"application/json\")\r\n\r\n\tparams := mux.Vars(r)\r\n\tvar review Review\r\n\tdeleted := db.First(&review, params[\"id\"])\r\n\tfmt.Println(\"This is deleted\", deleted)\r\n\tdb.Delete(&review)\r\n\r\n\tjson.NewEncoder(w).Encode(&deleted)\r\n}", "title": "" }, { "docid": "1479c9c501fd9126c3b8e74c7336cfe8", "score": "0.4640166", "text": "func GetReleaseDetail(client catalogclient.Interface, namespace, name string) (*ReleaseDetails, error) {\n\tlog.Printf(\"Getting details of %s release in %s namespace\\n\", name, namespace)\n\trawRelease, err := client.CatalogControllerV1alpha1().Releases(namespace).Get(name, api.GetOptionsInCache)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tresultItems := make([]appCore.ResourceResult, 0, len(rawRelease.Status.Items))\n\tfor _, item := range rawRelease.Status.Items {\n\t\tresultItem := v1alpha1.ConvertToAppcore(item)\n\t\tresultItems = append(resultItems, resultItem)\n\t}\n\tresult := appCore.Result{\n\t\tItems: resultItems,\n\t}\n\n\tdetails := &ReleaseDetails{rawRelease, result}\n\treturn details, nil\n}", "title": "" }, { "docid": "131e748a4600aab0189ec1db5e4d90dc", "score": "0.46347764", "text": "func (*buildReviewModel) GetByName(name string) (v *BuildReview, err error) {\n\tv = &BuildReview{Name: name, Status: BuildReviewStatusTobe}\n\n\tif err = Ormer().Read(v, \"Name\", \"Status\"); err == nil {\n\t\treturn v, nil\n\t}\n\treturn nil, err\n}", "title": "" }, { "docid": "5fc0be1557829c6a0ce7ad5941c8965b", "score": "0.46315303", "text": "func TestreviewAuthenticated(t *testing.T) {\n\t// Create a response recorder\n\tw := httptest.NewRecorder()\n\n\t// Get a new router\n\tr := getRouter(true)\n\n\t// Set the token cookie to simulate an authenticated user\n\thttp.SetCookie(w, &http.Cookie{Name: \"token\", Value: \"123\"})\n\n\t// Define the route similar to its definition in the routes file\n\tr.GET(\"/review/view/:review_id\", getreview)\n\n\t// Create a request to send to the above route\n\treq, _ := http.NewRequest(\"GET\", \"/review/view/1\", nil)\n\treq.Header = http.Header{\"Cookie\": w.HeaderMap[\"Set-Cookie\"]}\n\n\t// Create the service and process the above request.\n\tr.ServeHTTP(w, req)\n\n\t// Test that the http status code is 200\n\tif w.Code != http.StatusOK {\n\t\tt.Fail()\n\t}\n\n\t// Test that the page title is \"review 1\"\n\t// You can carry out a lot more detailed tests using libraries that can\n\t// parse and process HTML pages\n\tp, err := ioutil.ReadAll(w.Body)\n\tif err != nil || strings.Index(string(p), \"<title>review 1</title>\") < 0 {\n\t\tt.Fail()\n\t}\n\n}", "title": "" }, { "docid": "a0f58dc185e3dd73eb2a9ae1c89d2480", "score": "0.4621448", "text": "func (ap *AnimeParser) getReviewID(veryBottomArea *goquery.Selection) int {\n\tidLink, _ := veryBottomArea.Find(\"a\").Attr(\"href\")\n\tid := utils.GetValueFromSplit(idLink, \"?id=\", 1)\n\treturn utils.StrToNum(id)\n}", "title": "" }, { "docid": "209c07e2166540dd5483893c6e6d9b2d", "score": "0.45959207", "text": "func (s *productService) Get(ctx context.Context, req *pb.GetRequest, resp *pb.ProductDetail) error {\n\tp, err := s.Repo.Get(ctx, req.Id)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tresp.Description = p.Description\n\tresp.Discount = p.Discount\n\tresp.Product = p.Product\n\n\treturn nil\n}", "title": "" }, { "docid": "b7769c5497ab8407caa59c7ad6f7a82f", "score": "0.45918506", "text": "func (mt *Review) Validate() (err error) {\n\tif mt.Comment != nil {\n\t\tif len(*mt.Comment) < 10 {\n\t\t\terr = goa.MergeErrors(err, goa.InvalidLengthError(`response.comment`, *mt.Comment, len(*mt.Comment), 10, true))\n\t\t}\n\t}\n\tif mt.Comment != nil {\n\t\tif len(*mt.Comment) > 200 {\n\t\t\terr = goa.MergeErrors(err, goa.InvalidLengthError(`response.comment`, *mt.Comment, len(*mt.Comment), 200, false))\n\t\t}\n\t}\n\tif mt.Rating != nil {\n\t\tif *mt.Rating < 1 {\n\t\t\terr = goa.MergeErrors(err, goa.InvalidRangeError(`response.rating`, *mt.Rating, 1, true))\n\t\t}\n\t}\n\tif mt.Rating != nil {\n\t\tif *mt.Rating > 5 {\n\t\t\terr = goa.MergeErrors(err, goa.InvalidRangeError(`response.rating`, *mt.Rating, 5, false))\n\t\t}\n\t}\n\treturn\n}", "title": "" }, { "docid": "1f28bb4dad912f18be6b25704d9bfa8a", "score": "0.45748654", "text": "func NewAccessReviewReviewer()(*AccessReviewReviewer) {\n m := &AccessReviewReviewer{\n Entity: *NewEntity(),\n }\n return m\n}", "title": "" }, { "docid": "67406a6ae23d416cd63190bcfeeeba71", "score": "0.45739874", "text": "func postReviewHandler(formatter *render.Render) http.HandlerFunc {\n\n\treturn func(w http.ResponseWriter, req *http.Request) {\n\t\tvar m Review\n\t\t_ = json.NewDecoder(req.Body).Decode(&m)\n\t\tfmt.Println(\"Review is: \", m.ItemName, \" \", m.Reviews)\n\t\tsession, err := mgo.Dial(mongodb_server)\n\t\tif err != nil {\n\t\t\tpanic(err)\n\t\t}\n\n\t\tif err != nil {\n\t\t\tfmt.Println(\"Reviews API (Post) - Unable to connect to MongoDB during read operation\")\n\t\t\tpanic(err)\n\t\t}\n\t\tdefer session.Close()\n\t\tsession.SetMode(mgo.Monotonic, true)\n\t\tc := session.DB(mongodb_database).C(mongodb_collection)\n\t\tentry := Review{\n\t\t\tItemName: m.ItemName,\n\t\t\tReviews: m.Reviews,\n\t\t}\n\t\terr = c.Insert(entry)\n\t\tif err != nil {\n\t\t\tfmt.Println(\"Error while adding reviews: \", err)\n\t\t\tformatter.JSON(w, http.StatusInternalServerError, struct{ Response error }{err})\n\t\t} else {\n\t\t\tformatter.JSON(w, http.StatusOK, struct{ Response string }{\"Review added\"})\n\t\t}\n\t}\n}", "title": "" }, { "docid": "206c23625609118caa8fa53f8f086090", "score": "0.45695984", "text": "func GetRatingDetails(id int) Rating {\n\tdb, err := sql.Open(config.Mysql, config.Dbconnection)\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\tdefer db.Close()\n\n\tsql := \"SELECT id, valuation_id, valuation_name, user_id, description, date_valuation, given_score, staff_id, comments FROM view_rating WHERE id=?\"\n\tresults, err := db.Query(sql, id)\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tvar item Rating\n\tfor results.Next() {\n\t\terr = results.Scan(&item.ID, &item.ValuationID, &item.ValuationName, &item.UserID, &item.Description, &item.DateValuation, &item.GivenScore, &item.StaffID, &item.Comments)\n\t\tif err != nil {\n\t\t\tpanic(err.Error())\n\t\t}\n\t}\n\treturn item\n}", "title": "" }, { "docid": "21d6d4439ae8ca7a38741540d3148a59", "score": "0.45630643", "text": "func DeleteReview(ReviewID int64) Review {\n\tvar review Review\n\tdb.Where(\"ReviewID = ?\", ReviewID).Delete(review)\n\treturn review\n\n}", "title": "" }, { "docid": "11806cc85c4f88a8c053d2df2c7c0814", "score": "0.45555598", "text": "func (o *WatchlistScreeningIndividualReviewCreateRequest) GetComment() string {\n\tif o == nil || o.Comment.Get() == nil {\n\t\tvar ret string\n\t\treturn ret\n\t}\n\treturn *o.Comment.Get()\n}", "title": "" }, { "docid": "09d2e595657265e65b18cfee64594334", "score": "0.45522666", "text": "func (client *ClientImpl) GetComment(ctx context.Context, args GetCommentArgs) (*Comment, error) {\n\trouteValues := make(map[string]string)\n\tif args.Project != nil && *args.Project != \"\" {\n\t\trouteValues[\"project\"] = *args.Project\n\t}\n\tif args.RepositoryId == nil || *args.RepositoryId == \"\" {\n\t\treturn nil, &azuredevops.ArgumentNilOrEmptyError{ArgumentName: \"args.RepositoryId\"}\n\t}\n\trouteValues[\"repositoryId\"] = *args.RepositoryId\n\tif args.PullRequestId == nil {\n\t\treturn nil, &azuredevops.ArgumentNilError{ArgumentName: \"args.PullRequestId\"}\n\t}\n\trouteValues[\"pullRequestId\"] = strconv.Itoa(*args.PullRequestId)\n\tif args.ThreadId == nil {\n\t\treturn nil, &azuredevops.ArgumentNilError{ArgumentName: \"args.ThreadId\"}\n\t}\n\trouteValues[\"threadId\"] = strconv.Itoa(*args.ThreadId)\n\tif args.CommentId == nil {\n\t\treturn nil, &azuredevops.ArgumentNilError{ArgumentName: \"args.CommentId\"}\n\t}\n\trouteValues[\"commentId\"] = strconv.Itoa(*args.CommentId)\n\n\tlocationId, _ := uuid.Parse(\"965a3ec7-5ed8-455a-bdcb-835a5ea7fe7b\")\n\tresp, err := client.Client.Send(ctx, http.MethodGet, locationId, \"5.1\", routeValues, nil, nil, \"\", \"application/json\", nil)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tvar responseValue Comment\n\terr = client.Client.UnmarshalBody(resp, &responseValue)\n\treturn &responseValue, err\n}", "title": "" }, { "docid": "ec474d5952f3b77f41eb05b8a6662234", "score": "0.45281243", "text": "func (r *RiskDetectionRequest) Get(ctx context.Context) (resObj *RiskDetection, 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}", "title": "" }, { "docid": "d24b5885947e9f85a9325dccbfb7fcf8", "score": "0.45224637", "text": "func TestreviewUnauthenticated(t *testing.T) {\n\tr := getRouter(true)\n\n\t// Define the route similar to its definition in the routes file\n\tr.GET(\"/review/view/:review_id\", getreview)\n\n\t// Create a request to send to the above route\n\treq, _ := http.NewRequest(\"GET\", \"/review/view/1\", nil)\n\n\ttestHTTPResponse(t, r, req, func(w *httptest.ResponseRecorder) bool {\n\t\t// Test that the http status code is 200\n\t\tstatusOK := w.Code == http.StatusOK\n\n\t\t// Test that the page title is \"review 1\"\n\t\t// You can carry out a lot more detailed tests using libraries that can\n\t\t// parse and process HTML pages\n\t\tp, err := ioutil.ReadAll(w.Body)\n\t\tpageOK := err == nil && strings.Index(string(p), \"<title>review 1</title>\") > 0\n\n\t\treturn statusOK && pageOK\n\t})\n}", "title": "" }, { "docid": "5efef990b6e4865073cc655f9960ed60", "score": "0.4521725", "text": "func CreateReview(opts models.CreateReviewOptions) (*models.Review, error) {\n\treview, err := models.CreateReview(opts)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tvar reviewHookType models.HookEventType\n\n\tswitch opts.Type {\n\tcase models.ReviewTypeApprove:\n\t\treviewHookType = models.HookEventPullRequestApproved\n\tcase models.ReviewTypeComment:\n\t\treviewHookType = models.HookEventPullRequestComment\n\tcase models.ReviewTypeReject:\n\t\treviewHookType = models.HookEventPullRequestRejected\n\tdefault:\n\t\t// unsupported review webhook type here\n\t\treturn review, nil\n\t}\n\n\tpr := opts.Issue.PullRequest\n\n\tif err := pr.LoadIssue(); err != nil {\n\t\treturn nil, err\n\t}\n\n\tmode, err := models.AccessLevel(opts.Issue.Poster, opts.Issue.Repo)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tif err := models.PrepareWebhooks(opts.Issue.Repo, reviewHookType, &api.PullRequestPayload{\n\t\tAction: api.HookIssueSynchronized,\n\t\tIndex: opts.Issue.Index,\n\t\tPullRequest: pr.APIFormat(),\n\t\tRepository: opts.Issue.Repo.APIFormat(mode),\n\t\tSender: opts.Reviewer.APIFormat(),\n\t}); err != nil {\n\t\treturn nil, err\n\t}\n\tgo models.HookQueue.Add(opts.Issue.Repo.ID)\n\n\treturn review, nil\n}", "title": "" }, { "docid": "ec047bb23bb26511d07f0f7c74566bc8", "score": "0.45099765", "text": "func (a UserApiService) GetRideReceipt(id string) (RideReceipt, *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 RideReceipt\n\t)\n\n\t// create path and map variables\n\tlocalVarPath := \"https://api.lyft.com/v1/rides/{id}/receipt\"\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"id\"+\"}\", fmt.Sprintf(\"%v\", id), -1)\n\n\tlocalVarHeaderParams := make(map[string]string)\n\tlocalVarQueryParams := url.Values{}\n\tlocalVarFormParams := url.Values{}\n\n\n\t// to determine the Content-Type header\n\tlocalVarHttpContentTypes := []string{ \"application/json\", }\n\n\t// set Content-Type header\n\tlocalVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes)\n\tif localVarHttpContentType != \"\" {\n\t\tlocalVarHeaderParams[\"Content-Type\"] = localVarHttpContentType\n\t}\n\n\t// to determine the Accept header\n\tlocalVarHttpHeaderAccepts := []string{\n\t\t\"application/json\",\n\t\t}\n\n\t// set Accept header\n\tlocalVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts)\n\tif localVarHttpHeaderAccept != \"\" {\n\t\tlocalVarHeaderParams[\"Accept\"] = localVarHttpHeaderAccept\n\t}\n\n\t r, err := a.client.prepareRequest(localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes)\n\t if err != nil {\n\t\t return successPayload, nil, err\n\t }\n\n\t localVarHttpResponse, err := a.client.callAPI(r)\n\t if err != nil || localVarHttpResponse == nil {\n\t\t return successPayload, localVarHttpResponse, err\n\t }\n\t defer localVarHttpResponse.Body.Close()\n\t if localVarHttpResponse.StatusCode >= 300 {\n\t\treturn successPayload, localVarHttpResponse, errors.New(localVarHttpResponse.Status)\n\t }\n\t\n\tif err = json.NewDecoder(localVarHttpResponse.Body).Decode(&successPayload); err != nil {\n\t \treturn successPayload, localVarHttpResponse, err\n\t}\n\n\n\treturn successPayload, localVarHttpResponse, err\n}", "title": "" }, { "docid": "b296db215860e6499ce6f8d6f01c9e99", "score": "0.4500935", "text": "func (s *Store) Get(req *http.Request) *Representation {\n\ts.init()\n\n\ts.RLock()\n\tdefer s.RUnlock()\n\n\tresKey := NewResourceKey(req)\n\tres, ok := s.Resources[resKey]\n\tif !ok {\n\t\treturn nil\n\t}\n\n\trepKey := NewRepresentationKey(res, req)\n\trep, ok := res.Representations[repKey]\n\tif !ok {\n\t\treturn nil\n\t}\n\n\trep.Lock()\n\tdefer rep.Unlock()\n\trep.LastUsedTime = time.Now()\n\n\tlog.WithFields(log.Fields{\n\t\t\"id\": rep.ID,\n\t}).Info(\"Get a representation\")\n\n\treturn rep.clone()\n}", "title": "" }, { "docid": "c6f830045e542a701a27dbbd2db9ce1c", "score": "0.44658908", "text": "func (svr *Server) GetMovie(ctx context.Context, req *pb.GetMovieRequest) (*pb.GetMovieResponse, error) {\n\ttconst := req.GetTconst()\n\tif len(tconst) == 0 {\n\t\tlogger.Error().Printf(\"get movie failed: null values\\n\")\n\t\treturn nil, fmt.Errorf(\"null values\")\n\t}\n\tsr := mongoColl.FindOne(\n\t\tctx,\n\t\tbson.M{\"tconst\": tconst},\n\t)\n\tif sr.Err() == mongo.ErrNoDocuments {\n\t\tlogger.Error().Printf(\"get movie{tconst=%s} failed: %v\\n\", tconst, sr.Err())\n\t\treturn nil, fmt.Errorf(\"get movie{tconst=%s}: not found\", tconst)\n\t}\n\tvar movie *pb.Movie\n\terr := sr.Decode(movie)\n\tif err != nil {\n\t\tlogger.Error().Printf(\"get movie{tconst=%s} failed: %v\\n\", tconst, err)\n\t\treturn nil, fmt.Errorf(\"get movie{tconst=%s}: decode failed\", tconst)\n\t}\n\tlogger.Debug().Printf(\"get movie{tconst=%s} successfully\\n\", tconst)\n\treturn &pb.GetMovieResponse{\n\t\tMovie: movie,\n\t}, nil\n}", "title": "" } ]
e4f942fc5fd1b3eca9727fd0227b9353
New create a new CSVStream
[ { "docid": "2978bd4858e889b6b1144e4ffeb8a93d", "score": "0.7810945", "text": "func New(f string, cl string) (*CSVStream, error) {\n\n\til, err := intList.New(cl)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tc := CSVStream{\n\t\tfile: f,\n\t\tcolumns: il,\n\t}\n\n\treturn &c, nil\n}", "title": "" } ]
[ { "docid": "9490070e2bf90d258cc31d2c4ffd44c0", "score": "0.64216703", "text": "func newCsv(nomfic string, path string) *fichierCsv {\n\tif _, err := os.Stat(nomfic); os.IsNotExist(err) {\n\t\tlog.Fatal(\"Erreur newCsv \", err)\n\t}\n\tfile := &fichierCsv{}\n\tfile.nom = nomfic\n\tfile.path = path\n\tfile.data = make(map[int]couple)\n\tfile.pac = make(map[string]*fichierPac)\n\tif err := file.LoadCsvFile(); err != nil {\n\t\tlog.Println(\"Error LoadCsvFile:\", err)\n\t}\n\treturn file\n}", "title": "" }, { "docid": "d4b04067ede2d710a6b172aca3312b3a", "score": "0.6316431", "text": "func NewCsv() *Csv {\n\treturn &Csv{repository.Logs()}\n}", "title": "" }, { "docid": "2567525b53f68f12dd7df100e978462e", "score": "0.60820115", "text": "func (e *estimator) streamFromCSV(in *csv.Reader) func() (interface{}, error) {\n\treturn func() (interface{}, error) {\n\t\trecord, err := in.Read()\n\t\treturn Line(record), err\n\t}\n}", "title": "" }, { "docid": "6c90be2c292cb815ab4fddb1b9d788d5", "score": "0.6006408", "text": "func New(filename string, config ...Config) *CSV {\n\tcsv := &CSV{Filename: filename}\n\tfor _, cfg := range config {\n\t\tcsv.config = cfg\n\t}\n\treturn csv\n}", "title": "" }, { "docid": "11b28c85ccc32cc4dc995a022826a25c", "score": "0.59081626", "text": "func NewCSV(options CSVOptions) CSV {\n\tif options.ArrayDelimiter == \"\" {\n\t\toptions.ArrayDelimiter = \".\"\n\t}\n\tif options.IndexPos == 0 {\n\t\toptions.IndexPos = 1\n\t}\n\tif options.StructTag == \"\" {\n\t\toptions.StructTag = \"json\"\n\t}\n\treturn &csv{\n\t\toptions: options,\n\t}\n}", "title": "" }, { "docid": "327a2823fb5ae6535d1abefce1381f16", "score": "0.58948123", "text": "func NewCsv(floc string) (FileReader, error) {\n\tf, err := os.Open(floc)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn &rcsv{\n\t\tf: f,\n\t\treader: csv.NewReader(f),\n\t}, nil\n}", "title": "" }, { "docid": "4e2b4d3e1821b5ec8df2cced61650145", "score": "0.5631907", "text": "func NewStream(rw io.ReadWriter) *Stream { return &Stream{raw: rw} }", "title": "" }, { "docid": "a8264fc04d74cff31cd3672529be16c5", "score": "0.56206506", "text": "func New(ctx context.Context, raw []byte, config Config) (*CSV, error) {\n\tlogger := zephyrus.NewLoggerFromContext(ctx)\n\tvar r *regexp.Regexp\n\tvar replacement string\n\treplaceWith := config.ReplaceWith\n\tif replaceWith != \"\" {\n\t\ts := strings.Split(replaceWith, replaceSeparator)\n\t\tif len(s) != 2 {\n\t\t\treturn nil, errSearchReplace\n\t\t}\n\t\tvar err error\n\t\tpattern := s[0]\n\t\tlogger.WithField(\"pattern\", pattern).Info(\"Using search pattern\")\n\t\tr, err = regexp.Compile(pattern)\n\t\tif err != nil {\n\t\t\treturn nil, errSearchReplace\n\t\t}\n\t\treplacement = s[1]\n\t}\n\treader := csv.NewReader(strings.NewReader(string(raw)))\n\tif config.AllowMalformed {\n\t\treader.FieldsPerRecord = -1 // This allows variable number of columns per row.\n\t}\n\treadValues, err := reader.ReadAll()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tif len(readValues) < 2 {\n\t\treturn nil, errEmptyCSV\n\t}\n\n\tvalues := make([]map[string]string, 0)\n\tfor i := 1; i < len(readValues); i++ {\n\t\tkeys := readValues[0]\n\t\tvalue := make(map[string]string)\n\t\tfor j := 0; j < len(keys); j++ {\n\t\t\tnoOfcolumns := len(readValues[i])\n\t\t\tif j >= noOfcolumns {\n\t\t\t\tvalue[keys[j]] = config.FillEmptyWith\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\t// Find and replace if enabled\n\t\t\tif r != nil {\n\t\t\t\tval := r.ReplaceAllString(readValues[i][j], replacement)\n\t\t\t\tif val != \"\" {\n\t\t\t\t\tvalue[keys[j]] = val\n\t\t\t\t\tcontinue\n\t\t\t\t}\n\t\t\t}\n\t\t\tvalue[keys[j]] = readValues[i][j]\n\t\t}\n\t\tvalues = append(values, value)\n\t}\n\treturn &CSV{\n\t\tvalues: values,\n\t}, nil\n}", "title": "" }, { "docid": "82463ecff88f8b0b8f6af148d8e00560", "score": "0.55832374", "text": "func Stream(reader io.Reader, header bool, terminator rune, logger *zl.Logger) (<-chan []string, error) {\n\tout := make(chan []string)\n\n\tgo func() {\n\t\tdefer close(out)\n\t\tif rr, ok := reader.(io.ReadCloser); ok {\n\t\t\tdefer rr.Close()\n\t\t}\n\n\t\tr := csv.NewReader(reader)\n\t\tr.Comma = terminator\n\n\t\tfor i := 0; ; i++ {\n\t\t\trow, err := r.Read()\n\t\t\tif err == io.EOF {\n\t\t\t\tbreak\n\t\t\t}\n\n\t\t\tif err != nil {\n\t\t\t\tlogger.Error().\n\t\t\t\t\tInt(\"line\", i).\n\t\t\t\t\tErr(err).\n\t\t\t\t\tStrs(\"rows\", row).\n\t\t\t\t\tMsg(\"failed reading line\")\n\t\t\t\tcontinue\n\t\t\t}\n\n\t\t\tif header && i == 0 {\n\t\t\t\tcontinue\n\t\t\t}\n\n\t\t\tout <- row\n\t\t}\n\t}()\n\n\treturn out, nil\n}", "title": "" }, { "docid": "8cbbf6dd602ed96bea9e35ee7a578586", "score": "0.5559469", "text": "func NewStream(it Iterator) Stream {\n\treturn Stream{it: it}\n}", "title": "" }, { "docid": "c28807b7c87d547bc194590fc4551fc5", "score": "0.555388", "text": "func NewReader(r io.Reader) *Reader {\n\treturn &Reader{Reader: csv.NewReader(r)}\n}", "title": "" }, { "docid": "15e34748489e2cc96d9fe1069d355c93", "score": "0.54344624", "text": "func newChunkReader() *chunkReader {\n\treturn &chunkReader{state: newRow}\n}", "title": "" }, { "docid": "4dc366ce8bcebc53cde8b512f78c725e", "score": "0.5328242", "text": "func newIOStream(ctx context.Context, d dataStream) *ioStream {\n\tctx, cancel := context.WithCancel(ctx)\n\treturn &ioStream{\n\t\tdataSafeStream: dataSafeStream{\n\t\t\tdataStream: d,\n\t\t},\n\t\tcancel: cancel,\n\t\tdoneCh: ctx.Done(),\n\t}\n}", "title": "" }, { "docid": "0761b8438531df2ea4f0a592c7e4d113", "score": "0.53278506", "text": "func NewRecordChan(f io.Reader, comma rune, lquotes bool, skip int) <-chan struct {\n\tRecord []string\n\tError error\n} {\n\tvar (\n\t\tpipe = make(chan struct {\n\t\t\tRecord []string\n\t\t\tError error\n\t\t})\n\t\tmakeResult = func(rec []string, err error) struct {\n\t\t\tRecord []string\n\t\t\tError error\n\t\t} {\n\t\t\treturn struct {\n\t\t\t\tRecord []string\n\t\t\t\tError error\n\t\t\t}{\n\t\t\t\trec,\n\t\t\t\terr,\n\t\t\t}\n\t\t}\n\t)\n\n\tgo func() {\n\t\tdefer func() { close(pipe) }()\n\n\t\tr := csv.NewReader(f)\n\t\tr.Comma = comma\n\t\tr.LazyQuotes = lquotes\n\n\t\tvar n int\n\t\tfor {\n\t\t\trec, err := r.Read()\n\t\t\tif err != nil {\n\t\t\t\tif err == io.EOF {\n\t\t\t\t\tbreak\n\t\t\t\t}\n\t\t\t\tpipe <- makeResult(nil, err)\n\t\t\t\tcontinue\n\t\t\t}\n\n\t\t\tn++\n\t\t\tif n <= skip {\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tpipe <- makeResult(rec, nil)\n\t\t}\n\t}()\n\n\treturn pipe\n}", "title": "" }, { "docid": "d0f4decacb7ed97d3f925e878030dacb", "score": "0.5259848", "text": "func newStream(StreamID protocol.StreamID,\n\tonData func(),\n\tonReset func(protocol.StreamID, protocol.ByteCount),\n\tflowControlManager flowcontrol.FlowControlManager) *stream {\n\ts := &stream{\n\t\tonData: onData,\n\t\tonReset: onReset,\n\t\tstreamID: StreamID,\n\t\tflowControlManager: flowControlManager,\n\t\tframeQueue: newStreamFrameSorter(),\n\t\treadChan: make(chan struct{}, 1),\n\t\twriteChan: make(chan struct{}, 1),\n\t}\n\ts.ctx, s.ctxCancel = context.WithCancel(context.Background())\n\treturn s\n}", "title": "" }, { "docid": "d7cc47b518b560ee0a25740d8a2b5dbf", "score": "0.524097", "text": "func NewCSVUserLoginReader(r io.Reader, ch chan<- UserLogin) error {\n\tcr := csv.NewReader(r)\n\tfor {\n\t\trecord, err := cr.Read()\n\t\tif err == io.EOF {\n\t\t\tbreak\n\t\t} else if err != nil {\n\t\t\treturn err\n\t\t}\n\t\tch <- UserLogin{\n\t\t\tID: record[0],\n\t\t\tChecksum: fromStringPointer(record[1]),\n\t\t\tCustomerID: record[2],\n\t\t\tUserID: record[3],\n\t\t\tBrowser: fromStringPointer(record[4]),\n\t\t\tDate: fromCSVInt64(record[5]),\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "aa0eb6ee67de575aa4503386b28534d2", "score": "0.5213109", "text": "func NewCSVRecord() CSVRecord {\n\tnewCSVRecord := make(map[string]string)\n\treturn newCSVRecord\n}", "title": "" }, { "docid": "d6ce3457eac677f49a74bd909c3dcd4b", "score": "0.51557773", "text": "func (factory *streamFactory) New(net, transport gopacket.Flow) tcpassembly.Stream {\n\tlog.Printf(\"new stream %v:%v->%v:%v started\", net.Src(), transport.Src(),\n\t\tnet.Dst(), transport.Dst())\n\ts := &Stream{\n\t\tnet: net,\n\t\ttransport: transport,\n\t\tstart: time.Now(),\n\t}\n\t//s.end = s.start\n\t// ReaderStream implements tcpassembly.Stream, so we can return a pointer to it.\n\treturn s\n}", "title": "" }, { "docid": "a6872f974879f7c50496d716f73c642f", "score": "0.51404124", "text": "func NewReader(r io.Reader) *Reader {\n\trr := transform.NewReader(r, japanese.ShiftJIS.NewDecoder())\n\treturn &Reader{\n\t\treader: csv.NewReader(rr),\n\t\tIgnoreHeader: true,\n\t}\n}", "title": "" }, { "docid": "4e944f87934df8032f4afe4de1c2c375", "score": "0.513738", "text": "func csvtabOpen(tls *libc.TLS, p uintptr, ppCursor uintptr) int32 { /* csv.c:705:12: */\n\tvar pTab uintptr = p\n\tvar pCur uintptr\n\tvar nByte size_t\n\tnByte = (uint64(unsafe.Sizeof(CsvCursor{})) + ((uint64(unsafe.Sizeof(uintptr(0))) + uint64(unsafe.Sizeof(int32(0)))) * uint64((*CsvTable)(unsafe.Pointer(pTab)).FnCol)))\n\tpCur = sqlite3.Xsqlite3_malloc64(tls, uint64(nByte))\n\tif pCur == uintptr(0) {\n\t\treturn SQLITE_NOMEM\n\t}\n\tlibc.Xmemset(tls, pCur, 0, nByte)\n\t(*CsvCursor)(unsafe.Pointer(pCur)).FazVal = (pCur + 1*296)\n\t(*CsvCursor)(unsafe.Pointer(pCur)).FaLen = ((*CsvCursor)(unsafe.Pointer(pCur)).FazVal + uintptr((*CsvTable)(unsafe.Pointer(pTab)).FnCol)*8)\n\t*(*uintptr)(unsafe.Pointer(ppCursor)) = (pCur /* &.base */)\n\tif csv_reader_open(tls, (pCur+8 /* &.rdr */), (*CsvTable)(unsafe.Pointer(pTab)).FzFilename, (*CsvTable)(unsafe.Pointer(pTab)).FzData) != 0 {\n\t\tcsv_xfer_error(tls, pTab, (pCur + 8 /* &.rdr */))\n\t\treturn SQLITE_ERROR\n\t}\n\treturn SQLITE_OK\n}", "title": "" }, { "docid": "0ff06151e6fda3ebb64e94001056e98a", "score": "0.5107883", "text": "func CreateCSV(ctx context.Context, maxLines int, output, tableName string, recordChan <-chan []string) {\n\ttitles := <-recordChan\n\tvar recordCounter, fileCounter int\n\tvar csvFile *os.File\n\tvar csvWriter *csv.Writer\n\tvar fileOpen bool\n\tvar fileName string\n\n\toutput = getCorrectDirPath(output, tableName)\n\tif _, err := os.Stat(output); os.IsNotExist(err) {\n\t\tos.MkdirAll(output, 0777)\n\t}\n\tfmt.Println(color.BlueString(output))\n\n\tcheckEqual := func() bool {\n\t\tif recordCounter == maxLines {\n\t\t\tfileOpen = false\n\t\t\tfileCounter++\n\t\t\trecordCounter = 0\n\n\t\t\tcsvFile.Close()\n\t\t\tcsvWriter.Flush()\n\t\t\tif err := csvWriter.Error(); err != nil {\n\t\t\t\tprintError(err.Error(), tableName)\n\t\t\t\treturn true\n\t\t\t}\n\t\t}\n\t\treturn false\n\t}\n\n\tisRunning := true\n\tfor isRunning {\n\t\tselect {\n\t\tcase <-ctx.Done():\n\t\t\treturn\n\t\tcase record, ok := <-recordChan:\n\t\t\tif ok {\n\t\t\t\tif fileOpen {\n\t\t\t\t\tif err := csvWriter.Write(record); err != nil {\n\t\t\t\t\t\tprintError(err.Error(), tableName)\n\t\t\t\t\t\treturn\n\t\t\t\t\t}\n\t\t\t\t\trecordCounter++\n\t\t\t\t\tif checkEqual() {\n\t\t\t\t\t\treturn\n\t\t\t\t\t}\n\t\t\t\t} else {\n\t\t\t\t\tfileName = fmt.Sprintf(\"%s/%d.csv\", output, fileCounter)\n\t\t\t\t\tcsvFile, err := os.Create(fileName)\n\t\t\t\t\tif err != nil {\n\t\t\t\t\t\tprintError(err.Error(), tableName)\n\t\t\t\t\t\treturn\n\t\t\t\t\t}\n\n\t\t\t\t\tcsvWriter = csv.NewWriter(csvFile)\n\t\t\t\t\tcsvWriter.WriteAll([][]string{titles, record}) // добавление заголовка в начало файла + добавление первой записи\n\t\t\t\t\tif err := csvWriter.Error(); err != nil {\n\t\t\t\t\t\tprintError(err.Error(), tableName)\n\t\t\t\t\t\treturn\n\t\t\t\t\t}\n\n\t\t\t\t\trecordCounter++\n\t\t\t\t\tfileOpen = true\n\t\t\t\t\tif checkEqual() {\n\t\t\t\t\t\treturn\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tisRunning = false\n\t\t\t\tif fileOpen {\n\t\t\t\t\tfileOpen = false\n\n\t\t\t\t\tcsvFile.Close()\n\t\t\t\t\tcsvWriter.Flush()\n\t\t\t\t\tif err := csvWriter.Error(); err != nil {\n\t\t\t\t\t\tprintError(err.Error(), tableName)\n\t\t\t\t\t\treturn\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n}", "title": "" }, { "docid": "2f9c85b4e9d6da7ba83e3ac56b799750", "score": "0.5072478", "text": "func New(namedColumns []string, columnNamesRow []string) (CsvColumnMap, error) {\n\tinverseMap := make(map[string]int, len(columnNamesRow))\n\tfor idx, name := range columnNamesRow {\n\t\tinverseMap[name] = idx\n\t}\n\n\tvar resultMap CsvColumnMap\n\n\tentries := make([]csvNamedColumn, len(namedColumns))\n\tfor idx, name := range namedColumns {\n\t\tcolumnIndex, keyExists := inverseMap[name]\n\t\tif keyExists {\n\t\t\tentries[idx] = csvNamedColumn{columnIndex, name}\n\t\t} else {\n\t\t\tlog.Println(\"Could not find column \", name)\n\t\t\treturn resultMap, errors.New(\"no such column\")\n\t\t}\n\t}\n\n\treturn CsvColumnMap{entries: entries}, nil\n}", "title": "" }, { "docid": "5c28644d41e1f9368e6f0b2d3a49ae18", "score": "0.50582546", "text": "func NewCSVHeader() CSVHeader {\n\tnewCSVHeader := make(map[int]string)\n\treturn newCSVHeader\n}", "title": "" }, { "docid": "bc435682661851e21cf896327b6f3bce", "score": "0.5055107", "text": "func newStream(name, subject string, config *proto.StreamConfig, creationTime time.Time,\n\tsrvConfig *Config) *stream {\n\n\ts := &stream{\n\t\tname: name,\n\t\tsubject: subject,\n\t\tconfig: config,\n\t\tpartitions: make(map[int32]*partition),\n\t\tcreationTime: creationTime,\n\t}\n\tif isReservedStream(name) {\n\t\tapplyReservedStreamOverrides(s, srvConfig)\n\t}\n\treturn s\n}", "title": "" }, { "docid": "ef1f56ff84a868b1ab99bf7fd606950d", "score": "0.50540906", "text": "func NewActivity(metadata *activity.Metadata) activity.Activity {\n\taCSVParserActivity := &CSVParserActivity{\n\t\tmetadata: metadata,\n\t\tworkingDatas: make(map[string]*CSVParserWorkingData),\n\t}\n\treturn aCSVParserActivity\n}", "title": "" }, { "docid": "f8363caa6128307d828463781027bb64", "score": "0.50461626", "text": "func newBaseStream(\n\tctx context.Context,\n\tcancelCtx func(),\n\tstream *webrtcpb.Stream,\n\tonDone func(id uint64),\n\tlogger golog.Logger,\n) *baseStream {\n\tbs := baseStream{\n\t\tctx: ctx,\n\t\tcancel: cancelCtx,\n\t\tstream: stream,\n\t\tonDone: onDone,\n\t\tlogger: logger,\n\t}\n\tbs.msgCh = make(chan []byte, 1)\n\treturn &bs\n}", "title": "" }, { "docid": "89e8f6cfca52ab7088a30d224484c21d", "score": "0.50435376", "text": "func newStream(bufsize int, replay bool) *Stream {\n\treturn &Stream{\n\t\tAutoReplay: replay,\n\t\tsubscribers: make([]*Subscriber, 0),\n\t\tregister: make(chan *Subscriber),\n\t\tderegister: make(chan *Subscriber),\n\t\tevent: make(chan *Event, bufsize),\n\t\tquit: make(chan bool),\n\t\tEventlog: make(EventLog, 0),\n\t}\n}", "title": "" }, { "docid": "9f2d5567d841453ac1637657a55efe7e", "score": "0.504219", "text": "func (n *NeptuneDB) StreamCSVRows(ctx context.Context, instanceID, filterID string, filter *observation.DimensionFilters, limit *int) (observation.StreamRowReader, error) {\n\tif filter == nil {\n\t\treturn nil, ErrInvalidFilter\n\t}\n\n\tq := fmt.Sprintf(query.GetInstanceHeaderPart, instanceID)\n\theaderReader, err := n.Pool.OpenStreamCursor(ctx, q, nil, nil)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tq = buildObservationsQuery(instanceID, filter)\n\tq += query.GetObservationValuesPart\n\n\tif limit != nil {\n\t\tq += fmt.Sprintf(query.LimitPart, *limit)\n\t}\n\n\tobservationReader, err := n.Pool.OpenStreamCursor(ctx, q, nil, nil)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn observation.NewCompositeRowReader(headerReader, observationReader), nil\n}", "title": "" }, { "docid": "38eab1cf34f4f5502d3fe84df9a50839", "score": "0.50391203", "text": "func New(t Transport, h ElementHandler, mode Mode) Stream {\n\treturn Stream{t: t, h: h, mode: mode}\n}", "title": "" }, { "docid": "b680919de6fc2cea2e846707bafaf2e5", "score": "0.49954486", "text": "func NewReadIter(file *os.File, ps interface{}) (this *ReadIter, err error) {\n\trdr := csv.NewReader(file)\n\t// options are available at:\n\t// http://golang.org/src/pkg/encoding/csv/reader.go?s=3213:3671#L94\n\trdr.Comma = ','\n\n\tthis = new(ReadIter)\n\tthis.Line = 1\n\tthis.Headers, err = rdr.Read()\n\tthis.Reader = rdr\n\tif err != nil {\n\t\tthis = nil\n\t\treturn\n\t}\n\tst := reflect.TypeOf(ps).Elem()\n\tsv := reflect.ValueOf(ps).Elem()\n\tnf := st.NumField()\n\t// if nf != len(this.Headers) {\n\t// \treturn nil, &FieldMismatch{nf, len(this.Headers)}\n\t// }\n\tthis.kinds = make([]int, nf)\n\tthis.tags = make([]int, nf)\n\tthis.fields = make([]reflect.Value, nf)\n\tfor i := 0; i < nf; i++ {\n\t\tf := st.Field(i)\n\n\t\tval := sv.Field(i)\n\t\t// get the corresponding field name and look it up in the headers\n\t\ttag := f.Tag.Get(\"field\")\n\t\tif len(tag) == 0 {\n\t\t\ttag = f.Name\n\t\t\tif strings.Contains(tag, \"_\") {\n\t\t\t\ttag = strings.Replace(tag, \"_\", \" \", -1)\n\t\t\t}\n\t\t}\n\n\t\treqTag := f.Tag.Get(\"required\")\n\t\tfmt.Printf(\"isRequired: %v\\n\", reqTag)\n\n\t\tisRequired, parseErr := strconv.ParseBool(reqTag)\n\t\tif parseErr != nil {\n\t\t\terr = errors.New(\"Unable to parse required tag \" + reqTag)\n\t\t}\n\n\t\titag := -1\n\t\tfor k, h := range this.Headers {\n\t\t\tif h == tag {\n\t\t\t\titag = k\n\t\t\t\tbreak\n\t\t\t}\n\t\t}\n\n\t\tif itag == -1 && isRequired {\n\t\t\terr = errors.New(\"cannot find this field \" + tag)\n\t\t\tthis = nil\n\t\t\treturn\n\t\t}\n\n\t\tkind := none_k\n\t\tKind := f.Type.Kind()\n\t\t// this is necessary because Kind can't tell distinguish between a primitive type\n\t\t// and a type derived from it. We're looking for a Value interface defined on\n\t\t// the pointer to this value\n\t\t_, ok := val.Addr().Interface().(Value)\n\t\tif ok {\n\t\t\tval = val.Addr()\n\t\t\tkind = value_k\n\t\t} else {\n\t\t\tswitch Kind {\n\t\t\tcase reflect.Int, reflect.Int16, reflect.Int8, reflect.Int32, reflect.Int64:\n\t\t\t\tkind = int_k\n\t\t\tcase reflect.Uint, reflect.Uint16, reflect.Uint8, reflect.Uint32, reflect.Uint64:\n\t\t\t\tkind = uint_k\n\t\t\tcase reflect.Float32, reflect.Float64:\n\t\t\t\tkind = float_k\n\t\t\tcase reflect.String:\n\t\t\t\tkind = string_k\n\t\t\tdefault:\n\t\t\t\tkind = value_k\n\t\t\t\t_, ok := val.Interface().(Value)\n\t\t\t\tif !ok {\n\t\t\t\t\terr = errors.New(\"cannot convert this type \")\n\t\t\t\t\tthis = nil\n\t\t\t\t\treturn\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tif itag >= 0 {\n\t\t\tthis.kinds[i] = kind\n\t\t\tthis.tags[i] = itag\n\t\t\tthis.fields[i] = val\n\t\t}\n\n\t}\n\treturn\n}", "title": "" }, { "docid": "15aaaac35307d25a496efb1556e25735", "score": "0.49797964", "text": "func csv_reader_open(tls *libc.TLS, p uintptr, zFilename uintptr, zData uintptr) int32 { /* csv.c:122:12: */\n\tbp := tls.Alloc(8)\n\tdefer tls.Free(8)\n\n\tif zFilename != 0 {\n\t\t(*CsvReader)(unsafe.Pointer(p)).FzIn = sqlite3.Xsqlite3_malloc(tls, CSV_INBUFSZ)\n\t\tif (*CsvReader)(unsafe.Pointer(p)).FzIn == uintptr(0) {\n\t\t\tcsv_errmsg(tls, p, ts+1930 /* \"out of memory\" */, 0)\n\t\t\treturn 1\n\t\t}\n\t\t(*CsvReader)(unsafe.Pointer(p)).Fin = libc.Xfopen(tls, zFilename, ts+4263 /* \"rb\" */)\n\t\tif (*CsvReader)(unsafe.Pointer(p)).Fin == uintptr(0) {\n\t\t\tsqlite3.Xsqlite3_free(tls, (*CsvReader)(unsafe.Pointer(p)).FzIn)\n\t\t\tcsv_reader_reset(tls, p)\n\t\t\tcsv_errmsg(tls, p, ts+4266 /* \"cannot open '%s'...\" */, libc.VaList(bp, zFilename))\n\t\t\treturn 1\n\t\t}\n\t} else {\n\n\t\t(*CsvReader)(unsafe.Pointer(p)).FzIn = zData\n\t\t(*CsvReader)(unsafe.Pointer(p)).FnIn = libc.Xstrlen(tls, zData)\n\t}\n\treturn 0\n}", "title": "" }, { "docid": "d07fa43cd2d54648a7a79febbf019c65", "score": "0.49672663", "text": "func InitStream() Data {\n\treturn &Stream{}\n}", "title": "" }, { "docid": "b4f05bf3101b6512b3fb36540477cfdb", "score": "0.49670404", "text": "func newIOStreams(in io.Reader, out, err io.Writer) *ioStreams {\n\treturn &ioStreams{\n\t\tIn: in,\n\t\tOut: out,\n\t\tErrOut: err,\n\t}\n}", "title": "" }, { "docid": "56c635fe20f550ed54159fd20e9623f0", "score": "0.49601525", "text": "func (t testConn) NewStream() (network.Stream, error) { return nil, nil }", "title": "" }, { "docid": "358bd730b41c2812f35853481d9714e8", "score": "0.4946203", "text": "func NewReader(r io.Reader) (Reader, error) {\n\tcr := csv.NewReader(r)\n\tfields, err := readHeaderFields(cr)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn &reader{\n\t\tcr: cr,\n\t\tfields: fields,\n\t}, nil\n}", "title": "" }, { "docid": "15e38f3c3ffcca1014f6e0d0aa13aff7", "score": "0.49457112", "text": "func csv_reader_init(tls *libc.TLS, p uintptr) { /* csv.c:89:13: */\n\t(*CsvReader)(unsafe.Pointer(p)).Fin = uintptr(0)\n\t(*CsvReader)(unsafe.Pointer(p)).Fz = uintptr(0)\n\t(*CsvReader)(unsafe.Pointer(p)).Fn = 0\n\t(*CsvReader)(unsafe.Pointer(p)).FnAlloc = 0\n\t(*CsvReader)(unsafe.Pointer(p)).FnLine = 0\n\t(*CsvReader)(unsafe.Pointer(p)).FbNotFirst = 0\n\t(*CsvReader)(unsafe.Pointer(p)).FnIn = uint64(0)\n\t(*CsvReader)(unsafe.Pointer(p)).FzIn = uintptr(0)\n\t*(*int8)(unsafe.Pointer((p + 64 /* &.zErr */))) = int8(0)\n}", "title": "" }, { "docid": "5f2f3e955e55b54f6bc1b4d4e99cfb65", "score": "0.49321353", "text": "func NewStreaming() *Streaming {\n\treturn &Streaming{c: covariance.NewStreaming()}\n}", "title": "" }, { "docid": "c53789a16ea19a193a1c792e0d17ac8b", "score": "0.4921042", "text": "func newClientStream(conn net.Conn, version string) streamSession {\n\treturn newSmuxClient(conn)\n}", "title": "" }, { "docid": "2e02f5b1f7125b81d5591addaefd4ae2", "score": "0.49043247", "text": "func OpenCSV(filename string) (grate.Source, error) {\n\tf, err := os.Open(filename)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tdefer f.Close()\n\tt := &simpleFile{\n\t\tfilename: filename,\n\t\titerRow: -1,\n\t}\n\n\ts := csv.NewReader(f)\n\ts.FieldsPerRecord = -1\n\n\ttotal := 0\n\tncols := make(map[int]int)\n\trec, err := s.Read()\n\tfor ; err == nil; rec, err = s.Read() {\n\t\tncols[len(rec)]++\n\t\ttotal++\n\t\tt.rows = append(t.rows, rec)\n\t}\n\tif err != nil {\n\t\tswitch perr := err.(type) {\n\t\tcase *csv.ParseError:\n\t\t\treturn nil, grate.WrapErr(perr, grate.ErrNotInFormat)\n\t\t}\n\t\tif total < 10 {\n\t\t\t// probably? not in this format\n\t\t\treturn nil, grate.WrapErr(err, grate.ErrNotInFormat)\n\t\t}\n\t\treturn nil, err\n\t}\n\n\t// kinda arbitrary metrics for detecting CSV\n\tlooksGood := 0\n\tfor c, n := range ncols {\n\t\tif c <= 1 {\n\t\t\tcontinue\n\t\t}\n\t\tif n > 10 && float64(n)/float64(total) > 0.8 {\n\t\t\t// more than 80% of rows have the same number of columns, we're good\n\t\t\tlooksGood = 2\n\t\t} else if n > 25 && looksGood == 0 {\n\t\t\tlooksGood = 1\n\t\t}\n\t}\n\tif looksGood == 1 {\n\t\treturn t, grate.ErrNotInFormat\n\t}\n\n\treturn t, nil\n}", "title": "" }, { "docid": "7fc278ee85a47bd2b6d7ae07fb6e3d4b", "score": "0.49024928", "text": "func NewCSVWriter(wr io.WriteCloser, outSch schema.Schema, info *CSVFileInfo) (*CSVWriter, error) {\n\tbwr := bufio.NewWriterSize(wr, WriteBufSize)\n\tdelimStr := string(info.Delim)\n\n\tif info.HasHeaderLine {\n\t\tallCols := outSch.GetAllCols()\n\t\tnumCols := allCols.Size()\n\t\tcolNames := make([]string, 0, numCols)\n\t\terr := allCols.Iter(func(tag uint64, col schema.Column) (stop bool, err error) {\n\t\t\tcolNames = append(colNames, col.Name)\n\t\t\treturn false, nil\n\t\t})\n\n\t\tif err != nil {\n\t\t\twr.Close()\n\t\t\treturn nil, err\n\t\t}\n\n\t\theaderLine := strings.Join(colNames, delimStr)\n\t\terr = iohelp.WriteLine(bwr, headerLine)\n\n\t\tif err != nil {\n\t\t\twr.Close()\n\t\t\treturn nil, err\n\t\t}\n\t}\n\n\treturn &CSVWriter{wr, bwr, info, delimStr, outSch}, nil\n}", "title": "" }, { "docid": "70bc67f8d26e9903d6e42df60ce939b9", "score": "0.48950592", "text": "func NewCSVJiraUserReader(r io.Reader, ch chan<- JiraUser) error {\n\tcr := csv.NewReader(r)\n\tfor {\n\t\trecord, err := cr.Read()\n\t\tif err == io.EOF {\n\t\t\tbreak\n\t\t} else if err != nil {\n\t\t\treturn err\n\t\t}\n\t\tch <- JiraUser{\n\t\t\tID: record[0],\n\t\t\tChecksum: fromStringPointer(record[1]),\n\t\t\tUserID: record[2],\n\t\t\tUsername: record[3],\n\t\t\tName: record[4],\n\t\t\tEmail: record[5],\n\t\t\tAvatarURL: record[6],\n\t\t\tURL: record[7],\n\t\t\tCustomerID: record[8],\n\t\t\tRefID: record[9],\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "3919c9e504fee3f60f5c8a8812ae51fb", "score": "0.4893342", "text": "func newStream(id uint32, niceness uint8, frameSize int, writeTokenBucketSize int32, sess *Session) *Stream {\n\ts := new(Stream)\n\ts.niceness = niceness\n\ts.id = id\n\ts.chReadEvent = make(chan struct{}, 1)\n\ts.frameSize = frameSize\n\ts.sess = sess\n\ts.die = make(chan struct{})\n\ts.writeTokenBucket = writeTokenBucketSize\n\ts.writeTokenBucketNotify = make(chan struct{}, 1)\n\treturn s\n}", "title": "" }, { "docid": "057dc76e9c62b504a299c892f347f689", "score": "0.48914608", "text": "func NewJSONStream(recordChan chan Record) Stream {\n\treturn Stream{\n\t\trecords: recordChan,\n\t}\n}", "title": "" }, { "docid": "73942c20e2705946157fadb65f18aa32", "score": "0.4872907", "text": "func newStreamCommand(command string, args []string) *streamCommand {\n\treturn &streamCommand{\n\t\tcmd: exec.Command(command, args...),\n\t\tkillTimeout: time.Second * 2,\n\t}\n}", "title": "" }, { "docid": "b1380d2f0c8d2dc7b245fb078a1545ea", "score": "0.48623988", "text": "func NewUserLoginCSVWriter(w io.Writer, dedupers ...UserLoginCSVDeduper) (chan UserLogin, chan bool, error) {\n\treturn NewUserLoginCSVWriterSize(w, UserLoginCSVDefaultSize, dedupers...)\n}", "title": "" }, { "docid": "75f91f5f30336742dc2457dec2d35bf7", "score": "0.4855572", "text": "func NewReader(r io.Reader) *Reader {\n\treturn &Reader{\n\t\tComma: ',',\n\t\tr: bufio.NewReader(r),\n\t}\n}", "title": "" }, { "docid": "bc9a4a419592391ba4eb1b8a29271c8d", "score": "0.48554763", "text": "func New() *Streamer {\n\treturn &Streamer{size: 2000, cursorNameGenerator: CursorNameGenerator}\n}", "title": "" }, { "docid": "876d83304250a803de4514b547267015", "score": "0.48460546", "text": "func (c *CSVHandlerConstructor) Construct(_ context.Context) Handler {\n\treturn &csvHandler{}\n}", "title": "" }, { "docid": "ac14fa674722b24aacba8ec2cd64ea3b", "score": "0.48425207", "text": "func newStream(id string, buffSize int, replay, isAutoStream bool, onSubscribe, onUnsubscribe func(string, *Subscriber)) *Stream {\n\treturn &Stream{\n\t\tID: id,\n\t\tAutoReplay: replay,\n\t\tsubscribers: make([]*Subscriber, 0),\n\t\tisAutoStream: isAutoStream,\n\t\tregister: make(chan *Subscriber),\n\t\tderegister: make(chan *Subscriber),\n\t\tevent: make(chan *Event, buffSize),\n\t\tquit: make(chan struct{}),\n\t\tEventlog: make(EventLog, 0),\n\t\tOnSubscribe: onSubscribe,\n\t\tOnUnsubscribe: onUnsubscribe,\n\t}\n}", "title": "" }, { "docid": "3f4466b2a97f76f15e0e2b0281c90cab", "score": "0.4837434", "text": "func NewStream() *Stream {\n\treturn &Stream{\n\t\tchs: make(map[chan []byte]struct{}),\n\t}\n}", "title": "" }, { "docid": "b397a31ba925925ae5f823006d806f18", "score": "0.48319408", "text": "func NewDecoderCSV(r *csv.Reader) *Decoder {\n\treturn &Decoder{r: r}\n}", "title": "" }, { "docid": "1c07223d10a1dc7e0d22a728bb9506dd", "score": "0.48300508", "text": "func New(file string) (Pipedream, error) {\n\tvar pipedream Pipedream\n\t_, err := toml.DecodeFile(file, &pipedream)\n\n\tpipedream.CDNURL = strings.TrimRight(pipedream.CDNURL, \"/\")\n\n\treturn pipedream, err\n}", "title": "" }, { "docid": "9beb70ce26c1e55ef85d1a57c8e7f51f", "score": "0.48168537", "text": "func NewReader(r io.Reader) (*Reader, error) {}", "title": "" }, { "docid": "65cb4c16c5a34843e8dd9d7623f1de89", "score": "0.47939488", "text": "func (gitter *Gitter) newStreamConnection(wait time.Duration, retries int) *streamConnection {\n\treturn &streamConnection{\n\t\tclosed: true,\n\t\twait: wait,\n\t\tretries: retries,\n\t}\n}", "title": "" }, { "docid": "2439a782aac1d572999f9ee2049f8d86", "score": "0.4783014", "text": "func (s *CSV) initCSVFields(csv *olmapiv1alpha1.ClusterServiceVersion) {\n\t// Metadata\n\tcsv.TypeMeta.APIVersion = olmapiv1alpha1.ClusterServiceVersionAPIVersion\n\tcsv.TypeMeta.Kind = olmapiv1alpha1.ClusterServiceVersionKind\n\tcsv.SetName(getCSVName(strings.ToLower(s.ProjectName), s.CSVVersion))\n\tcsv.SetNamespace(\"placeholder\")\n\n\t// Spec fields\n\tcsv.Spec.Version = *semver.New(s.CSVVersion)\n\tcsv.Spec.DisplayName = getDisplayName(s.ProjectName)\n\tcsv.Spec.Description = \"Placeholder description\"\n\tcsv.Spec.Maturity = \"Basic Install\"\n\tcsv.Spec.Provider = olmapiv1alpha1.AppLink{}\n\tcsv.Spec.Maintainers = make([]olmapiv1alpha1.Maintainer, 0)\n\tcsv.Spec.Links = make([]olmapiv1alpha1.AppLink, 0)\n}", "title": "" }, { "docid": "e7b305ebef5a3f6f615c72f2e5d3ef8e", "score": "0.47819942", "text": "func New() coverage.Reader {\n\treturn new(reader)\n}", "title": "" }, { "docid": "6efad1745e511d5776226fcd527c2db3", "score": "0.4780638", "text": "func NewReader(r io.Reader) (*Reader, error) {\n\tcr := csv.NewReader(uni.New(r))\n\n\tcr.Comment = '#'\n\tcr.LazyQuotes = true\n\tcr.TrimLeadingSpace = true\n\n\t// Read the header.\n\trow, err := cr.Read()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\thead, err := ParseFileHeader(row)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn &Reader{\n\t\thead: head,\n\t\tcsv: cr,\n\t}, nil\n}", "title": "" }, { "docid": "2068b87d891d482aab6ba88148e89d6b", "score": "0.4779316", "text": "func csv_reader_reset(tls *libc.TLS, p uintptr) { /* csv.c:102:13: */\n\tif (*CsvReader)(unsafe.Pointer(p)).Fin != 0 {\n\t\tlibc.Xfclose(tls, (*CsvReader)(unsafe.Pointer(p)).Fin)\n\t\tsqlite3.Xsqlite3_free(tls, (*CsvReader)(unsafe.Pointer(p)).FzIn)\n\t}\n\tsqlite3.Xsqlite3_free(tls, (*CsvReader)(unsafe.Pointer(p)).Fz)\n\tcsv_reader_init(tls, p)\n}", "title": "" }, { "docid": "39be5c0606aa28b0b08b6a54ef9c58e5", "score": "0.47749037", "text": "func newMockLogStreamProvider(t mockConstructorTestingTnewMockLogStreamProvider) *mockLogStreamProvider {\n\tmock := &mockLogStreamProvider{}\n\tmock.Mock.Test(t)\n\n\tt.Cleanup(func() { mock.AssertExpectations(t) })\n\n\treturn mock\n}", "title": "" }, { "docid": "17fd1a606778598d7168c7eaff79fbbf", "score": "0.4771338", "text": "func NewReader(r io.Reader) Reader { return &reader{buf: bufio.NewReader(r)} }", "title": "" }, { "docid": "cf0a10337066615be86b2633bcece587", "score": "0.47465438", "text": "func NewCSVReader(csvFilePath string) (*CSVReader, error) {\n\n\tcsvFile, err := os.Open(csvFilePath)\n\tif err != nil {\n\t\treturn nil, xerrors.Errorf(\"NewCSVReader: %w\", err)\n\t}\n\n\treturn &CSVReader{fileReader: csv.NewReader(csvFile), file: csvFile}, nil\n}", "title": "" }, { "docid": "74d72f3810c70784a201dc99ce06ce4b", "score": "0.47424912", "text": "func csvtabCreate(tls *libc.TLS, db uintptr, pAux uintptr, argc int32, argv uintptr, ppVtab uintptr, pzErr uintptr) int32 { /* csv.c:681:12: */\n\treturn csvtabConnect(tls, db, pAux, argc, argv, ppVtab, pzErr)\n}", "title": "" }, { "docid": "1e589eedf1f14cfdeb3f67ec2afcf4c6", "score": "0.47298148", "text": "func newReader(r io.Reader) *reader {\n\treturn &reader{\n\t\tr: r,\n\t\tbuflen: defaultBufLen,\n\t}\n}", "title": "" }, { "docid": "db44ddd16603eb587f66beff6bdcadaa", "score": "0.47273386", "text": "func NewReader(iter ReadOneFunc) *Reader {\n\treturn &Reader{\n\t\tReadOne: iter,\n\t\tBuf: make([]byte, 0),\n\t}\n}", "title": "" }, { "docid": "bcc74fe3f93070159c845622580b966a", "score": "0.47255298", "text": "func (f *fwriter) NewReader() (r io.ReadCloser) {\n\tf.Lock()\n\tif f.closed {\n\t\tpanic(\"FanoutWriter: attempted to create a new Reader when closed.\")\n\t}\n\n\toff := f.off\n\tif !f.c.ReadFromStart {\n\t\toff += len(f.buf)\n\t}\n\n\tc := &client{\n\t\tfw: f,\n\t\toff: off,\n\t}\n\tr = c\n\n\tf.clients[c] = struct{}{}\n\n\tf.Unlock()\n\treturn\n}", "title": "" }, { "docid": "c7a3470c628101508d7d897ab26da063", "score": "0.47238815", "text": "func csv_resize_and_append(tls *libc.TLS, p uintptr, c int8) int32 { /* csv.c:175:25: */\n\tvar zNew uintptr\n\tvar nNew int32 = (((*CsvReader)(unsafe.Pointer(p)).FnAlloc * 2) + 100)\n\tzNew = sqlite3.Xsqlite3_realloc64(tls, (*CsvReader)(unsafe.Pointer(p)).Fz, uint64(nNew))\n\tif zNew != 0 {\n\t\t(*CsvReader)(unsafe.Pointer(p)).Fz = zNew\n\t\t(*CsvReader)(unsafe.Pointer(p)).FnAlloc = nNew\n\t\t*(*int8)(unsafe.Pointer((*CsvReader)(unsafe.Pointer(p)).Fz + uintptr(libc.PostIncInt32(&(*CsvReader)(unsafe.Pointer(p)).Fn, 1)))) = c\n\t\treturn 0\n\t} else {\n\t\tcsv_errmsg(tls, p, ts+1930 /* \"out of memory\" */, 0)\n\t\treturn 1\n\t}\n\treturn int32(0)\n}", "title": "" }, { "docid": "f96a69c29a5acfb80e56b799e8fa988f", "score": "0.47122023", "text": "func NewCSVGooseDbVersionReader(r io.Reader, ch chan<- GooseDbVersion) error {\n\tcr := csv.NewReader(r)\n\tfor {\n\t\trecord, err := cr.Read()\n\t\tif err == io.EOF {\n\t\t\tbreak\n\t\t} else if err != nil {\n\t\t\treturn err\n\t\t}\n\t\tch <- GooseDbVersion{\n\t\t\tID: fromCSVInt32(record[0]),\n\t\t\tVersionID: fromCSVInt32(record[1]),\n\t\t\tIsApplied: fromCSVBool(record[2]),\n\t\t\tTstamp: fromCSVDate(record[3]),\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "621d0a9138b933011cb21d84ad12fc6f", "score": "0.4701085", "text": "func ParseCSV(fname string) (Table, error) {\n\tvar err error\n\tvar read *bufio.Reader\n\n\tf, _ := os.Open(\"./test_data/simple.csv\")\n\tread = bufio.NewReader(f)\n\n\t// prepare channels here and then wait for the 'done' signal to come\n\t/*charStream := make(chan byte)\n\ttokStream := make(chan token)\n\tdone := make(chan *Table)\n\n\tgo tokenize(charStream, tokStream)\n\tgo build(tokStream, done)*/\n\n\t/*\tfor _, v := range input {\n\t\tcharStream <- string(v)\n\t}*/\n\n\t//fmt.Println(\"START READING FILE\")\n\n\terr = nil\n\t//curr := make([]byte, 100)\n\tpindex := 0\n\tindex := 0\n\tcurrTok := 0\n\t//line := make([]byte, 100)\n\tvar line []byte\n\t//var c byte\n\ttokens := make([]token, 10000)\n\n\t// if char, just move on\n\t// if comma, set pindex to index and move on\n\t// if newline, push token from [pindex:index], reset index + pindex\n\n\tfor err == nil {\n\t\t//fmt.Println(\"READ FILE:\")\n\t\tif line, err = read.ReadSlice('\\n'); err == nil {\n\t\t\t//fmt.Print(\"LINE:\", string(line))\n\t\t\tindex = 0\n\t\t\tpindex = 0\n\t\t\tfor i := 0; i < len(line); i++ {\n\t\t\t\tif line[i] == ',' {\n\t\t\t\t\t//\t\t\t\tfmt.Println(\"COMMA:\", pindex, index)\n\t\t\t\t\ttokens[currTok] = token{line[pindex:index]}\n\t\t\t\t\tcurrTok++\n\t\t\t\t\tpindex = index + 1\n\t\t\t\t}\n\t\t\t\tindex++\n\t\t\t}\n\t\t\t// set last token\n\t\t\ttokens[currTok] = token{line[pindex : index-1]}\n\t\t\tcurrTok++\n\t\t\t// send the builder a newline token\n\t\t\t//tokens = append(tokens, token{[]byte{'\\n'}})\n\t\t\t// send last message\n\t\t\t//tokens = append(tokens, token{curr[0:index]})\n\t\t\t// close the token channel\n\t\t}\n\t}\n\t// close the first stream\n\t//fmt.Println(\"GOT TOKENS:\", tokens[0:1000])\n\n\t// now we have the tokens, let's parse the structure\n\ttab := Table{}\n\tfor i := 0; i < currTok; i += 3 {\n\t\tt1 := tokens[i]\n\t\tt2 := tokens[i+1]\n\t\tt3 := tokens[i+2]\n\n\t\ttab = append(tab, Line{\n\t\t\tA: toStr(t1.Value),\n\t\t\tB: toInt(t2.Value),\n\t\t\tC: toFloat(t3.Value),\n\t\t})\n\t}\n\n\t//fmt.Println(\"GOT TAB:\", len(tab))\n\n\treturn tab, nil //errors.New(\"Not implemented\")\n}", "title": "" }, { "docid": "317183668646298d8b0d243c501c742d", "score": "0.4700088", "text": "func New(r io.Reader) (stream *Stream, err error) {\n\t// Verify FLAC signature and parse the StreamInfo metadata block.\n\tbr := bufio.NewReader(r)\n\tstream = &Stream{r: br}\n\tblock, err := stream.parseStreamInfo()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\t// Skip the remaining metadata blocks.\n\tfor !block.IsLast {\n\t\tblock, err = meta.New(br)\n\t\tif err != nil && err != meta.ErrReservedType {\n\t\t\treturn stream, err\n\t\t}\n\t\tif err = block.Skip(); err != nil {\n\t\t\treturn stream, err\n\t\t}\n\t}\n\n\treturn stream, nil\n}", "title": "" }, { "docid": "986106f9682cfc6301b290a70e2264e2", "score": "0.46708658", "text": "func sqlite3_csv_init(tls *libc.TLS, db uintptr, pzErrMsg uintptr, pApi uintptr) int32 { /* csv.c:939:5: */\n\tvar rc int32\n\t_ = pApi\n\n\trc = sqlite3.Xsqlite3_create_module(tls, db, ts+4676 /* \"csv\" */, uintptr(unsafe.Pointer(&CsvModule)), uintptr(0))\n\tif rc == SQLITE_OK {\n\t\trc = sqlite3.Xsqlite3_create_module(tls, db, ts+4680 /* \"csv_wr\" */, uintptr(unsafe.Pointer(&CsvModuleFauxWrite)), uintptr(0))\n\t}\n\treturn rc\n}", "title": "" }, { "docid": "059052e7139c8c9f8b57d12ac9f058d5", "score": "0.46669635", "text": "func getCSVImporter(apiToken string) CSVImporter {\n\tdateFormatter := date.NewISO8601Formatter()\n\tcsvTimeRecordMapper := NewCSVTimeRecordMapper(dateFormatter)\n\n\ttogglAPI := togglapi.NewAPI(togglAPIBaseURL, apiToken)\n\tworkspaces := toggl.NewWorkspaceRepository(togglAPI)\n\tclients := toggl.NewClientRepository(togglAPI, workspaces)\n\tprojects := toggl.NewProjectRepository(togglAPI, workspaces, clients)\n\n\ttimeRecords := toggl.NewTimeRecordRepository(togglAPI, workspaces, projects, clients)\n\n\treturn &TogglCSVImporter{\n\t\tcsvMapper: csvTimeRecordMapper,\n\t\ttimeRecordRepository: timeRecords,\n\t\toutput: os.Stdout,\n\t}\n}", "title": "" }, { "docid": "44070ddcd8994917730a938425b123e9", "score": "0.46611002", "text": "func New(fname string, src []byte) (s *Scanner) {\n\tif len(src) > 2 && src[0] == 0xEF && src[1] == 0xBB && src[2] == 0xBF {\n\t\tsrc = src[3:]\n\t}\n\ts = &Scanner{\n\t\tsrc: src,\n\t\tNLine: 1,\n\t\tNCol: 0,\n\t\tFname: fname,\n\t}\n\ts.next()\n\treturn\n}", "title": "" }, { "docid": "b17058e0edd2e57a3a1140b657fd10c7", "score": "0.4638864", "text": "func OpenCSVWriter(path string, fs filesys.WritableFS, outSch schema.Schema, info *CSVFileInfo) (*CSVWriter, error) {\n\terr := fs.MkDirs(filepath.Dir(path))\n\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\twr, err := fs.OpenForWrite(path)\n\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn NewCSVWriter(wr, outSch, info)\n}", "title": "" }, { "docid": "70c73f6f2c5e79aa990a76fdded549fb", "score": "0.463873", "text": "func NewSeek(rs io.ReadSeeker) (stream *Stream, err error) {\n\tstream = &Stream{r: rs, seekTableSize: defaultSeekTableSize}\n\n\t// Verify FLAC signature and parse the StreamInfo metadata block.\n\tblock, err := stream.parseStreamInfo()\n\tif err != nil {\n\t\treturn stream, err\n\t}\n\n\tfor !block.IsLast {\n\t\tblock, err = meta.Parse(stream.r)\n\t\tif err != nil {\n\t\t\tif err != meta.ErrReservedType {\n\t\t\t\treturn stream, err\n\t\t\t}\n\t\t\tif err = block.Skip(); err != nil {\n\t\t\t\treturn stream, err\n\t\t\t}\n\t\t}\n\n\t\tif block.Header.Type == meta.TypeSeekTable {\n\t\t\tstream.seekTable = block.Body.(*meta.SeekTable)\n\t\t}\n\t}\n\n\t// Record file offset of the first frame header.\n\tstream.dataStart, err = rs.Seek(0, io.SeekCurrent)\n\treturn stream, err\n}", "title": "" }, { "docid": "deea71e09aca4e6cf1ed51fd4c196c96", "score": "0.46350935", "text": "func NewUserLoginCSVWriterFile(fn string, dedupers ...UserLoginCSVDeduper) (chan UserLogin, chan bool, error) {\n\tf, err := os.Create(fn)\n\tif err != nil {\n\t\treturn nil, nil, fmt.Errorf(\"error opening CSV file %s. %v\", fn, err)\n\t}\n\tvar fc io.WriteCloser = f\n\tif filepath.Ext(fn) == \".gz\" {\n\t\tw, _ := gzip.NewWriterLevel(f, gzip.BestCompression)\n\t\tfc = w\n\t}\n\tch, done, err := NewUserLoginCSVWriter(fc, dedupers...)\n\tif err != nil {\n\t\tfc.Close()\n\t\tf.Close()\n\t\treturn nil, nil, fmt.Errorf(\"error creating CSV writer for %s. %v\", fn, err)\n\t}\n\tsdone := make(chan bool)\n\tgo func() {\n\t\t// wait for our writer to finish\n\t\t<-done\n\t\t// close our files\n\t\tfc.Close()\n\t\tf.Close()\n\t\t// signal our delegate channel\n\t\tsdone <- true\n\t}()\n\treturn ch, sdone, nil\n}", "title": "" }, { "docid": "6848c9e3e3a8df2900c1bf1488dd5b96", "score": "0.463455", "text": "func newStreamIOInitializer(out output, serializer encoding.Serializer, streamMsgReader encoding.StreamRequestReader) *streamIOInitializer {\n\treturn &streamIOInitializer{\n\t\tout: out,\n\t\tserializer: serializer,\n\t\tstreamMsgReader: streamMsgReader,\n\t}\n}", "title": "" }, { "docid": "e68e070eeb954bfad51cca18b55a7074", "score": "0.46338722", "text": "func NewReader(streamReader io.Reader) *Reader {\n\trdr := &Reader{\n\t\tMetadata: make(map[string][]byte),\n\t\tstreamReader: streamReader,\n\t\tbucket: &bytes.Reader{},\n\t\tbucketReader: &bytes.Buffer{},\n\t}\n\n\treturn rdr\n}", "title": "" }, { "docid": "30916ad97a89dfb20678fe14167fa265", "score": "0.4631916", "text": "func newIterator(batch *js.Value, err error) *iterator {\n\treturn &iterator{batch: batch, err: err, index: -1}\n}", "title": "" }, { "docid": "fc6d4da79bca3698f4ed9bb501e6d317", "score": "0.4630914", "text": "func NewFromCSVFiles(logger *logrus.Logger, files []string, driverRoot string) (Discover, error) {\n\tif len(files) == 0 {\n\t\tlogger.Warnf(\"No CSV files specified\")\n\t\treturn None{}, nil\n\t}\n\n\tsymlinkLocator := lookup.NewSymlinkLocator(logger, driverRoot)\n\tlocators := map[csv.MountSpecType]lookup.Locator{\n\t\tcsv.MountSpecDev: lookup.NewCharDeviceLocator(lookup.WithLogger(logger), lookup.WithRoot(driverRoot)),\n\t\tcsv.MountSpecDir: lookup.NewDirectoryLocator(logger, driverRoot),\n\t\t// Libraries and symlinks are handled in the same way\n\t\tcsv.MountSpecLib: symlinkLocator,\n\t\tcsv.MountSpecSym: symlinkLocator,\n\t}\n\n\tvar mountSpecs []*csv.MountSpec\n\tfor _, filename := range files {\n\t\ttargets, err := loadCSVFile(logger, filename)\n\t\tif err != nil {\n\t\t\tlogger.Warnf(\"Skipping CSV file %v: %v\", filename, err)\n\t\t\tcontinue\n\t\t}\n\t\tmountSpecs = append(mountSpecs, targets...)\n\t}\n\n\treturn newFromMountSpecs(logger, locators, driverRoot, mountSpecs)\n}", "title": "" }, { "docid": "405e08b1d98c883c4c589f0a811d525d", "score": "0.46272582", "text": "func NewMockCSVGetter(ctrl *gomock.Controller) *MockCSVGetter {\n\tmock := &MockCSVGetter{ctrl: ctrl}\n\tmock.recorder = &MockCSVGetterMockRecorder{mock}\n\treturn mock\n}", "title": "" }, { "docid": "405e08b1d98c883c4c589f0a811d525d", "score": "0.46272582", "text": "func NewMockCSVGetter(ctrl *gomock.Controller) *MockCSVGetter {\n\tmock := &MockCSVGetter{ctrl: ctrl}\n\tmock.recorder = &MockCSVGetterMockRecorder{mock}\n\treturn mock\n}", "title": "" }, { "docid": "9c0e95b0790173365b175d1369b8024c", "score": "0.4619774", "text": "func NewCSVUserLoginReaderFile(fp string, ch chan<- UserLogin) error {\n\tf, err := os.Open(fp)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"error opening CSV file at %s. %v\", fp, err)\n\t}\n\tvar fc io.ReadCloser = f\n\tif filepath.Ext(fp) == \".gz\" {\n\t\tgr, err := gzip.NewReader(f)\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"error opening CSV file at %s. %v\", fp, err)\n\t\t}\n\t\tfc = gr\n\t}\n\tdefer f.Close()\n\tdefer fc.Close()\n\treturn NewCSVUserLoginReader(fc, ch)\n}", "title": "" }, { "docid": "a2425a358e360b9c0945c4caf1e525bd", "score": "0.4612781", "text": "func NewCfnStream_Override(c CfnStream, scope awscdk.Construct, id *string, props *CfnStreamProps) {\n\t_init_.Initialize()\n\n\t_jsii_.Create(\n\t\t\"monocdk.aws_qldb.CfnStream\",\n\t\t[]interface{}{scope, id, props},\n\t\tc,\n\t)\n}", "title": "" }, { "docid": "da754460e84330b321103a62255376b6", "score": "0.46124607", "text": "func (r *CSVReader) Open() error {\n\tf, err := os.Open(r.FileName)\n\tif err != nil {\n\t\treturn err\n\t}\n\tr.f = f\n\tr.rowCount = 0\n\trcsv := csv.NewReader(f)\n\trcsv.Comma = r.Separator\n\trcsv.TrimLeadingSpace = true\n\tr.rcsv = rcsv\n\n\terr = r.readHeader()\n\tif err != nil {\n\t\treturn err\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "e1b696d84ad3e48ff5e74b0af9d9b568", "score": "0.459917", "text": "func New(stream *stream.Replicate) *Collector {\n\n\treturn &Collector{\n\t\tstream: stream,\n\t}\n}", "title": "" }, { "docid": "1a9b189b381497e369f57ac85604167d", "score": "0.45961714", "text": "func Of(args ...interface{}) (*Stream, error) {\n\treturn New(args)\n}", "title": "" }, { "docid": "15954fe77b70a5232af557fad56bb900", "score": "0.4592403", "text": "func (t *ssh2Client) NewStream(ctx context.Context, callHdr *CallHdr) (_ *Stream, err error) {\n\n\tlogrus.Debugln(\"NewStream\")\n\tlogrus.Debugln(\"NewStream -- ctx:\", ctx)\n\tlogrus.Debugln(\"NewStream -- callHdr:\", callHdr)\n\n\t// wait for t.writableChan or t.shutdownChan\n\tif _, err := wait(ctx, t.shutdownChan, t.writableChan); err != nil {\n\t\tlogrus.Debugln(\"NewStream -- wait error:\", err.Error())\n\t\treturn nil, err\n\t}\n\n\ts := t.newStream(ctx, callHdr)\n\n\t// build the NewChannel extra data (http2 uses headers)\n\t// it contains the Stream ID, the method name, and the host name\n\textraData := \"\"\n\t// convert Stream ID into a string -- Ad: may not be required\n\tintStr := strconv.FormatUint(uint64(s.id), 10)\n\tlogrus.Debugln(\"EXTRA DATA ID:\", intStr)\n\textraData += intStr + \"|\"\n\t// add host -- Ad: may not be required\n\tlogrus.Debugln(\"EXTRA DATA HOST:\", callHdr.Host)\n\textraData += callHdr.Host + \"|\"\n\t// add method\n\tlogrus.Debugln(\"EXTRA DATA METHOD:\", callHdr.Method)\n\textraData += callHdr.Method + \"|\"\n\tlogrus.Debugln(\"EXTRA DATA FINAL:\", extraData)\n\n\tch, _, err := t.conn.OpenChannel(\"grpc\", []byte(extraData))\n\tif err != nil {\n\t\tlogrus.Debugln(\"NewStream -- ERROR OPENNING CHANNEL\")\n\t\treturn nil, errors.New(\"NewStream -- ERROR OPENNING CHANNEL\")\n\t}\n\n\tt.channelsByStreamId[s.id] = &ch\n\n\t// read from channel (for response)\n\tgo t.reader(&ch, s)\n\n\tt.writableChan <- 0\n\treturn s, nil\n}", "title": "" }, { "docid": "3c37c004982dafadf4095052c704a57c", "score": "0.457756", "text": "func NewCSVEncoder(w io.Writer) Encoder {\n\tenc := csv.NewWriter(w)\n\treturn func(r *Result) error {\n\t\terr := enc.Write([]string{\n\t\t\tstrconv.FormatInt(r.Timestamp.UnixNano(), 10),\n\t\t\tstrconv.FormatUint(uint64(r.Code), 10),\n\t\t\tstrconv.FormatInt(r.Latency.Nanoseconds(), 10),\n\t\t\tstrconv.FormatUint(r.BytesOut, 10),\n\t\t\tstrconv.FormatUint(r.BytesIn, 10),\n\t\t\tr.Error,\n\t\t\tbase64.StdEncoding.EncodeToString(r.Body),\n\t\t\tr.Attack,\n\t\t\tstrconv.FormatUint(r.Seq, 10),\n\t\t\tr.Method,\n\t\t\tr.URL,\n\t\t\tbase64.StdEncoding.EncodeToString(headerBytes(r.Headers)),\n\t\t})\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\tenc.Flush()\n\n\t\treturn enc.Error()\n\t}\n}", "title": "" }, { "docid": "4e8434f0cf285a43aa4cc0979faea44c", "score": "0.45755658", "text": "func (t *Table) ReadCSV(fname string, summation bool, prop map[string]string) {\n\tvar vector []string\n\t//err :=nil\n\tfields := t.selector\n\tf1, _ := os.Create(fname)\n\tt.w = bufio.NewWriter(f1)\n\tw := t.w\n\tt.prop = prop\n\tt.Type = prop[\"type\"]\n\n\tfmt.Fprintln(w, t.Begin(w, prop))\n\n\tcount := 0\n\tf, _ := os.Open(t.outpath)\n\n\tdefer f.Close()\n\tt.rd = csv.NewReader(f)\n\n\t//rd := t.rd\n\tt.csvDefaultSettings()\n\n\tt.skiplines()\n\tt.renderHead()\n\n\tfor {\n\t\trecord, err := t.Read()\n\n\t\tif err == io.EOF {\n\t\t\tbreak\n\t\t} else if err != nil {\n\t\t\tfmt.Println(\"Error:\", err)\n\t\t}\n\n\t\tvector = nil\n\t\tfor _, v := range fields {\n\t\t\tlog.Println(v, record[v])\n\t\t\tvector = append(vector, record[v])\n\t\t}\n\n\t\t//if record[8] != \"\" && record[0] != \"\" {\n\t\tcount++\n\n\t\tt.ProcessRow(w, vector)\n\t\tif prop[\"rowlines\"] == \"true\" {\n\t\t\tfmt.Fprintln(w, \"\\\\hline\")\n\t\t}\n\t}\n\n\tt.closeTabular(w)\n}", "title": "" }, { "docid": "33eab105bc1052fa4fb23f5761d27bcb", "score": "0.45751706", "text": "func New(arr interface{}) (*Stream, error) {\n\tops := make([]op, 0)\n\tdata := make([]interface{}, 0)\n\tdataValue := reflect.ValueOf(&data).Elem()\n\tarrValue := reflect.ValueOf(arr)\n\tif arrValue.Kind() == reflect.Ptr {\n\t\tarrValue = arrValue.Elem()\n\t}\n\tif arrValue.Kind() == reflect.Slice || arrValue.Kind() == reflect.Array {\n\t\tfor i := 0; i < arrValue.Len(); i++ {\n\t\t\tdataValue.Set(reflect.Append(dataValue, arrValue.Index(i)))\n\t\t}\n\t} else {\n\t\treturn nil, errors.New(\"the type of arr parameter must be Array or Slice\")\n\t}\n\treturn &Stream{ops: ops, data: data}, nil\n}", "title": "" }, { "docid": "4d88fac6c1a5c32dd160f189a059cfc1", "score": "0.45617965", "text": "func New(underlying io.Writer, filterFunc func(s string) bool) io.Writer {\n\treturn &filteredWriter{underlying: underlying, filterFunc: filterFunc}\n}", "title": "" }, { "docid": "ba0fbf1e18aaf28655729c013cf657c6", "score": "0.45564377", "text": "func NewCfnStream(scope awscdk.Construct, id *string, props *CfnStreamProps) CfnStream {\n\t_init_.Initialize()\n\n\tj := jsiiProxy_CfnStream{}\n\n\t_jsii_.Create(\n\t\t\"monocdk.aws_qldb.CfnStream\",\n\t\t[]interface{}{scope, id, props},\n\t\t&j,\n\t)\n\n\treturn &j\n}", "title": "" }, { "docid": "7f94b1a2474b89a1c324b7082cd92cd9", "score": "0.45552108", "text": "func New(path string) *Reader {\n\tvar group []string\n\tvalue := make(map[string]string)\n\tinfo := Reader{Value: value, Group: group, Path: path, Delimiter: \":\"}\n\tinfo.UpdateContent()\n\treturn &info\n}", "title": "" }, { "docid": "09dccf63632dd7b20ae052074ad43408", "score": "0.45536593", "text": "func newS3Reader(base string) Reader {\n\treturn &S3Reader{base: base}\n}", "title": "" }, { "docid": "20edbbe7ceddcc050d2bb68dcdd5251b", "score": "0.45503604", "text": "func newFanoutReader(reader *multipart.Reader, sup SkyfileUploadParameters) *skyfileMultipartReader {\n\tif reader == nil {\n\t\treturn nil\n\t}\n\treturn newSkyfileMultipartReader(reader, nil, sup)\n}", "title": "" }, { "docid": "67a6cd49f6ed1aa0d0c7254a963d5172", "score": "0.45480546", "text": "func New(writer io.Writer, columns []string, format string, opts ...Option) *Writer {\n\ttable := tablewriter.NewWriter(writer)\n\ttable.SetHeader(columns)\n\tcsvw := csv.NewWriter(writer)\n\tcsvw.Write(columns)\n\tw := &Writer{\n\t\tbasew: writer,\n\t\tsize: defaultSize,\n\t\tcsvw: csvw,\n\t\ttable: table,\n\t\tformatters: map[string][]Formatter{},\n\t\tcolumns: columns,\n\t\tformat: format,\n\t}\n\tfor _, o := range opts {\n\t\to(w)\n\t}\n\tw.strw = bufio.NewWriterSize(writer, w.size)\n\treturn w\n}", "title": "" }, { "docid": "b1c5b595c616a51b1bc3e069212ccd08", "score": "0.45478845", "text": "func (p *Plumber) newReader(pipe string) *Reader {\n\tlog.Debug(\"newReader: %v\", pipe)\n\n\tr := &Reader{\n\t\tC: make(chan string),\n\t\tDone: make(chan struct{}),\n\t\tID: p.id(),\n\t}\n\n\tif _, ok := p.pipes[pipe]; !ok {\n\t\tp.pipes[pipe] = &Pipe{\n\t\t\tname: pipe,\n\t\t\treaders: make(map[int64]*Reader),\n\t\t}\n\t}\n\tpp := p.pipes[pipe]\n\tpp.readers[r.ID] = r\n\n\tgo func() {\n\t\t<-r.Done\n\t\tpp.lock.Lock()\n\t\tdefer pp.lock.Unlock()\n\t\tclose(r.C)\n\t\tdelete(pp.readers, r.ID)\n\t}()\n\n\treturn r\n}", "title": "" }, { "docid": "14e8dbc7cc03479e50566e2c165f0f06", "score": "0.4547666", "text": "func NewCSVDecoder(r io.Reader) Decoder {\n\tdec := csv.NewReader(r)\n\tdec.FieldsPerRecord = 12\n\tdec.TrimLeadingSpace = true\n\n\treturn func(r *Result) error {\n\t\trec, err := dec.Read()\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\tts, err := strconv.ParseInt(rec[0], 10, 64)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tr.Timestamp = time.Unix(0, ts)\n\n\t\tcode, err := strconv.ParseUint(rec[1], 10, 16)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tr.Code = uint16(code)\n\n\t\tlatency, err := strconv.ParseInt(rec[2], 10, 64)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tr.Latency = time.Duration(latency)\n\n\t\tif r.BytesOut, err = strconv.ParseUint(rec[3], 10, 64); err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\tif r.BytesIn, err = strconv.ParseUint(rec[4], 10, 64); err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\tr.Error = rec[5]\n\t\tif r.Body, err = base64.StdEncoding.DecodeString(rec[6]); err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\tr.Attack = rec[7]\n\t\tif r.Seq, err = strconv.ParseUint(rec[8], 10, 64); err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\tr.Method = rec[9]\n\t\tr.URL = rec[10]\n\n\t\tif rec[11] != \"\" {\n\t\t\tpr := textproto.NewReader(bufio.NewReader(\n\t\t\t\tbase64.NewDecoder(base64.StdEncoding, strings.NewReader(rec[11]))))\n\t\t\thdr, err := pr.ReadMIMEHeader()\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t\tr.Headers = http.Header(hdr)\n\t\t}\n\n\t\treturn err\n\t}\n}", "title": "" }, { "docid": "89f6cab54d0689a3cd29204ab45c4412", "score": "0.45434234", "text": "func NewMockCSVExtractor(ctrl *gomock.Controller) *MockCSVExtractor {\n\tmock := &MockCSVExtractor{ctrl: ctrl}\n\tmock.recorder = &MockCSVExtractorMockRecorder{mock}\n\treturn mock\n}", "title": "" }, { "docid": "d309d0282134dc75d8e798cc5113df69", "score": "0.45424682", "text": "func NewReader(r io.Reader, aead cipher.AEAD) io.Reader { return newReader(r, aead) }", "title": "" } ]
d10cc57dcb4d364630af973ccdb2d10e
GetParticipants gets the participants property value. List of distinct identities involved in the call.
[ { "docid": "0688fb3cabf3f6dbfdf34e1316faa73b", "score": "0.82315016", "text": "func (m *CallRecord) GetParticipants()([]iadcd81124412c61e647227ecfc4449d8bba17de0380ddda76f641a29edf2b242.IdentitySetable) {\n val, err := m.GetBackingStore().Get(\"participants\")\n if err != nil {\n panic(err)\n }\n if val != nil {\n return val.([]iadcd81124412c61e647227ecfc4449d8bba17de0380ddda76f641a29edf2b242.IdentitySetable)\n }\n return nil\n}", "title": "" } ]
[ { "docid": "72cf1eb16dfe739f594e306b42915d26", "score": "0.8392915", "text": "func (m *InviteParticipantsOperation) GetParticipants()([]InvitationParticipantInfoable) {\n return m.participants\n}", "title": "" }, { "docid": "fae437c9322417e53551007edf374c58", "score": "0.79173005", "text": "func (m *InvitePostRequestBody) GetParticipants()([]iadcd81124412c61e647227ecfc4449d8bba17de0380ddda76f641a29edf2b242.InvitationParticipantInfoable) {\n return m.participants\n}", "title": "" }, { "docid": "1dac6c71f6e74487633d833b5cbf7abb", "score": "0.7575378", "text": "func (m *CreateOrGetPostRequestBody) GetParticipants()(iadcd81124412c61e647227ecfc4449d8bba17de0380ddda76f641a29edf2b242.MeetingParticipantsable) {\n return m.participants\n}", "title": "" }, { "docid": "d3e3ff5ee14a3dd7593956a948faacf5", "score": "0.7528462", "text": "func (c *ChatInvite) GetParticipants() (value []UserClass, ok bool) {\n\tif c == nil {\n\t\treturn\n\t}\n\tif !c.Flags.Has(4) {\n\t\treturn value, false\n\t}\n\treturn c.Participants, true\n}", "title": "" }, { "docid": "d9ddfae1fa2ce0db0f232923c507d67f", "score": "0.751842", "text": "func (conf *ZoomConference) GetParticipants(ctx context.Context) (int, error) {\n\tui := conf.ui\n\n\tparticipant := nodewith.NameContaining(\"open the participants list pane\").Role(role.Button)\n\tnoParticipant := nodewith.NameContaining(\"[0] particpants\").Role(role.Button)\n\tif err := uiauto.NamedCombine(\"wait participants\",\n\t\tui.WaitUntilExists(participant),\n\t\tui.WithTimeout(mediumUITimeout).WaitUntilGone(noParticipant),\n\t)(ctx); err != nil {\n\t\treturn 0, errors.Wrap(err, \"failed to wait participant info\")\n\t}\n\n\tnode, err := ui.Info(ctx, participant)\n\tif err != nil {\n\t\treturn 0, errors.Wrap(err, \"failed to get participant info\")\n\t}\n\ttesting.ContextLog(ctx, \"Get participant info: \", node.Name)\n\tinfo := strings.Split(node.Name, \"[\")\n\tinfo = strings.Split(info[1], \"]\")\n\tparticipants, err := strconv.ParseInt(info[0], 10, 64)\n\tif err != nil {\n\t\treturn 0, errors.Wrap(err, \"cannot parse number of participants\")\n\t}\n\n\treturn int(participants), nil\n}", "title": "" }, { "docid": "b6464949d0476bacc61635b4b1b519ca", "score": "0.69251215", "text": "func (m *CallEndedEventMessageDetail) GetCallParticipants()([]CallParticipantInfoable) {\n return m.callParticipants\n}", "title": "" }, { "docid": "86166c3554c434606b69cff51f80346e", "score": "0.6768983", "text": "func (m *InviteParticipantsOperation) SetParticipants(value []InvitationParticipantInfoable)() {\n m.participants = value\n}", "title": "" }, { "docid": "ac47d5f0410b4b0ec453d5fc20f71cec", "score": "0.6663267", "text": "func (t *Tournament) Participants(c appengine.Context) []*User {\n\tvar users []*User\n\n\tfor _, uId := range t.UserIds {\n\t\tuser, err := UserById(c, uId)\n\t\tif err != nil {\n\t\t\tlog.Errorf(c, \" Participants, cannot find user with ID=%\", uId)\n\t\t} else {\n\t\t\tusers = append(users, user)\n\t\t}\n\t}\n\n\treturn users\n}", "title": "" }, { "docid": "17f906b5bd487b9306e0af9f073a66a8", "score": "0.66461134", "text": "func (matchMakingExtProtocol *MatchMakingExtProtocol) GetParticipants(handler func(err error, client *nex.Client, callID uint32, idGathering uint32, bOnlyActive bool)) {\n\tmatchMakingExtProtocol.GetParticipantsHandler = handler\n}", "title": "" }, { "docid": "00232c2954c4950a43bf3a74f667b3ea", "score": "0.66358143", "text": "func (s *BadgerStore) Participants() (*peers.Peers, error) {\n\treturn s.participants, nil\n}", "title": "" }, { "docid": "2dc37e75b7f23c4c983ba7371a1e30d0", "score": "0.64851713", "text": "func Participants(w http.ResponseWriter, r *http.Request, u *mdl.User) error {\n\tif r.Method != \"GET\" {\n\t\treturn &helpers.BadRequest{Err: errors.New(helpers.ErrorCodeNotSupported)}\n\t}\n\n\tc := appengine.NewContext(r)\n\tdesc := \"Tournament Participants handler:\"\n\textract := extract.NewContext(c, desc, r)\n\n\tvar tournament *mdl.Tournament\n\tvar err error\n\ttournament, err = extract.Tournament()\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tparticipants := tournament.Participants(c)\n\n\tparticipantFieldsToKeep := []string{\"Id\", \"Username\", \"Alias\"}\n\tparticipantsJSON := make([]mdl.UserJSON, len(participants))\n\thelpers.TransformFromArrayOfPointers(&participants, &participantsJSON, participantFieldsToKeep)\n\n\tdata := struct {\n\t\tParticipants []mdl.UserJSON\n\t}{\n\t\tparticipantsJSON,\n\t}\n\n\treturn templateshlp.RenderJSON(w, c, data)\n}", "title": "" }, { "docid": "182acc3278aee073e2338c91bb1fdee0", "score": "0.62152046", "text": "func (a *DefaultApiService) ListParticipants(ctx context.Context, pullRequestId int64, projectKey string, repositorySlug string) (string, *http.Response, error) {\n\tvar (\n\t\tlocalVarHttpMethod = strings.ToUpper(\"Get\")\n\t\tlocalVarPostBody interface{}\n\t\tlocalVarFileName string\n\t\tlocalVarFileBytes []byte\n\t\tlocalVarReturnValue string\n\t)\n\n\t// create path and map variables\n\tlocalVarPath := a.client.cfg.BasePath + \"/api/1.0/projects/{projectKey}/repos/{repositorySlug}/pull-requests/{pullRequestId}/participants\"\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"pullRequestId\"+\"}\", fmt.Sprintf(\"%v\", pullRequestId), -1)\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"projectKey\"+\"}\", fmt.Sprintf(\"%v\", projectKey), -1)\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"repositorySlug\"+\"}\", fmt.Sprintf(\"%v\", repositorySlug), -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{\"application/json\"}\n\n\t// set Accept header\n\tlocalVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts)\n\tif localVarHttpHeaderAccept != \"\" {\n\t\tlocalVarHeaderParams[\"Accept\"] = localVarHttpHeaderAccept\n\t}\n\tr, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes)\n\tif err != nil {\n\t\treturn localVarReturnValue, nil, err\n\t}\n\n\tlocalVarHttpResponse, err := a.client.callAPI(r)\n\tif err != nil || localVarHttpResponse == nil {\n\t\treturn localVarReturnValue, localVarHttpResponse, err\n\t}\n\n\tlocalVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body)\n\tlocalVarHttpResponse.Body.Close()\n\tif err != nil {\n\t\treturn localVarReturnValue, localVarHttpResponse, err\n\t}\n\n\tif localVarHttpResponse.StatusCode < 300 {\n\t\t// If we succeed, return the data, otherwise pass on to decode error.\n\t\terr = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get(\"Content-Type\"));\n\t\tif err == nil { \n\t\t\treturn localVarReturnValue, localVarHttpResponse, err\n\t\t}\n\t}\n\n\tif localVarHttpResponse.StatusCode >= 300 {\n\t\tnewErr := GenericSwaggerError{\n\t\t\tbody: localVarBody,\n\t\t\terror: localVarHttpResponse.Status,\n\t\t}\n\t\tif localVarHttpResponse.StatusCode == 200 {\n\t\t\tvar v string\n\t\t\terr = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get(\"Content-Type\"));\n\t\t\t\tif err != nil {\n\t\t\t\t\tnewErr.error = err.Error()\n\t\t\t\t\treturn localVarReturnValue, localVarHttpResponse, newErr\n\t\t\t\t}\n\t\t\t\tnewErr.model = v\n\t\t\t\treturn localVarReturnValue, localVarHttpResponse, newErr\n\t\t}\n\t\treturn localVarReturnValue, localVarHttpResponse, newErr\n\t}\n\n\treturn localVarReturnValue, localVarHttpResponse, nil\n}", "title": "" }, { "docid": "ce2c91990cf7a0eb8e39acee07e855ba", "score": "0.618964", "text": "func (m *CallRecord) SetParticipants(value []iadcd81124412c61e647227ecfc4449d8bba17de0380ddda76f641a29edf2b242.IdentitySetable)() {\n err := m.GetBackingStore().Set(\"participants\", value)\n if err != nil {\n panic(err)\n }\n}", "title": "" }, { "docid": "0d32f0a8bcb726932ffa86bf52378124", "score": "0.61511457", "text": "func (c *ChatInvite) GetParticipantsCount() (value int) {\n\tif c == nil {\n\t\treturn\n\t}\n\treturn c.ParticipantsCount\n}", "title": "" }, { "docid": "0b4bc720aa65bab55999b7bc23a77194", "score": "0.61502063", "text": "func (c *Chat) GetParticipantsCount() (value int) {\n\tif c == nil {\n\t\treturn\n\t}\n\treturn c.ParticipantsCount\n}", "title": "" }, { "docid": "1d750dd572348bb5d12a0969e7d24b84", "score": "0.6129743", "text": "func (m *InviteParticipantsOperation) GetFieldDeserializers()(map[string]func(i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNode)(error)) {\n res := m.CommsOperation.GetFieldDeserializers()\n res[\"participants\"] = i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.SetCollectionOfObjectValues(CreateInvitationParticipantInfoFromDiscriminatorValue , m.SetParticipants)\n return res\n}", "title": "" }, { "docid": "f72754ec6d3bb1155191879b856c0f11", "score": "0.60976905", "text": "func (c *ChatInvite) SetParticipants(value []UserClass) {\n\tc.Flags.Set(4)\n\tc.Participants = value\n}", "title": "" }, { "docid": "8254c23b81f3fb735a91c7ff528e1f60", "score": "0.60660344", "text": "func (c *Channel) GetParticipantsCount() (value int, ok bool) {\n\tif c == nil {\n\t\treturn\n\t}\n\tif !c.Flags.Has(17) {\n\t\treturn value, false\n\t}\n\treturn c.ParticipantsCount, true\n}", "title": "" }, { "docid": "1376076982e50d3919b1033ba9aa0631", "score": "0.60204613", "text": "func (act Account) ListParticipants(p ParticipantStatus, confSid string) (ParticipantList, error) {\n\tvar pl ParticipantList\n\tif !validateConferenceSid(confSid) {\n\t\treturn pl, errors.New(\"Invalid conference sid\")\n\t}\n\terr := common.SendGetRequest(fmt.Sprintf(participant.List, act.AccountSid, confSid)+p.getQueryString(), act, &pl)\n\tpl.act = &act\n\treturn pl, err\n}", "title": "" }, { "docid": "5dc1ba2ef2da2d0bdfd5438bf221981e", "score": "0.6018624", "text": "func (m *InvitePostRequestBody) SetParticipants(value []iadcd81124412c61e647227ecfc4449d8bba17de0380ddda76f641a29edf2b242.InvitationParticipantInfoable)() {\n m.participants = value\n}", "title": "" }, { "docid": "686f5c33f1832aeffdb61e24b958c4b2", "score": "0.5937221", "text": "func (m *CreateOrGetPostRequestBody) SetParticipants(value iadcd81124412c61e647227ecfc4449d8bba17de0380ddda76f641a29edf2b242.MeetingParticipantsable)() {\n m.participants = value\n}", "title": "" }, { "docid": "e1bf56c18619ed431c014e7541429101", "score": "0.58522034", "text": "func (pg *PlayGroup) QueryParticipants() *PetQuery {\n\treturn (&PlayGroupClient{config: pg.config}).QueryParticipants(pg)\n}", "title": "" }, { "docid": "b8353dd7b73a6844803cadb992b1be7b", "score": "0.57600874", "text": "func GetPeople() []*Person {\n\treturn people\n}", "title": "" }, { "docid": "e30a721d8e6a0d09dbdfaaf058414714", "score": "0.5714967", "text": "func (c *ChatInvite) MapParticipants() (value UserClassArray, ok bool) {\n\tif !c.Flags.Has(4) {\n\t\treturn value, false\n\t}\n\treturn UserClassArray(c.Participants), true\n}", "title": "" }, { "docid": "24bd246bd64c70b7f915ca065107299b", "score": "0.567574", "text": "func RSVPParticipants(mods ...qm.QueryMod) rsvpParticipantQuery {\n\tmods = append(mods, qm.From(\"\\\"rsvp_participants\\\"\"))\n\tq := NewQuery(mods...)\n\tif len(queries.GetSelect(q)) == 0 {\n\t\tqueries.SetSelect(q, []string{\"\\\"rsvp_participants\\\".*\"})\n\t}\n\n\treturn rsvpParticipantQuery{q}\n}", "title": "" }, { "docid": "84f2a098e55f4b42a1a9dba03eb80813", "score": "0.56623167", "text": "func ByParticipants(u *url.URL, h http.Header, _ interface{}, context *models.Context) (int, http.Header, interface{}, error) {\n\t// only logged in users\n\tif !context.IsLoggedIn() {\n\t\treturn response.NewBadRequest(models.ErrNotLoggedIn)\n\t}\n\n\tquery := request.GetQuery(u)\n\tquery = context.OverrideQuery(query)\n\n\tparticipantsStr, ok := u.Query()[\"id\"]\n\tif !ok {\n\t\treturn response.NewBadRequest(errors.New(\"participants not set\"))\n\t}\n\n\tif len(participantsStr) == 0 {\n\t\treturn response.NewBadRequest(errors.New(\"at least one participant is required\"))\n\t}\n\n\tunify := make(map[string]interface{})\n\n\t// add current account to participants list\n\tunify[strconv.FormatInt(context.Client.Account.Id, 10)] = struct{}{}\n\n\t// remove duplicates from participants\n\tfor i := range participantsStr {\n\t\tunify[participantsStr[i]] = struct{}{}\n\t}\n\n\tparticipants := make([]int64, 0)\n\n\t// convert strings to int64\n\tfor participantStr := range unify {\n\t\ti, err := strconv.ParseInt(participantStr, 10, 64)\n\t\tif err != nil {\n\t\t\treturn response.NewBadRequest(err)\n\t\t}\n\n\t\tparticipants = append(participants, i)\n\t}\n\n\tchannels, err := models.NewChannel().ByParticipants(participants, query)\n\tif err != nil {\n\t\tif err == bongo.RecordNotFound {\n\t\t\treturn response.NewNotFound()\n\t\t}\n\t}\n\n\tcc := models.NewChannelContainers().\n\t\tPopulateWith(channels, context.Client.Account.Id).\n\t\tAddLastMessage(context.Client.Account.Id).\n\t\tAddUnreadCount(context.Client.Account.Id)\n\n\treturn response.HandleResultAndError(cc, cc.Err())\n}", "title": "" }, { "docid": "b87b75fe57957a5e74d45a260ac8a329", "score": "0.5567297", "text": "func (matchMakingExtProtocol *MatchMakingExtProtocol) GetParticipantsURLs(handler func(err error, client *nex.Client, callID uint32, lstGatherings []uint32)) {\n\tmatchMakingExtProtocol.GetParticipantsURLsHandler = handler\n}", "title": "" }, { "docid": "bce8db744b9b3ae2974434066aa1404c", "score": "0.5546894", "text": "func (m *CallEndedEventMessageDetail) SetCallParticipants(value []CallParticipantInfoable)() {\n m.callParticipants = value\n}", "title": "" }, { "docid": "e0c43c7aef2c2c2042503ec8ee41f192", "score": "0.5517259", "text": "func (matchMakingExtProtocol *MatchMakingExtProtocol) GetDetailedParticipants(handler func(err error, client *nex.Client, callID uint32, idGathering uint32, bOnlyActive bool)) {\n\tmatchMakingExtProtocol.GetDetailedParticipantsHandler = handler\n}", "title": "" }, { "docid": "98ae07866cae3e77951878c313517af7", "score": "0.5512858", "text": "func (m *EducationAssignmentIndividualRecipient) GetRecipients()([]string) {\n return m.recipients\n}", "title": "" }, { "docid": "ef80e82d1b3424ae4695b9d7d91aaf90", "score": "0.5361459", "text": "func ListParticipantsCommand() commands.Command {\n\treturn commands.Command{\n\t\tCallPhrase: \"list\",\n\t\tPermission: commands.Members,\n\t\tHelpDescription: \"List members interest in joining the next WS\",\n\t\tHandler: HandleListParticipants,\n\t\tHelp: commands.Help{\n\t\t\tSummary: \"List members interest in joining the next WS\",\n\t\t\tDetailedDescription: \"List every member that has opted in respectively out from the next White Star.\",\n\t\t\tSyntax: \"list\",\n\t\t\tExample: \"list\",\n\t\t},\n\t}\n}", "title": "" }, { "docid": "8b3b54b80cc7d79c2bfb3dc526cb1f6d", "score": "0.53121835", "text": "func HandleListParticipants(msg string, s *discordgo.Session, m *discordgo.MessageCreate, db *sql.DB, guildID string, cmds []commands.Command) {\n\tlistParticipants(\"\", channelToInstance(m.ChannelID, msg), s, m, db)\n}", "title": "" }, { "docid": "b06758474658dde9aba968f1509ac5b6", "score": "0.5226493", "text": "func (fw *FinalizingWorker) participants(contract *BallotContract) ([]Participant, error) {\n\t// inform\n\tfw.log.Debugf(\"loading participants of %s\", fw.ballot.Address.String())\n\n\t// create the filter to iterate over the list\n\tit, err := contract.FilterVoted(nil, []common.Address{fw.ballot.Address}, nil)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\t// make sure to close the iterator on leaving\n\tdefer func() {\n\t\terr := it.Close()\n\t\tif err != nil {\n\t\t\tfw.log.Errorf(\"failed to close votes iterator; %s\", err.Error())\n\t\t}\n\n\t\t// inform\n\t\tfw.log.Debugf(\"participants of %s loaded\", fw.ballot.Address.String())\n\t}()\n\n\t// prep the list\n\tlist := make([]Participant, 0)\n\n\t// loop the filter\n\tfor it.Next() {\n\t\t// make the participant\n\t\tparty := Participant{\n\t\t\tAddress: it.Event.Voter,\n\t\t\tVote: int(it.Event.Vote.Uint64()),\n\t\t\tTotal: fw.accountTotal(it.Event.Voter),\n\t\t\tTimeStamp: time.Now().UTC().Unix(),\n\t\t}\n\n\t\t// push to the list\n\t\tif party.Total != nil {\n\t\t\tlist = append(list, party)\n\t\t}\n\n\t\t// check for possible termination request\n\t\tselect {\n\t\tcase <-fw.sigTerminate:\n\t\t\t// re-enter consumed termination signal and end the loader\n\t\t\tfw.sigTerminate <- true\n\t\t\treturn nil, nil\n\t\tdefault:\n\t\t\t// just continue\n\t\t}\n\t}\n\n\t// return the list of participants\n\treturn list, nil\n}", "title": "" }, { "docid": "3032d2ae7d25230d948d49ea84526009", "score": "0.52100056", "text": "func (m *EducationClass) GetMembers()([]EducationUserable) {\n return m.members\n}", "title": "" }, { "docid": "06452bd053e99859cd236e40f3f784ba", "score": "0.52009773", "text": "func (c *HandlerContext) ParticipantHandler(w http.ResponseWriter, r *http.Request) {\n\tswitch r.Method {\n\tcase \"GET\":\n\t\tparticipants := []*users.User{}\n\t\tquery := r.URL.Query().Get(\"q\")\n\t\t//returns all the current users stored in the mongo db collection\n\t\tallUsers, err := c.UsersStore.GetAllUsers()\n\t\tif err != nil {\n\t\t\thttp.Error(w, fmt.Sprintf(\"error grabbing users from database: %v\", err), http.StatusInternalServerError)\n\t\t\treturn\n\t\t}\n\t\t//filters out users based on the query passed in params\n\t\tfor _, user := range allUsers {\n\t\t\tif strings.ToLower(user.AccountType) == \"participant\" &&\n\t\t\t\tstrings.Contains(strings.ToLower(user.GetFullName()), strings.TrimSpace(strings.ToLower(query))) {\n\t\t\t\tparticipants = append(participants, user)\n\t\t\t}\n\t\t}\n\t\t//encodes the users back to the client\n\t\terr = json.NewEncoder(w).Encode(participants)\n\t\tif err != nil {\n\t\t\thttp.Error(w, fmt.Sprintf(\"error encoding users to JSON: %v\", err), http.StatusInternalServerError)\n\t\t}\n\tdefault:\n\t\thttp.Error(w, \"wrong type of method\", http.StatusMethodNotAllowed)\n\t\treturn\n\t}\n}", "title": "" }, { "docid": "80a11d6439b418ea3710ddd8cf32459f", "score": "0.51806074", "text": "func FilterParticipants(participants []*Participant, fn func(*Participant) bool) []*Participant {\n\ti := 0\n\tfor _, p := range participants {\n\t\tif fn(p) {\n\t\t\tparticipants[i] = p\n\t\t\ti++\n\t\t}\n\t}\n\treturn participants[:i]\n}", "title": "" }, { "docid": "3c7b5e4a219d0924ccf2de68951257d0", "score": "0.5164359", "text": "func (act Account) GetParticipant(confSid string, callSid string) (Participant, error) {\n\tvar p Participant\n\tif !validateConferenceSid(confSid) {\n\t\treturn p, errors.New(\"Invalid conference sid\")\n\t} else if !validateCallSid(callSid) {\n\t\treturn p, errors.New(\"Invalid call sid\")\n\t}\n\terr := common.SendGetRequest(fmt.Sprintf(participant.Get, act.AccountSid, confSid, callSid), act, &p)\n\treturn p, err\n}", "title": "" }, { "docid": "87e32f684dfb9dc103ec8160c7d1aaed", "score": "0.5158885", "text": "func (m *CallParticipantInfoCollectionResponse) GetValue()([]CallParticipantInfoable) {\n val, err := m.GetBackingStore().Get(\"value\")\n if err != nil {\n panic(err)\n }\n if val != nil {\n return val.([]CallParticipantInfoable)\n }\n return nil\n}", "title": "" }, { "docid": "2d1ce53f23700794364c4860864e8c21", "score": "0.5138623", "text": "func (ptcp *Participants) TeamMembers(team common.Team) []*common.Player {\n\treturn ptcp.Called().Get(0).([]*common.Player)\n}", "title": "" }, { "docid": "d1e0f9a5890a14090457a431bb835b8a", "score": "0.5104995", "text": "func (a *LearningRepository) GetParticipantByCourse(id int) []*model.Participant {\n\t// DB Response struct\n\tparticipants := make([]*model.Participant, 0)\n\n\t// Data for query\n\tqueryParams := map[string]interface{}{\n\t\t\"course_id\": id,\n\t}\n\n\t// Compose query\n\tquery, err := a.conn.PrepareNamed(`SELECT username,status FROM course_participants WHERE course_id = :course_id`)\n\tif err != nil {\n\t\tfmt.Println(\"Error db GetParticipantByCourse->PrepareNamed : \", err)\n\t}\n\n\t// Execute query\n\terr = query.Select(&participants, queryParams)\n\tif err != nil {\n\t\tfmt.Println(\"Error db GetParticipantByCourse->query.Get : \", err)\n\t}\n\n\treturn participants\n}", "title": "" }, { "docid": "46578d98c1bfd0073f528daf31c0fc3f", "score": "0.5091156", "text": "func (c *ChannelsChannelParticipant) GetUsers() (value []UserClass) {\n\tif c == nil {\n\t\treturn\n\t}\n\treturn c.Users\n}", "title": "" }, { "docid": "9220e2398d09a66f9a68b22068053667", "score": "0.50589895", "text": "func (r *DeviceManagementRemoteAssistancePartnersCollectionRequest) Get(ctx context.Context) ([]RemoteAssistancePartner, error) {\n\treturn r.GetN(ctx, 0)\n}", "title": "" }, { "docid": "6c2d36aece437840cd8af025e61975af", "score": "0.5054601", "text": "func (c *Client) GetDepartingMembers(congress int, chamber string) (members []MemberInTransition, err error) {\n\tclient := &http.Client{}\n\treq, err := http.NewRequest(\"GET\", fmt.Sprintf(\"%s/%d/%s/members/leaving.json\", c.Endpoint, congress, chamber), nil)\n\tif err != nil {\n\t\treturn\n\t}\n\treq.Header.Add(\"X-API-Key\", c.Key)\n\tresp, err := client.Do(req)\n\tif err != nil {\n\t\treturn\n\t}\n\tvar unmarshaled getMembersInTransitionResponse\n\tbody, err := ioutil.ReadAll(resp.Body)\n\tif err != nil {\n\t\treturn\n\t}\n\terr = json.Unmarshal(body, &unmarshaled)\n\tif err != nil {\n\t\treturn\n\t}\n\t// Results are broken down by chamber\n\tif len(unmarshaled.Results) > 0 {\n\t\tmembers = unmarshaled.Results[0].Members\n\t}\n\tif len(unmarshaled.Results) > 1 {\n\t\tmembers = append(members, unmarshaled.Results[1].Members...)\n\t}\n\treturn\n}", "title": "" }, { "docid": "e43a3b741acce05b0b175be243bb015b", "score": "0.5039022", "text": "func (o *InlineResponse2005) GetPartners() UserCapability {\n\tif o == nil {\n\t\tvar ret UserCapability\n\t\treturn ret\n\t}\n\n\treturn o.Partners\n}", "title": "" }, { "docid": "9535d25585637f865d2e81e24efe7648", "score": "0.5035004", "text": "func (op *PaymentListenerOperation) GetParticipantOperatingAccounts() (accounts []model.Account, err error) {\n\tLOGGER.Debugf(\"getParticipantOperatingAccounts\")\n\n\tparticipantObj, err := op.PRClient.GetParticipantForDomain(os.Getenv(global_environment.ENV_KEY_HOME_DOMAIN_NAME))\n\tif err != nil {\n\t\tLOGGER.Errorf(\" Error GetParticipantForDomain failed: %v\", err)\n\t\treturn accounts, err\n\t}\n\n\tfor _, account := range participantObj.OperatingAccounts {\n\t\taccounts = append(accounts, *account)\n\t}\n\n\treturn accounts, err\n}", "title": "" }, { "docid": "33d5239fc21dd2ef8b8b90b0beb41df8", "score": "0.50174505", "text": "func GetPeople(c *gin.Context) {\n\tjson.NewEncoder(c.Writer).Encode(people)\n}", "title": "" }, { "docid": "5a039b6d996c72c3fc70a70aac5db942", "score": "0.5015791", "text": "func (c *ChannelsChannelParticipant) GetParticipant() (value ChannelParticipantClass) {\n\tif c == nil {\n\t\treturn\n\t}\n\treturn c.Participant\n}", "title": "" }, { "docid": "d27279d40c9c408f8badb5e7875e2624", "score": "0.5011481", "text": "func (m *InviteParticipantsOperation) Serialize(writer i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.SerializationWriter)(error) {\n err := m.CommsOperation.Serialize(writer)\n if err != nil {\n return err\n }\n if m.GetParticipants() != nil {\n cast := i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.CollectionCast[i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.Parsable](m.GetParticipants())\n err = writer.WriteCollectionOfObjectValues(\"participants\", cast)\n if err != nil {\n return err\n }\n }\n return nil\n}", "title": "" }, { "docid": "51d9369e74e1ee4f3ac64d8075f304a5", "score": "0.5003761", "text": "func (r *Discovery) GetMembers(accept filter) []*Member {\n\tidentityInfo := r.gossip.IdentityInfo()\n\tmapByID := identityInfo.ByID()\n\n\tvar peers []*Member\n\tfor _, m := range r.gossip.PeersOfChannel(common.ChannelID(r.channelID)) {\n\t\tidentity, ok := mapByID[string(m.PKIid)]\n\t\tif !ok {\n\t\t\tlogger.Warningf(\"[%s] Not adding peer [%s] as a validator since unable to determine MSP ID from PKIID for [%s]\", r.channelID, m.Endpoint)\n\t\t\tcontinue\n\t\t}\n\n\t\tm := &Member{\n\t\t\tNetworkMember: m,\n\t\t\tMSPID: string(identity.Organization),\n\t\t}\n\n\t\tif accept(m) {\n\t\t\tpeers = append(peers, m)\n\t\t}\n\t}\n\n\tif accept(r.Self()) {\n\t\tpeers = append(peers, r.Self())\n\t}\n\n\treturn peers\n}", "title": "" }, { "docid": "249040d1e8a4e9feab4faacce0a34a09", "score": "0.4985782", "text": "func (c *ApiService) ListParticipantConversation(params *ListParticipantConversationParams) ([]ConversationsV1ParticipantConversation, error) {\n\tresponse, errors := c.StreamParticipantConversation(params)\n\n\trecords := make([]ConversationsV1ParticipantConversation, 0)\n\tfor record := range response {\n\t\trecords = append(records, record)\n\t}\n\n\tif err := <-errors; err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn records, nil\n}", "title": "" }, { "docid": "3680e4f40b07c4146f97d7508e31fbf7", "score": "0.49792662", "text": "func (s *Service) GetParticipatedEvents(ctx context.Context) (map[string]struct{}, error) {\n\tuserID := constant.GetUserIDFromCtx(ctx)\n\n\tevents, err := s.storage.getParticipatedEvents(ctx, userID)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"get events with user participation: %w\", err)\n\t}\n\n\treturn events, nil\n}", "title": "" }, { "docid": "2e23a1c768137b7a1f7f81a8ab941da5", "score": "0.49703723", "text": "func (gpm *GivePeersMessage) GetPeers() []string {\n\tpeers := make([]string, len(gpm.Peers))\n\tfor i, ipaddr := range gpm.Peers {\n\t\tpeers[i] = ipaddr.String()\n\t}\n\treturn peers\n}", "title": "" }, { "docid": "75abdf8ed1377290a1390df9a6e4e064", "score": "0.4964697", "text": "func GetMembers(c context.Context, u *model.User, team string) ([]*model.Member, error) {\n\treturn FromContext(c).GetMembers(c, u, team)\n}", "title": "" }, { "docid": "d522573badcaf6692e04a6fd8c80b590", "score": "0.4963333", "text": "func (k Keeper) GetDrawParticipantsAndTickets(ctx sdk.Context) (participants []string, ticketsSold []types.Ticket) {\n\tparticipantsAddresses := map[string]bool{}\n\tk.IterateTickets(ctx, func(index int64, ticket types.Ticket) (stop bool) {\n\t\tif !participantsAddresses[ticket.Owner] {\n\t\t\tparticipants = append(participants, ticket.Owner)\n\t\t\tparticipantsAddresses[ticket.Owner] = true\n\t\t}\n\n\t\tticketsSold = append(ticketsSold, ticket)\n\t\treturn false\n\t})\n\n\treturn participants, ticketsSold\n}", "title": "" }, { "docid": "f527194180218d3013cfa7a4abc19e31", "score": "0.49533522", "text": "func (ptcp *Participants) All() []*common.Player {\n\treturn ptcp.Called().Get(0).([]*common.Player)\n}", "title": "" }, { "docid": "32b8cff0a50ad74032f0f4156444d097", "score": "0.49361902", "text": "func (s *BadgerStore) ParticipantEvents(participant string, skip int64) (EventHashes, error) {\n\tres, err := s.inmemStore.ParticipantEvents(participant, skip)\n\tif err != nil {\n\t\tres, err = s.dbParticipantEvents(participant, skip)\n\t}\n\treturn res, err\n}", "title": "" }, { "docid": "3fdebf3ba6fc24927a38484ceff7425c", "score": "0.492617", "text": "func (self *Person) GetContacts() []*Person {\n\tlog.Println(\"---> get contact was call!\", self.Contacts)\n\treturn self.Contacts\n}", "title": "" }, { "docid": "8362ed6aa0d8ff8b4909df7cdb37dd33", "score": "0.4908533", "text": "func (ptcp *Participants) Connected() []*common.Player {\n\treturn ptcp.Called().Get(0).([]*common.Player)\n}", "title": "" }, { "docid": "d364f89a4b566bb41b49d54196d6b3c4", "score": "0.49084106", "text": "func (this *ClusterManager) GetMembersIds() (peers []string) {\n\tfor k := range this.Members {\n\t\tpeers = append(peers, k)\n\t}\n\n\treturn\n}", "title": "" }, { "docid": "b283b2ab63a511c20ebb8e4305f90d47", "score": "0.49050036", "text": "func (o *MicrosoftGraphEducationClass) GetMembers() []MicrosoftGraphEducationUser {\n\tif o == nil || o.Members == nil {\n\t\tvar ret []MicrosoftGraphEducationUser\n\t\treturn ret\n\t}\n\treturn *o.Members\n}", "title": "" }, { "docid": "96d3e95dc5356cefc7977561035bfefc", "score": "0.48906422", "text": "func (t *Testing1) getParticipant(stub shim.ChaincodeStubInterface, args []string) peer.Response {\r\n\t//Checks appropriate number of arguments in incoming invoke request\r\n\tif len(args) < 2 {\r\n\t\treturn shim.Error(\"Invoke Error: Incorrect number of arguments - Two Argument expected\")\r\n\t}\r\n\t//Get Data\r\n\tdata := string(args[0])\r\n\t//Get Invoking Participant\r\n\tparticipantNamespace := \"PARTICIPANT\"\r\n\tparticipantID := string(args[1])\r\n\tparticipantKey := participantNamespace + \"-\" + participantID\r\n\t//Define Namespace\r\n\tnamespace := \"PARTICIPANT\"\r\n\r\n\t//Key for fetching/storing the Asset\r\n\tkeystring := namespace + \"-\" + data\r\n\r\n\t//Check if Invoking Participant already exists, return error if not.\r\n\tif value, geterr := stub.GetState(strings.ToLower(participantKey)); geterr != nil || value == nil {\r\n\t\treturn shim.Error(\"Invoke Error (Get Participant): Invoking Participant Does Not Exists! Please Enroll Participant\")\r\n\t}\r\n\r\n\t//Get the Asset from Blockchain\r\n\tvalue, geterr := stub.GetState(strings.ToLower(keystring))\r\n\tif geterr != nil || value == nil {\r\n\t\treturn shim.Error(\"Invoke Error (Get Participant): Error while fetching data from Blockchain\")\r\n\t}\r\n\treturn shim.Success(value)\r\n}", "title": "" }, { "docid": "62f93f5fa3a79f4b65260a6a1367fa29", "score": "0.48837507", "text": "func (_Lottery *LotteryCaller) GetPlayers(opts *bind.CallOpts) ([]common.Address, error) {\n\tvar (\n\t\tret0 = new([]common.Address)\n\t)\n\tout := ret0\n\terr := _Lottery.contract.Call(opts, out, \"getPlayers\")\n\treturn *ret0, err\n}", "title": "" }, { "docid": "0cb71e1d2fc9af5245ccc72f78de5efc", "score": "0.48787668", "text": "func (l *Listener) GetPeers() []*Peer {\n\tl.mu.RLock()\n\tdefer l.mu.RUnlock()\n\n\tvar r []*Peer\n\tfor p := range l.peers {\n\t\tr = append(r, p)\n\t}\n\treturn r\n}", "title": "" }, { "docid": "39ba3ce0c1ec1fd1d7196567f216ae38", "score": "0.4869012", "text": "func (r *ProberPoolResource) GetMembers(id string) (*ProberPoolMembersList, error) {\n\tvar list ProberPoolMembersList\n\tif err := r.c.ReadQuery(BasePath+ProberPoolEndpoint+\"/\"+id+ProberPoolMembersEndpoint, &list); err != nil {\n\t\treturn nil, err\n\t}\n\treturn &list, nil\n}", "title": "" }, { "docid": "c2e4bea4049c4433b234922a7bb22a46", "score": "0.4865683", "text": "func GetPeers(c *gin.Context) {\n\tpeerLock.Lock()\n\tdefer peerLock.Unlock()\n\n\tvar friendlyPeers = make([]*PeerData, 0, len(Peers))\n\tfor _, peer := range Peers {\n\t\tfriendlyPeers = append(friendlyPeers, &PeerData{\n\t\t\tAddress: peer.Connection.RemoteAddr().String(),\n\t\t\tID: peer.ID,\n\t\t})\n\t}\n\tc.JSON(http.StatusOK, friendlyPeers)\n}", "title": "" }, { "docid": "fb6aad1bbc48c1b1ce14a15261f47acd", "score": "0.48503527", "text": "func (o *Peers) GetPeers() []Peer {\n\tif o == nil {\n\t\tvar ret []Peer\n\t\treturn ret\n\t}\n\n\treturn o.Peers\n}", "title": "" }, { "docid": "4f309aa4eaf9ea98e7f692b4bb1b8bcd", "score": "0.48265043", "text": "func (r *RoomMap) Get(roomID string) []Participant {\n\tr.Mutex.RLock()\n\tdefer r.Mutex.RUnlock()\n\n\treturn r.Map[roomID]\n}", "title": "" }, { "docid": "19507259959c48b9e6b07ea4a6291296", "score": "0.4825627", "text": "func (o *PeersEntity) GetPeers() []PeerDTO {\n\tif o == nil || o.Peers == nil {\n\t\tvar ret []PeerDTO\n\t\treturn ret\n\t}\n\treturn *o.Peers\n}", "title": "" }, { "docid": "114e607f7ce5931d23e49ac6948a1d66", "score": "0.4795889", "text": "func (m *EducationRoot) GetUsers()([]EducationUserable) {\n return m.users\n}", "title": "" }, { "docid": "5327bcc0cef478a819687ca44a0ca91f", "score": "0.47807166", "text": "func (m *EducationClass) GetTeachers()([]EducationUserable) {\n return m.teachers\n}", "title": "" }, { "docid": "df653c4f6b16b05221b151229bb51054", "score": "0.47779748", "text": "func (e PlayGroupEdges) ParticipantsOrErr() ([]*Pet, error) {\n\tif e.loadedTypes[0] {\n\t\treturn e.Participants, nil\n\t}\n\treturn nil, &NotLoadedError{edge: \"participants\"}\n}", "title": "" }, { "docid": "081dfc4ecc9bc1b849e1c9f4c69a071b", "score": "0.47451642", "text": "func (gos *Gossiper) GetPeers() []string {\n\treturn gos.knownPeers.SafeRead()\n}", "title": "" }, { "docid": "e3e1b4fdb5b42b208e7fca8eb192ee1a", "score": "0.47262844", "text": "func NewInviteParticipantsOperation()(*InviteParticipantsOperation) {\n m := &InviteParticipantsOperation{\n CommsOperation: *NewCommsOperation(),\n }\n return m\n}", "title": "" }, { "docid": "aa35954dbb862495817df86bc689d51f", "score": "0.4708955", "text": "func (g *Game) GetPlayers() []*Player {\n\treturn g.players\n}", "title": "" }, { "docid": "ed18de593a21f409daca8d41ddd37322", "score": "0.47083145", "text": "func (client *RTMServerClient) GetRoomMembers(roomId int64, rest ...interface{}) ([]int64, error) {\n\n\tvar timeout time.Duration\n\tvar callback func([]int64, int, string)\n\n\tfor _, value := range rest {\n\t\tswitch value := value.(type) {\n\t\tcase time.Duration:\n\t\t\ttimeout = value\n\t\tcase func([]int64, int, string):\n\t\t\tcallback = value\n\t\tdefault:\n\t\t\treturn nil, errors.New(\"Invaild params when call RTMServerClient.GetRoomMembers() function.\")\n\t\t}\n\t}\n\n\tquest := client.genServerQuest(\"getroommembers\")\n\tquest.Param(\"rid\", roomId)\n\treturn client.sendSliceQuest(quest, timeout, \"uids\", callback)\n}", "title": "" }, { "docid": "2a986eaf0e88be60a679c401c64c5e6b", "score": "0.4706246", "text": "func GetLeagues(qparms rest.QParms) ([]League, error) {\n\tvar sb strings.Builder\n\tsb.Grow(100)\n\tsb.WriteString(config.Data.BaseURL)\n\tsb.WriteString(\"/leagues/\")\n\n\tbody, err := get(sb.String(), nil)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\t// Parse into an array of clans\n\ttype respType struct {\n\t\tLeagues []League `json:\"items\"`\n\t}\n\tvar resp respType\n\terr = json.Unmarshal(body, &resp)\n\tif err != nil {\n\t\tlog.Debug(\"failed to parse the json response\")\n\t\treturn nil, err\n\t}\n\n\treturn resp.Leagues, nil\n}", "title": "" }, { "docid": "7eac0c8350cd80a3ae019df2b2eabfce", "score": "0.469977", "text": "func (r *DeviceManagementDeviceManagementPartnersCollectionRequest) Get(ctx context.Context) ([]DeviceManagementPartner, error) {\n\treturn r.GetN(ctx, 0)\n}", "title": "" }, { "docid": "0cb2eb24aef1c8174d8fbd0fe8ebc262", "score": "0.46873623", "text": "func (p *People) GetActivePeople() []Person {\r\n\tvar activeUsers []Person\r\n\tfor _, person := range p.idToPerson {\r\n\t\tif person.Active {\r\n\t\t\tactiveUsers = append(activeUsers, person)\r\n\t\t}\r\n\t}\r\n\treturn activeUsers\r\n}", "title": "" }, { "docid": "5210ef189be2fe5fb4fe1982ca855775", "score": "0.46870834", "text": "func (msg ListMiniMsg) GetInvolvedAddresses() []types.AccAddress {\n\treturn msg.GetSigners()\n}", "title": "" }, { "docid": "8c3bb7c71c535fdb4828d6df483baff7", "score": "0.46840382", "text": "func (s *ChannelsSendAsPeers) GetPeers() (value []SendAsPeer) {\n\tif s == nil {\n\t\treturn\n\t}\n\treturn s.Peers\n}", "title": "" }, { "docid": "5fc74b0a16b0bf10ff9e3f929aa6d15d", "score": "0.4681576", "text": "func (e *Engine) Peers() []peer.ID {\n\te.lock.RLock()\n\tdefer e.lock.RUnlock()\n\n\tresponse := make([]peer.ID, 0, len(e.ledgerMap))\n\n\tfor _, ledger := range e.ledgerMap {\n\t\tresponse = append(response, ledger.Partner)\n\t}\n\treturn response\n}", "title": "" }, { "docid": "d2f199a2db06a42e63ddba2ef41ff7cb", "score": "0.46798724", "text": "func (c *ClientServer) ChatUsers(ctx context.Context, chatID string) ([]string, error) {\n\tc.mutex.Lock()\n\tlist := c.client.GetChatList()[chatID].ClientsIPsList()\n\tc.mutex.Unlock()\n\n\t// log.Println(\"ChatUsers: chatID \", chatID, \" resp: \", list)\n\n\tlog.WithFields(log.Fields{\n\t\t\"chatID\": chatID,\n\t\t\"resp\": list,\n\t}).Debug(\"ChatUsers:\")\n\n\tif list != nil {\n\t\treturn list, nil\n\t}\n\n\treturn nil, errors.New(\"clients IPs List could be not returned\")\n}", "title": "" }, { "docid": "59f60d40de9db1bd7e1c4709c53e85d0", "score": "0.46644947", "text": "func (o *NewRole) GetMembers() []int32 {\n\tif o == nil {\n\t\tvar ret []int32\n\t\treturn ret\n\t}\n\n\treturn o.Members\n}", "title": "" }, { "docid": "64af499d8cebb71c4c6b9a16970b655e", "score": "0.4663373", "text": "func (m *IncomingContext) GetObservedParticipantId()(*string) {\n val, err := m.GetBackingStore().Get(\"observedParticipantId\")\n if err != nil {\n panic(err)\n }\n if val != nil {\n return val.(*string)\n }\n return nil\n}", "title": "" }, { "docid": "61f00c918d3b23175d10bf18e66229f4", "score": "0.46631876", "text": "func (*PhoneGetParticipants) Descriptor() ([]byte, []int) {\n\treturn file_chat_phone_proto_rawDescGZIP(), []int{8}\n}", "title": "" }, { "docid": "ca9d7f008f9ff4a3e2cc60dd267d6a9f", "score": "0.46559444", "text": "func (m *DeviceAndAppManagementRoleAssignment) GetMembers()([]string) {\n return m.members\n}", "title": "" }, { "docid": "b91946196faae117337f127683f2dd6a", "score": "0.4648269", "text": "func (c *Channel) SetParticipantsCount(value int) {\n\tc.Flags.Set(17)\n\tc.ParticipantsCount = value\n}", "title": "" }, { "docid": "24610919d5deb9c72057b368b2904ba6", "score": "0.463538", "text": "func (c *DefaultApiService) ListVideoParticipantSummary(RoomSid string, params *ListVideoParticipantSummaryParams) (*ListVideoParticipantSummaryResponse, error) {\n\tpath := \"/v1/Video/Rooms/{RoomSid}/Participants\"\n\tpath = strings.Replace(path, \"{\"+\"RoomSid\"+\"}\", RoomSid, -1)\n\n\tdata := url.Values{}\n\theaders := make(map[string]interface{})\n\n\tif params != nil && params.PageSize != nil {\n\t\tdata.Set(\"PageSize\", fmt.Sprint(*params.PageSize))\n\t}\n\n\tresp, err := c.requestHandler.Get(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 := &ListVideoParticipantSummaryResponse{}\n\tif err := json.NewDecoder(resp.Body).Decode(ps); err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn ps, err\n}", "title": "" }, { "docid": "d927e5d707f2fd5f0b87e42412ebadf0", "score": "0.46282834", "text": "func (service *P2P) GetPeers() []*Peer {\n\tpeers := make([]*Peer, 0)\n\tservice.outbountPeers.Range(\n\t\tfunc(key, value interface{}) bool {\n\t\t\tpeer := value.(*Peer)\n\t\t\tpeers = append(peers, peer)\n\t\t\treturn true\n\t\t},\n\t)\n\tservice.inboundPeers.Range(\n\t\tfunc(key, value interface{}) bool {\n\t\t\tpeer := value.(*Peer)\n\t\t\tpeers = append(peers, peer)\n\t\t\treturn true\n\t\t},\n\t)\n\treturn peers\n}", "title": "" }, { "docid": "16dddbd85b1717e086272680f5af9883", "score": "0.46173978", "text": "func (_Lottery *LotteryCallerSession) GetPlayers() ([]common.Address, error) {\n\treturn _Lottery.Contract.GetPlayers(&_Lottery.CallOpts)\n}", "title": "" }, { "docid": "164fa94e99518fd877bec7940784c791", "score": "0.45862794", "text": "func (o *InlineObject742) GetRecipients() []MicrosoftGraphDriveRecipient {\n\tif o == nil || o.Recipients == nil {\n\t\tvar ret []MicrosoftGraphDriveRecipient\n\t\treturn ret\n\t}\n\treturn *o.Recipients\n}", "title": "" }, { "docid": "927e34cce78482ab2e011a638eedb4db", "score": "0.45839193", "text": "func (c *Cluster) Peers() []api.ID {\n\tmembers, err := c.consensus.Peers()\n\tif err != nil {\n\t\tlogger.Error(err)\n\t\tlogger.Error(\"an empty list of peers will be returned\")\n\t\treturn []api.ID{}\n\t}\n\tlenMembers := len(members)\n\n\tpeersSerial := make([]api.IDSerial, lenMembers, lenMembers)\n\tpeers := make([]api.ID, lenMembers, lenMembers)\n\n\tctxs, cancels := rpcutil.CtxsWithCancel(c.ctx, lenMembers)\n\tdefer rpcutil.MultiCancel(cancels)\n\n\terrs := c.rpcClient.MultiCall(\n\t\tctxs,\n\t\tmembers,\n\t\t\"Cluster\",\n\t\t\"ID\",\n\t\tstruct{}{},\n\t\trpcutil.CopyIDSerialsToIfaces(peersSerial),\n\t)\n\n\tfor i, err := range errs {\n\t\tif err != nil {\n\t\t\tpeersSerial[i].ID = peer.IDB58Encode(members[i])\n\t\t\tpeersSerial[i].Error = err.Error()\n\t\t}\n\t}\n\n\tfor i, ps := range peersSerial {\n\t\tpeers[i] = ps.ToID()\n\t}\n\treturn peers\n}", "title": "" }, { "docid": "11288492fbc40c5b4668b74529c4d89c", "score": "0.45793608", "text": "func (m *Event) GetAttendees()([]Attendeeable) {\n return m.attendees\n}", "title": "" }, { "docid": "4a73d498ad528642904e48d046d5137c", "score": "0.45774758", "text": "func (q rsvpParticipantQuery) All(ctx context.Context, exec boil.ContextExecutor) (RSVPParticipantSlice, error) {\n\tvar o []*RSVPParticipant\n\n\terr := q.Bind(ctx, exec, &o)\n\tif err != nil {\n\t\treturn nil, errors.Wrap(err, \"models: failed to assign all query results to RSVPParticipant slice\")\n\t}\n\n\treturn o, nil\n}", "title": "" }, { "docid": "5bf50890271dff5dab47bb08acde46e2", "score": "0.45753765", "text": "func (t *Twitch) GetChatters(ctx context.Context, channel string) (*Chatters, error) {\n\turl := \"https://tmi.twitch.tv/group/user/\" + strings.ToLower(channel) + \"/chatters\"\n\n\tresp, err := ctxhttp.Get(ctx, t.cli, url)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tdefer resp.Body.Close()\n\n\tif err := statusToError(resp.StatusCode); err != nil {\n\t\treturn nil, err\n\t}\n\n\tc := &Chatters{}\n\n\tif err := jsonx.DecodeSingle(resp.Body, c); err != nil {\n\t\treturn nil, ErrServerError\n\t}\n\n\treturn c, nil\n}", "title": "" }, { "docid": "8fc1533227780111573abd9c9ad52c03", "score": "0.4561387", "text": "func (c *Client) GetMembers(congress int, chamber string) (members []MemberSummary, err error) {\n\tclient := &http.Client{}\n\treq, err := http.NewRequest(\"GET\", fmt.Sprintf(\"%s/%d/%s/members.json\", c.Endpoint, congress, chamber), nil)\n\tif err != nil {\n\t\treturn\n\t}\n\treq.Header.Add(\"X-API-Key\", c.Key)\n\tresp, err := client.Do(req)\n\tif err != nil {\n\t\treturn\n\t}\n\tvar unmarshaled getMembersResponse\n\tbody, err := ioutil.ReadAll(resp.Body)\n\tif err != nil {\n\t\treturn\n\t}\n\terr = json.Unmarshal(body, &unmarshaled)\n\tif err != nil {\n\t\treturn\n\t}\n\tif len(unmarshaled.Results) > 0 {\n\t\tmembers = unmarshaled.Results[0].Members\n\t}\n\treturn\n}", "title": "" }, { "docid": "24e46c3fa51c6ea90c0cf15d96e22603", "score": "0.45594892", "text": "func (r *AccountsClientsInvitationsService) Get(accountId int64, clientAccountId int64, invitationId int64) *AccountsClientsInvitationsGetCall {\n\tc := &AccountsClientsInvitationsGetCall{s: r.s, urlParams_: make(gensupport.URLParams)}\n\tc.accountId = accountId\n\tc.clientAccountId = clientAccountId\n\tc.invitationId = invitationId\n\treturn c\n}", "title": "" }, { "docid": "8403b03675a3699d2ebf479e16089d1c", "score": "0.45569935", "text": "func GetInvitations(user string) ([]string, error) {\n\trows, err := db.Query(\"SELECT id FROM invitations WHERE creator=?\", user)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tdefer rows.Close()\n\n\tvar s string\n\tinv := make([]string, 0)\n\n\tfor rows.Next() {\n\t\terr = rows.Scan(&s)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tinv = append(inv, s)\n\t}\n\treturn inv, nil\n}", "title": "" }, { "docid": "3294a1ff4408438f570234b1e6a76f7d", "score": "0.45542938", "text": "func GetPeople(w http.ResponseWriter, r *http.Request) {\n\tw.Header().Set(\"content-type\", \"application/json\")\n\n\t/*//validate the jwt token\n\t_, err := security.ValidateToken(w, r)\n\tif err != nil {\n\t\tw.WriteHeader(http.StatusUnauthorized)\n\t\tw.Write([]byte(err.Error()))\n\t\treturn\n\t}*/\n\n\t//get all users\n\tvar people []data.Person\n\tfoundPeople := data.DB.Find(&people)\n\tif foundPeople.Error != nil {\n\t\thttp.Error(w, \"No users exist\", http.StatusBadRequest)\n\t\treturn\n\t}\n\n\tvar _people []string\n\tfor i := 0; i < len(people); i++ {\n\t\t_people = append(_people, people[i].Name)\n\t}\n\n\tjson.NewEncoder(w).Encode(&_people)\n}", "title": "" }, { "docid": "78f874971780a1b037825869a0c74a29", "score": "0.45535266", "text": "func (o *AccountItemParamsAccountItem) GetPartners() []AccountItemParamsAccountItemItems {\n\tif o == nil || o.Partners == nil {\n\t\tvar ret []AccountItemParamsAccountItemItems\n\t\treturn ret\n\t}\n\treturn *o.Partners\n}", "title": "" } ]
9ad8026f443817f3d65fea41cc522a1f
NewFollowerRepository returns a new instance of FollowerRepository.
[ { "docid": "1435611bc84f436e63364d9cdc8f3127", "score": "0.8280395", "text": "func NewFollowerRepository(db database.Database) FollowerRepository {\n\treturn &followerRepository{db: db}\n}", "title": "" } ]
[ { "docid": "19f96b99815604f0e3207704570de63b", "score": "0.65979606", "text": "func newFollower(configuration *configpb.Configuration, followerID string, followerAddress *configpb.ServiceAddress) (*follower, error) {\n\t// Connect to the leader\n\tconn, err := dial(configuration.Leader)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tlogger.Printf(\"Connected to leader at address %v\", configuration.Leader)\n\treturn &follower{\n\t\tid: followerID,\n\t\taddress: followerAddress,\n\t\tstore: make(map[string]*data),\n\t\tstoreMutex: sync.Mutex{},\n\t\tdone: make(chan bool),\n\t\tconn: conn,\n\t\tleader: lpb.NewLeaderClient(conn),\n\t}, nil\n}", "title": "" }, { "docid": "0df7642774a04dbfc7998131e3c5d1e1", "score": "0.6577138", "text": "func NewFollower(filename string) (Follower, error) {\n\tf := &followerImpl{\n\t\tfilename: filename,\n\t}\n\n\tif err := f.start(); err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn f, nil\n}", "title": "" }, { "docid": "813fcf52a369c5fcdf6db0aab9bb86fb", "score": "0.63124293", "text": "func (a *Actor) NewFollower(iri string, inbox string) error {\n\ta.followers[iri] = inbox\n\treturn a.save()\n}", "title": "" }, { "docid": "22d43fa5f6824ce4a55a176ceadc8087", "score": "0.5910445", "text": "func NewRepository() *Repository {\n\treturn &Repository{\n\t\tidData: make(map[string]*users.User),\n\t\tusernameData: make(map[string]*users.User),\n\t\tlastAdded: nil,\n\t}\n}", "title": "" }, { "docid": "4dc65cd480567e547f09f3abd9619819", "score": "0.58523256", "text": "func NewRepository(\n\thydroAdapter hydro.Adapter,\n\tbasePath string,\n\tptr interface{},\n) files.Repository {\n\treturn createRepository(hydroAdapter, basePath, ptr)\n}", "title": "" }, { "docid": "3b1d87957757c2b7a1bc571cd6725f6d", "score": "0.5838341", "text": "func NewPartnerRepository() *PartnerRepository {\n\treturn &PartnerRepository{}\n}", "title": "" }, { "docid": "4f84886c4e6dc429d944bf7bee4f868d", "score": "0.57818717", "text": "func NewRepository() (*Repository, error) {\n\treturn &Repository{\n\t\tClassifierRepository: &ClassifierRepository{\n\t\t\tclassifiers: make(map[string]*classifier.Classifier),\n\t\t\tmu: new(sync.RWMutex),\n\t\t},\n\t}, nil\n}", "title": "" }, { "docid": "0dd2807eb8f0ac568d176c1de2c32968", "score": "0.575081", "text": "func (ri *RepositoryInteractor) New(name, projectBranch, publicBranch, accessToken string) (*Repository, error) {\n\tdomainRepository := domain.Repository{\n\t\tID: uuid.New(),\n\t\tName: name,\n\t\tProjectBranch: projectBranch,\n\t\tPublicBranch: publicBranch,\n\t\tAccessToken: accessToken,\n\t}\n\terr := ri.RepositoryRepository.New(domainRepository)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn &Repository{\n\t\tID: domainRepository.ID,\n\t\tName: domainRepository.Name,\n\t\tProjectBranch: domainRepository.ProjectBranch,\n\t\tPublicBranch: domainRepository.PublicBranch,\n\t\tAccessToken: domainRepository.AccessToken,\n\t}, nil\n}", "title": "" }, { "docid": "d5602f341ee0d03e767b29de133d4dad", "score": "0.5719778", "text": "func NewRepository(owner Owner, name string) *Repository {\n\treturn &Repository{\n\t\tCreated: time.Now(),\n\t\tModified: time.Now(),\n\t\tName: name,\n\t\tPublic: false,\n\t\tOwner: owner.GetID(),\n\t}\n}", "title": "" }, { "docid": "c1821cbc1eec9ec5775ea910112d56e0", "score": "0.56993663", "text": "func NewMockFollower(ctrl *gomock.Controller) *MockFollower {\n\tmock := &MockFollower{ctrl: ctrl}\n\tmock.recorder = &MockFollowerMockRecorder{mock}\n\treturn mock\n}", "title": "" }, { "docid": "7b17ce4f5f1619cb6945bff8ec95a6d7", "score": "0.5680536", "text": "func NewRepository(converter EntityConverter) *repository {\n\treturn &repository{\n\t\tconv: converter,\n\t\tgetter: repo.NewSingleGetterWithEmbeddedTenant(destinationTable, tenantIDColumn, destinationColumns),\n\t\tdeleter: repo.NewDeleterWithEmbeddedTenant(destinationTable, tenantIDColumn),\n\t\tglobalDeleter: repo.NewDeleterGlobal(resource.Destination, destinationTable),\n\t\tupserterWithEmbeddedTenant: repo.NewUpserterWithEmbeddedTenant(resource.Destination, destinationTable, destinationColumns, conflictingColumns, updateColumns, tenantIDColumn),\n\t\tupserterGlobal: repo.NewUpserterGlobal(resource.Destination, destinationTable, destinationColumns, conflictingColumns, updateColumns),\n\t\tlister: repo.NewListerWithEmbeddedTenant(destinationTable, tenantIDColumn, destinationColumns),\n\t}\n}", "title": "" }, { "docid": "06640816b9454f91295fc8a4c39839c2", "score": "0.56652325", "text": "func (r *Restic) NewRepo(location Location) (*Repository, error) {\n\treturn NewRepository(location, r), nil\n}", "title": "" }, { "docid": "bacb66372e98ca7a9072432974194047", "score": "0.5618626", "text": "func FollowNew(id ID, ob Item) *Follow {\n\ta := ActivityNew(id, FollowType, ob)\n\to := Follow(*a)\n\treturn &o\n}", "title": "" }, { "docid": "45350422b4378eef618985e11afeade2", "score": "0.56156456", "text": "func NewRepository(s Storer) (*Repository, error) {\n\treturn &Repository{\n\t\ts: s,\n\t\tr: make(map[string]*Remote, 0),\n\t}, nil\n}", "title": "" }, { "docid": "f4c1eac35516f5dd53acdccbea5b9885", "score": "0.55817163", "text": "func NewRepo(ta IAdapter) Repo {\n\treturn Repo{\n\t\ttractorAdapter: ta,\n\t}\n}", "title": "" }, { "docid": "4d0a3dbef05d5dfdf43c2873118cb156", "score": "0.55598176", "text": "func NewRepository(brokers, topic string) *Repository {\n\treturn &Repository{\n\t\tmemoryRepository: memory.NewRepository(),\n\t\tWriter: kafka.NewWriter(kafka.WriterConfig{\n\t\t\tBrokers: strings.Split(brokers, \",\"),\n\t\t\tTopic: topic,\n\t\t\tBalancer: &kafka.LeastBytes{},\n\t\t}),\n\t\tReader: kafka.NewReader(kafka.ReaderConfig{\n\t\t\tBrokers: strings.Split(brokers, \",\"),\n\t\t\tTopic: topic,\n\t\t\tMinBytes: 10e3, // 10KB\n\t\t\tMaxBytes: 10e6, // 10MB\n\t\t}),\n\t}\n}", "title": "" }, { "docid": "8455c9d19f433d59bc80fbc1a87d8704", "score": "0.551506", "text": "func NewRepository() storage.Repository {\n\tposts := make(map[string]*model.Post)\n\treturn &repository{\n\t\tposts: posts,\n\t}\n}", "title": "" }, { "docid": "87b7fcec6af1278fd561800b887824e7", "score": "0.55131215", "text": "func newRepository(segments []string, ctxBranch *string, configuration config.Configuration) (types.RepositoryService, error) {\n\tvar repositoryService types.RepositoryService\n\n\t// Default branch that will be used if a branch\n\t// is not passed in though the optional 'branch'\n\t// query parameter and is not part of the url.\n\tbranch := master\n\n\tif len(segments) <= 2 {\n\t\treturn repositoryService, ErrInvalidPath\n\t}\n\n\t// If the query parameter field 'branch' is not\n\t// empty then set the branch name to the query\n\t// parameter value.\n\tif ctxBranch != nil {\n\t\tbranch = *ctxBranch\n\t} else if len(segments) > 4 {\n\t\t// If the user has not specified the branch\n\t\t// check whether it is passed in through\n\t\t// the URL.\n\t\tif segments[3] == tree {\n\t\t\tbranch = segments[4]\n\t\t}\n\t}\n\n\trepositoryService = githubRepository{\n\t\towner: segments[1],\n\t\trepository: segments[2],\n\t\tbranch: branch,\n\t\tclientID: configuration.Github.ClientID,\n\t\tclientSecret: configuration.Github.ClientSecret,\n\t}\n\n\treturn repositoryService, nil\n}", "title": "" }, { "docid": "4fcbe92e9d71e5bc7ef42e1a774f8a1f", "score": "0.5499471", "text": "func New(p persistence.IPersistance) *Repository {\n\treturn &Repository{\n\t\tp,\n\t}\n}", "title": "" }, { "docid": "7849134283383748f296dae5000ab353", "score": "0.54937035", "text": "func NewRepository(db *sqlx.DB, user *user.Repository, userAccount *user_account.Repository, account *account.Repository) *Repository {\n\treturn &Repository{\n\t\tDbConn: db,\n\t\tUser: user,\n\t\tUserAccount: userAccount,\n\t\tAccount: account,\n\t}\n}", "title": "" }, { "docid": "60df883fed412b66aeed2957ef531db5", "score": "0.54885435", "text": "func newRepoWalker(r *git.Repository, repoURL string, repoCache *RepoCache) *repoWalker {\n\tu, _ := url.Parse(repoURL)\n\treturn &repoWalker{\n\t\trepo: r,\n\t\trepoURL: u,\n\t\ttree: map[fileKey]BlobLocation{},\n\t\trepoCache: repoCache,\n\t\tsubRepoVersions: map[string]plumbing.Hash{},\n\t}\n}", "title": "" }, { "docid": "7262277099cd6673e5ae896847ca0b75", "score": "0.54824126", "text": "func NewRepository() IRepository {\n\treturn &Repository{\n\t\tDB: db.DB,\n\t}\n}", "title": "" }, { "docid": "353e1fea7676f2ac67793e42e82f06e0", "score": "0.5481997", "text": "func NewRepository(ctx context.Context, options map[string]interface{}, logger *log.Logger) (*UserRepository, error) {\n\tadapter, err := storage.NewPSQL(ctx, options, logger)\n\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn &UserRepository{\n\t\tAdapter: adapter,\n\t}, nil\n}", "title": "" }, { "docid": "9a5303ebcb5c37e5077d5bb99e6aa231", "score": "0.54793227", "text": "func NewTravellerRepository() traveller.Repository {\n\treturn &travellerRepository{}\n}", "title": "" }, { "docid": "22683306350367dedec49e1689c2c5a7", "score": "0.5469225", "text": "func NewRepository(db *gorm.DB) domain.AccountRepository {\n\terr := db.AutoMigrate(&Account{})\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn &accountRepositoryImplement{db}\n}", "title": "" }, { "docid": "44f49aa065293c9ded2103b532a18813", "score": "0.54684055", "text": "func NewRepository(dbConn *db.Conn) Repository {\n\tif dbConn != nil {\n\t\tdbConn.GetDB().AutoMigrate(User{})\n\t}\n\n\treturn &repository{\n\t\tdbConn: dbConn,\n\t}\n}", "title": "" }, { "docid": "8260e0dcf4dc1a096310ca4e63efe3e8", "score": "0.5466041", "text": "func NewPersonRepository(cfg *db.Configuration, session *sqlx.DB) repositories.Person {\n\t// Defines allowed columns\n\tdefaultColumns := []string{\n\t\t\"id\", \"principal\", \"meta\",\n\t}\n\n\t// Sortable columns\n\tsortableColumns := []string{\n\t\t\"principal\",\n\t}\n\n\treturn &pgPersonRepository{\n\t\tadapter: db.NewCRUDTable(session, \"\", PersonTableName, defaultColumns, sortableColumns),\n\t}\n}", "title": "" }, { "docid": "0b3ec33818494f0830a55d9902cbda82", "score": "0.54360914", "text": "func NewRepositoryFactory(owner string) RepositoryFactory {\n\treturn &repositoryFactory{owner: owner}\n}", "title": "" }, { "docid": "1369a10d34e423ad23c2476f0b463a06", "score": "0.5435749", "text": "func NewNotaryRepository(baseDir, gun, baseURL string, rt http.RoundTripper,\n\tpassphraseRetriever passphrase.Retriever) (*NotaryRepository, error) {\n\n\tkeyStoreManager, err := keystoremanager.NewKeyStoreManager(baseDir, passphraseRetriever)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tcryptoService := cryptoservice.NewCryptoService(gun, keyStoreManager.NonRootKeyStore())\n\n\tnRepo := &NotaryRepository{\n\t\tgun: gun,\n\t\tbaseDir: baseDir,\n\t\tbaseURL: baseURL,\n\t\ttufRepoPath: filepath.Join(baseDir, tufDir, filepath.FromSlash(gun)),\n\t\tcryptoService: cryptoService,\n\t\troundTrip: rt,\n\t\tKeyStoreManager: keyStoreManager,\n\t}\n\n\tfileStore, err := store.NewFilesystemStore(\n\t\tnRepo.tufRepoPath,\n\t\t\"metadata\",\n\t\t\"json\",\n\t\t\"\",\n\t)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tnRepo.fileStore = fileStore\n\n\treturn nRepo, nil\n}", "title": "" }, { "docid": "6b565d482e8cbe5484d5fba2d898b562", "score": "0.5424286", "text": "func NewRepository(database string) *Repository {\n\treturn &Repository{database: database}\n}", "title": "" }, { "docid": "9b280892f5bee448de05ed01a15750e0", "score": "0.5416286", "text": "func NewRepository(source string, dir string, main bool) RepositoryInterface {\n\treturn &repository{\n\t\tsource: source,\n\t\tdir: dir,\n\t\tmain: main,\n\t}\n}", "title": "" }, { "docid": "6dcb8ff03fac29f97d2fef32ddd8f1da", "score": "0.5415883", "text": "func NewRepository(URL string, branch string, strict bool, rank int, targetDir string) Repository {\n\tr := Repository{\n\t\tURL: URL,\n\t\tBranch: branch,\n\t\tStrict: strict,\n\t\tRank: rank,\n\t}\n\tvar err error\n\tr.Path, _ = r.getRepoPath()\n\tr.Path = filepath.Join(targetDir, r.Path)\n\n\tif filesystem.IsDir(r.Path) {\n\t\tr.Repo, err = git.PlainOpen(r.Path)\n\t\tif err != nil && err != git.NoErrAlreadyUpToDate {\n\t\t\tlog.Fatal(err)\n\t\t}\n\t\t// fetches head of the appropriate branch\n\t\thead, err := r.Repo.Head()\n\t\tif err != nil {\n\t\t\tlog.Fatal(err)\n\t\t}\n\n\t\t// hashes the commit to get commit tree\n\t\tcommit, err := r.Repo.CommitObject(head.Hash())\n\t\tif err != nil {\n\t\t\tlog.Fatal(err)\n\t\t}\n\t\tr.Tree, err = commit.Tree()\n\t\tif err != nil {\n\t\t\tlog.Fatal(err)\n\t\t}\n\t\tr.FetchKeyRing()\n\t}\n\treturn r\n}", "title": "" }, { "docid": "e11d02ec64c25a279fda6e5f2baced38", "score": "0.5409899", "text": "func New(redis *redis.Client) *Repository {\n\treturn &Repository{\n\t\tRedis: redis,\n\t}\n}", "title": "" }, { "docid": "83c4f53a0a34c4dc030c54ca49443a54", "score": "0.54007006", "text": "func NewRepository(client *dynamodb.DynamoDB) *Repository {\n\treturn &Repository{client}\n}", "title": "" }, { "docid": "efdc2f41a941f86788057de7f3f5a5d0", "score": "0.5400637", "text": "func NewRepository() *Repository {\n\treturn &Repository{\n\t\tSessions: make(map[string]Session),\n\t}\n}", "title": "" }, { "docid": "cfa266922bf5cddf7cf62cf741369ad8", "score": "0.5397434", "text": "func NewRepository() *RepositoryImpl {\n\treturn &RepositoryImpl{}\n}", "title": "" }, { "docid": "5b2e93a34fb3644d82613eb89ee4deb7", "score": "0.5368955", "text": "func NewNotificationRepository() *Notification {\n\tdb().AutoMigrate(&model.Notification{})\n\treturn new(Notification)\n}", "title": "" }, { "docid": "3c1c85e996132422f228d807acabd142", "score": "0.5367838", "text": "func NewRepository(s string) InterviewRepository {\n\tif s == \"MemoryRepository\" {\n\t\treturn NewMemoryRepository()\n\t}\n\n\tif s == \"DBInterviewRepository\" {\n\t\treturn NewDBInterviewRepository(\"uri\")\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "ba19aa8f3926fccffa7543aaf056c8c7", "score": "0.5344331", "text": "func newRepository() repository {\n\treturn make(map[string]string)\n}", "title": "" }, { "docid": "01ae1ad583634a488fec984127b499f6", "score": "0.5343937", "text": "func initFollower(filename string) (*follower.Follower, error) {\n\tt, err := follower.New(filename, follower.Config{\n\t\tWhence: io.SeekEnd,\n\t\tOffset: 0,\n\t\tReopen: true,\n\t})\n\treturn t, err\n}", "title": "" }, { "docid": "0824dcb3e1142830478b4cc65a11033b", "score": "0.53420466", "text": "func NewRepository(db *sql.DB) Repository {\n\treturn Repository{\n\t\tdb: db,\n\t}\n}", "title": "" }, { "docid": "6c821e9b051874cbae0e0f2a8b94a40d", "score": "0.5328314", "text": "func NewRepo(repo eh.ReadWriteRepo) *Repo {\n\treturn &Repo{\n\t\tReadWriteRepo: repo,\n\t}\n}", "title": "" }, { "docid": "385b82927c3e5addae2e8e642d182963", "score": "0.5328108", "text": "func New(basePath string) Interface {\n\treturn repo{basePath: basePath}\n}", "title": "" }, { "docid": "667f8ff55e2bdf0e7ad1a7d2ee4f2252", "score": "0.5322613", "text": "func NewRepository(opts *redis.Options) Repository {\n\treturn &redisRepo{\n\t\tclient: redis.NewClient(opts),\n\t}\n}", "title": "" }, { "docid": "be25f840fd2e2802f207e03294635902", "score": "0.5312491", "text": "func NewRepository(db *dbcontext.DB, logger log.Logger) Repository {\n\treturn repository{db, logger}\n}", "title": "" }, { "docid": "be25f840fd2e2802f207e03294635902", "score": "0.5312491", "text": "func NewRepository(db *dbcontext.DB, logger log.Logger) Repository {\n\treturn repository{db, logger}\n}", "title": "" }, { "docid": "1e3134682e7237305b14a03a82e04bc4", "score": "0.5312168", "text": "func NewRepository() DbRepository {\n\treturn &dbRepository{}\n}", "title": "" }, { "docid": "34a62acb6315fdf5bd9ebda129431909", "score": "0.5305902", "text": "func NewRepository() DBRepository {\n\treturn &dbRepository{}\n}", "title": "" }, { "docid": "9a72f2f7e708170058336a9e69752d67", "score": "0.5302874", "text": "func NewRepository(db *pg.DB) interfaces.Repository {\n\treturn &repository{\n\t\tDB: db,\n\t}\n}", "title": "" }, { "docid": "8f87cec5da902d927c7ca5379bb9f846", "score": "0.53022283", "text": "func NewRepository(s StorageProvider) Repository {\n\treturn Repository{\n\t\tStorage: s,\n\t}\n}", "title": "" }, { "docid": "b21ff149b3b49d5ef169e24d420568a0", "score": "0.5286677", "text": "func NewRepository() Repository {\n\tdB, err := createDBConnection()\n\tif err != nil {\n\t\tfmt.Println(\"Error conecting DB\")\n\t\tpanic(\"Exiting...\")\n\t}\n\treturn ServerInfoRepository{db: dB}\n}", "title": "" }, { "docid": "1b828537e0e7c069646256ddcf9a4610", "score": "0.52850527", "text": "func NewRepository(f fetcher.Fetcher, s storage.Storage) *Repository {\n\treturn &Repository{f, s, sync.Mutex{}}\n}", "title": "" }, { "docid": "6333a3244597497439ce258424e895ec", "score": "0.5284113", "text": "func NewFeedRepo() Repository {\n\treturn &feedRepo{}\n}", "title": "" }, { "docid": "593a4b9b1c9c0530df8e768da8490c05", "score": "0.5283729", "text": "func newUserRepository(dbConn *pg.DB) UserRepository {\n\treturn &userRepository{\n\t\tDB: dbConn,\n\t}\n}", "title": "" }, { "docid": "3148b216f999ec38dfaaeedd9bfb7442", "score": "0.52764124", "text": "func NewRepository(db *gorm.DB) *Repository {\n\treturn &Repository{\n\t\tdb: db,\n\t}\n}", "title": "" }, { "docid": "1d2556ab1ec79bb7df6f805f94e55fcc", "score": "0.5274299", "text": "func NewFileRepository(basedir string) *FileRepository {\n return &FileRepository{basedir, DefaultFormat}\n}", "title": "" }, { "docid": "95465477ab579f73d4aeaaf89fbd3f36", "score": "0.5273929", "text": "func NewReceitaRepository(db *gorm.DB) ReceitaRepository {\n\treturn receitaRepository{\n\t\tDB: db,\n\t}\n}", "title": "" }, { "docid": "c24a02de4f97d1b8de92e3c2a4639c21", "score": "0.52623874", "text": "func NewNotificationRepository(apiKey, token string) notification.Repository {\n\treturn &notificationRepository{\n\t\tclient: trello.NewClient(apiKey, token),\n\t}\n}", "title": "" }, { "docid": "c88f54dc6e86f49c17505d7838f3ff33", "score": "0.5258005", "text": "func New(db *gorm.DB) *Repository {\n\tdb.AutoMigrate(&ShortenedURL{})\n\treturn &Repository{db: db}\n}", "title": "" }, { "docid": "3d2fb4ad1bc4535f61df844a21f30d20", "score": "0.52486247", "text": "func (r *FakeRepository) New() Repository {\n\tclone := r.Clone()\n\tclone.SetSearch(nil)\n\tclone.SetValue(nil)\n\treturn clone\n}", "title": "" }, { "docid": "7877e8bf0e9546e05c6d3eb46c4d9ab1", "score": "0.5245643", "text": "func NewRepository(db *sqlx.DB) Repository {\n\treturn repository{\n\t\tdb: db,\n\t}\n}", "title": "" }, { "docid": "c2e8172d14ee20c34710a633327c1c15", "score": "0.52321726", "text": "func New(cfg *config.Config) (Repository, error) {\n\tr := repository{}\n\n\tdb, err := connect(cfg)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"repository.New(): %w\", err)\n\t}\n\n\tr.db = db\n\n\tif err := r.db.AutoMigrate(&models.Tag{}); err != nil {\n\t\treturn nil, fmt.Errorf(\"AutoMigrate(Tag): %w\", err)\n\t}\n\tif err := r.db.AutoMigrate(&models.Member{}); err != nil {\n\t\treturn nil, fmt.Errorf(\"AutoMigrate(Member): %w\", err)\n\t}\n\tif err := r.db.AutoMigrate(&models.Role{}); err != nil {\n\t\treturn nil, fmt.Errorf(\"AutoMigrate(MemberRole): %w\", err)\n\t}\n\n\treturn &r, nil\n}", "title": "" }, { "docid": "21a5f1b6be836dc14a870f6c4c8febf0", "score": "0.52193433", "text": "func New() app.Repository {\n\treturn &repo{}\n}", "title": "" }, { "docid": "4dfde8731ef370a75a08106f7f3b5f78", "score": "0.52176857", "text": "func NewRepository(settings Settings) (Repository, error) {\n\tr := Repository{}\n\terr := r.connect(settings)\n\tif err != nil {\n\t\tlog.Fatalln(\"error while creating repository:\", err)\n\t}\n\n\treturn r, nil\n}", "title": "" }, { "docid": "14f8d86b83de147141bccb4d7f75f461", "score": "0.5211907", "text": "func NewRepository() singleton{\n\tonce.Do(func() {\n\t\tinstance = make(singleton)\n\t})\n\n\treturn instance\n}", "title": "" }, { "docid": "b58a8c2eb5577b7441ae22f23a6629c7", "score": "0.5210245", "text": "func NewRepository(db *gorm.DB) *GormRepository {\n\treturn &GormRepository{\n\t\tdb: db,\n\t\twinr: numbersequence.NewWorkItemNumberSequenceRepository(db),\n\t}\n}", "title": "" }, { "docid": "ac41ae1849f0be938ce94e951c01af58", "score": "0.5193312", "text": "func NewRepository(client *firestore.Client) (*Repository, error) {\n\treturn &Repository{\n\t\tUsers: NewUserStore(client),\n\t\tPasswordRestoreRequests: NewPasswordRecoveryRequestStore(client),\n\t}, nil\n}", "title": "" }, { "docid": "e3483982f938f5f09341945a5d696c74", "score": "0.5188332", "text": "func NewRepo(a *config.AppConfig) *Repository {\r\n\treturn &Repository {\r\n\t\tApp: a,\r\n\t}\r\n}", "title": "" }, { "docid": "057ad1b32362a1cb1f700709f3eec42e", "score": "0.5186657", "text": "func NewRepository(\n\ttrRepository transfer_lock.Repository,\n) Repository {\n\tbuilder := NewBuilder()\n\treturn createRepository(trRepository, builder)\n}", "title": "" }, { "docid": "37f9bb86fb4a72b4fcefaa6e75b18083", "score": "0.5184084", "text": "func New(db *sql.DB) (order.Repository, error) {\n\t// return repository\n\treturn &repository{\n\t\tdb: db,\n\t}, nil\n}", "title": "" }, { "docid": "e8d8db4c9661d48fb5cf990c80db1d86", "score": "0.5176735", "text": "func NewRepo(a *config.AppConfig) *Repository {\n\treturn &Repository{\n\t\tApp: *a,\n\t}\n}", "title": "" }, { "docid": "9fdcca1f5b6d96ca992f5c1ed39aa521", "score": "0.5167119", "text": "func NewRepository(name string, conf utils.BuilderConf) (Repository, error) {\n\trepositoryBuilder, err := utils.GetServiceBuilder(nlpRepositoryBuilderPrefix + name)\n\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\trepository, err := repositoryBuilder(conf)\n\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn repository.(Repository), nil\n}", "title": "" }, { "docid": "a066b766f4ad805bd023e04355177b32", "score": "0.5164091", "text": "func NewAccountRepository(db *sql.DB) *AccountRepository {\n\treturn &AccountRepository{queryer: db, txer: db}\n}", "title": "" }, { "docid": "0c0279e52634982125fd4c2709e12f23", "score": "0.51513165", "text": "func NewPaymentRepository(accounts account.Repository) payment.Repository {\n\treturn &paymentRepository{\n\t\tpayments: make(map[uuid.UUID]*payment.Payment),\n\t\taccounts: accounts,\n\t}\n}", "title": "" }, { "docid": "8560c4b857fefc2283f2bdb0a5ea4fc0", "score": "0.51462543", "text": "func NewTracker(\n\tsvc *tracker.Services,\n\tr *hub.Repository,\n\topts ...func(t tracker.Tracker),\n) tracker.Tracker {\n\tt := &Tracker{\n\t\tsvc: svc,\n\t\tr: r,\n\t\tlogger: log.With().Str(\"repo\", r.Name).Str(\"kind\", hub.GetKindName(r.Kind)).Logger(),\n\t}\n\tfor _, o := range opts {\n\t\to(t)\n\t}\n\tif t.svc.Rc == nil {\n\t\tt.svc.Rc = &repo.Cloner{}\n\t}\n\treturn t\n}", "title": "" }, { "docid": "7a15c1e35ad402405418287d2d666c28", "score": "0.51380706", "text": "func New(options ...Option) repository.Repository {\n\tr := &bleeveRepository{}\n\tfor _, option := range options {\n\t\toption(r)\n\t}\n\treturn r\n}", "title": "" }, { "docid": "97beedbc8035c379dfb8c9d8c02becfd", "score": "0.5133989", "text": "func NewRepository(name string) *Repository {\n\treturn &Repository{name, nil}\n}", "title": "" }, { "docid": "92c2612522e8c099167ab1c9049839aa", "score": "0.5131367", "text": "func NewRepo(a *config.AppConfig) *Repository {\n\treturn &Repository{\n\t\tApp: a,\n\t}\n}", "title": "" }, { "docid": "92c2612522e8c099167ab1c9049839aa", "score": "0.5131367", "text": "func NewRepo(a *config.AppConfig) *Repository {\n\treturn &Repository{\n\t\tApp: a,\n\t}\n}", "title": "" }, { "docid": "e5f3de2e7812b0d531558f01235f9a5b", "score": "0.5128176", "text": "func NewRankingRepository(sqlHandler rdb.SQLHandler) usecases.RankingRepository {\n\treturn &rankingRepository{sqlHandler: sqlHandler}\n}", "title": "" }, { "docid": "b6709d26dd0ec610f74c8650e5bb0b92", "score": "0.5125203", "text": "func NewRepository() *Repository {\n\tstore := new(Repository)\n\tstore.tableName = \"go-restapi-demo-dev\"\n\tstore.metaKey = \"metadata\"\n\tstore.region = os.Getenv(\"region\")\n\treturn store\n}", "title": "" }, { "docid": "d59b82ad51d20c680517a757b7226031", "score": "0.51249754", "text": "func NewNotifier() base.Notifier {\n\treturn &mirrorNotifier{}\n}", "title": "" }, { "docid": "8c0a0ec0adc6f54ebf64949436d340eb", "score": "0.5121966", "text": "func NewFileFollower(logger *log.Logger, filename string) (Follower, error) {\n\tf := &followerImpl{\n\t\tfilename: filename,\n\t\tline: make(chan string),\n\t\tlogger: logger,\n\t}\n\n\tif err := f.start(); err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn f, nil\n}", "title": "" }, { "docid": "bbc34b3ec3351465d58dce21ea83e0d4", "score": "0.51165587", "text": "func NewRepository(db *sqlx.DB) *Repository {\n\treturn &Repository{\n\t\tDbConn: db,\n\t}\n}", "title": "" }, { "docid": "d32a2bd41d7d501abe204c9807d54231", "score": "0.5111121", "text": "func newAccountRepository(ext sqlx.Ext) repository.AccountRepository {\n\treturn &accountRepository{\n\t\text: ext,\n\t}\n}", "title": "" }, { "docid": "02ecc972f04f849046824c68386ae130", "score": "0.51086706", "text": "func New(be backend.Backend) *Repository {\n\trepo := &Repository{\n\t\tbe: be,\n\t\tidx: NewMasterIndex(),\n\t\tpackerManager: newPackerManager(be, nil),\n\t}\n\n\treturn repo\n}", "title": "" }, { "docid": "c701af8278b276cb3a0c408c91042b84", "score": "0.51026314", "text": "func NewRepository(fileRepository file.Repository) Repository {\n\tadapter := NewAdapter()\n\treturn createRepository(adapter, fileRepository)\n}", "title": "" }, { "docid": "ba87d0feee41c37a6646e2e471abd824", "score": "0.5071913", "text": "func New(db *gorm.DB) *Repository {\n\treturn &Repository{\n\t\tdb: db,\n\t}\n}", "title": "" }, { "docid": "50d76017caa556b6c28f2ea731e3e7a8", "score": "0.50564617", "text": "func NewRepository(config *config.AppConfig) *Repository {\n\treturn &Repository{\n\t\tApp: config,\n\t}\n}", "title": "" }, { "docid": "6270074657bfc79b3dea17d0a4bf390f", "score": "0.5054086", "text": "func NewRepository(db *sqlx.DB) RepositoryService {\n\treturn repository{\n\t\tdb,\n\t}\n}", "title": "" }, { "docid": "d1d7999ac47a7bbe6209bd4a55d8d762", "score": "0.50516033", "text": "func New(db *sql.DB, logger log.Logger) (account.Repository, error) {\n\t// return repository\n\treturn &repository{\n\t\tdb: db,\n\t\tlogger: log.With(logger, \"rep\", \"cockroachdb\"),\n\t}, nil\n}", "title": "" }, { "docid": "af5835ee85713a34df8c37eea38721b6", "score": "0.50504297", "text": "func NewRepository(ms *mgo.Session) *Repository {\n\treturn &Repository{Session: ms}\n}", "title": "" }, { "docid": "b5bde867407ee3b83ca1b8b9ba27a7ba", "score": "0.5050376", "text": "func NewRepository() order.Repository {\n\tdb, err := sql.Open(\"sqlite3\", \"./internal/database/test.sqlite\")\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn &repository{\n\t\tdb: db,\n\t}\n}", "title": "" }, { "docid": "b0df8141b830d767a07ff6c995c1f2b1", "score": "0.50481313", "text": "func NewChatRepo() *chatRepo {\n\tsess, err := session.NewSession()\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\tu := s3manager.NewUploader(sess)\n\td := s3manager.NewDownloader(sess)\n\treturn &chatRepo{\n\t\tuploader: u,\n\t\tdownloader: d,\n\t}\n}", "title": "" }, { "docid": "44e4b607c12003ea2e8cd64e49c5ccca", "score": "0.5044345", "text": "func NewNicknameTracker(redisAddress, redisPassword string, expiresIn time.Duration) (*NicknameTracker, error) {\n\n\tclient := redis.NewClient(&redis.Options{\n\t\tAddr: redisAddress,\n\t\tPassword: redisPassword,\n\t})\n\n\t_, err := client.Ping().Result()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn &NicknameTracker{client, expiresIn}, nil\n}", "title": "" }, { "docid": "75ff9498da0fd4575de74a2af008c63d", "score": "0.504418", "text": "func NewRepo(db *sql.DB) (repo, error) {\n\treturn repo{\n\t\tdb: db,\n\t}, nil\n}", "title": "" }, { "docid": "a357c519ba3edc107b37319742b7950e", "score": "0.50390214", "text": "func NewRepo() *repo.Repo {\n\treturn &repo.Repo{\n\t\tGroup: newGroupRepo(),\n\t\tActivityLog: newActivityLogRepo(),\n\t\tInvestor: newInvestorRepo(),\n\t}\n}", "title": "" }, { "docid": "c7baeb0e60fe5fd2a972e563d3c230d2", "score": "0.50311446", "text": "func (r *NoOpRegistryClient) NewRepository(parsedName reference.Named) (dim.Repository, error) {\n\treturn r.NewRepositoryFn(parsedName)\n}", "title": "" }, { "docid": "4600b32e54ae02cc3d360d436fefa7e8", "score": "0.5022172", "text": "func NewRepo(repoPath, remote string, branch string, postReceiveHooks ...PostReceiveHook) *Repo {\n\treturn &Repo{\n\t\tname: path.Base(repoPath),\n\t\tPath: repoPath,\n\t\tRemote: remote,\n\t\tBranch: upstreamBase + \"/\" + branch,\n\t\tpostReceiveHooks: postReceiveHooks,\n\t}\n}", "title": "" }, { "docid": "b638374c2543884716a9e04e327bfb83", "score": "0.50196445", "text": "func (g git) NewRepository(dst string) (Repository, error) {\n\t_, err := g.OpenRepository(dst)\n\tif err == nil {\n\t\treturn nil, ErrRepoExists\n\t}\n\tcmd := exec.Exec(dst, \"git\", \"init\")\n\tif cmd.Err != nil {\n\t\treturn nil, cmd.Err\n\t}\n\treturn &repository{\n\t\trootDir: dst,\n\t}, nil\n}", "title": "" } ]
46b735bff5c29f0947115b9e6b2e27d2
findLabels gets labels from the Vision API for an image at the given file path.
[ { "docid": "84fc7dd34481625894efc43d1e733da6", "score": "0.7750311", "text": "func findLabels() ([]string, error) {\n\tctx := context.Background()\n\n\t// Create the client.\n\tclient, err := vision.NewImageAnnotatorClient(ctx)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\t// Open the file.\n\tf, err := os.Open(\"../../resources/demo-image.jpg\")\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\timage, err := vision.NewImageFromReader(f)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\t// Perform the request.\n\tannotations, err := client.DetectLabels(ctx, image, nil, 10)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tvar labels []string\n\tfor _, annotation := range annotations {\n\t\tlabels = append(labels, annotation.Description)\n\t}\n\treturn labels, nil\n}", "title": "" } ]
[ { "docid": "8ff444692cb351d63bcd94a1aefa86ac", "score": "0.63911384", "text": "func DetectLabels(ctx context.Context, e GCSEvent) error {\n\tlog.Printf(\"Processing file: %s\", e.Name)\n\n\t// Create a vision client\n\tvisionClient, err := vision.NewImageAnnotatorClient(ctx)\n\tif err != nil {\n\t\tlog.Fatalf(\"Failed to create vision client: %v\", err)\n\t\treturn err\n\t}\n\n\t// Load image from GCS bucket\n\timg := vision.NewImageFromURI(fmt.Sprintf(\"gs://%s/%s\", e.Bucket, e.Name))\n\n\tlabels, err := visionClient.DetectLabels(ctx, img, nil, 10)\n\tif err != nil {\n\t\tlog.Fatalf(\"Failed to detect labels: %v\", err)\n\t\treturn err\n\t}\n\n\tprops, err := visionClient.DetectSafeSearch(ctx, img, nil)\n\tif err != nil {\n\t\tlog.Fatalf(\"Failed to detect safe search: %v\", err)\n\t\treturn err\n\t}\n\n\t// Split string to generate output filename\n\tfilename := strings.Split(e.Name, \".\")[0] + \"_labels.txt\"\n\n\t// Create a GCS client\n\tstorageClient, err := storage.NewClient(ctx)\n\tif err != nil {\n\t\tlog.Fatalf(\"Failed to create GCS client: %v\", err)\n\t}\n\n\t// Create object to write output to\n\toutputBlob := storageClient.Bucket(e.Bucket).Object(filename)\n\tw := outputBlob.NewWriter(ctx)\n\tdefer w.Close()\n\n\tfmt.Println(\"Labels:\")\n\tfmt.Fprintln(w, \"Labels:\")\n\tfor _, label := range labels {\n\t\tfmt.Printf(\"%v: %v\", label.Description, label.Score)\n\t\tfmt.Fprintf(w, \"%v: %v\\n\", label.Description, label.Score)\n\t}\n\n\tfmt.Println(\"Safe Search:\")\n\tfmt.Fprintln(w, \"Safe Search:\")\n\tfmt.Printf(\"Racy: %v\", props.Racy)\n\tfmt.Fprintf(w, \"Racy: %v\\n\", props.Racy)\n\n\treturn nil\n}", "title": "" }, { "docid": "960d3d7c63593d85881ab4ac337d188e", "score": "0.60891604", "text": "func (s *LabelService) FindLabels(ctx context.Context, filter plat.LabelFilter, opt ...plat.FindOptions) ([]*plat.Label, error) {\n\turl, err := newURL(s.Addr, resourceIDPath(s.BasePath, filter.ResourceID))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treq, err := http.NewRequest(\"GET\", url.String(), nil)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tSetToken(s.Token, req)\n\n\thc := newClient(url.Scheme, s.InsecureSkipVerify)\n\n\tresp, err := hc.Do(req)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tif err := CheckError(resp); err != nil {\n\t\treturn nil, err\n\t}\n\n\tvar r labelsResponse\n\tif err := json.NewDecoder(resp.Body).Decode(&r); err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn r.Labels, nil\n}", "title": "" }, { "docid": "7c9a3c277ddc7e9b261ee9dab04c6975", "score": "0.60784847", "text": "func getLabels(filename string) (labels []string) {\n\t// file class\n\tfile, err := os.Open(filename)\n\tif err != nil {\n\t\tlog.Println(err)\n\t\treturn\n\t}\n\tdefer file.Close()\n\n\tscanner := bufio.NewScanner(file)\n\tfor scanner.Scan() { // internally, it advances token based on sperator\n\t\tlabels = append(labels, scanner.Text()) // token in unicode-char\n\t}\n\n\treturn\n\n}", "title": "" }, { "docid": "e191c5c201a38db8b00d6808dfcf3eb7", "score": "0.59920114", "text": "func (a *AWSservice) DetectLabels(dlInput entities.DetectLabelInput) (*rekognition.DetectLabelsOutput, error) {\n\tsess, err := session.NewSession(&aws.Config{\n\t\tRegion: aws.String(os.Getenv(\"AWS_REGION\")),\n\t\tCredentials: credentials.NewSharedCredentials(os.Getenv(\"AWS_CREDENTIALS_FILEPATH\"),\n\t\t\tos.Getenv(\"AWS_PROFILE\")),\n\t})\n\n\tif err != nil {\n\t\tlog.Printf(\"%v\", err)\n\t\treturn nil, err\n\t}\n\n\tsvc := rekognition.New(sess)\n\n\tinput := &rekognition.DetectLabelsInput{\n\t\tImage: &rekognition.Image{\n\t\t\tBytes: dlInput.Image,\n\t\t},\n\t\tMaxLabels: aws.Int64(dlInput.MaxLabels),\n\t\tMinConfidence: aws.Float64(dlInput.MinConfidence),\n\t}\n\n\tresults, err := svc.DetectLabels(input)\n\tif err != nil {\n\t\tlog.Printf(\"%v\", err)\n\t\treturn nil, err\n\t}\n\treturn results, nil\n}", "title": "" }, { "docid": "c58291e70e45c9007630153f67504111", "score": "0.5913781", "text": "func (a *LabelApiService) LabelsFindByLabelurn(ctx _context.Context, labelurn string, optionals *LabelsFindByLabelurnOpts) (Label, *APIResponse, 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 Label\n\t)\n\n\t// create path and map variables\n\tlocalVarPath := a.client.cfg.BasePath + \"/labels/{labelurn}\"\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"labelurn\"+\"}\", _neturl.PathEscape(parameterToString(labelurn, \"\")) , -1)\n\n\tlocalVarHeaderParams := make(map[string]string)\n\tlocalVarQueryParams := _neturl.Values{}\n\tlocalVarFormParams := _neturl.Values{}\n\n\tif optionals != nil && optionals.Pretty != nil {\n\t\tlocalVarQueryParams.Add(\"pretty\", parameterToString(*optionals.Pretty, \"\"))\n\t}\n\tif optionals != nil && optionals.Depth != nil {\n\t\tlocalVarQueryParams.Add(\"depth\", parameterToString(*optionals.Depth, \"\"))\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 optionals != nil && optionals.XContractNumber != nil {\n\t\tlocalVarHeaderParams[\"X-Contract-Number\"] = parameterToString(*optionals.XContractNumber, \"\")\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\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\tlocalVarAPIResponse := &APIResponse {\n\t\tResponse: localVarHTTPResponse,\n\t\tMethod: localVarHTTPMethod,\n\t\tRequestURL: localVarPath,\n\t\tOperation: \"LabelsFindByLabelurn\",\n\t}\n\tif err != nil || localVarHTTPResponse == nil {\n\t\treturn localVarReturnValue, localVarAPIResponse, err\n\t}\n\n\tlocalVarBody, err := _ioutil.ReadAll(localVarHTTPResponse.Body)\n\tlocalVarHTTPResponse.Body.Close()\n\tlocalVarAPIResponse.Payload = localVarBody\n\tif err != nil {\n\t\treturn localVarReturnValue, localVarAPIResponse, err\n\t}\n\n\tif localVarHTTPResponse.StatusCode >= 300 {\n\t\tnewErr := GenericOpenAPIError{\n\t\t\tbody: localVarBody,\n\t\t\terror: localVarHTTPResponse.Status,\n\t\t}\n\t\t\tvar v Error\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, localVarAPIResponse, newErr\n\t\t\t}\n\t\t\tnewErr.model = v\n\t\treturn localVarReturnValue, localVarAPIResponse, 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, localVarAPIResponse, newErr\n\t}\n\n\treturn localVarReturnValue, localVarAPIResponse, nil\n}", "title": "" }, { "docid": "0d5c076d62618b0a93ced36419b0591b", "score": "0.56839496", "text": "func (m *manager) FindLabels(c echo.Context) error {\n\tname := c.QueryParam(\"name\")\n\titems, err := m.luc.Find(name)\n\tif err != nil {\n\t\treturn err\n\t}\n\treturn c.JSON(200, map[string]interface{}{\n\t\t\"items\": items,\n\t})\n}", "title": "" }, { "docid": "db8723fcbbebbdf7f47b6a531b0c56ee", "score": "0.5681487", "text": "func (drc *DummyRegistryClient) LabelsForImageName(in string) (map[string]string, error) {\n\tmd := <-drc.mds\n\treturn md.Labels, nil\n}", "title": "" }, { "docid": "26a8b207627bc6ec3d5ff3f45079d7db", "score": "0.5652823", "text": "func (s *Repo) Labels(f form.LabelSearch) (results []LabelResult, err error) {\n\tif err := f.ParseQueryString(); err != nil {\n\t\treturn results, err\n\t}\n\n\tdefer util.ProfileTime(time.Now(), fmt.Sprintf(\"search: %+v\", f))\n\n\tq := s.db.NewScope(nil).DB()\n\n\t// q.LogMode(true)\n\n\tq = q.Table(\"labels\").\n\t\tSelect(`labels.*`).\n\t\tWhere(\"labels.deleted_at IS NULL\").\n\t\tGroup(\"labels.id\")\n\n\tif f.Query != \"\" {\n\t\tvar labelIds []uint\n\t\tvar categories []entity.Category\n\t\tvar label entity.Label\n\n\t\tslugString := slug.Make(f.Query)\n\t\tlikeString := \"%\" + strings.ToLower(f.Query) + \"%\"\n\n\t\tif result := s.db.First(&label, \"label_slug = ?\", slugString); result.Error != nil {\n\t\t\tlog.Infof(\"search: label \\\"%s\\\" not found\", f.Query)\n\n\t\t\tq = q.Where(\"LOWER(labels.label_name) LIKE ?\", likeString)\n\t\t} else {\n\t\t\tlabelIds = append(labelIds, label.ID)\n\n\t\t\ts.db.Where(\"category_id = ?\", label.ID).Find(&categories)\n\n\t\t\tfor _, category := range categories {\n\t\t\t\tlabelIds = append(labelIds, category.LabelID)\n\t\t\t}\n\n\t\t\tlog.Infof(\"search: label \\\"%s\\\" includes %d categories\", label.LabelName, len(labelIds))\n\n\t\t\tq = q.Where(\"labels.id IN (?)\", labelIds)\n\t\t}\n\t}\n\n\tif f.Favorites {\n\t\tq = q.Where(\"labels.label_favorite = 1\")\n\t}\n\n\tif !f.All {\n\t\tq = q.Where(\"labels.label_priority >= 0 OR labels.label_favorite = 1\")\n\t}\n\n\tswitch f.Order {\n\tcase \"slug\":\n\t\tq = q.Order(\"labels.label_favorite DESC, label_slug ASC\")\n\tdefault:\n\t\tq = q.Order(\"labels.label_favorite DESC, label_slug ASC\")\n\t}\n\n\tif f.Count > 0 && f.Count <= 1000 {\n\t\tq = q.Limit(f.Count).Offset(f.Offset)\n\t} else {\n\t\tq = q.Limit(100).Offset(0)\n\t}\n\n\tif result := q.Scan(&results); result.Error != nil {\n\t\treturn results, result.Error\n\t}\n\n\treturn results, nil\n}", "title": "" }, { "docid": "ac69440c192e6e0eb69c54dd5ad3a186", "score": "0.5613914", "text": "func (issue *Issue) FindLabels(regex *regexp.Regexp) []Label {\n\tlabels := []Label{}\n\n\tfor _, label := range issue.Labels {\n\t\tif regex.MatchString(label.Name) {\n\t\t\tlabels = append(labels, label)\n\t\t}\n\t}\n\n\treturn labels\n}", "title": "" }, { "docid": "a76da4975a286446db68ae2a337c6aaf", "score": "0.5609256", "text": "func LoadLabelFile(name string) ([]Label, error) {\n\tfile, err := os.Open(name)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tdefer file.Close()\n\n\treader, err := gzip.NewReader(file)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\theader := labelFileHeader{}\n\n\terr = binary.Read(reader, binary.BigEndian, &header)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tif header.Magic != labelMagic {\n\t\treturn nil, err\n\t}\n\n\tlabels := make([]Label, header.NumLabels)\n\tfor i := int32(0); i < header.NumLabels; i++ {\n\t\terr = binary.Read(reader, binary.BigEndian, &labels[i])\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\n\treturn labels, nil\n}", "title": "" }, { "docid": "1820ee0f53944bf131e0711f94dc50ed", "score": "0.5581558", "text": "func (client *ClientImpl) GetLabels(ctx context.Context, args GetLabelsArgs) (*[]git.TfvcLabelRef, error) {\n\trouteValues := make(map[string]string)\n\tif args.Project != nil && *args.Project != \"\" {\n\t\trouteValues[\"project\"] = *args.Project\n\t}\n\n\tqueryParams := url.Values{}\n\tif args.RequestData == nil {\n\t\treturn nil, &azuredevops.ArgumentNilError{ArgumentName: \"requestData\"}\n\t}\n\tif args.RequestData.LabelScope != nil {\n\t\tqueryParams.Add(\"requestData.labelScope\", *args.RequestData.LabelScope)\n\t}\n\tif args.RequestData.Name != nil {\n\t\tqueryParams.Add(\"requestData.name\", *args.RequestData.Name)\n\t}\n\tif args.RequestData.Owner != nil {\n\t\tqueryParams.Add(\"requestData.owner\", *args.RequestData.Owner)\n\t}\n\tif args.RequestData.ItemLabelFilter != nil {\n\t\tqueryParams.Add(\"requestData.itemLabelFilter\", *args.RequestData.ItemLabelFilter)\n\t}\n\tif args.RequestData.MaxItemCount != nil {\n\t\tqueryParams.Add(\"requestData.maxItemCount\", strconv.Itoa(*args.RequestData.MaxItemCount))\n\t}\n\tif args.RequestData.IncludeLinks != nil {\n\t\tqueryParams.Add(\"requestData.includeLinks\", strconv.FormatBool(*args.RequestData.IncludeLinks))\n\t}\n\tif args.Top != nil {\n\t\tqueryParams.Add(\"$top\", strconv.Itoa(*args.Top))\n\t}\n\tif args.Skip != nil {\n\t\tqueryParams.Add(\"$skip\", strconv.Itoa(*args.Skip))\n\t}\n\tlocationId, _ := uuid.Parse(\"a5d9bd7f-b661-4d0e-b9be-d9c16affae54\")\n\tresp, err := client.Client.Send(ctx, http.MethodGet, locationId, \"6.0\", routeValues, queryParams, nil, \"\", \"application/json\", nil)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tvar responseValue []git.TfvcLabelRef\n\terr = client.Client.UnmarshalCollectionBody(resp, &responseValue)\n\treturn &responseValue, err\n}", "title": "" }, { "docid": "b64cd889e31c3c8ef182fec25ecfe553", "score": "0.5570202", "text": "func GetLabelsWithPythonScript(filename string) ([]string, error) {\n\tapp := \"python3\"\n\targ0 := \"./workflow/object_detection/scripts/object_detection.py\"\n\targ1 := filename\n\n\tcmd := exec.Command(app, arg0, arg1)\n\tout, err := cmd.Output()\n\n\tif err != nil {\n\t\tfmt.Printf(\"Error running python object detection script (%s %s %s): %v\", app, arg0, arg1, err)\n\t\tpanic(err)\n\t}\n\n\toutput := strings.Split(string(out), \"\\n\")\n\n\tvar labels []string\n\n\tfor _, line := range output {\n\t\tif strings.HasPrefix(line, \"RESULT\") && len(line) > 7 {\n\t\t\tlabels = strings.Split(line[7:], \";\")\n\t\t\tbreak\n\t\t}\n\t}\n\n\treturn labels, nil\n}", "title": "" }, { "docid": "fde8b21a0183a1e41ad3d033d1c4cdb7", "score": "0.5557332", "text": "func (a *LabelApiService) IpblocksLabelsFindByKey(ctx _context.Context, ipblockId string, key string, optionals *IpblocksLabelsFindByKeyOpts) (LabelResource, *APIResponse, 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 LabelResource\n\t)\n\n\t// create path and map variables\n\tlocalVarPath := a.client.cfg.BasePath + \"/ipblocks/{ipblockId}/labels/{key}\"\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"ipblockId\"+\"}\", _neturl.PathEscape(parameterToString(ipblockId, \"\")) , -1)\n\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"key\"+\"}\", _neturl.PathEscape(parameterToString(key, \"\")) , -1)\n\n\tlocalVarHeaderParams := make(map[string]string)\n\tlocalVarQueryParams := _neturl.Values{}\n\tlocalVarFormParams := _neturl.Values{}\n\n\tif optionals != nil && optionals.Pretty != nil {\n\t\tlocalVarQueryParams.Add(\"pretty\", parameterToString(*optionals.Pretty, \"\"))\n\t}\n\tif optionals != nil && optionals.Depth != nil {\n\t\tlocalVarQueryParams.Add(\"depth\", parameterToString(*optionals.Depth, \"\"))\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 optionals != nil && optionals.XContractNumber != nil {\n\t\tlocalVarHeaderParams[\"X-Contract-Number\"] = parameterToString(*optionals.XContractNumber, \"\")\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\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\tlocalVarAPIResponse := &APIResponse {\n\t\tResponse: localVarHTTPResponse,\n\t\tMethod: localVarHTTPMethod,\n\t\tRequestURL: localVarPath,\n\t\tOperation: \"IpblocksLabelsFindByKey\",\n\t}\n\tif err != nil || localVarHTTPResponse == nil {\n\t\treturn localVarReturnValue, localVarAPIResponse, err\n\t}\n\n\tlocalVarBody, err := _ioutil.ReadAll(localVarHTTPResponse.Body)\n\tlocalVarHTTPResponse.Body.Close()\n\tlocalVarAPIResponse.Payload = localVarBody\n\tif err != nil {\n\t\treturn localVarReturnValue, localVarAPIResponse, err\n\t}\n\n\tif localVarHTTPResponse.StatusCode >= 300 {\n\t\tnewErr := GenericOpenAPIError{\n\t\t\tbody: localVarBody,\n\t\t\terror: localVarHTTPResponse.Status,\n\t\t}\n\t\t\tvar v Error\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, localVarAPIResponse, newErr\n\t\t\t}\n\t\t\tnewErr.model = v\n\t\treturn localVarReturnValue, localVarAPIResponse, 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, localVarAPIResponse, newErr\n\t}\n\n\treturn localVarReturnValue, localVarAPIResponse, nil\n}", "title": "" }, { "docid": "86831239fc8b7fc4801a7ce6671381d9", "score": "0.55131036", "text": "func (sdc *SDConfig) GetLabels(baseDir string) ([]*promutils.Labels, error) {\n\tcfg, err := getAPIConfig(sdc, baseDir)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"cannot get API config: %w\", err)\n\t}\n\tswitch sdc.Role {\n\tcase \"hypervisor\":\n\t\treturn getHypervisorLabels(cfg)\n\tcase \"instance\":\n\t\treturn getInstancesLabels(cfg)\n\tdefault:\n\t\treturn nil, fmt.Errorf(\"unexpected `role`: %q; must be one of `instance` or `hypervisor`; skipping it\", sdc.Role)\n\t}\n}", "title": "" }, { "docid": "95875a2d44f9f2252bc51142ec78d98b", "score": "0.55004954", "text": "func (a *DefaultApiService) GetAllLabelsForRepository(ctx context.Context, projectKey string, repositorySlug string) (string, *http.Response, error) {\n\tvar (\n\t\tlocalVarHttpMethod = strings.ToUpper(\"Get\")\n\t\tlocalVarPostBody interface{}\n\t\tlocalVarFileName string\n\t\tlocalVarFileBytes []byte\n\t\tlocalVarReturnValue string\n\t)\n\n\t// create path and map variables\n\tlocalVarPath := a.client.cfg.BasePath + \"/api/1.0/projects/{projectKey}/repos/{repositorySlug}/labels\"\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"projectKey\"+\"}\", fmt.Sprintf(\"%v\", projectKey), -1)\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"repositorySlug\"+\"}\", fmt.Sprintf(\"%v\", repositorySlug), -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{\"application/json\"}\n\n\t// set Accept header\n\tlocalVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts)\n\tif localVarHttpHeaderAccept != \"\" {\n\t\tlocalVarHeaderParams[\"Accept\"] = localVarHttpHeaderAccept\n\t}\n\tr, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes)\n\tif err != nil {\n\t\treturn localVarReturnValue, nil, err\n\t}\n\n\tlocalVarHttpResponse, err := a.client.callAPI(r)\n\tif err != nil || localVarHttpResponse == nil {\n\t\treturn localVarReturnValue, localVarHttpResponse, err\n\t}\n\n\tlocalVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body)\n\tlocalVarHttpResponse.Body.Close()\n\tif err != nil {\n\t\treturn localVarReturnValue, localVarHttpResponse, err\n\t}\n\n\tif localVarHttpResponse.StatusCode < 300 {\n\t\t// If we succeed, return the data, otherwise pass on to decode error.\n\t\terr = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get(\"Content-Type\"));\n\t\tif err == nil { \n\t\t\treturn localVarReturnValue, localVarHttpResponse, err\n\t\t}\n\t}\n\n\tif localVarHttpResponse.StatusCode >= 300 {\n\t\tnewErr := GenericSwaggerError{\n\t\t\tbody: localVarBody,\n\t\t\terror: localVarHttpResponse.Status,\n\t\t}\n\t\tif localVarHttpResponse.StatusCode == 200 {\n\t\t\tvar v string\n\t\t\terr = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get(\"Content-Type\"));\n\t\t\t\tif err != nil {\n\t\t\t\t\tnewErr.error = err.Error()\n\t\t\t\t\treturn localVarReturnValue, localVarHttpResponse, newErr\n\t\t\t\t}\n\t\t\t\tnewErr.model = v\n\t\t\t\treturn localVarReturnValue, localVarHttpResponse, newErr\n\t\t}\n\t\treturn localVarReturnValue, localVarHttpResponse, newErr\n\t}\n\n\treturn localVarReturnValue, localVarHttpResponse, nil\n}", "title": "" }, { "docid": "39de8843194e15605e0f769624dd262c", "score": "0.54974884", "text": "func (a *LabelApiService) IpblocksLabelsGet(ctx _context.Context, ipblockId string, optionals *IpblocksLabelsGetOpts) (LabelResources, *APIResponse, 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 LabelResources\n\t)\n\n\t// create path and map variables\n\tlocalVarPath := a.client.cfg.BasePath + \"/ipblocks/{ipblockId}/labels\"\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"ipblockId\"+\"}\", _neturl.PathEscape(parameterToString(ipblockId, \"\")) , -1)\n\n\tlocalVarHeaderParams := make(map[string]string)\n\tlocalVarQueryParams := _neturl.Values{}\n\tlocalVarFormParams := _neturl.Values{}\n\n\tif optionals != nil && optionals.Pretty != nil {\n\t\tlocalVarQueryParams.Add(\"pretty\", parameterToString(*optionals.Pretty, \"\"))\n\t}\n\tif optionals != nil && optionals.Depth != nil {\n\t\tlocalVarQueryParams.Add(\"depth\", parameterToString(*optionals.Depth, \"\"))\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 optionals != nil && optionals.XContractNumber != nil {\n\t\tlocalVarHeaderParams[\"X-Contract-Number\"] = parameterToString(*optionals.XContractNumber, \"\")\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\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\tlocalVarAPIResponse := &APIResponse {\n\t\tResponse: localVarHTTPResponse,\n\t\tMethod: localVarHTTPMethod,\n\t\tRequestURL: localVarPath,\n\t\tOperation: \"IpblocksLabelsGet\",\n\t}\n\tif err != nil || localVarHTTPResponse == nil {\n\t\treturn localVarReturnValue, localVarAPIResponse, err\n\t}\n\n\tlocalVarBody, err := _ioutil.ReadAll(localVarHTTPResponse.Body)\n\tlocalVarHTTPResponse.Body.Close()\n\tlocalVarAPIResponse.Payload = localVarBody\n\tif err != nil {\n\t\treturn localVarReturnValue, localVarAPIResponse, err\n\t}\n\n\tif localVarHTTPResponse.StatusCode >= 300 {\n\t\tnewErr := GenericOpenAPIError{\n\t\t\tbody: localVarBody,\n\t\t\terror: localVarHTTPResponse.Status,\n\t\t}\n\t\t\tvar v Error\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, localVarAPIResponse, newErr\n\t\t\t}\n\t\t\tnewErr.model = v\n\t\treturn localVarReturnValue, localVarAPIResponse, 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, localVarAPIResponse, newErr\n\t}\n\n\treturn localVarReturnValue, localVarAPIResponse, nil\n}", "title": "" }, { "docid": "72b8f2d9eba64dc86571b9220cb95009", "score": "0.5456632", "text": "func getLabelsDocumentation() (map[string][]string, error) {\n\tdocumentedMetrics := map[string][]string{}\n\n\tdocPath := \"../../docs/\"\n\tdocFiles, err := os.ReadDir(docPath)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"failed to read documentation directory: %w\", err)\n\t}\n\n\t// Match file names such as daemonset-metrics.md\n\tfileRe := regexp.MustCompile(`^([a-z]*)-metrics.md$`)\n\t// Match doc lines such as | kube_node_created | Gauge | `node`=&lt;node-address&gt;| STABLE |\n\tlineRe := regexp.MustCompile(`^\\| *(kube_[a-z_]+) *\\| *[a-zA-Z]+ *\\|(.*)\\| *[A-Z]+`)\n\t// Match label names in label documentation\n\tlabelsRe := regexp.MustCompile(\"`([a-zA-Z_][a-zA-Z0-9_]*)`\")\n\t// Match wildcard patterns for dynamic labels such as label_CRONJOB_LABEL\n\tpatternRe := regexp.MustCompile(`_[A-Z_]+`)\n\n\tfor _, file := range docFiles {\n\t\tif file.IsDir() || !fileRe.MatchString(file.Name()) {\n\t\t\tcontinue\n\t\t}\n\n\t\tfilePath := path.Join(docPath, file.Name())\n\t\tf, err := os.Open(filepath.Clean(filePath))\n\t\tif err != nil {\n\t\t\treturn nil, fmt.Errorf(\"cannot read file %s: %w\", filePath, err)\n\t\t}\n\t\tscanner := bufio.NewScanner(f)\n\t\tfor scanner.Scan() {\n\t\t\tparams := lineRe.FindStringSubmatch(scanner.Text())\n\t\t\tif len(params) != 3 {\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tmetric := params[1]\n\t\t\tlabelsDoc := params[2]\n\n\t\t\tlabels := labelsRe.FindAllStringSubmatch(labelsDoc, -1)\n\t\t\tlabelPatterns := make([]string, len(labels))\n\t\t\tfor i, l := range labels {\n\t\t\t\tif len(l) <= 1 {\n\t\t\t\t\treturn nil, fmt.Errorf(\"Label documentation %s did not match regex\", labelsDoc)\n\t\t\t\t}\n\t\t\t\tlabelPatterns[i] = patternRe.ReplaceAllString(l[1], \"_.*\")\n\t\t\t}\n\n\t\t\tdocumentedMetrics[metric] = labelPatterns\n\t\t}\n\t}\n\treturn documentedMetrics, nil\n}", "title": "" }, { "docid": "7a81c89326d5de9173fbc234cfe7719a", "score": "0.5397633", "text": "func (a *LabelApiService) LabelsGet(ctx _context.Context, optionals *LabelsGetOpts) (Labels, *APIResponse, 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 Labels\n\t)\n\n\t// create path and map variables\n\tlocalVarPath := a.client.cfg.BasePath + \"/labels\"\n\tlocalVarHeaderParams := make(map[string]string)\n\tlocalVarQueryParams := _neturl.Values{}\n\tlocalVarFormParams := _neturl.Values{}\n\n\tif optionals != nil && optionals.Pretty != nil {\n\t\tlocalVarQueryParams.Add(\"pretty\", parameterToString(*optionals.Pretty, \"\"))\n\t}\n\tif optionals != nil && optionals.Depth != nil {\n\t\tlocalVarQueryParams.Add(\"depth\", parameterToString(*optionals.Depth, \"\"))\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 optionals != nil && optionals.XContractNumber != nil {\n\t\tlocalVarHeaderParams[\"X-Contract-Number\"] = parameterToString(*optionals.XContractNumber, \"\")\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\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\tlocalVarAPIResponse := &APIResponse {\n\t\tResponse: localVarHTTPResponse,\n\t\tMethod: localVarHTTPMethod,\n\t\tRequestURL: localVarPath,\n\t\tOperation: \"LabelsGet\",\n\t}\n\tif err != nil || localVarHTTPResponse == nil {\n\t\treturn localVarReturnValue, localVarAPIResponse, err\n\t}\n\n\tlocalVarBody, err := _ioutil.ReadAll(localVarHTTPResponse.Body)\n\tlocalVarHTTPResponse.Body.Close()\n\tlocalVarAPIResponse.Payload = localVarBody\n\tif err != nil {\n\t\treturn localVarReturnValue, localVarAPIResponse, err\n\t}\n\n\tif localVarHTTPResponse.StatusCode >= 300 {\n\t\tnewErr := GenericOpenAPIError{\n\t\t\tbody: localVarBody,\n\t\t\terror: localVarHTTPResponse.Status,\n\t\t}\n\t\t\tvar v Error\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, localVarAPIResponse, newErr\n\t\t\t}\n\t\t\tnewErr.model = v\n\t\treturn localVarReturnValue, localVarAPIResponse, 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, localVarAPIResponse, newErr\n\t}\n\n\treturn localVarReturnValue, localVarAPIResponse, nil\n}", "title": "" }, { "docid": "4f879698891e6f9dea0934c6840d76a8", "score": "0.5335729", "text": "func (a *API) GetLabels(id string) (*Labels, error) {\n\tep, err := a.getContentGenericEndpoint(id, \"label\")\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn a.SendLabelRequest(ep, \"GET\", nil)\n}", "title": "" }, { "docid": "403347cfbaa1c449be8384ef730b5985", "score": "0.5321935", "text": "func (m *Method) findLabel(name string) (bool, int, *Label) {\n\tfor i, label := range m.labels {\n\t\tif label.Name == name {\n\t\t\treturn true, i, label\n\t\t}\n\t}\n\treturn false, -1, nil\n}", "title": "" }, { "docid": "6626718faf56d36e25a5df4433e0fa6f", "score": "0.5317809", "text": "func (a *LabelApiService) DatacentersVolumesLabelsGet(ctx _context.Context, datacenterId string, volumeId string, optionals *DatacentersVolumesLabelsGetOpts) (LabelResources, *APIResponse, 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 LabelResources\n\t)\n\n\t// create path and map variables\n\tlocalVarPath := a.client.cfg.BasePath + \"/datacenters/{datacenterId}/volumes/{volumeId}/labels\"\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"datacenterId\"+\"}\", _neturl.PathEscape(parameterToString(datacenterId, \"\")) , -1)\n\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"volumeId\"+\"}\", _neturl.PathEscape(parameterToString(volumeId, \"\")) , -1)\n\n\tlocalVarHeaderParams := make(map[string]string)\n\tlocalVarQueryParams := _neturl.Values{}\n\tlocalVarFormParams := _neturl.Values{}\n\n\tif optionals != nil && optionals.Pretty != nil {\n\t\tlocalVarQueryParams.Add(\"pretty\", parameterToString(*optionals.Pretty, \"\"))\n\t}\n\tif optionals != nil && optionals.Depth != nil {\n\t\tlocalVarQueryParams.Add(\"depth\", parameterToString(*optionals.Depth, \"\"))\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 optionals != nil && optionals.XContractNumber != nil {\n\t\tlocalVarHeaderParams[\"X-Contract-Number\"] = parameterToString(*optionals.XContractNumber, \"\")\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\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\tlocalVarAPIResponse := &APIResponse {\n\t\tResponse: localVarHTTPResponse,\n\t\tMethod: localVarHTTPMethod,\n\t\tRequestURL: localVarPath,\n\t\tOperation: \"DatacentersVolumesLabelsGet\",\n\t}\n\tif err != nil || localVarHTTPResponse == nil {\n\t\treturn localVarReturnValue, localVarAPIResponse, err\n\t}\n\n\tlocalVarBody, err := _ioutil.ReadAll(localVarHTTPResponse.Body)\n\tlocalVarHTTPResponse.Body.Close()\n\tlocalVarAPIResponse.Payload = localVarBody\n\tif err != nil {\n\t\treturn localVarReturnValue, localVarAPIResponse, err\n\t}\n\n\tif localVarHTTPResponse.StatusCode >= 300 {\n\t\tnewErr := GenericOpenAPIError{\n\t\t\tbody: localVarBody,\n\t\t\terror: localVarHTTPResponse.Status,\n\t\t}\n\t\t\tvar v Error\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, localVarAPIResponse, newErr\n\t\t\t}\n\t\t\tnewErr.model = v\n\t\treturn localVarReturnValue, localVarAPIResponse, 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, localVarAPIResponse, newErr\n\t}\n\n\treturn localVarReturnValue, localVarAPIResponse, nil\n}", "title": "" }, { "docid": "ae5aab787eeca3014ae4c1e68a3879ca", "score": "0.5279245", "text": "func (m *manager) FindAllLabels(c echo.Context) error {\n\titems, err := m.luc.FindAll()\n\tif err != nil {\n\t\treturn err\n\t}\n\treturn c.JSON(200, map[string]interface{}{\n\t\t\"items\": items,\n\t})\n}", "title": "" }, { "docid": "f6d2110a07fdb3395831ff763e8ae836", "score": "0.5237907", "text": "func (z *Zone) findLabels(s string, targets []string, qts qTypes) (*Label, uint16) {\n\n\tfor _, target := range targets {\n\n\t\tvar name string\n\n\t\tswitch target {\n\t\tcase \"@\":\n\t\t\tname = s\n\t\tdefault:\n\t\t\tif len(s) > 0 {\n\t\t\t\tname = s + \".\" + target\n\t\t\t} else {\n\t\t\t\tname = target\n\t\t\t}\n\t\t}\n\n\t\tif label, ok := z.Labels[name]; ok {\n\n\t\t\tfor _, qtype := range qts {\n\n\t\t\t\tswitch qtype {\n\t\t\t\tcase dns.TypeANY:\n\t\t\t\t\t// short-circuit mostly to avoid subtle bugs later\n\t\t\t\t\t// to be correct we should run through all the selectors and\n\t\t\t\t\t// pick types not already picked\n\t\t\t\t\treturn z.Labels[s], qtype\n\t\t\t\tcase dns.TypeMF:\n\t\t\t\t\tif label.Records[dns.TypeMF] != nil {\n\t\t\t\t\t\tname = label.firstRR(dns.TypeMF).(*dns.MF).Mf\n\t\t\t\t\t\t// TODO: need to avoid loops here somehow\n\t\t\t\t\t\treturn z.findLabels(name, targets, qts)\n\t\t\t\t\t}\n\t\t\t\tdefault:\n\t\t\t\t\t// return the label if it has the right record\n\t\t\t\t\tif label.Records[qtype] != nil && len(label.Records[qtype]) > 0 {\n\t\t\t\t\t\treturn label, qtype\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\treturn z.Labels[s], 0\n}", "title": "" }, { "docid": "3eee264dc88aa3a1ee84b5a4480273fa", "score": "0.5232559", "text": "func (a *LabelApiService) DatacentersVolumesLabelsFindByKey(ctx _context.Context, datacenterId string, volumeId string, key string, optionals *DatacentersVolumesLabelsFindByKeyOpts) (LabelResource, *APIResponse, 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 LabelResource\n\t)\n\n\t// create path and map variables\n\tlocalVarPath := a.client.cfg.BasePath + \"/datacenters/{datacenterId}/volumes/{volumeId}/labels/{key}\"\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"datacenterId\"+\"}\", _neturl.PathEscape(parameterToString(datacenterId, \"\")) , -1)\n\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"volumeId\"+\"}\", _neturl.PathEscape(parameterToString(volumeId, \"\")) , -1)\n\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"key\"+\"}\", _neturl.PathEscape(parameterToString(key, \"\")) , -1)\n\n\tlocalVarHeaderParams := make(map[string]string)\n\tlocalVarQueryParams := _neturl.Values{}\n\tlocalVarFormParams := _neturl.Values{}\n\n\tif optionals != nil && optionals.Pretty != nil {\n\t\tlocalVarQueryParams.Add(\"pretty\", parameterToString(*optionals.Pretty, \"\"))\n\t}\n\tif optionals != nil && optionals.Depth != nil {\n\t\tlocalVarQueryParams.Add(\"depth\", parameterToString(*optionals.Depth, \"\"))\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 optionals != nil && optionals.XContractNumber != nil {\n\t\tlocalVarHeaderParams[\"X-Contract-Number\"] = parameterToString(*optionals.XContractNumber, \"\")\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\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\tlocalVarAPIResponse := &APIResponse {\n\t\tResponse: localVarHTTPResponse,\n\t\tMethod: localVarHTTPMethod,\n\t\tRequestURL: localVarPath,\n\t\tOperation: \"DatacentersVolumesLabelsFindByKey\",\n\t}\n\tif err != nil || localVarHTTPResponse == nil {\n\t\treturn localVarReturnValue, localVarAPIResponse, err\n\t}\n\n\tlocalVarBody, err := _ioutil.ReadAll(localVarHTTPResponse.Body)\n\tlocalVarHTTPResponse.Body.Close()\n\tlocalVarAPIResponse.Payload = localVarBody\n\tif err != nil {\n\t\treturn localVarReturnValue, localVarAPIResponse, err\n\t}\n\n\tif localVarHTTPResponse.StatusCode >= 300 {\n\t\tnewErr := GenericOpenAPIError{\n\t\t\tbody: localVarBody,\n\t\t\terror: localVarHTTPResponse.Status,\n\t\t}\n\t\t\tvar v Error\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, localVarAPIResponse, newErr\n\t\t\t}\n\t\t\tnewErr.model = v\n\t\treturn localVarReturnValue, localVarAPIResponse, 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, localVarAPIResponse, newErr\n\t}\n\n\treturn localVarReturnValue, localVarAPIResponse, nil\n}", "title": "" }, { "docid": "d64c7561359e15bda26b5ba25d08091a", "score": "0.5198307", "text": "func (a *LabelApiService) DatacentersLabelsFindByKey(ctx _context.Context, datacenterId string, key string, optionals *DatacentersLabelsFindByKeyOpts) (LabelResource, *APIResponse, 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 LabelResource\n\t)\n\n\t// create path and map variables\n\tlocalVarPath := a.client.cfg.BasePath + \"/datacenters/{datacenterId}/labels/{key}\"\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"datacenterId\"+\"}\", _neturl.PathEscape(parameterToString(datacenterId, \"\")) , -1)\n\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"key\"+\"}\", _neturl.PathEscape(parameterToString(key, \"\")) , -1)\n\n\tlocalVarHeaderParams := make(map[string]string)\n\tlocalVarQueryParams := _neturl.Values{}\n\tlocalVarFormParams := _neturl.Values{}\n\n\tif optionals != nil && optionals.Pretty != nil {\n\t\tlocalVarQueryParams.Add(\"pretty\", parameterToString(*optionals.Pretty, \"\"))\n\t}\n\tif optionals != nil && optionals.Depth != nil {\n\t\tlocalVarQueryParams.Add(\"depth\", parameterToString(*optionals.Depth, \"\"))\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 optionals != nil && optionals.XContractNumber != nil {\n\t\tlocalVarHeaderParams[\"X-Contract-Number\"] = parameterToString(*optionals.XContractNumber, \"\")\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\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\tlocalVarAPIResponse := &APIResponse {\n\t\tResponse: localVarHTTPResponse,\n\t\tMethod: localVarHTTPMethod,\n\t\tRequestURL: localVarPath,\n\t\tOperation: \"DatacentersLabelsFindByKey\",\n\t}\n\tif err != nil || localVarHTTPResponse == nil {\n\t\treturn localVarReturnValue, localVarAPIResponse, err\n\t}\n\n\tlocalVarBody, err := _ioutil.ReadAll(localVarHTTPResponse.Body)\n\tlocalVarHTTPResponse.Body.Close()\n\tlocalVarAPIResponse.Payload = localVarBody\n\tif err != nil {\n\t\treturn localVarReturnValue, localVarAPIResponse, err\n\t}\n\n\tif localVarHTTPResponse.StatusCode >= 300 {\n\t\tnewErr := GenericOpenAPIError{\n\t\t\tbody: localVarBody,\n\t\t\terror: localVarHTTPResponse.Status,\n\t\t}\n\t\t\tvar v Error\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, localVarAPIResponse, newErr\n\t\t\t}\n\t\t\tnewErr.model = v\n\t\treturn localVarReturnValue, localVarAPIResponse, 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, localVarAPIResponse, newErr\n\t}\n\n\treturn localVarReturnValue, localVarAPIResponse, nil\n}", "title": "" }, { "docid": "56840c529c364308905766cb97522717", "score": "0.5193837", "text": "func (a *ClustersApiService) ListNodepoolLabels(ctx _context.Context, orgId int32, id int32) (map[string][]NodepoolLabels, *_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 map[string][]NodepoolLabels\n\t)\n\n\t// create path and map variables\n\tlocalVarPath := a.client.cfg.BasePath + \"/api/v1/orgs/{orgId}/clusters/{id}/nodepool-labels\"\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"orgId\"+\"}\", _neturl.QueryEscape(parameterToString(orgId, \"\")) , -1)\n\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"id\"+\"}\", _neturl.QueryEscape(parameterToString(id, \"\")) , -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\", \"application/problem+json\"}\n\n\t// set Accept header\n\tlocalVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts)\n\tif localVarHTTPHeaderAccept != \"\" {\n\t\tlocalVarHeaderParams[\"Accept\"] = localVarHTTPHeaderAccept\n\t}\n\tr, err := a.client.prepareRequest(ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes)\n\tif err != nil {\n\t\treturn localVarReturnValue, nil, err\n\t}\n\n\tlocalVarHTTPResponse, err := a.client.callAPI(r)\n\tif err != nil || localVarHTTPResponse == nil {\n\t\treturn localVarReturnValue, localVarHTTPResponse, err\n\t}\n\n\tlocalVarBody, err := _ioutil.ReadAll(localVarHTTPResponse.Body)\n\tlocalVarHTTPResponse.Body.Close()\n\tif err != nil {\n\t\treturn localVarReturnValue, localVarHTTPResponse, err\n\t}\n\n\tif localVarHTTPResponse.StatusCode >= 300 {\n\t\tnewErr := GenericOpenAPIError{\n\t\t\tbody: localVarBody,\n\t\t\terror: localVarHTTPResponse.Status,\n\t\t}\n\t\t\tvar v CommonError\n\t\t\terr = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get(\"Content-Type\"))\n\t\t\tif err != nil {\n\t\t\t\tnewErr.error = err.Error()\n\t\t\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t\t\t}\n\t\t\tnewErr.model = v\n\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t}\n\n\terr = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get(\"Content-Type\"))\n\tif err != nil {\n\t\tnewErr := GenericOpenAPIError{\n\t\t\tbody: localVarBody,\n\t\t\terror: err.Error(),\n\t\t}\n\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t}\n\n\treturn localVarReturnValue, localVarHTTPResponse, nil\n}", "title": "" }, { "docid": "a07042040a1a03c58b3f97f481a50fd4", "score": "0.518112", "text": "func (a *DefaultApiService) GetLabel(ctx context.Context, labelName string) (string, *http.Response, error) {\n\tvar (\n\t\tlocalVarHttpMethod = strings.ToUpper(\"Get\")\n\t\tlocalVarPostBody interface{}\n\t\tlocalVarFileName string\n\t\tlocalVarFileBytes []byte\n\t\tlocalVarReturnValue string\n\t)\n\n\t// create path and map variables\n\tlocalVarPath := a.client.cfg.BasePath + \"/api/1.0/labels/{labelName}\"\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"labelName\"+\"}\", fmt.Sprintf(\"%v\", labelName), -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{\"application/json\"}\n\n\t// set Accept header\n\tlocalVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts)\n\tif localVarHttpHeaderAccept != \"\" {\n\t\tlocalVarHeaderParams[\"Accept\"] = localVarHttpHeaderAccept\n\t}\n\tr, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes)\n\tif err != nil {\n\t\treturn localVarReturnValue, nil, err\n\t}\n\n\tlocalVarHttpResponse, err := a.client.callAPI(r)\n\tif err != nil || localVarHttpResponse == nil {\n\t\treturn localVarReturnValue, localVarHttpResponse, err\n\t}\n\n\tlocalVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body)\n\tlocalVarHttpResponse.Body.Close()\n\tif err != nil {\n\t\treturn localVarReturnValue, localVarHttpResponse, err\n\t}\n\n\tif localVarHttpResponse.StatusCode < 300 {\n\t\t// If we succeed, return the data, otherwise pass on to decode error.\n\t\terr = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get(\"Content-Type\"));\n\t\tif err == nil { \n\t\t\treturn localVarReturnValue, localVarHttpResponse, err\n\t\t}\n\t}\n\n\tif localVarHttpResponse.StatusCode >= 300 {\n\t\tnewErr := GenericSwaggerError{\n\t\t\tbody: localVarBody,\n\t\t\terror: localVarHttpResponse.Status,\n\t\t}\n\t\tif localVarHttpResponse.StatusCode == 200 {\n\t\t\tvar v string\n\t\t\terr = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get(\"Content-Type\"));\n\t\t\t\tif err != nil {\n\t\t\t\t\tnewErr.error = err.Error()\n\t\t\t\t\treturn localVarReturnValue, localVarHttpResponse, newErr\n\t\t\t\t}\n\t\t\t\tnewErr.model = v\n\t\t\t\treturn localVarReturnValue, localVarHttpResponse, newErr\n\t\t}\n\t\treturn localVarReturnValue, localVarHttpResponse, newErr\n\t}\n\n\treturn localVarReturnValue, localVarHttpResponse, nil\n}", "title": "" }, { "docid": "93e917fd1c7fcf773ead807f51b27285", "score": "0.5175857", "text": "func (c *Cluster) Labels() []string {\n\tlabels := []string{\"kind/flake\"}\n\n\ttopTests := make([]string, len(c.Tests))\n\tfor i, test := range c.topTestsFailed(len(c.Tests)) {\n\t\ttopTests[i] = test.Name\n\t}\n\tfor sig := range c.filer.creator.TestsSIGs(topTests) {\n\t\tlabels = append(labels, \"sig/\"+sig)\n\t}\n\n\treturn labels\n}", "title": "" }, { "docid": "92ec415f1e5cc5d742c93ab79532e923", "score": "0.51603955", "text": "func (g *Gitlab) MergeLabels(projID int, mrIID int) (labels []string, err error) {\n\tvar mergerequest *gitlab.MergeRequest\n\tif mergerequest, _, err = g.client.MergeRequests.GetMergeRequest(projID, mrIID); err != nil {\n\t\treturn\n\t}\n\tlabels = mergerequest.Labels\n\treturn\n}", "title": "" }, { "docid": "4dfbec2c657304001695fdc0d047a4dd", "score": "0.51439536", "text": "func (o GetInstanceBootDiskInitializeParamOutput) Labels() pulumi.MapOutput {\n\treturn o.ApplyT(func(v GetInstanceBootDiskInitializeParam) map[string]interface{} { return v.Labels }).(pulumi.MapOutput)\n}", "title": "" }, { "docid": "5d002a84cfe93072aef9a540300d76e0", "score": "0.51425946", "text": "func (o GetImagesImageOutput) Label() pulumi.StringOutput {\n\treturn o.ApplyT(func(v GetImagesImage) string { return v.Label }).(pulumi.StringOutput)\n}", "title": "" }, { "docid": "fe0eb9e74dbd60a68ac219bb4283a453", "score": "0.51331747", "text": "func GetLabels(sdc *SDConfig) ([]map[string]string, error) {\n\tcfg, err := getAPIConfig(sdc)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"cannot get API config: %s\", err)\n\t}\n\tms, err := getInstancesLabels(cfg)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"error when fetching instances data from GCE: %s\", err)\n\t}\n\treturn ms, nil\n}", "title": "" }, { "docid": "9f55e22b8204badc7b521f7149f9a8ad", "score": "0.5122585", "text": "func (a *LabelApiService) SnapshotsLabelsFindByKey(ctx _context.Context, snapshotId string, key string, optionals *SnapshotsLabelsFindByKeyOpts) (LabelResource, *APIResponse, 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 LabelResource\n\t)\n\n\t// create path and map variables\n\tlocalVarPath := a.client.cfg.BasePath + \"/snapshots/{snapshotId}/labels/{key}\"\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"snapshotId\"+\"}\", _neturl.PathEscape(parameterToString(snapshotId, \"\")) , -1)\n\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"key\"+\"}\", _neturl.PathEscape(parameterToString(key, \"\")) , -1)\n\n\tlocalVarHeaderParams := make(map[string]string)\n\tlocalVarQueryParams := _neturl.Values{}\n\tlocalVarFormParams := _neturl.Values{}\n\n\tif optionals != nil && optionals.Pretty != nil {\n\t\tlocalVarQueryParams.Add(\"pretty\", parameterToString(*optionals.Pretty, \"\"))\n\t}\n\tif optionals != nil && optionals.Depth != nil {\n\t\tlocalVarQueryParams.Add(\"depth\", parameterToString(*optionals.Depth, \"\"))\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 optionals != nil && optionals.XContractNumber != nil {\n\t\tlocalVarHeaderParams[\"X-Contract-Number\"] = parameterToString(*optionals.XContractNumber, \"\")\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\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\tlocalVarAPIResponse := &APIResponse {\n\t\tResponse: localVarHTTPResponse,\n\t\tMethod: localVarHTTPMethod,\n\t\tRequestURL: localVarPath,\n\t\tOperation: \"SnapshotsLabelsFindByKey\",\n\t}\n\tif err != nil || localVarHTTPResponse == nil {\n\t\treturn localVarReturnValue, localVarAPIResponse, err\n\t}\n\n\tlocalVarBody, err := _ioutil.ReadAll(localVarHTTPResponse.Body)\n\tlocalVarHTTPResponse.Body.Close()\n\tlocalVarAPIResponse.Payload = localVarBody\n\tif err != nil {\n\t\treturn localVarReturnValue, localVarAPIResponse, err\n\t}\n\n\tif localVarHTTPResponse.StatusCode >= 300 {\n\t\tnewErr := GenericOpenAPIError{\n\t\t\tbody: localVarBody,\n\t\t\terror: localVarHTTPResponse.Status,\n\t\t}\n\t\t\tvar v Error\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, localVarAPIResponse, newErr\n\t\t\t}\n\t\t\tnewErr.model = v\n\t\treturn localVarReturnValue, localVarAPIResponse, 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, localVarAPIResponse, newErr\n\t}\n\n\treturn localVarReturnValue, localVarAPIResponse, nil\n}", "title": "" }, { "docid": "3ea76fdfb2224d2a1d35e487cead3a53", "score": "0.5115557", "text": "func (a *LabelApiService) DatacentersLabelsGet(ctx _context.Context, datacenterId string, optionals *DatacentersLabelsGetOpts) (LabelResources, *APIResponse, 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 LabelResources\n\t)\n\n\t// create path and map variables\n\tlocalVarPath := a.client.cfg.BasePath + \"/datacenters/{datacenterId}/labels\"\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"datacenterId\"+\"}\", _neturl.PathEscape(parameterToString(datacenterId, \"\")) , -1)\n\n\tlocalVarHeaderParams := make(map[string]string)\n\tlocalVarQueryParams := _neturl.Values{}\n\tlocalVarFormParams := _neturl.Values{}\n\n\tif optionals != nil && optionals.Pretty != nil {\n\t\tlocalVarQueryParams.Add(\"pretty\", parameterToString(*optionals.Pretty, \"\"))\n\t}\n\tif optionals != nil && optionals.Depth != nil {\n\t\tlocalVarQueryParams.Add(\"depth\", parameterToString(*optionals.Depth, \"\"))\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 optionals != nil && optionals.XContractNumber != nil {\n\t\tlocalVarHeaderParams[\"X-Contract-Number\"] = parameterToString(*optionals.XContractNumber, \"\")\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\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\tlocalVarAPIResponse := &APIResponse {\n\t\tResponse: localVarHTTPResponse,\n\t\tMethod: localVarHTTPMethod,\n\t\tRequestURL: localVarPath,\n\t\tOperation: \"DatacentersLabelsGet\",\n\t}\n\tif err != nil || localVarHTTPResponse == nil {\n\t\treturn localVarReturnValue, localVarAPIResponse, err\n\t}\n\n\tlocalVarBody, err := _ioutil.ReadAll(localVarHTTPResponse.Body)\n\tlocalVarHTTPResponse.Body.Close()\n\tlocalVarAPIResponse.Payload = localVarBody\n\tif err != nil {\n\t\treturn localVarReturnValue, localVarAPIResponse, err\n\t}\n\n\tif localVarHTTPResponse.StatusCode >= 300 {\n\t\tnewErr := GenericOpenAPIError{\n\t\t\tbody: localVarBody,\n\t\t\terror: localVarHTTPResponse.Status,\n\t\t}\n\t\t\tvar v Error\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, localVarAPIResponse, newErr\n\t\t\t}\n\t\t\tnewErr.model = v\n\t\treturn localVarReturnValue, localVarAPIResponse, 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, localVarAPIResponse, newErr\n\t}\n\n\treturn localVarReturnValue, localVarAPIResponse, nil\n}", "title": "" }, { "docid": "3bdb95130683d8502e2bbe54d133911b", "score": "0.51099825", "text": "func (pc *ProfileCalculator) podLabelsGet(podNamespace, podName string) (string, map[string]string, error) {\n\tpod, err := pc.listers.Pods.Pods(podNamespace).Get(podName)\n\tif err != nil {\n\t\treturn \"\", nil, err\n\t}\n\n\treturn pod.Spec.NodeName, util.MapOfStringsCopy(pod.Labels), nil\n}", "title": "" }, { "docid": "95f3627a6b308b84f6c9202ecd728301", "score": "0.50957507", "text": "func (p *QL) FindLabelsValues(ctx echo.Context) error {\n\tw := ctx.Response()\n\tr := ctx.Request()\n\n\ttoken := core.RetrieveToken(r)\n\tif len(token) == 0 {\n\t\trespondWithError(w, errors.New(\"Not authorized, please provide a READ token\"), http.StatusForbidden)\n\t\treturn nil\n\t}\n\n\tlabelValue := ctx.Param(\"label\")\n\n\tif len(labelValue) == 0 {\n\t\tlog.WithFields(log.Fields{}).Error(\"missing label\")\n\t\trespondWithError(w, errors.New(\"Unprocessable Entity: label\"), http.StatusBadRequest)\n\t\treturn nil\n\t}\n\n\tselector := \"~.*{\" + labelValue + \"~.*}\"\n\n\twarpServer := core.NewWarpServer(viper.GetString(\"warp_endpoint\"), \"prometheus-find-labels\")\n\tgtss, err := warpServer.FindGTS(token, selector)\n\tif err != nil {\n\t\tlog.WithFields(log.Fields{\n\t\t\t\"query\": selector,\n\t\t\t\"error\": err.Error(),\n\t\t}).Error(\"Error finding some GTS\")\n\t\trespondWithError(w, err, http.StatusInternalServerError)\n\t\treturn nil\n\t}\n\n\tvar resp prometheusFindLabelsResponse\n\n\tresp.Status = \"success\"\n\n\tfor _, gts := range gtss.GTS {\n\t\tfor key, value := range gts.Labels {\n\t\t\tif key != labelValue {\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tresp.Data = append(resp.Data, value)\n\t\t}\n\t}\n\n\tresp.Data = unique(resp.Data)\n\tb, _ := json.Marshal(resp)\n\tw.Write(b)\n\n\treturn nil\n}", "title": "" }, { "docid": "77afd135111de932f02ac021c6c9ee59", "score": "0.50745463", "text": "func (a *LabelApiService) SnapshotsLabelsGet(ctx _context.Context, snapshotId string, optionals *SnapshotsLabelsGetOpts) (LabelResources, *APIResponse, 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 LabelResources\n\t)\n\n\t// create path and map variables\n\tlocalVarPath := a.client.cfg.BasePath + \"/snapshots/{snapshotId}/labels\"\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"snapshotId\"+\"}\", _neturl.PathEscape(parameterToString(snapshotId, \"\")) , -1)\n\n\tlocalVarHeaderParams := make(map[string]string)\n\tlocalVarQueryParams := _neturl.Values{}\n\tlocalVarFormParams := _neturl.Values{}\n\n\tif optionals != nil && optionals.Pretty != nil {\n\t\tlocalVarQueryParams.Add(\"pretty\", parameterToString(*optionals.Pretty, \"\"))\n\t}\n\tif optionals != nil && optionals.Depth != nil {\n\t\tlocalVarQueryParams.Add(\"depth\", parameterToString(*optionals.Depth, \"\"))\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 optionals != nil && optionals.XContractNumber != nil {\n\t\tlocalVarHeaderParams[\"X-Contract-Number\"] = parameterToString(*optionals.XContractNumber, \"\")\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\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\tlocalVarAPIResponse := &APIResponse {\n\t\tResponse: localVarHTTPResponse,\n\t\tMethod: localVarHTTPMethod,\n\t\tRequestURL: localVarPath,\n\t\tOperation: \"SnapshotsLabelsGet\",\n\t}\n\tif err != nil || localVarHTTPResponse == nil {\n\t\treturn localVarReturnValue, localVarAPIResponse, err\n\t}\n\n\tlocalVarBody, err := _ioutil.ReadAll(localVarHTTPResponse.Body)\n\tlocalVarHTTPResponse.Body.Close()\n\tlocalVarAPIResponse.Payload = localVarBody\n\tif err != nil {\n\t\treturn localVarReturnValue, localVarAPIResponse, err\n\t}\n\n\tif localVarHTTPResponse.StatusCode >= 300 {\n\t\tnewErr := GenericOpenAPIError{\n\t\t\tbody: localVarBody,\n\t\t\terror: localVarHTTPResponse.Status,\n\t\t}\n\t\t\tvar v Error\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, localVarAPIResponse, newErr\n\t\t\t}\n\t\t\tnewErr.model = v\n\t\treturn localVarReturnValue, localVarAPIResponse, 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, localVarAPIResponse, newErr\n\t}\n\n\treturn localVarReturnValue, localVarAPIResponse, nil\n}", "title": "" }, { "docid": "6f98b86e93e5e89d90384b154efdd692", "score": "0.5065815", "text": "func (a *LabelApiService) IpblocksLabelsPost(ctx _context.Context, ipblockId string, label LabelResource, optionals *IpblocksLabelsPostOpts) (LabelResource, *APIResponse, error) {\n\tvar (\n\t\tlocalVarHTTPMethod = _nethttp.MethodPost\n\t\tlocalVarPostBody interface{}\n\t\tlocalVarFormFileName string\n\t\tlocalVarFileName string\n\t\tlocalVarFileBytes []byte\n\t\tlocalVarReturnValue LabelResource\n\t)\n\n\t// create path and map variables\n\tlocalVarPath := a.client.cfg.BasePath + \"/ipblocks/{ipblockId}/labels\"\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"ipblockId\"+\"}\", _neturl.PathEscape(parameterToString(ipblockId, \"\")) , -1)\n\n\tlocalVarHeaderParams := make(map[string]string)\n\tlocalVarQueryParams := _neturl.Values{}\n\tlocalVarFormParams := _neturl.Values{}\n\n\tif optionals != nil && optionals.Pretty != nil {\n\t\tlocalVarQueryParams.Add(\"pretty\", parameterToString(*optionals.Pretty, \"\"))\n\t}\n\tif optionals != nil && optionals.Depth != nil {\n\t\tlocalVarQueryParams.Add(\"depth\", parameterToString(*optionals.Depth, \"\"))\n\t}\n\t// to determine the Content-Type header\n\tlocalVarHTTPContentTypes := []string{\"application/json\"}\n\n\t// set Content-Type header\n\tlocalVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes)\n\tif localVarHTTPContentType != \"\" {\n\t\tlocalVarHeaderParams[\"Content-Type\"] = localVarHTTPContentType\n\t}\n\n\t// to determine the Accept header\n\tlocalVarHTTPHeaderAccepts := []string{\"application/json\"}\n\n\t// set Accept header\n\tlocalVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts)\n\tif localVarHTTPHeaderAccept != \"\" {\n\t\tlocalVarHeaderParams[\"Accept\"] = localVarHTTPHeaderAccept\n\t}\n\tif optionals != nil && optionals.XContractNumber != nil {\n\t\tlocalVarHeaderParams[\"X-Contract-Number\"] = parameterToString(*optionals.XContractNumber, \"\")\n\t}\n\t// body params\n\tlocalVarPostBody = &label\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\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\tlocalVarAPIResponse := &APIResponse {\n\t\tResponse: localVarHTTPResponse,\n\t\tMethod: localVarHTTPMethod,\n\t\tRequestURL: localVarPath,\n\t\tOperation: \"IpblocksLabelsPost\",\n\t}\n\tif err != nil || localVarHTTPResponse == nil {\n\t\treturn localVarReturnValue, localVarAPIResponse, err\n\t}\n\n\tlocalVarBody, err := _ioutil.ReadAll(localVarHTTPResponse.Body)\n\tlocalVarHTTPResponse.Body.Close()\n\tlocalVarAPIResponse.Payload = localVarBody\n\tif err != nil {\n\t\treturn localVarReturnValue, localVarAPIResponse, err\n\t}\n\n\tif localVarHTTPResponse.StatusCode >= 300 {\n\t\tnewErr := GenericOpenAPIError{\n\t\t\tbody: localVarBody,\n\t\t\terror: localVarHTTPResponse.Status,\n\t\t}\n\t\t\tvar v Error\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, localVarAPIResponse, newErr\n\t\t\t}\n\t\t\tnewErr.model = v\n\t\treturn localVarReturnValue, localVarAPIResponse, 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, localVarAPIResponse, newErr\n\t}\n\n\treturn localVarReturnValue, localVarAPIResponse, nil\n}", "title": "" }, { "docid": "91c7db8cce4cc99833f9981b70be54bd", "score": "0.5063228", "text": "func GetLabels(build Build, github GitHub) []string {\n\tlabels := []string{}\n\tif build.Labels != nil {\n\t\tlabels = build.Labels\n\t}\n\n\tif !build.AddGitLabels {\n\t\treturn labels\n\t}\n\n\tif github.Repository != \"\" {\n\t\tlabels = append(labels, opencontainersLabelPrefix+\".source=https://github.com/\"+github.Repository)\n\t}\n\n\tif github.Sha != \"\" {\n\t\tlabels = append(labels, opencontainersLabelPrefix+\".revision=\"+github.Sha)\n\n\t}\n\n\tcreatedTime := time.Now().UTC().Format(time.RFC3339)\n\tlabels = append(labels, opencontainersLabelPrefix+\".created=\"+createdTime)\n\n\treturn labels\n}", "title": "" }, { "docid": "ec39739612d572cac0592cac6593abc6", "score": "0.5055442", "text": "func (a *LabelApiService) DatacentersServersLabelsFindByKey(ctx _context.Context, datacenterId string, serverId string, key string, optionals *DatacentersServersLabelsFindByKeyOpts) (LabelResource, *APIResponse, 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 LabelResource\n\t)\n\n\t// create path and map variables\n\tlocalVarPath := a.client.cfg.BasePath + \"/datacenters/{datacenterId}/servers/{serverId}/labels/{key}\"\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"datacenterId\"+\"}\", _neturl.PathEscape(parameterToString(datacenterId, \"\")) , -1)\n\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"serverId\"+\"}\", _neturl.PathEscape(parameterToString(serverId, \"\")) , -1)\n\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"key\"+\"}\", _neturl.PathEscape(parameterToString(key, \"\")) , -1)\n\n\tlocalVarHeaderParams := make(map[string]string)\n\tlocalVarQueryParams := _neturl.Values{}\n\tlocalVarFormParams := _neturl.Values{}\n\n\tif optionals != nil && optionals.Pretty != nil {\n\t\tlocalVarQueryParams.Add(\"pretty\", parameterToString(*optionals.Pretty, \"\"))\n\t}\n\tif optionals != nil && optionals.Depth != nil {\n\t\tlocalVarQueryParams.Add(\"depth\", parameterToString(*optionals.Depth, \"\"))\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 optionals != nil && optionals.XContractNumber != nil {\n\t\tlocalVarHeaderParams[\"X-Contract-Number\"] = parameterToString(*optionals.XContractNumber, \"\")\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\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\tlocalVarAPIResponse := &APIResponse {\n\t\tResponse: localVarHTTPResponse,\n\t\tMethod: localVarHTTPMethod,\n\t\tRequestURL: localVarPath,\n\t\tOperation: \"DatacentersServersLabelsFindByKey\",\n\t}\n\tif err != nil || localVarHTTPResponse == nil {\n\t\treturn localVarReturnValue, localVarAPIResponse, err\n\t}\n\n\tlocalVarBody, err := _ioutil.ReadAll(localVarHTTPResponse.Body)\n\tlocalVarHTTPResponse.Body.Close()\n\tlocalVarAPIResponse.Payload = localVarBody\n\tif err != nil {\n\t\treturn localVarReturnValue, localVarAPIResponse, err\n\t}\n\n\tif localVarHTTPResponse.StatusCode >= 300 {\n\t\tnewErr := GenericOpenAPIError{\n\t\t\tbody: localVarBody,\n\t\t\terror: localVarHTTPResponse.Status,\n\t\t}\n\t\t\tvar v Error\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, localVarAPIResponse, newErr\n\t\t\t}\n\t\t\tnewErr.model = v\n\t\treturn localVarReturnValue, localVarAPIResponse, 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, localVarAPIResponse, newErr\n\t}\n\n\treturn localVarReturnValue, localVarAPIResponse, nil\n}", "title": "" }, { "docid": "acaf6bbf5128a39a0cda648c2d8c5870", "score": "0.50405246", "text": "func (p *PCE) GetLabels(queryParameters map[string]string) (api APIResponse, err error) {\n\tapi, err = p.GetCollection(\"labels\", false, queryParameters, &p.LabelsSlice)\n\tif len(p.LabelsSlice) >= 500 {\n\t\tp.LabelsSlice = nil\n\t\tapi, err = p.GetCollection(\"labels\", true, queryParameters, &p.LabelsSlice)\n\t}\n\t// Populate the PCE objects\n\tp.Labels = make(map[string]Label)\n\tfor _, l := range p.LabelsSlice {\n\t\tp.Labels[l.Href] = l\n\t\tp.Labels[l.Key+l.Value] = l\n\t\tp.Labels[strings.ToLower(l.Key+l.Value)] = l\n\t\tp.Labels[strings.ToLower(l.Key)+l.Value] = l\n\t}\n\n\treturn api, err\n}", "title": "" }, { "docid": "731a55a7cd6630ed13e248df754f866a", "score": "0.50357485", "text": "func (s *labeledService) ListLabels(ctx context.Context, tenantID string) (map[string]*model.Label, error) {\n\tlog.C(ctx).Infof(\"getting labels for tenant with ID %s\", tenantID)\n\tif err := s.ensureTenantExists(ctx, tenantID); err != nil {\n\t\treturn nil, err\n\t}\n\n\tlabels, err := s.labelRepo.ListForObject(ctx, tenantID, model.TenantLabelableObject, tenantID)\n\tif err != nil {\n\t\treturn nil, errors.Wrapf(err, \"whilie listing labels for tenant with ID %s\", tenantID)\n\t}\n\n\treturn labels, nil\n}", "title": "" }, { "docid": "1e54cb0e3c83b3e70b8f2c05706aa989", "score": "0.50320154", "text": "func (client *ClientImpl) GetLabel(ctx context.Context, args GetLabelArgs) (*git.TfvcLabel, error) {\n\trouteValues := make(map[string]string)\n\tif args.Project != nil && *args.Project != \"\" {\n\t\trouteValues[\"project\"] = *args.Project\n\t}\n\tif args.LabelId == nil || *args.LabelId == \"\" {\n\t\treturn nil, &azuredevops.ArgumentNilOrEmptyError{ArgumentName: \"args.LabelId\"}\n\t}\n\trouteValues[\"labelId\"] = *args.LabelId\n\n\tqueryParams := url.Values{}\n\tif args.RequestData == nil {\n\t\treturn nil, &azuredevops.ArgumentNilError{ArgumentName: \"requestData\"}\n\t}\n\tif args.RequestData.LabelScope != nil {\n\t\tqueryParams.Add(\"requestData.labelScope\", *args.RequestData.LabelScope)\n\t}\n\tif args.RequestData.Name != nil {\n\t\tqueryParams.Add(\"requestData.name\", *args.RequestData.Name)\n\t}\n\tif args.RequestData.Owner != nil {\n\t\tqueryParams.Add(\"requestData.owner\", *args.RequestData.Owner)\n\t}\n\tif args.RequestData.ItemLabelFilter != nil {\n\t\tqueryParams.Add(\"requestData.itemLabelFilter\", *args.RequestData.ItemLabelFilter)\n\t}\n\tif args.RequestData.MaxItemCount != nil {\n\t\tqueryParams.Add(\"requestData.maxItemCount\", strconv.Itoa(*args.RequestData.MaxItemCount))\n\t}\n\tif args.RequestData.IncludeLinks != nil {\n\t\tqueryParams.Add(\"requestData.includeLinks\", strconv.FormatBool(*args.RequestData.IncludeLinks))\n\t}\n\tlocationId, _ := uuid.Parse(\"a5d9bd7f-b661-4d0e-b9be-d9c16affae54\")\n\tresp, err := client.Client.Send(ctx, http.MethodGet, locationId, \"6.0\", routeValues, queryParams, nil, \"\", \"application/json\", nil)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tvar responseValue git.TfvcLabel\n\terr = client.Client.UnmarshalBody(resp, &responseValue)\n\treturn &responseValue, err\n}", "title": "" }, { "docid": "3c8fc43ddf3763eaa8bf816c97192baf", "score": "0.5015203", "text": "func (o InstanceBootDiskInitializeParamsOutput) Labels() pulumi.MapOutput {\n\treturn o.ApplyT(func(v InstanceBootDiskInitializeParams) map[string]interface{} { return v.Labels }).(pulumi.MapOutput)\n}", "title": "" }, { "docid": "c6f1f37e9f1b7d1e181fa60dcd600cec", "score": "0.49844268", "text": "func (a *LabelApiService) DatacentersServersLabelsGet(ctx _context.Context, datacenterId string, serverId string, optionals *DatacentersServersLabelsGetOpts) (LabelResources, *APIResponse, 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 LabelResources\n\t)\n\n\t// create path and map variables\n\tlocalVarPath := a.client.cfg.BasePath + \"/datacenters/{datacenterId}/servers/{serverId}/labels\"\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"datacenterId\"+\"}\", _neturl.PathEscape(parameterToString(datacenterId, \"\")) , -1)\n\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"serverId\"+\"}\", _neturl.PathEscape(parameterToString(serverId, \"\")) , -1)\n\n\tlocalVarHeaderParams := make(map[string]string)\n\tlocalVarQueryParams := _neturl.Values{}\n\tlocalVarFormParams := _neturl.Values{}\n\n\tif optionals != nil && optionals.Pretty != nil {\n\t\tlocalVarQueryParams.Add(\"pretty\", parameterToString(*optionals.Pretty, \"\"))\n\t}\n\tif optionals != nil && optionals.Depth != nil {\n\t\tlocalVarQueryParams.Add(\"depth\", parameterToString(*optionals.Depth, \"\"))\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 optionals != nil && optionals.XContractNumber != nil {\n\t\tlocalVarHeaderParams[\"X-Contract-Number\"] = parameterToString(*optionals.XContractNumber, \"\")\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\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\tlocalVarAPIResponse := &APIResponse {\n\t\tResponse: localVarHTTPResponse,\n\t\tMethod: localVarHTTPMethod,\n\t\tRequestURL: localVarPath,\n\t\tOperation: \"DatacentersServersLabelsGet\",\n\t}\n\tif err != nil || localVarHTTPResponse == nil {\n\t\treturn localVarReturnValue, localVarAPIResponse, err\n\t}\n\n\tlocalVarBody, err := _ioutil.ReadAll(localVarHTTPResponse.Body)\n\tlocalVarHTTPResponse.Body.Close()\n\tlocalVarAPIResponse.Payload = localVarBody\n\tif err != nil {\n\t\treturn localVarReturnValue, localVarAPIResponse, err\n\t}\n\n\tif localVarHTTPResponse.StatusCode >= 300 {\n\t\tnewErr := GenericOpenAPIError{\n\t\t\tbody: localVarBody,\n\t\t\terror: localVarHTTPResponse.Status,\n\t\t}\n\t\t\tvar v Error\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, localVarAPIResponse, newErr\n\t\t\t}\n\t\t\tnewErr.model = v\n\t\treturn localVarReturnValue, localVarAPIResponse, 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, localVarAPIResponse, newErr\n\t}\n\n\treturn localVarReturnValue, localVarAPIResponse, nil\n}", "title": "" }, { "docid": "fc147142cec3b9c69dbad25d35f4730f", "score": "0.49782506", "text": "func extractLabels(template string) (map[string]string, error) {\n\tlabelsValue := gjson.Get(template, labelsPath)\n\tif !labelsValue.Exists() {\n\t\treturn nil, errors.New(\"failed to find labels\")\n\t}\n\tvalues, ok := labelsValue.Value().(map[string]interface{})\n\tif !ok {\n\t\treturn nil, fmt.Errorf(\"unexpected type for labels: %T\", labelsValue.Value())\n\t}\n\n\tlabels := make(map[string]string)\n\tfor k, v := range values {\n\t\tvalue, ok := v.(string)\n\t\tif !ok {\n\t\t\treturn nil, fmt.Errorf(\"unexpected type for label value: %T\", value)\n\t\t}\n\t\tlabels[k] = value\n\t}\n\n\treturn labels, nil\n}", "title": "" }, { "docid": "64c80ffe5a56c33108c3978deba77f84", "score": "0.49769923", "text": "func (s *service) ListLabels(ctx context.Context, applicationID string) (map[string]*model.Label, error) {\n\tappTenant, err := tenant.LoadFromContext(ctx)\n\tif err != nil {\n\t\treturn nil, errors.Wrapf(err, \"while loading tenant from context\")\n\t}\n\n\tappExists, err := s.appRepo.Exists(ctx, appTenant, applicationID)\n\tif err != nil {\n\t\treturn nil, errors.Wrap(err, \"while checking Application existence\")\n\t}\n\n\tif !appExists {\n\t\treturn nil, fmt.Errorf(\"Application with ID %s doesn't exist\", applicationID)\n\t}\n\n\tlabels, err := s.labelRepo.List(ctx, appTenant, model.ApplicationLabelableObject, applicationID)\n\tif err != nil {\n\t\treturn nil, errors.Wrap(err, \"while getting label for Application\")\n\t}\n\n\treturn labels, nil\n}", "title": "" }, { "docid": "cab462b20478a23477ec6833e54489b6", "score": "0.4965795", "text": "func (c *APIClient) fetchPodLabels(ns, name string) error {\n\tvar data interface{}\n\n\t// initiate a get request to the api server\n\tpodURL := c.baseURL + ns + \"/pods/\" + name\n\tr, err := c.client.Get(podURL)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tdefer r.Body.Close()\n\tswitch {\n\tcase r.StatusCode == int(404):\n\t\treturn fmt.Errorf(\"Page not found!\")\n\tcase r.StatusCode == int(403):\n\t\treturn fmt.Errorf(\"Access denied!\")\n\tcase r.StatusCode != int(200):\n\t\tlog.Errorf(\"GET Status '%s' status code %d \\n\", r.Status, r.StatusCode)\n\t\treturn fmt.Errorf(\"%s\", r.Status)\n\t}\n\n\tresponse, err := ioutil.ReadAll(r.Body)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\terr = json.Unmarshal(response, &data)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tpodSpec := data.(map[string]interface{})\n\tm, ok := podSpec[\"metadata\"]\n\t// Treat missing metadata as a fatal error\n\tif !ok {\n\t\treturn fmt.Errorf(\"metadata not found in podSpec\")\n\t}\n\n\tp := &c.podCache\n\tp.setDefaults(ns, name)\n\n\tmeta := m.(map[string]interface{})\n\tl, ok := meta[\"labels\"]\n\tif ok {\n\t\tlabels := l.(map[string]interface{})\n\t\tfor key, val := range labels {\n\t\t\tswitch valType := val.(type) {\n\n\t\t\tcase string:\n\t\t\t\tp.labels[key] = val.(string)\n\n\t\t\tdefault:\n\t\t\t\tlog.Infof(\"Label %s type %v in pod %s.%s ignored\",\n\t\t\t\t\tkey, valType, ns, name)\n\t\t\t}\n\t\t}\n\t} else {\n\t\tlog.Infof(\"labels not found in podSpec metadata, using defaults\")\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "3dcecb9d689131c8c2f834c19631307d", "score": "0.49585807", "text": "func (s *customSource) GetLabels() (source.FeatureLabels, error) {\n\t// Get raw features from all sources\n\tfeatures := source.GetAllFeatures()\n\n\tlabels := source.FeatureLabels{}\n\tallFeatureConfig := append(getStaticFeatureConfig(), *s.config...)\n\tallFeatureConfig = append(allFeatureConfig, getDirectoryFeatureConfig()...)\n\tklog.V(2).InfoS(\"resolving custom features\", \"configuration\", utils.DelayedDumper(allFeatureConfig))\n\t// Iterate over features\n\tfor _, rule := range allFeatureConfig {\n\t\truleOut, err := rule.execute(features)\n\t\tif err != nil {\n\t\t\tklog.ErrorS(err, \"failed to execute rule\")\n\t\t\tcontinue\n\t\t}\n\n\t\tfor n, v := range ruleOut.Labels {\n\t\t\tlabels[n] = v\n\t\t}\n\t\t// Feed back rule output to features map for subsequent rules to match\n\t\tfeatures.InsertAttributeFeatures(nfdv1alpha1.RuleBackrefDomain, nfdv1alpha1.RuleBackrefFeature, ruleOut.Labels)\n\t\tfeatures.InsertAttributeFeatures(nfdv1alpha1.RuleBackrefDomain, nfdv1alpha1.RuleBackrefFeature, ruleOut.Vars)\n\t}\n\n\treturn labels, nil\n}", "title": "" }, { "docid": "38b1bd9f613f2b247a14a280479a07de", "score": "0.49522385", "text": "func GetLabelsInRepoByIDs(ctx context.Context, repoID int64, labelIDs []int64) ([]*Label, error) {\n\tlabels := make([]*Label, 0, len(labelIDs))\n\treturn labels, db.GetEngine(ctx).\n\t\tWhere(\"repo_id = ?\", repoID).\n\t\tIn(\"id\", labelIDs).\n\t\tAsc(\"name\").\n\t\tFind(&labels)\n}", "title": "" }, { "docid": "c852fee4296a7084958473dc45ff9021", "score": "0.49322632", "text": "func getCVLabels(claim *apis.CStorVolumeClaim) map[string]string {\n\treturn map[string]string{\n\t\t\"openebs.io/persistent-volume\": claim.Name,\n\t\t\"openebs.io/version\": version.GetVersion(),\n\t}\n}", "title": "" }, { "docid": "ffadf6108c825475a015efdc8199df07", "score": "0.49105054", "text": "func (tagL) LoadLabels(e boil.Executor, singular bool, maybeTag interface{}, mods queries.Applicator) error {\n\tvar slice []*Tag\n\tvar object *Tag\n\n\tif singular {\n\t\tobject = maybeTag.(*Tag)\n\t} else {\n\t\tslice = *maybeTag.(*[]*Tag)\n\t}\n\n\targs := make([]interface{}, 0, 1)\n\tif singular {\n\t\tif object.R == nil {\n\t\t\tobject.R = &tagR{}\n\t\t}\n\t\targs = append(args, object.ID)\n\t} else {\n\tOuter:\n\t\tfor _, obj := range slice {\n\t\t\tif obj.R == nil {\n\t\t\t\tobj.R = &tagR{}\n\t\t\t}\n\n\t\t\tfor _, a := range args {\n\t\t\t\tif a == obj.ID {\n\t\t\t\t\tcontinue Outer\n\t\t\t\t}\n\t\t\t}\n\n\t\t\targs = append(args, obj.ID)\n\t\t}\n\t}\n\n\tif len(args) == 0 {\n\t\treturn nil\n\t}\n\n\tquery := NewQuery(\n\t\tqm.Select(\"\\\"labels\\\".id, \\\"labels\\\".uid, \\\"labels\\\".content_unit_id, \\\"labels\\\".media_type, \\\"labels\\\".properties, \\\"labels\\\".approve_state, \\\"labels\\\".created_at, \\\"a\\\".\\\"tag_id\\\"\"),\n\t\tqm.From(\"\\\"labels\\\"\"),\n\t\tqm.InnerJoin(\"\\\"label_tag\\\" as \\\"a\\\" on \\\"labels\\\".\\\"id\\\" = \\\"a\\\".\\\"label_id\\\"\"),\n\t\tqm.WhereIn(\"\\\"a\\\".\\\"tag_id\\\" in ?\", args...),\n\t)\n\tif mods != nil {\n\t\tmods.Apply(query)\n\t}\n\n\tresults, err := query.Query(e)\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"failed to eager load labels\")\n\t}\n\n\tvar resultSlice []*Label\n\n\tvar localJoinCols []int64\n\tfor results.Next() {\n\t\tone := new(Label)\n\t\tvar localJoinCol int64\n\n\t\terr = results.Scan(&one.ID, &one.UID, &one.ContentUnitID, &one.MediaType, &one.Properties, &one.ApproveState, &one.CreatedAt, &localJoinCol)\n\t\tif err != nil {\n\t\t\treturn errors.Wrap(err, \"failed to scan eager loaded results for labels\")\n\t\t}\n\t\tif err = results.Err(); err != nil {\n\t\t\treturn errors.Wrap(err, \"failed to plebian-bind eager loaded slice labels\")\n\t\t}\n\n\t\tresultSlice = append(resultSlice, one)\n\t\tlocalJoinCols = append(localJoinCols, localJoinCol)\n\t}\n\n\tif err = results.Close(); err != nil {\n\t\treturn errors.Wrap(err, \"failed to close results in eager load on labels\")\n\t}\n\tif err = results.Err(); err != nil {\n\t\treturn errors.Wrap(err, \"error occurred during iteration of eager loaded relations for labels\")\n\t}\n\n\tif singular {\n\t\tobject.R.Labels = resultSlice\n\t\tfor _, foreign := range resultSlice {\n\t\t\tif foreign.R == nil {\n\t\t\t\tforeign.R = &labelR{}\n\t\t\t}\n\t\t\tforeign.R.Tags = append(foreign.R.Tags, object)\n\t\t}\n\t\treturn nil\n\t}\n\n\tfor i, foreign := range resultSlice {\n\t\tlocalJoinCol := localJoinCols[i]\n\t\tfor _, local := range slice {\n\t\t\tif local.ID == localJoinCol {\n\t\t\t\tlocal.R.Labels = append(local.R.Labels, foreign)\n\t\t\t\tif foreign.R == nil {\n\t\t\t\t\tforeign.R = &labelR{}\n\t\t\t\t}\n\t\t\t\tforeign.R.Tags = append(foreign.R.Tags, local)\n\t\t\t\tbreak\n\t\t\t}\n\t\t}\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "1846ceddd9421ba4ee83d68f08049c75", "score": "0.49035355", "text": "func getLabels(span *zipkincore.Span) ([]string, map[string]string) {\n\n\tvar keys []string\n\tlabelMap := make(map[string]string)\n\n\t// extract any tags whose key starts with \"fn\" from the span\n\tbinaryAnnotations := span.GetBinaryAnnotations()\n\tfor _, thisBinaryAnnotation := range binaryAnnotations {\n\t\tkey := thisBinaryAnnotation.GetKey()\n\t\tif thisBinaryAnnotation.GetAnnotationType() == zipkincore.AnnotationType_STRING && strings.HasPrefix(key, \"fn\") {\n\t\t\tkeys = append(keys, key)\n\t\t\tvalue := string(thisBinaryAnnotation.GetValue()[:])\n\t\t\tlabelMap[key] = value\n\t\t}\n\t}\n\n\treturn keys, labelMap\n}", "title": "" }, { "docid": "e90a199646c853c280b71499531f1a72", "score": "0.4902994", "text": "func (l *LabelAPI) List() {\n\tquery := &models.LabelQuery{\n\t\tName: l.GetString(\"name\"),\n\t\tFuzzyMatchName: true,\n\t\tLevel: common.LabelLevelUser,\n\t}\n\n\tscope := l.GetString(\"scope\")\n\tif scope != common.LabelScopeGlobal && scope != common.LabelScopeProject {\n\t\tl.SendBadRequestError(fmt.Errorf(\"invalid scope: %s\", scope))\n\t\treturn\n\t}\n\tquery.Scope = scope\n\n\tif scope == common.LabelScopeProject {\n\t\tprojectIDStr := l.GetString(\"project_id\")\n\t\tif len(projectIDStr) == 0 {\n\t\t\tl.SendBadRequestError(errors.New(\"project_id is required\"))\n\t\t\treturn\n\t\t}\n\t\tprojectID, err := strconv.ParseInt(projectIDStr, 10, 64)\n\t\tif err != nil || projectID <= 0 {\n\t\t\tl.SendBadRequestError(fmt.Errorf(\"invalid project_id: %s\", projectIDStr))\n\t\t\treturn\n\t\t}\n\n\t\tresource := rbac.NewProjectNamespace(projectID).Resource(rbac.ResourceLabel)\n\t\tif !l.SecurityCtx.Can(rbac.ActionList, resource) {\n\t\t\tif !l.SecurityCtx.IsAuthenticated() {\n\t\t\t\tl.SendUnAuthorizedError(errors.New(\"UnAuthorized\"))\n\t\t\t\treturn\n\t\t\t}\n\t\t\tl.SendForbiddenError(errors.New(l.SecurityCtx.GetUsername()))\n\t\t\treturn\n\t\t}\n\t\tquery.ProjectID = projectID\n\t}\n\n\ttotal, err := dao.GetTotalOfLabels(query)\n\tif err != nil {\n\t\tl.SendInternalServerError(fmt.Errorf(\"failed to get total count of labels: %v\", err))\n\t\treturn\n\t}\n\n\tquery.Page, query.Size, err = l.GetPaginationParams()\n\tif err != nil {\n\t\tl.SendBadRequestError(err)\n\t\treturn\n\t}\n\n\tlabels, err := dao.ListLabels(query)\n\tif err != nil {\n\t\tl.SendInternalServerError(fmt.Errorf(\"failed to list labels: %v\", err))\n\t\treturn\n\t}\n\n\tl.SetPaginationHeader(total, query.Page, query.Size)\n\tl.Data[\"json\"] = labels\n\tl.ServeJSON()\n}", "title": "" }, { "docid": "f8c50ede0ff4c003a1922dc1fec46084", "score": "0.48987603", "text": "func (t *FileTarget) Labels() model.LabelSet {\n\treturn t.labels\n}", "title": "" }, { "docid": "5d7eaa3a5977d5c41f9024b45c9dd7c2", "score": "0.48923868", "text": "func (o InstanceTemplateDiskOutput) Labels() pulumi.StringMapOutput {\n\treturn o.ApplyT(func(v InstanceTemplateDisk) map[string]string { return v.Labels }).(pulumi.StringMapOutput)\n}", "title": "" }, { "docid": "5c49a12384b9e99d03a7c5c12560e539", "score": "0.48730564", "text": "func (pc *PolicyCache) getMatchLabelPodsInsideNs(namespace string, labels []*policymodel.Policy_Label) []string {\n\t// Check if we have empty labels\n\tif len(labels) == 0 {\n\t\treturn []string{}\n\t}\n\tprevNSLabelSelector := namespace + \"/\" + labels[0].Key + \"/\" + labels[0].Value\n\tprevPodSet := pc.configuredPods.LookupPodsByNSLabelSelector(prevNSLabelSelector)\n\tcurrent := prevPodSet\n\n\tfor i := 1; i < len(labels); i++ {\n\t\tprevPodSet = current\n\t\tnewNSLabelSelector := namespace + \"/\" + labels[i].Key + \"/\" + labels[i].Value\n\t\tnewPodSet := pc.configuredPods.LookupPodsByNSLabelSelector(newNSLabelSelector)\n\t\tcurrent = utils.Intersect(prevPodSet, newPodSet)\n\t\tif len(current) == 0 {\n\t\t\tbreak\n\t\t}\n\t}\n\n\treturn current\n}", "title": "" }, { "docid": "6ece724a4bf2d4423fc19044856a1772", "score": "0.4872936", "text": "func (o LookupAssetResultOutput) Labels() pulumi.StringMapOutput {\n\treturn o.ApplyT(func(v LookupAssetResult) map[string]string { return v.Labels }).(pulumi.StringMapOutput)\n}", "title": "" }, { "docid": "0e3285e88d3df05b6b04376731267e89", "score": "0.48663074", "text": "func (a *LabelApiService) IpblocksLabelsPut(ctx _context.Context, ipblockId string, key string, label LabelResource, optionals *IpblocksLabelsPutOpts) (LabelResource, *APIResponse, error) {\n\tvar (\n\t\tlocalVarHTTPMethod = _nethttp.MethodPut\n\t\tlocalVarPostBody interface{}\n\t\tlocalVarFormFileName string\n\t\tlocalVarFileName string\n\t\tlocalVarFileBytes []byte\n\t\tlocalVarReturnValue LabelResource\n\t)\n\n\t// create path and map variables\n\tlocalVarPath := a.client.cfg.BasePath + \"/ipblocks/{ipblockId}/labels/{key}\"\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"ipblockId\"+\"}\", _neturl.PathEscape(parameterToString(ipblockId, \"\")) , -1)\n\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"key\"+\"}\", _neturl.PathEscape(parameterToString(key, \"\")) , -1)\n\n\tlocalVarHeaderParams := make(map[string]string)\n\tlocalVarQueryParams := _neturl.Values{}\n\tlocalVarFormParams := _neturl.Values{}\n\n\tif optionals != nil && optionals.Pretty != nil {\n\t\tlocalVarQueryParams.Add(\"pretty\", parameterToString(*optionals.Pretty, \"\"))\n\t}\n\tif optionals != nil && optionals.Depth != nil {\n\t\tlocalVarQueryParams.Add(\"depth\", parameterToString(*optionals.Depth, \"\"))\n\t}\n\t// to determine the Content-Type header\n\tlocalVarHTTPContentTypes := []string{\"application/json\"}\n\n\t// set Content-Type header\n\tlocalVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes)\n\tif localVarHTTPContentType != \"\" {\n\t\tlocalVarHeaderParams[\"Content-Type\"] = localVarHTTPContentType\n\t}\n\n\t// to determine the Accept header\n\tlocalVarHTTPHeaderAccepts := []string{\"application/json\"}\n\n\t// set Accept header\n\tlocalVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts)\n\tif localVarHTTPHeaderAccept != \"\" {\n\t\tlocalVarHeaderParams[\"Accept\"] = localVarHTTPHeaderAccept\n\t}\n\tif optionals != nil && optionals.XContractNumber != nil {\n\t\tlocalVarHeaderParams[\"X-Contract-Number\"] = parameterToString(*optionals.XContractNumber, \"\")\n\t}\n\t// body params\n\tlocalVarPostBody = &label\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\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\tlocalVarAPIResponse := &APIResponse {\n\t\tResponse: localVarHTTPResponse,\n\t\tMethod: localVarHTTPMethod,\n\t\tRequestURL: localVarPath,\n\t\tOperation: \"IpblocksLabelsPut\",\n\t}\n\tif err != nil || localVarHTTPResponse == nil {\n\t\treturn localVarReturnValue, localVarAPIResponse, err\n\t}\n\n\tlocalVarBody, err := _ioutil.ReadAll(localVarHTTPResponse.Body)\n\tlocalVarHTTPResponse.Body.Close()\n\tlocalVarAPIResponse.Payload = localVarBody\n\tif err != nil {\n\t\treturn localVarReturnValue, localVarAPIResponse, err\n\t}\n\n\tif localVarHTTPResponse.StatusCode >= 300 {\n\t\tnewErr := GenericOpenAPIError{\n\t\t\tbody: localVarBody,\n\t\t\terror: localVarHTTPResponse.Status,\n\t\t}\n\t\t\tvar v Error\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, localVarAPIResponse, newErr\n\t\t\t}\n\t\t\tnewErr.model = v\n\t\treturn localVarReturnValue, localVarAPIResponse, 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, localVarAPIResponse, newErr\n\t}\n\n\treturn localVarReturnValue, localVarAPIResponse, nil\n}", "title": "" }, { "docid": "c74073707af29133766fe402fac95639", "score": "0.4860322", "text": "func (o LookupConversationResultOutput) Labels() pulumi.StringMapOutput {\n\treturn o.ApplyT(func(v LookupConversationResult) map[string]string { return v.Labels }).(pulumi.StringMapOutput)\n}", "title": "" }, { "docid": "8bbf1cf7c76fadccae7da895c733d003", "score": "0.48545188", "text": "func GetPodLabels() map[string]string {\n\tonce.Do(func() {\n\t\t// Add pod labels into nodeInfo\n\t\tpodLabelsPath := fmt.Sprintf(\"%s/labels\", IstioPodInfoPath)\n\t\tif _, err := os.Stat(podLabelsPath); err == nil || os.IsExist(err) {\n\t\t\tf, err := os.Open(podLabelsPath)\n\t\t\tif err == nil {\n\t\t\t\tdefer f.Close()\n\n\t\t\t\tbr := bufio.NewReader(f)\n\t\t\t\tfor {\n\t\t\t\t\tl, _, e := br.ReadLine()\n\t\t\t\t\tif e == io.EOF {\n\t\t\t\t\t\tbreak\n\t\t\t\t\t}\n\t\t\t\t\t// group=\"blue\"\n\t\t\t\t\tkeyValueSep := strings.SplitN(strings.ReplaceAll(string(l), \"\\\"\", \"\"), podLabelsSeparator, 2)\n\t\t\t\t\tif len(keyValueSep) != 2 {\n\t\t\t\t\t\tcontinue\n\t\t\t\t\t}\n\t\t\t\t\tlabels[keyValueSep[0]] = keyValueSep[1]\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t})\n\n\treturn labels\n}", "title": "" }, { "docid": "1724b2cf30870453a44a510ba01e8c68", "score": "0.48472977", "text": "func (o LookupApiResultOutput) Labels() pulumi.StringMapOutput {\n\treturn o.ApplyT(func(v LookupApiResult) map[string]string { return v.Labels }).(pulumi.StringMapOutput)\n}", "title": "" }, { "docid": "97c59692208dd64a6e2d3eb3adbdf6a1", "score": "0.48445773", "text": "func (o InstanceBootDiskInitializeParamsPtrOutput) Labels() pulumi.MapOutput {\n\treturn o.ApplyT(func(v *InstanceBootDiskInitializeParams) map[string]interface{} {\n\t\tif v == nil {\n\t\t\treturn nil\n\t\t}\n\t\treturn v.Labels\n\t}).(pulumi.MapOutput)\n}", "title": "" }, { "docid": "907eae1d512bf36648439b518e823cb6", "score": "0.48421127", "text": "func (client *MockedContainerdClient) Labels(ctn containerd.Container) (map[string]string, error) {\n\treturn client.MockLabels(ctn)\n}", "title": "" }, { "docid": "20e59008dcd2faed955b6b4ec01cc7f9", "score": "0.48394087", "text": "func (p *PCE) GetLabelByKeyValue(key, value string) (Label, APIResponse, error) {\n\tapi, err := p.GetLabels(map[string]string{\"key\": key, \"value\": value})\n\tfor _, label := range p.LabelsSlice {\n\t\tif label.Value == value {\n\t\t\treturn label, api, err\n\t\t}\n\t}\n\treturn Label{}, api, nil\n}", "title": "" }, { "docid": "4ce5dda5420f6e6a3f9e996ee072fdba", "score": "0.48336414", "text": "func (a *API) GetLabels(w http.ResponseWriter, r *http.Request) {\n\tvar (\n\t\tuniqueLabels []string\n\t\tm = make(map[string]bool)\n\t)\n\tfor _, route := range a.config.Config.Routes {\n\t\tfor _, label := range route.Labels {\n\t\t\tif _, value := m[label]; !value {\n\t\t\t\tm[label] = true\n\t\t\t\tuniqueLabels = append(uniqueLabels, label)\n\t\t\t}\n\t\t}\n\t}\n\ta.ResponseStatus = http.StatusText(200)\n\ta.Data = uniqueLabels\n\ta.send(w, a.marshalled())\n}", "title": "" }, { "docid": "4b262fb2342ee15441e915e5406a3915", "score": "0.4813815", "text": "func (p *plugin) Label(instance instance.ID, labels map[string]string) error {\n\tbuff, err := afero.ReadFile(p.fs, filepath.Join(p.Dir, string(instance)+\".tf.json\"))\n\tif err != nil {\n\t\treturn err\n\t}\n\n\ttf := TFormat{}\n\terr = types.AnyBytes(buff).Decode(&tf)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tvmType, vmName, props, err := FindVM(&tf)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tif len(props) == 0 || vmName != TResourceName(string(instance)) {\n\t\treturn fmt.Errorf(\"not found:%v\", instance)\n\t}\n\n\tswitch vmType {\n\tcase VMAmazon, VMAzure, VMDigitalOcean, VMGoogleCloud:\n\t\tif _, has := props[\"tags\"]; !has {\n\t\t\tprops[\"tags\"] = map[string]interface{}{}\n\t\t}\n\n\t\tif tags, ok := props[\"tags\"].(map[string]interface{}); ok {\n\t\t\tfor k, v := range labels {\n\t\t\t\ttags[k] = v\n\t\t\t}\n\t\t}\n\n\tcase VMSoftLayer:\n\t\tif _, has := props[\"tags\"]; !has {\n\t\t\tprops[\"tags\"] = []interface{}{}\n\t\t}\n\t\ttags, ok := props[\"tags\"].([]interface{})\n\t\tif !ok {\n\t\t\treturn fmt.Errorf(\"bad format:%v\", instance)\n\t\t}\n\t\tprops[\"tags\"] = mergeLabelsIntoTagSlice(tags, labels)\n\t}\n\n\tbuff, err = json.MarshalIndent(tf, \" \", \" \")\n\tif err != nil {\n\t\treturn err\n\t}\n\terr = afero.WriteFile(p.fs, filepath.Join(p.Dir, string(instance)+\".tf.json\"), buff, 0644)\n\tif err != nil {\n\t\treturn err\n\t}\n\treturn p.terraformApply()\n}", "title": "" }, { "docid": "95bc8975881e4621b9cc73f1d92e2e0a", "score": "0.48037297", "text": "func GetLabelsByRepoID(ctx context.Context, repoID int64, sortType string, listOptions db.ListOptions) ([]*Label, error) {\n\tif repoID <= 0 {\n\t\treturn nil, ErrRepoLabelNotExist{0, repoID}\n\t}\n\tlabels := make([]*Label, 0, 10)\n\tsess := db.GetEngine(ctx).Where(\"repo_id = ?\", repoID)\n\n\tswitch sortType {\n\tcase \"reversealphabetically\":\n\t\tsess.Desc(\"name\")\n\tcase \"leastissues\":\n\t\tsess.Asc(\"num_issues\")\n\tcase \"mostissues\":\n\t\tsess.Desc(\"num_issues\")\n\tdefault:\n\t\tsess.Asc(\"name\")\n\t}\n\n\tif listOptions.Page != 0 {\n\t\tsess = db.SetSessionPagination(sess, &listOptions)\n\t}\n\n\treturn labels, sess.Find(&labels)\n}", "title": "" }, { "docid": "96d62143f547cec11fd13b0dc8e4c91b", "score": "0.48028576", "text": "func (k *KubernetesResourceV1) GetAllLabels() map[string]string {\n\treturn k.Metadata.Labels\n}", "title": "" }, { "docid": "3b721fdc38337d1e62bad9922442b3eb", "score": "0.47951034", "text": "func (d *Data) GetLabelMapping(versionID dvid.VersionLocalID, label []byte) (uint64, error) {\n\tfirstKey := d.NewForwardMapKey(versionID, label, 0)\n\tlastKey := d.NewForwardMapKey(versionID, label, MaxLabel)\n\n\tdb := server.StorageEngine()\n\tif db == nil {\n\t\treturn 0, fmt.Errorf(\"Did not find a working key-value datastore to get image!\")\n\t}\n\tkeys, err := db.KeysInRange(firstKey, lastKey)\n\tif err != nil {\n\t\treturn 0, err\n\t}\n\tnumKeys := len(keys)\n\tswitch {\n\tcase numKeys == 0:\n\t\treturn 0, fmt.Errorf(\"Label %d is not mapped to any other label.\", label)\n\tcase numKeys > 1:\n\t\tvar mapped string\n\t\tfor i := 0; i < len(keys); i++ {\n\t\t\tmapped += fmt.Sprintf(\"%d \", keys[i])\n\t\t}\n\t\treturn 0, fmt.Errorf(\"Label %d is mapped to more than one label: %s\", label, mapped)\n\t}\n\n\tb := keys[0].Bytes()\n\tindexBytes := b[datastore.DataKeyIndexOffset:]\n\tmapping := binary.BigEndian.Uint64(indexBytes[9:17])\n\n\treturn mapping, nil\n}", "title": "" }, { "docid": "c916bc3728af8ed0f7adc6d5e7677f0e", "score": "0.4790921", "text": "func (db *badgerDB) GetLabels(ctx context.Context) []models.Label {\n\tlabelData := new(models.Label)\n\tvar labels []models.Label\n\titer := db.Conn.Bucket(\"labels\").Iter()\n\tdefer iter.Close()\n\tfor iter.Next(labelData) {\n\t\tlabels = append(labels, *labelData)\n\t}\n\treturn labels\n}", "title": "" }, { "docid": "38c31aff7f86858194b4399e5bc5e658", "score": "0.47887155", "text": "func (a *EngineAPI) LabelNames(ctx context.Context, matchers []string, startTime time.Time, endTime time.Time) ([]string, v1.Warnings, error) {\n\treturn nil, nil, fmt.Errorf(\"not implemented\")\n}", "title": "" }, { "docid": "630dc823f51aa08fe83ea82378cb17c8", "score": "0.4787143", "text": "func (s sliceTester) testLabel(t *testing.T, vol labelVol, img *dvid.Image) {\n\tdata := img.Data()\n\tvar x, y, z int32\n\ti := 0\n\tswitch s.orient {\n\tcase \"xy\":\n\t\tfor y = 0; y < s.height; y++ {\n\t\t\tfor x = 0; x < s.width; x++ {\n\t\t\t\tlabel := binary.LittleEndian.Uint64(data[i*8 : (i+1)*8])\n\t\t\t\ti++\n\t\t\t\tvx := x + s.offset[0]\n\t\t\t\tvy := y + s.offset[1]\n\t\t\t\tvz := s.offset[2]\n\t\t\t\texpected := vol.label(vx, vy, vz)\n\t\t\t\tif label != expected {\n\t\t\t\t\tt.Errorf(\"Bad label @ (%d,%d,%d): expected %d, got %d\\n\", vx, vy, vz, expected, label)\n\t\t\t\t\treturn\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\treturn\n\tcase \"xz\":\n\t\tfor z = 0; z < s.height; z++ {\n\t\t\tfor x = 0; x < s.width; x++ {\n\t\t\t\tlabel := binary.LittleEndian.Uint64(data[i*8 : (i+1)*8])\n\t\t\t\ti++\n\t\t\t\tvx := x + s.offset[0]\n\t\t\t\tvy := s.offset[1]\n\t\t\t\tvz := z + s.offset[2]\n\t\t\t\texpected := vol.label(vx, vy, vz)\n\t\t\t\tif label != expected {\n\t\t\t\t\tt.Errorf(\"Bad label @ (%d,%d,%d): expected %d, got %d\\n\", vx, vy, vz, expected, label)\n\t\t\t\t\treturn\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\treturn\n\tcase \"yz\":\n\t\tfor z = 0; z < s.height; z++ {\n\t\t\tfor y = 0; y < s.width; y++ {\n\t\t\t\tlabel := binary.LittleEndian.Uint64(data[i*8 : (i+1)*8])\n\t\t\t\ti++\n\t\t\t\tvx := s.offset[0]\n\t\t\t\tvy := y + s.offset[1]\n\t\t\t\tvz := z + s.offset[2]\n\t\t\t\texpected := vol.label(vx, vy, vz)\n\t\t\t\tif label != expected {\n\t\t\t\t\tt.Errorf(\"Bad label @ (%d,%d,%d): expected %d, got %d\\n\", vx, vy, vz, expected, label)\n\t\t\t\t\treturn\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\treturn\n\tdefault:\n\t\tt.Fatalf(\"Unknown slice orientation %q\\n\", s.orient)\n\t}\n}", "title": "" }, { "docid": "f3033e53d1514b81d21cf7f7cb8fc6ff", "score": "0.47841376", "text": "func TestItShouldGetLabelsFromContainer(t *testing.T) {\n\ttestLabel := \"com.polpetta.test.getLabels\"\n\tu.DockerCli(u.NewDockerCliBuilder(u.DockerRunCommand).\n\t\tFlag(u.DockerCliDetachFlag).\n\t\tFlag(u.DockerTTYFlag).\n\t\tLabel(testLabel).\n\t\tImage(\"alpine\"), func(containerId string) {\n\t\tresult, err := m.GetLabelsFromContainer(containerId)\n\t\tif err != nil {\n\t\t\tu.KillContainer(containerId, t)\n\t\t\tt.Fatalf(err.Error())\n\t\t}\n\t\tlabels := result.Labels()\n\t\tif len(labels) != 1 || labels[0].Name() != testLabel {\n\t\t\tu.KillContainer(containerId, t)\n\t\t\tt.Fatalf(\"Expected 1 element in the array, found %d\",\n\t\t\t\tlen(labels))\n\t\t}\n\n\t\tt.Log(labels[0].Name())\n\t}, t)\n}", "title": "" }, { "docid": "cd4a94324f3b448765b7f71f6ba5b052", "score": "0.47827274", "text": "func (s sliceTester) getLabel(t *testing.T, img *dvid.Image, x, y, z int32) uint64 {\n\tswitch s.orient {\n\tcase \"xy\":\n\t\tif z != s.offset[2] || x < s.offset[0] || x >= s.offset[0]+s.width || y < s.offset[1] || y >= s.offset[1]+s.height {\n\t\t\tbreak\n\t\t}\n\t\tix := x - s.offset[0]\n\t\tiy := y - s.offset[1]\n\t\tdata, err := img.DataPtr(ix, iy)\n\t\tif err != nil {\n\t\t\tt.Fatalf(\"Could not get data at (%d,%d): %s\\n\", ix, iy, err.Error())\n\t\t}\n\t\tif len(data) != 8 {\n\t\t\tt.Fatalf(\"Returned labels64 data that is not 8 bytes for a voxel\")\n\t\t}\n\t\treturn binary.LittleEndian.Uint64(data)\n\tdefault:\n\t\tt.Fatalf(\"Unknown slice orientation %q\\n\", s.orient)\n\t}\n\tt.Fatalf(\"Attempted to get voxel (%d, %d, %d) not in %d x %d %s slice at offset %s\\n\",\n\t\tx, y, z, s.width, s.height, s.orient, s.offset)\n\treturn 0\n}", "title": "" }, { "docid": "ee38f2e69805c6eab1a24e8fad2e803c", "score": "0.47805065", "text": "func (o TargetVMDetailsResponseOutput) Labels() pulumi.StringMapOutput {\n\treturn o.ApplyT(func(v TargetVMDetailsResponse) map[string]string { return v.Labels }).(pulumi.StringMapOutput)\n}", "title": "" }, { "docid": "8894e4a66705661ca6f1feb95832c48a", "score": "0.4777918", "text": "func (s sliceTester) testLabel(t *testing.T, vol labelVol, img *dvid.Image) {\n\tdata := img.Data()\n\tvar x, y, z int32\n\ti := 0\n\tswitch s.orient {\n\tcase \"xy\":\n\t\tfor y = 0; y < s.height; y++ {\n\t\t\tfor x = 0; x < s.width; x++ {\n\t\t\t\tlabel := binary.LittleEndian.Uint64(data[i*8 : (i+1)*8])\n\t\t\t\ti++\n\t\t\t\tvx := x + s.offset[0]\n\t\t\t\tvy := y + s.offset[1]\n\t\t\t\tvz := s.offset[2]\n\t\t\t\texpected := vol.label(vx, vy, vz)\n\t\t\t\tif label != expected {\n\t\t\t\t\tt.Errorf(\"Bad label @ (%d,%d,%d): expected %d, got %d\\n\", vx, vy, vz, expected, label)\n\t\t\t\t\treturn\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\treturn\n\tcase \"xz\":\n\t\tfor z = 0; z < s.height; z++ {\n\t\t\tfor x = 0; x < s.width; x++ {\n\t\t\t\tlabel := binary.LittleEndian.Uint64(data[i*8 : (i+1)*8])\n\t\t\t\ti++\n\t\t\t\tvx := x + s.offset[0]\n\t\t\t\tvy := s.offset[1]\n\t\t\t\tvz := z + s.offset[2]\n\t\t\t\texpected := vol.label(vx, vy, vz)\n\t\t\t\tif label != expected {\n\t\t\t\t\tt.Errorf(\"Bad label @ (%d,%d,%d): expected %d, got %d\\n\", vx, vy, vz, expected, label)\n\t\t\t\t\treturn\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\treturn\n\tcase \"yz\":\n\t\tfor z = 0; z < s.height; z++ {\n\t\t\tfor y = 0; x < s.width; x++ {\n\t\t\t\tlabel := binary.LittleEndian.Uint64(data[i*8 : (i+1)*8])\n\t\t\t\ti++\n\t\t\t\tvx := s.offset[0]\n\t\t\t\tvy := y * s.offset[1]\n\t\t\t\tvz := z + s.offset[2]\n\t\t\t\texpected := vol.label(vx, vy, vz)\n\t\t\t\tif label != expected {\n\t\t\t\t\tt.Errorf(\"Bad label @ (%d,%d,%d): expected %d, got %d\\n\", vx, vy, vz, expected, label)\n\t\t\t\t\treturn\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\treturn\n\tdefault:\n\t\tt.Fatalf(\"Unknown slice orientation %q\\n\", s.orient)\n\t}\n}", "title": "" }, { "docid": "91641083ff75de6719759699da47f0c0", "score": "0.4764452", "text": "func FindK8S() error {\n\tcount := 0\n\tfileList := []string{}\n\terr := filepath.Walk(\".\", func(path string, f os.FileInfo, err error) error {\n\t\tif strings.HasSuffix(path, \"yaml\") || strings.HasSuffix(path, \"yml\") {\n\n\t\t\tb, err := ioutil.ReadFile(path)\n\t\t\tif err != nil {\n\t\t\t\tpanic(err)\n\t\t\t}\n\t\t\ts := string(b)\n\n\t\t\tif strings.Contains(s, \"spec:\") && strings.Contains(s, \"kind:\") {\n\t\t\t\tfileList = append(fileList, path)\n\t\t\t\tcount++\n\t\t\t}\n\n\t\t}\n\t\treturn nil\n\t})\n\n\tfor _, file := range fileList {\n\t\tfmt.Println(file)\n\t}\n\n\tfmt.Printf(\"\\nFound %v Kubernetes object files\\n\", count)\n\n\treturn err\n}", "title": "" }, { "docid": "1790eed807768aaa637175edc4d2e9df", "score": "0.47629583", "text": "func (a *LabelApiService) DatacentersVolumesLabelsPost(ctx _context.Context, datacenterId string, volumeId string, label LabelResource, optionals *DatacentersVolumesLabelsPostOpts) (LabelResource, *APIResponse, error) {\n\tvar (\n\t\tlocalVarHTTPMethod = _nethttp.MethodPost\n\t\tlocalVarPostBody interface{}\n\t\tlocalVarFormFileName string\n\t\tlocalVarFileName string\n\t\tlocalVarFileBytes []byte\n\t\tlocalVarReturnValue LabelResource\n\t)\n\n\t// create path and map variables\n\tlocalVarPath := a.client.cfg.BasePath + \"/datacenters/{datacenterId}/volumes/{volumeId}/labels\"\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"datacenterId\"+\"}\", _neturl.PathEscape(parameterToString(datacenterId, \"\")) , -1)\n\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"volumeId\"+\"}\", _neturl.PathEscape(parameterToString(volumeId, \"\")) , -1)\n\n\tlocalVarHeaderParams := make(map[string]string)\n\tlocalVarQueryParams := _neturl.Values{}\n\tlocalVarFormParams := _neturl.Values{}\n\n\tif optionals != nil && optionals.Pretty != nil {\n\t\tlocalVarQueryParams.Add(\"pretty\", parameterToString(*optionals.Pretty, \"\"))\n\t}\n\tif optionals != nil && optionals.Depth != nil {\n\t\tlocalVarQueryParams.Add(\"depth\", parameterToString(*optionals.Depth, \"\"))\n\t}\n\t// to determine the Content-Type header\n\tlocalVarHTTPContentTypes := []string{\"application/json\"}\n\n\t// set Content-Type header\n\tlocalVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes)\n\tif localVarHTTPContentType != \"\" {\n\t\tlocalVarHeaderParams[\"Content-Type\"] = localVarHTTPContentType\n\t}\n\n\t// to determine the Accept header\n\tlocalVarHTTPHeaderAccepts := []string{\"application/json\"}\n\n\t// set Accept header\n\tlocalVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts)\n\tif localVarHTTPHeaderAccept != \"\" {\n\t\tlocalVarHeaderParams[\"Accept\"] = localVarHTTPHeaderAccept\n\t}\n\tif optionals != nil && optionals.XContractNumber != nil {\n\t\tlocalVarHeaderParams[\"X-Contract-Number\"] = parameterToString(*optionals.XContractNumber, \"\")\n\t}\n\t// body params\n\tlocalVarPostBody = &label\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\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\tlocalVarAPIResponse := &APIResponse {\n\t\tResponse: localVarHTTPResponse,\n\t\tMethod: localVarHTTPMethod,\n\t\tRequestURL: localVarPath,\n\t\tOperation: \"DatacentersVolumesLabelsPost\",\n\t}\n\tif err != nil || localVarHTTPResponse == nil {\n\t\treturn localVarReturnValue, localVarAPIResponse, err\n\t}\n\n\tlocalVarBody, err := _ioutil.ReadAll(localVarHTTPResponse.Body)\n\tlocalVarHTTPResponse.Body.Close()\n\tlocalVarAPIResponse.Payload = localVarBody\n\tif err != nil {\n\t\treturn localVarReturnValue, localVarAPIResponse, err\n\t}\n\n\tif localVarHTTPResponse.StatusCode >= 300 {\n\t\tnewErr := GenericOpenAPIError{\n\t\t\tbody: localVarBody,\n\t\t\terror: localVarHTTPResponse.Status,\n\t\t}\n\t\t\tvar v Error\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, localVarAPIResponse, newErr\n\t\t\t}\n\t\t\tnewErr.model = v\n\t\treturn localVarReturnValue, localVarAPIResponse, 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, localVarAPIResponse, newErr\n\t}\n\n\treturn localVarReturnValue, localVarAPIResponse, nil\n}", "title": "" }, { "docid": "fd1e2b64c6dad67c8f9b90154103d923", "score": "0.47526023", "text": "func (bundle *Bundle) uploadLabelFiles(queryRunner *PgQueryRunner) (string, []string, LSN, error) {\n\tlabel, offsetMap, lsnStr, err := queryRunner.stopBackup()\n\tif err != nil {\n\t\treturn \"\", nil, 0, errors.Wrap(err, \"UploadLabelFiles: failed to stop backup\")\n\t}\n\n\tlsn, err := ParseLSN(lsnStr)\n\tif err != nil {\n\t\treturn \"\", nil, 0, errors.Wrap(err, \"UploadLabelFiles: failed to parse finish LSN\")\n\t}\n\n\tif !queryRunner.IsTablespaceMapExists() {\n\t\treturn \"\", nil, lsn, nil\n\t}\n\n\ttarBall := bundle.NewTarBall(false)\n\ttarBall.SetUp(bundle.Crypter)\n\n\tlabelHeader := &tar.Header{\n\t\tName: BackupLabelFilename,\n\t\tMode: int64(0600),\n\t\tSize: int64(len(label)),\n\t\tTypeflag: tar.TypeReg,\n\t}\n\n\t_, err = internal.PackFileTo(tarBall, labelHeader, strings.NewReader(label))\n\tif err != nil {\n\t\treturn \"\", nil, 0, errors.Wrapf(err, \"UploadLabelFiles: failed to put %s to tar\", labelHeader.Name)\n\t}\n\ttracelog.InfoLogger.Println(labelHeader.Name)\n\n\toffsetMapHeader := &tar.Header{\n\t\tName: TablespaceMapFilename,\n\t\tMode: int64(0600),\n\t\tSize: int64(len(offsetMap)),\n\t\tTypeflag: tar.TypeReg,\n\t}\n\n\t_, err = internal.PackFileTo(tarBall, offsetMapHeader, strings.NewReader(offsetMap))\n\tif err != nil {\n\t\treturn \"\", nil, 0, errors.Wrapf(err, \"UploadLabelFiles: failed to put %s to tar\", offsetMapHeader.Name)\n\t}\n\ttracelog.InfoLogger.Println(offsetMapHeader.Name)\n\n\terr = bundle.TarBallQueue.CloseTarball(tarBall)\n\tif err != nil {\n\t\treturn \"\", nil, 0, errors.Wrap(err, \"UploadLabelFiles: failed to close tarball\")\n\t}\n\n\treturn tarBall.Name(), []string{TablespaceMapFilename, BackupLabelFilename}, lsn, nil\n}", "title": "" }, { "docid": "bb297281c9893571febf6e623623034b", "score": "0.47398087", "text": "func LabelList() {\n\tfirstEntry, clusterFile := getSwarmLeaderNodeAndClusterFile()\n\tnodesList := getNodesFromYml(getWorkingDir())\n\tgc.ExitIfFalse(len(nodesList) > 0, \"No nodes found in nodes.yml\")\n\tgc.ExitIfFalse(firstEntry != nil, \"No manager node found!\")\n\n\tvar cmdline bytes.Buffer\n\tcmdline.WriteString(\"sudo docker node inspect\")\n\n\tfor _, node := range nodesList {\n\t\tcmdline.WriteString(\" \" + node.Alias)\n\t}\n\n\tclient := getSSHClient(clusterFile)\n\n\tjsonstr := client.ExecOrExit(firstEntry.node.Host, cmdline.String())\n\tvar result []map[string]interface{}\n\tjson.Unmarshal([]byte(jsonstr), &result)\n\tgc.ExitIfFalse(len(result) == len(nodesList), \"Unexpected number of returned nodes\")\n\n\tnodesLines := make([]nodeLine, len(result))\n\tmaxLen := 1\n\tfor i, n := range result {\n\t\tspec := n[\"Spec\"].(map[string]interface{})\n\t\tdescription := n[\"Description\"].(map[string]interface{})\n\t\tlabels := spec[\"Labels\"].(map[string]interface{})\n\t\thostName := description[\"Hostname\"].(string)\n\t\trole := spec[\"Role\"].(string)\n\t\tvar labelsStr bytes.Buffer\n\t\tfor k, v := range labels {\n\t\t\tif labelsStr.Len() > 0 {\n\t\t\t\tlabelsStr.WriteString(\", \")\n\t\t\t}\n\t\t\tlabelsStr.WriteString(k)\n\t\t\tvalue := v.(string)\n\t\t\tif len(value) > 0 {\n\t\t\t\tlabelsStr.WriteString(\"=\")\n\t\t\t\tlabelsStr.WriteString(value)\n\t\t\t}\n\t\t}\n\t\tline := nodeLine{\n\t\t\tnode: hostName + \" (\" + role + \")\",\n\t\t\tlabels: labelsStr.String(),\n\t\t}\n\t\tnodesLines[i] = line\n\t\tif len(line.node) > maxLen {\n\t\t\tmaxLen = len(line.node)\n\t\t}\n\t}\n\n\tgc.Info(fmt.Sprintf(\"%-\"+strconv.Itoa(maxLen+6)+\"s%-50s\", \"NODE\", \"LABELS\"))\n\tfor _, line := range nodesLines {\n\t\tgc.Info(fmt.Sprintf(\"%-\"+strconv.Itoa(maxLen+6)+\"s%-50s\", line.node, line.labels))\n\t}\n}", "title": "" }, { "docid": "080d4e8761f43c3994332a6bf33d7393", "score": "0.47379822", "text": "func (cla *ChartLabelAPI) GetLabels() {\n\tcla.getLabelsOfResource(common.ResourceTypeChart, cla.chartFullName)\n}", "title": "" }, { "docid": "1b5ac46688168844366a7e6715cafd50", "score": "0.47302705", "text": "func ListLabelsTest() {\n\tresult, err := cli.ListLabels(\"\")\n\tif err != nil {\n\t\tlog.Fatal(\"\", \"error\", err)\n\t}\n\tlog.Info(\"ListLabels\", \"result\", result)\n\tresult2, err2 := cli.ListLabels(\"receive\")\n\tif err2 != nil {\n\t\tlog.Fatal(\"\", \"error\", err2)\n\t}\n\tlog.Info(\"ListLabels\", \"result\", result2)\n\tresult3, err3 := cli.ListLabels(\"send\")\n\tif err3 != nil {\n\t\tlog.Fatal(\"\", \"error\", err3)\n\t}\n\tlog.Info(\"ListLabels\", \"result\", result3) //empty?\n}", "title": "" }, { "docid": "6981995c0372cb5c76b86f559b12f454", "score": "0.47299427", "text": "func FetchLabels(ctx context.Context, client *http.Client) (\n\t*gmail.ListLabelsResponse, error) { // TODO(bzz): extract all args to a struct and make it a method\n\tsrv, err := gmail.New(client)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\t// TODO(bzz): handle token expiration (by cookie expiration? or set refresh token?)\n\t// Unable to retrieve all labels: Get https://www.googleapis.com/gmail/v1/users/me/labels?alt=json&prettyPrint=false: oauth2: token expired and refresh token is not set\n\n\t// fetch from Gmail\n\tlabelsResp, err := srv.Users.Labels.List(\"me\").Do()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn labelsResp, nil\n}", "title": "" }, { "docid": "fb4055024c12ac8bdb6b7a73608a6653", "score": "0.47258678", "text": "func (o LookupSpecResultOutput) Labels() pulumi.StringMapOutput {\n\treturn o.ApplyT(func(v LookupSpecResult) map[string]string { return v.Labels }).(pulumi.StringMapOutput)\n}", "title": "" }, { "docid": "36a94679544a3e775c7cf57ed8f99d2b", "score": "0.4725613", "text": "func (f *FullConfig) LabelsFor(text ...string) []string {\n\tsearchable := []byte(strings.Join(text, \" \"))\n\tlabels := make([]string, 0)\n\tfor key, values := range f.Labels {\n\t\tshouldLabel := true\n\t\tfor _, pattern := range values.Exclude {\n\t\t\tre := regexp.MustCompile(pattern)\n\t\t\tif re.Match(searchable) {\n\t\t\t\tshouldLabel = false\n\t\t\t\tbreak\n\t\t\t}\n\t\t}\n\t\tif !shouldLabel {\n\t\t\tbreak\n\t\t}\n\t\tfor _, pattern := range values.Include {\n\t\t\tre := regexp.MustCompile(pattern)\n\t\t\tif re.Match(searchable) {\n\t\t\t\tlabels = append(labels, key)\n\t\t\t}\n\t\t}\n\t}\n\treturn labels\n}", "title": "" }, { "docid": "addae68c62d92aad1a7606131b98264c", "score": "0.4708154", "text": "func (o PatchInstanceFilterGroupLabelResponseOutput) Labels() pulumi.StringMapOutput {\n\treturn o.ApplyT(func(v PatchInstanceFilterGroupLabelResponse) map[string]string { return v.Labels }).(pulumi.StringMapOutput)\n}", "title": "" }, { "docid": "addae68c62d92aad1a7606131b98264c", "score": "0.4708154", "text": "func (o PatchInstanceFilterGroupLabelResponseOutput) Labels() pulumi.StringMapOutput {\n\treturn o.ApplyT(func(v PatchInstanceFilterGroupLabelResponse) map[string]string { return v.Labels }).(pulumi.StringMapOutput)\n}", "title": "" }, { "docid": "ffbb8bfd8e0d7177266e8deffd4b2ef7", "score": "0.47016978", "text": "func (p *Post) Labels() ([]Label, error) {\n\t// I prefer returning an empty list than a nil pointer\n\tvar labels []Label\n\n\tdb, err := openDatabase(&p.db)\n\tif err != nil {\n\t\tfmt.Println(\"PostLabels 1:\", err)\n\t\treturn labels, err\n\t}\n\tdefer db.Close()\n\n\tstmt, err := db.Prepare(findLabelsByPostId)\n\tif err != nil {\n\t\tfmt.Println(\"PostLabels 2:\", err)\n\t\treturn labels, err\n\t}\n\tdefer stmt.Close()\n\n\trows, err := stmt.Query(p.Id())\n\tif err != nil {\n\t\tfmt.Println(\"PostLabels 3:\", err)\n\t\treturn labels, err\n\t}\n\tdefer rows.Close()\n\n\tfor rows.Next() {\n\t\tvar id int64\n\t\tvar name string\n\t\terr := rows.Scan(&id, &name)\n\t\tif err != nil {\n\t\t\tfmt.Println(\"PostLabels 4:\", err)\n\t\t\treturn labels, err\n\t\t}\n\t\tvar aLabel = Label{\n\t\t\tid: id,\n\t\t\tname: name,\n\t\t}\n\t\tlabels = append(labels, aLabel)\n\t}\n\treturn labels, nil\n}", "title": "" }, { "docid": "1cdb704044d395f6bfd22345d40ee0e8", "score": "0.46887013", "text": "func (o LookupVersionArtifactResultOutput) Labels() pulumi.StringMapOutput {\n\treturn o.ApplyT(func(v LookupVersionArtifactResult) map[string]string { return v.Labels }).(pulumi.StringMapOutput)\n}", "title": "" }, { "docid": "c3cf1226328ffdec47ae79e5d7aa9898", "score": "0.46868312", "text": "func TestItShouldGetLabelsFromService(t *testing.T) {\n\ttestLabel := \"com.polpetta.test.getLabels\"\n\tu.DockerCli(u.NewDockerCliBuilder(u.DockerServiceCommand).\n\t\tCommand(u.DockerCreateCommand).\n\t\tFlag(u.DockerCliDetachFlag).\n\t\tLabel(testLabel).\n\t\tName(\"testService\").\n\t\tImage(\"nginx\"), func(serviceId string) {\n\t\tresult, err := m.GetLabelsFromService(serviceId)\n\t\tif err != nil {\n\t\t\tu.KillService(serviceId, t)\n\t\t\tt.Fatalf(err.Error())\n\t\t}\n\t\tlabels := result.Labels()\n\t\tif len(labels) != 1 || labels[0].Name() != testLabel {\n\t\t\tu.KillService(serviceId, t)\n\t\t\tt.Fatalf(\"Expected 1 element in the array, found %d\",\n\t\t\t\tlen(labels))\n\t\t}\n\n\t\tt.Log(labels[0].Name())\n\t}, t)\n}", "title": "" }, { "docid": "e315340a349498ec129c8b2deda4c7c3", "score": "0.46866032", "text": "func (mr *ModifiedResources) computeLabelsDiff(o, m *Block, path []string) bool {\n\tif len(o.Labels) != len(m.Labels) {\n\t\tif Debug {\n\n\t\t\t//Basically this case should never happen\n\t\t\tLogger.Println(\"WARNING!!! This should never happen!\")\n\t\t\tLogger.Printf(\"Lables quantity differ. Path: %s\\n\"+\n\t\t\t\t\" Original: %d (in File %s)\\n\"+\n\t\t\t\t\" Modified: %d (in File %s)\", strings.Join(path, \"/\"),\n\t\t\t\tlen(o.Labels), o.Range().Filename,\n\t\t\t\tlen(m.Labels), m.Range().Filename)\n\t\t\tlogString, err := utils.GetChangeLogString(o.Range(), m.Range())\n\t\t\tif err != nil {\n\t\t\t\tLogger.Print(\"Cannot compose labels quantity diff\")\n\t\t\t} else {\n\t\t\t\tLogger.Println(logString)\n\t\t\t}\n\t\t}\n\n\t\treturn false\n\t}\n\tfor i, v := range o.Labels {\n\t\tif v != m.Labels[i] {\n\t\t\tif Debug {\n\t\t\t\tLogger.Printf(\"Lables differ. Path: %s\\n\"+\n\t\t\t\t\t\" Original: %s (in File %s at line: %d, column: %d)\\n\"+\n\t\t\t\t\t\" Modified: %s (in File %s at line: %d, column: %d)\", strings.Join(path, \"/\"),\n\t\t\t\t\to.Type, o.LabelRanges[i].Filename, o.LabelRanges[i].Start.Line, o.LabelRanges[i].Start.Column,\n\t\t\t\t\tm.Type, m.LabelRanges[i].Filename, m.LabelRanges[i].Start.Line, m.LabelRanges[i].Start.Column)\n\t\t\t\tlogString, err := utils.GetChangeLogString(o.LabelRanges[i], m.LabelRanges[i])\n\t\t\t\tif err != nil {\n\t\t\t\t\tLogger.Print(\"Cannot compose label diff\")\n\t\t\t\t} else {\n\t\t\t\t\tLogger.Println(logString)\n\t\t\t\t}\n\t\t\t}\n\t\t\tmr.Add(strings.Join(path, \"/\"))\n\t\t\treturn false\n\t\t}\n\t}\n\treturn true\n}", "title": "" }, { "docid": "17d0a5d5bd074a3226b0dccb20c1154d", "score": "0.4683562", "text": "func (o LookupTableResultOutput) Labels() pulumi.StringMapOutput {\n\treturn o.ApplyT(func(v LookupTableResult) map[string]string { return v.Labels }).(pulumi.StringMapOutput)\n}", "title": "" }, { "docid": "f72fe315abe64fc5652b2628057850e6", "score": "0.4677963", "text": "func (d *Data) GetLabelBytes(v dvid.VersionID, bcoord dvid.ChunkPoint3d) ([]byte, error) {\n\treturn d.getBlockLabels(v, bcoord, 0, false)\n}", "title": "" }, { "docid": "487245210e180bb0c86c1b6dc90e8e23", "score": "0.4673066", "text": "func GetLabels(mgoSession *mgo.Session) []models.Label {\n\tlabels := repositories.GetLabels(mgoSession)\n\n\treturn labels\n}", "title": "" }, { "docid": "df400c551f0988f1885a92ad8b19daa5", "score": "0.46692201", "text": "func (o *PointRequest) GetLabelsOk() (*[]Label, bool) {\n\tif o == nil || o.Labels == nil {\n\t\treturn nil, false\n\t}\n\treturn o.Labels, true\n}", "title": "" }, { "docid": "01164057f69be5cfef0c9e8cdfd9fdab", "score": "0.46692184", "text": "func (m *Term) GetLabels()([]LocalizedLabelable) {\n return m.labels\n}", "title": "" }, { "docid": "31c49c4396e2b90ad3ee65ffc69c4635", "score": "0.46657163", "text": "func (a *LabelApiService) DatacentersVolumesLabelsPut(ctx _context.Context, datacenterId string, volumeId string, key string, label LabelResource, optionals *DatacentersVolumesLabelsPutOpts) (LabelResource, *APIResponse, error) {\n\tvar (\n\t\tlocalVarHTTPMethod = _nethttp.MethodPut\n\t\tlocalVarPostBody interface{}\n\t\tlocalVarFormFileName string\n\t\tlocalVarFileName string\n\t\tlocalVarFileBytes []byte\n\t\tlocalVarReturnValue LabelResource\n\t)\n\n\t// create path and map variables\n\tlocalVarPath := a.client.cfg.BasePath + \"/datacenters/{datacenterId}/volumes/{volumeId}/labels/{key}\"\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"datacenterId\"+\"}\", _neturl.PathEscape(parameterToString(datacenterId, \"\")) , -1)\n\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"volumeId\"+\"}\", _neturl.PathEscape(parameterToString(volumeId, \"\")) , -1)\n\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"key\"+\"}\", _neturl.PathEscape(parameterToString(key, \"\")) , -1)\n\n\tlocalVarHeaderParams := make(map[string]string)\n\tlocalVarQueryParams := _neturl.Values{}\n\tlocalVarFormParams := _neturl.Values{}\n\n\tif optionals != nil && optionals.Pretty != nil {\n\t\tlocalVarQueryParams.Add(\"pretty\", parameterToString(*optionals.Pretty, \"\"))\n\t}\n\tif optionals != nil && optionals.Depth != nil {\n\t\tlocalVarQueryParams.Add(\"depth\", parameterToString(*optionals.Depth, \"\"))\n\t}\n\t// to determine the Content-Type header\n\tlocalVarHTTPContentTypes := []string{\"application/json\"}\n\n\t// set Content-Type header\n\tlocalVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes)\n\tif localVarHTTPContentType != \"\" {\n\t\tlocalVarHeaderParams[\"Content-Type\"] = localVarHTTPContentType\n\t}\n\n\t// to determine the Accept header\n\tlocalVarHTTPHeaderAccepts := []string{\"application/json\"}\n\n\t// set Accept header\n\tlocalVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts)\n\tif localVarHTTPHeaderAccept != \"\" {\n\t\tlocalVarHeaderParams[\"Accept\"] = localVarHTTPHeaderAccept\n\t}\n\tif optionals != nil && optionals.XContractNumber != nil {\n\t\tlocalVarHeaderParams[\"X-Contract-Number\"] = parameterToString(*optionals.XContractNumber, \"\")\n\t}\n\t// body params\n\tlocalVarPostBody = &label\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\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\tlocalVarAPIResponse := &APIResponse {\n\t\tResponse: localVarHTTPResponse,\n\t\tMethod: localVarHTTPMethod,\n\t\tRequestURL: localVarPath,\n\t\tOperation: \"DatacentersVolumesLabelsPut\",\n\t}\n\tif err != nil || localVarHTTPResponse == nil {\n\t\treturn localVarReturnValue, localVarAPIResponse, err\n\t}\n\n\tlocalVarBody, err := _ioutil.ReadAll(localVarHTTPResponse.Body)\n\tlocalVarHTTPResponse.Body.Close()\n\tlocalVarAPIResponse.Payload = localVarBody\n\tif err != nil {\n\t\treturn localVarReturnValue, localVarAPIResponse, err\n\t}\n\n\tif localVarHTTPResponse.StatusCode >= 300 {\n\t\tnewErr := GenericOpenAPIError{\n\t\t\tbody: localVarBody,\n\t\t\terror: localVarHTTPResponse.Status,\n\t\t}\n\t\t\tvar v Error\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, localVarAPIResponse, newErr\n\t\t\t}\n\t\t\tnewErr.model = v\n\t\treturn localVarReturnValue, localVarAPIResponse, 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, localVarAPIResponse, newErr\n\t}\n\n\treturn localVarReturnValue, localVarAPIResponse, nil\n}", "title": "" }, { "docid": "89d10c62bb3a86a035bc5f3320e8b045", "score": "0.46614692", "text": "func (o PatchInstanceFilterGroupLabelOutput) Labels() pulumi.StringMapOutput {\n\treturn o.ApplyT(func(v PatchInstanceFilterGroupLabel) map[string]string { return v.Labels }).(pulumi.StringMapOutput)\n}", "title": "" }, { "docid": "89d10c62bb3a86a035bc5f3320e8b045", "score": "0.46614692", "text": "func (o PatchInstanceFilterGroupLabelOutput) Labels() pulumi.StringMapOutput {\n\treturn o.ApplyT(func(v PatchInstanceFilterGroupLabel) map[string]string { return v.Labels }).(pulumi.StringMapOutput)\n}", "title": "" } ]
fa385eb56e10216bc9f06dfe63bd12d8
TestOpenDeletedOrRenamedFileFails ensures that opening a deleted/renamed verity enabled file or the corresponding Merkle tree file fails with the verify error.
[ { "docid": "4657fb4ec75209eaa1639d029dc9a943", "score": "0.82514286", "text": "func TestOpenDeletedFileFails(t *testing.T) {\n\ttestCases := []struct {\n\t\t// Tests removing files is remove is true. Otherwise tests\n\t\t// renaming files.\n\t\tremove bool\n\t\t// The original file is removed/renamed if changeFile is true.\n\t\tchangeFile bool\n\t\t// The Merkle tree file is removed/renamed if changeMerkleFile\n\t\t// is true.\n\t\tchangeMerkleFile bool\n\t}{\n\t\t{\n\t\t\tremove: true,\n\t\t\tchangeFile: true,\n\t\t\tchangeMerkleFile: false,\n\t\t},\n\t\t{\n\t\t\tremove: true,\n\t\t\tchangeFile: false,\n\t\t\tchangeMerkleFile: true,\n\t\t},\n\t\t{\n\t\t\tremove: false,\n\t\t\tchangeFile: true,\n\t\t\tchangeMerkleFile: false,\n\t\t},\n\t\t{\n\t\t\tremove: false,\n\t\t\tchangeFile: true,\n\t\t\tchangeMerkleFile: false,\n\t\t},\n\t}\n\tfor _, tc := range testCases {\n\t\tt.Run(fmt.Sprintf(\"remove:%t\", tc.remove), func(t *testing.T) {\n\t\t\tfor _, alg := range hashAlgs {\n\t\t\t\tvfsObj, root, ctx, err := newVerityRoot(t, alg)\n\t\t\t\tif err != nil {\n\t\t\t\t\tt.Fatalf(\"newVerityRoot: %v\", err)\n\t\t\t\t}\n\n\t\t\t\tfilename := \"verity-test-file\"\n\t\t\t\tfd, _, err := newFileFD(ctx, vfsObj, root, filename, 0644)\n\t\t\t\tif err != nil {\n\t\t\t\t\tt.Fatalf(\"newFileFD: %v\", err)\n\t\t\t\t}\n\n\t\t\t\t// Enable verity on the file.\n\t\t\t\tvar args arch.SyscallArguments\n\t\t\t\targs[1] = arch.SyscallArgument{Value: linux.FS_IOC_ENABLE_VERITY}\n\t\t\t\tif _, err := fd.Ioctl(ctx, nil /* uio */, args); err != nil {\n\t\t\t\t\tt.Fatalf(\"Ioctl: %v\", err)\n\t\t\t\t}\n\n\t\t\t\trootLowerVD := root.Dentry().Impl().(*dentry).lowerVD\n\t\t\t\tif tc.remove {\n\t\t\t\t\tif tc.changeFile {\n\t\t\t\t\t\tif err := vfsObj.UnlinkAt(ctx, auth.CredentialsFromContext(ctx), &vfs.PathOperation{\n\t\t\t\t\t\t\tRoot: rootLowerVD,\n\t\t\t\t\t\t\tStart: rootLowerVD,\n\t\t\t\t\t\t\tPath: fspath.Parse(filename),\n\t\t\t\t\t\t}); err != nil {\n\t\t\t\t\t\t\tt.Fatalf(\"UnlinkAt: %v\", err)\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\tif tc.changeMerkleFile {\n\t\t\t\t\t\tif err := vfsObj.UnlinkAt(ctx, auth.CredentialsFromContext(ctx), &vfs.PathOperation{\n\t\t\t\t\t\t\tRoot: rootLowerVD,\n\t\t\t\t\t\t\tStart: rootLowerVD,\n\t\t\t\t\t\t\tPath: fspath.Parse(merklePrefix + filename),\n\t\t\t\t\t\t}); err != nil {\n\t\t\t\t\t\t\tt.Fatalf(\"UnlinkAt: %v\", err)\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t} else {\n\t\t\t\t\tnewFilename := \"renamed-test-file\"\n\t\t\t\t\tif tc.changeFile {\n\t\t\t\t\t\tif err := vfsObj.RenameAt(ctx, auth.CredentialsFromContext(ctx), &vfs.PathOperation{\n\t\t\t\t\t\t\tRoot: rootLowerVD,\n\t\t\t\t\t\t\tStart: rootLowerVD,\n\t\t\t\t\t\t\tPath: fspath.Parse(filename),\n\t\t\t\t\t\t}, &vfs.PathOperation{\n\t\t\t\t\t\t\tRoot: rootLowerVD,\n\t\t\t\t\t\t\tStart: rootLowerVD,\n\t\t\t\t\t\t\tPath: fspath.Parse(newFilename),\n\t\t\t\t\t\t}, &vfs.RenameOptions{}); err != nil {\n\t\t\t\t\t\t\tt.Fatalf(\"RenameAt: %v\", err)\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\tif tc.changeMerkleFile {\n\t\t\t\t\t\tif err := vfsObj.RenameAt(ctx, auth.CredentialsFromContext(ctx), &vfs.PathOperation{\n\t\t\t\t\t\t\tRoot: rootLowerVD,\n\t\t\t\t\t\t\tStart: rootLowerVD,\n\t\t\t\t\t\t\tPath: fspath.Parse(merklePrefix + filename),\n\t\t\t\t\t\t}, &vfs.PathOperation{\n\t\t\t\t\t\t\tRoot: rootLowerVD,\n\t\t\t\t\t\t\tStart: rootLowerVD,\n\t\t\t\t\t\t\tPath: fspath.Parse(merklePrefix + newFilename),\n\t\t\t\t\t\t}, &vfs.RenameOptions{}); err != nil {\n\t\t\t\t\t\t\tt.Fatalf(\"UnlinkAt: %v\", err)\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\t// Ensure reopening the verity enabled file fails.\n\t\t\t\tif _, err = vfsObj.OpenAt(ctx, auth.CredentialsFromContext(ctx), &vfs.PathOperation{\n\t\t\t\t\tRoot: root,\n\t\t\t\t\tStart: root,\n\t\t\t\t\tPath: fspath.Parse(filename),\n\t\t\t\t}, &vfs.OpenOptions{\n\t\t\t\t\tFlags: linux.O_RDONLY,\n\t\t\t\t\tMode: linux.ModeRegular,\n\t\t\t\t}); err != syserror.EIO {\n\t\t\t\t\tt.Errorf(\"got OpenAt error: %v, expected EIO\", err)\n\t\t\t\t}\n\t\t\t}\n\t\t})\n\t}\n}", "title": "" } ]
[ { "docid": "d452dbc3138c457067a71472b57c7a3a", "score": "0.6645445", "text": "func TestWriteOpenFileFail(t *testing.T) {\n\t_, done := writeSetup(t)\n\tdefer done()\n\n\tmockData := []byte(\"\")\n\tmockTaskARN := validTaskARN\n\tmockContainerName := containerName\n\tmockDataDir := dataDir\n\tmockOpenErr := errors.New(\"does exist\")\n\n\ttempOpenFile := openFile\n\topenFile = func(name string, flag int, perm os.FileMode) (oswrapper.File, error) {\n\t\treturn nil, mockOpenErr\n\t}\n\tdefer func() {\n\t\topenFile = tempOpenFile\n\t}()\n\n\terr := writeToMetadataFile(mockData, mockTaskARN, mockContainerName, mockDataDir)\n\n\texpectErrorMessage := \"does exist\"\n\n\tassert.Error(t, err)\n\tassert.Equal(t, expectErrorMessage, err.Error())\n}", "title": "" }, { "docid": "bcc0a737043314a247db806cacd63488", "score": "0.65345865", "text": "func TestOpen_ErrNotExists(t *testing.T) {\n\t_, err := bolt.Open(filepath.Join(tempfile(), \"bad-path\"), 0600, nil)\n\tif err == nil {\n\t\tt.Fatal(\"expected error\")\n\t}\n}", "title": "" }, { "docid": "0fdbecd5dadd48877f9f204a29468d7d", "score": "0.64730173", "text": "func TestOpen(t *testing.T) {\n\tfor _, alg := range hashAlgs {\n\t\tvfsObj, root, ctx, err := newVerityRoot(t, alg)\n\t\tif err != nil {\n\t\t\tt.Fatalf(\"newVerityRoot: %v\", err)\n\t\t}\n\n\t\tfilename := \"verity-test-file\"\n\t\tif _, _, err := newFileFD(ctx, vfsObj, root, filename, 0644); err != nil {\n\t\t\tt.Fatalf(\"newFileFD: %v\", err)\n\t\t}\n\n\t\t// Ensure that the corresponding Merkle tree file is created.\n\t\tlowerRoot := root.Dentry().Impl().(*dentry).lowerVD\n\t\tif _, err = vfsObj.OpenAt(ctx, auth.CredentialsFromContext(ctx), &vfs.PathOperation{\n\t\t\tRoot: lowerRoot,\n\t\t\tStart: lowerRoot,\n\t\t\tPath: fspath.Parse(merklePrefix + filename),\n\t\t}, &vfs.OpenOptions{\n\t\t\tFlags: linux.O_RDONLY,\n\t\t}); err != nil {\n\t\t\tt.Errorf(\"OpenAt Merkle tree file %s: %v\", merklePrefix+filename, err)\n\t\t}\n\n\t\t// Ensure the root merkle tree file is created.\n\t\tif _, err = vfsObj.OpenAt(ctx, auth.CredentialsFromContext(ctx), &vfs.PathOperation{\n\t\t\tRoot: lowerRoot,\n\t\t\tStart: lowerRoot,\n\t\t\tPath: fspath.Parse(merklePrefix + rootMerkleFilename),\n\t\t}, &vfs.OpenOptions{\n\t\t\tFlags: linux.O_RDONLY,\n\t\t}); err != nil {\n\t\t\tt.Errorf(\"OpenAt root Merkle tree file %s: %v\", merklePrefix+rootMerkleFilename, err)\n\t\t}\n\t}\n}", "title": "" }, { "docid": "68c06ab18a5151789ab7cb8bf49bc3e8", "score": "0.64486444", "text": "func TestReopenUnmodifiedFileSucceeds(t *testing.T) {\n\tfor _, alg := range hashAlgs {\n\t\tvfsObj, root, ctx, err := newVerityRoot(t, alg)\n\t\tif err != nil {\n\t\t\tt.Fatalf(\"newVerityRoot: %v\", err)\n\t\t}\n\n\t\tfilename := \"verity-test-file\"\n\t\tfd, _, err := newFileFD(ctx, vfsObj, root, filename, 0644)\n\t\tif err != nil {\n\t\t\tt.Fatalf(\"newFileFD: %v\", err)\n\t\t}\n\n\t\t// Enable verity on the file and confirms a normal read succeeds.\n\t\tvar args arch.SyscallArguments\n\t\targs[1] = arch.SyscallArgument{Value: linux.FS_IOC_ENABLE_VERITY}\n\t\tif _, err := fd.Ioctl(ctx, nil /* uio */, args); err != nil {\n\t\t\tt.Fatalf(\"Ioctl: %v\", err)\n\t\t}\n\n\t\t// Ensure reopening the verity enabled file succeeds.\n\t\tif _, err = vfsObj.OpenAt(ctx, auth.CredentialsFromContext(ctx), &vfs.PathOperation{\n\t\t\tRoot: root,\n\t\t\tStart: root,\n\t\t\tPath: fspath.Parse(filename),\n\t\t}, &vfs.OpenOptions{\n\t\t\tFlags: linux.O_RDONLY,\n\t\t\tMode: linux.ModeRegular,\n\t\t}); err != nil {\n\t\t\tt.Errorf(\"reopen enabled file failed: %v\", err)\n\t\t}\n\t}\n}", "title": "" }, { "docid": "663b8ff12b19dafb44fef15ba8478cc4", "score": "0.6367926", "text": "func TestModifiedMerkleFails(t *testing.T) {\n\tfor _, alg := range hashAlgs {\n\t\tvfsObj, root, ctx, err := newVerityRoot(t, alg)\n\t\tif err != nil {\n\t\t\tt.Fatalf(\"newVerityRoot: %v\", err)\n\t\t}\n\n\t\tfilename := \"verity-test-file\"\n\t\tfd, size, err := newFileFD(ctx, vfsObj, root, filename, 0644)\n\t\tif err != nil {\n\t\t\tt.Fatalf(\"newFileFD: %v\", err)\n\t\t}\n\n\t\t// Enable verity on the file.\n\t\tvar args arch.SyscallArguments\n\t\targs[1] = arch.SyscallArgument{Value: linux.FS_IOC_ENABLE_VERITY}\n\t\tif _, err := fd.Ioctl(ctx, nil /* uio */, args); err != nil {\n\t\t\tt.Fatalf(\"Ioctl: %v\", err)\n\t\t}\n\n\t\t// Open a new lowerMerkleFD that's read/writable.\n\t\tlowerMerkleVD := fd.Impl().(*fileDescription).d.lowerMerkleVD\n\n\t\tlowerMerkleFD, err := vfsObj.OpenAt(ctx, auth.CredentialsFromContext(ctx), &vfs.PathOperation{\n\t\t\tRoot: lowerMerkleVD,\n\t\t\tStart: lowerMerkleVD,\n\t\t}, &vfs.OpenOptions{\n\t\t\tFlags: linux.O_RDWR,\n\t\t})\n\t\tif err != nil {\n\t\t\tt.Fatalf(\"OpenAt: %v\", err)\n\t\t}\n\n\t\t// Flip a random bit in the Merkle tree file.\n\t\tstat, err := lowerMerkleFD.Stat(ctx, vfs.StatOptions{})\n\t\tif err != nil {\n\t\t\tt.Fatalf(\"stat: %v\", err)\n\t\t}\n\t\tmerkleSize := int(stat.Size)\n\t\tif err := corruptRandomBit(ctx, lowerMerkleFD, merkleSize); err != nil {\n\t\t\tt.Fatalf(\"corruptRandomBit: %v\", err)\n\t\t}\n\n\t\t// Confirm that read from a file with modified Merkle tree fails.\n\t\tbuf := make([]byte, size)\n\t\tif _, err := fd.PRead(ctx, usermem.BytesIOSequence(buf), 0 /* offset */, vfs.ReadOptions{}); err == nil {\n\t\t\tfmt.Println(buf)\n\t\t\tt.Fatalf(\"fd.PRead succeeded with modified Merkle file\")\n\t\t}\n\t}\n}", "title": "" }, { "docid": "d4074c7d2942de1180d00436a9ad935d", "score": "0.6364744", "text": "func TestSeriesFile_Open_WhenFileCorrupt_ShouldReturnErr(t *testing.T) {\n\tf := NewBrokenSeriesFile([]byte{0, 0, 0, 0, 0})\n\tdefer f.Close()\n\tf.Logger = logger.New(os.Stdout)\n\n\terr := f.Open(context.Background())\n\tif err == nil {\n\t\tt.Fatalf(\"should report error\")\n\t}\n}", "title": "" }, { "docid": "8ab727f5533a7a611f07d88acbce964c", "score": "0.63604355", "text": "func TestOpenNotExistsFile(t *testing.T) {\n\tassertions := assert.New(t)\n\t_, err := OpenImageFile(\"not exists\")\n\tassertions.True(err != nil)\n}", "title": "" }, { "docid": "6d4b40e6429ba16e6f493f9396848d4f", "score": "0.6317933", "text": "func TestReadModifiedFileFails(t *testing.T) {\n\tfor _, alg := range hashAlgs {\n\t\tvfsObj, root, ctx, err := newVerityRoot(t, alg)\n\t\tif err != nil {\n\t\t\tt.Fatalf(\"newVerityRoot: %v\", err)\n\t\t}\n\n\t\tfilename := \"verity-test-file\"\n\t\tfd, size, err := newFileFD(ctx, vfsObj, root, filename, 0644)\n\t\tif err != nil {\n\t\t\tt.Fatalf(\"newFileFD: %v\", err)\n\t\t}\n\n\t\t// Enable verity on the file.\n\t\tvar args arch.SyscallArguments\n\t\targs[1] = arch.SyscallArgument{Value: linux.FS_IOC_ENABLE_VERITY}\n\t\tif _, err := fd.Ioctl(ctx, nil /* uio */, args); err != nil {\n\t\t\tt.Fatalf(\"Ioctl: %v\", err)\n\t\t}\n\n\t\t// Open a new lowerFD that's read/writable.\n\t\tlowerVD := fd.Impl().(*fileDescription).d.lowerVD\n\n\t\tlowerFD, err := vfsObj.OpenAt(ctx, auth.CredentialsFromContext(ctx), &vfs.PathOperation{\n\t\t\tRoot: lowerVD,\n\t\t\tStart: lowerVD,\n\t\t}, &vfs.OpenOptions{\n\t\t\tFlags: linux.O_RDWR,\n\t\t})\n\t\tif err != nil {\n\t\t\tt.Fatalf(\"OpenAt: %v\", err)\n\t\t}\n\n\t\tif err := corruptRandomBit(ctx, lowerFD, size); err != nil {\n\t\t\tt.Fatalf(\"corruptRandomBit: %v\", err)\n\t\t}\n\n\t\t// Confirm that read from the modified file fails.\n\t\tbuf := make([]byte, size)\n\t\tif _, err := fd.Read(ctx, usermem.BytesIOSequence(buf), vfs.ReadOptions{}); err == nil {\n\t\t\tt.Fatalf(\"fd.Read succeeded, expected failure\")\n\t\t}\n\t}\n}", "title": "" }, { "docid": "229c9b313a0b5cca7913e2ddb7c7d3a6", "score": "0.62648106", "text": "func TestOpen_ErrInvalid(t *testing.T) {\n\tpath := tempfile()\n\tdefer os.RemoveAll(path)\n\n\tf, err := os.Create(path)\n\tif err != nil {\n\t\tt.Fatal(err)\n\t}\n\tif _, err := fmt.Fprintln(f, \"this is not a bolt database\"); err != nil {\n\t\tt.Fatal(err)\n\t}\n\tif err := f.Close(); err != nil {\n\t\tt.Fatal(err)\n\t}\n\n\tif _, err := bolt.Open(path, 0600, nil); err != berrors.ErrInvalid {\n\t\tt.Fatalf(\"unexpected error: %s\", err)\n\t}\n}", "title": "" }, { "docid": "de05f61c8ed296e52763d724e07bf670", "score": "0.6245323", "text": "func TestOpenFile(t *testing.T) {\n expected := \"test123\"\n\n for _, v := range files {\n file, err := OpenFile(v)\n if err != nil {\n t.Fatalf(\"OpenFile %v failed: %v\", v, err)\n }\n defer file.Close()\n\n buffer := make([]byte, 25)\n count, err := file.Read(buffer)\n if err != nil {\n t.Fatalf(\"OpenFile %v failed: %v\", v, err)\n }\n\n txt := string(buffer)\n for i := range expected {\n if expected[i] != txt[i] {\n t.Fatalf(\n \"OpenFile %v failed: Expected: %v, Observed: %v\",\n v,\n expected,\n txt,\n ) \n }\n }\n\n if len(expected) != count {\n t.Fatalf(\n \"OpenFile %v count wrong. Expected: %v, Observed: %v\",\n v,\n len(expected),\n count,\n )\n }\n \n log.Printf(\"OpenFile %v: passed\", v)\n }\n\n for _, v := range badFiles {\n file, err := OpenFile(v)\n if err == nil {\n file.Close()\n t.Fatalf(\"OpenFile (badFile) %v failed\", v)\n }\n \n log.Printf(\"OpenFile (badFile) %v: passed\", v)\n }\n}", "title": "" }, { "docid": "aa1574d99faff291ed82891cde84a67e", "score": "0.613637", "text": "func TestOpenFile(t *testing.T) {\n\tvar xlsxFile *File\n\tvar error error\n\txlsxFile, error = OpenFile(\"testfile.xlsx\")\n\tif error != nil {\n\t\tt.Error(error.Error())\n\t\treturn\n\t}\n\tif xlsxFile == nil {\n\t\tt.Error(\"OpenFile returned nil FileInterface without generating an os.Error\")\n\t\treturn\n\t}\n\n}", "title": "" }, { "docid": "0ab32827702befa652e89b4de8907ad1", "score": "0.61249197", "text": "func TestClientFailOpen(t *testing.T) {\n\tc := New(\"testdata\")\n\n\tfilePath := path.Join(\"testdata\", \"foobad.json\")\n\n\t// Write a bad file.\n\terr := ioutil.WriteFile(filePath, []byte(\"{\"), 0644)\n\tif err != nil {\n\t\tt.Error(err)\n\t}\n\n\t// Check the output.\n\tassert.NotNil(t, c.read(\"foobad\"))\n\n\t// Cleanup\n\terr = os.Remove(filePath)\n\tif err != nil {\n\t\tt.Error(err)\n\t}\n}", "title": "" }, { "docid": "173fb0fcfd7ce3d469d1ca8a2e762e8d", "score": "0.59498113", "text": "func TestPReadModifiedFileFails(t *testing.T) {\n\tfor _, alg := range hashAlgs {\n\t\tvfsObj, root, ctx, err := newVerityRoot(t, alg)\n\t\tif err != nil {\n\t\t\tt.Fatalf(\"newVerityRoot: %v\", err)\n\t\t}\n\n\t\tfilename := \"verity-test-file\"\n\t\tfd, size, err := newFileFD(ctx, vfsObj, root, filename, 0644)\n\t\tif err != nil {\n\t\t\tt.Fatalf(\"newFileFD: %v\", err)\n\t\t}\n\n\t\t// Enable verity on the file.\n\t\tvar args arch.SyscallArguments\n\t\targs[1] = arch.SyscallArgument{Value: linux.FS_IOC_ENABLE_VERITY}\n\t\tif _, err := fd.Ioctl(ctx, nil /* uio */, args); err != nil {\n\t\t\tt.Fatalf(\"Ioctl: %v\", err)\n\t\t}\n\n\t\t// Open a new lowerFD that's read/writable.\n\t\tlowerVD := fd.Impl().(*fileDescription).d.lowerVD\n\n\t\tlowerFD, err := vfsObj.OpenAt(ctx, auth.CredentialsFromContext(ctx), &vfs.PathOperation{\n\t\t\tRoot: lowerVD,\n\t\t\tStart: lowerVD,\n\t\t}, &vfs.OpenOptions{\n\t\t\tFlags: linux.O_RDWR,\n\t\t})\n\t\tif err != nil {\n\t\t\tt.Fatalf(\"OpenAt: %v\", err)\n\t\t}\n\n\t\tif err := corruptRandomBit(ctx, lowerFD, size); err != nil {\n\t\t\tt.Fatalf(\"corruptRandomBit: %v\", err)\n\t\t}\n\n\t\t// Confirm that read from the modified file fails.\n\t\tbuf := make([]byte, size)\n\t\tif _, err := fd.PRead(ctx, usermem.BytesIOSequence(buf), 0 /* offset */, vfs.ReadOptions{}); err == nil {\n\t\t\tt.Fatalf(\"fd.PRead succeeded, expected failure\")\n\t\t}\n\t}\n}", "title": "" }, { "docid": "4e4777b382a7c12b3e5634a51e715b5b", "score": "0.5936015", "text": "func TestModifiedParentMerkleFails(t *testing.T) {\n\tfor _, alg := range hashAlgs {\n\t\tvfsObj, root, ctx, err := newVerityRoot(t, alg)\n\t\tif err != nil {\n\t\t\tt.Fatalf(\"newVerityRoot: %v\", err)\n\t\t}\n\n\t\tfilename := \"verity-test-file\"\n\t\tfd, _, err := newFileFD(ctx, vfsObj, root, filename, 0644)\n\t\tif err != nil {\n\t\t\tt.Fatalf(\"newFileFD: %v\", err)\n\t\t}\n\n\t\t// Enable verity on the file.\n\t\tvar args arch.SyscallArguments\n\t\targs[1] = arch.SyscallArgument{Value: linux.FS_IOC_ENABLE_VERITY}\n\t\tif _, err := fd.Ioctl(ctx, nil /* uio */, args); err != nil {\n\t\t\tt.Fatalf(\"Ioctl: %v\", err)\n\t\t}\n\n\t\t// Enable verity on the parent directory.\n\t\tparentFD, err := vfsObj.OpenAt(ctx, auth.CredentialsFromContext(ctx), &vfs.PathOperation{\n\t\t\tRoot: root,\n\t\t\tStart: root,\n\t\t}, &vfs.OpenOptions{\n\t\t\tFlags: linux.O_RDONLY,\n\t\t})\n\t\tif err != nil {\n\t\t\tt.Fatalf(\"OpenAt: %v\", err)\n\t\t}\n\n\t\tif _, err := parentFD.Ioctl(ctx, nil /* uio */, args); err != nil {\n\t\t\tt.Fatalf(\"Ioctl: %v\", err)\n\t\t}\n\n\t\t// Open a new lowerMerkleFD that's read/writable.\n\t\tparentLowerMerkleVD := fd.Impl().(*fileDescription).d.parent.lowerMerkleVD\n\n\t\tparentLowerMerkleFD, err := vfsObj.OpenAt(ctx, auth.CredentialsFromContext(ctx), &vfs.PathOperation{\n\t\t\tRoot: parentLowerMerkleVD,\n\t\t\tStart: parentLowerMerkleVD,\n\t\t}, &vfs.OpenOptions{\n\t\t\tFlags: linux.O_RDWR,\n\t\t})\n\t\tif err != nil {\n\t\t\tt.Fatalf(\"OpenAt: %v\", err)\n\t\t}\n\n\t\t// Flip a random bit in the parent Merkle tree file.\n\t\t// This parent directory contains only one child, so any random\n\t\t// modification in the parent Merkle tree should cause verification\n\t\t// failure when opening the child file.\n\t\tstat, err := parentLowerMerkleFD.Stat(ctx, vfs.StatOptions{})\n\t\tif err != nil {\n\t\t\tt.Fatalf(\"stat: %v\", err)\n\t\t}\n\t\tparentMerkleSize := int(stat.Size)\n\t\tif err := corruptRandomBit(ctx, parentLowerMerkleFD, parentMerkleSize); err != nil {\n\t\t\tt.Fatalf(\"corruptRandomBit: %v\", err)\n\t\t}\n\n\t\tparentLowerMerkleFD.DecRef(ctx)\n\n\t\t// Ensure reopening the verity enabled file fails.\n\t\tif _, err = vfsObj.OpenAt(ctx, auth.CredentialsFromContext(ctx), &vfs.PathOperation{\n\t\t\tRoot: root,\n\t\t\tStart: root,\n\t\t\tPath: fspath.Parse(filename),\n\t\t}, &vfs.OpenOptions{\n\t\t\tFlags: linux.O_RDONLY,\n\t\t\tMode: linux.ModeRegular,\n\t\t}); err == nil {\n\t\t\tt.Errorf(\"OpenAt file with modified parent Merkle succeeded\")\n\t\t}\n\t}\n}", "title": "" }, { "docid": "64db3b25cd2593dbc651bfa728a62fe6", "score": "0.58707523", "text": "func AssertReadOnlyDeleteFails(gcsCLIPath string, ctx AssertContext) {\n\tExpect(ctx.Config.CredentialsSource).ToNot(Equal(config.NoneCredentialsSource),\n\t\t\"Cannot use 'none' credentials to setup\")\n\n\troctx := ctx.Clone(AsReadOnlyCredentials)\n\tdefer roctx.Cleanup()\n\n\tsession, err := RunGCSCLI(gcsCLIPath, roctx.ConfigPath,\n\t\t\"delete\", roctx.GCSFileName)\n\tExpect(err).ToNot(HaveOccurred())\n\tExpect(session.ExitCode()).ToNot(BeZero())\n\tExpect(session.Err.Contents()).To(ContainSubstring(client.ErrInvalidROWriteOperation.Error()))\n}", "title": "" }, { "docid": "14f141013221690accab25ed45ac47f6", "score": "0.58461547", "text": "func TestModifiedStatFails(t *testing.T) {\n\tfor _, alg := range hashAlgs {\n\t\tvfsObj, root, ctx, err := newVerityRoot(t, alg)\n\t\tif err != nil {\n\t\t\tt.Fatalf(\"newVerityRoot: %v\", err)\n\t\t}\n\n\t\tfilename := \"verity-test-file\"\n\t\tfd, _, err := newFileFD(ctx, vfsObj, root, filename, 0644)\n\t\tif err != nil {\n\t\t\tt.Fatalf(\"newFileFD: %v\", err)\n\t\t}\n\n\t\t// Enable verity on the file.\n\t\tvar args arch.SyscallArguments\n\t\targs[1] = arch.SyscallArgument{Value: linux.FS_IOC_ENABLE_VERITY}\n\t\tif _, err := fd.Ioctl(ctx, nil /* uio */, args); err != nil {\n\t\t\tt.Fatalf(\"fd.Ioctl: %v\", err)\n\t\t}\n\n\t\tlowerFD := fd.Impl().(*fileDescription).lowerFD\n\t\t// Change the stat of the underlying file, and check that stat fails.\n\t\tif err := lowerFD.SetStat(ctx, vfs.SetStatOptions{\n\t\t\tStat: linux.Statx{\n\t\t\t\tMask: uint32(linux.STATX_MODE),\n\t\t\t\tMode: 0777,\n\t\t\t},\n\t\t}); err != nil {\n\t\t\tt.Fatalf(\"lowerFD.SetStat: %v\", err)\n\t\t}\n\n\t\tif _, err := fd.Stat(ctx, vfs.StatOptions{}); err == nil {\n\t\t\tt.Errorf(\"fd.Stat succeeded when it should fail\")\n\t\t}\n\t}\n}", "title": "" }, { "docid": "94138a4e26afd215da4875d49ce38ab9", "score": "0.58302873", "text": "func (suite *streamTestSuite) TestCacheOnOpenFileError() {\n\tdefer suite.cleanupTest()\n\tsuite.cleanupTest()\n\tconfig := \"stream:\\n block-size-mb: 4\\n buffer-size-mb: 16\\n max-buffers: 3\\n\"\n\tsuite.setupTestHelper(config, true)\n\thandle := &handlemap.Handle{Size: int64(100 * MB), Path: fileNames[0]}\n\n\topenFileOptions, _, _ := suite.getRequestOptions(0, handle, false, int64(100*MB), 0, 0)\n\tsuite.mock.EXPECT().OpenFile(openFileOptions).Return(handle, syscall.ENOENT)\n\t_, err := suite.stream.OpenFile(openFileOptions)\n\n\tsuite.assert.Equal(err, syscall.ENOENT)\n}", "title": "" }, { "docid": "bae7224281076dbe29b0f97048393446", "score": "0.58276594", "text": "func AssertDeleteNonexistentWorks(s3CLIPath string, cfg *config.S3Cli) {\n\tconfigPath := MakeConfigFile(cfg)\n\tdefer func() { _ = os.Remove(configPath) }()\n\n\ts3CLISession, err := RunS3CLI(s3CLIPath, configPath, \"delete\", \"non-existent-file\")\n\tgomega.Expect(err).ToNot(gomega.HaveOccurred())\n\tgomega.Expect(s3CLISession.ExitCode()).To(gomega.BeZero())\n}", "title": "" }, { "docid": "9d733e25ecdb539806f7891a506a4051", "score": "0.5778169", "text": "func (m *MockVolumePublishManager) DeleteFailedUpgradeTrackingFile(arg0 context.Context, arg1 fs.FileInfo) {\n\tm.ctrl.T.Helper()\n\tm.ctrl.Call(m, \"DeleteFailedUpgradeTrackingFile\", arg0, arg1)\n}", "title": "" }, { "docid": "0d989ae5779d462a13981c14f266d650", "score": "0.5756514", "text": "func TestFileWriteErr(t *testing.T) {\n\ttestFileWriteErr(t)\n}", "title": "" }, { "docid": "455dd61b2d00b3b062d1ab8325d532b1", "score": "0.57451403", "text": "func (m *MockNodeHelper) DeleteFailedUpgradeTrackingFile(arg0 context.Context, arg1 fs.FileInfo) {\n\tm.ctrl.T.Helper()\n\tm.ctrl.Call(m, \"DeleteFailedUpgradeTrackingFile\", arg0, arg1)\n}", "title": "" }, { "docid": "0be21c5ef885ecc9a841d23ca64a8e50", "score": "0.5726472", "text": "func (l *FileSuite) TestOpenFile(c *C) {\n\tvar xlsxFile *File\n\tvar error error\n\n\txlsxFile, error = OpenFile(\"./testdocs/testfile.xlsx\")\n\tc.Assert(error, IsNil)\n\tc.Assert(xlsxFile, NotNil)\n}", "title": "" }, { "docid": "c46faefc4c484071f68d675c7dc0af28", "score": "0.5708245", "text": "func TestDelete(t *testing.T) {\n\tif testing.Short() {\n\t\tt.SkipNow()\n\t}\n\tt.Parallel()\n\n\t// Create SiaFileSet with SiaFile\n\tentry, _, _ := newTestSiaFileSetWithFile()\n\t// Delete file.\n\tif err := entry.Delete(); err != nil {\n\t\tt.Fatal(\"Failed to delete file\", err)\n\t}\n\t// Check if file was deleted and if deleted flag was set.\n\tif !entry.Deleted() {\n\t\tt.Fatal(\"Deleted flag was not set correctly\")\n\t}\n\tif _, err := os.Open(entry.siaFilePath); !os.IsNotExist(err) {\n\t\tt.Fatal(\"Expected a file doesn't exist error but got\", err)\n\t}\n}", "title": "" }, { "docid": "fc1b1acb496b25f72bc43203eabb7489", "score": "0.57071733", "text": "func TestOpen(t *testing.T) {\n\tpath := tempfile()\n\tdefer os.RemoveAll(path)\n\n\tklog.Infof(\"path %s\", path)\n\tdb, err := bolt.Open(path, 0666, nil)\n\tif err != nil {\n\t\tt.Fatal(err)\n\t} else if db == nil {\n\t\tt.Fatal(\"expected db\")\n\t}\n\n\tif s := db.Path(); s != path {\n\t\tt.Fatalf(\"unexpected path: %s\", s)\n\t}\n\n\tif err := db.Close(); err != nil {\n\t\tt.Fatal(err)\n\t}\n}", "title": "" }, { "docid": "82855f12a4de938c9e98e392cd1327fa", "score": "0.5706217", "text": "func TestZFSDiffFileDeleted(t *testing.T) {\n\tz, fsName, fsPath, cleanup := createPoolAndFilesystem(t)\n\tdefer cleanup()\n\n\tfilePath := filepath.Join(fsPath, \"myfile.txt\")\n\terr := ioutil.WriteFile(filePath, []byte(\"woo\"), 0644)\n\tif err != nil {\n\t\tt.Fatalf(\"Error creating file: %s\", err)\n\t}\n\n\toutput, err := z.Snapshot(fsName, \"myfirstsnapshot\", []string{})\n\tif err != nil {\n\t\tt.Fatalf(\"Error snapshotting: %s\\n%s\", err, output)\n\t}\n\terr = os.Remove(filePath)\n\tif err != nil {\n\t\tt.Fatalf(\"Error removing: %s\\n\", err)\n\t}\n\n\texpectChangesFromDiff(t, z, fsName, types.ZFSFileDiff{Change: types.FileChangeRemoved, Filename: \"myfile.txt\"})\n\tcheckDirtyDelta(t, z, fsName, \"myfirstsnapshot\", true, true)\n}", "title": "" }, { "docid": "c831c438c05ce5de0ca736f51c41027d", "score": "0.5672439", "text": "func TestReadUnmodifiedFileSucceeds(t *testing.T) {\n\tfor _, alg := range hashAlgs {\n\t\tvfsObj, root, ctx, err := newVerityRoot(t, alg)\n\t\tif err != nil {\n\t\t\tt.Fatalf(\"newVerityRoot: %v\", err)\n\t\t}\n\n\t\tfilename := \"verity-test-file\"\n\t\tfd, size, err := newFileFD(ctx, vfsObj, root, filename, 0644)\n\t\tif err != nil {\n\t\t\tt.Fatalf(\"newFileFD: %v\", err)\n\t\t}\n\n\t\t// Enable verity on the file and confirm a normal read succeeds.\n\t\tvar args arch.SyscallArguments\n\t\targs[1] = arch.SyscallArgument{Value: linux.FS_IOC_ENABLE_VERITY}\n\t\tif _, err := fd.Ioctl(ctx, nil /* uio */, args); err != nil {\n\t\t\tt.Fatalf(\"Ioctl: %v\", err)\n\t\t}\n\n\t\tbuf := make([]byte, size)\n\t\tn, err := fd.Read(ctx, usermem.BytesIOSequence(buf), vfs.ReadOptions{})\n\t\tif err != nil && err != io.EOF {\n\t\t\tt.Fatalf(\"fd.Read: %v\", err)\n\t\t}\n\n\t\tif n != int64(size) {\n\t\t\tt.Errorf(\"fd.PRead got read length %d, want %d\", n, size)\n\t\t}\n\t}\n}", "title": "" }, { "docid": "20715ef6e265a1e2d7c29d7ae05a17ea", "score": "0.56371444", "text": "func TestOpen_ErrPathRequired(t *testing.T) {\n\t_, err := bolt.Open(\"\", 0600, nil)\n\tif err == nil {\n\t\tt.Fatalf(\"expected error\")\n\t}\n}", "title": "" }, { "docid": "de421fe6c56377f9a97911718d670ac5", "score": "0.56182975", "text": "func TestStore_Open_InvalidDatabaseFile(t *testing.T) {\n\ts := NewStore()\n\tdefer s.Close()\n\n\t// Create a file instead of a directory for a database.\n\tif _, err := os.Create(filepath.Join(s.Path(), \"db0\")); err != nil {\n\t\tt.Fatal(err)\n\t}\n\n\t// Store should ignore database since it's a file.\n\tif err := s.Open(); err != nil {\n\t\tt.Fatal(err)\n\t} else if n := s.DatabaseIndexN(); n != 0 {\n\t\tt.Fatalf(\"unexpected database index count: %d\", n)\n\t}\n}", "title": "" }, { "docid": "bb76c938880f2e2927b3159c919b5f7c", "score": "0.56008875", "text": "func TestOpen_ErrVersionMismatch(t *testing.T) {\n\tif pageSize != os.Getpagesize() {\n\t\tt.Skip(\"page size mismatch\")\n\t}\n\n\t// Create empty database.\n\tdb := btesting.MustCreateDB(t)\n\tpath := db.Path()\n\n\t// Close database.\n\tif err := db.Close(); err != nil {\n\t\tt.Fatal(err)\n\t}\n\n\t// Read data file.\n\tbuf, err := os.ReadFile(path)\n\tif err != nil {\n\t\tt.Fatal(err)\n\t}\n\n\t// Rewrite meta pages.\n\tmeta0 := (*meta)(unsafe.Pointer(&buf[pageHeaderSize]))\n\tmeta0.version++\n\tmeta1 := (*meta)(unsafe.Pointer(&buf[pageSize+pageHeaderSize]))\n\tmeta1.version++\n\tif err := os.WriteFile(path, buf, 0666); err != nil {\n\t\tt.Fatal(err)\n\t}\n\n\t// Reopen data file.\n\tif _, err := bolt.Open(path, 0600, nil); err != berrors.ErrVersionMismatch {\n\t\tt.Fatalf(\"unexpected error: %s\", err)\n\t}\n}", "title": "" }, { "docid": "56c9a2ff83121ec8c45e74d24b864eee", "score": "0.5594679", "text": "func checkVerifyBrokenContentFail(filename string) check {\n\treturn func(t *testing.T, sgzData []byte, tocDigest digest.Digest, dgstMap map[string]digest.Digest, controller TestingController, newController TestingControllerFactory) {\n\t\t// Parse stargz file\n\t\tsgz, err := Open(\n\t\t\tio.NewSectionReader(bytes.NewReader(sgzData), 0, int64(len(sgzData))),\n\t\t\tWithDecompressors(controller),\n\t\t)\n\t\tif err != nil {\n\t\t\tt.Fatalf(\"failed to parse converted stargz: %v\", err)\n\t\t\treturn\n\t\t}\n\t\tev, err := sgz.VerifyTOC(tocDigest)\n\t\tif err != nil {\n\t\t\tt.Fatalf(\"failed to verify stargz: %v\", err)\n\t\t\treturn\n\t\t}\n\n\t\t// Open the target file\n\t\tsr, err := sgz.OpenFile(filename)\n\t\tif err != nil {\n\t\t\tt.Fatalf(\"failed to open file %q\", filename)\n\t\t}\n\t\tce, ok := sgz.ChunkEntryForOffset(filename, 0)\n\t\tif !ok {\n\t\t\tt.Fatalf(\"lost chunk %q(offset=%d) in the converted TOC\", filename, 0)\n\t\t\treturn\n\t\t}\n\t\tif ce.ChunkSize == 0 {\n\t\t\tt.Fatalf(\"file mustn't be empty\")\n\t\t\treturn\n\t\t}\n\t\tdata := make([]byte, ce.ChunkSize)\n\t\tif _, err := sr.ReadAt(data, ce.ChunkOffset); err != nil {\n\t\t\tt.Errorf(\"failed to get data of a chunk of %q(offset=%q)\",\n\t\t\t\tfilename, ce.ChunkOffset)\n\t\t}\n\n\t\t// Check the broken chunk (must fail)\n\t\tv, err := ev.Verifier(ce)\n\t\tif err != nil {\n\t\t\tt.Fatalf(\"failed to get verifier for %q\", filename)\n\t\t}\n\t\tbroken := append([]byte{^data[0]}, data[1:]...)\n\t\tif _, err := io.CopyN(v, bytes.NewReader(broken), ce.ChunkSize); err != nil {\n\t\t\tt.Fatalf(\"failed to get chunk of %q (offset=%d,size=%d)\",\n\t\t\t\tfilename, ce.ChunkOffset, ce.ChunkSize)\n\t\t}\n\t\tif v.Verified() {\n\t\t\tt.Errorf(\"verification must fail for broken file chunk %q(org:%q,broken:%q)\",\n\t\t\t\tfilename, data, broken)\n\t\t}\n\t}\n}", "title": "" }, { "docid": "de87489c3ef1745c4b8c4063610385da", "score": "0.55640996", "text": "func TestFileIntegrityAcceptsExpectedChange(t *testing.T) {\n\tf, testctx, namespace := setupTest(t)\n\ttestName := testIntegrityNamePrefix + \"-nodechange\"\n\tsetupFileIntegrity(t, f, testctx, testName, namespace)\n\tdefer testctx.Cleanup()\n\tdefer func() {\n\t\tif err := cleanNodes(f, namespace); err != nil {\n\t\t\tt.Fatal(err)\n\t\t}\n\t}()\n\tdefer logContainerOutput(t, f, namespace, testName)\n\n\t// wait to go active.\n\terr := waitForScanStatus(t, f, namespace, testName, fileintv1alpha1.PhaseActive)\n\tif err != nil {\n\t\tt.Errorf(\"Timeout waiting for scan status\")\n\t}\n\n\tt.Log(\"Asserting that the FileIntegrity check is in a SUCCESS state after deploying it\")\n\tassertNodesConditionIsSuccess(t, f, testName, namespace, 2*time.Second, 5*time.Minute)\n\n\t// Create MCFG\n\tmcfg := getTestMcfg(t)\n\tcleanupOptions := framework.CleanupOptions{\n\t\tTestContext: testctx,\n\t\tTimeout: cleanupTimeout,\n\t\tRetryInterval: cleanupRetryInterval,\n\t}\n\terr = f.Client.Create(context.TODO(), mcfg, &cleanupOptions)\n\tif err != nil {\n\t\tt.Errorf(\"Cannot create a test MC: %v\", err)\n\t}\n\n\t// Wait some time... The machineConfigs take some time to kick in.\n\ttime.Sleep(30 * time.Second)\n\n\t// Wait for nodes to be ready\n\tif err = waitForNodesToBeReady(f); err != nil {\n\t\tt.Errorf(\"Timeout waiting for nodes\")\n\t}\n\n\t// wait to go active.\n\terr = waitForScanStatus(t, f, namespace, testName, fileintv1alpha1.PhaseActive)\n\tif err != nil {\n\t\tt.Errorf(\"Timeout waiting for scan status\")\n\t}\n\n\tt.Log(\"Asserting that the FileIntegrity check is in a SUCCESS state after expected changes\")\n\tassertNodesConditionIsSuccess(t, f, testName, namespace, 5*time.Second, 5*time.Minute)\n}", "title": "" }, { "docid": "1313d75db73d0e6962e050d21b3c94e8", "score": "0.5551507", "text": "func TestOpen(test *testing.T) {\n\tfs, err := OpenFileSystemFile(\"../../../minix3root.img\")\n\tif err != nil {\n\t\tFatalHere(test, \"Failed opening file system: %s\", err)\n\t}\n\tproc, err := fs.Spawn(1, 022, \"/\")\n\tif err != nil {\n\t\tFatalHere(test, \"Failed when spawning new process: %s\", err)\n\t}\n\n\tfile, err := fs.Open(proc, \"/sample/europarl-en.txt\", O_RDONLY, 0666)\n\tif err != nil {\n\t\tFatalHere(test, \"Failed opening file: %s\", err)\n\t}\n\n\t// Verify open file count and presence of *File entry\n\tfound := false\n\tcount := 0\n\tfor _, fi := range proc.files {\n\t\tif fi == file {\n\t\t\tfound = true\n\t\t}\n\t\tif fi != nil {\n\t\t\tcount++\n\t\t}\n\t}\n\n\tif !found {\n\t\tFatalHere(test, \"Did not find open file in proc.files\")\n\t}\n\tif count != 1 {\n\t\tFatalHere(test, \"Open file count incorrect got %d, expected %d\", count, 1)\n\t}\n\n\tif file.count != 1 {\n\t\tFatalHere(test, \"Filp count wrong got %d, expected %d\", file.count, 1)\n\t}\n\n\t// Check to make sure there is a global filp entry\n\tfound = false\n\tcount = 0\n\tfor _, fi := range fs.filps {\n\t\tif fi == file.Filp {\n\t\t\tfound = true\n\t\t}\n\t\tif fi != nil {\n\t\t\tcount++\n\t\t}\n\t}\n\n\tif !found {\n\t\tFatalHere(test, \"Did not find global filp entry\")\n\t}\n\tif count != 1 {\n\t\tFatalHere(test, \"Global filp count wrong got %d, expected %d\", count, 1)\n\t}\n\n\tfs.Exit(proc)\n\terr = fs.Shutdown()\n\tif err != nil {\n\t\tFatalHere(test, \"Failed when shutting down filesystem: %s\", err)\n\t}\n}", "title": "" }, { "docid": "8fb2e19f2b14c1ad511d17f3dfe103cc", "score": "0.55481285", "text": "func TestFileSystem_SelectDxFileToFix(t *testing.T) {\n\ttests := []struct {\n\t\tnumFiles int\n\t}{\n\t\t{1},\n\t\t{10},\n\t\t{100},\n\t}\n\tif testing.Short() {\n\t\ttests = tests[:1]\n\t}\n\tfor i, test := range tests {\n\t\t// Create a random file system with random files, and random contractManager\n\t\tdr := newStandardDisrupter()\n\t\tct := &randomContractManager{\n\t\t\tmissRate: 0.1,\n\t\t\tonlineRate: 0.8,\n\t\t\tgoodForRenewRate: 0.8,\n\t\t}\n\t\tfs := newEmptyTestFileSystem(t, strconv.Itoa(i), ct, dr)\n\t\tck, err := crypto.GenerateCipherKey(crypto.GCMCipherCode)\n\t\tif err != nil {\n\t\t\tt.Fatal(err)\n\t\t}\n\t\tfileSize := uint64(1 << 22 * 10 * 10)\n\t\tvar minHealth = dxdir.DefaultHealth\n\t\tfor i := 0; i != test.numFiles; i++ {\n\t\t\tpath := randomDxPath(t, 5)\n\t\t\tfile, err := fs.fileSet.NewRandomDxFile(path, 10, 30, erasurecode.ECTypeStandard, ck, fileSize, 0)\n\t\t\tif err != nil {\n\t\t\t\tt.Fatal(err)\n\t\t\t}\n\t\t\ttable := fs.contractManager.HostHealthMapByID(file.HostIDs())\n\t\t\tif err = file.MarkAllUnhealthySegmentsAsStuck(table); err != nil {\n\t\t\t\tt.Fatal(err)\n\t\t\t}\n\t\t\tif err = file.MarkAllHealthySegmentsAsUnstuck(table); err != nil {\n\t\t\t\tt.Fatal(err)\n\t\t\t}\n\t\t\tdirPath, err := file.DxPath().Parent()\n\t\t\tif err != nil {\n\t\t\t\tt.Fatal(err)\n\t\t\t}\n\t\t\tif err := fs.InitAndUpdateDirMetadata(dirPath); err != nil {\n\t\t\t\tt.Fatal(err)\n\t\t\t}\n\t\t\tfHealth, _, _ := file.Health(table)\n\t\t\tif dxfile.CmpRepairPriority(fHealth, minHealth) >= 0 {\n\t\t\t\tminHealth = fHealth\n\t\t\t}\n\t\t}\n\t\tif err := fs.waitForUpdatesComplete(10 * time.Second); err != nil {\n\t\t\tt.Fatal(err)\n\t\t}\n\t\tf, err := fs.SelectDxFileToFix()\n\t\tif err == ErrNoRepairNeeded && dxfile.CmpRepairPriority(minHealth, dxdir.DefaultHealth) <= 0 {\n\t\t\t// no repair needed\n\t\t\tcontinue\n\t\t} else if err == nil {\n\t\t\tif f.GetHealth() != minHealth {\n\t\t\t\tt.Errorf(\"SelectDxFileToFix got file not with expected health. Got %v, Expect %v\", f.GetHealth(), minHealth)\n\t\t\t}\n\t\t} else if err == errStopped {\n\t\t\t// No logging for stopped\n\t\t} else {\n\t\t\tt.Fatalf(\"SelectDxFileToFix return unexpected error: %v\", err)\n\t\t}\n\t}\n}", "title": "" }, { "docid": "c61659309d2df5252f65f4eb668c188a", "score": "0.5528383", "text": "func TestLoadJSONCorruptedFiles(t *testing.T) {\n\tif testing.Short() {\n\t\tt.SkipNow()\n\t}\n\t// Define the test object that will be getting loaded.\n\ttestMeta := Metadata{\"Test Struct\", \"v1.2.1\"}\n\ttype testStruct struct {\n\t\tOne string\n\t\tTwo uint64\n\t\tThree []byte\n\t}\n\tobj1 := testStruct{\"dog\", 25, []byte(\"more dog\")}\n\tvar obj2 testStruct\n\n\t// Try loading a file with a bad checksum.\n\terr := LoadJSON(testMeta, &obj2, filepath.Join(\"testdata\", \"badchecksum.json\"))\n\tif err == nil {\n\t\tt.Error(\"bad checksum should have failed\")\n\t}\n\t// Try loading a file where only the main has a bad checksum.\n\terr = LoadJSON(testMeta, &obj2, filepath.Join(\"testdata\", \"badchecksummain.json\"))\n\tif err != nil {\n\t\tt.Error(\"bad checksum main failed:\", err)\n\t}\n\t// Verify equivalence.\n\tif obj2.One != obj1.One {\n\t\tt.Error(\"persist mismatch\")\n\t}\n\tif obj2.Two != obj1.Two {\n\t\tt.Error(\"persist mismatch\")\n\t}\n\tif !bytes.Equal(obj2.Three, obj1.Three) {\n\t\tt.Error(\"persist mismatch\")\n\t}\n\tif obj2.One != \"dog\" {\n\t\tt.Error(\"persist mismatch\")\n\t}\n\tif obj2.Two != 25 {\n\t\tt.Error(\"persist mismatch\")\n\t}\n\tif !bytes.Equal(obj2.Three, []byte(\"more dog\")) {\n\t\tt.Error(\"persist mismatch\")\n\t}\n\n\t// Try loading a file with a manual checksum.\n\terr = LoadJSON(testMeta, &obj2, filepath.Join(\"testdata\", \"manual.json\"))\n\tif err != nil {\n\t\tt.Error(\"loading file with a manual checksum should have succeeded\")\n\t}\n\t// Verify equivalence.\n\tif obj2.One != obj1.One {\n\t\tt.Error(\"persist mismatch\")\n\t}\n\tif obj2.Two != obj1.Two {\n\t\tt.Error(\"persist mismatch\")\n\t}\n\tif !bytes.Equal(obj2.Three, obj1.Three) {\n\t\tt.Error(\"persist mismatch\")\n\t}\n\tif obj2.One != \"dog\" {\n\t\tt.Error(\"persist mismatch\")\n\t}\n\tif obj2.Two != 25 {\n\t\tt.Error(\"persist mismatch\")\n\t}\n\tif !bytes.Equal(obj2.Three, []byte(\"more dog\")) {\n\t\tt.Error(\"persist mismatch\")\n\t}\n\n\t// Try loading a file with a bad manual checksum.\n\terr = LoadJSON(testMeta, &obj2, filepath.Join(\"testdata\", \"manual_bad.json\"))\n\tif err == nil {\n\t\tt.Error(\"bad manual checksum should not have resulted in loading correctly\")\n\t}\n\terr = LoadJSON(testMeta, &obj2, filepath.Join(\"testdata\", \"manual_bad2.json\"))\n\tif err == nil {\n\t\tt.Error(\"bad manual checksum should not have resulted in loading correctly\")\n\t}\n\n\t// Try loading a file where the main has been corrupted in a way that makes\n\t// the file too short.\n\terr = LoadJSON(testMeta, &obj2, filepath.Join(\"testdata\", \"corruptmainshort.json\"))\n\tif err != nil {\n\t\tt.Error(\"short mainfile seems to be causing problems\")\n\t}\n\n\t// Try loading a corrupted main file.\n\terr = LoadJSON(testMeta, &obj2, filepath.Join(\"testdata\", \"corruptmain.json\"))\n\tif err != nil {\n\t\tt.Error(\"couldn't load corrupted main:\", err)\n\t}\n\t// Verify equivalence.\n\tif obj2.One != obj1.One {\n\t\tt.Error(\"persist mismatch\")\n\t}\n\tif obj2.Two != obj1.Two {\n\t\tt.Error(\"persist mismatch\")\n\t}\n\tif !bytes.Equal(obj2.Three, obj1.Three) {\n\t\tt.Error(\"persist mismatch\")\n\t}\n\tif obj2.One != \"dog\" {\n\t\tt.Error(\"persist mismatch\")\n\t}\n\tif obj2.Two != 25 {\n\t\tt.Error(\"persist mismatch\")\n\t}\n\tif !bytes.Equal(obj2.Three, []byte(\"more dog\")) {\n\t\tt.Error(\"persist mismatch\")\n\t}\n\n\t// Try loading a corrupted temp file.\n\terr = LoadJSON(testMeta, &obj2, filepath.Join(\"testdata\", \"corrupttemp.json\"))\n\tif err != nil {\n\t\tt.Error(\"couldn't load corrupted main:\", err)\n\t}\n\t// Verify equivalence.\n\tif obj2.One != obj1.One {\n\t\tt.Error(\"persist mismatch\")\n\t}\n\tif obj2.Two != obj1.Two {\n\t\tt.Error(\"persist mismatch\")\n\t}\n\tif !bytes.Equal(obj2.Three, obj1.Three) {\n\t\tt.Error(\"persist mismatch\")\n\t}\n\tif obj2.One != \"dog\" {\n\t\tt.Error(\"persist mismatch\")\n\t}\n\tif obj2.Two != 25 {\n\t\tt.Error(\"persist mismatch\")\n\t}\n\tif !bytes.Equal(obj2.Three, []byte(\"more dog\")) {\n\t\tt.Error(\"persist mismatch\")\n\t}\n\n\t// Try loading a file with no temp, and no checksum.\n\terr = LoadJSON(testMeta, &obj2, filepath.Join(\"testdata\", \"nochecksum.json\"))\n\tif err != nil {\n\t\tt.Error(\"couldn't load no checksum:\", err)\n\t}\n\t// Verify equivalence.\n\tif obj2.One != obj1.One {\n\t\tt.Error(\"persist mismatch\")\n\t}\n\tif obj2.Two != obj1.Two {\n\t\tt.Error(\"persist mismatch\")\n\t}\n\tif !bytes.Equal(obj2.Three, obj1.Three) {\n\t\tt.Error(\"persist mismatch\")\n\t}\n\tif obj2.One != \"dog\" {\n\t\tt.Error(\"persist mismatch\")\n\t}\n\tif obj2.Two != 25 {\n\t\tt.Error(\"persist mismatch\")\n\t}\n\tif !bytes.Equal(obj2.Three, []byte(\"more dog\")) {\n\t\tt.Error(\"persist mismatch\")\n\t}\n}", "title": "" }, { "docid": "d646af187ea51e1727ce7d09e0dfae88", "score": "0.55277973", "text": "func testNewFileRepoIndex(t *testing.T) {\n\n\t// TEST NEW REPO INDEX WITH BAD REPO NAME\n\tctxt := getContext()\n\n\tif _, err := newFileRepositoryIndex(ctxt, testRepoName+\"-badName\"); err == nil {\n\t\tt.Errorf(\"newFileRepositoryIndex(): succeeded with non-existent repo (name)\")\n\t}\n\n\tif fri, err := newFileRepositoryIndex(ctxt, testRepoName); err != nil {\n\t\tt.Errorf(\"newFileRepositoryIndex(): failed with existing repo (name): %v\", err)\n\t} else {\n\t\tfileRepoIdx = fri\n\t}\n\n\tif fileRepoIdx == nil {\n\t\tt.Errorf(\"newFileRepositoryIndex(): returnd nil object on success\")\n\t}\n}", "title": "" }, { "docid": "4f379db3011de20cefc6f89d1cd050ce", "score": "0.55201787", "text": "func TestCreateReadDeleteUpdate(t *testing.T) {\n\tif testing.Short() {\n\t\tt.SkipNow()\n\t}\n\tt.Parallel()\n\n\tsf := newTestFile()\n\tupdate := sf.createDeleteUpdate()\n\t// Read update\n\tpath := readDeleteUpdate(update)\n\t// Compare values\n\tif path != sf.siaFilePath {\n\t\tt.Error(\"paths doesn't match\")\n\t}\n}", "title": "" }, { "docid": "d92c758127f7fe3ecfe1634d83ffea62", "score": "0.55191183", "text": "func TestArchiveFileNotFoundReturnsError(t *testing.T) {\n\tt.Parallel()\n\n\tConvey(`The client should handle missing isolate files.`, t, func() {\n\t\ta := archiver.New(context.Background(), isolatedclient.New(nil, nil, \"http://unused\", isolatedclient.DefaultNamespace, nil, nil), nil)\n\t\topts := &ArchiveOptions{\n\t\t\tIsolate: \"/this-file-does-not-exist\",\n\t\t\tIsolated: \"/this-file-doesnt-either\",\n\t\t}\n\t\titem := Archive(a, opts)\n\t\titem.WaitForHashed()\n\t\terr := item.Error()\n\t\tSo(strings.HasPrefix(err.Error(), \"open /this-file-does-not-exist: \"), ShouldBeTrue)\n\t\t// The archiver itself hasn't failed, it's Archive() that did.\n\t\tSo(a.Close(), ShouldBeNil)\n\t})\n}", "title": "" }, { "docid": "4138dbe816bca7e18b97830bd0712461", "score": "0.55101585", "text": "func TestOpenFailed(t *testing.T) {\n\t_, err := db.Open(wrapperName, db.DataSource{})\n\n\tif err == nil {\n\t\tt.Fatalf(\"Could not open database.\")\n\t}\n}", "title": "" }, { "docid": "24c9d8ced1c1919da5089ce3aa09525b", "score": "0.55013484", "text": "func TestReadStandardsFailsWhenInvalidStandard(t *testing.T) {\n\tmockConfig()\n\tpath.Standards = func() ([]path.File, error) {\n\t\tfilePath := fmt.Sprintf(\"%s/../fixtures/standards/invalid-standard.yml\", getRootPath())\n\t\tfileInfo, _ := os.Lstat(filePath)\n\t\treturn []path.File{\n\t\t\t{FullPath: filePath, Info: fileInfo},\n\t\t}, nil\n\t}\n\n\t_, err := ReadStandards()\n\tif err == nil {\n\t\tt.Fatal(`ReadStandards() was expected to fail`, err)\n\t}\n}", "title": "" }, { "docid": "97b1ae78c7e302780f337b7b5cd760a7", "score": "0.5497016", "text": "func TestInvalidFileName(t *testing.T) {\n\tr := Reader{}\n\n\tr.FileName = \"test/testdata/xyz.csv\"\n\terr := r.Read()\n\n\tif !strings.Contains(err.Error(), \"file name\") {\n\t\tt.Errorf(\"%T: %s\", err, err)\n\t}\n}", "title": "" }, { "docid": "1d4605baa3192822f687febbac035ba8", "score": "0.54823303", "text": "func TestNewSpecErrors(t *testing.T) {\n\tt.Parallel()\n\tnewSpecTests := []struct {\n\t\tdescription string\n\t\tfilename string\n\t\terrMsg string\n\t}{\n\t\t{\n\t\t\tdescription: \"Should fail when provided spec file doesn't exist\",\n\t\t\tfilename: \"testdata/no_such_file\",\n\t\t\terrMsg: \"open testdata/no_such_file: no such file or directory\",\n\t\t},\n\t\t{\n\t\t\tdescription: \"Should fail when spec file contains invalid YAML\",\n\t\t\tfilename: \"testdata/bad_yaml.txt\",\n\t\t\terrMsg: \"yaml: line 2: could not find expected ':'\",\n\t\t},\n\t\t{\n\t\t\tdescription: \"Should fail when spec file doesn't match the schema\",\n\t\t\tfilename: \"testdata/bad_spec.yaml\",\n\t\t\terrMsg: \"invalid spec file: testdata/bad_spec.yaml\\n\\trelease: Invalid type. Expected: integer, given: string\",\n\t\t},\n\t\t{\n\t\t\tdescription: \"Should fail when spec file doesn't contain all required fields\",\n\t\t\tfilename: \"testdata/bad_template_missing_fields_spec.yaml\",\n\t\t\terrMsg: \"invalid spec file: testdata/bad_template_missing_fields_spec.yaml\\n\\t(root): \" +\n\t\t\t\t\"version is required\\n\\t(root): release is required\",\n\t\t},\n\t\t{\n\t\t\tdescription: \"Should fail when spec file has unparseable template values\",\n\t\t\tfilename: \"testdata/bad_template_spec.yaml\",\n\t\t\terrMsg: `template: :1: unexpected \"}\" in operand`,\n\t\t},\n\t\t{\n\t\t\tdescription: \"Should fail when spec file uses unknown fields as template values\",\n\t\t\tfilename: \"testdata/bad_fields_spec.yaml\",\n\t\t\terrMsg: `template: :1:2: executing \"\" at <.FakeField>: can't evaluate field FakeField in type *mere.Spec`,\n\t\t},\n\t\t{\n\t\t\tdescription: \"Should fail when spec file has bad template data in the 'build' section\",\n\t\t\tfilename: \"testdata/bad_template_build_spec.yaml\",\n\t\t\terrMsg: `template: :1:17: executing \"\" at <.Versio>: can't evaluate field Versio in type *mere.Spec`,\n\t\t},\n\t\t{\n\t\t\tdescription: \"Should fail when spec file has bad template data in the 'test' section\",\n\t\t\tfilename: \"testdata/bad_template_test_spec.yaml\",\n\t\t\terrMsg: `template: :1:17: executing \"\" at <.Versio>: can't evaluate field Versio in type *mere.Spec`,\n\t\t},\n\t\t{\n\t\t\tdescription: \"Should fail when spec file has bad template data in the 'install' section\",\n\t\t\tfilename: \"testdata/bad_template_install_spec.yaml\",\n\t\t\terrMsg: `template: :1:17: executing \"\" at <.Versio>: can't evaluate field Versio in type *mere.Spec`,\n\t\t},\n\t\t{\n\t\t\tdescription: \"Should fail when spec file has bad b3sum value\",\n\t\t\tfilename: \"testdata/bad_b3sum_spec.yaml\",\n\t\t\terrMsg: \"invalid spec file: testdata/bad_b3sum_spec.yaml\\n\\tsources.0.b3sum: \" +\n\t\t\t\t\"String length must be greater than or equal to 64\",\n\t\t},\n\t\t{\n\t\t\tdescription: \"Should fail when spec source uses an invalid url scheme\",\n\t\t\tfilename: \"testdata/bad_url.yaml\",\n\t\t\terrMsg: `parse \"://fake/file\": missing protocol scheme`,\n\t\t},\n\t}\n\tfor _, tc := range newSpecTests {\n\t\ttc := tc\n\t\tt.Run(tc.description, func(t *testing.T) {\n\t\t\tt.Parallel()\n\t\t\tassert := assert.New(t)\n\t\t\tvar buf bytes.Buffer\n\t\t\t_, err := mere.NewSpec(tc.filename, &buf)\n\t\t\tassert.Contains(err.Error(), tc.errMsg)\n\t\t})\n\t}\n}", "title": "" }, { "docid": "1632a89a3ef9babde604aed3350ad0fa", "score": "0.5475417", "text": "func TestDeltaOnImageLoadInvalidTar(t *testing.T) {\n\tctx := context.Background()\n\tclient := testEnv.APIClient()\n\n\tbrokenTarFileName := \"\"\n\n\t// Create a file that is not really a tar.\n\tfunc() {\n\t\tbrokenTarFile, err := os.CreateTemp(\"\", \"brokenTarFile-*.tar\")\n\t\tassert.NilError(t, err)\n\t\tdefer func() {\n\t\t\tbrokenTarFile.Close()\n\t\t}()\n\t\tbrokenTarFile.Write([]byte(\"this is definitely not a valid tar file!\"))\n\t\tbrokenTarFileName = brokenTarFile.Name()\n\t}()\n\n\t// Load the broken tar file. The load operation itself shall succeed, but we\n\t// expect an error reported in the response body.\n\tloadedBrokenTarFile, err := os.Open(brokenTarFileName)\n\tassert.NilError(t, err)\n\tdefer loadedBrokenTarFile.Close()\n\tresp, err := client.ImageLoad(ctx, loadedBrokenTarFile, true)\n\tassert.NilError(t, err)\n\tdefer resp.Body.Close()\n\trespBody, err := io.ReadAll(resp.Body)\n\tassert.NilError(t, err)\n\tassert.Assert(t, cmp.Contains(string(respBody), `\"errorDetail\":`))\n}", "title": "" }, { "docid": "e19c6d5861d16dead2cdde4515ccd6cf", "score": "0.546973", "text": "func TestNewFileLoaderFail(t *testing.T) {\n\t_, err := NewTestFileLoader(\"/fooey/kablooie\", \"/bad/var\")\n\tif err == nil {\n\t\tt.Error(\"No error!\")\n\t}\n}", "title": "" }, { "docid": "24ededdf856ccd5ce23194ce320b125a", "score": "0.5466094", "text": "func TestOpen(t *testing.T) {\n\tpath := tempfile()\n\tdefer os.RemoveAll(path)\n\n\tdb, err := bolt.Open(path, 0600, nil)\n\tif err != nil {\n\t\tt.Fatal(err)\n\t} else if db == nil {\n\t\tt.Fatal(\"expected db\")\n\t}\n\n\tif s := db.Path(); s != path {\n\t\tt.Fatalf(\"unexpected path: %s\", s)\n\t}\n\n\tif err := db.Close(); err != nil {\n\t\tt.Fatal(err)\n\t}\n}", "title": "" }, { "docid": "70e55cbd1774968809ecd2d0414089d2", "score": "0.54631793", "text": "func TestUpdateTargetDir(t *testing.T) {\n\t// load metadata\n\tmt, err := LoadTargetDir(\"./testdir\")\n\tif err != nil {\n\t\tt.Fatalf(\"want no error, got err: %s\", err)\n\t}\n\n\t// ensure metadata is correct\n\tf1 := File{Path: \"./testdir\", Root: true, Visited: true}\n\tf2 := File{Path: \"testdir/testfile.yml\", Visited: true}\n\twantFiles := []*File{&f1, &f2}\n\tif !reflect.DeepEqual(mt.files, wantFiles) {\n\t\tt.Fatalf(\"results are not equal, got: %#v, want: %#v\", pp(mt.files), pp(wantFiles))\n\t}\n\n\t// create tmp file in testdir (candidate for delete)\n\tfile, err := os.Create(\"./testdir/tobedeleted.yml\")\n\tif err != nil {\n\t\tt.Fatalf(\"failed to create tmp file in testdir, got: %s\", err)\n\t}\n\n\tdefer func() {\n\t\t_ = file.Close()\n\t}()\n\n\t// run UpdateTargetDir to detect a new file\n\terr = UpdateTargetDir(mt)\n\tif err != nil {\n\t\tt.Fatalf(\"want no error, got err: %s\", err)\n\t}\n\n\t// verify new file is there\n\tf3 := File{Path: \"testdir/tobedeleted.yml\", Visited: true}\n\twantFiles = []*File{&f1, &f2, &f3}\n\tif !reflect.DeepEqual(mt.files, wantFiles) {\n\t\tt.Fatalf(\"results are not equal, got: %v, want: %v\", mt.files, wantFiles)\n\t}\n\n\t// delete (simulate user)\n\terr = os.Remove(\"./testdir/tobedeleted.yml\")\n\tif err != nil {\n\t\tt.Fatalf(\"want no error, got err: %s\", err)\n\t}\n\n\t// run UpdateTargetDir to detect the deletion\n\terr = UpdateTargetDir(mt)\n\tif err != nil {\n\t\tt.Fatalf(\"want no error, got err: %s\", err)\n\t}\n\n\t// verify no tobedeted.yml in metedata\n\twantFiles = []*File{&f1, &f2}\n\tif !reflect.DeepEqual(mt.files, wantFiles) {\n\t\tt.Fatalf(\"results are not equal, got: %#v, want: %#v\", pp(mt.files), pp(wantFiles))\n\t}\n}", "title": "" }, { "docid": "4ed8723b4a3fb815565c9601207d11f8", "score": "0.54623115", "text": "func mustOpen(t *testing.T, path string) *os.File {\n\tf, err := os.Open(path)\n\tif err != nil {\n\t\tt.Fatalf(\"Error while opening file '%s'; err=%s\", path, err)\n\t}\n\n\treturn f\n}", "title": "" }, { "docid": "8fe5b649eae0d0afa74a2f549e43980f", "score": "0.5457218", "text": "func TestUnmodifiedStatSucceeds(t *testing.T) {\n\tfor _, alg := range hashAlgs {\n\t\tvfsObj, root, ctx, err := newVerityRoot(t, alg)\n\t\tif err != nil {\n\t\t\tt.Fatalf(\"newVerityRoot: %v\", err)\n\t\t}\n\n\t\tfilename := \"verity-test-file\"\n\t\tfd, _, err := newFileFD(ctx, vfsObj, root, filename, 0644)\n\t\tif err != nil {\n\t\t\tt.Fatalf(\"newFileFD: %v\", err)\n\t\t}\n\n\t\t// Enable verity on the file and confirms stat succeeds.\n\t\tvar args arch.SyscallArguments\n\t\targs[1] = arch.SyscallArgument{Value: linux.FS_IOC_ENABLE_VERITY}\n\t\tif _, err := fd.Ioctl(ctx, nil /* uio */, args); err != nil {\n\t\t\tt.Fatalf(\"fd.Ioctl: %v\", err)\n\t\t}\n\n\t\tif _, err := fd.Stat(ctx, vfs.StatOptions{}); err != nil {\n\t\t\tt.Errorf(\"fd.Stat: %v\", err)\n\t\t}\n\t}\n}", "title": "" }, { "docid": "e51e48071602ee5ff72ee32f13a672b2", "score": "0.54190075", "text": "func TestInvalidSDNCSVFile(t *testing.T) {\n\tr := Reader{}\n\tr.FileName = \"invalid/sdn.csv\"\n\tif err := r.Read(); err != nil {\n\t\tif _, ok := err.(*os.PathError); ok {\n\t\t} else {\n\t\t\tt.Errorf(\"%T: %s\", err, err)\n\t\t}\n\t}\n}", "title": "" }, { "docid": "1ad1fd045b50119fc93a26d5bd47fda4", "score": "0.5408586", "text": "func TestGenerateRCFile_ErrIfCannotWrite(t *testing.T) {\n\trcFile := \"/this/dir/does/not/exist/.terraformrc\"\n\texpErr := fmt.Sprintf(\"writing generated .terraformrc file with TFE token to %s: open %s: no such file or directory\", rcFile, rcFile)\n\tactErr := generateRCFile(\"token\", \"hostname\", \"/this/dir/does/not/exist\")\n\tErrEquals(t, expErr, actErr)\n}", "title": "" }, { "docid": "c775081b7d127640a743318bb998f3d0", "score": "0.54079485", "text": "func TestOpenImageFile(t *testing.T) {\n\tassertions := assert.New(t)\n\tjpgFilename := \"testdata/jpg_sample_image.jpg\"\n\topenedImage, err := OpenImageFile(jpgFilename)\n\tassertions.True(err == nil, \"jpg image format should be supported\")\n\tassertions.True(openedImage != nil, \"opened jpg file should not be nil\")\n\n\tpngFilename := \"testdata/png_sample_image.png\"\n\topenedImage, err = OpenImageFile(pngFilename)\n\tassertions.True(err == nil, \"png image format should be supported\")\n\tassertions.True(openedImage != nil, \"opened jpg file should not be nil\")\n\n\tnotSupported := \"testdata/not_supported_sample_image\"\n\topenedImage, err = OpenImageFile(notSupported)\n\tassertions.True(err != nil, \"should not open unsupported image\")\n\tassertions.True(openedImage == nil, \"not supported image should be nil\")\n}", "title": "" }, { "docid": "0c9179c34d7c365ef05db39cbe5e90b1", "score": "0.53987753", "text": "func TestOnMatchingFileContent(t *testing.T) {\n\tt.Parallel()\n\t//nolint\n\ttests := []struct {\n\t\tname string\n\t\twantErr bool\n\t\tshellPattern string\n\t\tcaseSensitive bool\n\t\tshouldFuncFail bool\n\t\tshouldGetPredicateFail bool\n\t\tfiles []string\n\t}{\n\t\t{\n\t\t\tname: \"no files\",\n\t\t\tshellPattern: \"Dockerfile\",\n\t\t\tcaseSensitive: true,\n\t\t\tfiles: []string{\n\t\t\t\t\"Dockerfile\",\n\t\t\t\t\"Dockerfile.template\",\n\t\t\t\t\"Dockerfile.template.template\",\n\t\t\t\t\"Dockerfile.template.template.template\",\n\t\t\t\t\"Dockerfile.template.template.template.template\",\n\t\t\t},\n\t\t},\n\t\t{\n\t\t\tname: \"no files\",\n\t\t\tshellPattern: \"Dockerfile\",\n\t\t\tcaseSensitive: false,\n\t\t\tfiles: []string{},\n\t\t},\n\t\t{\n\t\t\tname: \"no files\",\n\t\t\tshellPattern: \"Dockerfile\",\n\t\t\tcaseSensitive: true,\n\t\t\tfiles: []string{},\n\t\t},\n\t\t{\n\t\t\tname: \"no files\",\n\t\t\tshellPattern: \"Dockerfile\",\n\t\t\tcaseSensitive: false,\n\t\t\tfiles: []string{\n\t\t\t\t\"Dockerfile\",\n\t\t\t\t\"Dockerfile.template\",\n\t\t\t\t\"Dockerfile.template.template\",\n\t\t\t\t\"Dockerfile.template.template.template\",\n\t\t\t\t\"Dockerfile.template.template.template.template\",\n\t\t\t},\n\t\t\tshouldFuncFail: true,\n\t\t},\n\t\t{\n\t\t\tname: \"no files\",\n\t\t\tshellPattern: \"Dockerfile\",\n\t\t\tcaseSensitive: false,\n\t\t\tshouldGetPredicateFail: true,\n\t\t\tfiles: []string{\n\t\t\t\t\"Dockerfile\",\n\t\t\t\t\"Dockerfile.template\",\n\t\t\t\t\"Dockerfile.template.template\",\n\t\t\t\t\"Dockerfile.template.template.template\",\n\t\t\t\t\"Dockerfile.template.template.template.template\",\n\t\t\t},\n\t\t},\n\t\t{\n\t\t\tname: \"no files\",\n\t\t\tshellPattern: \"Dockerfile\",\n\t\t\tcaseSensitive: true,\n\t\t\tfiles: []string{\n\t\t\t\t\"Dockerfile\",\n\t\t\t\t\"Dockerfile.template\",\n\t\t\t\t\"Dockerfile.template.template\",\n\t\t\t\t\"Dockerfile.template.template.template\",\n\t\t\t\t\"Dockerfile.template.template.template.template\",\n\t\t\t},\n\t\t},\n\t\t{\n\t\t\tname: \"no files\",\n\t\t\tshellPattern: \"Dockerfile\",\n\t\t\tcaseSensitive: false,\n\t\t\tfiles: []string{},\n\t\t},\n\t\t{\n\t\t\tname: \"no files\",\n\t\t\tshellPattern: \"Dockerfile\",\n\t\t\tcaseSensitive: true,\n\t\t\tfiles: []string{},\n\t\t},\n\t\t{\n\t\t\tname: \"no files\",\n\t\t\tshellPattern: \"Dockerfile\",\n\t\t\tcaseSensitive: false,\n\t\t\tfiles: []string{\n\t\t\t\t\"Dockerfile\",\n\t\t\t\t\"Dockerfile.template\",\n\t\t\t\t\"Dockerfile.template.template\",\n\t\t\t\t\"Dockerfile.template.template.template\",\n\t\t\t\t\"Dockerfile.template.template.template.template\",\n\t\t\t},\n\t\t\tshouldFuncFail: true,\n\t\t},\n\t\t{\n\t\t\tname: \"no files\",\n\t\t\tshellPattern: \"Dockerfile\",\n\t\t\tcaseSensitive: false,\n\t\t\tshouldGetPredicateFail: true,\n\t\t\tfiles: []string{\n\t\t\t\t\"Dockerfile\",\n\t\t\t\t\"Dockerfile.template\",\n\t\t\t\t\"Dockerfile.template.template\",\n\t\t\t\t\"Dockerfile.template.template.template\",\n\t\t\t\t\"Dockerfile.template.template.template.template\",\n\t\t\t},\n\t\t},\n\t}\n\n\tfor _, tt := range tests {\n\t\ttt := tt // Re-initializing variable so it is not changed while executing the closure below\n\t\tt.Run(tt.name, func(t *testing.T) {\n\t\t\tt.Parallel()\n\t\t\tx := func(path string, content []byte, args ...interface{}) (bool, error) {\n\t\t\t\tif tt.shouldFuncFail {\n\t\t\t\t\t//nolint\n\t\t\t\t\treturn false, errors.New(\"test error\")\n\t\t\t\t}\n\t\t\t\tif tt.shouldGetPredicateFail {\n\t\t\t\t\treturn false, nil\n\t\t\t\t}\n\t\t\t\treturn true, nil\n\t\t\t}\n\n\t\t\tctrl := gomock.NewController(t)\n\t\t\tmockRepo := mockrepo.NewMockRepoClient(ctrl)\n\t\t\tmockRepo.EXPECT().ListFiles(gomock.Any()).Return(tt.files, nil).AnyTimes()\n\t\t\tmockRepo.EXPECT().GetFileContent(gomock.Any()).Return(nil, nil).AnyTimes()\n\n\t\t\tresult := OnMatchingFileContentDo(mockRepo, PathMatcher{\n\t\t\t\tPattern: tt.shellPattern,\n\t\t\t\tCaseSensitive: tt.caseSensitive,\n\t\t\t}, x)\n\n\t\t\tif tt.wantErr && result == nil {\n\t\t\t\tt.Errorf(\"OnMatchingFileContentDo() = %v, want %v test name %v\", result, tt.wantErr, tt.name)\n\t\t\t}\n\t\t})\n\t}\n}", "title": "" }, { "docid": "6948f3c3eb6eb24375208950562cc415", "score": "0.53986", "text": "func TestSaveJSONCorruptedMainFile(t *testing.T) {\n\tif testing.Short() {\n\t\tt.SkipNow()\n\t}\n\n\t// Create the directory used for testing.\n\tdir := filepath.Join(build.TempDir(persistDir), t.Name())\n\terr := os.MkdirAll(dir, 0700)\n\tif err != nil {\n\t\tt.Fatal(err)\n\t}\n\n\t// Define the test object that will be getting saved.\n\ttestMeta := Metadata{\"Test Struct\", \"v1.2.1\"}\n\ttype testStruct struct {\n\t\tOne string\n\t\tTwo uint64\n\t\tThree []byte\n\t}\n\t// 'newObj' is different from the object that has already been saved to\n\t// 'corruptmain.json' and 'corruptmain.json_temp'.\n\tnewObj := testStruct{\"cat\", 716, []byte(\"cat attack\")}\n\n\t// Copy the corruptmain files to the testing dir.\n\tcorruptMainFileSource := filepath.Join(\"testdata\", \"corruptmain.json\")\n\tcorruptMainTempFileSource := filepath.Join(\"testdata\", \"corruptmain.json_temp\")\n\tcorruptMainFileDest := filepath.Join(dir, \"corruptmain.json\")\n\tcorruptMainTempFileDest := filepath.Join(dir, \"corruptmain.json_temp\")\n\tbuild.CopyFile(corruptMainFileSource, corruptMainFileDest)\n\tbuild.CopyFile(corruptMainTempFileSource, corruptMainTempFileDest)\n\n\t// Get all of the bytes of the temp file to verify later that the temp file\n\t// is unchanged after saving.\n\tfile, err := os.Open(corruptMainTempFileDest)\n\tif err != nil {\n\t\tt.Fatal(err)\n\t}\n\toriginalTempFileData, err := ioutil.ReadAll(file)\n\tif err != nil {\n\t\tt.Fatal(err)\n\t}\n\tfile.Close()\n\n\t// Try saving a file when the main file has been corrupted. The save file\n\t// should detect that the main file has been corrupted, and it should not\n\t// touch the temp file. If the temp file changes, corruption has potentially\n\t// been introduced.\n\terr = SaveJSON(testMeta, newObj, corruptMainFileDest)\n\tif err != nil {\n\t\tt.Fatal(err)\n\t}\n\n\t// Check that the temp file is untouched.\n\tfile, err = os.Open(corruptMainTempFileDest)\n\tif err != nil {\n\t\tt.Fatal(err)\n\t}\n\ttempFileDataAfterBadSave, err := ioutil.ReadAll(file)\n\tif err != nil {\n\t\tt.Fatal(err)\n\t}\n\tfile.Close()\n\tif !bytes.Equal(tempFileDataAfterBadSave, originalTempFileData) {\n\t\tt.Error(\"Temp file was changed after a correupted main file save\")\n\t}\n\n\t// Save again. This time, because the full file is correct, it should\n\t// overwrite the temp file.\n\terr = SaveJSON(testMeta, newObj, corruptMainFileDest)\n\tif err != nil {\n\t\tt.Fatal(err)\n\t}\n\tfile, err = os.Open(corruptMainTempFileDest)\n\tif err != nil {\n\t\tt.Fatal(err)\n\t}\n\ttempFileDataAfterGoodSave, err := ioutil.ReadAll(file)\n\tif err != nil {\n\t\tt.Fatal(err)\n\t}\n\tfile.Close()\n\tif bytes.Equal(tempFileDataAfterGoodSave, originalTempFileData) {\n\t\tt.Error(\"Temp file was not changed after a good save\")\n\t}\n}", "title": "" }, { "docid": "0c312b82310833876410a52b635453a0", "score": "0.53885925", "text": "func TestLoadingNonexistentFile(t *testing.T) {\n\tholder := tides.ObservationHolder{}\n\terr := holder.LoadDataStore(\"data_does_not_exist\")\n\tif err == nil {\n\t\tt.Error(\"Should have errored on dir that does not exist\")\n\t}\n}", "title": "" }, { "docid": "e1c9253ddeda19e3f7af155ad387494c", "score": "0.5373555", "text": "func TestRenameAllAndDelete(t *testing.T) {\n\t// Create a testing directory and directory system\n\ttestDir := tempDir(t.Name())\n\tfileDir := filepath.Join(testDir, \"files\")\n\tfiles := []string{\n\t\tfilepath.Join(fileDir, \"file.sia\"),\n\t\tfilepath.Join(fileDir, \"file2.sia\"),\n\t\tfilepath.Join(fileDir, \"file3.sia\"),\n\t\tfilepath.Join(fileDir, \"file3-extended.sia\"),\n\t\tfilepath.Join(fileDir, \"a/file.sia\"),\n\t\tfilepath.Join(fileDir, \"a/file-extended.sia\"),\n\t\tfilepath.Join(fileDir, \"a/file2.sia\"),\n\t\tfilepath.Join(fileDir, \"a/a/a/file.sia\"),\n\t\tfilepath.Join(fileDir, \"/as/as/as/as/as/file.sia\"),\n\t}\n\tsiadirs := []string{\n\t\tfilepath.Join(fileDir, \"a/.siadir\"),\n\t\tfilepath.Join(fileDir, \"a/a/a/.siadir\"),\n\t}\n\tgoodFile := filepath.Join(fileDir, \"bb/bb/file.sia\")\n\terr := os.MkdirAll(filepath.Dir(goodFile), persist.DefaultDiskPermissionsTest)\n\tif err != nil {\n\t\tt.Fatal(err)\n\t}\n\t_, err = os.Create(goodFile)\n\tif err != nil {\n\t\tt.Fatal(err)\n\t}\n\tfor _, file := range files {\n\t\terr = os.MkdirAll(filepath.Dir(file), persist.DefaultDiskPermissionsTest)\n\t\tif err != nil {\n\t\t\tt.Fatal(err)\n\t\t}\n\t\t_, err = os.Create(file)\n\t\tif err != nil {\n\t\t\tt.Fatal(err)\n\t\t}\n\t}\n\tfor _, siadir := range siadirs {\n\t\terr = os.MkdirAll(filepath.Dir(siadir), persist.DefaultDiskPermissionsTest)\n\t\tif err != nil {\n\t\t\tt.Fatal(err)\n\t\t}\n\t\t_, err = os.Create(siadir)\n\t\tif err != nil {\n\t\t\tt.Fatal(err)\n\t\t}\n\t}\n\n\t// rename files\n\tdirFile := filepath.Join(testDir, \"File\")\n\tf, err := os.Create(dirFile)\n\tif err != nil {\n\t\tt.Fatal(err)\n\t}\n\tdefer func() {\n\t\tif err := f.Close(); err != nil {\n\t\t\tt.Fatal(err)\n\t\t}\n\t}()\n\terr = renameAll(f, fileDir)\n\tif err != nil {\n\t\tt.Fatal(err)\n\t}\n\n\t// Verify renaming\n\t_, err = os.Stat(goodFile)\n\tif err != nil {\n\t\tt.Fatal(err)\n\t}\n\tfor _, file := range files {\n\t\t_, err = os.Stat(file)\n\t\tif !os.IsNotExist(err) {\n\t\t\tt.Fatal(err, file)\n\t\t}\n\t}\n\n\t// Delete all the empty dirs\n\terr = deleteEmptyDirs(fileDir)\n\tif err != nil {\n\t\tt.Fatal(err)\n\t}\n\tfor _, file := range files {\n\t\tdir, _ := filepath.Split(file)\n\t\tdir = strings.TrimSuffix(dir, \"/\")\n\t\tif dir == fileDir {\n\t\t\tcontinue\n\t\t}\n\t\t_, err = os.Stat(dir)\n\t\tif !os.IsNotExist(err) {\n\t\t\tt.Fatal(err, dir)\n\t\t}\n\t}\n\tfor _, siadir := range siadirs {\n\t\t_, err = os.Stat(siadir)\n\t\tif !os.IsNotExist(err) {\n\t\t\tt.Fatal(err, siadir)\n\t\t}\n\t}\n}", "title": "" }, { "docid": "fcb93359515b10ffa05dc70dcdf03d81", "score": "0.53613496", "text": "func TestFindKeyErrors(t *testing.T) {\n\n\tshallowYaml := parseFile(t, \"node-examples/yaml1.yaml\")\n\tdeepYaml := parseFile(t, \"node-examples/yaml2.yaml\")\n\tshallowJson := parseFile(t, \"node-examples/json1.json\")\n\tdeepJson := parseFile(t, \"node-examples/json2.json\")\n\n\tvar keyTest = []struct {\n\t\ttestName string\n\t\tbaseNode *yaml.Node\n\t\tpath []string\n\t\texpectedErrorString string\n\t}{\n\t\t{\n\t\t\t\"ExhaustiveSearch\",\n\t\t\tshallowYaml,\n\t\t\t[]string{\"putting\", \"invalidKey1\"},\n\t\t\t\"unable to find yaml node invalidKey1\",\n\t\t},\n\t\t{\n\t\t\t\"ExhaustiveSearch2\",\n\t\t\tdeepJson,\n\t\t\t[]string{\"0\", \"1\", \"0\", \"whole\", \"2\", \"3\", \"invalidKey2\"},\n\t\t\t\"unable to find yaml node invalidKey2\",\n\t\t},\n\t\t{\n\t\t\t\"InvalidIndex\",\n\t\t\tshallowJson,\n\t\t\t[]string{\"corn\", \"worth\", \"7\"},\n\t\t\t\"invalid index parsed 7\",\n\t\t},\n\t\t{\n\t\t\t\"InvalidIndex2\",\n\t\t\tdeepYaml,\n\t\t\t[]string{\"0\", \"1\", \"neighbor\", \"1\", \"slightly\", \"group\", \"1\", \"development\", \"search\", \"-1\"},\n\t\t\t\"invalid index parsed -1\",\n\t\t},\n\t}\n\tfor _, trial := range keyTest {\n\t\tt.Run(trial.testName, func(tt *testing.T) {\n\t\t\t_, _, err := FindKey(trial.baseNode, trial.path...)\n\t\t\tdiff := cmp.Diff(trial.expectedErrorString, err.Error())\n\t\t\tif diff != \"\" {\n\t\t\t\ttt.Error(\"UnexpectedFilePosition: diff(-want +got):\\n\", diff)\n\t\t\t}\n\t\t})\n\t}\n}", "title": "" }, { "docid": "869bee23d5bf76365143ad03923ae2df", "score": "0.53547573", "text": "func TestOpen_ErrChecksum(t *testing.T) {\n\tif pageSize != os.Getpagesize() {\n\t\tt.Skip(\"page size mismatch\")\n\t}\n\n\t// Create empty database.\n\tdb := btesting.MustCreateDB(t)\n\tpath := db.Path()\n\n\t// Close database.\n\tif err := db.Close(); err != nil {\n\t\tt.Fatal(err)\n\t}\n\n\t// Read data file.\n\tbuf, err := os.ReadFile(path)\n\tif err != nil {\n\t\tt.Fatal(err)\n\t}\n\n\t// Rewrite meta pages.\n\tmeta0 := (*meta)(unsafe.Pointer(&buf[pageHeaderSize]))\n\tmeta0.pgid++\n\tmeta1 := (*meta)(unsafe.Pointer(&buf[pageSize+pageHeaderSize]))\n\tmeta1.pgid++\n\tif err := os.WriteFile(path, buf, 0666); err != nil {\n\t\tt.Fatal(err)\n\t}\n\n\t// Reopen data file.\n\tif _, err := bolt.Open(path, 0600, nil); err != berrors.ErrChecksum {\n\t\tt.Fatalf(\"unexpected error: %s\", err)\n\t}\n}", "title": "" }, { "docid": "1b778d681762616683671f40e5121d68", "score": "0.5348779", "text": "func VerifySize(t *testing.T, path string, want int) {\n\t// Read whole file\n\tbuf, err := ioutil.ReadFile(path)\n\tif err != nil {\n\t\tt.Errorf(\"ReadFile failed: %v\", err)\n\t} else if len(buf) != want {\n\t\tt.Errorf(\"wrong read size: got=%d want=%d\", len(buf), want)\n\t}\n\t// Stat()\n\tvar st syscall.Stat_t\n\terr = syscall.Stat(path, &st)\n\tif err != nil {\n\t\tt.Errorf(\"Stat failed: %v\", err)\n\t} else if st.Size != int64(want) {\n\t\tt.Errorf(\"wrong stat file size, got=%d want=%d\", st.Size, want)\n\t}\n\t// Fstat()\n\tfd, err := os.Open(path)\n\tif err != nil {\n\t\tt.Fatal(err)\n\t}\n\tdefer fd.Close()\n\tvar st2 syscall.Stat_t\n\terr = syscall.Fstat(int(fd.Fd()), &st2)\n\tif err != nil {\n\t\tt.Fatal(err)\n\t}\n\tif st2.Size != int64(want) {\n\t\tt.Errorf(\"wrong fstat file size, got=%d want=%d\", st2.Size, want)\n\t}\n\t// The inode number is not stable with `-sharedstorage`, ignore it in the\n\t// comparison.\n\tst.Ino = 0\n\tst2.Ino = 0\n\tif st != st2 {\n\t\tt.Logf(\"Stat vs Fstat mismatch:\\nst= %#v\\nst2=%#v\", st, st2)\n\t}\n}", "title": "" }, { "docid": "42d9375cc0bf92e6659aa5f188add62c", "score": "0.5346003", "text": "func testDigestAndVerify(t *testing.T, controllers ...TestingControllerFactory) {\n\ttests := []struct {\n\t\tname string\n\t\ttarInit func(t *testing.T, dgstMap map[string]digest.Digest) (blob []tarEntry)\n\t\tchecks []check\n\t\tminChunkSize []int\n\t}{\n\t\t{\n\t\t\tname: \"no-regfile\",\n\t\t\ttarInit: func(t *testing.T, dgstMap map[string]digest.Digest) (blob []tarEntry) {\n\t\t\t\treturn tarOf(\n\t\t\t\t\tdir(\"test/\"),\n\t\t\t\t)\n\t\t\t},\n\t\t\tchecks: []check{\n\t\t\t\tcheckStargzTOC,\n\t\t\t\tcheckVerifyTOC,\n\t\t\t\tcheckVerifyInvalidStargzFail(buildTar(t, tarOf(\n\t\t\t\t\tdir(\"test2/\"), // modified\n\t\t\t\t), allowedPrefix[0])),\n\t\t\t},\n\t\t},\n\t\t{\n\t\t\tname: \"small-files\",\n\t\t\ttarInit: func(t *testing.T, dgstMap map[string]digest.Digest) (blob []tarEntry) {\n\t\t\t\treturn tarOf(\n\t\t\t\t\tregDigest(t, \"baz.txt\", \"\", dgstMap),\n\t\t\t\t\tregDigest(t, \"foo.txt\", \"a\", dgstMap),\n\t\t\t\t\tdir(\"test/\"),\n\t\t\t\t\tregDigest(t, \"test/bar.txt\", \"bbb\", dgstMap),\n\t\t\t\t)\n\t\t\t},\n\t\t\tminChunkSize: []int{0, 64000},\n\t\t\tchecks: []check{\n\t\t\t\tcheckStargzTOC,\n\t\t\t\tcheckVerifyTOC,\n\t\t\t\tcheckVerifyInvalidStargzFail(buildTar(t, tarOf(\n\t\t\t\t\tfile(\"baz.txt\", \"\"),\n\t\t\t\t\tfile(\"foo.txt\", \"M\"), // modified\n\t\t\t\t\tdir(\"test/\"),\n\t\t\t\t\tfile(\"test/bar.txt\", \"bbb\"),\n\t\t\t\t), allowedPrefix[0])),\n\t\t\t\t// checkVerifyInvalidTOCEntryFail(\"foo.txt\"), // TODO\n\t\t\t\tcheckVerifyBrokenContentFail(\"foo.txt\"),\n\t\t\t},\n\t\t},\n\t\t{\n\t\t\tname: \"big-files\",\n\t\t\ttarInit: func(t *testing.T, dgstMap map[string]digest.Digest) (blob []tarEntry) {\n\t\t\t\treturn tarOf(\n\t\t\t\t\tregDigest(t, \"baz.txt\", \"bazbazbazbazbazbazbaz\", dgstMap),\n\t\t\t\t\tregDigest(t, \"foo.txt\", \"a\", dgstMap),\n\t\t\t\t\tdir(\"test/\"),\n\t\t\t\t\tregDigest(t, \"test/bar.txt\", \"testbartestbar\", dgstMap),\n\t\t\t\t)\n\t\t\t},\n\t\t\tchecks: []check{\n\t\t\t\tcheckStargzTOC,\n\t\t\t\tcheckVerifyTOC,\n\t\t\t\tcheckVerifyInvalidStargzFail(buildTar(t, tarOf(\n\t\t\t\t\tfile(\"baz.txt\", \"bazbazbazMMMbazbazbaz\"), // modified\n\t\t\t\t\tfile(\"foo.txt\", \"a\"),\n\t\t\t\t\tdir(\"test/\"),\n\t\t\t\t\tfile(\"test/bar.txt\", \"testbartestbar\"),\n\t\t\t\t), allowedPrefix[0])),\n\t\t\t\tcheckVerifyInvalidTOCEntryFail(\"test/bar.txt\"),\n\t\t\t\tcheckVerifyBrokenContentFail(\"test/bar.txt\"),\n\t\t\t},\n\t\t},\n\t\t{\n\t\t\tname: \"with-non-regfiles\",\n\t\t\tminChunkSize: []int{0, 64000},\n\t\t\ttarInit: func(t *testing.T, dgstMap map[string]digest.Digest) (blob []tarEntry) {\n\t\t\t\treturn tarOf(\n\t\t\t\t\tregDigest(t, \"baz.txt\", \"bazbazbazbazbazbazbaz\", dgstMap),\n\t\t\t\t\tregDigest(t, \"foo.txt\", \"a\", dgstMap),\n\t\t\t\t\tregDigest(t, \"bar/foo2.txt\", \"b\", dgstMap),\n\t\t\t\t\tregDigest(t, \"foo3.txt\", \"c\", dgstMap),\n\t\t\t\t\tsymlink(\"barlink\", \"test/bar.txt\"),\n\t\t\t\t\tdir(\"test/\"),\n\t\t\t\t\tregDigest(t, \"test/bar.txt\", \"testbartestbar\", dgstMap),\n\t\t\t\t\tdir(\"test2/\"),\n\t\t\t\t\tlink(\"test2/bazlink\", \"baz.txt\"),\n\t\t\t\t)\n\t\t\t},\n\t\t\tchecks: []check{\n\t\t\t\tcheckStargzTOC,\n\t\t\t\tcheckVerifyTOC,\n\t\t\t\tcheckVerifyInvalidStargzFail(buildTar(t, tarOf(\n\t\t\t\t\tfile(\"baz.txt\", \"bazbazbazbazbazbazbaz\"),\n\t\t\t\t\tfile(\"foo.txt\", \"a\"),\n\t\t\t\t\tfile(\"bar/foo2.txt\", \"b\"),\n\t\t\t\t\tfile(\"foo3.txt\", \"c\"),\n\t\t\t\t\tsymlink(\"barlink\", \"test/bar.txt\"),\n\t\t\t\t\tdir(\"test/\"),\n\t\t\t\t\tfile(\"test/bar.txt\", \"testbartestbar\"),\n\t\t\t\t\tdir(\"test2/\"),\n\t\t\t\t\tlink(\"test2/bazlink\", \"foo.txt\"), // modified\n\t\t\t\t), allowedPrefix[0])),\n\t\t\t\tcheckVerifyInvalidTOCEntryFail(\"test/bar.txt\"),\n\t\t\t\tcheckVerifyBrokenContentFail(\"test/bar.txt\"),\n\t\t\t},\n\t\t},\n\t}\n\n\tfor _, tt := range tests {\n\t\tif len(tt.minChunkSize) == 0 {\n\t\t\ttt.minChunkSize = []int{0}\n\t\t}\n\t\tfor _, srcCompression := range srcCompressions {\n\t\t\tsrcCompression := srcCompression\n\t\t\tfor _, newCL := range controllers {\n\t\t\t\tnewCL := newCL\n\t\t\t\tfor _, prefix := range allowedPrefix {\n\t\t\t\t\tprefix := prefix\n\t\t\t\t\tfor _, srcTarFormat := range []tar.Format{tar.FormatUSTAR, tar.FormatPAX, tar.FormatGNU} {\n\t\t\t\t\t\tsrcTarFormat := srcTarFormat\n\t\t\t\t\t\tfor _, minChunkSize := range tt.minChunkSize {\n\t\t\t\t\t\t\tminChunkSize := minChunkSize\n\t\t\t\t\t\t\tt.Run(tt.name+\"-\"+fmt.Sprintf(\"compression=%v,prefix=%q,format=%s,minChunkSize=%d\", newCL(), prefix, srcTarFormat, minChunkSize), func(t *testing.T) {\n\t\t\t\t\t\t\t\t// Get original tar file and chunk digests\n\t\t\t\t\t\t\t\tdgstMap := make(map[string]digest.Digest)\n\t\t\t\t\t\t\t\ttarBlob := buildTar(t, tt.tarInit(t, dgstMap), prefix, srcTarFormat)\n\n\t\t\t\t\t\t\t\tcl := newCL()\n\t\t\t\t\t\t\t\trc, err := Build(compressBlob(t, tarBlob, srcCompression),\n\t\t\t\t\t\t\t\t\tWithChunkSize(chunkSize), WithCompression(cl))\n\t\t\t\t\t\t\t\tif err != nil {\n\t\t\t\t\t\t\t\t\tt.Fatalf(\"failed to convert stargz: %v\", err)\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\ttocDigest := rc.TOCDigest()\n\t\t\t\t\t\t\t\tdefer rc.Close()\n\t\t\t\t\t\t\t\tbuf := new(bytes.Buffer)\n\t\t\t\t\t\t\t\tif _, err := io.Copy(buf, rc); err != nil {\n\t\t\t\t\t\t\t\t\tt.Fatalf(\"failed to copy built stargz blob: %v\", err)\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tnewStargz := buf.Bytes()\n\t\t\t\t\t\t\t\t// NoPrefetchLandmark is added during `Bulid`, which is expected behaviour.\n\t\t\t\t\t\t\t\tdgstMap[chunkID(NoPrefetchLandmark, 0, int64(len([]byte{landmarkContents})))] = digest.FromBytes([]byte{landmarkContents})\n\n\t\t\t\t\t\t\t\tfor _, check := range tt.checks {\n\t\t\t\t\t\t\t\t\tcheck(t, newStargz, tocDigest, dgstMap, cl, newCL)\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t})\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n}", "title": "" }, { "docid": "5a9ac92fa26d60f916b4e4c7fe1badbf", "score": "0.5325209", "text": "func TestInvalidFileExtension(t *testing.T) {\n\tr := Reader{}\n\n\tr.FileName = \"test/testdata/add.csb\"\n\terr := r.Read()\n\n\tif !strings.Contains(err.Error(), \"file type\") {\n\t\tt.Errorf(\"%T: %s\", err, err)\n\t}\n}", "title": "" }, { "docid": "0c25c1bbe6ffaf633730fbeffbe170f7", "score": "0.5324397", "text": "func testDelete(t *testing.T, newHarness HarnessMaker) {\n\tconst key = \"blob-for-deleting\"\n\n\tctx := context.Background()\n\tt.Run(\"NonExistentFails\", func(t *testing.T) {\n\t\th, err := newHarness(ctx, t)\n\t\tif err != nil {\n\t\t\tt.Fatal(err)\n\t\t}\n\t\tdefer h.Close()\n\t\tdrv, err := h.MakeDriver(ctx)\n\t\tif err != nil {\n\t\t\tt.Fatal(err)\n\t\t}\n\t\tb := blob.NewBucket(drv)\n\t\tdefer b.Close()\n\n\t\terr = b.Delete(ctx, \"does-not-exist\")\n\t\tif err == nil {\n\t\t\tt.Errorf(\"got nil want error\")\n\t\t} else if gcerrors.Code(err) != gcerrors.NotFound {\n\t\t\tt.Errorf(\"got %v want NotFound error\", err)\n\t\t} else if !strings.Contains(err.Error(), \"does-not-exist\") {\n\t\t\tt.Errorf(\"got %v want error to include missing key\", err)\n\t\t}\n\t})\n\n\tt.Run(\"Works\", func(t *testing.T) {\n\t\th, err := newHarness(ctx, t)\n\t\tif err != nil {\n\t\t\tt.Fatal(err)\n\t\t}\n\t\tdefer h.Close()\n\t\tdrv, err := h.MakeDriver(ctx)\n\t\tif err != nil {\n\t\t\tt.Fatal(err)\n\t\t}\n\t\tb := blob.NewBucket(drv)\n\t\tdefer b.Close()\n\n\t\t// Create the blob.\n\t\tif err := b.WriteAll(ctx, key, []byte(\"Hello world\"), nil); err != nil {\n\t\t\tt.Fatal(err)\n\t\t}\n\t\t// Delete it.\n\t\tif err := b.Delete(ctx, key); err != nil {\n\t\t\tt.Errorf(\"got unexpected error deleting blob: %v\", err)\n\t\t}\n\t\t// Subsequent read fails with NotFound.\n\t\t_, err = b.NewReader(ctx, key, nil)\n\t\tif err == nil {\n\t\t\tt.Errorf(\"read after delete got nil, want error\")\n\t\t} else if gcerrors.Code(err) != gcerrors.NotFound {\n\t\t\tt.Errorf(\"read after delete want NotFound error, got %v\", err)\n\t\t} else if !strings.Contains(err.Error(), key) {\n\t\t\tt.Errorf(\"got %v want error to include missing key\", err)\n\t\t}\n\t\t// Subsequent delete also fails.\n\t\terr = b.Delete(ctx, key)\n\t\tif err == nil {\n\t\t\tt.Errorf(\"delete after delete got nil, want error\")\n\t\t} else if gcerrors.Code(err) != gcerrors.NotFound {\n\t\t\tt.Errorf(\"delete after delete got %v, want NotFound error\", err)\n\t\t} else if !strings.Contains(err.Error(), key) {\n\t\t\tt.Errorf(\"got %v want error to include missing key\", err)\n\t\t}\n\t})\n}", "title": "" }, { "docid": "f553c8fa038806fdf02b7b906c4c9a69", "score": "0.5318468", "text": "func TestWriteFileWriteFail(t *testing.T) {\n\tmockFile, done := writeSetup(t)\n\tdefer done()\n\n\tmockData := []byte(\"\")\n\tmockTaskARN := validTaskARN\n\tmockContainerName := containerName\n\tmockDataDir := dataDir\n\n\tmockFile.(*mock_oswrapper.MockFile).WriteImpl = func(bytes []byte) (i int, e error) {\n\t\treturn 0, errors.New(\"write fail\")\n\t}\n\ttempOpenFile := openFile\n\topenFile = func(name string, flag int, perm os.FileMode) (oswrapper.File, error) {\n\t\treturn mockFile, nil\n\t}\n\tdefer func() {\n\t\topenFile = tempOpenFile\n\t}()\n\n\terr := writeToMetadataFile(mockData, mockTaskARN, mockContainerName, mockDataDir)\n\n\texpectErrorMessage := \"write fail\"\n\n\tassert.Error(t, err)\n\tassert.Equal(t, expectErrorMessage, err.Error())\n}", "title": "" }, { "docid": "9a120a3ec232b6341cbaa61823646db8", "score": "0.531515", "text": "func TestRead(t *testing.T) {\n\ttype readTest struct {\n\t\tname string\n\t\timage string\n\t\tabsPath string\n\t}\n\n\ttests := []readTest{\n\t\t{\n\t\t\tname: \"ext4 read small file\",\n\t\t\timage: ext4ImagePath,\n\t\t\tabsPath: \"/file.txt\",\n\t\t},\n\t\t{\n\t\t\tname: \"ext3 read small file\",\n\t\t\timage: ext3ImagePath,\n\t\t\tabsPath: \"/file.txt\",\n\t\t},\n\t\t{\n\t\t\tname: \"ext2 read small file\",\n\t\t\timage: ext2ImagePath,\n\t\t\tabsPath: \"/file.txt\",\n\t\t},\n\t\t{\n\t\t\tname: \"ext4 read big file\",\n\t\t\timage: ext4ImagePath,\n\t\t\tabsPath: \"/bigfile.txt\",\n\t\t},\n\t\t{\n\t\t\tname: \"ext3 read big file\",\n\t\t\timage: ext3ImagePath,\n\t\t\tabsPath: \"/bigfile.txt\",\n\t\t},\n\t\t{\n\t\t\tname: \"ext2 read big file\",\n\t\t\timage: ext2ImagePath,\n\t\t\tabsPath: \"/bigfile.txt\",\n\t\t},\n\t}\n\n\tfor _, test := range tests {\n\t\tt.Run(test.name, func(t *testing.T) {\n\t\t\tctx, vfsfs, root, tearDown, err := setUp(t, test.image)\n\t\t\tif err != nil {\n\t\t\t\tt.Fatalf(\"setUp failed: %v\", err)\n\t\t\t}\n\t\t\tdefer tearDown()\n\n\t\t\tfd, err := vfsfs.OpenAt(\n\t\t\t\tctx,\n\t\t\t\tauth.CredentialsFromContext(ctx),\n\t\t\t\t&vfs.PathOperation{Root: *root, Start: *root, Path: fspath.Parse(test.absPath)},\n\t\t\t\t&vfs.OpenOptions{},\n\t\t\t)\n\t\t\tif err != nil {\n\t\t\t\tt.Fatalf(\"vfsfs.OpenAt failed: %v\", err)\n\t\t\t}\n\n\t\t\t// Get a local file descriptor and compare its functionality with a vfs file\n\t\t\t// description for the same file.\n\t\t\tlocalFile, err := testutil.FindFile(path.Join(assetsDir, test.absPath))\n\t\t\tif err != nil {\n\t\t\t\tt.Fatalf(\"testutil.FindFile failed for %s: %v\", test.absPath, err)\n\t\t\t}\n\n\t\t\tf, err := os.Open(localFile)\n\t\t\tif err != nil {\n\t\t\t\tt.Fatalf(\"os.Open failed for %s: %v\", localFile, err)\n\t\t\t}\n\t\t\tdefer f.Close()\n\n\t\t\t// Read the entire file by reading one byte repeatedly. Doing this stress\n\t\t\t// tests the underlying file reader implementation.\n\t\t\tgot := make([]byte, 1)\n\t\t\twant := make([]byte, 1)\n\t\t\tfor {\n\t\t\t\tn, err := f.Read(want)\n\t\t\t\tfd.Read(ctx, usermem.BytesIOSequence(got), vfs.ReadOptions{})\n\n\t\t\t\tif diff := cmp.Diff(got, want); diff != \"\" {\n\t\t\t\t\tt.Errorf(\"file data mismatch (-want +got):\\n%s\", diff)\n\t\t\t\t}\n\n\t\t\t\t// Make sure there is no more file data left after getting EOF.\n\t\t\t\tif n == 0 || err == io.EOF {\n\t\t\t\t\tif n, _ := fd.Read(ctx, usermem.BytesIOSequence(got), vfs.ReadOptions{}); n != 0 {\n\t\t\t\t\t\tt.Errorf(\"extra unexpected file data in file %s in image %s\", test.absPath, test.image)\n\t\t\t\t\t}\n\n\t\t\t\t\tbreak\n\t\t\t\t}\n\n\t\t\t\tif err != nil {\n\t\t\t\t\tt.Fatalf(\"read failed: %v\", err)\n\t\t\t\t}\n\t\t\t}\n\t\t})\n\t}\n}", "title": "" }, { "docid": "6e5ca2c173c73e13a195180a5013a076", "score": "0.5315115", "text": "func TestMirrorLogExistingFile(t *testing.T) {\n\tcount := testMirrorLogExistingFile(t, false)\n\tif count != 2 {\n\t\tt.Fatalf(\"Expected 2 log entries; got %v\", count)\n\t}\n}", "title": "" }, { "docid": "7d0c90e7ecf68217673fa26e37136f8b", "score": "0.53142303", "text": "func dirMgr01TestCreateCheckFiles03DirFiles() (string, error) {\n ePrefix := \"TestFile: xt_dirmgr_01_test.go Func: dirMgr01TestCreateCheckFiles03DirFiles() \"\n fh := FileHelper{}\n\n origDir := fh.AdjustPathSlash(\"../../checkfiles/checkfiles02/checkfiles03\")\n\n if fh.DoesFileExist(origDir) {\n\n err := os.RemoveAll(origDir)\n\n if err != nil {\n return \"\",\n fmt.Errorf(ePrefix+\"Error returned by os.RemoveAll(origDir). origDir='%v' Error='%v'\", origDir, err.Error())\n }\n\n }\n\n if fh.DoesFileExist(origDir) {\n return \"\", fmt.Errorf(ePrefix+\"Error: Attempted to delete origDir='%v'. However, it still Exists!\", origDir)\n }\n\n // origDir does NOT exist!\n var ModePerm os.FileMode = 0777\n\n err := os.MkdirAll(origDir, ModePerm)\n\n if err != nil {\n return \"\", fmt.Errorf(ePrefix+\"Error returned from os.MkdirAll(origDir, ModePerm). origDir='%v' ModePerm='%v' Error='%v'\", origDir, ModePerm, err.Error())\n }\n\n if !fh.DoesFileExist(origDir) {\n return \"\", fmt.Errorf(ePrefix+\"Error: Failed to create directory! origDir='%v'\", origDir)\n }\n\n fileDir := origDir + string(os.PathSeparator)\n newFile1 := fileDir + \"checkFile30001.txt\"\n fp1, err := os.Create(newFile1)\n\n if err != nil {\n return \"\", fmt.Errorf(ePrefix+\"Error returned from os.Create(newFile1). newFile1='%v' Error='%v' \", newFile1, err.Error())\n }\n\n newFile2 := fileDir + \"checkFile30002.txt\"\n\n fp2, err := os.Create(newFile2)\n\n if err != nil {\n _ = fp1.Close()\n return \"\", fmt.Errorf(ePrefix+\"Error returned from os.Create(newFile2). newFile2='%v' Error='%v' \", newFile2, err.Error())\n }\n\n newFile3 := fileDir + \"checkFile30003.txt\"\n\n fp3, err := os.Create(newFile3)\n\n if err != nil {\n _ = fp1.Close()\n _ = fp2.Close()\n return \"\", fmt.Errorf(ePrefix+\"Error returned from os.Create(newFile3). newFile3='%v' Error='%v' \", newFile3, err.Error())\n }\n\n newFile4 := fileDir + \"checkFile30004.txt\"\n\n fp4, err := os.Create(newFile4)\n\n if err != nil {\n _ = fp1.Close()\n _ = fp2.Close()\n _ = fp3.Close()\n\n return \"\", fmt.Errorf(ePrefix+\"Error returned from os.Create(newFile4). newFile4='%v' Error='%v' \", newFile4, err.Error())\n }\n\n t := time.Now()\n fmtT := t.Format(\"2006-01-02 Mon 15:04:05.000000000 -0700 MST\")\n _, err = fp4.WriteString(fmtT)\n\n if err != nil {\n _ = fp1.Close()\n _ = fp2.Close()\n _ = fp3.Close()\n return \"\", fmt.Errorf(ePrefix+\"%v\", err.Error())\n }\n\n _ = fp1.Close()\n _ = fp2.Close()\n _ = fp3.Close()\n _ = fp4.Close()\n\n return origDir, nil\n}", "title": "" }, { "docid": "08602f13a132176d6d61d385f3afb444", "score": "0.5303733", "text": "func TestReadProceduresFailsWhenInvalidProcedure(t *testing.T) {\n\tmockConfig()\n\tpath.Procedures = func() ([]path.File, error) {\n\t\tfilePath := fmt.Sprintf(\"%s/../fixtures/procedures/invalid-workstation.md\", getRootPath())\n\t\tfileInfo, _ := os.Lstat(filePath)\n\t\treturn []path.File{\n\t\t\t{FullPath: filePath, Info: fileInfo},\n\t\t}, nil\n\t}\n\n\t_, err := ReadProcedures()\n\tif err == nil {\n\t\tt.Fatal(`ReadProcedures() was expected to fail`, err)\n\t}\n}", "title": "" }, { "docid": "e667f2e74dd7f8e38d82bf69109c5380", "score": "0.53031117", "text": "func TestRenameFile(t *testing.T) {\n\n\tinstallFile := \"terraform\"\n\tinstallVersion := \"terraform_\"\n\tinstallPath := \"/.terraform.versions_test/\"\n\tversion := \"0.0.7\"\n\n\tusr, errCurr := user.Current()\n\tif errCurr != nil {\n\t\tlog.Fatal(errCurr)\n\t}\n\tinstallLocation := usr.HomeDir + installPath\n\n\tcreateDirIfNotExist(installLocation)\n\n\tcreateFile(installLocation + installFile)\n\n\tif exist := checkFileExist(installLocation + installFile); exist {\n\t\tt.Logf(\"File exist %v\", installLocation+installFile)\n\t} else {\n\t\tt.Logf(\"File does not exist %v\", installLocation+installFile)\n\t\tt.Error(\"Missing file\")\n\t}\n\n\tlib.RenameFile(installLocation+installFile, installLocation+installVersion+version)\n\n\tif exist := checkFileExist(installLocation + installVersion + version); exist {\n\t\tt.Logf(\"New file exist %v\", installLocation+installVersion+version)\n\t} else {\n\t\tt.Logf(\"New file does not exist %v\", installLocation+installVersion+version)\n\t\tt.Error(\"Missing new file\")\n\t}\n\n\tif exist := checkFileExist(installLocation + installFile); exist {\n\t\tt.Logf(\"Old file should not exist %v\", installLocation+installFile)\n\t\tt.Error(\"Did not rename file\")\n\t} else {\n\t\tt.Logf(\"Old file does not exist %v\", installLocation+installFile)\n\t}\n\n\tcleanUp(installLocation)\n}", "title": "" }, { "docid": "c10c5eee0c9ed9731b045151434c8d97", "score": "0.5295013", "text": "func TestReadNarrativesFailsWhenInvalidNarrative(t *testing.T) {\n\tmockConfig()\n\tpath.Narratives = func() ([]path.File, error) {\n\t\tfilePath := fmt.Sprintf(\"%s/../fixtures/narratives/invalid-control.md\", getRootPath())\n\t\tfileInfo, _ := os.Lstat(filePath)\n\t\treturn []path.File{\n\t\t\t{FullPath: filePath, Info: fileInfo},\n\t\t}, nil\n\t}\n\n\t_, err := ReadNarratives()\n\tif err == nil {\n\t\tt.Fatal(`ReadNarratives() was expected to fail`)\n\t}\n}", "title": "" }, { "docid": "c869cd500fea269fece9e2bcd9e531a7", "score": "0.5283264", "text": "func TestFindBoxJSONFileFail(t *testing.T) {\n\t_, err := findBoxJSONFile(\"http://\", \"name\")\n\tif err == nil {\n\t\tt.Fatal(\"It should've failed\")\n\t}\n}", "title": "" }, { "docid": "cf2840d88581aab7c7c7c0d85fe00ea9", "score": "0.52714044", "text": "func checkDeletedFiles(indexFileInfoMap map[string]FileMetaData, indexMap map[string]int, dirMap map[string]os.FileInfo, indexLines *[]string) {\n for fileName, metadata := range indexFileInfoMap {\n if _, ok := dirMap[fileName]; !ok {\n // file recorded in index.txt, but deleted in dir, version will increase and hashlist update to \"0\"\n index := indexMap[fileName]\n if len(metadata.BlockHashList) == 1 && metadata.BlockHashList[0] == \"0\" {\n (*indexLines)[index] = metadata.Filename + \",\" + strconv.Itoa(metadata.Version) + \",0\"\n } else {\n (*indexLines)[index] = metadata.Filename + \",\" + strconv.Itoa(metadata.Version + 1) + \",0\"\n }\n }\n }\n}", "title": "" }, { "docid": "8f9d3e764843f8b6b60c817746e71905", "score": "0.52566326", "text": "func TestNoValidationFile(t *testing.T) {\n\tsource := &MockSource{}\n\trelease := &Release{\n\t\trepoOwner: \"test\",\n\t\trepoName: \"test\",\n\t\tValidationAssetID: 123,\n\t}\n\tupdater := &Updater{\n\t\tsource: source,\n\t}\n\terr := updater.validate(release, []byte(\"some data\"))\n\tassert.EqualError(t, err, ErrAssetNotFound.Error())\n}", "title": "" }, { "docid": "aec6dc83d27a7c08337a428514eb1977", "score": "0.5250333", "text": "func TestFileExists(t *testing.T) {\n for _, v := range files {\n exists, info := FileExists(v)\n if exists {\n t.Fatalf(\"FileExists %v expected false, got true\", v)\n }\n\n if info != nil {\n t.Fatalf(\"FileExists %v expected nil FileInfo\", v)\n }\n\n log.Printf(\"!FileExists %v: passed\", v)\n }\n}", "title": "" }, { "docid": "55f3dcacf9f838c9461b26fdf3ac7f9d", "score": "0.52497405", "text": "func TestPlatformSpecificFiles(t *testing.T) {\n\topenBMCBuildNames, err := getBuildNames()\n\tif err != nil {\n\t\tt.Fatalf(\"Failed to get build names from repo: %v\", err)\n\t}\n\n\t// buildNameCapturingGroup is a capturing group that captures build name\n\t// values and checks them against existing OpenBMC build names\n\tconst buildNameCapturingGroup = \"(?P<build_name>[^/]+)\"\n\n\t// validPathPatternsMap maps from the subdirectory (relative to\n\t// fileutils.SourceRootDir) to valid patterns for non-`_test.go` .go\n\t// files allowed in that subdirectory\n\tvalidPathPatternsMap := map[string]([]string){\n\t\t\"checks_and_remediations\": []string{\n\t\t\t\"common/(?P<step_name>[0-9]{2}_[^ ]+).go$\",\n\t\t\tfmt.Sprintf(\"%v/(?P<step_name>[0-9]{2}_[^ ]+).go$\", buildNameCapturingGroup),\n\t\t},\n\t\t\"flash_procedure\": []string{\n\t\t\tfmt.Sprintf(\"flash_%v.go$\", buildNameCapturingGroup),\n\t\t},\n\t}\n\n\tfor dir, patterns := range validPathPatternsMap {\n\t\tabsDirPath := filepath.Join(fileutils.SourceRootDir, dir)\n\t\terr := filepath.Walk(absDirPath,\n\t\t\tfunc(path string, info os.FileInfo, err error) error {\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn err\n\t\t\t\t}\n\n\t\t\t\tif info.IsDir() || // skip directories\n\t\t\t\t\t(info.Mode()&os.ModeSymlink == os.ModeSymlink) || // skip symlinks to ignore alias system names.\n\t\t\t\t\tfilepath.Ext(info.Name()) != \".go\" || // skip non .go files\n\t\t\t\t\ttests.IsGoTestFileName(info.Name()) { // skip _test.go files\n\t\t\t\t\treturn nil\n\t\t\t\t}\n\n\t\t\t\t// trim it to try to match the patterns in validPathPatternsMap\n\t\t\t\tsubdirPath := path[len(dir)+1:]\n\n\t\t\t\t// try to match each pattern\n\t\t\t\tfor _, pattern := range patterns {\n\t\t\t\t\tregExMap, err := utils.GetRegexSubexpMap(pattern, subdirPath)\n\t\t\t\t\tif err == nil {\n\t\t\t\t\t\t// if \"build_name\" is present in the map, check if it's\n\t\t\t\t\t\t// in the list of build names of existing OpenBMC platforms\n\t\t\t\t\t\tif buildName, ok := regExMap[\"build_name\"]; ok {\n\t\t\t\t\t\t\tif utils.StringFind(buildName, openBMCBuildNames) == -1 {\n\t\t\t\t\t\t\t\treturn errors.Errorf(\"'%v' file not allowed: %v is not an existing OpenBMC build name\",\n\t\t\t\t\t\t\t\t\tpath, buildName)\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t\treturn nil // test passed\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\treturn errors.Errorf(\"'%v' file not allowed, does not match any of the given patterns: %#v\",\n\t\t\t\t\tpath, patterns)\n\t\t\t})\n\t\tif err != nil {\n\t\t\tt.Errorf(\"Test Platform-specific files failed: %v\", err)\n\t\t}\n\t}\n}", "title": "" }, { "docid": "c083b28059ccd173672536c69bb6e2f3", "score": "0.5244344", "text": "func mustOpen(filename string) *os.File {\n\tfd, err := os.Open(filename)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn fd\n}", "title": "" }, { "docid": "62791715ce78def04570a0b9c6e383eb", "score": "0.52412647", "text": "func Test_RmDir_CanRemoveFile(t *testing.T) {\n\tstore := testConn(t)\n\tdefer store.Close()\n\n\t_, _, err := store.Set(\"/foo\", \"value\", Always)\n\tok(t, err)\n\n\t_, _, err = store.RmDir(\"/foo\", false, Always)\n\tok(t, err)\n\n\t_, err = store.Get(\"/foo\", false)\n\texpectError(t, \"Key not found\", \"/foo\", err)\n}", "title": "" }, { "docid": "40b98c670db3b7e8e3229f746adf01b0", "score": "0.5239881", "text": "func TestTSMReader_VerifiesFileType(t *testing.T) {\n\tdir := mustTempDir()\n\tdefer os.RemoveAll(dir)\n\tf := mustTempFile(dir)\n\tdefer f.Close()\n\n\t// write some garbage\n\tf.Write([]byte{0x23, 0xac, 0x99, 0x22, 0x77, 0x23, 0xac, 0x99, 0x22, 0x77, 0x23, 0xac, 0x99, 0x22, 0x77, 0x23, 0xac, 0x99, 0x22, 0x77})\n\n\t_, err := NewTSMReader(f)\n\tif err == nil {\n\t\tt.Fatal(\"expected error trying to open non-tsm file\")\n\t}\n}", "title": "" }, { "docid": "af8fd01980a84f85efb95503898bc8e8", "score": "0.5238809", "text": "func AssertDeleteNonexistentWorks(gcsCLIPath string, ctx AssertContext) {\n\tsession, err := RunGCSCLI(gcsCLIPath, ctx.ConfigPath,\n\t\t\"delete\", ctx.GCSFileName)\n\tExpect(err).ToNot(HaveOccurred())\n\tExpect(session.ExitCode()).To(BeZero())\n}", "title": "" }, { "docid": "4f2f2ad8edf2cd98bafbc397ab036846", "score": "0.5238755", "text": "func TestOpen_FileTooSmall(t *testing.T) {\n\tpath := tempfile()\n\tdefer os.RemoveAll(path)\n\n\tdb, err := bolt.Open(path, 0600, nil)\n\tif err != nil {\n\t\tt.Fatal(err)\n\t}\n\tpageSize := int64(db.Info().PageSize)\n\tif err = db.Close(); err != nil {\n\t\tt.Fatal(err)\n\t}\n\n\t// corrupt the database\n\tif err = os.Truncate(path, pageSize); err != nil {\n\t\tt.Fatal(err)\n\t}\n\n\t_, err = bolt.Open(path, 0600, nil)\n\tif err == nil || !strings.Contains(err.Error(), \"file size too small\") {\n\t\tt.Fatalf(\"unexpected error: %s\", err)\n\t}\n}", "title": "" }, { "docid": "46158fb6d84fec2e318a73ccd1c4c10c", "score": "0.5235523", "text": "func testKeyManagerRekeyAddAndRevokeDeviceWithConflict(t *testing.T, ver kbfsmd.MetadataVer) {\n\tvar u1, u2 kbname.NormalizedUsername = \"u1\", \"u2\"\n\tconfig1, _, ctx, cancel := kbfsOpsConcurInit(t, u1, u2)\n\tdefer kbfsConcurTestShutdown(ctx, t, config1, cancel)\n\tclock := clocktest.NewTestClockNow()\n\tconfig1.SetClock(clock)\n\n\tconfig1.SetMetadataVersion(ver)\n\n\tconfig2 := ConfigAsUser(config1, u2)\n\tdefer CheckConfigAndShutdown(ctx, t, config2)\n\tsession2, err := config2.KBPKI().GetCurrentSession(ctx)\n\tif err != nil {\n\t\tt.Fatal(err)\n\t}\n\tuid2 := session2.UID\n\n\t// create a shared folder\n\tname := u1.String() + \",\" + u2.String()\n\n\trootNode1 := GetRootNodeOrBust(ctx, t, config1, name, tlf.Private)\n\n\tkbfsOps1 := config1.KBFSOps()\n\n\t// user 1 creates a file\n\t_, _, err = kbfsOps1.CreateFile(ctx, rootNode1, testPPS(\"a\"), false, NoExcl)\n\tif err != nil {\n\t\tt.Fatalf(\"Couldn't create file: %+v\", err)\n\t}\n\terr = kbfsOps1.SyncAll(ctx, rootNode1.GetFolderBranch())\n\tif err != nil {\n\t\tt.Fatalf(\"Couldn't sync file: %+v\", err)\n\t}\n\n\tconfig2Dev2 := ConfigAsUser(config1, u2)\n\tdefer CheckConfigAndShutdown(ctx, t, config2Dev2)\n\n\t// give user 2 a new device\n\tAddDeviceForLocalUserOrBust(t, config1, uid2)\n\tAddDeviceForLocalUserOrBust(t, config2, uid2)\n\tdevIndex := AddDeviceForLocalUserOrBust(t, config2Dev2, uid2)\n\tSwitchDeviceForLocalUserOrBust(t, config2Dev2, devIndex)\n\n\t// user 2 should be unable to read the data now since its device\n\t// wasn't registered when the folder was originally created.\n\tkbfsOps2Dev2 := config2Dev2.KBFSOps()\n\t_, err = GetRootNodeForTest(ctx, config2Dev2, name, tlf.Private)\n\tif _, ok := err.(NeedSelfRekeyError); !ok {\n\t\tt.Fatalf(\"Got unexpected error when reading with new key: %+v\", err)\n\t}\n\n\t// now user 1 should rekey\n\t_, err = RequestRekeyAndWaitForOneFinishEvent(ctx,\n\t\tkbfsOps1, rootNode1.GetFolderBranch().Tlf)\n\tif err != nil {\n\t\tt.Fatalf(\"Couldn't rekey: %+v\", err)\n\t}\n\n\t// this device should be able to read now\n\troot2Dev2 := GetRootNodeOrBust(ctx, t, config2Dev2, name, tlf.Private)\n\n\t// Now revoke the original user 2 device\n\tclock.Add(1 * time.Minute)\n\tRevokeDeviceForLocalUserOrBust(t, config1, uid2, 0)\n\tRevokeDeviceForLocalUserOrBust(t, config2Dev2, uid2, 0)\n\n\t// Stall user 1's rekey, to ensure a conflict.\n\tonPutStalledCh, putUnstallCh, putCtx :=\n\t\tStallMDOp(ctx, config1, StallableMDPut, 1)\n\n\t// Have user 1 also try to rekey but fail due to conflict\n\terrChan := make(chan error, 1)\n\tgo func() {\n\t\t_, err := RequestRekeyAndWaitForOneFinishEvent(putCtx, kbfsOps1, rootNode1.GetFolderBranch().Tlf)\n\t\terrChan <- err\n\t}()\n\tselect {\n\tcase <-ctx.Done():\n\t\tt.Fatal(ctx.Err())\n\tcase <-onPutStalledCh:\n\t}\n\n\t// rekey again but with user 2 device 2\n\t_, err = RequestRekeyAndWaitForOneFinishEvent(ctx,\n\t\tkbfsOps2Dev2, root2Dev2.GetFolderBranch().Tlf)\n\tif err != nil {\n\t\tt.Fatalf(\"Couldn't rekey: %+v\", err)\n\t}\n\n\t// Make sure user 1's rekey failed.\n\tselect {\n\tcase <-ctx.Done():\n\t\tt.Fatal(ctx.Err())\n\tcase putUnstallCh <- struct{}{}:\n\t}\n\tselect {\n\tcase <-ctx.Done():\n\t\tt.Fatal(ctx.Err())\n\tcase err = <-errChan:\n\t}\n\tif _, isConflict := err.(RekeyConflictError); !isConflict {\n\t\tt.Fatalf(\"Expected failure due to conflict\")\n\t}\n\n\terr = kbfsOps2Dev2.SyncFromServer(ctx,\n\t\troot2Dev2.GetFolderBranch(), nil)\n\tif err != nil {\n\t\tt.Fatalf(\"Couldn't sync from server: %+v\", err)\n\t}\n\n\t// force re-encryption of the root dir\n\t_, _, err = kbfsOps2Dev2.CreateFile(\n\t\tctx, root2Dev2, testPPS(\"b\"), false, NoExcl)\n\tif err != nil {\n\t\tt.Fatalf(\"Couldn't create file: %+v\", err)\n\t}\n\terr = kbfsOps2Dev2.SyncAll(ctx, root2Dev2.GetFolderBranch())\n\tif err != nil {\n\t\tt.Fatalf(\"Couldn't sync file: %+v\", err)\n\t}\n\n\t// device 1 should still work\n\terr = kbfsOps1.SyncFromServer(ctx,\n\t\trootNode1.GetFolderBranch(), nil)\n\tif err != nil {\n\t\tt.Fatalf(\"Couldn't sync from server: %+v\", err)\n\t}\n\n\trootNode1 = GetRootNodeOrBust(ctx, t, config1, name, tlf.Private)\n\n\tchildren, err := kbfsOps1.GetDirChildren(ctx, rootNode1)\n\trequire.NoError(t, err)\n\tif _, ok := children[rootNode1.ChildName(\"b\")]; !ok {\n\t\tt.Fatalf(\"Device 1 couldn't see the new dir entry\")\n\t}\n}", "title": "" }, { "docid": "e0034e32729e78e0239c1b5338ef7116", "score": "0.52353305", "text": "func TestGetCorruptFileAfterPut(t *testing.T) {\n\tconst filesize = 1024\n\tvar (\n\t\tnum = 2\n\t\tfilenameCh = make(chan string, num)\n\t\terrCh = make(chan error, 100)\n\t\tbck = cmn.Bck{\n\t\t\tName: TestBucketName,\n\t\t\tProvider: cmn.ProviderAIS,\n\t\t}\n\t\tproxyURL = tutils.RandomProxyURL()\n\t\tbaseParams = tutils.BaseAPIParams(proxyURL)\n\t\tcksumType = cmn.DefaultBucketProps().Cksum.Type\n\t)\n\tif containers.DockerRunning() {\n\t\tt.Skip(fmt.Sprintf(\"%q requires setting Xattrs, doesn't work with docker\", t.Name()))\n\t}\n\n\ttutils.CreateFreshBucket(t, proxyURL, bck)\n\tdefer tutils.DestroyBucket(t, proxyURL, bck)\n\n\ttutils.PutRandObjs(proxyURL, bck, SmokeStr, filesize, num, errCh, filenameCh, cksumType)\n\ttassert.SelectErr(t, errCh, \"put\", false)\n\tclose(filenameCh)\n\tclose(errCh)\n\n\t// Test corrupting the file contents\n\t// Note: The following tests can only work when running on a local setup(targets are co-located with\n\t// where this test is running from, because it searches a local file system)\n\tobjName := <-filenameCh\n\tfqn := findObjOnDisk(bck, objName)\n\ttutils.Logf(\"Corrupting file data[%s]: %s\\n\", objName, fqn)\n\terr := ioutil.WriteFile(fqn, []byte(\"this file has been corrupted\"), 0644)\n\ttassert.CheckFatal(t, err)\n\t_, err = api.GetObjectWithValidation(baseParams, bck, path.Join(SmokeStr, objName))\n\tif err == nil {\n\t\tt.Error(\"Error is nil, expected non-nil error on a a GET for an object with corrupted contents\")\n\t}\n}", "title": "" }, { "docid": "a901db8c4ce0d6291bd01b3f68873750", "score": "0.52222836", "text": "func TestMirrorLogExistingFileButNewQueueManager(t *testing.T) {\n\tcount := testMirrorLogExistingFile(t, true)\n\tif count != 3 {\n\t\tt.Fatalf(\"Expected 3 log entries; got %v\", count)\n\t}\n}", "title": "" }, { "docid": "0fb86bbe8ff557a030cb0c2e671adc02", "score": "0.5203831", "text": "func TestWriteFolderToTarPackageFailure2(t *testing.T) {\n\tsrcPath := filepath.Join(\"testdata\", \"BadMetadataInvalidIndex\")\n\tbuf := bytes.NewBuffer(nil)\n\tgw := gzip.NewWriter(buf)\n\ttw := tar.NewWriter(gw)\n\n\terr := WriteFolderToTarPackage(tw, srcPath, []string{}, nil, nil)\n\trequire.Error(t, err, \"Should have received error writing folder to package\")\n\trequire.Contains(t, err.Error(), \"Index metadata file [META-INF/statedb/couchdb/indexes/bad.json] is not a valid JSON\")\n\n\ttw.Close()\n\tgw.Close()\n}", "title": "" }, { "docid": "f0470ced28666a1b353df2a810f259e0", "score": "0.52033186", "text": "func VerifyExistence(t *testing.T, path string) bool {\n\tt.Helper()\n\t// Check if file can be stat()ed\n\tstat := true\n\tfi, err := os.Stat(path)\n\tif err != nil {\n\t\tstat = false\n\t}\n\t// Check if file can be opened\n\topen := true\n\tfd, err := os.Open(path)\n\tif err != nil {\n\t\topen = false\n\t}\n\tfd.Close()\n\t// Check if file shows up in directory listing\n\treaddir := false\n\tdir := filepath.Dir(path)\n\tname := filepath.Base(path)\n\td, err := os.Open(dir)\n\tif err != nil && open {\n\t\tt.Errorf(\"VerifyExistence: we can open the file but not the parent dir!? err=%v\", err)\n\t} else if err == nil {\n\t\tdefer d.Close()\n\t\tlisting, err := d.Readdirnames(0)\n\t\tif stat && fi.IsDir() && err != nil {\n\t\t\tt.Errorf(\"VerifyExistence: It's a directory, but readdirnames failed: %v\", err)\n\t\t}\n\t\tfor _, entry := range listing {\n\t\t\tif entry == name {\n\t\t\t\treaddir = true\n\t\t\t}\n\t\t}\n\t}\n\t// If the result is consistent, return it.\n\tif stat == open && open == readdir {\n\t\treturn stat\n\t}\n\tt.Errorf(\"VerifyExistence: inconsistent result on %q: stat=%v open=%v readdir=%v, path=%q\", name, stat, open, readdir, path)\n\treturn false\n}", "title": "" }, { "docid": "6bfe2f02318a3a42edf58a7721ce214e", "score": "0.52003497", "text": "func TestFindFileInDir(t *testing.T) {\n\tnonExistentDirName := \"invalid_dir\"\n\tvalidDirNameWithDaprYAMLFile := \"valid_dir\"\n\tvalidDirWithNoDaprYAML := \"valid_dir_no_dapr_yaml\"\n\n\tdirName := createTempDir(t, \"test_find_file_in_dir\")\n\tt.Cleanup(func() {\n\t\tcleanupTempDir(t, dirName)\n\t})\n\n\terr := os.Mkdir(filepath.Join(dirName, validDirNameWithDaprYAMLFile), 0o755)\n\tassert.NoError(t, err)\n\n\terr = os.Mkdir(filepath.Join(dirName, validDirWithNoDaprYAML), 0o755)\n\tassert.NoError(t, err)\n\n\tfl, err := os.Create(filepath.Join(dirName, validDirNameWithDaprYAMLFile, \"dapr.yaml\"))\n\tassert.NoError(t, err)\n\tfl.Close()\n\n\tfl, err = os.Create(filepath.Join(dirName, validDirNameWithDaprYAMLFile, \"test1.yaml\"))\n\tassert.NoError(t, err)\n\tfl.Close()\n\n\ttestcases := []struct {\n\t\tname string\n\t\tinput string\n\t\texpectedErr bool\n\t\texpectedFilePath string\n\t}{\n\t\t{\n\t\t\tname: \"valid directory path with dapr.yaml file\",\n\t\t\tinput: filepath.Join(dirName, validDirNameWithDaprYAMLFile),\n\t\t\texpectedErr: false,\n\t\t\texpectedFilePath: filepath.Join(dirName, validDirNameWithDaprYAMLFile, \"dapr.yaml\"),\n\t\t},\n\t\t{\n\t\t\tname: \"valid directory path with no dapr.yaml file\",\n\t\t\tinput: filepath.Join(dirName, validDirWithNoDaprYAML),\n\t\t\texpectedErr: true,\n\t\t\texpectedFilePath: \"\",\n\t\t},\n\t\t{\n\t\t\tname: \"non existent dir\",\n\t\t\tinput: nonExistentDirName,\n\t\t\texpectedErr: true,\n\t\t\texpectedFilePath: \"\",\n\t\t},\n\t}\n\tfor _, tc := range testcases {\n\t\ttc := tc\n\t\tt.Run(tc.name, func(t *testing.T) {\n\t\t\tt.Parallel()\n\t\t\tfilePath, err := FindFileInDir(tc.input, \"dapr.yaml\")\n\t\t\tassert.Equal(t, tc.expectedErr, err != nil)\n\t\t\tassert.Equal(t, tc.expectedFilePath, filePath)\n\t\t})\n\t}\n}", "title": "" }, { "docid": "64b7c99802f49415d7a55d2600abe26d", "score": "0.5197009", "text": "func TestIsFileExisting(t *testing.T) {\n\t// given\n\ttempFile, _ := os.Create(\"temp.yaml\")\n\tt.Cleanup(func() {\n\t\ttempFile.Close()\n\t\tos.Remove(\"temp.yaml\")\n\t})\n\ttestcases := []struct {\n\t\tname string\n\t\tfilePath string\n\t\tisError bool\n\t}{\n\t\t{\n\t\t\tname: \"success: file exists\",\n\t\t\tfilePath: \"./temp.yaml\",\n\t\t\tisError: false,\n\t\t},\n\t\t{\n\t\t\tname: \"failure: file does not exist\",\n\t\t\tfilePath: \"./temp1.yaml\",\n\t\t\tisError: true,\n\t\t},\n\t}\n\tfor _, tc := range testcases {\n\t\t// when\n\t\tisExist, _ := handler.IsFileExisting(tc.filePath)\n\t\t// then\n\t\tif tc.isError {\n\t\t\tassert.False(t, isExist)\n\t\t} else {\n\t\t\tassert.True(t, isExist)\n\t\t}\n\t}\n}", "title": "" }, { "docid": "0a15f3a9181e0b081046d07d4876c36f", "score": "0.5191875", "text": "func TestPReadUnmodifiedFileSucceeds(t *testing.T) {\n\tfor _, alg := range hashAlgs {\n\t\tvfsObj, root, ctx, err := newVerityRoot(t, alg)\n\t\tif err != nil {\n\t\t\tt.Fatalf(\"newVerityRoot: %v\", err)\n\t\t}\n\n\t\tfilename := \"verity-test-file\"\n\t\tfd, size, err := newFileFD(ctx, vfsObj, root, filename, 0644)\n\t\tif err != nil {\n\t\t\tt.Fatalf(\"newFileFD: %v\", err)\n\t\t}\n\n\t\t// Enable verity on the file and confirm a normal read succeeds.\n\t\tvar args arch.SyscallArguments\n\t\targs[1] = arch.SyscallArgument{Value: linux.FS_IOC_ENABLE_VERITY}\n\t\tif _, err := fd.Ioctl(ctx, nil /* uio */, args); err != nil {\n\t\t\tt.Fatalf(\"Ioctl: %v\", err)\n\t\t}\n\n\t\tbuf := make([]byte, size)\n\t\tn, err := fd.PRead(ctx, usermem.BytesIOSequence(buf), 0 /* offset */, vfs.ReadOptions{})\n\t\tif err != nil && err != io.EOF {\n\t\t\tt.Fatalf(\"fd.PRead: %v\", err)\n\t\t}\n\n\t\tif n != int64(size) {\n\t\t\tt.Errorf(\"fd.PRead got read length %d, want %d\", n, size)\n\t\t}\n\t}\n}", "title": "" }, { "docid": "ba526b2ed14d6274e24e77a28c5201d5", "score": "0.51858836", "text": "func assertFilesNotCommitted(t *testing.T, jirix *jiri.X, files []string) {\n\tassertFilesExist(t, jirix, files)\n\tfor _, file := range files {\n\t\tif gitutil.New(jirix.NewSeq()).IsFileCommitted(file) {\n\t\t\tt.Fatalf(\"expected file %v not to be committed but it is\", file)\n\t\t}\n\t}\n}", "title": "" }, { "docid": "498788bf777f0b9cfa324ec66065c72a", "score": "0.51856506", "text": "func testFileWriteErr(t testing.TB) {\n\tfile := NewFile().SetHeader(mockFileHeader())\n\tentry := mockEntryDetail()\n\tentry.AddAddenda(mockAddenda05())\n\tbatch := NewBatchPPD(mockBatchPPDHeader())\n\tbatch.SetHeader(mockBatchHeader())\n\tbatch.AddEntry(entry)\n\tbatch.Create()\n\tfile.AddBatch(batch)\n\n\tif err := file.Create(); err != nil {\n\t\tt.Errorf(\"%T: %s\", err, err)\n\t}\n\tif err := file.Validate(); err != nil {\n\t\tt.Errorf(\"%T: %s\", err, err)\n\t}\n\n\tfile.Batches[0].GetControl().EntryAddendaCount = 10\n\n\tb := &bytes.Buffer{}\n\tf := NewWriter(b)\n\n\tif err := f.Write(file); err != nil {\n\t\tif e, ok := err.(*FileError); ok {\n\t\t\tif e.FieldName != \"EntryAddendaCount\" {\n\t\t\t\tt.Errorf(\"%T: %s\", err, err)\n\t\t\t}\n\t\t} else {\n\t\t\tt.Errorf(\"%T: %s\", err, err)\n\t\t}\n\t}\n}", "title": "" }, { "docid": "7b34d3707d2fa19960c99ef9d6ad4cd1", "score": "0.5178594", "text": "func TestCheckLoadFails(t *testing.T) {\n\tunittest.MediumTest(t)\n\n\twd, cleanup := testutils.TempDir(t)\n\tdefer cleanup()\n\n\tauth, _, _, _ := makeMocks()\n\n\t// This should not work\n\t_, err := LoadCloudClient(auth, wd)\n\tassert.Error(t, err)\n\tassert.Contains(t, err.Error(), \"from disk\")\n}", "title": "" }, { "docid": "5733a216986fa1c28467ab2a056e9714", "score": "0.5177569", "text": "func TestOpen_MetaInitWriteError(t *testing.T) {\n\tt.Skip(\"pending\")\n}", "title": "" }, { "docid": "7031ade4ff0b14b87f6f0ed1eeaa6618", "score": "0.51743734", "text": "func (fs *filesystem) verifyStat(ctx context.Context, d *dentry, stat linux.Statx) error {\n\tvfsObj := fs.vfsfs.VirtualFilesystem()\n\n\t// Get the path to the child dentry. This is only used to provide path\n\t// information in failure case.\n\tchildPath, err := vfsObj.PathnameWithDeleted(ctx, d.fs.rootDentry.lowerVD, d.lowerVD)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tfs.verityMu.RLock()\n\tdefer fs.verityMu.RUnlock()\n\n\tfd, err := vfsObj.OpenAt(ctx, fs.creds, &vfs.PathOperation{\n\t\tRoot: d.lowerMerkleVD,\n\t\tStart: d.lowerMerkleVD,\n\t}, &vfs.OpenOptions{\n\t\tFlags: linux.O_RDONLY,\n\t})\n\tif err == syserror.ENOENT {\n\t\treturn alertIntegrityViolation(fmt.Sprintf(\"Failed to open merkle file for %s: %v\", childPath, err))\n\t}\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tmerkleSize, err := fd.GetXattr(ctx, &vfs.GetXattrOptions{\n\t\tName: merkleSizeXattr,\n\t\tSize: sizeOfStringInt32,\n\t})\n\n\tif err == syserror.ENODATA {\n\t\treturn alertIntegrityViolation(fmt.Sprintf(\"Failed to get xattr %s for merkle file of %s: %v\", merkleSizeXattr, childPath, err))\n\t}\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tsize, err := strconv.Atoi(merkleSize)\n\tif err != nil {\n\t\treturn alertIntegrityViolation(fmt.Sprintf(\"Failed to convert xattr %s for %s to int: %v\", merkleSizeXattr, childPath, err))\n\t}\n\n\tfdReader := vfs.FileReadWriteSeeker{\n\t\tFD: fd,\n\t\tCtx: ctx,\n\t}\n\n\tvar buf bytes.Buffer\n\tparams := &merkletree.VerifyParams{\n\t\tOut: &buf,\n\t\tTree: &fdReader,\n\t\tSize: int64(size),\n\t\tName: d.name,\n\t\tMode: uint32(stat.Mode),\n\t\tUID: stat.UID,\n\t\tGID: stat.GID,\n\t\t//TODO(b/156980949): Support passing other hash algorithms.\n\t\tHashAlgorithms: fs.alg.toLinuxHashAlg(),\n\t\tReadOffset: 0,\n\t\t// Set read size to 0 so only the metadata is verified.\n\t\tReadSize: 0,\n\t\tExpected: d.hash,\n\t\tDataAndTreeInSameFile: false,\n\t}\n\tif atomic.LoadUint32(&d.mode)&linux.S_IFMT == linux.S_IFDIR {\n\t\tparams.DataAndTreeInSameFile = true\n\t}\n\n\tif _, err := merkletree.Verify(params); err != nil && err != io.EOF {\n\t\treturn alertIntegrityViolation(fmt.Sprintf(\"Verification stat for %s failed: %v\", childPath, err))\n\t}\n\td.mode = uint32(stat.Mode)\n\td.uid = stat.UID\n\td.gid = stat.GID\n\td.size = uint32(size)\n\treturn nil\n}", "title": "" }, { "docid": "b594018f3b80fbe5b5abbe53af5aab3d", "score": "0.5161844", "text": "func TestIsFileExist1(t *testing.T) {\n\tisFileExist := IsFileExist(\"random-string\")\n\tif isFileExist {\n\t\tt.Errorf(\"Expected '%t' for a file that does not exist, got '%t' instead\\n\", false, true)\n\t}\n}", "title": "" }, { "docid": "9feb4e69da66a3ca50348a1c28410452", "score": "0.51608646", "text": "func mustOpen(file string) (f *os.File) {\n\tvar err error\n\tf, err = os.Open(file)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn\n}", "title": "" }, { "docid": "10b14ff0af275e08dea037ac63235c44", "score": "0.5157262", "text": "func TestIfFileIsReadable(t *testing.T) {\n\t//Create the file.\n\treadWriteFilePath := path.Join(os.TempDir(), FILE_WITH_READ_PERMISSION)\n\treadWriteFile, err := os.Create(readWriteFilePath)\n\tif err != nil {\n\t\tt.Fatal(err)\n\t}\n\t//Change the permissions that only the owner can read and write it.\n\treadWriteFile.Chmod(0600)\n\tif readable, _ := utils.CheckIfFileIsReadable(readWriteFilePath); !readable {\n\t\tos.Remove(readWriteFile.Name())\n\t\tt.Error(\"The file: \\\"\" + readWriteFilePath + \"\\\" should be readable but an error occured during the check.\")\n\t}\n\tos.Remove(readWriteFile.Name())\n\t//Create the file.\n\twithoutReadWriteFilePath := path.Join(os.TempDir(), FILE_WITHOUT_READ_WRITE_PERMISSION)\n\tfile, err := os.Create(withoutReadWriteFilePath)\n\tif err != nil {\n\t\tt.Fatal(err)\n\t}\n\t//Change the permissions that only the owner can read it.\n\tfile.Chmod(0200)\n\t//Remove the file after checking. If a error occures and of not...\n\tif readable, _ := utils.CheckIfFileIsReadable(withoutReadWriteFilePath); readable {\n\t\tos.Remove(file.Name())\n\t\tt.Error(\"The file: \\\"\" + withoutReadWriteFilePath + \"\\\" is not readable but no error occured during the check.\")\n\t}\n\tos.Remove(file.Name())\n}", "title": "" }, { "docid": "58b9ecdec12a2fa07a2050643a32d572", "score": "0.51502895", "text": "func Test_log_openLogFile_2(t *testing.T) {\n\twrc, err := openLogFile(\"\\\\:/\")\n\tif wrc != nil {\n\t\tt.Error(\"0xEC8BA1\")\n\t}\n\tif !matchError(err, \"ERROR 0x\") {\n\t\tt.Error(\"0xEE9DE4\", \"wrong error:\", err)\n\t}\n}", "title": "" }, { "docid": "be597de876c8a494e7b048b7d9d2e0bb", "score": "0.51484925", "text": "func AssertWrongKeyEncryptionFails(gcsCLIPath string, ctx AssertContext) {\n\tExpect(ctx.Config.EncryptionKey).ToNot(BeNil(),\n\t\t\"Need encryption key for test\")\n\n\tsession, err := RunGCSCLI(gcsCLIPath, ctx.ConfigPath,\n\t\t\"put\", ctx.ContentFile, ctx.GCSFileName)\n\tExpect(err).ToNot(HaveOccurred())\n\tExpect(session.ExitCode()).To(BeZero())\n\n\t_, gcsClient, err := client.NewSDK(*ctx.Config)\n\tExpect(err).ToNot(HaveOccurred())\n\tblobstoreClient, err := client.New(context.Background(),\n\t\tgcsClient, ctx.Config)\n\tExpect(err).ToNot(HaveOccurred())\n\n\tctx.Config.EncryptionKey[0]++\n\n\tvar target bytes.Buffer\n\terr = blobstoreClient.Get(ctx.GCSFileName, &target)\n\tExpect(err).To(HaveOccurred())\n\n\tsession, err = RunGCSCLI(gcsCLIPath, ctx.ConfigPath,\n\t\t\"delete\", ctx.GCSFileName)\n\tExpect(err).ToNot(HaveOccurred())\n\tExpect(session.ExitCode()).To(BeZero())\n}", "title": "" }, { "docid": "e9b1551213adccb43bfa7b60f19295ab", "score": "0.5140343", "text": "func TestGenerateRCFile_ErrIfCannotRead(t *testing.T) {\n\ttmp := t.TempDir()\n\n\trcFile := filepath.Join(tmp, \".terraformrc\")\n\terr := os.WriteFile(rcFile, []byte(\"can't see me!\"), 0000)\n\tOk(t, err)\n\n\texpErr := fmt.Sprintf(\"trying to read %s to ensure we're not overwriting it: open %s: permission denied\", rcFile, rcFile)\n\tactErr := generateRCFile(\"token\", \"hostname\", tmp)\n\tErrEquals(t, expErr, actErr)\n}", "title": "" }, { "docid": "4f241276797b273aeeefa5d8a64f6e9d", "score": "0.5135731", "text": "func TestOpenFailedDueToLoadTableErr(t *testing.T) {\n\ttl := syslogger.NewTestLogger()\n\tdefer tl.Close()\n\tdb := fakesqldb.New(t)\n\tdefer db.Close()\n\tschematest.AddDefaultQueries(db)\n\tdb.AddQueryPattern(baseShowTablesPattern, &sqltypes.Result{\n\t\tFields: mysql.BaseShowTablesFields,\n\t\tRows: [][]sqltypes.Value{\n\t\t\tmysql.BaseShowTablesRow(\"test_table\", false, \"\"),\n\t\t\tmysql.BaseShowTablesRow(\"test_view\", true, \"VIEW\"),\n\t\t},\n\t})\n\t// this will cause NewTable error, as it expects zero rows.\n\tdb.MockQueriesForTable(\"test_table\", sqltypes.MakeTestResult(sqltypes.MakeTestFields(\"foo\", \"varchar\"), \"\"))\n\n\t// adding column query for table_view\n\tdb.AddQueryPattern(fmt.Sprintf(mysql.GetColumnNamesQueryPatternForTable, \"test_view\"),\n\t\tsqltypes.MakeTestResult(sqltypes.MakeTestFields(\"column_name\", \"varchar\"), \"\"))\n\t// rejecting the impossible query\n\tdb.AddRejectedQuery(\"SELECT * FROM `fakesqldb`.`test_view` WHERE 1 != 1\", sqlerror.NewSQLErrorFromError(errors.New(\"The user specified as a definer ('root'@'%') does not exist (errno 1449) (sqlstate HY000)\")))\n\n\tAddFakeInnoDBReadRowsResult(db, 0)\n\tse := newEngine(10, 1*time.Second, 1*time.Second, 0, db)\n\terr := se.Open()\n\t// failed load should return an error because of test_table\n\tassert.ErrorContains(t, err, \"Row count exceeded\")\n\n\tlogs := tl.GetAllLogs()\n\tlogOutput := strings.Join(logs, \":::\")\n\tassert.Contains(t, logOutput, \"WARNING:Failed reading schema for the view: test_view\")\n\tassert.Contains(t, logOutput, \"The user specified as a definer ('root'@'%') does not exist (errno 1449) (sqlstate HY000)\")\n}", "title": "" }, { "docid": "3896c7454d14aa559ee107e79a471536", "score": "0.5134685", "text": "func TestWriteLoadDeletePods(t *testing.T) {\n\ttestPods := []struct {\n\t\tpod *v1.Pod\n\t\twritten bool\n\t}{\n\t\t{\n\t\t\tpod: &v1.Pod{\n\t\t\t\tObjectMeta: metav1.ObjectMeta{\n\t\t\t\t\tName: \"Foo\",\n\t\t\t\t\tAnnotations: map[string]string{core.BootstrapCheckpointAnnotationKey: \"true\"},\n\t\t\t\t\tUID: \"1\",\n\t\t\t\t},\n\t\t\t},\n\t\t\twritten: true,\n\t\t},\n\t\t{\n\t\t\tpod: &v1.Pod{\n\t\t\t\tObjectMeta: metav1.ObjectMeta{\n\t\t\t\t\tName: \"Foo2\",\n\t\t\t\t\tAnnotations: map[string]string{core.BootstrapCheckpointAnnotationKey: \"true\"},\n\t\t\t\t\tUID: \"2\",\n\t\t\t\t},\n\t\t\t},\n\t\t\twritten: true,\n\t\t},\n\t\t{\n\t\t\tpod: &v1.Pod{\n\t\t\t\tObjectMeta: metav1.ObjectMeta{\n\t\t\t\t\tName: \"Bar\",\n\t\t\t\t\tUID: \"3\",\n\t\t\t\t},\n\t\t\t},\n\t\t\twritten: false,\n\t\t},\n\t}\n\n\tdir, err := ioutil.TempDir(\"\", \"checkpoint\")\n\tif err != nil {\n\t\tt.Errorf(\"Failed to allocate temp directory for TestWriteLoadDeletePods error=%v\", err)\n\t}\n\tdefer os.RemoveAll(dir)\n\n\tcpm, err := checkpointmanager.NewCheckpointManager(dir)\n\tif err != nil {\n\t\tt.Errorf(\"Failed to initialize checkpoint manager error=%v\", err)\n\t}\n\tfor _, p := range testPods {\n\t\t// Write pods should always pass unless there is an fs error\n\t\tif err := WritePod(cpm, p.pod); err != nil {\n\t\t\tt.Errorf(\"Failed to Write Pod: %v\", err)\n\t\t}\n\t}\n\t// verify the correct written files are loaded from disk\n\tpods, err := LoadPods(cpm)\n\tif err != nil {\n\t\tt.Errorf(\"Failed to Load Pods: %v\", err)\n\t}\n\t// loop through contents and check make sure\n\t// what was loaded matched the expected results.\n\tfor _, p := range testPods {\n\t\tpname := p.pod.GetName()\n\t\tvar lpod *v1.Pod\n\t\tfor _, check := range pods {\n\t\t\tif check.GetName() == pname {\n\t\t\t\tlpod = check\n\t\t\t\tbreak\n\t\t\t}\n\t\t}\n\t\tif p.written {\n\t\t\tif lpod != nil {\n\t\t\t\tif !reflect.DeepEqual(p.pod, lpod) {\n\t\t\t\t\tt.Errorf(\"expected %#v, \\ngot %#v\", p.pod, lpod)\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tt.Errorf(\"Got unexpected result for %v, should have been loaded\", pname)\n\t\t\t}\n\t\t} else if lpod != nil {\n\t\t\tt.Errorf(\"Got unexpected result for %v, should not have been loaded\", pname)\n\t\t}\n\t\terr = DeletePod(cpm, p.pod)\n\t\tif err != nil {\n\t\t\tt.Errorf(\"Failed to delete pod %v\", pname)\n\t\t}\n\t}\n\t// finally validate the contents of the directory is empty.\n\tfiles, err := ioutil.ReadDir(dir)\n\tif err != nil {\n\t\tt.Errorf(\"Failed to read directory %v\", dir)\n\t}\n\tif len(files) > 0 {\n\t\tt.Errorf(\"Directory %v should be empty but found %#v\", dir, files)\n\t}\n}", "title": "" }, { "docid": "b74ed4f1490f52d696009b8cee233d43", "score": "0.51290405", "text": "func TestSymlinkToFile(t *testing.T) {\n\tif err := os.Symlink(\"foo.tar.gz\", \"foo.tar.gz.sym\"); err != nil {\n\t\tt.Errorf(\"could not create a symlink: %s\", err)\n\t}\n\n\texpected := map[string]interface{}{\n\t\t\"foo.tar.gz.sym\": map[string]interface{}{\n\t\t\t\"sha256\": \"52947cb78b91ad01fe81cd6aef42d1f6817e92b9e6936c1e5aabb7c98514f355\",\n\t\t},\n\t}\n\tresult, err := RecordArtifacts([]string{\"foo.tar.gz.sym\"}, []string{\"sha256\"}, nil, nil, testOSisWindows(), false)\n\tif !reflect.DeepEqual(result, expected) {\n\t\tt.Errorf(\"RecordArtifacts returned '(%s, %s)', expected '(%s, nil)'\",\n\t\t\tresult, err, expected)\n\t}\n\n\tif err := os.Remove(\"foo.tar.gz.sym\"); err != nil {\n\t\tt.Errorf(\"could not remove foo.tar.gz.sym: %s\", err)\n\t}\n}", "title": "" }, { "docid": "2741702b886950288fa1cad1102ade26", "score": "0.5127914", "text": "func checkVerifyInvalidTOCEntryFail(filename string) check {\n\treturn func(t *testing.T, sgzData []byte, tocDigest digest.Digest, dgstMap map[string]digest.Digest, controller TestingController, newController TestingControllerFactory) {\n\t\tfuncs := map[string]rewriteFunc{\n\t\t\t\"lost digest in a entry\": func(t *testing.T, toc *JTOC, sgz *io.SectionReader) {\n\t\t\t\tvar found bool\n\t\t\t\tfor _, e := range toc.Entries {\n\t\t\t\t\tif cleanEntryName(e.Name) == filename {\n\t\t\t\t\t\tif e.Type != \"reg\" && e.Type != \"chunk\" {\n\t\t\t\t\t\t\tt.Fatalf(\"entry %q to break must be regfile or chunk\", filename)\n\t\t\t\t\t\t}\n\t\t\t\t\t\tif e.ChunkDigest == \"\" {\n\t\t\t\t\t\t\tt.Fatalf(\"entry %q is already invalid\", filename)\n\t\t\t\t\t\t}\n\t\t\t\t\t\te.ChunkDigest = \"\"\n\t\t\t\t\t\tfound = true\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tif !found {\n\t\t\t\t\tt.Fatalf(\"rewrite target not found\")\n\t\t\t\t}\n\t\t\t},\n\t\t\t\"duplicated entry offset\": func(t *testing.T, toc *JTOC, sgz *io.SectionReader) {\n\t\t\t\tvar (\n\t\t\t\t\tsampleEntry *TOCEntry\n\t\t\t\t\ttargetEntry *TOCEntry\n\t\t\t\t)\n\t\t\t\tfor _, e := range toc.Entries {\n\t\t\t\t\tif e.Type == \"reg\" || e.Type == \"chunk\" {\n\t\t\t\t\t\tif cleanEntryName(e.Name) == filename {\n\t\t\t\t\t\t\ttargetEntry = e\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tsampleEntry = e\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tif sampleEntry == nil {\n\t\t\t\t\tt.Fatalf(\"TOC must contain at least one regfile or chunk entry other than the rewrite target\")\n\t\t\t\t}\n\t\t\t\tif targetEntry == nil {\n\t\t\t\t\tt.Fatalf(\"rewrite target not found\")\n\t\t\t\t}\n\t\t\t\ttargetEntry.Offset = sampleEntry.Offset\n\t\t\t},\n\t\t}\n\n\t\tfor name, rFunc := range funcs {\n\t\t\tt.Run(name, func(t *testing.T) {\n\t\t\t\tnewSgz, newTocDigest := rewriteTOCJSON(t, io.NewSectionReader(bytes.NewReader(sgzData), 0, int64(len(sgzData))), rFunc, controller)\n\t\t\t\tbuf := new(bytes.Buffer)\n\t\t\t\tif _, err := io.Copy(buf, newSgz); err != nil {\n\t\t\t\t\tt.Fatalf(\"failed to get converted stargz\")\n\t\t\t\t}\n\t\t\t\tisgz := buf.Bytes()\n\n\t\t\t\tsgz, err := Open(\n\t\t\t\t\tio.NewSectionReader(bytes.NewReader(isgz), 0, int64(len(isgz))),\n\t\t\t\t\tWithDecompressors(controller),\n\t\t\t\t)\n\t\t\t\tif err != nil {\n\t\t\t\t\tt.Fatalf(\"failed to parse converted stargz: %v\", err)\n\t\t\t\t\treturn\n\t\t\t\t}\n\t\t\t\t_, err = sgz.VerifyTOC(newTocDigest)\n\t\t\t\tif err == nil {\n\t\t\t\t\tt.Errorf(\"must fail for invalid TOC\")\n\t\t\t\t\treturn\n\t\t\t\t}\n\t\t\t})\n\t\t}\n\t}\n}", "title": "" } ]
fe16b5747819c57b3557cdda93b4bf45
SnapshotRoot returns fs.Entry representing the root of a snapshot.
[ { "docid": "437d67dfc68967c1be3c6083c6c56029", "score": "0.8371749", "text": "func SnapshotRoot(rep *repo.Repository, man *snapshot.Manifest) (fs.Entry, error) {\n\toid := man.RootObjectID()\n\tif oid == \"\" {\n\t\treturn nil, errors.New(\"manifest root object ID\")\n\t}\n\n\treturn EntryFromDirEntry(rep, man.RootEntry)\n}", "title": "" } ]
[ { "docid": "5a1a0b2254f59c98c7e682975569bfff", "score": "0.6236476", "text": "func (f *FileSystem) Root() (fs.Node, error) { f.log.Root(); return f.RootNode, nil }", "title": "" }, { "docid": "4d08fd62233dc642603283ff8768ff3e", "score": "0.59385425", "text": "func (fs *fileStorer) Root() string {\n\treturn fs.root\n}", "title": "" }, { "docid": "0785e4df9f4efbc66a66a17e15a24688", "score": "0.5825972", "text": "func (h *HistoricalBatch) HashTreeRoot() ([32]byte, error) {\n\treturn ssz.HashWithDefaultHasher(h)\n}", "title": "" }, { "docid": "70dba199c3ff26a07f25151a3e1f1174", "score": "0.57437545", "text": "func (fsv FS) Root() string {\n\treturn fsv.root\n}", "title": "" }, { "docid": "307a800e508323d4622035a5e9efc973", "score": "0.572985", "text": "func (s *Super) Root() (fs.Node, error) {\n\tinode, err := s.InodeGet(RootInode)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\troot := NewDir(s, inode)\n\treturn root, nil\n}", "title": "" }, { "docid": "c291e8afa8ba52335d9ef7ae1e45d3fc", "score": "0.5676416", "text": "func (s *SignedVoluntaryExit) HashTreeRoot() ([32]byte, error) {\n\treturn ssz.HashWithDefaultHasher(s)\n}", "title": "" }, { "docid": "4cb1088976b5839d797dd5248c1f9c5a", "score": "0.56714904", "text": "func (c *LogClient) GetRoot() *types.LogRootV1 {\n\tc.rootLock.Lock()\n\tdefer c.rootLock.Unlock()\n\n\t// Copy the internal trusted root in order to prevent clients from modifying it.\n\tret := c.root\n\treturn &ret\n}", "title": "" }, { "docid": "a51aa546986749f039c8942daa9f393a", "score": "0.5669675", "text": "func (v *VoluntaryExit) HashTreeRoot() ([32]byte, error) {\n\treturn ssz.HashWithDefaultHasher(v)\n}", "title": "" }, { "docid": "4b99b44ec26515313c772c9ed85e426e", "score": "0.5604601", "text": "func (f *Fs) Root() string {\n\treturn f.root\n}", "title": "" }, { "docid": "4b99b44ec26515313c772c9ed85e426e", "score": "0.5604601", "text": "func (f *Fs) Root() string {\n\treturn f.root\n}", "title": "" }, { "docid": "4b99b44ec26515313c772c9ed85e426e", "score": "0.5604601", "text": "func (f *Fs) Root() string {\n\treturn f.root\n}", "title": "" }, { "docid": "4b99b44ec26515313c772c9ed85e426e", "score": "0.5604601", "text": "func (f *Fs) Root() string {\n\treturn f.root\n}", "title": "" }, { "docid": "4b99b44ec26515313c772c9ed85e426e", "score": "0.5604601", "text": "func (f *Fs) Root() string {\n\treturn f.root\n}", "title": "" }, { "docid": "4b99b44ec26515313c772c9ed85e426e", "score": "0.5604601", "text": "func (f *Fs) Root() string {\n\treturn f.root\n}", "title": "" }, { "docid": "1e5fba83bb24d365f66f4a97f40b05ed", "score": "0.5596714", "text": "func (c *Container) Root(pk cipher.PubKey, seq uint64) (r *Root, err error) {\n\n\tvar holded bool\n\n\terr = c.DB().IdxDB().Tx(func(feeds data.Feeds) (err error) {\n\t\tvar rs data.Roots\n\t\tif rs, err = feeds.Roots(pk); err != nil {\n\t\t\treturn\n\t\t}\n\t\tvar ir *data.Root\n\t\tif ir, err = rs.Get(seq); err != nil {\n\t\t\treturn\n\t\t}\n\t\tvar val []byte\n\t\tif val, _, err = c.DB().CXDS().Get(ir.Hash); err != nil {\n\t\t\treturn\n\t\t}\n\t\tif r, err = decodeRoot(val); err != nil {\n\t\t\treturn\n\t\t}\n\n\t\tc.Hold(pk, r.Seq) // hold the Root\n\t\tholded = true\n\n\t\tr.Hash = ir.Hash\n\t\tr.Sig = ir.Sig\n\t\tr.IsFull = true\n\n\t\treturn\n\t})\n\tif err != nil {\n\t\tif holded {\n\t\t\tc.Unhold(pk, r.Seq)\n\t\t}\n\t\tr = nil\n\t}\n\treturn\n}", "title": "" }, { "docid": "bdd1fa67aafdad9da18fbe5d8d23c3cc", "score": "0.5595793", "text": "func (fs *overlayFS) Root() string {\n\treturn fs.layout.RootPath()\n}", "title": "" }, { "docid": "0039ac0e345ae3023fc5d5427288d915", "score": "0.55933666", "text": "func (s *SeekerIn) Root() string {\n\treturn filepath.Join(s.root, s.dir)\n}", "title": "" }, { "docid": "0f4e00765bb9b43e6d77ff8d00a3a92c", "score": "0.5592763", "text": "func (fs *FS) Root() (fs.Node, error) {\n\treturn &Dir{core: fs.core}, nil\n}", "title": "" }, { "docid": "5d3938df2c289bd4d69079c3f83c90ce", "score": "0.55762047", "text": "func (c *Checkpoint) HashTreeRoot() ([32]byte, error) {\n\treturn ssz.HashWithDefaultHasher(c)\n}", "title": "" }, { "docid": "b4d6526329fd0091dce1fb0940194443", "score": "0.557456", "text": "func (tx *mapTX) LatestSignedMapRoot(ctx context.Context) (*trillian.SignedMapRoot, error) {\n\tcurrentSTH, err := tx.currentSTH(ctx)\n\tif err != nil {\n\t\tglog.Errorf(\"failed to determine current STH: %v\", err)\n\t\treturn nil, err\n\t}\n\twriteRev, err := tx.writeRev(ctx)\n\tif err != nil {\n\t\tglog.Errorf(\"failed to determine write revision: %v\", err)\n\t\treturn nil, err\n\t}\n\tif got, want := currentSTH.TreeRevision+1, writeRev; got != want {\n\t\treturn nil, fmt.Errorf(\"inconsistency: currentSTH.TreeRevision+1 (%d) != writeRev (%d)\", got, want)\n\t}\n\n\t// We already read the latest root as part of starting the transaction (in\n\t// order to calculate the writeRevision), so we just return that data here:\n\treturn sthToSMR(currentSTH)\n}", "title": "" }, { "docid": "06e6e282f64cfa7cbf5b30de70e52f8f", "score": "0.5519386", "text": "func (s *store) StartSnapshot() uint64 {\n\tdefer s.Unlock()\n\ts.Lock()\n\tss, ok := s.snapshots[s.lastVer]\n\tif !ok {\n\t\ts.snapshots[s.lastVer] = snapshot{keys: make(map[string]uint64)}\n\t\ts.lastSnapshot = s.lastVer\n\t}\n\tif ss.deleted {\n\t\tss.deleted = false\n\t}\n\treturn s.lastSnapshot\n}", "title": "" }, { "docid": "368069b06b583854d20de017ec174193", "score": "0.54732615", "text": "func (_OutboxEntry *OutboxEntryCaller) Root(opts *bind.CallOpts) ([32]byte, error) {\n\tvar out []interface{}\n\terr := _OutboxEntry.contract.Call(opts, &out, \"root\")\n\n\tif err != nil {\n\t\treturn *new([32]byte), err\n\t}\n\n\tout0 := *abi.ConvertType(out[0], new([32]byte)).(*[32]byte)\n\n\treturn out0, err\n\n}", "title": "" }, { "docid": "8dc3bdc140e0b57a040bfed0f2348a0c", "score": "0.5456123", "text": "func (txn *Txn) Snapshot() *Txn {\n\tif txn.rootTxn == nil {\n\t\treturn nil\n\t}\n\n\tsnapshot := &Txn{\n\t\tdb: txn.db,\n\t\trootTxn: txn.rootTxn.Clone(),\n\t}\n\n\t// Commit sub-transactions into the snapshot\n\tfor key, subTxn := range txn.modified {\n\t\tpath := indexPath(key.Table, key.Index)\n\t\tfinal := subTxn.CommitOnly()\n\t\tsnapshot.rootTxn.Insert(path, final)\n\t}\n\n\treturn snapshot\n}", "title": "" }, { "docid": "249f285eb50f26f85e09b387f59a4be2", "score": "0.5424011", "text": "func (h *HTree) Root() []byte {\n\th.finish()\n\treturn *h.root\n}", "title": "" }, { "docid": "4ab1d6d5fc2f2a6224c0121c71513b08", "score": "0.5411686", "text": "func (a *AggregateAndProof) HashTreeRoot() ([32]byte, error) {\n\treturn ssz.HashWithDefaultHasher(a)\n}", "title": "" }, { "docid": "d9f98c4c20620af0418b4589ea9b74bc", "score": "0.5396532", "text": "func (a *AttestationData) HashTreeRoot() ([32]byte, error) {\n\treturn ssz.HashWithDefaultHasher(a)\n}", "title": "" }, { "docid": "61937f724e6eb7f3c3d2bf196707a61a", "score": "0.5392139", "text": "func (f *Fork) HashTreeRoot() ([32]byte, error) {\n\treturn ssz.HashWithDefaultHasher(f)\n}", "title": "" }, { "docid": "4cce872336c2c42540f7ce4dfeaa5302", "score": "0.5373676", "text": "func Root(chunks [][]byte) []byte {\n\tleafs := computeLeafs(make([][]byte, 0, len(chunks)), chunks)\n\treturn computeRoot(leafs)\n}", "title": "" }, { "docid": "57a0536931d7a239fd92a6b643c87c34", "score": "0.5372699", "text": "func (cs ConsensusState) GetRoot() commitmentexported.Root {\n\treturn cs.Root\n}", "title": "" }, { "docid": "c036ddc1d80f45bea8a068976ed83795", "score": "0.53709966", "text": "func (i *IndexedAttestation) HashTreeRoot() ([32]byte, error) {\n\treturn ssz.HashWithDefaultHasher(i)\n}", "title": "" }, { "docid": "5fa13b6ec04f30f4bb07237d2dfcf1fd", "score": "0.53610677", "text": "func (a *Attestation) HashTreeRoot() ([32]byte, error) {\n\treturn ssz.HashWithDefaultHasher(a)\n}", "title": "" }, { "docid": "baa768246a131b38bd38e381498d719e", "score": "0.5357347", "text": "func (tx *mapTX) GetSignedMapRoot(ctx context.Context, revision int64) (*trillian.SignedMapRoot, error) {\n\tquery := spanner.NewStatement(\n\t\t`SELECT t.TreeID, t.TimestampNanos, t.TreeSize, t.RootHash, t.RootSignature, t.TreeRevision, t.TreeMetadata FROM TreeHeads t\n\t\t\t\tWHERE t.TreeID = @tree_id\n\t\t\t\tAND t.TreeRevision = @tree_rev\n\t\t\t\tLIMIT 1`)\n\tquery.Params[\"tree_id\"] = tx.treeID\n\tquery.Params[\"tree_rev\"] = revision\n\n\tvar th *spannerpb.TreeHead\n\trows := tx.stx.Query(ctx, query)\n\terr := rows.Do(func(r *spanner.Row) error {\n\t\ttth := &spannerpb.TreeHead{}\n\t\tif err := r.Columns(&tth.TreeId, &tth.TsNanos, &tth.TreeSize, &tth.RootHash, &tth.Signature, &tth.TreeRevision, &tth.Metadata); err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\tth = tth\n\t\treturn nil\n\t})\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tif th == nil {\n\t\tif revision == 0 {\n\t\t\treturn nil, storage.ErrTreeNeedsInit\n\t\t}\n\t\treturn nil, status.Errorf(codes.NotFound, \"map root %v not found\", revision)\n\t}\n\treturn sthToSMR(th)\n}", "title": "" }, { "docid": "3cac3a930ee7f399e0a7291d1ab04038", "score": "0.53529805", "text": "func (o DiskOutput) Snapshot() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v *Disk) pulumi.StringPtrOutput { return v.Snapshot }).(pulumi.StringPtrOutput)\n}", "title": "" }, { "docid": "cbeef4b96eae515d1cd8e5dcd2e2c294", "score": "0.53528553", "text": "func (a *AttesterSlashing) HashTreeRoot() ([32]byte, error) {\n\treturn ssz.HashWithDefaultHasher(a)\n}", "title": "" }, { "docid": "26d2a088e4389b549747cd460370a9bc", "score": "0.534529", "text": "func (b *Block) Root() common.Hash { return b.header.Root() }", "title": "" }, { "docid": "8e7c2f341553bf2f2473716ae84e6d53", "score": "0.53268135", "text": "func Root(fs FS) FS {\n\ttype unwrapper interface {\n\t\tUnwrap() FS\n\t}\n\n\tfor {\n\t\tu, ok := fs.(unwrapper)\n\t\tif !ok {\n\t\t\tbreak\n\t\t}\n\t\tfs = u.Unwrap()\n\t}\n\treturn fs\n}", "title": "" }, { "docid": "49ee7d0ad20d87be8a87bb753612b7c3", "score": "0.5322411", "text": "func (b *block) getRootHash() []byte {\n\treturn b.rootHash\n\t/*\n\t\tret := make([]byte, len(b.rootHash))\n\n\t\tcopy(ret, b.rootHash)\n\n\t\treturn ret\n\t*/\n}", "title": "" }, { "docid": "6365ed7cc015f3b7eb737ac848112c9c", "score": "0.53001577", "text": "func (v *Validator) HashTreeRoot() ([32]byte, error) {\n\treturn ssz.HashWithDefaultHasher(v)\n}", "title": "" }, { "docid": "7eb641fdcde67af7a9177474740ce68e", "score": "0.5296825", "text": "func RootHash() Hash {\n\treturn Hash(make([]byte, shaHashSize))\n}", "title": "" }, { "docid": "11e1ce1e14d77828637db720526fc5a7", "score": "0.529651", "text": "func (m *SharedDriveItem) GetRoot()(DriveItemable) {\n val, err := m.GetBackingStore().Get(\"root\")\n if err != nil {\n panic(err)\n }\n if val != nil {\n return val.(DriveItemable)\n }\n return nil\n}", "title": "" }, { "docid": "ff4355da71096884b332802ccb3fb4a0", "score": "0.5282244", "text": "func (s *SigningRoot) HashTreeRoot() ([32]byte, error) {\n\treturn ssz.HashWithDefaultHasher(s)\n}", "title": "" }, { "docid": "5d04adc149b8933a74f719ae632f4fac", "score": "0.52791244", "text": "func (s *fsm) Snapshot() (raft.FSMSnapshot, error) {\n\treturn nil, nil\n}", "title": "" }, { "docid": "f751ec9bc16161bd0f6584a122c66d11", "score": "0.52790993", "text": "func (d *DepositData) HashTreeRoot() ([32]byte, error) {\n\treturn ssz.HashWithDefaultHasher(d)\n}", "title": "" }, { "docid": "278e699d99b454679c4e6e751b914dac", "score": "0.52705234", "text": "func (d *Deposit) HashTreeRoot() ([32]byte, error) {\n\treturn ssz.HashWithDefaultHasher(d)\n}", "title": "" }, { "docid": "278e699d99b454679c4e6e751b914dac", "score": "0.52705234", "text": "func (d *Deposit) HashTreeRoot() ([32]byte, error) {\n\treturn ssz.HashWithDefaultHasher(d)\n}", "title": "" }, { "docid": "f4bc1b55a411cdd61167a24f9f859a7f", "score": "0.5270249", "text": "func (t *avlTree) getRoot() *node {\n\tassert(t != nil, \"tree is nil\")\n\treturn t.root\n}", "title": "" }, { "docid": "f6cd4dec102017cace6e67433602be9c", "score": "0.525179", "text": "func (_ZSLMerkleTree *ZSLMerkleTreeCaller) Root(opts *bind.CallOpts) ([32]byte, error) {\n\tvar (\n\t\tret0 = new([32]byte)\n\t)\n\tout := ret0\n\terr := _ZSLMerkleTree.contract.Call(opts, out, \"root\")\n\treturn *ret0, err\n}", "title": "" }, { "docid": "8846f861415fd8cb82121a2b80dd2126", "score": "0.52341217", "text": "func (m *Tree) Root() []byte {\n\treturn m.htree.Root()\n}", "title": "" }, { "docid": "d0cb1b476ec12d2468d4b1ef288b90d3", "score": "0.5219935", "text": "func (_OutboxEntry *OutboxEntrySession) Root() ([32]byte, error) {\n\treturn _OutboxEntry.Contract.Root(&_OutboxEntry.CallOpts)\n}", "title": "" }, { "docid": "10bf43d4d28d80f5e483f8040b54f1a0", "score": "0.5215175", "text": "func (c *ControlBlock) RootHash(revealedScript []byte) []byte {\n\t// We'll start by creating a new tapleaf from the revealed script,\n\t// this'll serve as the initial hash we'll use to incrementally\n\t// reconstruct the merkle root using the control block elements.\n\tmerkleAccumulator := NewTapLeaf(c.LeafVersion, revealedScript).TapHash()\n\n\t// Now that we have our initial hash, we'll parse the control block one\n\t// node at a time to build up our merkle accumulator into the taproot\n\t// commitment.\n\t//\n\t// The control block is a series of nodes that serve as an inclusion\n\t// proof as we can start hashing with our leaf, with each internal\n\t// branch, until we reach the root.\n\tnumNodes := len(c.InclusionProof) / ControlBlockNodeSize\n\tfor nodeOffset := 0; nodeOffset < numNodes; nodeOffset++ {\n\t\t// Extract the new node using our index to serve as a 32-byte\n\t\t// offset.\n\t\tleafOffset := 32 * nodeOffset\n\t\tnextNode := c.InclusionProof[leafOffset : leafOffset+32]\n\n\t\tmerkleAccumulator = tapBranchHash(merkleAccumulator[:], nextNode)\n\t}\n\n\treturn merkleAccumulator[:]\n}", "title": "" }, { "docid": "fd3bacc35133d1277a2fcfd556abf3e1", "score": "0.5206062", "text": "func (h HashFn) HashTreeRoot(fields ...HTR) Root {\n\t// TODO; benchmark, may be worth hard-coding a few more common short-paths\n\tn := uint64(len(fields))\n\tswitch n {\n\tcase 0:\n\t\treturn Root{}\n\tcase 1:\n\t\treturn fields[0].HashTreeRoot(h)\n\tcase 2:\n\t\treturn h(fields[0].HashTreeRoot(h), fields[1].HashTreeRoot(h))\n\tdefault:\n\t\treturn Merkleize(h, uint64(len(fields)), uint64(len(fields)), func(i uint64) Root {\n\t\t\treturn fields[i].HashTreeRoot(h)\n\t\t})\n\t}\n}", "title": "" }, { "docid": "479ec5c44b7369f9f59e04b19107bf0f", "score": "0.52055186", "text": "func (sf *factory) getRoot(nameSpace string, key string) (hash.Hash32B, error) {\n\tvar trieRoot hash.Hash32B\n\tswitch root, err := sf.dao.Get(nameSpace, []byte(key)); errors.Cause(err) {\n\tcase nil:\n\t\ttrieRoot = byteutil.BytesTo32B(root)\n\tcase bolt.ErrBucketNotFound:\n\t\ttrieRoot = trie.EmptyRoot\n\tdefault:\n\t\treturn hash.ZeroHash32B, errors.Wrap(err, \"failed to get trie's root hash from underlying db\")\n\t}\n\treturn trieRoot, nil\n}", "title": "" }, { "docid": "bc641d1992dbae7119885e9f6527856a", "score": "0.52052027", "text": "func (t *BSTree) Root() interface{} {\n\tt.RLock()\n\tdefer t.RUnlock()\n\n\tif t.root == nil {\n\t\treturn nil\n\t}\n\n\treturn t.root.payload\n}", "title": "" }, { "docid": "e8b1d5e8f9c6a26381e3e00b5751ec71", "score": "0.51958543", "text": "func (st *Store) LatestRootHash() []byte {\n\treturn st.tree.WorkingHash()\n}", "title": "" }, { "docid": "76cd12e7a5bc0c93a29abd66dda1053b", "score": "0.5186607", "text": "func (p *PendingAttestation) HashTreeRoot() ([32]byte, error) {\n\treturn ssz.HashWithDefaultHasher(p)\n}", "title": "" }, { "docid": "33dfddf717c7ead744cae11ef2f55215", "score": "0.5181668", "text": "func (st *Store) Snapshot() TreeReader {\n\t// Note: Could use immutable tree here. But not sure how fast that operation is\n\treturn NewSnapshot(st.tree)\n}", "title": "" }, { "docid": "3f11d53272ab5c9e2ddcaa8e53626e7d", "score": "0.5175854", "text": "func GroupSnapshotLog(groupsnapshot *storkv1.GroupVolumeSnapshot) *logrus.Entry {\n\tif groupsnapshot != nil {\n\t\treturn logrus.WithFields(logrus.Fields{\n\t\t\t\"GroupSnapshotName\": groupsnapshot.Name,\n\t\t\t\"Namespace\": groupsnapshot.Namespace,\n\t\t})\n\t}\n\n\treturn logrus.WithFields(logrus.Fields{})\n}", "title": "" }, { "docid": "0d012af50345448b1f651f1df3ec6ea3", "score": "0.5174979", "text": "func (t *Transfer) HashTreeRoot() ([32]byte, error) {\n\treturn ssz.HashWithDefaultHasher(t)\n}", "title": "" }, { "docid": "8fb6421781ed54483a937d470b5fc579", "score": "0.51741403", "text": "func (wr *journalWriter) snapshot() (io.Reader, int64, error) {\n\twr.lock.Lock()\n\tdefer wr.lock.Unlock()\n\tif err := wr.flush(); err != nil {\n\t\treturn nil, 0, err\n\t}\n\t// open a new file descriptor with an\n\t// independent lifecycle from |wr.file|\n\tf, err := os.Open(wr.path)\n\tif err != nil {\n\t\treturn nil, 0, err\n\t}\n\treturn io.LimitReader(f, wr.off), wr.off, nil\n}", "title": "" }, { "docid": "a4309abef283114d80701652afd515f8", "score": "0.5171904", "text": "func (p *ProposerSlashing) HashTreeRoot() ([32]byte, error) {\n\treturn ssz.HashWithDefaultHasher(p)\n}", "title": "" }, { "docid": "4483e5f73201b94951743ad2ba0a6a23", "score": "0.5171236", "text": "func (fs *MegaFS) GetRoot() *Node {\n\tfs.mutex.Lock()\n\tdefer fs.mutex.Unlock()\n\treturn fs.root\n}", "title": "" }, { "docid": "81436876b123be68a744cf36a9cbf2e0", "score": "0.5163413", "text": "func (s *SeekerDeep) Root() string {\n\treturn s.root\n}", "title": "" }, { "docid": "e13530ff1777cba63263a507f239aef9", "score": "0.5159283", "text": "func (id ID) Root() (RootDir, error) {\n\treturn RootDir(id), nil\n}", "title": "" }, { "docid": "0e2351f4ef02c87e04e929482ea0f7de", "score": "0.51453793", "text": "func (fs *DeviceFs) Root() fuse.FsNode {\n\treturn fs.root\n}", "title": "" }, { "docid": "4a0f2ac45479acd957a51ca31207cfed", "score": "0.513909", "text": "func (t *Tree) RootHash() []byte {\n\n\tif t.subTree == nil {\n\t\treturn sum(t.hashF) // zero hash\n\t}\n\n\trootHash := t.subTree.root.hash\n\tcurrent := t.subTree.left\n\n\tfor current != nil {\n\t\trootHash = sum(t.hashF, rootHash, current.root.hash)\n\t\tcurrent = current.left\n\t}\n\n\treturn rootHash\n}", "title": "" }, { "docid": "7e83804432f5b2cd88a4c7bba3b1f563", "score": "0.51265997", "text": "func (c *Container) LastRoot(pk cipher.PubKey) (r *Root, err error) {\n\n\tvar holded bool\n\n\terr = c.DB().IdxDB().Tx(func(feeds data.Feeds) (err error) {\n\t\tvar rs data.Roots\n\t\tif rs, err = feeds.Roots(pk); err != nil {\n\t\t\treturn\n\t\t}\n\t\treturn rs.Descend(func(ir *data.Root) (err error) {\n\t\t\tvar val []byte\n\t\t\tif val, _, err = c.DB().CXDS().Get(ir.Hash); err != nil {\n\t\t\t\treturn\n\t\t\t}\n\t\t\tif r, err = decodeRoot(val); err != nil {\n\t\t\t\treturn\n\t\t\t}\n\n\t\t\tc.Hold(pk, r.Seq) // hold the Root\n\t\t\tholded = true\n\n\t\t\tr.Hash = ir.Hash\n\t\t\tr.Sig = ir.Sig\n\t\t\tr.IsFull = true\n\n\t\t\treturn data.ErrStopIteration // break\n\t\t})\n\t})\n\tif err != nil {\n\t\tif holded {\n\t\t\tc.Unhold(pk, r.Seq)\n\t\t}\n\t\tr = nil\n\t} else if r == nil {\n\t\t// this occurs if feed is empty and the Descend function\n\t\t// above doesn't call given function, returning nil\n\t\terr = data.ErrNotFound\n\t}\n\treturn\n}", "title": "" }, { "docid": "ffde3d0b39f02ce6e74028c7e2cc3667", "score": "0.5125303", "text": "func (o LaunchTemplateBlockDeviceMappingEbsPtrOutput) SnapshotId() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v *LaunchTemplateBlockDeviceMappingEbs) *string {\n\t\tif v == nil {\n\t\t\treturn nil\n\t\t}\n\t\treturn v.SnapshotId\n\t}).(pulumi.StringPtrOutput)\n}", "title": "" }, { "docid": "f2c8ce9eee7540183c838d655e9c1582", "score": "0.5113051", "text": "func (_OutboxEntry *OutboxEntryCallerSession) Root() ([32]byte, error) {\n\treturn _OutboxEntry.Contract.Root(&_OutboxEntry.CallOpts)\n}", "title": "" }, { "docid": "46199033905a6898ff60b03a5ba23220", "score": "0.51108885", "text": "func (o GceRegionalPersistentDiskOutput) SourceSnapshot() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v GceRegionalPersistentDisk) *string { return v.SourceSnapshot }).(pulumi.StringPtrOutput)\n}", "title": "" }, { "docid": "73c133d26d0b21aa5b0175343b978385", "score": "0.51106924", "text": "func (l *LogServer) GetLatestSignedLogRoot(ctx context.Context, in *tpb.GetLatestSignedLogRootRequest, opts ...grpc.CallOption) (*tpb.GetLatestSignedLogRootResponse, error) {\n\treturn &tpb.GetLatestSignedLogRootResponse{\n\t\tSignedLogRoot: &tpb.SignedLogRoot{\n\t\t\tTreeSize: l.treeSize,\n\t\t},\n\t}, nil\n}", "title": "" }, { "docid": "3ceb5f93937df481dbcab7c0496df194", "score": "0.5105226", "text": "func (cs ConsensusState) GetRoot() types.Root {\n\treturn cs.Root\n}", "title": "" }, { "docid": "9f0e234ce348a3984155580d6aa9d9a0", "score": "0.5102693", "text": "func (s *Store) Snapshot() error {\n\tfuture := s.raft.Snapshot()\n\treturn future.Error()\n}", "title": "" }, { "docid": "c3ec6bfb5e8a650f91b8c5448c1cb652", "score": "0.51023996", "text": "func (o NodePoolDataDiskOutput) SnapshotId() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v NodePoolDataDisk) *string { return v.SnapshotId }).(pulumi.StringPtrOutput)\n}", "title": "" }, { "docid": "ea08390f20a534c7d1635a9093aba746", "score": "0.5099413", "text": "func (t *Txn) Root() *APINode {\n\treturn &APINode{t.root}\n}", "title": "" }, { "docid": "a31ae6d6da9e4b5c7568f5c4aac9aae5", "score": "0.5099018", "text": "func (m *MsgDeposit) HashTreeRoot() ([32]byte, error) {\n\treturn ssz.HashWithDefaultHasher(m)\n}", "title": "" }, { "docid": "3699dbfa69c3a71005282595b906ef11", "score": "0.5090982", "text": "func (rc *RunContext) RootNode() *Object { return rc.ia.root }", "title": "" }, { "docid": "f6ceb53b06d66d23d1a6c816fbbd6998", "score": "0.5090847", "text": "func (o LaunchTemplateBlockDeviceMappingEbsOutput) SnapshotId() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v LaunchTemplateBlockDeviceMappingEbs) *string { return v.SnapshotId }).(pulumi.StringPtrOutput)\n}", "title": "" }, { "docid": "d8f6a2e62ca77ebb7d931bb35c6f4d1a", "score": "0.5089833", "text": "func (r *RPC) Snapshot(blockHeight interface{}) (string, StdError) {\n\tmethod := ARCHIVE + \"snapshot\"\n\n\tdata, stdErr := r.call(method, blockHeight)\n\tif stdErr != nil {\n\t\treturn \"\", stdErr\n\t}\n\n\tvar result string\n\n\tif sysErr := json.Unmarshal(data, &result); sysErr != nil {\n\t\treturn \"\", NewSystemError(sysErr)\n\t}\n\n\treturn result, nil\n}", "title": "" }, { "docid": "189f63c51acc138417be96ecb2929a12", "score": "0.50844836", "text": "func Root(k ds.Key) ds.Key {\n\tfor k != nil && k.Parent() != nil {\n\t\tk = k.Parent()\n\t}\n\treturn k\n}", "title": "" }, { "docid": "6cca18c688a8bc6c100f2aa75db84b61", "score": "0.5075694", "text": "func (t *Tree) Root() *Node {\n\treturn t.root\n}", "title": "" }, { "docid": "7c47f58b44fd8e4b8aeae9983ea41406", "score": "0.50721645", "text": "func (p *Path) Root() *OpenAPI {\n\tif p.root == nil {\n\t\tpanic(\"no root for path \" + p.path)\n\t}\n\treturn p.root\n}", "title": "" }, { "docid": "619cc18106ac9e2d4359ff5e1b1656b7", "score": "0.50717026", "text": "func (s *SignedBeaconBlock) HashTreeRoot() ([32]byte, error) {\n\treturn ssz.HashWithDefaultHasher(s)\n}", "title": "" }, { "docid": "fd82e9f45e19edc2b6dc276aa89ec18d", "score": "0.505126", "text": "func (t *Tree) Root() *Node { return t.root }", "title": "" }, { "docid": "6eccbf8ac543fe6cebe1654f67de299d", "score": "0.50510454", "text": "func (rs *RaftStorage) Snapshot() raftpb.Snapshot {\n\tsn, _ := rs.ram.Snapshot() // Snapshot always returns nil error\n\treturn sn\n}", "title": "" }, { "docid": "030f86c9b83b76e79b2d1fc386e9a8df", "score": "0.5049542", "text": "func (f *fsm) Snapshot() (raft.FSMSnapshot, error) {\n\tf.mu.Lock()\n\tdefer f.mu.Unlock()\n\n\treturn newSnapshotNoop()\n}", "title": "" }, { "docid": "55bea8d09cdd483922e6785448c8b679", "score": "0.5041918", "text": "func (sp *Proof) ComputeRootHash() []byte {\n\treturn computeHashFromAunts(\n\t\tsp.Index,\n\t\tsp.Total,\n\t\tsp.LeafHash,\n\t\tsp.Aunts,\n\t)\n}", "title": "" }, { "docid": "df250fb56512166a681adeff837caef8", "score": "0.50355095", "text": "func (f *fsm) Snapshot() (raft.FSMSnapshot, error) {\n\ts := &fsmSnapshot{}\n\tmeta, err := f.srv.meta.AllMeta()\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"could not get all metadata: %v\", err)\n\t}\n\tmb, err := json.Marshal(meta)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"could not marshal metadata: %v\", err)\n\t}\n\ts.meta = mb\n\n\tdata, err := f.srv.data.All()\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"could not get all data: %v\", err)\n\t}\n\tdb, err := json.Marshal(data)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"could not marshal data: %v\", err)\n\t}\n\ts.data = db\n\treturn s, nil\n}", "title": "" }, { "docid": "438fd1471b2353d4bb16dfe3402471da", "score": "0.5030303", "text": "func (f *FSContext) RootDirectory() vfs.VirtualDentry {\n\tf.mu.Lock()\n\tdefer f.mu.Unlock()\n\n\tif f.root.Ok() {\n\t\tf.root.IncRef()\n\t}\n\treturn f.root\n}", "title": "" }, { "docid": "963640b19ca02955815a6d062c86e55b", "score": "0.50295687", "text": "func (t *TrillianLogServer) GetLatestSignedLogRoot(ctx context.Context, req *trillian.GetLatestSignedLogRootRequest) (*trillian.GetLatestSignedLogRootResponse, error) {\n\ttx, err := t.prepareStorageTx(req.LogId)\n\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tsignedRoot, err := tx.LatestSignedLogRoot()\n\n\tif err != nil {\n\t\ttx.Rollback()\n\t\treturn nil, err\n\t}\n\n\tif err := t.commitAndLog(tx, \"GetLatestSignedLogRoot\"); err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn &trillian.GetLatestSignedLogRootResponse{Status: buildStatus(trillian.TrillianApiStatusCode_OK), SignedLogRoot: &signedRoot}, nil\n}", "title": "" }, { "docid": "aead7b7a7b468b5ba74e80b28d6978de", "score": "0.5026891", "text": "func (e *Eth1Data) HashTreeRoot() ([32]byte, error) {\n\treturn ssz.HashWithDefaultHasher(e)\n}", "title": "" }, { "docid": "cc1f5567cf60564f79f5e4f4f0e7f043", "score": "0.50266165", "text": "func (tree *Tree) Root() *Node {\n\treturn tree.root\n}", "title": "" }, { "docid": "f8f527083388e75858605cfae43731cc", "score": "0.50238395", "text": "func (f *Rnode) Snapshot() (raft.FSMSnapshot, error) {\n\tfsm := &fsmSnapshot{}\t\n\tfsm.meta=\n}", "title": "" }, { "docid": "ef85dd6cd89755d295ec865a2877f190", "score": "0.5022294", "text": "func (o RegionInstanceTemplateDiskOutput) SourceSnapshot() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v RegionInstanceTemplateDisk) *string { return v.SourceSnapshot }).(pulumi.StringPtrOutput)\n}", "title": "" }, { "docid": "d0488b78f110c5cae325d4999f4c718c", "score": "0.50201863", "text": "func (v *Volume) Snapshot(client *Client, name string) (snapshot *Volume, err error) {\n\n\tlog.Debugf(\"Creating snapshot: %s\", v.Name)\n\n\turl := \"api/rest/volumes\"\n\tbody := map[string]interface{}{\"parent_id\": v.ID}\n\n\tif name == \"\" {\n\t\tbody[\"name\"] = fmt.Sprintf(\"auto-snapshot-%s\", uuid.New())\n\t}\n\tresponse, err := client.RestClient.R().SetBody(body).Post(url)\n\n\tresult, err := CheckAPIResponse(response, err)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"error creating volume: %s, %s\", v.Name, err.Error())\n\t}\n\n\terr = json.Unmarshal(*result.APIResult, &snapshot)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"error creating volume: %s, %s\", v.Name, err.Error())\n\t}\n\n\tlog.Debugf(\"Succesfully created snapshot %s for volume %s\", snapshot.Name, v.Name)\n\n\treturn snapshot, nil\n}", "title": "" }, { "docid": "8528b2e0f2b8317972b80298b8fde540", "score": "0.5019711", "text": "func NewRoot(initTime time.Time) *Root {\n\treturn &Root{\n\t\tSignedBase: SignedBase{\n\t\t\tTy: ManifestTypeRoot,\n\t\t\tSpecVersion: CurrentSpecVersion,\n\t\t\tExpires: initTime.Add(ManifestsConfig[ManifestTypeRoot].Expire).Format(time.RFC3339),\n\t\t\tVersion: 1, // initial repo starts with version 1\n\t\t},\n\t\tRoles: make(map[string]*Role),\n\t}\n}", "title": "" }, { "docid": "7cf8d9068e17b3e01cb29f1500f37773", "score": "0.5012642", "text": "func Root() *Finder {\n\tf := newFinder()\n\tf.root = true\n\treturn f\n}", "title": "" }, { "docid": "0b9334d6aa00662768e4d4c468f47049", "score": "0.50071293", "text": "func initRoot() fileOp {\n\treturn fileOp{func(c *ctx) error {\n\t\tif !c.noSyncInit {\n\t\t\t// Do this before GetRootDir so that we pick\n\t\t\t// up any TLF name changes.\n\t\t\terr := c.engine.SyncFromServer(c.user, c.tlfName, c.tlfType)\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t\tvar root Node\n\t\tvar err error\n\t\tswitch {\n\t\tcase c.tlfRevision != kbfsmd.RevisionUninitialized:\n\t\t\troot, err = c.engine.GetRootDirAtRevision(\n\t\t\t\tc.user, c.tlfName, c.tlfType, c.tlfRevision,\n\t\t\t\tc.expectedCanonicalTlfName)\n\t\tcase c.tlfTime != \"\":\n\t\t\troot, err = c.engine.GetRootDirAtTimeString(\n\t\t\t\tc.user, c.tlfName, c.tlfType, c.tlfTime,\n\t\t\t\tc.expectedCanonicalTlfName)\n\t\tcase c.tlfRelTime != \"\":\n\t\t\troot, err = c.engine.GetRootDirAtRelTimeString(\n\t\t\t\tc.user, c.tlfName, c.tlfType, c.tlfRelTime,\n\t\t\t\tc.expectedCanonicalTlfName)\n\t\tdefault:\n\t\t\troot, err = c.engine.GetRootDir(\n\t\t\t\tc.user, c.tlfName, c.tlfType, c.expectedCanonicalTlfName)\n\t\t}\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tc.rootNode = root\n\t\treturn nil\n\t}, IsInit, \"initRoot()\"}\n}", "title": "" }, { "docid": "d6b98d73ce421590df7927342b221337", "score": "0.49937788", "text": "func (t *tree) Root() *[NonceSize]byte {\n\treturn &t.values[len(t.values)-1][0]\n}", "title": "" }, { "docid": "39ff251a5b219bcbb4caaa89326e4f43", "score": "0.4993133", "text": "func (o AmiFromInstanceEbsBlockDeviceOutput) SnapshotId() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v AmiFromInstanceEbsBlockDevice) *string { return v.SnapshotId }).(pulumi.StringPtrOutput)\n}", "title": "" }, { "docid": "fc4185224b92b53e81b2fb9be3af9fc3", "score": "0.4989145", "text": "func (mv Map) Root() (string, error) {\n\tmm := map[string]interface{}(mv)\n\tif len(mm) != 1 {\n\t\treturn \"\", fmt.Errorf(\"Map does not have singleton root. Len: %d.\", len(mm))\n\t}\n\tfor k, _ := range mm {\n\t\treturn k, nil\n\t}\n\treturn \"\", nil\n}", "title": "" } ]
fa3c44f7364a0d4d3213319fc270a25d
ApplyConfig will determine the group of the Config before applying it to the group. If no group exists, one will be created. If a group already exists, the group will have its settings merged with the Config and will be updated.
[ { "docid": "5d2aaeeb71adcd7354d1db1680c020fa", "score": "0.82613266", "text": "func (m *GroupManager) ApplyConfig(c Config) error {\n\tm.mtx.Lock()\n\tdefer m.mtx.Unlock()\n\treturn m.applyConfig(c)\n}", "title": "" } ]
[ { "docid": "4e5596d25c1aab0879cfd1185e0c7cb1", "score": "0.64624053", "text": "func ApplyConfig(cfg Config) {\n\tconfigWriteMu.Lock()\n\tdefer configWriteMu.Unlock()\n\tc := *config.Load().(*Config)\n\tif cfg.DefaultSampler != nil {\n\t\tc.DefaultSampler = cfg.DefaultSampler\n\t}\n\tif cfg.IDGenerator != nil {\n\t\tc.IDGenerator = cfg.IDGenerator\n\t}\n\tif cfg.MaxAnnotationEventsPerSpan > 0 {\n\t\tc.MaxAnnotationEventsPerSpan = cfg.MaxAnnotationEventsPerSpan\n\t}\n\tif cfg.MaxMessageEventsPerSpan > 0 {\n\t\tc.MaxMessageEventsPerSpan = cfg.MaxMessageEventsPerSpan\n\t}\n\tif cfg.MaxAttributesPerSpan > 0 {\n\t\tc.MaxAttributesPerSpan = cfg.MaxAttributesPerSpan\n\t}\n\tif cfg.MaxLinksPerSpan > 0 {\n\t\tc.MaxLinksPerSpan = cfg.MaxLinksPerSpan\n\t}\n\tconfig.Store(&c)\n}", "title": "" }, { "docid": "f3d484fe9d67faab5a5f7b955fdcf59c", "score": "0.6403889", "text": "func (e *Environment) ApplyConfig(inFile string, data map[string]string) error {\n\tconfig, err := e.Fill(inFile, data)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tvs, _, err := crd.ParseInputs(config)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tfor _, v := range vs {\n\t\t// fill up namespace for the config\n\t\tv.Namespace = e.Config.Namespace\n\n\t\told, exists := e.config.Get(v.Type, v.Name, v.Namespace)\n\t\tif exists {\n\t\t\tv.ResourceVersion = old.ResourceVersion\n\t\t\t_, err = e.config.Update(v)\n\t\t} else {\n\t\t\t_, err = e.config.Create(v)\n\t\t}\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\tsleepTime := time.Second * 3\n\tlog.Infof(\"Sleeping %v for the config to propagate\", sleepTime)\n\ttime.Sleep(sleepTime)\n\treturn nil\n}", "title": "" }, { "docid": "0b8918230ba5ba9e567041530db1a6f1", "score": "0.6314233", "text": "func (tm *TargetManager) ApplyConfig(cfg *config.Config) error {\n\ttm.mtx.Lock()\n\tdefer tm.mtx.Unlock()\n\n\ttm.scrapeConfigs = cfg.ScrapeConfigs\n\n\tif tm.ctx != nil {\n\t\ttm.reload()\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "27821c4f498425006f6e134c96dc99d3", "score": "0.6288797", "text": "func UpdateGroupConfig(db Database, config gm.GroupConfig) error {\n\tsetup, dbID := GetGroupConfig(db, config.Group)\n\tif setup == nil || dbID == \"\" {\n\t\treturn NewError(\"Group \" + string(config.Group) + \" not found\")\n\t}\n\n\tif config.Leds != nil {\n\t\tsetup.Leds = config.Leds\n\t}\n\n\tif config.Sensors != nil {\n\t\tsetup.Sensors = config.Sensors\n\t}\n\n\tif config.Blinds != nil {\n\t\tsetup.Blinds = config.Blinds\n\t}\n\n\tif config.Hvacs != nil {\n\t\tsetup.Hvacs = config.Hvacs\n\t}\n\n\tif config.Nanosenses != nil {\n\t\tsetup.Nanosenses = config.Nanosenses\n\t}\n\n\tif config.FriendlyName != nil {\n\t\tsetup.FriendlyName = config.FriendlyName\n\t}\n\n\tif config.CorrectionInterval != nil {\n\t\tsetup.CorrectionInterval = config.CorrectionInterval\n\t}\n\n\tif config.Watchdog != nil {\n\t\tsetup.Watchdog = config.Watchdog\n\t}\n\n\tif config.SlopeStartManual != nil {\n\t\tsetup.SlopeStartManual = config.SlopeStartManual\n\t}\n\n\tif config.SlopeStopManual != nil {\n\t\tsetup.SlopeStopManual = config.SlopeStopManual\n\t}\n\n\tif config.SlopeStartAuto != nil {\n\t\tsetup.SlopeStartAuto = config.SlopeStartAuto\n\t}\n\n\tif config.SlopeStopAuto != nil {\n\t\tsetup.SlopeStopAuto = config.SlopeStopAuto\n\t}\n\n\tif config.SensorRule != nil {\n\t\tsetup.SensorRule = config.SensorRule\n\t}\n\n\tif config.Auto != nil {\n\t\tsetup.Auto = config.Auto\n\t}\n\n\tif config.RuleBrightness != nil {\n\t\tsetup.RuleBrightness = config.RuleBrightness\n\t}\n\n\tif config.RulePresence != nil {\n\t\tsetup.RulePresence = config.RulePresence\n\t}\n\n\tif config.FirstDay != nil {\n\t\tsetup.FirstDay = config.FirstDay\n\t}\n\n\tif config.FirstDayOffset != nil {\n\t\tsetup.FirstDayOffset = config.FirstDayOffset\n\t}\n\n\tif config.SetpointOccupiedCool1 != nil {\n\t\tsetup.SetpointOccupiedCool1 = config.SetpointOccupiedCool1\n\t}\n\n\tif config.SetpointOccupiedHeat1 != nil {\n\t\tsetup.SetpointOccupiedHeat1 = config.SetpointOccupiedHeat1\n\t}\n\n\tif config.SetpointUnoccupiedCool1 != nil {\n\t\tsetup.SetpointUnoccupiedCool1 = config.SetpointUnoccupiedCool1\n\t}\n\n\tif config.SetpointUnoccupiedHeat1 != nil {\n\t\tsetup.SetpointUnoccupiedHeat1 = config.SetpointUnoccupiedHeat1\n\t}\n\n\tif config.SetpointStandbyCool1 != nil {\n\t\tsetup.SetpointStandbyCool1 = config.SetpointStandbyCool1\n\t}\n\n\tif config.SetpointStandbyHeat1 != nil {\n\t\tsetup.SetpointStandbyHeat1 = config.SetpointStandbyHeat1\n\t}\n\n\tif config.HvacsTargetMode != nil {\n\t\tsetup.HvacsTargetMode = config.HvacsTargetMode\n\t}\n\n\tif config.HvacsHeatCool != nil {\n\t\tsetup.HvacsHeatCool = config.HvacsHeatCool\n\t}\n\n\treturn db.UpdateRecord(pconst.DbConfig, pconst.TbGroups, dbID, setup)\n}", "title": "" }, { "docid": "5aa65027cba6e3ba8868febe2d7433f2", "score": "0.6244403", "text": "func (c *Controller) ApplyConfig(config Config) error {\n\tif err := writeConfig(config); err != nil {\n\t\treturn fmt.Errorf(\"couldn't write NGINX configuration: %v\", err)\n\t}\n\n\tif !c.started {\n\t\tif err := c.start(); err != nil {\n\t\t\treturn fmt.Errorf(\"failed to start NGINX: %v\", err)\n\t\t}\n\t\tc.started = true\n\t} else {\n\t\tif err := c.Reload(); err != nil {\n\t\t\treturn fmt.Errorf(\"couldn't reload NGINX: %v\", err)\n\t\t}\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "d1cfc1961138e1aebb0caa41a27fbb77", "score": "0.61944115", "text": "func (fm *Manager) ApplyConfig(idHeaderName string, matchMap map[string][]string, injectMap map[string]string) error {\n\tfm.mtx.Lock()\n\tdefer fm.mtx.Unlock()\n\n\tif (len(matchMap) == 0 && len(injectMap) == 0) || idHeaderName == \"\" {\n\t\treturn fmt.Errorf(\"wrong filter config\")\n\t}\n\n\tif len(matchMap) > 0 {\n\t\tmatchMemMap := make(map[string][][]*labels.Matcher)\n\t\tvar matcherSets [][]*labels.Matcher\n\t\tfor id, matches := range matchMap {\n\t\t\tmatcherSets = make([][]*labels.Matcher, 0)\n\t\t\tfor _, s := range matches {\n\t\t\t\tmatchers, err := promql.ParseMetricSelector(s)\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn err\n\t\t\t\t}\n\t\t\t\tmatcherSets = append(matcherSets, matchers)\n\t\t\t}\n\t\t\tmatchMemMap[id] = matcherSets\n\t\t\tlevel.Debug(fm.logger).Log(\"client.id\", id, \"matchset\", fmt.Sprintf(\"%v\", matchMemMap[id]))\n\t\t}\n\t\tfm.matchMemMap = matchMemMap\n\t}\n\n\tif len(injectMap) > 0 {\n\t\tinjectMemMap := make(map[string][]*labels.Matcher)\n\t\tfor id, s := range injectMap {\n\t\t\tinject, err := promql.ParseMetricSelector(s)\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t\tinjectMemMap[id] = inject\n\t\t\tlevel.Debug(fm.logger).Log(\"client.id\", id, \"inject\", fmt.Sprintf(\"%v\", injectMemMap[id]))\n\t\t}\n\t\tfm.injectMemMap = injectMemMap\n\t}\n\n\tfm.idHeaderName = idHeaderName\n\treturn nil\n}", "title": "" }, { "docid": "b58a69801177954b6aa04ecaca4e3f9b", "score": "0.6130987", "text": "func (s *ServerGroup) ApplyConfig(cfg *Config) error {\n\ts.Cfg = cfg\n\n\t// Copy/paste from upstream prometheus/common until https://github.com/prometheus/common/issues/144 is resolved\n\ttlsConfig, err := config_util.NewTLSConfig(&cfg.HTTPConfig.HTTPConfig.TLSConfig)\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"error loading TLS client config\")\n\t}\n\t// The only timeout we care about is the configured scrape timeout.\n\t// It is applied on request. So we leave out any timings here.\n\tvar rt http.RoundTripper = &http.Transport{\n\t\tProxy: http.ProxyURL(cfg.HTTPConfig.HTTPConfig.ProxyURL.URL),\n\t\tMaxIdleConns: 20000,\n\t\tMaxIdleConnsPerHost: 1000, // see https://github.com/golang/go/issues/13801\n\t\tDisableKeepAlives: false,\n\t\tTLSClientConfig: tlsConfig,\n\t\tDisableCompression: true,\n\t\t// 5 minutes is typically above the maximum sane scrape interval. So we can\n\t\t// use keepalive for all configurations.\n\t\tIdleConnTimeout: 5 * time.Minute,\n\t\tDialContext: (&net.Dialer{Timeout: cfg.HTTPConfig.DialTimeout}).DialContext,\n\t}\n\n\t// If a bearer token is provided, create a round tripper that will set the\n\t// Authorization header correctly on each request.\n\tif len(cfg.HTTPConfig.HTTPConfig.BearerToken) > 0 {\n\t\trt = config_util.NewBearerAuthRoundTripper(cfg.HTTPConfig.HTTPConfig.BearerToken, rt)\n\t} else if len(cfg.HTTPConfig.HTTPConfig.BearerTokenFile) > 0 {\n\t\trt = config_util.NewBearerAuthFileRoundTripper(cfg.HTTPConfig.HTTPConfig.BearerTokenFile, rt)\n\t}\n\n\tif cfg.HTTPConfig.HTTPConfig.BasicAuth != nil {\n\t\trt = config_util.NewBasicAuthRoundTripper(cfg.HTTPConfig.HTTPConfig.BasicAuth.Username, cfg.HTTPConfig.HTTPConfig.BasicAuth.Password, cfg.HTTPConfig.HTTPConfig.BasicAuth.PasswordFile, rt)\n\t}\n\n\ts.Client = &http.Client{Transport: rt}\n\n\tif err := s.targetManager.ApplyConfig(map[string]sd_config.ServiceDiscoveryConfig{\"foo\": cfg.Hosts}); err != nil {\n\t\treturn err\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "39aa01f92924c4d716a8ee5597d0ddc2", "score": "0.60304606", "text": "func SaveGroupConfig(db Database, cfg gm.GroupConfig) error {\n\tcriteria := make(map[string]interface{})\n\tcriteria[\"Group\"] = cfg.Group\n\treturn SaveOnUpdateObject(db, cfg, pconst.DbConfig, pconst.TbGroups, criteria)\n}", "title": "" }, { "docid": "e6ea4797cbb31c813d158924b3921110", "score": "0.59554523", "text": "func ApplyConfig(c *Config) error {\n\tctx, cancel := context.WithTimeout(context.Background(), defaultTimeout)\n\tdefer cancel()\n\treturn ApplyConfigContext(ctx, c)\n}", "title": "" }, { "docid": "e7493b8e3f2065b574870c65a8e931f7", "score": "0.5924091", "text": "func (c *Config) Apply(cfg *config.ControllerConfiguration) {\n\t*cfg = *c.Config\n}", "title": "" }, { "docid": "0c05880c137e87a955a97d6d69f3b920", "score": "0.5921784", "text": "func groupConfigs(groupName string, grouped groupedConfigs) (Config, error) {\n\tif len(grouped) == 0 {\n\t\treturn Config{}, fmt.Errorf(\"no configs\")\n\t}\n\n\t// Move the map into a slice and sort it by name so this function\n\t// consistently does the same thing.\n\tcfgs := make([]Config, 0, len(grouped))\n\tfor _, cfg := range grouped {\n\t\tcfgs = append(cfgs, cfg)\n\t}\n\tsort.Slice(cfgs, func(i, j int) bool { return cfgs[i].Name < cfgs[j].Name })\n\n\tcombined, err := cfgs[0].Clone()\n\tif err != nil {\n\t\treturn Config{}, err\n\t}\n\tcombined.Name = groupName\n\tcombined.ScrapeConfigs = []*config.ScrapeConfig{}\n\n\t// Assign all remote_write configs in the group a consistent set of remote_names.\n\t// If the grouped configs are coming from the scraping service, defaults will have\n\t// been applied and the remote names will be prefixed with the old instance config name.\n\tfor _, rwc := range combined.RemoteWrite {\n\t\t// Blank out the existing name before getting the hash so it doesn't take into\n\t\t// account any existing name.\n\t\trwc.Name = \"\"\n\n\t\thash, err := getHash(rwc)\n\t\tif err != nil {\n\t\t\treturn Config{}, err\n\t\t}\n\n\t\trwc.Name = groupName[:6] + \"-\" + hash[:6]\n\t}\n\n\t// Combine all the scrape configs. It's possible that two different ungrouped\n\t// configs had a matching job name, but this will be detected and rejected\n\t// (as it should be) when the underlying Manager eventually validates the\n\t// combined config.\n\t//\n\t// TODO(rfratto): should we prepend job names with the name of the original\n\t// config? (e.g., job_name = \"config_name/job_name\").\n\tfor _, cfg := range cfgs {\n\t\tcombined.ScrapeConfigs = append(combined.ScrapeConfigs, cfg.ScrapeConfigs...)\n\t}\n\n\treturn combined, nil\n}", "title": "" }, { "docid": "87cefed61940f38f075a7868a3e6db88", "score": "0.58966064", "text": "func (ac *Config) Apply(ac1 *Config) {\n\tif ac1 == nil {\n\t\treturn\n\t}\n\n\tac.Ingestor.Apply(ac1.Ingestor)\n\tac.Scanner.Apply(ac1.Scanner)\n\tif ac1.StatusFile != \"\" {\n\t\tac.StatusFile = ac1.StatusFile\n\t}\n\tif ac1.StateFile != \"\" {\n\t\tac.StateFile = ac1.StateFile\n\t}\n}", "title": "" }, { "docid": "5d84fa28cc71fec5d867728936a3bc0a", "score": "0.5795686", "text": "func (d Driver) Apply(g Group) (bool, error) {\n\tgroup, err := d.backend.GetGroup(g.ID())\n\tif err != nil {\n\t\treturn false, err\n\t}\n\n\texists := false\n\tif group != nil {\n\t\texists = true\n\t\terr = d.backend.UpdateGroup(g)\n\t} else {\n\t\terr = d.backend.CreateGroup(g)\n\t}\n\n\tif err != nil {\n\t\treturn exists, err\n\t}\n\n\treturn exists, nil\n}", "title": "" }, { "docid": "118870002d90d468756e063fd0db406a", "score": "0.5732132", "text": "func (c *ClusterConfig) Apply(updateConf *ConfigToUpdate, asType string) error {\n\treturn copyProps(updateConf, c, asType)\n}", "title": "" }, { "docid": "60625abe1e217c94b5ab0b1f7d3ccc8e", "score": "0.5669703", "text": "func (o LookupNodegroupResultOutput) UpdateConfig() NodegroupUpdateConfigPtrOutput {\n\treturn o.ApplyT(func(v LookupNodegroupResult) *NodegroupUpdateConfig { return v.UpdateConfig }).(NodegroupUpdateConfigPtrOutput)\n}", "title": "" }, { "docid": "968b6ce8c95b7bdf8f1fd69c4c683b6a", "score": "0.56479883", "text": "func (c *DNSServiceConfig) Apply(cfg *config.DNSServiceConfig) {\n\tcfg.SeedID = c.SeedID\n\tcfg.DNSClass = c.DNSClass\n\tcfg.ReplicateDNSProviders = c.ReplicateDNSProviders\n\tcfg.ManageDNSProviders = c.ManageDNSProviders\n\tcfg.RemoteDefaultDomainSecret = c.RemoteDefaultDomainSecret\n}", "title": "" }, { "docid": "31f158d59ea89aab1a05afc00753d3a0", "score": "0.5614127", "text": "func (c *HealthConfig) ApplyHealthCheckConfig(config *healthcheckconfig.HealthCheckConfig) {\n\tconfig.SyncPeriod = c.HealthCheckSyncPeriod\n}", "title": "" }, { "docid": "d3b74742a8e36375fac294600fe0b8ab", "score": "0.5585468", "text": "func (ac *AgentConfig) Apply(ac1 *AgentConfig) {\n\tif ac1 == nil {\n\t\treturn\n\t}\n\n\tac.Ingestor.Apply(ac1.Ingestor)\n\tac.Collector.Apply(ac1.Collector)\n\tif ac1.StatusFile != \"\" {\n\t\tac.StatusFile = ac1.StatusFile\n\t}\n\tif ac1.GeyserStateFile != \"\" {\n\t\tac.GeyserStateFile = ac1.GeyserStateFile\n\t}\n}", "title": "" }, { "docid": "6849b697959665e64608576ecb653661", "score": "0.55503064", "text": "func (ic *IngestorConfig) Apply(ic1 *IngestorConfig) {\n\tif ic1 == nil {\n\t\treturn\n\t}\n\n\tif ic1.Server != \"\" {\n\t\tic.Server = ic1.Server\n\t}\n\n\tif ic1.RetrySec != 0 {\n\t\tic.RetrySec = ic1.RetrySec\n\t}\n\n\tif ic1.PacketMaxRecords != 0 {\n\t\tic.PacketMaxRecords = ic1.PacketMaxRecords\n\t}\n\n\tif ic1.HeartBeatMs != 0 {\n\t\tic.HeartBeatMs = ic1.HeartBeatMs\n\t}\n\n\tif ic1.AccessKey != \"\" {\n\t\tic.AccessKey = ic1.AccessKey\n\t}\n\n\tif ic1.SecretKey != \"\" {\n\t\tic.SecretKey = ic1.SecretKey\n\t}\n\n\tif len(ic1.Schemas) != 0 {\n\t\tic.Schemas = deepcopy.Copy(ic1.Schemas).([]*SchemaConfig)\n\t}\n}", "title": "" }, { "docid": "a13df23c531b64b4d94235eb2be55c1d", "score": "0.54787207", "text": "func (c *ruleConfig) adjust() {\n\t// remove all default group configurations.\n\t// if there are rules belong to the group, it will be re-add later.\n\tfor id, g := range c.groups {\n\t\tif g.isDefault() {\n\t\t\tdelete(c.groups, id)\n\t\t}\n\t}\n\tfor _, r := range c.rules {\n\t\tg := c.groups[r.GroupID]\n\t\tif g == nil {\n\t\t\t// create default group configurations.\n\t\t\tg = &RuleGroup{ID: r.GroupID}\n\t\t\tc.groups[r.GroupID] = g\n\t\t}\n\t\t// setup group for `buildRuleList`\n\t\tr.group = g\n\t}\n}", "title": "" }, { "docid": "9ab7f4d810fc89ce80ed006f5b6929a8", "score": "0.5439653", "text": "func (o *ApplyOptions) Apply(c *CommandLineContext) runner.Runner {\n\to.c = c\n\tc.Log.Debug(\"Executing apply.\")\n\tvar err runner.Runner\n\to.fileList, err = o.getFiles()\n\tif err != nil {\n\t\treturn err\n\t}\n\tc.Log.Debug(\"Processing \", len(o.fileList), \" files...\")\n\terrors := c.SgcManager.ParseConfig()\n\tif errors != nil {\n\t\tfor _, f := range errors {\n\t\t\tc.Log.Errorln(f.Error())\n\t\t}\n\t\treturn &runner.ExitError{}\n\t}\n\terr = o.applyConfigs()\n\tif err != nil {\n\t\treturn err\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "cbc38353762a2bfc905c3f47faed654b", "score": "0.5437468", "text": "func (k *Kmod) applyConfig(modules []module) error {\n\tif k.modConfig == \"\" {\n\t\treturn nil\n\t}\n\tf, err := os.Open(k.modConfig)\n\tif os.IsNotExist(err) {\n\t\treturn nil\n\t}\n\tif err != nil {\n\t\treturn err\n\t}\n\tdefer f.Close()\n\n\tscanner := bufio.NewScanner(f)\n\tfor scanner.Scan() {\n\t\tline := strings.TrimSpace(scanner.Text())\n\t\tif strings.HasPrefix(line, \"#\") {\n\t\t\tcontinue\n\t\t}\n\t\tfields := strings.Fields(line)\n\t\tif len(fields) < 3 || fields[0] != \"options\" {\n\t\t\tcontinue\n\t\t}\n\t\tname := cleanName(fields[1])\n\t\tfor i, m := range modules {\n\t\t\tif m.name == name {\n\t\t\t\tm.params = strings.Join(fields[2:], \" \")\n\t\t\t\tmodules[i] = m\n\t\t\t\tbreak\n\t\t\t}\n\t\t}\n\t}\n\treturn scanner.Err()\n}", "title": "" }, { "docid": "593737272808a170533ecf622837ae30", "score": "0.5409448", "text": "func (m *Manager) ApplyConfig(cfg ManagerConfig) error {\n\tvar failed bool\n\n\tm.cfgMut.Lock()\n\tdefer m.cfgMut.Unlock()\n\n\tm.integrationsMut.Lock()\n\tdefer m.integrationsMut.Unlock()\n\n\t// The global prometheus config settings don't get applied to integrations until later. This\n\t// causes us to skip reload when those settings change.\n\tif util.CompareYAML(m.cfg, cfg) && util.CompareYAML(m.cfg.PrometheusGlobalConfig, cfg.PrometheusGlobalConfig) {\n\t\tlevel.Debug(m.logger).Log(\"msg\", \"Integrations config is unchanged skipping apply\")\n\t\treturn nil\n\t}\n\tlevel.Debug(m.logger).Log(\"msg\", \"Applying integrations config changes\")\n\n\tselect {\n\tcase <-m.ctx.Done():\n\t\treturn fmt.Errorf(\"Manager already stopped\")\n\tdefault:\n\t\t// No-op\n\t}\n\n\t// Iterate over our integrations. New or changed integrations will be\n\t// started, with their existing counterparts being shut down.\n\tfor _, ic := range cfg.Integrations {\n\t\tif !ic.Common.Enabled {\n\t\t\tcontinue\n\t\t}\n\t\t// Key is used to identify the instance of this integration within the\n\t\t// instance manager and within our set of running integrations.\n\t\tkey := integrationKey(ic.Name())\n\n\t\t// Look for an existing integration with the same key. If it exists and\n\t\t// is unchanged, we have nothing to do. Otherwise, we're going to recreate\n\t\t// it with the new settings, so we'll need to stop it.\n\t\tif p, exist := m.integrations[key]; exist {\n\t\t\tif util.CompareYAMLWithHook(p.cfg, ic, noScrubbedSecretsHook) {\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tp.stop()\n\t\t\tdelete(m.integrations, key)\n\t\t}\n\n\t\tl := log.With(m.logger, \"integration\", ic.Name())\n\t\ti, err := ic.NewIntegration(l)\n\t\tif err != nil {\n\t\t\tlevel.Error(m.logger).Log(\"msg\", \"failed to initialize integration. it will not run or be scraped\", \"integration\", ic.Name(), \"err\", err)\n\t\t\tfailed = true\n\n\t\t\t// If this integration was running before, its instance won't be cleaned\n\t\t\t// up since it's now removed from the map. We need to clean it up here.\n\t\t\t_ = m.im.DeleteConfig(key)\n\t\t\tcontinue\n\t\t}\n\n\t\t// Find what instance label should be used to represent this integration.\n\t\tvar instanceKey string\n\t\tif kp := ic.Common.InstanceKey; kp != nil {\n\t\t\t// Common config takes precedence.\n\t\t\tinstanceKey = strings.TrimSpace(*kp)\n\t\t} else {\n\t\t\tinstanceKey, err = ic.InstanceKey(fmt.Sprintf(\"%s:%d\", m.hostname, cfg.ListenPort))\n\t\t\tif err != nil {\n\t\t\t\tlevel.Error(m.logger).Log(\"msg\", \"failed to get instance key for integration. it will not run or be scraped\", \"integration\", ic.Name(), \"err\", err)\n\t\t\t\tfailed = true\n\n\t\t\t\t// If this integration was running before, its instance won't be cleaned\n\t\t\t\t// up since it's now removed from the map. We need to clean it up here.\n\t\t\t\t_ = m.im.DeleteConfig(key)\n\t\t\t\tcontinue\n\t\t\t}\n\t\t}\n\n\t\t// Create, start, and register the new integration.\n\t\tctx, cancel := context.WithCancel(m.ctx)\n\t\tp := &integrationProcess{\n\t\t\tlog: m.logger,\n\t\t\tcfg: ic,\n\t\t\ti: i,\n\t\t\tinstanceKey: instanceKey,\n\n\t\t\tctx: ctx,\n\t\t\tstop: cancel,\n\n\t\t\twg: &m.wg,\n\t\t\twait: m.instanceBackoff,\n\t\t}\n\t\tgo p.Run()\n\t\tm.integrations[key] = p\n\t}\n\n\t// Delete instances and processed that have been removed in between calls to\n\t// ApplyConfig.\n\tfor key, process := range m.integrations {\n\t\tfoundConfig := false\n\t\tfor _, ic := range cfg.Integrations {\n\t\t\tif integrationKey(ic.Name()) == key {\n\t\t\t\t// If this is disabled then we should delete from integrations\n\t\t\t\tif !ic.Common.Enabled {\n\t\t\t\t\tbreak\n\t\t\t\t}\n\t\t\t\tfoundConfig = true\n\t\t\t\tbreak\n\t\t\t}\n\t\t}\n\t\tif foundConfig {\n\t\t\tcontinue\n\t\t}\n\n\t\t_ = m.im.DeleteConfig(key)\n\t\tprocess.stop()\n\t\tdelete(m.integrations, key)\n\t}\n\n\t// Re-apply configs to our instance manager for all running integrations.\n\t// Generated scrape configs may change in between calls to ApplyConfig even\n\t// if the configs for the integration didn't.\n\tfor key, p := range m.integrations {\n\t\tshouldCollect := cfg.ScrapeIntegrations\n\t\tif common := p.cfg.Common; common.ScrapeIntegration != nil {\n\t\t\tshouldCollect = *common.ScrapeIntegration\n\t\t}\n\n\t\tswitch shouldCollect {\n\t\tcase true:\n\t\t\tinstanceConfig := m.instanceConfigForIntegration(p, cfg)\n\t\t\tif err := m.validator(&instanceConfig); err != nil {\n\t\t\t\tlevel.Error(p.log).Log(\"msg\", \"failed to validate generated scrape config for integration. integration will not be scraped\", \"err\", err, \"integration\", p.cfg.Name())\n\t\t\t\tfailed = true\n\t\t\t\tbreak\n\t\t\t}\n\n\t\t\tif err := m.im.ApplyConfig(instanceConfig); err != nil {\n\t\t\t\tlevel.Error(p.log).Log(\"msg\", \"failed to apply integration. integration will not be scraped\", \"err\", err, \"integration\", p.cfg.Name())\n\t\t\t\tfailed = true\n\t\t\t}\n\t\tcase false:\n\t\t\t// If a previous instance of the config was being scraped, we need to\n\t\t\t// delete it here. Calling DeleteConfig when nothing is running is a safe\n\t\t\t// operation.\n\t\t\t_ = m.im.DeleteConfig(key)\n\t\t}\n\t}\n\n\tm.cfg = cfg\n\n\tif failed {\n\t\treturn fmt.Errorf(\"not all integrations were correctly updated\")\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "eb3bca84fc903bee7b9887d41f8a946e", "score": "0.53862226", "text": "func (s *application) ApplyConfiguration(cfg interface{}) error {\n\t// Check configuration validity\n\tif err := s.checkConfiguration(cfg); err != nil {\n\t\treturn err\n\t}\n\n\t// Apply to current component (type assertion done if check)\n\ts.cfg, _ = cfg.(*config.Configuration)\n\n\t// No error\n\treturn nil\n}", "title": "" }, { "docid": "4b7af9bc4131cbeeba69911a2e2b2aad", "score": "0.5330654", "text": "func (k *Kubernetes) Apply(state []Manifest, opts ApplyOpts) error {\n\tif k == nil {\n\t\treturn ErrorMissingConfig\n\t}\n\n\tyaml, err := k.Fmt(state)\n\tif err != nil {\n\t\treturn err\n\t}\n\treturn k.client.Apply(yaml, k.Spec.Namespace, opts)\n}", "title": "" }, { "docid": "3595254ac8300fc2a8f19cc324b77150", "score": "0.53092796", "text": "func patchApplyConfig(ctx context.Context, cli client.Client) error {\n\tdep := appsv1apply.Deployment(\"sample3\", \"default\").\n\t\tWithSpec(appsv1apply.DeploymentSpec().\n\t\t\tWithReplicas(3).\n\t\t\tWithSelector(metav1apply.LabelSelector().WithMatchLabels(map[string]string{\"app\": \"nginx\"})).\n\t\t\tWithTemplate(corev1apply.PodTemplateSpec().\n\t\t\t\tWithLabels(map[string]string{\"app\": \"nginx\"}).\n\t\t\t\tWithSpec(corev1apply.PodSpec().\n\t\t\t\t\tWithContainers(corev1apply.Container().\n\t\t\t\t\t\tWithName(\"nginx\").\n\t\t\t\t\t\tWithImage(\"nginx:latest\"),\n\t\t\t\t\t),\n\t\t\t\t),\n\t\t\t),\n\t\t)\n\n\tobj, err := runtime.DefaultUnstructuredConverter.ToUnstructured(dep)\n\tif err != nil {\n\t\treturn err\n\t}\n\tpatch := &unstructured.Unstructured{\n\t\tObject: obj,\n\t}\n\n\tvar current appsv1.Deployment\n\terr = cli.Get(ctx, client.ObjectKey{Namespace: \"default\", Name: \"sample3\"}, &current)\n\tif err != nil && !errors.IsNotFound(err) {\n\t\treturn err\n\t}\n\n\tcurrApplyConfig, err := appsv1apply.ExtractDeployment(&current, \"client-sample\")\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tif equality.Semantic.DeepEqual(dep, currApplyConfig) {\n\t\treturn nil\n\t}\n\n\terr = cli.Patch(ctx, patch, client.Apply, &client.PatchOptions{\n\t\tFieldManager: \"client-sample\",\n\t\tForce: pointer.Bool(true),\n\t})\n\treturn err\n}", "title": "" }, { "docid": "8c13e31af83f1080becb88b2571c7ea3", "score": "0.527686", "text": "func (conf *Config) ApplyConfig(stub shim.ChaincodeStubInterface) {\n\tobjs := (*conf)[\"objects\"]\n\n\tcreateTables(stub)\n\tfor _, v := range objs {\n\t\tif v[\"type\"] == \"table\" {\n\t\t\tprocessTable(stub, v)\n\t\t} else {\n\t\t\tprocessAction(stub, v)\n\t\t}\n\t}\n}", "title": "" }, { "docid": "95b4443681f86bcb9108438439df5601", "score": "0.5275438", "text": "func (fn OptionFunc) Apply(g *Group) {\n\tfn(g)\n}", "title": "" }, { "docid": "e624fd9771041508af53ec107f231864", "score": "0.5266729", "text": "func (c *Config) Apply(opts *heartbeat.AddOptions) {\n\topts.ExtensionName = c.ExtensionName\n\topts.Namespace = c.Namespace\n\topts.RenewIntervalSeconds = c.RenewIntervalSeconds\n}", "title": "" }, { "docid": "ca0f79629688a9d6cd5b174ee89def53", "score": "0.52581745", "text": "func (rws *WriteStorage) ApplyConfig(conf *config.Config) error {\n\trws.mtx.Lock()\n\tdefer rws.mtx.Unlock()\n\n\t// Remote write queues only need to change if the remote write config or\n\t// external labels change.\n\texternalLabelUnchanged := labels.Equal(conf.GlobalConfig.ExternalLabels, rws.externalLabels)\n\trws.externalLabels = conf.GlobalConfig.ExternalLabels\n\n\tnewQueues := make(map[string]*QueueManager)\n\tnewHashes := []string{}\n\tfor _, rwConf := range conf.RemoteWriteConfigs {\n\t\thash, err := toHash(rwConf)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\t// Don't allow duplicate remote write configs.\n\t\tif _, ok := newQueues[hash]; ok {\n\t\t\treturn fmt.Errorf(\"duplicate remote write configs are not allowed, found duplicate for URL: %s\", rwConf.URL)\n\t\t}\n\n\t\t// Set the queue name to the config hash if the user has not set\n\t\t// a name in their remote write config so we can still differentiate\n\t\t// between queues that have the same remote write endpoint.\n\t\tname := hash[:6]\n\t\tif rwConf.Name != \"\" {\n\t\t\tname = rwConf.Name\n\t\t}\n\n\t\tc, err := NewWriteClient(name, &ClientConfig{\n\t\t\tURL: rwConf.URL,\n\t\t\tTimeout: rwConf.RemoteTimeout,\n\t\t\tHTTPClientConfig: rwConf.HTTPClientConfig,\n\t\t\tSigV4Config: rwConf.SigV4Config,\n\t\t\tAzureADConfig: rwConf.AzureADConfig,\n\t\t\tHeaders: rwConf.Headers,\n\t\t\tRetryOnRateLimit: rwConf.QueueConfig.RetryOnRateLimit,\n\t\t})\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\tqueue, ok := rws.queues[hash]\n\t\tif externalLabelUnchanged && ok {\n\t\t\t// Update the client in case any secret configuration has changed.\n\t\t\tqueue.SetClient(c)\n\t\t\tnewQueues[hash] = queue\n\t\t\tdelete(rws.queues, hash)\n\t\t\tcontinue\n\t\t}\n\n\t\t// Redacted to remove any passwords in the URL (that are\n\t\t// technically accepted but not recommended) since this is\n\t\t// only used for metric labels.\n\t\tendpoint := rwConf.URL.Redacted()\n\t\tnewQueues[hash] = NewQueueManager(\n\t\t\tnewQueueManagerMetrics(rws.reg, name, endpoint),\n\t\t\trws.watcherMetrics,\n\t\t\trws.liveReaderMetrics,\n\t\t\trws.logger,\n\t\t\trws.dir,\n\t\t\trws.samplesIn,\n\t\t\trwConf.QueueConfig,\n\t\t\trwConf.MetadataConfig,\n\t\t\tconf.GlobalConfig.ExternalLabels,\n\t\t\trwConf.WriteRelabelConfigs,\n\t\t\tc,\n\t\t\trws.flushDeadline,\n\t\t\trws.interner,\n\t\t\trws.highestTimestamp,\n\t\t\trws.scraper,\n\t\t\trwConf.SendExemplars,\n\t\t\trwConf.SendNativeHistograms,\n\t\t)\n\t\t// Keep track of which queues are new so we know which to start.\n\t\tnewHashes = append(newHashes, hash)\n\t}\n\n\t// Anything remaining in rws.queues is a queue who's config has\n\t// changed or was removed from the overall remote write config.\n\tfor _, q := range rws.queues {\n\t\tq.Stop()\n\t}\n\n\tfor _, hash := range newHashes {\n\t\tnewQueues[hash].Start()\n\t}\n\n\trws.queues = newQueues\n\n\treturn nil\n}", "title": "" }, { "docid": "b4d632f1d031b5452187a5bb0266691c", "score": "0.5173312", "text": "func AppliedConfiguration(applied *netv1.NetworkConfig) (*uns.Unstructured, error) {\n\tapp, err := json.Marshal(applied.Spec)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tcm := &corev1.ConfigMap{\n\t\tTypeMeta: metav1.TypeMeta{\n\t\t\tAPIVersion: \"v1\",\n\t\t\tKind: \"ConfigMap\",\n\t\t},\n\t\tObjectMeta: metav1.ObjectMeta{\n\t\t\tNamespace: NAMESPACE,\n\t\t\tName: NAME_PREFIX + applied.Name,\n\t\t},\n\t\tData: map[string]string{\n\t\t\t\"applied\": string(app),\n\t\t},\n\t}\n\n\t// transmute to unstructured\n\tb, err := json.Marshal(cm)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tu := &uns.Unstructured{}\n\tif err := json.Unmarshal(b, &u); err != nil {\n\t\treturn nil, err\n\t}\n\treturn u, nil\n}", "title": "" }, { "docid": "a76b1d625c9aaf82743955aad773c4a4", "score": "0.51601523", "text": "func (ct *Throttler) ApplyConfig(config ThrottlerConfig) error {\n\t// assemble exempted nets\n\texemptedNets, err := utils.ParseNetList(config.Exempted)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"Could not parse throttle exemption list: %v\", err.Error())\n\t}\n\n\tct.Lock()\n\tdefer ct.Unlock()\n\n\tif ct.population == nil {\n\t\tct.population = make(map[string]ThrottleDetails)\n\t}\n\n\tct.enabled = config.Enabled\n\tct.ipv4Mask = net.CIDRMask(config.CidrLenIPv4, 32)\n\tct.ipv6Mask = net.CIDRMask(config.CidrLenIPv6, 128)\n\tct.subnetLimit = config.ConnectionsPerCidr\n\tct.duration = config.Duration\n\tct.banDuration = config.BanDuration\n\tct.banMessage = config.BanMessage\n\tct.exemptedNets = exemptedNets\n\n\treturn nil\n}", "title": "" }, { "docid": "e43ed0462cae81607c9970332c634f43", "score": "0.5141027", "text": "func (c *ControllerConfig) Apply(opts *AddOptions) {\n\topts.BackupBucketPath = c.BackupBucketPath\n\topts.ContainerMountPath = c.ContainerMountPath\n}", "title": "" }, { "docid": "65785510ae6b6eeb7421764c963d92ac", "score": "0.5136898", "text": "func (b *ObjectReferenceApplyConfiguration) WithGroup(value string) *ObjectReferenceApplyConfiguration {\n\tb.Group = &value\n\treturn b\n}", "title": "" }, { "docid": "43dce2174fcfd37afe98d2a11c5f63af", "score": "0.51327044", "text": "func (c *Config) ApplyBastionConfig(config *config.BastionConfig) {\n\tif c.Config.BastionConfig != nil {\n\t\t*config = *c.Config.BastionConfig\n\t}\n}", "title": "" }, { "docid": "1cc4b661b525e2af0b8998cd7c061d87", "score": "0.512995", "text": "func MergeConfig(base *Configuration, overlay *Configuration) *Configuration {\n\tbase = base.Copy()\n\toverlay = overlay.Copy()\n\n\t// Copy the scope to overlay, since they will be replaced with CopyStruct\n\tif overlay.Scope != nil && base.Scope != nil {\n\t\tfor sk, sv := range *overlay.Scope {\n\t\t\t(*base.Scope)[sk] = sv\n\t\t}\n\t\toverlay.Scope = base.Scope\n\t}\n\toverlay.ForbiddenUsers = MergeStringArrays(base.ForbiddenUsers, overlay.ForbiddenUsers)\n\toverlay.Preload = MergeStringArrays(base.Preload, overlay.Preload)\n\n\tCopyStructIfPtrSet(base, overlay)\n\n\tif len(overlay.UserSettingsSchema) > 0 {\n\t\tMergeMap(base.UserSettingsSchema, overlay.UserSettingsSchema)\n\t}\n\n\t// Merge the ObjectTypes map\n\tfor ak, av := range overlay.ObjectTypes {\n\t\tcv, ok := base.ObjectTypes[ak]\n\t\tif ok {\n\t\t\t// Copy the scope to av\n\t\t\tif av.Scope != nil && cv.Scope != nil {\n\t\t\t\tfor sk, sv := range *av.Scope {\n\t\t\t\t\t(*cv.Scope)[sk] = sv\n\t\t\t\t}\n\t\t\t\tav.Scope = cv.Scope\n\t\t\t}\n\t\t\t// Copy the routes to av\n\t\t\tif av.Routes != nil && cv.Routes != nil {\n\t\t\t\tfor rk, rv := range *av.Routes {\n\t\t\t\t\t(*cv.Routes)[rk] = rv\n\t\t\t\t}\n\t\t\t\tav.Routes = cv.Routes\n\t\t\t}\n\n\t\t\t// Update only the set values\n\t\t\tCopyStructIfPtrSet(&cv, &av)\n\t\t\tbase.ObjectTypes[ak] = cv\n\t\t} else {\n\t\t\tbase.ObjectTypes[ak] = av\n\t\t}\n\t}\n\n\tfor k, v := range overlay.RunTypes {\n\t\tbv, ok := base.RunTypes[k]\n\t\tif ok {\n\t\t\tCopyStructIfPtrSet(&bv, &v)\n\t\t\tif len(v.ConfigSchema) > 0 {\n\t\t\t\tbv.ConfigSchema = v.ConfigSchema\n\t\t\t}\n\t\t\tbase.RunTypes[k] = bv\n\t\t} else {\n\t\t\tbase.RunTypes[k] = v\n\t\t}\n\t}\n\n\t// Now go into the plugins, and continue the good work\n\tfor pluginName, oplugin := range overlay.Plugins {\n\t\tbplugin, ok := base.Plugins[pluginName]\n\t\tif !ok {\n\t\t\t// We take the overlay's plugin wholesale\n\t\t\tbase.Plugins[pluginName] = oplugin\n\n\t\t} else {\n\t\t\toplugin.Preload = MergeStringArrays(bplugin.Preload, oplugin.Preload)\n\t\t\t// Need to continue settings merge into the children\n\t\t\tCopyStructIfPtrSet(bplugin, oplugin)\n\n\t\t\t// Exec jobs\n\t\t\tfor execName, oexecValue := range oplugin.Run {\n\t\t\t\tbexecValue, ok := bplugin.Run[execName]\n\t\t\t\tif !ok {\n\t\t\t\t\tbplugin.Run[execName] = oexecValue\n\t\t\t\t} else {\n\t\t\t\t\tCopyStructIfPtrSet(&bexecValue, &oexecValue)\n\t\t\t\t\tfor rsn, rsv := range oexecValue.Config {\n\t\t\t\t\t\tbexecValue.Config[rsn] = rsv\n\t\t\t\t\t}\n\t\t\t\t\tbplugin.Run[execName] = bexecValue\n\t\t\t\t}\n\n\t\t\t}\n\t\t\tfor _, oV := range oplugin.On {\n\t\t\t\tbplugin.On = append(bplugin.On, oV)\n\t\t\t}\n\n\t\t\tfor cName, ocValue := range oplugin.Apps {\n\t\t\t\tbcValue, ok := bplugin.Apps[cName]\n\t\t\t\tif !ok {\n\t\t\t\t\tbplugin.Apps[cName] = ocValue\n\t\t\t\t} else {\n\t\t\t\t\tfor _, oV := range ocValue.On {\n\t\t\t\t\t\tbcValue.On = append(bcValue.On, oV)\n\t\t\t\t\t}\n\t\t\t\t\tCopyStructIfPtrSet(bcValue, ocValue)\n\t\t\t\t\tfor sName, sValue := range ocValue.Objects {\n\t\t\t\t\t\tbsValue, ok := bcValue.Objects[sName]\n\t\t\t\t\t\tif !ok {\n\t\t\t\t\t\t\tbcValue.Objects[sName] = sValue\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tfor _, oV := range sValue.On {\n\t\t\t\t\t\t\t\tbsValue.On = append(bsValue.On, oV)\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tCopyStructIfPtrSet(bsValue, sValue)\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t// Schema copy\n\t\t\tif len(oplugin.ConfigSchema) > 0 {\n\t\t\t\tMergeMap(bplugin.ConfigSchema, oplugin.ConfigSchema)\n\t\t\t}\n\t\t\tif len(oplugin.UserSettingsSchema) > 0 {\n\t\t\t\tMergeMap(bplugin.UserSettingsSchema, oplugin.UserSettingsSchema)\n\t\t\t}\n\n\t\t\t// Settings copy\n\t\t\tfor settingName, osettingValue := range oplugin.Config {\n\t\t\t\t// If the setting values are both objects,\n\t\t\t\t// then merge the object's first level. Otherwise, replace\n\n\t\t\t\tv, ok := bplugin.Config[settingName]\n\t\t\t\tif ok {\n\t\t\t\t\tvar v2 map[string]interface{}\n\t\t\t\t\tvar ov2 map[string]interface{}\n\t\t\t\t\tv2, ok = v.(map[string]interface{})\n\t\t\t\t\tif ok {\n\t\t\t\t\t\tov2, ok = osettingValue.(map[string]interface{})\n\t\t\t\t\t\tif ok {\n\t\t\t\t\t\t\tMergeMap(v2, ov2)\n\t\t\t\t\t\t\tbplugin.Config[settingName] = v2\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tif !ok {\n\t\t\t\t\tbplugin.Config[settingName] = osettingValue\n\t\t\t\t}\n\n\t\t\t}\n\t\t}\n\t}\n\n\tif overlay.Verbose {\n\t\tbase.Verbose = true\n\t}\n\n\treturn base\n\n}", "title": "" }, { "docid": "1ca8335c3eb23be8f685b4338f61a61b", "score": "0.5124567", "text": "func (c *Panorama) ConfigureGroup(dg string, objs []Entry, prevNames []string) error {\n\tvar err error\n\tsetList := make([]Entry, 0, len(objs))\n\teditList := make([]Entry, 0, len(objs))\n\n\tcurObjs, err := c.GetAll(dg)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// Determine which can be set and which must be edited.\n\tfor _, x := range objs {\n\t\tvar found bool\n\t\tfor _, live := range curObjs {\n\t\t\tif x.Name == live.Name {\n\t\t\t\tfound = true\n\t\t\t\tif !ObjectsMatch(x, live) {\n\t\t\t\t\teditList = append(editList, x)\n\t\t\t\t}\n\t\t\t\tbreak\n\t\t\t}\n\t\t}\n\t\tif !found {\n\t\t\tsetList = append(setList, x)\n\t\t}\n\t}\n\n\t// Set all objects.\n\tif len(setList) > 0 {\n\t\tif err = c.Set(dg, setList...); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\t// Edit each object one by one.\n\tfor _, x := range editList {\n\t\tif err = c.Edit(dg, x); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\t// Delete rules removed from the group.\n\tif len(prevNames) != 0 {\n\t\trmList := make([]interface{}, 0, len(prevNames))\n\t\tfor _, name := range prevNames {\n\t\t\tvar found bool\n\t\t\tfor _, x := range objs {\n\t\t\t\tif x.Name == name {\n\t\t\t\t\tfound = true\n\t\t\t\t\tbreak\n\t\t\t\t}\n\t\t\t}\n\t\t\tif !found {\n\t\t\t\trmList = append(rmList, name)\n\t\t\t}\n\t\t}\n\n\t\tif err = c.Delete(dg, rmList...); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "83dc4f97680becb125f3062ebdff0eed", "score": "0.51190805", "text": "func (c *Config) Apply(opts ...Option) error {\n\tfor _, opt := range opts {\n\t\terr := opt(c)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "e1d9f70004cdf308f3b4d654786f8254", "score": "0.51180387", "text": "func (i *Installation) ConfigMergedWithGroup() bool {\n\treturn i.configMergedWithGroup\n}", "title": "" }, { "docid": "eb190a91167ce8786220630a4c554e61", "score": "0.5116945", "text": "func (o *Options) ApplyTo(c *deschedulerappconfig.Config) error {\n\tif len(o.ConfigFile) == 0 {\n\t\to.ApplyLeaderElectionTo(o.ComponentConfig)\n\t\tc.ComponentConfig = *o.ComponentConfig\n\t} else {\n\t\tcfg, err := loadConfigFromFile(o.ConfigFile)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\t// If the --config arg is specified, honor the leader election CLI args only.\n\t\to.ApplyLeaderElectionTo(cfg)\n\n\t\tif err := validation.ValidateDeschedulerConfiguration(cfg); err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\tc.ComponentConfig = *cfg\n\n\t\t// use the loaded config file only, with the exception of --address and --port.\n\t\tif err := o.CombinedInsecureServing.ApplyToFromLoadedConfig(c, &c.ComponentConfig); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\tif err := o.SecureServing.ApplyTo(&c.SecureServing, &c.LoopbackClientConfig); err != nil {\n\t\treturn err\n\t}\n\to.Metrics.Apply()\n\n\treturn nil\n}", "title": "" }, { "docid": "e1cf3c80046667b59a78e8adc2a1f581", "score": "0.5116088", "text": "func (s *ConfigServer) applyConfig(ctx context.Context, c *beta.Client, request *betapb.ApplyIdentitytoolkitBetaConfigRequest) (*betapb.IdentitytoolkitBetaConfig, error) {\n\tp := ProtoToConfig(request.GetResource())\n\tres, err := c.ApplyConfig(ctx, p)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tr := ConfigToProto(res)\n\treturn r, nil\n}", "title": "" }, { "docid": "a39eb350716460321e704e7bd7d6cb04", "score": "0.5103878", "text": "func (i *Installation) MergeWithGroup(group *Group, includeOverrides bool) {\n\tif i.ConfigMergedWithGroup() {\n\t\treturn\n\t}\n\tif group == nil {\n\t\treturn\n\t}\n\n\ti.configMergedWithGroup = true\n\ti.configMergeGroupSequence = group.Sequence\n\n\ti.GroupOverrides = make(map[string]string)\n\tif group.MattermostEnv != nil && i.MattermostEnv == nil {\n\t\ti.MattermostEnv = make(EnvVarMap)\n\t}\n\n\tif len(group.Version) != 0 && i.Version != group.Version {\n\t\tif includeOverrides {\n\t\t\ti.GroupOverrides[\"Installation Version\"] = i.Version\n\t\t\ti.GroupOverrides[\"Group Version\"] = group.Version\n\t\t}\n\t\ti.Version = group.Version\n\t}\n\tif len(group.Image) != 0 && i.Image != group.Image {\n\t\tif includeOverrides {\n\t\t\ti.GroupOverrides[\"Installation Image\"] = i.Image\n\t\t\ti.GroupOverrides[\"Group Image\"] = group.Image\n\t\t}\n\t\ti.Image = group.Image\n\t}\n\tfor key, value := range group.MattermostEnv {\n\t\tif includeOverrides {\n\t\t\tif _, ok := i.MattermostEnv[key]; ok {\n\t\t\t\ti.GroupOverrides[fmt.Sprintf(\"Installation MattermostEnv[%s]\", key)] = i.MattermostEnv[key].Value\n\t\t\t\ti.GroupOverrides[fmt.Sprintf(\"Group MattermostEnv[%s]\", key)] = value.Value\n\t\t\t}\n\t\t}\n\t\ti.MattermostEnv[key] = value\n\t}\n}", "title": "" }, { "docid": "cafdcee42f012abcebcb1fe709e745d4", "score": "0.50806767", "text": "func ApplyToConfigSetWithProvider(configPath string, cs ConfigurationSet, provider string) error {\n\treturn applyConfiguration(configPath, cs, provider)\n}", "title": "" }, { "docid": "e10c60057698c086afffa1c02362972e", "score": "0.50788325", "text": "func (o *Options) ApplyTo(c *schedulerappconfig.Config) error {\n\tif len(o.ConfigFile) == 0 {\n\t\tc.ComponentConfig = o.ComponentConfig\n\t} else {\n\t\tcfg, err := loadConfigFromFile(o.ConfigFile)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\t// use the loaded config file only, with the exception of --address and --port. This means that\n\t\t// none of the deprecated flags in o.Deprecated are taken into consideration. This is the old\n\t\t// behaviour of the flags we have to keep.\n\t\tc.ComponentConfig = *cfg\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "cbd2b760fcc8997a73653921af6603bf", "score": "0.5077812", "text": "func Process(config config.Config) {\n\n\tfor k, v := range config.Groups {\n\n\t\tcreateGroups(k, v)\n\t}\n}", "title": "" }, { "docid": "fc08cf677f84766c7e597b55c7f4aadf", "score": "0.50731796", "text": "func (g *generator) ApplyConfig(config *generation.Config) generation.Generator {\n\tif config == nil || config.SwaggerDocs == nil {\n\t\treturn g\n\t}\n\n\toutputFileName := DefaultOutputFileName\n\tif config.SwaggerDocs.OutputFileName != \"\" {\n\t\toutputFileName = config.SwaggerDocs.OutputFileName\n\t}\n\n\treturn NewGenerator(Options{\n\t\tDisabled: config.SwaggerDocs.Disabled,\n\t\tCommentPolicy: config.SwaggerDocs.CommentPolicy,\n\t\tOutputFileName: outputFileName,\n\t\tVerify: g.verify,\n\t})\n}", "title": "" }, { "docid": "73b2233143fe979f01c9604079822f7b", "score": "0.5011302", "text": "func (c *FakeOAuths) Apply(ctx context.Context, oAuth *applyconfigurationsconfigv1.OAuthApplyConfiguration, opts v1.ApplyOptions) (result *configv1.OAuth, err error) {\n\tif oAuth == nil {\n\t\treturn nil, fmt.Errorf(\"oAuth provided to Apply must not be nil\")\n\t}\n\tdata, err := json.Marshal(oAuth)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tname := oAuth.Name\n\tif name == nil {\n\t\treturn nil, fmt.Errorf(\"oAuth.Name must be provided to Apply\")\n\t}\n\tobj, err := c.Fake.\n\t\tInvokes(testing.NewRootPatchSubresourceAction(oauthsResource, *name, types.ApplyPatchType, data), &configv1.OAuth{})\n\tif obj == nil {\n\t\treturn nil, err\n\t}\n\treturn obj.(*configv1.OAuth), err\n}", "title": "" }, { "docid": "3d6ebad91a8e2b94c2837212bf42d9f5", "score": "0.5008656", "text": "func (writer *Writer) UpdateConfig(fn func(Config) Config) error {\n\twriter.lock.Lock()\n\tdefer writer.lock.Unlock()\n\n\tconfig := fn(writer.config)\n\tif err := writer.setConfig(&config); err != nil {\n\t\treturn fmt.Errorf(\"writer/file.UpdateConfig: %v\", err)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "2c8d1617eb1dc1f06bfa159892647364", "score": "0.5008346", "text": "func (c *Config) ApplyHealthCheckConfig(config *healthcheckconfig.HealthCheckConfig) {\n\tif c.Config.HealthCheckConfig != nil {\n\t\t*config = *c.Config.HealthCheckConfig\n\t}\n}", "title": "" }, { "docid": "8b284c1e77ae1a378683eb9be119c1d6", "score": "0.50063306", "text": "func (zk *ZkGovImpl) SetConfig(key string, value string) error {\n\tif key == \"\" || value == \"\" {\n\t\treturn errors.New(\"key or value is empty\")\n\t}\n\terr := zk.configCenter.PublishConfig(key, zk.group, value)\n\tif err != nil {\n\t\tif perrors.Is(err, gozk.ErrNodeExists) {\n\t\t\treturn &RuleExists{err}\n\t\t}\n\t\treturn err\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "f42a72cc193a2d3f7b1db8ec504873c4", "score": "0.4972649", "text": "func (m *AISBackendProvider) Apply(v any, action string, cfg *cmn.ClusterConfig) (err error) {\n\tconf := cmn.BackendConfAIS{}\n\tif err = cos.MorphMarshal(v, &conf); err != nil {\n\t\terr = fmt.Errorf(\"%s: invalid ais backend config (%+v, %T): %v\", m.t, v, v, err)\n\t\tdebug.AssertNoErr(err)\n\t\treturn\n\t}\n\tnlog.Infof(\"%s: apply %q %+v Conf v%d\", m.t, action, conf, cfg.Version)\n\tm.mu.Lock()\n\terr = m._apply(cfg, conf, action)\n\tif err == nil {\n\t\tm.appliedCfgVer = cfg.Version\n\t}\n\tm.mu.Unlock()\n\treturn\n}", "title": "" }, { "docid": "86f481ac0e16b684fa105b937fad45b5", "score": "0.4964193", "text": "func (s SaslConfig) Apply(conf *sarama.Config) error {\n\tif s.Enabled == false {\n\t\treturn nil\n\t}\n\tif s.User == \"\" || s.Password == \"\" {\n\t\treturn ErrNoUsernameAndPassword\n\t}\n\tif s.Mechanism == \"\" {\n\t\ts.Mechanism = sarama.SASLTypePlaintext\n\t}\n\n\tswitch s.Mechanism {\n\tcase sarama.SASLTypeSCRAMSHA256:\n\t\tconf.Net.SASL.SCRAMClientGeneratorFunc = func() sarama.SCRAMClient {\n\t\t\treturn &XDGSCRAMClient{HashGeneratorFcn: SHA256}\n\t\t}\n\tcase sarama.SASLTypeSCRAMSHA512:\n\t\tconf.Net.SASL.SCRAMClientGeneratorFunc = func() sarama.SCRAMClient {\n\t\t\treturn &XDGSCRAMClient{HashGeneratorFcn: SHA512}\n\t\t}\n\tdefault:\n\t\treturn ErrUnsupportedSASLMechanism\n\t}\n\n\tconf.Net.SASL.Enable = true\n\tconf.Net.SASL.User = s.User\n\tconf.Net.SASL.Password = s.Password\n\tconf.Net.SASL.Mechanism = sarama.SASLMechanism(s.Mechanism)\n\n\treturn nil\n}", "title": "" }, { "docid": "73f35db27c3b832ba9aa8d6f81b770e7", "score": "0.49518052", "text": "func (c Config) Apply(o *InitializationOptions) Config {\n\tif o == nil {\n\t\treturn c\n\t}\n\tif o.DisableFuncSnippet != nil {\n\t\tc.DisableFuncSnippet = *o.DisableFuncSnippet\n\t}\n\n\tif o.DiagnosticsStyle != nil {\n\t\tc.DiagnosticsStyle = *o.DiagnosticsStyle\n\t}\n\n\tif o.GlobalCacheStyle != nil {\n\t\tc.GlobalCacheStyle = *o.GlobalCacheStyle\n\t}\n\n\tif o.FormatStyle != nil {\n\t\tc.FormatStyle = *o.FormatStyle\n\t}\n\n\tif o.EnhanceSignatureHelp != nil {\n\t\tc.EnhanceSignatureHelp = *o.EnhanceSignatureHelp\n\t}\n\n\tif o.GoimportsLocalPrefix != nil {\n\t\tc.GoimportsLocalPrefix = *o.GoimportsLocalPrefix\n\t}\n\n\tif o.BuildTags != nil {\n\t\tc.BuildTags = o.BuildTags\n\t}\n\n\treturn c\n}", "title": "" }, { "docid": "d79be45e511968bf1a15713ec398a924", "score": "0.4942094", "text": "func (l *LocalDB) apply(configName string) error {\n\n\tclusterName := l.configMap.GetObjectMeta().GetLabels()[config.LABEL_PG_CLUSTER]\n\tnamespace := l.configMap.GetObjectMeta().GetNamespace()\n\n\tlog.Debugf(\"Cluster Config: applying local config %s in cluster %s \"+\n\t\t\"(namespace %s)\", configName, clusterName, namespace)\n\n\tlocalConfig, err := l.getLocalConfig(configName)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// selector in the format \"pg-cluster=<cluster-name>,deployment-name=<server-name>\"\n\tselector := fmt.Sprintf(\"%s=%s,%s=%s\", config.LABEL_PG_CLUSTER, clusterName,\n\t\tconfig.LABEL_DEPLOYMENT_NAME, strings.TrimSuffix(configName, pghLocalConfigSuffix))\n\tdbPodList, err := l.kubeclientset.CoreV1().Pods(namespace).List(metav1.ListOptions{\n\t\tLabelSelector: selector,\n\t})\n\tif err != nil {\n\t\treturn err\n\t}\n\tdbPod := &dbPodList.Items[0]\n\n\t// add the config name and patroni port as params for the call to the apply & reload script\n\tapplyCommand := append(applyAndReloadConfigCMD, localConfig, config.DEFAULT_PATRONI_PORT)\n\n\tstdout, stderr, err := kubeapi.ExecToPodThroughAPI(l.restConfig, l.kubeclientset, applyCommand,\n\t\tdbPod.Spec.Containers[0].Name, dbPod.GetName(), namespace, nil)\n\n\tif err != nil {\n\t\tlog.Error(stderr, stdout)\n\t\treturn err\n\t}\n\n\tlog.Debugf(\"Cluster Config: successfully applied local config %s in cluster %s \"+\n\t\t\"(namespace %s)\", configName, clusterName, namespace)\n\n\treturn nil\n}", "title": "" }, { "docid": "fd0b498b770659782a0348c9ee3a6a37", "score": "0.49404222", "text": "func (iface Interface) mergeConfigs(input *Interface, equalPriority bool) {\n\tm := false\n\t// merge VF groups (input.VfGroups already contains the highest priority):\n\t// - skip group with same ResourceName,\n\t// - skip overlapping groups (use only highest priority)\n\tfor _, gr := range iface.VfGroups {\n\t\tif gr.ResourceName == input.VfGroups[0].ResourceName || gr.isVFRangeOverlapping(input.VfGroups[0]) {\n\t\t\tcontinue\n\t\t}\n\t\tm = true\n\t\tinput.VfGroups = append(input.VfGroups, gr)\n\t}\n\n\tif !equalPriority && !m {\n\t\treturn\n\t}\n\n\t// mtu configuration we take the highest value\n\tif input.Mtu < iface.Mtu {\n\t\tinput.Mtu = iface.Mtu\n\t}\n\tif input.NumVfs < iface.NumVfs {\n\t\tinput.NumVfs = iface.NumVfs\n\t}\n}", "title": "" }, { "docid": "fcc519ec9993da0a61c60695a688b6cc", "score": "0.49374244", "text": "func (c *Config) Merge(b *Config) *Config {\n\n\tif b == nil {\n\t\treturn c\n\t}\n\n\tresult := *c\n\n\tif b.UI {\n\t\tresult.UI = true\n\t}\n\tif b.LogLevel != \"\" {\n\t\tresult.LogLevel = b.LogLevel\n\t}\n\tif b.DataDir != \"\" {\n\t\tresult.DataDir = b.DataDir\n\t}\n\tif b.BindAddr != \"\" {\n\t\tresult.BindAddr = b.BindAddr\n\t}\n\n\t// Apply the ports config\n\tif result.Ports == nil && b.Ports != nil {\n\t\tports := *b.Ports\n\t\tresult.Ports = &ports\n\t} else if b.Ports != nil {\n\t\tresult.Ports = result.Ports.Merge(b.Ports)\n\t}\n\n\t// Apply the hotspot config\n\tif result.Hotspot == nil && b.Hotspot != nil {\n\t\thotspot := *b.Hotspot\n\t\tresult.Hotspot = &hotspot\n\t} else if b.Hotspot != nil {\n\t\tresult.Hotspot = result.Hotspot.Merge(b.Hotspot)\n\t}\n\n\treturn &result\n}", "title": "" }, { "docid": "fb1f5b0714751d5d96e53df163835f36", "score": "0.49330243", "text": "func (ssc *SystemStatsConfig) ApplyConfiguration() error {\n\tif ssc.InvokeIntervalString == \"\" {\n\t\tssc.InvokeIntervalString = defaultInvokeIntervalString\n\t}\n\tif ssc.DiskConfig.LsblkTimeoutString == \"\" {\n\t\tssc.DiskConfig.LsblkTimeoutString = defaultlsblkTimeoutString\n\t}\n\tif ssc.OsFeatureConfig.KnownModulesConfigPath == \"\" {\n\t\tssc.OsFeatureConfig.KnownModulesConfigPath = defaultKnownModulesConfigPath\n\t}\n\n\tvar err error\n\tssc.InvokeInterval, err = time.ParseDuration(ssc.InvokeIntervalString)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"error in parsing InvokeIntervalString %q: %v\", ssc.InvokeIntervalString, err)\n\t}\n\tssc.DiskConfig.LsblkTimeout, err = time.ParseDuration(ssc.DiskConfig.LsblkTimeoutString)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"error in parsing LsblkTimeoutString %q: %v\", ssc.DiskConfig.LsblkTimeoutString, err)\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "ad3b0bd51ad431010e6f6f4e2dd64d72", "score": "0.49187002", "text": "func Applycfg(host *models.Account) error {\n\tcfgPath := path.Join(\"/go\", \"/cfgfile/board.cfg\")\n\terr := os.Rename(cfgPath, cfgPath+\".bak1\")\n\tif err != nil {\n\t\tif !os.IsNotExist(err) { // fine if the file does not exists\n\t\t\treturn err\n\t\t}\n\t}\n\terr = os.Rename(cfgPath+\".tmp\", cfgPath)\n\tif err != nil {\n\t\tif !os.IsNotExist(err) { // fine if the file does not exists\n\t\t\treturn err\n\t\t}\n\t}\n\t_, err = Execute(fmt.Sprintf(\"cp %s %s.tmp\", cfgPath, cfgPath))\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tif err = StartBoard(host, &logBuffer); err != nil {\n\t\treturn err\n\t}\n\n\tif err = os.Remove(cfgPath + \".tmp\"); err != nil {\n\t\treturn err\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "1c505a1541b39e3ba3ad9561af1e5653", "score": "0.49184513", "text": "func ApplyConfigContext(ctx context.Context, c *Config) error {\n\treturn nftexec.ApplyConfig(ctx, c)\n}", "title": "" }, { "docid": "7fc255806cbc9f405fb414551535f4ad", "score": "0.49078602", "text": "func (application *Application) ApplyConfig(c *web.C, h http.Handler) http.Handler {\n\tfn := func(w http.ResponseWriter, r *http.Request) {\n\t\tc.Env[\"DBSession\"] = application.DBSession\n\t\tc.Env[\"Config\"] = application.Configuration\n\t\tc.Env[\"QueueChannel\"] = application.QueueChannel\n\n\t\th.ServeHTTP(w, r)\n\t}\n\treturn http.HandlerFunc(fn)\n}", "title": "" }, { "docid": "de9dcbbd32d62e6ba79e52bb52b4f6ea", "score": "0.4905039", "text": "func (format *Aggregate) Configure(conf core.PluginConfigReader) {\n\tapplyTo := conf.GetString(\"ApplyTo\", \"\")\n\n\t// init modulator array\n\tmodulatorSettings := format.getModulatorSettings(applyTo, conf)\n\n\tconfig := core.NewPluginConfig(\"\", \"format.Aggregate.Modulators\")\n\tconfig.Override(\"Modulators\", modulatorSettings)\n\tmodulatorReader := core.NewPluginConfigReaderWithError(&config)\n\n\tmodulatorArray, err := modulatorReader.GetModulatorArray(\"Modulators\", format.Logger, core.ModulatorArray{})\n\tif err != nil {\n\t\tconf.Errors.Push(err)\n\t}\n\n\tformat.modulators = modulatorArray\n}", "title": "" }, { "docid": "eaa441737485abb2cecaed63df5b4f15", "score": "0.49014765", "text": "func ApplyConfiguration(appConfig *configuration.ApplicationConfiguration) (err error) {\n\terr = logging.ApplyConfiguration(appConfig.LogConfig)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\terr = server.ApplyConfiguration(appConfig.ServerConfig)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\terr = database.ApplyConfiguration(appConfig.DatabaseConfig)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tlogging.Info(fmt.Sprintf(\"Loaded Configuration: %+v .\", appConfig))\n\treturn nil\n}", "title": "" }, { "docid": "35f9431daf62398d19d9bb0c1b809bd6", "score": "0.48859382", "text": "func RemoveGroupConfig(db Database, grID int) error {\n\tcriteria := make(map[string]interface{})\n\tcriteria[\"Group\"] = grID\n\treturn db.DeleteRecord(pconst.DbConfig, pconst.TbGroups, criteria)\n}", "title": "" }, { "docid": "ba573950cfb906798a3a8af88d6a3ab7", "score": "0.48801115", "text": "func (l *Logger) Apply(lc *LogConf) *Logger {\n\tif lc != nil {\n\t\tl.cfg = lc\n\t\tconfig := fmt.Sprintf(\"{\\\"filename\\\":\\\"%s\\\",\\\"level\\\":%d}\", lc.logFile, lc.logLevel)\n\t\tl.log.DelLogger(lc.logWay)\n\t\tl.log.SetLogger(lc.logWay, config)\n\t}\n\treturn l\n}", "title": "" }, { "docid": "4978cdd99d0d35854e8b96a3602f2ce1", "score": "0.48758018", "text": "func (h *HatcherySwarm) ApplyConfiguration(cfg interface{}) error {\n\tif err := h.CheckConfiguration(cfg); err != nil {\n\t\treturn err\n\t}\n\n\tvar ok bool\n\th.Config, ok = cfg.(HatcheryConfiguration)\n\tif !ok {\n\t\treturn fmt.Errorf(\"Invalid configuration\")\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "14929fa0c90f37ab0179d48ba0f8a795", "score": "0.4870892", "text": "func (g *Group) Apply(opts ...Option) *Group {\n\tfor _, o := range opts {\n\t\tif o == nil {\n\t\t\tcontinue\n\t\t}\n\t\to.Apply(g)\n\t}\n\treturn g\n}", "title": "" }, { "docid": "487d7a8d7bfe911b878143320a6f0ffd", "score": "0.48702943", "text": "func (svc localConfigsSVC) UpdateConfig(up Config) (Config, error) {\n\tcfgs, err := svc.ListConfigs()\n\tif err != nil {\n\t\treturn Config{}, err\n\t}\n\tp0, ok := cfgs[up.Name]\n\tif !ok {\n\t\treturn Config{}, &influxdb.Error{\n\t\t\tCode: influxdb.ENotFound,\n\t\t\tMsg: fmt.Sprintf(\"config %q is not found\", up.Name),\n\t\t}\n\t}\n\tif up.Token != \"\" {\n\t\tp0.Token = up.Token\n\t}\n\tif up.Host != \"\" {\n\t\tp0.Host = up.Host\n\t}\n\tif up.Org != \"\" {\n\t\tp0.Org = up.Org\n\t}\n\n\tcfgs[up.Name] = p0\n\tif up.Active {\n\t\tif err := cfgs.Switch(up.Name); err != nil {\n\t\t\treturn Config{}, err\n\t\t}\n\t}\n\n\treturn cfgs[up.Name], svc.writeConfigs(cfgs)\n}", "title": "" }, { "docid": "861e19e9dcd32b84bd2f17c2c6d48d7f", "score": "0.48693973", "text": "func (config Configuration) MergeConfig(other Configuration) {\n\tfor key, value := range other {\n\t\tif _, exists := config[key]; !exists {\n\t\t\tconfig[key] = value\n\t\t} else {\n\t\t\tswitch value.Value.(type) {\n\t\t\tcase map[string]interface{}:\n\t\t\t\tswitch config[key].Value.(type) {\n\t\t\t\tcase map[string]interface{}:\n\t\t\t\t\tconfig[key].Obj.MergeConfig(other[key].Obj)\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\t// config.Collapse()\n}", "title": "" }, { "docid": "fcd35a5b5f55b76ca0bb94ca36718536", "score": "0.48684558", "text": "func (o ForwardingRuleRuleActionOutput) ForwardGroupConfig() ForwardingRuleRuleActionForwardGroupConfigPtrOutput {\n\treturn o.ApplyT(func(v ForwardingRuleRuleAction) *ForwardingRuleRuleActionForwardGroupConfig {\n\t\treturn v.ForwardGroupConfig\n\t}).(ForwardingRuleRuleActionForwardGroupConfigPtrOutput)\n}", "title": "" }, { "docid": "19940972ce1adb22a28169efedce5b68", "score": "0.4867069", "text": "func (c *Config) ApplyOutput(name string, v interface{}) error {\n\tif c.outputs[name] != nil {\n\t\treturn mergeStruct(v, c.outputs[name], c.outputFieldsSet[name])\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "b5934258e935b7fa7d368fb3abc1cf69", "score": "0.48571736", "text": "func (r *CustomersDevicesService) ApplyConfiguration(parent string, customerapplyconfigurationrequest *CustomerApplyConfigurationRequest) *CustomersDevicesApplyConfigurationCall {\n\tc := &CustomersDevicesApplyConfigurationCall{s: r.s, urlParams_: make(gensupport.URLParams)}\n\tc.parent = parent\n\tc.customerapplyconfigurationrequest = customerapplyconfigurationrequest\n\treturn c\n}", "title": "" }, { "docid": "d3af50af1263fb92128483031f4648c3", "score": "0.48568735", "text": "func (s *Suite) Apply(c *db.Connection) (err error) {\n\tdefer s.writeStats()\n\tdefer func() {\n\t\tif r := recover(); r != nil {\n\t\t\terr = exception.New(r)\n\t\t}\n\t}()\n\n\tfor _, group := range s.groups {\n\t\tif err = group.Invoke(s, c); err != nil {\n\t\t\treturn\n\t\t}\n\t}\n\treturn\n}", "title": "" }, { "docid": "7383e66764021adcda04c3c6f6415313", "score": "0.48524243", "text": "func TestObjectModelConfiguration_ModifyGroup_WhenGroupDoesNotExist_CallsActionWithNewGroup(t *testing.T) {\n\tt.Parallel()\n\tg := NewGomegaWithT(t)\n\n\tomc := NewObjectModelConfiguration()\n\tvar cfg *GroupConfiguration\n\n\tg.Expect(\n\t\tomc.ModifyGroup(\n\t\t\ttest.Pkg2020,\n\t\t\tfunc(configuration *GroupConfiguration) error {\n\t\t\t\tcfg = configuration\n\t\t\t\treturn nil\n\t\t\t})).To(Succeed())\n\n\tg.Expect(cfg).NotTo(BeNil())\n}", "title": "" }, { "docid": "a5df2a9d0d4396f4751e124d7f32af46", "score": "0.48396865", "text": "func ApplyToConfigSet(configPath string, cs ConfigurationSet) error {\n\treturn applyConfiguration(configPath, cs, \"\")\n}", "title": "" }, { "docid": "b3e1a95888174e363bfb17907f988ded", "score": "0.4826498", "text": "func (r *DeviceConfigurationGroupAssignmentRequest) Update(ctx context.Context, reqObj *DeviceConfigurationGroupAssignment) error {\n\treturn r.JSONRequest(ctx, \"PATCH\", \"\", reqObj, nil)\n}", "title": "" }, { "docid": "9033687536e2da9f5da5f59bab227263", "score": "0.48181716", "text": "func MergeConfig(a, b *Config) *Config {\n\tvar result Config = *a\n\n\t// Return quickly if either side was nil\n\tif a == nil || b == nil {\n\t\treturn &result\n\t}\n\n\tif b.Delim != \"\" {\n\t\tresult.Delim = b.Delim\n\t}\n\tif b.Glue != \"\" {\n\t\tresult.Glue = b.Glue\n\t}\n\tif b.Prefix != \"\" {\n\t\tresult.Prefix = b.Prefix\n\t}\n\tif b.Empty != \"\" {\n\t\tresult.Empty = b.Empty\n\t}\n\n\treturn &result\n}", "title": "" }, { "docid": "3c9199b26f3151fb565f172826ea1e86", "score": "0.48161215", "text": "func (i *Ilo) ApplyCfg(config *cfgresources.ResourcesConfig) (err error) {\n\tif i.sessionKey == \"\" {\n\t\tmsg := \"Expected sessionKey not found, unable to configure BMC.\"\n\t\ti.log.V(1).Info(msg,\n\t\t\t\"IP\", i.ip,\n\t\t\t\"HardwareType\", i.HardwareType(),\n\t\t\t\"step\", \"Login()\",\n\t\t)\n\t\treturn errors.New(msg)\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "7b849c0cabc23676bfc29ba50373e593", "score": "0.48081228", "text": "func (g *Group) UpdateGroup(data types.MapStr, cond common.Condition) error {\n\tdata.Set(\"bk_supplier_account\", g.cli.GetSupplierAccount())\n\n\tparam := types.MapStr{\n\t\t\"condition\": cond.ToMapStr(),\n\t\t\"data\": data,\n\t}\n\n\tlog.Infof(\"update group by %s to %s\", cond.ToMapStr().ToJSON(), data.ToJSON())\n\ttargetURL := fmt.Sprintf(\"%s/api/v3/objectatt/group/update\", g.cli.GetAddress())\n\trst, err := g.cli.httpCli.PUT(targetURL, nil, param.ToJSON())\n\tif nil != err {\n\t\tlog.Errorf(\"post error %v\", err)\n\t\treturn err\n\t}\n\n\tgs := gjson.ParseBytes(rst)\n\n\t// check result\n\tif !gs.Get(\"result\").Bool() {\n\t\tlog.Errorf(\"post error %s\", rst)\n\t\treturn errors.New(gs.Get(\"bk_error_msg\").String())\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "1313636fb6ff967835df6e45e782b822", "score": "0.48076004", "text": "func (rl *LimiterFactory) UpdateConfig(config Config) {\n\trl.mu.Lock()\n\tdefer rl.mu.Unlock()\n\trl.mu.config = config\n\tfor _, rcLim := range rl.mu.tenants {\n\t\trcLim.lim.updateConfig(rl.mu.config)\n\t}\n}", "title": "" }, { "docid": "b96242d9b5e49bfba2ecd7ae389a844c", "score": "0.48068398", "text": "func (d *DockerAdapter) Apply() {\n\tif len(d.executable.Command) > 0 {\n\t\td.cfg.Entrypoint = d.executable.Command\n\t}\n\tif len(d.executable.Args) > 0 {\n\t\td.cfg.Cmd = d.executable.Args\n\t}\n\td.cfg.Env = containerEnvToDockerEnv(d.executable.Env)\n\td.cfg.ExposedPorts = containerPortsToDockerPorts(d.executable.Ports)\n}", "title": "" }, { "docid": "e047685807b49171da852fd3bcb4244f", "score": "0.47984874", "text": "func (c Config) Apply() error {\n\tcommands := c.GenerateCommands()\n\n\tfor _, command := range commands {\n\t\tcmd := exec.Command(command[0], command[1:]...)\n\t\toutput, err := cmd.CombinedOutput()\n\t\tif err != nil {\n\t\t\t// Libraries shouldn't write to stdio, but...\n\t\t\t_, err2 := fmt.Fprintf(os.Stderr, \"ERROR: %v %s\\n%s\\n\", command, err, output)\n\t\t\tif err2 != nil {\n\t\t\t\tpanic(err2)\n\t\t\t}\n\t\t\treturn err\n\t\t}\n\t\tlog.Printf(\"succesfully ran %s\", command)\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "9ddefaf4097c105552da069321f9099a", "score": "0.4797987", "text": "func (s *Deployment) applyClusterConfig() error {\n\t// Load api admin credentials from secret.\n\tusername, password, err := s.getAdminCreds()\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tif err := s.apiClient.Authenticate(string(username), string(password)); err != nil {\n\t\treturn err\n\t}\n\n\tcurrent, err := s.apiClient.GetCluster(context.Background())\n\tif err != nil {\n\t\treturn err\n\t}\n\n\twant := &storageosapi.Cluster{\n\t\tDisableTelemetry: s.stos.Spec.DisableTelemetry,\n\t\tDisableCrashReporting: s.stos.Spec.DisableTelemetry,\n\t\tDisableVersionCheck: s.stos.Spec.DisableTelemetry,\n\t\tLogLevel: \"info\", // default.\n\t\tLogFormat: \"json\", // not configurable.\n\t\tVersion: current.Version,\n\t}\n\tif s.stos.Spec.Debug {\n\t\twant.LogLevel = debugVal\n\t}\n\n\tif current.IsEqual(want) {\n\t\treturn nil\n\t}\n\n\treturn s.apiClient.UpdateCluster(context.Background(), want)\n}", "title": "" }, { "docid": "64138a581acb5f9f9387135ab461501d", "score": "0.47802624", "text": "func (c *ConfigurationWatcher) applyConfigurations(ctx context.Context) {\n\tvar lastConfigurations dynamic.Configurations\n\tfor {\n\t\tselect {\n\t\tcase <-ctx.Done():\n\t\t\treturn\n\t\tcase newConfigs, ok := <-c.newConfigs:\n\t\t\tif !ok {\n\t\t\t\treturn\n\t\t\t}\n\n\t\t\t// We wait for first configuration of the required provider before applying configurations.\n\t\t\tif _, ok := newConfigs[c.requiredProvider]; c.requiredProvider != \"\" && !ok {\n\t\t\t\tcontinue\n\t\t\t}\n\n\t\t\tif reflect.DeepEqual(newConfigs, lastConfigurations) {\n\t\t\t\tcontinue\n\t\t\t}\n\n\t\t\tconf := mergeConfiguration(newConfigs.DeepCopy(), c.defaultEntryPoints)\n\t\t\tconf = applyModel(conf)\n\n\t\t\tfor _, listener := range c.configurationListeners {\n\t\t\t\tlistener(conf)\n\t\t\t}\n\n\t\t\tlastConfigurations = newConfigs\n\t\t}\n\t}\n}", "title": "" }, { "docid": "bccb7a7f7eb97cfb7f2512d6d3e7f647", "score": "0.47760794", "text": "func (c *CgroupManager) Apply(pid int) error {\n\tfor _, subsysIns := range subsystems.SubsystemsIns {\n\t\tif err := subsysIns.Apply(c.Path, pid); err != nil {\n\t\t\treturn fmt.Errorf(\"add pid into cgroup fails %v\", err)\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "a11cbd2884543cbcf54e8d5bc3ee99e1", "score": "0.4768447", "text": "func (ghService *ConfigService) UpdateConfig(cnfConfig model.ConfigData, w http.ResponseWriter, r *http.Request) {\n\t// move current blog & site repos to bkp folder.\n\n\t// Checkout new repos to /ws/\n\tlogger.Logger(\"Cloning blogRepo from github\")\n\tout, err := exec.Command(\"api_hops_cloneBlog\", cnfConfig.BlogRepo).Output()\n\n\tif err != nil {\n\t\tlogger.Logger(\"Error: while clone blog repository\")\n\t\tlogger.Logger(err)\n\t\tw.WriteHeader(http.StatusBadRequest)\n\t\tcleanup(cnfConfig)\n\t\treturn\n\t} else {\n\t\tlogger.Logger(out)\n\t\tlogger.Logger(\"Successfully cloned blog repository\")\n\t}\n\n\t// store git credentials globally\n\tlogger.Logger(\"Storing git creds globally\")\n\tout, err = exec.Command(\"api_hops_save_git_creds\", cnfConfig.UserId, cnfConfig.Password, cnfConfig.Email).Output()\n\n\tif err != nil {\n\t\tlogger.Logger(\"Error: unable to store git creds\")\n\t\tlogger.Logger(err)\n\t\tw.WriteHeader(http.StatusBadRequest)\n\t\tcleanup(cnfConfig)\n\t\treturn\n\t} else {\n\t\tlogger.Logger(out)\n\t\tlogger.Logger(\"Successfully stored/cached git creds\")\n\t}\n\n\t// TODO: seperate boilerplate code\n\tlogger.Logger(\"Cloning siteRepo from github\")\n\tout, err = exec.Command(\"api_hops_cloneSite\", cnfConfig.SiteRepo).Output()\n\n\tif err != nil {\n\t\tlogger.Logger(\"Error: while clone site repository\")\n\t\tlogger.Logger(err)\n\t\tw.WriteHeader(http.StatusBadRequest)\n\t\tcleanup(cnfConfig)\n\t\treturn\n\t} else {\n\t\tlogger.Logger(out)\n\t\tlogger.Logger(\"Successfully cloned site repository\")\n\t}\n\n\t// startHugoServer()\n\tlogger.Logger(\"Starting hugo... \")\n\n\tstartCmd := exec.Command(\"api_hops_start_hugo\")\n\tstartCmd.Stdout = os.Stdout\n\terr = startCmd.Start()\n\tif err != nil {\n\t\tlogger.Logger(\"Error: starting hugo server\")\n\t\tlogger.Logger(err)\n\t}\n\tlogger.Logger(\"Hugo server started with pid :\" + string(startCmd.Process.Pid))\n\n\ttime.Sleep(200 * time.Millisecond)\n\tw.WriteHeader(http.StatusOK)\n}", "title": "" }, { "docid": "bb76d6a450d16b4ff71baf23a7f0bc01", "score": "0.47315782", "text": "func (b *GenerationStatusApplyConfiguration) WithGroup(value string) *GenerationStatusApplyConfiguration {\n\tb.Group = &value\n\treturn b\n}", "title": "" }, { "docid": "f1517120da07af3172a4162fc8372780", "score": "0.47271594", "text": "func (c Config) Merge(newcfg *Config) *Config {\n\tif newcfg == nil {\n\t\treturn &c\n\t}\n\n\tcfg := Config{}\n\n\tif newcfg.Credentials != nil {\n\t\tcfg.Credentials = newcfg.Credentials\n\t} else {\n\t\tcfg.Credentials = c.Credentials\n\t}\n\n\tif newcfg.Endpoint != \"\" {\n\t\tcfg.Endpoint = newcfg.Endpoint\n\t} else {\n\t\tcfg.Endpoint = c.Endpoint\n\t}\n\n\tif newcfg.Region != \"\" {\n\t\tcfg.Region = newcfg.Region\n\t} else {\n\t\tcfg.Region = c.Region\n\t}\n\n\tif newcfg.DisableSSL {\n\t\tcfg.DisableSSL = newcfg.DisableSSL\n\t} else {\n\t\tcfg.DisableSSL = c.DisableSSL\n\t}\n\n\tif newcfg.HTTPClient != nil {\n\t\tcfg.HTTPClient = newcfg.HTTPClient\n\t} else {\n\t\tcfg.HTTPClient = c.HTTPClient\n\t}\n\n\tif newcfg.LogHTTPBody {\n\t\tcfg.LogHTTPBody = newcfg.LogHTTPBody\n\t} else {\n\t\tcfg.LogHTTPBody = c.LogHTTPBody\n\t}\n\n\tif newcfg.LogLevel != 0 {\n\t\tcfg.LogLevel = newcfg.LogLevel\n\t} else {\n\t\tcfg.LogLevel = c.LogLevel\n\t}\n\n\tif newcfg.Logger != nil {\n\t\tcfg.Logger = newcfg.Logger\n\t} else {\n\t\tcfg.Logger = c.Logger\n\t}\n\n\tif newcfg.MaxRetries != DefaultRetries {\n\t\tcfg.MaxRetries = newcfg.MaxRetries\n\t} else {\n\t\tcfg.MaxRetries = c.MaxRetries\n\t}\n\n\tif newcfg.DisableParamValidation {\n\t\tcfg.DisableParamValidation = newcfg.DisableParamValidation\n\t} else {\n\t\tcfg.DisableParamValidation = c.DisableParamValidation\n\t}\n\n\tif newcfg.DisableComputeChecksums {\n\t\tcfg.DisableComputeChecksums = newcfg.DisableComputeChecksums\n\t} else {\n\t\tcfg.DisableComputeChecksums = c.DisableComputeChecksums\n\t}\n\n\tif newcfg.S3ForcePathStyle {\n\t\tcfg.S3ForcePathStyle = newcfg.S3ForcePathStyle\n\t} else {\n\t\tcfg.S3ForcePathStyle = c.S3ForcePathStyle\n\t}\n\n\treturn &cfg\n}", "title": "" }, { "docid": "cbab3512e7103ac7279219cc3cdde4a2", "score": "0.4720527", "text": "func (g *Group) Configure() error {\n\tfor _, h := range g.configHooks {\n\t\tif err := g.c.invoke(h.Configure); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "befec5037b9e31375589a12ed7ba4d82", "score": "0.4711037", "text": "func (a ActionConfig) Merge(m ActionConfig) ActionConfig {\n\tvar res ActionConfig\n\tif err := copier.Copy(&res, a); err != nil {\n\t\tpanic(err)\n\t}\n\tif err := mergo.MergeWithOverwrite(&res, m); err != nil {\n\t\tpanic(err)\n\t}\n\treturn res\n}", "title": "" }, { "docid": "dee2d56c9eaa1cf9190a5441d13cad04", "score": "0.46556816", "text": "func MergeConfig(v *viper.Viper, configUri string) {\n\n\t_, configFormat, compression := SplitNameFormatCompression(configUri)\n\tif len(compression) > 0 {\n\t\tpanic(errors.New(\"cannot have compression for config uri \" + configUri))\n\t}\n\n\tv.SetConfigType(configFormat)\n\n\tconfigReader, _, err := grw.ReadFromResource(configUri, \"\", 4096, false, nil)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\n\tconfigBytes, err := configReader.ReadAllAndClose()\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\n\tif len(configBytes) > 0 {\n\t\terr = v.MergeConfig(bytes.NewReader(configBytes))\n\t\tif err != nil {\n\t\t\tpanic(err)\n\t\t}\n\t}\n}", "title": "" }, { "docid": "ddbf083ca75b4561b0efcac5de185e7e", "score": "0.4645333", "text": "func (d *Swarm) UpdateConfig(c *check.C, id string, f ...ConfigConstructor) {\n\tconfig := d.GetConfig(c, id)\n\tfor _, fn := range f {\n\t\tfn(config)\n\t}\n\turl := fmt.Sprintf(\"/configs/%s/update?version=%d\", config.ID, config.Version.Index)\n\tstatus, out, err := d.SockRequest(\"POST\", url, config.Spec)\n\tc.Assert(err, checker.IsNil, check.Commentf(string(out)))\n\tc.Assert(status, checker.Equals, http.StatusOK, check.Commentf(\"output: %q\", string(out)))\n}", "title": "" }, { "docid": "ea36eb55f5e92ed78db033e8e223f131", "score": "0.46418664", "text": "func (b Buffer) Apply(config interface{}) error {\n\treturn b.Flush(config, false)\n}", "title": "" }, { "docid": "b93cd3572694e90343d7af541205d4b2", "score": "0.46343708", "text": "func (c *CfgManager) UpdateConfig(cfgs map[string]interface{}) error {\n\treturn c.store.Update(cfgs)\n}", "title": "" }, { "docid": "ab1b3189f4b3acfc5d6a8c6b49f169c6", "score": "0.46299505", "text": "func (config *RouterConfig) UpdateConfig(newConfig *RouterConfig) error {\n\tvar err error\n\tfor rule, nodes := range newConfig.Rules {\n\t\tif _, ok := config.Rules[rule]; !ok {\n\t\t\tconfig.Rules[rule] = nodes\n\t\t} else {\n\t\t\tfor _, node := range newConfig.Rules[rule] {\n\t\t\t\tif inSlice := nodeInSlice(node, config.Rules[rule]); !inSlice {\n\t\t\t\t\tconfig.Rules[rule] = append(config.Rules[rule], node)\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\tjsonData, _ := json.MarshalIndent(config, \"\", \" \")\n\terr = ioutil.WriteFile(config.FilePath, jsonData, 0644)\n\tif err != nil {\n\t\tlog.Printf(\"Failed to write to file %s: %s\", config.FilePath, err)\n\t\treturn err\n\t}\n\treturn err\n}", "title": "" }, { "docid": "5827024f391ea19afbcbabbc431d6c52", "score": "0.4628724", "text": "func (rp *reverseProxy) applyConfig(cfg *config.Config) error {\n\t// configLock protects from concurrent calls to applyConfig\n\t// by serializing such calls.\n\t// configLock shouldn't be used in other places.\n\trp.configLock.Lock()\n\tdefer rp.configLock.Unlock()\n\n\tclusters, err := newClusters(cfg.Clusters)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tcaches := make(map[string]*cache.AsyncCache, len(cfg.Caches))\n\tdefer func() {\n\t\t// caches is swapped with old caches from rp.caches\n\t\t// on successful config reload - see the end of reloadConfig.\n\t\tfor _, tmpCache := range caches {\n\t\t\t// Speed up applyConfig by closing caches in background,\n\t\t\t// since the process of cache closing may be lengthy\n\t\t\t// due to cleaning.\n\t\t\tgo tmpCache.Close()\n\t\t}\n\t}()\n\n\t// transactionsTimeout used for creation of transactions registry inside async cache.\n\t// It is set to the highest configured execution time of all users to avoid setups were users use the same cache and have configured different maxExecutionTime.\n\t// This would provoke undesired behaviour of `dogpile effect`\n\ttransactionsTimeout := config.Duration(0)\n\tfor _, user := range cfg.Users {\n\t\tif user.MaxExecutionTime > transactionsTimeout {\n\t\t\ttransactionsTimeout = user.MaxExecutionTime\n\t\t}\n\t\tif user.IsWildcarded {\n\t\t\trp.hasWildcarded = true\n\t\t}\n\t}\n\n\tif err := initTempCaches(caches, transactionsTimeout, cfg.Caches); err != nil {\n\t\treturn err\n\t}\n\n\tparams, err := paramsFromConfig(cfg.ParamGroups)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tprofile := &usersProfile{\n\t\tcfg: cfg.Users,\n\t\tclusters: clusters,\n\t\tcaches: caches,\n\t\tparams: params,\n\t}\n\tusers, err := profile.newUsers()\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tif err := validateNoWildcardedUserForHeartbeat(clusters, cfg.Clusters); err != nil {\n\t\treturn err\n\t}\n\n\t// New configs have been successfully prepared.\n\t// Restart service goroutines with new configs.\n\n\t// Stop the previous service goroutines.\n\tclose(rp.reloadSignal)\n\trp.reloadWG.Wait()\n\trp.reloadSignal = make(chan struct{})\n\trp.restartWithNewConfig(caches, clusters, users)\n\n\t// Substitute old configs with the new configs in rp.\n\t// All the currently running requests will continue with old configs,\n\t// while all the new requests will use new configs.\n\trp.lock.Lock()\n\trp.clusters = clusters\n\trp.users = users\n\t// Swap is needed for deferred closing of old caches.\n\t// See the code above where new caches are created.\n\tcaches, rp.caches = rp.caches, caches\n\trp.lock.Unlock()\n\n\treturn nil\n}", "title": "" }, { "docid": "32d5728cc156be85fa83597e5fd7dfbc", "score": "0.46277568", "text": "func (s *ConfigServer) applyConfig(ctx context.Context, c *beta.Client, request *betapb.ApplyRuntimeconfigBetaConfigRequest) (*betapb.RuntimeconfigBetaConfig, error) {\n\tp := ProtoToConfig(request.GetResource())\n\tres, err := c.ApplyConfig(ctx, p)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tr := ConfigToProto(res)\n\treturn r, nil\n}", "title": "" }, { "docid": "a42bb5b1d65cbda9869d6eda5fc9b387", "score": "0.46263942", "text": "func TestMergedGroupsConfig(t *testing.T) {\n\tvar containsMergedConfig bool\n\tfound := sets.String{}\n\tdups := sets.String{}\n\n\tfor _, g := range cfg.Groups {\n\t\tname := g.Name\n\t\tif name == \"community\" {\n\t\t\tcontainsMergedConfig = true\n\t\t}\n\n\t\tif found.Has(name) {\n\t\t\tdups.Insert(name)\n\t\t}\n\t\tfound.Insert(name)\n\t}\n\n\tif !containsMergedConfig {\n\t\tt.Errorf(\"Final GroupsConfig does not have merged configs from all groups.yaml files\")\n\t}\n\tif n := len(dups); n > 0 {\n\t\tt.Errorf(\"%d duplicate groups: %s\", n, strings.Join(dups.List(), \", \"))\n\t}\n}", "title": "" }, { "docid": "84da55596a91975a28750bce5d78c2d5", "score": "0.46157447", "text": "func (c *Config) mergeConfig(other *Config) error {\n\t// strings\n\tc.ApparmorProfile = mergeStrings(c.ApparmorProfile, other.ApparmorProfile)\n\tc.CgroupManager = mergeStrings(c.CgroupManager, other.CgroupManager)\n\tc.NetworkConfigDir = mergeStrings(c.NetworkConfigDir, other.NetworkConfigDir)\n\tc.DefaultNetwork = mergeStrings(c.DefaultNetwork, other.DefaultNetwork)\n\tc.DefaultMountsFile = mergeStrings(c.DefaultMountsFile, other.DefaultMountsFile)\n\tc.DetachKeys = mergeStrings(c.DetachKeys, other.DetachKeys)\n\tc.EventsLogFilePath = mergeStrings(c.EventsLogFilePath, other.EventsLogFilePath)\n\tc.EventsLogger = mergeStrings(c.EventsLogger, other.EventsLogger)\n\tc.ImageDefaultTransport = mergeStrings(c.ImageDefaultTransport, other.ImageDefaultTransport)\n\tc.InfraCommand = mergeStrings(c.InfraCommand, other.InfraCommand)\n\tc.InfraImage = mergeStrings(c.InfraImage, other.InfraImage)\n\tc.InitPath = mergeStrings(c.InitPath, other.InitPath)\n\tc.LockType = mergeStrings(c.LockType, other.LockType)\n\tc.Namespace = mergeStrings(c.Namespace, other.Namespace)\n\tc.NetworkCmdPath = mergeStrings(c.NetworkCmdPath, other.NetworkCmdPath)\n\tc.OCIRuntime = mergeStrings(c.OCIRuntime, other.OCIRuntime)\n\tc.SeccompProfile = mergeStrings(c.SeccompProfile, other.SeccompProfile)\n\tc.ShmSize = mergeStrings(c.ShmSize, other.ShmSize)\n\tc.SignaturePolicyPath = mergeStrings(c.SignaturePolicyPath, other.SignaturePolicyPath)\n\tc.StaticDir = mergeStrings(c.StaticDir, other.StaticDir)\n\tc.TmpDir = mergeStrings(c.TmpDir, other.TmpDir)\n\tc.VolumePath = mergeStrings(c.VolumePath, other.VolumePath)\n\n\t// string map of slices\n\tc.OCIRuntimes = mergeStringMaps(c.OCIRuntimes, other.OCIRuntimes)\n\n\t// string slices\n\tc.AdditionalDevices = mergeStringSlices(c.AdditionalDevices, other.AdditionalDevices)\n\tc.DefaultCapabilities = mergeStringSlices(c.DefaultCapabilities, other.DefaultCapabilities)\n\tc.DefaultSysctls = mergeStringSlices(c.DefaultSysctls, other.DefaultSysctls)\n\tc.DefaultUlimits = mergeStringSlices(c.DefaultUlimits, other.DefaultUlimits)\n\tc.CNIPluginDirs = mergeStringSlices(c.CNIPluginDirs, other.CNIPluginDirs)\n\tc.Env = mergeStringSlices(c.Env, other.Env)\n\tc.ConmonPath = mergeStringSlices(c.ConmonPath, other.ConmonPath)\n\tc.HooksDir = mergeStringSlices(c.HooksDir, other.HooksDir)\n\tc.HTTPProxy = mergeStringSlices(c.HTTPProxy, other.HTTPProxy)\n\tc.RuntimePath = mergeStringSlices(c.RuntimePath, other.RuntimePath)\n\tc.RuntimeSupportsJSON = mergeStringSlices(c.RuntimeSupportsJSON, other.RuntimeSupportsJSON)\n\tc.RuntimeSupportsNoCgroups = mergeStringSlices(c.RuntimeSupportsNoCgroups, other.RuntimeSupportsNoCgroups)\n\n\t// int64s\n\tc.LogSizeMax = mergeInt64s(c.LogSizeMax, other.LogSizeMax)\n\tc.PidsLimit = mergeInt64s(c.PidsLimit, other.PidsLimit)\n\n\t// uint32s\n\tc.NumLocks = mergeUint32s(c.NumLocks, other.NumLocks)\n\n\t// bools\n\tc.optionalEnableLabeling = mergeOptionalBools(c.optionalEnableLabeling, other.optionalEnableLabeling)\n\tc.optionalEnablePortReservation = mergeOptionalBools(c.optionalEnablePortReservation, other.optionalEnablePortReservation)\n\tc.optionalInit = mergeOptionalBools(c.optionalInit, other.optionalInit)\n\tc.optionalNoPivotRoot = mergeOptionalBools(c.optionalNoPivotRoot, other.optionalNoPivotRoot)\n\tc.optionalSDNotify = mergeOptionalBools(c.optionalSDNotify, other.optionalSDNotify)\n\n\t// state type\n\tif c.StateType == InvalidStateStore {\n\t\tc.StateType = other.StateType\n\t}\n\n\t// store options - need to check all fields since some configs might only\n\t// set it partially\n\tc.StorageConfig.RunRoot = mergeStrings(c.StorageConfig.RunRoot, other.StorageConfig.RunRoot)\n\tc.StorageConfig.GraphRoot = mergeStrings(c.StorageConfig.GraphRoot, other.StorageConfig.GraphRoot)\n\tc.StorageConfig.GraphDriverName = mergeStrings(c.StorageConfig.GraphDriverName, other.StorageConfig.GraphDriverName)\n\tc.StorageConfig.GraphDriverOptions = mergeStringSlices(c.StorageConfig.GraphDriverOptions, other.StorageConfig.GraphDriverOptions)\n\tif c.StorageConfig.UIDMap == nil {\n\t\tc.StorageConfig.UIDMap = other.StorageConfig.UIDMap\n\t}\n\tif c.StorageConfig.GIDMap == nil {\n\t\tc.StorageConfig.GIDMap = other.StorageConfig.GIDMap\n\t}\n\n\t// backwards compat *Set fields\n\tc.StorageConfigRunRootSet = mergeBools(c.StorageConfigRunRootSet, other.StorageConfigRunRootSet)\n\tc.StorageConfigGraphRootSet = mergeBools(c.StorageConfigGraphRootSet, other.StorageConfigGraphRootSet)\n\tc.StorageConfigGraphDriverNameSet = mergeBools(c.StorageConfigGraphDriverNameSet, other.StorageConfigGraphDriverNameSet)\n\tc.VolumePathSet = mergeBools(c.VolumePathSet, other.VolumePathSet)\n\tc.StaticDirSet = mergeBools(c.StaticDirSet, other.StaticDirSet)\n\tc.TmpDirSet = mergeBools(c.TmpDirSet, other.TmpDirSet)\n\n\treturn nil\n}", "title": "" }, { "docid": "9158f30d8a5aac0b42a62b4fe21f0f52", "score": "0.4594615", "text": "func mergeAndPopulateConfig(c *Config) (*Config, error) {\n\tfinal := newDefaultConfig()\n\n\tif c.Logger == nil {\n\t\treturn nil, errors.New(\"No logger input\")\n\t}\n\tfinal.Logger = c.Logger\n\n\tif c.ServiceName != \"\" {\n\t\tfinal.ServiceName = c.ServiceName\n\t} else if s := os.Getenv(\"SERVICE_NAME\"); s != \"\" {\n\t\tfinal.ServiceName = s\n\t}\n\n\tif c.TraceDestinationDNS != \"\" {\n\t\tfinal.TraceDestinationDNS = c.TraceDestinationDNS\n\t} else if s := os.Getenv(\"TRACE_DESTINATION_DNS\"); s != \"\" {\n\t\tfinal.TraceDestinationDNS = s\n\t}\n\n\tif c.TraceDestinationPort != \"\" {\n\t\tfinal.TraceDestinationPort = c.TraceDestinationPort\n\t} else if s := os.Getenv(\"TRACE_DESTINATION_PORT\"); s != \"\" {\n\t\tfinal.TraceDestinationPort = s\n\t}\n\n\tif c.DisableReporting != nil {\n\t\tfinal.DisableReporting = c.DisableReporting\n\t} else if s := os.Getenv(\"TRACE_DISABLE\"); s != \"\" {\n\t\tb, err := strconv.ParseBool(s)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tfinal.DisableReporting = &b\n\t}\n\n\tif c.SampleRate != 0 {\n\t\tfinal.SampleRate = c.SampleRate\n\t} else if s := os.Getenv(\"TRACE_SAMPLE_RATE\"); s != \"\" {\n\t\tv, err := strconv.ParseFloat(s, 64)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tfinal.SampleRate = v\n\t}\n\n\tif c.GlobalTags != nil {\n\t\tfinal.GlobalTags = c.GlobalTags\n\t} else {\n\t\tfinal.GlobalTags = map[string]string{}\n\t}\n\n\treturn final, nil\n}", "title": "" }, { "docid": "bccbd3e382fc681dba8794d84286d6e8", "score": "0.4587791", "text": "func ConfigGroupRouter(r chi.Router, endpoints endpoints.Endpoints, options []httptransport.ServerOption) chi.Router {\n\treturn r.Route(\"/groups\", func(r chi.Router) {\n\t\tr.Post(\"/\", httptransport.NewServer(\n\t\t\tendpoints.CreateGroup,\n\t\t\tDecodeCreateGroupRequest,\n\t\t\tencodeResponse,\n\t\t\toptions...,\n\t\t).ServeHTTP)\n\t\tr.Route(\"/{groupID}\", func(r chi.Router) {\n\t\t\tr.Use(makeGroupContext)\n\t\t\tr.Put(\"/\", httptransport.NewServer(\n\t\t\t\tendpoints.UpdateGroup,\n\t\t\t\tDecodeUpdateGroupRequest,\n\t\t\t\tencodeResponse,\n\t\t\t\toptions...,\n\t\t\t).ServeHTTP)\n\t\t\tr.Post(\"/archive\", httptransport.NewServer(\n\t\t\t\tendpoints.ArchiveGroup,\n\t\t\t\tDecodeNullRequest,\n\t\t\t\tencodeResponse,\n\t\t\t\toptions...,\n\t\t\t).ServeHTTP)\n\t\t\tr.Post(\"/join\", httptransport.NewServer(\n\t\t\t\tendpoints.JoinGroup,\n\t\t\t\tDecodeJoinGroupRequest,\n\t\t\t\tencodeResponse,\n\t\t\t\toptions...,\n\t\t\t).ServeHTTP)\n\t\t\tr.Post(\"/leave\", httptransport.NewServer(\n\t\t\t\tendpoints.LeaveGroup,\n\t\t\t\tDecodeLeaveGroupRequest,\n\t\t\t\tencodeResponse,\n\t\t\t\toptions...,\n\t\t\t).ServeHTTP)\n\t\t\tr.Post(\"/invite_user\", httptransport.NewServer(\n\t\t\t\tendpoints.InviteUser,\n\t\t\t\tDecodeInviteUserRequest,\n\t\t\t\tencodeResponse,\n\t\t\t\toptions...,\n\t\t\t).ServeHTTP)\n\t\t\tr.Post(\"/kick_user\", httptransport.NewServer(\n\t\t\t\tendpoints.KickUser,\n\t\t\t\tDecodeKickUserRequest,\n\t\t\t\tencodeResponse,\n\t\t\t\toptions...,\n\t\t\t).ServeHTTP)\n\t\t})\n\t})\n}", "title": "" } ]
baf92e0be9d542fa90a48a4ee8c11e9c
GetUuid returns the Uuid field value if set, zero value otherwise.
[ { "docid": "d4b3a2c38e79693e5e3397da9cf54e39", "score": "0.6911177", "text": "func (o *PatchedAssessment) GetUuid() string {\n\tif o == nil || o.Uuid == nil {\n\t\tvar ret string\n\t\treturn ret\n\t}\n\treturn *o.Uuid\n}", "title": "" } ]
[ { "docid": "536a35e7b474b5d3ef65929eac29e57f", "score": "0.7705577", "text": "func (o *UUID) GetUuid() string {\n\tif o == nil {\n\t\tvar ret string\n\t\treturn ret\n\t}\n\n\treturn o.Uuid\n}", "title": "" }, { "docid": "9a8ea6e6f7c804c067daf03246197575", "score": "0.7439991", "text": "func (o *FormatTest) GetUuid() string {\n\tif o == nil || IsNil(o.Uuid) {\n\t\tvar ret string\n\t\treturn ret\n\t}\n\treturn *o.Uuid\n}", "title": "" }, { "docid": "676ba631b8b0ee068be7d6ca3ea10c33", "score": "0.72258675", "text": "func (o *InvestorFee) GetUuid() string {\n\tif o == nil {\n\t\tvar ret string\n\t\treturn ret\n\t}\n\n\treturn o.Uuid\n}", "title": "" }, { "docid": "3c2f2a2643c1d0ce13471d9afca47c12", "score": "0.71842927", "text": "func (o *PatchedInvestorFee) GetUuid() string {\n\tif o == nil || o.Uuid == nil {\n\t\tvar ret string\n\t\treturn ret\n\t}\n\treturn *o.Uuid\n}", "title": "" }, { "docid": "e0acf65236d333bcdc8169c40c5d4164", "score": "0.71034276", "text": "func (o *AccessLog) GetUuid() string {\n\tif o == nil {\n\t\tvar ret string\n\t\treturn ret\n\t}\n\n\treturn o.Uuid\n}", "title": "" }, { "docid": "a0d044460fe0a154831e77eefa9ecb56", "score": "0.70706195", "text": "func (o *Vulnerability) GetUuid() string {\n\tif o == nil || o.Uuid == nil {\n\t\tvar ret string\n\t\treturn ret\n\t}\n\treturn *o.Uuid\n}", "title": "" }, { "docid": "6125b9340b4eadc2a1a2cd066845242a", "score": "0.69524163", "text": "func (o *Watchlist) GetUuid() string {\n\tif o == nil {\n\t\tvar ret string\n\t\treturn ret\n\t}\n\n\treturn o.Uuid\n}", "title": "" }, { "docid": "c1763f699d0445486f0291369b991a36", "score": "0.6937832", "text": "func (o *HyperflexDrive) GetUuid() string {\n\tif o == nil || o.Uuid == nil {\n\t\tvar ret string\n\t\treturn ret\n\t}\n\treturn *o.Uuid\n}", "title": "" }, { "docid": "7b9d63faca7f74a48dc15a96092f979e", "score": "0.6899009", "text": "func (o *LineageRequestDTO) GetUuid() string {\n\tif o == nil || o.Uuid == nil {\n\t\tvar ret string\n\t\treturn ret\n\t}\n\treturn *o.Uuid\n}", "title": "" }, { "docid": "e980904f166499860824c2175b822839", "score": "0.6783685", "text": "func (instance *N) GetUUID() string {\n\tif nil != instance {\n\t\treturn instance.uuid\n\t}\n\treturn \"\"\n}", "title": "" }, { "docid": "e4ad7b81a6d5bc2919aabaddd6c538d6", "score": "0.67746806", "text": "func (o *HyperflexStorageContainerAllOf) GetUuid() string {\n\tif o == nil || o.Uuid == nil {\n\t\tvar ret string\n\t\treturn ret\n\t}\n\treturn *o.Uuid\n}", "title": "" }, { "docid": "648d63832590e44fce8f6e39516b667e", "score": "0.6719651", "text": "func (o *Workspace) GetUuid() string {\n\tif o == nil || o.Uuid == nil {\n\t\tvar ret string\n\t\treturn ret\n\t}\n\treturn *o.Uuid\n}", "title": "" }, { "docid": "35866563dd8f017d2bb7f5c6ae27a960", "score": "0.67044884", "text": "func (o *RoleOut) GetUuid() string {\n\tif o == nil {\n\t\tvar ret string\n\t\treturn ret\n\t}\n\n\treturn o.Uuid\n}", "title": "" }, { "docid": "8b064ee8197c10b05bf3292d93f10e0b", "score": "0.6680473", "text": "func GetUID() string {\n\tuuid := uuid.New()\n\treturn uuid.String()\n}", "title": "" }, { "docid": "98f88fc3c9e7fe36047acd34dd2be5ac", "score": "0.66569775", "text": "func (o *PatchedApplicationClientUpdate) GetUuid() string {\n\tif o == nil || o.Uuid == nil {\n\t\tvar ret string\n\t\treturn ret\n\t}\n\treturn *o.Uuid\n}", "title": "" }, { "docid": "a56b4c7ec4b2db23ebe886935552616c", "score": "0.66478634", "text": "func (o *WebhookMessage) GetUuid() string {\n\tif o == nil || o.Uuid == nil {\n\t\tvar ret string\n\t\treturn ret\n\t}\n\treturn *o.Uuid\n}", "title": "" }, { "docid": "5994fbd04845331346c24ace2e43351c", "score": "0.66373247", "text": "func (o *UUID) GetUuidOk() (*string, bool) {\n\tif o == nil {\n\t\treturn nil, false\n\t}\n\treturn &o.Uuid, true\n}", "title": "" }, { "docid": "cc327108dee66a1b23d44a4db13bba06", "score": "0.66177994", "text": "func (o *PortfolioDetail) GetUuid() string {\n\tif o == nil {\n\t\tvar ret string\n\t\treturn ret\n\t}\n\n\treturn o.Uuid\n}", "title": "" }, { "docid": "15829ec6a77cb9847f633e70fcce3896", "score": "0.6611469", "text": "func (wc *WSConn) GetUuid() string {\n\treturn wc.uuid\n}", "title": "" }, { "docid": "860883b7cc30d2372f1acc9c5a8d53b9", "score": "0.65807945", "text": "func (o *Allocation) GetUuid() string {\n\tif o == nil || IsNil(o.Uuid) {\n\t\tvar ret string\n\t\treturn ret\n\t}\n\treturn *o.Uuid\n}", "title": "" }, { "docid": "513f69793ed0ccea043f884d22922090", "score": "0.65644133", "text": "func (o *StorageNetAppBaseDiskAllOf) GetUuid() string {\n\tif o == nil || o.Uuid == nil {\n\t\tvar ret string\n\t\treturn ret\n\t}\n\treturn *o.Uuid\n}", "title": "" }, { "docid": "848d807a14238da4b6cdeac28483c7bd", "score": "0.65487087", "text": "func (o *DeploymentRelease) GetUuid() string {\n\tif o == nil || o.Uuid == nil {\n\t\tvar ret string\n\t\treturn ret\n\t}\n\treturn *o.Uuid\n}", "title": "" }, { "docid": "04a3dbc77f0963b8f37cbd1a7861e207", "score": "0.65062815", "text": "func (u *NullUID) UniqueID() string { return \"\" }", "title": "" }, { "docid": "ad277874ebbb153bafa5359eec1fcb0c", "score": "0.6498931", "text": "func (o *AccessLog) GetUuidOk() (*string, bool) {\n\tif o == nil {\n\t\treturn nil, false\n\t}\n\treturn &o.Uuid, true\n}", "title": "" }, { "docid": "ab8322503e428113cedee5bed423f644", "score": "0.647494", "text": "func GetUUID() string {\n\treturn uuid.NewString()\n}", "title": "" }, { "docid": "64c37acde87b29f378bd7c58635b53ea", "score": "0.6455449", "text": "func (instance *Instance) GetUuid() (uuid uint64) {\n\tif val := instance.GetIndexInstance(); val != nil {\n\t\treturn val.GetInstId()\n\t} else {\n\t\t// TODO: should we panic ?\n\t}\n\treturn\n}", "title": "" }, { "docid": "6e2e7b925414e3f4817a318a41f546e0", "score": "0.64299333", "text": "func (o *InvestorFee) GetUuidOk() (*string, bool) {\n\tif o == nil {\n\t\treturn nil, false\n\t}\n\treturn &o.Uuid, true\n}", "title": "" }, { "docid": "8da654a3b7d900f5ef0565e7e441e9e8", "score": "0.63873893", "text": "func (o *RoleOut) GetUuidOk() (*string, bool) {\n\tif o == nil {\n\t\treturn nil, false\n\t}\n\treturn &o.Uuid, true\n}", "title": "" }, { "docid": "1f5489482f848902b07165ce66a2ca7b", "score": "0.636651", "text": "func (o *Watchlist) GetUuidOk() (*string, bool) {\n\tif o == nil {\n\t\treturn nil, false\n\t}\n\treturn &o.Uuid, true\n}", "title": "" }, { "docid": "1c415157700c89a98fae63fdaba7f1a9", "score": "0.6365929", "text": "func GetUid() types.Uid {\n\treturn uGen.Get()\n}", "title": "" }, { "docid": "e6367f4ac9549da6065cc870a479c45e", "score": "0.63610137", "text": "func (d Device) GetUUID() string {\n\treturn AnnotatedID(d.ID).GetID()\n}", "title": "" }, { "docid": "ece0212894de93dc4922f6060837f12d", "score": "0.6330778", "text": "func (u user) GetUID() string { return u.UID }", "title": "" }, { "docid": "e079a622fbb039ba97241a0ef4517b60", "score": "0.63209945", "text": "func (t *SimpleTunnel) GetUUID() string {\n\treturn t.uuid.String()\n}", "title": "" }, { "docid": "bfe3bac40e7cdb6451e1ada3fb659fb2", "score": "0.6286574", "text": "func (o *VolumeIdAttributesType) Uuid() UuidType {\n\tvar r UuidType\n\tif o.UuidPtr == nil {\n\t\treturn r\n\t}\n\tr = *o.UuidPtr\n\treturn r\n}", "title": "" }, { "docid": "479b1e58b17d72ffa9283a42ce2a857e", "score": "0.6285475", "text": "func (o *InlineResponse200124Deliveries) GetUuid() string {\n\tif o == nil || o.Uuid == nil {\n\t\tvar ret string\n\t\treturn ret\n\t}\n\treturn *o.Uuid\n}", "title": "" }, { "docid": "9b2c006dbd5648ab9a32b0f148c09095", "score": "0.6272438", "text": "func (v *DescribeDomainRequest) GetUUID() (o string) {\n\tif v != nil && v.UUID != nil {\n\t\treturn *v.UUID\n\t}\n\treturn\n}", "title": "" }, { "docid": "4d51c24677f899a8c2ffe0d2d331ed5b", "score": "0.62596864", "text": "func (o *Vulnerability) GetUuidOk() (*string, bool) {\n\tif o == nil || o.Uuid == nil {\n\t\treturn nil, false\n\t}\n\treturn o.Uuid, true\n}", "title": "" }, { "docid": "5c818918633f5a0a188c6f304a6a281f", "score": "0.62529975", "text": "func (r *Rectangle) GetUUID() string {\n\treturn r.UUID\n}", "title": "" }, { "docid": "5874b49abaa0c1aa2c5d7604bc35d5aa", "score": "0.62448084", "text": "func (instance *NioClient) GetUUID() string {\n\tif nil != instance {\n\t\treturn instance.uuid\n\t}\n\treturn \"\"\n}", "title": "" }, { "docid": "cdd84d6a7957b73fca77d624e076f328", "score": "0.6228036", "text": "func (o *FormatTest) GetUuidOk() (*string, bool) {\n\tif o == nil || IsNil(o.Uuid) {\n\t\treturn nil, false\n\t}\n\treturn o.Uuid, true\n}", "title": "" }, { "docid": "c8ca50e914711cbab9e30c1d1d2e1219", "score": "0.6195184", "text": "func (v *DomainInfo) GetUUID() (o string) {\n\tif v != nil {\n\t\treturn v.UUID\n\t}\n\treturn\n}", "title": "" }, { "docid": "ea06a62337c078d386db13f67aa643a4", "score": "0.6183808", "text": "func (v *NestHeaders) GetUUID() (o string) {\n\tif v != nil {\n\t\to = v.UUID\n\t}\n\treturn\n}", "title": "" }, { "docid": "eec4c7b25be6e3811ef30d25da96485b", "score": "0.61661166", "text": "func (o *PatchedInvestorFee) GetUuidOk() (*string, bool) {\n\tif o == nil || o.Uuid == nil {\n\t\treturn nil, false\n\t}\n\treturn o.Uuid, true\n}", "title": "" }, { "docid": "a14bf1374b4a388ddf935dc64624dfcc", "score": "0.6158834", "text": "func (o DataStoreResponseOutput) Uuid() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v DataStoreResponse) *string { return v.Uuid }).(pulumi.StringPtrOutput)\n}", "title": "" }, { "docid": "6d8898137a93f750481984e3f1c251d8", "score": "0.6157703", "text": "func (o *StorageNetAppBaseSnapMirrorPolicyAllOf) GetUuid() string {\n\tif o == nil || o.Uuid == nil {\n\t\tvar ret string\n\t\treturn ret\n\t}\n\treturn *o.Uuid\n}", "title": "" }, { "docid": "436ec1f83e7af2fe693c4a8879d59a65", "score": "0.6157229", "text": "func (o *PortfolioDetail) GetUuidOk() (*string, bool) {\n\tif o == nil {\n\t\treturn nil, false\n\t}\n\treturn &o.Uuid, true\n}", "title": "" }, { "docid": "fea2416e93bfe0bc0da9ba289b4351e4", "score": "0.61321485", "text": "func (_class VGPUClass) GetUUID(sessionID SessionRef, self VGPURef) (_retval string, _err error) {\n\tif IsMock {\n\t\treturn _class.GetUUIDMock(sessionID, self)\n\t}\t\n\t_method := \"VGPU.get_uuid\"\n\t_sessionIDArg, _err := convertSessionRefToXen(fmt.Sprintf(\"%s(%s)\", _method, \"session_id\"), sessionID)\n\tif _err != nil {\n\t\treturn\n\t}\n\t_selfArg, _err := convertVGPURefToXen(fmt.Sprintf(\"%s(%s)\", _method, \"self\"), self)\n\tif _err != nil {\n\t\treturn\n\t}\n\t_result, _err := _class.client.APICall(_method, _sessionIDArg, _selfArg)\n\tif _err != nil {\n\t\treturn\n\t}\n\t_retval, _err = convertStringToGo(_method + \" -> \", _result.Value)\n\treturn\n}", "title": "" }, { "docid": "e721a89e5e8d6d376ed407690f39d17f", "score": "0.6113439", "text": "func (_class VGPUTypeClass) GetUUID(sessionID SessionRef, self VGPUTypeRef) (_retval string, _err error) {\n\tif IsMock {\n\t\treturn _class.GetUUIDMock(sessionID, self)\n\t}\t\n\t_method := \"VGPU_type.get_uuid\"\n\t_sessionIDArg, _err := convertSessionRefToXen(fmt.Sprintf(\"%s(%s)\", _method, \"session_id\"), sessionID)\n\tif _err != nil {\n\t\treturn\n\t}\n\t_selfArg, _err := convertVGPUTypeRefToXen(fmt.Sprintf(\"%s(%s)\", _method, \"self\"), self)\n\tif _err != nil {\n\t\treturn\n\t}\n\t_result, _err := _class.client.APICall(_method, _sessionIDArg, _selfArg)\n\tif _err != nil {\n\t\treturn\n\t}\n\t_retval, _err = convertStringToGo(_method + \" -> \", _result.Value)\n\treturn\n}", "title": "" }, { "docid": "2423e604c720eacbd5dca00e185c679e", "score": "0.61065835", "text": "func (o *MemoryPersistentMemoryUnit) GetUid() string {\n\tif o == nil || o.Uid == nil {\n\t\tvar ret string\n\t\treturn ret\n\t}\n\treturn *o.Uid\n}", "title": "" }, { "docid": "0e33a73a907a8c54d44d395e6bfe6fa5", "score": "0.6094819", "text": "func (o *HyperflexDrive) GetUuidOk() (*string, bool) {\n\tif o == nil || o.Uuid == nil {\n\t\treturn nil, false\n\t}\n\treturn o.Uuid, true\n}", "title": "" }, { "docid": "a889c6813b571b58e2a353f34de14723", "score": "0.6078607", "text": "func (o *PatchedAssessment) GetUuidOk() (*string, bool) {\n\tif o == nil || o.Uuid == nil {\n\t\treturn nil, false\n\t}\n\treturn o.Uuid, true\n}", "title": "" }, { "docid": "e5626d7e827239e600564ceb5e322c63", "score": "0.6069248", "text": "func UUid() string {\r\n\tvar id = Rand()\r\n\treturn id.Hex()\r\n}", "title": "" }, { "docid": "7615ac17b68ddddcee75246d4e8b5da2", "score": "0.60680497", "text": "func (o *LunInfoType) Uuid() string {\n\tr := *o.UuidPtr\n\treturn r\n}", "title": "" }, { "docid": "4120e145998ca8682709bfdc30f7a644", "score": "0.6067445", "text": "func (o *FormatTest) SetUuid(v string) {\n\to.Uuid = &v\n}", "title": "" }, { "docid": "a8520150539edefd4b32609b65fd2335", "score": "0.60654294", "text": "func UuidGenerate(ctx expr.EvalContext) (value.StringValue, bool) {\n\treturn value.NewStringValue(uuid.New()), true\n}", "title": "" }, { "docid": "a8520150539edefd4b32609b65fd2335", "score": "0.60654294", "text": "func UuidGenerate(ctx expr.EvalContext) (value.StringValue, bool) {\n\treturn value.NewStringValue(uuid.New()), true\n}", "title": "" }, { "docid": "f7a5de619c8a2c636ed616af25b4e716", "score": "0.6056279", "text": "func (o *LineageRequestDTO) GetUuidOk() (*string, bool) {\n\tif o == nil || o.Uuid == nil {\n\t\treturn nil, false\n\t}\n\treturn o.Uuid, true\n}", "title": "" }, { "docid": "5a017fba1e87c313881d420929fbeeed", "score": "0.6020902", "text": "func (d *tegraDevice) GetUUID() (string, error) {\n\treturn tegraDeviceName, nil\n}", "title": "" }, { "docid": "9eefdc4be76631ac3d5659b92f0f3135", "score": "0.59968114", "text": "func (o *Allocation) GetUuidOk() (*string, bool) {\n\tif o == nil || IsNil(o.Uuid) {\n\t\treturn nil, false\n\t}\n\treturn o.Uuid, true\n}", "title": "" }, { "docid": "a812ede1b44f1e6d7306365f239d2dec", "score": "0.5977619", "text": "func (o *InvestorFee) SetUuid(v string) {\n\to.Uuid = v\n}", "title": "" }, { "docid": "888c57650abe09453a9dd0f81be0c39e", "score": "0.59714663", "text": "func getUUID() string {\n\tns, _ := uuid.FromString(\"6ba7b814-9dad-11d1-80b4-00c04fd430c8\")\n\n\treturn uuid.NewV5(ns, time.Now().Local().Format(timeFormat)).String()\n}", "title": "" }, { "docid": "4865521b0d22d1938e3102d14af0d8e5", "score": "0.5969367", "text": "func (o *DeploymentRelease) GetUuidOk() (*string, bool) {\n\tif o == nil || o.Uuid == nil {\n\t\treturn nil, false\n\t}\n\treturn o.Uuid, true\n}", "title": "" }, { "docid": "ed86fa3d5f682761d477eb2d96f6095e", "score": "0.59530824", "text": "func (o *WebhookMessage) GetUuidOk() (*string, bool) {\n\tif o == nil || o.Uuid == nil {\n\t\treturn nil, false\n\t}\n\treturn o.Uuid, true\n}", "title": "" }, { "docid": "681935aa0a4d11a6656579ecd6a02376", "score": "0.59412074", "text": "func (client *XenClient) BondGetUuid(self string) (result string, err error) {\n\tobj, err := client.APICall(\"Bond.get_uuid\", self)\n\tif err != nil {\n\t\treturn\n\t}\n\tresult = obj.(string)\n\treturn\n}", "title": "" }, { "docid": "b2d53c21e813169a280df70e7c760957", "score": "0.5921423", "text": "func (o *PatchedInvestorFee) SetUuid(v string) {\n\to.Uuid = &v\n}", "title": "" }, { "docid": "72a9a7c5be3502cd10237e6422eced77", "score": "0.5919506", "text": "func GetUidString() string {\n\treturn uGen.GetStr()\n}", "title": "" }, { "docid": "6cfa61a3528a69e073bfbd20d72c0f06", "score": "0.5904986", "text": "func getUuid() string {\n\tout, err := exec.Command(\"uuidgen\").Output()\n\tif err != nil {\n\t\tError.Println(err)\n\t}\n\tuuid := string(out)\n\tuuid = strings.Replace(uuid, \"\\n\", \"\", -1)\n\treturn uuid\n}", "title": "" }, { "docid": "ee603a8a1189a537eaa3fca3a337b657", "score": "0.58799344", "text": "func GetUUID() string {\n\tuuid, err := exec.Command(\"uuidgen\").Output()\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\treturn string(uuid)\n}", "title": "" }, { "docid": "b83515db76932051ed78981478d4a49d", "score": "0.5865452", "text": "func GetUUID(claims jwt.MapClaims) uuid.UUID {\n\tUUID, _ := uuid.Parse(fmt.Sprintf(\"%v\", claims[\"uuid\"]))\n\treturn UUID\n}", "title": "" }, { "docid": "f3c6660245eb57f3cb2d5434dd12d641", "score": "0.5848668", "text": "func (o *AccessLog) SetUuid(v string) {\n\to.Uuid = v\n}", "title": "" }, { "docid": "840f29df1911872a9174e5bb8469809e", "score": "0.584419", "text": "func (upf *UPF) UUID() string {\n\treturn upf.uuid.String()\n}", "title": "" }, { "docid": "30ce9f6247efc5f427692cc7c31f4cb7", "score": "0.5825455", "text": "func makeUuid() string {\r\n return uuid.New().String()\r\n}", "title": "" }, { "docid": "0ecfcb94004361309ac9923d7122aee6", "score": "0.5821788", "text": "func (o *Workspace) GetUuidOk() (*string, bool) {\n\tif o == nil || o.Uuid == nil {\n\t\treturn nil, false\n\t}\n\treturn o.Uuid, true\n}", "title": "" }, { "docid": "e8a35cebc8798bad054febbcd594512f", "score": "0.57963306", "text": "func (o LookupBatchResultOutput) Uuid() pulumi.StringOutput {\n\treturn o.ApplyT(func(v LookupBatchResult) string { return v.Uuid }).(pulumi.StringOutput)\n}", "title": "" }, { "docid": "6947602d11d989530bfd3f058de30167", "score": "0.57938814", "text": "func (m *EntityDTO_StorageData) GetLunUuid() string {\n\tif m != nil && m.LunUuid != nil {\n\t\treturn *m.LunUuid\n\t}\n\treturn \"\"\n}", "title": "" }, { "docid": "5f4d9d4f045f589d2740f7709d0178eb", "score": "0.57654756", "text": "func (_class PIFClass) GetUUID(sessionID SessionRef, self PIFRef) (_retval string, _err error) {\n\tif IsMock {\n\t\treturn _class.GetUUIDMock(sessionID, self)\n\t}\t\n\t_method := \"PIF.get_uuid\"\n\t_sessionIDArg, _err := convertSessionRefToXen(fmt.Sprintf(\"%s(%s)\", _method, \"session_id\"), sessionID)\n\tif _err != nil {\n\t\treturn\n\t}\n\t_selfArg, _err := convertPIFRefToXen(fmt.Sprintf(\"%s(%s)\", _method, \"self\"), self)\n\tif _err != nil {\n\t\treturn\n\t}\n\t_result, _err := _class.client.APICall(_method, _sessionIDArg, _selfArg)\n\tif _err != nil {\n\t\treturn\n\t}\n\t_retval, _err = convertStringToGo(_method + \" -> \", _result.Value)\n\treturn\n}", "title": "" }, { "docid": "9e649c057d87669a90013cdfaaa5e155", "score": "0.5748681", "text": "func (o *HyperflexStorageContainerAllOf) GetUuidOk() (*string, bool) {\n\tif o == nil || o.Uuid == nil {\n\t\treturn nil, false\n\t}\n\treturn o.Uuid, true\n}", "title": "" }, { "docid": "495b780eb61cf440575f4a32235f514f", "score": "0.5745381", "text": "func (client *XenClient) LVHDGetUuid(self string) (result string, err error) {\n\tobj, err := client.APICall(\"LVHD.get_uuid\", self)\n\tif err != nil {\n\t\treturn\n\t}\n\tresult = obj.(string)\n\treturn\n}", "title": "" }, { "docid": "a0a5ad646aa71c8e3d9108c069f35153", "score": "0.5717817", "text": "func (_class TaskClass) GetUUID(sessionID SessionRef, self TaskRef) (_retval string, _err error) {\n\tif IsMock {\n\t\treturn _class.GetUUIDMock(sessionID, self)\n\t}\t\n\t_method := \"task.get_uuid\"\n\t_sessionIDArg, _err := convertSessionRefToXen(fmt.Sprintf(\"%s(%s)\", _method, \"session_id\"), sessionID)\n\tif _err != nil {\n\t\treturn\n\t}\n\t_selfArg, _err := convertTaskRefToXen(fmt.Sprintf(\"%s(%s)\", _method, \"self\"), self)\n\tif _err != nil {\n\t\treturn\n\t}\n\t_result, _err := _class.client.APICall(_method, _sessionIDArg, _selfArg)\n\tif _err != nil {\n\t\treturn\n\t}\n\t_retval, _err = convertStringToGo(_method + \" -> \", _result.Value)\n\treturn\n}", "title": "" }, { "docid": "9decf9ec31bca225feda401547b9357f", "score": "0.5716365", "text": "func (o *Watchlist) SetUuid(v string) {\n\to.Uuid = v\n}", "title": "" }, { "docid": "0edc7403edc66a56fedca7cab3adbe1b", "score": "0.5714405", "text": "func (o *PortfolioDetail) SetUuid(v string) {\n\to.Uuid = v\n}", "title": "" }, { "docid": "08110aebfeac4a4deff7e40bdd8ad688", "score": "0.5708404", "text": "func getUID() (operations.RESULT, *UID){\n\trand.Seed(time.Now().UnixNano())\n\t_w := security.GetWotoConfig()\n\t_index := (rand.Intn(security.MaxUIDIndex) % security.MaxUIDIndex) + 1\n\t_last := _w.LastUID[_index - security.UIDIndexOffSet]\n\t_re := _w.UpdateUIDsInServer(uint8(_index))\n\treturn _re, &_last\n}", "title": "" }, { "docid": "69ff0cca36d20a71d7f4176ad6ba9fac", "score": "0.5708096", "text": "func GetUUID() string {\n\tuuid := make([]byte, 16)\n\tn, err := io.ReadFull(rand.Reader, uuid)\n\tif n != len(uuid) || err != nil {\n\t\treturn \"\"\n\t}\n\t// variant bits; see section 4.1.1\n\tuuid[8] = uuid[8]&^0xc0 | 0x80\n\t// version 4 (pseudo-random); see section 4.1.3\n\tuuid[6] = uuid[6]&^0xf0 | 0x40\n\treturn fmt.Sprintf(\"%x-%x-%x-%x-%x\", uuid[0:4], uuid[4:6], uuid[6:8], uuid[8:10], uuid[10:])\n}", "title": "" }, { "docid": "7b9ae95e5b89323886a5ec790c36134f", "score": "0.5707335", "text": "func (o *PatchedAssessment) SetUuid(v string) {\n\to.Uuid = &v\n}", "title": "" }, { "docid": "0d19ec4469f06b7ffa6cfcb4b52f10c9", "score": "0.57062197", "text": "func UID() string {\n\treturn uuid.NewV4().String()\n}", "title": "" }, { "docid": "d3cfdddc5c2a140e7de131abe1f60c83", "score": "0.5701473", "text": "func (o *InlineResponse200124Deliveries) SetUuid(v string) {\n\to.Uuid = &v\n}", "title": "" }, { "docid": "82894c4ddbc12d15ad209e320fd94501", "score": "0.56999075", "text": "func (o *PatchedApplicationClientUpdate) GetUuidOk() (*string, bool) {\n\tif o == nil || o.Uuid == nil {\n\t\treturn nil, false\n\t}\n\treturn o.Uuid, true\n}", "title": "" }, { "docid": "f34e2692c812ce3d5e04dda28358d960", "score": "0.56834793", "text": "func UID() string {\n\treturn rand.String(5)\n}", "title": "" }, { "docid": "182e0abdbc1b61bb1cea723fc86f4fbd", "score": "0.56728595", "text": "func (client *XenClient) USBGroupGetUuid(self string) (result string, err error) {\n\tobj, err := client.APICall(\"USB_group.get_uuid\", self)\n\tif err != nil {\n\t\treturn\n\t}\n\tresult = obj.(string)\n\treturn\n}", "title": "" }, { "docid": "884314b25a2b480c8519ac9f5d4143b2", "score": "0.5660294", "text": "func (o *WebhookMessage) SetUuid(v string) {\n\to.Uuid = &v\n}", "title": "" }, { "docid": "90ecbd4bd7b54319653de10d442bd3fb", "score": "0.56598926", "text": "func (o *StorageNetAppBaseDiskAllOf) GetUuidOk() (*string, bool) {\n\tif o == nil || o.Uuid == nil {\n\t\treturn nil, false\n\t}\n\treturn o.Uuid, true\n}", "title": "" }, { "docid": "4903b8c6b53f99f34d299ad05fe3b5bd", "score": "0.56377643", "text": "func (o *Workspace) SetUuid(v string) {\n\to.Uuid = &v\n}", "title": "" }, { "docid": "005daa8a7fe6a7fc4effdfdf5b5f92e4", "score": "0.56373113", "text": "func (_class GPUGroupClass) GetUUID(sessionID SessionRef, self GPUGroupRef) (_retval string, _err error) {\n\tif IsMock {\n\t\treturn _class.GetUUIDMock(sessionID, self)\n\t}\t\n\t_method := \"GPU_group.get_uuid\"\n\t_sessionIDArg, _err := convertSessionRefToXen(fmt.Sprintf(\"%s(%s)\", _method, \"session_id\"), sessionID)\n\tif _err != nil {\n\t\treturn\n\t}\n\t_selfArg, _err := convertGPUGroupRefToXen(fmt.Sprintf(\"%s(%s)\", _method, \"self\"), self)\n\tif _err != nil {\n\t\treturn\n\t}\n\t_result, _err := _class.client.APICall(_method, _sessionIDArg, _selfArg)\n\tif _err != nil {\n\t\treturn\n\t}\n\t_retval, _err = convertStringToGo(_method + \" -> \", _result.Value)\n\treturn\n}", "title": "" }, { "docid": "d32f8bce38d076d34842bdc99a33e612", "score": "0.5626825", "text": "func (s *server) GetUUID(context.Context, *pb.Snowflake_NullRequest) (*pb.Snowflake_UUID, error) {\n\ts.Lock()\n\tdefer s.Unlock()\n\n\t// get a correct serial number\n\tt := s.ts()\n\tif t < s.last_ts { // clock shift backward\n\t\tlog.Error(\"clock shift happened, waiting until the clock moving to the next millisecond.\")\n\t\tt = s.wait_ms(s.last_ts)\n\t}\n\n\tif s.last_ts == t { // same millisecond\n\t\ts.sn = (s.sn + 1) & SN_MASK\n\t\tif s.sn == 0 { // serial number overflows, wait until next ms\n\t\t\tt = s.wait_ms(s.last_ts)\n\t\t}\n\t} else { // new millsecond, reset serial number to 0\n\t\ts.sn = 0\n\t}\n\t// remember last timestamp\n\ts.last_ts = t\n\n\t// generate uuid, format:\n\t//\n\t// 0\t\t0.................0\t\t0..............0\t0........0\n\t// 1-bit\t41bit timestamp\t\t\t10bit machine-id\t12bit sn\n\tvar uuid uint64\n\tuuid |= (uint64(t) & TS_MASK) << 22\n\tuuid |= s.machine_id\n\tuuid |= s.sn\n\n\treturn &pb.Snowflake_UUID{uuid}, nil\n}", "title": "" }, { "docid": "cd481844e24f8c54de21aa2d740b3291", "score": "0.5617608", "text": "func (e Uuid) String() string {\n\treturn e.value\n}", "title": "" }, { "docid": "ca7bd161c082424656e5b922ad7c46be", "score": "0.56133556", "text": "func Getuid() int\t{ return syscall.Getuid() }", "title": "" }, { "docid": "0590e36188b42e1245c088535a898033", "score": "0.5610779", "text": "func (o *ApplicationIn) GetUid() string {\n\tif o == nil || o.Uid == nil {\n\t\tvar ret string\n\t\treturn ret\n\t}\n\treturn *o.Uid\n}", "title": "" }, { "docid": "14c2fc52ddd01321d6087007515d60cc", "score": "0.56107724", "text": "func (m *MkfsCommand) GetUUID() string {\n\tuuid := m.rootTfs.uuid\n\n\t/* UUID format: 00112233-4455-6677-8899-aabbccddeeff */\n\tvar uuidStr string\n\tfor i := 0; i < 4; i++ {\n\t\tuuidStr += fmt.Sprintf(\"%02x\", uuid[i])\n\t}\n\tuuidStr += fmt.Sprintf(\"-%02x%02x-%02x%02x-%02x%02x-\", uuid[4], uuid[5], uuid[6], uuid[7], uuid[8], uuid[9])\n\tfor i := 10; i < 16; i++ {\n\t\tuuidStr += fmt.Sprintf(\"%02x\", uuid[i])\n\t}\n\treturn uuidStr\n}", "title": "" }, { "docid": "2a0dc426b36bbeaa7acfed98dd8c739c", "score": "0.5605657", "text": "func (o *Vulnerability) SetUuid(v string) {\n\to.Uuid = &v\n}", "title": "" }, { "docid": "9a01cc54d4046b18ed3d33c0aa7499ef", "score": "0.55987436", "text": "func (o *PatchedInvestorFee) HasUuid() bool {\n\tif o != nil && o.Uuid != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" } ]
a11f3ecfff7584a351fcaa026c69db8a
PutAppFromDirectory provides a mock function with given fields: dir, ignorePaths
[ { "docid": "fbae8b82663c88274a197eeeff69456c", "score": "0.8004024", "text": "func (_m *RunInterface) PutAppFromDirectory(dir string, ignorePaths []string) error {\n\tret := _m.Called(dir, ignorePaths)\n\n\tvar r0 error\n\tif rf, ok := ret.Get(0).(func(string, []string) error); ok {\n\t\tr0 = rf(dir, ignorePaths)\n\t} else {\n\t\tr0 = ret.Error(0)\n\t}\n\n\treturn r0\n}", "title": "" } ]
[ { "docid": "d7b8e2250061f6a7d6d2b23609a9c576", "score": "0.5856714", "text": "func (_m *RunInterface) GetAppToDirectory(dir string) error {\n\tret := _m.Called(dir)\n\n\tvar r0 error\n\tif rf, ok := ret.Get(0).(func(string) error); ok {\n\t\tr0 = rf(dir)\n\t} else {\n\t\tr0 = ret.Error(0)\n\t}\n\n\treturn r0\n}", "title": "" }, { "docid": "06647584f8cb2c39812c338b10e9c1ac", "score": "0.56953883", "text": "func (_m *RunInterface) PutCacheFromDirectory(dir string) error {\n\tret := _m.Called(dir)\n\n\tvar r0 error\n\tif rf, ok := ret.Get(0).(func(string) error); ok {\n\t\tr0 = rf(dir)\n\t} else {\n\t\tr0 = ret.Error(0)\n\t}\n\n\treturn r0\n}", "title": "" }, { "docid": "97e146a5ede053a59ec5b7dbf1b1d347", "score": "0.55139095", "text": "func mockConfigDir() (string, error) {\n\treturn \"/tmp/CONFIG/datamaps/\", nil\n}", "title": "" }, { "docid": "4fdb4d4e75b913eecee5395a253cb4eb", "score": "0.52481496", "text": "func TestDirOverride(t *testing.T) {\n\tdir, err := ioutil.TempDir(\"\", tstprefix)\n\tif err != nil {\n\t\tt.Fatalf(\"error creating tempdir: %v\", err)\n\t}\n\tdefer os.RemoveAll(dir)\n\tds := NewTestStore()\n\n\timj := `\n\t\t{\n\t\t \"acKind\": \"ImageManifest\",\n\t\t \"acVersion\": \"0.1.1\",\n\t\t \"name\": \"example.com/test01\"\n\t\t}\n\t`\n\n\tentries := []*testTarEntry{\n\t\t{\n\t\t\tcontents: imj,\n\t\t\theader: &tar.Header{\n\t\t\t\tName: \"manifest\",\n\t\t\t\tSize: int64(len(imj)),\n\t\t\t},\n\t\t},\n\t\t{\n\t\t\theader: &tar.Header{\n\t\t\t\tName: \"rootfs/a\",\n\t\t\t\tTypeflag: tar.TypeDir,\n\t\t\t},\n\t\t},\n\t}\n\n\tkey1, err := newTestACI(entries, dir, ds)\n\tif err != nil {\n\t\tt.Fatalf(\"unexpected error: %v\", err)\n\t}\n\tim, err := createImageManifest(imj)\n\tif err != nil {\n\t\tt.Fatalf(\"unexpected error: %v\", err)\n\t}\n\timage1 := Image{Im: im, Key: key1, Level: 1}\n\n\timj = `\n\t\t{\n\t\t \"acKind\": \"ImageManifest\",\n\t\t \"acVersion\": \"0.1.1\",\n\t\t \"name\": \"example.com/test02\"\n\t\t}\n\t`\n\n\tk1, _ := types.NewHash(key1)\n\timj, err = addDependencies(imj,\n\t\ttypes.Dependency{\n\t\t\tImageName: \"example.com/test01\",\n\t\t\tImageID: k1},\n\t)\n\n\tentries = []*testTarEntry{\n\t\t{\n\t\t\tcontents: imj,\n\t\t\theader: &tar.Header{\n\t\t\t\tName: \"manifest\",\n\t\t\t\tSize: int64(len(imj)),\n\t\t\t},\n\t\t},\n\t\t// An empty dir\n\t\t{\n\t\t\theader: &tar.Header{\n\t\t\t\tName: \"rootfs/a\",\n\t\t\t\tTypeflag: tar.TypeDir,\n\t\t\t\tMode: 0700,\n\t\t\t},\n\t\t},\n\t}\n\n\texpectedFiles := []*fileInfo{\n\t\t&fileInfo{path: \"manifest\", typeflag: tar.TypeReg},\n\t\t&fileInfo{path: \"rootfs/a\", typeflag: tar.TypeDir, mode: 0700},\n\t}\n\n\tkey2, err := newTestACI(entries, dir, ds)\n\tif err != nil {\n\t\tt.Fatalf(\"unexpected error: %v\", err)\n\t}\n\tim, err = createImageManifest(imj)\n\tif err != nil {\n\t\tt.Fatalf(\"unexpected error: %v\", err)\n\t}\n\timage2 := Image{Im: im, Key: key2, Level: 0}\n\n\timages := Images{image2, image1}\n\terr = checkRenderACIFromList(images, expectedFiles, ds)\n\tif err != nil {\n\t\tt.Fatalf(\"unexpected error: %v\", err)\n\t}\n\terr = checkRenderACI(\"example.com/test02\", expectedFiles, ds)\n\tif err != nil {\n\t\tt.Fatalf(\"unexpected error: %v\", err)\n\t}\n}", "title": "" }, { "docid": "a63cf61ad8cab21fc253c166bd2fa21f", "score": "0.51684844", "text": "func TestDirIgnoreDir(t *testing.T) {\n\t// Init test files\n\tcurDir, _ := os.Getwd()\n\ttmpDir := filepath.Join(curDir, \"./tmp\")\n\tdefer os.RemoveAll(tmpDir)\n\tmakeTmpFiles(tmpDir, []string{\n\t\t\".git\",\n\t\t\"app.js\",\n\t\t\"package.json\",\n\t\t\"src/router.js\",\n\t\t\"src/store.js\",\n\t\t\"src/store.ts\",\n\t\t\"src/api/home.js\",\n\t\t\"src/api/user.js\",\n\t\t\"src/api/test.js\",\n\t\t\"src/service/home.js\",\n\t\t\"src/service/user.js\",\n\t\t\"src/service/test.js\",\n\t})\n\n\tpatterns := []string{\n\t\t\"src/**/*.js\",\n\t\t\"!src/service\",\n\t}\n\n\t// Match the patterns\n\tfiles := Match(patterns, Option{BaseDir: tmpDir})\n\t// Expected match files:\n\texpected := []string{\n\t\t\"src/router.js\",\n\t\t\"src/store.js\",\n\t\t\"src/api/home.js\",\n\t\t\"src/api/user.js\",\n\t\t\"src/api/test.js\",\n\t}\n\tif checkFiles(tmpDir, files, expected) {\n\t\tt.Errorf(\"files not match, expected %v, but got %v\", expected, files)\n\t}\n}", "title": "" }, { "docid": "4f5f2bf20322e79177639b08d7534198", "score": "0.5160301", "text": "func (_m *Knapsack) SetUpdateDirectory(directory string) error {\n\tret := _m.Called(directory)\n\n\tvar r0 error\n\tif rf, ok := ret.Get(0).(func(string) error); ok {\n\t\tr0 = rf(directory)\n\t} else {\n\t\tr0 = ret.Error(0)\n\t}\n\n\treturn r0\n}", "title": "" }, { "docid": "519994be65a61681145656171d1c458b", "score": "0.5143774", "text": "func (_m *Knapsack) UpdateDirectory() 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}", "title": "" }, { "docid": "316c4e51cc5c4d202aa71fbf442a766b", "score": "0.5070659", "text": "func (_m *AWSer) UploadDirectoryToS3(localPath string, bucket string, prefix string) ([]string, []string) {\n\tret := _m.Called(localPath, bucket, prefix)\n\n\tvar r0 []string\n\tif rf, ok := ret.Get(0).(func(string, string, string) []string); ok {\n\t\tr0 = rf(localPath, bucket, prefix)\n\t} else {\n\t\tif ret.Get(0) != nil {\n\t\t\tr0 = ret.Get(0).([]string)\n\t\t}\n\t}\n\n\tvar r1 []string\n\tif rf, ok := ret.Get(1).(func(string, string, string) []string); ok {\n\t\tr1 = rf(localPath, bucket, prefix)\n\t} else {\n\t\tif ret.Get(1) != nil {\n\t\t\tr1 = ret.Get(1).([]string)\n\t\t}\n\t}\n\n\treturn r0, r1\n}", "title": "" }, { "docid": "32b59a02b2cab3ba60cc0d62ea280a5d", "score": "0.50525343", "text": "func (_m *RunInterface) PutApp(data io.Reader) error {\n\tret := _m.Called(data)\n\n\tvar r0 error\n\tif rf, ok := ret.Get(0).(func(io.Reader) error); ok {\n\t\tr0 = rf(data)\n\t} else {\n\t\tr0 = ret.Error(0)\n\t}\n\n\treturn r0\n}", "title": "" }, { "docid": "8ea7e961944d48e28c90ecafa5370a42", "score": "0.4907746", "text": "func Test_App_MountPath(t *testing.T) {\n\tt.Parallel()\n\tapp := New()\n\tone := New()\n\ttwo := New()\n\tthree := New()\n\n\ttwo.Mount(\"/three\", three)\n\tone.Mount(\"/two\", two)\n\tapp.Mount(\"/one\", one)\n\n\tutils.AssertEqual(t, \"/one\", one.MountPath())\n\tutils.AssertEqual(t, \"/one/two\", two.MountPath())\n\tutils.AssertEqual(t, \"/one/two/three\", three.MountPath())\n\tutils.AssertEqual(t, \"\", app.MountPath())\n}", "title": "" }, { "docid": "0552db8dc3db5d54b72d7b3e89754240", "score": "0.4893265", "text": "func TestFileOvverideDir(t *testing.T) {\n\tdir, err := ioutil.TempDir(\"\", tstprefix)\n\tif err != nil {\n\t\tt.Fatalf(\"error creating tempdir: %v\", err)\n\t}\n\tdefer os.RemoveAll(dir)\n\tds := NewTestStore()\n\n\timj := `\n\t\t{\n\t\t \"acKind\": \"ImageManifest\",\n\t\t \"acVersion\": \"0.1.1\",\n\t\t \"name\": \"example.com/test01\"\n\t\t}\n\t`\n\n\tentries := []*testTarEntry{\n\t\t{\n\t\t\tcontents: imj,\n\t\t\theader: &tar.Header{\n\t\t\t\tName: \"manifest\",\n\t\t\t\tSize: int64(len(imj)),\n\t\t\t},\n\t\t},\n\t\t{\n\t\t\theader: &tar.Header{\n\t\t\t\tName: \"rootfs/a/b\",\n\t\t\t\tTypeflag: tar.TypeDir,\n\t\t\t\tMode: 0700,\n\t\t\t},\n\t\t},\n\t\t{\n\t\t\theader: &tar.Header{\n\t\t\t\tName: \"rootfs/a/b/c\",\n\t\t\t\tTypeflag: tar.TypeDir,\n\t\t\t\tMode: 0700,\n\t\t\t},\n\t\t},\n\t\t{\n\t\t\tcontents: \"hello\",\n\t\t\theader: &tar.Header{\n\t\t\t\tName: \"rootfs/a/b/c/file01\",\n\t\t\t\tSize: 5,\n\t\t\t},\n\t\t},\n\t}\n\n\tkey1, err := newTestACI(entries, dir, ds)\n\tif err != nil {\n\t\tt.Fatalf(\"unexpected error: %v\", err)\n\t}\n\tim, err := createImageManifest(imj)\n\tif err != nil {\n\t\tt.Fatalf(\"unexpected error: %v\", err)\n\t}\n\timage1 := Image{Im: im, Key: key1, Level: 1}\n\n\timj = `\n\t\t{\n\t\t \"acKind\": \"ImageManifest\",\n\t\t \"acVersion\": \"0.1.1\",\n\t\t \"name\": \"example.com/test02\"\n\t\t}\n\t`\n\n\tk1, _ := types.NewHash(key1)\n\timj, err = addDependencies(imj,\n\t\ttypes.Dependency{\n\t\t\tImageName: \"example.com/test01\",\n\t\t\tImageID: k1},\n\t)\n\n\tentries = []*testTarEntry{\n\t\t{\n\t\t\tcontents: imj,\n\t\t\theader: &tar.Header{\n\t\t\t\tName: \"manifest\",\n\t\t\t\tSize: int64(len(imj)),\n\t\t\t},\n\t\t},\n\t\t{\n\t\t\tcontents: \"hellohello\",\n\t\t\theader: &tar.Header{\n\t\t\t\tName: \"rootfs/a/b\",\n\t\t\t\tSize: 10,\n\t\t\t},\n\t\t},\n\t}\n\n\texpectedFiles := []*fileInfo{\n\t\t&fileInfo{path: \"manifest\", typeflag: tar.TypeReg},\n\t\t&fileInfo{path: \"rootfs/a/b\", typeflag: tar.TypeReg, size: 10},\n\t}\n\n\tkey2, err := newTestACI(entries, dir, ds)\n\tif err != nil {\n\t\tt.Fatalf(\"unexpected error: %v\", err)\n\t}\n\tim, err = createImageManifest(imj)\n\tif err != nil {\n\t\tt.Fatalf(\"unexpected error: %v\", err)\n\t}\n\timage2 := Image{Im: im, Key: key2, Level: 0}\n\n\timages := Images{image2, image1}\n\terr = checkRenderACIFromList(images, expectedFiles, ds)\n\tif err != nil {\n\t\tt.Fatalf(\"unexpected error: %v\", err)\n\t}\n\terr = checkRenderACI(\"example.com/test02\", expectedFiles, ds)\n\tif err != nil {\n\t\tt.Fatalf(\"unexpected error: %v\", err)\n\t}\n}", "title": "" }, { "docid": "292dad765c0834cd09bd82d6e3fc3f26", "score": "0.4835972", "text": "func getTestAppDir(t *testing.T) string {\n\treturn filepath.Join(getTestDataDir(t), \"app\")\n}", "title": "" }, { "docid": "1a16b90be34a5e5b89fc2e57f9bf4224", "score": "0.47632352", "text": "func TestNewDir(t *testing.T) {\n\tdir, err := ioutil.TempDir(\"\", tstprefix)\n\tif err != nil {\n\t\tt.Fatalf(\"error creating tempdir: %v\", err)\n\t}\n\tdefer os.RemoveAll(dir)\n\tds := NewTestStore()\n\n\timj := `\n\t\t{\n\t\t \"acKind\": \"ImageManifest\",\n\t\t \"acVersion\": \"0.1.1\",\n\t\t \"name\": \"example.com/test01\"\n\t\t}\n\t`\n\n\tentries := []*testTarEntry{\n\t\t{\n\t\t\tcontents: imj,\n\t\t\theader: &tar.Header{\n\t\t\t\tName: \"manifest\",\n\t\t\t\tSize: int64(len(imj)),\n\t\t\t},\n\t\t},\n\t\t// An empty dir\n\t\t{\n\t\t\theader: &tar.Header{\n\t\t\t\tName: \"rootfs/a\",\n\t\t\t\tTypeflag: tar.TypeDir,\n\t\t\t},\n\t\t},\n\t}\n\n\tkey1, err := newTestACI(entries, dir, ds)\n\tif err != nil {\n\t\tt.Fatalf(\"unexpected error: %v\", err)\n\t}\n\tim, err := createImageManifest(imj)\n\tif err != nil {\n\t\tt.Fatalf(\"unexpected error: %v\", err)\n\t}\n\timage1 := Image{Im: im, Key: key1, Level: 0}\n\n\timj = `\n\t\t{\n\t\t \"acKind\": \"ImageManifest\",\n\t\t \"acVersion\": \"0.1.1\",\n\t\t \"name\": \"example.com/test02\"\n\t\t}\n\t`\n\n\tk1, _ := types.NewHash(key1)\n\timj, err = addDependencies(imj,\n\t\ttypes.Dependency{\n\t\t\tImageName: \"example.com/test01\",\n\t\t\tImageID: k1},\n\t)\n\n\tentries = []*testTarEntry{\n\t\t{\n\t\t\tcontents: imj,\n\t\t\theader: &tar.Header{\n\t\t\t\tName: \"manifest\",\n\t\t\t\tSize: int64(len(imj)),\n\t\t\t},\n\t\t},\n\t}\n\n\texpectedFiles := []*fileInfo{\n\t\t&fileInfo{path: \"manifest\", typeflag: tar.TypeReg},\n\t\t&fileInfo{path: \"rootfs/a\", typeflag: tar.TypeDir},\n\t}\n\n\tkey2, err := newTestACI(entries, dir, ds)\n\tif err != nil {\n\t\tt.Fatalf(\"unexpected error: %v\", err)\n\t}\n\tim, err = createImageManifest(imj)\n\tif err != nil {\n\t\tt.Fatalf(\"unexpected error: %v\", err)\n\t}\n\timage2 := Image{Im: im, Key: key2, Level: 1}\n\n\timages := Images{image2, image1}\n\terr = checkRenderACIFromList(images, expectedFiles, ds)\n\tif err != nil {\n\t\tt.Fatalf(\"unexpected error: %v\", err)\n\t}\n\terr = checkRenderACI(\"example.com/test02\", expectedFiles, ds)\n\tif err != nil {\n\t\tt.Fatalf(\"unexpected error: %v\", err)\n\t}\n}", "title": "" }, { "docid": "1abd7ba5fd3a01ef9c6d59be44075370", "score": "0.47464138", "text": "func setupTestDir(t *testing.T, dir string) {\n\tfor _, file := range []string{\n\t\t\"kubernetes-client-darwin-386.tar.gz\",\n\t\t\"kubernetes-client-darwin-amd64.tar.gz\",\n\t\t\"kubernetes-client-linux-386.tar.gz\",\n\t\t\"kubernetes-client-linux-amd64.tar.gz\",\n\t\t\"kubernetes-client-linux-arm.tar.gz\",\n\t\t\"kubernetes-client-linux-arm64.tar.gz\",\n\t\t\"kubernetes-client-linux-ppc64le.tar.gz\",\n\t\t\"kubernetes-client-linux-s390x.tar.gz\",\n\t\t\"kubernetes-client-windows-386.tar.gz\",\n\t\t\"kubernetes-client-windows-amd64.tar.gz\",\n\t\t\"kubernetes-node-linux-amd64.tar.gz\",\n\t\t\"kubernetes-node-linux-arm.tar.gz\",\n\t\t\"kubernetes-node-linux-arm64.tar.gz\",\n\t\t\"kubernetes-node-linux-ppc64le.tar.gz\",\n\t\t\"kubernetes-node-linux-s390x.tar.gz\",\n\t\t\"kubernetes-node-windows-amd64.tar.gz\",\n\t\t\"kubernetes-server-linux-amd64.tar.gz\",\n\t\t\"kubernetes-server-linux-arm.tar.gz\",\n\t\t\"kubernetes-server-linux-arm64.tar.gz\",\n\t\t\"kubernetes-server-linux-ppc64le.tar.gz\",\n\t\t\"kubernetes-server-linux-s390x.tar.gz\",\n\t\t\"kubernetes-src.tar.gz\",\n\t\t\"kubernetes.tar.gz\",\n\t} {\n\t\trequire.Nil(t, ioutil.WriteFile(\n\t\t\tfilepath.Join(dir, file), []byte{1, 2, 3}, os.FileMode(0644),\n\t\t))\n\t}\n}", "title": "" }, { "docid": "f93abafcfa60e6efcad5af65c70dcbbb", "score": "0.47306558", "text": "func WithBundleDir(t *testing.T, fn func(dir string)) {\n\tdir, err := ioutil.TempDir(\"\", \"test\")\n\trequire.NoError(t, err)\n\n\tdefer func() {\n\t\trequire.NoError(t, os.RemoveAll(dir))\n\t}()\n\n\tfn(dir)\n}", "title": "" }, { "docid": "01c0393891b6af2a122bf38b8ed008dc", "score": "0.46625158", "text": "func MakeMock(srcPath, dstPath string) error {\n\tisGoFile := func(info os.FileInfo) bool {\n\t\tif info.IsDir() {\n\t\t\treturn false\n\t\t}\n\t\tif strings.HasSuffix(info.Name(), \"_test.go\") {\n\t\t\treturn false\n\t\t}\n\t\treturn strings.HasSuffix(info.Name(), \".go\")\n\t}\n\n\tfset := token.NewFileSet()\n\tpkgs, err := parser.ParseDir(fset, srcPath, isGoFile, parser.ParseComments)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tfor name, pkg := range pkgs {\n\t\ttypes := make(map[string]ast.Expr)\n\t\trecorders := make(map[string]string)\n\n\t\tfor path, file := range pkg.Files {\n\t\t\tfilename := filepath.Join(dstPath, filepath.Base(path))\n\n\t\t\tout, err := os.Create(filename)\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t\tdefer out.Close()\n\n\t\t\terr = mockFile(out, srcPath, file, types, recorders)\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\n\t\t\terr = fixup(filename)\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t\tfilename := filepath.Join(dstPath, name+\"_mock.go\")\n\n\t\tout, err := os.Create(filename)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tdefer out.Close()\n\n\t\terr = mockPkg(out, name, types, recorders)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\terr = fixup(filename)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "f155ce88bff215d44ada0a14c485d4da", "score": "0.46466833", "text": "func (s *mockFSServer) Mkdir(ctx context.Context, r *proto.MakeDirRequest) (*proto.MakeDirResponse, error) {\n\ts.lock.Lock()\n\tdefer s.lock.Unlock()\n\ts.filesCreated[r.Path] = true\n\n\treturn new(proto.MakeDirResponse), nil\n}", "title": "" }, { "docid": "514825d33f863fafd3ce1c47144c3f22", "score": "0.4643706", "text": "func setupAppDirectory(dm util.DepManager, appPath, coreVersion string) error {\n\n\terr := os.Mkdir(filepath.Join(appPath, dirBin), os.ModePerm)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tsrcDir := filepath.Join(appPath, dirSrc)\n\terr = os.Mkdir(srcDir, os.ModePerm)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t_, err = os.Create(filepath.Join(srcDir, fileImportsGo))\n\tif err != nil {\n\t\treturn err\n\t}\n\terr = ioutil.WriteFile(filepath.Join(srcDir, fileImportsGo), []byte(\"package main\\n\"), 0644)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\terr = dm.Init()\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tflogoCoreImport := util.NewFlogoImport(flogoCoreRepo, \"\", coreVersion, \"\")\n\n\t//todo get the actual version installed from the go.mod file\n\tif coreVersion == \"\" {\n\t\tfmt.Printf(\"Installing: %s@latest\\n\", flogoCoreImport.CanonicalImport())\n\t} else {\n\t\tfmt.Printf(\"Installing: %s\\n\", flogoCoreImport.CanonicalImport())\n\t}\n\n\t// add & fetch the core library\n\terr = dm.AddDependency(flogoCoreImport)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "00cc9ed6632c04839698afbccd1e0f78", "score": "0.46421382", "text": "func (_m *Forge) Dir(ctx context.Context, u *model.User, r *model.Repo, b *model.Pipeline, f string) ([]*types.FileMeta, error) {\n\tret := _m.Called(ctx, u, r, b, f)\n\n\tvar r0 []*types.FileMeta\n\tvar r1 error\n\tif rf, ok := ret.Get(0).(func(context.Context, *model.User, *model.Repo, *model.Pipeline, string) ([]*types.FileMeta, error)); ok {\n\t\treturn rf(ctx, u, r, b, f)\n\t}\n\tif rf, ok := ret.Get(0).(func(context.Context, *model.User, *model.Repo, *model.Pipeline, string) []*types.FileMeta); ok {\n\t\tr0 = rf(ctx, u, r, b, f)\n\t} else {\n\t\tif ret.Get(0) != nil {\n\t\t\tr0 = ret.Get(0).([]*types.FileMeta)\n\t\t}\n\t}\n\n\tif rf, ok := ret.Get(1).(func(context.Context, *model.User, *model.Repo, *model.Pipeline, string) error); ok {\n\t\tr1 = rf(ctx, u, r, b, f)\n\t} else {\n\t\tr1 = ret.Error(1)\n\t}\n\n\treturn r0, r1\n}", "title": "" }, { "docid": "d9739b56aa3fb7cfd97d9d37baec874d", "score": "0.45953017", "text": "func TestDirFromParent(t *testing.T) {\n\tdir, err := ioutil.TempDir(\"\", tstprefix)\n\tif err != nil {\n\t\tt.Fatalf(\"error creating tempdir: %v\", err)\n\t}\n\tdefer os.RemoveAll(dir)\n\tds := NewTestStore()\n\n\timj := `\n\t\t{\n\t\t \"acKind\": \"ImageManifest\",\n\t\t \"acVersion\": \"0.1.1\",\n\t\t \"name\": \"example.com/test01\"\n\t\t}\n\t`\n\n\tentries := []*testTarEntry{\n\t\t{\n\t\t\tcontents: imj,\n\t\t\theader: &tar.Header{\n\t\t\t\tName: \"manifest\",\n\t\t\t\tSize: int64(len(imj)),\n\t\t\t},\n\t\t},\n\t\t// An empty dir\n\t\t{\n\t\t\theader: &tar.Header{\n\t\t\t\tName: \"rootfs/a\",\n\t\t\t\tTypeflag: tar.TypeDir,\n\t\t\t},\n\t\t},\n\t}\n\n\tkey1, err := newTestACI(entries, dir, ds)\n\tif err != nil {\n\t\tt.Fatalf(\"unexpected error: %v\", err)\n\t}\n\tim, err := createImageManifest(imj)\n\tif err != nil {\n\t\tt.Fatalf(\"unexpected error: %v\", err)\n\t}\n\timage1 := Image{Im: im, Key: key1, Level: 1}\n\n\timj = `\n\t\t{\n\t\t \"acKind\": \"ImageManifest\",\n\t\t \"acVersion\": \"0.1.1\",\n\t\t \"name\": \"example.com/test02\"\n\t\t}\n\t`\n\n\tk1, _ := types.NewHash(key1)\n\timj, err = addDependencies(imj,\n\t\ttypes.Dependency{\n\t\t\tImageName: \"example.com/test01\",\n\t\t\tImageID: k1},\n\t)\n\n\tentries = []*testTarEntry{\n\t\t{\n\t\t\tcontents: imj,\n\t\t\theader: &tar.Header{\n\t\t\t\tName: \"manifest\",\n\t\t\t\tSize: int64(len(imj)),\n\t\t\t},\n\t\t},\n\t}\n\n\texpectedFiles := []*fileInfo{\n\t\t&fileInfo{path: \"manifest\", typeflag: tar.TypeReg},\n\t\t&fileInfo{path: \"rootfs/a\", typeflag: tar.TypeDir},\n\t}\n\n\tkey2, err := newTestACI(entries, dir, ds)\n\tif err != nil {\n\t\tt.Fatalf(\"unexpected error: %v\", err)\n\t}\n\tim, err = createImageManifest(imj)\n\tif err != nil {\n\t\tt.Fatalf(\"unexpected error: %v\", err)\n\t}\n\timage2 := Image{Im: im, Key: key2, Level: 0}\n\n\timages := Images{image2, image1}\n\terr = checkRenderACIFromList(images, expectedFiles, ds)\n\tif err != nil {\n\t\tt.Fatalf(\"unexpected error: %v\", err)\n\t}\n\terr = checkRenderACI(\"example.com/test02\", expectedFiles, ds)\n\tif err != nil {\n\t\tt.Fatalf(\"unexpected error: %v\", err)\n\t}\n}", "title": "" }, { "docid": "d872abe36764211fc40413c49d626760", "score": "0.45891356", "text": "func (_m *ISession) ApplicationUpdate(appID string, ap *discordgo.Application) (*discordgo.Application, error) {\n\tret := _m.Called(appID, ap)\n\n\tvar r0 *discordgo.Application\n\tvar r1 error\n\tif rf, ok := ret.Get(0).(func(string, *discordgo.Application) (*discordgo.Application, error)); ok {\n\t\treturn rf(appID, ap)\n\t}\n\tif rf, ok := ret.Get(0).(func(string, *discordgo.Application) *discordgo.Application); ok {\n\t\tr0 = rf(appID, ap)\n\t} else {\n\t\tif ret.Get(0) != nil {\n\t\t\tr0 = ret.Get(0).(*discordgo.Application)\n\t\t}\n\t}\n\n\tif rf, ok := ret.Get(1).(func(string, *discordgo.Application) error); ok {\n\t\tr1 = rf(appID, ap)\n\t} else {\n\t\tr1 = ret.Error(1)\n\t}\n\n\treturn r0, r1\n}", "title": "" }, { "docid": "223f476623722b633fc4f53b93f4a0b2", "score": "0.458892", "text": "func TestDirIgnoreFile(t *testing.T) {\n\t// Init test files\n\tcurDir, _ := os.Getwd()\n\ttmpDir := filepath.Join(curDir, \"./tmp\")\n\tdefer os.RemoveAll(tmpDir)\n\tmakeTmpFiles(tmpDir, []string{\n\t\t\".git\",\n\t\t\"app.js\",\n\t\t\"package.json\",\n\t\t\"src/router.js\",\n\t\t\"src/store.js\",\n\t\t\"src/store.ts\",\n\t\t\"src/api/home.js\",\n\t\t\"src/api/user.js\",\n\t\t\"src/api/test.js\",\n\t\t\"src/service/home.js\",\n\t\t\"src/service/user.js\",\n\t\t\"src/service/test.js\",\n\t})\n\n\tpatterns := []string{\n\t\t\"src/**/*.js\",\n\t\t\"!src/service/home.js\",\n\t}\n\n\t// Match the patterns\n\tfiles := Match(patterns, Option{BaseDir: tmpDir})\n\t// Expected match files:\n\texpected := []string{\n\t\t\"src/router.js\",\n\t\t\"src/store.js\",\n\t\t\"src/api/home.js\",\n\t\t\"src/api/user.js\",\n\t\t\"src/api/test.js\",\n\t\t\"src/service/user.js\",\n\t\t\"src/service/test.js\",\n\t}\n\tif checkFiles(tmpDir, files, expected) {\n\t\tt.Errorf(\"files not match, expected %v, but got %v\", expected, files)\n\t}\n}", "title": "" }, { "docid": "568c5f26efa693696b3588b3a68403fe", "score": "0.4557777", "text": "func (m *MockTenantServiceDao) BindAppByServiceIDs(appID string, serviceIDs []string) error {\n\tret := m.ctrl.Call(m, \"BindAppByServiceIDs\", appID, serviceIDs)\n\tret0, _ := ret[0].(error)\n\treturn ret0\n}", "title": "" }, { "docid": "d844fec3e9e73ce667b6a70208d9382d", "score": "0.45515022", "text": "func setupPathForTest(t *testing.T) func() {\n\tworkingDirectoryBeforeTest, err := os.Getwd()\n\tif err != nil {\n\t\tt.Fatal(err)\n\t}\n\n\t// Create tmp directory and cd into it to store private key files\n\ttmpDir, err := ioutil.TempDir(\"\", \"tmp-ctl-test-*\")\n\tif err != nil {\n\t\tt.Fatal(err)\n\t}\n\n\tif err := os.Chdir(tmpDir); err != nil {\n\t\tt.Fatal(err)\n\t}\n\treturn func() {\n\t\tif err := os.Chdir(workingDirectoryBeforeTest); err != nil {\n\t\t\tt.Fatal(err)\n\t\t}\n\t\tif err := os.RemoveAll(tmpDir); err != nil {\n\t\t\tt.Fatal(err)\n\t\t}\n\t}\n}", "title": "" }, { "docid": "366187885fb5d9e1939344b95b64238b", "score": "0.45417058", "text": "func (_m *OSIOAPI) ReadDir(dirname string) ([]os.FileInfo, error) {\n\tret := _m.Called(dirname)\n\n\tvar r0 []os.FileInfo\n\tif rf, ok := ret.Get(0).(func(string) []os.FileInfo); ok {\n\t\tr0 = rf(dirname)\n\t} else {\n\t\tif ret.Get(0) != nil {\n\t\t\tr0 = ret.Get(0).([]os.FileInfo)\n\t\t}\n\t}\n\n\tvar r1 error\n\tif rf, ok := ret.Get(1).(func(string) error); ok {\n\t\tr1 = rf(dirname)\n\t} else {\n\t\tr1 = ret.Error(1)\n\t}\n\n\treturn r0, r1\n}", "title": "" }, { "docid": "aa2d607559232719a653205a199726b2", "score": "0.45375985", "text": "func prepareDir(t *testing.T, fs *fs.FileSystem) bool {\n\tif !errors.AssertNil(t, fs.CreateDirectory(\"/foo\")) {\n\t\treturn false\n\t}\n\tif !errors.AssertNil(t, fs.CreateDirectory(\"/foo/bar\")) {\n\t\treturn false\n\t}\n\tif !errors.AssertNil(t, fs.CreateDirectory(\"/foo/test\")) {\n\t\treturn false\n\t}\n\tif !errors.AssertNil(t, fs.CreateDirectory(\"/foo/bar/hello\")) {\n\t\treturn false\n\t}\n\tif !errors.AssertNil(t, fs.WriteString(\"/foo/test.txt\", \"foo1\")) {\n\t\treturn false\n\t}\n\tif !errors.AssertNil(t, fs.WriteString(\"/foo/bar/hello/blub.txt\", \"bar2\")) {\n\t\treturn false\n\t}\n\treturn true\n}", "title": "" }, { "docid": "b0a9089934573a91c90afd3513422067", "score": "0.45064607", "text": "func TestDirStar(t *testing.T) {\n\t// Init test files\n\tcurDir, _ := os.Getwd()\n\ttmpDir := filepath.Join(curDir, \"./tmp\")\n\tdefer os.RemoveAll(tmpDir)\n\tmakeTmpFiles(tmpDir, []string{\n\t\t\".git\",\n\t\t\"app.js\",\n\t\t\"package.json\",\n\t\t\"src/router.js\",\n\t\t\"src/store.js\",\n\t\t\"src/api/home.js\",\n\t\t\"src/api/user.js\",\n\t\t\"src/api/test.js\",\n\t})\n\n\tpatterns := []string{\n\t\t\"src/**/*\",\n\t}\n\n\t// Match the patterns\n\tfiles := Match(patterns, Option{BaseDir: tmpDir})\n\t// Expected match files:\n\texpected := []string{\n\t\t\"src/router.js\",\n\t\t\"src/store.js\",\n\t\t\"src/api/home.js\",\n\t\t\"src/api/user.js\",\n\t\t\"src/api/test.js\",\n\t}\n\tif checkFiles(tmpDir, files, expected) {\n\t\tt.Errorf(\"files not match, expected %v, but got %v\", expected, files)\n\t}\n}", "title": "" }, { "docid": "c044315c38b5bc64d98c41e5993de7de", "score": "0.45053744", "text": "func (_m *Client) UpdateFolder(_a0 context.Context, _a1 build.UpdateFolderArgs) (*build.Folder, error) {\n\tret := _m.Called(_a0, _a1)\n\n\tvar r0 *build.Folder\n\tif rf, ok := ret.Get(0).(func(context.Context, build.UpdateFolderArgs) *build.Folder); ok {\n\t\tr0 = rf(_a0, _a1)\n\t} else {\n\t\tif ret.Get(0) != nil {\n\t\t\tr0 = ret.Get(0).(*build.Folder)\n\t\t}\n\t}\n\n\tvar r1 error\n\tif rf, ok := ret.Get(1).(func(context.Context, build.UpdateFolderArgs) error); ok {\n\t\tr1 = rf(_a0, _a1)\n\t} else {\n\t\tr1 = ret.Error(1)\n\t}\n\n\treturn r0, r1\n}", "title": "" }, { "docid": "8059dd42c5a888b5f7d85e6fc502507a", "score": "0.45027894", "text": "func (fs *FakeSubpath) SafeMakeDir(pathname string, base string, perm os.FileMode) error {\n\treturn nil\n}", "title": "" }, { "docid": "38959fd3d5020007b73677d914f9b9b5", "score": "0.4499142", "text": "func TestUploadDirectoryToVirtualDirectory(t *testing.T) {\n\ta := assert.New(t)\n\tbsc := getBlobServiceClient()\n\tvdirName := \"vdir\"\n\n\t// set up the source with numerous files\n\tsrcDirPath := scenarioHelper{}.generateLocalDirectory(a)\n\tdefer os.RemoveAll(srcDirPath)\n\tfileList := scenarioHelper{}.generateCommonRemoteScenarioForLocal(a, srcDirPath, \"\")\n\n\t// set up an empty container\n\tcc, containerName := createNewContainer(a, bsc)\n\tdefer deleteContainer(a, cc)\n\n\t// set up interceptor\n\tmockedRPC := interceptor{}\n\tRpc = mockedRPC.intercept\n\tmockedRPC.init()\n\n\t// construct the raw input to simulate user input\n\trawContainerURLWithSAS := scenarioHelper{}.getRawBlobURLWithSAS(a, containerName, vdirName)\n\traw := getDefaultCopyRawInput(srcDirPath, rawContainerURLWithSAS.String())\n\traw.recursive = true\n\n\trunCopyAndVerify(a, raw, func(err error) {\n\t\ta.Nil(err)\n\n\t\t// validate that the right number of transfers were scheduled\n\t\ta.Equal(len(fileList), len(mockedRPC.transfers))\n\n\t\t// validate that the right transfers were sent\n\t\texpectedTransfers := scenarioHelper{}.shaveOffPrefix(fileList, filepath.Base(srcDirPath)+common.AZCOPY_PATH_SEPARATOR_STRING)\n\t\tvalidateUploadTransfersAreScheduled(a, common.AZCOPY_PATH_SEPARATOR_STRING,\n\t\t\tcommon.AZCOPY_PATH_SEPARATOR_STRING+filepath.Base(srcDirPath)+common.AZCOPY_PATH_SEPARATOR_STRING, expectedTransfers, mockedRPC)\n\t})\n\n\t// turn off recursive, this time nothing should be transferred\n\traw.recursive = false\n\tmockedRPC.reset()\n\n\trunCopyAndVerify(a, raw, func(err error) {\n\t\ta.NotNil(err)\n\t\ta.Zero(len(mockedRPC.transfers))\n\t})\n}", "title": "" }, { "docid": "c7f7ef8e84739d6b1c2946eddf7a6611", "score": "0.44923383", "text": "func (f *fileUtilMock) MakeDirs(destinationDir string) error {\n\targs := f.Called(destinationDir)\n\treturn args.Error(0)\n}", "title": "" }, { "docid": "b2f70c108317183783c0f2fc97ca4205", "score": "0.44902328", "text": "func TestApiUpdateOtherFileInDirectory(t *testing.T) {\n\tserver = createTestServerWithContext(false)\n\n\trepoPath := \"../tests/tmp/repositories/update_file\"\n\tlr, _ := setupSmallTestRepo(repoPath)\n\n\ttarget := fmt.Sprintf(\"%s/%s\", server.URL, \"api/directories/documents/documents/document_3/files/index.md\")\n\n\tncf := NewCommitFile{\n\t\tPath: \"documents\",\n\t\tDocument: \"document_2\",\n\t\tFilename: \"index.md\", // note, target contains document_2.md\n\t\tBody: \"# The quick brown fox\",\n\t\tFrontMatter: FrontMatter{\n\t\t\tTitle: \"Document Three\",\n\t\t\tAuthor: \"Timothy Lovejoy\",\n\t\t},\n\t}\n\n\tnc := &NewCommit{\n\t\tMessage: \"Forty whacks with a wet noodle\",\n\t\tFiles: []NewCommitFile{ncf},\n\t\tRepositoryInfo: RepositoryInfo{LatestRevision: lr.String()},\n\t}\n\n\tpayload, err := json.Marshal(nc)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\n\tbuff := bytes.NewBuffer(payload)\n\n\tclient := &http.Client{}\n\n\treq, _ := http.NewRequest(\"PATCH\", target, buff)\n\n\tresp, err := client.Do(req)\n\n\tvar receiver FailureResponse\n\n\tjson.NewDecoder(resp.Body).Decode(&receiver)\n\n\tassert.Equal(t, \"No supplied file matches path\", receiver.Message)\n\tassert.Equal(t, http.StatusBadRequest, resp.StatusCode)\n\n}", "title": "" }, { "docid": "5ffa4ab8d68519f9ae754adad3ee2b5d", "score": "0.4476514", "text": "func (_m *ServerConnexion) MakeDir(sSource string) error {\n\tret := _m.Called(sSource)\n\n\tvar r0 error\n\tif rf, ok := ret.Get(0).(func(string) error); ok {\n\t\tr0 = rf(sSource)\n\t} else {\n\t\tr0 = ret.Error(0)\n\t}\n\n\treturn r0\n}", "title": "" }, { "docid": "71f5982cbce6356b6f46ff04c4ceb006", "score": "0.44759452", "text": "func (m *MockCdkClient) DeployApp(appDir string, context []string) (cdk.ProgressStream, error) {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"DeployApp\", appDir, context)\n\tret0, _ := ret[0].(cdk.ProgressStream)\n\tret1, _ := ret[1].(error)\n\treturn ret0, ret1\n}", "title": "" }, { "docid": "2faad15c73a6eff2270c8446685f5d61", "score": "0.4453323", "text": "func (_m *mockImportSteps) MergeFolders(dest string, srcs ...string) error {\n\t_va := make([]interface{}, len(srcs))\n\tfor _i := range srcs {\n\t\t_va[_i] = srcs[_i]\n\t}\n\tvar _ca []interface{}\n\t_ca = append(_ca, dest)\n\t_ca = append(_ca, _va...)\n\tret := _m.Called(_ca...)\n\n\tvar r0 error\n\tif rf, ok := ret.Get(0).(func(string, ...string) error); ok {\n\t\tr0 = rf(dest, srcs...)\n\t} else {\n\t\tr0 = ret.Error(0)\n\t}\n\n\treturn r0\n}", "title": "" }, { "docid": "cd63ac5deee7e446a09508f815b061ee", "score": "0.4444838", "text": "func TestPrepareDirectory(t *testing.T) {\n\n\tvar err error\n\n\t// Move temporary directory.\n\tcd, temp, err := _moveToTempDir(\"\", \"test-prepare-directory\")\n\tif err != nil {\n\t\tt.Error(err.Error())\n\t\treturn\n\t}\n\tdefer os.Chdir(cd)\n\tdefer os.RemoveAll(temp)\n\n\tt.Log(\"Test with an existing directory.\")\n\ttarget, err := ioutil.TempDir(\"\", \"fgo-test\")\n\tif err != nil {\n\t\tt.Error(err.Error())\n\t\treturn\n\t}\n\tdefer os.RemoveAll(target)\n\n\tif err = prepareDirectory(target); err != nil {\n\t\tt.Error(err.Error())\n\t}\n\n\tt.Log(\"Test with an existing file.\")\n\tfp, err := ioutil.TempFile(\"\", \"fgo-test2\")\n\tif err != nil {\n\t\tt.Error(err.Error())\n\t\treturn\n\t}\n\tfp.Close()\n\n\tif prepareDirectory(fp.Name()) == nil {\n\t\tt.Error(\"No error occurs when preparing directory with an existing file.\")\n\t}\n\n\tif err = os.Remove(fp.Name()); err != nil {\n\t\tt.Error(err.Error())\n\t\treturn\n\t}\n\n\tt.Log(\"Test without any collisions.\")\n\tif err = prepareDirectory(fp.Name()); err != nil {\n\t\tt.Error(err.Error())\n\t}\n\n}", "title": "" }, { "docid": "6f48faf2052202d293a36f577f55c567", "score": "0.44398567", "text": "func testDir(name string) string {\n\tdir := build.TempDir(name, filepath.Join(\"filesystem\"))\n\tif err := os.MkdirAll(dir, persist.DefaultDiskPermissionsTest); err != nil {\n\t\tpanic(err)\n\t}\n\treturn dir\n}", "title": "" }, { "docid": "ec5a6ae4e5f7dfad5862d6e000694ee3", "score": "0.44259593", "text": "func InitAppFilesDir(appFilesDir_ string) error {\n\t// already done ?\n\tif initDone {\n\t\treturn nil\n\t}\n\tinitDone = true\n\n\t//## debug\n\tdir, _ := os.Getwd()\n\tlog.Printf(\"cwd: %v\\n\", dir)\n\n\tappFilesDir = appFilesDir_\n\n\t// setup config file path\n\tconfigFilepath = filepath.Join(appFilesDir, configFilename)\n\tlog.Print(\"config file:\", configFilepath)\n\n\t// create initial (copy from assets) config.json in appFilesDir if does not exists\n\t// does config file exist in app files dir?\n\tif _, err := os.Stat(configFilepath); err != nil {\n\t\treturn copyConfigFile()\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "f79a934c03ba03165ed15b503003e736", "score": "0.43978179", "text": "func Test_App_Mount_Express_Behavior(t *testing.T) {\n\tt.Parallel()\n\tcreateTestHandler := func(body string) func(c *Ctx) error {\n\t\treturn func(c *Ctx) error {\n\t\t\treturn c.SendString(body)\n\t\t}\n\t}\n\ttestEndpoint := func(app *App, route, expectedBody string, expectedStatusCode int) {\n\t\tresp, err := app.Test(httptest.NewRequest(MethodGet, route, http.NoBody))\n\t\tutils.AssertEqual(t, nil, err, \"app.Test(req)\")\n\t\tbody, err := io.ReadAll(resp.Body)\n\t\tutils.AssertEqual(t, nil, err)\n\t\tutils.AssertEqual(t, expectedStatusCode, resp.StatusCode, \"Status code\")\n\t\tutils.AssertEqual(t, expectedBody, string(body), \"Unexpected response body\")\n\t}\n\n\tapp := New()\n\tsubApp := New()\n\t// app setup\n\t{\n\t\tsubApp.Get(\"/hello\", createTestHandler(\"subapp hello!\"))\n\t\tsubApp.Get(\"/world\", createTestHandler(\"subapp world!\")) // <- wins\n\n\t\tapp.Get(\"/hello\", createTestHandler(\"app hello!\")) // <- wins\n\t\tapp.Mount(\"/\", subApp) // <- subApp registration\n\t\tapp.Get(\"/world\", createTestHandler(\"app world!\"))\n\n\t\tapp.Get(\"/bar\", createTestHandler(\"app bar!\"))\n\t\tsubApp.Get(\"/bar\", createTestHandler(\"subapp bar!\")) // <- wins\n\n\t\tsubApp.Get(\"/foo\", createTestHandler(\"subapp foo!\")) // <- wins\n\t\tapp.Get(\"/foo\", createTestHandler(\"app foo!\"))\n\n\t\t// 404 Handler\n\t\tapp.Use(func(c *Ctx) error {\n\t\t\treturn c.SendStatus(StatusNotFound)\n\t\t})\n\t}\n\t// expectation check\n\ttestEndpoint(app, \"/world\", \"subapp world!\", StatusOK)\n\ttestEndpoint(app, \"/hello\", \"app hello!\", StatusOK)\n\ttestEndpoint(app, \"/bar\", \"subapp bar!\", StatusOK)\n\ttestEndpoint(app, \"/foo\", \"subapp foo!\", StatusOK)\n\ttestEndpoint(app, \"/unknown\", ErrNotFound.Message, StatusNotFound)\n\n\tutils.AssertEqual(t, uint32(17), app.handlersCount)\n\tutils.AssertEqual(t, uint32(16+9), app.routesCount)\n}", "title": "" }, { "docid": "1ac8c3ae1d155145315c21750312d78a", "score": "0.4381297", "text": "func dirImageMock(t *testing.T, dir, dockerReference string) private.UnparsedImage {\n\tref, err := reference.ParseNormalizedNamed(dockerReference)\n\trequire.NoError(t, err)\n\treturn dirImageMockWithRef(t, dir, refImageReferenceMock{ref: ref})\n}", "title": "" }, { "docid": "ad7bb9a8e2e72c363177054393ad71f4", "score": "0.4375252", "text": "func (m *MockMounter) MakeDir(arg0 string) error {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"MakeDir\", arg0)\n\tret0, _ := ret[0].(error)\n\treturn ret0\n}", "title": "" }, { "docid": "7677aaf941d0ea35e7ea492475bf4835", "score": "0.43575737", "text": "func TestFolders(t *testing.T) {\n api := New(*login, *password, *port, *verbose)\n\n Log(\"Testing AddFolder\")\n\n addFolderResponse, err := api.AddFolder(TmpDir)\n\n if err != nil {\n t.Errorf(\"Error making request to add new folder: %s\", err)\n return\n }\n\n if addFolderResponse.Error != 0 {\n t.Errorf(\"Error adding new folder\")\n return\n }\n\n Log(\"Testing GetFolders\")\n\n getFoldersResponse, err := api.GetFolders()\n\n if err != nil {\n t.Errorf(\"Error making request to get all folders: %s\", err)\n return\n }\n\n if len(*getFoldersResponse) == 0 {\n t.Errorf(\"Expected at least 1 folder\")\n return\n }\n\n found := false\n var testDir Folder\n for _, v := range *getFoldersResponse {\n if v.Dir == TmpDir {\n found = true\n testDir = v\n }\n }\n\n if !found {\n t.Errorf(\"Expected to find %s\", TmpDir)\n return\n }\n\n Log(\"Testing GetFolder\")\n\n getFolderResponse, err := api.GetFolder(testDir.Secret)\n if err != nil {\n t.Errorf(\"Error making request to get a single folder: %s\", err)\n return\n }\n\n if len(*getFolderResponse) != 1 {\n t.Errorf(\"Expected a single folder in response\")\n return\n }\n\n if (*getFolderResponse)[0].Dir != TmpDir {\n t.Errorf(\"Expected %s to be %s\", (*getFolderResponse)[0].Dir, TmpDir)\n return\n }\n\n Debug(\"Sleeping for 15 seconds to allow BTSync to pick up new file.\")\n\n time.Sleep(15000 * time.Millisecond)\n\n Log(\"Testing GetFiles\")\n\n getFilesResponse, err := api.GetFiles(testDir.Secret)\n if err != nil {\n t.Errorf(\"Error making request to get files: %s\", err)\n return\n }\n\n if len(*getFilesResponse) != 1 {\n t.Errorf(\"Expected 1 file\")\n return\n }\n\n if (*getFilesResponse)[0].Name != path.Base(TmpFile.Name()) {\n t.Errorf(\"Expected %s to be %s\", (*getFilesResponse)[0].Name, path.Base(TmpFile.Name()))\n return\n }\n\n Log(\"Testing SetFilePrefs\")\n\n setFilePrefsResponse, err := api.SetFilePrefs(testDir.Secret, path.Base(TmpFile.Name()), 1)\n if err != nil {\n t.Errorf(\"Error making request to set file preferences: %s\", err)\n return\n }\n\n if len(*setFilePrefsResponse) != 1 {\n t.Errorf(\"Expected response to have a length of 1\")\n }\n\n if (*setFilePrefsResponse)[0].State != \"created\" {\n t.Errorf(\"Expected file object in response\")\n return\n }\n\n Log(\"Testing GetFolderPeers\")\n _, err = api.GetFolderPeers(testDir.Secret)\n if err != nil {\n t.Errorf(\"Error making request to get folder peers: %s\", err)\n return\n }\n\n Log(\"Testing GetSecrets\")\n\n getSecretsResponse, err := api.GetSecrets(true)\n if err != nil {\n t.Errorf(\"Error requesting secrets\")\n return\n }\n\n if getSecretsResponse.Encryption == \"\" {\n t.Errorf(\"Expected response to have an encrypted key\")\n return\n }\n\n getSecretsResponse, err = api.GetSecretsForSecret(getSecretsResponse.ReadOnly)\n if err != nil {\n t.Errorf(\"Error requesting secrets for secret: %s\", getSecretsResponse.ReadOnly)\n return\n }\n\n if getSecretsResponse.ReadOnly == \"\" {\n t.Errorf(\"Expected response to have a read only key\")\n return\n }\n\n Log(\"Testing GetFolderPrefs\")\n\n getFolderPrefsResponse, err := api.GetFolderPrefs(testDir.Secret)\n if err != nil {\n t.Errorf(\"Error requesting prefs for folder\")\n return\n }\n\n if getFolderPrefsResponse.SearchLAN != 1 {\n t.Errorf(\"Exepected search_lan to be 1\")\n return\n }\n\n Log(\"Testing SetFolderPrefs\")\n\n prefs := &FolderPreferences{\n SearchLAN: 1,\n SelectiveSync: 1,\n UseDHT: 1,\n UseHosts: 1,\n UseRelayServer: 1,\n UseSyncTrash: 1,\n UseTracker: 1,\n }\n\n _, err = api.SetFolderPrefs(testDir.Secret, prefs)\n if err != nil {\n t.Errorf(\"Error making request to set folder preferences\")\n return\n }\n\n}", "title": "" }, { "docid": "6a9f98f819aefe0d14708a3daf6bf46d", "score": "0.433686", "text": "func TestAppOfApps(t *testing.T) {\n\tt.SkipNow()\n\tGiven(t).\n\t\tPath(\"app-of-apps\").\n\t\tWhen().\n\t\tCreate().\n\t\tSync().\n\t\tThen().\n\t\tExpect(OperationPhaseIs(OperationSucceeded)).\n\t\tExpect(SyncStatusIs(SyncStatusCodeSynced)).\n\t\t// we are missing the child apps, as we do not auto-sync them\n\t\tExpect(HealthIs(HealthStatusMissing)).\n\t\tWhen().\n\t\tPatchFile(\"templates/guestbook.yaml\", `[\n\t{\"op\": \"add\", \"path\": \"/spec/syncPolicy\", \"value\": {\"automated\": {\"prune\": true}}}\n]`).\n\t\tSync().\n\t\tThen().\n\t\tExpect(OperationPhaseIs(OperationSucceeded)).\n\t\tExpect(SyncStatusIs(SyncStatusCodeSynced)).\n\t\t// now we are in sync\n\t\tExpect(HealthIs(HealthStatusMissing))\n}", "title": "" }, { "docid": "5d558d416f74eba46ce80c22d2f3b045", "score": "0.43302205", "text": "func inDir(t *testing.T, dir string, f func()) {\n\toldDir, err := os.Getwd()\n\trequire.NoError(t, err)\n\terr = os.Chdir(dir)\n\trequire.NoError(t, err)\n\tf()\n\terr = os.Chdir(oldDir)\n\trequire.NoError(t, err)\n}", "title": "" }, { "docid": "79b5527a35cb71dbb553dacba07ec5f1", "score": "0.43224156", "text": "func TestApiUpdateNoFilesInDirectory(t *testing.T) {\n\tserver = createTestServerWithContext(false)\n\n\trepoPath := \"../tests/tmp/repositories/update_file\"\n\tlr, _ := setupSmallTestRepo(repoPath)\n\n\ttarget := fmt.Sprintf(\"%s/%s\", server.URL, \"api/directories/documents/documents/document_3/files/index.md\")\n\n\tnc := &NewCommit{\n\t\tMessage: \"Forty whacks with a wet noodle\",\n\t\tFiles: []NewCommitFile{},\n\t\tRepositoryInfo: RepositoryInfo{LatestRevision: lr.String()},\n\t}\n\n\tpayload, err := json.Marshal(nc)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\n\tbuff := bytes.NewBuffer(payload)\n\n\tclient := &http.Client{}\n\n\treq, _ := http.NewRequest(\"PATCH\", target, buff)\n\n\tresp, err := client.Do(req)\n\n\tvar receiver FailureResponse\n\n\tjson.NewDecoder(resp.Body).Decode(&receiver)\n\n\tassert.Equal(t, \"No files specified for update\", receiver.Message)\n\tassert.Equal(t, http.StatusBadRequest, resp.StatusCode)\n\n}", "title": "" }, { "docid": "5696cff2af99fc5e293870373d807c91", "score": "0.43182752", "text": "func (_m *ApplicationServiceInterface) Update(_a0 *models.Application) error {\n\tret := _m.Called(_a0)\n\n\tvar r0 error\n\tif rf, ok := ret.Get(0).(func(*models.Application) error); ok {\n\t\tr0 = rf(_a0)\n\t} else {\n\t\tr0 = ret.Error(0)\n\t}\n\n\treturn r0\n}", "title": "" }, { "docid": "7c8fa48af7e71a236705ab16bd104027", "score": "0.4312583", "text": "func Test_App_Mount_Nested(t *testing.T) {\n\tt.Parallel()\n\tapp := New()\n\tone := New()\n\ttwo := New()\n\tthree := New()\n\n\ttwo.Mount(\"/three\", three)\n\tapp.Mount(\"/one\", one)\n\tone.Mount(\"/two\", two)\n\n\tone.Get(\"/doe\", func(c *Ctx) error {\n\t\treturn c.SendStatus(StatusOK)\n\t})\n\n\ttwo.Get(\"/nested\", func(c *Ctx) error {\n\t\treturn c.SendStatus(StatusOK)\n\t})\n\n\tthree.Get(\"/test\", func(c *Ctx) error {\n\t\treturn c.SendStatus(StatusOK)\n\t})\n\n\tresp, err := app.Test(httptest.NewRequest(MethodGet, \"/one/doe\", http.NoBody))\n\tutils.AssertEqual(t, nil, err, \"app.Test(req)\")\n\tutils.AssertEqual(t, 200, resp.StatusCode, \"Status code\")\n\n\tresp, err = app.Test(httptest.NewRequest(MethodGet, \"/one/two/nested\", http.NoBody))\n\tutils.AssertEqual(t, nil, err, \"app.Test(req)\")\n\tutils.AssertEqual(t, 200, resp.StatusCode, \"Status code\")\n\n\tresp, err = app.Test(httptest.NewRequest(MethodGet, \"/one/two/three/test\", http.NoBody))\n\tutils.AssertEqual(t, nil, err, \"app.Test(req)\")\n\tutils.AssertEqual(t, 200, resp.StatusCode, \"Status code\")\n\n\tutils.AssertEqual(t, uint32(6), app.handlersCount)\n\tutils.AssertEqual(t, uint32(6), app.routesCount)\n}", "title": "" }, { "docid": "1c9a4d545f6f9be80402deb53a86278a", "score": "0.42997694", "text": "func (m *MockMounter) MakeDir(pathname string) error {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"MakeDir\", pathname)\n\tret0, _ := ret[0].(error)\n\treturn ret0\n}", "title": "" }, { "docid": "68f7da394e92877875e31139b4202154", "score": "0.4298089", "text": "func (_m *Knapsack) RootDirectory() 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}", "title": "" }, { "docid": "78b86665147cf0add8bcec8e97515781", "score": "0.42979446", "text": "func TestDirRenameEmptyDir(t *testing.T) {\n\trun.skipIfNoFUSE(t)\n\n\trun.mkdir(t, \"dir\")\n\trun.mkdir(t, \"dir1\")\n\trun.checkDir(t, \"dir/|dir1/\")\n\n\terr := run.os.Rename(run.path(\"dir1\"), run.path(\"dir/dir2\"))\n\trequire.NoError(t, err)\n\trun.checkDir(t, \"dir/|dir/dir2/\")\n\n\terr = run.os.Rename(run.path(\"dir/dir2\"), run.path(\"dir/dir3\"))\n\trequire.NoError(t, err)\n\trun.checkDir(t, \"dir/|dir/dir3/\")\n\n\trun.rmdir(t, \"dir/dir3\")\n\trun.rmdir(t, \"dir\")\n\trun.checkDir(t, \"\")\n}", "title": "" }, { "docid": "e60af4bb3c7e61e3b5cb3ded25b63d9b", "score": "0.42844316", "text": "func writeFileToTestDir(fname, content string) {\n testDirPath := \".\" + string(filepath.Separator) + TEST_DIR\n testFilePath := testDirPath + string(filepath.Separator) + fname\n\n _ = os.MkdirAll(testDirPath, 0755)\n _ = ioutil.WriteFile(testFilePath, []byte(content), os.ModePerm)\n}", "title": "" }, { "docid": "b0704afa4351cf92eabc2c28d3fcc547", "score": "0.42841822", "text": "func TestBuildTree(t *testing.T) {\n // Mock the filepath.Walk function\n oldWalk := Walk\n oldAbs := Abs\n defer func() { Walk = oldWalk; Abs = oldAbs }()\n Abs = func (path string) (string, error) {\n return \"/fake/root/\" + path, nil\n }\n Walk = func (root string, walkFn filepath.WalkFunc) error {\n walkFn(\n \"/fake/root/example_dir\",\n fileInfoMock{name: \"example_dir\", size: 4096, isDir: true},\n nil,\n )\n walkFn(\n \"/fake/root/example_dir/subdir\",\n fileInfoMock{name: \"subdir\", size: 4096, isDir: true},\n nil,\n )\n walkFn(\n \"/fake/root/example_dir/subdir/file.txt\",\n fileInfoMock{name: \"file.txt\", size: 308, isDir: false},\n nil,\n )\n return nil\n }\n tree, err := buildTree(\"example_dir\")\n if err != nil {\n t.Fatal(\"Expected nil and and got\", err)\n }\n if tree == nil {\n t.Fatal(\"Expected a tree and got nil\")\n }\n if tree.name != \"example_dir\" {\n t.Fatal(fmt.Sprintf(\"Expected 'example_dir' and got %v\", tree.name))\n }\n if len(tree.children) != 1 {\n t.Fatal(fmt.Sprintf(\"Expected 1 child and got %v\", len(tree.children)))\n }\n if len(tree.children[\"subdir\"].children) != 1 {\n t.Fatal(fmt.Sprintf(\"Expected 1 child and got %v\", len(tree.children[\"subdir\"].children)))\n }\n if tree.children[\"subdir\"].children[\"file.txt\"].name != \"file.txt\" {\n t.Fatal(fmt.Sprintf(\"Expected 'file.txt' and got %v\", tree.children[\"subdir\"].children[\"file.txt\"].name))\n }\n if tree.cummulativeSize != 8500 {\n t.Fatal(fmt.Sprintf(\"Expected 8500 and got %v\", tree.cummulativeSize))\n }\n}", "title": "" }, { "docid": "a52547b0c381363a4509a05efa18e4fe", "score": "0.42804834", "text": "func TestDirectoryModTime(t *testing.T) {\n\tif testing.Short() {\n\t\tt.SkipNow()\n\t}\n\tt.Parallel()\n\n\t// Create a test directory with sub folders\n\t//\n\t// root/ file\n\t// root/SubDir1/\n\t// root/SubDir1/SubDir2/ file\n\n\t// Create test renter\n\trt, err := newRenterTesterWithDependency(t.Name(), &dependencies.DependencyDisableRepairAndHealthLoops{})\n\tif err != nil {\n\t\tt.Fatal(err)\n\t}\n\tdefer rt.Close()\n\n\t// Create directory tree\n\tsubDir1, err := modules.NewSiaPath(\"SubDir1\")\n\tif err != nil {\n\t\tt.Fatal(err)\n\t}\n\tsubDir2, err := modules.NewSiaPath(\"SubDir2\")\n\tif err != nil {\n\t\tt.Fatal(err)\n\t}\n\tif err := rt.renter.CreateDir(subDir1); err != nil {\n\t\tt.Fatal(err)\n\t}\n\tsubDir1_2, err := subDir1.Join(subDir2.String())\n\tif err != nil {\n\t\tt.Fatal(err)\n\t}\n\tif err := rt.renter.CreateDir(subDir1_2); err != nil {\n\t\tt.Fatal(err)\n\t}\n\t// Add files\n\trsc, _ := siafile.NewRSCode(1, 1)\n\tup := modules.FileUploadParams{\n\t\tSource: \"\",\n\t\tSiaPath: modules.RandomSiaPath(),\n\t\tErasureCode: rsc,\n\t}\n\tfileSize := uint64(100)\n\t_, err = rt.renter.staticFileSet.NewSiaFile(up, crypto.GenerateSiaKey(crypto.RandomCipherType()), fileSize, 0777)\n\tif err != nil {\n\t\tt.Fatal(err)\n\t}\n\tup.SiaPath, err = subDir1_2.Join(hex.EncodeToString(fastrand.Bytes(8)))\n\tif err != nil {\n\t\tt.Fatal(err)\n\t}\n\tf, err := rt.renter.staticFileSet.NewSiaFile(up, crypto.GenerateSiaKey(crypto.RandomCipherType()), fileSize, 0777)\n\tif err != nil {\n\t\tt.Fatal(err)\n\t}\n\n\t// Call bubble on lowest lever and confirm top level reports accurate last\n\t// update time\n\trt.renter.managedBubbleMetadata(subDir1_2)\n\tbuild.Retry(100, 100*time.Millisecond, func() error {\n\t\tdirInfo, err := rt.renter.staticDirSet.DirInfo(modules.RootSiaPath())\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tif dirInfo.MostRecentModTime != f.ModTime() {\n\t\t\treturn fmt.Errorf(\"ModTime is incorrect, got %v expected %v\", dirInfo.MostRecentModTime, f.ModTime())\n\t\t}\n\t\treturn nil\n\t})\n\tif err != nil {\n\t\tt.Fatal(err)\n\t}\n}", "title": "" }, { "docid": "09a6fd521b3483b00e74fc4817033648", "score": "0.42796892", "text": "func TestConfigDir(t *testing.T) {\n\tis := is.New(t)\n\n\tJunkEnv()\n\tdir, fixture, err := FixtureDir()\n\tif err != nil {\n\t\tt.Fatal(err)\n\t}\n\n\tconfig, err := New(dir)\n\tif err != nil {\n\t\tt.Fatal(err.Error())\n\t}\n\n\tis.Equal(fixture[\"endpoint\"], config.GetIgnoreErr(\"endpoint\"))\n\tis.Equal(fixture[\"auth-endpoint\"], config.GetIgnoreErr(\"auth-endpoint\"))\n\tis.Equal(fixture[\"user\"], config.GetIgnoreErr(\"user\"))\n\tis.Equal(fixture[\"account\"], config.GetIgnoreErr(\"account\"))\n\tis.Equal(fixture[\"debug-level\"], config.GetIgnoreErr(\"debug-level\"))\n\n\t_ = os.RemoveAll(dir)\n}", "title": "" }, { "docid": "e0fdb526d05f16850f8f47be7d4238c6", "score": "0.42548275", "text": "func (c *Client) SetupDirectory() {\n\tv := reflect.ValueOf(c.dir)\n\tif v.Kind() == reflect.Ptr {\n\t\tv = v.Elem()\n\t}\n\tif v.Kind() != reflect.Struct {\n\t\tlog.Fatal(\"only accepts structs\")\n\t}\n\tfor i := 0; i < v.NumField(); i++ {\n\t\tkey := v.Field(i).String()\n\t\tc.client.Set(context.Background(), key, \"\", &client.SetOptions{\n\t\t\tDir: true,\n\t\t\tPrevExist: client.PrevNoExist,\n\t\t})\n\t}\n}", "title": "" }, { "docid": "e9c1e518bffea73e28e783d0ebc210a3", "score": "0.42542803", "text": "func (m *MockMachine) Directory() string {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"Directory\")\n\tret0, _ := ret[0].(string)\n\treturn ret0\n}", "title": "" }, { "docid": "af21dbdef7f808c3529324b3d79d89dc", "score": "0.42380083", "text": "func TestDirCacheFlushOnDirRename(t *testing.T) {\n\trun.skipIfNoFUSE(t)\n\trun.mkdir(t, \"dir\")\n\trun.createFile(t, \"dir/file\", \"1\")\n\n\tdm := newDirMap(\"dir/|dir/file 1\")\n\tlocalDm := make(dirMap)\n\trun.readLocal(t, localDm, \"\")\n\tassert.Equal(t, dm, localDm, \"expected vs fuse mount\")\n\n\t// expect remotely created directory to not show up\n\terr := run.fremote.Mkdir(context.Background(), \"dir/subdir\")\n\trequire.NoError(t, err)\n\trun.readLocal(t, localDm, \"\")\n\tassert.Equal(t, dm, localDm, \"expected vs fuse mount\")\n\n\terr = run.os.Rename(run.path(\"dir\"), run.path(\"rid\"))\n\trequire.NoError(t, err)\n\n\tdm = newDirMap(\"rid/|rid/subdir/|rid/file 1\")\n\tlocalDm = make(dirMap)\n\trun.readLocal(t, localDm, \"\")\n\tassert.Equal(t, dm, localDm, \"expected vs fuse mount\")\n\n\trun.rm(t, \"rid/file\")\n\trun.rmdir(t, \"rid/subdir\")\n\trun.rmdir(t, \"rid\")\n\trun.checkDir(t, \"\")\n}", "title": "" }, { "docid": "de331613d74d71223b74b5a7b5ad55a4", "score": "0.42246002", "text": "func TestDirStar2(t *testing.T) {\n\t// Init test files\n\tcurDir, _ := os.Getwd()\n\ttmpDir := filepath.Join(curDir, \"./tmp\")\n\tdefer os.RemoveAll(tmpDir)\n\tmakeTmpFiles(tmpDir, []string{\n\t\t\".git\",\n\t\t\"app.js\",\n\t\t\"package.json\",\n\t\t\"src/router.js\",\n\t\t\"src/store.js\",\n\t\t\"src/store.ts\",\n\t\t\"src/api/home.js\",\n\t\t\"src/api/user.js\",\n\t\t\"src/api/test.js\",\n\t})\n\n\tpatterns := []string{\n\t\t\"src/**/*.js\",\n\t}\n\n\t// Match the patterns\n\tfiles := Match(patterns, Option{BaseDir: tmpDir})\n\t// Expected match files:\n\texpected := []string{\n\t\t\"src/router.js\",\n\t\t\"src/store.js\",\n\t\t\"src/api/home.js\",\n\t\t\"src/api/user.js\",\n\t\t\"src/api/test.js\",\n\t}\n\tif checkFiles(tmpDir, files, expected) {\n\t\tt.Errorf(\"files not match, expected %v, but got %v\", expected, files)\n\t}\n}", "title": "" }, { "docid": "0f7205e3a4e01288a4b68f9e354c0d90", "score": "0.42162427", "text": "func (_m *Visitor) VisitDir(baseURL string, files []os.FileInfo) error {\n\tret := _m.Called(baseURL, files)\n\n\tvar r0 error\n\tif rf, ok := ret.Get(0).(func(string, []os.FileInfo) error); ok {\n\t\tr0 = rf(baseURL, files)\n\t} else {\n\t\tr0 = ret.Error(0)\n\t}\n\n\treturn r0\n}", "title": "" }, { "docid": "c1a3b081b2f76c0355f4577ce8eb438e", "score": "0.42148638", "text": "func (_m *RunInterface) GetCacheToDirectory(dir string) error {\n\tret := _m.Called(dir)\n\n\tvar r0 error\n\tif rf, ok := ret.Get(0).(func(string) error); ok {\n\t\tr0 = rf(dir)\n\t} else {\n\t\tr0 = ret.Error(0)\n\t}\n\n\treturn r0\n}", "title": "" }, { "docid": "e248e69da878f8b456ad35ee007480d4", "score": "0.42076772", "text": "func (f *Fs) Mkdir(ctx context.Context, dir string) error {\n\tif f.opt.SharedFiles || f.opt.SharedFolders {\n\t\treturn errNotSupportedInSharedMode\n\t}\n\troot := path.Join(f.slashRoot, dir)\n\n\t// can't create or run metadata on root\n\tif root == \"/\" {\n\t\treturn nil\n\t}\n\n\t// check directory doesn't exist\n\t_, err := f.getDirMetadata(ctx, root)\n\tif err == nil {\n\t\treturn nil // directory exists already\n\t} else if err != fs.ErrorDirNotFound {\n\t\treturn err // some other error\n\t}\n\n\t// create it\n\targ2 := files.CreateFolderArg{\n\t\tPath: f.opt.Enc.FromStandardPath(root),\n\t}\n\t// Don't attempt to create filenames that are too long\n\tif cErr := checkPathLength(arg2.Path); cErr != nil {\n\t\treturn cErr\n\t}\n\terr = f.pacer.Call(func() (bool, error) {\n\t\t_, err = f.srv.CreateFolderV2(&arg2)\n\t\treturn shouldRetry(ctx, err)\n\t})\n\treturn err\n}", "title": "" }, { "docid": "8f157858219f654970c1441623b3fbab", "score": "0.42065132", "text": "func (_m *KV) PutMap(prefix string, data map[string]interface{}) error {\n\tret := _m.Called(prefix, data)\n\n\tvar r0 error\n\tif rf, ok := ret.Get(0).(func(string, map[string]interface{}) error); ok {\n\t\tr0 = rf(prefix, data)\n\t} else {\n\t\tr0 = ret.Error(0)\n\t}\n\n\treturn r0\n}", "title": "" }, { "docid": "5256681374155c95ef6387c9123f41f1", "score": "0.4195651", "text": "func (_m *ISession) Application(appID string) (*discordgo.Application, error) {\n\tret := _m.Called(appID)\n\n\tvar r0 *discordgo.Application\n\tvar r1 error\n\tif rf, ok := ret.Get(0).(func(string) (*discordgo.Application, error)); ok {\n\t\treturn rf(appID)\n\t}\n\tif rf, ok := ret.Get(0).(func(string) *discordgo.Application); ok {\n\t\tr0 = rf(appID)\n\t} else {\n\t\tif ret.Get(0) != nil {\n\t\t\tr0 = ret.Get(0).(*discordgo.Application)\n\t\t}\n\t}\n\n\tif rf, ok := ret.Get(1).(func(string) error); ok {\n\t\tr1 = rf(appID)\n\t} else {\n\t\tr1 = ret.Error(1)\n\t}\n\n\treturn r0, r1\n}", "title": "" }, { "docid": "831e66e47930db342e8f3a5e62db820f", "score": "0.41947073", "text": "func (_m *mockDbOperation) StoreMetadata(metadata db.Metadata, dir string) error {\n\tret := _m.Called(metadata, dir)\n\n\tvar r0 error\n\tif rf, ok := ret.Get(0).(func(db.Metadata, string) error); ok {\n\t\tr0 = rf(metadata, dir)\n\t} else {\n\t\tr0 = ret.Error(0)\n\t}\n\n\treturn r0\n}", "title": "" }, { "docid": "1a0952b6df1901fb25cfcf81477a048d", "score": "0.41895992", "text": "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}", "title": "" }, { "docid": "e124cb244a4bd48f8ad8caa1f50aee69", "score": "0.41842422", "text": "func Test_WriteFolderToTarPackage4(t *testing.T) {\n\tsrcPath := filepath.Join(\"testdata\", \"sourcefiles\") + string(filepath.Separator)\n\tfilePath := \"META-INF/statedb/couchdb/indexes/indexOwner.json\"\n\n\ttarBytes := createTestTar(t, srcPath, []string{}, nil, nil)\n\n\t// Read the files from the archive and check for the metadata index file\n\tentries := tarContents(t, tarBytes)\n\tassert.Contains(t, entries, filePath, \"should have found statedb index artifact in META-INF directory\")\n}", "title": "" }, { "docid": "cea6af77e7d41d3a2e9f91b14bb4b9ff", "score": "0.41806218", "text": "func (m *Mocker) Mock(name, method, path string, f MockFunc) {\n\tpath = strings.TrimRight(path, \"/\")\n\n\tif m.handlers[path] == nil {\n\t\tm.handlers[path] = make(map[string][]Handler)\n\t}\n\n\th := Handler{\n\t\tName: name,\n\t\tHandler: http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {\n\t\t\tif f != nil {\n\t\t\t\tf(w, r, m.t)\n\t\t\t} else {\n\t\t\t\tw.WriteHeader(http.StatusNoContent)\n\t\t\t}\n\t\t}),\n\t}\n\n\tm.handlers[path][method] = append(m.handlers[path][method], h)\n}", "title": "" }, { "docid": "a8199196054d6a77bb5f8c0480a63d3e", "score": "0.41729802", "text": "func (_m *Transpiler) GetFiles(dir string) []afero.File {\n\tret := _m.Called(dir)\n\n\tvar r0 []afero.File\n\tif rf, ok := ret.Get(0).(func(string) []afero.File); ok {\n\t\tr0 = rf(dir)\n\t} else {\n\t\tif ret.Get(0) != nil {\n\t\t\tr0 = ret.Get(0).([]afero.File)\n\t\t}\n\t}\n\n\treturn r0\n}", "title": "" }, { "docid": "9285e5582c6d3955fa7e9625797bbd90", "score": "0.4164675", "text": "func TestPutPresentationMergeInvalidfolder(t *testing.T) {\n request := createPutPresentationMergeRequest()\n request.folder = invalidizeTestParamValue(request.folder, \"folder\", \"string\").(string)\n e := initializeTest(\"PutPresentationMerge\", \"folder\", request.folder)\n if e != nil {\n t.Errorf(\"Error: %v.\", e)\n return\n }\n r, _, e := getTestApiClient().MergeDocumentApi.PutPresentationMerge(request)\n assertError(t, \"PutPresentationMerge\", \"folder\", r.Code, e)\n}", "title": "" }, { "docid": "37f495dae8b6a2a25c294b13619833a0", "score": "0.41549966", "text": "func TestMoveEmptyDirectories(t *testing.T) {\n\tctx := context.Background()\n\tr := fstest.NewRun(t)\n\tfile1 := r.WriteFile(\"sub dir/hello world\", \"hello world\", t1)\n\terr := operations.Mkdir(ctx, r.Flocal, \"sub dir2\")\n\trequire.NoError(t, err)\n\tr.Mkdir(ctx, r.Fremote)\n\n\terr = MoveDir(ctx, r.Fremote, r.Flocal, false, true)\n\trequire.NoError(t, err)\n\n\tr.CheckRemoteListing(\n\t\tt,\n\t\t[]fstest.Item{\n\t\t\tfile1,\n\t\t},\n\t\t[]string{\n\t\t\t\"sub dir\",\n\t\t\t\"sub dir2\",\n\t\t},\n\t)\n}", "title": "" }, { "docid": "972800c5b16898e2a414224b781b538e", "score": "0.41542047", "text": "func Test_WriteFolderToTarPackage5(t *testing.T) {\n\tsrcPath := filepath.Join(\"testdata\", \"sourcefiles\")\n\tfilePath := \"META-INF/.hiddenfile\"\n\n\tassert.FileExists(t, filepath.Join(srcPath, \"META-INF\", \".hiddenfile\"))\n\n\ttarBytes := createTestTar(t, srcPath, []string{}, nil, nil)\n\n\t// Read the files from the archive and check for the metadata index file\n\tentries := tarContents(t, tarBytes)\n\tassert.NotContains(t, entries, filePath, \"should not contain .hiddenfile in META-INF directory\")\n}", "title": "" }, { "docid": "041261f7f2e5c3958d3ad2d526579e8a", "score": "0.41489714", "text": "func Test_App_Mount(t *testing.T) {\n\tt.Parallel()\n\tmicro := New()\n\tmicro.Get(\"/doe\", func(c *Ctx) error {\n\t\treturn c.SendStatus(StatusOK)\n\t})\n\n\tapp := New()\n\tapp.Mount(\"/john\", micro)\n\tresp, err := app.Test(httptest.NewRequest(MethodGet, \"/john/doe\", http.NoBody))\n\tutils.AssertEqual(t, nil, err, \"app.Test(req)\")\n\tutils.AssertEqual(t, 200, resp.StatusCode, \"Status code\")\n\tutils.AssertEqual(t, uint32(2), app.handlersCount)\n}", "title": "" }, { "docid": "fe1b123971a004073b7bfe82a0930134", "score": "0.4147821", "text": "func (h testHelper) makeTestDir() (path string) {\n\tpath, err := ioutil.TempDir(\"\", \"TestDir\")\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\t\n\t// Now populate it with interesting files.\n\t// - zero byte file\n\th.writeFile(\"0_byte_file\", path, makeRisingIntsSlice(0))\n\t\n\t// - one byte file, zero value\n\th.writeFile(\"1_byte_file_0_value\", path,\n\t\tmakeConstantSlice(1, 0))\n\n\t// - one byte file, 128 value\n\th.writeFile(\"1_byte_file_128_value\", path,\n\t\tmakeConstantSlice(1, 128))\n\n\t// - ascending ints file, 10 bytes\n\th.writeFile(\"10_byte_file_rising_ints\", path,\n\t\tmakeRisingIntsSlice(10))\n\n\t// - ascending ints file, 100 bytes\n\th.writeFile(\"100_byte_file_rising_ints\", path,\n\t\tmakeRisingIntsSlice(100))\n\n\t// - all zeros, 100 byte file\n\th.writeFile(\"100_byte_file_0_value\", path,\n\t\tmakeConstantSlice(100, 0))\n\t\n\t// - all 255, 100 byte file\n\th.writeFile(\"100_byte_file_255_value\", path,\n\t\tmakeConstantSlice(100, 255))\n\n\t// - Hello World! file\n\th.writeFile(\"hello_world_file_plain\", path,\n\t\tmakeStringSlice(\"Hello World!\"))\n\n\t// - Hello World!\\n file\n\th.writeFile(\"hello_world_file_nl\", path,\n\t\tmakeStringSlice(\"Hello World!\\n\"))\n\n\t// - Hello World!\\r\\n file\n\th.writeFile(\"hello_world_file_crnl\", path,\n\t\tmakeStringSlice(\"Hello World!\\r\\n\"))\n\n\treturn path\n}", "title": "" }, { "docid": "08d4b8d155459ef4a38034aa8a519d52", "score": "0.4129349", "text": "func dirImageMockWithRef(t *testing.T, dir string, ref types.ImageReference) private.UnparsedImage {\n\tsrcRef, err := directory.NewReference(dir)\n\trequire.NoError(t, err)\n\tsrc, err := srcRef.NewImageSource(context.Background(), nil)\n\trequire.NoError(t, err)\n\tt.Cleanup(func() {\n\t\terr := src.Close()\n\t\trequire.NoError(t, err)\n\t})\n\treturn image.UnparsedInstance(&dirImageSourceMock{\n\t\tImageSource: imagesource.FromPublic(src),\n\t\tref: ref,\n\t}, nil)\n}", "title": "" }, { "docid": "79c0f0701bbd5ef0b22980ac81e231f7", "score": "0.412836", "text": "func TestAddApps(t *testing.T) {\n\n\tvar err error\n\n\t// Use the configuration manager to get Algolia's keys to mock the app interactor\n\tconfigInteractor := interfaces.ConfigurationManager{}\n\tconfigInteractor.ConfigurationInteractor = infrastructure.NewViperConfig()\n\n\t// Instanciate the App interactor\n\tappInteractor := usecases.NewAppInteractor(\n\t\tinterfaces.NewAlgoliaRepository(\n\t\t\tconfigInteractor.GetConfigString(\"algolia.applicationID\", \"NOT_SET\"),\n\t\t\tconfigInteractor.GetConfigString(\"algolia.apiKey\", \"NOT_SET\"),\n\t\t\tconfigInteractor.GetConfigString(\"algolia.indexes.apps\", \"NOT_SET\"),\n\t\t),\n\t)\n\n\t// Batch addition\n\t// Create a random app\n\ttestApps := []domain.App{\n\t\tdomain.NewApp(\n\t\t\t\"Unit testing app interactor\",\n\t\t\t\"static.whatthetvshow.com:9000/media/snapshots/c4c3021b168ba93572d402e313f0f884_medium.png\",\n\t\t\t\"http://whatthetvshow.com/fe/snapshots/2205\",\n\t\t\t\"Quiz unit tests Benjamin\",\n\t\t\t223,\n\t\t),\n\t\tdomain.NewApp(\n\t\t\t\"Unit testing app interactor 2\",\n\t\t\t\"static.whatthetvshow.com:9000/media/snapshots/c4c3021b168ba93572d402e313f0f884_medium.png\",\n\t\t\t\"http://whatthetvshow.com/fe/snapshots/2205\",\n\t\t\t\"Quiz unit tests Benjamin\",\n\t\t\t224,\n\t\t),\n\t\tdomain.NewApp(\n\t\t\t\"Unit testing app interactor 3\",\n\t\t\t\"static.whatthetvshow.com:9000/media/snapshots/c4c3021b168ba93572d402e313f0f884_medium.png\",\n\t\t\t\"http://whatthetvshow.com/fe/snapshots/2205\",\n\t\t\t\"Quiz unit tests Benjamin\",\n\t\t\t225,\n\t\t),\n\t\tdomain.NewApp(\n\t\t\t\"Unit testing app interactor 4\",\n\t\t\t\"static.whatthetvshow.com:9000/media/snapshots/c4c3021b168ba93572d402e313f0f884_medium.png\",\n\t\t\t\"http://whatthetvshow.com/fe/snapshots/2205\",\n\t\t\t\"Quiz unit tests Benjamin\",\n\t\t\t226,\n\t\t),\n\t}\n\t// Try to persist it\n\tres, err := appInteractor.CreateBatch(testApps)\n\n\t// Testing returns\n\tif err != nil {\n\t\t// Error raised during the creation\n\t\tt.Error(\"Apps were not properly added : \", err)\n\t\treturn\n\t}\n\tif len(res) == 0 {\n\t\t// None of apps were created properly\n\t\tt.Error(\"Apps were not properly added : no identifiers returned\")\n\t\treturn\n\t}\n\tfor i := range testApps {\n\t\tif len(res) > 0 && res[i] == \"\" {\n\t\t\t// No object created\n\t\t\tt.Error(\"App number \", i, \" '\", testApps[i].Name, \" was not properly added : no identifier returned\")\n\t\t}\n\t}\n\n\t_, _ = appInteractor.DeleteBatch(res)\n\n\tt.Log(\"TestAddApp: Test Clear\")\n\n\tt.Log(\"TestAddApps: Test Clear\")\n\treturn\n}", "title": "" }, { "docid": "6bac6186df83030c9fcf3b18e89149c8", "score": "0.41274396", "text": "func (c *Client) FixFileWriteFlagsInDir(dir string, lockablePatterns, unlockablePatterns []string) error {\n\n\t// early-out if no patterns\n\tif len(lockablePatterns) == 0 && len(unlockablePatterns) == 0 {\n\t\treturn nil\n\t}\n\n\tabsPath := dir\n\tif !filepath.IsAbs(dir) {\n\t\tabsPath = filepath.Join(c.LocalWorkingDir, dir)\n\t}\n\tstat, err := os.Stat(absPath)\n\tif err != nil {\n\t\treturn err\n\t}\n\tif !stat.IsDir() {\n\t\treturn fmt.Errorf(\"%q is not a valid directory\", dir)\n\t}\n\n\tvar lockableFilter *filepathfilter.Filter\n\tvar unlockableFilter *filepathfilter.Filter\n\tif lockablePatterns != nil {\n\t\tlockableFilter = filepathfilter.New(lockablePatterns, nil, filepathfilter.GitAttributes)\n\t}\n\tif unlockablePatterns != nil {\n\t\tunlockableFilter = filepathfilter.New(unlockablePatterns, nil, filepathfilter.GitAttributes)\n\t}\n\n\treturn c.fixFileWriteFlags(absPath, c.LocalWorkingDir, lockableFilter, unlockableFilter)\n}", "title": "" }, { "docid": "ee4d3ff5cba4afbc3daefa9be4889e93", "score": "0.41255054", "text": "func getBenchmarkMockApp() (testInput, error) {\n\tmapp := mock.NewApp()\n\ttypes.RegisterCodec(mapp.Cdc)\n\n\ttoken.RegisterCodec(mapp.Cdc)\n\tkeyToken := sdk.NewKVStoreKey(token.StoreKey)\n\ttokenKeeper := token.NewKeeper(mapp.Cdc, keyToken, nil, nil, mapp.ParamsKeeper.Subspace(token.DefaultParamspace))\n\n\tblacklistedAddrs := make(map[string]bool)\n\tblacklistedAddrs[moduleAccAddr.String()] = true\n\n\tbankKeeper := keeper.NewBaseKeeper(\n\t\tmapp.AccountKeeper, &tokenKeeper,\n\t\tmapp.ParamsKeeper.Subspace(types.DefaultParamspace),\n\t\ttypes.DefaultCodespace,\n\t\tblacklistedAddrs,\n\t)\n\n\t//\t(&bankKeeper).SetTokenKeeper(&tokenKeeper)\n\tmapp.Router().AddRoute(types.RouterKey, bank.NewHandler(bankKeeper))\n\tmapp.SetInitChainer(getInitChainer(mapp, bankKeeper, tokenKeeper))\n\n\terr := mapp.CompleteSetup(keyToken)\n\treturn testInput{mapp, tokenKeeper}, err\n}", "title": "" }, { "docid": "7b09f32ebdac4e2f985b5a942cee6cf9", "score": "0.41246042", "text": "func WithDir(f func(string), dirs ...string) {\n\t// Mkdirs\n\tif len(dirs) < 1 {\n\t\tpanic(errors.ProgrammerError.New(\"WithDir must have at least one sub-directory\"))\n\t}\n\ttempPath := filepath.Join(dirs...)\n\terr := os.MkdirAll(tempPath, 0755)\n\tif err != nil {\n\t\tpanic(errors.IOError.Wrap(err))\n\t}\n\n\t// Lambda\n\tf(tempPath)\n\n\t// Cleanup\n\t// this is intentionally not in a defer or try/finally -- it's critical we *don't* do this for all errors.\n\t// specifically, if there's a placer error? hooooly shit DO NOT proceed on a bunch of deletes;\n\t// in a worst case scenario that placer error might have been failure to remove a bind from the host.\n\t// and that would leave a wormhole straight to hell which we should really NOT pump energy into.\n\terr = os.RemoveAll(tempPath)\n\tif err != nil {\n\t\t// TODO: we don't want to panic here, more like a debug log entry, \"failed to remove tempdir.\"\n\t\t// Can accomplish once we add logging.\n\t\tpanic(errors.IOError.Wrap(err))\n\t}\n}", "title": "" }, { "docid": "fe971f760b00da873c668012c1ec41c0", "score": "0.41207016", "text": "func TestDirCacheFlush(t *testing.T) {\n\trun.skipIfNoFUSE(t)\n\n\trun.checkDir(t, \"\")\n\n\trun.mkdir(t, \"dir\")\n\trun.mkdir(t, \"otherdir\")\n\trun.createFile(t, \"dir/file\", \"1\")\n\trun.createFile(t, \"otherdir/file\", \"1\")\n\n\tdm := newDirMap(\"otherdir/|otherdir/file 1|dir/|dir/file 1\")\n\tlocalDm := make(dirMap)\n\trun.readLocal(t, localDm, \"\")\n\tassert.Equal(t, dm, localDm, \"expected vs fuse mount\")\n\n\terr := run.fremote.Mkdir(context.Background(), \"dir/subdir\")\n\trequire.NoError(t, err)\n\n\t// expect newly created \"subdir\" on remote to not show up\n\trun.forget(\"otherdir\")\n\trun.readLocal(t, localDm, \"\")\n\tassert.Equal(t, dm, localDm, \"expected vs fuse mount\")\n\n\trun.forget(\"dir\")\n\tdm = newDirMap(\"otherdir/|otherdir/file 1|dir/|dir/file 1|dir/subdir/\")\n\trun.readLocal(t, localDm, \"\")\n\tassert.Equal(t, dm, localDm, \"expected vs fuse mount\")\n\n\trun.rm(t, \"otherdir/file\")\n\trun.rmdir(t, \"otherdir\")\n\trun.rm(t, \"dir/file\")\n\trun.rmdir(t, \"dir/subdir\")\n\trun.rmdir(t, \"dir\")\n\trun.checkDir(t, \"\")\n}", "title": "" }, { "docid": "3242820a49b64317768367172eac783e", "score": "0.41183093", "text": "func InTestDirWithSetup(dir Dir) func() {\n\t_, cleanup := InTestDir()\n\tApplyDir(dir)\n\treturn cleanup\n}", "title": "" }, { "docid": "947ed924156b30c29778e3e8aa75cfce", "score": "0.41179743", "text": "func directoryPluginLookup(mockPlugins map[string]mock.RawPlugin) DirectoryPluginLookupFunc {\n\treturn func(\n\t\tpluginDir string,\n\t\tchecksumfile string,\n\t\tlogger log.Logger,\n\t) (map[string]rawPlugin, error) {\n\t\trawPlugins := map[string]rawPlugin{}\n\t\tfor name, plugin := range mockPlugins {\n\t\t\trawPlugins[name] = plugin\n\t\t}\n\t\treturn rawPlugins, nil\n\t}\n}", "title": "" }, { "docid": "ca441a42ca6ae3055ef5840144cb977f", "score": "0.4117464", "text": "func newTestAppServer() ApplicationServiceServer {\n\tkubeclientset := fake.NewSimpleClientset()\n\tenforcer := rbac.NewEnforcer(kubeclientset, testNamespace, common.ArgoCDRBACConfigMapName, nil)\n\tenforcer.SetBuiltinPolicy(test.BuiltinPolicy)\n\tenforcer.SetDefaultRole(\"role:admin\")\n\n\tdb := db.NewDB(testNamespace, kubeclientset)\n\tctx := context.Background()\n\t_, err := db.CreateRepository(ctx, fakeRepo())\n\terrors.CheckError(err)\n\t_, err = db.CreateCluster(ctx, fakeCluster())\n\terrors.CheckError(err)\n\n\tmockRepoServiceClient := mockreposerver.RepositoryServiceClient{}\n\tmockRepoServiceClient.On(\"GetFile\", mock.Anything, mock.Anything).Return(fakeFileResponse(), nil)\n\tmockRepoServiceClient.On(\"ListDir\", mock.Anything, mock.Anything).Return(fakeListDirResponse(), nil)\n\n\tmockRepoClient := &mockrepo.Clientset{}\n\tmockRepoClient.On(\"NewRepositoryClient\").Return(&fakeCloser{}, &mockRepoServiceClient, nil)\n\n\treturn NewServer(\n\t\ttestNamespace,\n\t\tkubeclientset,\n\t\tapps.NewSimpleClientset(),\n\t\tmockRepoClient,\n\t\tdb,\n\t\tenforcer,\n\t\tutil.NewKeyLock(),\n\t)\n}", "title": "" }, { "docid": "c74e32bf898b136005c917bb1772b06f", "score": "0.4116188", "text": "func createAppDirectory(basePath, appName string) (string, error) {\n\n\tvar err error\n\n\tif basePath == \".\" {\n\t\tbasePath, err = os.Getwd()\n\t\tif err != nil {\n\t\t\treturn \"\", err\n\t\t}\n\t}\n\n\tappPath := filepath.Join(basePath, appName)\n\terr = os.Mkdir(appPath, os.ModePerm)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\n\treturn appPath, nil\n}", "title": "" }, { "docid": "4beedfdef088ded3f3db0a70fa734210", "score": "0.4111968", "text": "func TestRandomStuckDirectory(t *testing.T) {\n\tif testing.Short() {\n\t\tt.SkipNow()\n\t}\n\tt.Parallel()\n\n\t// Create test renter\n\trt, err := newRenterTesterWithDependency(t.Name(), &dependencies.DependencyDisableRepairAndHealthLoops{})\n\tif err != nil {\n\t\tt.Fatal(err)\n\t}\n\tdefer rt.Close()\n\n\t// Create a test directory with sub folders\n\t//\n\t// root/\n\t// root/SubDir1/\n\t// root/SubDir1/SubDir2/\n\t// root/SubDir2/\n\tsubDir1, err := modules.NewSiaPath(\"SubDir1\")\n\tif err != nil {\n\t\tt.Fatal(err)\n\t}\n\tsubDir2, err := modules.NewSiaPath(\"SubDir2\")\n\tif err != nil {\n\t\tt.Fatal(err)\n\t}\n\tif err := rt.renter.CreateDir(subDir1); err != nil {\n\t\tt.Fatal(err)\n\t}\n\tif err := rt.renter.CreateDir(subDir2); err != nil {\n\t\tt.Fatal(err)\n\t}\n\tsubDir1_2, err := subDir1.Join(subDir2.String())\n\tif err != nil {\n\t\tt.Fatal(err)\n\t}\n\tif err := rt.renter.CreateDir(subDir1_2); err != nil {\n\t\tt.Fatal(err)\n\t}\n\n\t// Add a file to root and SubDir1/SubDir2 and mark the first chunk as stuck\n\t// in each file\n\t//\n\t// This will test the edge case of continuing to find stuck files when a\n\t// directory has no files only directories\n\trsc, _ := siafile.NewRSCode(1, 1)\n\tup := modules.FileUploadParams{\n\t\tSource: \"\",\n\t\tSiaPath: modules.RandomSiaPath(),\n\t\tErasureCode: rsc,\n\t}\n\tf, err := rt.renter.staticFileSet.NewSiaFile(up, crypto.GenerateSiaKey(crypto.RandomCipherType()), 100, 0777)\n\tif err != nil {\n\t\tt.Fatal(err)\n\t}\n\tif err = f.SetStuck(uint64(0), true); err != nil {\n\t\tt.Fatal(err)\n\t}\n\tif err = f.Close(); err != nil {\n\t\tt.Fatal(err)\n\t}\n\tup.SiaPath, err = subDir1_2.Join(hex.EncodeToString(fastrand.Bytes(8)))\n\tif err != nil {\n\t\tt.Fatal(err)\n\t}\n\tf, err = rt.renter.staticFileSet.NewSiaFile(up, crypto.GenerateSiaKey(crypto.RandomCipherType()), 100, 0777)\n\tif err != nil {\n\t\tt.Fatal(err)\n\t}\n\tif err = f.SetStuck(uint64(0), true); err != nil {\n\t\tt.Fatal(err)\n\t}\n\tif err = f.Close(); err != nil {\n\t\tt.Fatal(err)\n\t}\n\n\t// Bubble directory information so NumStuckChunks is updated, there should\n\t// be at least 2 stuck chunks because of the two we manually marked as\n\t// stuck, but the repair loop could have marked the rest as stuck so we just\n\t// want to ensure that the root directory reflects at least the two we\n\t// marked as stuck\n\trt.renter.managedBubbleMetadata(subDir1_2)\n\tbuild.Retry(100, 100*time.Millisecond, func() error {\n\t\t// Get Root Directory Metadata\n\t\tmetadata, err := rt.renter.managedDirectoryMetadata(modules.RootSiaPath())\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\t// Check Aggregate number of stuck chunks\n\t\tif metadata.AggregateNumStuckChunks != uint64(2) {\n\t\t\treturn fmt.Errorf(\"Incorrect number of stuck chunks, should be 2\")\n\t\t}\n\t\treturn nil\n\t})\n\tif err != nil {\n\t\tt.Fatal(err)\n\t}\n\n\t// Create map of stuck directories that contain files. These are the only\n\t// directories that should be returned.\n\tstuckDirectories := make(map[modules.SiaPath]struct{})\n\tstuckDirectories[modules.RootSiaPath()] = struct{}{}\n\tstuckDirectories[subDir1_2] = struct{}{}\n\n\t// Find random directory several times, confirm that it finds a stuck\n\t// directory and there it finds unique directories\n\tvar unique bool\n\tvar previousDir modules.SiaPath\n\tfor i := 0; i < 10; i++ {\n\t\tdir, err := rt.renter.managedStuckDirectory()\n\t\tif err != nil {\n\t\t\tt.Log(\"Error with Directory `\", dir, \"` on iteration\", i)\n\t\t\tt.Fatal(err)\n\t\t}\n\t\t_, ok := stuckDirectories[dir]\n\t\tif !ok {\n\t\t\tt.Fatal(\"Found non stuck directory:\", dir)\n\t\t}\n\t\tif !dir.Equals(previousDir) {\n\t\t\tunique = true\n\t\t}\n\t\tpreviousDir = dir\n\t}\n\tif !unique {\n\t\tt.Fatal(\"No unique directories found\")\n\t}\n}", "title": "" }, { "docid": "687cecb08e9a6db0bbe402669be26ef2", "score": "0.41053155", "text": "func TestGenerateHelmWithValuesDirectoryTraversalOutsideRepo(t *testing.T) {\n\tservice := newService(\"../..\")\n\n\t_, err := service.GenerateManifest(context.Background(), &apiclient.ManifestRequest{\n\t\tRepo: &argoappv1.Repository{},\n\t\tAppLabelValue: \"test\",\n\t\tApplicationSource: &argoappv1.ApplicationSource{\n\t\t\tPath: \"./util/helm/testdata/redis\",\n\t\t\tHelm: &argoappv1.ApplicationSourceHelm{\n\t\t\t\tValueFiles: []string{\"../../../../../minio/values.yaml\"},\n\t\t\t\tValues: `cluster: {slaveCount: 2}`,\n\t\t\t},\n\t\t},\n\t})\n\tassert.Error(t, err, \"should be on or under current directory\")\n}", "title": "" }, { "docid": "986cca23b1710a53fa8468e6d4532ad5", "score": "0.41037792", "text": "func (_m *CognitoIdentityProviderAPI) UpdateUserPoolDomainRequest(_a0 *cognitoidentityprovider.UpdateUserPoolDomainInput) (*request.Request, *cognitoidentityprovider.UpdateUserPoolDomainOutput) {\n\tret := _m.Called(_a0)\n\n\tvar r0 *request.Request\n\tif rf, ok := ret.Get(0).(func(*cognitoidentityprovider.UpdateUserPoolDomainInput) *request.Request); ok {\n\t\tr0 = rf(_a0)\n\t} else {\n\t\tif ret.Get(0) != nil {\n\t\t\tr0 = ret.Get(0).(*request.Request)\n\t\t}\n\t}\n\n\tvar r1 *cognitoidentityprovider.UpdateUserPoolDomainOutput\n\tif rf, ok := ret.Get(1).(func(*cognitoidentityprovider.UpdateUserPoolDomainInput) *cognitoidentityprovider.UpdateUserPoolDomainOutput); ok {\n\t\tr1 = rf(_a0)\n\t} else {\n\t\tif ret.Get(1) != nil {\n\t\t\tr1 = ret.Get(1).(*cognitoidentityprovider.UpdateUserPoolDomainOutput)\n\t\t}\n\t}\n\n\treturn r0, r1\n}", "title": "" }, { "docid": "3fb63ecd128c2bfd6b15acbe5199080e", "score": "0.40985793", "text": "func TestMakePluginNoPath(t *testing.T) {\n\ttempDir, err := ioutil.TempDir(\"\", \"\")\n\trequire.Empty(t, err, \"cannot create temp dir\")\n\n\tpluginDir := filepath.Join(tempDir, \"plugin\")\n\terr = os.MkdirAll(pluginDir, os.ModePerm)\n\trequire.Empty(t, err, \"cannot create plugin dir\")\n\n\tfiles := []string{\"hello.plugin.zsh\", \"world.plugin.zsh\", \"impretty.zsh-theme\"}\n\tfor _, filename := range files {\n\t\t_, err = os.Create(filepath.Join(pluginDir, filename))\n\t\trequire.Empty(t, err, \"cannot create plugin file\")\n\t}\n\n\t_, err = MakeDir(\"\", map[string]string{})\n\tassert.NotEmpty(t, err, \"must return error\")\n}", "title": "" }, { "docid": "8dd3eb50c21b22712a7d1f6869ffa744", "score": "0.4097891", "text": "func ByDir(left, right *FileInfoPath) bool {\n\treturn left.IsDir() && !right.IsDir()\n}", "title": "" }, { "docid": "383585f8143ec5129b82115ca33d27a7", "score": "0.40976548", "text": "func (m *MockMounter) MountSensitiveWithoutSystemd(arg0, arg1, arg2 string, arg3, arg4 []string) error {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"MountSensitiveWithoutSystemd\", arg0, arg1, arg2, arg3, arg4)\n\tret0, _ := ret[0].(error)\n\treturn ret0\n}", "title": "" }, { "docid": "f1d0f90b129b7f68814e1b4b736e22a0", "score": "0.40975687", "text": "func getBenchmarkMockAppWithSetTokenKeeper() (testInput, error) {\n\tmapp := mock.NewApp()\n\ttypes.RegisterCodec(mapp.Cdc)\n\n\ttoken.RegisterCodec(mapp.Cdc)\n\tkeyToken := sdk.NewKVStoreKey(token.StoreKey)\n\ttokenKeeper := token.NewKeeper(mapp.Cdc, keyToken, nil, nil, mapp.ParamsKeeper.Subspace(token.DefaultParamspace))\n\n\tblacklistedAddrs := make(map[string]bool)\n\tblacklistedAddrs[moduleAccAddr.String()] = true\n\n\tbankKeeper := keeper.NewBaseKeeper(\n\t\tmapp.AccountKeeper, nil,\n\t\tmapp.ParamsKeeper.Subspace(types.DefaultParamspace),\n\t\ttypes.DefaultCodespace,\n\t\tblacklistedAddrs,\n\t)\n\n\tbankKeeper.SetTokenKeeper(&tokenKeeper)\n\tmapp.Router().AddRoute(types.RouterKey, bank.NewHandler(bankKeeper))\n\tmapp.SetInitChainer(getInitChainer(mapp, bankKeeper, tokenKeeper))\n\n\terr := mapp.CompleteSetup(keyToken)\n\treturn testInput{mapp, tokenKeeper}, err\n}", "title": "" }, { "docid": "7cd86e4b3b678bd4e1d810a8bc1561c0", "score": "0.40966785", "text": "func (_m *ApplicationService) Update(ctx context.Context, id string, in model.ApplicationUpdateInput) error {\n\tret := _m.Called(ctx, id, in)\n\n\tvar r0 error\n\tif rf, ok := ret.Get(0).(func(context.Context, string, model.ApplicationUpdateInput) error); ok {\n\t\tr0 = rf(ctx, id, in)\n\t} else {\n\t\tr0 = ret.Error(0)\n\t}\n\n\treturn r0\n}", "title": "" }, { "docid": "39a6df0992645a4980fd994c59d5784b", "score": "0.4092353", "text": "func (_m *LambdaAPI) UpdateAliasRequest(_a0 *lambda.UpdateAliasInput) (*request.Request, *lambda.AliasConfiguration) {\n\tret := _m.Called(_a0)\n\n\tvar r0 *request.Request\n\tif rf, ok := ret.Get(0).(func(*lambda.UpdateAliasInput) *request.Request); ok {\n\t\tr0 = rf(_a0)\n\t} else {\n\t\tif ret.Get(0) != nil {\n\t\t\tr0 = ret.Get(0).(*request.Request)\n\t\t}\n\t}\n\n\tvar r1 *lambda.AliasConfiguration\n\tif rf, ok := ret.Get(1).(func(*lambda.UpdateAliasInput) *lambda.AliasConfiguration); ok {\n\t\tr1 = rf(_a0)\n\t} else {\n\t\tif ret.Get(1) != nil {\n\t\t\tr1 = ret.Get(1).(*lambda.AliasConfiguration)\n\t\t}\n\t}\n\n\treturn r0, r1\n}", "title": "" }, { "docid": "2739dbb6d23a5097ae5b48148caa0ae6", "score": "0.40849242", "text": "func getMockAppWithBalance(t *testing.T, numGenAccs int, balance int64) (mockApp *MockApp,\n\taddrKeysSlice mock.AddrKeysSlice) {\n\tmapp := mock.NewApp()\n\tregisterCodec(mapp.Cdc)\n\n\tmockApp = &MockApp{\n\t\tApp: mapp,\n\t\tkeyOrder: sdk.NewKVStoreKey(OrderStoreKey),\n\n\t\tkeyToken: sdk.NewKVStoreKey(token.StoreKey),\n\t\tkeyLock: sdk.NewKVStoreKey(token.KeyLock),\n\t\tkeyDex: sdk.NewKVStoreKey(dex.StoreKey),\n\t\tkeyTokenPair: sdk.NewKVStoreKey(dex.TokenPairStoreKey),\n\n\t\tkeySupply: sdk.NewKVStoreKey(supply.StoreKey),\n\t}\n\n\tfeeCollector := supply.NewEmptyModuleAccount(auth.FeeCollectorName)\n\tblacklistedAddrs := make(map[string]bool)\n\tblacklistedAddrs[feeCollector.String()] = true\n\n\tmockApp.bankKeeper = bank.NewBaseKeeper(mockApp.AccountKeeper,\n\t\tmockApp.ParamsKeeper.Subspace(bank.DefaultParamspace),\n\t\tblacklistedAddrs)\n\n\tmaccPerms := map[string][]string{\n\t\tauth.FeeCollectorName: nil,\n\t\ttoken.ModuleName: {supply.Minter, supply.Burner},\n\t}\n\tmockApp.supplyKeeper = supply.NewKeeper(mockApp.Cdc, mockApp.keySupply, mockApp.AccountKeeper,\n\t\tmockApp.bankKeeper, maccPerms)\n\n\tmockApp.tokenKeeper = token.NewKeeper(\n\t\tmockApp.bankKeeper,\n\t\tmockApp.ParamsKeeper.Subspace(token.DefaultParamspace),\n\t\tauth.FeeCollectorName,\n\t\tmockApp.supplyKeeper,\n\t\tmockApp.keyToken,\n\t\tmockApp.keyLock,\n\t\tmockApp.Cdc,\n\t\ttrue, mockApp.AccountKeeper)\n\n\tmockApp.dexKeeper = dex.NewKeeper(\n\t\tauth.FeeCollectorName,\n\t\tmockApp.supplyKeeper,\n\t\tmockApp.ParamsKeeper.Subspace(dex.DefaultParamspace),\n\t\tmockApp.tokenKeeper,\n\t\tnil,\n\t\tmockApp.bankKeeper,\n\t\tmockApp.keyDex,\n\t\tmockApp.keyTokenPair,\n\t\tmockApp.Cdc)\n\n\tmockApp.orderKeeper = NewKeeper(\n\t\tmockApp.tokenKeeper,\n\t\tmockApp.supplyKeeper,\n\t\tmockApp.dexKeeper,\n\t\tmockApp.ParamsKeeper.Subspace(DefaultParamspace),\n\t\tauth.FeeCollectorName,\n\t\tmockApp.keyOrder,\n\t\tmockApp.Cdc,\n\t\ttrue,\n\t\tmonitor.NopOrderMetrics())\n\n\tmockApp.Router().AddRoute(RouterKey, NewOrderHandler(mockApp.orderKeeper))\n\tmockApp.QueryRouter().AddRoute(QuerierRoute, NewQuerier(mockApp.orderKeeper))\n\n\tmockApp.SetBeginBlocker(getBeginBlocker(mockApp.orderKeeper))\n\tmockApp.SetEndBlocker(getEndBlocker(mockApp.orderKeeper))\n\tmockApp.SetInitChainer(getInitChainer(mockApp.App, mockApp.supplyKeeper,\n\t\t[]exported.ModuleAccountI{feeCollector}))\n\n\tdecCoins, err := sdk.ParseDecCoins(fmt.Sprintf(\"%d%s,%d%s\",\n\t\tbalance, common.NativeToken, balance, common.TestToken))\n\trequire.Nil(t, err)\n\tcoins := decCoins\n\n\tkeysSlice, genAccs := CreateGenAccounts(numGenAccs, coins)\n\taddrKeysSlice = keysSlice\n\n\t// todo: checkTx in mock app\n\tmockApp.SetAnteHandler(nil)\n\n\tapp := mockApp\n\trequire.NoError(t, app.CompleteSetup(\n\t\tapp.keyOrder,\n\t\tapp.keyToken,\n\t\tapp.keyDex,\n\t\tapp.keyTokenPair,\n\t\tapp.keyLock,\n\t\tapp.keySupply,\n\t))\n\tmock.SetGenesis(mockApp.App, genAccs)\n\n\tfor i := 0; i < numGenAccs; i++ {\n\t\tmock.CheckBalance(t, app.App, keysSlice[i].Address, coins)\n\t\tmockApp.TotalCoinsSupply = mockApp.TotalCoinsSupply.Add2(coins)\n\t}\n\n\treturn mockApp, addrKeysSlice\n}", "title": "" }, { "docid": "b9d55067624a98f7b01424c47d85de24", "score": "0.4082683", "text": "func setupTestFiles(baseLoc vfs.Location) {\n\n\t// setup \"test_files\" dir\n\tcreateDir(baseLoc, \"test_files\")\n\n\t// setup \"test_files/test.txt\"\n\twriteStringFile(baseLoc, \"test_files/empty.txt\", ``)\n\n\t// setup \"test_files/test.txt\"\n\twriteStringFile(baseLoc, \"test_files/prefix-file.txt\", `hello, Dave`)\n\n\t// setup \"test_files/test.txt\"\n\twriteStringFile(baseLoc, \"test_files/test.txt\", `hello world`)\n\n\t// setup \"test_files/subdir\" dir\n\tcreateDir(baseLoc, \"test_files/subdir\")\n\n\t// setup \"test_files/subdir/test.txt\"\n\twriteStringFile(baseLoc, \"test_files/subdir/test.txt\", `hello world too`)\n}", "title": "" }, { "docid": "b7dd01e816971a34996cd7292352c5f3", "score": "0.40782833", "text": "func MockUpdateMetadataResponse(t *testing.T) {\n\tth.Mux.HandleFunc(shareEndpoint+\"/\"+shareID+\"/metadata\", func(w http.ResponseWriter, r *http.Request) {\n\t\tth.TestMethod(t, r, \"POST\")\n\t\tth.TestHeader(t, r, \"X-Auth-Token\", fake.TokenID)\n\t\tth.TestHeader(t, r, \"Content-Type\", \"application/json\")\n\t\tth.TestHeader(t, r, \"Accept\", \"application/json\")\n\t\tth.TestJSONRequest(t, r, updateMetadataRequest)\n\t\tw.Header().Add(\"Content-Type\", \"application/json\")\n\t\tw.WriteHeader(http.StatusOK)\n\t\tfmt.Fprint(w, updateMetadataResponse)\n\t})\n}", "title": "" }, { "docid": "cad6393713857b48dac3f83aa7b237d9", "score": "0.4073551", "text": "func (_m *CognitoIdentityProviderAPI) UpdateUserPoolDomain(_a0 *cognitoidentityprovider.UpdateUserPoolDomainInput) (*cognitoidentityprovider.UpdateUserPoolDomainOutput, error) {\n\tret := _m.Called(_a0)\n\n\tvar r0 *cognitoidentityprovider.UpdateUserPoolDomainOutput\n\tif rf, ok := ret.Get(0).(func(*cognitoidentityprovider.UpdateUserPoolDomainInput) *cognitoidentityprovider.UpdateUserPoolDomainOutput); ok {\n\t\tr0 = rf(_a0)\n\t} else {\n\t\tif ret.Get(0) != nil {\n\t\t\tr0 = ret.Get(0).(*cognitoidentityprovider.UpdateUserPoolDomainOutput)\n\t\t}\n\t}\n\n\tvar r1 error\n\tif rf, ok := ret.Get(1).(func(*cognitoidentityprovider.UpdateUserPoolDomainInput) error); ok {\n\t\tr1 = rf(_a0)\n\t} else {\n\t\tr1 = ret.Error(1)\n\t}\n\n\treturn r0, r1\n}", "title": "" }, { "docid": "2c84605eb0e53dc9615e023ea4359a34", "score": "0.4072785", "text": "func TestFileCopyS2SWithDirectory(t *testing.T) {\n\ta := assert.New(t)\n\tfsc := getFileServiceClient()\n\tsrcShareClient, srcShareName := createNewShare(a, fsc)\n\tdstShareClient, dstShareName := createNewShare(a, fsc)\n\tdefer deleteShare(a, srcShareClient)\n\tdefer deleteShare(a, dstShareClient)\n\n\t// set up the source share with numerous files\n\tdirName := \"dir\"\n\tfileList := scenarioHelper{}.generateCommonRemoteScenarioForAzureFile(a, srcShareClient, fsc, dirName+\"/\")\n\ta.NotZero(len(fileList))\n\n\t// set up the destination with the exact same files\n\tscenarioHelper{}.generateShareFilesFromList(a, dstShareClient, fsc, fileList)\n\n\t// set up interceptor\n\tmockedRPC := interceptor{}\n\tRpc = mockedRPC.intercept\n\tmockedRPC.init()\n\n\t// construct the raw input to simulate user input\n\tsrcShareURLWithSAS := scenarioHelper{}.getRawShareURLWithSAS(a, srcShareName)\n\tdstShareURLWithSAS := scenarioHelper{}.getRawShareURLWithSAS(a, dstShareName)\n\tsrcShareURLWithSAS.Path += \"/\" + dirName\n\traw := getDefaultCopyRawInput(srcShareURLWithSAS.String(), dstShareURLWithSAS.String())\n\traw.recursive = true\n\n\texpectedList := scenarioHelper{}.shaveOffPrefix(fileList, dirName+\"/\")\n\texpectedList = scenarioHelper{}.addFoldersToList(expectedList, true) // since this is files-to-files and so folder aware\n\trunCopyAndVerify(a, raw, func(err error) {\n\t\ta.Nil(err)\n\t\tvalidateS2STransfersAreScheduled(a, \"/\", \"/\"+dirName+\"/\", expectedList, mockedRPC)\n\t})\n}", "title": "" }, { "docid": "ad5dc4fbc6ea9b6ebbbd612853407245", "score": "0.4070682", "text": "func AddNewDeviceToIoddFilesAndMap(\n\tioddFilemapKey IoddFilemapKey,\n\trelativeDirectoryPath string,\n\tfileInfoSlice []fs.DirEntry, isTest bool) ([]fs.DirEntry, error) {\n\tzap.S().Debugf(\"Requesting IoddFile %v -> %s\", ioddFilemapKey, relativeDirectoryPath)\n\terr := RequestSaveIoddFile(ioddFilemapKey, relativeDirectoryPath, isTest)\n\tif err != nil {\n\t\tzap.S().Debugf(\"File with fileMapKey%v already saved.\", ioddFilemapKey)\n\t}\n\tzap.S().Debugf(\"Reading IoddFiles %v -> %s\", fileInfoSlice, relativeDirectoryPath)\n\tfileInfoSlice, err = ReadIoddFiles(fileInfoSlice, relativeDirectoryPath)\n\tif err != nil {\n\t\tzap.S().Errorf(\"Error in AddNewDeviceToIoddFilesAndMap: %s\", err.Error())\n\t\treturn fileInfoSlice, err\n\t}\n\treturn fileInfoSlice, nil\n}", "title": "" }, { "docid": "0e4ac0f3da1f02d0accf2718e79aa8af", "score": "0.40702048", "text": "func TestFS(fsys writefs.WriteFS) func(t *testing.T) {\n\treturn func(t *testing.T) {\n\t\tdirs := []string{\n\t\t\t\"dir1\",\n\t\t\t\"dir1/dirsub1\",\n\t\t\t\"dirempty\",\n\t\t}\n\t\tfiles := []string{\n\t\t\t\"dir1/file1\",\n\t\t\t\"dir1/file2\",\n\t\t\t\"dir1/dirsub1/file3\",\n\t\t}\n\n\t\tt.Run(\"initialize testing FS\", func(t *testing.T) {\n\t\t\tfor _, dir := range dirs {\n\t\t\t\terr := writefs.MkDir(fsys, dir, fs.FileMode(0755))\n\t\t\t\t//if !(err == nil || errors.Is(err, fs.ErrExist)) {\n\t\t\t\t//\tfmt.Println(err, dir)\n\t\t\t\t//}\n\t\t\t\tassert.True(t, err == nil || errors.Is(err, fs.ErrExist))\n\n\t\t\t}\n\n\t\t\tfor _, file := range files {\n\t\t\t\tfake := []byte(file + \" content\\n\")\n\t\t\t\tn, err := writefs.WriteFile(fsys, file, fake)\n\t\t\t\tassert.NoError(t, err)\n\t\t\t\tassert.Equal(t, len(fake), n)\n\t\t\t}\n\t\t})\n\n\t\tt.Run(\"pass TestFS\", func(t *testing.T) {\n\t\t\terr := fstest.TestFS(fsys, append(files, dirs...)...)\n\t\t\tassert.NoError(t, err)\n\t\t})\n\n\t\tdirExists := func(t *testing.T, dir string) {\n\t\t\tinfo, err := fs.Stat(fsys, dir)\n\t\t\tif assert.NoError(t, err) {\n\t\t\t\tassert.True(t, info.IsDir())\n\t\t\t}\n\t\t}\n\n\t\tfileExists := func(t *testing.T, dir string) {\n\t\t\tinfo, err := fs.Stat(fsys, dir)\n\t\t\tif assert.NoError(t, err) {\n\t\t\t\tassert.True(t, info.Mode().IsRegular())\n\t\t\t}\n\t\t}\n\n\t\tfileNotExists := func(t *testing.T, dir string) {\n\t\t\tinfo, err := fs.Stat(fsys, dir)\n\t\t\tassert.True(t, errors.Is(err, fs.ErrNotExist))\n\t\t\tassert.Nil(t, info)\n\t\t}\n\n\t\tcheckDirCreated := func(t *testing.T, dir string) {\n\t\t\tfileNotExists(t, dir)\n\n\t\t\terr := writefs.Remove(fsys, dir)\n\t\t\tassert.True(t, err == nil || errors.Is(err, fs.ErrNotExist))\n\n\t\t\tf, err := writefs.OpenFile(fsys, dir, os.O_CREATE, fs.FileMode(0755)|fs.ModeDir)\n\t\t\tassert.NoError(t, err)\n\t\t\tassert.Nil(t, f)\n\t\t\tdirExists(t, dir)\n\t\t}\n\t\tdirRemove := func(t *testing.T, dir string) {\n\t\t\tf, _ := writefs.OpenFile(fsys, dir, os.O_TRUNC, 0)\n\t\t\tassert.Nil(t, f)\n\t\t\tfileNotExists(t, dir)\n\t\t}\n\t\tcheckDirRemoved := func(t *testing.T, dir string) {\n\t\t\terr := writefs.MkDir(fsys, dir, fs.FileMode(0755))\n\t\t\tassert.True(t, err == nil || errors.Is(err, fs.ErrExist))\n\t\t\tdirExists(t, dir)\n\n\t\t\tf, err := writefs.OpenFile(fsys, dir, os.O_TRUNC, 0)\n\t\t\tassert.NoError(t, err)\n\t\t\tassert.Nil(t, f)\n\t\t\tfileNotExists(t, dir)\n\t\t}\n\t\tt.Run(\"creates directories with OpenFile - nested and not recursively\", func(t *testing.T) {\n\t\t\tdirRemove(t, \"dir1/adir/nested\")\n\t\t\tdirRemove(t, \"dir1/adir\")\n\n\t\t\t// nested dir return error\n\t\t\tf, err := writefs.OpenFile(fsys, \"dir1/adir/nested\", os.O_CREATE, fs.FileMode(0755)|fs.ModeDir)\n\t\t\tassert.Error(t, err)\n\t\t\tassert.Nil(t, f)\n\t\t\tassert.True(t, errors.Is(err, fs.ErrNotExist))\n\n\t\t\tcheckDirCreated(t, \"dir1/adir\")\n\t\t\tcheckDirCreated(t, \"dir1/adir/nested\")\n\t\t})\n\n\t\tt.Run(\"OpenFile return *PathError on bad paths\", func(t *testing.T) {\n\t\t\tcheckBadPath(t, \"afilename\", \"OpenFile\", func(name string) error {\n\t\t\t\t_, err := writefs.OpenFile(fsys, name, 0, 0)\n\t\t\t\treturn err\n\t\t\t})\n\t\t})\n\n\t\tt.Run(\"remove files with OpenFile\", func(t *testing.T) {\n\t\t\tfile := \"dir1/somenewfile\"\n\t\t\t_, err := writefs.WriteFile(fsys, file, []byte(file))\n\t\t\tassert.NoError(t, err)\n\n\t\t\tfileExists(t, file)\n\n\t\t\tf, err := writefs.OpenFile(fsys, file, os.O_TRUNC, 0)\n\t\t\tassert.NoError(t, err)\n\t\t\tassert.Nil(t, f)\n\n\t\t\tfileNotExists(t, file)\n\t\t})\n\n\t\tt.Run(\"remove directories with OpenFile - nested and not recursively\", func(t *testing.T) {\n\t\t\t// non empty dir return error\n\t\t\tf, err := writefs.OpenFile(fsys, \"dir1/adir\", os.O_TRUNC, 0)\n\t\t\tassert.Error(t, err)\n\t\t\tassert.Nil(t, f)\n\t\t\tassert.True(t, errors.Is(err, fs.ErrInvalid))\n\t\t\t//assert.True(t, errors.Is(err, &fs.PathError{}))\n\n\t\t\tcheckDirRemoved(t, \"dir1/adir/nested\")\n\t\t\tcheckDirRemoved(t, \"dir1/adir\")\n\t\t})\n\t\tt.Run(\"create and write on new files\", func(t *testing.T) {\n\t\t\tfile := \"dir1/file1new\"\n\t\t\terr := writefs.Remove(fsys, file)\n\t\t\tassert.True(t, err == nil || errors.Is(err, fs.ErrNotExist))\n\t\t\tfileNotExists(t, file)\n\n\t\t\tf, err := writefs.OpenFile(fsys, file, os.O_CREATE|os.O_WRONLY, fs.FileMode(0644))\n\t\t\tif assert.NoError(t, err) {\n\t\t\t\tassert.NotNil(t, f)\n\t\t\t\tbuf := []byte(\"ciao\\n\")\n\t\t\t\tn, err := f.Write(buf)\n\t\t\t\tassert.NoError(t, err)\n\t\t\t\tassert.Equal(t, len(buf), n)\n\t\t\t\terr = f.Close()\n\t\t\t\tassert.NoError(t, err)\n\t\t\t}\n\n\t\t\tt.Run(\"set modtime to now\", func(t *testing.T) {\n\t\t\t\tinfo, err := fs.Stat(fsys, file)\n\t\t\t\tif assert.NoError(t, err) {\n\t\t\t\t\tassert.Less(t, time.Now().Sub(info.ModTime()), time.Second)\n\t\t\t\t}\n\t\t\t})\n\t\t\tt.Run(\"set content\", func(t *testing.T) {\n\t\t\t\tbuf := []byte(\"ciao\\n\")\n\t\t\t\tactual, err := fs.ReadFile(fsys, file)\n\t\t\t\tassert.NoError(t, err)\n\t\t\t\tassert.Equal(t, buf, actual)\n\t\t\t})\n\t\t})\n\n\t\tt.Run(\"write on existing files\", func(t *testing.T) {\n\t\t\tfile := \"dir1/file1new\"\n\t\t\terr := writefs.Remove(fsys, file)\n\t\t\tassert.True(t, err == nil || errors.Is(err, fs.ErrExist))\n\t\t\t_, err = writefs.WriteFile(fsys, file, []byte(\"ciao\\n\"))\n\t\t\tassert.NoError(t, err)\n\n\t\t\tfileExists(t, file)\n\n\t\t\tf, err := writefs.OpenFile(fsys, file, os.O_WRONLY, fs.FileMode(0644))\n\t\t\tif assert.NoError(t, err) {\n\t\t\t\tassert.NotNil(t, f)\n\t\t\t\tbuf := []byte(\"mi\")\n\t\t\t\tn, err := f.Write(buf)\n\t\t\t\tassert.NoError(t, err)\n\t\t\t\tassert.Equal(t, len(buf), n)\n\t\t\t\terr = f.Close()\n\t\t\t\tassert.NoError(t, err)\n\t\t\t}\n\n\t\t\tt.Run(\"updates modtime\", func(t *testing.T) {\n\t\t\t\tinfo, err := fs.Stat(fsys, file)\n\t\t\t\tif assert.NoError(t, err) {\n\t\t\t\t\tassert.Less(t, time.Now().Sub(info.ModTime()), time.Second)\n\t\t\t\t}\n\t\t\t})\n\t\t\tt.Run(\"update content\", func(t *testing.T) {\n\t\t\t\tactual, err := fs.ReadFile(fsys, file)\n\t\t\t\tassert.NoError(t, err)\n\t\t\t\tassert.Equal(t, []byte(\"miao\\n\"), actual)\n\t\t\t})\n\t\t})\n\t\tt.Run(\"write on existing files truncating\", func(t *testing.T) {\n\t\t\tfile := \"dir1/file1new\"\n\t\t\terr := writefs.Remove(fsys, file)\n\t\t\tassert.True(t, err == nil || errors.Is(err, fs.ErrExist))\n\t\t\t_, err = writefs.WriteFile(fsys, file, []byte(\"ciao\\n\"))\n\t\t\tassert.NoError(t, err)\n\n\t\t\tfileExists(t, file)\n\n\t\t\tf, err := writefs.OpenFile(fsys, file, os.O_WRONLY|os.O_TRUNC, fs.FileMode(0644))\n\t\t\tif assert.NoError(t, err) {\n\t\t\t\tassert.NotNil(t, f)\n\t\t\t\tbuf := []byte(\"mi\")\n\t\t\t\tn, err := f.Write(buf)\n\t\t\t\tassert.NoError(t, err)\n\t\t\t\tassert.Equal(t, len(buf), n)\n\t\t\t\terr = f.Close()\n\t\t\t\tassert.NoError(t, err)\n\t\t\t}\n\n\t\t\tt.Run(\"updates modtime\", func(t *testing.T) {\n\t\t\t\tinfo, err := fs.Stat(fsys, file)\n\t\t\t\tif assert.NoError(t, err) {\n\t\t\t\t\tassert.Less(t, time.Now().Sub(info.ModTime()), time.Second)\n\t\t\t\t}\n\t\t\t})\n\t\t\tt.Run(\"set content\", func(t *testing.T) {\n\t\t\t\tactual, err := fs.ReadFile(fsys, file)\n\t\t\t\tassert.NoError(t, err)\n\t\t\t\tassert.Equal(t, []byte(\"mi\"), actual)\n\t\t\t})\n\t\t})\n\n\t\tt.Run(\"appending to existing files\", func(t *testing.T) {\n\t\t\tfile := \"dir1/file1new\"\n\t\t\terr := writefs.Remove(fsys, file)\n\t\t\tassert.True(t, err == nil || errors.Is(err, fs.ErrExist))\n\t\t\t_, err = writefs.WriteFile(fsys, file, []byte(\"ciao\\n\"))\n\t\t\tassert.NoError(t, err)\n\n\t\t\tfileExists(t, file)\n\n\t\t\tf, err := writefs.OpenFile(fsys, file, os.O_WRONLY|os.O_APPEND, fs.FileMode(0644))\n\t\t\tif assert.NoError(t, err) {\n\t\t\t\tassert.NotNil(t, f)\n\t\t\t\tbuf := []byte(\"mi\")\n\t\t\t\tn, err := f.Write(buf)\n\t\t\t\tassert.NoError(t, err)\n\t\t\t\tassert.Equal(t, len(buf), n)\n\t\t\t\terr = f.Close()\n\t\t\t\tassert.NoError(t, err)\n\t\t\t}\n\n\t\t\tt.Run(\"updates modtime\", func(t *testing.T) {\n\t\t\t\tinfo, err := fs.Stat(fsys, file)\n\t\t\t\tif assert.NoError(t, err) {\n\t\t\t\t\tassert.Less(t, time.Now().Sub(info.ModTime()), time.Second)\n\t\t\t\t}\n\t\t\t})\n\t\t\tt.Run(\"updates content\", func(t *testing.T) {\n\t\t\t\tactual, err := fs.ReadFile(fsys, file)\n\t\t\t\tassert.NoError(t, err)\n\t\t\t\tassert.Equal(t, []byte(\"ciao\\nmi\"), actual)\n\t\t\t})\n\t\t})\n\n\t\tt.Run(\"opening non existing files\", func(t *testing.T) {\n\t\t\tf, err := writefs.OpenFile(fsys, \"unkfile\", os.O_WRONLY, fs.FileMode(0644))\n\t\t\tassert.Error(t, err)\n\t\t\tassert.True(t, errors.Is(err, fs.ErrNotExist))\n\t\t\tassert.Nil(t, f)\n\t\t})\n\t\t/*\n\t\t\tt.Run(\"opening read-only files for write\", func(t *testing.T) {\n\t\t\t\tf, err := writefs.OpenFile(fsys,\"/etc/passwd\", os.O_WRONLY, fs.FileMode(0644))\n\t\t\t\tassert.Error(t, err)\n\t\t\t\tassert.Nil(t, f)\n\t\t\t})\n\t\t*/\n\t}\n}", "title": "" }, { "docid": "a25af56c68a5d18e10200ebc8acd5a6a", "score": "0.40685913", "text": "func (m *MetaSpec) SetupDir() ([]byte, error) {\n\terr := os.MkdirAll(m.MetaSpace, 0777)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tdata := []byte(\"{}\")\n\terr = ioutil.WriteFile(m.MetaFilePath(), data, 0666)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn data, nil\n}", "title": "" } ]
20de38ace89f6e1ff8d5694ab6027c2c
The app setting name that contains the `clientSecret` value used for Apple Login. !> NOTE: A setting with this name must exist in `appSettings` to function correctly. !> NOTE: A setting with this name must exist in `appSettings` to function correctly. !> NOTE: A setting with this name must exist in `appSettings` to function correctly. !> NOTE: A setting with this name must exist in `appSettings` to function correctly. !> NOTE: A setting with this name must exist in `appSettings` to function correctly.
[ { "docid": "9a014e0872d650e8374e4f1c4fe7e0f5", "score": "0.0", "text": "func (o WindowsFunctionAppSlotAuthSettingsV2CustomOidcV2Output) ClientSecretSettingName() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v WindowsFunctionAppSlotAuthSettingsV2CustomOidcV2) *string { return v.ClientSecretSettingName }).(pulumi.StringPtrOutput)\n}", "title": "" } ]
[ { "docid": "71218302ff582063b15cd269992169b3", "score": "0.7419946", "text": "func (o WindowsFunctionAppAuthSettingsV2AppleV2Output) ClientSecretSettingName() pulumi.StringOutput {\n\treturn o.ApplyT(func(v WindowsFunctionAppAuthSettingsV2AppleV2) string { return v.ClientSecretSettingName }).(pulumi.StringOutput)\n}", "title": "" }, { "docid": "a1311673c97bb98109bddf2c96ad1fa8", "score": "0.7415393", "text": "func (o WindowsWebAppAuthSettingsV2AppleV2Output) ClientSecretSettingName() pulumi.StringOutput {\n\treturn o.ApplyT(func(v WindowsWebAppAuthSettingsV2AppleV2) string { return v.ClientSecretSettingName }).(pulumi.StringOutput)\n}", "title": "" }, { "docid": "028d1341029ebd3e60c442dc944b1eb7", "score": "0.73923856", "text": "func (o WindowsWebAppSlotAuthSettingsV2AppleV2Output) ClientSecretSettingName() pulumi.StringOutput {\n\treturn o.ApplyT(func(v WindowsWebAppSlotAuthSettingsV2AppleV2) string { return v.ClientSecretSettingName }).(pulumi.StringOutput)\n}", "title": "" }, { "docid": "d0c092aeda624e572fb30d9fea870130", "score": "0.73585594", "text": "func (o WindowsFunctionAppSlotAuthSettingsV2AppleV2Output) ClientSecretSettingName() pulumi.StringOutput {\n\treturn o.ApplyT(func(v WindowsFunctionAppSlotAuthSettingsV2AppleV2) string { return v.ClientSecretSettingName }).(pulumi.StringOutput)\n}", "title": "" }, { "docid": "33984faabfca40ce52ce9a5a42bb496f", "score": "0.73196405", "text": "func (o GetLinuxWebAppAuthSettingsV2AppleV2Output) ClientSecretSettingName() pulumi.StringOutput {\n\treturn o.ApplyT(func(v GetLinuxWebAppAuthSettingsV2AppleV2) string { return v.ClientSecretSettingName }).(pulumi.StringOutput)\n}", "title": "" }, { "docid": "8f965ca7454040a5bb065f12cac53e51", "score": "0.7316361", "text": "func (o LinuxFunctionAppAuthSettingsV2AppleV2Output) ClientSecretSettingName() pulumi.StringOutput {\n\treturn o.ApplyT(func(v LinuxFunctionAppAuthSettingsV2AppleV2) string { return v.ClientSecretSettingName }).(pulumi.StringOutput)\n}", "title": "" }, { "docid": "fbdabe344efd097ca04828905e8a1f36", "score": "0.7315658", "text": "func (o LinuxWebAppAuthSettingsV2AppleV2Output) ClientSecretSettingName() pulumi.StringOutput {\n\treturn o.ApplyT(func(v LinuxWebAppAuthSettingsV2AppleV2) string { return v.ClientSecretSettingName }).(pulumi.StringOutput)\n}", "title": "" }, { "docid": "ec596d1361bbbe945620213e806db977", "score": "0.729418", "text": "func (o GetLinuxFunctionAppAuthSettingsV2AppleV2Output) ClientSecretSettingName() pulumi.StringOutput {\n\treturn o.ApplyT(func(v GetLinuxFunctionAppAuthSettingsV2AppleV2) string { return v.ClientSecretSettingName }).(pulumi.StringOutput)\n}", "title": "" }, { "docid": "e7780366b60eb9fd8ef5eba0ee97d483", "score": "0.7269816", "text": "func (o LinuxWebAppSlotAuthSettingsV2AppleV2Output) ClientSecretSettingName() pulumi.StringOutput {\n\treturn o.ApplyT(func(v LinuxWebAppSlotAuthSettingsV2AppleV2) string { return v.ClientSecretSettingName }).(pulumi.StringOutput)\n}", "title": "" }, { "docid": "cb411e58d22392e74bb776793125f29c", "score": "0.72353274", "text": "func (o LinuxFunctionAppSlotAuthSettingsV2AppleV2Output) ClientSecretSettingName() pulumi.StringOutput {\n\treturn o.ApplyT(func(v LinuxFunctionAppSlotAuthSettingsV2AppleV2) string { return v.ClientSecretSettingName }).(pulumi.StringOutput)\n}", "title": "" }, { "docid": "2f6ba5b4716873baf10696ce91f6b3e5", "score": "0.69195175", "text": "func (o WindowsWebAppAuthSettingsV2AppleV2PtrOutput) ClientSecretSettingName() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v *WindowsWebAppAuthSettingsV2AppleV2) *string {\n\t\tif v == nil {\n\t\t\treturn nil\n\t\t}\n\t\treturn &v.ClientSecretSettingName\n\t}).(pulumi.StringPtrOutput)\n}", "title": "" }, { "docid": "f1a70a52600c89610272c5486d5b60ad", "score": "0.6879499", "text": "func (o WindowsFunctionAppAuthSettingsV2AppleV2PtrOutput) ClientSecretSettingName() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v *WindowsFunctionAppAuthSettingsV2AppleV2) *string {\n\t\tif v == nil {\n\t\t\treturn nil\n\t\t}\n\t\treturn &v.ClientSecretSettingName\n\t}).(pulumi.StringPtrOutput)\n}", "title": "" }, { "docid": "40231049412e10ee5d895e918dd8c7fc", "score": "0.68774915", "text": "func (o WindowsWebAppSlotAuthSettingsV2AppleV2PtrOutput) ClientSecretSettingName() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v *WindowsWebAppSlotAuthSettingsV2AppleV2) *string {\n\t\tif v == nil {\n\t\t\treturn nil\n\t\t}\n\t\treturn &v.ClientSecretSettingName\n\t}).(pulumi.StringPtrOutput)\n}", "title": "" }, { "docid": "cacd6b1a1d180763399a2b4f056e1c49", "score": "0.68273777", "text": "func (o WindowsWebAppAuthSettingsV2MicrosoftV2Output) ClientSecretSettingName() pulumi.StringOutput {\n\treturn o.ApplyT(func(v WindowsWebAppAuthSettingsV2MicrosoftV2) string { return v.ClientSecretSettingName }).(pulumi.StringOutput)\n}", "title": "" }, { "docid": "5f2feabdca95bd88f1718515ce6614c8", "score": "0.68220145", "text": "func (o WindowsWebAppAuthSettingsV2GoogleV2Output) ClientSecretSettingName() pulumi.StringOutput {\n\treturn o.ApplyT(func(v WindowsWebAppAuthSettingsV2GoogleV2) string { return v.ClientSecretSettingName }).(pulumi.StringOutput)\n}", "title": "" }, { "docid": "e339874e14d56b756e896fa56fddd633", "score": "0.6821658", "text": "func (o WindowsFunctionAppSlotAuthSettingsV2AppleV2PtrOutput) ClientSecretSettingName() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v *WindowsFunctionAppSlotAuthSettingsV2AppleV2) *string {\n\t\tif v == nil {\n\t\t\treturn nil\n\t\t}\n\t\treturn &v.ClientSecretSettingName\n\t}).(pulumi.StringPtrOutput)\n}", "title": "" }, { "docid": "da7a5337376e6eac387af90b77c15989", "score": "0.6813282", "text": "func (o WindowsWebAppSlotAuthSettingsV2GoogleV2Output) ClientSecretSettingName() pulumi.StringOutput {\n\treturn o.ApplyT(func(v WindowsWebAppSlotAuthSettingsV2GoogleV2) string { return v.ClientSecretSettingName }).(pulumi.StringOutput)\n}", "title": "" }, { "docid": "2bc3b1acc0c08e424682e4b5941752e3", "score": "0.6811357", "text": "func (o WindowsWebAppSlotAuthSettingsV2MicrosoftV2Output) ClientSecretSettingName() pulumi.StringOutput {\n\treturn o.ApplyT(func(v WindowsWebAppSlotAuthSettingsV2MicrosoftV2) string { return v.ClientSecretSettingName }).(pulumi.StringOutput)\n}", "title": "" }, { "docid": "ab776298246ed61550edafd2a9a50141", "score": "0.67989904", "text": "func (o LinuxWebAppAuthSettingsV2AppleV2PtrOutput) ClientSecretSettingName() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v *LinuxWebAppAuthSettingsV2AppleV2) *string {\n\t\tif v == nil {\n\t\t\treturn nil\n\t\t}\n\t\treturn &v.ClientSecretSettingName\n\t}).(pulumi.StringPtrOutput)\n}", "title": "" }, { "docid": "7bb577d82b6c78f862d6daae9a188fe2", "score": "0.6798099", "text": "func (o LinuxWebAppSlotAuthSettingsV2GoogleV2Output) ClientSecretSettingName() pulumi.StringOutput {\n\treturn o.ApplyT(func(v LinuxWebAppSlotAuthSettingsV2GoogleV2) string { return v.ClientSecretSettingName }).(pulumi.StringOutput)\n}", "title": "" }, { "docid": "d327c3be36f807fe0f331fcfc4e4ed0f", "score": "0.6798094", "text": "func (o LinuxWebAppAuthSettingsV2GoogleV2Output) ClientSecretSettingName() pulumi.StringOutput {\n\treturn o.ApplyT(func(v LinuxWebAppAuthSettingsV2GoogleV2) string { return v.ClientSecretSettingName }).(pulumi.StringOutput)\n}", "title": "" }, { "docid": "4983741e5b92616e6c13c5c9aae3ee6f", "score": "0.6795719", "text": "func (o LinuxWebAppAuthSettingsV2MicrosoftV2Output) ClientSecretSettingName() pulumi.StringOutput {\n\treturn o.ApplyT(func(v LinuxWebAppAuthSettingsV2MicrosoftV2) string { return v.ClientSecretSettingName }).(pulumi.StringOutput)\n}", "title": "" }, { "docid": "82e99d6a268b961addcead99026b1a34", "score": "0.67758024", "text": "func (o WindowsFunctionAppAuthSettingsV2MicrosoftV2Output) ClientSecretSettingName() pulumi.StringOutput {\n\treturn o.ApplyT(func(v WindowsFunctionAppAuthSettingsV2MicrosoftV2) string { return v.ClientSecretSettingName }).(pulumi.StringOutput)\n}", "title": "" }, { "docid": "ea017c4f5f14607281fd1c53c9ea2894", "score": "0.6773294", "text": "func (o LinuxWebAppSlotAuthSettingsV2MicrosoftV2Output) ClientSecretSettingName() pulumi.StringOutput {\n\treturn o.ApplyT(func(v LinuxWebAppSlotAuthSettingsV2MicrosoftV2) string { return v.ClientSecretSettingName }).(pulumi.StringOutput)\n}", "title": "" }, { "docid": "82b389062cb752e97881248f34197103", "score": "0.6768641", "text": "func (o GetLinuxWebAppAuthSettingsV2MicrosoftV2Output) ClientSecretSettingName() pulumi.StringOutput {\n\treturn o.ApplyT(func(v GetLinuxWebAppAuthSettingsV2MicrosoftV2) string { return v.ClientSecretSettingName }).(pulumi.StringOutput)\n}", "title": "" }, { "docid": "d9ad925862f4fae64f3d51b3a8ae32a9", "score": "0.6767496", "text": "func (o LinuxFunctionAppAuthSettingsV2GoogleV2Output) ClientSecretSettingName() pulumi.StringOutput {\n\treturn o.ApplyT(func(v LinuxFunctionAppAuthSettingsV2GoogleV2) string { return v.ClientSecretSettingName }).(pulumi.StringOutput)\n}", "title": "" }, { "docid": "f70f9e4d101ef1d68ea5185240b4e456", "score": "0.6766137", "text": "func (o LinuxFunctionAppAuthSettingsV2MicrosoftV2Output) ClientSecretSettingName() pulumi.StringOutput {\n\treturn o.ApplyT(func(v LinuxFunctionAppAuthSettingsV2MicrosoftV2) string { return v.ClientSecretSettingName }).(pulumi.StringOutput)\n}", "title": "" }, { "docid": "776a85a5c20514f7a1dacb3df3453542", "score": "0.6761362", "text": "func (o LinuxFunctionAppAuthSettingsV2AppleV2PtrOutput) ClientSecretSettingName() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v *LinuxFunctionAppAuthSettingsV2AppleV2) *string {\n\t\tif v == nil {\n\t\t\treturn nil\n\t\t}\n\t\treturn &v.ClientSecretSettingName\n\t}).(pulumi.StringPtrOutput)\n}", "title": "" }, { "docid": "1e04b424d10d4d658eed224a9a6a80d5", "score": "0.6753573", "text": "func (o WindowsFunctionAppAuthSettingsV2GoogleV2Output) ClientSecretSettingName() pulumi.StringOutput {\n\treturn o.ApplyT(func(v WindowsFunctionAppAuthSettingsV2GoogleV2) string { return v.ClientSecretSettingName }).(pulumi.StringOutput)\n}", "title": "" }, { "docid": "6e319aa5903cfa4cc5d2a026d071d703", "score": "0.6740022", "text": "func (o LinuxWebAppSlotAuthSettingsV2AppleV2PtrOutput) ClientSecretSettingName() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v *LinuxWebAppSlotAuthSettingsV2AppleV2) *string {\n\t\tif v == nil {\n\t\t\treturn nil\n\t\t}\n\t\treturn &v.ClientSecretSettingName\n\t}).(pulumi.StringPtrOutput)\n}", "title": "" }, { "docid": "8e1ef3848fea57f7335a3c0b1e79323c", "score": "0.673906", "text": "func (o WindowsWebAppAuthSettingsV2GithubV2Output) ClientSecretSettingName() pulumi.StringOutput {\n\treturn o.ApplyT(func(v WindowsWebAppAuthSettingsV2GithubV2) string { return v.ClientSecretSettingName }).(pulumi.StringOutput)\n}", "title": "" }, { "docid": "96cf190fc94a76568373d25241c941b8", "score": "0.67353994", "text": "func (o GetLinuxFunctionAppAuthSettingsV2MicrosoftV2Output) ClientSecretSettingName() pulumi.StringOutput {\n\treturn o.ApplyT(func(v GetLinuxFunctionAppAuthSettingsV2MicrosoftV2) string { return v.ClientSecretSettingName }).(pulumi.StringOutput)\n}", "title": "" }, { "docid": "0c6d1493668cc5ab11492fb30564ba29", "score": "0.6734251", "text": "func (o GetLinuxWebAppAuthSettingsV2GoogleV2Output) ClientSecretSettingName() pulumi.StringOutput {\n\treturn o.ApplyT(func(v GetLinuxWebAppAuthSettingsV2GoogleV2) string { return v.ClientSecretSettingName }).(pulumi.StringOutput)\n}", "title": "" }, { "docid": "a2d267b03226c41c1ffc627e1699e3d8", "score": "0.6720556", "text": "func (o LinuxFunctionAppSlotAuthSettingsV2GoogleV2Output) ClientSecretSettingName() pulumi.StringOutput {\n\treturn o.ApplyT(func(v LinuxFunctionAppSlotAuthSettingsV2GoogleV2) string { return v.ClientSecretSettingName }).(pulumi.StringOutput)\n}", "title": "" }, { "docid": "2a874a79907b1acaed300aa4b578cdab", "score": "0.6719717", "text": "func (o WindowsFunctionAppAuthSettingsV2GithubV2Output) ClientSecretSettingName() pulumi.StringOutput {\n\treturn o.ApplyT(func(v WindowsFunctionAppAuthSettingsV2GithubV2) string { return v.ClientSecretSettingName }).(pulumi.StringOutput)\n}", "title": "" }, { "docid": "6b391ad6c4887020a8da01182e6430f2", "score": "0.67196035", "text": "func (o GetLinuxFunctionAppAuthSettingsV2GoogleV2Output) ClientSecretSettingName() pulumi.StringOutput {\n\treturn o.ApplyT(func(v GetLinuxFunctionAppAuthSettingsV2GoogleV2) string { return v.ClientSecretSettingName }).(pulumi.StringOutput)\n}", "title": "" }, { "docid": "264c5511e72b71225090baef31381c93", "score": "0.6719372", "text": "func (o WindowsFunctionAppSlotAuthSettingsV2MicrosoftV2Output) ClientSecretSettingName() pulumi.StringOutput {\n\treturn o.ApplyT(func(v WindowsFunctionAppSlotAuthSettingsV2MicrosoftV2) string { return v.ClientSecretSettingName }).(pulumi.StringOutput)\n}", "title": "" }, { "docid": "c6806cedc6567b72a4f4badb01ead3ba", "score": "0.67147124", "text": "func (o GetLinuxFunctionAppAuthSettingGithubOutput) ClientSecretSettingName() pulumi.StringOutput {\n\treturn o.ApplyT(func(v GetLinuxFunctionAppAuthSettingGithub) string { return v.ClientSecretSettingName }).(pulumi.StringOutput)\n}", "title": "" }, { "docid": "72bd5a9c3263630ff136a329c001d6fe", "score": "0.6712493", "text": "func (o WindowsFunctionAppSlotAuthSettingsV2GoogleV2Output) ClientSecretSettingName() pulumi.StringOutput {\n\treturn o.ApplyT(func(v WindowsFunctionAppSlotAuthSettingsV2GoogleV2) string { return v.ClientSecretSettingName }).(pulumi.StringOutput)\n}", "title": "" }, { "docid": "e8ed6f41f5aff6f5ddcff345f05cf64b", "score": "0.6710923", "text": "func (o WindowsWebAppSlotAuthSettingsV2GithubV2Output) ClientSecretSettingName() pulumi.StringOutput {\n\treturn o.ApplyT(func(v WindowsWebAppSlotAuthSettingsV2GithubV2) string { return v.ClientSecretSettingName }).(pulumi.StringOutput)\n}", "title": "" }, { "docid": "961061d1f04829b7bc7c4cf47fb5dee9", "score": "0.66992915", "text": "func (o GetLinuxWebAppAuthSettingMicrosoftOutput) ClientSecretSettingName() pulumi.StringOutput {\n\treturn o.ApplyT(func(v GetLinuxWebAppAuthSettingMicrosoft) string { return v.ClientSecretSettingName }).(pulumi.StringOutput)\n}", "title": "" }, { "docid": "714c6db4ed974f3623f2c8e8e7cf62bd", "score": "0.6696894", "text": "func (o LinuxFunctionAppSlotAuthSettingsV2MicrosoftV2Output) ClientSecretSettingName() pulumi.StringOutput {\n\treturn o.ApplyT(func(v LinuxFunctionAppSlotAuthSettingsV2MicrosoftV2) string { return v.ClientSecretSettingName }).(pulumi.StringOutput)\n}", "title": "" }, { "docid": "df2740f85d4b99ec5f6e7610ea0ed292", "score": "0.66881365", "text": "func (o LinuxFunctionAppSlotAuthSettingsV2AppleV2PtrOutput) ClientSecretSettingName() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v *LinuxFunctionAppSlotAuthSettingsV2AppleV2) *string {\n\t\tif v == nil {\n\t\t\treturn nil\n\t\t}\n\t\treturn &v.ClientSecretSettingName\n\t}).(pulumi.StringPtrOutput)\n}", "title": "" }, { "docid": "2f5215c124ed2792a3be64a0bd96319a", "score": "0.6688052", "text": "func (o WindowsFunctionAppAuthSettingsGithubOutput) ClientSecretSettingName() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v WindowsFunctionAppAuthSettingsGithub) *string { return v.ClientSecretSettingName }).(pulumi.StringPtrOutput)\n}", "title": "" }, { "docid": "46db859cc572708819de34e3fcfe31e9", "score": "0.6687", "text": "func (o GetLinuxWebAppAuthSettingsV2ActiveDirectoryV2Output) ClientSecretSettingName() pulumi.StringOutput {\n\treturn o.ApplyT(func(v GetLinuxWebAppAuthSettingsV2ActiveDirectoryV2) string { return v.ClientSecretSettingName }).(pulumi.StringOutput)\n}", "title": "" }, { "docid": "eaa2cfa8f0f87719ff7dbf979fee014b", "score": "0.6685065", "text": "func (o GetLinuxWebAppAuthSettingGithubOutput) ClientSecretSettingName() pulumi.StringOutput {\n\treturn o.ApplyT(func(v GetLinuxWebAppAuthSettingGithub) string { return v.ClientSecretSettingName }).(pulumi.StringOutput)\n}", "title": "" }, { "docid": "ca042e6e0ee16e40838dcb389b0956d4", "score": "0.6672326", "text": "func (o GetLinuxFunctionAppAuthSettingGoogleOutput) ClientSecretSettingName() pulumi.StringOutput {\n\treturn o.ApplyT(func(v GetLinuxFunctionAppAuthSettingGoogle) string { return v.ClientSecretSettingName }).(pulumi.StringOutput)\n}", "title": "" }, { "docid": "afc6b4fb677c25c02c723530fdf5c2e5", "score": "0.6669041", "text": "func (o GetLinuxFunctionAppAuthSettingsV2ActiveDirectoryV2Output) ClientSecretSettingName() pulumi.StringOutput {\n\treturn o.ApplyT(func(v GetLinuxFunctionAppAuthSettingsV2ActiveDirectoryV2) string { return v.ClientSecretSettingName }).(pulumi.StringOutput)\n}", "title": "" }, { "docid": "d7645613ab8fe9aae346db6bbd0c17be", "score": "0.66608083", "text": "func (o GetLinuxFunctionAppAuthSettingMicrosoftOutput) ClientSecretSettingName() pulumi.StringOutput {\n\treturn o.ApplyT(func(v GetLinuxFunctionAppAuthSettingMicrosoft) string { return v.ClientSecretSettingName }).(pulumi.StringOutput)\n}", "title": "" }, { "docid": "3d578a7b0a21223965a0790393065ab2", "score": "0.66587967", "text": "func (o WindowsWebAppAuthSettingsV2ActiveDirectoryV2Output) ClientSecretSettingName() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v WindowsWebAppAuthSettingsV2ActiveDirectoryV2) *string { return v.ClientSecretSettingName }).(pulumi.StringPtrOutput)\n}", "title": "" }, { "docid": "643b04ae4d37617936fcc9e80790cad0", "score": "0.6645324", "text": "func (o WindowsFunctionAppSlotAuthSettingsV2GithubV2Output) ClientSecretSettingName() pulumi.StringOutput {\n\treturn o.ApplyT(func(v WindowsFunctionAppSlotAuthSettingsV2GithubV2) string { return v.ClientSecretSettingName }).(pulumi.StringOutput)\n}", "title": "" }, { "docid": "477c8a753cd16c3744188e861610a84e", "score": "0.6636482", "text": "func (o GetLinuxWebAppAuthSettingGoogleOutput) ClientSecretSettingName() pulumi.StringOutput {\n\treturn o.ApplyT(func(v GetLinuxWebAppAuthSettingGoogle) string { return v.ClientSecretSettingName }).(pulumi.StringOutput)\n}", "title": "" }, { "docid": "7abf30d0bbbc3439590f9a3203f993ac", "score": "0.66274846", "text": "func (o WindowsFunctionAppSlotAuthSettingsGithubOutput) ClientSecretSettingName() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v WindowsFunctionAppSlotAuthSettingsGithub) *string { return v.ClientSecretSettingName }).(pulumi.StringPtrOutput)\n}", "title": "" }, { "docid": "612345c6a757095aa038e342e7678e47", "score": "0.66246647", "text": "func (o WindowsWebAppSlotAuthSettingsV2ActiveDirectoryV2Output) ClientSecretSettingName() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v WindowsWebAppSlotAuthSettingsV2ActiveDirectoryV2) *string { return v.ClientSecretSettingName }).(pulumi.StringPtrOutput)\n}", "title": "" }, { "docid": "1b3a01f2b44fa4ff1389372bab04179e", "score": "0.6621941", "text": "func (o GetLinuxWebAppAuthSettingsV2CustomOidcV2Output) ClientSecretSettingName() pulumi.StringOutput {\n\treturn o.ApplyT(func(v GetLinuxWebAppAuthSettingsV2CustomOidcV2) string { return v.ClientSecretSettingName }).(pulumi.StringOutput)\n}", "title": "" }, { "docid": "3961b416790381d79b4d1396d5cdc61d", "score": "0.66192096", "text": "func (o WindowsWebAppAuthSettingsGithubOutput) ClientSecretSettingName() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v WindowsWebAppAuthSettingsGithub) *string { return v.ClientSecretSettingName }).(pulumi.StringPtrOutput)\n}", "title": "" }, { "docid": "ec2ccc39767aeac25a562a2bc88b7eec", "score": "0.66190207", "text": "func (o LinuxFunctionAppAuthSettingsV2GithubV2Output) ClientSecretSettingName() pulumi.StringOutput {\n\treturn o.ApplyT(func(v LinuxFunctionAppAuthSettingsV2GithubV2) string { return v.ClientSecretSettingName }).(pulumi.StringOutput)\n}", "title": "" }, { "docid": "361c99e8fc1c629879cc6014bfdcfc43", "score": "0.66060466", "text": "func (o LinuxFunctionAppAuthSettingsGoogleOutput) ClientSecretSettingName() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v LinuxFunctionAppAuthSettingsGoogle) *string { return v.ClientSecretSettingName }).(pulumi.StringPtrOutput)\n}", "title": "" }, { "docid": "68d49654acc0d77e6ce8ab5ddb3e5d5e", "score": "0.6600802", "text": "func (o WindowsWebAppSlotAuthSettingsGithubOutput) ClientSecretSettingName() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v WindowsWebAppSlotAuthSettingsGithub) *string { return v.ClientSecretSettingName }).(pulumi.StringPtrOutput)\n}", "title": "" }, { "docid": "083559d316e7f2e3e7fc0106f30adee9", "score": "0.6600304", "text": "func (o LinuxWebAppAuthSettingsV2GithubV2Output) ClientSecretSettingName() pulumi.StringOutput {\n\treturn o.ApplyT(func(v LinuxWebAppAuthSettingsV2GithubV2) string { return v.ClientSecretSettingName }).(pulumi.StringOutput)\n}", "title": "" }, { "docid": "6d4a7844856304ba874dd24120844d82", "score": "0.6596386", "text": "func (o LinuxFunctionAppAuthSettingsGithubOutput) ClientSecretSettingName() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v LinuxFunctionAppAuthSettingsGithub) *string { return v.ClientSecretSettingName }).(pulumi.StringPtrOutput)\n}", "title": "" }, { "docid": "365b54f3128e2374b3422f53a120ec9f", "score": "0.6592643", "text": "func (o GetLinuxWebAppAuthSettingsV2GithubV2Output) ClientSecretSettingName() pulumi.StringOutput {\n\treturn o.ApplyT(func(v GetLinuxWebAppAuthSettingsV2GithubV2) string { return v.ClientSecretSettingName }).(pulumi.StringOutput)\n}", "title": "" }, { "docid": "42014e32c5eed096f503e507e7b7f719", "score": "0.65881926", "text": "func (o WindowsWebAppAuthSettingsMicrosoftOutput) ClientSecretSettingName() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v WindowsWebAppAuthSettingsMicrosoft) *string { return v.ClientSecretSettingName }).(pulumi.StringPtrOutput)\n}", "title": "" }, { "docid": "ecaeff2bee6e155acc6481e7365c6aa5", "score": "0.65877926", "text": "func (o WindowsFunctionAppAuthSettingsV2ActiveDirectoryV2Output) ClientSecretSettingName() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v WindowsFunctionAppAuthSettingsV2ActiveDirectoryV2) *string { return v.ClientSecretSettingName }).(pulumi.StringPtrOutput)\n}", "title": "" }, { "docid": "5a04ca97a84a134e24bbfec43bbb753c", "score": "0.6577634", "text": "func (o WindowsFunctionAppAuthSettingsGoogleOutput) ClientSecretSettingName() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v WindowsFunctionAppAuthSettingsGoogle) *string { return v.ClientSecretSettingName }).(pulumi.StringPtrOutput)\n}", "title": "" }, { "docid": "a69c84abc559fcf981a766c45b32af6e", "score": "0.65745825", "text": "func (o GetLinuxWebAppAuthSettingActiveDirectoryOutput) ClientSecretSettingName() pulumi.StringOutput {\n\treturn o.ApplyT(func(v GetLinuxWebAppAuthSettingActiveDirectory) string { return v.ClientSecretSettingName }).(pulumi.StringOutput)\n}", "title": "" }, { "docid": "c88dff78754466ca4db14a1bc53fa531", "score": "0.6570997", "text": "func (o WindowsWebAppAuthSettingsGoogleOutput) ClientSecretSettingName() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v WindowsWebAppAuthSettingsGoogle) *string { return v.ClientSecretSettingName }).(pulumi.StringPtrOutput)\n}", "title": "" }, { "docid": "a07f68720dcfb416b2920dd9d2d4dcf0", "score": "0.65684545", "text": "func (o GetLinuxFunctionAppAuthSettingActiveDirectoryOutput) ClientSecretSettingName() pulumi.StringOutput {\n\treturn o.ApplyT(func(v GetLinuxFunctionAppAuthSettingActiveDirectory) string { return v.ClientSecretSettingName }).(pulumi.StringOutput)\n}", "title": "" }, { "docid": "1b6524eec40cbff10dff1406dfb5c09c", "score": "0.6566425", "text": "func (o GetLinuxFunctionAppAuthSettingsV2GithubV2Output) ClientSecretSettingName() pulumi.StringOutput {\n\treturn o.ApplyT(func(v GetLinuxFunctionAppAuthSettingsV2GithubV2) string { return v.ClientSecretSettingName }).(pulumi.StringOutput)\n}", "title": "" }, { "docid": "ce3269c3ccbffdd8c3513b3581f70e12", "score": "0.6566003", "text": "func (o LinuxWebAppSlotAuthSettingsV2GithubV2Output) ClientSecretSettingName() pulumi.StringOutput {\n\treturn o.ApplyT(func(v LinuxWebAppSlotAuthSettingsV2GithubV2) string { return v.ClientSecretSettingName }).(pulumi.StringOutput)\n}", "title": "" }, { "docid": "f4c22badf8dc65037d454f179b54dd57", "score": "0.65635127", "text": "func (o LinuxWebAppSlotAuthSettingsGoogleOutput) ClientSecretSettingName() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v LinuxWebAppSlotAuthSettingsGoogle) *string { return v.ClientSecretSettingName }).(pulumi.StringPtrOutput)\n}", "title": "" }, { "docid": "62cd01e5f38ef25f3227ceeddc15b6f9", "score": "0.65626645", "text": "func (o LinuxWebAppAuthSettingsGoogleOutput) ClientSecretSettingName() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v LinuxWebAppAuthSettingsGoogle) *string { return v.ClientSecretSettingName }).(pulumi.StringPtrOutput)\n}", "title": "" }, { "docid": "ef50c25395effd15abafd834c07650c8", "score": "0.65625185", "text": "func (o WindowsWebAppSlotAuthSettingsGoogleOutput) ClientSecretSettingName() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v WindowsWebAppSlotAuthSettingsGoogle) *string { return v.ClientSecretSettingName }).(pulumi.StringPtrOutput)\n}", "title": "" }, { "docid": "17563c0cebbca39b1d23173d62115685", "score": "0.6554819", "text": "func (o GetLinuxFunctionAppAuthSettingsV2CustomOidcV2Output) ClientSecretSettingName() pulumi.StringOutput {\n\treturn o.ApplyT(func(v GetLinuxFunctionAppAuthSettingsV2CustomOidcV2) string { return v.ClientSecretSettingName }).(pulumi.StringOutput)\n}", "title": "" }, { "docid": "c02b5c797d669a331c957721276c594a", "score": "0.65537655", "text": "func (o LinuxFunctionAppSlotAuthSettingsGoogleOutput) ClientSecretSettingName() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v LinuxFunctionAppSlotAuthSettingsGoogle) *string { return v.ClientSecretSettingName }).(pulumi.StringPtrOutput)\n}", "title": "" }, { "docid": "dac30ca120dd5e4ba86248f555a7efbe", "score": "0.6542757", "text": "func (o LinuxWebAppAuthSettingsMicrosoftOutput) ClientSecretSettingName() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v LinuxWebAppAuthSettingsMicrosoft) *string { return v.ClientSecretSettingName }).(pulumi.StringPtrOutput)\n}", "title": "" }, { "docid": "b7a88de92e1bac1a69d92dd9ff817f7c", "score": "0.653954", "text": "func (o WindowsWebAppSlotAuthSettingsMicrosoftOutput) ClientSecretSettingName() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v WindowsWebAppSlotAuthSettingsMicrosoft) *string { return v.ClientSecretSettingName }).(pulumi.StringPtrOutput)\n}", "title": "" }, { "docid": "590c101c1aa5b2a0304a17b5d4de6e7b", "score": "0.65381706", "text": "func (o WindowsFunctionAppAuthSettingsMicrosoftOutput) ClientSecretSettingName() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v WindowsFunctionAppAuthSettingsMicrosoft) *string { return v.ClientSecretSettingName }).(pulumi.StringPtrOutput)\n}", "title": "" }, { "docid": "0052d5796dba1f4cc618f2a6ee772ec8", "score": "0.65375066", "text": "func (o LinuxFunctionAppAuthSettingsMicrosoftOutput) ClientSecretSettingName() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v LinuxFunctionAppAuthSettingsMicrosoft) *string { return v.ClientSecretSettingName }).(pulumi.StringPtrOutput)\n}", "title": "" }, { "docid": "2f356f86c76fe95f9b67c7e7f5fa9b12", "score": "0.6537171", "text": "func (o LinuxWebAppAuthSettingsV2ActiveDirectoryV2Output) ClientSecretSettingName() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v LinuxWebAppAuthSettingsV2ActiveDirectoryV2) *string { return v.ClientSecretSettingName }).(pulumi.StringPtrOutput)\n}", "title": "" }, { "docid": "2990dae62c91ef6a81512a445e865e7b", "score": "0.6532872", "text": "func (o WindowsWebAppAuthSettingsActiveDirectoryOutput) ClientSecretSettingName() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v WindowsWebAppAuthSettingsActiveDirectory) *string { return v.ClientSecretSettingName }).(pulumi.StringPtrOutput)\n}", "title": "" }, { "docid": "ca2a276c04b133dd89e29318202680ec", "score": "0.6532666", "text": "func (o LinuxFunctionAppSlotAuthSettingsV2GithubV2Output) ClientSecretSettingName() pulumi.StringOutput {\n\treturn o.ApplyT(func(v LinuxFunctionAppSlotAuthSettingsV2GithubV2) string { return v.ClientSecretSettingName }).(pulumi.StringOutput)\n}", "title": "" }, { "docid": "32101df460df915a3abed887f37e6ed3", "score": "0.6528198", "text": "func (o WindowsFunctionAppSlotAuthSettingsGoogleOutput) ClientSecretSettingName() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v WindowsFunctionAppSlotAuthSettingsGoogle) *string { return v.ClientSecretSettingName }).(pulumi.StringPtrOutput)\n}", "title": "" }, { "docid": "77bf4f5c1e01c0f5dada665514ea490b", "score": "0.6519849", "text": "func (o WindowsWebAppAuthSettingsV2CustomOidcV2Output) ClientSecretSettingName() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v WindowsWebAppAuthSettingsV2CustomOidcV2) *string { return v.ClientSecretSettingName }).(pulumi.StringPtrOutput)\n}", "title": "" }, { "docid": "ad1d3f5bb65a7554fb0cf90fc06b293a", "score": "0.6507086", "text": "func (o LinuxFunctionAppAuthSettingsV2ActiveDirectoryV2Output) ClientSecretSettingName() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v LinuxFunctionAppAuthSettingsV2ActiveDirectoryV2) *string { return v.ClientSecretSettingName }).(pulumi.StringPtrOutput)\n}", "title": "" }, { "docid": "7c0f882f34b7d63cdad42d5bc41f4013", "score": "0.6495811", "text": "func (o LinuxFunctionAppSlotAuthSettingsGithubOutput) ClientSecretSettingName() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v LinuxFunctionAppSlotAuthSettingsGithub) *string { return v.ClientSecretSettingName }).(pulumi.StringPtrOutput)\n}", "title": "" }, { "docid": "eef693f4682784bf37db07eebc08a69e", "score": "0.64903206", "text": "func (o LinuxWebAppSlotAuthSettingsV2ActiveDirectoryV2Output) ClientSecretSettingName() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v LinuxWebAppSlotAuthSettingsV2ActiveDirectoryV2) *string { return v.ClientSecretSettingName }).(pulumi.StringPtrOutput)\n}", "title": "" }, { "docid": "3ef6c7ad2d22d8684f49257fe1c01e5e", "score": "0.6489881", "text": "func (o LinuxWebAppAuthSettingsGithubOutput) ClientSecretSettingName() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v LinuxWebAppAuthSettingsGithub) *string { return v.ClientSecretSettingName }).(pulumi.StringPtrOutput)\n}", "title": "" }, { "docid": "4af9676c8a78119dd0898b5f0aedbca9", "score": "0.6488526", "text": "func (o WindowsFunctionAppAuthSettingsActiveDirectoryOutput) ClientSecretSettingName() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v WindowsFunctionAppAuthSettingsActiveDirectory) *string { return v.ClientSecretSettingName }).(pulumi.StringPtrOutput)\n}", "title": "" }, { "docid": "531ef88f048f9a88a166597b8acba476", "score": "0.64881206", "text": "func (o LinuxWebAppSlotAuthSettingsMicrosoftOutput) ClientSecretSettingName() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v LinuxWebAppSlotAuthSettingsMicrosoft) *string { return v.ClientSecretSettingName }).(pulumi.StringPtrOutput)\n}", "title": "" }, { "docid": "7638b566d85c0418ec65df874848e939", "score": "0.6476741", "text": "func (o WindowsWebAppSlotAuthSettingsActiveDirectoryOutput) ClientSecretSettingName() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v WindowsWebAppSlotAuthSettingsActiveDirectory) *string { return v.ClientSecretSettingName }).(pulumi.StringPtrOutput)\n}", "title": "" }, { "docid": "014af1a866eb670cf98a382d9add4a7f", "score": "0.6476593", "text": "func (o WindowsFunctionAppAuthSettingsV2CustomOidcV2Output) ClientSecretSettingName() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v WindowsFunctionAppAuthSettingsV2CustomOidcV2) *string { return v.ClientSecretSettingName }).(pulumi.StringPtrOutput)\n}", "title": "" }, { "docid": "4fb34e2fd0884ffcd0809ca1bc7a9622", "score": "0.6473254", "text": "func (o WindowsWebAppSlotAuthSettingsV2GoogleV2PtrOutput) ClientSecretSettingName() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v *WindowsWebAppSlotAuthSettingsV2GoogleV2) *string {\n\t\tif v == nil {\n\t\t\treturn nil\n\t\t}\n\t\treturn &v.ClientSecretSettingName\n\t}).(pulumi.StringPtrOutput)\n}", "title": "" }, { "docid": "d694ae5cab28ff2b8975cc668d5ba458", "score": "0.64728427", "text": "func (o WindowsWebAppAuthSettingsV2GoogleV2PtrOutput) ClientSecretSettingName() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v *WindowsWebAppAuthSettingsV2GoogleV2) *string {\n\t\tif v == nil {\n\t\t\treturn nil\n\t\t}\n\t\treturn &v.ClientSecretSettingName\n\t}).(pulumi.StringPtrOutput)\n}", "title": "" }, { "docid": "4de0cca0c7dc40221c171d41f98812cb", "score": "0.64543205", "text": "func (o WindowsFunctionAppSlotAuthSettingsMicrosoftOutput) ClientSecretSettingName() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v WindowsFunctionAppSlotAuthSettingsMicrosoft) *string { return v.ClientSecretSettingName }).(pulumi.StringPtrOutput)\n}", "title": "" }, { "docid": "e82b2e2bafef9df7df8e52e6d675602d", "score": "0.6445556", "text": "func (o LinuxWebAppSlotAuthSettingsGithubOutput) ClientSecretSettingName() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v LinuxWebAppSlotAuthSettingsGithub) *string { return v.ClientSecretSettingName }).(pulumi.StringPtrOutput)\n}", "title": "" }, { "docid": "57b5a4675c11d69deafd6e04687e24fe", "score": "0.6435613", "text": "func (o LinuxFunctionAppAuthSettingsActiveDirectoryOutput) ClientSecretSettingName() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v LinuxFunctionAppAuthSettingsActiveDirectory) *string { return v.ClientSecretSettingName }).(pulumi.StringPtrOutput)\n}", "title": "" }, { "docid": "56d07f771ca179cd2a8d6c5964dae4c1", "score": "0.6432906", "text": "func (o WindowsFunctionAppSlotAuthSettingsV2ActiveDirectoryV2Output) ClientSecretSettingName() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v WindowsFunctionAppSlotAuthSettingsV2ActiveDirectoryV2) *string {\n\t\treturn v.ClientSecretSettingName\n\t}).(pulumi.StringPtrOutput)\n}", "title": "" }, { "docid": "3a96b13827dd8337adaf45b88f441198", "score": "0.6431994", "text": "func (o LinuxFunctionAppSlotAuthSettingsMicrosoftOutput) ClientSecretSettingName() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v LinuxFunctionAppSlotAuthSettingsMicrosoft) *string { return v.ClientSecretSettingName }).(pulumi.StringPtrOutput)\n}", "title": "" }, { "docid": "dec0b8c79c776fdcf44d1595168e6c2a", "score": "0.6426999", "text": "func (o LinuxWebAppAuthSettingsActiveDirectoryOutput) ClientSecretSettingName() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v LinuxWebAppAuthSettingsActiveDirectory) *string { return v.ClientSecretSettingName }).(pulumi.StringPtrOutput)\n}", "title": "" }, { "docid": "b6c56abecada237554e636c7a1f00da0", "score": "0.6423304", "text": "func (o LinuxWebAppAuthSettingsV2CustomOidcV2Output) ClientSecretSettingName() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v LinuxWebAppAuthSettingsV2CustomOidcV2) *string { return v.ClientSecretSettingName }).(pulumi.StringPtrOutput)\n}", "title": "" } ]